:root {
    --navy: #002855;
    --navy-dark: #00162f;
    --navy-soft: #174a74;
    --aqua: #00c5be;
    --aqua-dark: #009c98;
    --gold: #ffd44a;
    --gold-deep: #dba900;
    --cream: #fffaf0;
    --paper: #ffffff;
    --ink: #0f2940;
    --muted: #5d7182;
    --danger: #c93644;
    --focus: var(--gold);
    --touch-opacity: .82;
    --touch-dock-height: 82px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.game-running #menu-overlay { display: none !important; }
html, body { width: 100%; height: 100%; }
body {
    margin: 0;
    overflow: hidden;
    color: var(--ink);
    background:
        radial-gradient(circle at 18% 14%, rgba(0,197,190,.23), transparent 28%),
        radial-gradient(circle at 82% 86%, rgba(255,212,74,.16), transparent 30%),
        linear-gradient(145deg, #00142c, #003164 52%, #00162f);
    font-family: "Segoe UI", Inter, Arial, sans-serif;
}
button, input { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

#app-shell, #game-container { width: 100%; height: 100%; }
#app-shell { transition: height .2s ease; }
#game-container { display: grid; place-items: center; }
canvas {
    max-width: 100%;
    max-height: 100%;
    border: clamp(0px, .5vw, 4px) solid rgba(255,255,255,.92);
    border-radius: clamp(0px, 1.3vw, 12px);
    box-shadow: 0 24px 80px rgba(0,0,0,.42);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    image-rendering: auto;
}

#touch-control-dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    display: flex;
    height: calc(var(--touch-dock-height) + env(safe-area-inset-bottom));
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px max(14px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    border-top: 2px solid rgba(255,212,74,.72);
    color: white;
    background: linear-gradient(180deg, rgba(0,49,100,.98), rgba(0,18,39,.995));
    box-shadow: 0 -12px 34px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.13);
    user-select: none;
    -webkit-user-select: none;
}
.touch-game:not(.modal-open) #app-shell { height: calc(100dvh - var(--touch-dock-height) - env(safe-area-inset-bottom)); }
.modal-open #touch-control-dock { display: none !important; }
.touch-direction-group, .touch-action-group { display: flex; align-items: center; gap: 12px; }
.touch-dock-label { color: #a9cfe1; font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.touch-game-button, .touch-pause {
    display: grid;
    min-width: 64px;
    height: 58px;
    place-items: center;
    padding: 0 18px;
    border: 2px solid rgba(255,255,255,.9);
    border-radius: 18px;
    color: white;
    box-shadow: inset 0 2px 0 rgba(255,255,255,.22), 0 6px 0 rgba(0,0,0,.25);
    font-size: 24px;
    font-weight: 900;
    touch-action: none;
}
.touch-game-button.is-pressed, .touch-pause:active { transform: translateY(4px); box-shadow: inset 0 2px 0 rgba(255,255,255,.18), 0 2px 0 rgba(0,0,0,.28); }
.touch-left { background: linear-gradient(160deg, #1689df, #005da8); }
.touch-right { background: linear-gradient(160deg, #9268de, #6032b2); }
.touch-jump { min-width: 126px; color: var(--navy); background: linear-gradient(160deg, #ffe477, #ffc928); font-size: 16px; }
.touch-pause { min-width: 52px; height: 52px; padding: 0; background: linear-gradient(160deg, #1d668e, #003d69); font-size: 20px; }

.screen-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow: auto;
    overscroll-behavior: contain;
    background:
        radial-gradient(circle at 50% 0, rgba(0,197,190,.12), transparent 38%),
        rgba(0, 18, 39, .92);
    backdrop-filter: blur(14px) saturate(1.08);
}

.panel-card {
    width: min(94vw, 560px);
    max-height: calc(100dvh - 32px);
    overflow: auto;
    padding: clamp(22px, 5vw, 42px);
    text-align: center;
    border: 1px solid rgba(255,255,255,.76);
    border-top: 4px solid var(--gold);
    border-bottom: 7px solid var(--aqua);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(247,251,253,.985));
    box-shadow: 0 34px 100px rgba(0,0,0,.5), 0 0 0 1px rgba(0,197,190,.14);
}
.panel-card h1, .panel-card h2 { margin: 4px 0 12px; color: var(--navy); line-height: 1.05; }
.panel-card h1 { font-size: clamp(29px, 5vw, 43px); }
.panel-card h2 { font-size: clamp(26px, 4.5vw, 36px); }
.panel-card p { line-height: 1.5; }
.eyebrow { margin: 0 0 9px !important; color: var(--aqua-dark); font-size: 12px; font-weight: 900; letter-spacing: .15em; }
.eyebrow.danger { color: var(--danger); }
.lead { margin: 0 0 24px; color: var(--muted); font-size: 17px; }
.brand-logo { width: min(280px, 74vw); height: auto; }
#menu-overlay { isolation: isolate; }
#menu-overlay::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background: url("../../assets/img/portada_juego.png") center 42% / cover no-repeat;
    filter: blur(16px) saturate(.82);
    opacity: .22;
}
#menu-overlay::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(135deg, rgba(0,18,39,.94), rgba(0,40,85,.82) 55%, rgba(0,18,39,.94));
}
.menu-card { width: min(94vw, 580px); }
.menu-brand-panel {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: center;
    gap: 15px;
    margin: 4px auto 13px;
    padding: 11px 18px 11px 11px;
    border: 1px solid rgba(255,212,74,.54);
    border-radius: 20px;
    background: linear-gradient(135deg, #001d3f, var(--navy-soft));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 14px 30px rgba(0,40,85,.25);
}
.menu-app-icon { display: block; width: 82px; height: 82px; border: 3px solid rgba(255,255,255,.88); border-radius: 20px; box-shadow: 0 8px 20px rgba(0,0,0,.32); }
.menu-logo { display: block; width: min(245px, 48vw); margin: 0 auto; }
.menu-card h1 { letter-spacing: -.035em; }

.menu-card label, .settings-card > label { display: grid; gap: 8px; margin: 0 0 12px; color: var(--navy); font-weight: 700; text-align: left; }
input[type="text"] {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    border: 2px solid #cbd7e0;
    border-radius: 11px;
    color: var(--ink);
    text-align: center;
    background: #fff;
    box-shadow: inset 0 2px 5px rgba(0,40,85,.05);
}
input[type="text"]:focus { border-color: var(--aqua); }
input[type="range"] { width: 100%; accent-color: var(--aqua-dark); }
.check-row { grid-template-columns: auto 1fr; align-items: center; }
.check-row input { width: 20px; height: 20px; accent-color: var(--aqua-dark); }

.button {
    min-height: 46px;
    padding: 12px 20px;
    border: 2px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 800;
    letter-spacing: .035em;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.28);
    transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.button-primary { color: white; background: linear-gradient(135deg, #00aaa5, #007f83); box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 9px 22px rgba(0,156,152,.28); }
.button-primary:hover { background: linear-gradient(135deg, #00bcb6, #006f74); box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 12px 27px rgba(0,156,152,.34); }
.button-secondary { color: var(--navy); border-color: #b5c8d7; background: linear-gradient(180deg, #fff, #e9f1f6); }
.menu-actions, .result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.menu-actions .button { flex: 1 1 180px; }
.text-button { padding: 7px 10px; color: var(--navy); border: 0; border-radius: 8px; background: transparent; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.text-button:hover { background: rgba(0,40,85,.07); }
.utility-actions { display: flex; justify-content: center; gap: 9px; margin: 13px 0 7px; }
.utility-button { display: inline-flex; min-height: 38px; align-items: center; gap: 7px; padding: 8px 13px; color: white; border: 1px solid #3b7499; border-radius: 999px; background: linear-gradient(180deg, #174f75, #06385f); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 5px 12px rgba(0,40,85,.18); cursor: pointer; font-size: 13px; font-weight: 800; }
.utility-button:hover { border-color: var(--gold); background: linear-gradient(180deg, #1d648e, #06385f); }
.utility-button span { color: var(--gold); font-size: 16px; }
.menu-card small { color: #718391; }
.status { min-height: 22px; margin: 12px 0 0; color: var(--navy); font-weight: 700; }
.loading-track { height: 8px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: #dbe4eb; }
#loading-bar { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--aqua); transition: width .2s ease; }

.splash {
    z-index: 500;
    overflow: hidden;
    color: white;
    background:
        radial-gradient(circle at 50% 42%, rgba(0,197,190,.16), transparent 32%),
        radial-gradient(circle at 20% 12%, rgba(255,212,74,.09), transparent 24%),
        linear-gradient(145deg, #000f23, #002855 56%, #00142c);
}
.splash::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,.15) 1px, transparent 1.5px);
    background-size: 38px 38px;
    opacity: .2;
    mask-image: linear-gradient(to bottom, #000, transparent 78%);
}
.splash-slide {
    position: absolute;
    inset: 0;
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(54px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(16px) scale(.98);
    transition: opacity .82s ease, transform .82s ease, visibility 0s linear .82s;
}
.splash-slide.is-active { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition-delay: 0s; }
.intro-lockup { display: grid; justify-items: center; gap: 15px; text-align: center; }
.intro-brand-logo { width: min(430px, 78vw); filter: drop-shadow(0 14px 30px rgba(0,0,0,.35)); }
.intro-divider { width: 62px; height: 3px; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--aqua)); }
.splash-slide p { margin: 0; color: #bdebea; font-size: 13px; font-weight: 800; letter-spacing: .17em; }
.splash-slide strong { font-size: clamp(22px, 4vw, 34px); letter-spacing: .12em; }
.creator-lockup { gap: 11px; }
.studio-mark {
    display: grid;
    width: 112px;
    height: 112px;
    margin-bottom: 8px;
    place-items: center;
    border: 2px solid var(--gold);
    border-radius: 32px;
    color: white;
    background: linear-gradient(145deg, rgba(23,74,116,.8), rgba(0,22,47,.9));
    box-shadow: inset 0 0 0 5px rgba(255,255,255,.06), 0 18px 45px rgba(0,0,0,.34), 0 0 35px rgba(255,212,74,.12);
    font-size: 31px;
    font-weight: 900;
    letter-spacing: .07em;
}
.creator-subtitle { color: #9ccbd3; font-size: 14px; letter-spacing: .07em; }
.video-slide { padding-block: max(12px, env(safe-area-inset-top)) max(50px, env(safe-area-inset-bottom)); }
.intro-video-stage {
    position: relative;
    width: min(1100px, calc(100vw - 58px));
    height: min(680px, calc(100dvh - 78px));
    overflow: hidden;
    border: 2px solid rgba(255,212,74,.72);
    border-radius: 28px;
    background: #000b18;
    box-shadow: 0 36px 110px rgba(0,0,0,.68), 0 0 0 1px rgba(255,255,255,.14);
}
.intro-video-stage video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.intro-video-prompt {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: end center;
    justify-items: center;
    gap: 10px;
    padding: 34px 22px 58px;
    color: white;
    background: linear-gradient(180deg, rgba(0,11,24,.06) 28%, rgba(0,22,47,.72) 62%, rgba(0,11,24,.96));
    text-align: center;
    transition: opacity .3s ease;
}
.intro-video-prompt .eyebrow { color: var(--gold); }
.intro-video-prompt strong { font-size: clamp(25px, 4vw, 42px); letter-spacing: .035em; }
.intro-video-prompt > span { color: #d8f8f6; font-size: clamp(14px, 2vw, 18px); }
.intro-video-play { min-width: min(330px, 78vw); color: var(--navy); border-color: #fff1ad; background: linear-gradient(180deg, #ffe982, var(--gold)); box-shadow: 0 12px 30px rgba(255,212,74,.28); }
.intro-video-stage.is-playing .intro-video-prompt { opacity: 0; pointer-events: none; }
.video-skip-button {
    position: absolute;
    right: 16px;
    bottom: 14px;
    z-index: 3;
    min-height: 42px;
    padding: 9px 15px;
    color: white;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 999px;
    background: rgba(0,40,85,.78);
    backdrop-filter: blur(8px);
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
}
.video-skip-button:hover { color: var(--navy); border-color: var(--gold); background: var(--gold); }
.intro-video-status { position: absolute; left: 16px; bottom: 18px; z-index: 3; max-width: calc(100% - 220px); color: white !important; font-size: 12px !important; letter-spacing: 0 !important; }
.cover-slide { padding-block: max(14px, env(safe-area-inset-top)) max(50px, env(safe-area-inset-bottom)); }
.cover-presentation {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(230px, 320px);
    width: min(1180px, calc(100vw - 62px));
    height: min(790px, calc(100dvh - 76px));
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 28px;
    background: rgba(0,18,39,.72);
    box-shadow: 0 38px 110px rgba(0,0,0,.62), 0 0 0 1px rgba(255,212,74,.12);
}
.cover-art-shell { position: relative; display: grid; min-width: 0; min-height: 0; place-items: center; overflow: hidden; background: #dda900; }
.cover-ambient { position: absolute; inset: -50px; background: url("../../assets/img/portada_juego.png") center / cover no-repeat; filter: blur(34px) saturate(1.1); opacity: .58; transform: scale(1.12); }
.cover-art-shell::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 70px rgba(0,22,47,.34); }
.game-cover { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 22px 38px rgba(0,0,0,.34)); }
.cover-entry-panel { position: relative; z-index: 2; display: grid; align-content: center; justify-items: center; gap: 14px; padding: 28px; color: white; background: linear-gradient(160deg, rgba(0,49,100,.98), rgba(0,18,39,.99)); text-align: center; }
.cover-entry-panel::before { content: ""; width: 52px; height: 3px; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--aqua)); }
.cover-app-icon { width: 104px; height: 104px; border: 3px solid rgba(255,255,255,.9); border-radius: 25px; box-shadow: 0 18px 35px rgba(0,0,0,.38); }
.cover-entry-panel .eyebrow { color: var(--gold); }
.cover-entry-panel > strong { max-width: 250px; font-size: clamp(17px, 2.2vw, 22px); line-height: 1.35; letter-spacing: 0; }
.cover-enter-button { width: 100%; color: var(--navy-dark); border-color: #fff0a7; background: linear-gradient(180deg, #ffe374, var(--gold)); box-shadow: inset 0 1px 0 #fff6c9, 0 11px 25px rgba(255,212,74,.22); }
.cover-enter-button:hover { background: linear-gradient(180deg, #ffea90, #ffc928); box-shadow: inset 0 1px 0 #fff, 0 14px 30px rgba(255,212,74,.3); }
.intro-music-button { min-height: 36px; padding: 7px 13px; color: #d8f8f6; border: 1px solid #3f888a; border-radius: 999px; background: rgba(0,197,190,.12); cursor: pointer; font-size: 12px; font-weight: 900; letter-spacing: .06em; }
.intro-music-button[aria-pressed="true"] { color: var(--navy); border-color: #ffe98f; background: var(--gold); }
.cover-entry-panel small { color: #a9c5d7; font-size: 12px; }
.splash-progress { position: absolute; bottom: max(27px, env(safe-area-inset-bottom)); left: 50%; display: flex; gap: 9px; transform: translateX(-50%); }
.splash-progress span { width: 8px; height: 8px; border: 1px solid #73a5c6; border-radius: 50%; background: transparent; transition: width .3s ease, background-color .3s ease; }
.splash-progress span.is-active { width: 25px; border-radius: 999px; border-color: var(--aqua); background: var(--aqua); }
.skip-button { position: absolute; top: max(18px, env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right)); z-index: 4; padding: 9px 13px; color: #c5dce8; border: 1px solid #527493; border-radius: 999px; background: rgba(0,22,47,.58); cursor: pointer; }
.skip-button:hover { color: white; border-color: var(--aqua); background: rgba(0,40,85,.82); }

.level-card { max-width: 640px; }
.objective { padding: 13px 16px; color: var(--navy); border-left: 5px solid var(--aqua); background: #eaf8f7; font-weight: 700; text-align: left; }
.level-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0; }
.level-facts span { display: grid; gap: 4px; padding: 10px 7px; color: var(--muted); border-radius: 10px; background: #edf3f7; font-size: 13px; }
.level-facts strong { color: var(--navy); font-size: 16px; }
.controls-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0 12px; }
.control-card { display: grid; min-height: 112px; justify-items: center; align-content: center; gap: 7px; padding: 14px 10px; border: 2px solid transparent; border-radius: 15px; color: var(--navy); box-shadow: 0 7px 18px rgba(0,40,85,.09); }
.control-card strong { font-size: 12px; line-height: 1.2; letter-spacing: .045em; }
.control-card small { font-size: 11px; line-height: 1.3; }
.control-move { border-color: #aacbe9; background: linear-gradient(180deg, #f4f9ff, #e2effa); }
.control-move small { color: #345a7c; }
.control-jump { border-color: #8dded9; background: linear-gradient(180deg, #f1ffff, #dcf5f3); }
.control-jump small { color: #25706d; }
.control-touch { border-color: #f1ce55; background: linear-gradient(180deg, #fffdf2, #fff3bd); }
.control-touch small { color: #725d13; }
.control-icon { display: grid; min-width: 58px; min-height: 30px; place-items: center; padding: 4px 8px; color: #fff; border-radius: 8px; background: var(--navy); box-shadow: 0 4px 0 #001a38; font-size: 13px; font-weight: 900; }
.control-jump .control-icon { background: #008d89; box-shadow: 0 4px 0 #006562; }
.control-touch .control-icon { color: var(--navy); background: #ffd44a; box-shadow: 0 4px 0 #c99e00; }
.question-rule { display: flex; align-items: center; gap: 10px; margin: 10px 0 17px; padding: 10px 13px; color: var(--navy); border-radius: 12px; background: #fff4c7; text-align: left; }
.question-rule > strong { display: grid; min-width: 35px; height: 35px; place-items: center; color: #fff; border-radius: 8px; background: var(--navy); font-size: 24px; }
.question-rule span { font-size: 13px; font-weight: 700; line-height: 1.35; }

.quiz-card { max-width: 620px; text-align: left; }
.quiz-instructions { margin: -3px 0 13px; color: var(--muted); font-size: 13px; font-weight: 600; }
.quiz-options { display: grid; gap: 10px; }
.quiz-option { width: 100%; min-height: 52px; padding: 12px 14px; color: var(--ink); border: 2px solid #cbd7e0; border-radius: 11px; background: #f5f8fa; cursor: pointer; touch-action: manipulation; text-align: left; }
.quiz-option:hover:not(:disabled), .quiz-option:focus-visible, .quiz-option.is-selected:not(:disabled) { border-color: var(--aqua-dark); background: #e0f7f5; box-shadow: 0 0 0 3px rgba(0,156,152,.18); transform: translateX(3px); }
.quiz-option.is-correct { color: #075a42; border-color: #43b88e; background: #e0f6ee; }
.quiz-option.is-wrong { color: #8d1f2b; border-color: #de6c78; background: #fde8eb; }
.quiz-feedback { display: grid; gap: 5px; margin: 16px 0; padding: 13px; border-radius: 10px; line-height: 1.45; }
.quiz-feedback.is-correct { color: #075a42; background: #e0f6ee; }
.quiz-feedback.is-wrong { color: #8d1f2b; background: #fde8eb; }

.score-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.score-grid div { padding: 13px; border-radius: 12px; background: #edf3f7; }
.score-grid dt { color: var(--muted); font-size: 13px; }
.score-grid dd { margin: 5px 0 0; color: var(--navy); font-size: 24px; font-weight: 900; }
.score-grid .score-total { grid-column: 1 / -1; color: white; background: var(--navy); }
.score-grid .score-total dt, .score-grid .score-total dd { color: white; }
.result-stats { color: var(--muted); }
.compact-card { max-width: 500px; }
.results-card, .gameover-card { width: min(94vw, 790px); max-width: 790px; }
.outcome-layout { display: grid; grid-template-columns: minmax(0, 1fr) 230px; align-items: center; gap: 22px; }
.outcome-copy { min-width: 0; }
.outcome-bear-panel { position: relative; display: grid; min-height: 320px; place-items: end center; overflow: hidden; border-radius: 20px; background: radial-gradient(circle at 50% 72%, rgba(255,255,255,.96), rgba(0,197,190,.2) 38%, rgba(0,40,85,.08) 64%, transparent 65%); }
.outcome-bear-panel::after { content: ""; position: absolute; bottom: 12px; width: 72%; height: 20px; border-radius: 50%; background: rgba(0,40,85,.16); filter: blur(5px); }
.outcome-bear-panel img { position: relative; z-index: 1; display: block; max-width: 100%; max-height: 310px; object-fit: contain; filter: drop-shadow(0 16px 18px rgba(0,40,85,.24)); }
.outcome-bear-panel.is-gameover { background: radial-gradient(circle at 50% 72%, rgba(255,255,255,.96), rgba(201,54,68,.14) 40%, transparent 68%); }
.pause-card { width: min(92vw, 560px); }
.pause-help { margin: 0 0 12px; color: var(--muted); }
.pause-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.pause-actions .button { width: 100%; }
.pause-map-button { grid-column: 1 / -1; color: white; background: linear-gradient(135deg, #a32635, #761b28); }
.ios-help-card ol { display: grid; gap: 8px; margin: 16px 0; padding-left: 24px; color: var(--navy); text-align: left; }
.ios-help-card p { color: var(--muted); }
#ios-fullscreen-overlay { z-index: 950; }

#orientation-overlay { display: none; position: fixed; inset: 0; z-index: 900; padding: 24px; place-items: center; color: white; background: rgba(0,22,47,.98); text-align: center; }
.requiere-giro #orientation-overlay { display: grid; }
.orientation-card { display: grid; justify-items: center; gap: 12px; max-width: 360px; font-size: 18px; line-height: 1.35; }
.orientation-card strong { font-size: 26px; }
.phone-icon { display: grid; width: 70px; height: 110px; place-items: center; border: 5px solid var(--aqua); border-radius: 12px; font-size: 44px; animation: rotate-phone 1.8s ease-in-out infinite; }
@keyframes rotate-phone { 0%, 35% { transform: rotate(0); } 65%, 100% { transform: rotate(90deg); } }

#toast { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 1000; max-width: min(90vw, 520px); padding: 11px 18px; color: white; border-radius: 999px; background: var(--navy); box-shadow: 0 10px 35px rgba(0,0,0,.35); opacity: 0; transform: translate(-50%, 18px); pointer-events: none; transition: .2s ease; text-align: center; }
#toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.game-running #toast { top: max(76px, env(safe-area-inset-top)); bottom: auto; transform: translate(-50%, -18px); }
.game-running #toast.is-visible { transform: translate(-50%, 0); }

.high-contrast { --navy: #001b3c; --aqua-dark: #006f6c; --muted: #354654; }
.reduced-motion *, .reduced-motion *::before, .reduced-motion *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }

@media (max-width: 700px) {
    .controls-guide { grid-template-columns: 1fr 1fr; gap: 10px; }
    .control-touch { grid-column: 1 / -1; min-height: 92px; }
}

@media (max-width: 560px) {
    .panel-card { width: calc(100vw - 20px); padding: 24px 18px; border-radius: 18px; }
    .level-facts { grid-template-columns: 1fr; }
    .menu-actions { flex-direction: column; }
    .menu-actions .button { flex-basis: auto; width: 100%; }
    .controls-guide { grid-template-columns: 1fr; }
    .control-touch { grid-column: auto; }
    .menu-brand-panel { grid-template-columns: 66px minmax(0, 1fr); gap: 10px; padding: 9px 13px 9px 9px; }
    .menu-app-icon { width: 66px; height: 66px; border-radius: 17px; }
    .menu-logo { width: min(215px, 48vw); }
    .cover-presentation { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; width: calc(100vw - 24px); height: calc(100dvh - 74px); border-radius: 20px; }
    .intro-video-stage { width: calc(100vw - 24px); height: calc(100dvh - 74px); border-radius: 20px; }
    .intro-video-prompt { padding: 24px 14px 68px; }
    .intro-video-status { display: none; }
    .cover-entry-panel { grid-template-columns: auto 1fr; gap: 7px 12px; padding: 13px 16px; text-align: left; }
    .cover-entry-panel::before, .cover-entry-panel .eyebrow, .cover-entry-panel > strong { display: none; }
    .cover-app-icon { grid-row: 1 / 3; width: 58px; height: 58px; border-radius: 15px; }
    .cover-enter-button { width: 100%; min-height: 42px; padding-block: 9px; }
    .cover-entry-panel small { text-align: center; }
}

@media (max-height: 500px) and (orientation: landscape) {
    :root { --touch-dock-height: 68px; }
    .screen-overlay { padding: 5px max(7px, env(safe-area-inset-right)) 5px max(7px, env(safe-area-inset-left)); overflow: hidden; }
    .panel-card { width: min(92vw, 680px); padding: 15px 24px; border-radius: 16px; }
    .menu-logo { width: 175px; }
    .menu-card { width: min(92vw, 620px); }
    .menu-brand-panel { grid-template-columns: 58px minmax(0, 1fr); margin-bottom: 7px; padding: 7px 13px 7px 7px; border-radius: 14px; }
    .menu-app-icon { width: 58px; height: 58px; border-radius: 13px; }
    .panel-card h1 { font-size: 29px; }
    .panel-card h2 { font-size: 25px; }
    .lead { margin-bottom: 10px; }
    .level-card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); grid-template-rows: auto auto auto 1fr auto; grid-template-areas: "kicker controls" "title controls" "objective controls" "intro rule" "facts start"; width: min(calc(100vw - 12px), 920px); height: calc(100dvh - 10px); max-width: 920px; max-height: none; gap: 3px 14px; padding: 9px 15px; overflow: hidden; text-align: left; }
    #level-kicker { grid-area: kicker; margin: 0 !important; }
    #level-title { grid-area: title; margin: 0; font-size: clamp(21px, 5.5vh, 28px); }
    #level-objective { grid-area: objective; margin: 3px 0; padding: 6px 9px; font-size: 12px; line-height: 1.25; }
    #level-intro-copy { grid-area: intro; align-self: center; margin: 2px 0; font-size: 11px; line-height: 1.25; }
    .level-facts { grid-area: facts; gap: 4px; margin: 3px 0 0; }
    .level-facts span { padding: 5px 3px; font-size: 9px; text-align: center; }
    .level-facts strong { font-size: 12px; }
    .controls-guide { grid-area: controls; grid-template-columns: 1fr; align-self: stretch; gap: 4px; margin: 0; }
    .control-card { min-height: 0; grid-template-columns: auto 1fr; grid-template-rows: auto auto; justify-items: start; align-content: center; align-items: center; gap: 0 7px; padding: 5px 7px; border-radius: 9px; }
    .control-card .control-icon { grid-row: 1 / 3; min-width: 45px; min-height: 25px; font-size: 10px; }
    .control-card strong { font-size: 9px; }
    .control-card small { grid-column: 2; font-size: 8px; }
    .question-rule { grid-area: rule; align-self: center; margin: 3px 0; padding: 6px 7px; border-radius: 9px; }
    .question-rule > strong { min-width: 27px; height: 27px; font-size: 18px; }
    .question-rule span { font-size: 10px; line-height: 1.2; }
    #level-start { grid-area: start; align-self: end; width: 100%; min-height: 40px; padding: 7px 12px; }
    .quiz-card { max-width: 720px; }
    .quiz-options { grid-template-columns: 1fr 1fr; gap: 7px; }
    .quiz-option { min-height: 42px; padding: 8px 11px; }
    .cover-presentation { grid-template-columns: minmax(250px, 1fr) minmax(190px, 260px); width: calc(100vw - 42px); height: calc(100dvh - 34px); border-radius: 18px; }
    .intro-video-stage { width: calc(100vw - 42px); height: calc(100dvh - 34px); border-radius: 18px; }
    .intro-video-prompt { gap: 6px; padding: 14px 18px 50px; }
    .intro-video-prompt strong { font-size: 24px; }
    .intro-video-prompt > span { font-size: 13px; }
    .intro-video-play { min-width: 250px; min-height: 40px; padding: 7px 15px; font-size: 12px; }
    .video-skip-button { right: 10px; bottom: 8px; min-height: 38px; padding: 7px 12px; font-size: 11px; }
    .cover-entry-panel { gap: 8px; padding: 15px; }
    .cover-entry-panel::before { width: 38px; }
    .cover-app-icon { width: 72px; height: 72px; border-radius: 18px; }
    .cover-entry-panel > strong { font-size: 16px; }
    .cover-enter-button { min-height: 41px; padding: 8px 12px; }
    .intro-music-button { min-height: 30px; padding: 5px 10px; font-size: 10px; }
    .splash-progress { bottom: 9px; }
    .skip-button { top: 10px; right: 10px; padding: 7px 10px; font-size: 11px; }
    .results-card, .gameover-card { width: min(calc(100vw - 12px), 820px); height: calc(100dvh - 10px); max-width: 820px; max-height: none; padding: 10px 14px; overflow: hidden; }
    .outcome-layout { grid-template-columns: minmax(0, 1fr) minmax(120px, 25%); height: 100%; gap: 10px; }
    .outcome-copy { display: grid; align-content: center; }
    .outcome-copy .eyebrow { margin-bottom: 2px !important; }
    .outcome-copy h2 { margin: 0 0 3px; font-size: 22px; }
    .outcome-copy .lead, #gameover-copy { margin: 0 0 5px; font-size: 12px; }
    .score-grid { grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 5px 0; }
    .score-grid .score-total { grid-column: auto; }
    .score-grid div { padding: 6px; }
    .score-grid dt { font-size: 10px; }
    .score-grid dd { margin-top: 2px; font-size: 17px; }
    .result-stats { margin: 3px 0; font-size: 11px; }
    .result-actions, .gameover-card .menu-actions { flex-wrap: nowrap; gap: 5px; margin-top: 5px; }
    .result-actions .button, .gameover-card .button { min-height: 39px; padding: 7px 11px; font-size: 11px; }
    .outcome-bear-panel { min-height: 0; height: 100%; }
    .outcome-bear-panel img { max-height: 100%; }
    .pause-card { width: min(calc(100vw - 16px), 650px); max-height: calc(100dvh - 10px); padding: 10px 18px; overflow: hidden; }
    .pause-card h2 { margin: 0 0 4px; }
    .pause-help { margin-bottom: 6px; font-size: 11px; }
    .pause-actions { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .pause-actions .button { min-height: 38px; padding: 6px 10px; font-size: 10px; }
    .pause-map-button { grid-column: auto; }
    #touch-control-dock { gap: 8px; padding-top: 5px; padding-bottom: max(5px, env(safe-area-inset-bottom)); }
    .touch-direction-group, .touch-action-group { gap: 8px; }
    .touch-game-button { min-width: 62px; height: 50px; border-radius: 15px; }
    .touch-jump { min-width: 112px; font-size: 14px; }
    .touch-pause { width: 46px; min-width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (forced-colors: active) {
    .panel-card, .quiz-option, .button { border: 2px solid ButtonText; }
    .button-primary, .button-secondary { color: ButtonText; background: ButtonFace; }
}
