/*
  Gambit Club: chess learning app (Screenery template)
  A club room in the evening: a dark walnut ground, green baize panels, maple paper for the scoresheet and ledgers,
  brass for the fittings, and one warm lamp. Alegreya for the voice, Alegreya Sans for the interface.

  Contents
   1. Tokens
   2. Base and browser surfaces
   3. Surfaces: walnut, baize, maple
   4. Components: buttons, segmented control, fields, tabs
   5. Header
   6. The app: table, 3D stage, 2D board, panel, scoresheet
   7. Courses
   8. Streak and rating
   9. Coaches
  10. Pricing
  11. Sign up
  12. Questions and footer
  13. Motion
  14. Narrow screens
*/

/* ---------- 1. Tokens ---------- */
:root {
  /* Walnut: the ground and the furniture */
  --walnut-950: #160e08;
  --walnut-900: #1d130c;    /* page ground */
  --walnut-800: #2a1c12;    /* raised walnut */
  --walnut-700: #3a2717;
  --walnut-600: #57391f;
  --walnut-500: #7a5030;    /* dark squares */

  /* Cream text on walnut */
  --cream: #f3e7cf;         /* 14.9:1 on walnut-900 */
  --cream-2: #d8c5a2;       /* 10.6:1 */
  --cream-3: #b7a07c;       /* 7:1, labels */

  /* Maple: light squares and paper */
  --maple: #e6c995;
  --maple-paper: #f4e8cf;
  --maple-paper-2: #ead9b6;
  --ink: #26190f;           /* text on maple, 13:1 */
  --ink-2: #5a4128;         /* secondary on maple, 6.9:1 */
  --rule: rgb(38 25 15 / 0.16);

  /* Baize */
  --baize: #1f4630;
  --baize-2: #275a3d;
  --baize-3: #163423;
  --on-baize: #f1e8d2;
  --on-baize-2: #c9d6c0;    /* 8.4:1 on baize */

  /* Brass */
  --brass: #d1a94f;
  --brass-hi: #ecc96f;
  --brass-lo: #8e6c26;
  --on-brass: #20150b;

  /* Signals */
  --good: #a9dd98;          /* on baize/walnut */
  --good-ink: #2d5f22;      /* on maple */
  --bad: #f2a689;
  --bad-ink: #8f2f16;

  /* Board squares in 2D */
  --sq-light: #e2c38c;
  --sq-dark: #8e5c35;
  --sq-sel: #e9c05a;
  --sq-last: rgb(205 222 120 / 0.55);

  /* Type */
  --serif: "Alegreya", "Iowan Old Style", Georgia, serif;
  --sans: "Alegreya Sans", "Gill Sans", "Trebuchet MS", sans-serif;
  --fs-xs: 0.875rem;
  --fs-sm: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: clamp(1.625rem, 1.3rem + 1.2vw, 2.25rem);
  --fs-2xl: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
  --fs-3xl: clamp(2.25rem, 1.5rem + 2.4vw, 3.5rem);

  /* Space and shape */
  --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem; --s-5: 1.5rem;
  --s-6: 2rem; --s-7: 3rem; --s-8: 4.5rem; --s-9: 7rem;
  --r-1: 4px; --r-2: 8px; --r-3: 14px; --r-pill: 999px;
  --wrap: 1240px;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);

  /* Depth: lamp from above, a little in front */
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.35), 0 6px 14px -6px rgb(0 0 0 / 0.5);
  --shadow-2: 0 2px 4px rgb(0 0 0 / 0.35), 0 22px 44px -18px rgb(0 0 0 / 0.75);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
}

/* ---------- 2. Base and browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-color: var(--walnut-600) var(--walnut-950); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--cream);
  background-color: var(--walnut-900);
  /* Walnut grain: long stretched turbulence, very low contrast, plus the lamp pool at the top */
  background-image:
    radial-gradient(120% 60% at 50% 0%, rgb(236 180 96 / 0.13), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2400' height='400'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.004 0.09' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.55  0 0 0 0 0.35  0 0 0 0 0.2  0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
::selection { background: var(--brass); color: var(--on-brass); }
input, textarea, select { caret-color: var(--brass-lo); }
:root { accent-color: var(--brass); }
.maple { accent-color: var(--brass-lo); }
a { color: inherit; text-decoration-color: var(--brass); text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 3px; border-radius: var(--r-1); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.12; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
button { font: inherit; color: inherit; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.ico { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico--lg { width: 2rem; height: 2rem; }
.skip { position: absolute; left: var(--s-4); top: -4rem; z-index: 50; background: var(--brass); color: var(--on-brass); padding: var(--s-2) var(--s-4); border-radius: var(--r-1); font-weight: 700; }
.skip:focus { top: var(--s-4); }
.h1 { font-size: var(--fs-3xl); font-weight: 500; letter-spacing: -0.015em; max-width: 22ch; }
.h2 { font-size: var(--fs-2xl); letter-spacing: -0.01em; }
section { scroll-margin-top: 4.5rem; }
.sec-head { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s-4) var(--s-7); align-items: end; margin-bottom: var(--s-6); }
.sec-head p { color: var(--cream-2); max-width: 52ch; }
[data-tabular], .stats dd, .course__count, .tally dd, .streak__num, .rating__now, .plan__price, .day, .chart text, .mv, .mv-no, .fixture__seats { font-variant-numeric: tabular-nums lining-nums; }

/* ---------- 3. Surfaces ---------- */
/* Baize: green felt with a fine nap. Brass rule inside the edge. */
.baize {
  background-color: var(--baize);
  background-image:
    radial-gradient(90% 70% at 30% 0%, rgb(255 236 190 / 0.09), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.05  0 0 0 0 0.12  0 0 0 0 0.07  0 0 0 0.35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  color: var(--on-baize);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-2), inset 0 0 0 1px rgb(0 0 0 / 0.35), inset 0 0 0 5px var(--baize-3), inset 0 0 0 6px rgb(209 169 79 / 0.45);
}
/* Maple: warm paper-like veneer for anything you read closely */
.maple {
  background-color: var(--maple-paper);
  background-image:
    linear-gradient(180deg, rgb(255 255 255 / 0.25), transparent 40%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='700' height='260'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006 0.12' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.6  0 0 0 0 0.42  0 0 0 0 0.2  0 0 0 0.14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
  color: var(--ink);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-2), inset 0 0 0 1px rgb(120 80 40 / 0.25);
}
.maple { color-scheme: light; }
.maple :focus-visible { outline-color: var(--brass-lo); }

/* ---------- 4. Components ---------- */
.btn {
  --b: var(--cream);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0.55rem 1.1rem;
  border: 1px solid transparent; border-radius: var(--r-pill);
  font-family: var(--sans); font-weight: 700; font-size: var(--fs-sm); letter-spacing: 0.01em;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 0.2s var(--ease-out), color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn--brass {
  color: var(--on-brass);
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 55%, #b98f3a);
  box-shadow: inset 0 1px 0 rgb(255 245 210 / 0.7), 0 1px 1px rgb(0 0 0 / 0.4), 0 6px 14px -8px rgb(0 0 0 / 0.8);
}
.btn--brass:hover { background: linear-gradient(180deg, #f4d785, var(--brass-hi) 55%, var(--brass)); }
.btn--line { color: inherit; border-color: currentColor; background: transparent; border-color: rgb(241 232 210 / 0.5); }
.btn--line:hover { background: rgb(241 232 210 / 0.1); border-color: rgb(241 232 210 / 0.85); }
.maple .btn--line { border-color: rgb(38 25 15 / 0.45); }
.maple .btn--line:hover { background: rgb(38 25 15 / 0.06); border-color: var(--ink); }
.btn--small { min-height: 44px; padding: 0.4rem 0.9rem; font-size: var(--fs-xs); color: var(--ink); background: transparent; border-color: rgb(38 25 15 / 0.4); }
.btn--small:hover:not(:disabled) { background: var(--ink); color: var(--maple-paper); }
.btn:disabled { cursor: default; opacity: 1; }
.btn--line:disabled { opacity: 0.5; }
.btn--line:disabled:hover { background: transparent; }
.btn--small:disabled { border-style: dashed; color: var(--ink-2); }
.btn[aria-busy="true"] { cursor: progress; }

.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: var(--r-pill); background: var(--walnut-950); box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.6), 0 0 0 1px rgb(209 169 79 / 0.25); }
.seg__btn { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 40px; padding: 0 0.9rem; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--cream-2); font-weight: 500; font-size: var(--fs-xs); cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.seg__btn:hover { color: var(--cream); }
.seg__btn[aria-pressed="true"] { background: var(--walnut-700); color: var(--cream); box-shadow: inset 0 1px 0 rgb(255 230 180 / 0.12), 0 1px 2px rgb(0 0 0 / 0.5); }
.seg__btn[aria-pressed="true"] .ico { color: var(--brass-hi); }
.seg__btn:disabled { color: var(--cream-3); cursor: not-allowed; text-decoration: line-through; text-decoration-color: rgb(183 160 124 / 0.6); }

/* ---------- 5. Header ---------- */
.top { position: sticky; top: 0; z-index: 30; background: rgb(22 14 8 / 0.92); border-bottom: 1px solid rgb(209 169 79 / 0.22); }
@supports (backdrop-filter: blur(1px)) { .top { background: rgb(22 14 8 / 0.82); backdrop-filter: blur(10px) saturate(1.2); } }
.top__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-5); min-height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: var(--s-2); text-decoration: none; }
.brand__mark { width: 2rem; height: 2rem; fill: var(--brass); stroke: var(--walnut-950); stroke-width: 1; }
.brand__name { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
.nav { display: flex; align-items: center; gap: var(--s-1) var(--s-5); }
.nav a:not(.btn) { text-decoration: none; color: var(--cream-2); font-size: var(--fs-sm); padding: var(--s-2) 0; }
.nav a:not(.btn):hover { color: var(--cream); text-decoration: underline; }
.menu-btn { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; border: 1px solid rgb(241 232 210 / 0.35); background: transparent; border-radius: var(--r-2); cursor: pointer; }

/* ---------- 6. The app ---------- */
.hero { padding: var(--s-6) 0 var(--s-8); }
.hero__head { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--s-4) var(--s-7); align-items: end; margin-bottom: var(--s-6); }
.lede { color: var(--cream-2); font-size: var(--fs-md); max-width: 50ch; }
.app { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 400px); gap: var(--s-5); align-items: start; }

/* The table: a walnut tray that holds the board */
.table {
  position: relative;
  container-type: inline-size;
  padding: var(--s-4);
  border-radius: calc(var(--r-3) + 4px);
  background: linear-gradient(180deg, var(--walnut-800), var(--walnut-950));
  box-shadow: var(--shadow-2), inset 0 1px 0 rgb(255 225 170 / 0.08), inset 0 0 0 1px rgb(209 169 79 / 0.2);
}
.table__bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s-3); margin-bottom: var(--s-3); }
.table__turn { display: inline-flex; align-items: center; gap: var(--s-2); font-family: var(--serif); font-size: var(--fs-lg); }
.turn-dot { width: 0.85rem; height: 0.85rem; border-radius: 50%; background: var(--maple-paper); box-shadow: 0 0 0 2px var(--walnut-950), 0 0 0 3px var(--brass); }
.table[data-side="b"] .turn-dot { background: #1a100a; }
.table__help { margin-top: var(--s-3); font-size: var(--fs-xs); color: var(--cream-3); max-width: 70ch; }

.stage {
  position: relative;
  /* square on narrow screens; wider than tall when the viewport is short, so the board fits the first screen */
  width: 100%;
  height: min(100cqw, max(440px, 100svh - 21rem), 860px);
  border-radius: var(--r-2);
  overflow: hidden;
  /* The baize under the lamp; this shows behind the 3D board and stands in for it */
  background:
    radial-gradient(70% 65% at 50% 38%, rgb(255 220 150 / 0.2), transparent 70%),
    radial-gradient(120% 100% at 50% 40%, var(--baize-2), var(--baize-3) 80%);
}
.stage__canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.6s var(--ease-out); touch-action: none; cursor: grab; }
.stage__canvas.is-dragging { cursor: grabbing; }
.table[data-view="3d"] .stage__canvas.is-ready { opacity: 1; }
.table[data-view="3d"] .board2d { visibility: hidden; }
.table[data-view="2d"] .stage__canvas { visibility: hidden; }
.stage__canvas:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: -4px; }
.stage__cursor { position: absolute; left: var(--s-3); bottom: var(--s-3); z-index: 2; padding: 0.2rem 0.6rem; border-radius: var(--r-1); background: rgb(22 14 8 / 0.82); color: var(--cream); font-size: var(--fs-xs); pointer-events: none; }
.stage__cursor:empty, .table[data-view="2d"] .stage__cursor { display: none; }

/* The 2D board: a walnut-framed grid of 64 buttons */
.board2d {
  position: absolute; top: 3.5%; left: 50%; height: 93%; aspect-ratio: 1; max-width: 93%; translate: -50% 0;
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  border: 0.6rem solid var(--walnut-700);
  border-radius: 6px;
  box-shadow: 0 0 0 1px var(--brass-lo), 0 18px 40px -16px rgb(0 0 0 / 0.8), inset 0 0 0 1px rgb(0 0 0 / 0.4);
  touch-action: none;
}
.sq { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0; cursor: pointer; }
.sq--l { background: var(--sq-light); }
.sq--d { background: var(--sq-dark); }
.sq--last.sq--l { background: color-mix(in oklab, var(--sq-light), #c7d96a 40%); }
.sq--last.sq--d { background: color-mix(in oklab, var(--sq-dark), #b4c356 45%); }
.sq--sel { background: var(--sq-sel) !important; }
.sq--hint { box-shadow: inset 0 0 0 4px var(--brass-hi); }
.sq--target::after { content: ""; position: absolute; width: 28%; aspect-ratio: 1; border-radius: 50%; background: rgb(32 20 10 / 0.38); pointer-events: none; }
.sq--target.sq--cap::after { width: 86%; background: transparent; box-shadow: inset 0 0 0 4px rgb(32 20 10 / 0.42); }
.sq--bad { animation: sq-bad 0.6s var(--ease-out); }
@keyframes sq-bad { 0%, 100% { box-shadow: inset 0 0 0 0 transparent; } 30% { box-shadow: inset 0 0 0 5px var(--bad-ink); } }
.sq:focus-visible { outline: 3px solid #fff4cf; outline-offset: -3px; z-index: 2; border-radius: 0; box-shadow: inset 0 0 0 5px var(--walnut-950); }
.co { position: absolute; font-size: clamp(0.55rem, 1.3vw, 0.8rem); font-weight: 700; line-height: 1; pointer-events: none; }
.co--r { top: 6%; left: 7%; }
.co--f { bottom: 6%; right: 8%; }
.sq--l .co { color: var(--walnut-600); }
.sq--d .co { color: #f8e8c6; }
.pc { width: 86%; height: 86%; pointer-events: none; overflow: visible; }
.pc--w { fill: #fbf0d8; stroke: #2a1a0e; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 2px 1.5px rgb(0 0 0 / 0.45)); }
.pc--b { fill: #231409; stroke: #f0d9ac; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 2px 1.5px rgb(0 0 0 / 0.5)); }
.drag-ghost { position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, -55%) scale(1.12); filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.5)); }
.sq.is-lifted .pc { opacity: 0.25; }

/* The panel: puzzle details, status, scoresheet */
.panel { padding: var(--s-5); display: grid; gap: var(--s-4); }
.picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-bottom: 1px solid rgb(241 232 210 / 0.25); }
.picker__btn { display: grid; gap: 0; justify-items: start; padding: 0.3rem 0.1rem 0.6rem; min-height: 44px; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; background: none; cursor: pointer; text-align: left; line-height: 1.2; }
.picker__btn span { font-weight: 700; font-size: var(--fs-sm); }
.picker__btn small { color: var(--on-baize-2); font-size: var(--fs-xs); }
.picker__btn:hover { border-bottom-color: rgb(241 232 210 / 0.45); }
.picker__btn[aria-pressed="true"] { border-bottom-color: var(--brass-hi); }
.picker__btn[aria-pressed="true"] span { color: var(--brass-hi); }
.picker__btn.is-solved span::after { content: ""; display: inline-block; width: 0.5rem; height: 0.5rem; margin-left: 0.35rem; border-radius: 50%; background: var(--good); vertical-align: 0.1em; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.4); }
.panel__title { font-size: var(--fs-xl); margin-top: var(--s-2); }
.panel__task { color: var(--on-baize-2); }
.panel__task strong { color: var(--on-baize); font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: var(--s-3); margin: 0; padding: var(--s-3) 0; border-block: 1px solid rgb(241 232 210 / 0.18); }
.stats div { display: grid; gap: 0.1rem; }
.stats dt { font-size: 0.8125rem; color: var(--on-baize-2); }
.stats dd { margin: 0; font-family: var(--serif); font-size: var(--fs-lg); font-weight: 700; }
.stats .up { color: var(--good); }
.stats .down { color: var(--bad); }
.stats dd.is-final { text-decoration: underline 2px; text-underline-offset: 0.25em; }

.status { padding: 0 0 var(--s-1); min-height: 5.2rem; }
.status__lead { font-family: var(--serif); font-size: var(--fs-lg); font-weight: 700; }
.status__text { color: var(--on-baize-2); font-size: var(--fs-sm); margin-top: 0.15rem; }
.status[data-tone="bad"] .status__lead { color: var(--bad); }
.status[data-tone="good"] .status__lead { color: var(--good); }
.status.is-shake { animation: shake 0.45s var(--ease-out); }
@keyframes shake { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } }
.actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.actions .btn { flex: 1 1 auto; padding-inline: 0.8rem; }

/* The scoresheet: ruled maple paper with a handwritten feel */
.sheet { background: var(--maple-paper); color: var(--ink); border-radius: var(--r-1); padding: var(--s-3) var(--s-4) var(--s-4); box-shadow: 0 1px 0 rgb(255 255 255 / 0.4) inset, 0 8px 18px -10px rgb(0 0 0 / 0.7); transform: rotate(-0.4deg); }
.sheet__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); border-bottom: 2px solid var(--ink); padding-bottom: var(--s-1); }
.sheet__title { font-size: var(--fs-md); font-weight: 700; }
.sheet__game { font-size: var(--fs-xs); color: var(--ink-2); }
.sheet__moves { list-style: none; margin: 0; padding: 0; min-height: 5.4rem; }
.sheet__moves li { display: grid; grid-template-columns: 2.6rem 1fr 1fr; align-items: center; height: 1.8rem; border-bottom: 1px solid var(--rule); }
.mv-no { color: var(--ink-2); font-size: var(--fs-sm); }
.mv { font-family: var(--serif); font-style: italic; font-size: var(--fs-md); font-weight: 500; }
.mv--empty { color: var(--ink-2); }
.mv--you { color: var(--ink); }
.mv--reply { color: var(--ink-2); }
.mv--new { animation: ink-in 0.7s var(--ease-out); }
@keyframes ink-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.explain { padding-top: var(--s-4); border-top: 1px solid rgb(209 169 79 / 0.55); display: grid; gap: var(--s-3); justify-items: start; }
.explain[hidden] { display: none; }
.explain__title { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-lg); color: var(--brass-hi); }
.explain p { color: var(--on-baize); font-size: var(--fs-sm); }

/* ---------- 7. Courses ---------- */
.courses, .progress, .coaches, .pricing, .signup, .faq { padding: var(--s-8) 0; }
.courses__layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-5); align-items: start; }
.ledger { padding: var(--s-4) var(--s-5) var(--s-3); }
.tabs { display: flex; gap: var(--s-5); border-bottom: 2px solid var(--ink); margin-bottom: var(--s-1); overflow-x: auto; }
.tabs [role="tab"] { min-height: 44px; padding: 0 0.1rem; border: 0; background: none; color: var(--ink-2); font-weight: 700; font-size: var(--fs-sm); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brass-lo); }
.course-list { list-style: none; margin: 0; padding: 0; }
.course { display: grid; grid-template-columns: minmax(0, 1fr) 220px auto; gap: var(--s-2) var(--s-5); align-items: center; padding: var(--s-4) 0; border-bottom: 1px solid var(--rule); }
.course:last-child { border-bottom: 0; }
.course[hidden] { display: none; }
.course h3 { font-size: var(--fs-lg); }
.course p { color: var(--ink-2); font-size: var(--fs-sm); max-width: 58ch; }
.course__bar { display: grid; gap: 0.3rem; }
.course__count { font-size: var(--fs-xs); color: var(--ink-2); }
.course__count b { color: var(--ink); }
.course .btn { min-width: 8.5rem; }
progress, meter { -webkit-appearance: none; appearance: none; width: 100%; height: 0.6rem; border: 0; border-radius: var(--r-pill); background: rgb(38 25 15 / 0.14); overflow: hidden; }
progress::-webkit-progress-bar { background: rgb(38 25 15 / 0.14); border-radius: var(--r-pill); }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--brass-lo), var(--brass)); border-radius: var(--r-pill); transition: width 0.6s var(--ease-out); }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--brass-lo), var(--brass)); border-radius: var(--r-pill); }
meter::-webkit-meter-bar { background: rgb(0 0 0 / 0.3); border: 0; border-radius: var(--r-pill); height: 0.6rem; }
meter::-webkit-meter-optimum-value, meter::-webkit-meter-suboptimum-value, meter::-webkit-meter-even-less-good-value { background: linear-gradient(90deg, var(--brass-lo), var(--brass-hi)); border-radius: var(--r-pill); transition: width 0.6s var(--ease-out); }
meter::-moz-meter-bar { background: linear-gradient(90deg, var(--brass-lo), var(--brass-hi)); border-radius: var(--r-pill); }
meter { background: rgb(0 0 0 / 0.3); }
.tally { padding: var(--s-5); position: sticky; top: 5.5rem; }
.tally__title { font-size: var(--fs-xl); margin-bottom: var(--s-4); }
.tally__rows { margin: 0; display: grid; gap: var(--s-4); }
.tally__rows div { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem var(--s-3); }
.tally__rows meter { grid-column: 1 / -1; }
.tally dt { color: var(--on-baize-2); }
.tally dd { margin: 0; color: var(--on-baize-2); }
.tally dd span { font-family: var(--serif); font-weight: 700; font-size: var(--fs-lg); color: var(--on-baize); }
.tally__total { padding-top: var(--s-4); border-top: 1px solid rgb(241 232 210 / 0.2); }
.tally__total dt { color: var(--on-baize); font-weight: 700; }
.tally__note { margin-top: var(--s-4); font-size: var(--fs-sm); color: var(--on-baize-2); }

/* ---------- 8. Streak and rating ---------- */
.progress__grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: var(--s-5); align-items: start; }
.streak { padding: var(--s-5); }
.streak__head { display: flex; align-items: center; gap: var(--s-3); color: var(--bad-ink); }
.streak__head p { color: var(--ink); font-size: var(--fs-md); }
.streak__num { font-family: var(--serif); font-size: var(--fs-2xl); font-weight: 700; line-height: 1; }
.streak__sub { color: var(--ink-2); font-size: var(--fs-sm); margin: var(--s-3) 0 var(--s-5); }
.streak__month { font-size: var(--fs-md); font-weight: 700; margin-bottom: var(--s-2); }
.cal__wk, .cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal__wk span { font-size: 0.8125rem; color: var(--ink-2); text-align: center; padding-bottom: 0.2rem; }
.cal { list-style: none; margin: 0; padding: 0; }
.day { display: grid; place-items: center; aspect-ratio: 1; border-radius: 6px; font-size: var(--fs-xs); font-weight: 700; }
.day:first-child { grid-column-start: 7; }
/* Played days look like dark squares on the board; missed ones are left empty with a red ring */
.day--done { background: var(--walnut-500); color: var(--maple-paper); }
.day--miss { background: transparent; color: var(--bad-ink); box-shadow: inset 0 0 0 2px var(--bad-ink); }
.day--today { background: var(--maple-paper-2); color: var(--ink); box-shadow: inset 0 0 0 2px var(--brass-lo); }
.day--today.is-played { background: var(--baize-2); color: var(--on-baize); box-shadow: inset 0 0 0 2px var(--brass); }
.day--future { color: #6b5236; background: rgb(38 25 15 / 0.05); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); padding: 0; margin: var(--s-4) 0 0; font-size: var(--fs-xs); color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: var(--s-2); }
.key { width: 0.9rem; height: 0.9rem; border-radius: 3px; }
.key--done { background: var(--walnut-500); }
.key--miss { box-shadow: inset 0 0 0 2px var(--bad-ink); }
.key--today { background: var(--maple-paper-2); box-shadow: inset 0 0 0 2px var(--brass-lo); }

.rating { padding: var(--s-5); display: grid; gap: var(--s-4); }
.rating__head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: var(--s-2) var(--s-4); }
.rating__title { font-size: var(--fs-lg); }
.rating__now { color: var(--on-baize-2); font-size: var(--fs-sm); }
.rating__now b { font-family: var(--serif); font-size: var(--fs-xl); color: var(--on-baize); margin-right: 0.2rem; }
.chart { width: 100%; height: auto; overflow: visible; border-radius: var(--r-1); }
.chart:focus-visible { outline-offset: 6px; }
.chart__grid line { stroke: rgb(241 232 210 / 0.14); stroke-width: 1; }
.chart text { fill: var(--on-baize-2); font-family: var(--sans); font-size: 13px; }
.chart__area { fill: rgb(236 201 111 / 0.12); }
.chart__line { fill: none; stroke: var(--brass-hi); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart__pt { fill: var(--baize); stroke: var(--brass-hi); stroke-width: 1.6; }
.chart__pt[data-miss] { stroke: var(--bad); }
.chart__pt.is-on { fill: var(--brass-hi); }
.chart__rule { stroke: rgb(241 232 210 / 0.5); stroke-width: 1; stroke-dasharray: 3 4; }
.elo { padding-top: var(--s-4); border-top: 1px solid rgb(241 232 210 / 0.18); display: grid; gap: var(--s-3); }
.elo__title { font-size: var(--fs-lg); }
.elo p { color: var(--on-baize-2); font-size: var(--fs-sm); max-width: 66ch; }
.elo__sum { color: var(--on-baize) !important; font-size: var(--fs-md) !important; }
.elo__sum b { color: var(--brass-hi); }

/* ---------- 9. Coaches ---------- */
.fixtures { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgb(209 169 79 / 0.35); }
.fixture { display: grid; grid-template-columns: 4.5rem minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: var(--s-3) var(--s-6); align-items: center; padding: var(--s-5) 0; border-bottom: 1px solid rgb(209 169 79 / 0.35); }
.medal { width: 4.5rem; height: 4.5rem; }
.medal circle:first-child { fill: var(--brass); stroke: var(--brass-lo); stroke-width: 2; }
.medal circle:nth-child(2) { fill: var(--walnut-800); stroke: var(--brass-hi); stroke-width: 1; }
.medal use { fill: var(--maple-paper); stroke: var(--walnut-950); stroke-width: 1.2; }
.fixture h3 { font-size: var(--fs-xl); }
.fixture__title { color: var(--brass-hi); font-weight: 700; font-size: var(--fs-sm); margin: 0.15rem 0 var(--s-2); }
.fixture__who > p:last-child { color: var(--cream-2); font-size: var(--fs-sm); max-width: 60ch; }
.fixture__when { display: grid; gap: 0.3rem; font-size: var(--fs-sm); }
.fixture__slot { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 700; }
.fixture__slot .ico { color: var(--brass-hi); }
.fixture__topic { color: var(--cream-2); }
.fixture__seats { color: var(--cream-3); }
.fixture__seats b { color: var(--cream); }
.fixture__book { min-width: 12rem; }
.fixture__book[aria-pressed="true"] { background: var(--cream); color: var(--walnut-900); border-color: var(--cream); }

/* ---------- 10. Pricing ---------- */
.billing { display: inline-flex; gap: 3px; padding: 3px; margin: 0 0 var(--s-5); border: 0; border-radius: var(--r-pill); background: var(--walnut-950); box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.6), 0 0 0 1px rgb(209 169 79 / 0.25); }
.billing label { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.1rem; border-radius: var(--r-pill); cursor: pointer; color: var(--cream-2); font-weight: 700; font-size: var(--fs-sm); }
.billing input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.billing label:has(:checked) { background: var(--walnut-700); color: var(--cream); }
.billing label:has(:focus-visible) { outline: 2px solid var(--brass-hi); outline-offset: 2px; }
.plans { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: var(--s-5); align-items: stretch; }
.plan { padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-3); }
.plan__name { font-size: var(--fs-2xl); }
.plan__price { font-size: var(--fs-md); }
.plan__price b { font-family: var(--serif); font-size: var(--fs-2xl); font-weight: 700; margin-right: 0.2rem; }
.plan .plan__price span { color: var(--ink-2); }
.plan--club .plan__price span, .plan__note { color: var(--on-baize-2); }
.plan__note { font-size: var(--fs-sm); }
.plan__list { list-style: none; margin: var(--s-3) 0 var(--s-5); padding: 0; display: grid; gap: var(--s-3); }
.plan__list li { display: flex; gap: var(--s-3); align-items: flex-start; }
.plan__list .ico { margin-top: 0.2rem; color: var(--good-ink); }
.plan--club .plan__list .ico { color: var(--brass-hi); }
.plan__cta { margin-top: auto; align-self: flex-start; }

/* ---------- 11. Sign up ---------- */
.signup__grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: var(--s-7); align-items: start; }
.signup__intro { display: grid; gap: var(--s-4); }
.signup__intro p { color: var(--cream-2); max-width: 48ch; }
.steps { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; gap: 0; border-top: 1px solid rgb(209 169 79 / 0.3); }
.steps li { display: flex; gap: var(--s-4); align-items: center; padding: var(--s-4) 0; border-bottom: 1px solid rgb(209 169 79 / 0.3); }
.steps__pc { width: 2.75rem; height: 2.75rem; flex: none; fill: var(--maple-paper); stroke: var(--walnut-950); stroke-width: 1.3; stroke-linejoin: round; filter: drop-shadow(0 3px 3px rgb(0 0 0 / 0.5)); }
.steps p { color: var(--cream-2); font-size: var(--fs-sm); }
.steps b { display: block; color: var(--cream); font-family: var(--serif); font-size: var(--fs-lg); font-weight: 500; }
.form { padding: var(--s-6); }
.form__body { display: grid; gap: var(--s-4); }
.form__body[hidden] { display: none; }
.field { display: grid; gap: 0.35rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .field legend { font-weight: 700; font-size: var(--fs-sm); padding: 0; }
.field input[type="text"], .field input[type="email"], .select select {
  width: 100%; min-height: 48px; padding: 0.6rem 0.85rem;
  font: inherit; font-size: var(--fs-md); color: var(--ink);
  background: #fffaf0; border: 1px solid rgb(38 25 15 / 0.4); border-radius: var(--r-2);
  box-shadow: inset 0 1px 2px rgb(38 25 15 / 0.12);
}
.field input:focus-visible, .select select:focus-visible { outline: 2px solid var(--brass-lo); outline-offset: 1px; border-color: var(--brass-lo); }
.field input[aria-invalid="true"] { border-color: var(--bad-ink); box-shadow: inset 0 0 0 1px var(--bad-ink); }
.field__hint { font-size: var(--fs-xs); color: var(--ink-2); }
.field__err { font-size: var(--fs-xs); color: var(--bad-ink); font-weight: 700; }
.field__err:empty { display: none; }
.level { gap: var(--s-2); }
.level legend { margin-bottom: var(--s-2); }
.level__opt { display: flex; gap: var(--s-3); align-items: flex-start; padding: 0.7rem 0.85rem; border: 1px solid rgb(38 25 15 / 0.25); border-radius: var(--r-2); cursor: pointer; font-weight: 400 !important; background: rgb(255 250 240 / 0.5); }
.level__opt:hover { border-color: rgb(38 25 15 / 0.55); }
.level__opt:has(:checked) { border-color: var(--brass-lo); background: #fff6df; box-shadow: inset 0 0 0 1px var(--brass-lo); }
.level__opt input { width: 1.15rem; height: 1.15rem; margin: 0.2rem 0 0; flex: none; }
.level__opt span { display: grid; color: var(--ink-2); font-size: var(--fs-sm); }
.level__opt b { color: var(--ink); font-size: var(--fs-md); }
.level[aria-invalid="true"] .level__opt { border-color: rgb(143 47 22 / 0.6); }
.select { position: relative; }
.select select { appearance: none; padding-right: 2.5rem; cursor: pointer; }
.select .ico { position: absolute; right: 0.8rem; top: 50%; translate: 0 -50%; pointer-events: none; color: var(--ink-2); }
.check { display: flex; gap: var(--s-3); align-items: center; font-size: var(--fs-sm); cursor: pointer; min-height: 44px; }
.check input { width: 1.15rem; height: 1.15rem; margin: 0; }
.form__error { color: var(--bad-ink); font-weight: 700; font-size: var(--fs-sm); padding: var(--s-3) var(--s-4); border: 1px solid var(--bad-ink); border-radius: var(--r-2); background: rgb(143 47 22 / 0.07); }
.form__error:empty { display: none; }
.form__submit { justify-self: start; min-width: 14rem; }
.form__submit[aria-busy="true"] span::before { content: ""; display: inline-block; width: 1rem; height: 1rem; margin-right: 0.55rem; vertical-align: -0.15em; border: 2px solid rgb(32 21 11 / 0.3); border-top-color: var(--on-brass); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { rotate: 1turn; } }
.form__done { display: grid; gap: var(--s-3); justify-items: start; padding: var(--s-4) 0; }
.form__done[hidden] { display: none; }
.form__done:focus { outline: none; }
.form__done h3 { font-size: var(--fs-2xl); }
.form__done p { color: var(--ink-2); max-width: 46ch; }
.form__seal { width: 4rem; height: 4rem; }
.form__seal circle { fill: var(--baize); stroke: var(--brass); stroke-width: 2; }
.form__seal path { fill: none; stroke: var(--brass-hi); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 12. Questions and footer ---------- */
.faq__grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: var(--s-6) var(--s-7); align-items: start; }
.faq__list { border-top: 1px solid rgb(209 169 79 / 0.35); }
.faq details { border-bottom: 1px solid rgb(209 169 79 / 0.35); }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); min-height: 3.5rem; padding: var(--s-3) 0; cursor: pointer; list-style: none; font-family: var(--serif); font-size: var(--fs-lg); font-weight: 500; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ico { color: var(--brass-hi); transition: rotate 0.3s var(--ease-out); }
.faq details[open] summary .ico { rotate: 180deg; }
.faq details p { color: var(--cream-2); padding: 0 0 var(--s-5); max-width: 66ch; }
.foot { margin-top: var(--s-7); padding: var(--s-7) 0 var(--s-6); background: var(--walnut-950); border-top: 1px solid rgb(209 169 79 / 0.3); }
.foot__grid { display: grid; grid-template-columns: 1.1fr 1fr 1.2fr; gap: var(--s-5) var(--s-6); align-items: start; }
.foot__name { display: flex; align-items: center; gap: var(--s-2); font-family: var(--serif); font-size: 1.6rem; font-weight: 700; }
.foot__line { color: var(--cream-2); margin-top: var(--s-2); }
.foot__nav { display: grid; grid-template-columns: repeat(2, max-content); gap: var(--s-2) var(--s-6); }
.foot__nav a { color: var(--cream-2); text-decoration: none; padding: 0.3rem 0; }
.foot__nav a:hover { color: var(--cream); text-decoration: underline; }
.foot__contact { color: var(--cream-2); font-size: var(--fs-sm); line-height: 1.8; }
.foot__small { grid-column: 1 / -1; color: var(--cream-3); font-size: var(--fs-xs); padding-top: var(--s-5); border-top: 1px solid rgb(241 232 210 / 0.12); }

/* ---------- 13. Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* Sections settle in as they arrive: visible by default, only the timing is scroll-driven */
  @supports (animation-timeline: view()) {
    .sec-head, .plan, .fixture, .streak, .rating, .ledger, .tally, .form {
      animation: settle linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }
}
@keyframes settle { from { translate: 0 14px; } to { translate: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- 14. Narrow screens ---------- */
@media (max-width: 1080px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .courses__layout { grid-template-columns: minmax(0, 1fr); }
  .tally { position: static; }
  .progress__grid { grid-template-columns: minmax(0, 1fr); }
  .fixture { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .fixture__when, .fixture__book { grid-column: 2; }
  .fixture__book { justify-self: start; }
}
@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .nav { position: absolute; top: 100%; left: 0; right: 0; display: none; flex-direction: column; align-items: stretch; gap: 0; padding: var(--s-3) var(--gutter) var(--s-5); background: var(--walnut-950); border-bottom: 1px solid rgb(209 169 79 / 0.3); box-shadow: var(--shadow-2); }
  .nav.is-open { display: flex; }
  .nav a:not(.btn) { padding: var(--s-3) 0; border-bottom: 1px solid rgb(241 232 210 / 0.1); font-size: var(--fs-md); }
  .nav__join { margin-top: var(--s-4); }
  .hero__head, .sec-head, .signup__grid, .faq__grid, .plans { grid-template-columns: minmax(0, 1fr); }
  .course { grid-template-columns: minmax(0, 1fr) auto; }
  .course__text { grid-column: 1 / -1; }
  .foot__grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .hero { padding-top: var(--s-5); }
  .table { padding: var(--s-2); margin-inline: calc(var(--gutter) * -0.5); }
  .table__bar { padding: var(--s-1) var(--s-2) 0; }
  .table__help { padding: 0 var(--s-2) var(--s-2); }
  .board2d { top: 2.5%; height: 95%; max-width: 95%; border-width: 0.35rem; }
  .panel { padding: var(--s-4); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .actions .btn { flex: 1 1 40%; }
  .ledger, .streak, .rating, .tally, .plan, .form { padding: var(--s-4); }
  .course .btn { min-width: 0; }
  .fixture { grid-template-columns: 3.25rem minmax(0, 1fr); gap: var(--s-3) var(--s-4); }
  .medal { width: 3.25rem; height: 3.25rem; }
  .fixture__book { min-width: 0; width: 100%; grid-column: 1 / -1; }
  .fixture__when { grid-column: 1 / -1; }
  .form__submit { width: 100%; }
  .chart text { font-size: 24px; }
  .chart__pt { r: 4; }
  .fixture { align-items: start; }
  .seg__btn { padding: 0 0.7rem; }
}
