:root {
    --language-flags-build: 20260522;
    --game-bg: #020617;
    --game-panel: rgba(15, 23, 42, 0.94);
    --game-panel-border: rgba(255, 255, 255, 0.1);
    --game-text: #f8fafc;
    --game-muted: #cbd5e1;
    --game-accent: #38bdf8;
    --game-accent-2: #a855f7;
    --game-danger: #ef4444;
    --game-success: #22c55e;
    --game-radius: 20px;
}

body.game-page {
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: var(--arcade-viewport-height, 100dvh);
    overflow-x: hidden;
    overscroll-behavior: none;
    touch-action: none;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

.game-shell {
    width: min(1180px, calc(100% - 24px), calc(var(--arcade-viewport-width, 100dvw) - 16px));
    min-height: 100vh;
    min-height: 100dvh;
    min-height: var(--arcade-viewport-height, 100dvh);
    margin: 0 auto;
    padding: 18px 0 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

body.game-page,
body.game-page *,
body.game-page button,
body.game-page a,
body.game-page canvas,
body.game-page [data-arcade-controls],
body.game-page [data-arcade-controls] *,
body.game-page [data-game-stage],
body.game-page [data-game-stage] *,
.arcade-button,
.game-button,
.game-info-button,
.game-settings-button,
.game-fullscreen-button,
.game-share-button,
.game-pause-ui-button,
.arcade-control,
.arcade-joystick,
.arcade-joystick *,
.arcade-touchpad,
.arcade-touchpad *,
.arcade-buttons,
.arcade-buttons * {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    -webkit-tap-highlight-color: transparent;
}

@supports selector(html:has(body.game-page)) {
    html:has(body.game-page) {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-user-drag: none;
        -webkit-tap-highlight-color: transparent;
    }
}

body.game-page input,
body.game-page textarea,
body.game-page select {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
    -webkit-user-drag: auto;
    touch-action: manipulation;
}

.game-info-modal__box,
.game-settings-modal__box,
.game-overlay__box,
.game-ranking__list,
.ranking-modal__list {
    touch-action: pan-y;
}

.game-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--game-panel-border);
    border-radius: var(--game-radius);
    background: var(--game-panel);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.26);
}

.game-topbar__left {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.game-back {
    color: var(--game-accent);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
}

.game-title-row,
.game-landscape-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-title-row {
    flex-wrap: wrap;
}

.game-landscape-title-row {
    justify-content: space-between;
}

.game-title {
    margin: 0;
    font-size: clamp(1.4rem, 5vw, 2.2rem);
    line-height: 1.05;
}

.game-subtitle {
    margin: 0;
    color: var(--game-muted);
    font-size: 0.95rem;
}

.game-topbar__right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-stat {
    min-width: 86px;
    padding: 9px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    text-align: center;
}

.game-stat__label {
    display: block;
    color: var(--game-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.game-stat__value {
    display: block;
    margin-top: 2px;
    color: var(--game-text);
    font-size: 1.25rem;
    font-weight: 900;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 14px;
    align-items: start;
}

.game-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.game-stage-wrap {
    position: relative;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--game-radius);
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.10), transparent 30%),
        linear-gradient(135deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.96));
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.03),
        0 24px 80px rgba(0, 0, 0, 0.30);
    overflow: hidden;
    touch-action: none;
}

.game-stage {
    position: relative;
    width: min(100%, 680px, var(--game-viewport-stage-max, 680px));
    max-width: min(100%, 680px, var(--game-viewport-stage-max, 680px));
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    display: grid;
    place-items: center;
    border-radius: 18px;
    overflow: hidden;
    background: #020617;
    box-shadow:
        0 0 0 2px rgba(148, 163, 184, 0.22),
        0 0 0 8px rgba(15, 23, 42, 0.92),
        0 10px 30px rgba(0, 0, 0, 0.35);
}

.game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #020617;
}

.game-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.04),
        inset 0 0 40px rgba(0, 0, 0, 0.18);
}

.game-overlay {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    padding: 24px;
    background: rgba(2, 6, 23, 0.74);
    backdrop-filter: blur(8px);
    text-align: center;
    z-index: 20;
}

.game-overlay.is-visible {
    display: grid;
}

.game-overlay:not(.has-score-form):not(.is-ranking-view) {
    padding: 24px;
}

.game-overlay__box {
    width: min(420px, 100%);
    padding: 24px;
    border-radius: 22px;
    border: 1px solid var(--game-panel-border);
    background: rgba(15, 23, 42, 0.96);
}

.game-overlay:not(.has-score-form):not(.is-ranking-view) .game-overlay__box {
    width: min(420px, 100%);
    max-height: calc(100% - 8px);
    padding: 24px;
    overflow: hidden;
}

.game-overlay h2 {
    margin: 0 0 10px;
    font-size: 1.7rem;
}

.game-overlay:not(.has-score-form):not(.is-ranking-view) h2 {
    margin-bottom: 10px;
    font-size: 2rem;
    line-height: 1.08;
}

.game-overlay p {
    margin: 0 0 18px;
    color: var(--game-muted);
    line-height: 1.5;
}

.game-overlay:not(.has-score-form):not(.is-ranking-view) p {
    margin-bottom: 18px;
    font-size: 1.1rem;
    line-height: 1.42;
}

.game-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.game-overlay:not(.has-score-form):not(.is-ranking-view) .game-actions {
    gap: 10px;
}

.arcade-button,
.game-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--game-accent);
    color: #020617;
    font: inherit;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
}

.arcade-button:hover,
.game-button:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.arcade-button:active,
.game-button:active {
    transform: translateY(1px) scale(0.98);
}

.game-button.is-gamepad-focused,
.game-settings-modal .is-gamepad-focused {
    outline: 3px solid rgba(255, 255, 255, 0.94);
    outline-offset: 3px;
    filter: brightness(1.08);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.5);
}

.game-button--secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--game-text);
}

.game-button--danger {
    background: var(--game-danger);
    color: #fff;
}

/* ---------------------------- */
/* Formulario ranking */
/* ---------------------------- */

.game-score-form {
    width: 100%;
    margin: 16px 0 18px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(168, 85, 247, 0.08)),
        rgba(255, 255, 255, 0.03);
    text-align: left;
}

.game-score-form[hidden] {
    display: none !important;
}

.game-score-form__label {
    display: block;
    margin-bottom: 8px;
    color: var(--game-text);
    font-size: 0.9rem;
    font-weight: 900;
}

.game-score-form__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.game-score-form__input {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.72);
    color: var(--game-text);
    font: inherit;
    font-weight: 800;
    outline: none;
    text-transform: uppercase;
}

.game-score-form__input::placeholder {
    color: rgba(203, 213, 225, 0.62);
    text-transform: none;
}

.game-score-form__input:focus {
    border-color: rgba(56, 189, 248, 0.9);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

.game-score-form__button {
    min-height: 44px;
    padding: 0 16px;
}

.game-score-form__message {
    min-height: 1.3em;
    margin: 8px 0 0 !important;
    color: var(--game-muted);
    font-size: 0.86rem;
    line-height: 1.35;
}

.game-score-form__message.is-error {
    color: #fecaca;
}

.game-score-form__message.is-success {
    color: #bbf7d0;
}

.game-score-form.is-saving {
    opacity: 0.75;
    pointer-events: none;
}

.game-side-panel {
    padding: 18px;
    border: 1px solid var(--game-panel-border);
    border-radius: var(--game-radius);
    background: var(--game-panel);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.game-info-modal__backdrop {
    display: none;
}

.game-info-modal__box {
    position: relative;
    z-index: 1;
}

.game-side-panel h2,
.game-side-panel h3 {
    margin: 0 0 12px;
}

.game-side-panel p {
    margin: 0 0 12px;
    color: var(--game-muted);
    line-height: 1.5;
}

.game-side-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.game-info-title-row {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.game-info-title-row h2 {
    flex: 0 1 auto;
    margin: 0;
}

.game-info-device-icons {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

.game-info-device-icon,
.game-instruction-group__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(56, 189, 248, 0.28);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.82);
    color: var(--game-accent);
    box-shadow: inset 0 0 18px rgba(56, 189, 248, 0.10);
}

.game-info-device-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.game-info-device-icon.is-active {
    border-color: rgba(56, 189, 248, 0.72);
    background: rgba(8, 47, 73, 0.86);
    box-shadow:
        inset 0 0 22px rgba(56, 189, 248, 0.20),
        0 0 18px rgba(56, 189, 248, 0.16);
}

.game-info-device-icon:focus-visible {
    outline: 3px solid rgba(56, 189, 248, 0.42);
    outline-offset: 3px;
}

.game-info-device-icon svg,
.game-instruction-group__icon svg {
    width: 62%;
    height: 62%;
    fill: currentColor;
}

.game-instruction-groups {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.game-instruction-group[hidden] {
    display: none;
}

.game-instruction-group {
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.10), transparent 40%),
        rgba(15, 23, 42, 0.74);
}

.game-instruction-group__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.game-instruction-group__icon {
    width: 42px;
    height: 42px;
}

.game-instruction-group__header h3 {
    margin: 0;
    color: var(--game-text);
    font-size: clamp(1rem, 2.5vw, 1.15rem);
}

.game-instructions {
    padding-left: 18px;
    margin: 0;
    color: var(--game-muted);
    line-height: 1.6;
}

.game-instructions--group {
    padding-left: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.game-info-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--game-accent);
    font: inherit;
    font-size: 1.25rem;
    font-weight: 900;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.game-info-button:hover {
    background: rgba(255, 255, 255, 0.16);
}

.game-info-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--game-text);
    font: inherit;
    font-size: 1.5rem;
    font-weight: 900;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.is-hidden {
    display: none !important;
}

/* ---------------------------- */
/* Botón pausa dibujado por CSS */
/* ---------------------------- */

.game-pause-ui-button {
    --pause-icon-color: #08111f;
    --pause-bar-width: 4px;
    --pause-bar-height: 16px;
    --pause-bar-gap: 4px;

    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.95), rgba(168, 85, 247, 0.9));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 8px 18px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    -webkit-appearance: none;
    transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.game-pause-ui-button:hover {
    filter: brightness(1.04);
}

.game-pause-ui-button:active {
    transform: scale(0.96);
}

.game-pause-ui-button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.35);
    outline-offset: 2px;
}

.game-pause-ui-button__icon {
    position: relative;
    display: block;
    width: calc((var(--pause-bar-width) * 2) + var(--pause-bar-gap));
    height: var(--pause-bar-height);
}

.game-pause-ui-button__icon::before,
.game-pause-ui-button__icon::after {
    content: "";
    position: absolute;
    top: 50%;
    width: var(--pause-bar-width);
    height: var(--pause-bar-height);
    background: var(--pause-icon-color);
    border-radius: 2px;
    transform: translateY(-50%);
}

.game-pause-ui-button__icon::before {
    left: 0;
}

.game-pause-ui-button__icon::after {
    right: 0;
}

/* ---------------------------- */
/* Botones de ajustes / pantalla completa */
/* ---------------------------- */

.game-settings-button,
.game-fullscreen-button,
.game-share-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--game-accent);
    font: inherit;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.game-settings-button svg,
.game-fullscreen-button__svg,
.game-share-button__svg {
    display: block;
    width: 21px;
    height: 21px;
    fill: currentColor;
    color: inherit;
    pointer-events: none;
}

.game-settings-button:hover,
.game-fullscreen-button:hover,
.game-share-button:hover {
    background: rgba(255, 255, 255, 0.16);
}

.game-overlay:not(.has-score-form):not(.is-ranking-view) .game-button {
    min-height: 48px;
    padding-inline: 22px;
    font-size: 1.05rem;
}

.game-settings-button:active,
.game-fullscreen-button:active,
.game-share-button:active {
    transform: scale(0.96);
}

.game-fullscreen-button__svg--compress {
    display: none;
}

.game-fullscreen-button.is-fullscreen .game-fullscreen-button__svg--expand {
    display: none;
}

.game-fullscreen-button.is-fullscreen .game-fullscreen-button__svg--compress {
    display: block;
}

.game-fullscreen-button--landscape {
    width: clamp(34px, 8.5dvh, 38px);
    height: clamp(34px, 8.5dvh, 38px);
    min-width: clamp(34px, 8.5dvh, 38px);
    min-height: clamp(34px, 8.5dvh, 38px);
}

.game-fullscreen-button--landscape .game-fullscreen-button__svg {
    width: clamp(18px, 4.2dvh, 21px);
    height: clamp(18px, 4.2dvh, 21px);
}

/* ---------------------------- */
/* Modal de ajustes */
/* ---------------------------- */

.game-settings-modal {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: none;
    place-items: center;
    padding: 18px;
}

.game-settings-modal.is-visible {
    display: grid;
}

.game-settings-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(8px);
}

.game-settings-modal__box {
    position: relative;
    z-index: 1;
    width: min(430px, 100%);
    padding: 20px;
    border: 1px solid var(--game-panel-border);
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.98);
    box-shadow: 0 24px 90px rgba(0, 0, 0, 0.45);
    color: var(--game-text);
}

.game-settings-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.game-settings-modal__header h2 {
    margin: 0;
    font-size: 1.55rem;
}

.game-settings-modal__actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.game-fullscreen-button--settings,
.game-share-button--settings {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
}

.game-share-button.is-copied {
    color: var(--game-success);
    background: rgba(34, 197, 94, 0.12);
}

.game-settings-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--game-text);
    font: inherit;
    font-size: 1.5rem;
    font-weight: 900;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.game-settings-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 14px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.game-settings-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--game-text);
    font-weight: 800;
    cursor: pointer;
}

.game-settings-toggle input {
    width: 20px;
    height: 20px;
    accent-color: var(--game-accent);
}

.game-settings-label {
    color: var(--game-text);
    font-weight: 800;
}

.game-settings-select {
    width: 100%;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(56, 189, 248, 0.28);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.76);
    color: var(--game-text);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.game-language-switch {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.game-language-switch__button {
    display: inline-grid;
    place-items: center;
    width: 46px;
    height: 42px;
    border: 1px solid rgba(56, 189, 248, 0.28);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.76);
    color: var(--game-text);
    font: inherit;
    font-size: 1.18rem;
    cursor: pointer;
}

.game-language-switch .language-flag {
    display: block;
    position: relative;
    width: 24px;
    height: 16px;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
    overflow: hidden;
}

.game-language-switch .language-flag--es {
    background: linear-gradient(#c60b1e 0 25%, #ffc400 25% 75%, #c60b1e 75%);
}

.game-language-switch .language-flag--en {
    background: #012169 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 40'%3E%3Cpath fill='%23012169' d='M0 0h60v40H0z'/%3E%3Cpath stroke='%23fff' stroke-width='8' d='m0 0 60 40M60 0 0 40'/%3E%3Cpath stroke='%23c8102e' stroke-width='4' d='m0 0 60 40M60 0 0 40'/%3E%3Cpath stroke='%23fff' stroke-width='13' d='M30 0v40M0 20h60'/%3E%3Cpath stroke='%23c8102e' stroke-width='7' d='M30 0v40M0 20h60'/%3E%3C/svg%3E") center / cover no-repeat;
}

.game-language-switch .language-flag--en::before,
.game-language-switch .language-flag--en::after {
    content: "";
    display: none;
    position: absolute;
    inset: 0;
}

.game-language-switch .language-flag--en::before {
    background:
        linear-gradient(32deg, transparent 0 42%, #fff 42% 49%, #c8102e 49% 54%, #fff 54% 61%, transparent 61%),
        linear-gradient(148deg, transparent 0 42%, #fff 42% 49%, #c8102e 49% 54%, #fff 54% 61%, transparent 61%);
}

.game-language-switch .language-flag--en::after {
    background:
        linear-gradient(90deg, transparent 0 41%, #fff 41% 59%, transparent 59%),
        linear-gradient(0deg, transparent 0 36%, #fff 36% 64%, transparent 64%),
        linear-gradient(90deg, transparent 0 45%, #c8102e 45% 55%, transparent 55%),
        linear-gradient(0deg, transparent 0 42%, #c8102e 42% 58%, transparent 58%);
}

.game-language-switch__button.is-active {
    border-color: rgba(56, 189, 248, 0.9);
    background: rgba(56, 189, 248, 0.18);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.16);
}

.game-language-switch__button:focus-visible {
    outline: 2px solid rgba(56, 189, 248, 0.72);
    outline-offset: 2px;
}

.game-settings-volume {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 10px;
    align-items: center;
}

.game-settings-volume input[type="range"] {
    width: 100%;
    accent-color: var(--game-accent);
}

.game-settings-volume input[type="range"].is-range-editing {
    outline: 3px solid rgba(250, 204, 21, 0.92);
    outline-offset: 4px;
    filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.34));
}

.game-settings-volume span {
    color: var(--game-muted);
    font-weight: 800;
    text-align: right;
}

/* ---------------------------- */
/* Tarjeta instalación PWA */
/* ---------------------------- */

.game-install-card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px 14px;
    align-items: center;
    margin-top: 18px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(168, 85, 247, 0.08)),
        rgba(255, 255, 255, 0.03);
}

.game-install-card[hidden] {
    display: none !important;
}

.game-install-card__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(168, 85, 247, 0.18));
    color: var(--game-accent);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0;
    line-height: 0;
}

.game-install-card__icon > *:not(svg) {
    display: none !important;
}

.game-install-card__icon svg {
    display: block !important;
    width: 26px;
    height: 26px;
    fill: currentColor;
    color: inherit;
    pointer-events: none;
    flex: 0 0 auto;
}

.game-install-card__icon:hover {
    filter: brightness(1.08);
}

.game-install-card__icon:active {
    transform: scale(0.96);
}

.game-install-card__content {
    min-width: 0;
}

.game-install-card__title {
    margin: 0 0 4px;
    font-size: 1.05rem;
    line-height: 1.2;
}

.game-install-card__text {
    margin: 0;
    color: var(--game-muted);
    line-height: 1.4;
    font-size: 0.94rem;
}

.game-install-card.is-installed .game-install-card__icon {
    color: var(--game-success);
    background: rgba(34, 197, 94, 0.12);
    cursor: default;
    pointer-events: none;
}

.game-install-card.is-installed .game-install-card__icon:hover {
    filter: none;
}

.game-install-card.is-installed .game-install-card__icon:active {
    transform: none;
}

.game-install-card.is-guide .game-install-card__icon {
    color: var(--game-accent);
}

/* ---------------------------- */
/* Paneles y controles landscape */
/* ---------------------------- */

.game-landscape-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-landscape-panel {
    display: none;
}

.game-landscape-panel__top {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-landscape-controls-host {
    margin-top: auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: 0;
}

.game-landscape-controls-host--right {
    justify-content: center;
}

.game-back--compact {
    font-size: 0.82rem;
}

.game-landscape-title {
    margin: 0;
    font-size: 1.55rem;
    line-height: 1.05;
    color: var(--game-text);
}

.game-landscape-subtitle {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.25;
    color: var(--game-muted);
}

.game-info-button--landscape {
    align-self: flex-start;
}

.game-settings-button--landscape {
    width: clamp(34px, 8.5dvh, 38px);
    height: clamp(34px, 8.5dvh, 38px);
    min-width: clamp(34px, 8.5dvh, 38px);
    min-height: clamp(34px, 8.5dvh, 38px);
}

.game-settings-button--landscape svg {
    width: clamp(18px, 4.2dvh, 21px);
    height: clamp(18px, 4.2dvh, 21px);
}

/* ---------------------------- */
/* Controles arcade */
/* ---------------------------- */

.game-mobile-controls {
    display: none;
    position: relative;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border: 1px solid var(--game-panel-border);
    border-radius: var(--game-radius);
    background: rgba(15, 23, 42, 0.88);
    user-select: none;
    touch-action: none;
}

.arcade-dpad {
    display: grid;
    grid-template-columns: repeat(3, 62px);
    grid-template-rows: repeat(3, 62px);
    gap: 6px;
    touch-action: none;
}

.arcade-joystick-surface {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 4;
    display: none;
    touch-action: none;
}

.arcade-joystick-surface--left {
    left: 0;
    width: 50%;
}

.arcade-joystick-surface--right {
    right: 0;
    width: 50%;
}

.arcade-joystick-surface[hidden] {
    display: none !important;
}

@media (pointer: fine) and (hover: hover) {
    .game-mobile-controls {
        display: none !important;
    }
}

.game-mobile-controls.has-buttons:not(.has-dpad):not(.has-joystick) {
    justify-content: center;
}

.game-mobile-controls.has-touchpad:not(.has-dpad):not(.has-joystick):not(.has-buttons) {
    justify-content: center;
}

.game-mobile-controls.has-panel-messages {
    align-items: center;
    justify-content: center;
}

.arcade-panel-messages {
    width: min(100%, 480px);
    padding: 12px 18px;
    text-align: center;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.arcade-panel-messages.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.arcade-panel-messages__text {
    margin: 0;
    color: #d8f8f0;
    font-size: clamp(0.9rem, 3.8vw, 1.08rem);
    font-weight: 700;
    line-height: 1.45;
    text-wrap: balance;
    text-shadow: 0 0 16px rgba(52, 211, 153, 0.2);
}

@media (prefers-reduced-motion: reduce) {
    .arcade-panel-messages {
        transform: none;
        transition: opacity 0.01ms linear;
    }
}

.game-mobile-controls.has-joystick:not(.has-buttons):not(.has-dpad) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
}

.game-mobile-controls.has-joystick:not(.has-buttons):not(.has-dpad) .arcade-joystick {
    justify-self: center;
}

.game-mobile-controls.has-joystick.has-buttons {
    display: grid;
    grid-template-columns: minmax(8px, 1fr) auto minmax(16px, 2fr) auto minmax(8px, 1fr);
    justify-content: stretch;
}

.game-mobile-controls.has-joystick.has-buttons .arcade-joystick {
    grid-column: 2;
}

.game-mobile-controls.has-joystick.has-buttons .arcade-buttons {
    grid-column: 4;
}

.arcade-joystick {
    --joystick-x: 0px;
    --joystick-y: 0px;

    position: relative;
    z-index: 3;
    display: grid;
    place-items: center;
    width: clamp(150px, 30vw, 190px);
    height: clamp(150px, 30vw, 190px);
    min-width: clamp(150px, 30vw, 190px);
    border: 1px solid rgba(56, 189, 248, 0.38);
    border-radius: 999px;
    background:
        radial-gradient(circle at 50% 50%, rgba(248, 250, 252, 0.12) 0 18%, transparent 19%),
        radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.22) 0 34%, transparent 35%),
        linear-gradient(135deg, rgba(56, 189, 248, 0.26), rgba(168, 85, 247, 0.24)),
        rgba(15, 23, 42, 0.9);
    box-shadow:
        inset 0 0 0 10px rgba(255, 255, 255, 0.04),
        inset 0 0 24px rgba(2, 6, 23, 0.45),
        0 0 28px rgba(56, 189, 248, 0.24);
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.arcade-joystick::before,
.arcade-joystick::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 68%;
    height: 2px;
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.13);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.arcade-joystick::after {
    width: 2px;
    height: 68%;
}

.arcade-joystick__knob {
    position: relative;
    z-index: 1;
    width: clamp(62px, 12vw, 78px);
    height: clamp(62px, 12vw, 78px);
    border-radius: 999px;
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.55) 0 10%, transparent 11%),
        linear-gradient(135deg, #67e8f9, #38bdf8 48%, #a855f7);
    box-shadow:
        inset 0 -8px 12px rgba(2, 6, 23, 0.22),
        0 8px 20px rgba(2, 6, 23, 0.42),
        0 0 22px rgba(56, 189, 248, 0.32);
    transform: translate(var(--joystick-x), var(--joystick-y));
    transition: transform 0.06s linear, filter 0.12s ease;
}

.arcade-joystick.is-active .arcade-joystick__knob {
    filter: brightness(1.08);
}

.arcade-control {
    border: 0;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--game-text);
    font-size: 1.4rem;
    font-weight: 900;
    cursor: pointer;
    touch-action: none;
    user-select: none;
}

.arcade-control:active,
.arcade-control.is-active {
    background: var(--game-accent);
    color: #020617;
    transform: scale(0.96);
}

.arcade-control--empty {
    opacity: 0;
    pointer-events: none;
}

.arcade-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.arcade-action {
    width: 66px;
    height: 66px;
    box-sizing: border-box;
    padding: 0 5%;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--game-accent), var(--game-accent-2));
    color: #020617;
    font-size: 1.15rem;
    font-weight: 1000;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    touch-action: none;
    user-select: none;
}

.arcade-action:active,
.arcade-action.is-active {
    transform: scale(0.94);
    filter: brightness(1.08);
}

.arcade-action--console {
    --arcade-action-size: 82px;
    width: 82px;
    height: 82px;
    font-size: clamp(0.72rem, calc(var(--arcade-action-size) * 0.17), 1.14rem);
    letter-spacing: 0;
    text-transform: uppercase;
    box-shadow:
        0 0 18px rgba(250, 204, 21, 0.24),
        inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.arcade-action--jump {
    background: #facc15;
}

.arcade-action--attack {
    background: #ef4444;
    color: #fff7ed;
    box-shadow:
        0 0 18px rgba(239, 68, 68, 0.28),
        inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.arcade-action--pause {
    width: 58px;
    height: 58px;
    min-width: 58px;
    padding: 0;
    font-size: 1.5rem;
    font-weight: 900;
    line-height: 1;
}

.arcade-action--tap {
    width: min(280px, calc(100dvw - 32px));
    height: 72px;
    min-width: min(280px, calc(100dvw - 32px));
    border-radius: 18px;
    letter-spacing: 0;
    font-size: 1.35rem;
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.28);
}

.arcade-action--move {
    width: 72px;
    height: 72px;
    min-width: 72px;
    border-radius: 22px;
    font-size: 2.2rem;
    line-height: 1;
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.26);
}

.arcade-touchpad {
    position: relative;
    display: grid;
    place-items: center;
    width: min(280px, calc(100dvw - 32px));
    height: 72px;
    min-width: min(280px, calc(100dvw - 32px));
    border-radius: 18px;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(168, 85, 247, 0.28)),
        rgba(15, 23, 42, 0.86);
    border: 1px solid rgba(56, 189, 248, 0.34);
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.28);
    color: var(--game-text);
    cursor: pointer;
    touch-action: none;
    user-select: none;
}

.arcade-touchpad::before {
    content: "";
    position: absolute;
    inset: 10px 14px;
    border-radius: inherit;
    border: 1px dashed rgba(248, 250, 252, 0.24);
    pointer-events: none;
}

.arcade-touchpad.is-active {
    filter: brightness(1.08);
}

.arcade-touchpad__hint {
    position: relative;
    z-index: 1;
    font-size: 1.15rem;
    font-weight: 1000;
    letter-spacing: 0;
    color: #f8fafc;
    animation: arcade-touchpad-pulse 1s ease-in-out infinite;
}

@keyframes arcade-touchpad-pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.42;
    }
}

/* ---------------------------- */
/* Aviso orientación */
/* ---------------------------- */

.orientation-warning {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: none;
    place-items: center;
    padding: 24px;
    background: rgba(2, 6, 23, 0.96);
    color: var(--game-text);
    text-align: center;
}

.orientation-warning.is-visible {
    display: grid;
}

.orientation-warning__box {
    width: min(420px, 100%);
    padding: 24px;
    border: 1px solid var(--game-panel-border);
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.96);
}

.orientation-warning__icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.orientation-warning h2 {
    margin: 0 0 10px;
}

.orientation-warning p {
    margin: 0;
    color: var(--game-muted);
    line-height: 1.5;
}

/* ---------------------------- */
/* Tablet / móvil general */
/* ---------------------------- */

@media (min-width: 901px) {
    .game-info-button {
        display: none;
    }
}

@media (max-width: 900px) {
    .game-shell {
        width: min(100% - 16px, 760px);
        padding-top: 8px;
    }

    .game-layout {
        grid-template-columns: 1fr;
    }

    .game-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .game-topbar__right {
        width: 100%;
        justify-content: space-between;
    }

    .game-stat {
        flex: 1;
    }

    .game-stage {
        width: min(100%, 92vh);
    }

    .game-side-panel {
        display: none;
        position: fixed;
        left: 50%;
        top: 50%;
        right: auto;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: min(420px, calc(100vw - 24px));
        z-index: 80;
        max-height: calc(100svh - 24px);
        overflow: auto;
        background: rgba(15, 23, 42, 0.97);
        backdrop-filter: blur(14px);
        box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
    }

    .game-side-panel.is-visible {
        display: block;
    }

    .game-info-close {
        display: inline-flex;
    }
}

@media (max-width: 480px) {
    .game-shell {
        width: calc(100% - 12px);
        gap: 10px;
    }

    .game-topbar {
        padding: 12px;
        border-radius: 16px;
    }

    .game-stage-wrap {
        border-radius: 16px;
    }

    .game-mobile-controls {
        padding: 10px;
        gap: 10px;
        border-radius: 16px;
    }

    .arcade-dpad {
        grid-template-columns: repeat(3, 52px);
        grid-template-rows: repeat(3, 52px);
        gap: 5px;
    }

    .arcade-control {
        border-radius: 15px;
        font-size: 1.2rem;
    }

    .arcade-action {
        width: 58px;
        height: 58px;
    }

    .arcade-action--tap {
        width: min(300px, calc(100dvw - 28px));
        min-width: min(300px, calc(100dvw - 28px));
        height: 66px;
    }

    .game-side-panel {
        padding: 14px;
        border-radius: 16px;
    }

    .game-settings-row,
    .game-score-form__row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .game-settings-volume {
        grid-template-columns: minmax(0, 1fr) 46px;
    }

    .game-score-form {
        margin: 14px 0 16px;
        padding: 12px;
        border-radius: 16px;
    }

    .game-score-form__button {
        width: 100%;
    }

    .game-install-card {
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 10px 12px;
        padding: 12px;
        border-radius: 16px;
    }

    .game-install-card__icon {
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }

    .game-install-card__icon svg {
        width: 23px;
        height: 23px;
    }

    .game-install-card__title {
        font-size: 1rem;
    }

    .game-install-card__text {
        font-size: 0.9rem;
    }
}

/* ---------------------------- */
/* MÓVIL VERTICAL */
/* ---------------------------- */

@media (pointer: coarse) and (orientation: portrait), (max-width: 820px) and (orientation: portrait) {
    body.game-page {
        height: 100dvh;
        height: var(--arcade-viewport-height, 100dvh);
        min-height: 100dvh;
        min-height: var(--arcade-viewport-height, 100dvh);
        padding-bottom: 0;
        overflow: hidden;
    }

    .game-shell {
        width: min(calc(100% - 16px), calc(var(--arcade-viewport-width, 100dvw) - 16px));
        height: 100dvh;
        height: var(--arcade-viewport-height, 100dvh);
        min-height: 0;
        max-height: 100dvh;
        max-height: var(--arcade-viewport-height, 100dvh);
        padding-top: calc(env(safe-area-inset-top, 0px) + 8px);
        padding-bottom: 0;
        gap: 10px;
        overflow: hidden;
    }

    .game-topbar {
        position: relative;
        padding: 12px;
        gap: 10px;
    }

    .game-topbar__left {
        gap: 2px;
        padding-right: 54px;
    }

    .game-back {
        font-size: 0.8rem;
    }

    .game-title {
        font-size: 1.75rem;
    }

    .game-subtitle {
        font-size: 0.9rem;
        line-height: 1.25;
    }

    .game-topbar__right {
        display: grid;
        grid-template-columns: 42px 1fr 1fr;
        width: 100%;
        gap: 8px;
        align-items: center;
    }
    
    .game-topbar__right .game-info-button {
        align-self: center;
        justify-self: center;
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
    }

    .game-topbar .game-pause-ui-button {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 42px;
        height: 42px;
        min-width: 42px;
        padding: 0;
        font-size: 1.25rem;
        z-index: 3;
    }

    .game-stat {
        min-width: 0;
        padding: 8px 10px;
        border-radius: 16px;
    }

    .game-stat__label {
        font-size: 0.68rem;
    }

    .game-stat__value {
        font-size: 1.35rem;
    }

    .game-layout {
        display: block;
    }

    .game-stage-wrap {
        min-height: 0;
        margin-bottom: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .game-stage {
        width: min(100%, var(--game-stage-max, calc(100svh - 446px)));
        max-width: 680px;
        max-height: var(--game-stage-max, calc(100svh - 446px));
        min-width: 0;
        aspect-ratio: 1 / 1;
    }

    .game-mobile-controls {
        box-sizing: border-box;
        display: flex;
        position: fixed;
        top: var(--game-mobile-controls-top, auto);
        left: var(--game-mobile-controls-left, 10px);
        right: var(--game-mobile-controls-right, 10px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
        width: auto;
        max-width: none;
        z-index: 60;
        padding: 10px 14px;
        min-height: 0;
        height: auto;
        background: rgba(15, 23, 42, 0.88);
        backdrop-filter: blur(12px);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.42);
    }

    .game-mobile-controls.has-joystick-surface .arcade-joystick-surface {
        display: block;
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-buttons {
        position: relative;
        z-index: 5;
    }

    .game-mobile-controls.has-dpad:not(.has-buttons):not(.has-joystick):not(.has-touchpad) {
        justify-content: center;
        align-items: center;
    }

    .game-mobile-controls.has-buttons:not(.has-dpad):not(.has-joystick),
    .game-mobile-controls.has-buttons.has-touchpad:not(.has-dpad):not(.has-joystick),
    .game-mobile-controls.has-touchpad:not(.has-dpad):not(.has-joystick):not(.has-buttons) {
        min-height: 0;
        height: auto;
        padding: clamp(10px, calc(var(--game-mobile-controls-height, 156px) * 0.08), 18px);
        align-items: center;
    }

    .game-mobile-controls.has-buttons:not(.has-dpad):not(.has-joystick) .arcade-buttons {
        width: 100%;
        height: 100%;
    }

    .game-mobile-controls.has-buttons.has-touchpad:not(.has-dpad):not(.has-joystick) .arcade-buttons {
        display: none;
    }

    .game-mobile-controls.has-buttons.has-touchpad:not(.has-dpad):not(.has-joystick) .arcade-touchpad {
        width: 100%;
        min-width: 0;
        height: 100%;
        border-radius: clamp(22px, calc(var(--game-mobile-controls-height, 156px) * 0.15), 32px);
    }

    .game-mobile-controls.has-buttons:not(.has-dpad):not(.has-joystick) .arcade-action--tap {
        width: 100%;
        min-width: 0;
        height: 100%;
        border-radius: clamp(22px, calc(var(--game-mobile-controls-height, 156px) * 0.15), 32px);
        font-size: clamp(1.35rem, 4.6svh, 1.8rem);
    }

    .game-mobile-controls.has-touchpad:not(.has-dpad):not(.has-joystick):not(.has-buttons) .arcade-touchpad {
        width: 100%;
        min-width: 0;
        height: 100%;
        border-radius: clamp(22px, calc(var(--game-mobile-controls-height, 156px) * 0.15), 32px);
    }

    .game-mobile-controls.has-touchpad:not(.has-dpad):not(.has-joystick):not(.has-buttons) .arcade-touchpad__hint {
        font-size: clamp(1.25rem, 4.2svh, 1.65rem);
    }

    .arcade-dpad {
        --arcade-dpad-cell: clamp(42px, min(14vw, calc(var(--game-mobile-controls-height, 156px) * 0.24)), 58px);
        --arcade-dpad-gap: clamp(4px, calc(var(--game-mobile-controls-height, 156px) * 0.025), 6px);
        grid-template-columns: repeat(3, var(--arcade-dpad-cell));
        grid-template-rows: repeat(3, var(--arcade-dpad-cell));
        gap: var(--arcade-dpad-gap);
    }

    .arcade-joystick {
        --arcade-joystick-size: clamp(118px, min(37vw, calc(var(--game-mobile-controls-height, 156px) * 0.72)), 166px);
        width: var(--arcade-joystick-size);
        height: var(--arcade-joystick-size);
        min-width: var(--arcade-joystick-size);
    }

    .arcade-joystick__knob {
        width: clamp(50px, calc(var(--arcade-joystick-size, 150px) * 0.42), 68px);
        height: clamp(50px, calc(var(--arcade-joystick-size, 150px) * 0.42), 68px);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-buttons {
        align-self: stretch;
        align-items: center;
        gap: clamp(10px, 3vw, 18px);
    }

    .game-mobile-controls.has-joystick.has-buttons {
        grid-template-columns: minmax(12px, 1fr) auto minmax(24px, 2fr) auto minmax(12px, 1fr);
        gap: 0;
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--console {
        --arcade-action-size: clamp(66px, min(19vw, calc(var(--game-mobile-controls-height, 156px) * 0.42)), 88px);
        width: var(--arcade-action-size);
        height: var(--arcade-action-size);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--attack {
        transform: translateY(-18px);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--attack:active,
    .game-mobile-controls.has-joystick.has-buttons .arcade-action--attack.is-active {
        transform: translateY(-18px) scale(0.94);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--jump {
        transform: translateY(18px);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--jump:active,
    .game-mobile-controls.has-joystick.has-buttons .arcade-action--jump.is-active {
        transform: translateY(18px) scale(0.94);
    }

    .arcade-control {
        border-radius: 16px;
        font-size: 1.15rem;
    }

    .game-side-panel {
        display: none;
        position: fixed;
        left: 50%;
        top: 50%;
        right: auto;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: min(420px, calc(100vw - 24px));
        z-index: 80;
        max-height: calc(100svh - 24px);
        overflow: auto;
        background: rgba(15, 23, 42, 0.97);
        backdrop-filter: blur(14px);
        box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
    }

    .game-side-panel.is-visible {
        display: block;
    }

    .game-info-close {
        display: inline-flex;
    }

    .game-landscape-panel,
    .game-info-button--landscape,
    .game-pause-ui-button--landscape {
        display: none !important;
    }
}

/* ---------------------------- */
/* MÓVIL HORIZONTAL */
/* ---------------------------- */

@media (orientation: portrait) and (max-height: 760px) {
    body.game-page {
        --game-portrait-controls-reserve: 158px;
    }

    .game-shell {
        width: calc(100% - 12px);
        padding-top: 6px;
        gap: 8px;
    }

    .game-topbar {
        padding: 9px 10px;
        gap: 7px;
        border-radius: 16px;
    }

    .game-topbar__left {
        padding-right: 46px;
    }

    .game-back {
        font-size: 0.74rem;
    }

    .game-title {
        font-size: clamp(1.25rem, 6vw, 1.55rem);
    }

    .game-subtitle {
        font-size: 0.78rem;
        line-height: 1.18;
    }

    .game-topbar__right {
        grid-template-columns: 36px 1fr 1fr;
        gap: 6px;
    }

    .game-topbar__right .game-info-button,
    .game-topbar .game-pause-ui-button {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 1rem;
    }

    .game-topbar .game-pause-ui-button {
        top: 9px;
        right: 10px;
    }

    .game-stat {
        padding: 6px 7px;
        border-radius: 13px;
    }

    .game-stat__label {
        font-size: 0.58rem;
    }

    .game-stat__value {
        margin-top: 0;
        font-size: 1.05rem;
    }

    .game-stage-wrap {
        margin-bottom: 6px;
    }

    .game-mobile-controls {
        left: var(--game-mobile-controls-left, 8px);
        right: var(--game-mobile-controls-right, 8px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
        min-height: 86px;
        padding: 8px 11px;
    }

    .arcade-joystick {
        width: clamp(112px, 31vw, 138px);
        height: clamp(112px, 31vw, 138px);
        min-width: clamp(112px, 31vw, 138px);
    }

    .arcade-joystick__knob {
        width: clamp(46px, 12vw, 58px);
        height: clamp(46px, 12vw, 58px);
    }

    .game-mobile-controls.has-joystick.has-buttons {
        grid-template-columns: minmax(10px, 1fr) auto minmax(20px, 2fr) auto minmax(10px, 1fr);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-buttons {
        gap: clamp(8px, 2.6vw, 12px);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--console {
        --arcade-action-size: clamp(64px, 17vw, 76px);
        width: var(--arcade-action-size);
        height: var(--arcade-action-size);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--attack {
        transform: translateY(-12px);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--attack:active,
    .game-mobile-controls.has-joystick.has-buttons .arcade-action--attack.is-active {
        transform: translateY(-12px) scale(0.94);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--jump {
        transform: translateY(12px);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--jump:active,
    .game-mobile-controls.has-joystick.has-buttons .arcade-action--jump.is-active {
        transform: translateY(12px) scale(0.94);
    }
}

@media (orientation: portrait) and (max-height: 640px) {
    body.game-page {
        --game-portrait-controls-reserve: 128px;
    }

    .game-shell {
        padding-top: 4px;
        gap: 6px;
    }

    .game-topbar {
        padding: 7px 8px;
        gap: 5px;
    }

    .game-topbar__left {
        padding-right: 38px;
    }

    .game-title {
        font-size: clamp(1.08rem, 5.4vw, 1.35rem);
    }

    .game-subtitle {
        display: none;
    }

    .game-topbar__right {
        grid-template-columns: 32px 1fr 1fr;
        gap: 5px;
    }

    .game-topbar__right .game-info-button,
    .game-topbar .game-pause-ui-button {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        font-size: 0.92rem;
    }

    .game-topbar .game-pause-ui-button {
        top: 7px;
        right: 8px;
    }

    .game-stat {
        padding: 5px 6px;
        border-radius: 11px;
    }

    .game-stat__label {
        font-size: 0.52rem;
    }

    .game-stat__value {
        font-size: 0.92rem;
    }

    .game-stage-wrap {
        margin-bottom: 4px;
    }

    .game-mobile-controls {
        left: var(--game-mobile-controls-left, 6px);
        right: var(--game-mobile-controls-right, 6px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
        min-height: 72px;
        padding: 6px 8px;
        border-radius: 14px;
    }

    .arcade-joystick {
        width: clamp(88px, 28vw, 112px);
        height: clamp(88px, 28vw, 112px);
        min-width: clamp(88px, 28vw, 112px);
    }

    .arcade-joystick__knob {
        width: clamp(38px, 11vw, 48px);
        height: clamp(38px, 11vw, 48px);
    }

    .game-mobile-controls.has-joystick.has-buttons {
        grid-template-columns: minmax(8px, 1fr) auto minmax(16px, 2fr) auto minmax(8px, 1fr);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-buttons {
        gap: clamp(6px, 2.2vw, 8px);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--console {
        --arcade-action-size: clamp(54px, 15vw, 64px);
        width: var(--arcade-action-size);
        height: var(--arcade-action-size);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--attack {
        transform: translateY(-8px);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--attack:active,
    .game-mobile-controls.has-joystick.has-buttons .arcade-action--attack.is-active {
        transform: translateY(-8px) scale(0.94);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--jump {
        transform: translateY(8px);
    }

    .game-mobile-controls.has-joystick.has-buttons .arcade-action--jump:active,
    .game-mobile-controls.has-joystick.has-buttons .arcade-action--jump.is-active {
        transform: translateY(8px) scale(0.94);
    }
}

@media (orientation: portrait) and (max-height: 820px) {
    .game-overlay:not(.has-score-form):not(.is-ranking-view) {
        padding: 8px;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-overlay__box {
        width: min(360px, calc(100% - 10px));
        max-height: calc(100% - 8px);
        padding: 14px;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) h2 {
        margin-bottom: 6px;
        font-size: clamp(1.25rem, 5.2vw, 1.55rem);
        line-height: 1.04;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) p {
        margin-bottom: 10px;
        font-size: clamp(0.82rem, 3.4vw, 0.95rem);
        line-height: 1.22;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-actions {
        gap: 8px;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-button {
        min-height: 38px;
        padding-inline: 16px;
        font-size: 0.92rem;
    }
}

@media (pointer: coarse) and (orientation: landscape), (max-height: 620px) and (orientation: landscape) {
    body.game-page {
        width: 100dvw;
        width: var(--arcade-viewport-width, 100dvw);
        height: 100dvh;
        height: var(--arcade-viewport-height, 100dvh);
        padding: 0;
        overflow: hidden;
    }

    .game-shell {
        --side-width: clamp(128px, 18vw, 168px);
        --game-gap: 6px;
        --control-size: clamp(34px, 9dvh, 42px);
        --action-size: clamp(44px, 12dvh, 56px);
        --tap-action-size: clamp(92px, 27dvh, 138px);

        width: 100%;
        max-width: var(--arcade-viewport-width, 100dvw);
        height: 100dvh;
        height: var(--arcade-viewport-height, 100dvh);
        min-height: 100dvh;
        min-height: var(--arcade-viewport-height, 100dvh);
        padding: calc(env(safe-area-inset-top, 0px) + 5px) calc(env(safe-area-inset-right, 0px) + 5px) calc(env(safe-area-inset-bottom, 0px) + 5px) calc(env(safe-area-inset-left, 0px) + 5px);
        gap: 0;
    }

    .game-topbar {
        display: none;
    }

    .game-layout {
        display: block;
        height: 100%;
    }

    .game-main {
        height: 100%;
        display: grid;
        grid-template-columns: var(--side-width) minmax(0, 1fr) var(--side-width);
        grid-template-areas: "left stage right";
        gap: var(--game-gap);
        align-items: stretch;
    }

    .game-landscape-panel {
        display: flex;
        flex-direction: column;
        gap: clamp(5px, 1.4dvh, 9px);
        padding: clamp(6px, 1.5dvh, 10px);
        border-radius: 16px;
        background: rgba(15, 23, 42, 0.82);
        backdrop-filter: blur(10px);
        min-width: 0;
        min-height: 0;
        overflow: hidden;
    }

    .game-landscape-panel--left {
        grid-area: left;
    }

    .game-landscape-panel--right {
        grid-area: right;
    }

    .game-landscape-panel__top {
        gap: clamp(4px, 1.1dvh, 8px);
        flex: 0 0 auto;
    }

    .game-back--compact {
        font-size: clamp(0.62rem, 2.2dvh, 0.78rem);
        line-height: 1.1;
    }

    .game-landscape-title {
        font-size: clamp(1.1rem, 4.6dvh, 1.55rem);
        line-height: 1;
    }

    .game-landscape-subtitle {
        font-size: clamp(0.68rem, 2.5dvh, 0.9rem);
        line-height: 1.18;
    }

    .game-landscape-buttons {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .game-info-button--landscape,
    .game-pause-ui-button--landscape {
        display: inline-flex;
        width: clamp(34px, 8.5dvh, 42px);
        height: clamp(34px, 8.5dvh, 42px);
    }

    .game-pause-ui-button--landscape {
        --pause-bar-width: clamp(3px, 0.7dvh, 4px);
        --pause-bar-height: clamp(12px, 3.1dvh, 16px);
        --pause-bar-gap: clamp(3px, 0.8dvh, 4px);
    }

    .game-stage-wrap {
        grid-area: stage;
        height: 100%;
        min-height: 0;
        padding: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 18px;
        overflow: hidden;
    }

    .game-stage {
        border-radius: 14px;
        width: min(
            calc(var(--arcade-viewport-height, 100dvh) - 30px),
            calc(var(--arcade-viewport-width, 100dvw) - (var(--side-width) * 2) - (var(--game-gap) * 2) - 32px)
        );
        height: min(
            calc(var(--arcade-viewport-height, 100dvh) - 30px),
            calc(var(--arcade-viewport-width, 100dvw) - (var(--side-width) * 2) - (var(--game-gap) * 2) - 32px)
        );
        max-width: 100%;
        max-height: 100%;
        margin: 0 auto;
    }

    .game-mobile-controls {
        position: absolute;
        width: 0;
        height: 0;
        overflow: hidden;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .game-landscape-controls-host {
        position: relative;
        display: flex;
        justify-content: center;
        min-height: 0;
        margin-top: auto;
        padding-top: 4px;
        width: 100%;
    }

    .game-landscape-controls-host.has-joystick-surface {
        flex: 1 1 auto;
        align-items: center;
        justify-content: center;
        margin-top: 0;
        padding: clamp(8px, 2dvh, 14px) 0 clamp(10px, 2.4dvh, 16px);
        cursor: pointer;
        touch-action: none;
    }

    .game-landscape-controls-host--right {
        flex: 1 1 auto;
        align-items: center;
        justify-content: flex-end;
        margin-top: 0;
        padding-top: clamp(6px, 1.6dvh, 12px);
        min-height: 0;
    }

    .game-landscape-controls-host .arcade-dpad {
        --landscape-dpad-gap: clamp(3px, 0.9dvh, 5px);
        --landscape-dpad-size: min(
            var(--control-size),
            calc((var(--side-width) - clamp(18px, 3vw, 28px) - (var(--landscape-dpad-gap) * 2)) / 3)
        );
        display: grid;
        grid-template-columns: repeat(3, var(--landscape-dpad-size));
        grid-template-rows: repeat(3, var(--landscape-dpad-size));
        gap: var(--landscape-dpad-gap);
        justify-content: center;
        align-content: center;
        width: min(100%, calc((var(--landscape-dpad-size) * 3) + (var(--landscape-dpad-gap) * 2)));
        margin-inline: auto;
    }

    .game-landscape-controls-host .arcade-dpad .arcade-control {
        min-width: 0;
        min-height: 0;
        font-size: clamp(0.85rem, calc(var(--landscape-dpad-size) * 0.42), 1.15rem);
    }

    .game-landscape-controls-host .arcade-joystick {
        width: min(100%, clamp(108px, 23dvh, 146px));
        height: min(100%, clamp(108px, 23dvh, 146px));
        min-width: 0;
        margin: auto;
        pointer-events: auto;
    }

    .game-landscape-controls-host.has-joystick-surface::before {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
    }

    .game-landscape-controls-host .arcade-joystick__knob {
        width: clamp(46px, 10dvh, 64px);
        height: clamp(46px, 10dvh, 64px);
    }

    .game-landscape-controls-host .arcade-buttons {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: clamp(6px, 1.4dvh, 10px);
        width: 100%;
        height: 100%;
        min-height: 0;
    }

    .game-landscape-controls-host .arcade-action--console {
        --arcade-action-size: clamp(80px, 17dvh, 102px);
        width: var(--arcade-action-size);
        height: var(--arcade-action-size);
    }

    .game-landscape-controls-host .arcade-action--attack {
        order: 1;
        transform: translateX(18px);
    }

    .game-landscape-controls-host .arcade-action--attack:active,
    .game-landscape-controls-host .arcade-action--attack.is-active {
        transform: translateX(18px) scale(0.94);
    }

    .game-landscape-controls-host .arcade-action--jump {
        order: 2;
        transform: translateX(-18px);
    }

    .game-landscape-controls-host .arcade-action--jump:active,
    .game-landscape-controls-host .arcade-action--jump.is-active {
        transform: translateX(-18px) scale(0.94);
    }

    .game-landscape-controls-host .arcade-touchpad {
        display: none;
    }

    .game-landscape-controls-host .arcade-action--move {
        width: min(100%, 118px);
        height: var(--game-landscape-move-height, 100%);
        min-width: 0;
        max-height: 100%;
        margin-top: auto;
        border-radius: clamp(22px, 6dvh, 34px);
        font-size: clamp(2.1rem, 9dvh, 3.4rem);
        box-shadow:
            0 0 26px rgba(56, 189, 248, 0.34),
            0 0 42px rgba(168, 85, 247, 0.2);
    }

    .game-landscape-controls-host--right .arcade-action--move-right {
        transform: none;
    }

    .game-landscape-controls-host--right .arcade-action--move-right:active,
    .game-landscape-controls-host--right .arcade-action--move-right.is-active {
        transform: scale(0.94);
    }

    .game-landscape-controls-host--left {
        flex: 1 1 auto;
        align-items: center;
        justify-content: flex-end;
        margin-top: 0;
        padding-top: clamp(6px, 1.6dvh, 12px);
        min-height: 0;
    }

    .arcade-control {
        border-radius: 14px;
        font-size: clamp(0.95rem, 3.8dvh, 1.15rem);
    }

    .arcade-action--pause {
        width: var(--action-size);
        height: var(--action-size);
        min-width: var(--action-size);
        font-size: clamp(1.15rem, 4.5dvh, 1.5rem);
    }

    .game-landscape-controls-host .arcade-action--tap {
        width: min(100%, 124px);
        height: 100%;
        min-width: 0;
        max-height: 100%;
        border-radius: clamp(22px, 6dvh, 34px);
        font-size: clamp(1.15rem, 4.4dvh, 1.55rem);
        box-shadow:
            0 0 26px rgba(56, 189, 248, 0.34),
            0 0 42px rgba(168, 85, 247, 0.2);
    }

    .game-landscape-panel--right .game-stat {
        min-width: 0;
        padding: clamp(5px, 1.3dvh, 8px) 8px;
        border-radius: 14px;
    }

    .game-landscape-panel--right .game-stat__label {
        font-size: clamp(0.55rem, 2dvh, 0.66rem);
    }

    .game-landscape-panel--right .game-stat__value {
        font-size: clamp(1rem, 4.2dvh, 1.35rem);
    }

    .game-overlay {
        padding: 8px;
    }

    .game-overlay__box {
        width: min(92%, 340px);
        max-height: calc(100% - 12px);
        padding: clamp(10px, 2.2dvh, 16px);
        overflow: auto;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-overlay__box {
        width: min(90%, 320px);
        padding: clamp(10px, calc(10px + (8px * var(--game-ui-scale, 1))), 16px);
        overflow: hidden;
    }

    .game-overlay h2 {
        margin-bottom: 5px;
        font-size: clamp(1.25rem, 5dvh, 1.65rem);
        line-height: 1.05;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) h2 {
        margin-bottom: clamp(3px, calc(8px * var(--game-ui-scale, 1)), 6px);
        font-size: clamp(1.2rem, calc(0.75rem + (1rem * var(--game-ui-scale, 1))), 1.65rem);
        line-height: 1.03;
    }

    .game-overlay p {
        margin-bottom: 10px;
        font-size: clamp(0.8rem, 3dvh, 0.95rem);
        line-height: 1.25;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) p {
        margin-bottom: clamp(5px, calc(12px * var(--game-ui-scale, 1)), 10px);
        font-size: clamp(0.78rem, calc(0.56rem + (0.4rem * var(--game-ui-scale, 1))), 0.95rem);
        line-height: 1.18;
    }

    .game-actions {
        gap: 8px;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-actions {
        gap: clamp(5px, calc(9px * var(--game-ui-scale, 1)), 8px);
    }

    .game-button {
        min-height: clamp(34px, 8.5dvh, 42px);
        padding: 0 14px;
        font-size: clamp(0.82rem, 3dvh, 1rem);
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-button {
        min-height: clamp(32px, calc(26px + (18px * var(--game-ui-scale, 1))), 40px);
        padding-inline: clamp(12px, calc(18px * var(--game-ui-scale, 1)), 16px);
        font-size: clamp(0.82rem, calc(0.58rem + (0.42rem * var(--game-ui-scale, 1))), 0.98rem);
    }

    .game-score-form {
        margin: 8px 0 10px;
        padding: 10px;
        border-radius: 14px;
    }

    .game-score-form__label {
        margin-bottom: 6px;
        font-size: clamp(0.72rem, 2.7dvh, 0.86rem);
    }

    .game-score-form__row {
        gap: 8px;
    }

    .game-score-form__input {
        min-height: clamp(32px, 8dvh, 40px);
        padding: 0 12px;
        font-size: clamp(0.78rem, 3dvh, 0.95rem);
    }

    .game-score-form__button {
        min-height: clamp(32px, 8dvh, 40px);
        padding: 0 12px;
        font-size: clamp(0.78rem, 3dvh, 0.95rem);
    }

    .game-score-form__message {
        margin-top: 6px !important;
        font-size: clamp(0.7rem, 2.5dvh, 0.82rem);
    }

    .game-side-panel {
        display: none;
        position: fixed;
        left: 50%;
        top: 50%;
        right: auto;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: min(
            560px,
            calc(100dvw - (var(--side-width) * 2) - (var(--game-gap) * 2) - 24px)
        );
        max-height: calc(100dvh - 20px);
        z-index: 90;
        overflow: auto;
        background: rgba(15, 23, 42, 0.97);
        backdrop-filter: blur(14px);
        box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
    }

    .game-side-panel.is-visible {
        display: block;
    }

    .game-info-close {
        display: inline-flex;
    }

    .game-settings-modal {
        padding: 10px;
    }

    .game-settings-modal__box {
        width: min(430px, 72vw);
        max-height: calc(100dvh - 20px);
        overflow: auto;
        padding: 14px;
        border-radius: 20px;
    }

    .game-settings-modal__header {
        margin-bottom: 10px;
    }

    .game-settings-modal__header h2 {
        font-size: 1.25rem;
    }

    .game-settings-row {
        padding: 10px 0;
    }

    .game-fullscreen-button--settings,
    .game-share-button--settings {
        width: clamp(34px, 8.5dvh, 38px);
        height: clamp(34px, 8.5dvh, 38px);
        min-width: clamp(34px, 8.5dvh, 38px);
        min-height: clamp(34px, 8.5dvh, 38px);
    }

    .game-fullscreen-button--settings .game-fullscreen-button__svg,
    .game-share-button--settings .game-share-button__svg {
        width: clamp(18px, 4.2dvh, 21px);
        height: clamp(18px, 4.2dvh, 21px);
    }

    .game-topbar .game-info-button,
    .game-topbar .game-pause-ui-button {
        display: none;
    }
}

/* ---------------------------- */
/* Variables base               */
/* ---------------------------- */

.game-stage,
.game-overlay {
    --game-stage-size: 600px;
    --game-ui-scale: 1;
}

/* ---------------------------- */
/* Ocultación de bloques        */
/* ---------------------------- */

.game-ranking-result[hidden],
.game-ranking[hidden],
.game-actions[hidden],
.game-confirm-exit[hidden],
.game-score-close[hidden] {
    display: none !important;
}

/* ---------------------------- */
/* Estados del overlay          */
/* ---------------------------- */

.game-overlay.is-ranking-view,
.game-overlay.has-score-form {
    padding: clamp(5px, calc(8px * var(--game-ui-scale)), 12px);
    align-items: center;
    justify-content: center;
}

.game-overlay.is-ranking-view .game-overlay__box,
.game-overlay.has-score-form .game-overlay__box {
    position: relative;
    width: min(calc(var(--game-stage-size) * 0.90), calc(100% - 8px));
    max-width: 590px;
    max-height: calc(100% - 6px);
    padding: clamp(16px, calc(18px * var(--game-ui-scale)), 28px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(10px, calc(11px * var(--game-ui-scale)), 18px);
    border-radius: clamp(18px, calc(20px * var(--game-ui-scale)), 28px);
    box-sizing: border-box;
}

/* ---------------------------- */
/* Botón cerrar score / ranking */
/* ---------------------------- */

.game-score-close {
    position: absolute;
    top: clamp(8px, calc(10px * var(--game-ui-scale)), 12px);
    right: clamp(8px, calc(10px * var(--game-ui-scale)), 12px);
    width: clamp(30px, calc(34px * var(--game-ui-scale)), 40px);
    height: clamp(30px, calc(34px * var(--game-ui-scale)), 40px);
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: clamp(22px, calc(24px * var(--game-ui-scale)), 28px);
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.game-score-close:hover {
    background: rgba(255, 255, 255, 0.16);
}

.game-score-close:focus-visible {
    outline: 2px solid rgba(56, 189, 248, 0.9);
    outline-offset: 2px;
}

/* ---------------------------- */
/* Cabecera común               */
/* ---------------------------- */

.game-overlay.is-ranking-view [data-overlay-title],
.game-overlay.has-score-form [data-overlay-title] {
    flex: 0 0 auto;
    margin: 0;
    text-align: center;
    color: #ffffff;
    font-weight: 700;
    line-height: 1.12;
}

.game-overlay.is-ranking-view [data-overlay-text],
.game-overlay.has-score-form [data-overlay-text] {
    flex: 0 0 auto;
    margin: 0;
    text-align: center;
    line-height: 1.4;
    color: #d8e4f5;
}

/* ---------------------------- */
/* Vista: formulario guardar    */
/* ---------------------------- */

.game-overlay.has-score-form .game-overlay__box {
    width: min(calc(var(--game-stage-size) * 0.94), calc(100% - 8px));
    max-width: 590px;
    min-height: 0;
    max-height: calc(100% - 6px);
    justify-content: center;
    padding-top: clamp(22px, calc(24px * var(--game-ui-scale)), 34px);
    padding-bottom: clamp(8px, calc(12px * var(--game-ui-scale)), 16px);
    gap: clamp(6px, calc(9px * var(--game-ui-scale)), 14px);
    overflow: auto;
}

@media (pointer: fine) and (hover: hover) and (orientation: landscape) and (max-height: 620px) {
    .game-landscape-controls-host {
        display: none;
    }

    .game-info-button--landscape,
    .game-pause-ui-button--landscape {
        display: none;
    }
}

.game-overlay.has-score-form [data-overlay-title] {
    font-size: clamp(16px, calc(26px * var(--game-ui-scale)), 34px);
    line-height: 1.08;
    white-space: nowrap;
    padding-inline: clamp(28px, calc(34px * var(--game-ui-scale)), 40px);
}

.game-overlay.has-score-form [data-overlay-text] {
    font-size: clamp(11px, calc(19px * var(--game-ui-scale)), 24px);
    line-height: 1.24;
}

.game-overlay.has-score-form .game-score-form {
    flex: 0 0 auto;
    width: 100%;
    margin-top: clamp(2px, calc(4px * var(--game-ui-scale)), 6px);
    padding: clamp(8px, calc(14px * var(--game-ui-scale)), 18px);
    border-radius: clamp(13px, calc(18px * var(--game-ui-scale)), 22px);
    background: rgba(53, 63, 108, 0.38);
    border: 1px solid rgba(148, 163, 184, 0.16);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

.game-overlay.has-score-form .game-score-form__label {
    display: block;
    margin-bottom: clamp(5px, calc(8px * var(--game-ui-scale)), 12px);
    font-size: clamp(12px, calc(18px * var(--game-ui-scale)), 22px);
    line-height: 1.18;
    font-weight: 700;
    color: #ffffff;
}

/* Botón Guardar SIEMPRE debajo del input */
.game-overlay.has-score-form .game-score-form__row {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(6px, calc(9px * var(--game-ui-scale)), 12px);
    align-items: end;
    margin-top: clamp(2px, calc(4px * var(--game-ui-scale)), 8px);
}

.game-overlay.has-score-form .game-score-form__input {
    width: 100%;
    min-height: clamp(34px, calc(46px * var(--game-ui-scale)), 58px);
    box-sizing: border-box;
    font-size: clamp(12px, calc(16px * var(--game-ui-scale)), 20px);
}

.game-overlay.has-score-form .game-score-form__button {
    width: 100%;
    min-height: clamp(34px, calc(46px * var(--game-ui-scale)), 58px);
    font-size: clamp(12px, calc(16px * var(--game-ui-scale)), 20px);
}

.game-overlay.has-score-form .game-score-form__message {
    margin: clamp(4px, calc(7px * var(--game-ui-scale)), 10px) 0 0;
    min-height: 1em;
    text-align: center;
    font-size: clamp(10px, calc(13px * var(--game-ui-scale)), 15px);
    line-height: 1.35;
}

/* ---------------------------- */
/* Confirmación salir sin guardar */
/* ---------------------------- */

.game-overlay.is-confirm-exit .game-overlay__box {
    justify-content: center;
}

.game-confirm-exit {
    width: 100%;
    margin-top: 4px;
    padding: clamp(14px, calc(16px * var(--game-ui-scale)), 22px);
    border-radius: 16px;
    background: rgba(53, 63, 108, 0.48);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-sizing: border-box;
}

.game-confirm-exit__text {
    margin: 0 0 14px;
    text-align: center;
    color: #ffffff;
    font-size: clamp(14px, calc(9px + 0.65vw), 19px);
    line-height: 1.4;
    font-weight: 700;
}

.game-confirm-exit__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.game-confirm-exit__actions .game-button {
    min-height: 44px;
}

/* ---------------------------- */
/* Vista: ranking final         */
/* ---------------------------- */

.game-overlay.is-ranking-view .game-overlay__box {
    width: min(calc(var(--game-stage-size) * 0.96), calc(100% - 8px));
    max-width: 650px;
    padding-top: clamp(10px, calc(11px * var(--game-ui-scale)), 14px);
    padding-bottom: clamp(6px, calc(7px * var(--game-ui-scale)), 10px);
    gap: 1px;
}

.game-overlay.is-ranking-view [data-overlay-title] {
    font-family: "Press Start 2P", monospace;
    font-size: clamp(22px, calc(12px + 1.35vw), 34px);
    line-height: 1.04;
    text-transform: uppercase;
    color: #ffe66d;
    text-shadow:
        0 0 8px rgba(255, 230, 109, 0.35),
        2px 2px 0 rgba(0, 0, 0, 0.35);
    padding-inline: 42px;
}

.game-overlay.is-ranking-view [data-overlay-text] {
    font-family: "Press Start 2P", monospace;
    font-size: clamp(10px, calc(6px + 0.55vw), 14px);
    line-height: 1.08;
    color: #9ae6ff;
    text-transform: uppercase;
    white-space: nowrap;
}

.game-ranking-result {
    flex: 0 1 auto;
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
}

.game-ranking-result__text {
    flex: 0 0 auto;
    margin: 0;
    display: grid;
    gap: 0;
    justify-items: center;
    font-family: "Press Start 2P", monospace;
    font-size: clamp(10px, calc(7px + 0.5vw), 15px);
    line-height: 1.05;
    color: #ffffff;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
}

.game-ranking-result__text span {
    display: block;
    margin: 0;
    white-space: nowrap;
}

/* Subimos el ranking para eliminar el hueco visual bajo PUESTO */
.game-ranking-result__text + .game-ranking {
    margin-top: -12px;
}

.game-ranking {
    width: 100%;
    flex: 0 1 auto;
    min-height: 138px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background: rgba(4, 12, 35, 0.72);
    border: 2px solid rgba(74, 222, 255, 0.28);
    border-radius: 16px;
    padding: clamp(6px, calc(7px * var(--game-ui-scale)), 10px);
    box-shadow:
        inset 0 0 18px rgba(56, 189, 248, 0.08),
        0 0 20px rgba(56, 189, 248, 0.08);
}

.game-ranking__title {
    flex: 0 0 auto;
    margin-bottom: 10px;
    font-family: "Press Start 2P", monospace;
    font-size: clamp(12px, calc(7px + 0.55vw), 15px);
    line-height: 1.3;
    color: #ffe66d;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(255, 230, 109, 0.28);
}

.game-ranking__list {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    gap: clamp(4px, calc(5px * var(--game-ui-scale)), 8px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
}

.game-ranking__list::-webkit-scrollbar {
    width: 6px;
}

.game-ranking__list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

.game-ranking__list::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.55);
    border-radius: 999px;
}

.game-ranking__row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 62px;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    font-family: "Press Start 2P", monospace;
    font-size: clamp(9px, calc(6px + 0.38vw), 11px);
    line-height: 1.22;
    color: #e5f7ff;
    box-sizing: border-box;
}

.game-ranking__position {
    color: #8fdfff;
    white-space: nowrap;
}

.game-ranking__name {
    min-width: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.game-ranking__score {
    min-width: 0;
    color: #ffffff;
    text-align: right;
    white-space: nowrap;
}

.game-ranking__empty {
    padding: 14px 10px;
    text-align: center;
    font-family: "Press Start 2P", monospace;
    font-size: 11px;
    line-height: 1.6;
    color: #cdefff;
}

.game-ranking__row.is-current {
    background: rgba(255, 226, 84, 0.16);
    border: 1px solid rgba(255, 226, 84, 0.75);
    box-shadow:
        0 0 0 1px rgba(255, 226, 84, 0.16) inset,
        0 0 18px rgba(255, 226, 84, 0.22);
    color: #fff6b0;
    animation: arcade-highlight-blink 0.9s steps(2, end) infinite;
}

.game-ranking__row.is-current .game-ranking__position,
.game-ranking__row.is-current .game-ranking__score,
.game-ranking__row.is-current .game-ranking__name {
    color: #fff6b0;
}

/* En el TOP 10 se cierra con la X superior */
.game-overlay.is-ranking-view .game-ranking-result__accept {
    display: none !important;
}

/* Por si se reutiliza fuera del ranking */
.game-ranking-result__accept {
    flex: 0 0 auto;
    width: 100%;
    margin-top: 0;
    min-height: clamp(44px, calc(46px * var(--game-ui-scale)), 58px);
}

/* ---------------------------- */
/* Animación highlight          */
/* ---------------------------- */

@keyframes arcade-highlight-blink {
    0%,
    49% {
        opacity: 1;
        transform: scale(1);
        box-shadow:
            0 0 0 1px rgba(255, 226, 84, 0.18) inset,
            0 0 20px rgba(255, 226, 84, 0.28);
    }

    50%,
    100% {
        opacity: 0.76;
        transform: scale(1.01);
        box-shadow:
            0 0 0 1px rgba(255, 226, 84, 0.06) inset,
            0 0 8px rgba(255, 226, 84, 0.1);
    }
}

/* ---------------------------- */
/* Móvil vertical               */
/* ---------------------------- */

@media (orientation: portrait) {
    .game-overlay.is-ranking-view .game-overlay__box,
    .game-overlay.has-score-form .game-overlay__box {
        width: min(calc(var(--game-stage-size) * 0.90), calc(100% - 10px));
    }

    .game-overlay.has-score-form .game-overlay__box {
        min-height: auto;
        max-height: calc(100% - 6px);
        padding-top: clamp(22px, 7svh, 30px);
        padding-bottom: clamp(7px, 2svh, 10px);
        gap: clamp(5px, 1.7svh, 8px);
        justify-content: center;
        overflow: auto;
    }

    .game-overlay.has-score-form [data-overlay-title] {
        font-size: clamp(16px, 4.7vw, 28px);
        line-height: 1.08;
        margin-top: 0;
        padding-inline: clamp(30px, 10vw, 40px);
    }

    .game-overlay.has-score-form [data-overlay-text] {
        font-size: clamp(11px, 3.2vw, 18px);
        line-height: 1.22;
    }

    .game-overlay.has-score-form .game-score-form {
        margin-top: 2px;
        padding: clamp(8px, 2.2vw, 12px);
        border-radius: clamp(14px, 4vw, 18px);
    }

    .game-overlay.has-score-form .game-score-form__label {
        margin-bottom: clamp(5px, 1.8vw, 8px);
        font-size: clamp(12px, 3.2vw, 17px);
        line-height: 1.16;
    }

    .game-overlay.has-score-form .game-score-form__row {
        gap: clamp(6px, 2vw, 9px);
        margin-top: 2px;
    }

    .game-overlay.has-score-form .game-score-form__input,
    .game-overlay.has-score-form .game-score-form__button {
        min-height: clamp(34px, 8svh, 42px);
        font-size: clamp(12px, 3.2vw, 15px);
    }

    .game-overlay.has-score-form .game-score-form__message {
        margin-top: clamp(4px, 1.8vw, 7px);
        min-height: 1em;
        font-size: clamp(10px, 2.8vw, 13px);
    }

    .game-confirm-exit__actions {
        grid-template-columns: 1fr;
    }

    .game-overlay.is-ranking-view .game-overlay__box {
        width: min(calc(var(--game-stage-size) * 0.92), calc(100% - 10px));
        max-height: calc(100% - 8px);
        padding-top: 10px;
        padding-bottom: 6px;
        gap: 1px;
    }

    .game-overlay.is-ranking-view [data-overlay-title] {
        font-size: clamp(20px, 5.5vw, 27px);
        line-height: 1.04;
        padding-inline: 38px;
    }

    .game-overlay.is-ranking-view [data-overlay-text] {
        font-size: clamp(8px, 2.55vw, 11px);
        line-height: 1.08;
    }

    .game-ranking-result {
        flex: 0 1 auto;
        justify-content: flex-start;
        gap: 0;
    }

    .game-ranking-result__text {
        font-size: clamp(8px, 2.55vw, 10px);
        line-height: 1.05;
        gap: 0;
    }

    .game-ranking-result__text + .game-ranking {
        margin-top: -14px;
    }

    .game-ranking {
        flex: 0 1 auto;
        min-height: 172px;
        padding: 6px;
        border-radius: 14px;
    }

    .game-ranking__title {
        margin-bottom: 8px;
        font-size: 11px;
    }

    .game-ranking__list {
        gap: 5px;
    }

    .game-ranking__row {
        grid-template-columns: 42px minmax(0, 1fr) 48px;
        gap: 7px;
        padding: 6px 8px;
        font-size: clamp(8px, 2.45vw, 10px);
        border-radius: 8px;
        line-height: 1.16;
    }
}

/* ---------------------------- */
/* Móvil horizontal / pantallas bajas */
/* ---------------------------- */

@media (orientation: landscape) and (max-height: 700px) {
    .game-overlay.is-ranking-view,
    .game-overlay.has-score-form {
        padding: 4px;
    }

    .game-overlay.is-ranking-view .game-overlay__box,
    .game-overlay.has-score-form .game-overlay__box {
        width: min(calc(var(--game-stage-size) * 0.92), calc(100% - 8px));
        max-width: 620px;
        max-height: calc(100% - 4px);
        padding: 12px 12px 10px;
        gap: 8px;
    }

    .game-overlay.has-score-form .game-overlay__box {
        min-height: auto;
        max-height: calc(100% - 4px);
        padding-top: 28px;
        padding-bottom: 8px;
    }

    .game-score-close {
        top: 6px;
        right: 6px;
        width: 30px;
        height: 30px;
        font-size: 22px;
    }

    .game-overlay.has-score-form [data-overlay-title] {
        font-size: clamp(20px, calc(12px + 1.25vw), 27px);
    }

    .game-overlay.has-score-form [data-overlay-text] {
        font-size: clamp(13px, calc(8px + 0.8vw), 19px);
        line-height: 1.4;
    }

    .game-overlay.has-score-form .game-score-form {
        padding: 10px;
    }

    .game-overlay.has-score-form .game-score-form__label {
        margin-bottom: 8px;
        font-size: clamp(13px, calc(9px + 0.6vw), 16px);
    }

    .game-overlay.has-score-form .game-score-form__row {
        grid-template-columns: 1fr;
        gap: 8px;
        align-items: end;
        margin-top: 4px;
    }

    .game-overlay.has-score-form .game-score-form__input,
    .game-overlay.has-score-form .game-score-form__button {
        min-height: 42px;
        font-size: clamp(13px, calc(8px + 0.55vw), 16px);
    }

    .game-overlay.is-ranking-view .game-overlay__box {
        width: min(calc(var(--game-stage-size) * 0.94), calc(100% - 8px));
        padding-top: 10px;
        padding-bottom: 6px;
        gap: 1px;
    }

    .game-overlay.is-ranking-view [data-overlay-title] {
        font-size: clamp(15px, calc(9px + 1vw), 23px);
        line-height: 1.04;
        padding-inline: 36px;
    }

    .game-overlay.is-ranking-view [data-overlay-text] {
        font-size: clamp(7px, calc(5px + 0.45vw), 10px);
        line-height: 1.08;
    }

    .game-ranking-result {
        flex: 0 1 auto;
        justify-content: flex-start;
        gap: 0;
    }

    .game-ranking-result__text {
        font-size: clamp(7px, calc(5px + 0.5vw), 11px);
        line-height: 1.05;
        gap: 0;
        white-space: nowrap;
    }

    .game-ranking-result__text + .game-ranking {
        margin-top: -6px;
    }

    .game-ranking {
        flex: 0 1 auto;
        min-height: 136px;
        padding: 5px;
        border-radius: 12px;
    }

    .game-ranking__title {
        margin-bottom: 6px;
        font-size: 10px;
    }

    .game-ranking__list {
        gap: 4px;
    }

    .game-ranking__row {
        grid-template-columns: 40px minmax(0, 1fr) 48px;
        gap: 6px;
        padding: 5px 7px;
        font-size: clamp(7px, calc(4px + 0.55vw), 9px);
        line-height: 1.12;
    }

    .game-confirm-exit {
        padding: 10px;
    }

    .game-confirm-exit__text {
        font-size: clamp(11px, calc(7px + 0.6vw), 14px);
    }

    .game-confirm-exit__actions .game-button {
        min-height: 36px;
    }
}

@supports (-webkit-touch-callout: none) {
    .game-mobile-controls,
    .game-landscape-panel,
    .game-topbar,
    .game-stage-wrap {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* ---------------------------- */
/* Pantallas muy bajas          */
/* ---------------------------- */

@media (max-height: 560px) {
    .game-overlay {
        padding: 8px;
    }

    .game-overlay__box {
        width: min(380px, calc(100% - 8px));
        max-height: calc(100% - 8px);
        padding: 16px;
        border-radius: 18px;
        overflow: auto;
    }

    .game-overlay h2 {
        margin-bottom: 7px;
        font-size: clamp(1.35rem, 8.4vh, 1.7rem);
        line-height: 1.08;
    }

    .game-overlay p {
        margin-bottom: 12px;
        font-size: clamp(0.88rem, 4.2vh, 1rem);
        line-height: 1.35;
    }

    .game-actions {
        gap: 8px;
    }

    .arcade-button,
    .game-button {
        min-height: clamp(34px, 10.5vh, 42px);
        padding-inline: clamp(14px, 5vw, 20px);
        font-size: clamp(0.84rem, 3.9vh, 1rem);
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) {
        padding: 5px;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-overlay__box {
        width: min(340px, calc(100% - 8px));
        max-height: calc(100% - 6px);
        padding: clamp(10px, 3.2vh, 14px);
        overflow: hidden;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) h2 {
        margin-bottom: 5px;
        font-size: clamp(1.18rem, 7.2vh, 1.55rem);
        line-height: 1.04;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) p {
        margin-bottom: 8px;
        font-size: clamp(0.78rem, 3.8vh, 0.94rem);
        line-height: 1.2;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-actions {
        gap: 7px;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-button {
        min-height: clamp(30px, 9.2vh, 38px);
        padding-inline: clamp(12px, 4.5vw, 16px);
        font-size: clamp(0.78rem, 3.5vh, 0.94rem);
    }

    .game-overlay.is-ranking-view .game-overlay__box,
    .game-overlay.has-score-form .game-overlay__box {
        width: min(calc(var(--game-stage-size) * 0.94), calc(100% - 8px));
        max-width: 620px;
        padding: 10px 10px 9px;
        gap: 5px;
    }

    .game-overlay.has-score-form .game-overlay__box {
        min-height: auto;
        max-height: calc(100% - 4px);
        padding-top: 28px;
        padding-bottom: 8px;
        overflow: auto;
    }

    .game-score-close {
        top: 5px;
        right: 5px;
        width: 28px;
        height: 28px;
        font-size: 20px;
    }

    .game-overlay.has-score-form [data-overlay-title] {
        font-size: clamp(17px, calc(10px + 1.05vw), 22px);
    }

    .game-overlay.has-score-form [data-overlay-text] {
        font-size: clamp(11px, calc(7px + 0.7vw), 15px);
    }

    .game-overlay.has-score-form .game-score-form {
        padding: 9px 10px 8px;
    }

    .game-overlay.has-score-form .game-score-form__label {
        font-size: clamp(12px, calc(8px + 0.55vw), 15px);
        margin-bottom: 5px;
    }

    .game-overlay.has-score-form .game-score-form__input,
    .game-overlay.has-score-form .game-score-form__button {
        min-height: 38px;
        font-size: clamp(12px, calc(7px + 0.55vw), 14px);
    }

    .game-overlay.is-ranking-view .game-overlay__box {
        padding-top: 8px;
        padding-bottom: 5px;
        gap: 1px;
    }

    .game-overlay.is-ranking-view [data-overlay-title] {
        font-size: clamp(14px, calc(8px + 0.9vw), 19px);
        line-height: 1.04;
    }

    .game-overlay.is-ranking-view [data-overlay-text] {
        font-size: clamp(7px, calc(4px + 0.45vw), 9px);
        line-height: 1.08;
    }

    .game-ranking-result {
        flex: 0 1 auto;
        justify-content: flex-start;
        gap: 0;
    }

    .game-ranking-result__text {
        font-size: clamp(7px, calc(4px + 0.48vw), 10px);
        gap: 0;
        line-height: 1.04;
    }

    .game-ranking-result__text + .game-ranking {
        margin-top: -6px;
    }

    .game-ranking {
        flex: 0 1 auto;
        min-height: 120px;
        padding: 5px;
    }

    .game-ranking__list {
        gap: 3px;
    }

    .game-ranking__row {
        padding: 4px 6px;
        font-size: clamp(7px, calc(4px + 0.45vw), 8px);
        line-height: 1.08;
    }

    .game-confirm-exit {
        padding: 9px;
    }

    .game-confirm-exit__text {
        margin-bottom: 8px;
        font-size: 11px;
    }

    .game-confirm-exit__actions {
        gap: 8px;
    }
}

@media (max-height: 460px) {
    .game-overlay {
        padding: 4px;
    }

    .game-overlay__box {
        width: min(350px, calc(100% - 6px));
        max-height: calc(100% - 6px);
        padding: 12px;
        border-radius: 16px;
    }

    .game-overlay h2 {
        margin-bottom: 5px;
        font-size: clamp(1.12rem, 7.2vh, 1.45rem);
    }

    .game-overlay p {
        margin-bottom: 9px;
        font-size: clamp(0.78rem, 3.55vh, 0.92rem);
    }

    .game-actions {
        gap: 7px;
    }

    .arcade-button,
    .game-button {
        min-height: clamp(30px, 9.2vh, 38px);
        padding-inline: clamp(12px, 4.5vw, 18px);
        font-size: clamp(0.78rem, 3.35vh, 0.94rem);
    }

    .game-overlay.has-score-form .game-overlay__box {
        width: min(calc(var(--game-stage-size) * 0.96), calc(100% - 6px));
        padding: 22px 8px 7px;
        gap: 4px;
    }

    .game-overlay.has-score-form [data-overlay-title] {
        font-size: clamp(14px, calc(8px + 1vw), 18px);
        line-height: 1.05;
        padding-inline: 30px;
    }

    .game-overlay.has-score-form [data-overlay-text] {
        font-size: clamp(9px, calc(6px + 0.65vw), 13px);
        line-height: 1.24;
    }

    .game-overlay.has-score-form .game-score-form {
        margin-top: 2px;
        padding: 7px 8px;
        border-radius: 14px;
    }

    .game-overlay.has-score-form .game-score-form__label {
        margin-bottom: 4px;
        font-size: clamp(11px, calc(7px + 0.55vw), 13px);
        line-height: 1.18;
    }

    .game-overlay.has-score-form .game-score-form__row {
        gap: 6px;
        margin-top: 2px;
    }

    .game-overlay.has-score-form .game-score-form__input,
    .game-overlay.has-score-form .game-score-form__button {
        min-height: 34px;
        font-size: clamp(11px, calc(6px + 0.55vw), 13px);
    }

    .game-score-close {
        top: 4px;
        right: 4px;
        width: 26px;
        height: 26px;
        font-size: 19px;
    }
}

@media (orientation: landscape) and (max-height: 430px) {
    .game-overlay:not(.has-score-form):not(.is-ranking-view) {
        padding: clamp(3px, 1.5dvh, 6px);
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-overlay__box {
        width: min(88%, 310px);
        max-height: calc(100% - 6px);
        padding: clamp(8px, 3dvh, 12px);
        border-radius: clamp(14px, 5dvh, 20px);
        overflow: hidden;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) h2 {
        margin-bottom: clamp(3px, 1.1dvh, 5px);
        font-size: clamp(1rem, 7dvh, 1.45rem);
        line-height: 1.02;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) p {
        margin-bottom: clamp(6px, 2.1dvh, 9px);
        font-size: clamp(0.72rem, 4.3dvh, 0.94rem);
        line-height: 1.18;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-actions {
        gap: clamp(5px, 1.7dvh, 8px);
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-button {
        min-height: clamp(28px, 10.5dvh, 38px);
        padding-inline: clamp(12px, 4.8dvh, 18px);
        font-size: clamp(0.76rem, 4.3dvh, 0.98rem);
    }
}

@media (orientation: landscape) and (max-height: 340px) {
    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-overlay__box {
        width: min(84%, 280px);
        padding: 7px 9px;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) h2 {
        font-size: clamp(0.9rem, 6.6dvh, 1.18rem);
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) p {
        margin-bottom: 5px;
        font-size: clamp(0.66rem, 4.1dvh, 0.82rem);
        line-height: 1.12;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-actions {
        gap: 4px;
    }

    .game-overlay:not(.has-score-form):not(.is-ranking-view) .game-button {
        min-height: clamp(25px, 10dvh, 32px);
        padding-inline: 12px;
        font-size: clamp(0.68rem, 4dvh, 0.84rem);
    }
}

@media (max-width: 900px), (orientation: landscape) and (max-height: 700px) {
    .game-side-panel {
        position: fixed;
        inset: 0;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 940;
        display: none;
        place-items: center;
        width: auto;
        max-height: none;
        padding: 18px;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        transform: none;
        overflow: hidden;
    }

    .game-side-panel.is-visible {
        display: grid;
    }

    .game-info-modal__backdrop {
        display: block;
        position: absolute;
        inset: 0;
        background: rgba(2, 6, 23, 0.72);
        backdrop-filter: blur(8px);
    }

    .game-info-modal__box {
        width: min(520px, 100%);
        max-height: calc(100dvh - 36px);
        padding: 20px;
        border: 1px solid var(--game-panel-border);
        border-radius: 24px;
        background: rgba(15, 23, 42, 0.98);
        box-shadow: 0 24px 90px rgba(0, 0, 0, 0.45);
        overflow: auto;
    }

    .game-info-close {
        display: inline-flex;
    }
}

@media (max-width: 480px), (orientation: landscape) and (max-height: 520px) {
    .game-side-panel {
        padding: 10px;
    }

    .game-info-modal__box {
        width: min(430px, 100%);
        max-height: calc(100dvh - 20px);
        padding: 14px;
        border-radius: 18px;
    }

    .game-side-panel__header {
        margin-bottom: 10px;
    }

    .game-side-panel__header h2 {
        font-size: 1.25rem;
    }

    .game-instructions {
        font-size: 0.92rem;
        line-height: 1.45;
    }
}

/* ---------------------------- */
/* Ranking y nick a pantalla completa */
/* ---------------------------- */

.game-overlay.is-visible.has-score-form,
.game-overlay.is-visible.is-ranking-view {
    position: fixed;
    inset: 0;
    z-index: 930;
    width: auto;
    height: auto;
    padding: clamp(10px, 3dvh, 22px);
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.game-overlay.is-visible.has-score-form .game-overlay__box,
.game-overlay.is-visible.is-ranking-view .game-overlay__box {
    width: min(520px, calc(100dvw - 22px));
    max-width: calc(100dvw - 22px);
    max-height: calc(100dvh - 22px);
    padding: clamp(16px, 3dvh, 26px);
    border-radius: clamp(18px, 4dvh, 28px);
    overflow-x: hidden;
    overflow-y: auto;
}

.game-overlay.is-visible.has-score-form .game-overlay__box {
    padding-top: clamp(30px, 5dvh, 40px);
    gap: clamp(7px, 1.8dvh, 14px);
}

.game-overlay.is-visible.has-score-form [data-overlay-title] {
    font-size: clamp(1.35rem, 4.7dvh, 2.2rem);
    line-height: 1.06;
    padding-inline: clamp(30px, 8vw, 44px);
}

.game-overlay.is-visible.has-score-form [data-overlay-text] {
    font-size: clamp(0.95rem, 3.2dvh, 1.35rem);
    line-height: 1.24;
}

.game-overlay.is-visible.has-score-form .game-score-form {
    width: min(100%, 360px);
    max-width: calc(100dvw - 48px);
    margin-inline: auto;
    padding: clamp(10px, 2.4dvh, 16px);
    border-radius: clamp(16px, 3dvh, 22px);
}

.game-overlay.is-visible.has-score-form .game-score-form__label {
    margin-bottom: clamp(6px, 1.5dvh, 10px);
    font-size: clamp(0.92rem, 3dvh, 1.2rem);
    line-height: 1.16;
}

.game-overlay.is-visible.has-score-form .game-score-form__row {
    gap: clamp(7px, 1.8dvh, 11px);
    margin-top: 2px;
}

.game-overlay.is-visible.has-score-form .game-score-form__input,
.game-overlay.is-visible.has-score-form .game-score-form__button {
    min-height: clamp(38px, 8.5dvh, 54px);
    font-size: clamp(0.9rem, 3dvh, 1.15rem);
}

.game-overlay.is-visible.has-score-form .game-score-form__input {
    padding-inline: clamp(12px, 4vw, 18px);
}

.game-overlay.is-visible.has-score-form .game-score-form__button {
    padding-inline: clamp(14px, 4vw, 20px);
}

@media (max-height: 560px), (max-width: 380px) {
    .game-overlay.is-visible.has-score-form,
    .game-overlay.is-visible.is-ranking-view {
        padding: 8px;
    }

    .game-overlay.is-visible.has-score-form .game-overlay__box,
    .game-overlay.is-visible.is-ranking-view .game-overlay__box {
        width: min(430px, calc(100dvw - 16px));
        max-width: calc(100dvw - 16px);
        max-height: calc(100dvh - 16px);
        padding: 12px;
        border-radius: 18px;
    }

    .game-overlay.is-visible.has-score-form .game-overlay__box {
        padding-top: 28px;
        gap: 5px;
    }

    .game-overlay.is-visible.has-score-form [data-overlay-title] {
        font-size: clamp(1.05rem, 6dvh, 1.55rem);
        padding-inline: 30px;
    }

    .game-overlay.is-visible.has-score-form [data-overlay-text] {
        font-size: clamp(0.78rem, 4dvh, 1rem);
        line-height: 1.18;
    }

    .game-overlay.is-visible.has-score-form .game-score-form {
        width: min(calc(100% - 20px), clamp(240px, 64dvh, 300px));
        max-width: calc(100dvw - 42px);
        padding: 8px;
        border-radius: 15px;
    }

    .game-overlay.is-visible.has-score-form .game-score-form__label {
        margin-bottom: 5px;
        font-size: clamp(0.78rem, 4dvh, 0.98rem);
    }

    .game-overlay.is-visible.has-score-form .game-score-form__row {
        gap: 6px;
    }

    .game-overlay.is-visible.has-score-form .game-score-form__input,
    .game-overlay.is-visible.has-score-form .game-score-form__button {
        min-height: clamp(32px, 9dvh, 40px);
        font-size: clamp(0.78rem, 3.8dvh, 0.95rem);
    }

    .game-overlay.is-visible.has-score-form .game-score-form__message {
        margin-top: 4px;
        font-size: clamp(0.7rem, 3.2dvh, 0.82rem);
    }
}

@media (orientation: landscape) {
    .game-overlay.is-visible.has-score-form .game-overlay__box {
        width: min(620px, calc(100dvw - 24px));
        min-height: 0;
        max-width: 620px;
        max-height: min(680px, calc(100dvh - 24px));
        padding: clamp(18px, 3.2dvh, 28px);
        padding-top: clamp(32px, 4.8dvh, 42px);
        gap: clamp(7px, 2dvh, 14px);
    }

    .game-overlay.is-visible.has-score-form [data-overlay-title] {
        font-size: clamp(1.45rem, 6.2dvh, 2.25rem);
    }

    .game-overlay.is-visible.has-score-form [data-overlay-text] {
        font-size: clamp(1rem, 4.2dvh, 1.35rem);
    }

    .game-overlay.is-visible.has-score-form .game-score-form {
        width: min(100%, 420px);
        padding: clamp(10px, 3dvh, 16px);
    }

    .game-overlay.is-visible.has-score-form .game-score-form__label {
        font-size: clamp(0.95rem, 3.7dvh, 1.2rem);
    }

    .game-overlay.is-visible.has-score-form .game-score-form__input,
    .game-overlay.is-visible.has-score-form .game-score-form__button {
        min-height: clamp(38px, 10dvh, 54px);
        font-size: clamp(0.92rem, 3.7dvh, 1.15rem);
    }

    .game-overlay.is-visible.has-score-form.is-confirm-exit .game-confirm-exit__actions {
        grid-template-columns: 1fr;
    }
}

@media (orientation: landscape) and (max-width: 960px), (orientation: landscape) and (max-height: 520px) {
    .game-overlay.is-visible.has-score-form .game-overlay__box {
        width: min(calc(100dvh - 16px), calc(100dvw - 24px), 520px);
        min-height: min(calc(100dvh - 16px), calc(100dvw - 24px), 520px);
        max-width: min(calc(100dvw - 24px), 520px);
        max-height: calc(100dvh - 16px);
        padding: clamp(16px, 4dvh, 26px) clamp(18px, 5dvh, 30px);
        padding-top: clamp(30px, 6dvh, 42px);
    }

    .game-overlay.is-visible.has-score-form .game-score-form {
        width: min(100%, calc(100dvh - 96px), 390px);
    }
}

@media (orientation: landscape) and (max-height: 420px) {
    .game-overlay.is-visible.has-score-form .game-overlay__box {
        width: min(calc(100dvh - 12px), calc(100dvw - 18px), 460px);
        min-height: min(calc(100dvh - 12px), calc(100dvw - 18px), 460px);
        max-width: min(calc(100dvw - 18px), 460px);
        max-height: calc(100dvh - 12px);
        padding: 26px 16px 10px;
        gap: 5px;
    }

    .game-overlay.is-visible.has-score-form [data-overlay-title] {
        font-size: clamp(1.18rem, 7dvh, 1.55rem);
    }

    .game-overlay.is-visible.has-score-form [data-overlay-text] {
        font-size: clamp(0.82rem, 4.8dvh, 1rem);
        line-height: 1.16;
    }

    .game-overlay.is-visible.has-score-form .game-score-form {
        width: min(100%, calc(100dvh - 76px), 340px);
        padding: 8px 10px;
    }

    .game-overlay.is-visible.has-score-form .game-score-form__input,
    .game-overlay.is-visible.has-score-form .game-score-form__button {
        min-height: clamp(34px, 10dvh, 40px);
    }

    .game-overlay.is-visible.has-score-form.is-confirm-exit .game-confirm-exit__actions {
        grid-template-columns: 1fr 1fr;
    }
}
