:root {
  --bg: #fbfaf6;
  --bg-warm: #f4f1e9;
  --ink: #211f1a;
  --ink-soft: #56524a;
  --ink-faint: #8d887d;
  --line: #e4dfd3;
  --card: #fffefb;
  --accent: #1f7d5e;
  --accent-deep: #155f47;
  --gold: #c9a227;
  --bad: #b42318;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(33,31,26,.04), 0 12px 30px -18px rgba(33,31,26,.22);
  --ui: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 78% -8%, var(--bg-warm), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-deep); }
a:hover { color: var(--accent); }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(251,250,246,.88);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
}
.brand-text { display: grid; line-height: 1.15; }
.brand-name { font-weight: 700; letter-spacing: -.02em; }
.brand-sub { font-size: .75rem; color: var(--ink-faint); }
.top-nav { display: flex; gap: 16px; font-size: .92rem; }
.top-nav a { text-decoration: none; color: var(--ink-soft); }
.top-nav a:hover { color: var(--ink); }
main { flex: 1; width: min(980px, 100%); margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 48px; }
.home .eyebrow, .prose .eyebrow {
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .75rem;
  color: var(--accent-deep);
  margin: 0 0 8px;
}
h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  letter-spacing: -.02em;
  line-height: 1.2;
  margin: 0 0 12px;
}
.lede { font-size: 1.08rem; color: var(--ink-soft); max-width: 38rem; }
.games {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 28px;
}
.game-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px 20px;
  box-shadow: var(--shadow);
}
.game-card h2 { margin: 0 0 8px; font-size: 1.25rem; }
.game-card p { margin: 0 0 10px; color: var(--ink-soft); }
.game-meta { font-size: .82rem; color: var(--ink-faint); }
.game-card.soon { opacity: .88; }
.cta-row, .tools { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  background: transparent;
  touch-action: manipulation;
}
.btn-primary { background: var(--accent); color: #fff !important; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-ghost { border-color: var(--line); color: var(--ink-soft) !important; background: #fff; }
.btn-ghost:hover { border-color: var(--ink-faint); color: var(--ink) !important; }
.btn.on, .btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: #e7f2ec;
  color: var(--accent-deep) !important;
}
.prose { max-width: 40rem; }
.prose h2 { font-size: 1.15rem; margin: 1.6em 0 .5em; color: var(--accent-deep); }
.foot {
  padding: 24px 20px 36px;
  text-align: center;
  color: var(--ink-faint);
  font-size: .88rem;
}
.foot p { margin: 0 0 6px; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Sudoku */
.play { padding-top: 18px; }
.sudoku { display: grid; gap: 16px; justify-items: center; }
.play-bar { width: min(100%, 28rem); }
.play-bar h1 { font-size: 1.6rem; margin-bottom: 6px; }
.level-line { display: flex; gap: 8px; margin: 0 0 8px; }
.lvl {
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: .88rem;
  font-weight: 600;
}
.lvl.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.meta-line { display: flex; gap: 12px; align-items: baseline; margin: 0; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.status.ok { color: var(--accent-deep); }
.status.bad { color: var(--bad); }
.board-wrap {
  width: min(100%, 28rem);
}
.grid {
  --cell: calc((min(100vw, 28rem) - 32px) / 9);
  width: calc(var(--cell) * 9);
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 3px solid var(--ink);
  background: var(--ink);
  gap: 1px;
  touch-action: manipulation;
}
.cell {
  aspect-ratio: 1;
  border: 0;
  margin: 0;
  padding: 0;
  background: var(--card);
  font-family: var(--display);
  font-size: clamp(1rem, 4.6vw, 1.55rem);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.cell:nth-child(3n) { border-right: 2px solid var(--ink); }
.cell:nth-child(9n) { border-right: 0; }
.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--ink); }
.cell.given { color: var(--ink); font-weight: 700; }
.cell:not(.given) { color: #1a5c9e; }
.cell.selected { background: #d8eee4; }
.cell.peer { background: #f3eee2; }
.cell.same { background: #e4f0d8; }
.cell.conflict { color: var(--bad); background: #fde8e6; }
.cell.hinted { background: #fff3c4; }
.cell.win { background: #e7f2ec; }
.notes {
  position: absolute;
  inset: 2px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  font-size: .55rem;
  font-weight: 600;
  font-family: var(--ui);
  color: var(--ink-faint);
  line-height: 1;
  pointer-events: none;
}
.notes span { display: grid; place-items: center; }
.pad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  width: min(100%, 28rem);
}
.pad button {
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.pad button:hover { border-color: var(--accent); }
.tools { width: min(100%, 28rem); justify-content: stretch; }
.tools .btn { flex: 1 1 auto; }

@media (max-width: 640px) {
  .top-nav a:last-child { display: none; }
  .pad button { min-height: 44px; }
  .tools .btn { min-height: 44px; padding: 8px 10px; font-size: .88rem; }
}
