@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@200;300;400;500&display=swap');
/* ---------- Design tokens: a quiet, cinematic glass HUD ---------- */
:root {
  --ui: "Inter", "Nirmala UI", "Segoe UI", system-ui, sans-serif;
  --num: "Outfit", "Inter", "Segoe UI", system-ui, sans-serif;
  --ink: #f5f2ed; --ink-2: rgba(245,242,237,.74); --ink-3: rgba(245,242,237,.48);
  --glass: rgba(12,14,18,.34); --glass-2: rgba(12,14,18,.52); --glass-3: rgba(14,16,20,.78);
  --hair: rgba(255,255,255,.12); --hair-2: rgba(255,255,255,.22);
  --blur: blur(14px) saturate(135%);
  --shadow: 0 10px 30px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.05);
  --accent: #ffc98a; --rose: #ff8fa8; --ok: #a6f0c6; --bad: #ff7a7a; --cool: #9fd8ff;
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0b0a; font-family: var(--ui); color: var(--ink); -webkit-font-smoothing: antialiased; touch-action: none; user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.hico { display: inline-flex; width: 14px; height: 14px; flex: none; color: var(--ink-3); }
.hico svg, .statrow .ico svg { width: 100%; height: 100%; display: block; }
kbd { font-family: var(--ui); }
/* graphics presets (body.q-*, set from game.quality by phone.js).
   1.10: the backdrop blur re-samples the live WebGL frame under every glass panel each frame (GPU cost, and on some
   GPUs a flicker when panels appear / disappear over the canvas). Ultra keeps the full frosted look, High a lighter
   blur on the big persistent panels only; Medium joins Low: denser glass, no blur. Small panels that pop in and out
   (toasts, prompt, wanted badge, mouse hint) never blur — they use the denser glass on every tier. */
:root { --blur-dial: blur(8px) saturate(130%); }
body.q-high { --blur: blur(10px) saturate(130%); --blur-dial: blur(6px) saturate(125%); }
body.q-low, body.q-medium { --glass: rgba(12,14,18,.58); --glass-2: rgba(12,14,18,.7); --glass-3: rgba(14,16,20,.9); --blur-dial: none; }
body.q-low *, body.q-low *::before, body.q-low *::after, body.q-medium *, body.q-medium *::before, body.q-medium *::after { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; contain: strict; }
#stats { position: absolute; top: 16px; left: 16px; display: flex; flex-direction: column; gap: 7px; min-width: 204px; padding: 13px 16px 13px; background: var(--glass); border: 1px solid var(--hair); border-radius: var(--r); box-shadow: var(--shadow); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
#cash { font: 300 30px/1 var(--num); letter-spacing: -.01em; color: var(--ink); font-variant-numeric: tabular-nums; transition: color .5s, text-shadow .5s; }
#cash.up { color: var(--ok); text-shadow: 0 0 16px rgba(166,240,198,.45); }
#cash.down { color: var(--bad); text-shadow: 0 0 16px rgba(255,122,122,.4); }
#rep { display: flex; align-items: center; gap: 2px; color: var(--accent); font: 500 11px/1 var(--ui); }
#rep svg { width: 12px; height: 12px; display: block; }
#rep .off { color: rgba(255,255,255,.28); }
#rep .rv { margin-left: 7px; color: var(--ink-3); letter-spacing: .06em; font-variant-numeric: tabular-nums; }
#clock { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font: 400 12.5px/1.25 var(--ui); color: var(--ink-2); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.bar { width: 160px; height: 3px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; }
.bar > div { height: 100%; width: 100%; background: var(--ink); border-radius: 2px; transition: width .25s; }
#energy, #timerFill, #meterFill { transform-origin: 0 50%; transition: transform .25s; } /* hud.js fills these by scaleX (no layout) */
.statrow { display: flex; align-items: center; gap: 8px; }
.statrow .ico { display: inline-flex; width: 14px; height: 14px; color: var(--ink-3); font-size: 11px; }
.statrow .bar { width: 150px; }
#energy.low { animation: lowPulse 1.1s ease-in-out infinite; }
@keyframes lowPulse { 50% { opacity: .35; } }
#fuel { background: var(--cool); }
#fuelText { font: 500 11px var(--ui); color: var(--ink-2); }
#bizName { display: flex; align-items: center; gap: 6px; font: 500 10px/1.2 var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
#bizName:empty { display: none; }
#eventChip { padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(255,140,140,.32); background: rgba(255,90,90,.12); color: #ffdcdc; font: 500 11px var(--ui); letter-spacing: .02em; }
#eventChip:empty { display: none; }
#meter { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 16px; background: var(--glass-2); border: 1px solid var(--hair); border-radius: 999px; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); font: 500 12px var(--ui); letter-spacing: .04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
#meter .bar { width: 160px; }
#meterFill { background: var(--ok); }
/* the place name sits in the cluster, over the minimap dial (moved there by hud.js) */
#place { width: 230px; min-height: 14px; contain: layout paint style; margin: 0 0 9px; text-align: center; font: 500 10.5px/1.3 var(--ui); letter-spacing: .22em; text-transform: uppercase; color: var(--ink-2); text-shadow: 0 1px 10px rgba(0,0,0,.7); }
#place.flash { animation: placeIn 2.6s ease-out; } #place.flash2 { animation: placeIn2 2.6s ease-out; } /* (two names: restart without a forced layout) */
@keyframes placeIn { 0% { opacity: 0; letter-spacing: .5em; filter: blur(4px); } 25% { opacity: 1; letter-spacing: .22em; filter: none; color: #fff; } 100% { color: var(--ink-2); } }
@keyframes placeIn2 { 0% { opacity: 0; letter-spacing: .5em; filter: blur(4px); } 25% { opacity: 1; letter-spacing: .22em; filter: none; color: #fff; } 100% { color: var(--ink-2); } }
#objective { position: absolute; bottom: 62px; left: 50%; transform: translateX(-50%); max-width: min(720px, 92vw); padding: 9px 18px 9px 16px; background: var(--glass); border: 1px solid var(--hair); border-radius: 12px; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow), inset 2px 0 0 var(--accent); font: 400 14.5px/1.45 var(--ui); text-align: center; transition: opacity .9s ease; }
#objective.dim { opacity: .55; }
.talking #objective, .talking #prompt { display: none; }
.act #objective, .act-foot #nav { display: none; } /* an activity's own HUD + hint take over */
#timer { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 16px; background: var(--glass-2); border: 1px solid var(--hair); border-radius: 999px; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); font: 500 12px var(--ui); letter-spacing: .06em; text-transform: uppercase; }
#timer .bar { width: 200px; }
#timerText { font: 300 17px var(--num); letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
#speed { display: none; }
#prompt { position: absolute; bottom: 112px; left: 50%; transform: translateX(-50%); padding: 8px 16px; background: rgba(12,14,18,.68); color: var(--ink); border: 1px solid var(--hair-2); border-radius: 12px; font: 500 13.5px/1.6 var(--ui); box-shadow: 0 12px 30px rgba(0,0,0,.3); max-width: min(760px, 92vw); text-align: center; animation: tstIn .25s ease-out; contain: layout paint style; }
#prompt kbd, #dlgChoices kbd, #help kbd.cap { display: inline-block; min-width: 1.7em; padding: 0 6px; margin: 0 4px 0 1px; border-radius: 5px; border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.08); color: #fff; font: 600 11px/1.75 var(--ui); text-align: center; letter-spacing: .02em; box-shadow: inset 0 -1px 0 rgba(255,255,255,.12); vertical-align: 1px; }
#toast { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: min(640px, 90vw); pointer-events: none; }
#toast .tst { padding: 8px 16px; background: rgba(12,14,18,.68); border: 1px solid var(--hair); border-radius: 12px; font: 500 13.5px/1.45 var(--ui); text-align: center; box-shadow: 0 10px 26px rgba(0,0,0,.25); animation: tstIn .3s cubic-bezier(.2,.8,.2,1); transition: opacity .3s, transform .3s; }
#toast .tst:not(:first-child) { opacity: .66; font-size: 12.5px; }
#toast .tst.out { opacity: 0; transform: translateY(-6px); }
@keyframes tstIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } } /* (no filter: a filter animation over the 3D view re-creates a render surface at its end — a one-frame flash on some GPUs) */
@media (max-width: 900px) { #toast { top: auto; bottom: 250px; max-width: calc(100vw - 32px); } #toast .tst { font-size: 12.5px; padding: 6px 12px; } }
/* result banner: thin, wide-tracked type between two hairlines — a film title card, not a cartoon */
#banner { position: absolute; top: 30%; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; text-align: center; animation: bannerIn .7s cubic-bezier(.2,.8,.2,1); }
#banner::before, #banner::after { content: ''; width: min(420px, 60vw); height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); }
#banner::before { margin-bottom: 14px; } #banner::after { margin-top: 14px; }
#bannerTitle { font: 200 clamp(34px, 6.4vw, 66px)/1.05 var(--num); letter-spacing: .16em; text-transform: uppercase; color: #fff; text-shadow: 0 2px 30px rgba(0,0,0,.55); padding-left: .16em; }
#bannerSub { font: 400 clamp(13px, 1.9vw, 17px)/1.4 var(--ui); letter-spacing: .08em; color: var(--ink-2); margin-top: 8px; text-shadow: 0 1px 12px rgba(0,0,0,.8); max-width: 90vw; }
#banner.good #bannerTitle { color: #fff3df; text-shadow: 0 0 34px rgba(255,201,138,.55), 0 2px 30px rgba(0,0,0,.5); }
#banner.bad #bannerTitle { color: #ffd0d0; text-shadow: 0 0 34px rgba(255,90,90,.5), 0 2px 30px rgba(0,0,0,.5); }
@keyframes bannerIn { from { opacity: 0; letter-spacing: .4em; filter: blur(8px); } to { opacity: 1; filter: none; } }

/* ---------- JS-built HUD parts (hud.js): digital cluster, mission card, wanted badge, road strip, subtitles ---------- */
/* the cluster is its own layer; the gauge slides in by opacity + transform only (it used to animate its width: a
   layout of the whole cluster every frame for half a second), and the glow is an opacity-only layer (#gaugeGlow) */
#cluster { position: fixed; right: calc(18px + env(safe-area-inset-right, 0px)); top: calc(16px + env(safe-area-inset-top, 0px)); bottom: auto; display: flex; align-items: flex-start; gap: 16px; z-index: 6; pointer-events: none; transition: opacity .45s ease; contain: layout style; will-change: opacity; }
#gaugeBox { position: relative; width: 172px; height: 172px; opacity: 0; flex: none; transform: translateX(28px) scale(.9); transition: transform .55s cubic-bezier(.2,.8,.2,1), opacity .45s; }
#gaugeBox.on { opacity: 1; transform: none; }
#gauge { display: block; width: 172px; height: 172px; border-radius: 50%; background: radial-gradient(circle at 50% 38%, rgba(255,255,255,.05), rgba(10,12,16,.26) 60%, rgba(10,12,16,.4)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1), 0 14px 34px rgba(0,0,0,.24); backdrop-filter: var(--blur-dial); -webkit-backdrop-filter: var(--blur-dial); }
body.q-low #gauge, body.q-medium #gauge { background: radial-gradient(circle at 50% 38%, rgba(255,255,255,.05), rgba(10,12,16,.4) 60%, rgba(10,12,16,.55)); }
#gaugeGlow { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; opacity: 0; will-change: opacity; box-shadow: 0 0 34px rgba(160,215,255,.28), inset 0 0 22px rgba(160,215,255,.12); }
#cluster.brake #gaugeGlow { box-shadow: 0 0 34px rgba(255,110,95,.32), inset 0 0 22px rgba(255,110,95,.14); }
#mmBox { display: flex; flex-direction: column; align-items: center; flex: none; }
#mmDial { position: relative; width: 176px; height: 176px; border-radius: 50%; backdrop-filter: var(--blur-dial); -webkit-backdrop-filter: var(--blur-dial); box-shadow: 0 0 0 1px rgba(255,255,255,.14), 0 0 0 6px rgba(255,255,255,.03), 0 14px 36px rgba(0,0,0,.32); }
#mmDial::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(155deg, rgba(255,255,255,.14), rgba(255,255,255,0) 36%), radial-gradient(circle at 50% 120%, rgba(255,255,255,.06), transparent 50%); pointer-events: none; }
#minimap { display: block; width: 176px; height: 176px; border-radius: 50%; }
#tracker { position: fixed; right: calc(18px + env(safe-area-inset-right, 0px)); top: calc(250px + env(safe-area-inset-top, 0px)); width: 256px; padding: 11px 14px 12px; background: var(--glass); border: 1px solid var(--hair); border-radius: var(--r); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow); color: var(--ink); font: 400 12px/1.4 var(--ui); pointer-events: none; z-index: 6; transition: opacity .9s ease, transform .9s ease; }
#tracker.dim { opacity: .3; }
/* layout isolation: a text change inside one HUD panel re-lays out that panel only, never the page */
#stats, #tracker, #nav, #toast, #objective, #timer, #meter, #wanted, #subs { contain: layout style; }
body.hud-drive #tracker.dim { opacity: 0; transform: translateX(10px); }
#tracker .th { display: flex; justify-content: space-between; align-items: center; font: 600 9.5px var(--ui); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 7px; }
#tracker .th span { display: inline-flex; align-items: center; gap: 6px; }
#tracker .th .hico { width: 12px; height: 12px; color: var(--accent); }
#tracker .tb { height: 2px; background: rgba(255,255,255,.1); border-radius: 2px; margin: 0 0 8px; }
#tracker .tb i { display: block; height: 100%; background: var(--accent); border-radius: 2px; box-shadow: 0 0 8px rgba(255,201,138,.55); }
#tracker .tm { font: 500 13px/1.35 var(--ui); }
#tracker .ts { color: var(--ink-2); font-size: 11.5px; margin-top: 2px; }
#wanted { position: fixed; left: 50%; top: 58px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 16px; border-radius: 999px; background: rgba(22,8,10,.74); border: 1px solid rgba(255,100,100,.45); color: #fff; font: 600 12.5px var(--ui); letter-spacing: .05em; box-shadow: 0 0 22px rgba(255,60,60,.22); z-index: 7; pointer-events: none; }
#wanted.flash { animation: wflash .7s ease-in-out infinite alternate; }
@keyframes wflash { from { box-shadow: 0 0 26px rgba(255,50,60,.55); border-color: rgba(255,100,100,.85); } to { box-shadow: 0 0 26px rgba(70,120,255,.55); border-color: rgba(120,160,255,.85); } }
#nav { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; padding: 7px 16px; background: var(--glass); border: 1px solid var(--hair); border-radius: 999px; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); color: var(--ink-2); font: 400 12px var(--ui); z-index: 6; pointer-events: none; white-space: nowrap; max-width: max(280px, calc(100vw - 840px)); overflow: hidden; text-overflow: ellipsis; }
#nav b { font-weight: 500; color: var(--ink); font-size: 13px; }
#nav .nd { color: var(--accent); font-weight: 500; letter-spacing: .1em; }
#nav .na { color: var(--ink-3); }
#subs { position: fixed; left: 50%; bottom: 168px; transform: translateX(-50%); text-align: center; max-width: min(760px, 92vw); pointer-events: none; z-index: 6; }
#subs .sr { display: inline-block; color: #fff; font: 500 17px/1.45 "Inter", "Nirmala UI", "Mangal", "Segoe UI", sans-serif; padding: 3px 12px; border-radius: 8px; background: rgba(0,0,0,.28); text-shadow: 0 1px 2px rgba(0,0,0,.9), 0 0 14px rgba(0,0,0,.6); }
#subs .se { color: rgba(255,240,220,.82); font: italic 300 14px var(--ui); margin-top: 4px; text-shadow: 0 1px 3px #000, 0 0 10px #000; }
/* round chrome buttons (help.js / phone.js): small glass circles with line icons; they fade back when idle / driving */
#helpBtn, #phoneBtn { position: fixed; bottom: 18px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; padding: 0; border-radius: 50%; border: 1px solid var(--hair-2); background: var(--glass); color: var(--ink-2); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 8px 20px rgba(0,0,0,.22); cursor: pointer; z-index: 8; transition: opacity .7s, background .2s, color .2s, transform .2s; }
#helpBtn { left: 18px; } #phoneBtn { left: 66px; }
#helpBtn:hover, #phoneBtn:hover { background: rgba(255,255,255,.14); color: #fff; opacity: 1; transform: translateY(-1px); }
#helpBtn svg, #phoneBtn svg { width: 18px; height: 18px; display: block; }
body.hud-calm #helpBtn, body.hud-calm #phoneBtn, body.hud-drive #helpBtn, body.hud-drive #phoneBtn { opacity: .3; }
@media (max-width: 700px) {
  #tracker { width: 190px; font-size: 11px; }
  #nav { bottom: 132px; max-width: 92vw; font-size: 11px; flex-wrap: wrap; white-space: normal; justify-content: center; border-radius: 14px; }
  #cluster { right: calc(12px + env(safe-area-inset-right, 0px)); top: calc(12px + env(safe-area-inset-top, 0px)); gap: 10px; }
  #tracker { top: calc(200px + env(safe-area-inset-top, 0px)); }
  #gaugeBox, #gauge { width: 128px; height: 128px; }
  #mmDial, #minimap { width: 140px; height: 140px; }
}

.bubble { position: absolute; left: 0; top: 0; max-width: 240px; padding: 6px 11px; background: rgba(255,255,255,.94); color: #17140f; border: 0; border-radius: 12px; font: 500 13.5px/1.35 var(--ui); white-space: normal; text-align: center; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-top-color: rgba(255,255,255,.94); border-bottom: 0; }
.bubble.pop { animation: pop .25s ease-out; }
@keyframes pop { from { scale: .4; } to { scale: 1; } }

/* ---------- Dialogue ---------- */
#dialogue { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(760px, 94vw); min-height: 104px; padding: 16px 22px 30px; background: linear-gradient(180deg, rgba(14,16,20,.6), rgba(10,12,16,.78)); border: 1px solid var(--hair); border-radius: 18px; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 24px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06); animation: dlgIn .3s cubic-bezier(.2,.8,.2,1); }
@keyframes dlgIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
#dlgSpeaker { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 600 10.5px var(--ui); letter-spacing: .22em; text-transform: uppercase; color: var(--ink-2); --who: #ff8f7a; }
#dlgSpeaker::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--who); box-shadow: 0 0 10px var(--who); }
#dlgSpeaker[data-who="chaaju"] { --who: var(--accent); }
#dlgSpeaker[data-who="tip"] { --who: #6fe3cf; }
#dlgSpeaker[data-who="emily"] { --who: #7cc4ff; }
#dlgText { font: 400 17px/1.6 var(--ui); color: var(--ink); }
#dlgChoices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
#dlgChoices button { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--hair-2); border-radius: 12px; background: rgba(255,255,255,.04); color: var(--ink); font: 500 14px/1.35 var(--ui); text-align: left; cursor: pointer; transition: background .15s, border-color .15s; }
#dlgChoices button:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.42); }
#dlgChoices kbd { flex: none; margin: 0; }
@media (max-width: 600px) { #dlgChoices { grid-template-columns: 1fr; } }

/* ---------- Khaata panel ---------- */
#panel { position: fixed; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(6,7,9,.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.pcard { width: min(760px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--glass-3); border: 1px solid var(--hair); border-radius: 20px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.5); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.phead { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--hair); font: 500 15px var(--ui); letter-spacing: .02em; }
#panelCash { color: var(--ok); font: 300 18px var(--num); font-variant-numeric: tabular-nums; }
.phead button, .maphead button { margin-left: auto; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--hair-2); background: transparent; color: var(--ink-2); font-size: 14px; cursor: pointer; }
.phead button:hover, .maphead button:hover { background: rgba(255,255,255,.1); color: #fff; }
#panelTabs { display: flex; gap: 4px; padding: 10px 14px 0; flex-wrap: wrap; }
#panelTabs button { padding: 7px 14px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--ink-2); font: 500 12.5px var(--ui); cursor: pointer; }
#panelTabs button:hover { background: rgba(255,255,255,.06); }
#panelTabs button.on { background: rgba(255,255,255,.92); color: #111; }
#panelBody { padding: 12px 16px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.prow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); border-radius: 12px; }
.prow.done { opacity: .75; }
.prow.locked { opacity: .5; }
.prow .pi { font-size: 22px; width: 32px; text-align: center; }
.prow .pt { flex: 1; min-width: 0; }
.prow .pt b { display: block; font-weight: 500; }
.prow .pt small { color: var(--ink-3); }
.prow button { padding: 7px 14px; border: 0; border-radius: 999px; background: rgba(255,255,255,.92); color: #111; font: 600 12.5px var(--ui); cursor: pointer; white-space: nowrap; }
.prow button:hover { background: #fff; }
.prow button:disabled { background: rgba(255,255,255,.1); color: rgba(255,255,255,.4); cursor: default; }
.pnote { font-size: 13px; color: var(--ink-2); }
.pseg { display: flex; gap: 6px; }
.pseg button.on { background: var(--ok); }
.pfoot { padding: 6px 18px 10px; font-size: 11px; color: var(--ink-3); letter-spacing: .04em; }

/* ---------- City map ---------- */
#citymap { position: fixed; inset: 0; background: rgba(6,7,9,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 5; }
.mapcard { max-width: 100%; max-height: 100%; display: flex; flex-direction: column; background: var(--glass-3); border: 1px solid var(--hair); border-radius: 20px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.maphead { padding: 12px 18px; border-bottom: 1px solid var(--hair); display: flex; align-items: center; gap: 8px; font: 400 13px var(--ui); color: var(--ink-2); }
.maphead b { color: var(--ink); font-weight: 600; letter-spacing: .02em; }
.mapbody { display: flex; gap: 12px; padding: 12px; min-height: 0; flex: 1; height: calc(100vh - 120px); justify-content: center; }
/* the map keeps its own shape (tall city): full height, width follows — the card wraps map + list, no empty half */
#citymapCanvas { height: calc(100vh - 140px); width: auto; max-width: calc(100vw - 320px); min-width: 0; flex: 0 0 auto; object-fit: contain; border-radius: 12px; background: #e3cba5; }
#citymapList { width: 250px; flex: 0 0 250px; display: flex; flex-direction: column; gap: 4px; overflow: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.mapkind { display: flex; gap: 4px; margin-bottom: 6px; }
.mapkind button { flex: 1; padding: 6px 2px !important; font-size: 12px; text-align: center !important; }
.mapkind button.on { background: rgba(255,255,255,.92) !important; color: #111 !important; }
#citymapList button { text-align: left; padding: 8px 10px; border: 1px solid rgba(255,255,255,.06); border-radius: 10px; background: rgba(255,255,255,.04); color: var(--ink); font: 500 12.5px var(--ui); cursor: pointer; }
#citymapList button:hover { background: rgba(255,255,255,.12); }
.maplisthead { margin: 10px 2px 2px; font: 600 10px var(--ui); color: var(--ink-3); letter-spacing: .18em; text-transform: uppercase; }
@media (max-width: 700px) { .maplisthead { width: 100%; } }
.mapfoot { padding: 6px 18px 10px; font-size: 10.5px; color: var(--ink-3); }
@media (max-width: 700px) { .mapbody { flex-direction: column; height: auto; } #citymapList { width: auto; flex: 1 1 auto; flex-direction: row; flex-wrap: wrap; } #citymapCanvas { height: auto; width: 100%; max-width: none; max-height: 50vh; } .mapkind { width: 100%; } }

/* ---------- Rhythm mini-game ---------- */
#rhythm { position: fixed; inset: 0; z-index: 6; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 30px; pointer-events: none; }
.rcard { width: min(520px, 94vw); padding: 14px; background: var(--glass-3); border: 1px solid rgba(255,143,168,.35); border-radius: 18px; text-align: center; pointer-events: auto; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 20px 50px rgba(0,0,0,.4); }
#rhythmTitle { font: 300 20px var(--num); letter-spacing: .14em; text-transform: uppercase; color: #fff; }
#rhythmLane { position: relative; height: 70px; margin: 10px 0; background: rgba(255,255,255,.05); border: 1px solid var(--hair); border-radius: 12px; overflow: hidden; }
#rhythmHit { position: absolute; left: 60px; top: 6px; bottom: 6px; width: 54px; border: 1px solid rgba(255,255,255,.7); border-radius: 12px; box-shadow: 0 0 14px rgba(255,201,138,.35), inset 0 0 12px rgba(255,201,138,.2); }
.note { position: absolute; top: 12px; width: 46px; height: 46px; margin-left: -23px; border-radius: 50%; background: var(--rose); color: #fff; font-size: 22px; font-weight: 600; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 14px rgba(255,143,168,.5); }
.note.hit { background: var(--ok); color: #000; transform: scale(1.3); transition: all .15s; opacity: 0; }
.note.miss { background: #555; box-shadow: none; }
#rhythmPads { display: flex; gap: 8px; justify-content: center; }
#rhythmPads button { width: 64px; height: 52px; border: 1px solid var(--hair-2); border-radius: 12px; background: rgba(255,255,255,.05); color: #fff; font-size: 20px; cursor: pointer; }
#rhythmPads button:active { background: rgba(255,255,255,.18); }
#rhythmScore { margin-top: 8px; font: 500 13px var(--ui); color: var(--ink-2); font-variant-numeric: tabular-nums; }

#dlgHint { position: absolute; right: 18px; bottom: 10px; display: flex; align-items: center; gap: 6px; font: 500 9.5px var(--ui); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); animation: blink 1.8s ease-in-out infinite; }
#dlgHint svg { width: 10px; height: 10px; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- Touch controls ---------- */
#touch { position: fixed; inset: 0; pointer-events: none; }
#stick { position: absolute; left: 28px; bottom: 28px; width: 130px; height: 130px; border-radius: 50%; background: rgba(12,14,18,.22); border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: auto; touch-action: none; }
#knob { position: absolute; left: 40px; top: 40px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 4px 14px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.6); }
#buttons { position: absolute; right: 18px; bottom: 22px; display: grid; grid-template-columns: repeat(3, 66px); gap: 10px; pointer-events: auto; }
#buttons button { height: 58px; border-radius: 50%; border: 1px solid rgba(255,255,255,.32); background: rgba(12,14,18,.32); color: rgba(255,255,255,.9); font: 600 10px var(--ui); letter-spacing: .12em; touch-action: none; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#buttons button:active { background: rgba(255,255,255,.3); }
#buttons .small { height: 40px; }
@media (pointer: coarse) {
  #objective { bottom: auto; top: 200px; font-size: 13px; }
  #cluster { top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); bottom: auto; align-items: flex-start; gap: 8px; }
  #gaugeBox, #gauge { width: 112px; height: 112px; }
  #mmDial, #minimap { width: 128px; height: 128px; }
  #place { order: 2; margin: 6px 0 0; max-width: 150px; font-size: 9.5px; }
  #tracker { top: 172px; right: 10px; }
  #dialogue { bottom: auto; top: 12px; }
  #meter { top: 50px; font-size: 11px; }
  #meter .bar { width: 100px; }
  .statrow .bar { width: 100px; }
  #prompt { bottom: 180px; }
}
@media (max-width: 560px) {
  #cash { font-size: 25px; }
  #stats { min-width: 0; padding: 10px 12px; }
  #clock { max-width: calc(100vw - 180px); }
  #eventChip { display: inline-block; margin: 3px 0 0; }
}
@media (pointer: coarse) and (max-width: 420px) {
  #stick { left: 12px; bottom: 20px; width: 116px; height: 116px; }
  #knob { left: 32px; top: 32px; }
  #buttons { right: 10px; grid-template-columns: repeat(3, 54px); gap: 7px; }
  #buttons button { height: 50px; font-size: 9.5px; }
}

/* ---------- Menu ---------- */
#menu { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(circle at 50% 30%, rgba(120,60,70,.55), rgba(8,6,8,.92)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); overflow: auto; }
#menu .card { width: min(560px, 100%); padding: 28px 28px 22px; background: var(--glass-3); border: 1px solid var(--hair); border-radius: 22px; text-align: center; box-shadow: 0 40px 100px rgba(0,0,0,.55); }
#menu h1 { margin: 0; font: 200 clamp(40px, 9vw, 64px)/1 var(--num); letter-spacing: .32em; padding-left: .32em; text-transform: uppercase; color: #fff; }
#menu h2 { margin: 8px 0 10px; font: 400 13px var(--ui); letter-spacing: .24em; text-transform: uppercase; color: var(--ink-2); }
#menu .tag { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
#menu .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
#menu button { padding: 11px 12px; border: 1px solid var(--hair-2); border-radius: 12px; background: rgba(255,255,255,.04); color: var(--ink); font: 500 14px var(--ui); cursor: pointer; transition: background .15s, border-color .15s; }
#menu button:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.4); }
#menu button:disabled { opacity: .35; cursor: default; }
#menu #btnNew { grid-column: span 2; background: rgba(255,255,255,.92); color: #111; border-color: transparent; font: 600 16px var(--ui); letter-spacing: .04em; }
#menu #btnNew:hover { background: #fff; }
.controls { width: 100%; font-size: 12.5px; border-collapse: collapse; text-align: left; }
.controls td { padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,.07); color: var(--ink-2); }
.controls td:first-child { color: var(--ink); font-weight: 600; white-space: nowrap; }
.mobile-note { font-size: 11.5px; color: var(--ink-3); }
#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #0d0b0a; font: 300 18px var(--ui); letter-spacing: .08em; color: var(--ink-2); z-index: 10; }

/* ---------- Landing page (src/ui/landing.js) ---------- */
#landing { position: fixed; inset: 0; z-index: 90; overflow: hidden; background: #1b0a14; color: #fff6ea; font-family: "Segoe UI", "Nirmala UI", system-ui, sans-serif; transition: opacity .35s cubic-bezier(0.2, 0, 0.2, 1); }
#landing.out { opacity: 0; pointer-events: none; }
#lnBg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ln-veil { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, transparent 35%, rgba(20,4,12,.55) 100%), linear-gradient(180deg, rgba(10,2,8,.15), transparent 30%, transparent 62%, rgba(14,3,8,.75)); pointer-events: none; }
.ln-gate { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; transition: opacity .6s; }
.ln-gate.gone { opacity: 0; pointer-events: none; }
.ln-logo { display: flex; flex-direction: column; align-items: center; text-shadow: 0 6px 30px rgba(255,120,60,.55), 0 2px 0 rgba(0,0,0,.5); animation: lnRise 1.6s ease-out both; }
.ln-logo .ln-dev { font: 600 clamp(26px, 5vw, 44px) "Nirmala UI", sans-serif; color: #ffd9a8; letter-spacing: 4px; }
.ln-logo b { font: 800 clamp(56px, 13vw, 132px) "Segoe UI", sans-serif; letter-spacing: .14em; line-height: .95; background: linear-gradient(180deg, #fff3d6 10%, #ffb35c 55%, #e8497a 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ln-logo i { font: 600 clamp(15px, 2.6vw, 24px) "Segoe UI", sans-serif; letter-spacing: .5em; text-transform: uppercase; color: #ffd0e0; font-style: normal; margin-top: 8px; }
.ln-begin { border: 1px solid rgba(255,214,150,.7); background: rgba(40,8,24,.45); color: #fff1d6; padding: 13px 26px; border-radius: 40px; font: 700 17px "Segoe UI", sans-serif; letter-spacing: .08em; cursor: pointer; backdrop-filter: blur(4px); animation: lnPulse 2.4s ease-in-out infinite; }
.ln-begin small { opacity: .7; font-weight: 500; }
.ln-hint { opacity: .6; letter-spacing: .1em; }
@keyframes lnRise { from { opacity: 0; transform: translateY(24px); letter-spacing: .3em; } to { opacity: 1; transform: none; } }
@keyframes lnPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,180,90,.45); } 50% { box-shadow: 0 0 0 14px rgba(255,180,90,0); } }
.ln-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 18px; }
.ln-frame { position: relative; width: min(980px, 100%); max-height: calc(100vh - 36px); overflow: auto; padding: 26px 34px 22px; background: linear-gradient(180deg, rgba(36,8,22,.58), rgba(22,5,14,.74)); border-radius: 22px; backdrop-filter: blur(6px);
  border: 14px solid transparent; border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 42 42'%3E%3Crect width='42' height='42' fill='none' stroke='%23d9a64a' stroke-width='1.6' x='3' y='3' rx='3' ry='3' width='36' height='36'/%3E%3Cpath d='M9 33V21a12 12 0 0 1 24 0v12' fill='none' stroke='%23e07a9a' stroke-width='1.4'/%3E%3Ccircle cx='21' cy='9.5' r='2' fill='%23d9a64a'/%3E%3C/svg%3E") 14 round;
  box-shadow: 0 30px 90px rgba(0,0,0,.55), inset 0 0 0 1px rgba(217,166,74,.35); animation: lnRise 1s ease-out both; }
.ln-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }
.ln-dots button { background: transparent; border: 1px solid rgba(255,214,150,.3); color: #f6dcc4; border-radius: 30px; padding: 6px 14px; font: 600 13px "Segoe UI", sans-serif; letter-spacing: .06em; cursor: pointer; transition: all .3s; }
.ln-dots button b { display: inline-block; width: 20px; height: 20px; line-height: 20px; border-radius: 50%; background: rgba(255,255,255,.12); margin-right: 6px; font-size: 11px; }
.ln-dots button.on { background: linear-gradient(90deg, #e8497a, #ff9f43); border-color: transparent; color: #fff; box-shadow: 0 4px 18px rgba(232,73,122,.45); }
.ln-sec { display: none; min-height: 300px; animation: lnFade .7s ease-out both; }
.ln-sec.on { display: block; }
@keyframes lnFade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.ln-kicker { font: 700 12px "Segoe UI", sans-serif; letter-spacing: .32em; color: #ffb35c; margin-bottom: 8px; }
.ln-h { margin: 0 0 12px; font: 800 clamp(34px, 6vw, 58px) "Segoe UI", sans-serif; letter-spacing: .02em; background: linear-gradient(180deg, #fff6e6, #ffc58a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ln-h span { font: 600 .5em "Nirmala UI", sans-serif; color: #ff9fbf; -webkit-text-fill-color: #ff9fbf; }
.ln-quote { font: 300 clamp(19px, 2.6vw, 27px)/1.5 "Segoe UI Light", "Segoe UI", sans-serif; color: #fff1e0; max-width: 760px; margin: 6px 0 20px; }
.ln-quote .w { opacity: 0; display: inline-block; animation: lnWord .6s ease-out forwards; }
@keyframes lnWord { from { opacity: 0; filter: blur(6px); transform: translateY(6px); } to { opacity: 1; filter: none; transform: none; } }
.ln-facts { display: flex; gap: 12px; flex-wrap: wrap; }
.ln-facts span { padding: 10px 16px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,214,150,.22); font-size: 13px; color: #f3d9c6; }
.ln-facts b { display: block; font-size: 22px; color: #ffd166; }
.ln-vo { margin-top: 16px; background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 20px; padding: 6px 12px; cursor: pointer; }
.ln-hero { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.ln-spot { position: relative; width: 260px; height: 340px; border-radius: 22px; overflow: hidden; background: radial-gradient(ellipse at 50% 85%, rgba(255,160,80,.45), transparent 60%), radial-gradient(ellipse at 50% 30%, #4a1530, #1e0612 75%); box-shadow: inset 0 0 0 1px rgba(255,214,150,.3), 0 18px 50px rgba(0,0,0,.5); flex: none; }
.ln-spot canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.ln-spot small { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 11px; opacity: .6; }
.ln-bio { flex: 1; min-width: 260px; }
.ln-bio p { font-size: 16px; line-height: 1.65; color: #fbe6d4; margin: 0 0 16px; }
.ln-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ln-chips span { padding: 6px 12px; border-radius: 20px; background: rgba(255,159,67,.14); border: 1px solid rgba(255,159,67,.35); font-size: 13px; }
.ln-pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 6px; }
.ln-pillars div { padding: 18px 16px; border-radius: 18px; background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.02)); border: 1px solid rgba(255,214,150,.22); transition: transform .3s, border-color .3s; }
.ln-pillars div:hover { transform: translateY(-4px); border-color: rgba(255,179,92,.7); }
.ln-pillars i { font-style: normal; font-size: 34px; display: block; margin-bottom: 8px; }
.ln-pillars b { display: block; font-size: 16px; color: #ffd8a8; margin-bottom: 6px; }
.ln-pillars p { margin: 0; font-size: 14px; line-height: 1.5; color: #f1d6c6; }
.ln-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 22px; flex-wrap: wrap; border-top: 1px solid rgba(255,214,150,.18); padding-top: 16px; }
.ln-load { flex: 1; min-width: 200px; }
.ln-bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; }
.ln-bar i { display: block; height: 100%; width: 3%; background: linear-gradient(90deg, #e8497a, #ffb35c); transition: width .6s ease; }
.ln-load small { display: block; margin-top: 6px; opacity: .7; font-size: 12px; }
.ln-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ln-sm { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); color: #fff; padding: 10px 14px; border-radius: 12px; font: 600 14px "Segoe UI", sans-serif; cursor: pointer; }
.ln-sm:hover { background: rgba(255,255,255,.16); }
.ln-cta { position: relative; border: 0; border-radius: 14px; padding: 14px 24px; font: 800 16px "Segoe UI", sans-serif; letter-spacing: .12em; color: #2a0a12; cursor: pointer; background: linear-gradient(90deg, #ffd166, #ff9f43, #ff6b8b, #ffd166); background-size: 300% 100%; animation: lnGlow 3s linear infinite; box-shadow: 0 0 24px rgba(255,159,67,.6), 0 0 60px rgba(232,73,122,.35); transition: transform .2s; }
.ln-cta small { font-weight: 700; letter-spacing: .06em; opacity: .75; }
.ln-cta:hover:not(:disabled) { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 34px rgba(255,190,90,.9), 0 0 80px rgba(232,73,122,.55); }
.ln-cta:disabled { filter: grayscale(.6) brightness(.75); cursor: wait; animation: none; box-shadow: none; }
@keyframes lnGlow { from { background-position: 0% 0; } to { background-position: 300% 0; } }
.ln-frame { scrollbar-width: thin; scrollbar-color: rgba(255,179,92,.5) transparent; }
@media (max-width: 760px) { .ln-frame { padding: 18px 16px 0; } .ln-foot { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(22,5,14,.6), rgba(22,5,14,.97) 30%); padding-bottom: 14px; } .ln-facts span { padding: 7px 10px; } .ln-facts b { font-size: 17px; } .ln-quote { font-size: 18px; } .ln-pillars { grid-template-columns: 1fr; } .ln-spot { width: 100%; height: 300px; } .ln-cta { width: 100%; } .ln-foot { flex-direction: column; align-items: stretch; } .ln-nav { justify-content: space-between; } }
/* narrow screens: the nav strip sits at 132px and wraps to two lines — keep the action prompt clear above it */
@media (max-width: 700px) { #prompt { bottom: 216px; font-size: 12.5px; padding: 6px 12px; } }

/* mouse-lock hint (input.js) */
#lockHint { position: fixed; top: 64px; left: 50%; transform: translateX(-50%) translateY(-8px); padding: 6px 14px; border-radius: 999px; background: var(--glass-2); color: var(--ink); font: 500 12px var(--ui); letter-spacing: .03em; border: 1px solid var(--hair-2); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 40; }
#lockHint.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* touch screens: the round HUD buttons must not sit on the joystick (left) or the BRAKE / action pad (right) */
@media (pointer: coarse) {
  #helpBtn { left: 14px !important; bottom: 172px !important; top: auto !important; right: auto !important; }
  #phoneBtn { left: 62px !important; bottom: 172px !important; top: auto !important; right: auto !important; }
  #actBtn { right: 16px !important; bottom: 246px !important; }
}
@media (pointer: coarse) and (max-width: 700px) {
  #nav { bottom: 186px !important; } /* above the JUMP / RUN pad, not over it */
  #objective { top: 270px !important; } /* under the mission card, not behind it */
}
