/* The Trackdown family look (https://trackdown.uk), so Wheelsdown reads as a sibling of Trackdown.
   index.html links this file, loads the fonts, then sets its own --accent / --accent-ink and --cols.
   Fonts: <link href="https://fonts.googleapis.com/css2?family=Archivo+Black&family=Syne:wght@700;800&family=Karla:ital,wght@0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
   Tile colours mean the same thing in every game: --hit = match, --near = close, --miss = no. Never use
   green or amber as a game's accent, or "close" tiles blur into the branding. */
:root {
  --bg: #141220;
  --surface: #1e1b2e;
  --fg: #f0edf8;
  --muted: #9a94b5;
  --line: #2f2b45;
  --accent: #ff5c8d;          /* Trackdown pink; each game overrides */
  --accent-ink: #1b1830;
  --hit: #36a86a;
  --hit-ink: #0e1a14;
  --near: #e3b341;
  --near-ink: #1b1830;
  --miss: #2a2740;
  --miss-ink: #b6b0cc;
  --font-body: 'Karla', ui-sans-serif, system-ui, sans-serif;
  --font-brand: 'Archivo Black', 'Arial Black', sans-serif;      /* the wordmark, same as the Trackdown link card */
  --font-display: 'Syne', ui-sans-serif, system-ui, sans-serif;   /* headings: 700 (Syne widens as it gets heavier) */
  --cols: 7;                  /* tiles per guess row */
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 0 16px 48px; background: var(--bg); color: var(--fg);
  font: 16px/1.5 var(--font-body);
}
main { max-width: 572px; margin: 0 auto; }
button {
  font: inherit; font-size: 14px; color: var(--fg); background: transparent; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
}
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { cursor: not-allowed; opacity: .45; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* Header: two-tone wordmark, puzzle line, stats. <h1>Track<span>down</span></h1> */
header { padding: 24px 0 12px; border-bottom: 2px solid var(--fg); margin-bottom: 16px; }
header .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 12px; margin-top: 6px; }
h1 { margin: 0; font: 400 clamp(38px, 9vw, 56px)/1 var(--font-brand); white-space: nowrap; letter-spacing: -0.04em; }
h1 span { color: var(--accent); }
.sub { margin: 0; font-size: 14px; color: var(--muted); }
.stats { display: flex; gap: 18px; text-align: center; }
.stats b { display: block; font: 700 22px/1 var(--font-display); }
.stats small { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Guess input and suggestion list */
.guess-box { position: relative; }
.guess-box input {
  width: 100%; font: inherit; font-size: 18px; color: var(--fg); background: var(--surface);
  border: 2px solid var(--line); border-radius: 10px; padding: 14px 16px;
}
.guess-box input::placeholder { color: var(--muted); }
.guess-box input:focus { outline: none; border-color: var(--accent); }
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin: 6px 0 0; padding: 6px;
  list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px rgb(0 0 0 / .45); max-height: 360px; overflow-y: auto;
}
.suggest li { display: flex; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; line-height: 1.3; }
.suggest li[aria-selected="true"] { background: var(--miss); }
.suggest li.note { cursor: default; color: var(--muted); font-size: 14px; }
.suggest small { color: var(--muted); }

/* Toolbar under the input: guess count (+ filter) and the More menu */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 12px 0 16px; font-size: 14px; }
.more { position: relative; }
.more summary { list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.more summary::-webkit-details-marker { display: none; }
.more .menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 4; min-width: 180px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgb(0 0 0 / .45);
}
.more .menu button { display: block; width: 100%; text-align: left; border: 0; border-radius: 6px; padding: 8px 10px; }
.more .menu button:hover:not(:disabled) { background: var(--miss); }

/* Result: "Got it in 4." / answer / facts / "Next ... in 6h 31m" / actions */
.result { margin-bottom: 20px; }
.result h2 { margin: 0 0 12px; font: 700 24px var(--font-display); letter-spacing: -.02em; }
.result p { margin: 0 0 10px; }
.result .next { font: 700 15px var(--font-display); }
.result .next span { color: var(--accent); font-family: var(--font-display); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.toast { font-size: 14px; }

/* Guess cards, newest first, each with a row of --cols tiles */
.cols, .tiles { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 4px; }
.cols { padding: 0 9px; margin-bottom: 6px; }
.cols span { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; }
.guesses { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.guesses li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.guesses li.win { border: 2px solid var(--hit); }
.guesses .title { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 15px; }
.guesses .title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guesses .title small { color: var(--muted); font: 700 12px var(--font-display); }
.tile {
  position: relative; min-width: 0; padding: 5px 2px; border-radius: 6px; text-align: center;
  font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--miss); color: var(--miss-ink);
}
.tile.hit { background: var(--hit); color: var(--hit-ink); font-weight: 500; }
.tile.near { background: var(--near); color: var(--near-ink); font-weight: 500; }
/* Corner triangles: the answer is higher (up) or lower (down). */
.tile.up::after, .tile.down::after { content: ""; position: absolute; right: 3px; border: 4px solid transparent; }
.tile.up::after { top: 2px; border-bottom-color: currentColor; border-top-width: 0; }
.tile.down::after { bottom: 2px; border-top-color: currentColor; border-bottom-width: 0; }

footer { margin-top: 32px; font-size: 13px; color: var(--muted); }
footer a { color: inherit; }

@media (max-width: 480px) {
  .stats { gap: 12px; }
  .tile { font-size: 11px; padding: 5px 1px; }
  .cols span { font-size: 8.5px; letter-spacing: .04em; }
}
