/* The shared chrome (top bar, buttons, dialogs, stats grid, week strip, toast) is in
   hub/game.css, linked before this file. This sets the tokens it uses and Waypoint's own pieces:
   the city card, the map and the results' trip map. */
:root {
  color-scheme: light dark;
  --bg: #eef4f1;
  --bg-2: #e2ece8;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-solid: #ffffff;
  --ink: #15292e;
  --muted: #4f656a;
  --line: rgba(21, 41, 46, 0.13);
  --accent: #1f7a8c; /* white button text on it is 5.0:1 */
  --accent-deep: #155a69;
  --accent-ink: #ffffff;
  --good: #2b9a60;
  --bad: #d64545;
  --shadow: rgba(20, 70, 80, 0.18);
  --sea: #b9dbe2;
  --sea-line: rgba(21, 90, 105, 0.16);
  --land: #f3ead2;
  --coast: #b39d6c;
  --pin: #ff8a1f;
  --pin-ink: #6b3300;
  --real: #155a69;
  --g: #2b9a60; --y: #e0b021; --o: #f08a24; --r: #d64545;
  --display: Fredoka, 'Arial Rounded MT Bold', system-ui, sans-serif;
  --text: Nunito, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1a1f;
    --bg-2: #13232a;
    --panel: rgba(30, 50, 58, 0.72);
    --panel-solid: #1a2c33;
    --ink: #e5f1f0;
    --muted: #9fb7ba;
    --line: rgba(229, 241, 240, 0.13);
    --accent: #5cc3d6;
    --accent-deep: #3aa6bb;
    --accent-ink: #062a31;
    --good: #5bd394;
    --bad: #ff7a72;
    --shadow: rgba(0, 0, 0, 0.45);
    --sea: #173944;
    --sea-line: rgba(160, 220, 230, 0.12);
    --land: #43554a;
    --coast: #7d9483;
    --pin: #ffa24a;
    --pin-ink: #3d1c00;
    --real: #bfeaf2;
    --g: #5bd394; --y: #f2cc4a; --o: #ffa24a; --r: #ff7a72;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font: 600 16px/1.4 var(--text);
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(180deg, var(--bg), var(--bg-2)) fixed;
}
button { -webkit-tap-highlight-color: transparent; }

.app {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------------------------------------------------------------- header */
.logo { margin: 0; font: 700 2.1rem/1 var(--display); color: var(--accent-deep); }
@media (prefers-color-scheme: dark) { .logo { color: var(--accent); } }
.day { margin: 4px 0 0; font-size: 0.78rem; color: var(--muted); }

/* ---------------------------------------------------------------- the city */
.play { display: flex; flex-direction: column; gap: 10px; }
.prompt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 14px 40px -26px var(--shadow);
}
.where { min-width: 0; }
.leg { margin: 0; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.city { margin: 2px 0 0; font: 700 1.75rem/1.1 var(--display); overflow-wrap: anywhere; }
.country { margin: 2px 0 0; color: var(--muted); font-size: 1rem; }
.legs { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; }
.legs li {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  border: 1.5px dashed var(--line); color: var(--muted); font: 600 0.82rem/1 var(--display); font-variant-numeric: tabular-nums;
}
.legs li.now { border: 2px solid var(--accent); color: var(--accent-deep); }
@media (prefers-color-scheme: dark) { .legs li.now { color: var(--accent); } }
.legs li.got { border: 0; color: #fff; }
.legs li.got.g-g { background: var(--g); }
.legs li.got.g-y { background: var(--y); color: #2a2000; }
.legs li.got.g-o { background: var(--o); color: #2a1300; }
.legs li.got.g-r { background: var(--r); }
@media (prefers-color-scheme: dark) { .legs li.got { color: #0b1a1e; } }

/* ---------------------------------------------------------------- the map */
.mapwrap { position: relative; }
.map {
  display: block; width: 100%; aspect-ratio: 2 / 1; max-height: 62vh; border-radius: 18px;
  border: 1px solid var(--line); box-shadow: 0 14px 40px -26px var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; background: var(--sea);
}
.map:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sea { fill: var(--sea); }
.grat { fill: none; stroke: var(--sea-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.land { fill: var(--land); stroke: var(--coast); stroke-width: 0.8; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.pin path { fill: var(--pin); stroke: var(--pin-ink); stroke-width: 1.6; }
.pin circle { fill: var(--pin-ink); }
.pin { cursor: grab; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3)); }
.pin.placed { cursor: default; }
.stop circle { fill: var(--real); stroke: #fff; stroke-width: 2; }
.stop.g-g circle { stroke: var(--g); stroke-width: 3; }
.stop.g-y circle { stroke: var(--y); stroke-width: 3; }
.stop.g-o circle { stroke: var(--o); stroke-width: 3; }
.stop.g-r circle { stroke: var(--r); stroke-width: 3; }
.stop text { fill: #fff; font: 700 10px/1 var(--display); text-anchor: middle; }
@media (prefers-color-scheme: dark) { .stop text { fill: #0b1a1e; } }
.guess circle { fill: var(--pin); stroke: var(--pin-ink); stroke-width: 1.5; }
.guess.faint { opacity: 0.6; }
.label { fill: var(--ink); font: 700 13px/1 var(--display); text-anchor: middle; paint-order: stroke; stroke: var(--panel-solid); stroke-width: 4px; stroke-linejoin: round; }
.miss { fill: none; stroke: var(--pin-ink); stroke-width: 2; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; opacity: 0.8; }
@media (prefers-color-scheme: dark) { .miss { stroke: var(--pin); } }
.route { fill: none; stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.route.real { stroke: var(--real); }
.route.mine { stroke: var(--pin); stroke-dasharray: 6 6; }

.zoom { display: flex; gap: 6px; }
.zbtn {
  min-width: 38px; height: 38px; padding: 0 8px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-solid); color: var(--ink); font: 700 1.2rem/1 var(--display); box-shadow: 0 4px 12px -6px var(--shadow);
}
.zbtn.wide { font-size: 0.78rem; }
.zbtn:active { transform: scale(0.95); }

.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hint { margin: 0; color: var(--muted); font-size: 0.95rem; min-height: 1.4em; flex: 1 1 160px; text-align: center; }
.hint b { color: var(--ink); }
#btnGo { min-width: 150px; }
#btnGo:disabled { opacity: 0.55; }

/* ---------------------------------------------------------------- buttons */
.btn.wide { margin-top: 16px; }

/* ---------------------------------------------------------------- dialogs and results */
.rules { padding-left: 1.2em; margin: 10px 0; }
.rules li { margin: 6px 0; }
.kicker { color: var(--muted); }
.res-score { font: 700 2.2rem/1.1 var(--display); }
.res-score small { font-size: 0.5em; color: var(--muted); }
.res-line { margin: 2px 0 10px; font-size: 1.05rem; }
.tripmap { display: block; width: 100%; aspect-ratio: 2 / 1; border-radius: 14px; border: 1px solid var(--line); background: var(--sea); }
.leglist { list-style: none; margin: 10px 0 4px; padding: 0; display: grid; gap: 4px; }
.leglist li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 3.2em; align-items: center; gap: 8px; font-size: 0.92rem; }
.leglist .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 0.75rem/1 var(--display); background: var(--real); }
.leglist .n.g-g { background: var(--g); } .leglist .n.g-y { background: var(--y); color: #2a2000; }
.leglist .n.g-o { background: var(--o); color: #2a1300; } .leglist .n.g-r { background: var(--r); }
.leglist .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.leglist .km { color: var(--muted); font-variant-numeric: tabular-nums; }
.leglist .pt { text-align: right; font: 700 1rem/1 var(--display); font-variant-numeric: tabular-nums; }
.wd.today i { outline: 2px dashed var(--accent); outline-offset: -2px; }
.wd.won i { background: var(--accent); color: var(--accent-ink); font-size: 0.7rem; }

.toast { z-index: 10; }

@media (max-width: 560px) {
  .map { aspect-ratio: 3 / 2; }
  .city { font-size: 1.5rem; }
  .legs li { width: 34px; height: 34px; border-radius: 10px; }
  /* The zoom buttons and the hint share a row, with the big button under them. */
  .actions { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; }
  .hint { text-align: right; font-size: 0.86rem; }
  #btnGo { grid-column: 1 / -1; width: 100%; }
}
@media (max-width: 380px) {
  .app { padding-left: 12px; padding-right: 12px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .legs { gap: 4px; }
  .legs li { width: 30px; height: 30px; font-size: 0.74rem; }
}
