/* BUS YATRA skin — v2.24.0. Landscape-first on phones (v2.15.0 was portrait;
   the brief now demands landscape). Theme system as before: dark by default,
   light when the OS is light or the Arqadex shell says daylight. */
:root {
  --bg: #050514; --ink: #ffffff; --muted: rgba(255, 255, 255, .6); --faint: rgba(255, 255, 255, .4);
  --card: rgba(255, 255, 255, .05); --line: rgba(255, 255, 255, .14); --line-soft: rgba(255, 255, 255, .08);
  --pink: #FF2DA6; --pink-soft: rgba(255, 45, 166, .12); --cyan: #00F5FF; --cyan-soft: rgba(0, 245, 255, .10);
  --gold: #FFB020; --gold-soft: rgba(255, 176, 32, .10); --green: #22c55e; --red: #dc2626;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #fafaf8; --ink: #17171c; --muted: rgba(23, 23, 28, .62); --faint: rgba(23, 23, 28, .42);
    --card: #ffffff; --line: rgba(23, 23, 28, .16); --line-soft: rgba(23, 23, 28, .08);
    --pink: #D6006E; --pink-soft: rgba(214, 0, 110, .08); --cyan: #00879C; --cyan-soft: rgba(0, 135, 156, .08);
    --gold: #8A5E00; --gold-soft: rgba(138, 94, 0, .08); --green: #15803d; --red: #dc2626; color-scheme: light; }
}
html[data-theme="light"] {
  --bg: #fafaf8; --ink: #17171c; --muted: rgba(23, 23, 28, .62); --faint: rgba(23, 23, 28, .42);
  --card: #ffffff; --line: rgba(23, 23, 28, .16); --line-soft: rgba(23, 23, 28, .08);
  --pink: #D6006E; --pink-soft: rgba(214, 0, 110, .08); --cyan: #00879C; --cyan-soft: rgba(0, 135, 156, .08);
  --gold: #8A5E00; --gold-soft: rgba(138, 94, 0, .08); --green: #15803d; --red: #dc2626; color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #050514; --ink: #ffffff; --muted: rgba(255, 255, 255, .6); --faint: rgba(255, 255, 255, .4);
  --card: rgba(255, 255, 255, .05); --line: rgba(255, 255, 255, .14); --line-soft: rgba(255, 255, 255, .08);
  --pink: #FF2DA6; --pink-soft: rgba(255, 45, 166, .12); --cyan: #00F5FF; --cyan-soft: rgba(0, 245, 255, .10);
  --gold: #FFB020; --gold-soft: rgba(255, 176, 32, .10); --green: #22c55e; --red: #dc2626; color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--ink); font-family: 'Space Mono', ui-monospace, monospace;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
#game-root { position: fixed; inset: 0; z-index: 0; }
#game-root canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.screen { position: fixed; inset: 0; z-index: 10; overflow-y: auto; background: var(--bg);
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px calc(32px + env(safe-area-inset-bottom, 0px)); }
.screen.hidden, .hidden { display: none !important; }
.screen > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.eyebrow { font-family: Orbitron, sans-serif; font-size: 11px; letter-spacing: .25em; color: var(--cyan); margin-bottom: 10px; text-align: center; }
h1 { font-family: Orbitron, sans-serif; font-weight: 900; font-size: clamp(44px, 10vw, 64px); line-height: .95; margin-bottom: 10px; text-align: center; }
h1 span { color: transparent; -webkit-text-stroke: 1.5px var(--gold); }
h2 { font-family: Orbitron, sans-serif; font-weight: 900; font-size: clamp(24px, 6vw, 32px); line-height: 1.1; margin-bottom: 10px; text-align: center; }
.tag { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 18px; text-align: center; }
.field-label { font-family: Orbitron, sans-serif; font-size: 11px; letter-spacing: .2em; color: var(--faint); margin: 16px 0 8px; }
.save-bar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; }
.save-bar span { background: var(--gold-soft); border: 1px solid var(--gold); color: var(--gold);
  border-radius: 20px; padding: 7px 13px; font-size: 12px; font-family: Orbitron, sans-serif; letter-spacing: .04em; }
.mode-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-btn { flex: 1; min-width: 100px; font-family: Orbitron, sans-serif; font-weight: 700; font-size: 11px; letter-spacing: .05em;
  padding: 12px 6px; border-radius: 12px; cursor: pointer; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); }
.mode-btn.selected { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.pick-list { display: flex; flex-direction: column; gap: 8px; }
.pick { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left;
  padding: 12px 14px; border-radius: 12px; cursor: pointer; background: var(--card);
  border: 1px solid var(--line); color: var(--ink); font-family: 'Space Mono', monospace; font-size: 13px; line-height: 1.4; }
.pick.selected { border-color: var(--pink); background: var(--pink-soft); }
.pick.locked { opacity: .65; }
.pick b { font-family: Orbitron, sans-serif; font-size: 13px; letter-spacing: .06em; display: block; }
.pick i { font-style: normal; color: var(--muted); font-size: 12px; }
.pick .pill { font-family: Orbitron, sans-serif; font-size: 10px; letter-spacing: .1em; color: var(--gold); white-space: nowrap; }
.pick .pill.lock { color: var(--faint); }
.hint { background: var(--cyan-soft); border: 1px solid var(--cyan); color: var(--cyan);
  padding: 12px; border-radius: 10px; font-size: 12px; margin-top: 16px; line-height: 1.6; }
.hint b { color: var(--gold); }
.btn-row { display: flex; gap: 10px; margin: 18px 0; }
/* v2.24.0: the lobby is long on a landscape phone (2064px in a 390px
   viewport) and ENTER THE CITY sat at the very bottom — users never
   reached it. Pin the CTA to the bottom of the visible lobby area. */
#screen-lobby .btn-row { position: sticky; bottom: 0; z-index: 5;
  background: var(--bg); padding: 12px 0 calc(8px + env(safe-area-inset-bottom, 0px)); margin-bottom: 0; }
/* v2.24.0: compact landscape lobby — two-column route/garage grids so the
   whole lobby is ~half as tall on short (landscape) screens. */
@media (max-height: 500px) {
  #screen-lobby h1 { font-size: 34px; }
  #screen-lobby .tag { margin-bottom: 10px; font-size: 12px; }
  #screen-lobby .field-label { margin: 10px 0 6px; }
  #screen-lobby .pick-list { display: grid; grid-template-columns: 1fr 1fr; }
  #screen-lobby .hint { margin-top: 10px; }
  #screen-lobby .save-bar { margin-bottom: 2px; }
}
.btn { font-family: Orbitron, sans-serif; font-weight: 700; letter-spacing: .1em; font-size: 14px;
  padding: 16px 20px; border-radius: 12px; cursor: pointer; border: 1px solid transparent;
  color: var(--ink); background: var(--card); transition: transform .15s ease; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--pink-soft); border-color: var(--pink); color: var(--pink); flex: 1; }
.btn.ghost { background: var(--cyan-soft); border-color: var(--cyan); color: var(--cyan); flex: 1; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.foot { font-size: 11px; line-height: 1.6; color: var(--faint); margin-top: 20px; text-align: center; }
#debug-log { display: none; margin-top: 20px; padding: 12px; border-radius: 10px;
  background: rgba(0,0,0,.6); border: 1px solid var(--gold);
  font-size: 11px; line-height: 1.5; color: var(--gold); max-height: 260px; overflow-y: auto; white-space: pre-wrap; }
#debug-log.on { display: block; }

/* Rotate overlay (landscape only on phones) */
#rotate-tip { align-self: center; pointer-events: auto; background: rgba(0,0,0,.75); color: #fff; font-size: 12px;
  padding: 8px 12px; border-radius: 20px; border: 1px solid rgba(255,255,255,.3); white-space: nowrap;
  max-width: 94vw; overflow: hidden; text-overflow: ellipsis; margin-top: 6px; }
#rotate-tip button { background: none; border: none; color: #fff; font-size: 13px; cursor: pointer; padding: 0 0 0 6px; }
.rotate-card p { color: var(--muted); font-size: 13px; line-height: 1.6; }

/* HUD */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 10px calc(8px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; justify-content: space-between; }
.hud-top { display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 130px); }
.hud-chip { background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.25); border-radius: 10px;
  padding: 6px 9px; color: #fff; font-size: 12px; backdrop-filter: blur(4px); }
.hud-chip .hud-label { display: block; font-family: Orbitron, sans-serif; font-size: 8px; letter-spacing: .2em; opacity: .7; }
.hud-chip b { font-family: Orbitron, sans-serif; font-size: 12px; }
.hud-right { position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); right: 10px; text-align: center; pointer-events: auto; }
#minimap { width: 110px; height: 110px; border-radius: 12px; border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px); }
#map-label { font-family: Orbitron, sans-serif; font-size: 8px; letter-spacing: .2em; color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.8); margin-top: 3px; }
.hud-mid { text-align: center; }
#hud-stop { font-family: Orbitron, sans-serif; font-size: 12px; letter-spacing: .12em; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
#hud-msg { font-size: 12px; color: var(--gold); text-shadow: 0 2px 8px rgba(0,0,0,.9); margin-top: 4px; min-height: 16px; }
.hud-radio, .hud-drive-row { display: flex; gap: 6px; justify-content: center; pointer-events: auto; flex-wrap: wrap; }
.hud-radio button, .hud-drive-row button { background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.3); color: #fff;
  border-radius: 20px; padding: 8px 12px; font-family: Orbitron, sans-serif; font-size: 11px; letter-spacing: .06em;
  cursor: pointer; backdrop-filter: blur(4px); }
.hud-radio button:active, .hud-drive-row button:active { transform: scale(.96); }
.hud-drive-row { margin-top: 6px; }
.hud-drive-row button.on { border-color: var(--gold); color: var(--gold); }
#btn-music.playing { border-color: var(--gold); color: var(--gold); animation: beat 0.6s ease-in-out infinite; }
@keyframes beat { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* Music player panel */
#music-panel { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  z-index: 8; width: min(420px, calc(100% - 24px)); background: rgba(10,10,26,.92);
  border: 1px solid var(--gold); border-radius: 16px; padding: 14px; backdrop-filter: blur(6px); }
.mp-title { font-family: Orbitron, sans-serif; font-size: 12px; letter-spacing: .08em; color: var(--gold); margin-bottom: 8px; }
.mp-progress { height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; margin-bottom: 10px; }
#mp-bar { height: 100%; width: 0%; background: var(--gold); }
.mp-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.mp-controls button { flex: 0 0 44px; height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.08); color: #fff; font-size: 16px; cursor: pointer; }
.mp-controls label { font-family: Orbitron, sans-serif; font-size: 10px; letter-spacing: .1em; color: #fff;
  display: flex; align-items: center; gap: 6px; flex: 1; }
.mp-controls input { flex: 1; accent-color: var(--gold); }
.mp-list { display: flex; flex-direction: column; gap: 4px; }
.mp-item { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 12px; color: rgba(255,255,255,.8); }
.mp-item.sel { background: var(--gold-soft); color: var(--gold); }

/* Walk joystick — Swordigo-style: big, chunky, unmissable */
#joystick { position: absolute; left: 18px; bottom: 96px; z-index: 6; text-align: center; pointer-events: auto; }
#joy-base { width: 140px; height: 140px; border-radius: 28px; background: rgba(120,20,20,.45);
  border: 3px solid rgba(255,255,255,.7); position: relative; touch-action: none; backdrop-filter: blur(4px);
  box-shadow: 0 6px 18px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.25); }
#joy-nub { width: 60px; height: 60px; border-radius: 50%; background: var(--pink);
  border: 3px solid rgba(255,255,255,.85);
  position: absolute; left: 37px; top: 37px; box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.joy-label { font-family: Orbitron, sans-serif; font-size: 10px; letter-spacing: .2em; color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.8); margin-top: 6px; }
/* First-walk hint: big, unmissable, sits above the joystick until you move */
#walk-hint { position: absolute; left: 18px; bottom: 268px; z-index: 7;
  background: var(--pink); color: #fff; font-family: Orbitron, sans-serif; font-weight: 700; font-size: 13px;
  letter-spacing: .05em; padding: 10px 14px; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.5);
  animation: hint-bob 1s ease-in-out infinite; pointer-events: none; max-width: 240px; }
/* D-pad: Swordigo-style — big chunky translucent-red keys with a thick light
   border and a large white arrow. Hold to walk; release to stop. */
#dpad { position: absolute; right: 18px; bottom: 96px; z-index: 6; pointer-events: auto;
  display: grid; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(3, 64px); gap: 6px; }
#dpad button { background: rgba(120,20,20,.55); border: 3px solid rgba(255,255,255,.7); color: #fff;
  border-radius: 16px; font-size: 28px; cursor: pointer; touch-action: none; backdrop-filter: blur(4px);
  box-shadow: 0 6px 18px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.25); }
#dpad button:active, #dpad button.held { background: rgba(200,30,30,.8); transform: scale(.92); }
#dp-up { grid-column: 2; grid-row: 1; }
#dp-left { grid-column: 1; grid-row: 2; }
#dp-down { grid-column: 2; grid-row: 3; }
#dp-right { grid-column: 3; grid-row: 2; }
@keyframes hint-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
/* Pulsing ring on the joystick nub until the player first walks */
#joystick.hint-pulse #joy-nub { animation: nub-pulse 1s ease-in-out infinite; }
@keyframes nub-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(225,6,0,.7), 0 4px 14px rgba(0,0,0,.5); }
  50% { box-shadow: 0 0 0 16px rgba(225,6,0,0), 0 4px 14px rgba(0,0,0,.5); } }

/* Drive controls — Swordigo-style chunky keys */
#drive-controls { position: fixed; left: 0; right: 0; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 6;
  display: flex; justify-content: space-between; align-items: flex-end; padding: 0 16px; pointer-events: none; }
#wheel-wrap { text-align: center; pointer-events: auto; }
#wheel { width: 130px; height: 130px; border-radius: 32px; background: rgba(120,20,20,.5);
  border: 3px solid rgba(255,255,255,.7); color: #fff; font-size: 44px; line-height: 124px; text-align: center;
  touch-action: none; backdrop-filter: blur(4px); transition: transform .08s linear;
  box-shadow: 0 6px 18px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.25); }
.wheel-label { font-family: Orbitron, sans-serif; font-size: 9px; letter-spacing: .18em; color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.8); margin-top: 6px; }
.pedals { display: flex; gap: 12px; pointer-events: auto; }
.pedals button { width: 80px; height: 80px; border-radius: 20px; border: 3px solid rgba(255,255,255,.7);
  background: rgba(120,20,20,.55); color: #fff; font-family: Orbitron, sans-serif; font-size: 13px; font-weight: 700;
  cursor: pointer; backdrop-filter: blur(4px); touch-action: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.25); }
.pedals button.held { background: rgba(200,30,30,.8); border-color: #fff; transform: scale(.94); }
#btn-gas { border-color: var(--green) !important; }
#btn-brake { border-color: var(--red) !important; }
#btn-rev { border-color: var(--cyan) !important; }

/* Passenger */
#touch-passenger { position: fixed; left: 0; right: 0; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 6;
  display: flex; gap: 10px; justify-content: center; padding: 0 14px; }
#touch-passenger button { background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.4); color: #fff;
  border-radius: 24px; padding: 13px 18px; font-family: Orbitron, sans-serif; font-size: 12px; letter-spacing: .06em;
  cursor: pointer; backdrop-filter: blur(4px); }

/* Prompt cards (bus / ticket / seat) — big and unmissable, Swordigo-style */
#bus-prompt, #ticket-panel, #seat-panel { position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(200px + env(safe-area-inset-bottom, 0px)); z-index: 9;
  width: min(460px, calc(100% - 24px)); pointer-events: none; display: flex; justify-content: center; }
.prompt-card { pointer-events: auto; width: 100%; background: rgba(10,10,26,.92);
  border: 2px solid var(--gold); border-radius: 20px; padding: 20px; text-align: center; backdrop-filter: blur(6px);
  box-shadow: 0 10px 32px rgba(0,0,0,.6); }
.prompt-bus { font-family: Orbitron, sans-serif; font-weight: 900; font-size: 24px; letter-spacing: .08em; color: var(--gold); }
.prompt-sub { font-size: 13px; color: rgba(255,255,255,.8); margin: 6px 0 14px; }
.prompt-btns { display: flex; gap: 12px; }
.prompt-btns .btn { flex: 1; padding: 18px 10px; font-size: 16px; font-weight: 700; border-radius: 16px;
  border: 3px solid rgba(255,255,255,.7); box-shadow: 0 6px 18px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.25); }
.prompt-btns .btn.primary { background: linear-gradient(180deg, #b45309, #78350f); color: #fff; }
.prompt-btns .btn.ghost { background: rgba(255,255,255,.12); color: #fff; }
.prompt-btns .btn:active { transform: scale(.95); }
.prompt-note { font-size: 11px; line-height: 1.5; color: rgba(255,255,255,.55); margin-top: 10px; }
#seat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.seat { padding: 12px 4px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.06);
  color: #fff; font-family: Orbitron, sans-serif; font-size: 11px; cursor: pointer; }
.seat.sel { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }
.seat small { display: block; font-size: 9px; opacity: .7; margin-top: 2px; }

.scoreboard { display: flex; flex-direction: column; gap: 8px; margin: 18px 0; }
.scoreboard .row { display: flex; justify-content: space-between; background: var(--card);
  border: 1px solid var(--line-soft); border-radius: 10px; padding: 11px 14px; font-size: 14px; }
.scoreboard .row b { color: var(--gold); font-family: Orbitron, sans-serif; }

/* Landscape phones: tighten the HUD so controls never overlap */
@media (orientation: landscape) and (max-height: 500px) {
  #minimap { width: 84px; height: 84px; }
  #joy-base { width: 120px; height: 120px; }
  #joy-nub { width: 52px; height: 52px; left: 31px; top: 31px; }
  #dpad { grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(3, 56px); bottom: 64px; }
  #dpad button { font-size: 24px; }
  #walk-hint { bottom: 240px; }
  #wheel { width: 112px; height: 112px; line-height: 106px; font-size: 36px; }
  .pedals button { width: 68px; height: 68px; }
  #bus-prompt, #ticket-panel, #seat-panel { bottom: calc(138px + env(safe-area-inset-bottom, 0px)); }
  .prompt-card { padding: 12px; }
  .prompt-bus { font-size: 20px; }
  .prompt-sub { margin: 4px 0 10px; }
  .prompt-btns .btn { padding: 15px 10px; font-size: 15px; }
  .prompt-note { margin-top: 8px; }
  #music-panel { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

/* YouTube hook player: small, top-right under the minimap, visible while a
   YouTube station plays. */
#yt-box { position: fixed; top: calc(128px + env(safe-area-inset-top, 0px)); right: 10px; width: 180px; z-index: 4;
  background: rgba(0,0,0,.65); border: 1px solid rgba(255,255,255,.3); border-radius: 12px; overflow: hidden;
  backdrop-filter: blur(4px); }
#yt-player { width: 180px; height: 101px; }
#yt-player iframe { width: 100%; height: 100%; border: 0; }
#yt-title { font-size: 10px; color: #fff; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Tall screens (portrait phones): lift the walk hint above the objective text */
@media (min-height: 600px) {
  #walk-hint { bottom: 310px; }
}
