* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}

html, body {
    width: 100%;
    height: 100%;
    width: 100dvw;
    height: 100dvh;
    background: #000;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    position: fixed;
    inset: 0;
}

.layout {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
}

#game {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    object-position: center;
    background: #000;
}

.touch-controls {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    height: 120px;
    padding: 8px 16px calc(12px + env(safe-area-inset-bottom));
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.55) 45%);
    pointer-events: none;
}

.layout.has-touch .touch-controls {
    display: flex;
}

.layout.is-mobile.is-landscape .touch-controls {
    inset: 0;
    height: auto;
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
    background: none;
    align-items: flex-start;
    justify-content: space-between;
}

.pad {
    display: flex;
    gap: 12px;
    align-items: center;
    pointer-events: none;
}

.pad-right {
    margin-left: auto;
}

.btn {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    min-height: 56px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    touch-action: none;
    pointer-events: auto;
}

.btn[data-action="left"]::before { content: "◀"; }
.btn[data-action="right"]::before { content: "▶"; }
.btn[data-action="jump"]::before { content: "▲"; }
.btn[data-action="enter"]::before { content: "Reiniciar"; }

.btn:active,
.btn.is-down {
    background: rgba(255, 255, 255, 0.36);
}

.btn-jump {
    min-width: 88px;
    min-height: 64px;
}

.btn-enter {
    font-size: 16px;
    padding: 0 16px;
    min-width: 110px;
}

.layout.is-mobile.is-landscape .btn {
    min-width: 56px;
    min-height: 48px;
    width: 56px;
    height: 48px;
    font-size: 18px;
    padding: 0;
}

.layout.is-mobile.is-landscape .btn-jump {
    min-width: 56px;
    min-height: 48px;
}

.layout.is-mobile.is-landscape .btn-enter {
    min-width: 88px;
    width: auto;
    font-size: 13px;
    padding: 0 10px;
}
