:root {
    --fondo: #070912;
    --texto: #f4f1ff;
    --celeste: #5cc8ff;
    --fucsia: #ff3fa4;
    --oro: #f2c14e;
    --vidrio: rgba(20, 16, 40, 0.55);
    --borde: rgba(255, 255, 255, 0.22);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--fondo);
    color: var(--texto);
    font-family: Rubik, system-ui, sans-serif;
    overflow: hidden;
    overflow-x: clip;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#escenario {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: radial-gradient(ellipse at 50% 60%, #151432 0%, var(--fondo) 70%);
}

#juego {
    display: block;
    max-width: 100vw;
    max-height: 100vh;
    touch-action: none;
    image-rendering: auto;
    border-radius: 6px;
    box-shadow: 0 0 60px rgba(92, 200, 255, 0.08), 0 0 60px rgba(255, 63, 164, 0.08);
}

/* ---------- Controles táctiles ---------- */
#tactil {
    position: fixed;
    inset: auto 0 0 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    pointer-events: none;
    touch-action: none;
}

#tactil[hidden] { display: none; }

#tactil button {
    pointer-events: auto;
    touch-action: none;
    border: 2px solid var(--borde);
    background: var(--vidrio);
    color: var(--texto);
    font: 700 15px Rubik, system-ui, sans-serif;
    border-radius: 50%;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0.8;
}

#tactil button.on { background: rgba(255, 255, 255, 0.35); opacity: 1; }

.cruz {
    display: grid;
    grid-template-columns: repeat(3, 54px);
    grid-template-rows: repeat(3, 54px);
    gap: 2px;
}

.cruz button { width: 54px; height: 54px; font-size: 20px !important; border-radius: 14px !important; }
.cruz .arr { grid-area: 1 / 2; }
.cruz .izq { grid-area: 2 / 1; }
.cruz .der { grid-area: 2 / 3; }
.cruz .aba { grid-area: 3 / 2; }

.botones {
    display: grid;
    grid-template-columns: 70px 70px;
    grid-template-rows: 70px 70px;
    gap: 8px;
}

.botones button { width: 70px; height: 70px; }
.botones .golpe { grid-area: 2 / 1; border-color: var(--celeste) !important; }
.botones .patada { grid-area: 2 / 2; border-color: var(--fucsia) !important; }
.botones .especial { grid-area: 1 / 2; border-color: var(--oro) !important; font-size: 12px !important; }

#mudo {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--borde);
    background: var(--vidrio);
    color: var(--texto);
    font-size: 18px;
    cursor: pointer;
    opacity: 0.75;
}

#mudo:hover { opacity: 1; }

/* ---------- Celu vertical ---------- */
#girar {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 16px;
    text-align: center;
    background: var(--fondo);
    font: 400 22px Bungee, Rubik, sans-serif;
    color: var(--oro);
}

#girar span { font-size: 54px; }

@media (orientation: portrait) and (pointer: coarse) {
    #girar { display: flex; }
}

.sin-js {
    position: fixed;
    inset: 40% 16px auto;
    text-align: center;
}
