/*
 * style.css: the whole look of What Did It Cost?
 *
 * WHAT: colors, type, layout and every component (item card, price-gun year
 *       label, radio line, guess box, answer "receipt", share row, ad box).
 * WHY:  one file so the design stays consistent and easy to change.
 * Design idea: one centered column like a store shelf; the item sits on a
 * price-gun label, the year stamped large, the answer printed like a receipt.
 * NOTE: fonts are self-hosted (fonts.css), never loaded from Google.
 * Light and dark mode follow the visitor's device setting.
 */

/* ---------- Colors and fonts (change the look here) ---------- */
:root {
  --bg: #eceee6;          /* shelf grey-green */
  --surface: #fbfbf7;     /* receipt paper */
  --ink: #1c2320;
  --muted: #5d6762;
  --line: #d3d8cd;
  --accent: #e2580b;      /* price-gun label orange */
  --accent-ink: #ffffff;
  --good: #2b8a5e;
  --near: #c99a06;
  --bad: #c0392b;
  --font-display: "Archivo Black", "Arial Black", Impact, sans-serif;
  --font-body: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131714; --surface: #1d221f; --ink: #e8ebe3; --muted: #9aa49e; --line: #333b36;
    --accent: #ff7a2e; --accent-ink: #1a0d04; --good: #49b985; --near: #e2b52a; --bad: #e5675a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131714; --surface: #1d221f; --ink: #e8ebe3; --muted: #9aa49e; --line: #333b36;
  --accent: #ff7a2e; --accent-ink: #1a0d04; --good: #49b985; --near: #e2b52a; --bad: #e5675a;
  color-scheme: dark;
}
/* ---------- Page frame and components ---------- */
* { box-sizing: border-box; }
body { margin: 0; -webkit-text-size-adjust: 100%; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5; }
.wrap { max-width: 520px; margin: 0 auto; padding-inline: 16px; padding-block: 20px 40px; display: flex; flex-direction: column; gap: 16px; }
header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
h1 { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.1; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
.score { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.score b { color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.item { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; }
.pic { width: 96px; height: 96px; border-radius: 12px; background: var(--bg); display: grid; place-items: center; font-size: 56px; line-height: 1; }
.item-text { min-width: 0; }
.eyebrow { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0; }
.item-name { font-weight: 600; font-size: 1.15rem; margin: 2px 0 0; text-wrap: balance; }
.year-tag { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-display); font-size: 1.9rem; padding: 2px 14px 2px 10px; border-radius: 4px 10px 10px 4px; position: relative; }
.year-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); }

.radio { display: flex; align-items: center; gap: 12px; border-top: 1px dashed var(--line); padding-top: 14px; }
.radio-icon { font-size: 22px; }
.radio-text { min-width: 0; flex: 1; font-size: 0.9rem; }
.radio-text strong { display: block; overflow-wrap: anywhere; }
.radio a { color: var(--good); font-weight: 600; text-decoration: none; white-space: nowrap; font-size: 0.85rem; border: 1px solid currentColor; padding: 4px 10px; border-radius: 999px; }
.radio a:hover, .radio a:focus-visible { background: var(--good); color: var(--surface); }

form { display: flex; gap: 10px; }
.money { flex: 1; min-width: 0; display: flex; align-items: center; border: 2px solid var(--ink); border-radius: 10px; background: var(--surface); }
.money span { font-family: var(--font-mono); font-weight: 700; padding-left: 12px; color: var(--muted); }
.money input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; padding: 10px 12px 10px 4px; outline: none; }
.money:focus-within { border-color: var(--accent); }
.money input:focus-visible { outline: none; }
button { font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; border: 2px solid var(--ink); background: var(--ink); color: var(--bg); padding: 10px 18px; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button.secondary { background: transparent; color: var(--ink); }

.tries { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--muted); }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); }
.dot.used { background: var(--bad); border-color: var(--bad); }
.dot.won { background: var(--good); border-color: var(--good); }
.hints { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-family: var(--font-mono); font-size: 0.95rem; }
.hints li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: 8px; background: var(--bg); font-variant-numeric: tabular-nums; }

.reveal { display: flex; flex-direction: column; gap: 10px; }
.verdict { font-family: var(--font-display); font-size: 1.3rem; margin: 0; }
.verdict.good { color: var(--good); } .verdict.bad { color: var(--bad); }
.receipt { font-family: var(--font-mono); font-size: 0.95rem; display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; font-variant-numeric: tabular-nums; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); padding-block: 10px; }
.receipt .cpi-head { grid-column: 1 / -1; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.receipt .big { font-size: 1.3rem; font-weight: 700; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.row-actions button { flex: 1; }

.ad { text-align: center; align-items: center; }
.ad-box { width: 100%; max-width: 300px; aspect-ratio: 300 / 250; border: 2px dashed var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-family: var(--font-mono); font-size: 0.85rem; padding: 16px; }
.small { font-size: 0.8rem; color: var(--muted); margin: 0; }
footer { font-size: 0.8rem; color: var(--muted); line-height: 1.5; }
footer p { margin: 0 0 6px; }
.toast { min-height: 1.2em; font-size: 0.85rem; color: var(--good); margin: 0; }
@media (prefers-reduced-motion: no-preference) {
  .card { animation: rise .25s ease-out; }
  @keyframes rise { from { transform: translateY(6px); opacity: .6; } to { transform: none; opacity: 1; } }
}

/* ---------- Daily 5, choices (version B), scoreboard, progress ---------- */
.mode { display: inline-block; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 4px; background: var(--ink); color: var(--bg); }
.share-preview { font-family: var(--font-mono); font-size: 0.85rem; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border-radius: 8px; padding: 10px 12px; margin: 0; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { background: var(--surface); color: var(--ink); font-family: var(--font-mono); font-size: 1.15rem; padding: 14px 8px; font-variant-numeric: tabular-nums; }
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice:disabled { cursor: default; opacity: 0.55; }
.choice.right { background: var(--good); border-color: var(--good); color: var(--surface); opacity: 1; }
.choice.wrong { border-color: var(--bad); color: var(--bad); text-decoration: line-through; opacity: 1; }
.squares { font-size: 2rem; letter-spacing: 4px; margin: 0; }
/* "You beat X% of players today" (empty, so hidden, until the counter answers) */
.beat { font-weight: 600; margin: 0; }
.beat:empty { display: none; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; border-top: 1px dashed var(--line); padding-top: 14px; }
.stats b { display: block; font-family: var(--font-display); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stats span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.progress { display: flex; gap: 6px; }
.progress i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.progress i.done { background: var(--accent); }

/* ---------- Sharing: one Share button on phones, a row of buttons on computers ---------- */
.share-row { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.share-row > * { min-width: 0; text-align: center; padding-inline: 8px; }
.share-row button, .share-row a { font-size: 0.9rem; }
.share-link { font-weight: 600; border-radius: 10px; border: 2px solid var(--ink); color: var(--ink); padding: 10px 12px; text-decoration: none; }
.share-link:hover { background: var(--ink); color: var(--bg); }

/* ---------- Footer and simple text pages (privacy, 404) ---------- */
footer a, .page a { color: inherit; }
.page { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.page h2 { font-family: var(--font-display); font-size: 1.2rem; margin: 20px 0 6px; }
.page p, .page li { margin: 0 0 10px; }
.brand { color: inherit; text-decoration: none; }
