@import url("fonts/fonts.css");
* { box-sizing:border-box }
body { margin:0; overflow:hidden; background:#101d37; color:#172b44; font:400 16px/1.5 "Be Vietnam Pro","Segoe UI",sans-serif }
button { font:inherit; font-weight:700; cursor:pointer; touch-action:manipulation; min-height:44px; min-width:44px; border-radius:13px; border:1px solid #b4c4d4; color:inherit }
button:focus-visible,summary:focus-visible { outline:3px solid #db750f; outline-offset:2px }
canvas { position:absolute; inset:0; width:100%; height:100%; display:block; touch-action:none }
#fireworksCanvas { z-index:6;pointer-events:none }
.icon { width:19px;height:19px;vertical-align:middle;flex:none }
.overlay { position:fixed;inset:0;z-index:5;overflow:auto;overscroll-behavior:contain;display:flex;flex-direction:column;padding:max(16px,env(safe-area-inset-top)) max(5vw,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(5vw,env(safe-area-inset-left)) }
#start-screen,#end-screen { background:radial-gradient(ellipse at bottom left,#dfefeb,transparent 55%),linear-gradient(130deg,#fffcf6,#e9f1f9) }
.mast { display:flex;align-items:center;gap:11px;width:min(1140px,100%);margin:0 auto;border-bottom:1px solid #c9d5de;padding:0 0 13px;flex:none;font-size:15px }
.mast small,.mode-btn small {display:block;color:#475569;font-size:12px}
.mark { display:grid;place-items:center;background:#192b48;color:#ffda94;width:40px;height:40px;border-radius:14px 14px 14px 5px }
.mark .icon {width:27px;height:27px}
.launch { width:min(1140px,100%);margin:auto; padding:clamp(20px,4vh,42px) 0;display:grid;grid-template-columns:1fr 1.04fr;gap:clamp(30px,5vw,74px);align-items:center }
.poster {grid-column:2;grid-row:1;align-self:stretch;min-height:470px;border-radius:22px 58px 22px 22px;overflow:hidden;position:relative;background:var(--deep)}
.poster img {width:100%;height:100%;position:absolute;object-fit:cover}
.brief {grid-column:1;grid-row:1}
.topics,legend,.badge,.quiz-tag,.school-tag {font-size:12px;font-weight:800;letter-spacing:.085em;text-transform:uppercase;color:var(--ink)}
.topics::before {content:'';width:30px;height:4px;background:#df9851;display:inline-block;margin-right:10px;vertical-align:middle}
h1 {font-size:clamp(48px,5.8vw,88px);letter-spacing:-.055em;line-height:1.12;margin:12px 0 16px}
h1 em {color:var(--ink);font-style:normal}
.intro {display:flex;gap:10px;align-items:center;margin:0 0 17px;font-size:15px}.intro img {width:52px;height:52px}
fieldset {border:0;margin:0;padding:0}legend {margin-bottom:8px}
.modes {display:grid;grid-template-columns:1fr 1fr;gap:10px}
.mode-btn {text-align:left;background:white;padding:10px 22px 10px 12px;font-size:14px;position:relative}
.mode-btn::after {content:'';position:absolute;right:8px;top:13px;width:9px;height:9px;border-radius:50%;border:1px solid #678}
.mode-btn.active {background:var(--soft);border-color:var(--ink);box-shadow:inset 0 0 0 1px var(--ink)}
.mode-btn.active::after {background:var(--ink);box-shadow:inset 0 0 0 2px white}
.primary,.btn-next-q,.btn-continue,.highlight {background:linear-gradient(110deg,var(--cta),var(--deep));color:white;border:0}
.primary {padding:13px 18px;margin:12px 0 9px;width:100%;font-size:18px;box-shadow:0 4px 0 var(--ink)}
.guide {font-size:13px;color:#43546a}.guide p {display:flex;gap:8px;margin:6px 0;align-items:baseline}.guide .icon {align-self:flex-start;color:var(--ink);width:17px}
.guide summary {font-weight:700;color:var(--ink);cursor:pointer;min-height:44px;align-content:center}
#end-screen {align-items:center;text-align:center}.result,.card,.quiz-card {width:min(650px,100%);border-radius:25px;background:#fafcfb;padding:clamp(18px,3vw,36px);margin:auto;border:1px solid #c5d4df;box-shadow:0 12px 50px #152c4224}
.result {flex:none}.result h1 {font-size:clamp(30px,4vw,55px)}.result>img {width:90px}.result .primary {width:auto;padding-inline:30px}.result .stats {background:var(--soft);border-radius:15px;padding:10px;color:var(--ink);font-weight:700}
#station-modal,#quiz-modal {display:none;background:#0a1837bb}.card,.quiz-card {flex:none}
.card-header,.quiz-header-row {display:flex;align-items:center;justify-content:space-between;gap:12px}
.close-x {background:#edf2f6}.wonder-title {display:flex;align-items:center;gap:12px;font-size:clamp(23px,3vw,36px);margin:12px 0;color:var(--ink);line-height:1.22}.wonder-title img {width:55px;height:55px}
.wonder-desc,.eco-banner,.next-prompt-sub,.next-banner-fact {font-size:14px}
.eco-banner,.next-prompt-box,.next-banner {background:#dff4e9;color:#174d40;border-radius:14px;padding:12px 16px}
.eco-banner strong {display:block;font-size:12px;letter-spacing:.04em}.quiz-title,.quiz-q {font-size:clamp(17px,2vw,23px);font-weight:700;line-height:1.4}
.opt-list,.quiz-opts {display:grid;gap:7px}.opt-btn,.quiz-opt {display:flex;align-items:center;gap:12px;text-align:left;background:white;padding:9px 12px;font-size:15px}.opt-letter {display:grid;place-items:center;border-radius:8px;background:#e8eff4;min-width:29px;height:29px}
.opt-btn.correct,.quiz-opt.correct {background:#d2f6e2;color:#10523a;border-color:#38835d}.opt-btn.wrong,.quiz-opt.wrong {background:#fee2e2;color:#862a28;border-color:#b65955}.opt-btn.correct::after {content:'✓';margin-left:auto}.opt-btn.wrong::after {content:'×';margin-left:auto}
.next-prompt-box,.next-banner {display:none;margin-top:12px}.wrong-box,.warn-banner {background:#fff0d5;color:#663910}
.next-prompt-text,.next-banner-title {font-weight:700;margin:0}.btn-next-q,.btn-continue {padding:8px 14px}
#hud {position:absolute;z-index:2;inset:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:6px;flex-wrap:wrap;padding:max(7px,env(safe-area-inset-top)) max(2vw,env(safe-area-inset-right)) 7px max(2vw,env(safe-area-inset-left));background:#172b48;color:#f5f8fc;border-bottom:2px solid #718ca6;font-weight:700;font-size:clamp(13px,1.1vw,17px)}
.hud-group,.hud-box,.hud-pill,#sound-btn {display:flex;align-items:center;gap:7px}.hud-group {gap:clamp(8px,2vw,28px)}.hud-box,.hud-pill {white-space:nowrap}.hud-box .icon,.hud-pill .icon {color:#ffdb97}
#sound-btn,.nav-btn,.pad-btn,#sonar-btn {background:#223c58;color:white;border:1px solid #819bb1;padding:8px 12px}
#progress-wrap {position:absolute;inset:0 0 auto;height:3px;z-index:3}#progress-bar,.bar-fill,#clean-bar,#sonar-bar {height:100%;background:#72e1bd}
.bar-track,.bar-wrap {height:7px;width:58px;background:#48627a;border-radius:4px;overflow:hidden}
#bottom-bar,#action-bar {position:absolute;bottom:max(10px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);display:flex;gap:8px;z-index:2;white-space:nowrap}
#action-bar {width:calc(100% - 32px);justify-content:space-between}#sonar-btn.ready,.nav-btn.highlight {background:var(--cta)}
@media(max-width:740px), (max-width:900px) and (orientation:portrait){
 .overlay {padding-inline:max(16px,env(safe-area-inset-left)) max(16px,env(safe-area-inset-right))}
 .launch {display:flex;flex-direction:column;align-items:stretch;gap:15px;max-width:520px;margin:0 auto;padding:14px 0 0}
 .poster {min-height:0;height:clamp(125px,20vh,190px);border-radius:15px 32px 15px 15px}
 h1 {font-size:clamp(40px,9vw,62px);margin:6px 0 10px}.intro {font-size:13px}.intro img {width:40px;height:40px}.mode-btn {font-size:13px}
}
@media (max-width:640px), (max-height:520px) {
 #hud {font-size:13px;padding: max(4px,env(safe-area-inset-top)) max(7px,env(safe-area-inset-right)) 4px max(7px,env(safe-area-inset-left))}
 .hud-group {gap:7px}.hud-box,.hud-pill {gap:4px}.lbl,#zone-label {display:none}.hud-box .icon,.hud-pill .icon {width:16px}.bar-track,.bar-wrap {width:22px}
 #sound-btn {padding:0;justify-content:center}
 .card,.quiz-card {padding:16px}.mast {padding-bottom:8px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after {animation:none!important;scroll-behavior:auto!important}}
@media(max-height:520px) and (min-width:641px){
 .overlay {padding-top:max(6px,env(safe-area-inset-top));padding-bottom:max(8px,env(safe-area-inset-bottom))}
 .mast {padding:0 0 5px;font-size:12px}.mark {width:32px;height:32px}.mast small {font-size:10px}
 .launch {padding:8px 0;gap:20px;grid-template-columns:1.4fr 1fr}.poster {min-height:0}
 h1 {font-size:32px;margin:3px 0}h1 br {display:none}h1 em::before {content:' '}
 .intro {margin:4px 0;font-size:12px;line-height:1.4}.intro img {width:32px;height:32px}
 .topics,legend {font-size:10px}legend {margin-bottom:3px}
 .mode-btn {font-size:12px;padding-block:4px}.primary {font-size:15px;padding:5px 12px;margin:6px 0}
 .guide {font-size:11px}.guide p {margin:3px 0}
 .result {padding:10px 20px}.result>img {height:48px;width:48px}.result h1 {font-size:25px}.result p {margin:6px 0}
}
.health-row {display:flex;align-items:center;gap:8px;margin-bottom:6px}.health-row strong {font-size:13px}
canvas.health-globe {position:static;width:48px;height:48px}
.result canvas.health-globe {width:88px;height:88px;display:block;margin:auto}
@media(max-height:520px){.result canvas.health-globe {width:50px;height:50px}}

#flight-pad { display:none }
@media (any-pointer:coarse) {
 #flight-pad:not([hidden]) {
   position:fixed; z-index:2; display:flex; align-items:center; justify-content:space-between;
   left:max(14px,env(safe-area-inset-left)); right:max(14px,env(safe-area-inset-right));
   bottom:max(8px,env(safe-area-inset-bottom)); pointer-events:none;
 }
 #flight-pad .joystick {
   width:clamp(88px,24vmin,116px); aspect-ratio:1; position:relative; display:grid; place-items:center;
   border:2px solid #aec7df; border-radius:50%; pointer-events:auto;
   background:radial-gradient(circle,#263d61 36%,#15294ae6 38% 67%,#567597 69%);
   box-shadow:0 3px 7px #101d3770; touch-action:none;
 }
 .joystick::before,.joystick::after {
   content:''; position:absolute; top:50%; width:6%; aspect-ratio:1;
   border:solid #c3d9ec; border-width:2px 2px 0 0;
 }
 .joystick::before { left:10%; transform:translateY(-50%) rotate(-135deg) }
 .joystick::after { right:10%; transform:translateY(-50%) rotate(45deg) }
 #steering { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; z-index:1; touch-action:none }
 .joystick:focus-within { outline:2px solid #ffda91; outline-offset:2px }
 .joystick-knob {
   width:43%; aspect-ratio:1; border-radius:50%; border:2px solid #c4def1; pointer-events:none;
   z-index:1; background:radial-gradient(circle at 36% 28%,#7799bd,#35577e 72%); box-shadow:0 3px 6px #0c1a32;
 }
 @media (max-height:450px) { #flight-pad .joystick { width:72px } }
 #flight-pad button {
   pointer-events:auto; touch-action:none; user-select:none; -webkit-user-select:none;
   -webkit-touch-callout:none; width:clamp(48px,7vmin,60px); height:clamp(48px,7vmin,60px);
   padding:0; border:2px solid #a5bdcd; background:#21365c; color:white; font-size:20px;
   box-shadow:0 3px 0 #101d37;
 }
 #flight-pad #fire-button { width:72px; border-radius:28px; background:#ffda91; border-color:#ffedc9; color:#33263c }
 #flight-pad button:active { transform:translateY(2px); box-shadow:none }
}
