/*
 * The site's stylesheet. Everything it draws reads the custom properties in the first block, so a
 * theme restyles the site by setting them (see assets.rs for theme folders). Colours are written as
 * light-dark(light, dark); most tints are mixed from --brand, so one colour is enough to rebrand.
 *
 * The properties are set on :host as well as :root, for the site's header at the top of reports, which
 * sits in a shadow root of its own (see report_header.html). A theme should set them on both.
 */

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

:root, :host {
  /* colour */
  --brand: light-dark(#2d6a4f, #7cc39b);            /* buttons, links, highlights */
  --brand-ink: light-dark(#ffffff, #0f2419);        /* text on --brand */
  --wordmark-light: light-dark(#e1dbcc, #2c2a25);   /* the light squares of the name in the header */
  --bg: light-dark(#f6f4ef, #141312);
  --surface: light-dark(#ffffff, #1d1c1a);          /* cards */
  --surface-sunk: light-dark(#efece4, #181715);     /* wells, inputs */
  --text: light-dark(#1e1c18, #ece8df);
  --text-muted: light-dark(#6a655b, #a29c8f);
  --border: light-dark(#e3ded2, #33302b);
  --success: light-dark(#2f7d4f, #7cc39b);
  --warning: light-dark(#a8661a, #e2b04f);
  --danger: light-dark(#b8433b, #ef8a82);

  /* mixed from the above */
  --brand-soft: color-mix(in oklab, var(--brand) 13%, var(--surface));
  --brand-strong: color-mix(in oklab, var(--brand) 82%, var(--text));
  --danger-soft: color-mix(in oklab, var(--danger) 12%, var(--surface));
  --warning-soft: color-mix(in oklab, var(--warning) 14%, var(--surface));
  --sticker: light-dark(#f4b740, #e9b44c);          /* the order form's sales sticker */
  --sticker-ink: light-dark(#3b2604, #2b1c03);
  --focus-ring: 0 0 0 3px color-mix(in oklab, var(--brand) 45%, transparent);

  /* type */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font-sans);                 /* headings */
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text-size: 16px;
  --leading: 1.55;
  --heading-weight: 750;
  --heading-tracking: -0.025em;

  /* shape */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-button: 999px;                           /* 999px for pills, or match --radius */
  --border-width: 1px;

  /* depth */
  --shadow-sm: 0 1px 2px rgb(20 18 14 / 0.06);
  --shadow: 0 1px 2px rgb(20 18 14 / 0.05), 0 10px 28px -12px rgb(20 18 14 / 0.16);
  --shadow-lg: 0 2px 6px rgb(20 18 14 / 0.06), 0 28px 56px -18px rgb(20 18 14 / 0.26);

  /* space */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 80px;

  /* layout */
  --content-width: 1120px;
  --narrow-width: 720px;
  --gutter: 20px;

  /* motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --speed: 160ms;

  /* the faint chessboard behind the front page's opening; 0 turns it off */
  --pattern-opacity: 0.045;
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
/* a link to a part of a page shows it below the sticky header, not under it */
/* room kept for a scrollbar on every page, so a short page lines up with a long one where scrollbars take room */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 88px; scrollbar-gutter: stable; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: var(--text-size)/var(--leading) var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
h1, h2, h3 {
  font-family: var(--font-display); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking);
  line-height: 1.15; margin: 0 0 var(--space-3); text-wrap: balance;
}
h1 { font-size: clamp(30px, 4.2vw, 46px); }
h2 { font-size: clamp(24px, 3vw, 34px); }
h3 { font-size: 19px; letter-spacing: -0.01em; }
p { margin: 0 0 var(--space-4); text-wrap: pretty; }
a { color: var(--brand); text-underline-offset: 3px; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
::selection { background: var(--brand-soft); }

.container { width: 100%; max-width: calc(var(--content-width) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
/* an account's pages keep to one column under the logo, as wide as the order form's, so going from one to
   the next moves nothing */
.narrow > * { max-width: var(--narrow-width); }
.muted { color: var(--text-muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--space-4); top: -60px; z-index: 10; background: var(--surface); padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); }
.skip:focus { top: var(--space-3); }
.eyebrow { font-size: 13px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); margin-bottom: var(--space-3); }
.lede { font-size: clamp(17px, 1.6vw, 19px); color: var(--text-muted); max-width: 62ch; }
.page-head { padding: var(--space-7) 0 var(--space-5); }
.page-head .lede { margin-bottom: 0; }
.stack > * + * { margin-top: var(--space-4); }

/* ---------------------------------------------------------------- header and footer */

.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: var(--border-width) solid color-mix(in oklab, var(--border) 70%, transparent);
}
.header-row { display: flex; align-items: center; gap: var(--space-4); height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; letter-spacing: -0.01em; font-size: 17px; margin-right: auto; }
.brand img { height: 30px; width: auto; }
.brand-mark { flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; }
/* the name as it's drawn (templates/wordmark.html): a row of the board where there's room for it, and two
   rows, with the square left over empty, where there isn't */
.brand .wordmark { flex: none; width: auto; }
.brand .wordmark.wide { height: 28px; }
.brand .wordmark.stacked { display: none; height: 36px; }
@media (max-width: 900px) { .brand .wordmark.wide { display: none; } .brand .wordmark.stacked { display: block; } }
.site-nav { display: flex; align-items: center; gap: var(--space-1); }
.site-nav > a { color: var(--text-muted); text-decoration: none; font-size: 15px; font-weight: 550; padding: 8px 12px; border-radius: var(--radius-sm); }
.site-nav > a:hover { color: var(--text); background: var(--surface-sunk); }
.site-nav > a[aria-current="page"] { color: var(--text); }
@media (max-width: 560px) { .site-nav > a.optional { display: none; } }
/* on a phone, My reports is in the account menu, and the header keeps Games */
@media (max-width: 440px) { .site-nav > a.roomy { display: none; } }
.site-nav > a { white-space: nowrap; }

.icon-button {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-muted); cursor: pointer;
}
.icon-button:hover { color: var(--text); background: var(--surface-sunk); }
.icon-button svg { width: 19px; height: 19px; }
/* the sun when the page is light and the moon when it's dark, one over the other with the other unseen;
   light-dark() follows the color-scheme, which reaches into the report's header where :root can't */
.theme-toggle svg { grid-area: 1 / 1; }
.theme-toggle .sun { color: light-dark(currentColor, transparent); }
.theme-toggle .moon { color: light-dark(transparent, currentColor); }

.account { position: relative; }
.account summary { list-style: none; cursor: pointer; border-radius: 50%; }
.account summary::-webkit-details-marker { display: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; font-size: 15px; margin-left: var(--space-1);
}
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: var(--space-2);
  background: var(--surface); border: var(--border-width) solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.menu .who { padding: var(--space-2) var(--space-3) var(--space-3); border-bottom: var(--border-width) solid var(--border); margin-bottom: var(--space-2); overflow-wrap: anywhere; }
.menu .who span { display: block; font-size: 14px; color: var(--text-muted); }
.menu form { margin: 0; }
.menu hr { border: 0; border-top: var(--border-width) solid var(--border); margin: var(--space-2) 0; }
.menu-item {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 15px; color: var(--text); background: none; border: 0;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
}
.menu-item:hover { background: var(--surface-sunk); }

.site-footer { border-top: var(--border-width) solid var(--border); margin-top: var(--space-8); padding: var(--space-6) 0; color: var(--text-muted); font-size: 14px; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); }
.footer-links { display: flex; gap: var(--space-4); }
.footer-links a { color: inherit; text-decoration: none; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }
.footer-about { display: flex; flex-direction: column; gap: var(--space-1); }
.footer-build { font-size: 12px; font-variant-numeric: tabular-nums; opacity: 0.8; }

/* the header at the top of a report: a shadow root's host, styled apart from the report around it */
:host {
  display: block; background: var(--bg); color: var(--text);
  font: var(--text-size)/var(--leading) var(--font-sans); -webkit-font-smoothing: antialiased;
}
:host .site-header { position: static; }
@media print { :host { display: none; } }

/* ---------------------------------------------------------------- buttons */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font: inherit; font-weight: 650; font-size: 16px; line-height: 1.2; text-decoration: none; white-space: nowrap;
  padding: 13px 22px; border-radius: var(--radius-button); cursor: pointer;
  border: var(--border-width) solid var(--border); background: var(--surface); color: var(--text);
  transition: transform var(--speed) var(--ease), background var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.button:hover { background: var(--surface-sunk); }
.button:active { transform: translateY(1px); }
.button svg { width: 18px; height: 18px; }
.button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.button.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.button.large { padding: 16px 28px; font-size: 17px; }
.button.small { padding: 7px 14px; font-size: 14px; }
.button.small svg { width: 16px; height: 16px; }
.button.danger { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.button.danger:hover { background: color-mix(in oklab, var(--danger) 85%, var(--text)); }
.button.block { display: flex; width: 100%; }
.button[aria-busy="true"] { opacity: 0.7; pointer-events: none; }
.link-button { font: inherit; background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; }

/* ---------------------------------------------------------------- cards, badges, notes */

.card {
  background: var(--surface); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 32px); box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }
.card.flat { box-shadow: none; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; line-height: 1;
  padding: 6px 10px; border-radius: 999px; background: var(--surface-sunk); color: var(--text-muted); white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ready { background: var(--brand-soft); color: var(--brand-strong); }
.badge.live { background: var(--warning-soft); color: var(--warning); }
.badge.live::before { animation: pulse 1.4s var(--ease) infinite; }
.badge.failed { background: var(--danger-soft); color: var(--danger); }
.badge.plain::before { display: none; }
@keyframes pulse { 50% { opacity: 0.3; } }
.note { border-radius: var(--radius); padding: var(--space-3) var(--space-4); background: var(--surface-sunk); margin-bottom: var(--space-4); }
.note.error { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.note.info { background: var(--brand-soft); color: var(--brand-strong); }
.note.warning { background: var(--warning-soft); color: color-mix(in oklab, var(--warning) 70%, var(--text)); }
.note.error a, .note.warning a { color: inherit; font-weight: 650; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }

/* ---------------------------------------------------------------- forms */

.field { display: grid; gap: var(--space-2); margin: 0 0 var(--space-5); border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend { font-weight: 650; font-size: 15px; padding: 0; }
.legend-aside { font-weight: 400; color: var(--text-muted); }
.hint { font-size: 14px; color: var(--text-muted); }
.input {
  font: inherit; width: 100%; padding: 13px 14px; color: var(--text); background: var(--surface-sunk);
  border: var(--border-width) solid var(--border); border-radius: var(--radius); transition: border-color var(--speed), box-shadow var(--speed);
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus-ring); background: var(--surface); }
.input-prefixed { position: relative; }
.input-prefixed span { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--text-muted); pointer-events: none; }
.input-prefixed .input { padding-left: 32px; }
/* a drop-down that looks like the other fields, with an arrow of its own */
.select { position: relative; display: block; }
.select .input { appearance: none; padding-right: 40px; cursor: pointer; }
.select::after {
  content: ""; position: absolute; right: 18px; top: 50%; width: 7px; height: 7px; margin-top: -6px; pointer-events: none;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); rotate: 45deg;
}

/* a row of choices that reads as one control: radio buttons underneath */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px;
  background: var(--surface-sunk); border: var(--border-width) solid var(--border); border-radius: calc(var(--radius) + 2px);
}
.segmented label { position: relative; display: block; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: block; text-align: center; padding: 10px 8px; border-radius: var(--radius); font-weight: 600; font-size: 15px; color: var(--text-muted);
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
/* the chosen one stands up from the track: a card on it in light, and in dark, where a shadow doesn't show,
   a clearly lighter one with the brand's colour round it */
.segmented input:checked + span {
  background: light-dark(var(--surface), color-mix(in oklab, var(--text) 15%, var(--surface)));
  color: var(--text);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px light-dark(transparent, color-mix(in oklab, var(--brand) 60%, transparent));
}
.segmented input:focus-visible + span { box-shadow: var(--focus-ring); }
.segmented label:hover span { color: var(--text); }
.segmented.pairs { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
.segmented.wrap { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
/* a choice that costs more than the others, such as a report of two or three credits: in the warning colour, saying
   what it costs under it, with every choice in the row as tall */
.segmented:has(.more-credits) label { display: flex; }
.segmented:has(.more-credits) span { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.segmented .more-credits span { color: var(--warning); }
.segmented .more-credits small { font-size: 11px; font-weight: 650; line-height: 1.2; white-space: nowrap; }
.segmented .more-credits input:checked + span {
  background: var(--warning-soft); color: var(--warning); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--warning);
}
.segmented .more-credits:hover span { color: var(--warning); }
.more-credits-hint b { color: var(--warning); font-weight: 650; }

/* ---------------------------------------------------------------- the front page */

.hero { position: relative; overflow: hidden; padding: clamp(48px, 8vw, 104px) 0 clamp(48px, 7vw, 88px); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: var(--pattern-opacity);
  background: repeating-conic-gradient(var(--text) 0 25%, transparent 0 50%) 0 0 / 56px 56px;
  mask-image: radial-gradient(ellipse 70% 80% at 70% 30%, black, transparent 75%);
}
.hero::after {
  content: ""; position: absolute; z-index: -1; width: 640px; height: 640px; right: -160px; top: -220px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in oklab, var(--brand) 22%, transparent), transparent 65%);
}
.hero-grid { display: grid; gap: clamp(36px, 6vw, 72px); align-items: center; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }
@media (max-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }
.hero h1 { font-size: clamp(36px, 5.6vw, 62px); margin-bottom: var(--space-4); }
.hero .lede { margin-bottom: var(--space-6); }
.signin { display: grid; gap: var(--space-3); max-width: 380px; }
.signin form { display: flex; gap: var(--space-2); margin: 0; }
.signin .input { padding: 12px 14px; }
/* the "Get your report" buttons lead here: the sign-in buttons pulse, to say they're the next step */
.signin .button.nudge, .signin:target .button { animation: nudge 0.8s var(--ease) 3; }
@keyframes nudge {
  0% { box-shadow: var(--shadow-sm), 0 0 0 0 color-mix(in oklab, var(--brand) 60%, transparent); }
  25% { transform: scale(1.04); }
  50% { transform: scale(1); }
  100% { box-shadow: var(--shadow-sm), 0 0 0 16px color-mix(in oklab, var(--brand) 0%, transparent); }
}
.hero .reassure { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: var(--space-5) 0 0; padding: 0; list-style: none; color: var(--text-muted); font-size: 14px; }
/* under them, a way in for someone with no games to be read yet */
.hero .hero-new { margin: var(--space-4) 0 0; }
.reassure li { display: flex; align-items: center; gap: 6px; }
.reassure svg { width: 16px; height: 16px; color: var(--brand); }

/* the example report beside the opening */
.preview { position: relative; display: grid; gap: var(--space-4); }
.preview .card { padding: var(--space-5); border-radius: var(--radius-lg); }
.preview .card:nth-child(2) { margin-left: clamp(0px, 5vw, 48px); }
.preview .card:nth-child(3) { margin-left: clamp(0px, 2.5vw, 24px); }
.preview .tag { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: var(--space-2); }
.preview h3 { margin-bottom: var(--space-3); font-size: 17px; }
.preview .big { font-family: var(--font-display); font-size: 34px; font-weight: 750; letter-spacing: -0.03em; color: var(--brand); line-height: 1; }
.bars { display: grid; gap: 7px; margin-top: var(--space-3); }
.bars div { display: grid; grid-template-columns: 92px 1fr 42px; gap: var(--space-3); align-items: center; font-size: 13px; color: var(--text-muted); }
.bars i { height: 8px; border-radius: 4px; background: var(--surface-sunk); position: relative; overflow: hidden; }
.bars i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 4px; background: var(--brand); }
.bars i.bad::after { background: var(--danger); }
.bars b { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.example-label { position: absolute; top: -12px; right: 12px; z-index: 1; }
/* under the examples: that they're a few of many */
.preview .card.more { padding: var(--space-4) var(--space-5); border-style: dashed; background: transparent; box-shadow: none; font-size: 14px; color: var(--text-muted); }
.preview .card.more p { margin: 0; }
.preview .card.more b { color: var(--text); }
.preview .card.more .see-example { margin-top: var(--space-3); }

.section { padding: clamp(56px, 8vw, 96px) 0 0; }
.section-head { max-width: 640px; margin-bottom: var(--space-6); }
.section-head.center { margin-left: auto; margin-right: auto; }
.steps { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); counter-reset: step; list-style: none; margin: 0; padding: 0; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; margin-bottom: var(--space-4);
  background: var(--brand-soft); color: var(--brand-strong); font-weight: 750;
}
.features { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
/* four, two by two rather than three and one */
.features.pairs { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.feature { padding: var(--space-5); }
.feature .icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); margin-bottom: var(--space-4); }
.feature .icon svg { width: 22px; height: 22px; }
.feature p { color: var(--text-muted); margin: 0; }

.pricing { max-width: 480px; margin: 0 auto; text-align: center; padding: clamp(28px, 4vw, 44px); }
.price { font-family: var(--font-display); font-size: 56px; font-weight: 780; letter-spacing: -0.04em; line-height: 1; margin: var(--space-3) 0 var(--space-2); }
.price-about { margin: 0 0 var(--space-1); font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ticks { list-style: none; padding: 0; margin: var(--space-5) 0 var(--space-6); display: grid; gap: var(--space-3); text-align: left; }
.ticks li { display: grid; grid-template-columns: 22px 1fr; gap: var(--space-2); }
.ticks svg { width: 18px; height: 18px; margin-top: 3px; color: var(--brand); }
/* the reports of more games, which cost more than the price above: in the warning colour, as the order
   form picks them out */
.bigger { text-align: left; background: var(--warning-soft); border-radius: var(--radius); padding: var(--space-4) var(--space-5); margin: 0 0 var(--space-6); }
.bigger p { margin: var(--space-1) 0 0; font-weight: 600; }
.bigger .bigger-head { margin: 0 0 var(--space-2); font-weight: 700; color: var(--warning); }
.bigger .bigger-note { margin-top: var(--space-2); font-size: 14px; font-weight: 500; color: var(--text-muted); }

.faq { max-width: var(--narrow-width); margin: 0 auto; }
.faq details { border-bottom: var(--border-width) solid var(--border); }
.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-5) 0; font-weight: 650; font-size: 17px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--text-muted); transition: rotate var(--speed) var(--ease); }
.faq details[open] summary::after { rotate: 45deg; }
.faq details p { color: var(--text-muted); margin-top: calc(-1 * var(--space-2)); padding-bottom: var(--space-3); }

.launch-note { max-width: var(--narrow-width); margin: var(--space-6, 32px) auto 0; text-align: center; text-wrap: balance; color: var(--text-muted); }
.launch-note b { color: var(--text); font-weight: 650; }
.closing { text-align: center; padding: clamp(36px, 6vw, 64px); background: var(--brand-soft); border-color: transparent; box-shadow: none; }
.closing p { color: var(--text-muted); }

/* ---------------------------------------------------------------- ordering */

/* the form as wide as the other pages' column, and the summary beside it while there's room, under it after */
.order-grid { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, var(--narrow-width)) minmax(0, 1fr); align-items: start; }
@media (max-width: 1080px) { .order-grid { grid-template-columns: minmax(0, var(--narrow-width)); } }
.aside { position: sticky; top: 88px; }
.aside h3 { margin-bottom: var(--space-4); }
/* a sales sticker for a report's free remakes, stuck on with a bit of a slap: on the corner of what a report
   includes, or beside the heading where that's under the form */
.aside.with-sticker h3 { padding-right: 96px; margin-bottom: var(--space-5); }
.sticker.in-head { display: none; }
.pricing.with-sticker { position: relative; }
.sticker.on-pricing { top: -46px; right: -28px; width: 128px; height: 128px; }
@media (max-width: 560px) { .sticker.on-pricing { top: -54px; right: -12px; width: 104px; height: 104px; } }
@media (max-width: 1080px) {
  .sticker.on-aside { display: none; }
  .aside.with-sticker h3 { padding-right: 0; margin-bottom: var(--space-4); }
  /* beside the heading, its right edge in line with the form's */
  .page-head.with-sticker { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
                            max-width: var(--narrow-width); }
  .sticker.in-head { display: grid; position: relative; top: auto; right: auto; flex: none; width: 104px; height: 104px; }
}
.sticker { position: absolute; top: -50px; right: -18px; width: 118px; height: 118px; display: grid; place-items: center;
           color: var(--sticker-ink); transform: rotate(12deg); filter: drop-shadow(0 6px 10px rgb(20 18 14 / 0.28));
           pointer-events: none; animation: sticker-in 650ms var(--ease) 250ms both; }
.sticker svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sticker polygon { fill: var(--sticker); }
.sticker circle { fill: none; stroke: currentColor; stroke-opacity: 0.14; stroke-width: 1.2; stroke-dasharray: 3 2.5; }
.sticker span { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1.05; text-align: center; }
.sticker small { font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.08em; }
.sticker b { font-size: 20px; font-weight: 850; letter-spacing: -0.02em; }
.sticker b + b { font-size: 16px; }
.sticker .more { margin-top: 4px; font-size: 10.5px; font-weight: 650; text-transform: none; letter-spacing: 0; }
@keyframes sticker-in {
  from { opacity: 0; transform: rotate(-24deg) scale(0.4); }
  70% { opacity: 1; transform: rotate(15deg) scale(1.06); }
  to { opacity: 1; transform: rotate(12deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .sticker { animation: none; } }
.summary { display: grid; gap: var(--space-2); margin: var(--space-5) 0 0; padding: var(--space-4) 0 0; border-top: var(--border-width) solid var(--border); }
.summary div { display: flex; justify-content: space-between; gap: var(--space-3); }
.summary dt { color: var(--text-muted); }
.summary dd { margin: 0; font-weight: 650; text-align: right; }
.fine-print { font-size: 14px; color: var(--text-muted); margin: var(--space-3) 0 0; text-align: center; }
.recap-player { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.recap-player .initial { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); font-weight: 750; font-size: 18px; text-transform: uppercase; }
.recap-player .player-name { font-size: 22px; font-weight: 750; overflow-wrap: anywhere; }
.recap-player .player-site { color: var(--text-muted); white-space: nowrap; }
.recap-player .hint { display: block; margin-top: var(--space-1); }
.credits-left, .credits-back { margin: var(--space-5) 0 0; }
.credits-left + .credits-back { margin-top: var(--space-3); }
.confirm-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }
.confirm-actions .button { flex: 1 1 auto; white-space: normal; }

/* ---------------------------------------------------------------- a report's progress */

/* the heading's own space below it, which it gives up to line up with the button or chips beside it, goes under
   the row instead, so the page starts at the same height as one with a heading alone */
.job-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--space-4);
            padding-bottom: calc(var(--space-5) + var(--space-3)); }
.job-head h1 { margin: 0; overflow-wrap: anywhere; }
.status { margin-top: var(--space-5); }
.status-line { display: flex; align-items: center; gap: var(--space-3); font-size: 18px; font-weight: 600; margin-bottom: var(--space-5); }
.spinner { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2.5px solid var(--brand-soft); border-top-color: var(--brand); animation: spin 0.9s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
.progress { height: 10px; border-radius: 5px; background: var(--surface-sunk); overflow: hidden; margin-bottom: var(--space-5); }
.progress i { display: block; height: 100%; border-radius: 5px; background: var(--brand); transition: width 0.6s var(--ease); }
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2); list-style: none; margin: 0; padding: 0; counter-reset: s; }
.stepper li { counter-increment: s; display: grid; gap: var(--space-2); font-size: 14px; color: var(--text-muted); }
.stepper li::before { content: ""; height: 4px; border-radius: 2px; background: var(--border); }
.stepper li.done::before, .stepper li.now::before { background: var(--brand); }
.stepper li.now { color: var(--text); font-weight: 650; }
@media (max-width: 560px) { .stepper li span { display: none; } .stepper li.now span { display: inline; } .stepper { grid-template-columns: repeat(4, 1fr); } }
.finished { text-align: center; padding: var(--space-4) 0 var(--space-2); }
.finished .tick { width: 56px; height: 56px; margin: 0 auto var(--space-4); border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }
.finished .tick svg { width: 28px; height: 28px; }
.finished-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); }

/* ---------------------------------------------------------------- a person's reports */

.list { padding: var(--space-2); }
.row { display: flex; align-items: center; border-radius: var(--radius); }
.row + .row { border-top: var(--border-width) solid var(--border); border-top-left-radius: 0; border-top-right-radius: 0; }
.row:hover { background: var(--surface-sunk); }
.row-link {
  flex: 1; min-width: 0; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: var(--space-4); align-items: center;
  padding: var(--space-4); border-radius: inherit; color: var(--text); text-decoration: none;
}
/* beside the report, not in it: the row leads to the report, and this to the order form, or a free remake */
.row-again { flex: none; margin-right: var(--space-4); }
.row-again-form { display: contents; }
/* monthly reports: on Credits, the offer on My reports, and the box on the page confirming a purchase */
.monthly-card { margin-bottom: var(--space-5); }
.monthly-card h2 { margin-bottom: var(--space-3); }
.monthly-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: var(--space-4) 0 0; }
.monthly-form .select { flex: 1 1 260px; }
.monthly-offer form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: var(--space-3) 0 0; }
.monthly-offer p { margin: 0; }
.monthly-next { margin: 0 0 var(--space-4); }
.monthly-check { align-items: flex-start; margin: var(--space-5) 0 0; font-size: 14px; line-height: 1.5; }
.monthly-check input { margin-top: 4px; flex: none; }
.row-again .narrow { display: none; }
.row .initial { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); font-weight: 750; font-size: 18px; text-transform: uppercase; }
.row .what b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .what span { font-size: 14px; color: var(--text-muted); }
.row .badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }
/* on a phone, the badges go under the player, leaving the width to their name, and Make again is its icon,
   with "Free" beside it when it's a free remake */
@media (max-width: 560px) {
  .row-link { grid-template-columns: 44px minmax(0, 1fr); gap: var(--space-2) var(--space-3); padding-right: var(--space-3); }
  .row .initial { grid-row: span 2; }
  .row .badges { justify-content: flex-start; }
  .row-again { padding: 8px; margin-right: var(--space-3); }
  .row-again span { display: none; }
  .row-again .narrow { display: inline; }
}
.badge svg { width: 13px; height: 13px; }
.empty { text-align: center; padding: clamp(40px, 7vw, 72px) var(--space-5); }
.empty .icon { width: 56px; height: 56px; margin: 0 auto var(--space-4); border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }
.empty .icon svg { width: 26px; height: 26px; }

/* ---------------------------------------------------------------- playing the engine */

/* The board from the page's left edge, as wide as there's room for beside the panel, up to what fits the
   window's height with the names and the status line around it, and never less than 560px for that. */
.play { --board: calc(100dvh - 13rem); display: grid; grid-template-columns: minmax(0, clamp(560px, var(--board), calc(100% - 380px - var(--space-6)))) minmax(0, 380px); gap: var(--space-6); align-items: start; justify-content: start; padding-bottom: var(--space-7); }
@media (max-width: 960px) { .play { grid-template-columns: minmax(0, clamp(560px, var(--board), 100%)); gap: var(--space-5); } }
.play-main { position: relative; min-width: 0; }
.play-who { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 40px; font-weight: 650; }
/* there or not, it takes the same room, so nothing moves as it comes and goes */
.play-thinking { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 14px; font-weight: 500; color: var(--text-muted); visibility: hidden; }
.play-thinking.on { visibility: visible; }
.play-thinking .spinner { width: 16px; height: 16px; }
.play-boardwrap { position: relative; display: flex; gap: 6px; }
.play-board { position: relative; flex: 1; min-width: 0; aspect-ratio: 1; touch-action: none; user-select: none; -webkit-user-select: none; }
/* your win chance, filling from your side of the board */
.play-bar { position: relative; flex: none; width: 12px; overflow: hidden; border-radius: 4px; background: var(--surface-sunk); border: var(--border-width) solid var(--border); }
.play-bar[hidden] { display: none; }
.play-bar span { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: var(--brand); transition: height 0.35s var(--ease); }
.play-side { display: inline-flex; align-items: center; gap: var(--space-3); min-width: 0; }
/* the pieces a side has taken beyond what the other took back in kind, on the board's own colour so both
   sides' pieces show in either theme; same pieces overlap, to keep a long row short */
.play-taken { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 999px; background: #d9a066; }
.play-taken:empty { display: none; }
.play-taken span { display: inline-flex; }
.play-taken svg { display: block; width: 20px; height: 20px; flex: none; }
.play-taken svg + svg { margin-left: -11px; }
.play-you { display: inline-flex; align-items: center; gap: var(--space-3); min-width: 0; }
/* on, it's edged in the orange of the arrows it draws */
.play-hint[aria-pressed="true"] { border-color: #e8902a; box-shadow: inset 0 0 0 1px #e8902a; }
.play-chance { font-size: 14px; font-weight: 500; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.play-board svg { display: block; width: 100%; height: auto; border-radius: 4px; }
.play-board.movable { cursor: pointer; }
.play-promote { position: absolute; inset: 0; display: grid; place-items: center; background: rgb(0 0 0 / 0.4); border-radius: 4px; }
.play-promote[hidden] { display: none; }
.play-promote > div { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--space-2); padding: var(--space-3); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.play-promote p { width: 100%; margin: 0; text-align: center; font-weight: 650; }
.play-promote button { width: 64px; height: 64px; padding: 4px; border: var(--border-width) solid var(--border); border-radius: 10px; background: #ffce9e; cursor: pointer; }
.play-promote button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.field[hidden] { display: none; }
.play-won { position: absolute; inset: 0; display: grid; place-items: center; padding: var(--space-4); pointer-events: none; }
.play-won[hidden] { display: none; }
.play-won > div { pointer-events: auto; max-width: 22rem; padding: var(--space-5) var(--space-6); text-align: center; background: var(--surface);
                  border: 2px solid var(--sticker); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg), 0 0 0 6px color-mix(in oklab, var(--sticker) 30%, transparent);
                  animation: won-in 700ms var(--ease) 750ms both; }
.play-won p { margin: 0; text-wrap: balance; }
.play-won-title { font-family: var(--font-display); font-size: clamp(30px, 7vw, 44px); font-weight: 850; letter-spacing: -0.03em; line-height: 1.05; color: var(--brand); }
.play-won-title + p { margin-top: var(--space-2); font-weight: 600; }
.play-won-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-4) !important; }
.play-confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
@keyframes won-in {
  from { opacity: 0; transform: scale(0.5) rotate(-6deg); }
  65% { opacity: 1; transform: scale(1.06) rotate(1.5deg); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .play-won > div { animation: none; } }
.play-status-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); margin: var(--space-3) 0 0; }
.play-status { flex: 1 1 18rem; margin: 0; min-height: 1.5em; font-weight: 650; }
.play-back[hidden] { display: none; }
.play-coach { margin: var(--space-3) 0 0; padding: var(--space-3) var(--space-4); border: var(--border-width) solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 15px; }
.play-coach[hidden] { display: none; }
.play-coach p { margin: 0; }
.play-coach > * + * { margin-top: var(--space-2); }
.coach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.coach-list li { padding: 2px 0 2px var(--space-3); border-left: 4px solid #2f9e55; }
.coach-list li.danger { border-left-color: #d6453d; }
.coach-list li.deep { border-left-style: dashed; }
.coach-last { padding-bottom: var(--space-2); border-bottom: var(--border-width) solid var(--border); color: var(--text-muted); }
.coach-last.missed { color: var(--text); }
.coach-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.coach-score { font-size: 13px; color: var(--text-muted); }
.coach-score button { padding: 0; border: 0; background: none; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
.play-elo { display: grid; grid-template-columns: minmax(0, 1fr) 5ch; gap: var(--space-3); align-items: center; }
.play-elo input { width: 100%; margin: 0; accent-color: var(--brand); }
.play-elo output { font-weight: 750; font-size: 18px; text-align: right; font-variant-numeric: tabular-nums; }
.play-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-5); }
.play-opening { width: fit-content; max-width: 100%; margin: var(--space-2) 0 0 calc(-1 * var(--space-2)); padding: 2px var(--space-2); min-height: 1.6em; border-radius: var(--radius-sm);
                font-size: 15px; font-weight: 650; color: var(--brand-strong); }
.play-opening:empty { visibility: hidden; }
.play-opening.new { animation: opening-new 1800ms var(--ease); }
@keyframes opening-new {
  from { background: var(--sticker); color: var(--sticker-ink); transform: scale(1.04); }
  35% { background: var(--sticker); color: var(--sticker-ink); transform: none; }
  to { background: transparent; }
}
@media (prefers-reduced-motion: reduce) { .play-opening.new { animation: none; } }
.play-moves .named { text-decoration: underline dotted; text-decoration-color: var(--brand); text-decoration-thickness: 2px; text-underline-offset: 4px; }
/* a fixed height, so the panel doesn't grow as the game does: the latest moves are kept in sight */
.play-moves {
  list-style: none; margin: 0; padding: var(--space-2); height: 228px; overflow-y: auto; font-size: 15px; font-variant-numeric: tabular-nums;
  background: var(--surface-sunk); border: var(--border-width) solid var(--border); border-radius: var(--radius);
}
/* each line a button, back to before your move in it */
.play-line {
  display: grid; grid-template-columns: 3.2ch minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2); align-items: center; width: 100%;
  padding: 2px var(--space-2); border: 0; border-radius: 6px; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.play-line:hover { background: var(--surface); }
.play-line:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.play-line.here { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
/* showing who's winning: Black's move on the right, and between, a bar from the middle toward whoever is */
.play-moves.judged .play-line { grid-template-columns: 3.2ch minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr); }
.play-moves.judged .play-line > :last-child { text-align: right; }
.play-moves .tilt { position: relative; height: 12px; }
.play-moves .tilt::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.play-moves .tilt::after { content: ""; position: absolute; left: calc(50% - 0.5px); top: 0; bottom: 0; width: 1px; background: var(--text-muted); }
/* yours in the colour of the bar by the board, Stockfish's in grey */
.play-moves .lean { position: absolute; top: 3px; bottom: 3px; background: var(--brand); border-radius: 3px; }
.play-moves .lean.theirs { background: color-mix(in oklab, var(--text-muted) 70%, var(--surface-sunk)); }
.play-moves .n { color: var(--text-muted); }
/* looking back, the moves a move from there would take the place of */
.play-moves .gone { opacity: 0.45; }
/* the moves of the opening the game started from */
.play-moves .set { color: var(--text-muted); }
/* what a move gave up, as reports' game viewers mark it */
.play-moves .s-blunder, .play-moves .s-mistake, .play-moves .s-mate, .play-key .s-blunder, .play-key .s-mistake { color: var(--danger); font-weight: 650; }
.play-moves .s-inaccuracy, .play-key .s-inaccuracy { color: var(--warning); font-weight: 650; }
.play-toggle { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-4); font-size: 15px; cursor: pointer; }
.play-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.play-key { margin: var(--space-2) 0 0; font-size: 13px; color: var(--text-muted); }
.play-key span { margin-left: var(--space-2); }
.play-key span:first-child { margin-left: 0; }
.play-credit { text-align: left; }

/* ---------------------------------------------------------------- the games (templates/games.html, game.html; static/games.js) */
.games-page { padding-bottom: var(--space-7); }
.games-list { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.game-card { position: relative; display: block; padding: var(--space-5); color: inherit; text-decoration: none; transition: translate var(--speed) var(--ease), box-shadow var(--speed) var(--ease), border-color var(--speed) var(--ease); }
.game-card:hover { translate: 0 -2px; box-shadow: var(--shadow-lg); border-color: color-mix(in oklab, var(--brand) 45%, var(--border)); }
.game-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.game-card h2 { font-size: 22px; margin: 0 0 var(--space-2); }
.game-card p { margin: 0; color: var(--text-muted); }
.game-piece { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: var(--space-4); border-radius: 14px; background: #d9a066; }
.game-piece svg { width: 48px; height: 48px; }
.game-card.engine .game-piece { background: #b9773a; }
.game-kind { display: block; font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); margin-bottom: var(--space-1); }
.game-done { position: absolute; top: var(--space-5); right: var(--space-5); padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong); font-size: 13px; font-weight: 650; }
.game-done[hidden] { display: none; }
.game-page .eyebrow a { color: inherit; }
.game-top { display: flex; align-items: center; min-height: 40px; }
.game-top .game-tally { margin: 0; }
.game-under:empty, .game-said:empty { display: none; }
.game-under { margin: var(--space-3) 0 0; }
.game .play-status { margin: var(--space-3) 0 0; }
.game .play-actions { align-items: center; margin: 0; }
.game-said { margin: var(--space-3) 0 0; padding: var(--space-3) var(--space-4); border: var(--border-width) solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 15px; }
.game-said p { margin: 0; }
.game-said > * + * { margin-top: var(--space-3); }
.game-panel .play-actions { margin: 0 0 var(--space-5); }
.game-panel .field > .label { font-weight: 650; font-size: 15px; }
.game-tally { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: 0 0 var(--space-5); }
.game-tally div { display: flex; align-items: baseline; gap: var(--space-2); }
.game-tally dt { font-size: 13px; color: var(--text-muted); }
.game-tally dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.game-hint { display: block; margin: calc(-1 * var(--space-3)) 0 var(--space-5); }
.game-panel [data-panel]:empty + .game-how { padding-top: 0; border-top: 0; }
.game-link { display: block; color: inherit; text-decoration: none; }
.game-link:hover { border-color: color-mix(in oklab, var(--brand) 45%, var(--border)); }
.games-more { margin: var(--space-5) 0 0; }
.game-how { margin: 0 0 var(--space-4); padding-top: var(--space-4); border-top: var(--border-width) solid var(--border); font-size: 15px; }
.game-how summary { font-weight: 650; cursor: pointer; }
.game-how ul { margin: var(--space-3) 0 0; padding-left: 1.2em; display: grid; gap: var(--space-2); color: var(--text-muted); }
.game-story { padding-top: var(--space-4); border-top: var(--border-width) solid var(--border); font-size: 15px; }
.game-story h2 { font-size: 16px; margin: 0 0 var(--space-2); letter-spacing: 0; }
.game-story p { margin: 0; color: var(--text-muted); }
.game-picks { display: grid; gap: 6px; }
.game-pick { display: grid; gap: 1px; padding: 8px 12px; text-align: left; font: inherit; color: var(--text); cursor: pointer; background: var(--surface-sunk); border: var(--border-width) solid var(--border); border-radius: var(--radius-sm); }
.game-pick span { font-size: 13px; color: var(--text-muted); }
.game-pick:hover { border-color: color-mix(in oklab, var(--brand) 45%, var(--border)); }
.game-pick:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.game-pick.here { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.game-pick.done b::after { content: " \2713"; color: var(--success); }
.game-line { margin: 0 0 var(--space-4); font-size: 14px; color: var(--text-muted); overflow-wrap: anywhere; }
/* Recall: the time left to look, the pieces to put back, and how it's gone */
.game-fuse { flex: 1; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-sunk); border: var(--border-width) solid var(--border); }
.game-fuse i { display: block; height: 100%; background: var(--brand); transform-origin: left; animation: game-fuse linear forwards; }
@keyframes game-fuse { to { transform: scaleX(0); } }
.game-tray { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 0 0 var(--space-3); }
.game-tray button { aspect-ratio: 1; padding: 2px; border: 2px solid transparent; border-radius: 10px; background: #d9a066; cursor: pointer; }
.game-tray button svg { display: block; width: 100%; height: 100%; }
.game-tray button.here { border-color: var(--brand); box-shadow: var(--focus-ring); background: #ffce9e; }
@media (min-width: 620px) { .game-tray { grid-template-columns: repeat(12, minmax(0, 1fr)); } }
.game-bar { display: grid; grid-template-columns: 14ch minmax(0, 1fr) 4ch; align-items: center; gap: var(--space-3); font-size: 14px; }
.game-bar i { height: 10px; border-radius: 5px; background: linear-gradient(var(--brand), var(--brand)) left / var(--w) 100% no-repeat var(--surface-sunk); }
.game-bar b { text-align: right; font-variant-numeric: tabular-nums; }
/* Warmer, colder: the tries so far */
.game-tries { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.game-tries li { display: grid; grid-template-columns: 16px minmax(0, 1fr) 5ch 7ch; align-items: center; gap: var(--space-2); font-size: 15px; font-variant-numeric: tabular-nums; }
.game-tries li span { color: var(--text-muted); text-align: right; }
.game-tries li.none { display: block; color: var(--text-muted); }
.game-chip { width: 14px; height: 14px; border-radius: 4px; background: var(--c); }
.game-share { margin-top: var(--space-3); width: 100%; font-size: 14px; }
/* Who played it?: the two moves to choose between, and what's known of them */
.game-two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.game-two .button { justify-content: center; font-size: 18px; border: 2px solid var(--c); box-shadow: inset 0 -4px 0 color-mix(in oklab, var(--c) 30%, transparent); }
.game-two .button:disabled { opacity: 0.55; cursor: default; }
.game-two.game-three { grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
/* over the board, in the game with no board to look at: the name of the square asked about */
.game-cover { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font-size: clamp(72px, 22vw, 150px); font-weight: 800; letter-spacing: -0.04em; color: #3a2410; }
.game-cover[hidden] { display: none; }
.game-two.game-three .button { font-size: 15px; padding-inline: 6px; white-space: normal; text-align: center; line-height: 1.2; }
.game-said .button:disabled { opacity: 0.45; cursor: default; }
.game-two .button.right:disabled { opacity: 1; background: color-mix(in oklab, var(--success) 16%, var(--surface)); }
.game-two.names .button { font-size: 15px; white-space: normal; text-align: center; line-height: 1.25; border: var(--border-width) solid var(--border); box-shadow: none; }
.game-under .game-line { margin: 0 0 var(--space-3); }
/* the name of the square to find, and the piece that's in hand to be put down */
.game-ask { margin: 0; text-align: center; font-size: 46px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--text); }
/* buying an army: a row for each kind of piece, with its price and how many */
.game-buy { display: grid; gap: var(--space-2); }
.game-buy > div { display: grid; grid-template-columns: 38px 1fr auto 2ch auto; align-items: center; gap: var(--space-3); }
.game-buy svg { width: 38px; height: 38px; border-radius: var(--radius-sm); background: #e8ad72; }
.game-buy small { color: var(--text-muted); margin-left: 4px; }
.game-buy b { text-align: center; font-variant-numeric: tabular-nums; }
.game-buy .button { min-width: 40px; justify-content: center; }
.game-buy .button:disabled { opacity: 0.4; cursor: default; }
/* the moves read out in the game played with the pieces out of sight */
.game-moves { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.game-hand { display: flex; align-items: center; gap: var(--space-3); }
.game-hand svg { width: 52px; height: 52px; flex: none; padding: 3px; border-radius: var(--radius); background: #e8ad72; }
.game-line b { color: var(--text); }
.game-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.game-table th, .game-table td { padding: 5px 8px; text-align: right; border-bottom: var(--border-width) solid var(--border); }
.game-table th:first-child { text-align: left; font-weight: 500; color: var(--text-muted); }
.game-table thead th { font-weight: 700; }

/* ---------------------------------------------------------------- messages */

.message { max-width: 560px; margin: clamp(40px, 8vw, 96px) auto 0; text-align: center; }
.message .lede { margin-left: auto; margin-right: auto; }
.message-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); }
.message-actions form { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  /* rather than pulse, the sign-in buttons keep a ring */
  .signin .button.nudge, .signin:target .button { box-shadow: var(--shadow-sm), 0 0 0 4px color-mix(in oklab, var(--brand) 40%, transparent); }
}

/* ---------------------------------------------------------------- long text: the privacy policy and terms */

.prose { max-width: 68ch; padding-bottom: var(--space-6); }
.prose h2 { font-size: 22px; margin-top: var(--space-6); }
.prose ul { padding-left: 1.2em; margin: 0 0 var(--space-4); }
.prose li { margin-bottom: var(--space-2); }
.prose li::marker { color: var(--text-muted); }

/* ---------------------------------------------------------------- packs of credits, on the order form and front page */

.packs { display: grid; gap: var(--space-2); }
.packs label {
  display: flex; align-items: center; gap: var(--space-3); cursor: pointer;
  padding: var(--space-3) var(--space-4); border: var(--border-width) solid var(--border); border-radius: var(--radius);
  background: var(--surface); transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.packs label:hover { border-color: color-mix(in oklab, var(--brand) 40%, var(--border)); }
.packs label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.packs input { accent-color: var(--brand); margin: 0; width: 18px; height: 18px; }
.pack-what { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--space-2); }
.pack-name { font-weight: 650; white-space: nowrap; }
.pack-price { margin-left: auto; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* (it may wrap after "about", so a pack fits on the narrowest phones) */
.pack-about { display: block; text-align: right; font-size: 13px; font-weight: 500; color: var(--text-muted); white-space: normal; }
.save { white-space: nowrap; font-size: 13px; font-weight: 650; color: var(--success); background: color-mix(in oklab, var(--success) 13%, var(--surface)); padding: 2px 8px; border-radius: 999px; }
/* beside the price it takes off, just left of it */
.pack-price .save { margin-right: var(--space-2); vertical-align: 1px; }
.pack-offer { margin: calc(-1 * var(--space-2)) 0 var(--space-4); font-weight: 600; color: var(--brand-strong); }
.credit-note { margin: calc(-1 * var(--space-2)) 0 0; font-size: 14px; color: var(--text-muted); }
/* a pack too small for the report chosen, such as one credit for a report of two */
.packs label:has(input:disabled) { cursor: not-allowed; background: var(--surface-sunk); border-color: var(--border); color: var(--text-muted); }
.packs label:has(input:disabled) .save { display: none; }
.too-few { font-size: 13px; font-weight: 600; color: var(--warning); }
.packs label:not(:has(input:disabled)) .too-few { display: none; }
/* the parts of the order form for buying a pack, shown when a report takes more credits than they have */
fieldset.shop { border: 0; padding: 0; margin: 0; min-width: 0; }
/* reports are slow to start just now: said under the button */
.queue-slow { margin: var(--space-4) 0 0; font-size: 15px; }

/* ---------------------------------------------------------------- tables: credits, and the admin pages' accounts */

.table-wrap { overflow-x: auto; padding: var(--space-2) var(--space-3); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); padding: var(--space-2) var(--space-3); border-bottom: var(--border-width) solid var(--border); white-space: nowrap;
}
.table td { padding: var(--space-3); border-bottom: var(--border-width) solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .date { white-space: nowrap; color: var(--text-muted); }
.table .gain { color: var(--success); font-weight: 650; }
.table .spend { color: var(--text-muted); }
.table .sub { display: block; font-size: 14px; color: var(--text-muted); }
.table .links { display: flex; flex-wrap: wrap; gap: var(--space-3); font-size: 14px; margin-top: 2px; }
.table a { text-decoration: none; }
.table a:hover { text-decoration: underline; }
@media (max-width: 560px) {
  .table .optional { display: none; }
  .table-wrap { padding: var(--space-1); }
  .table td, .table th { padding-left: var(--space-2); padding-right: var(--space-2); }
}

.balance-card { margin-bottom: var(--space-5); }
.balance { font-size: 20px; margin: 0 0 var(--space-1); }
.balance b { font-family: var(--font-display); font-size: 44px; font-weight: 780; letter-spacing: -0.03em; margin-right: 4px; }
/* Canada's leaf, after the line that says whose the site is */
.maple-leaf { width: 1em; height: 1em; vertical-align: -0.12em; fill: #d52b1e; }
/* the way down to the form that sells more, raised beside the count */
.balance-buy { font-size: 13px; font-weight: 600; line-height: 0; margin-left: 2px; white-space: nowrap; }
.section-title { font-size: 22px; margin-top: var(--space-6); }

/* ---------------------------------------------------------------- the admin pages */

.search { display: flex; gap: var(--space-2); flex: 1; max-width: 420px; }
.search .input { flex: 1; }
.search .button { padding: 10px 18px; }
.admin-grid { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: var(--space-4); align-items: start; }
.admin-grid .balance-card { margin: 0; }
@media (max-width: 700px) { .admin-grid { grid-template-columns: 1fr; } }
.grant h3 { margin-bottom: var(--space-4); }
.grant-row { display: grid; grid-template-columns: 110px 1fr; gap: var(--space-3); }
.grant-row .field { margin-bottom: var(--space-3); }
.grant .hint { margin-left: var(--space-3); }
.danger-zone { margin-top: var(--space-7); border-color: color-mix(in oklab, var(--danger) 40%, var(--border)); }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }

/* ---------------------------------------------------------------- under the header on a report: how long it's kept, a copy to save, and sharing it */

.report-bar { background: var(--brand-soft); border-bottom: var(--border-width) solid color-mix(in oklab, var(--brand) 25%, var(--border)); }
.report-bar-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); padding-block: var(--space-2); font-size: 14px; color: var(--brand-strong); font-weight: 600; }
.report-bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.report-bar form, .share-card form { margin: 0; }
/* while it's shared: its link, to copy, and a button to stop */
.report-share { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding-block: 0 var(--space-2); font-size: 14px; color: var(--brand-strong); font-weight: 600; }
.report-share .copy-row { flex: 1 1 300px; }
.report-share .copy-row .input { font-size: 13px; padding: 6px 10px; }
.share-card { margin-top: var(--space-4); display: grid; gap: var(--space-3); justify-items: start; }
.share-card > * { margin: 0; }
.share-card h2 { display: flex; align-items: center; gap: var(--space-2); font-size: 18px; }
.share-card h2 svg { width: 20px; height: 20px; }
.share-card .copy-row { width: 100%; }

/* ---------------------------------------------------------------- inviting friends */

.invite-lede { margin-top: 0; }
.copy-row { display: flex; gap: var(--space-2); }
.copy-row .input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 15px; }
.invite-nudge { margin: var(--space-5) 0 0; font-size: 15px; color: var(--text-muted); }

/* ---------------------------------------------------------------- codes for credits */

.redeemed { margin-bottom: var(--space-5); }
.redeemed .lede { margin-top: 0; color: var(--text); font-weight: 650; }
.code-input { font-family: var(--font-mono); font-size: 17px; letter-spacing: 0.06em; text-transform: uppercase; }
.table .code { font-family: var(--font-mono); white-space: nowrap; }
.table tr:target td { background: var(--brand-soft); }
.make-codes h3 { margin-bottom: var(--space-4); }
.make-codes-row { display: grid; grid-template-columns: 110px 110px 1fr 160px; gap: var(--space-3); }
.make-codes-row .field { margin-bottom: var(--space-3); }
@media (max-width: 700px) { .make-codes-row { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-4); font-size: 15px; }
.head-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* ---------------------------------------------------------------- gifts */

.gift-count { max-width: 120px; }
.gift-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); margin-top: var(--space-5); }
.gift-card { text-align: center; }
.gift-card .eyebrow { margin-bottom: var(--space-2); }
.gift-code { font-family: var(--font-mono); font-size: 21px; font-weight: 700; letter-spacing: 0.05em; margin: 0 0 var(--space-2); }
.gift-card.spent .gift-code { color: var(--text-muted); text-decoration: line-through; }
.gift-state { margin: var(--space-2) 0 0; }
.gift-link { margin: var(--space-4) 0 0; text-align: center; }
.gift-list .what b { white-space: normal; }
@media print {
  site-header, .site-header, .site-footer, .no-print { display: none !important; }
  .gift-cards { grid-template-columns: 1fr 1fr; }
  .gift-card { break-inside: avoid; border: 1px solid #888; box-shadow: none; }
  .gift-card.spent { display: none; }
}
.gift-paid { margin-bottom: var(--space-5); }
.gift-paid p { margin: 0 0 var(--space-2); }
.gift-paid .links { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: 15px; margin: 0; }
.attention { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }

/* for whoever followed a link to redeem a code, signed out: what they've been given, and how to claim it */
.gift-welcome {
  display: flex; align-items: center; gap: var(--space-4); max-width: 560px; margin: 0 0 var(--space-6);
  padding: var(--space-4) var(--space-5); border: var(--border-width) solid color-mix(in oklab, var(--brand) 35%, var(--border));
  border-radius: var(--radius); background: var(--brand-soft); box-shadow: var(--shadow-sm);
}
.gift-welcome h2 { font-size: 20px; margin: 0 0 var(--space-2); }
.gift-welcome p { margin: 0 0 var(--space-2); }
.gift-welcome p:last-child { margin: 0; font-size: 14px; }
.gift-welcome .gift-box { width: 64px; height: 64px; }
@media (max-width: 520px) { .gift-welcome { align-items: flex-start; } .gift-welcome .gift-box { width: 48px; height: 48px; } }

/* the front page's link to gifts: a wrapped box that now and then shakes, and opens for a knight to look
   out; still, for anyone who asks for less motion */
.gift-pill {
  display: inline-flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-5); padding: 4px 16px 4px 8px;
  border: var(--border-width) solid var(--border); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm);
  color: var(--text); font-size: 15px; font-weight: 650; text-decoration: none; transition: border-color 0.2s, transform 0.2s var(--ease);
}
.gift-pill:hover { border-color: color-mix(in oklab, var(--brand) 50%, var(--border)); transform: translateY(-1px); }
.gift-pill .more { font-weight: 500; color: var(--text-muted); }
.gift-pill > svg:last-child { width: 16px; height: 16px; flex: none; color: var(--brand); transition: transform 0.2s var(--ease); }
.gift-pill:hover > svg:last-child { transform: translateX(3px); }
@media (max-width: 520px) { .gift-pill .more { display: none; } }
.gift-box { width: 40px; height: 40px; flex: none; overflow: visible; --ribbon: #e2b04f; }
.gift-box .gb-shadow { fill: var(--text); opacity: 0.1; }
.gift-box .gb-body { fill: var(--brand); }
.gift-box .gb-top { fill: color-mix(in oklab, var(--brand) 80%, black); }
.gift-box .gb-ribbon, .gift-box .gb-spark { fill: var(--ribbon); }
.gift-box .gb-knight { fill: var(--text); }
.gift-box .gb-eye { fill: var(--surface); }
.gift-box .gb-whole, .gift-box .gb-lid, .gift-box .gb-knight { transform-box: view-box; animation: 7s var(--ease) 1s infinite both; }
.gift-box .gb-whole { transform-origin: 24px 44px; animation-name: gift-shake; }
.gift-box .gb-lid { transform-origin: 7px 27px; animation-name: gift-lid; }
.gift-box .gb-knight { animation-name: gift-knight; }
.gift-box .gb-spark { transform-box: fill-box; transform-origin: center; opacity: 0; animation: gift-spark 7s ease-out 1s infinite both; }
.gift-box g:nth-of-type(3) .gb-spark { animation-delay: 1.25s; }
.gift-box g:nth-of-type(4) .gb-spark { animation-delay: 1.5s; }
@keyframes gift-shake {
  0%, 57%, 67%, 100% { transform: rotate(0); }
  59% { transform: rotate(-5deg); }
  61% { transform: rotate(5deg); }
  63% { transform: rotate(-3deg); }
  65% { transform: rotate(2deg); }
}
@keyframes gift-lid {
  0%, 66%, 93%, 100% { transform: rotate(0); }
  71% { transform: rotate(-40deg); }
  74%, 87% { transform: rotate(-36deg); }
}
@keyframes gift-knight {
  0%, 69%, 90%, 100% { transform: translateY(0); }
  75%, 85% { transform: translateY(-10px); }
}
@keyframes gift-spark {
  0%, 73%, 88%, 100% { opacity: 0; transform: scale(0.2); }
  77%, 83% { opacity: 1; transform: scale(1); }
}

/* ---------------------------------------------------------------- the front page's story (templates/story.html)
   Five steps in words, and a stage beside them that static/story.js plays through. The stage is drawn in ems
   and its font size follows its own width, so it's one picture at any size: 50em by 31.25em when wide, and
   26em by 41.6em, each scene stacked, when narrow. Until the script says it's live, only the report's scene shows. */
.story { display: grid; gap: clamp(24px, 4vw, 48px); align-items: center; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
.story-steps { display: grid; gap: var(--space-4); list-style: none; margin: 0; padding: 0; }
.story-steps li { position: relative; padding-left: var(--space-5); }
.story-steps li::before, .story-steps li::after { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 3px; border-radius: 2px; }
.story-steps li::after { background: var(--border); z-index: -1; }
.story-steps li::before { background: var(--brand); transform-origin: top; transform: scaleY(0); }
.story-steps h3 { font-size: 17px; margin-bottom: var(--space-1); }
.story-steps h3 button { all: unset; cursor: pointer; }
.story-steps h3 button:hover { color: var(--brand); }
.story-steps h3 button:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.story-steps p { margin: 0; font-size: 15px; color: var(--text-muted); }
.story-after { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }
.story-note { max-width: 78ch; margin: var(--space-5) 0 0; font-size: 15px; }
.story-note + .launch-note { margin-top: var(--space-5); }
@media (max-width: 900px) {
  .story { grid-template-columns: minmax(0, 1fr); }
  .story-frame { order: -1; }
  .story-steps { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
}

.story-frame { position: relative; container: story / inline-size; }
.story-stage {
  position: relative; overflow: hidden; margin: 0 auto; aspect-ratio: 16 / 10; font-size: 2cqw; line-height: 1.3; pointer-events: none; user-select: none;
  background: var(--surface); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  --sq-light: #ecdcbb; --sq-dark: #b48b63;
}
.story-toggle {
  position: absolute; right: 12px; top: 12px; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; cursor: pointer;
  border-radius: 50%; border: var(--border-width) solid var(--border); background: var(--surface); color: var(--text-muted);
}
.story-toggle:hover { color: var(--text); }
.story-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.story-toggle .play { display: none; fill: currentColor; stroke-width: 1.5; }
.story.paused .story-toggle .play { display: inline; }
.story.paused .story-toggle .pause { display: none; }

.story-scene { position: absolute; inset: 0; padding: 1.7em 2.2em; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 0.9em; }
.story:not(.live) .story-scene:not(.s-report) { display: none; }
.story-scene p, .story-scene h4 { margin: 0; }
.story-scene i, .story-scene em { font-style: normal; }
.s-title { display: flex; align-items: center; gap: 0.6em; font-size: 1.15em; font-weight: var(--heading-weight); letter-spacing: -0.01em; }
.s-title b { display: grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; font-size: 0.85em; background: var(--brand-soft); color: var(--brand-strong); }
.s-body { display: grid; align-content: center; min-height: 0; }
.s-foot { text-align: center; font-size: 0.95em; color: var(--text-muted); text-wrap: balance; padding: 0 2.5em; }
/* a bar: its track, and as much of it filled as --w says */
.story-stage i[style] { display: block; height: 0.6em; border-radius: 0.3em; background: var(--surface-sunk); position: relative; overflow: hidden; }
.story-stage i[style]::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 0.3em; background: var(--brand); transform-origin: left; }
.story-stage i.bad::after, .story-stage .bait i::after { background: var(--danger); }

/* 1: the games */
.s-games .s-body { justify-items: center; gap: 1.4em; }
.s-field { display: flex; align-items: center; gap: 0.5em; width: 27em; max-width: 100%; padding: 0.55em 0.7em 0.55em 0.9em; border-radius: 999px; border: var(--border-width) solid var(--border); background: var(--surface-sunk); font-family: var(--font-mono); }
.s-field svg { width: 1.5em; height: 1.5em; flex: none; }
.s-typed { overflow: hidden; white-space: nowrap; }
.s-caret { width: 0.1em; height: 1.2em; margin-left: -0.4em; background: var(--text); opacity: 0; }
.s-site { font-family: var(--font-sans); font-size: 0.85em; font-weight: 650; padding: 0.25em 0.8em; border-radius: 999px; color: var(--text-muted); border: var(--border-width) solid var(--border); }
.s-site.on { margin-left: auto; background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.s-tiles { display: grid; grid-template-columns: repeat(20, 1.5em); gap: 0.36em; }
.s-tiles i { height: 1.5em; border-radius: 0.32em; background: var(--brand); }
.s-tiles .l, .s-tally .l::before { background: var(--danger); }
.s-tiles .d, .s-tally .d::before { background: var(--text-muted); }
.s-tally { display: flex; gap: 1.8em; color: var(--text-muted); }
.s-tally span { display: flex; align-items: baseline; gap: 0.35em; }
.s-tally span::before { content: ""; width: 0.7em; height: 0.7em; border-radius: 0.18em; background: var(--brand); }
.s-tally b { font-size: 1.35em; color: var(--text); font-variant-numeric: tabular-nums; }

/* 2: the position, and each move by the engine and by people */
.s-moves .s-body { grid-template-columns: 19em minmax(0, 1fr); gap: 2em; align-items: center; }
.s-board svg { width: 100%; border-radius: 0.5em; box-shadow: var(--shadow-sm); }
.s-board .light { fill: var(--sq-light); }
.s-board .dark { fill: var(--sq-dark); }
.s-board .last { fill: #f2d24b; opacity: 0.4; }
.s-board .arrow { color: var(--arrow); }
.s-board .safe { --arrow: #2f8f5b; }
.s-board .worse { --arrow: #d08a1c; }
.s-board .bad { --arrow: #c8443c; }
.s-board .shaft { fill: none; stroke: currentColor; stroke-width: 0.1px; stroke-linecap: round; }
.s-board .head { fill: currentColor; }
.s-lens { display: grid; gap: 0.5em; }
.s-lens-head, .s-move { display: grid; grid-template-columns: 3.8em minmax(0, 1fr) minmax(0, 1fr); gap: 1.1em; align-items: center; padding: 0 0.8em; }
.s-lens-head { align-items: end; font-size: 0.9em; font-weight: 700; line-height: 1.25; margin-bottom: 0.2em; }
.s-lens-head small { display: block; font-size: 0.95em; font-weight: 400; color: var(--text-muted); }
.s-move { position: relative; padding-top: 0.55em; padding-bottom: 0.55em; border-radius: 0.7em; background: var(--surface-sunk); }
.s-move b { font-family: var(--font-mono); }
.s-move > span:not(.s-flag) { display: grid; grid-template-columns: minmax(0, 1fr) 2.6em; gap: 0.6em; align-items: center; }
.s-move em { text-align: right; font-size: 0.92em; font-variant-numeric: tabular-nums; }
.s-move i[style] { background: var(--surface); }
.s-move .people i::after { background: color-mix(in oklab, var(--text) 55%, var(--surface)); }
.s-move.bait { background: var(--danger-soft); }
.s-flag { position: absolute; left: 0.6em; top: -0.8em; padding: 0.1em 0.7em; border-radius: 999px; font-size: 0.85em; font-weight: 700; background: var(--danger); color: var(--surface); }

/* 3: mistakes by kind */
.s-habits .s-body { gap: 1.1em; }
.s-funnel { display: flex; justify-content: center; align-items: baseline; color: var(--text-muted); }
.s-funnel span + span::before { content: "\203A"; margin: 0 0.9em; opacity: 0.6; }
.s-funnel b { font-size: 1.5em; color: var(--text); margin-right: 0.15em; font-variant-numeric: tabular-nums; }
.s-rows { display: grid; gap: 0.4em; }
.s-row { display: grid; grid-template-columns: 19.5em minmax(0, 1fr) 1.8em 8.6em; gap: 0.9em; align-items: center; padding: 0.42em 0.8em; border-radius: 0.7em; background: var(--surface-sunk); font-size: 0.95em; }
.s-row i[style] { background: var(--surface); }
.s-row i[style]::after { background: color-mix(in oklab, var(--text) 45%, var(--surface)); }
.s-row b { text-align: right; font-variant-numeric: tabular-nums; }
.s-row em:not(:empty) { justify-self: start; padding: 0.12em 0.75em; border-radius: 999px; font-size: 0.92em; font-weight: 700; white-space: nowrap; background: var(--surface); color: var(--text-muted); }
.s-row.cost i::after { background: var(--danger); }
.s-row.cost em { background: var(--danger); color: var(--surface); }
.s-row.start i::after { background: var(--brand); }
.s-row.start em { background: var(--brand); color: var(--brand-ink); }

/* 4: the report */
.s-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9em; }
.s-card { padding: 0.8em 1em 0.9em; border-radius: 0.9em; border: var(--border-width) solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
.s-tag { font-size: 0.85em; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.s-tag span { font-weight: 400; letter-spacing: 0; text-transform: none; }
.s-tag span::before { content: "\00B7  "; }
.s-card.weak .s-tag { color: var(--danger); }
.s-card.strong .s-tag { color: var(--brand); }
.s-card .s-tag span { color: var(--text-muted); }
.s-card h4 { font-size: 1.04em; line-height: 1.25; letter-spacing: -0.01em; margin: 0.2em 0 0.55em; }
.s-bars { display: grid; gap: 0.4em; }
.s-bars div { display: grid; grid-template-columns: 6.6em minmax(0, 1fr) 2.5em; gap: 0.7em; align-items: center; font-size: 0.9em; color: var(--text-muted); }
.s-bars b { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.s-bars i:not(.bad):not(.good)::after { background: color-mix(in oklab, var(--text) 45%, var(--surface)); }
/* where an opponent's game would be flagged: 60% */
.s-bars.flagged i[style]::before { content: ""; position: absolute; z-index: 1; left: 60%; top: 0; bottom: 0; width: 0.14em; background: var(--danger); }
.story-scene .s-check { margin-top: 0.9em; padding: 0.6em 1em; border-radius: 0.9em; border: var(--border-width) dashed var(--border); text-align: center; text-wrap: balance; color: var(--text-muted); }
.s-check b { margin-right: 0.5em; color: var(--brand-strong); }

@container story (max-width: 660px) {
  .story-stage { aspect-ratio: 5 / 8; max-width: 440px; font-size: min(3.846cqw, 16.92px); }
  .story-scene { padding: 1.5em; }
  .s-foot { padding: 0; }
  .s-field { width: 100%; }
  .s-tiles { grid-template-columns: repeat(10, 1.85em); gap: 0.42em; }
  .s-tiles i { height: 1.85em; }
  .s-moves .s-body { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 1.2em; }
  .s-board { width: 13.5em; }
  .s-lens { width: 100%; gap: 0.4em; }
  .s-lens-head, .s-move { gap: 0.8em; }
  .s-move { padding-top: 0.4em; padding-bottom: 0.4em; }
  .s-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name count" "bar mark"; gap: 0.35em 0.8em; padding: 0.5em 0.8em; }
  .s-row span { grid-area: name; }
  .s-row b { grid-area: count; }
  .s-row i[style] { grid-area: bar; }
  .s-row em { grid-area: mark; }
  .s-cards { grid-template-columns: minmax(0, 1fr); gap: 0.6em; }
  .s-card { padding: 0.6em 0.9em 0.7em; }
  .s-card h4 { margin-bottom: 0.4em; }
  .story-scene .s-check { margin-top: 0.7em; }
  .s-funnel { font-size: 0.9em; white-space: nowrap; }
  .s-funnel span + span::before { margin: 0 0.5em; }
}

/* 5: what comes with the report */
.s-panels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.9em; }
.s-panel { display: grid; grid-template-rows: 13.5em auto; gap: 0.9em; padding: 1em 1.1em 1.1em; border-radius: 0.9em; border: var(--border-width) solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
.s-panel h4 { font-size: 1.04em; letter-spacing: -0.01em; margin-bottom: 0.25em; }
.s-panel h4 + p { font-size: 0.9em; color: var(--text-muted); }
.s-art { display: grid; align-content: center; justify-items: center; gap: 0.6em; min-height: 0; border-radius: 0.6em; background: var(--surface-sunk); padding: 0.8em; }
.replay .s-board { width: 7.4em; }
.s-panel > * { min-width: 0; }
.s-lines { display: flex; flex-direction: column; align-items: center; gap: 0.3em; font-family: var(--font-mono); font-size: 0.85em; font-weight: 700; white-space: nowrap; }
.s-lines span { padding: 0.15em 0.6em; border-radius: 999px; background: var(--danger-soft); color: var(--danger); }
.s-lines .tried { background: var(--brand); color: var(--brand-ink); }
.s-lines i { font-family: var(--font-sans); font-weight: 400; opacity: 0.85; }
.copy .s-art { grid-template-columns: auto auto; justify-content: center; align-items: center; column-gap: 1em; }
.s-file { width: 5em; }
.s-file .sheet { fill: var(--surface); stroke: var(--border); stroke-width: 2; }
.s-file .fold, .s-file .rule { fill: none; stroke: var(--border); stroke-width: 2; stroke-linecap: round; }
.s-file .rule { stroke: color-mix(in oklab, var(--text) 30%, var(--surface)); stroke-width: 3; }
.s-down { width: 2.6em; fill: none; stroke: var(--brand); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.s-chip { grid-column: 1 / -1; padding: 0.15em 0.8em; border-radius: 999px; font-size: 0.85em; font-weight: 700; background: var(--brand-soft); color: var(--brand-strong); }
.again .s-art { justify-items: stretch; gap: 0.45em; }
.s-change { display: flex; justify-content: space-between; align-items: center; gap: 0.6em; font-size: 0.9em; }
.s-change b { padding: 0.1em 0.7em; border-radius: 999px; font-size: 0.92em; white-space: nowrap; background: var(--surface); color: var(--text-muted); }
.s-change .up, .s-change .down { background: var(--brand); color: var(--brand-ink); }
.s-change .up::before { content: "\2191  "; }
.s-change .down::before { content: "\2193  "; }
@container story (max-width: 660px) {
  .s-panels { grid-auto-flow: row; gap: 0.6em; }
  .s-panel { grid-template-rows: none; grid-template-columns: 11.5em minmax(0, 1fr); align-items: center; padding: 0.7em; }
  .s-art { align-self: stretch; padding: 0.6em; }
  .replay .s-board { width: 7em; }
  .s-file { width: 3.6em; }
  .s-down { width: 2em; }
}

/* Messages: the account menu's marks, an account's conversations, and one conversation's messages. */
.avatar.marked { position: relative; }
.avatar.marked::after {
  content: ""; position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
}
.menu-item .count {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: var(--space-1); border-radius: 10px;
  background: var(--danger); color: var(--surface); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
.threads { padding: var(--space-2); }
.thread {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); color: inherit; text-decoration: none;
}
.thread + .thread { border-top: var(--border-width) solid var(--border); border-top-left-radius: 0; border-top-right-radius: 0; }
.thread:hover { background: var(--surface-sunk); }
.thread .what { min-width: 0; }
.thread .what b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread .what span { font-size: 14px; color: var(--text-muted); }
.thread .badge { flex: none; }
.talk { list-style: none; margin: 0 0 var(--space-5); padding: 0; display: grid; gap: var(--space-3); }
.talk li {
  max-width: min(100%, 560px); justify-self: start; padding: var(--space-3) var(--space-4);
  border: var(--border-width) solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.talk li.own { justify-self: end; background: var(--brand-soft); border-color: transparent; }
.talk .said-by { margin: 0 0 var(--space-1); font-size: 14px; }
.talk .said-by span { color: var(--text-muted); margin-left: var(--space-1); }
/* as it was written: its line breaks kept, long words broken, and nothing in it read as markup */
.talk .said { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.write textarea { resize: vertical; min-height: 120px; font: inherit; }
.write .field { margin-bottom: var(--space-4); }
.aside { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }
.views { display: flex; gap: var(--space-2); }

/* ---------- Lessons (learn.rs, lessons/*.html, learn.js) ---------- */
.learn-level { margin-bottom: var(--space-7); }
.learn-level > h2 { font-size: 26px; margin: 0 0 var(--space-2); }
.learn-blurb { color: var(--text-muted); max-width: 62ch; margin: 0 0 var(--space-5); }
.learn-list { list-style: none; margin: 0; padding: 0; }
.learn-list > li { display: grid; }
.learn-card h3 { font-size: 22px; margin: 0 0 var(--space-2); letter-spacing: -0.01em; }
.learn-card.next { border-color: color-mix(in oklab, var(--brand) 55%, var(--border)); }
.learn-more { color: var(--text-muted); }
.lesson-page { padding-bottom: var(--space-7); }
.lesson { max-width: 1040px; margin: 0 auto; }
.lesson .eyebrow a { color: inherit; }
.lesson-progress { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-4) 0 0; font-size: 14px; font-weight: 600; color: var(--text-muted); }
.lesson-progress[hidden] { display: none; }
.lesson-bar { flex: none; width: 140px; height: 8px; border-radius: 999px; background: var(--surface-sunk); overflow: hidden; }
.lesson-bar span { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width var(--speed) var(--ease); }
.lesson-step { display: grid; gap: var(--space-5); padding: var(--space-6) 0; border-top: var(--border-width) solid var(--border); }
@media (min-width: 880px) {
  .lesson-step:has(figure) { grid-template-columns: minmax(0, 1fr) minmax(0, 430px); gap: var(--space-7); align-items: start; }
  /* a board to look at stays beside its words as they scroll, under the header; one to do things on doesn't,
     so that all of it can be scrolled to */
  .lesson-step figure { position: sticky; top: 80px; }
  .lesson-step figure.task { position: static; }
}
.lesson-words { max-width: 62ch; font-size: 17px; }
.lesson-words h2 { font-size: 24px; margin: 0 0 var(--space-3); }
.lesson-words * + h2 { margin-top: var(--space-6); }
.lesson-words p { margin: 0 0 var(--space-3); }
.lesson-words ul { margin: 0 0 var(--space-3); padding-left: 1.2em; display: grid; gap: var(--space-2); }
.lesson-words > :last-child { margin-bottom: 0; }
.lesson-pieces { list-style: none; padding-left: 0 !important; }
.lesson-pieces li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: var(--space-3); align-items: center; }
.lesson-pieces svg { width: 44px; height: 44px; border-radius: 10px; background: #d9a066; }
.lesson-step figure { margin: 0; width: 100%; max-width: 430px; justify-self: center; }
.lesson-step figcaption { margin-top: var(--space-2); font-size: 14px; color: var(--text-muted); }
.lesson-board { flex: none; }
.lesson-board.movable { cursor: pointer; }
.lesson-step figure.task { padding: var(--space-3); border: var(--border-width) solid color-mix(in oklab, var(--brand) 40%, var(--border)); border-radius: var(--radius); background: var(--surface); max-width: 456px; }
.lesson-step figure.task::before { content: "Your turn"; display: block; margin-bottom: var(--space-2); font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); }
.lesson-step figure.task[data-step]::before { content: "Your turn \00b7  " attr(data-step); }
.lesson-step figure.task.done::before { content: "Done \2713"; color: var(--success); }
.lesson-step figure.task.done { border-color: color-mix(in oklab, var(--success) 60%, var(--border)); }
.lesson-status { margin: 0 0 var(--space-3); font-weight: 600; min-height: 3em; }
.lesson-actions { margin: var(--space-2) 0 0; }
.lesson-actions:empty { display: none; }
.lesson-end { margin-top: var(--space-5); padding: var(--space-5); }
.lesson-finished { display: none; margin: 0 0 var(--space-4); font-size: 20px; font-weight: 700; color: var(--brand-strong); }
.lesson-end.done .lesson-finished { display: block; }
.lesson-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); }
