/* Blunder Gym's shared look, used by every page (the app, checkout, gift, puzzle, opening pages, legal pages):
   the tokens (colour, type, spacing, radius, shadow, icon size) and the shared components (header, footer, buttons,
   fields, cards, pills, callouts). Page-specific styles stay in each page. See styleguide.html. */
@import url('https://fonts.bunny.net/css?family=inter:400,500,600,700|fraunces:500,600,700|ibm-plex-mono:400,500&display=swap');

/* ---------- tokens ---------- */
:root {
  color-scheme: light dark;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif; /* headings: a book serif (the Nov 2026 "Scoresheet" look) */
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; /* labels and numbers */
  --bg: #f5f1e8; --bg-2: #efe9dc; --surface: #fffdf8; --surface-2: #faf6ee; --surface-3: #ece6d8; --seg-on: #fffdf8;
  --text: #1b1a17; --text-2: #3b3832; --muted: #625d53; --line: #e0d9c9; --line-2: #cbc2ae;
  --accent: #2d6a4a; --accent-2: #23553b; --on-accent: #ffffff; --accent-soft: #e6efe8; --accent-ink: #2d6a4a; --accent-bright: #3f8a62;
  --gold: #f59e0b; --gold-soft: #fef3c7; --gold-ink: #b45309;
  --bad: #dc2626; --bad-soft: #fef2f2; --bad-ink: #b91c1c;
  --orange: #f97316; --orange-soft: #fff7ed; --orange-ink: #c2410c;
  --eval-white: #fafafa; --eval-black: #27272a; /* White's and Black's share in the eval bar and graph */
  /* feature colours: each part of the site has its own (an icon chip, a tint across its card, a coloured edge) */
  --emerald: #059669; --sky: #0284c7; --violet: #7c3aed; --indigo: #4f46e5; --rose: #e11d48; --teal: #0d9488; --amber: #d97706;
  --bar: #4f46e5; /* the patterns chart: one series, one colour */
  --ph-1: #818cf8; --ph-2: #4f46e5; --ph-3: #312e81; /* game phases: one indigo ramp; both checked with the dataviz validator */
  --hl: linear-gradient(100deg, #059669, #0284c7 55%, #7c3aed);
  --feature: radial-gradient(140% 120% at 100% 0%, #10b981 0%, #059669 38%, #064e3b 100%);
  --shadow-1: none; /* flat: rules and borders instead of shadows */
  --shadow-2: none;
  --shadow-3: 0 2px 4px rgb(9 9 11 / .04), 0 24px 48px -20px rgb(9 9 11 / .26);
  --shadow-board: none;
  --ring: rgb(5 150 105 / .28);
  --checker: rgb(9 9 11 / .035);
  --glow: rgb(16 185 129 / .2); --glow-2: rgb(245 158 11 / .14); --glow-3: rgb(14 165 233 / .18); --glow-4: rgb(139 92 246 / .16);
  --cta: linear-gradient(120deg, #047857 0%, #0e7490 48%, #6d28d9 100%);
  --grain: 0;
  /* icons used as CSS masks */
  --ic-check: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='m8.5 12.5 2.5 2.5 5-5.5'/></svg>");
  --ic-x: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='m15 9-6 6M9 9l6 6'/></svg>");
  --ic-bulb: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 18h6M10 22h4M15.1 14c.2-1 .7-1.7 1.5-2.5A6 6 0 1 0 7.4 11.5c.8.8 1.3 1.5 1.5 2.5'/></svg>");
  --ic-info: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 16v-4M12 8h.01'/></svg>");
  --ic-voice: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M11 5 6 9H2v6h4l5 4zM15.5 8.5a5 5 0 0 1 0 7M19 5a10 10 0 0 1 0 14'/></svg>");
  --ic-warn: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='m21.7 18-8-14a2 2 0 0 0-3.4 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.7-3Z'/><path d='M12 9v4M12 17h.01'/></svg>");
  --ic-chevron: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  /* scales: spacing 8/16/24/40/64, one radius scale, two shadow levels, one icon size */
    --space-1: 8px; --space-2: 16px; --space-3: 24px; --space-4: 40px; --space-5: 64px;
    --radius-sm: 4px; --radius: 6px; --radius-lg: 8px; --radius-pill: 99px;
    --shadow-sm: var(--shadow-1); --shadow-md: var(--shadow-2); /* --shadow-3 and --shadow-board are for floating things and boards only */
    --icon: 20px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12110f; --bg-2: #171613; --surface: #1a1916; --surface-2: #1f1d1a; --surface-3: #26241f; --seg-on: #302d28;
    --text: #f2ede3; --text-2: #d8d1c4; --muted: #a59e90; --line: #2b2924; --line-2: #3a3731;
    --accent: #7cc59b; --accent-2: #a3d9b9; --on-accent: #0f2418; --accent-soft: #1c2a22; --accent-ink: #a3d9b9; --accent-bright: #7cc59b;
    --gold: #fbbf24; --gold-soft: #2b2108; --gold-ink: #fcd34d;
    --bad: #f87171; --bad-soft: #3a1515; --bad-ink: #fca5a5;
    --orange: #fb923c; --orange-soft: #36200f; --orange-ink: #fdba74;
    --eval-white: #e4e4e7; --eval-black: #050506;
    --emerald: #34d399; --sky: #38bdf8; --violet: #a78bfa; --indigo: #818cf8; --rose: #fb7185; --teal: #2dd4bf; --amber: #fbbf24;
    --bar: #7477f4;
    --ph-1: #4338ca; --ph-2: #6366f1; --ph-3: #a5b4fc;
    --hl: linear-gradient(100deg, #34d399, #38bdf8 50%, #c4b5fd);
    --feature: radial-gradient(140% 120% at 100% 0%, #10b981 0%, #047857 40%, #022c22 100%);
    --shadow-1: none;
    --shadow-2: none;
    --shadow-3: inset 0 1px 0 rgb(255 255 255 / .04), 0 28px 60px -24px rgb(0 0 0 / .9);
    --shadow-board: none;
    --ring: rgb(16 185 129 / .35);
    --checker: rgb(255 255 255 / .025);
    --glow: rgb(16 185 129 / .2); --glow-2: rgb(251 191 36 / .1); --glow-3: rgb(56 189 248 / .17); --glow-4: rgb(167 139 250 / .18);
    --cta: linear-gradient(120deg, #047857 0%, #0e7490 48%, #6d28d9 100%);
    --grain: 0;
  }
}

/* ---------- the player's colour choices (Account › Settings) ----------
   <html data-board="wood" data-accent="blue">, set before first paint by a small script in the page's head. No attribute
   is the default green. The same attribute on a swatch button gives that button the theme's colours. */
:root, [data-board=""] { --sq-light: #f0e6d2; --sq-dark: #4a7c59; --sq-prev: rgb(246 214 60 / .5); --sq-sel: rgb(246 214 60 / .7); --sq-arrow: rgb(36 100 214 / .8); --sq-dot: rgb(0 0 0 / .16); }
[data-board="wood"] { --sq-light: #f0d9b5; --sq-dark: #b58863; }
[data-board="blue"] { --sq-light: #e6edf2; --sq-dark: #5b83a6; --sq-arrow: rgb(234 106 12 / .88); } /* a blue arrow would vanish */
[data-board="grey"] { --sq-light: #e6e6e3; --sq-dark: #8b8f94; }
[data-board="contrast"] { --sq-light: #ffffff; --sq-dark: #64748b; --sq-prev: rgb(250 204 21 / .7); --sq-sel: rgb(250 204 21 / .92); --sq-arrow: rgb(234 106 12 / .92); --sq-dot: rgb(0 0 0 / .3); }

:root { --accent-deep: #2d6a4a; } /* the dark end of the accent, the same in light and dark mode */
[data-accent=""] { --accent: #2d6a4a; --accent-2: #23553b; --on-accent: #ffffff; --accent-soft: #e6efe8; --accent-ink: #2d6a4a; --accent-bright: #3f8a62; --accent-deep: #2d6a4a; }
[data-accent="blue"] { --accent: #1d4ed8; --accent-2: #1e40af; --on-accent: #ffffff; --accent-soft: #eff6ff; --accent-ink: #1d4ed8; --accent-bright: #2563eb; --accent-deep: #1d4ed8; }
[data-accent="purple"] { --accent: #6d28d9; --accent-2: #5b21b6; --on-accent: #ffffff; --accent-soft: #f5f3ff; --accent-ink: #6d28d9; --accent-bright: #7c3aed; --accent-deep: #6d28d9; }
[data-accent="pink"] { --accent: #be185d; --accent-2: #9d174d; --on-accent: #ffffff; --accent-soft: #fdf2f8; --accent-ink: #be185d; --accent-bright: #db2777; --accent-deep: #be185d; }
[data-accent="graphite"] { --accent: #27272a; --accent-2: #3f3f46; --on-accent: #ffffff; --accent-soft: #f4f4f5; --accent-ink: #27272a; --accent-bright: #52525b; --accent-deep: #27272a; }
@media (prefers-color-scheme: dark) {
  [data-accent=""] { --accent: #7cc59b; --accent-2: #a3d9b9; --on-accent: #0f2418; --accent-soft: #1c2a22; --accent-ink: #a3d9b9; --accent-bright: #7cc59b; }
  [data-accent="blue"] { --accent: #60a5fa; --accent-2: #93c5fd; --on-accent: #0a1a3a; --accent-soft: #10203f; --accent-ink: #93c5fd; --accent-bright: #60a5fa; }
  [data-accent="purple"] { --accent: #a78bfa; --accent-2: #c4b5fd; --on-accent: #1b0f40; --accent-soft: #1e1640; --accent-ink: #c4b5fd; --accent-bright: #a78bfa; }
  [data-accent="pink"] { --accent: #f472b6; --accent-2: #f9a8d4; --on-accent: #3b0a22; --accent-soft: #33111f; --accent-ink: #f9a8d4; --accent-bright: #f472b6; }
  [data-accent="graphite"] { --accent: #e4e4e7; --accent-2: #fafafa; --on-accent: #18181b; --accent-soft: #26262b; --accent-ink: #e4e4e7; --accent-bright: #a1a1aa; }
}
/* the glows, focus ring and feature card follow whichever accent is picked */
:root, [data-accent] {
  --ring: color-mix(in srgb, var(--accent-bright) 32%, transparent); --glow: color-mix(in srgb, var(--accent-bright) 20%, transparent);
  --feature: radial-gradient(140% 120% at 100% 0%, var(--accent-bright) 0%, var(--accent-deep) 40%, color-mix(in srgb, var(--accent-deep) 40%, #000) 100%);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; padding-bottom: var(--consent-h, 0px); background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
[hidden] { display: none !important; }
/* Depth behind every page: a soft glow from the top and a fine grain, both under the content. */
body::before, body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
body::before { background: none; } /* the Scoresheet look: plain paper, no glow */
body::after { opacity: var(--grain); background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='180' height='180' filter='url(%23n)'/></svg>"); }
[id] { scroll-margin-top: 84px; }
::selection { background: var(--ring); }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }
h1, h2, h3 { color: var(--text); text-wrap: balance; font-family: var(--display); }
h1 { font-size: clamp(1.9rem, 3.8vw, 2.6rem); line-height: 1.1; margin: 0; letter-spacing: -.015em; font-weight: 600; }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.15; margin: 0 0 12px; letter-spacing: -.015em; font-weight: 600; }
h3 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 6px; letter-spacing: -.005em; font-weight: 600; }
p { margin: 0 0 12px; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
b, strong { font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.2rem); line-height: 1.6; color: var(--muted); max-width: 36em; }
.eyebrow { font: 500 .75rem/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.error { color: var(--bad); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons and inputs (kept low-specificity so board squares, which are buttons, stay plain) ---------- */
:where(button, .btn) {
  font: inherit; font-weight: 650; line-height: 1.2; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border: 1px solid transparent; border-radius: 4px; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--on-accent); box-shadow: none;
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
:where(button:not(:disabled), .btn):hover { background-color: var(--accent-2); color: var(--on-accent); }
:where(button, .btn):active { transform: translateY(1px); }
:where(button):disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn, .btn:hover { color: var(--on-accent); } /* links styled as buttons: beat the plain link colour */
.wide { width: 100%; padding: 15px 20px; font-size: 1.05rem; border-radius: 4px; }
.secondary { background: var(--surface); color: var(--text); border-color: var(--line-2); box-shadow: var(--shadow-1); }
.secondary:hover { background: var(--surface-2); color: var(--text); border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)); box-shadow: var(--shadow-1); }
.ghost { background: transparent; color: var(--text-2); box-shadow: none; padding: 8px 12px; }
.ghost:hover { background: var(--surface-3); color: var(--text); box-shadow: none; transform: none; }
.back { margin: 0 0 12px -12px; }
button.link { display: inline; background: none; padding: 0; border: 0; border-radius: 0; box-shadow: none; color: var(--accent-ink); font-weight: 650; font-size: inherit; text-decoration: underline; text-underline-offset: 3px; }
button.link:hover { background: none; color: var(--accent); box-shadow: none; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row > * { flex: 1 1 auto; }

:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { font: inherit; width: 100%; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 4px; background-color: var(--surface); color: var(--text); transition: border-color .15s ease, box-shadow .15s ease; }
:where(input, select, textarea):hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line-2)); }
:where(input, select, textarea):focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 42px; background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; }
input::placeholder { color: var(--muted); opacity: .85; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 6px; color: var(--text-2); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; font-size: 1rem; font-weight: 550; color: var(--text); cursor: pointer; }
.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 46px; height: 28px; margin: 0; border-radius: 99px; background: var(--line-2); cursor: pointer; transition: background-color .2s ease; }
.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .2s cubic-bezier(.3, .7, .4, 1); }
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(18px); }
@media (prefers-color-scheme: dark) { [data-accent="graphite"] .switch:checked::before { background: #18181b; } } /* a white knob on near-white wouldn't show */

/* ---------- header and footer ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--text); }
.site-header .wrap { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 1.2rem; letter-spacing: -.01em; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo:hover { color: var(--text); }
.logo img { width: 30px; height: 30px; border-radius: 6px; }
nav { display: flex; align-items: center; gap: 4px; }
nav a:not(.btn) { color: var(--text-2); text-decoration: none; font-weight: 550; font-size: .95rem; padding: 8px 12px; border-radius: 4px; transition: background-color .15s ease, color .15s ease; }
nav a:not(.btn):hover { color: var(--text); background: var(--surface-3); }
nav .btn { padding: 9px 16px; margin-left: 8px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; font-size: .875rem; font-weight: 600; color: var(--text-2); padding: 6px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.user-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 640px) { .hide-sm { display: none !important; } }
/* Main tabs once you're in: in the header on wide screens, a bar along the bottom on phones and tablets. */
nav.tabs { gap: 2px; }
nav.tabs a { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 4px; color: var(--text-2); font-weight: 600; text-decoration: none; }
nav.tabs a:hover { background: var(--surface-3); color: var(--text); }
nav.tabs a[aria-current] { background: none; color: var(--text); box-shadow: inset 0 -2px 0 var(--text); border-radius: 0; } /* the current tab: underlined, like a ruled page */
nav.tabs b { display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: var(--on-accent); font-size: .7rem; font-weight: 750; line-height: 1; }
@media (max-width: 1099px) { .user-chip { display: none !important; } }
@media (max-width: 899px) {
  /* a blurred header would pin the bar inside itself, so the header goes solid here */
  .site-header { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
  nav.tabs { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--text); }
  nav.tabs a { flex-direction: column; gap: 3px; padding: 6px 0; font-size: .72rem; }
  @media (max-width: 380px) { nav.tabs a { font-size: .64rem; letter-spacing: -.01em; } } /* "Analysis/Review" still fits on small phones */
  nav.tabs a[aria-current] { background: transparent; box-shadow: none; }
  nav.tabs a[aria-current] .i { background: var(--accent-soft); border-radius: 4px; padding: 3px 14px; width: 52px; height: 28px; margin: -3px 0; }
  nav.tabs b { position: absolute; top: 0; left: calc(50% + 6px); min-width: 17px; height: 17px; font-size: .65rem; }
  body.in { padding-bottom: calc(70px + env(safe-area-inset-bottom) + var(--consent-h, 0px)); } /* the tab bar, and the cookie banner docked on it */
}
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--muted); font-size: .875rem; }
.site-footer p { margin: 0 0 6px; }

/* The plain pages' header: the logo home, and the way back into the app (the header itself is above). */
.site-nav { display: flex; align-items: center; gap: 16px; }
.site-nav a:not(.btn) { color: var(--text-2); font-weight: 600; text-decoration: none; }
@media (max-width: 480px) { .site-nav .btn { padding: 8px 12px; font-size: .9rem; } .logo { font-size: 1rem; } .logo img { width: 30px; height: 30px; } }

/* ---------- cards, pills, callouts ---------- */
.badge { display: inline-flex; align-items: center; font-size: .78rem; font-weight: 650; letter-spacing: 0; padding: 3px 8px; border-radius: 3px; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--line); vertical-align: middle; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: none; }
@media (min-width: 640px) { .card { padding: 24px; } }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; }
.card-head p { margin: 2px 0 0; }
.ico { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--accent-ink); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 3px; font-size: .78rem; font-weight: 650; line-height: 1.1; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.pill.good { background: var(--accent-soft); color: var(--accent-ink); }
.pill.bad { background: var(--bad-soft); color: var(--bad-ink); }
.pill.gold { background: var(--gold-soft); color: var(--gold-ink); }
.pill.solid { background: var(--accent); color: var(--on-accent); }
.callout { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0; padding: 12px 14px; border-radius: 4px; font-weight: 600; line-height: 1.45; background: var(--surface-3); color: var(--text); }
.callout::before { content: ""; flex: none; width: 20px; height: 20px; margin-top: 1px; background: currentColor; -webkit-mask: var(--ic, var(--ic-info)) center / contain no-repeat; mask: var(--ic, var(--ic-info)) center / contain no-repeat; }
.callout.good { background: var(--accent-soft); color: var(--accent-ink); --ic: var(--ic-check); }
.callout.bad { background: var(--bad-soft); color: var(--bad-ink); --ic: var(--ic-x); }
.callout.hint { background: var(--gold-soft); color: var(--gold-ink); --ic: var(--ic-bulb); }

/* ---------- board screens (drills, lessons, endgames, analysis, calculator, puzzle) ----------
   One template: the board on the left at --board size, the panel on the right. On phones the board fills the width,
   the instruction sits right under it, and the main actions stay in a bar stuck to the bottom, within thumb reach
   (above the tab bar inside the app). */
:root { --board: min(760px, calc(100svh - 180px), calc(100% - 400px)); }
@media (max-width: 899px) {
  .action-bar { position: sticky; z-index: 5; bottom: calc(var(--tabbar, 0px) + var(--consent-h, 0px) + 8px + env(safe-area-inset-bottom)); }
  .action-bar:not(button) { padding: 8px; margin-inline: -8px; border-radius: var(--radius); /* a bar of buttons gets a backing; a single button keeps its own fill */
    background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--shadow-md); }
  .action-bar button, .action-bar .btn, button.action-bar { min-height: 44px; }
  button.action-bar { width: 100%; margin-inline: 0; }
  body.in { --tabbar: calc(70px + env(safe-area-inset-bottom)); }
}

/* ---------- states: empty, loading, error, success (icon + one line + at most one action) ---------- */
.state { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin: 0; padding: 14px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--text-2); font-size: .95rem; line-height: 1.45; }
.state::before { content: ""; flex: none; width: var(--icon); height: var(--icon); background: var(--muted); -webkit-mask: var(--ic-info) center / contain no-repeat; mask: var(--ic-info) center / contain no-repeat; }
.state > span { flex: 1 1 12em; }
.state.error { border-style: solid; border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: var(--bad-soft); color: var(--bad-ink); }
.state.error::before { background: var(--bad); -webkit-mask-image: var(--ic-warn); mask-image: var(--ic-warn); }
.state.success { border-style: solid; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); color: var(--accent-ink); }
.state.success::before { background: var(--accent); -webkit-mask-image: var(--ic-check); mask-image: var(--ic-check); }
.state.loading::before { -webkit-mask: none; mask: none; background: none; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; width: 16px; height: 16px; animation: spin .8s linear infinite; }
.state.compact { display: inline-flex; padding: 6px 10px; font-size: .875rem; }
@keyframes spin { to { transform: rotate(360deg); } }
/* skeletons: grey placeholders the shape of what's loading */
.skeleton { display: block; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%) 0 0 / 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton, .state.loading::before { animation: none; } }

/* ---------- motion (none when the device asks for less) ---------- */
@media (prefers-reduced-motion: no-preference) {
  :where(button, .btn) { transition-duration: .15s; }
  .card.lift, .op-card, .go-card { transition: transform .15s ease, box-shadow .15s ease; }
  .card.lift:hover, .op-card:hover, .go-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
}

/* Phones: every button, chip and field is at least 44px tall, so it's easy to tap (board squares and inline text links aside). */
@media (max-width: 480px) {
  :where(button:not(.sq):not(.link), .btn, select, input:not([type="checkbox"]):not([type="radio"]), summary) { min-height: 44px; }
}
.site-nav .back-link { white-space: nowrap; }
@media (max-width: 480px) {
  .site-nav a { min-height: 44px; display: inline-flex; align-items: center; } /* tap targets */
  .site-nav a:not(.back-link) ~ .back-link { display: none; } /* "All openings" plus the back link don't fit: the logo goes home anyway */
}
@media (max-width: 360px) { .site-nav .back-link { display: none; } } /* small phones: the logo is the way back */
