/* Roam. Style: true-black flat (taste-skill app sheet, seed 759148992).
   Elevation by lightness alone: #000 ground, #111 cards, #2a2a2a nested.
   One data hue, road-paint yellow, only on map shading, the fit count and the clue ladder. */
:root {
  --ground: #000000;
  --surface: #111111;
  --raised: #2a2a2a;
  --rule: #1f1f1f;
  --control: #444444;
  --text: #ffffff;
  --muted: #b4b4b4;
  --faint: #949494;
  --accent: #f2c230;
  --accent-tint: #1f1a08;
  --positive: #3fc07a;
  --pill-positive-bg: #172a1d;
  --negative: #e5566f;
  --radius-card: 20px;
  --radius-inner: 14px;
  --gap: 14px;
  --pad: 22px;
  --rail: 392px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--text);
  font: 400 14px/20px var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 18px; }
[hidden] { display: none !important; }
button svg, .compass svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- top bar */
.bar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 var(--gap);
}
.wordmark { font-weight: 600; font-size: 16px; text-decoration: none; letter-spacing: -0.01em; }
.nav { display: flex; gap: 22px; }
.nav a { color: #bbbbbb; text-decoration: none; font-weight: 500; }
.nav a:hover, .nav a[aria-current] { color: #fff; }
.bar-info { margin-left: auto; color: var(--muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.bar-info .num { color: #fff; }
.bar-leave { margin-left: 18px; color: #bbbbbb; text-decoration: none; font-weight: 500; }
.bar-leave:hover { color: #fff; }

/* ---------------------------------------------------------------- controls */
.primary {
  height: 36px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-weight: 600;
  white-space: nowrap;
}
.primary:hover:not(:disabled) { background: #e6e6e6; }
.primary:active:not(:disabled) { transform: translateY(1px); }
.primary:disabled { background: var(--raised); color: #8a8a8a; }
.text-btn { background: none; border: 0; padding: 8px 2px; color: var(--muted); font-weight: 500; }
.text-btn:hover:not(:disabled) { color: #fff; }
.text-btn:disabled { color: #6b6b6b; }
.icon-btn {
  width: 32px; height: 32px; border: 0; border-radius: 999px;
  background: var(--raised); color: #fff; display: grid; place-items: center;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: #3a3a3a; }
.field {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--control);
  border-radius: 999px;
  background: var(--ground);
  color: #fff;
  min-width: 0;
}
.field::placeholder { color: var(--faint); }
.field:focus { outline: none; border-color: #fff; }
.chip, .seg-item > span, .seg > button {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: var(--raised);
  color: #fff;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  transition: background-color 0.12s;
}
.chip:hover, .seg-item:hover > span, .seg > button:hover { background: #3a3a3a; }
.chip[aria-pressed="true"], .seg-item input:checked + span, .seg > button[aria-selected="true"] { background: #fff; color: #000; }
.chip.more { background: transparent; box-shadow: inset 0 0 0 1px var(--control); color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-item { position: relative; cursor: pointer; }
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }
.seg-item.is-off { cursor: default; }
.seg-item.is-off > span { background: transparent; box-shadow: inset 0 0 0 1px #2a2a2a; color: #6b6b6b; }
.seg-count { margin-left: 7px; color: var(--faint); font-weight: 400; }
.seg-item input:checked + span .seg-count { color: #555; }
.switch {
  appearance: none;
  width: 40px; height: 24px; flex: none;
  border-radius: 999px;
  background: var(--control);
  position: relative;
  cursor: pointer;
  margin: 0;
  transition: background-color 0.15s;
}
.switch::before {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.switch:checked { background: #fff; }
.switch:checked::before { background: #000; transform: translateX(16px); }
.pill {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: 999px; font-size: 12px; font-weight: 500; vertical-align: 1px;
}
.pill-positive { background: var(--pill-positive-bg); color: var(--positive); }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border-radius: var(--radius-card); padding: var(--pad); }
.card h2 { font-size: 16px; line-height: 24px; font-weight: 600; }

/* ---------------------------------------------------------------- play */
.play {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail);
  gap: var(--gap);
  padding: 0 var(--gap) var(--gap);
  height: calc(100dvh - 48px);
}
.stage {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--surface);
  min-height: 0;
}
.viewer { position: absolute; inset: 0; overflow: hidden; touch-action: none; background: #0a0a0a; }
.vw-flat { position: absolute; left: 0; top: 0; max-width: none; user-select: none; cursor: grab; }
.vw-pano { position: absolute; inset: 0; width: 100%; height: 100%; display: none; cursor: grab; }
.vw.is-pano .vw-pano { display: block; }
.vw.is-pano .vw-flat { display: none; }
.vw.is-dragging .vw-flat, .vw.is-dragging .vw-pano { cursor: grabbing; }
.hud { position: absolute; z-index: 5; }
.hud-top { top: 14px; left: 14px; right: 14px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.compass, .hud-status {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px 0 10px;
  background: var(--surface); border-radius: 999px;
  font-weight: 500;
}
.compass svg { fill: #6b6b6b; stroke: none; transition: transform 0.08s linear; }
.compass .needle-n { fill: #fff; }
.hud-status { padding: 0 14px; color: var(--muted); }
.hud-status:empty { display: none; }
.hud-move { bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.hud-zoom { bottom: 14px; right: 14px; display: flex; flex-direction: column; gap: 8px; }
.round-btn {
  width: 44px; height: 44px; border: 0; border-radius: 999px;
  background: var(--surface); color: #fff; display: grid; place-items: center;
}
.round-btn:hover:not(:disabled) { background: var(--raised); }
.round-btn:active:not(:disabled) { transform: scale(0.96); }
.round-btn:disabled { color: #555; }
.stage-map { position: absolute; inset: 0; z-index: 8; display: none; }
.play.map-big .stage-map { display: block; }
.mapbox { width: 100%; height: 100%; background: #0b0b0b; }

.rail { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; }
.phone-tabs { display: none; }
.coachcard { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.mapcard { flex: none; display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.mapcard-head { display: flex; justify-content: space-between; align-items: center; padding-left: 6px; }
.mapslot { height: 290px; border-radius: var(--radius-inner); overflow: hidden; }
.play.map-big .mapslot { display: none; }
.mapcard-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-left: 6px; }
.mapcard-foot .primary { margin-left: auto; }

/* coach */
.coach-head {
  position: sticky;
  top: calc(var(--pad) * -1);
  z-index: 2;
  background: var(--surface);
  margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 0;
  padding: var(--pad) var(--pad) 14px;
}
.coach-title { display: flex; justify-content: space-between; align-items: center; }
.fit-none { color: var(--muted); margin-top: 6px; }
.fit-line { margin-top: 6px; color: var(--muted); }
.fit-n { color: var(--accent); font-size: 24px; line-height: 28px; font-weight: 600; margin-right: 2px; }
.fit-names { margin-top: 4px; color: #fff; }
.hints { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.hints li { background: var(--raised); border-radius: 12px; padding: 10px 12px; }
.groups { margin-top: 8px; display: flex; flex-direction: column; gap: 20px; }
.grp-title { font-weight: 600; display: block; }
.grp-hint { font-size: 12px; line-height: 18px; color: var(--faint); margin: 2px 0 9px; }
.grp-note { font-size: 12px; line-height: 18px; color: var(--muted); margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-extra { display: none; }
.grp.show-all .chip-extra { display: inline-flex; }
.grp .field { width: 120px; }

/* lesson */
.lesson-country { font-size: 20px !important; line-height: 28px !important; }
.lesson-score { margin-top: 4px; color: var(--muted); }
.lesson-score .score { color: #fff; font-size: 24px; line-height: 28px; font-weight: 600; }
.verdict { margin-top: 6px; }
.verdict.is-right { color: var(--positive); }
.verdict.is-wrong { color: #fff; }
.lesson h3, .card h3 { font-size: 14px; font-weight: 600; margin: 26px 0 8px; }
.tips li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.tips li:first-child { border-top: 0; padding-top: 4px; }
.tip-kind { color: var(--faint); font-size: 12px; line-height: 20px; }
.diff { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; line-height: 18px; }
.diff th, .diff td { text-align: left; vertical-align: top; padding: 8px 8px 8px 0; border-top: 1px solid var(--rule); font-weight: 400; }
.diff thead th { color: var(--faint); font-size: 12px; border-top: 0; padding-top: 0; }
.diff tbody th { color: var(--muted); width: 30%; }
.ladder li { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; padding: 7px 0; }
.ladder-n { font-weight: 600; }
.ladder-bar { grid-column: 1 / -1; height: 6px; background: var(--raised); border-radius: 3px; overflow: hidden; }
.ladder-fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.4s ease-out; }
.wrong li { padding: 8px 0; border-top: 1px solid var(--rule); }
.wrong li:first-child { border-top: 0; }
.credit { color: var(--faint); margin-top: 26px; }
.credit a { color: var(--muted); }

/* ---------------------------------------------------------------- home */
.home {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--gap);
  max-width: 1208px;
  margin: 0 auto;
  padding: 30px var(--gap) 48px;
  align-items: start;
}
.home h1, .page h1 { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.02em; }
.lede { font-size: 16px; line-height: 24px; color: var(--muted); max-width: 62ch; margin: 10px 0 24px; }
.modes { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.mode {
  display: grid; grid-template-columns: 22px 1fr; column-gap: 12px; row-gap: 2px;
  padding: 14px 16px; border-radius: var(--radius-inner); cursor: pointer;
}
.mode:hover { background: #1a1a1a; }
.mode:has(input:checked) { background: var(--raised); }
.mode input { grid-row: span 2; margin: 3px 0 0; accent-color: #fff; width: 16px; height: 16px; }
.mode-name { font-size: 15px; font-weight: 600; }
.mode-desc { color: var(--muted); font-size: 13px; line-height: 18px; }
.mode.is-off { cursor: default; }
.mode.is-off .mode-name { color: #8a8a8a; }
.opts { margin-top: var(--gap); display: flex; flex-direction: column; gap: 20px; }
.opt { display: flex; flex-direction: column; gap: 10px; }
.opt-row { flex-direction: row; justify-content: space-between; align-items: center; gap: 16px; cursor: pointer; }
div.opt-row { cursor: default; }
.opt-label { font-weight: 600; display: block; }
.opt-note { display: block; color: var(--muted); font-size: 13px; line-height: 18px; }
.home-go { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.home-go .primary { height: 44px; padding: 0 28px; font-size: 15px; }
.home-side { display: flex; flex-direction: column; gap: var(--gap); position: sticky; top: 14px; }
.shot { padding: 10px; }
.shot-img { aspect-ratio: 4 / 3; border-radius: var(--radius-inner); overflow: hidden; background: var(--raised); }
.shot-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot figcaption { padding: 10px 8px 4px; font-size: 13px; line-height: 18px; }
.mini h2 { margin-bottom: 14px; }
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.strip > div { padding: 0 16px; border-left: 1px solid var(--raised); }
.strip > div:first-child { padding-left: 0; border-left: 0; }
.strip dt { color: var(--muted); font-size: 12px; line-height: 18px; }
.strip dd { font-size: 24px; line-height: 30px; font-weight: 600; margin-top: 2px; }
.strip-v { grid-template-columns: 1fr; gap: 14px; }
.strip-v > div { padding: 0; border: 0; }
.mini-weak { margin-top: 16px; color: var(--muted); }
.mini-weak a { color: #fff; }

/* ---------------------------------------------------------------- pages */
.page {
  max-width: 1208px;
  margin: 0 auto;
  padding: 26px var(--gap) 48px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.title-row { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); flex-wrap: wrap; }
.page .lede { margin: -4px 0 4px; }
.search { width: 260px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: #fff; }
.counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.count {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  height: 61px; padding: 12px 14px; border: 0; border-radius: var(--radius-inner);
  background: var(--surface); text-align: left;
}
.count:hover { background: #1a1a1a; }
.count.is-on { background: var(--accent-tint); box-shadow: inset 0 0 0 1.5px var(--accent); }
.count-label { color: var(--muted); font-size: 13px; line-height: 18px; }
.count-n { font-size: 16px; font-weight: 600; }
.list { padding: 6px var(--pad); }
.row { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--rule); text-decoration: none; }
.row:first-child { border-top: 0; }
.row:hover .row-name { text-decoration: underline; text-underline-offset: 3px; }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-name { font-size: 15px; font-weight: 600; }
.row-meta { color: var(--muted); font-size: 13px; line-height: 18px; }
.row-tip { color: var(--faint); font-size: 13px; line-height: 18px; }
.row-side { color: var(--muted); font-size: 13px; white-space: nowrap; }
.empty { padding: 28px 0; color: var(--muted); }
.object { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); flex-wrap: wrap; }
.object h1 { font-size: 24px; line-height: 30px; }
.object-main p { margin-top: 4px; }
.object-act { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.country-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.country-grid h2 { margin-bottom: 12px; }
.pairs li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--rule); }
.pairs li:first-child { border-top: 0; padding-top: 0; }
.pairs a { font-weight: 600; }
.pairs span { color: var(--muted); }
.table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table th { color: var(--muted); font-size: 12px; font-weight: 500; text-align: left; padding: 6px 12px 8px 0; border-bottom: 1px solid var(--raised); }
.table td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--rule); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table a { text-decoration: none; font-weight: 500; }
.table a:hover { text-decoration: underline; }
.results-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.link-list { margin-top: 10px; }
.link-list li { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--rule); }
.link-list li:first-child { border-top: 0; }
.link-list a { font-weight: 500; }

/* ---------------------------------------------------------------- leaflet, dark */
.leaflet-container { background: #0b0b0b; font: 12px/1.4 var(--font); }
.leaflet-tile-pane .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.35); }
.leaflet-container img.leaflet-tile { mix-blend-mode: normal; }
.leaflet-control-attribution { background: rgba(0, 0, 0, 0.7) !important; color: var(--faint) !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar { border: 0 !important; border-radius: 999px !important; overflow: hidden; }
.leaflet-bar a { background: var(--surface) !important; color: #fff !important; border-bottom-color: var(--raised) !important; }
.leaflet-bar a:hover { background: var(--raised) !important; }
.mapbox, .leaflet-container { cursor: crosshair; }

/* ---------------------------------------------------------------- phone and tablet */
@media (max-width: 980px) {
  :root { --rail: 340px; }
  .home { grid-template-columns: 1fr; }
  .home-side { position: static; }
  .country-grid { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4 { grid-column: auto; }
  .results-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .bar { gap: 16px; padding: 0 16px; }
  .nav { gap: 14px; }
  .nav a { font-size: 13px; white-space: nowrap; }
  body.playing .nav { display: none; }
  .bar-info { font-size: 13px; }
  .bar-leave { margin-left: 12px; }
  .coach-head { position: static; }
  .play { grid-template-columns: 1fr; height: auto; padding-bottom: 16px; }
  .stage { height: 56vh; min-height: 300px; }
  .phone-tabs { display: flex; gap: 6px; }
  .phone-tabs button { flex: 1; justify-content: center; height: 40px; }
  .play[data-tab="clues"] .mapcard { display: none; }
  .play[data-tab="map"] .coachcard { display: none; }
  .play[data-phase="reveal"] .phone-tabs { display: none; }
  .play[data-phase="reveal"] .mapcard { display: flex; order: -1; }
  .coachcard { overflow: visible; }
  .mapslot { height: 52vh; }
  .hud-zoom { display: none; }
  .home, .page { padding-left: 16px; padding-right: 16px; }
  .home h1, .page h1 { font-size: 24px; line-height: 30px; }
  .counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { width: 100%; }
  .table th:nth-child(4), .table td:nth-child(4), .table th:nth-child(5), .table td:nth-child(5) { display: none; }
  .tips li { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
