/* ═══════════════════════════════════════════════════════════════════
   competification.com
   A dictionary entry that is gradually taken over by a scoreboard.

   Two dials, both driven by scroll position from comp.js:

   --comp (0 → 1, continuous)  the gradual escalation — vignette, accent
                               intensity, atmosphere.
   data-stage (calm | loud)    the surface palette. Flips once, with
                               hysteresis, at The Competifier. Kept binary
                               on purpose: crossfading paper→black would
                               pass through a mid-grey where text contrast
                               collapses to nothing.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Fonts ─────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Instrument Serif';
  src: url('/assets/fonts/instrument-serif.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('/assets/fonts/instrument-serif-italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Newsreader';
  src: url('/assets/fonts/newsreader.woff2') format('woff2-variations');
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Newsreader';
  src: url('/assets/fonts/newsreader-italic.woff2') format('woff2-variations');
  font-weight: 200 800; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Azeret Mono';
  src: url('/assets/fonts/azeret-mono.woff2') format('woff2-variations');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

/* ── Animatable custom properties ──────────────────────────────────
   Registering these lets the paper→black takeover animate as a single
   timed transition instead of crossfading through a muddy mid-grey where
   text contrast would collapse. --comp stays linear for atmosphere;
   the surface colours flip decisively at one narrative beat.
   ─────────────────────────────────────────────────────────────────── */
@property --comp       { syntax: '<number>'; inherits: true; initial-value: 0; }
@property --bg         { syntax: '<color>';  inherits: true; initial-value: #F3EFE5; }
@property --ink        { syntax: '<color>';  inherits: true; initial-value: #17150F; }
@property --muted      { syntax: '<color>';  inherits: true; initial-value: #6E6759; }
@property --rule       { syntax: '<color>';  inherits: true; initial-value: #DCD5C3; }
@property --card       { syntax: '<color>';  inherits: true; initial-value: #FBF8F1; }
@property --accent-text{ syntax: '<color>';  inherits: true; initial-value: #4C5C0C; }

/* ── Tokens ────────────────────────────────────────────────────── */
:root {
  --comp: 0;

  --accent:      #C8FF2E;   /* acid lime — the colour of being measured */
  --accent-ink:  #0B0B0C;
  --flag:        #FF3B1F;
  --gold:        #FFC542;

  /* the HUD and its toasts are always dark — they are an intrusion,
     not part of the page, so they never follow the stage palette */
  --hud-bg:      #0B0B0C;
  --hud-ink:     #F2F0EA;

  /* CALM — the dictionary */
  --bg:          #F3EFE5;
  --ink:         #17150F;
  --muted:       #6E6759;
  --rule:        #DCD5C3;
  --card:        #FBF8F1;
  --accent-text: #4C5C0C;   /* lime is unreadable on paper; olive is not */

  --serif:   'Newsreader', Iowan Old Style, Palatino, Georgia, serif;
  --display: 'Instrument Serif', 'Newsreader', Georgia, serif;
  --mono:    'Azeret Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --measure: 62ch;
  --gut: clamp(1.25rem, 4vw, 3rem);
  --ease: cubic-bezier(.2, .7, .25, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  color-scheme: light;

  /* the takeover, as one timed sweep */
  transition:
    --bg .7s var(--ease), --ink .7s var(--ease), --muted .7s var(--ease),
    --rule .7s var(--ease), --card .7s var(--ease), --accent-text .7s var(--ease);
}

/* LOUD — the scoreboard. Set by JS once you reach The Competifier. */
html[data-stage="loud"] {
  --bg:          #0B0B0C;
  --ink:         #F2F0EA;
  --muted:       #8C8C86;
  --rule:        #2A2A2F;
  --card:        #131316;
  --accent-text: #C8FF2E;
  color-scheme: dark;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 380;
  font-size: clamp(1.0625rem, .55vw + .95rem, 1.1875rem);
  line-height: 1.62;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }

::selection { background: var(--accent); color: var(--accent-ink); }

:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute; top: -100px; left: 1rem; z-index: 999;
  background: var(--ink); color: var(--bg);
  padding: .7rem 1.1rem; border-radius: 4px;
  font-family: var(--mono); font-size: .8rem; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ── Atmosphere: grain + vignette ──────────────────────────────── */
.grain {
  position: fixed; inset: -50%;
  z-index: 1; pointer-events: none;
  opacity: .32;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: var(--comp);
  background: radial-gradient(120% 90% at 50% 40%, transparent 40%, rgba(0,0,0,.55) 100%);
  transition: opacity .4s linear;
}

/* the grain flips to screen-blend once the page goes dark */
html[data-stage="loud"] .grain { mix-blend-mode: screen; opacity: .1; }

/* ── Layout ────────────────────────────────────────────────────── */
.wrap {
  width: min(100% - (var(--gut) * 2), 74rem);
  margin-inline: auto;
  position: relative;
  z-index: 2;
}

.section {
  position: relative;
  padding-block: clamp(5rem, 13vh, 9rem);
  z-index: 2;
}
.section + .section { border-top: 1px solid var(--rule); }

/* ═══════════════ MASTHEAD ═══════════════ */
/* Both items sit left: the HUD claims the top-right corner. */
.masthead {
  position: relative; z-index: 5;
  display: flex; flex-wrap: wrap; gap: .35rem 1.1rem;
  align-items: baseline;
  width: min(100% - (var(--gut) * 2), 74rem);
  margin-inline: auto;
  padding-block: 1.6rem 0;
  padding-inline-end: 21rem;
}
@media (max-width: 60rem) {
  .masthead { padding-inline-end: 0; }
  .masthead__sub { flex-basis: 100%; }
}
.masthead__brand {
  font-family: var(--mono);
  font-size: .72rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: baseline; gap: .5ch;
  transition: color .3s var(--ease);
}
.masthead__mark {
  font-family: var(--display); font-size: 1.15rem;
  color: var(--accent-text);
  transform: translateY(1px);
  transition: transform .5s var(--ease);
}
.masthead__brand:hover .masthead__mark { transform: translateY(1px) rotate(-14deg) scale(1.15); }
.masthead__tld { opacity: .4; }
.masthead__sub {
  font-family: var(--mono);
  font-size: .66rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.masthead__edition { color: var(--ink); }

/* ═══════════════ THE ENTRY (hero) ═══════════════ */
.entry {
  position: relative; z-index: 2;
  min-height: clamp(30rem, 74svh, 48rem);
  display: flex; align-items: center;
  padding-block: clamp(2.5rem, 6vh, 4.5rem) clamp(3.5rem, 9vh, 6rem);
}
.entry__inner { width: min(100% - (var(--gut) * 2), 74rem); margin-inline: auto; }

.entry__eyebrow {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .9rem;
  margin-bottom: clamp(.6rem, 1.5vh, 1.4rem);
}
.entry__pos {
  font-family: var(--serif); font-style: italic;
  font-size: 1.05rem; color: var(--ink);
  border-bottom: 1px solid var(--rule); padding-bottom: 1px;
}
.entry__hyph {
  font-family: var(--mono); font-size: .68rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}

.headword {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3.1rem, 12.5vw, 11.5rem);
  line-height: .88;
  letter-spacing: -.022em;
  margin-block: 0 clamp(1rem, 2.5vh, 1.75rem);
  text-wrap: balance;
}
.headword__syl {
  display: inline-block;
  transition: transform .45s var(--ease-out), color .45s var(--ease);
}
/* drawn as a box rather than the · glyph, so it lands exactly on
   mid-x-height instead of wherever the typeface happens to put it */
.headword__dot {
  display: inline-block;
  inline-size: .13em; block-size: .13em;
  vertical-align: .26em;
  margin-inline: .07em;
  border-radius: 50%;
  background: var(--accent-text);
  color: transparent;
  overflow: hidden;
  transition: transform .45s var(--ease-out), background-color .7s var(--ease);
}
/* syllables lift on hover — the word itself gets a little competitive */
.headword:hover .headword__syl { transform: translateY(-.035em); }
.headword__syl:hover {
  transform: translateY(-.13em) !important;
  color: var(--accent-text);
}
.headword:hover .headword__dot { transform: scale(1.5); }

.phonetic {
  display: flex; align-items: center; gap: .85rem;
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
}
.phonetic__ipa {
  font-family: var(--mono); font-size: clamp(.8rem, 1.4vw, .95rem);
  font-weight: 300; letter-spacing: .02em; color: var(--muted);
}
.say {
  --s: 2.35rem;
  inline-size: var(--s); block-size: var(--s);
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--rule); border-radius: 50%;
  cursor: pointer; padding: 0; flex: none;
  transition: background-color .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease-out);
}
.say svg { width: 1.05rem; height: 1.05rem; fill: var(--ink); stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; fill-rule: evenodd; }
.say svg path:first-child { stroke: none; }
.say__wave { fill: none; opacity: .45; transition: opacity .3s; }
.say:hover { background: var(--accent); border-color: var(--accent); transform: scale(1.07); }
.say:hover svg { fill: var(--accent-ink); stroke: var(--accent-ink); }
.say:hover .say__wave { opacity: 1; }
.say[data-playing="true"] { background: var(--accent); border-color: var(--accent); }
.say[data-playing="true"] svg { fill: var(--accent-ink); stroke: var(--accent-ink); }
.say[data-playing="true"] .say__wave--1 { animation: pulse .6s infinite; }
.say[data-playing="true"] .say__wave--2 { animation: pulse .6s .15s infinite; }
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.entry__scroll {
  display: flex; align-items: center; gap: .8rem;
  margin-top: clamp(2.5rem, 6vh, 4rem);
  font-family: var(--mono); font-size: .66rem;
  letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.entry__scroll a { color: inherit; text-underline-offset: .35em; }
.entry__scroll a:hover { color: var(--ink); }
.entry__scrollline {
  inline-size: 3.5rem; block-size: 1px; background: var(--rule);
  position: relative; overflow: hidden;
}
.entry__scrollline::after {
  content: ''; position: absolute; inset: 0;
  background: var(--ink);
  animation: sweep 2.6s var(--ease) infinite;
}
@keyframes sweep {
  0%   { transform: translateX(-100%); }
  60%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

/* ═══════════════ SENSES ═══════════════ */
.senses--full { display: grid; gap: clamp(2.25rem, 5vh, 3.5rem); }

.sense {
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  gap: 0 .5rem;
  align-items: start;
  max-width: var(--measure);
}
.sense__n {
  font-family: var(--mono);
  font-size: .82rem; font-weight: 500;
  color: var(--accent-text);
  padding-top: .42em;
  font-variant-numeric: tabular-nums;
}
.sense__def {
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  line-height: 1.42; font-weight: 350;
  text-wrap: pretty;
}
.sense__def em { font-style: italic; }
.sense__reg {
  font-style: italic; color: var(--muted);
  font-size: .85em; margin-right: .3ch;
}
.sense__eg {
  grid-column: 2;
  margin-top: .85rem; padding-left: 1rem;
  border-left: 2px solid var(--rule);
  font-style: italic; font-size: .96rem;
  color: var(--muted); text-wrap: pretty;
}
.crossref {
  font-style: normal; font-family: var(--mono); font-size: .82em;
  border-bottom: 1px dashed currentColor;
}
.sense--rare .sense__def { color: var(--muted); }

/* ═══════════════ RUBRICS ═══════════════ */
.rubric {
  font-family: var(--mono);
  font-size: .7rem; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: 1.2rem;
}
.rubric::after {
  content: ''; flex: 1; height: 1px; background: var(--rule);
}
.rubric--loud {
  color: var(--accent);
  font-weight: 700; font-size: .78rem;
}
.rubric--loud span {
  background: var(--accent); color: var(--accent-ink);
  padding: .35em .7em .3em; border-radius: 2px;
}
.rubric--loud::after { background: var(--accent); opacity: .35; }

.rubric__note {
  max-width: 46ch; color: var(--muted);
  font-style: italic; margin-bottom: clamp(2.5rem, 6vh, 4rem);
  text-wrap: pretty;
}

/* ═══════════════ ETYMOLOGY ═══════════════ */
.etym { display: grid; gap: clamp(2.5rem, 6vw, 5rem); grid-template-columns: 1fr; }
@media (min-width: 60rem) {
  .etym { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
  .etym .rubric { grid-column: 1 / -1; }
}
.etym__body { max-width: var(--measure); }
.etym__body p + p { margin-top: 1.15rem; }

.etym__formula {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .75rem;
  margin-bottom: 1.75rem;
  font-family: var(--display);
  font-size: clamp(1.75rem, 4.5vw, 2.9rem);
  line-height: 1;
}
.etym__part { position: relative; }
.etym__part--suffix {
  font-style: italic;
  color: var(--muted);
}
.etym__part--suffix::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -.12em;
  height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .7s var(--ease-out);
}
[data-obs].is-in .etym__part--suffix::after { transform: scaleX(1); transition-delay: .45s; }
.etym__plus { color: var(--accent-text); font-size: .7em; }

.lede { font-size: 1.2rem; }
.hl {
  font-weight: 600;
  background: linear-gradient(transparent 62%, var(--accent) 62%, var(--accent) 92%, transparent 92%);
  padding-inline: .1em;
}

.etym__attest {
  margin-top: 1.75rem !important; padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: .95rem; color: var(--muted);
}
.etym__attestlabel, .forms__antlabel {
  display: block;
  font-family: var(--mono); font-size: .63rem;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); opacity: .75; margin-bottom: .35rem;
}
.tick {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  color: var(--ink); font-weight: 500;
}

/* related forms */
.forms {
  border: 1px solid var(--rule);
  background: color-mix(in oklab, var(--card), transparent 30%);
  padding: clamp(1.4rem, 3vw, 2rem);
  border-radius: 3px;
}
.forms__title {
  font-family: var(--mono); font-size: .63rem; font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 1.1rem;
}
.forms__list { display: grid; gap: .7rem; }
.forms__row {
  display: grid; grid-template-columns: minmax(0, auto) 1fr;
  gap: .2rem .9rem; align-items: baseline;
  padding-bottom: .7rem; border-bottom: 1px dotted var(--rule);
}
.forms__row:last-of-type { border-bottom: 0; padding-bottom: 0; }
.forms__row dt { font-weight: 500; font-size: 1.02rem; }
.forms__row dd { color: var(--muted); font-size: .92rem; margin: 0; }
.forms__row dd i { font-style: italic; opacity: .8; }
.forms__row--wistful dt { color: var(--accent-text); }
.forms__ant {
  margin-top: 1.4rem; padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  font-size: .92rem; color: var(--muted);
}
.obs { text-decoration: line-through; opacity: .55; }

/* ═══════════════ IN THE WILD ═══════════════ */
.wild { list-style: none; padding: 0; display: grid; gap: 0; }
.wild__item {
  display: grid;
  grid-template-columns: minmax(6.5rem, 12rem) 1.75rem minmax(0, 1fr);
  gap: .35rem .5rem;
  align-items: baseline;
  padding-block: clamp(.95rem, 2.2vh, 1.35rem);
  border-bottom: 1px solid var(--rule);
  transition: background-color .35s var(--ease), padding-inline .35s var(--ease);
}
.wild__item:first-child { border-top: 1px solid var(--rule); }
.wild__item:hover {
  background: color-mix(in oklab, var(--accent), transparent 88%);
  padding-inline: .85rem;
}
.wild__from {
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.6vw, 1.85rem);
  line-height: 1.15;
}
.wild__arrow {
  font-family: var(--mono); color: var(--accent-text);
  transition: transform .35s var(--ease-out);
}
.wild__item:hover .wild__arrow { transform: translateX(.3rem); }
.wild__to { color: var(--muted); text-wrap: pretty; }
.wild__item--dark .wild__to { color: color-mix(in oklab, var(--muted), var(--flag) 40%); font-style: italic; }

@media (max-width: 40rem) {
  .wild__item { grid-template-columns: 1fr; }
  .wild__arrow { display: none; }
  .wild__to::before { content: '→ '; color: var(--accent-text); }
}

/* ═══════════════ THE COMPETIFIER ═══════════════ */
.machine { max-width: 44rem; }
.machine__label {
  display: block;
  font-family: var(--mono); font-size: .63rem;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); margin-bottom: .7rem;
}
.machine__row { display: flex; flex-wrap: wrap; gap: .6rem; }
.machine__input {
  flex: 1 1 15rem; min-width: 0;
  background: color-mix(in oklab, var(--card), transparent 25%);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .85rem 1rem;
  font-family: var(--display);
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}
.machine__input::placeholder { color: var(--muted); opacity: .55; }
.machine__input:focus { outline: none; border-color: var(--accent); background: var(--card); }

.btn {
  border: 1px solid transparent; border-radius: 3px;
  padding: .85rem 1.5rem;
  font-family: var(--mono); font-size: .78rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  cursor: pointer;
  transition: transform .2s var(--ease-out), box-shadow .25s var(--ease), background-color .25s;
}
.btn--go {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent), transparent 60%);
}
.btn--go:hover { transform: translateY(-2px); box-shadow: 0 6px 0 -1px color-mix(in oklab, var(--accent), black 45%); }
.btn--go:active { transform: translateY(0); box-shadow: 0 1px 0 -1px color-mix(in oklab, var(--accent), black 45%); }

.machine__hint {
  margin-top: .9rem; font-size: .85rem; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline;
}
.chip {
  background: transparent; border: 1px dashed var(--rule);
  border-radius: 100px; padding: .18rem .7rem;
  font-family: var(--mono); font-size: .72rem; color: var(--muted);
  cursor: pointer;
  transition: color .25s, border-color .25s, background-color .25s;
}
.chip:hover { color: var(--ink); border-color: var(--accent); border-style: solid; background: color-mix(in oklab, var(--accent), transparent 88%); }

/* the generated product */
.product {
  margin-top: clamp(2.5rem, 6vh, 4rem);
  max-width: 46rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  background: var(--card);
  box-shadow: 0 24px 60px -30px rgba(0,0,0,.45);
  animation: bootUp .55s var(--ease-out) both;
}
@keyframes bootUp {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.product__chrome {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in oklab, var(--card), var(--ink) 5%);
}
.product__dot {
  inline-size: .5rem; block-size: .5rem; border-radius: 50%;
  background: var(--flag); flex: none;
  box-shadow: .8rem 0 0 var(--gold), 1.6rem 0 0 var(--accent);
  margin-right: 1.6rem;
}
.product__url {
  font-family: var(--mono); font-size: .72rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.product__badge {
  margin-left: auto; flex: none;
  font-family: var(--mono); font-size: .58rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  background: var(--accent); color: var(--accent-ink);
  padding: .25em .6em; border-radius: 2px;
}
.product__body { padding: clamp(1.5rem, 4vw, 2.5rem); }
.product__kicker {
  font-family: var(--mono); font-size: .63rem;
  letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
  margin-bottom: .5rem;
}
.product__name {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(2rem, 6.5vw, 3.6rem);
  line-height: 1; letter-spacing: -.02em;
  margin-bottom: .6rem; text-wrap: balance;
}
.product__tag {
  font-size: 1.1rem; color: var(--muted); font-style: italic;
  max-width: 34ch; text-wrap: pretty;
}
.product__feats {
  list-style: none; padding: 0;
  margin-block: 1.75rem;
  display: grid; gap: .8rem;
}
.product__feats li {
  display: grid; grid-template-columns: 1.4rem 1fr; gap: .6rem;
  align-items: start; font-size: .98rem;
}
.product__feats li::before {
  content: '✓';
  font-family: var(--mono); font-size: .8rem;
  color: var(--accent-ink); background: var(--accent);
  inline-size: 1.15rem; block-size: 1.15rem;
  display: grid; place-items: center; border-radius: 2px;
  transform: translateY(.15rem);
}
.product__stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 1px; background: var(--rule);
  border: 1px solid var(--rule); border-radius: 3px; overflow: hidden;
}
.pstat { background: var(--card); padding: .9rem 1rem; display: grid; gap: .25rem; }
.pstat__k {
  font-family: var(--mono); font-size: .58rem;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.pstat__v {
  font-family: var(--mono); font-size: 1.05rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.review {
  margin-top: 1.75rem; padding-top: 1.5rem;
  border-top: 1px dotted var(--rule);
}
.review__stars { font-size: 1rem; color: var(--gold); letter-spacing: .1em; }
.review__stars span { color: var(--muted); opacity: .4; }
.review__text {
  font-family: var(--display); font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  line-height: 1.35; margin-block: .6rem .7rem; text-wrap: pretty;
}
.review__by { font-family: var(--mono); font-size: .7rem; color: var(--muted); }

/* ═══════════════ LEADERBOARD ═══════════════ */
.board { list-style: none; padding: 0; display: grid; gap: 2px; }
.board__row {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr) auto;
  gap: .5rem 1rem; align-items: center;
  padding: .8rem 1rem;
  background: color-mix(in oklab, var(--card), transparent 35%);
  border: 1px solid transparent;
  border-radius: 3px;
  font-family: var(--mono); font-size: .88rem;
  transition: background-color .4s var(--ease), border-color .4s var(--ease), transform .35s var(--ease-out);
}
.board__row:hover { transform: translateX(3px); }
.board__pos {
  font-variant-numeric: tabular-nums; font-weight: 600;
  color: var(--muted);
}
.board__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board__score { font-variant-numeric: tabular-nums; font-weight: 600; }
.board__row--medal .board__pos { color: var(--gold); }
.board__row--you {
  background: color-mix(in oklab, var(--accent), transparent 86%);
  border-color: var(--accent);
}
.board__row--you .board__name { color: var(--accent-text); font-weight: 700; }
.board__row--you .board__pos, .board__row--you .board__score { color: var(--ink); }
.board__tag {
  font-size: .6rem; letter-spacing: .14em; text-transform: uppercase;
  background: var(--accent); color: var(--accent-ink);
  padding: .15em .45em; border-radius: 2px; margin-left: .6rem;
}
.board__gap {
  text-align: center; font-family: var(--mono);
  color: var(--muted); opacity: .5; font-size: .8rem;
  padding-block: .6rem; letter-spacing: .4em;
}
.board__row.is-bump { animation: bump .5s var(--ease-out); }
@keyframes bump {
  0%   { background-color: color-mix(in oklab, var(--flag), transparent 75%); }
  100% { background-color: color-mix(in oklab, var(--card), transparent 35%); }
}
.board__foot {
  margin-top: 2rem; max-width: 58ch;
  color: var(--muted); font-size: .95rem; text-wrap: pretty;
}

/* ═══════════════ THE EXIT ═══════════════ */
.section--exit { border-top: 1px solid var(--rule); }
.exit { display: grid; place-items: center; text-align: center; }
.exit__card { max-width: 40rem; }
.exit__title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(2.25rem, 7vw, 4.25rem);
  line-height: 1.02; letter-spacing: -.02em;
  margin-bottom: 1.25rem; text-wrap: balance;
}
.exit__body {
  color: var(--muted); max-width: 46ch; margin-inline: auto;
  margin-bottom: 2.25rem; text-wrap: pretty;
}
.btn--quit {
  background: transparent; color: var(--ink);
  border: 1px solid var(--ink);
  padding: 1rem 2rem;
}
.btn--quit:hover {
  background: var(--ink); color: var(--bg);
  transform: translateY(-2px);
}
.exit__small {
  margin-top: 1.1rem; font-family: var(--mono);
  font-size: .68rem; color: var(--muted); opacity: .7;
}

.afterword { max-width: 42rem; animation: settle 1.2s var(--ease-out) both; }
@keyframes settle {
  from { opacity: 0; transform: translateY(12px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.afterword__line {
  font-family: var(--display);
  font-size: clamp(2rem, 6vw, 3.5rem);
  line-height: 1.05; margin-bottom: 1.5rem;
}
.afterword__body { color: var(--muted); margin-bottom: 1rem; text-wrap: pretty; }
.afterword__body em { font-style: italic; color: var(--ink); }
.linkish {
  background: none; border: 0; padding: .5rem 0;
  margin-top: 1.5rem; cursor: pointer;
  font-family: var(--mono); font-size: .7rem; color: var(--muted);
  border-bottom: 1px dashed var(--rule);
}
.linkish:hover { color: var(--ink); border-color: var(--ink); }

/* ═══════════════ COLOPHON ═══════════════ */
.colophon {
  position: relative; z-index: 2;
  border-top: 1px solid var(--rule);
  padding-block: 2.5rem 3.5rem;
}
.colophon__inner {
  display: flex; flex-wrap: wrap; gap: .75rem 2rem;
  justify-content: space-between; align-items: baseline;
  font-family: var(--mono); font-size: .68rem;
  color: var(--muted); letter-spacing: .02em;
}
.colophon__l strong { color: var(--ink); font-weight: 600; }

/* ═══════════════ HUD (the scoreboard) ═══════════════ */
.hud {
  position: fixed;
  z-index: 40;
  inset-block-start: max(.75rem, env(safe-area-inset-top));
  inset-inline-end: max(.75rem, env(safe-area-inset-right));
  width: min(20rem, calc(100vw - 1.5rem));
  background: color-mix(in oklab, var(--hud-bg), transparent 8%);
  color: var(--hud-ink);
  border: 1px solid color-mix(in oklab, var(--accent), transparent 65%);
  border-radius: 4px;
  box-shadow: 0 18px 40px -18px rgba(0,0,0,.6);
  backdrop-filter: blur(10px) saturate(1.2);
  overflow: hidden;
  animation: hudIn .5s var(--ease-out) both;
}
@keyframes hudIn {
  from { opacity: 0; transform: translateY(-14px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
.hud[hidden] { display: none; }
.hud__bar { display: flex; align-items: stretch; }
.hud__cell {
  flex: 1; min-width: 0;
  padding: .55rem .7rem .6rem;
  display: grid; gap: .1rem;
  position: relative;
}
.hud__cell + .hud__cell { border-left: 1px solid color-mix(in oklab, var(--accent), transparent 82%); }
.hud__label {
  font-family: var(--mono); font-size: .52rem; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase;
  color: color-mix(in oklab, var(--accent), transparent 25%);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hud__value {
  font-family: var(--mono); font-size: .95rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  color: #fff;
}
.hud__cell--score .hud__value { color: var(--accent); }
.hud__delta {
  position: absolute; right: .5rem; top: .5rem;
  font-family: var(--mono); font-size: .55rem; font-weight: 700;
  color: var(--flag);
  animation: deltaIn 2s var(--ease) forwards;
}
@keyframes deltaIn {
  0%   { opacity: 0; transform: translateY(-4px); }
  15%  { opacity: 1; transform: none; }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(5px); }
}
.hud__close {
  flex: none; inline-size: 1.6rem;
  background: none; border: 0; border-left: 1px solid color-mix(in oklab, var(--accent), transparent 82%);
  color: color-mix(in oklab, var(--accent), transparent 45%);
  font-size: 1rem; line-height: 1; cursor: pointer;
  transition: background-color .2s, color .2s;
}
.hud__close:hover { background: var(--flag); color: #fff; }
.hud__meter { block-size: 2px; background: rgba(255,255,255,.09); }
.hud__meter i {
  display: block; block-size: 100%; inline-size: 0%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: inline-size .4s var(--ease);
}
.hud.is-scored { animation: hudPop .35s var(--ease-out); }
@keyframes hudPop { 50% { transform: scale(1.035); } }

/* On phones the top-right corner belongs to the masthead, so the
   scoreboard docks to the bottom instead and the toasts stack above it. */
@media (max-width: 46rem) {
  .hud {
    inset-block-start: auto;
    inset-block-end: max(.5rem, env(safe-area-inset-bottom));
    inset-inline-start: max(.5rem, env(safe-area-inset-left));
    inset-inline-end: max(.5rem, env(safe-area-inset-right));
    width: auto;
  }
  .hud__value { font-size: .85rem; }
}

/* ═══════════════ TOASTS (achievements) ═══════════════ */
.toasts {
  position: fixed; z-index: 45;
  inset-block-end: max(1rem, env(safe-area-inset-bottom));
  inset-inline-start: max(1rem, env(safe-area-inset-left));
  width: min(19rem, calc(100vw - 2rem));
  display: grid; gap: .5rem;
  pointer-events: none;
}
.toast {
  display: grid; grid-template-columns: 2.1rem 1fr auto;
  gap: .1rem .7rem; align-items: center;
  padding: .6rem .8rem;
  background: color-mix(in oklab, var(--hud-bg), transparent 6%);
  border: 1px solid color-mix(in oklab, var(--accent), transparent 70%);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  box-shadow: 0 14px 30px -14px rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  animation: toastIn .45s var(--ease-out) both, toastOut .45s var(--ease) 4.6s both;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-18px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(-14px) scale(.97); }
}
.toast__icon { grid-row: span 2; font-size: 1.3rem; text-align: center; }
.toast__title {
  font-family: var(--mono); font-size: .74rem; font-weight: 700;
  color: #fff; letter-spacing: -.01em;
}
.toast__sub {
  grid-column: 2; font-family: var(--mono); font-size: .6rem;
  color: color-mix(in oklab, var(--accent), transparent 30%);
  letter-spacing: .04em;
}
.toast__pts {
  grid-row: span 2;
  font-family: var(--mono); font-size: .8rem; font-weight: 700;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.toast--penalty { border-left-color: var(--flag); }
.toast--penalty .toast__pts { color: var(--flag); }
.toast--penalty .toast__sub { color: color-mix(in oklab, var(--flag), transparent 35%); }
.toast--null { border-left-color: var(--muted); }
.toast--null .toast__pts { color: var(--muted); font-size: .68rem; }

/* must come after the base .toasts rule to win — the bottom-docked
   scoreboard on phones needs the stack to clear it */
@media (max-width: 46rem) {
  .toasts {
    inset-block-end: calc(max(.5rem, env(safe-area-inset-bottom)) + 4.5rem);
    inset-inline-start: max(.5rem, env(safe-area-inset-left));
    width: min(19rem, calc(100vw - 1rem));
  }
}

/* ═══════════════ SCROLL REVEALS ═══════════════ */
/* Load-in stagger for the hero. Declared here rather than as inline
   style="--d:…" attributes so the page satisfies a strict CSP with no
   'unsafe-inline' in style-src. */
.reveal { animation: revealUp .95s var(--ease-out) both; }
.entry__eyebrow.reveal { animation-delay:   0ms; }
.headword.reveal       { animation-delay:  80ms; }
.phonetic.reveal       { animation-delay: 220ms; }
.entry .sense.reveal   { animation-delay: 360ms; }
.entry__scroll.reveal  { animation-delay: 520ms; }
@keyframes revealUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
[data-obs] {
  opacity: 0; transform: translateY(20px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
}
[data-obs].is-in { opacity: 1; transform: none; }

/* ═══════════════ WITHDRAWN STATE ═══════════════ */
html[data-withdrawn] .hud,
html[data-withdrawn] .toasts { display: none !important; }
html[data-withdrawn] .vignette { opacity: 0 !important; }
html[data-withdrawn] .exit__card { display: none; }
html[data-withdrawn] .grain { mix-blend-mode: multiply; opacity: .32; }

/* back to paper, whatever the scroll position says */
html[data-withdrawn] {
  --comp: 0 !important;
  --bg:          #F3EFE5 !important;
  --ink:         #17150F !important;
  --muted:       #6E6759 !important;
  --rule:        #DCD5C3 !important;
  --card:        #FBF8F1 !important;
  --accent-text: #4C5C0C !important;
  color-scheme: light;
  transition:
    --bg 1.4s var(--ease), --ink 1.4s var(--ease), --muted 1.4s var(--ease),
    --rule 1.4s var(--ease), --card 1.4s var(--ease), --accent-text 1.4s var(--ease);
}

/* ═══════════════ COMPETITIVE MODE (konami) ═══════════════ */
html[data-competitive] .wild__item::after,
html[data-competitive] .sense::after,
html[data-competitive] .forms__row::after {
  content: attr(data-rank);
  font-family: var(--mono); font-size: .55rem; font-weight: 700;
  letter-spacing: .1em;
  background: var(--flag); color: #fff;
  padding: .15em .45em; border-radius: 2px;
  justify-self: end; align-self: center;
}
html[data-competitive] .wild__item { grid-template-columns: minmax(6.5rem, 12rem) 1.75rem minmax(0, 1fr) auto; }
html[data-competitive] .headword__syl:nth-child(odd) { color: var(--accent); }

/* ═══════════════ MOTION PREFERENCES ═══════════════ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  [data-obs] { opacity: 1; transform: none; }
  .reveal { opacity: 1; transform: none; }
  .entry__scrollline::after { display: none; }
}

/* ═══════════════ PRINT (a real dictionary would) ═══════════════ */
@media print {
  .hud, .toasts, .grain, .vignette, .entry__scroll, .machine, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .section { padding-block: 1.5rem; break-inside: avoid; }
  [data-obs] { opacity: 1; transform: none; }
}
