/* daily-games — one shared stylesheet.
   Cozy, phone-first, dark-mode-friendly. Kept small on purpose. */

:root {
  --bg: #16223d;          /* midnight navy */
  --bg-2: #0f1830;
  --surface: #1e2d4d;
  --surface-2: #263759;
  --ink: #f4edde;         /* warm cream */
  --ink-soft: #9fb0cf;
  --line: #2f4066;
  --accent: #ffce3a;      /* chick yellow */
  --accent-ink: #16223d;
  --link: #ffd75e;
  --good: #63c257;        /* puzzle green */
  --good-bg: #1c3a2a;
  --warn: #f5a623;        /* beak orange */
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "SF Pro Rounded", ui-rounded, "Nunito", "Quicksand", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
  font-size: 17px;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}

a { color: var(--link); }
a:hover { text-decoration: none; }

/* Header / footer -------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand .dot { color: var(--accent); }
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
  margin-left: 14px;
}
.site-nav a:hover { color: var(--link); }

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 48px;
  padding: 24px 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  justify-content: space-between;
}
.site-footer a { color: var(--ink-soft); }

/* Headings / prose ------------------------------------------------------- */

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 1.7rem; margin: 24px 0 8px; }
h2 { font-size: 1.25rem; margin: 28px 0 8px; }
.lede { color: var(--ink-soft); margin-top: 0; }
main { padding-bottom: 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 16px 0;
}

/* Hub game list ---------------------------------------------------------- */

.game-list { list-style: none; padding: 0; margin: 16px 0; }
.game-list li { margin: 12px 0; }
.game-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.08s ease, border-color 0.08s ease;
}
.game-tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.game-tile .emoji { font-size: 2rem; line-height: 1; }
.game-tile h2 { margin: 0 0 2px; font-size: 1.15rem; }
.game-tile p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

/* Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  padding: 11px 18px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-ghost {
  background: transparent;
  color: var(--link);
  border: 1px solid var(--line);
}

/* Place game ------------------------------------------------------------- */

.puzzle-meta { color: var(--ink-soft); font-size: 0.9rem; margin: 0 0 12px; }

.silhouette {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 8px auto 4px;
  aspect-ratio: 1 / 1;
  color: var(--ink);
}
.silhouette svg { width: 100%; height: 100%; display: block; }

/* Flag game: the flag image with an opaque tile cover peeled back per guess. */
.flag-board {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 8px auto 4px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-2);
}
.flag-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.flag-cover {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}
.flag-tile {
  background: var(--surface-2);
  border: 1px solid var(--bg-2);
  transition: opacity 0.35s ease;
}
.flag-tile.revealed {
  opacity: 0;
  pointer-events: none;
}
.guess-row.skipped { opacity: 0.6; }

.guesses { list-style: none; padding: 0; margin: 12px 0; }
.guess-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  margin-bottom: 8px;
  font-size: 0.98rem;
}
.guess-row.correct { background: var(--good-bg); border-color: var(--good); }
.guess-name { font-weight: 600; }
.guess-dist { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.guess-arrow { font-size: 1.15rem; }
.guess-prox {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 3.2em;
  text-align: right;
}

.heat { display: inline-block; }

/* Autocomplete input ----------------------------------------------------- */

.guess-form { position: relative; margin: 12px 0; }
.guess-input-row { display: flex; gap: 8px; }
.guess-input {
  flex: 1;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  min-width: 0;
}
.guess-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.autocomplete {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
  z-index: 20;
  list-style: none;
  margin: 0;
  padding: 4px;
}
.autocomplete[hidden] { display: none; }
.autocomplete li {
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.autocomplete li[aria-selected="true"],
.autocomplete li:hover { background: var(--surface-2); }

/* Result / share --------------------------------------------------------- */

.result { text-align: center; margin: 16px 0; }
.result .verdict { font-family: var(--font-display); font-size: 1.4rem; margin: 4px 0; }
.result .answer { color: var(--ink-soft); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.stat { text-align: center; }
.stat .num { font-size: 1.5rem; font-weight: 700; font-family: var(--font-display); }
.stat .label { font-size: 0.72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }

.dist-bars { margin: 12px 0; }
.dist-bar { display: flex; align-items: center; gap: 8px; margin: 3px 0; font-size: 0.9rem; }
.dist-bar .k { width: 1.2em; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.dist-bar .bar {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 6px;
  padding: 1px 8px;
  min-width: 1.6em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dist-bar.current .bar { background: var(--good); }

.msg { text-align: center; color: var(--ink-soft); padding: 24px 0; }
.msg.error { color: var(--accent); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; }

/* Archive list ----------------------------------------------------------- */

.archive-list { list-style: none; padding: 0; margin: 16px 0; }
.archive-list li { margin: 6px 0; }
.archive-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
}
.archive-list a:hover { border-color: var(--accent); }
.archive-list .played { font-size: 0.85rem; }
.archive-list .played.win { color: var(--good); }
.archive-list .played.loss { color: var(--accent); }

/* Ad slots — reserved, no network wired ---------------------------------- */

.ad-slot {
  margin: 20px 0;
  min-height: 90px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--surface-2);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

@media (max-width: 380px) {
  body { font-size: 16px; }
  .stats-grid { gap: 4px; }
  .guess-row { grid-template-columns: 1fr auto auto; }
  .guess-row .guess-arrow { display: none; }
}

/* Ad slots hidden until a real network is wired (see managing-seo-platform). */
.ad-slot { display: none !important; }

/* Landing hero ----------------------------------------------------------- */
.hero { text-align: center; padding: 22px 0 6px; }
.hero img {
  width: 100%;
  max-width: 380px;
  height: auto;
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 20px 0 6px; font-size: 2.1rem; }
.hero .lede { max-width: 30rem; margin: 0 auto 4px; }
.hero .chirp { color: var(--accent); font-weight: 700; letter-spacing: 0.02em; }

/* Landing today-label + per-game status ---------------------------------- */
.today-label {
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 22px 0 8px;
}
.game-status {
  margin: 6px 0 0;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--accent);
}
.game-status.win { color: var(--good); }
.game-status.loss { color: var(--ink-soft); }


/* Place: 'Give up' — small ghost button under the guess row; two-tap arm state. */
.giveup-row { text-align: center; margin-top: 8px; }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }
.btn.armed { color: var(--warn); border-color: var(--warn); }
