@font-face{font-family:'Fraunces';font-style:italic;font-weight:400 700;font-display:swap;src:url('/fonts/fraunces-italic-400-700.woff2') format('woff2');}
@font-face{font-family:'Fraunces';font-style:normal;font-weight:400 700;font-display:swap;src:url('/fonts/fraunces-normal-400-700.woff2') format('woff2');}
@font-face{font-family:'Source Serif 4';font-style:normal;font-weight:400 700;font-display:swap;src:url('/fonts/source-serif-4-normal-400-700.woff2') format('woff2');}

/* PuzzleHarbor — paper & ink design system
   Light: warm paper, heavy ink rules, vermilion accent.
   Dark: ink paper, warm off-white type. */

:root {
  color-scheme: light dark;
  --paper: #f6f1e4;
  --paper-2: #fffdf6;
  --paper-3: #efe8d7;
  --ink: #16150f;
  --ink-2: #3b382c;
  --ink-3: #6b6656;
  --rule: #d6cbb4;
  --rule-strong: #16150f;
  --accent: #c8452b;
  --accent-ink: #fff8ef;
  --teal: #0d6659;
  --amber: #e9b44c;
  --good: #1f7a4d;
  --bad: #b3372a;
  --focus: #1d5bd6;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --radius: 4px;
  --wrap: 1180px;
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.09rem);
  --step-1: clamp(1.18rem, 1.12rem + 0.3vw, 1.36rem);
  --step-2: clamp(1.42rem, 1.3rem + 0.6vw, 1.78rem);
  --step-3: clamp(1.75rem, 1.5rem + 1.2vw, 2.5rem);
  --step-4: clamp(2.2rem, 1.6rem + 2.6vw, 4rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121210;
    --paper-2: #1b1a17;
    --paper-3: #232118;
    --ink: #f2ecdd;
    --ink-2: #d8d1bf;
    --ink-3: #a49d8a;
    --rule: #38352a;
    --rule-strong: #f2ecdd;
    --accent: #f0704f;
    --accent-ink: #1a0c07;
    --teal: #57c3ae;
    --amber: #f2c666;
    --good: #63c48d;
    --bad: #f07a6a;
    --focus: #8ab4ff;
    --shadow: 5px 5px 0 #000;
    --shadow-sm: 3px 3px 0 #000;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121210;
  --paper-2: #1b1a17;
  --paper-3: #232118;
  --ink: #f2ecdd;
  --ink-2: #d8d1bf;
  --ink-3: #a49d8a;
  --rule: #38352a;
  --rule-strong: #f2ecdd;
  --accent: #f0704f;
  --accent-ink: #1a0c07;
  --teal: #57c3ae;
  --amber: #f2c666;
  --good: #63c48d;
  --bad: #f07a6a;
  --focus: #8ab4ff;
  --shadow: 5px 5px 0 #000;
  --shadow-sm: 3px 3px 0 #000;
}

:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.62;
  font-variant-numeric: oldstyle-nums;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); font-weight: 600; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
p { margin: 0 0 1.1em; }
strong { font-weight: 650; }
small { font-size: var(--step--1); }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
@media (max-width: 640px) { .wrap { width: calc(100% - 2rem); } }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--ink); color: var(--paper-2); padding: 0.6rem 1rem; border-radius: var(--radius);
}
.skip-link:focus { left: 8px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1.5px solid var(--rule-strong);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; text-decoration: none; letter-spacing: -0.02em; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand:hover .brand-mark .cell-1 { fill: var(--accent); }
.nav { display: flex; align-items: center; gap: 1.15rem; margin-left: auto; font-family: var(--font-ui); font-size: 0.9rem; font-weight: 500; letter-spacing: 0.01em; }
.nav a { text-decoration: none; color: var(--ink-2); padding: 0.35rem 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.nav .nav-cta { background: var(--ink); color: var(--paper-2); padding: 0.5rem 0.9rem; border-radius: 999px; border: 1.5px solid var(--ink); }
.nav .nav-cta:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.header-tools { display: flex; align-items: center; gap: 0.4rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border: 1.5px solid var(--rule-strong); border-radius: 50%; background: transparent; color: var(--ink);
  cursor: pointer; transition: transform 0.15s ease, background 0.15s ease;
}
.icon-btn:hover { background: var(--paper-3); transform: translateY(-1px); }
.nav-toggle { display: none; }

@media (max-width: 900px) {
  .nav {
    position: fixed; inset: 68px 0 auto 0; flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--paper-2); border-bottom: 1.5px solid var(--rule-strong);
    padding: 0.5rem 1.25rem 1.25rem; transform: translateY(-120%); transition: transform 0.25s ease;
    box-shadow: 0 20px 40px rgb(0 0 0 / 0.12);
  }
  .nav[data-open="true"] { transform: translateY(0); }
  .nav a { width: 100%; padding: 0.85rem 0; border-bottom: 1px solid var(--rule); font-size: 1rem; }
  .nav .nav-cta { margin-top: 0.9rem; text-align: center; border-bottom: 1.5px solid var(--ink); }
  .nav-toggle { display: inline-grid; }
}

/* ---------- type utilities ---------- */
.kicker {
  font-family: var(--font-ui); font-size: 0.74rem; font-weight: 650; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); display: inline-flex; align-items: center; gap: 0.6rem;
}
.kicker::before { content: ""; width: 26px; height: 2px; background: var(--accent); display: block; }
.lede { font-size: var(--step-1); color: var(--ink-2); max-width: 56ch; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.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; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  font-family: var(--font-ui); font-weight: 600; font-size: 0.94rem; line-height: 1;
  padding: 0.85rem 1.25rem; border-radius: 999px; border: 1.5px solid var(--ink);
  background: var(--ink); color: var(--paper-2); text-decoration: none; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.btn:hover { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--paper-3); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 3px 3px 0 var(--ink); }
.btn--sm { padding: 0.6rem 0.95rem; font-size: 0.84rem; box-shadow: 2px 2px 0 var(--ink); }
.btn--block { width: 100%; }

/* ---------- home hero ---------- */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 4vw, 3.5rem); position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.85fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.hero h1 { margin: 0.7rem 0 0.9rem; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.6rem 0 1.2rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-family: var(--font-ui); font-size: 0.8rem; color: var(--ink-3); }
.hero-meta span { display: inline-flex; align-items: center; gap: 0.4rem; }
.hero-meta span::before { content: ""; width: 6px; height: 6px; background: var(--teal); border-radius: 50%; }

.hero-card { position: relative; }
.paper-card {
  background: var(--paper-2); border: 1.5px solid var(--rule-strong); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem;
}
.paper-card .card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; }
.paper-card .card-head strong { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.paper-card .card-head span { font-family: var(--font-ui); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.tape {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%) rotate(-2.5deg);
  width: 108px; height: 24px; background: color-mix(in srgb, var(--amber) 65%, transparent);
  border-left: 1px dashed color-mix(in srgb, var(--ink) 25%, transparent);
  border-right: 1px dashed color-mix(in srgb, var(--ink) 25%, transparent);
  opacity: 0.85; pointer-events: none;
}
.hero-card .paper-card .mini-sudoku { width: min(100%, 232px); height: auto; aspect-ratio: 1 / 1; margin: 0.35rem auto 0; }
.hero-card .mini-sudoku span { font-size: 11px; }
.hero-card .stamp {
  position: absolute; right: -14px; bottom: -18px; transform: rotate(7deg);
  font-family: var(--font-ui); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); border: 2px solid var(--accent); border-radius: 50%; width: 82px; height: 82px;
  display: grid; place-items: center; text-align: center; line-height: 1.15; background: var(--paper); opacity: 0.92;
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-card { max-width: 340px; margin-inline: auto; }
}

/* ---------- sections ---------- */
.section { padding: clamp(2rem, 4vw, 3.2rem) 0; border-top: 1.5px solid var(--rule); }
.section:first-of-type { border-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 0.8rem 2rem; margin-bottom: 1.8rem; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--ink-3); max-width: 46ch; font-size: 0.96rem; }
.section-head .more { font-family: var(--font-ui); font-size: 0.86rem; font-weight: 600; white-space: nowrap; }

/* ---------- game cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.1rem; }
.game-card {
  position: relative; display: flex; flex-direction: column; gap: 0.55rem;
  background: var(--paper-2); border: 1.5px solid var(--rule-strong); border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.15rem; text-decoration: none; box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.game-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.game-card .art { height: 96px; display: grid; place-items: center; margin-bottom: 0.35rem; }
.game-card h3 { margin: 0; font-size: 1.28rem; }
.game-card p { margin: 0; font-size: 0.92rem; color: var(--ink-3); }
.game-card .meta { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 0.55rem; font-family: var(--font-ui); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.game-card .meta b { color: var(--accent); font-weight: 700; }

.mini-sudoku { display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr); width: 96px; height: 96px; border: 2px solid var(--ink); }
.mini-sudoku span { border: 0.5px solid var(--rule); display: grid; place-items: center; font-size: 7px; font-family: var(--font-mono); }
.mini-sudoku span:nth-child(3n) { border-right: 1.5px solid var(--ink); }
.mini-sudoku span:nth-child(9n) { border-right: 0; }
.mini-sudoku span:nth-child(n+19):nth-child(-n+27),
.mini-sudoku span:nth-child(n+46):nth-child(-n+54) { border-bottom: 1.5px solid var(--ink); }
.mini-sudoku span.filled { background: color-mix(in srgb, var(--amber) 35%, transparent); font-weight: 700; }

.mini-wordsearch { display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(7, 1fr); width: 98px; height: 98px; border: 2px solid var(--ink); }
.mini-wordsearch span { display: grid; place-items: center; font-family: var(--font-mono); font-size: 8px; border: 0.5px solid var(--rule); }
.mini-wordsearch span.hit { background: var(--teal); color: var(--paper-2); }

.tile-2048 { width: 82px; height: 82px; border-radius: 6px; background: var(--amber); border: 2px solid var(--ink); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; box-shadow: 3px 3px 0 var(--ink); }

.mine-grid { display: grid; grid-template-columns: repeat(7, 1fr); width: 98px; height: 98px; border: 2px solid var(--ink); }
.mine-grid span { display: grid; place-items: center; font-size: 9px; border: 0.5px solid var(--rule); background: var(--paper-3); }
.mine-grid span.boom { background: var(--accent); color: var(--accent-ink); }

/* ---------- daily / split panels ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 1.6rem; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.daily-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.4rem; align-items: center; background: var(--paper-2); border: 1.5px solid var(--rule-strong); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow); }
@media (max-width: 560px) { .daily-card { grid-template-columns: 1fr; } }
.daily-card h3 { margin: 0 0 0.35rem; }
.daily-card p { margin: 0 0 0.9rem; color: var(--ink-3); font-size: 0.93rem; }
.daily-facts { display: flex; gap: 1.6rem; margin-top: 1rem; }
.daily-facts div { display: flex; flex-direction: column; }
.daily-facts b { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; }
.daily-facts span { font-family: var(--font-ui); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }

.link-list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--rule); }
.link-list li { border-bottom: 1px solid var(--rule); }
.link-list a { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.72rem 0; text-decoration: none; }
.link-list a:hover { color: var(--accent); }
.link-list .t { font-size: 0.98rem; }
.link-list .n { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-3); white-space: nowrap; }

/* ---------- chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.42rem 0.8rem;
  border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--paper-2);
  font-family: var(--font-ui); font-size: 0.82rem; text-decoration: none; transition: background 0.14s ease, color 0.14s ease;
}
.chip:hover { background: var(--ink); color: var(--paper-2); }
.chip small { opacity: 0.6; font-size: 0.7rem; }

/* ---------- puzzle page layout ---------- */
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(1.6rem, 4vw, 3rem); align-items: start; padding: 2rem 0 3rem; }
@media (max-width: 980px) { .game-layout { grid-template-columns: 1fr; } }
.game-main { min-width: 0; }
.game-side { display: grid; gap: 1.2rem; position: sticky; top: 88px; }
@media (max-width: 980px) { .game-side { position: static; } }

.page-head { padding: 1.6rem 0 0.4rem; }
.page-head h1 { font-size: var(--step-3); margin: 0.45rem 0 0.5rem; }
.page-head .lede { font-size: 1.05rem; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.9rem; }
.toolbar-group { display: flex; align-items: center; gap: 0.4rem; }
.seg { display: inline-flex; border: 1.5px solid var(--rule-strong); border-radius: 999px; overflow: hidden; background: var(--paper-2); }
.seg a, .seg button {
  font-family: var(--font-ui); font-size: 0.78rem; font-weight: 600; padding: 0.42rem 0.7rem;
  background: transparent; border: 0; color: var(--ink-2); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.seg a + a, .seg button + button { border-left: 1px solid var(--rule); }
.seg a[aria-current="true"], .seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper-2); }

.status { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-3); display: inline-flex; gap: 0.9rem; }
.status b { color: var(--ink); font-weight: 600; }

/* ---------- sudoku ---------- */
.board-wrap { position: relative; max-width: 544px; margin: 0 auto; }
.sudoku {
  display: grid; background: var(--paper-2); border: 2.5px solid var(--ink);
  width: 100%; aspect-ratio: 1 / 1; user-select: none; touch-action: manipulation;
}
.sudoku[data-size="6"] { aspect-ratio: 6 / 6; }
.sudoku[data-size="4"] { aspect-ratio: 1 / 1; max-width: 360px; margin-inline: auto; }
.sudoku .cell {
  position: relative; display: grid; place-items: center; border-right: 0.5px solid var(--rule);
  border-bottom: 0.5px solid var(--rule); font-family: var(--font-mono); font-size: clamp(1rem, 4.2vw, 1.55rem);
  color: var(--ink-2); cursor: pointer; background: transparent; padding: 0; line-height: 1;
}
.sudoku .cell.br { border-right: 2.2px solid var(--ink); }
.sudoku .cell.bb { border-bottom: 2.2px solid var(--ink); }
.sudoku .cell.last-col { border-right: 0; }
.sudoku .cell.last-row { border-bottom: 0; }
.sudoku .cell.given { color: var(--ink); font-weight: 700; }
.sudoku .cell.user { color: var(--accent); font-weight: 600; }
.sudoku .cell.peer { background: color-mix(in srgb, var(--amber) 18%, transparent); }
.sudoku .cell.same { background: color-mix(in srgb, var(--teal) 20%, transparent); }
.sudoku .cell.selected { background: color-mix(in srgb, var(--amber) 55%, transparent); box-shadow: inset 0 0 0 2px var(--ink); }
.sudoku .cell.conflict { color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, transparent); }
.sudoku .cell.hinted { animation: pop 0.35s ease; }
.sudoku .notes { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; height: 100%; padding: 2px; gap: 1px; font-size: clamp(0.4rem, 1.35vw, 0.56rem); color: var(--ink-3); font-weight: 500; }
.sudoku .notes span { display: grid; place-items: center; line-height: 1; }

@keyframes pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }

.numpad { display: grid; grid-template-columns: repeat(5, 1fr); grid-auto-flow: dense; gap: 0.4rem; margin-top: 0.9rem; }
.numpad button {
  font-family: var(--font-mono); font-size: 1.2rem; font-weight: 600; padding: 0.7rem 0;
  background: var(--paper-2); border: 1.5px solid var(--rule-strong); border-radius: var(--radius);
  color: var(--ink); cursor: pointer; box-shadow: 2px 2px 0 var(--ink); transition: transform 0.1s ease;
}
.numpad button:hover { background: var(--paper-3); }
.numpad button:disabled { opacity: 0.42; cursor: not-allowed; box-shadow: none; }
.numpad button:disabled:hover { background: var(--paper-2); }
.numpad button:active { transform: translate(2px, 2px); box-shadow: none; }
.numpad button.is-active { background: var(--ink); color: var(--paper-2); }
.numpad button { min-height: 48px; }
.numpad [data-hint-count] { font-family: var(--font-mono); opacity: 0.75; margin-left: 0.25em; }
.numpad button small { display: inline; font-family: var(--font-ui); font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.6; font-weight: 500; margin-left: 0.3em; }
.numpad .wide { grid-column: span 2; font-family: var(--font-ui); font-size: 0.82rem; }
.numpad { grid-auto-rows: 52px; }
.numpad .erase { color: var(--bad); }
@media (min-width: 700px) and (max-width: 980px) { .numpad { max-width: 544px; margin-inline: auto; } }

.game-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.45rem; margin-top: 0.9rem; font-family: var(--font-ui); }
.game-bar button, .game-bar a {
  font-size: 0.78rem; font-weight: 600; padding: 0.5rem 0.8rem; border-radius: 999px;
  border: 1px solid var(--rule-strong); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none;
}
.game-bar button:hover, .game-bar a:hover { background: var(--paper-3); }
.game-bar .primary { background: var(--ink); color: var(--paper-2); border-color: var(--ink); }

.overlay {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(2px);
  border: 2px solid var(--ink); z-index: 5; padding: 1rem;
}
.overlay[hidden] { display: none; }
.overlay h3 { margin: 0 0 0.2rem; font-size: 1.7rem; }
.overlay p { margin: 0 0 1rem; color: var(--ink-3); font-family: var(--font-ui); font-size: 0.9rem; }

/* ---------- word search ---------- */
.ws-wrap { max-width: 620px; margin: 0 auto; }
.wordsearch { display: grid; background: var(--paper-2); border: 2.5px solid var(--ink); aspect-ratio: 1 / 1; user-select: none; touch-action: none; }
.wordsearch .letter {
  display: grid; place-items: center; font-family: var(--font-mono); font-size: clamp(0.62rem, 2.1vw, 1.02rem);
  border-right: 0.5px solid color-mix(in srgb, var(--rule) 60%, transparent);
  border-bottom: 0.5px solid color-mix(in srgb, var(--rule) 60%, transparent);
  color: var(--ink-2); text-transform: uppercase; line-height: 1;
}
.wordsearch .letter.sel { background: color-mix(in srgb, var(--amber) 60%, transparent); color: var(--ink); }
.wordsearch .letter.found { background: color-mix(in srgb, var(--teal) 30%, transparent); color: var(--ink); font-weight: 700; }
.words { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.3rem 1rem; margin: 1rem 0 0; padding: 0; list-style: none; font-family: var(--font-ui); }
.words li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.84rem; padding: 0.3rem 0.45rem; border-radius: 3px; color: var(--ink-2); }
.words li::before { content: ""; width: 10px; height: 10px; border: 1.5px solid var(--ink-3); border-radius: 2px; flex: none; }
.words li.found { text-decoration: line-through; color: var(--ink-3); }
.words li.found::before { background: var(--teal); border-color: var(--teal); }

/* ---------- 2048 ---------- */
.g2048-wrap { max-width: 460px; margin: 0 auto; }
.g2048 { position: relative; aspect-ratio: 1 / 1; background: var(--paper-3); border: 2px solid var(--ink); border-radius: 6px; padding: 2.4%; }
.g2048 .bg { position: absolute; inset: 2.4%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2.4%; }
.g2048 .bg span { background: color-mix(in srgb, var(--ink) 8%, transparent); border-radius: 4px; }
.g2048 .tiles { position: absolute; inset: 2.4%; }
.tile {
  position: absolute; display: grid; place-items: center; border-radius: 4px;
  font-family: var(--font-display); font-weight: 700; color: #2b2318;
  transition: transform 0.11s ease, opacity 0.11s ease; will-change: transform;
}
.tile[data-v="2"] { background: #eee4d3; }
.tile[data-v="4"] { background: #ede0c8; }
.tile[data-v="8"] { background: #f2b179; color: #fff; }
.tile[data-v="16"] { background: #f59563; color: #fff; }
.tile[data-v="32"] { background: #f67c5f; color: #fff; }
.tile[data-v="64"] { background: #f65e3b; color: #fff; }
.tile[data-v="128"] { background: #edcf72; color: #fff; }
.tile[data-v="256"] { background: #edcc61; color: #fff; }
.tile[data-v="512"] { background: #edc850; color: #fff; }
.tile[data-v="1024"] { background: #edc53f; color: #fff; }
.tile[data-v="2048"] { background: #edc22e; color: #fff; }
.tile.new { animation: tile-in 0.16s ease; }
@keyframes tile-in { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- minesweeper ---------- */
.mine-wrap { max-width: 620px; margin: 0 auto; }
.mineboard { display: grid; gap: 2px; background: var(--ink); border: 2px solid var(--ink); padding: 2px; user-select: none; }
.mineboard button {
  aspect-ratio: 1 / 1; display: grid; place-items: center; border: 0; padding: 0; cursor: pointer;
  background: var(--paper-3); font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(0.65rem, 2vw, 1rem); color: var(--ink); border-radius: 1px;
}
.mineboard button:hover { background: color-mix(in srgb, var(--amber) 30%, var(--paper-3)); }
.mineboard button.open { background: var(--paper-2); cursor: default; }
.mineboard button.flag { color: var(--accent); }
.mineboard button.boom { background: var(--accent); color: #fff; }
.mineboard button[data-n="1"] { color: #1d5bd6; }
.mineboard button[data-n="2"] { color: #1f7a4d; }
.mineboard button[data-n="3"] { color: #b3372a; }
.mineboard button[data-n="4"] { color: #5b2d8e; }
.mineboard button[data-n="5"] { color: #8a4b1f; }
.mineboard button[data-n="6"] { color: #0d6659; }
.mineboard button[data-n="7"] { color: #16150f; }
.mineboard button[data-n="8"] { color: #6b6656; }

/* ---------- content pages ---------- */
.page { padding: 1.6rem 0 3rem; }
.breadcrumbs { font-family: var(--font-ui); font-size: 0.78rem; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 1rem 0 0; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs span[aria-current] { color: var(--ink-2); }

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 3rem; align-items: start; }
@media (max-width: 980px) { .article-layout { grid-template-columns: 1fr; } }
.prose { max-width: 72ch; font-size: 1.05rem; }
.prose h2 { margin-top: 2.2em; font-size: var(--step-2); }
.prose h3 { margin-top: 1.6em; font-size: 1.24rem; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1.1em; }
.prose li { margin-bottom: 0.4em; }
.prose blockquote { margin: 1.6em 0; padding: 0.4em 0 0.4em 1.2em; border-left: 3px solid var(--accent); font-style: italic; color: var(--ink-2); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: 0.92rem; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 0.55em 0.6em; text-align: left; }
.prose th { font-family: var(--font-ui); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.callout { background: var(--paper-2); border: 1.5px solid var(--rule-strong); border-left: 4px solid var(--teal); border-radius: var(--radius); padding: 1rem 1.15rem; margin: 1.6em 0; font-size: 0.96rem; }
.callout p:last-child { margin: 0; }
.article-meta { font-family: var(--font-ui); font-size: 0.78rem; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-bottom: 1.2rem; }

.faq { margin-top: 2.4rem; }
.faq details { border-bottom: 1px solid var(--rule); padding: 0.9rem 0; }
.faq summary { font-family: var(--font-display); font-size: 1.08rem; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-ui); font-weight: 400; color: var(--accent); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0.6rem 0 0; color: var(--ink-2); font-size: 0.96rem; }

/* ---------- ads ---------- */
.ad-slot { display: none; margin: 1.4rem auto; text-align: center; position: relative; min-height: 60px; }
body.ads-on .ad-slot { display: block; }
.ad-slot .ad-label { display: block; font-family: var(--font-ui); font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.35rem; }
.ad-slot .ad-body { display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--ink) 4%, transparent); border: 1px dashed var(--rule); min-height: 58px; overflow: hidden; }
.ad-slot .ad-body[data-empty="true"] { min-height: 60px; }
.ad-slot--leaderboard .ad-body { min-height: 90px; }
.ad-slot--rectangle .ad-body { min-height: 250px; max-width: 300px; margin-inline: auto; }
.ad-slot--native .ad-body { min-height: 250px; }
.ad-ph { font-family: var(--font-ui); font-size: 0.7rem; color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase; }
.side-card { background: var(--paper-2); border: 1.5px solid var(--rule-strong); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow-sm); }
.side-card h2 { font-size: 1.05rem; margin: 0 0 0.6rem; }
.side-card p { font-size: 0.9rem; color: var(--ink-2); margin: 0 0 0.6rem; }
.side-card .btn { margin-top: 0.3rem; }
.stat-line { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px dotted var(--rule); font-family: var(--font-ui); font-size: 0.84rem; color: var(--ink-2); }
.stat-line b { font-family: var(--font-mono); color: var(--ink); font-weight: 600; }
.overlay-best { color: var(--teal) !important; font-family: var(--font-ui); font-size: 0.8rem; margin: 0 0 1rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1.5px solid var(--rule-strong); margin-top: 2rem; padding: 2.4rem 0 2rem; font-family: var(--font-ui); font-size: 0.85rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 2rem; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-brand p { color: var(--ink-3); max-width: 34ch; margin: 0.6rem 0 0; }
.footer-col h3 { font-family: var(--font-ui); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 0.7rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.footer-col a { text-decoration: none; color: var(--ink-2); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.8rem; border-top: 1px solid var(--rule); margin-top: 2rem; padding-top: 1.2rem; color: var(--ink-3); font-size: 0.78rem; }

/* ---------- consent ---------- */
.consent {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 60; max-width: 560px; margin-inline: auto;
  background: var(--paper-2); border: 1.5px solid var(--ink); border-radius: var(--radius); box-shadow: 6px 6px 0 var(--ink);
  padding: 1rem 1.1rem; font-family: var(--font-ui); font-size: 0.82rem; line-height: 1.5;
}
.consent[hidden] { display: none; }
.consent p { margin: 0 0 0.75rem; color: var(--ink-2); }
.consent .row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- miscellaneous ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; border-top: 1.5px solid var(--rule-strong); border-bottom: 1.5px solid var(--rule-strong); padding: 1.2rem 0; margin: 2.4rem 0; }
.stat-row div { display: flex; flex-direction: column; gap: 0.1rem; }
.stat-row b { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; }
.stat-row span { font-family: var(--font-ui); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
@media (max-width: 640px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

.toc { border: 1.5px solid var(--rule-strong); background: var(--paper-2); border-radius: var(--radius); padding: 0.9rem 1.1rem; margin: 1.4rem 0 2rem; font-family: var(--font-ui); font-size: 0.86rem; }
.toc strong { display: block; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.5rem; }
.toc ol { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.3rem; }
.toc a { text-decoration: none; color: var(--ink-2); }
.toc a:hover { color: var(--accent); }

.prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.4rem; border-top: 1.5px solid var(--rule); padding-top: 1.2rem; }
.prev-next a { text-decoration: none; font-family: var(--font-ui); font-size: 0.85rem; }
.prev-next span { display: block; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.2rem; }
.prev-next .next { text-align: right; }

.note { font-size: 0.85rem; color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ---------- print ---------- */
.large-ws .wordsearch { max-width: 720px; }
.large-ws .wordsearch .letter { font-size: clamp(0.8rem, 2.6vw, 1.25rem); }
.large-print .sudoku { max-width: 640px; font-size: clamp(1.4rem, 5vw, 2.1rem); }
.large-print .sudoku .cell { font-size: clamp(1.4rem, 5vw, 2.1rem); }
@page { margin: 1.2cm; }

@media print {
  :root { --paper: #fff; --paper-2: #fff; --ink: #000; --ink-2: #000; --ink-3: #444; --rule: #bbb; --rule-strong: #000; }
  body { background: #fff !important; background-image: none !important; font-size: 11pt; }
  .site-header, .site-footer, .ad-slot, .consent, .game-bar, .numpad, .toolbar, .breadcrumbs,
  .game-side, .no-print, .hero-actions, .nav, .overlay, .toc, .prev-next { display: none !important; }
  .wrap { width: 100%; }
  .game-layout { display: block; padding: 0; }
  .page-head { padding: 0 0 1rem; }
  .page-head .lede { display: none; }
  .board-wrap, .sudoku, .ws-wrap, .wordsearch { max-width: 100%; }
  .sudoku { border-width: 2px; width: 16cm; height: 16cm; margin: 0.5cm auto; }
  .sudoku[data-size="4"] { width: 10cm; height: 10cm; }
  .sudoku[data-size="6"] { width: 12cm; height: 12cm; }
  .sudoku .cell { color: #000 !important; background: transparent !important; box-shadow: none !important; border-color: #666; }
  .sudoku .cell.given { font-weight: 700; }
  .wordsearch { width: 17cm; height: 17cm; }
  .large-print .sudoku { width: 19cm; height: 19cm; page-break-after: always; }
  .large-ws .wordsearch { width: 19cm; height: 19cm; }
  .large-ws .wordsearch .letter { font-size: 11pt; }
  .large-print .sudoku .cell { font-size: 30pt; }
  .words { font-size: 9pt; }
  .words li::before { border-color: #000; }
  .print-only { display: block !important; }
  .print-title { font-size: 16pt; margin: 0 0 0.2cm; }
  .print-meta { font-family: var(--font-ui); font-size: 8pt; color: #444; margin-bottom: 0.4cm; }
  a { text-decoration: none; color: #000; }
  .prose { max-width: none; font-size: 11pt; }
  @page { margin: 1.2cm; }
}
.print-only { display: none; }