/* ===========================================================================
   PickFour — visual identity
   Built colour-first around the four difficulty tiers, then everything else.
   High-contrast, chunky, playful. Not a SaaS card in sight.
   =========================================================================== */

:root {
  /* the four tiers — the core of the brand */
  --yellow: #e3b23c;
  --green:  #4f9d52;
  --blue:   #3f7cc4;
  --purple: #8a56b0;
  --yellow-ink: #201a08;
  --tier-ink:   #ffffff;

  /* page chrome */
  --bg:      #f6f1e7;
  --panel:   #fffdf8;
  --ink:     #1c1a17;
  --ink-soft:#5c554b;
  --line:    #d9d0bf;
  --tile:    #efe8d8;
  --tile-ink:#1c1a17;
  --pick:    #23201c;
  --pick-ink:#fdfbf5;
  --accent:  #d5462f;      /* PickFour red — buttons, links, focus */
  --accent-ink:#ffffff;

  --radius: 12px;
  --maxw: 640px;
  --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #16150f;
    --panel:   #201e17;
    --ink:     #f3eee2;
    --ink-soft:#b7ad99;
    --line:    #3a362b;
    --tile:    #2b281f;
    --tile-ink:#f3eee2;
    --pick:    #f3eee2;
    --pick-ink:#16150f;
    --accent:  #f2593f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- layout ------------------------------------------------------------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

.site-header {
  border-bottom: 2px solid var(--ink);
  background: var(--panel);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; padding-bottom: 12px;
}
.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 9px;
}
.brand .mark {
  display: grid;
  grid-template-columns: 11px 11px;
  grid-template-rows: 11px 11px;
  gap: 3px;
}
.brand .mark i { border-radius: 3px; display: block; }
.brand .mark i:nth-child(1) { background: var(--yellow); }
.brand .mark i:nth-child(2) { background: var(--green); }
.brand .mark i:nth-child(3) { background: var(--blue); }
.brand .mark i:nth-child(4) { background: var(--purple); }

.site-nav a {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  margin-left: 18px;
}
.site-nav a:hover { color: var(--accent); }

main { padding: 26px 0 48px; }

.page-title {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: clamp(1.5rem, 6vw, 2.1rem);
  margin: 0 0 6px;
}
.lede { color: var(--ink-soft); margin: 0 0 22px; }

/* --- ad slots --------------------------------------------------------------- */
.ad-wrap {
  margin: 18px auto;
  min-height: 0;
  text-align: center;
}
.ad-wrap ins { display: block; }

/* --- game ------------------------------------------------------------------- */
#game { margin-top: 6px; }

.gg-date {
  font-family: var(--display);
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  margin: 0 0 14px;
}

.gg-solved { display: grid; gap: 8px; margin-bottom: 8px; }
.gg-solved-row {
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: center;
  color: var(--tier-ink);
  animation: pop 0.28s ease;
}
.gg-solved-row.gg-yellow { background: var(--yellow); color: var(--yellow-ink); }
.gg-solved-row.gg-green  { background: var(--green); }
.gg-solved-row.gg-blue   { background: var(--blue); }
.gg-solved-row.gg-purple { background: var(--purple); }
.gg-solved-row.is-missed { opacity: 0.82; }
.gg-solved-cat {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 2px;
  font-size: 0.95rem;
}
.gg-solved-items {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.gg-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.gg-tile {
  appearance: none;
  border: 2px solid var(--ink);
  background: var(--tile);
  color: var(--tile-ink);
  border-radius: var(--radius);
  min-height: 76px;
  padding: 4px 6px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(0.72rem, 3.1vw, 1rem);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  word-break: break-word;
  hyphens: auto;
  transition: transform 0.06s ease, background 0.12s ease, color 0.12s ease;
  box-shadow: 0 2px 0 var(--ink);
}
.gg-tile.is-long { font-size: clamp(0.62rem, 2.6vw, 0.84rem); }
.gg-tile:hover { transform: translateY(-1px); }
.gg-tile:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--ink); }
.gg-tile.is-selected {
  background: var(--pick);
  color: var(--pick-ink);
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--ink);
}
.gg-tile:disabled { cursor: default; opacity: 0.55; }
.gg-tile:disabled:hover { transform: none; }

@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.gg-shake { animation: shake 0.4s ease; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}
@media (prefers-reduced-motion: reduce) {
  .gg-shake, .gg-solved-row { animation: none; }
  .gg-tile { transition: none; }
}

.gg-mistakes {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 14px;
  font-family: var(--display);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.gg-dots { display: inline-flex; gap: 7px; }
.gg-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--ink);
  background: transparent;
}
.gg-dot.is-on { background: var(--ink); }

.gg-controls { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.gg-btn {
  appearance: none;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 999px;
  padding: 11px 20px;
  border: 2px solid var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.06s ease;
}
.gg-btn:active { transform: translateY(1px); }
.gg-btn-primary { background: var(--accent); color: var(--accent-ink); }
.gg-btn-ghost { background: transparent; color: var(--ink); }
.gg-btn:disabled { opacity: 0.4; cursor: default; }

.gg-toast {
  position: sticky; top: 8px;
  margin: 0 auto 12px;
  width: max-content; max-width: 100%;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 999px;
  z-index: 5;
}

.gg-error { color: var(--accent); font-weight: 600; }

/* --- end screen ------------------------------------------------------------- */
.gg-end {
  margin-top: 24px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px 18px;
  text-align: center;
}
.gg-end-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0 0 2px;
}
.gg-end-sub { margin: 0 0 14px; color: var(--ink-soft); font-size: 0.9rem; }
.gg-share-grid {
  font-size: 1.15rem;
  line-height: 1.35;
  margin: 0 0 14px;
  letter-spacing: 2px;
}
.gg-streak {
  font-family: var(--display);
  font-weight: 600;
  margin: 0 0 14px;
}
.gg-end-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.gg-share-text {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
}
.gg-countdown {
  font-family: var(--display);
  font-weight: 600;
  margin: 14px 0 2px;
}
.gg-bookmark { font-size: 0.82rem; color: var(--ink-soft); margin: 0; }

.gg-aff {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.gg-aff-text { margin: 0 0 8px; font-size: 0.92rem; }
.gg-aff-link { font-family: var(--display); font-weight: 600; }
.gg-aff-disc { margin: 6px 0 0; font-size: 0.72rem; color: var(--ink-soft); }

/* --- consent banner ------------------------------------------------------- */
.gg-consent {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  margin: 0 auto;
  max-width: var(--maxw);
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.12);
  z-index: 50;
}
.gg-consent p { margin: 0 0 10px; font-size: 0.86rem; }
.gg-consent-btns { display: flex; gap: 8px; justify-content: flex-end; }
.gg-consent .gg-btn { padding: 8px 16px; font-size: 0.88rem; }

/* --- archive ------------------------------------------------------------- */
.archive-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.archive-list a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--panel);
  text-decoration: none;
  color: var(--ink);
  font-family: var(--display);
}
.archive-list a:hover { background: var(--tile); }
.archive-list .no { color: var(--ink-soft); font-weight: 500; font-size: 0.85rem; }

.answers {
  margin-top: 22px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 4px 16px;
}
.answers summary {
  font-family: var(--display);
  font-weight: 600;
  cursor: pointer;
  padding: 12px 0;
}
.answers ul { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.answers li { font-size: 0.92rem; }
.answers .dot {
  display: inline-block; width: 11px; height: 11px; border-radius: 3px;
  margin-right: 8px; vertical-align: middle;
  border: 1px solid var(--ink);
}
.answers .dot.yellow { background: var(--yellow); }
.answers .dot.green  { background: var(--green); }
.answers .dot.blue   { background: var(--blue); }
.answers .dot.purple { background: var(--purple); }

.pager { display: flex; justify-content: space-between; margin-top: 20px; font-family: var(--display); font-weight: 600; }
.pager a { text-decoration: none; }
.pager span { color: var(--ink-soft); }

/* --- prose (how-to-play, privacy) ------------------------------------------ */
.prose h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.01em; margin: 26px 0 8px; }
.prose p, .prose li { font-size: 0.98rem; }
.prose code { background: var(--tile); padding: 1px 5px; border-radius: 4px; font-size: 0.86em; }
.mini-grid {
  display: grid; grid-template-columns: repeat(4, 40px); gap: 6px; margin: 12px 0;
}
.mini-grid i {
  height: 40px; border-radius: 6px; border: 2px solid var(--ink); display: block;
}
.mini-grid i.y { background: var(--yellow); }
.mini-grid i.g { background: var(--green); }
.mini-grid i.b { background: var(--blue); }
.mini-grid i.p { background: var(--purple); }

/* --- footer ------------------------------------------------------------- */
.site-footer {
  border-top: 2px solid var(--ink);
  background: var(--panel);
  font-size: 0.85rem;
}
.site-footer .wrap { padding: 22px 16px 30px; }
.site-footer h3 {
  font-family: var(--display);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin: 0 0 8px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 16px; padding: 0; list-style: none; }
.footer-meta { color: var(--ink-soft); margin: 0; }
