:root{--navy:#062F59;--blue:#095583;--light:#EAF5FB;--cyan:#009BC5;--green:#3fae49;--warn:#e8a317}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden;background:#9fd3ef;font-family:Arial,Helvetica,sans-serif;color:var(--navy);-webkit-tap-highlight-color:transparent}
#scene{position:fixed;inset:0;width:100%;height:100%;display:block;touch-action:none}
[hidden]{display:none!important}
.screen{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(6,47,89,.35);z-index:20}
.panel{background:#fff;border-radius:14px;padding:22px 24px;max-width:560px;width:100%;box-shadow:0 10px 30px rgba(0,0,0,.25);max-height:calc(100vh - 32px);overflow:auto}
.panel h1{font-size:2.2rem;margin:.2em 0 .3em}
.panel h2{margin:.1em 0 .5em}
.brand{font-size:.8rem;letter-spacing:.06em;text-transform:uppercase;color:var(--blue);font-weight:bold}
.row{display:flex;gap:10px;flex-wrap:wrap;margin:14px 0}
.col{display:flex;flex-direction:column;gap:10px}
.btn{font:inherit;font-weight:bold;border:0;border-radius:10px;padding:12px 18px;background:var(--cyan);color:#fff;cursor:pointer;min-height:44px}
.btn.big{font-size:1.15rem;padding:14px 26px}
.btn.secondary{background:var(--light);color:var(--navy)}
.btn:focus-visible,.chip:focus-visible,.tbtn:focus-visible,.icon-btn:focus-visible{outline:3px solid var(--navy);outline-offset:2px}
.opts{border:1px solid #cfe3ef;border-radius:10px;padding:10px 14px;margin:10px 0}
.opts label,.col label{display:block;margin:8px 0;cursor:pointer}
.lang{display:flex;gap:8px;margin-top:8px}
.chip{font:inherit;border:2px solid var(--cyan);background:#fff;color:var(--navy);border-radius:20px;padding:6px 14px;cursor:pointer;min-height:36px}
.chip[aria-pressed="true"]{background:var(--cyan);color:#fff}
.note{font-size:.82rem;color:#4a6378}
#hud{position:fixed;inset:0;pointer-events:none;z-index:10}
.hud-col{position:absolute;left:12px;right:64px;top:12px;display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.hud-left{max-width:min(52vw,420px);background:rgba(255,255,255,.92);border-radius:10px;padding:10px 12px}
.m-title{font-weight:bold;color:var(--blue);font-size:.9rem}
.m-obj{font-size:1rem;margin-top:4px;line-height:1.3}
.hud-right{background:rgba(255,255,255,.92);border-radius:10px;padding:10px 12px;font-size:.92rem;min-width:170px}
.meter span{font-size:.8rem}
.bar{height:10px;background:#dfe9ef;border-radius:6px;overflow:hidden;margin:3px 0 6px}
.bar i{display:block;height:100%;width:100%;background:var(--green);transition:width .2s}
.bar i.low{background:var(--warn)}
.stat{margin-top:3px}
.icon-btn{pointer-events:auto;position:absolute;right:12px;top:12px;width:44px;height:44px;border-radius:10px;border:0;background:rgba(255,255,255,.92);color:var(--navy);font-weight:bold;font-size:1rem;cursor:pointer}
#toast{position:fixed;left:50%;top:96px;transform:translateX(-50%);max-width:min(90vw,560px);background:var(--navy);color:#fff;padding:10px 16px;border-radius:10px;font-size:1rem;line-height:1.35;z-index:15;opacity:0;transition:opacity .25s;pointer-events:none;text-align:center}
#toast.show{opacity:1}
.choice{position:fixed;left:50%;bottom:20px;transform:translateX(-50%);z-index:16;max-width:600px;width:calc(100% - 24px)}
.choice p{line-height:1.4}
#touch{position:fixed;left:0;right:0;bottom:0;display:flex;justify-content:space-between;padding:12px max(12px,env(safe-area-inset-left)) max(14px,env(safe-area-inset-bottom));z-index:12;pointer-events:none}
.tgroup{display:flex;gap:12px;pointer-events:auto}
.tbtn{width:74px;height:74px;border-radius:50%;border:0;background:rgba(255,255,255,.82);color:var(--navy);font-size:1.6rem;touch-action:none;user-select:none;-webkit-user-select:none}
.tbtn.on{background:var(--cyan);color:#fff}
.tbtn.gas{background:rgba(63,174,73,.88);color:#fff}
.tbtn.gas.on{background:#2b8a34}
#end-body ul{padding-left:1.2em;line-height:1.45}
@media (max-width:640px){
 .panel h1{font-size:1.7rem}
 .hud-col{flex-direction:column;gap:6px}
 .hud-left{max-width:none;padding:8px 10px}
 .m-obj{font-size:.85rem}
 .hud-right{min-width:0;font-size:.8rem;padding:6px 10px;display:flex;flex-wrap:wrap;gap:2px 12px;align-items:center}
 .hud-right .meter{flex:1 1 100%} .hud-right .bar{margin:2px 0}
 #toast{top:auto;bottom:110px;font-size:.9rem}
 .choice{bottom:100px}
 .tbtn{width:64px;height:64px}
}
@media (max-height:480px){ #toast{top:70px;bottom:auto} .choice{bottom:8px} }
#help{z-index:30}

.tbtn.drift{background:rgba(232,163,23,.9);color:#fff}
.tbtn.drift.on{background:#b97c06}
.menu-foot{border-top:1px solid #d7e6ef;margin-top:12px;padding-top:12px;display:flex;flex-direction:column;gap:10px}
.back-link{color:#095583;font-weight:bold;display:inline-flex;min-height:44px;align-items:center}
.ti-mini{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.ti-logo{width:140px;height:auto}
.ui-badge{display:flex;align-items:center;gap:8px;max-width:300px;color:#4a6378}
.ui-badge img{width:36px;height:36px;flex:none}
.nojs{padding:20px}
@media (max-width:640px){ .tbtn{width:58px;height:58px} .tgroup{gap:9px} }

/* v0.4 touch controls */
.ctl-set{border-top:1px solid #e1edf3;margin-top:10px;padding-top:8px}
.ctl-title{font-weight:bold;font-size:.92rem}
.chip{min-height:40px}
.row.tight{margin:6px 0;align-items:center}
#steer-zone{position:fixed;left:0;bottom:0;width:55%;top:38%;z-index:11;touch-action:none;display:none;pointer-events:auto}
#touch[data-mode="thumb"] #steer-zone{display:block}
#touch[data-mode="thumb"] .left-btns,#touch[data-mode="tilt"] .left-btns{visibility:hidden}
#steer-hint{position:absolute;left:16px;bottom:22px;color:#fff;font-size:.85rem;background:rgba(6,47,89,.55);padding:6px 10px;border-radius:8px;max-width:180px;pointer-events:none}
#steer-base{position:absolute;width:150px;height:150px;margin:-75px 0 0 -75px;border-radius:50%;border:3px solid rgba(255,255,255,.75);background:rgba(255,255,255,.18);display:none;pointer-events:none}
#steer-base.on{display:block}
#steer-knob{position:absolute;left:50%;top:50%;width:64px;height:64px;margin:-32px 0 0 -32px;border-radius:50%;background:rgba(0,155,197,.92);box-shadow:0 2px 8px rgba(0,0,0,.3)}
#tilt-meter{position:fixed;left:16px;bottom:22px;width:170px;height:44px;border-radius:22px;background:rgba(255,255,255,.82);z-index:12;display:none;pointer-events:none;color:#062F59;font-size:.75rem;text-align:center;line-height:44px}
#tilt-meter span{position:relative;z-index:1}
#tilt-needle{position:absolute;top:6px;left:50%;width:32px;height:32px;margin-left:-16px;border-radius:50%;background:#009BC5;opacity:.85}
#touch[data-mode="tilt"] #tilt-meter{display:block}
#touch[data-autogas="1"] .tbtn.gas{display:none}
#touch .tbtn.brake{width:84px;height:84px}
@media (max-width:640px){ #touch .tbtn.brake{width:72px;height:72px} }

/* v0.5 guidance, tasks, read-aloud */
.m-next{margin-top:4px;font-weight:bold;color:#7a3fc4;font-size:.9rem}
.m-next:empty{display:none}
.choice .row{flex-direction:row}
.choice.three .row{flex-direction:column;align-items:stretch}
.choice.three .btn{text-align:left}
.reading{outline:3px solid #8e5bd6;outline-offset:2px;background:#f1e9fb!important;color:#062F59!important}
p.reading{border-radius:6px}
.tasks{list-style:none;padding:0;margin:6px 0 12px;font-size:.95rem;line-height:1.5}
.tasks li{color:#4a6378}.tasks li.done{color:#2b8a34;font-weight:bold}
.menu-missions{background:#f4f9fc;border-radius:10px;padding:8px 12px;font-size:.92rem;line-height:1.4}
.menu-missions ol{margin:4px 0 2px;padding-left:1.2em}
.legend{list-style:none;padding:0}.legend li{margin:4px 0}
.dot{display:inline-block;width:14px;height:14px;border-radius:50%;vertical-align:-2px;margin-right:6px}
.qsum{padding-left:1.1em;font-size:.92rem}
@media (max-width:640px){ .choice.three .btn{padding:10px 12px;font-size:.92rem} .choice p{font-size:.92rem} }
.dot.c-coin{background:#009BC5}.dot.c-batt{background:#3fae49}.dot.c-boost{background:#d9ff7a;border:1px solid #1d6b2b}.dot.c-cone{background:#ff7a1a}.dot.c-doc{background:#fff;border:1px solid #095583}.dot.c-q{background:#8e5bd6}
.choice .btn.opt{background:#EAF5FB;color:#062F59;border:2px solid #b9d9ea;text-align:left}
.choice .btn.opt:focus-visible{outline:3px solid #062F59}

/* v0.5.2: answer panel with countdown; compact driving messages that stay out of the way */
.fbpanel h2{font-size:1.1rem;margin:0 0 6px;color:#095583}
.fbpanel #fb-lines p{margin:6px 0;line-height:1.4}
.fb-foot{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:10px}
.fb-track{flex:1 1 100%;height:6px;background:#e1edf3;border-radius:4px;overflow:hidden}
.fb-track i{display:block;height:100%;background:#8e5bd6;width:100%}
#fb-count{font-size:.88rem;color:#4a6378;flex:1}
#toast{top:auto;bottom:16px;max-width:min(60vw,460px);font-size:.88rem;padding:7px 12px;background:rgba(6,47,89,.82)}
@media (max-width:640px){ #toast{bottom:auto;top:178px;max-width:calc(100vw - 24px);font-size:.82rem;padding:6px 10px} }
@media (max-height:480px){ #toast{top:auto;bottom:8px;max-width:44vw} }

.language-picker{justify-content:flex-end;flex-wrap:wrap;margin:0 0 14px;gap:6px}.language-picker .chip{padding:6px 10px}.speech-toolbar{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}.speech-toolbar .note{flex-basis:100%;margin:0}

/* Speech controls stay operable in compact choice/feedback panels. */
.speech-toolbar label{flex-basis:100%;display:flex;align-items:center;gap:8px;min-height:32px;cursor:pointer;font-size:.9rem}
.speech-toolbar input{flex:none;width:18px;height:18px}
.speech-toolbar input:focus-visible{outline:3px solid var(--navy);outline-offset:2px}
@media (max-width:640px){.choice{max-height:calc(100vh - 116px);max-height:calc(100dvh - 116px)}}
@media (max-height:480px){.choice{max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px)}}
