/* PlayNook — one stylesheet, no external fonts. */
:root {
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --surface-2: #efe9dd;
  --ink: #1f1c17;
  --muted: #6a6358;
  --line: #e2dacb;
  --accent: #e4572e;
  --accent-ink: #ffffff;
  --teal: #17806d;
  --gold: #e09a00;
  --blue: #3a6ea5;
  --plum: #8a4fa3;
  --rose: #c8406a;
  --good: #17806d;
  --bad: #c8333a;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 10px 28px rgba(40, 30, 10, .07);
  --radius: 18px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16140f;
    --surface: #1f1c16;
    --surface-2: #2a261e;
    --ink: #f3eee4;
    --muted: #a99f90;
    --line: #3a352b;
    --accent: #ff6b3d;
    --accent-ink: #1a0f08;
    --teal: #3cc0a2;
    --gold: #ffc24b;
    --blue: #7aa7dd;
    --plum: #c08ad6;
    --rose: #ec7398;
    --good: #3cc0a2;
    --bad: #ff6b6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 12px; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 32px); margin-inline: auto; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 1.25rem; }
.logo-mark { width: 34px; height: 34px; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: var(--ink); text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.nav-toggle { display: none; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; padding: 11px 10px; flex-direction: column; justify-content: space-between; }
.nav-toggle span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }
@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .site-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px 14px; }
}

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 72px; padding: 48px 0 28px; background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin: 6px 0; }
.footer-grid a:not(.brand) { color: var(--ink); text-decoration: none; }
.footer-grid a:not(.brand):hover { color: var(--accent); }
.footer-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: var(--font); }
.live-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.live-stats[hidden] { display: none; }
.live-stats span { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 999px; padding: 7px 14px; font-size: .9rem; color: var(--muted); }
.live-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #1aa260; box-shadow: 0 0 0 0 rgba(26, 162, 96, .5); animation: livepulse 2s infinite; }
@keyframes livepulse { 70% { box-shadow: 0 0 0 7px rgba(26, 162, 96, 0); } 100% { box-shadow: 0 0 0 0 rgba(26, 162, 96, 0); } }
.footer-base {margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); font-size: .875rem; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }

/* Shared bits */
.tag { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 3px 10px; border-radius: 999px; width: fit-content; }
.section { margin-top: 64px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 24px 0 12px; font-size: .875rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; opacity: .6; }
.crumbs a { color: var(--muted); }

/* Hero */
.hero { padding: 56px 0 8px; display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: center; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 34ch; }
.hero-art { aspect-ratio: 5 / 4; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 22px; }
.hero-art a { border-radius: 18px; display: grid; place-items: center; background: var(--tile); transition: transform .15s; }
.hero-art a:hover { transform: translateY(-3px) rotate(-2deg); }
.hero-art svg { width: 62%; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; padding-top: 32px; } .hero-art { order: -1; aspect-ratio: 3 / 1.4; grid-template-columns: repeat(6, 1fr); padding: 14px; gap: 10px; } .hero-art a:nth-child(n+7) { display: none; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 700 .95rem/1 var(--font); padding: 12px 18px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; transition: transform .08s, background .15s; user-select: none; -webkit-user-select: none; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 8px 12px; min-height: 36px; font-size: .85rem; border-radius: 10px; }

/* Game cards */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.game-card { display: flex; gap: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s; }
.game-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.game-icon { flex: none; width: 76px; height: 76px; border-radius: 16px; background: var(--tile); display: grid; place-items: center; }
.game-icon svg { width: 46px; height: 46px; }
.game-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.game-card-title { font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
.game-card-text { font-size: .9rem; color: var(--muted); line-height: 1.45; }

/* Post cards */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.post-card { display: flex; flex-direction: column; gap: 8px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s; }
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.post-card-title { font-family: var(--display); font-weight: 800; font-size: 1.15rem; line-height: 1.3; }
.post-card-text { color: var(--muted); font-size: .92rem; line-height: 1.5; flex: 1; }

/* Feature strip */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.feature { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.feature h3 { margin-bottom: .3em; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Prose */
.prose { font-size: 1.05rem; }
.prose h2 { margin-top: 2em; }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin: .35em 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1.2em; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.prose th { background: var(--surface-2); }
.prose kbd, kbd { font: 600 .85em/1 ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 2px 6px; }
.prose blockquote { margin: 0 0 1em; padding: 12px 18px; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 12px 12px 0; }
.callout { padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin: 0 0 1.2em; }
.diagram { display: inline-grid; gap: 3px; margin: 4px 0 1.2em; font: 700 .95rem/1 ui-monospace, Consolas, monospace; }
.diagram span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; background: var(--surface-2); }
.diagram .h { background: var(--surface); border: 1px dashed var(--line); }
.diagram .s { background: color-mix(in srgb, var(--teal) 30%, var(--surface)); }
.diagram .m { background: color-mix(in srgb, var(--bad) 35%, var(--surface)); }
.page-head { padding: 8px 0 12px; }
.page-head p { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.meta-line { color: var(--muted); font-size: .9rem; margin-bottom: 2em; }

/* FAQ */
.faq details { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding: 0 18px 14px; color: var(--muted); }

/* Game page */
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
.game-aside { position: sticky; top: 88px; display: grid; gap: 16px; }
.aside-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.aside-box h2 { font-size: 1rem; font-family: var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.aside-box ul { margin: 0; padding-left: 1.1em; }
.aside-links { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.aside-links a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 600; }
.aside-links .game-icon { width: 38px; height: 38px; border-radius: 10px; }
.aside-links .game-icon svg { width: 24px; height: 24px; }
@media (max-width: 960px) { .game-layout { grid-template-columns: minmax(0, 1fr); } .game-aside { position: static; } }

.stage { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px; box-shadow: var(--shadow); min-height: 420px; position: relative; }
.stage noscript { display: block; padding: 40px; text-align: center; }
.game-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 6px 12px; min-width: 72px; text-align: center; }
.stat b { display: block; font: 800 1.2rem/1.2 var(--display); font-variant-numeric: tabular-nums; }
.stat span { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.game-opts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.seg { display: inline-flex; flex-wrap: wrap; justify-content: center; max-width: 100%; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--ink); font: 600 .85rem/1 var(--font); padding: 9px 12px; border-radius: 9px; cursor: pointer; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.status { min-height: 1.6em; font-weight: 700; text-align: center; margin: 10px 0 0; }
.board-wrap { position: relative; margin-inline: auto; }
.board-canvas { width: 100%; height: auto; border-radius: 14px; touch-action: none; background: var(--surface-2); }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(3px); border-radius: 14px; text-align: center; padding: 20px; z-index: 5; }
.overlay[hidden] { display: none; }
.overlay h2 { margin-bottom: .2em; }
.overlay p { color: var(--muted); margin-bottom: 1em; }

/* D-pad for touch screens */
.dpad { display: none; grid-template-columns: repeat(3, 60px); grid-template-rows: repeat(2, 54px); gap: 6px; justify-content: center; margin-top: 14px; }
.dpad button { font-size: 1.3rem; padding: 0; }
.dpad .up { grid-column: 2; }
.dpad .left { grid-column: 1; grid-row: 2; }
.dpad .down { grid-column: 2; grid-row: 2; }
.dpad .right { grid-column: 3; grid-row: 2; }
@media (pointer: coarse) { .dpad { display: grid; } }

/* Tic-tac-toe */
.ttt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(360px, 100%); margin: 8px auto 0; }
.ttt button { aspect-ratio: 1; border: 0; border-radius: 16px; background: var(--surface-2); cursor: pointer; display: grid; place-items: center; padding: 18%; }
.ttt button:hover:not(:disabled) { background: color-mix(in srgb, var(--surface-2) 80%, var(--ink)); }
.ttt button:disabled { cursor: default; }
.ttt button.win { background: color-mix(in srgb, var(--gold) 40%, var(--surface-2)); }
.ttt svg { width: 100%; height: 100%; animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* Memory */
.mem { display: grid; gap: 8px; margin: 0 auto; width: 100%; }
.mem .card { display: block; width: 100%; aspect-ratio: 1; border: 0; padding: 0; background: transparent; cursor: pointer; perspective: 600px; }
.mem .inner { display: block; position: relative; width: 100%; height: 100%; transition: transform .35s; transform-style: preserve-3d; }
.mem .card.up .inner, .mem .card.done .inner { transform: rotateY(180deg); }
.mem .face { position: absolute; inset: 0; border-radius: 12px; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.mem .back { background: var(--accent); background-image: radial-gradient(circle at 30% 30%, rgba(255,255,255,.25) 0 12%, transparent 13%), radial-gradient(circle at 70% 70%, rgba(255,255,255,.18) 0 12%, transparent 13%); }
.mem .front { background: var(--surface-2); transform: rotateY(180deg); font-size: clamp(1.4rem, 6vw, 2.4rem); }
.mem .card.done .front { background: color-mix(in srgb, var(--teal) 28%, var(--surface-2)); }

/* Sudoku */
.sdk { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(468px, 100%); margin: 0 auto; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--ink); gap: 2px; touch-action: manipulation; }
.sdk .box { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.sdk .c { aspect-ratio: 1; background: var(--surface); border: 0; padding: 0; font: 600 clamp(1rem, 4.6vw, 1.5rem)/1 var(--font); color: var(--blue); cursor: pointer; position: relative; display: grid; place-items: center; }
.sdk .c.given { color: var(--ink); font-weight: 800; }
.sdk .c.peer { background: color-mix(in srgb, var(--blue) 9%, var(--surface)); }
.sdk .c.same { background: color-mix(in srgb, var(--blue) 22%, var(--surface)); }
.sdk .c.sel { background: color-mix(in srgb, var(--gold) 45%, var(--surface)); }
.sdk .c.err { color: var(--bad); }
.sdk .notes { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); font-size: clamp(.45rem, 1.8vw, .65rem); color: var(--muted); font-weight: 600; }
.sdk .notes i { font-style: normal; display: grid; place-items: center; }
.pad { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; width: min(468px, 100%); margin: 12px auto 0; }
.pad button { min-width: 0; aspect-ratio: 1 / 1.1; font: 700 1.2rem/1 var(--font); padding: 0; border-radius: 10px; }
.pad-tools { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

/* Minefield */
.mines { display: grid; gap: 2px; margin: 0 auto; width: 100%; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.mines button { aspect-ratio: 1; border: 0; padding: 0; border-radius: 4px; background: color-mix(in srgb, var(--teal) 55%, var(--surface-2)); cursor: pointer; font: 800 clamp(.7rem, 2.6vw, 1.05rem)/1 var(--font); display: grid; place-items: center; color: var(--ink); }
.mines button:hover { filter: brightness(1.08); }
.mines button.open { background: var(--surface-2); cursor: default; }
.mines button.boom { background: var(--bad); }
.mines button.wrong { background: color-mix(in srgb, var(--bad) 35%, var(--surface-2)); }
.mines .n1 { color: #2f6fd0; } .mines .n2 { color: #1f8a4c; } .mines .n3 { color: #d13b3b; } .mines .n4 { color: #6a3fb0; }
.mines .n5 { color: #a0522d; } .mines .n6 { color: #138a8a; } .mines .n7 { color: var(--ink); } .mines .n8 { color: var(--muted); }
@media (prefers-color-scheme: dark) { .mines .n1 { color: #7fb0ff; } .mines .n2 { color: #6fd39a; } .mines .n3 { color: #ff8080; } .mines .n4 { color: #c4a0ff; } .mines .n5 { color: #e0a070; } .mines .n6 { color: #6fdada; } }

/* Four in a row */
.c4 { position: relative; width: min(490px, 100%); margin: 0 auto; background: var(--blue); border-radius: 18px; padding: 10px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.c4 .slot { aspect-ratio: 1; border-radius: 50%; background: var(--surface); position: relative; overflow: hidden; box-shadow: inset 0 3px 6px rgba(0,0,0,.2); }
.c4 .disc { position: absolute; inset: 0; border-radius: 50%; animation: drop .35s cubic-bezier(.4,0,.6,1.4); box-shadow: inset 0 -4px 0 rgba(0,0,0,.18); }
.c4 .disc.p1 { background: var(--accent); }
.c4 .disc.p2 { background: var(--gold); }
.c4 .disc.win { outline: 4px solid var(--surface); outline-offset: -9px; }
@keyframes drop { from { transform: translateY(var(--from, -400%)); } }
.c4-cols { position: absolute; inset: 10px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.c4-cols button { border: 0; background: transparent; cursor: pointer; border-radius: 12px; padding: 0; }
.c4-cols button:hover:not(:disabled) { background: rgba(255,255,255,.15); }
.c4-cols button:disabled { cursor: default; }
.legend { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }

/* Sliding */
.slide { position: relative; width: min(420px, 100%); aspect-ratio: 1; margin: 0 auto; background: var(--surface-2); border-radius: 16px; padding: 6px; touch-action: manipulation; }
.slide-in { position: relative; width: 100%; height: 100%; }
.slide button { position: absolute; left: 0; top: 0; border: 3px solid transparent; background-clip: padding-box; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font: 800 clamp(1rem, 5vw, 1.8rem)/1 var(--display); cursor: pointer; transition: transform .12s ease-out; display: grid; place-items: center; padding: 0; box-shadow: inset 0 -4px 0 rgba(0,0,0,.15); }
.slide button.home { background: var(--teal); }
.slide.solved button { background: var(--gold); color: #1f1c17; }

/* Word guess */
.wg-balloons { display: flex; justify-content: center; gap: 8px; min-height: 64px; margin: 4px 0 8px; }
.wg-balloons svg { width: 36px; height: 58px; transition: transform .3s, opacity .3s; }
.wg-balloons svg.popped { transform: scale(1.6); opacity: 0; }
.wg-hint { text-align: center; color: var(--muted); margin: 0 0 6px; }
.wg-word { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 10px 0 18px; }
.wg-word span { width: clamp(28px, 7vw, 42px); height: clamp(38px, 9vw, 52px); border-bottom: 3px solid var(--ink); display: grid; place-items: center; font: 800 clamp(1.2rem, 5vw, 1.8rem)/1 var(--display); text-transform: uppercase; }
.wg-word span.space { border: 0; width: 14px; }
.wg-word span.miss { color: var(--bad); }
.wg-keys { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; max-width: 520px; margin: 0 auto; }
.wg-keys button { padding: 0; min-height: 44px; font: 700 1rem/1 var(--font); text-transform: uppercase; border-radius: 10px; }
.wg-keys button.hit { background: color-mix(in srgb, var(--teal) 35%, var(--surface)); }
.wg-keys button.miss { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }

/* Pattern echo */
.echo { position: relative; width: min(380px, 100%); aspect-ratio: 1; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; touch-action: manipulation; }
.echo .pad-btn { border: 0; cursor: pointer; opacity: .55; transition: opacity .1s, transform .1s, filter .1s; }
.echo .pad-btn:nth-child(1) { background: #2fa36b; border-radius: 100% 14px 14px 14px; }
.echo .pad-btn:nth-child(2) { background: #e0453a; border-radius: 14px 100% 14px 14px; }
.echo .pad-btn:nth-child(3) { background: #f0b400; border-radius: 14px 14px 14px 100%; }
.echo .pad-btn:nth-child(4) { background: #3a78d4; border-radius: 14px 14px 100% 14px; }
.echo .pad-btn.lit { opacity: 1; filter: brightness(1.25) saturate(1.2); transform: scale(.98); }
.echo .pad-btn:disabled { cursor: default; }
.echo-center { position: absolute; left: 50%; top: 50%; width: 38%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: var(--surface); border: 6px solid var(--bg); display: grid; place-items: center; text-align: center; font: 800 2rem/1 var(--display); pointer-events: none; }
.echo-center small { display: block; font: 700 .65rem/1.2 var(--font); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* Reaction */
.react { width: 100%; min-height: 320px; border: 0; border-radius: 18px; cursor: pointer; display: grid; place-items: center; text-align: center; padding: 24px; color: #fff; font-family: var(--display); transition: background .1s; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.react h2 { font-size: clamp(1.6rem, 5vw, 2.6rem); margin: 0 0 .2em; color: inherit; }
.react p { margin: 0; font: 600 1rem/1.5 var(--font); opacity: .9; }
.react.idle { background: var(--blue); }
.react.wait { background: var(--bad); }
.react.go { background: #1aa260; }
.react.early, .react.result { background: var(--ink); color: var(--bg); }
.tries { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.tries span { background: var(--surface-2); border-radius: 10px; padding: 6px 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Typing test */
.type-wrap { position: relative; }
.type-box { height: 9.6em; overflow: hidden; padding: 14px 18px; border-radius: 14px; background: var(--surface-2); font: 500 clamp(1.05rem, 3.6vw, 1.35rem)/1.75 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); cursor: text; user-select: none; -webkit-user-select: none; }
.type-box .ok { color: var(--ink); }
.type-box .bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 18%, transparent); border-radius: 3px; }
.type-box .cur { box-shadow: inset 2px 0 0 var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { box-shadow: none; } }
.type-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; resize: none; border: 0; font-size: 16px; cursor: text; }
.type-wrap:focus-within .type-box { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Checkers */
.ck { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); width: min(480px, 100%); margin: 0 auto; border: 6px solid #6b4a2b; border-radius: 10px; overflow: hidden; }
.ck button { aspect-ratio: 1; border: 0; padding: 0; display: grid; place-items: center; }
.ck .lt { background: #ecd9b8; }
.ck .dk { background: #8b5e3c; cursor: pointer; }
.ck .dk.can { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25); }
.ck .dk.sel { background: #b07a3c; }
.ck .dk.target { background: #5e8f4f; }
.ck .pc { width: 78%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25), 0 2px 3px rgba(0, 0, 0, .35); }
.ck .pc.red { background: #d63a2f; }
.ck .pc.white { background: #f4efe4; }
.ck .pc.king::after { content: "♛"; font-size: clamp(.8rem, 3.5vw, 1.4rem); color: #f2b632; text-shadow: 0 1px 1px rgba(0, 0, 0, .5); }

/* Nonogram */
.nono { display: grid; gap: 0; width: min(560px, 100%); margin: 0 auto; touch-action: none; user-select: none; -webkit-user-select: none; font-variant-numeric: tabular-nums; }
.nono .corner { min-width: 2em; }
.nono .cclue { display: flex; align-items: flex-end; justify-content: center; text-align: center; padding-bottom: 4px; font: 700 clamp(.55rem, 2vw, .8rem)/1.25 var(--font); color: var(--muted); }
.nono .rclue { display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; white-space: nowrap; font: 700 clamp(.55rem, 2vw, .8rem)/1 var(--font); color: var(--muted); letter-spacing: .05em; }
.nono .cell { aspect-ratio: 1; border: 0; padding: 0; background: var(--surface); box-shadow: inset 0 0 0 .5px var(--line); cursor: pointer; position: relative; }
.nono .cell.br { box-shadow: inset 0 0 0 .5px var(--line), inset -2px 0 0 var(--muted); }
.nono .cell.bb { box-shadow: inset 0 0 0 .5px var(--line), inset 0 -2px 0 var(--muted); }
.nono .cell.br.bb { box-shadow: inset 0 0 0 .5px var(--line), inset -2px -2px 0 var(--muted); }
.nono .cell.on { background: var(--ink); }
.nono .cell.x::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .8em; }
.nono .cell.wrong { background: color-mix(in srgb, var(--bad) 55%, var(--surface)); }
.nono.solved .cell.on { background: var(--teal); }
.nono.solved .cell.x::after { content: none; }

/* Dots and boxes */
.dab { --dot: 12px; display: grid; width: min(440px, 100%); aspect-ratio: 1; margin: 0 auto; }
.dab .dot { background: var(--ink); border-radius: 50%; }
.dab .ln { border: 0; padding: 0; background: transparent; cursor: pointer; position: relative; }
.dab .ln::before { content: ""; position: absolute; background: var(--line); border-radius: 4px; transition: background .15s; }
.dab .ln.h::before { left: 0; right: 0; top: 50%; height: 6px; transform: translateY(-50%); }
.dab .ln.v::before { top: 0; bottom: 0; left: 50%; width: 6px; transform: translateX(-50%); }
.dab .ln.h { min-height: 24px; margin: -6px 0; }
.dab .ln.v { min-width: 24px; margin: 0 -6px; }
.dab.t1 .ln:not(.on):hover::before { background: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.dab.t2 .ln:not(.on):hover::before { background: color-mix(in srgb, var(--blue) 55%, var(--line)); }
.dab .ln.on { cursor: default; }
.dab .ln.on.p1::before { background: var(--accent); }
.dab .ln.on.p2::before { background: var(--blue); }
.dab .box { display: grid; place-items: center; font: 800 clamp(.6rem, 2.5vw, .95rem)/1 var(--display); color: #fff; border-radius: 4px; margin: 4px; }
.dab .box.p1 { background: color-mix(in srgb, var(--accent) 80%, transparent); }
.dab .box.p2 { background: color-mix(in srgb, var(--blue) 80%, transparent); }

/* Misc */
.notfound { text-align: center; padding: 60px 0 20px; }
.contact-card { display: grid; gap: 6px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 1.5em; }
.contact-card a { font-size: 1.2rem; font-weight: 700; word-break: break-all; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 20px; margin: 0 0 2em; font-size: .95rem; }
.toc ol { margin: 6px 0 0; padding-left: 1.2em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
