:root{--ink:#f8fafc;--muted:#aab6c5;--panel:rgba(15,23,34,.88);--line:rgba(255,255,255,.14);--orange:#ed8a42;--green:#68d391}*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#18232b;color:var(--ink);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}#world{position:fixed;inset:0}#world canvas{display:block;width:100%;height:100%}#hud{position:fixed;inset:0;pointer-events:none;padding:18px;display:flex;flex-direction:column;justify-content:space-between}.top,.bottom{display:flex;justify-content:space-between;align-items:flex-start;gap:14px}.quest{pointer-events:auto;width:min(450px,calc(100vw - 36px));background:rgba(248,244,233,.96);color:#282820;border-left:5px solid var(--orange);padding:14px 16px;box-shadow:0 12px 34px #0005}.quest-head{display:flex;justify-content:space-between;gap:10px;color:#87603f;font-size:10px;font-weight:800;letter-spacing:1.2px;text-transform:uppercase}.quest #note{font-size:15px;line-height:1.5;font-weight:750;margin-top:8px}.quest #translation{display:none;margin-top:9px;padding-top:8px;border-top:1px dashed #cbbba0;font-size:12px;color:#615746}.quest #translation.show{display:block}.actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:12px}button{border:0;padding:8px 11px;font-weight:750;font-size:11px;cursor:pointer;background:#e4dac7;color:#332d25}button.primary{background:#c86c39;color:white}button.dark{background:#202c38;color:white;border:1px solid #ffffff26}button:hover{filter:brightness(1.1)}.status{pointer-events:none;text-align:right;background:var(--panel);border:1px solid var(--line);padding:11px 14px;min-width:155px;box-shadow:0 8px 25px #0003}.mode{font-size:9px;letter-spacing:1.2px;text-transform:uppercase;color:#83c7ed;font-weight:850;margin-bottom:5px}.mode.dash{color:#ffb56e}.status strong{font-size:13px}.status small{display:block;color:var(--green);font-size:11px;margin-top:5px}.bottom{align-items:flex-end}.help{display:flex;flex-direction:column;gap:7px;max-width:min(620px,55vw)}.pill{background:var(--panel);border:1px solid var(--line);padding:8px 11px;font-size:10px;color:#d5deea;line-height:1.6;backdrop-filter:blur(8px)}kbd{background:#354354;border-radius:3px;padding:2px 5px;font-weight:800;color:white}.cluster{pointer-events:none;display:flex;align-items:center;gap:12px;background:var(--panel);border:1px solid var(--line);padding:10px 13px;box-shadow:0 12px 30px #0005;backdrop-filter:blur(12px)}.speed{width:108px;height:108px;position:relative;display:grid;place-items:center}.speed svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}.speed .value{font-size:25px;font-weight:800;line-height:1;font-variant-numeric:tabular-nums}.speed .unit{font-size:9px;color:#aebaca;letter-spacing:1px;margin-top:-20px}.speed .gear{position:absolute;bottom:12px;font-size:10px;font-weight:900;color:#ffc56f}.compass{width:108px;height:108px;border-radius:50%;position:relative;border:1px solid #91a0b3a0;background:radial-gradient(circle,#293848 0 55%,#15212d 56%);box-shadow:inset 0 0 18px #0008}.compass:before{content:"";position:absolute;inset:7px;border-radius:50%;border:1px dashed #b8c5d333}.card{position:absolute;font-size:10px;font-weight:900}.north{top:7px;left:50%;transform:translateX(-50%);color:#ff7777}.south{bottom:7px;left:50%;transform:translateX(-50%);color:#f8c56d}.east{right:8px;top:50%;transform:translateY(-50%);color:#6ed9ad}.west{left:8px;top:50%;transform:translateY(-50%);color:#7bb8ff}.needle{position:absolute;inset:0;display:grid;place-items:center;transition:transform .12s linear}.needle:before{content:"";position:absolute;top:22px;width:0;height:0;border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:27px solid #f18b49;filter:drop-shadow(0 1px 3px #000)}.needle:after{content:"";width:9px;height:9px;border-radius:50%;background:#f7f8fa;border:2px solid #192633;z-index:2}.compass-label{position:absolute;bottom:21px;left:50%;transform:translateX(-50%);font-size:8px;letter-spacing:1px;color:#aebaca}.toast{position:absolute;top:50%;left:50%;transform:translate(-50%,12px);opacity:0;transition:.2s;background:#111c29ed;border:1px solid #ffffff2b;padding:10px 17px;font-size:13px;font-weight:700;white-space:normal;text-align:center;max-width:80vw}.toast.show{opacity:1;transform:translate(-50%,0)}.toast.success{border-color:#68d391;color:#a5f3c0}.toast.warn{border-color:#f87171;color:#fecaca}#cockpit{position:fixed;inset:0;z-index:3;pointer-events:none;opacity:0;transition:opacity .25s}
#cockpit svg{display:block;width:100%;height:100%}
#cockpit.active{opacity:1}
#dash-frame{position:fixed;inset:0;pointer-events:none;opacity:0;transition:opacity .35s;background:linear-gradient(to top,#0a1019 0%,#0a1019d9 8%,transparent 27%),radial-gradient(ellipse at center,transparent 52%,#080d15a8 100%)}#dash-frame.active{opacity:1}#dash-frame:after{content:"";position:absolute;left:0;right:0;bottom:-2px;height:10%;background:linear-gradient(transparent,#101923);clip-path:polygon(0 100%,0 75%,40% 0,60% 0,100% 75%,100% 100%)}@media(max-width:700px){#hud{padding:10px}.quest{padding:10px 12px;width:min(370px,calc(100vw - 20px))}.quest #note{font-size:12px}.actions button{font-size:10px;padding:7px}.status{min-width:0;padding:8px}.status strong{font-size:11px}.help{max-width:48vw}.pill{font-size:9px;padding:6px}.cluster{gap:5px;padding:6px}.speed,.compass{width:82px;height:82px}.speed .value{font-size:20px}.compass-label{bottom:15px}.needle:before{top:15px}.bottom{align-items:flex-end}}

/* Dashcam HUD: keep route directions and compass clear of the cockpit artwork. */
#hud{z-index:6}
#cockpit{z-index:3}
#dash-frame{z-index:2}
#hud .cluster{
  position:fixed; right:18px; top:132px; bottom:auto;
  flex-direction:column; gap:10px; padding:10px;
}
#hud .bottom{align-items:flex-end}
#hud .help{max-width:min(520px,48vw)}
@media(max-width:700px){
  #hud .cluster{right:9px;top:118px;gap:6px;padding:6px}
  #hud .help{max-width:42vw}
}


/* Supplied EPS cockpit, isolated to transparent foreground artwork. */
#cockpit{
  position:fixed;
  inset:0;
  z-index:3;
  pointer-events:none;
  opacity:0;
  transition:opacity .25s ease;
  overflow:hidden;
}
#cockpit img{
  position:absolute;
  inset:auto 0 0;
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  object-position:center bottom;
  user-select:none;
  -webkit-user-drag:none;
}
#cockpit.active{opacity:1}
#dash-frame{z-index:2}
#hud{z-index:6}
#hud .top{align-items:flex-start}
#hud .cluster{
  position:fixed;
  right:18px;
  top:132px;
  bottom:auto;
  flex-direction:column;
  gap:10px;
  padding:10px;
}
#hud .bottom{align-items:flex-end}
#hud .help{max-width:min(520px,48vw)}
@media (max-width:700px){
  #hud{padding:10px}
  #hud .top{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}
  #hud .quest{width:auto;min-width:0;padding:9px 10px}
  #hud .quest #note{font-size:11px;line-height:1.35}
  #hud .quest-head{font-size:8px;letter-spacing:.7px}
  #hud .actions{gap:5px;margin-top:8px}
  #hud .actions button{font-size:9px;padding:6px 7px}
  #hud .status{min-width:92px;padding:8px 7px}
  #hud .status strong{font-size:10px}
  #hud .status small{font-size:9px}
  #hud .cluster{right:9px;top:112px;gap:6px;padding:6px}
  #hud .speed,#hud .compass{width:76px;height:76px}
  #hud .speed .value{font-size:18px}
  #hud .compass-label{bottom:13px;font-size:7px}
  #hud .needle:before{top:12px}
  #hud .help{max-width:46vw}
  #hud .pill{font-size:8px;padding:5px 7px}
}
@media (max-height:480px) and (orientation:landscape){
  #hud{padding:8px}
  #hud .quest{padding:7px 9px}
  #hud .quest #note{font-size:10px;margin-top:5px}
  #hud .actions{margin-top:6px}
  #hud .actions button{padding:5px 7px}
  #hud .status{padding:7px 9px}
  #hud .cluster{top:105px;right:8px;gap:4px;padding:5px}
  #hud .speed,#hud .compass{width:66px;height:66px}
  #hud .speed .value{font-size:16px}
  #hud .compass-label{bottom:10px}
  #hud .help{max-width:42vw}
}

/* Overview map zoom controls: available only before the first vehicle movement. */
.map-zoom{
  position:fixed;
  z-index:7;
  right:18px;
  top:50%;
  transform:translateY(-50%);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  padding:8px;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(15,23,34,.9);
  box-shadow:0 8px 25px #0004;
  backdrop-filter:blur(10px);
  pointer-events:auto;
}
.map-zoom button{
  width:38px;
  height:36px;
  padding:0;
  display:grid;
  place-items:center;
  background:#344454;
  color:#fff;
  font-size:23px;
  line-height:1;
  border:1px solid #ffffff20;
  border-radius:3px;
}
.map-zoom button:disabled{opacity:.35;cursor:default}
.map-zoom span{
  max-width:116px;
  text-align:center;
  line-height:1.35;
  white-space:normal;
  color:#aebaca;
  font-size:7px;
  font-weight:850;
  letter-spacing:1px;
  white-space:nowrap;
}
.map-zoom.hidden{display:none}
@media(max-width:700px){
  .map-zoom{right:9px;top:50%;padding:5px;gap:4px}
  .map-zoom button{width:32px;height:32px;font-size:20px}
  .map-zoom span{font-size:6px}
}


/* ===== Touch / mobile ===== */
#world{touch-action:none}
.touch-controls{display:none;position:fixed;left:0;right:0;bottom:0;z-index:8;pointer-events:none;padding:0 max(14px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));align-items:flex-end;justify-content:space-between;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
body.touch .touch-controls{display:flex}
.touch-controls button{pointer-events:auto;touch-action:none;-webkit-tap-highlight-color:transparent;font-family:inherit}
.touch-controls .pad{display:flex;gap:14px;align-items:flex-end}
.touch-controls .pad-right{flex-direction:column-reverse;gap:12px}
.touch-controls .pad button{width:76px;height:76px;border-radius:50%;padding:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;font-size:28px;line-height:1;color:#fff;background:rgba(15,23,34,.62);border:2px solid rgba(255,255,255,.35);backdrop-filter:blur(6px);box-shadow:0 6px 16px #0006;transition:transform .06s,background .06s}
.touch-controls .pad button span{font-size:9px;font-weight:900;letter-spacing:1px}
.touch-controls .pad button.gas{background:rgba(52,140,92,.7);border-color:#9be8bd}
.touch-controls .pad button.brake{background:rgba(190,70,60,.7);border-color:#ffb0a8;width:64px;height:64px;font-size:22px}
.touch-controls .pad button.on{transform:scale(.92);background:rgba(237,138,66,.9);border-color:#fff}
.touch-controls .tilt{position:absolute;left:50%;bottom:max(16px,env(safe-area-inset-bottom));transform:translateX(-50%);padding:9px 14px;border-radius:20px;font-size:11px;letter-spacing:.5px;background:rgba(15,23,34,.7);color:#fff;border:1px solid rgba(255,255,255,.3)}
.touch-controls .tilt.on{background:rgba(237,138,66,.92);border-color:#fff}
body.touch #hud .help{display:none}
body.touch #hud .bottom{justify-content:flex-end}
body.touch .map-zoom{top:auto;bottom:130px;transform:none}

/* Portrait phones: a tight cockpit crop instead of a thin strip under a bare sky. */
@media (orientation:portrait){
  #cockpit img{inset:auto;left:calc(50vw - 62vh*1.1);bottom:0;width:110vh;height:58vh;object-fit:fill;clip-path:inset(48% 0 0 0)}
  #dash-frame:after{display:none}
  #dash-frame{background:linear-gradient(to bottom,#0a1019cc 0,transparent 9%),linear-gradient(to top,#0a1019 0%,#0a1019b0 6%,transparent 20%),radial-gradient(ellipse at center,transparent 58%,#080d1590 100%)}
  #hud .top{grid-template-columns:minmax(0,1fr) auto}
  #hud .status{min-width:84px}
  body.touch #hud .cluster{position:fixed;right:9px;top:128px;flex-direction:column;padding:5px;gap:4px}
  body.touch #hud .speed,body.touch #hud .compass{width:58px;height:58px}
  body.touch #hud .speed .value{font-size:15px}
  body.touch #hud .speed .unit{font-size:7px;margin-top:-14px}
  body.touch #hud .speed .gear{font-size:8px;bottom:6px}
  body.touch #hud .card{font-size:7px}
  body.touch #hud .compass-label{display:none}
  body.touch #hud .needle:before{top:10px;border-left-width:5px;border-right-width:5px;border-bottom-width:16px}
}
@media (orientation:landscape) and (max-height:520px){
  .touch-controls .pad button{width:64px;height:64px;font-size:24px}
  .touch-controls .pad button.brake{width:54px;height:54px}
  .touch-controls .pad-right{flex-direction:row-reverse}
}


/* ===== Quest intro scene (intro.js) ===== */
.intro{position:fixed;inset:0;z-index:60;overflow:hidden;opacity:0;transition:opacity .45s ease;background:#bfe3f2;-webkit-user-select:none;user-select:none;touch-action:manipulation;cursor:pointer}
.intro[hidden]{display:none}
.intro.in{opacity:1}
.intro.out{opacity:0;transition:opacity .6s ease;pointer-events:none}
.i-sky{position:absolute;inset:0;background:linear-gradient(#7fc8ee 0%,#bfe6f5 45%,#f6f1d4 70%)}
.i-sun{position:absolute;left:10%;top:9%;width:min(12vh,16vw);height:min(12vh,16vw);border-radius:50%;background:radial-gradient(circle,#fff6c2 0 55%,#ffe27a 56% 100%);box-shadow:0 0 60px 20px #ffec9a88}
.i-cloud{position:absolute;height:min(6vh,9vw);width:min(18vh,26vw);border-radius:999px;background:#fff;opacity:.92;box-shadow:min(5vh,7vw) -2vh 0 -1vh #fff,-3vh -1.4vh 0 -.6vh #fff;animation:i-drift 60s linear infinite}
.i-cloud.c1{top:15%;left:30%}.i-cloud.c2{top:26%;left:62%;animation-duration:80s;transform:scale(.8)}.i-cloud.c3{top:11%;left:78%;animation-duration:100s;transform:scale(.6)}
@keyframes i-drift{from{translate:-12vw 0}to{translate:14vw 0}}
.i-scenery{position:absolute;left:0;right:0;bottom:41.5%;height:40%}
.i-svg{display:block;width:100%;height:100%}
.i-sidewalk{position:absolute;left:0;right:0;bottom:37.5%;height:4%;background:linear-gradient(#d9cfb8,#c9bea4);border-top:4px solid #b9ad92;box-shadow:inset 0 -4px 0 #b3a78c}
.i-road{position:absolute;left:0;right:0;bottom:19%;height:18.5%;background:linear-gradient(#3b4249,#2c3238)}
.i-dash{position:absolute;left:0;right:0;top:50%;height:.9vh;background:repeating-linear-gradient(90deg,#f4efd8 0 6vw,transparent 6vw 12vw)}
.i-grass{position:absolute;left:0;right:0;bottom:0;height:19%;background:repeating-linear-gradient(90deg,transparent 0 11vw,#0000000d 11vw calc(11vw + 3px)),linear-gradient(#e0d6bf,#cbbfa4);border-top:7px solid #b9ad92;box-shadow:inset 0 6px 0 #efe6d0}
.i-actors{position:absolute;inset:0;pointer-events:none}
.i-actor{position:absolute;left:0;top:0;will-change:transform;transform-origin:50% 100%}
.i-actor img{display:block;width:auto;transform-origin:50% 100%;filter:drop-shadow(0 6px 4px #0003);-webkit-user-drag:none}
.i-actor.car{z-index:2}.i-actor.car img{max-width:none;filter:drop-shadow(0 4px 3px #0004)}
.i-actor.tourist{z-index:3}.i-actor.local{z-index:4}
.i-shadow{position:absolute;left:0;top:0;height:2.4vh;border-radius:50%;background:radial-gradient(#0007,#0000 70%);z-index:1}
.i-actor.talking img{animation:i-talk .42s ease-in-out infinite}
@keyframes i-talk{0%,100%{transform:translateY(0) scale(1,1)}50%{transform:translateY(-1.2%) scale(1.015,1.02)}}

.i-dlg{position:absolute;left:50%;top:max(14px,env(safe-area-inset-top));width:min(94vw,780px);transform:translate(-50%,-14px);opacity:0;transition:.25s;background:rgba(248,244,233,.97);color:#282820;border-left:6px solid var(--orange);padding:12px 16px 10px;box-shadow:0 14px 34px #0005;pointer-events:none}
.i-dlg.show{opacity:1;transform:translate(-50%,0)}
.i-dlg.tourist{border-left-color:#3aa0d8}.i-dlg.local{border-left-color:#c86c39}.i-dlg.narr{border-left-color:#68a56a;background:rgba(238,246,232,.97)}
.i-name{font-size:10px;font-weight:850;letter-spacing:1.3px;text-transform:uppercase;color:#87603f}
.i-dlg.tourist .i-name{color:#237aa6}.i-dlg.narr .i-name{color:#3c7a40}
.i-jv{margin-top:5px;font-size:clamp(15px,2.3vh,22px);line-height:1.45;font-weight:750;min-height:1.45em}
.i-gloss{margin-top:7px;padding-top:6px;border-top:1px dashed #cbbba0;font-size:clamp(11px,1.6vh,13px);line-height:1.45;color:#615746}
.i-en{font-style:italic;color:#80775f}
.i-tap{margin-top:5px;text-align:right;font-size:9px;letter-spacing:.8px;color:#a09680}
.i-skip{position:absolute;right:max(12px,env(safe-area-inset-right));bottom:max(14px,env(safe-area-inset-bottom));z-index:5;padding:9px 15px;font-size:12px;border-radius:20px;background:rgba(15,23,34,.78);color:#fff;border:1px solid #ffffff40;cursor:pointer}
@media (orientation:portrait){.i-dlg{padding:10px 12px 8px}.i-skip{bottom:max(18px,env(safe-area-inset-bottom))}}
@media (max-height:460px){.i-gloss .i-en{display:none}.i-jv{font-size:14px}.i-dlg{padding:8px 12px 6px}}
@media (prefers-reduced-motion:reduce){.i-cloud{animation:none}}

/* Passed direction segments: instructions already followed turn red. */
.quest #note .note-seg{transition:color .28s ease}
.quest #note .note-seg.passed{color:#c0392b}

/* Campaign progress and locked next-quest button. */
.quest .campaign-progress{margin-top:7px;font-size:10px;font-weight:850;letter-spacing:1px;text-transform:uppercase;color:#87603f}
.quest .campaign-progress:empty{display:none}
.quest .actions button:disabled{opacity:.45;cursor:not-allowed;filter:none}
.quest .actions button:disabled:hover{filter:none}
@media(max-width:700px){.quest .campaign-progress{font-size:9px;letter-spacing:.6px}}
