/* Lanka Streets: Sri Lankan private-bus art. Saffron and magenta paint, chrome trim, peacock panels. */
:root {
  --ink: #0c1b2a;
  --ink-2: #13283b;
  --saffron: #f2a007;
  --magenta: #d6246e;
  --chrome: #e9e6df;
  --peacock: #0e5e6f;
  --tea: #2f6b3a;
  --paper: #f4f1ea;
  --red: #e2362f;
  --led: #ffb000;
  --display: 'Gemunu Libre', 'Arial Narrow', sans-serif;
  --body: 'Yaldevi', 'Gemunu Libre', system-ui, sans-serif;
  --stroke: 0.09em;
  color-scheme: dark;
}
:root:not([data-theme='light']) { --bg: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --bg: var(--ink); } }
:root[data-theme='dark'] { --bg: var(--ink); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg, var(--ink)); color: var(--paper); font-family: var(--body); }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
button, select, input { font: inherit; }
kbd { font-family: var(--display); font-weight: 700; background: var(--ink-2); border: 1px solid #3a536a; border-bottom-width: 3px; border-radius: 5px; padding: 0 0.4em; color: var(--paper); font-size: 0.95em; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 3px; }

/* Painted lettering: dark ink stroke under a bright fill, like hand-painted bus panels. */
.paint, .logo h1 span {
  font-family: var(--display);
  font-weight: 800;
  paint-order: stroke fill;
  -webkit-text-stroke: var(--stroke) var(--ink);
  letter-spacing: 0.01em;
}

/* ------------------------------------------------------------------ loading */
#loading {
  position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; gap: 22px; padding: 16px;
  background: radial-gradient(120% 90% at 50% 40%, #16324a 0%, var(--ink) 70%);
  transition: opacity 0.8s ease, visibility 0.8s;
}
#loading.done { opacity: 0; visibility: hidden; }
.board {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 18px;
  width: min(560px, 92vw); padding: 16px 22px; background: #050505; border-radius: 10px;
  border: 4px solid #b9bcc2; box-shadow: inset 0 0 0 2px #333, 0 18px 50px rgba(0, 0, 0, 0.5);
}
.route { font-family: var(--display); font-weight: 800; font-size: 64px; line-height: 1; color: var(--led); text-shadow: 0 0 12px rgba(255, 176, 0, 0.7); padding-right: 18px; border-right: 2px dashed #3a2a00; }
.dest p { margin: 0; font-family: var(--display); color: var(--led); text-shadow: 0 0 10px rgba(255, 176, 0, 0.6); }
.dest .si { font-family: var(--body); font-size: 22px; opacity: 0.85; }
#loadLabel { font-size: 26px; font-weight: 600; min-height: 1.3em; }
.track { width: min(560px, 92vw); height: 8px; border-radius: 4px; background: #24384b; overflow: hidden; }
#loadBar { height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: repeating-linear-gradient(90deg, var(--saffron) 0 14px, var(--magenta) 14px 28px); transition: transform 0.4s ease; }
.err { color: #ff9a9a; max-width: 560px; text-align: center; margin: 0; font-size: 14px; }

/* ------------------------------------------------------------------ title */
#title { position: fixed; inset: 0; z-index: 20; display: none; flex-direction: column; justify-content: center; gap: 34px; padding: 6vh 7vw;
  background: linear-gradient(90deg, rgba(12, 27, 42, 0.86) 0%, rgba(12, 27, 42, 0.55) 38%, rgba(12, 27, 42, 0) 70%); }
body[data-mode='title'] #title { display: flex; }
.logo h1 { margin: 0; display: flex; flex-direction: column; line-height: 0.82; transform: skewX(-9deg); transform-origin: left bottom; }
.logo .l0 { font-size: clamp(64px, 10.5vw, 150px); color: var(--saffron); --stroke: 0.06em;
  text-shadow: 0.035em 0.035em 0 var(--magenta), 0.07em 0.07em 0 var(--ink); }
.logo .l2 { font-size: clamp(54px, 9vw, 128px); color: var(--chrome); --stroke: 0.07em; margin-left: 0.32em;
  text-shadow: 0.04em 0.04em 0 var(--peacock), 0.08em 0.08em 0 var(--ink); }
.logo-si { margin: 0 0 6px; font-size: clamp(20px, 2.4vw, 30px); color: var(--paper); opacity: 0.9; }
.tag { margin: 18px 0 0; font-size: clamp(16px, 1.6vw, 20px); max-width: 34ch; color: var(--paper); }
.menu { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.menu button, .stack button, #controlsClose, #shopClose, #creditsClose, #travelClose, #modeClose {
  font-family: var(--display); font-weight: 700; font-size: 26px; padding: 8px 22px 6px; border-radius: 999px; cursor: pointer;
  background: var(--saffron); color: var(--ink); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--magenta);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.menu button:hover, .stack button:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--magenta); }
.menu button.quiet, .stack button.quiet, #shopClose, #travelClose, #modeClose { background: transparent; color: var(--paper); border-color: var(--paper); box-shadow: none; font-size: 21px; }
.foot { position: absolute; left: 7vw; bottom: 4vh; margin: 0; font-size: 14px; opacity: 0.8; max-width: 60ch; }
/* open-data and model credits: small, always readable */
.credit { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); margin: 0; font-size: 12px; line-height: 1.4; text-align: right; opacity: 0.72; max-width: 46ch; pointer-events: none; }
#mapView .credit { bottom: 62px; padding: 3px 8px; background: rgba(12, 27, 42, 0.7); border-radius: 4px; opacity: 0.9; }

/* ------------------------------------------------------------------ HUD */
/* A street dashboard rather than corner widgets: a three-wheeler fare meter, a police light bar,
   a bus-window minimap with a compass tape, trilingual road signs and a car-stereo faceplate. */
#hud, #letterbox, #crosshair { display: none; }
body[data-mode='game'] #hud, body[data-mode='game'] #letterbox { display: block; }
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; font-family: var(--body); }

/* Fare meter */
.meter { position: absolute; top: 16px; right: 18px; width: 272px; padding: 10px 10px 8px; border-radius: 16px;
  background: linear-gradient(#2a2d31, #15171a); border: 3px solid #b9bcc2; box-shadow: inset 0 0 0 2px #050607, 0 10px 24px rgba(0, 0, 0, 0.45); }
.meter-row { display: flex; gap: 8px; align-items: stretch; }
#weapon { position: relative; flex: 0 0 62px; height: 62px; border-radius: 10px; background: var(--chrome); border: 2px solid #050607; display: grid; place-items: center; transition: transform 0.15s; }
#weapon.pop { transform: scale(1.1); }
#weapon .w { display: none; width: 40px; height: 40px; fill: var(--ink); }
#weapon[data-w='fist'] .w-fist, #weapon[data-w='bat'] .w-bat, #weapon[data-w='pistol'] .w-pistol, #weapon[data-w='smg'] .w-smg, #weapon[data-w='shotgun'] .w-shotgun { display: block; }
#ammo { position: absolute; bottom: -4px; right: -4px; min-width: 24px; padding: 0 4px; border-radius: 8px; background: var(--ink); color: var(--saffron);
  font-family: var(--display); font-weight: 800; font-size: 15px; text-align: center; line-height: 20px; }
#ammo:empty { display: none; }
.lcd { position: relative; flex: 1; border-radius: 8px; background: #0a0505; border: 2px solid #050607; padding: 6px 10px 8px; overflow: hidden; }
.lcd-top { display: flex; justify-content: space-between; font-family: var(--display); font-weight: 700; font-size: 15px; color: #ff9b6b; line-height: 1.1; }
#speed { color: var(--saffron); }
.lcd-num { position: relative; text-align: right; font-family: var(--display); font-weight: 800; font-size: 38px; line-height: 1; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; font-style: italic; }
.lcd-num .ghost { position: absolute; right: 0; color: rgba(255, 70, 40, 0.09); }
#money { position: relative; color: #ff4a2a; text-shadow: 0 0 6px rgba(255, 74, 42, 0.55); }
#money.bump { animation: bump 0.35s ease; }
.cur { position: absolute; left: 10px; bottom: 4px; font-family: var(--display); font-weight: 700; font-size: 16px; color: #ff9b6b; }
.segs { display: grid; gap: 4px; margin-top: 8px; }
.seg { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; height: 9px; }
.seg i { border-radius: 2px; background: rgba(255, 255, 255, 0.08); }
.seg.hp i.on { background: var(--magenta); }
.seg.ar i.on { background: var(--chrome); }
.seg.ar:not(.has) { display: none; }
.seg.hp.low i.on { animation: blink 0.6s steps(2) infinite; }
/* Police light bar */
/* needs: four slim LCD-style gauges under the health bar */
.needs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; margin-top: 7px; }
.nd { display: flex; align-items: center; gap: 6px; font-size: 11px; line-height: 1; color: #f4f1ea; }
.nd b { width: 46px; font-weight: 600; opacity: 0.85; }
.nd i { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.nd em { display: block; height: 100%; width: 100%; border-radius: 3px; background: var(--peacock); transform: scaleX(0.5); transform-origin: left; transition: transform 0.4s; }
.nd.low em { background: var(--saffron); }
.nd.crit em { background: var(--magenta); animation: blink 0.8s steps(2) infinite; }
.nd[hidden] { display: none; }
.lightbar { display: flex; align-items: center; gap: 5px; margin-top: 8px; padding: 4px 8px; border-radius: 999px; background: #050607; }
.lightbar i { width: 26px; height: 12px; border-radius: 6px 6px 3px 3px; background: #1d2027; }
.lightbar i.on:nth-child(odd) { background: #ff2a2a; }
.lightbar i.on:nth-child(even) { background: #2a6bff; }
.lightbar.flash i.on { animation: blink 0.5s steps(2) infinite; }
.lightbar.pulse i.on { animation: bump 0.4s ease 3; }
.lightbar span { margin-left: auto; font-family: var(--display); font-weight: 700; font-size: 14px; color: #8b93a1; }
.lightbar.hot span { color: var(--paper); }
#timer { margin-top: 8px; text-align: center; font-family: var(--display); font-weight: 800; font-size: 34px; color: var(--paper); display: none; border-top: 1px dashed #3a3f47; padding-top: 4px; }
#timer.on { display: block; }
#timer.low { color: #ff4a2a; }

/* Bus-window minimap with compass tape */
.mapbox { position: absolute; left: 18px; top: 16px; width: 242px; padding: 3px; border-radius: 22px; background: #b9bcc2; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45); }
.mapbox canvas { display: block; width: 236px; }
#tape { height: 26px; border-radius: 19px 19px 0 0; background: #050607; }
#minimap { height: 236px; border-radius: 0 0 19px 19px; }
#objective { position: absolute; left: 18px; top: 290px; max-width: 300px; padding: 8px 12px 8px 30px; border-radius: 10px; background: rgba(12, 27, 42, 0.86);
  font-size: 16px; line-height: 1.35; opacity: 0; transition: opacity 0.3s; }
#objective::before { content: ''; position: absolute; left: 12px; top: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--saffron); }
#objective.on { opacity: 1; }
#help { position: absolute; top: 290px; left: 330px; max-width: 360px; padding: 10px 14px; background: rgba(12, 27, 42, 0.9); border-radius: 10px;
  font-size: 15px; line-height: 1.45; opacity: 0; transform: translateY(-6px); transition: 0.25s; }
#help.on { opacity: 1; transform: none; }
/* Door prompt: centred low, like a shop's hand-painted board */
#prompt { position: absolute; left: 50%; bottom: 26%; transform: translate(-50%, 8px); padding: 8px 18px 7px; border-radius: 8px;
  background: var(--saffron); color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: 0.01em;
  box-shadow: 0 3px 0 #9a5f00; opacity: 0; transition: opacity 0.2s, transform 0.2s; white-space: nowrap; }
#prompt.on { opacity: 1; transform: translate(-50%, 0); }

/* Trilingual road sign (Sinhala, Tamil, English, as on Sri Lankan roads) */
.roadsign { position: absolute; top: 16px; left: 50%; min-width: 260px; padding: 10px 26px 12px; text-align: center; border-radius: 10px;
  background: #1450a3; border: 3px solid var(--paper); box-shadow: 0 0 0 3px #1450a3, 0 12px 24px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -150%); transition: transform 0.45s cubic-bezier(.16, 1, .3, 1); }
.roadsign.on { transform: translate(-50%, 0); }
.roadsign.hwy { background: #19714a; box-shadow: 0 0 0 3px #19714a, 0 12px 24px rgba(0, 0, 0, 0.4); }
.roadsign b { display: block; font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--paper); line-height: 1.2; }
.roadsign i { display: block; font-style: normal; font-family: 'Noto Sans Tamil', var(--body); font-size: 16px; color: var(--paper); opacity: 0.92; }
.roadsign span { display: block; font-family: var(--display); font-weight: 800; font-size: 24px; color: var(--paper); letter-spacing: 0.02em; }
.roadsign i:empty { display: none; }

/* Car-stereo faceplate */
.stereo { position: absolute; right: 18px; bottom: 18px; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px;
  background: linear-gradient(#202328, #0e1013); border: 2px solid #5b6068; opacity: 0; transform: translateY(10px); transition: 0.3s; }
.stereo.on { opacity: 1; transform: none; }
.stereo .fq { font-family: var(--display); font-weight: 800; font-size: 26px; color: #7ff0e6; font-variant-numeric: tabular-nums; }
.stereo b { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--paper); }
.stereo i { font-style: normal; font-size: 14px; color: var(--saffron); }
#vname { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); padding: 4px 14px; border-radius: 999px; background: var(--saffron); color: var(--ink);
  font-family: var(--display); font-weight: 800; font-size: 20px; opacity: 0; transition: opacity 0.4s; }
#vname.on { opacity: 1; }
#toast { position: absolute; left: 50%; bottom: 196px; transform: translateX(-50%); max-width: min(560px, 90vw); padding: 8px 16px; border-radius: 999px;
  background: rgba(12, 27, 42, 0.9); border: 1px solid #34506a; font-size: 15px; text-align: center; opacity: 0; transition: opacity 0.25s; }
#toast.on { opacity: 1; }

/* Dialogue plate */
#say { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); width: min(780px, 92vw); padding: 14px 20px 14px; border-radius: 14px;
  background: rgba(8, 18, 28, 0.88); font-size: 21px; line-height: 1.45; opacity: 0; transition: opacity 0.2s; }
#say.on { opacity: 1; }
#say b { display: inline-block; margin-bottom: 4px; padding: 1px 10px; border-radius: 6px; background: var(--saffron); color: var(--ink); font-family: var(--display); font-size: 17px; }
#say span { display: block; }

/* Ribbon banners for job done / blown, hospital, arrested */
.big { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%) scale(0.9); text-align: center; opacity: 0; transition: opacity 0.35s, transform 0.35s; }
.big.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.big h2 { margin: 0; padding: 6px 48px 10px; font-family: var(--display); font-weight: 800; font-size: clamp(40px, 6.5vw, 84px); line-height: 1.05; color: var(--ink);
  background: var(--saffron); clip-path: polygon(0 0, 100% 0, 96% 50%, 100% 100%, 0 100%, 4% 50%); white-space: nowrap; }
.big p { margin: 10px auto 0; padding: 6px 16px; max-width: 48ch; width: max-content; border-radius: 8px; background: rgba(12, 27, 42, 0.88); font-size: 19px; }
.big.title h2 { background: var(--chrome); }
.big.fail h2 { background: #c8372d; color: var(--paper); }
.big.wasted h2 { background: #f4f1ea; color: #c41e2a; }
.big.busted h2 { background: #1d4fa3; color: var(--paper); }
body.wasted canvas#game { filter: saturate(0.25) contrast(1.05) brightness(0.85); transition: filter 1.5s; }
body.busted canvas#game { filter: saturate(0.4) hue-rotate(190deg) brightness(0.85); transition: filter 1.5s; }
#letterbox i { position: fixed; left: 0; right: 0; height: 11vh; background: #000; z-index: 9; transition: transform 0.5s ease; }
#letterbox i:first-child { top: 0; transform: translateY(-100%); } #letterbox i:last-child { bottom: 0; transform: translateY(100%); }
#letterbox.on i { transform: none; }
body.cine .meter, body.cine .mapbox, body.cine #objective, body.cine #help { opacity: 0; }
body.aiming #crosshair { display: block; }
#crosshair { position: fixed; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; z-index: 11; pointer-events: none; }
#crosshair::before, #crosshair::after { content: ''; position: absolute; background: var(--paper); box-shadow: 0 0 0 1px rgba(12, 27, 42, 0.7); }
#crosshair::before { left: 12px; top: 0; width: 2px; height: 26px; }
#crosshair::after { top: 12px; left: 0; width: 26px; height: 2px; }
body.lang-si .lcd-top, body.lang-si #say, body.lang-si #objective { font-family: var(--body); }

/* ------------------------------------------------------------------ sheets */
.sheet { position: fixed; inset: 0; z-index: 30; display: none; place-items: center; padding: 16px; background: rgba(12, 27, 42, 0.72); backdrop-filter: blur(3px); }
.sheet.on { display: grid; }
.panel { width: min(460px, 100%); max-height: 92vh; overflow: auto; background: var(--ink-2); border: 3px solid var(--chrome); border-radius: 14px; padding: 24px 26px;
  box-shadow: 8px 8px 0 var(--peacock); }
.panel.wide { width: min(980px, 100%); }
.panel h2 { margin: 0 0 8px; font-family: var(--display); font-weight: 800; font-size: 44px; color: var(--saffron); paint-order: stroke fill; -webkit-text-stroke: 0.08em var(--ink); transform: skewX(-6deg); }
.panel p { line-height: 1.55; }
.stack { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin: 16px 0; }
.stack button { font-size: 22px; }
fieldset { border: 2px solid #34506a; border-radius: 10px; padding: 12px 14px 14px; margin: 8px 0 0; display: grid; gap: 10px; }
legend { font-family: var(--display); font-size: 20px; color: var(--chrome); padding: 0 6px; }
fieldset label { display: grid; gap: 4px; font-size: 15px; }
fieldset label.check { display: flex; align-items: center; gap: 8px; }
input[type='range'] { accent-color: var(--saffron); width: 100%; }
select { background: var(--ink); color: var(--paper); border: 2px solid #34506a; border-radius: 6px; padding: 5px 8px; }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin: 12px 0 18px; }
dl { margin: 0; }
dt { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--chrome); margin-bottom: 6px; }
dd { margin: 0 0 7px; font-size: 15px; line-height: 1.5; }
#shopList, #travelList { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 8px; }
#shopList button, #travelList button { width: 100%; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 10px 14px; border-radius: 8px; cursor: pointer;
  background: var(--ink); color: var(--paper); border: 2px solid #34506a; font-size: 17px; text-align: left; }
#shopList button b, #travelList button b { font-family: var(--display); color: var(--saffron); font-size: 20px; }
#shopList button:hover:not(:disabled), #travelList button:hover:not(:disabled) { border-color: var(--saffron); }
#shopList button:disabled, #travelList button:disabled { opacity: 0.45; cursor: not-allowed; }
.shop-sub b { color: var(--saffron); }

#mapView { position: fixed; inset: 0; z-index: 25; display: none; background: #0e3b4f; }
#mapView.on { display: block; }
#mapCanvas { width: 100%; height: 100%; display: block; cursor: grab; }
.maphint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); margin: 0; padding: 8px 14px; background: rgba(12, 27, 42, 0.85); border-radius: 6px; font-size: 14px; text-align: center; width: max-content; max-width: 92vw; }

@keyframes blink { 50% { opacity: 0.25; } }
@keyframes bump { 40% { transform: scale(1.12); } }

@media (max-width: 760px) {
  #minimap { width: 150px; height: 150px; }
  .bl { left: 16px; bottom: 16px; }
  .tr { top: 12px; right: 16px; }
  #weapon { width: 56px; height: 56px; }
  #money { font-size: 26px; }
  #clock { font-size: 22px; }
  .bars { width: 110px; }
  #speed { left: 162px; font-size: 22px; }
  .cols { grid-template-columns: 1fr; }
  #help, #toast { left: 16px; max-width: calc(100vw - 32px); }
  #title { padding: 6vh 16px; background: linear-gradient(180deg, rgba(12, 27, 42, 0.85), rgba(12, 27, 42, 0.4)); }
  .foot { left: 16px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------ touch */
#touch { display: none; }
/* sleeping: a slow fade to black and back */
body.sleeping #game, body.sleeping canvas { animation: sleepfade 1.6s ease-in-out; }
@keyframes sleepfade { 0% { filter: brightness(1); } 45%, 60% { filter: brightness(0); } 100% { filter: brightness(1); } }
@media (prefers-reduced-motion: reduce) { body.sleeping canvas { animation: none; } }
/* mode picker: three tall choices */
.modes { display: grid; gap: 10px; margin: 14px 0; }
.modes button { display: grid; gap: 4px; text-align: left; padding: 12px 16px; border-radius: 10px; cursor: pointer; background: var(--ink); color: var(--paper); border: 2px solid #34506a; }
.modes button b { font-family: var(--display); font-size: 24px; color: var(--saffron); }
.modes button span { font-size: 15px; line-height: 1.35; opacity: 0.9; }
.modes button:hover, .modes button:focus-visible { border-color: var(--saffron); outline: none; }
/* New game, step two: who you are */
.modes[hidden], .who[hidden] { display: none; }
#modepick .panel.wide { width: min(760px, 100%); }
.who-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; margin: 6px 0 4px; }
.gender { display: inline-flex; border: 2px solid #34506a; border-radius: 999px; padding: 3px; background: var(--ink); }
.gender button { font-family: var(--display); font-weight: 700; font-size: 20px; padding: 6px 18px 4px; border-radius: 999px; border: 0; cursor: pointer; background: transparent; color: var(--paper); }
.gender button[aria-checked='true'] { background: var(--saffron); color: var(--ink); }
.gender button:focus-visible { outline: 2px solid var(--chrome); outline-offset: 2px; }
.who-name { display: grid; gap: 4px; font-size: 14px; flex: 1; min-width: 180px; }
.who-name input { font: 600 20px var(--body); padding: 8px 12px; border-radius: 10px; border: 2px solid #34506a; background: var(--ink); color: var(--paper); }
.who-name input:focus { border-color: var(--saffron); outline: none; }
.who-hint { margin: 10px 0 0; opacity: 0.85; }
.careers { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .careers { grid-template-columns: 1fr; } }
#modeClose { margin-top: 2px; }
/* life journal in the pause menu */
.journal { margin: 4px 0 10px; }
.journal summary { cursor: pointer; font-weight: 600; }
.journal ol { list-style: none; margin: 8px 0 0; padding: 0; max-height: 28vh; overflow-y: auto; display: grid; gap: 4px; font-size: 14px; }
.journal li { display: flex; gap: 8px; }
.journal li small { opacity: 0.6; min-width: 46px; }
.journal li.good { color: #9fe3b0; } .journal li.bad { color: #f2a7a7; }
body[data-playmode='explore'] .needs, body[data-playmode='explore'] #journal { display: none; }
.foot.tch, .tch-only { display: none !important; }
body.touch .tch-only { display: flex !important; }
body.touch .foot.desk { display: none; }
body.touch .foot.tch { display: block; }
body.touch[data-mode='game'] #touch { display: block; }
#touch { position: fixed; inset: 0; z-index: 12; pointer-events: none; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#touch .look { position: absolute; top: 0; right: 0; bottom: 0; left: 40%; pointer-events: auto; }
#touch .stick { position: absolute; left: calc(26px + env(safe-area-inset-left)); bottom: 26px; width: 150px; height: 150px; border-radius: 50%; pointer-events: auto;
  background: rgba(12, 27, 42, 0.32); border: 3px solid rgba(233, 230, 223, 0.55); display: grid; place-items: center; }
#touch .knob { width: 64px; height: 64px; border-radius: 50%; background: var(--saffron); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--magenta); }
#touch .tbtns { position: absolute; right: env(safe-area-inset-right); bottom: 0; width: 290px; height: 230px; pointer-events: none; }
#touch .tbtns .tb { position: absolute; }
#touch .s-main { right: 22px; bottom: 22px; }
#touch .s-2 { right: 132px; bottom: 16px; }
#touch .s-3 { right: 34px; bottom: 134px; }
#touch .s-4 { right: 218px; bottom: 22px; }
#touch .s-enter { right: 126px; bottom: 104px; width: 66px; height: 66px; }
#touch .tsys { position: absolute; top: calc(140px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); display: flex; gap: 8px; pointer-events: none; }
#touch .tb::after { content: ''; position: absolute; inset: -10px; border-radius: 50%; } /* a bigger, invisible hit area */
#touch .stick::before { content: ''; position: absolute; inset: -45px; border-radius: 50%; }
#touch .tb { pointer-events: auto; width: 72px; height: 72px; border-radius: 50%; font-family: var(--display); font-weight: 800; font-size: 18px; color: var(--ink);
  background: var(--chrome); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--peacock); touch-action: none; }
#touch .tb.tmain { width: 96px; height: 96px; font-size: 22px; background: var(--saffron); box-shadow: 3px 3px 0 var(--magenta); }
#touch .tb.small { width: 60px; height: 60px; font-size: 15px; }
#touch .tb.enter { background: #a8194f; color: var(--paper); } /* darker magenta keeps white text above 4.5:1 */
#touch .tb.sys { width: auto; height: 40px; padding: 0 16px; border-radius: 999px; font-size: 16px; background: rgba(233, 230, 223, 0.9); box-shadow: none; }
#touch .tb.down { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
#touch .tb.on { background: var(--peacock); color: var(--paper); }
body.in-car #touch .onfoot, body:not(.in-car) #touch .incar { display: none; }
body.cine #touch .stick, body.cine #touch .tbtns, body.cine #touch .tsys { opacity: 0; pointer-events: none; }
/* HUD rearranged around the thumbs */
body.touch .mapbox { left: calc(10px + env(safe-area-inset-left)); top: 8px; width: 150px; border-radius: 16px; }
body.touch .mapbox canvas { width: 144px; }
body.touch #tape { height: 18px; border-radius: 13px 13px 0 0; }
body.touch #minimap { height: 144px; border-radius: 0 0 13px 13px; }
body.touch .meter { top: 8px; right: calc(10px + env(safe-area-inset-right)); width: 210px; padding: 7px; border-radius: 12px; }
body.touch #weapon { flex-basis: 46px; height: 46px; }
body.touch #weapon .w { width: 30px; height: 30px; }
body.touch .lcd-num { font-size: 28px; }
body.touch .lcd-top { font-size: 12px; }
body.touch .lightbar i { width: 18px; height: 9px; }
body.touch .roadsign { top: 8px; min-width: 200px; padding: 6px 16px 8px; }
body.touch .roadsign b { font-size: 19px; } body.touch .roadsign span { font-size: 18px; } body.touch .roadsign i { font-size: 13px; }
body.touch #objective { top: 200px; left: calc(10px + env(safe-area-inset-left)); max-width: 230px; font-size: 13px; }
body.touch #help { top: auto; bottom: 190px; left: 50%; transform: translateX(-50%); max-width: 44vw; font-size: 13px; }
body.touch #help.on { transform: translateX(-50%); }
body.touch #say { bottom: 12px; width: min(470px, 56vw); font-size: 15px; padding: 10px 14px; }
body.touch #toast { bottom: auto; top: 96px; font-size: 13px; }
body.touch #vname { bottom: auto; top: 60px; }
body.touch .stereo { right: 50%; transform: translateX(50%); bottom: auto; top: 60px; }
@media (orientation: portrait) {
  body.touch[data-mode='game']::after { content: 'Turn your phone sideways to play'; position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; text-align: center;
    background: var(--ink); color: var(--saffron); font-family: var(--display); font-weight: 800; font-size: 30px; }
}

.mapclose { position: absolute; top: 14px; right: 14px; font-family: var(--display); font-weight: 700; font-size: 20px; padding: 6px 18px; border-radius: 999px; background: var(--saffron); color: var(--ink); border: 3px solid var(--ink); cursor: pointer; }

.langpick { display: flex; gap: 6px; margin-top: 6px; }
.langpick button { font-family: var(--body); font-size: 16px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--paper); background: transparent; color: var(--paper); cursor: pointer; }
.langpick button.on { background: var(--paper); color: var(--ink); }

/* ------------------------------------------------------------------ short landscape phones */
/* Phones on their side are ~390-430 px tall with a notch on one side: everything must fit and
   stay inside the safe area. */
#title { padding-left: max(7vw, calc(env(safe-area-inset-left) + 16px)); padding-right: max(16px, env(safe-area-inset-right)); }
.sheet { padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.panel { max-height: calc(100vh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); max-height: calc(100dvh - 24px); }
@media (max-height: 520px) {
  #title { justify-content: center; gap: 14px; padding-top: 12px; padding-bottom: 12px; }
  .logo .l0 { font-size: min(13vh * 1.05, 11vw); }
  .logo .l2 { font-size: min(10vh, 8vw); }
  .logo-si { font-size: 16px; margin-bottom: 2px; }
  .tag { margin-top: 8px; font-size: 14px; }
  .menu { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .menu button, #controlsClose, #shopClose, #creditsClose, #travelClose { font-size: 18px; padding: 6px 16px 4px; }
  .menu button.quiet { font-size: 16px; }
  .langpick { margin-top: 0; }
  .langpick button { font-size: 14px; padding: 4px 10px; }
  .foot { display: none !important; }
  .credit { font-size: 12px; max-width: 60ch; }
  #mapView .credit { bottom: 52px; }
  .panel { padding: 14px 16px; }
  .panel h2 { font-size: 28px; }
  .stack { margin: 10px 0; gap: 6px; }
  .stack button { font-size: 17px; }
  fieldset { gap: 6px; padding: 8px 10px; }
  .cols { gap: 10px; }
  .big h2 { font-size: 34px; padding: 4px 30px 6px; }
  .big p { font-size: 14px; }
  #loading { gap: 12px; }
  .board { grid-template-columns: auto 1fr; padding: 10px 14px; }
  .route { font-size: 40px; padding-right: 12px; }
  #loadLabel { font-size: 18px; }
}

/* journeys: a long list of regions scrolls inside the sheet on short screens */
#travelList { max-height: min(52vh, 420px); overflow-y: auto; }
.mapclose.maptravel { right: auto; left: max(14px, env(safe-area-inset-left)); background: var(--paper); }
/* End credits: the story's ending, then the roll of who made what */
.panel.roll { width: min(620px, 100%); }
.roll-head { margin: 22px 0 6px; font-family: var(--display); font-weight: 700; font-size: 24px; color: var(--saffron); }
.roll-list { margin: 0 0 18px; display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 15px; line-height: 1.45; }
.roll-list dt { font-weight: 700; opacity: 0.85; }
.roll-list dd { margin: 0; }
@media (max-width: 520px) { .roll-list { grid-template-columns: 1fr; gap: 2px; } .roll-list dd { margin-bottom: 8px; } }
#creditsStory[hidden] { display: none; }
