/* =====================================================================
   Taxi — fixed "cab yellow" theme.
   Same page frame as Ambulance / Flappy / Timberman (full-height app shell,
   frosted top bar, chunky arcade buttons, hard-shadow stage, card overlays,
   colored rules modal) but with this game's own palette taken straight from
   its 3D scene: checker-cab yellow, ink black, asphalt grey, money green,
   fuel amber, sky blue. The stage is a 16:9 landscape board because this is
   a driving game. Deliberately ignores the center's light/dark mode; no
   glass.css loaded. The c-* chrome lives HERE on purpose — it is not
   inherited from the shared stylesheets.
   ===================================================================== */
:root {
  --tx-sky:     #9fd0ec;   /* page gradient top */
  --tx-sky2:    #cbe6f5;   /* page gradient middle */
  --tx-haze:    #f4efdf;   /* page gradient bottom */
  --tx-yellow:  #f7c31c;   /* cab livery / primary */
  --tx-yelldk:  #b6820f;
  --tx-ink:     #241f14;   /* outline ink — main text colour */
  --tx-asphalt: #4a5463;
  --tx-green:   #2f9e57;   /* destination / money */
  --tx-greendk: #14603a;
  --tx-amber:   #f0952b;   /* fuel warning */
  --tx-red:     #e2483d;   /* empty tank */
  --tx-line:    rgba(36, 31, 20, .82);
  --tx-cream:   #fffdf3;
}

html, body { height: 100%; }
body.tx-page {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, var(--tx-sky) 0%, var(--tx-sky2) 52%, var(--tx-haze) 100%);
  color: var(--tx-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body.tx-page *,
body.tx-page *::before,
body.tx-page *::after { box-sizing: border-box; }

/* ---------- App frame ---------- */
.c-app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar ---------- */
.c-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px 18px;
  flex-wrap: wrap;
  padding: 12px clamp(12px, 3vw, 28px);
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(255, 255, 255, .42);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--tx-yellow);
  z-index: 20;
}
.c-bar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.c-bar__brand svg { filter: drop-shadow(0 2px 0 rgba(36, 31, 20, .18)); }
.c-bar__title {
  margin: 0;
  font-size: clamp(19px, 3.4vw, 26px);
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--tx-ink);
  text-shadow: 2px 2px 0 rgba(255, 255, 255, .55);
}
.c-bar__stats { display: flex; align-items: center; gap: 8px 18px; margin-left: auto; }
.c-bar__controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stat { font-size: 14px; font-weight: 700; letter-spacing: .03em; white-space: nowrap; color: rgba(36, 31, 20, .72); }
.stat b { color: var(--tx-greendk); font-size: 16px; }
/* The cash stat is the headline number — give it the money green. */
.c-bar__stats .stat:first-child b { color: var(--tx-green); }

/* ---------- Buttons (chunky arcade style, matches the shared frame) ------ */
.c-btn {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-block;
  padding: 9px 16px;
  border-radius: 12px;
  border: 2px solid var(--tx-line);
  background: #fff;
  color: var(--tx-ink);
  box-shadow: 0 3px 0 rgba(36, 31, 20, .35);
  transition: transform .06s ease, background .15s ease, box-shadow .15s ease;
}
.c-btn:hover { background: #fff3cf; border-color: var(--tx-yellow); }
.c-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(36, 31, 20, .35); }
.c-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(247, 195, 28, .6); }
/* Primary = checker-cab yellow with ink text. */
.c-btn--primary {
  background: linear-gradient(140deg, #ffd943, var(--tx-yellow));
  border-color: var(--tx-line);
  color: var(--tx-ink);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, .35);
}
.c-btn--primary:hover { background: linear-gradient(140deg, #ffe15f, var(--tx-yellow)); }

/* ---------- Table / stage column ---------- */
.c-table {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2.4vh, 22px);
}
.tx-board {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* 16:9 landscape; capped by both viewport width and remaining height. */
  width: min(96vw, calc((100vh - 210px) * 1.7778), 1040px);
  width: min(96vw, calc((100dvh - 210px) * 1.7778), 1040px);
}
.tx-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(#cbe6f5, #e7e2cf);
  border: 3px solid var(--tx-line);
  box-shadow: 0 10px 0 rgba(36, 31, 20, .22), 0 22px 48px rgba(36, 31, 20, .35);
  touch-action: manipulation;
}
#scene {
  display: block;
  width: 100%; height: 100%;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}

/* ---------- Fuel gauge (replaces the ambulance's shift clock) ---------- */
.fuelbar {
  position: relative;
  flex: none;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .6);
  border: 2px solid var(--tx-line);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(36, 31, 20, .18);
}
.fuelbar__fill {
  height: 100%; width: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, #58d07f, var(--tx-green));
  transition: width .12s linear, background-color .3s ease;
}
.fuelbar__fill.warn { background: linear-gradient(180deg, #ffc45a, var(--tx-amber)); }
.fuelbar__fill.low  { background: linear-gradient(180deg, #ff7a6d, var(--tx-red)); }
.fuelbar__label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; letter-spacing: .04em;
  color: var(--tx-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .6);
  pointer-events: none;
}
/* Pumping animation: the gauge stripes while fuel goes in. */
.fuelbar.pumping::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg,
    rgba(255, 255, 255, .5) 0 10px, rgba(255, 255, 255, 0) 10px 20px);
  animation: txPump .55s linear infinite;
  pointer-events: none;
}
@keyframes txPump { to { background-position: 28px 0; } }
/* Gauge shakes + flashes when a collision costs you cash. */
.fuelbar.hit { animation: txHit .4s ease; }
@keyframes txHit {
  0%, 100% { box-shadow: inset 0 1px 3px rgba(36, 31, 20, .18); }
  20%, 60% { box-shadow: 0 0 0 3px rgba(226, 72, 61, .8), inset 0 1px 3px rgba(36, 31, 20, .18); }
  30%, 70% { transform: translateX(-4px); }
  50%      { transform: translateX(4px); }
}

/* ---------- HUD overlay (objective + compass + ticket) ---------- */
.tx-hud { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.tx-hud[hidden] { display: none; }
.tx-objective {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(36, 31, 20, .72);
  color: #fff;
  font-size: 14px; font-weight: 800; letter-spacing: .03em;
  text-transform: uppercase;
  border: 2px solid rgba(255, 255, 255, .5);
  box-shadow: 0 4px 12px rgba(36, 31, 20, .35);
  white-space: nowrap;
}
.tx-objective.pick { background: rgba(182, 130, 15, .9); }   /* cab yellow */
.tx-objective.drop { background: rgba(20, 96, 58, .9); }     /* destination green */
.tx-objective.fuel { background: rgba(160, 40, 32, .9); }    /* low-fuel red */

/* Frameless 3D navigation readout pinned to the top-centre of the stage: a
   perspective-tilted extruded arrow (JS yaws #arrow) over an extruded
   distance number. No dial box / backdrop — it floats on the scene. */
.tx-nav {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0;
  perspective: 420px;
}
.tx-arrow3d {
  width: 66px; height: 66px;
  transform: rotateX(30deg);
  transform-style: preserve-3d;
  filter: drop-shadow(0 8px 7px rgba(36, 31, 20, .45));
}
.tx-arrow {
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .09s linear;
}
.tx-arrow svg { width: 100%; height: 100%; display: block; overflow: visible; }
.tx-arrow__face { fill: var(--tx-yellow); stroke: #7d5a06; stroke-width: 1.3; stroke-linejoin: round; }
/* Underside offset down-right behind the face fakes solid thickness. */
.tx-arrow__side { fill: #c8930f; stroke: none; transform: translate(1.8px, 3.4px); }
.tx-arrow.drop .tx-arrow__face { fill: #4fdc85; stroke: var(--tx-greendk); }
.tx-arrow.drop .tx-arrow__side { fill: var(--tx-greendk); }
.tx-arrow.fuel .tx-arrow__face { fill: #ff8b7d; stroke: #7d1a12; }
.tx-arrow.fuel .tx-arrow__side { fill: #8f2418; }
.tx-dist {
  font-size: 23px; font-weight: 800; letter-spacing: .03em;
  color: #fff;
  text-shadow:
    0 1px 0 #6c5410, 0 2px 0 #55420c, 0 3px 0 #40320a,
    0 4px 0 #2b2207, 0 6px 8px rgba(0, 0, 0, .45);
}

/* ---------- Live fare ticket (top-right) ---------- */
.tx-ticket {
  position: absolute; top: 10px; right: 12px;
  width: 172px;
  padding: 9px 11px 10px;
  border-radius: 12px;
  background: linear-gradient(160deg, #fffdf3, #f6ecd0);
  border: 2px solid var(--tx-line);
  box-shadow: 0 5px 0 rgba(36, 31, 20, .25), 0 12px 26px rgba(36, 31, 20, .3);
  /* Perforated receipt edge along the top. */
  background-image:
    radial-gradient(circle at 6px 0, rgba(36, 31, 20, .0) 3.4px, transparent 3.6px),
    linear-gradient(160deg, #fffdf3, #f6ecd0);
  animation: txTicket .22s ease;
}
.tx-ticket[hidden] { display: none; }
@keyframes txTicket { from { transform: translateY(-8px); opacity: 0; } }
.tx-ticket__tag {
  display: inline-block;
  font-size: 9.5px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase;
  color: #fff;
  background: var(--tx-ink);
  padding: 2px 7px;
  border-radius: 5px;
}
.tx-ticket__dest {
  margin: 5px 0 6px;
  font-size: 14px; font-weight: 800; letter-spacing: .01em;
  color: var(--tx-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx-ticket__bar {
  height: 9px;
  border-radius: 999px;
  background: rgba(36, 31, 20, .16);
  border: 1.5px solid var(--tx-line);
  overflow: hidden;
}
.tx-ticket__bar span {
  display: block; height: 100%; width: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd943, var(--tx-yellow));
  transition: width .1s linear, background-color .25s ease;
}
.tx-ticket__bar span.half { background: linear-gradient(180deg, #ffc45a, var(--tx-amber)); }
.tx-ticket__bar span.out { background: linear-gradient(180deg, #ff7a6d, var(--tx-red)); }
.tx-ticket__pay {
  margin-top: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  color: rgba(36, 31, 20, .72);
  white-space: nowrap;
}
.tx-ticket__pay b { color: var(--tx-green); font-size: 13px; }
.tx-ticket__tip { color: var(--tx-yelldk); font-weight: 800; }

/* ---------- Toast (fares paid, penalties, refuelling) ---------- */
.tx-toast {
  position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(20, 96, 58, .93);
  color: #fff;
  font-size: 15px; font-weight: 800; letter-spacing: .03em;
  border: 2px solid rgba(255, 255, 255, .6);
  box-shadow: 0 6px 16px rgba(36, 31, 20, .4);
  white-space: nowrap;
  pointer-events: none;
}
.tx-toast[hidden] { display: none; }
.tx-toast.bad { background: rgba(160, 40, 32, .93); }
.tx-toast.show { animation: txToast 1.2s ease forwards; }
@keyframes txToast {
  0%   { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.9); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(1); }
}

/* ---------- Caption under the stage ---------- */
.tx-caption {
  flex: none;
  margin: 0;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.9;
  color: rgba(36, 31, 20, .72);
}
.tx-card kbd, .c-modal kbd, .tx-caption kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin: 0 1px;
  font: 700 12px/1.5 ui-monospace, "Segoe UI", monospace;
  text-align: center;
  color: var(--tx-ink);
  background: #fff;
  border: 1px solid var(--tx-line);
  border-radius: 6px;
  box-shadow: 0 2px 0 rgba(36, 31, 20, .3);
}

/* ---------- Ready / game-over overlays ---------- */
.tx-overlay {
  touch-action: manipulation;
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(36, 31, 20, .36);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.tx-overlay[hidden] { display: none; }
.tx-card {
  touch-action: manipulation;
  max-width: 340px;
  text-align: center;
  padding: 22px 24px 20px;
  border-radius: 16px;
  background: linear-gradient(160deg, #ffffff, var(--tx-cream));
  border: 2px solid var(--tx-line);
  box-shadow: 0 8px 0 rgba(36, 31, 20, .25), 0 22px 50px rgba(36, 31, 20, .4);
  color: var(--tx-ink);
  animation: txPop .3s ease;
}
@keyframes txPop { from { transform: scale(.88); opacity: 0; } }
.tx-card__big { font-size: 42px; line-height: 1.1; }
.tx-card__big svg { display: block; margin: 0 auto; }
.tx-card h2 {
  margin: 6px 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--tx-ink);
  text-shadow: 2px 2px 0 rgba(255, 255, 255, .5);
}
.tx-card p { margin: 0 0 14px; color: #4a5463; font-size: 13.5px; line-height: 1.55; }
.tx-card p b { color: var(--tx-greendk); }
.tx-card .c-btn { font-size: 14px; }

/* ---------- Rules modal ---------- */
.c-modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; padding: 16px;
  overflow-y: auto;            /* the overlay itself scrolls; the card never has an inner scrollbar */
  overscroll-behavior: contain;
}
.c-modal[hidden] { display: none; }
.c-modal__backdrop {
  position: fixed; inset: 0;   /* stays put while the overlay scrolls */
  background: rgba(36, 31, 20, .5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
/* Panel is "inside the cab": deep cream with yellow trim + ink.
   margin:auto centres it and — unlike align-items:center — lets a too-tall card
   scroll into view from the top instead of clipping. */
.c-modal__panel {
  position: relative; z-index: 1;
  margin: auto;
  width: min(92vw, 490px);
  background: linear-gradient(160deg, #ffffff, #f3ead6);
  color: var(--tx-ink);
  border-radius: 16px;
  border: 2px solid var(--tx-line);
  box-shadow: 0 8px 0 rgba(36, 31, 20, .3), 0 24px 60px rgba(36, 31, 20, .55);
}
.c-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 2px solid var(--tx-ink);
  background: linear-gradient(140deg, #ffd943, var(--tx-yellow));
  border-radius: 14px 14px 0 0;
}
.c-modal__head h2 {
  margin: 0; font-size: 18px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--tx-ink);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, .4);
}
.c-modal__x {
  appearance: none; border: 0; background: none;
  color: var(--tx-ink); font-size: 26px; line-height: 1;
  cursor: pointer; padding: 0 4px;
}
.c-modal__x:hover { color: var(--tx-yelldk); }
.c-modal__body { padding: 8px 20px 4px; font-size: 14px; line-height: 1.55; }
.c-modal__body h3 {
  margin: 16px 0 6px; font-size: 13px;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--tx-yelldk);
}
.c-modal__body ul { margin: 0; padding-left: 20px; }
.c-modal__body li { margin: 4px 0; }
.c-modal__body b { color: var(--tx-greendk); }
.c-modal__lead { margin: 12px 0; }
.c-modal__note {
  margin: 14px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(74, 84, 99, .1);
  border: 1px solid rgba(74, 84, 99, .28);
  font-size: 13px;
  color: #3d4757;
}
.c-modal__foot { display: flex; justify-content: flex-end; padding: 12px 20px 16px; }
.c-modal .c-btn--primary { border-color: var(--tx-line); }

/* ---------- Responsive ---------- */
@media (max-width: 700px), (max-height: 620px) {
  .c-bar { gap: 5px 12px; padding: 7px clamp(10px, 3vw, 18px); padding-top: max(7px, env(safe-area-inset-top)); }
  .c-bar__brand { gap: 8px; }
  .c-bar__title { font-size: 16px; }
  .c-bar__stats { gap: 4px 12px; margin-left: auto; }
  .stat { font-size: 12px; }
  .stat b { font-size: 13px; }
  .c-btn { padding: 8px 10px; font-size: 12px; }
  .c-bar__controls { gap: 6px; }
  .c-bar__controls .c-btn { padding: 9px 10px; white-space: nowrap; }
  .tx-board { width: min(97vw, calc((100vh - 185px) * 1.7778), 1040px); width: min(97vw, calc((100dvh - 185px) * 1.7778), 1040px); }
  .tx-ticket { width: 140px; padding: 7px 9px 8px; }
  .tx-ticket__dest { font-size: 12.5px; }
}
@media (max-width: 700px) {
  .c-bar__controls { flex: 1 1 100%; flex-wrap: nowrap; }
  .c-bar__controls .c-btn { flex: 1 1 auto; min-width: 0; padding: 9px 6px; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 420px) {
  .tx-objective { font-size: 11.5px; padding: 5px 11px; }
  .tx-arrow3d { width: 52px; height: 52px; }
  .tx-dist { font-size: 19px; }
  .tx-ticket { width: 124px; }
}

@media (prefers-reduced-motion: reduce) {
  .c-btn, .tx-card, .tx-arrow, .fuelbar__fill, .tx-ticket, .fuelbar.pumping::after {
    transition: none; animation: none;
  }
}
