/* Purr Board Games. Same family as Purr Puzzles (Recursive type, paper
   palette, highlighter yellow), with wooden boards and pieces that differ by
   shape and outline as well as colour. */
@font-face { font-family: Recursive; src: url(/assets/fonts/recursive.woff2) format('woff2'); font-weight: 300 1000; font-display: swap; }

:root {
  --paper: #eef3f1; --paper-2: #ffffff; --paper-3: #e2eae7; --ink: #22303a; --muted: #56666e; --line: #c4d0cc; --line-2: #9fb0ab;
  --mark: #f2c14e; --mark-soft: rgba(242, 193, 78, .45); --act: #1f6f68; --act-ink: #fff; --bad: #b3261e; --good: #2e7d4f;
  --text-scale: 1; --radius: 6px; --c-game: var(--c, #1f6f68);
  --fs-0: calc(.8125rem * var(--text-scale)); --fs-1: calc(1rem * var(--text-scale)); --fs-2: calc(1.25rem * var(--text-scale)); --fs-3: calc(1.5625rem * var(--text-scale)); --fs-4: calc(2.25rem * var(--text-scale)); --fs-5: calc(3.25rem * var(--text-scale));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] { --paper: #17212b; --paper-2: #1f2b36; --paper-3: #263441; --ink: #e6eef0; --muted: #a3b2b8; --line: #34444f; --line-2: #4d606c; --mark: #d9a93a; --mark-soft: rgba(217, 169, 58, .35); --act: #5cc3b8; --act-ink: #10201f; --bad: #ff8a80; --good: #7fd6a0; color-scheme: dark; } }
:root[data-theme="dark"] { --paper: #17212b; --paper-2: #1f2b36; --paper-3: #263441; --ink: #e6eef0; --muted: #a3b2b8; --line: #34444f; --line-2: #4d606c; --mark: #d9a93a; --mark-soft: rgba(217, 169, 58, .35); --act: #5cc3b8; --act-ink: #10201f; --bad: #ff8a80; --good: #7fd6a0; color-scheme: dark; }
:root[data-contrast="high"] { --ink: #000; --muted: #222; --line: #000; --line-2: #000; --paper: #fff; --paper-2: #fff; --paper-3: #eee; --act: #004d47; --mark: #ffd400; }
:root[data-theme="dark"][data-contrast="high"] { --ink: #fff; --muted: #eee; --line: #fff; --line-2: #fff; --paper: #000; --paper-2: #000; --paper-3: #111; --act: #7fffef; --act-ink: #000; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Recursive, system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: var(--fs-1); line-height: 1.55; font-variation-settings: 'CASL' 0; }
h1, h2, h3 { font-variation-settings: 'CASL' 1; line-height: 1.15; margin: 0 0 .5em; font-weight: 750; letter-spacing: -.01em; }
h1 { font-size: var(--fs-4); } h2 { font-size: var(--fs-3); margin-top: 1.6em; } h3 { font-size: var(--fs-2); margin-top: 1.2em; }
p, ul, ol, dl { margin: 0 0 1em; }
a { color: var(--act); text-underline-offset: .18em; }
:focus-visible { outline: 3px solid var(--act); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 1rem; top: 1rem; z-index: 99; background: var(--paper-2); padding: .5rem 1rem; }
.muted { color: var(--muted); } .small { font-size: var(--fs-0); } .fine { font-size: var(--fs-0); color: var(--muted); }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
:root[data-motion="reduce"] * { animation: none !important; transition: none !important; }

/* header / footer: contents line up with the page width, not the window edges */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 1.25rem; max-width: 1240px; margin: 0 auto; padding: .55rem clamp(1rem, 4vw, 2.5rem); }
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); flex: none; }
.brand img { height: 30px; width: auto; }
.brand-name { font-variation-settings: 'CASL' 1; font-weight: 800; font-size: var(--fs-2); }
:root[data-theme="dark"] .brand img { filter: brightness(1.6); }
.main-nav ul { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.main-nav a { display: block; padding: .4rem .7rem; color: var(--ink); text-decoration: none; border-radius: var(--radius); white-space: nowrap; }
.main-nav a:hover { background: var(--paper-3); } .main-nav a[aria-current] { box-shadow: inset 0 -3px 0 var(--mark); }
.nav-signin { display: none; }
.header-actions { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--paper-2); border-radius: 10px; color: var(--ink); cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; } :root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .theme-toggle .sun { display: none; } :root[data-theme="auto"] .theme-toggle .moon { display: block; } }
/* Sign In / Sign Up (signed out) or Account (signed in): the root gets .is-in */
.if-in { display: none !important; } :root.is-in .if-in { display: inline-flex !important; } :root.is-in .if-out { display: none !important; }
:root.is-in .nav-signin.if-in { display: none !important; }
.signin { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .45rem 1rem; background: var(--act); color: var(--act-ink); border-radius: 10px; text-decoration: none; font-weight: 700; white-space: nowrap; }
.signin.if-out { flex-direction: column; gap: 3px; padding: 5px 14px; line-height: 1.15; font-size: .84rem; position: relative; overflow: hidden; isolation: isolate; }
.signin.if-out::after { content: ""; position: absolute; top: -50%; bottom: -50%; left: -60%; width: 40%; z-index: 1; pointer-events: none; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .7), transparent); transform: skewX(-18deg); animation: shine 3.6s ease-in-out 1s infinite; }
@keyframes shine { 0%, 55% { transform: translateX(0) skewX(-18deg); } 100% { transform: translateX(420%) skewX(-18deg); } }
.signin-marks { display: inline-flex; gap: 3px; }
.signin-marks svg { width: 18px; height: 18px; padding: 2px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); }
@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; gap: .4rem .5rem; padding-top: .45rem; padding-bottom: .3rem; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .main-nav .nav-signin { display: block; } .main-nav .nav-signin a { color: var(--act); font-weight: 700; }
  :root.is-in .main-nav .nav-signin.if-in { display: block !important; }
  .header-actions .signin { display: none !important; }
  .brand-name { font-size: var(--fs-1); }
}
/* login page */
.card { border: 1.5px solid var(--line-2); border-radius: var(--radius); background: var(--paper-2); padding: 1.25rem; }
.login-card { max-width: 460px; } .login-card h2 { margin-top: 0; font-size: var(--fs-2); }
.login-card label { display: block; font-weight: 700; margin: .75rem 0 .35rem; }
.login-card .row { display: flex; gap: .5rem; flex-wrap: wrap; }
.login-card input { min-height: 44px; padding: .4rem .7rem; border: 1.5px solid var(--line-2); border-radius: var(--radius); font: inherit; background: var(--paper-2); color: var(--ink); flex: 1; min-width: 180px; }
.social-signin { display: grid; gap: .6rem; }
.social-btn { display: flex; align-items: center; justify-content: center; gap: .6rem; min-height: 46px; border: 1.5px solid var(--line-2); border-radius: var(--radius); background: var(--paper-2); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.social-btn svg { width: 20px; height: 20px; } .social-btn:disabled { opacity: .6; }
.social-apple { background: #000; color: #fff; border-color: #000; }
.social-or { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: var(--fs-0); margin: .5rem 0 0; }
.social-or::before, .social-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0; color: var(--muted); font-size: var(--fs-0); }
.site-footer > * { max-width: 1240px; margin-left: auto; margin-right: auto; padding-left: clamp(1rem, 4vw, 2.5rem); padding-right: clamp(1rem, 4vw, 2.5rem); }
.site-footer ul { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; list-style: none; padding: 0; }
main { padding: 0 clamp(1rem, 4vw, 2.5rem) 3rem; max-width: 1240px; margin: 0 auto; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .55rem 1.1rem; background: var(--act); color: var(--act-ink); border: 1.5px solid var(--act); border-radius: var(--radius); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn:disabled { opacity: .55; cursor: default; }
.linklike { background: none; border: 0; padding: 0; color: var(--act); font: inherit; text-decoration: underline; cursor: pointer; }
.linklike.danger { color: var(--bad); }

/* home */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: center; padding: clamp(2rem, 6vw, 4.5rem) 0 2.5rem; }
.hero h1 { font-size: var(--fs-5); max-width: 16ch; font-weight: 800; }
.lede { font-size: var(--fs-2); color: var(--muted); max-width: 52ch; line-height: 1.45; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero-board { margin: 0; padding: 1.5rem; background-color: var(--paper-2); background-image: linear-gradient(var(--paper-3) 1px, transparent 1px), linear-gradient(90deg, var(--paper-3) 1px, transparent 1px); background-size: 22px 22px; border: 1.5px solid var(--ink); border-radius: 4px; box-shadow: 6px 6px 0 var(--mark); }
.hero-board figcaption { margin-top: 1rem; font-size: var(--fs-0); color: var(--muted); }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } .hero h1 { font-size: var(--fs-4); } }

.tiles { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); border-top: 1.5px solid var(--ink); border-left: 1.5px solid var(--ink); }
.tile { border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); background: var(--paper-2); }
.tile-link { display: grid; grid-template-rows: auto auto 1fr auto; gap: .35rem; height: 100%; padding: 1.1rem 1.1rem 1rem; color: var(--ink); text-decoration: none; min-height: 190px; position: relative; }
a.tile-link:hover { background: color-mix(in srgb, var(--c) 8%, var(--paper-2)); }
.tile-glyph { width: 52px; height: 52px; display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 800; font-size: 1.4rem; border-radius: 4px; font-variation-settings: 'CASL' 1; }
.tile-name { font-weight: 800; font-size: var(--fs-2); font-variation-settings: 'CASL' 1; }
.tile-tag { color: var(--muted); font-size: var(--fs-0); }
.tile-status { font-size: var(--fs-0); font-weight: 700; color: var(--c); }
.tiles-soon .tile { background: transparent; }
.tiles-soon .tile-link { min-height: 140px; } .tiles-soon .tile-glyph { background: transparent; color: var(--c); border: 1.5px dashed var(--c); }
.tiles-soon .tile-status { color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 2rem; }
.facts dt { font-weight: 800; font-variation-settings: 'CASL' 1; font-size: var(--fs-2); } .facts dd { margin: 0; color: var(--muted); }

/* game page */
.game-head { display: flex; gap: 1.5rem; align-items: flex-start; padding: 2.5rem 0 1rem; }
.game-glyph { flex: none; width: 88px; height: 88px; display: grid; place-items: center; background: var(--c); color: #fff; font-size: 2.2rem; font-weight: 800; border-radius: 6px; box-shadow: 5px 5px 0 var(--ink); }
.journey { list-style: none; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem; }
.lv-link { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; gap: 0 .7rem; padding: .7rem .8rem; background: var(--paper-2); border: 1.5px solid var(--line-2); border-radius: var(--radius); color: var(--ink); text-decoration: none; height: 100%; }
.lv-n { grid-row: 1 / 4; width: 2.1rem; height: 2.1rem; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 50%; font-weight: 800; font-variant-numeric: tabular-nums; }
.lv-label { font-weight: 750; display: block; } .lv-spec { display: block; font-size: var(--fs-0); color: var(--muted); }
.lv-state { font-size: var(--fs-0); font-weight: 700; margin-top: .25rem; }
.lv-pips { display: flex; gap: 4px; margin-top: .3rem; } .lv-pips i { width: 18px; height: 6px; border-radius: 3px; background: var(--paper-3); border: 1px solid var(--line-2); } .lv-pips i.on { background: var(--c); border-color: var(--c); }
.lv-expert .lv-link { border-color: var(--ink); border-width: 2px; } .lv-expert .lv-n { background: var(--ink); color: var(--paper-2); }
.lv.is-locked .lv-link { opacity: .62; border-style: dashed; }
.lv.is-passed .lv-n { background: var(--c); border-color: var(--c); color: #fff; }
.lv.is-mastery .lv-n::after { content: '◆'; position: absolute; font-size: .6rem; transform: translate(14px, -14px); color: var(--mark); }
.prose, .prose-wide { max-width: 70ch; } .prose-wide { max-width: 980px; }
.prose { padding-top: 1rem; }
.strategy div { margin-bottom: .9rem; } .strategy dt { font-weight: 750; } .strategy dd { margin: 0; }
.related { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.related li { border-left: 3px solid var(--line-2); padding-left: .75rem; } .related a { font-weight: 750; display: block; } .related span { font-size: var(--fs-0); color: var(--muted); }

/* play screen */
.play { padding-top: 1.25rem; position: relative; }
.play-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; align-items: flex-end; margin-bottom: 1rem; }
.play-head h1 { font-size: var(--fs-3); margin: 0; } .crumb { margin: 0; font-size: var(--fs-0); } .play-objective { margin: .25rem 0 0; color: var(--muted); font-size: var(--fs-0); }
.play-meta { display: flex; gap: 1.25rem; margin: 0; } .play-meta dt { font-size: var(--fs-0); color: var(--muted); } .play-meta dd { margin: 0; font-weight: 750; font-variant-numeric: tabular-nums; }
.play-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .play-body { grid-template-columns: 1fr; } .play-meta { gap: .9rem; flex-wrap: wrap; } }
.board-wrap { background: var(--paper-2); border: 1.5px solid var(--ink); border-radius: 4px; padding: clamp(.5rem, 2vw, 1.25rem); overflow: auto; container-type: inline-size; }
.board { width: 100%; display: flex; flex-direction: column; align-items: safe center; }
.loading, .notice { color: var(--muted); padding: 2rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tool { min-height: 44px; padding: .45rem .8rem; border: 1.5px solid var(--line-2); background: var(--paper-2); color: var(--ink); border-radius: var(--radius); font: inherit; font-weight: 650; cursor: pointer; }
.tool-hint { border-color: var(--ink); background: var(--mark-soft); }
.controls { margin-bottom: 1rem; }
.hint-panel { border: 1.5px solid var(--ink); background: var(--paper-2); padding: 1rem; border-radius: var(--radius); margin-bottom: 1rem; box-shadow: 4px 4px 0 var(--mark); }
.hint-panel h2 { font-size: var(--fs-2); margin-top: 0; } .hint-panel dt { font-weight: 700; } .hint-panel dd { margin: 0 0 .5rem; }
.hint-where { font-weight: 700; }
.rules-mini summary { cursor: pointer; font-weight: 700; } .other { font-size: var(--fs-0); }
.pause-cover { position: absolute; inset: 0; display: grid; place-content: center; gap: 1rem; text-align: center; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); z-index: 5; font-size: var(--fs-3); font-weight: 800; }
.is-paused .board { filter: blur(10px); }
.locked { max-width: 60ch; padding: 1rem; }
.pad { display: flex; flex-wrap: wrap; gap: .35rem; }
.pad-key { min-width: 44px; min-height: 44px; border: 1.5px solid var(--line-2); background: var(--paper-2); color: var(--ink); border-radius: var(--radius); font: inherit; font-size: var(--fs-2); font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; }
.pad-wide { font-size: var(--fs-1); padding: 0 .8rem; } .pad-key[aria-pressed="true"] { background: var(--ink); color: var(--paper-2); }
.dpad { display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(3, 52px); gap: 4px; margin: .75rem 0; }
.dpad button { border: 1.5px solid var(--line-2); background: var(--paper-2); color: var(--ink); border-radius: var(--radius); font-size: 1.3rem; cursor: pointer; }
.dpad-U { grid-area: 1 / 2; } .dpad-L { grid-area: 2 / 1; } .dpad-R { grid-area: 2 / 3; } .dpad-D { grid-area: 3 / 2; }
.zoom { display: flex; gap: .5rem; align-items: center; font-size: var(--fs-0); margin-top: .5rem; }

/* dialogs, toast */
.dlg { border: 1.5px solid var(--ink); border-radius: 6px; padding: 0; background: var(--paper-2); color: var(--ink); max-width: min(560px, 94vw); width: 100%; box-shadow: 8px 8px 0 var(--mark); }
.dlg::backdrop { background: rgba(20, 28, 34, .45); }
.dlg-inner { padding: 1.4rem 1.4rem 1.2rem; position: relative; max-height: 88vh; overflow: auto; }
.dlg-inner h2 { margin-top: 0; padding-right: 2rem; }
.dlg-x { position: absolute; top: .6rem; right: .6rem; width: 40px; height: 40px; border: 0; background: none; font-size: 1.6rem; cursor: pointer; color: var(--ink); }
.dlg-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.stars { font-size: 2.6rem; color: #c9892d; margin: 0; letter-spacing: .1em; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; } .result-stats dt { font-size: var(--fs-0); color: var(--muted); } .result-stats dd { margin: 0; font-weight: 750; }
@media (max-width: 480px) { .result-stats { grid-template-columns: repeat(2, 1fr); } }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: .7rem 1.1rem; border-radius: 99px; z-index: 50; max-width: 90vw; }
.settings fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 .75rem; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.settings label, .check { display: flex; align-items: center; gap: .35rem; min-height: 36px; }

/* account */
.signin .row { display: flex; gap: .5rem; flex-wrap: wrap; } .signin input { min-height: 44px; padding: .4rem .7rem; border: 1.5px solid var(--line-2); border-radius: var(--radius); font: inherit; background: var(--paper-2); color: var(--ink); flex: 1; min-width: 200px; }
.signin label { display: block; font-weight: 700; margin: .75rem 0 .35rem; } .err { color: var(--bad); }
.table-scroll { overflow-x: auto; }
.ach { border-collapse: collapse; } .ach th, .ach td { border: 1px solid var(--line); padding: .35rem .55rem; text-align: center; } .ach th[scope="row"] { text-align: left; }
.ach td.p { background: color-mix(in srgb, var(--act) 18%, var(--paper-2)); } .ach td.m { background: var(--mark-soft); font-weight: 800; }
.ach caption { caption-side: bottom; font-size: var(--fs-0); color: var(--muted); padding-top: .5rem; text-align: left; }
.faq dt { font-weight: 750; margin-top: 1rem; } .faq dd { margin: 0; }

/* pricing */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.plan { border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: 1.25rem; background: var(--paper-2); }
.plan-best { border-color: var(--ink); box-shadow: 5px 5px 0 var(--mark); }
.plan h2 { margin-top: 0; } .price { font-size: var(--fs-4); font-weight: 800; margin: .25rem 0 .75rem; } .price span { font-size: var(--fs-1); color: var(--muted); font-weight: 500; }
.compare { width: 100%; border-collapse: collapse; margin: 1.5rem 0; } .compare caption { text-align: left; font-weight: 750; margin-bottom: .5rem; }
.compare th, .compare td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.pay-methods { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ads (free visitors only) */
.ad-slot { margin: 1.25rem auto; text-align: center; }
.ad-slot.ad-empty { display: none; }
.ad-label { display: block; font-size: .7rem; color: var(--muted); margin-bottom: .2rem; }
.ad-box { display: flex; justify-content: center; min-height: 50px; } @media (min-width: 740px) { .ad-box { min-height: 90px; } }
.ad-rect .ad-box { min-height: 250px; }
.ad-frame { border: 0; display: block; max-width: 100%; background: transparent; }
.ad-rect .ad-box { min-height: 250px; }
.is-locked .play-meta, .is-locked .play-side { display: none; }

.save-card { border: 2px solid var(--ink); border-radius: var(--radius); background: var(--mark-soft); padding: .9rem 1rem; margin: 1rem 0 0; }
.save-card h3 { margin: 0 0 .35rem; font-size: var(--fs-2); } .save-card p { margin: 0 0 .75rem; }

/* ---------- board games ---------- */
:root { --wood: #e7c38c; --wood-2: #d9ae6c; --wood-line: #6b4a24; --sq-light: #f3e3c3; --sq-dark: #a4764a; --rv-green: #2f7d4f; --rv-line: #1d5236; --c4-blue: #2b5ea8; --legal: rgba(34, 48, 58, .38); --last: #f2c14e; }
:root[data-theme="dark"] { --sq-light: #d9c6a1; --sq-dark: #8a6340; --wood: #c9a46d; --wood-2: #b98f55; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] { --sq-light: #d9c6a1; --sq-dark: #8a6340; --wood: #c9a46d; --wood-2: #b98f55; } }

/* hub tiles with the level 1 board */
.tile-img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: #f6f3ee; }
.tile-link { min-height: 0; }
.game-head { display: grid; grid-template-columns: minmax(200px, 320px) minmax(0, 1fr); gap: clamp(1rem, 4vw, 2.5rem); align-items: center; padding: 2rem 0 .5rem; }
.game-board { margin: 0; } .game-board img, .hero-board img { width: 100%; height: auto; border-radius: 4px; display: block; }
.game-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
@media (max-width: 700px) { .game-head { grid-template-columns: 1fr; } .game-board { max-width: 340px; } }

/* ten-level ladder */
.ladder { list-style: none; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .6rem; }
.rung-link { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; padding: .75rem .85rem; background: var(--paper-2); border: 1.5px solid var(--line-2); border-radius: var(--radius); color: var(--ink); text-decoration: none; height: 100%; }
.rung-n { grid-row: 1 / 3; width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 50%; font-weight: 800; }
.rung-name { display: block; font-weight: 750; } .rung-goal { display: block; font-size: var(--fs-0); } .rung-meta { display: block; font-size: var(--fs-0); color: var(--muted); }
.rung-state { grid-column: 2; font-size: var(--fs-0); font-weight: 800; }
.rung[data-state="cleared"] .rung-n { background: var(--c); border-color: var(--c); color: #fff; } .rung[data-state="cleared"] .rung-state::before { content: '✓ '; }
.rung[data-state="available"] .rung-link { border-color: var(--ink); } .rung[data-state="available"] .rung-state { color: var(--act); }
.rung[data-state="locked"] .rung-link { border-style: dashed; opacity: .75; } .rung[data-state="locked"] .rung-state::before { content: '🔒 '; }
.rung[data-state="premium"] .rung-n { background: var(--ink); color: var(--paper-2); } .rung[data-state="premium"] .rung-state::before { content: '★ '; } .rung[data-state="premium"] .rung-state { color: #9a6b00; }

/* play layout: the board first; on phones the controls sit right beneath it */
.play-head { display: block; } .play-head h1 { margin: .15rem 0 .35rem; } .play-goal { margin: 0 0 .25rem; }
.play-body { grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); }
.board-col { min-width: 0; }
.status { min-height: 1.6em; font-weight: 650; margin-bottom: .5rem; }
.board-wrap { padding: clamp(.35rem, 1.5vw, 1rem); }
.board-preview { max-width: min(520px, 100%); height: auto; } .board-preview.dim { opacity: .55; }
.controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .75rem 0 1rem; }
.tool-quiet { background: transparent; } .tool:disabled { opacity: .5; cursor: default; }
.clock-box { display: flex; gap: 1.5rem; margin: 0 0 1rem; } .clock-box dt { font-size: var(--fs-0); color: var(--muted); } .clock-box dd { margin: 0; font-size: var(--fs-3); font-weight: 800; font-variant-numeric: tabular-nums; }
.clock-box dd.low { color: var(--bad); }
.move-list { max-height: 260px; overflow: auto; padding-left: 0; list-style: none; font-size: var(--fs-0); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2); margin-bottom: 1rem; }
.move-list:empty { display: none; } .move-list li { padding: .2rem .6rem; } .move-list li:nth-child(odd) { background: var(--paper-3); } .mv-n { color: var(--muted); font-variant-numeric: tabular-nums; } .mv-me { font-weight: 650; }
@media (max-width: 900px) { .play-body { grid-template-columns: 1fr; } .move-list { max-height: 140px; } }

/* shared board */
.bd { --size: min(560px, 100cqw - 2rem, 70vh); display: inline-grid; grid-template-columns: 1.4rem auto; grid-template-rows: auto 1.4rem; gap: 2px; font-size: var(--fs-0); color: var(--muted); }
.bd-ranks { grid-column: 1; grid-row: 1; display: grid; grid-template-rows: repeat(var(--rows), 1fr); align-items: center; text-align: right; padding-right: 3px; }
.bd-files { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(var(--cols), 1fr); text-align: center; }
.no-coords .bd-ranks, .no-coords .bd-files { visibility: hidden; }
.bd-grid { grid-column: 2; grid-row: 1; width: var(--size); aspect-ratio: var(--cols) / var(--rows); display: grid; grid-template-rows: repeat(var(--rows), 1fr); border: 2px solid var(--ink); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.bd-row { display: grid; grid-template-columns: repeat(var(--cols), 1fr); }
.cell { position: relative; border: 0; padding: 0; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; font: inherit; cursor: pointer; display: grid; place-items: center; min-width: 0; min-height: 0; color: inherit; }
.bd-grid.is-disabled .cell { cursor: default; }
.cell:focus-visible { outline: 3px solid var(--act); outline-offset: -3px; z-index: 2; }
.pc { pointer-events: none; }

/* squares (chess, checkers) */
.bd-k-square .cell.light { background: var(--sq-light); } .bd-k-square .cell.dark { background: var(--sq-dark); }
.bd-reversi .cell { background: var(--rv-green) !important; box-shadow: inset 0 0 0 .5px var(--rv-line); }
.bd-reversi .bd-grid { border-color: var(--rv-line); border-width: 3px; }
.cell.is-last { box-shadow: inset 0 0 0 3px var(--last); } .bd-reversi .cell.is-last { box-shadow: inset 0 0 0 .5px var(--rv-line), inset 0 0 0 3px var(--last); }
.cell.is-sel { box-shadow: inset 0 0 0 4px var(--act); }
.cell.is-hint { box-shadow: inset 0 0 0 4px var(--bad); }
.cell.is-legal::after { content: ''; position: absolute; width: 26%; height: 26%; border-radius: 50%; background: var(--legal); }
.cell.is-legal:has(.pc)::after { width: 86%; height: 86%; background: transparent; border: 3px solid var(--legal); }
.bd-reversi .cell.is-legal::after { background: rgba(255, 255, 255, .45); }

/* chess pieces: White outlined, Black filled, so they differ by shape as well as colour */
.cp { font-size: calc(var(--size) / 8 * .78); line-height: 1; font-family: 'Segoe UI Symbol', 'Noto Sans Symbols 2', 'DejaVu Sans', system-ui, sans-serif; }
.cp-w { color: #14191d; text-shadow: 0 0 2px #fff, 0 0 3px #fff, 0 0 4px #fff; }
.cp-b { color: #14191d; text-shadow: 0 0 2px rgba(255, 255, 255, .55); }

/* checkers: white men have a dark rim and inner ring, black men are solid; kings carry a crown */
.man { width: 78%; height: 78%; border-radius: 50%; display: grid; place-items: center; font-size: calc(var(--size) / 8 * .42); line-height: 1; }
.man-b { background: radial-gradient(circle at 35% 30%, #59646d, #1b2329 70%); border: 2px solid #000; color: #f2c14e; }
.man-w { background: radial-gradient(circle at 35% 30%, #fff, #e6dccb 70%); border: 2px solid #4b3a28; box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 5.5px #b9a68a; color: #8a5a00; }

/* stones: black solid, white with a dark outline */
.stone { width: 86%; height: 86%; border-radius: 50%; }
.stone-b { background: radial-gradient(circle at 35% 30%, #5b6670, #10161b 65%); box-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.stone-w { background: radial-gradient(circle at 35% 30%, #fff, #d9d4c7 75%); border: 1.5px solid #3b3b3b; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.bd-reversi .stone { width: 80%; height: 80%; }

/* intersections (go, gomoku): lines through the middle of each cell */
.bd-k-grid .bd-grid { background: var(--wood); border-color: var(--wood-line); }
.bd-k-grid .cell { --l: var(--wood-line); }
.bd-k-grid .cell::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(var(--l), var(--l)) center / 1.2px 100% no-repeat, linear-gradient(var(--l), var(--l)) center / 100% 1.2px no-repeat; }
.cell.edge-t::before { background: linear-gradient(var(--l), var(--l)) center bottom / 1.2px 50% no-repeat, linear-gradient(var(--l), var(--l)) center / 100% 1.2px no-repeat !important; }
.cell.edge-b::before { background: linear-gradient(var(--l), var(--l)) center top / 1.2px 50% no-repeat, linear-gradient(var(--l), var(--l)) center / 100% 1.2px no-repeat !important; }
.cell.edge-l::before { background: linear-gradient(var(--l), var(--l)) center / 1.2px 100% no-repeat, linear-gradient(var(--l), var(--l)) right center / 50% 1.2px no-repeat !important; }
.cell.edge-r::before { background: linear-gradient(var(--l), var(--l)) center / 1.2px 100% no-repeat, linear-gradient(var(--l), var(--l)) left center / 50% 1.2px no-repeat !important; }
.cell.edge-t.edge-l::before { background: linear-gradient(var(--l), var(--l)) center bottom / 1.2px 50% no-repeat, linear-gradient(var(--l), var(--l)) right center / 50% 1.2px no-repeat !important; }
.cell.edge-t.edge-r::before { background: linear-gradient(var(--l), var(--l)) center bottom / 1.2px 50% no-repeat, linear-gradient(var(--l), var(--l)) left center / 50% 1.2px no-repeat !important; }
.cell.edge-b.edge-l::before { background: linear-gradient(var(--l), var(--l)) center top / 1.2px 50% no-repeat, linear-gradient(var(--l), var(--l)) right center / 50% 1.2px no-repeat !important; }
.cell.edge-b.edge-r::before { background: linear-gradient(var(--l), var(--l)) center top / 1.2px 50% no-repeat, linear-gradient(var(--l), var(--l)) left center / 50% 1.2px no-repeat !important; }
.cell.star::after { content: ''; position: absolute; width: 14%; height: 14%; border-radius: 50%; background: var(--wood-line); }
.bd-k-grid .cell .stone { position: relative; z-index: 1; }
.bd-k-grid .cell.is-last .stone { box-shadow: 0 0 0 3px var(--last); }
.bd-k-grid .cell.is-last { box-shadow: none; }
.bd-k-grid .cell.is-line .stone { outline: 3px dashed var(--bad); outline-offset: 2px; }
.cell.is-dead .stone { opacity: .45; } .cell.is-dead::after { content: '✕'; position: absolute; z-index: 2; color: var(--bad); font-weight: 900; font-size: 1.1em; background: none; width: auto; height: auto; }
.cell.area-B::after { content: ''; position: absolute; width: 30%; height: 30%; background: #10161b; z-index: 1; border-radius: 0; }
.cell.area-W::after { content: ''; position: absolute; width: 30%; height: 30%; background: #fff; border: 1px solid #333; z-index: 1; border-radius: 0; }
.cell.is-target .stone { outline: 3px solid var(--bad); outline-offset: 1px; }
.libs { position: absolute; z-index: 3; font-size: .72em; font-weight: 800; color: #fff; text-shadow: 0 0 2px #000; pointer-events: none; }
.stone-w ~ .libs, .cell:has(.stone-w) .libs { color: #000; text-shadow: 0 0 2px #fff; }
.bd-go, .bd-gomoku { --size: min(560px, 100cqw - 2rem, 70vh); }

/* connect four: blue frame with holes; red solid, yellow with a ring */
.bd-k-columns .bd-grid { background: var(--c4-blue); border-color: #173c70; border-radius: 6px; }
.bd-k-columns .cell { background: transparent; }
.bd-k-columns .cell::after { content: ''; position: absolute; inset: 9%; border-radius: 50%; background: var(--paper); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .35); }
.bd-k-columns .cell.is-legal::after { background: var(--paper); box-shadow: inset 0 0 0 3px var(--mark), inset 0 2px 4px rgba(0, 0, 0, .35); width: auto; height: auto; border: 0; }
.disc { position: relative; z-index: 1; width: 82%; height: 82%; border-radius: 50%; }
.disc-r { background: radial-gradient(circle at 35% 30%, #ff6b5e, #b3261e 70%); box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .25); }
.disc-y { background: radial-gradient(circle at 35% 30%, #fff3a6, #e0b400 70%); box-shadow: inset 0 0 0 5px #e0b400, inset 0 0 0 8px #fff3a6, inset 0 0 0 9.5px #a07d00; }
.bd-k-columns .cell.is-last .disc { outline: 3px solid #fff; outline-offset: 1px; }
.bd-k-columns .cell.is-line .disc { outline: 3px dashed #fff; outline-offset: 2px; }
.bd-k-columns .bd-files { font-weight: 700; color: var(--ink); }
.bd-k-columns .bd-ranks { visibility: hidden; }

/* results, prompts, locked levels */
.results { margin-top: 1.5rem; }
.result-card { border: 2px solid var(--ink); border-radius: var(--radius); background: var(--paper-2); padding: 1.1rem 1.25rem; box-shadow: 5px 5px 0 var(--mark); max-width: 760px; }
.result-card.is-clear { border-color: var(--good); box-shadow: 5px 5px 0 var(--good); } .result-card h2 { margin-top: 0; }
.result-card h2:focus { outline: none; }
.result-why { font-size: var(--fs-2); }
.result-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .5rem 1.25rem; } .result-facts dt { font-size: var(--fs-0); color: var(--muted); } .result-facts dd { margin: 0; font-weight: 650; }
.result-actions, .row-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.upsell { border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1.25rem 0; max-width: 760px; background: var(--paper-2); }
.upsell h3 { margin-top: 0; }
.preview-levels { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.preview-levels li { display: grid; gap: .25rem; font-size: var(--fs-0); } .preview-levels img { width: 100%; height: auto; border-radius: 4px; }
.upsell-inline { position: relative; border-left: 4px solid var(--mark); padding: .6rem 2.6rem .6rem .9rem; margin: 1rem 0; background: var(--paper-2); max-width: 760px; } .upsell-inline p { margin: 0; }
.locked-card { border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 1.1rem 1.25rem; background: var(--paper-2); max-width: 680px; }
.locked-card h2 { margin-top: 0; }
.price-pair { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: baseline; font-size: var(--fs-2); } .price-pair span { color: var(--muted); font-size: var(--fs-1); }
.go-settle { flex-basis: 100%; border: 1.5px solid var(--ink); border-radius: var(--radius); padding: .8rem 1rem; background: var(--paper-2); }
.promo { display: flex; gap: .5rem; flex-wrap: wrap; }
.pricing .price { font-size: var(--fs-3); }

/* progress and stats */
.data { border-collapse: collapse; width: 100%; margin-bottom: 1rem; } .data th, .data td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; } .data thead th { font-size: var(--fs-0); color: var(--muted); }
.adv h3 { margin-top: 1.5rem; } .adv h4 { margin: 1rem 0 .4rem; }
.adv-preview { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.adv-card { border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: .9rem; background: var(--paper-2); } .adv-card h3 { margin: 0 0 .35rem; font-size: var(--fs-1); } .adv-card p { font-size: var(--fs-0); }
.adv-blur { display: grid; gap: 6px; filter: blur(2px); } .adv-blur span { height: 10px; border-radius: 4px; background: var(--paper-3); } .adv-blur span:nth-child(1) { width: 80%; } .adv-blur span:nth-child(2) { width: 55%; } .adv-blur span:nth-child(3) { width: 68%; }
.bars { display: grid; grid-template-columns: repeat(8, 1fr); gap: .5rem; align-items: end; height: 140px; max-width: 560px; }
.bar { display: grid; grid-template-rows: 1fr auto; height: 100%; text-align: center; font-size: .7rem; color: var(--muted); }
.bar-games { align-self: end; background: var(--paper-3); border: 1px solid var(--line-2); display: flex; align-items: flex-end; min-height: 2px; }
.bar-clears { width: 100%; background: var(--act); }
.notice { padding: .75rem 1rem; border-left: 4px solid var(--mark); background: var(--paper-2); }

/* review */
.review-note { min-height: 4.5em; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; background: var(--paper-2); margin-bottom: 1rem; }
.critical ol { padding-left: 1.2rem; }
.controls input[type="range"] { flex: 1; min-width: 140px; }
