/* Air Connu.
   Newspaper-clean, record soul.

   The strategic principle, from the brand guide: the interface is monochrome ink
   on paper, like every great newspaper puzzle — so the sleeve's colours are the
   only colour on the page. If you are about to add a saturated colour to the
   chrome, don't. */

/* The typefaces are self-hosted: /fonts/fonts.css declares the faces, and every
   page that wants them links it BEFORE its stylesheet (index.html, admin.html,
   the admin's preview iframe). It is its own file rather than a block here
   because the admin does not load style.css — one declaration, two surfaces. */

:root {
  /* Neutrals — newsprint paper + warm ink */
  --paper: #FBFAF6;
  --paper-2: #F3F1EA;
  --paper-3: #EDEAE0;
  --ink: #1A1712;
  --ink-2: #6A655C;
  --ink-3: #918B80;
  --rule: #E3DFD4;
  --rule-2: #CFC9BB;

  /* One accent: label red. Used sparingly, never decoratively. */
  --accent: #C63A25;
  --accent-ink: #8F2A1A;

  /* Semantic, and deliberately not the accent */
  --warn: #B07B1E;  /* "so close" */
  --ok: #4C7A4E;    /* solved */

  --radius: 8px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
}

/* Night edition. Ink becomes the ground; the sleeve colours are still the only
   saturation on the page. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15130F;
    --paper-2: #1E1B16;
    --paper-3: #26221C;
    --ink: #F4F1E8;
    --ink-2: #9C968A;
    --ink-3: #6F6A60;
    --rule: #2E2A23;
    --rule-2: #413B32;
    --accent: #E86A52;
    --accent-ink: #F08A74;
    --warn: #D3A44E;
    --ok: #7BAE7D;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  font-feature-settings: "ss01", "cv05";
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom));
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.wrap { max-width: 460px; margin: 0 auto; padding: 0 1.1rem; }
.loading { color: var(--ink-3); font-size: .9rem; padding: 2rem 0; text-align: center; }
.vis-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- splash ---------- */
/* Paints instantly over the whole page on load and fades once today's board is
   ready (see js/splash.js). Monochrome and variable-driven, so the Night edition
   comes for free. */

.splash {
  position: fixed;
  inset: 0;
  z-index: 200;            /* above the update-bar (50) and everything else */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  background: var(--paper);
}
.splash.is-hiding {
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease;
}

/* The wordmark disc, enlarged and spinning. Reuses the .disc gradient recipe.
   Scoped under .splash so it out-specifies the later `.disc { width: .58em }`
   rule — without the extra class it would shrink back to wordmark size. */
.splash .splash-disc {
  position: relative;
  width: 88px;
  height: 88px;
  animation: disc-spin 1.4s linear infinite;
}
/* The groove pattern is radially symmetric, so a bare spin would look frozen.
   One faint off-centre seam makes the rotation read — still ink on paper. */
.splash .splash-disc::after {
  content: "";
  position: absolute;
  top: 8%;
  left: calc(50% - 1px);
  width: 2px;
  height: 42%;
  border-radius: 1px;
  background: linear-gradient(var(--ink-3), transparent);
}

@keyframes disc-spin { to { transform: rotate(360deg); } }

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 2px solid var(--ink);
  margin-bottom: 1.2rem;
}
.masthead .wrap { padding-top: calc(1rem + env(safe-area-inset-top)); padding-bottom: .8rem; }

.kicker {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
  padding-bottom: .55rem;
  margin-bottom: .6rem;
}
.kicker .red { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* wrap is the safety net: if the nav ever outgrows the row (a 320px phone), it
   slides onto its own line instead of forcing the whole page to scroll sideways */
.masthead-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }

.wordmark {
  font-family: var(--serif);
  font-weight: 700;
  font-optical-sizing: auto;
  font-size: 1.5rem;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .04em;
}

/* the vinyl disc replacing the O of "Connu" — the one playful move */
.disc {
  display: inline-block;
  width: .58em;
  height: .58em;
  border-radius: 50%;
  flex: none;
  background:
    radial-gradient(circle at 50% 50%, var(--paper) 0 8%, transparent 8.5%),
    repeating-radial-gradient(circle at 50% 50%, var(--ink) 0 1px, transparent 1px 3px),
    var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

.nav { display: flex; gap: .9rem; margin-left: auto; }
.nav a {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-decoration: none;
  padding: .2rem 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* the help "?" — a circled glyph, not a fifth word: five uppercase links would
   crowd the masthead row off 320px phones */
.nav .q {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  align-self: center;
  padding: 0;
  border: 1.5px solid var(--rule-2);
  border-radius: 50%;
  font-size: .72rem;
  letter-spacing: 0;
}
.nav .q:hover { border-color: var(--ink); }
.nav .q[aria-current="page"] { border-color: var(--accent); }

/* five items have to share the row with the wordmark on a narrow phone */
@media (max-width: 419px) {
  .nav { gap: .55rem; }
  .nav a { letter-spacing: .06em; }
}

/* ---------- section captions: the two clue instruments ---------- */

.cap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .7rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: .35rem;
  margin: 0 0 .7rem;
}
.cap .name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--ink);
}
.cap .what {
  font-size: .56rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: right;
}

/* ---------- « Nuance »: the palette histogram ---------- */
/* Bar height is the colour's share of the sleeve, so the shape is a real
   fingerprint of the artwork rather than decoration. */

.palette { display: flex; align-items: flex-start; gap: 5px; }
.palette .bar {
  flex: 1;
  min-width: 0;
  /* TWO DEFINITE ROWS: the bar's track, then the label's.
     The 118px is load-bearing twice over. .fill sizes itself with a percentage,
     and a percentage height only resolves against a parent with a DEFINITE
     height — with `auto`, every bar collapses to nothing and the palette (the
     entire point of the game) renders invisible.
     And giving the label a row of its OWN is what makes the bars line up. They
     used to share one flex column with the label, so a name that wrapped to two
     lines ("Sage Green") ate into the bar above it and lifted that bar's baseline
     clear off the line the others sat on. Now the label can wrap, or not, and
     nothing above it moves. */
  display: grid;
  grid-template-rows: 118px auto;
  gap: 5px;
}
.palette .fill {
  /* Bottom of its track: the bars are read against a common baseline, which is
     the only way their heights mean anything. */
  align-self: end;
  border-radius: 4px 4px 2px 2px;
  box-shadow: inset 0 0 0 1px #00000014;
}
.palette small {
  /* Two lines' worth, reserved whether the name needs it or not — so every
     label row is the same height and the palette below stays on one line. */
  height: 2.3em;
  overflow: hidden;
  font-size: .47rem;
  color: var(--ink-3);
  text-align: center;
  line-height: 1.15;
  letter-spacing: .02em;
}

.mood {
  font-family: var(--serif);
  font-style: italic;
  text-align: center;
  color: var(--ink-2);
  font-size: .95rem;
  margin: .7rem 0 1.4rem;
}

/* ---------- « Demi-Mot »: the letter tiles ---------- */

.letters { display: grid; gap: 7px; }
.lrow { display: flex; flex-wrap: wrap; gap: 5px; }

.tile {
  width: 29px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--rule-2);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  font-size: .95rem;
  animation: pop .26s cubic-bezier(.2, 1.5, .4, 1) both;
}
@keyframes pop {
  from { transform: scale(.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.hushed { font-size: .72rem; color: var(--ink-3); margin: .55rem 0 0; }

/* ---------- guess form ---------- */

.guess-form { display: flex; gap: 8px; margin-top: 1.2rem; }
.guess-form input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--rule-2);
  border-radius: var(--radius);
  padding: .7rem .75rem;
  font-family: var(--sans);
  font-size: 1rem; /* 16px — anything smaller makes iOS zoom the page on focus */
  background: var(--paper);
  color: var(--ink);
}
.guess-form input::placeholder { color: var(--ink-3); }
.guess-form input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.guess-form.shake { animation: shake .4s; }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.btn {
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-weight: 700;
  font-size: .9rem;
  padding: 0 1.1rem;
  cursor: pointer;
}
.btn:hover { background: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.wide { width: 100%; padding: .75rem; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--rule-2);
}
.btn.ghost:hover { background: transparent; border-color: var(--accent); color: var(--accent); }

.feedback { min-height: 1.3rem; font-size: .84rem; font-weight: 600; margin: .55rem 0 0; }
.feedback.bad { color: var(--accent); }
.feedback.close { color: var(--warn); }

/* ---------- the hint ladder ---------- */

.ladder { display: grid; gap: 5px; margin-top: 1.1rem; }
.hint {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  text-align: left;
  border: 1px dashed var(--rule-2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  padding: .42rem .8rem;
  font-family: var(--sans);
  font-size: .79rem;
  cursor: pointer;
}
.hint:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.hint:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint:disabled { cursor: default; opacity: .45; }
.hint .tier {
  flex: none;
  font-weight: 800;
  font-size: .6rem;
  letter-spacing: .08em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.hint .lbl { flex: 1; font-weight: 600; }
.hint .cost {
  flex: none;
  font-weight: 800;
  font-size: .72rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.hint.got {
  border-style: solid;
  border-color: var(--ink);
  background: var(--paper-2);
  color: var(--ink);
  opacity: 1;
}
.hint.got .lbl { font-weight: 700; }
.hint.got .cost { color: var(--ink-3); text-decoration: line-through; }

/* ---------- live score ---------- */

.scorebar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--rule);
  margin-top: 1.1rem;
  padding-top: .65rem;
}
.scorebar .lab {
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.scorebar .val {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.scorebar .val.drop { animation: drop .4s; color: var(--accent); }
@keyframes drop {
  0% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

/* ---------- solved ---------- */

.solved { text-align: center; }
.verdict {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ink-2);
  margin: 0 0 1rem;
  text-wrap: balance;
}
.sleeve {
  width: 132px;
  height: 132px;
  margin: 0 auto 1rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper-2);
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 9px;
  overflow: hidden;
}
.sleeve i { flex: 1; border-radius: 2px; }
.sleeve.art { padding: 0; }
.sleeve img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }

.solved h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: -.01em;
  margin: 0;
  line-height: 1.15;
  text-wrap: balance;
}
.solved .artist { font-size: .9rem; color: var(--ink-2); margin: .2rem 0 1.2rem; }

/* ---------- the Apple Music player ---------- */
/* Rendered ONLY on the solved screen. The embed URL is part of the `answer`
   payload, which the server does not send while a play is open — so for an
   unsolved player this iframe does not exist, no request reaches Apple, and no
   preview audio can give the record away. */

.player { margin: 0 0 1.2rem; }
.player iframe {
  width: 100%;
  max-width: 100%;
  height: 175px;
  border: 0;
  overflow: hidden;
  border-radius: 10px;
  background: var(--paper-2);
}
.player .buy {
  display: inline-block;
  margin-top: .5rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-2);
}
.player .buy:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* the arithmetic, shown in full — a decaying score is only motivating if you can
   see exactly what each decision cost you */
.maths {
  text-align: left;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper-2);
  padding: .8rem .9rem;
  margin-bottom: 1.1rem;
}
.maths .r {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .82rem;
  padding: .15rem 0;
  font-variant-numeric: tabular-nums;
}
.maths .r span { color: var(--ink-2); }
.maths .r b { font-weight: 700; }
.maths .r.sub b { color: var(--accent); }
.maths .r.total {
  border-top: 1.5px solid var(--ink);
  margin-top: .4rem;
  padding-top: .5rem;
}
.maths .r.total span {
  color: var(--ink);
  font-weight: 800;
  font-size: .6rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.maths .r.total b { font-family: var(--serif); font-size: 1.5rem; line-height: 1; }

/* share card */
.sharecard {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper-2);
  padding: .9rem;
  margin-bottom: .8rem;
}
.sharecard .ttl { font-family: var(--serif); font-weight: 600; font-size: .98rem; margin-bottom: .5rem; }
.swatches { display: inline-grid; grid-template-columns: repeat(5, 26px); gap: 5px; margin-bottom: .5rem; }
.swatches i { width: 26px; height: 26px; border-radius: 3px; box-shadow: inset 0 0 0 1px #00000014; }
.sharecard .shape {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.stack { display: grid; gap: .55rem; }

/* the recovery code — shown once, so shown LARGE */
.recovery { text-align: center; }
.recovery .sub { color: var(--ink-2); font-size: .88rem; max-width: 34rem; margin: .6rem auto 1.2rem; }
.recovery .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.35rem;
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: .9rem .6rem;
  margin: 0 0 1.2rem;
  user-select: all; /* one tap selects the whole code */
}

/* "was that just me?" — the room's numbers, above the share card */
.roomline {
  text-align: center;
  font-size: .82rem;
  color: var(--ink-2);
  margin: 0 0 .9rem;
}

/* the reason to come back, under the share buttons */
.nextup {
  text-align: center;
  margin-top: 1.1rem;
  font-size: .82rem;
  color: var(--ink-2);
}
.nextup b { font-variant-numeric: tabular-nums; color: var(--ink); }
.nextup a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- score sheet ---------- */

/* ---------- account panel (score sheet) ---------- */
.account {
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.4rem;
  background: var(--paper-2);
}
.account .who { margin: 0; font-weight: 600; }
.account .who b { color: var(--accent-ink); }
.account .sub { margin: .3rem 0 0; font-size: .82rem; color: var(--ink-2); }
.account form { margin: .9rem 0 0; display: flex; flex-direction: column; gap: .5rem; }
.account input {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  font: inherit;
  background: var(--paper);
  color: var(--ink);
}
.account input:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.auth-error { margin: 0; font-size: .8rem; color: var(--accent-ink); }
.auth-actions { display: flex; gap: .5rem; margin-top: .2rem; }
.auth-actions button { flex: 1; }
.account button.primary {
  background: var(--ink); color: var(--paper);
  border: 0; border-radius: 999px; padding: .6rem 1rem; font-weight: 600; cursor: pointer;
}
.account button.primary:hover { background: var(--accent); }
.account button.ghost {
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--rule-2); border-radius: 999px; padding: .6rem 1rem; cursor: pointer;
}
.account button:disabled { opacity: .5; cursor: default; }
.board .who.guest { color: var(--ink-2); font-style: italic; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin-bottom: 1.4rem; }
.stat { text-align: center; }
.stat b {
  display: block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat span {
  display: block;
  margin-top: .25rem;
  font-size: .54rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.subcap {
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 1.5rem 0 .6rem;
}
.subcap:first-child { margin-top: 0; }

.dist { display: grid; gap: 5px; }
.dist .r { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: center; font-size: .78rem; }
.dist .r > span { font-weight: 800; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dist .r i {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 19px;
  min-width: 22px;
  padding-right: 6px;
  border-radius: 3px;
  background: var(--ink);
  color: var(--paper);
  font-size: .66rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.dist .r.best i { background: var(--accent); }

/* the crate — records you've named, as bar-marks */
.crate { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.rec {
  aspect-ratio: 1;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 5px;
  overflow: hidden;
}
.rec i { flex: 1; border-radius: 1px; }
.rec.locked {
  border-style: dashed;
  background: repeating-linear-gradient(45deg,
    var(--paper-2), var(--paper-2) 5px, var(--paper) 5px, var(--paper) 10px);
}

/* ---------- lists (packs, archive, leaderboard) ---------- */

/* The archive's month rules. Sticky, so you always know which month you are
   scrolling through once the list runs to hundreds of records. */
.month {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 1.4rem 0 0;
  padding: .45rem .15rem .3rem;
  background: var(--paper);
  border-bottom: 1.5px solid var(--ink);
  font-family: var(--sans);
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.month:first-child { margin-top: 0; }

.row-btn {
  display: flex;
  align-items: center;
  gap: .8rem;
  width: 100%;
  text-align: left;
  padding: .8rem .15rem;
  border: none;
  border-bottom: 1px solid var(--rule);
  background: none;
  color: var(--ink);
  font-family: var(--sans);
  cursor: pointer;
}
.row-btn:hover { background: var(--paper-2); }
.row-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.mini {
  flex: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 4px;
  overflow: hidden;
}
.mini i { flex: 1; border-radius: 1px; }
.mini.locked {
  border-style: dashed;
  background: repeating-linear-gradient(45deg,
    var(--paper-2), var(--paper-2) 5px, var(--paper) 5px, var(--paper) 10px);
}

.row-btn .txt { flex: 1; min-width: 0; }
.row-btn .txt b {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.02rem;
}
.row-btn .txt span { font-size: .75rem; color: var(--ink-2); }
.row-btn .cnt {
  flex: none;
  font-size: .68rem;
  font-weight: 800;
  color: var(--ink-3);
  letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
}
.row-btn .cnt.done { color: var(--ok); }

.board-tabs {
  display: flex;
  gap: .4rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.board-tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: .45rem .7rem;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
}
.board-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.board { display: grid; }
.board .row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: .7rem;
  align-items: center;
  padding: .65rem .15rem;
  border-bottom: 1px solid var(--rule);
  font-size: .87rem;
}
.board .rank {
  text-align: right;
  font-weight: 800;
  font-size: .78rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.board .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .who small { display: block; font-size: .65rem; color: var(--ink-3); font-weight: 500; }
.board .pts {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.06rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.board .row.me {
  background: var(--paper-2);
  border-bottom: none;
  border-radius: 5px;
  margin: 0 -.5rem;
  padding: .65rem .5rem;
}
.board .row.me .who { font-weight: 800; }
.board .row.me .rank { color: var(--accent); }

.empty {
  color: var(--ink-3);
  font-size: .9rem;
  text-align: center;
  padding: 2.2rem 1rem;
  font-family: var(--serif);
  font-style: italic;
  text-wrap: balance;
}

/* ---------- new-edition bar ---------- */
/* Shown when a new service worker takes over, so an installed PWA never sits
   silently on stale code. */

.update-bar {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 999px;
  padding: .7rem 1.2rem;
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 22px #00000030;
}
.update-bar:hover { background: var(--accent); }

/* ---------- the time machine (authoring only) ---------- */
/* /?day=2026-07-20 renders another date's board. It must be impossible to mistake
   for the real thing, so it is barred rather than tinted: the accent, top of the
   page, above the record. In production the server ignores ?day= entirely and
   this never renders. */
.asof {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .2rem .6rem;
  margin-bottom: 1.4rem;
  padding: .7rem .9rem;
  border-left: 3px solid var(--accent);
  background: var(--paper-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--sans);
  font-size: .78rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.asof b { color: var(--accent-ink); }
.asof a { color: var(--ink-2); }

/* ---------- admin: the Apple Music release picker ---------- */
/* You are choosing a SLEEVE, not a song. The same track exists on the single,
   the album, the remaster and three compilations, and their covers look nothing
   alike — so the artwork has to be big enough to judge. The palette is sampled
   from whichever you pick, and that same image is what players see on solving. */

.apple-results { display: grid; gap: 6px; margin-top: .7rem; }
.apple-hit {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  text-align: left;
  padding: .45rem;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  cursor: pointer;
}
.apple-hit:hover { border-color: var(--accent); }
.apple-hit.picked { border-color: var(--accent); background: var(--paper-2); }
.apple-hit img {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 4px;
  object-fit: cover;
  background: var(--paper-2);
}
.apple-hit .meta { min-width: 0; display: grid; gap: 1px; }
.apple-hit .meta b { font-size: .9rem; }
.apple-hit .meta span { font-size: .8rem; color: var(--ink-2); }
.apple-hit .meta small {
  font-size: .7rem;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- how to play ---------- */
/* The demos reuse the board's own .palette and .tile styling, so the examples
   stay true to the real thing by construction. */

.help .lede {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink);
  margin: 0 0 1.6rem;
}
.help p {
  font-size: .9rem;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 1rem;
}
.help p a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.help .cap { margin-top: 1.7rem; }
.help .demo { margin-bottom: .8rem; }
/* board-scale bars would dominate the page — shrink the track */
.help .palette .bar { grid-template-rows: 56px auto; }
.help .maths { margin-bottom: 1rem; }
.help .btn.wide { margin-top: .8rem; }
