  /* =========================================================
     THE SONGWRITER'S NOTEBOOK — core feel (Phases 0–3)
     ========================================================= */

  :root {
    --paper: #f5efe1;
    --paper-edge: #efe7d4;
    --desk: #c8bca6;
    --ink: #2b2722;            /* graphite body ink */
    --ink-soft: #6f675a;       /* faded pencil */
    --rule: rgba(43, 39, 34, 0.07);   /* ruled lines */
    --margin: rgba(178, 58, 58, 0.45); /* red margin rule */

    /* Era tokens (overridden per round by [data-era]) */
    --ink-accent: #a9791f;
    --highlighter: rgba(247, 201, 72, 0.55);
    --bead: #c8951f;
    --page-wash: rgba(212, 160, 23, 0.05);

    --line: 32px;  /* notebook baseline rhythm */
    --serif: Georgia, "Times New Roman", serif;
    --hand: "Caveat", "Bradley Hand", "Segoe Script", cursive;
    --type: "Courier Prime", "Courier New", monospace;
    --tension: 0;  /* 0 calm → 1 the bridge; driven by the timer */
  }

  /* ---- Era palettes (accent / highlighter / bead / wash) ---- */
  body[data-era="gold"]     { --ink-accent:#a9791f; --highlighter:rgba(247,201,72,0.55); --bead:#c8951f; --page-wash:rgba(212,160,23,0.05); }
  body[data-era="lavender"] { --ink-accent:#6d5aa6; --highlighter:rgba(186,160,235,0.50); --bead:#8b73c9; --page-wash:rgba(139,115,201,0.05); }
  body[data-era="red"]      { --ink-accent:#9b2226; --highlighter:rgba(225,90,95,0.42);  --bead:#b23a3f; --page-wash:rgba(178,58,63,0.05); }
  body[data-era="denim"]    { --ink-accent:#3f6fa3; --highlighter:rgba(120,170,220,0.45); --bead:#5b87b8; --page-wash:rgba(91,135,184,0.05); }
  body[data-era="graphite"] { --ink-accent:#4a4a4a; --highlighter:rgba(130,130,130,0.40); --bead:#6b6b6b; --page-wash:rgba(90,90,90,0.05); }
  body[data-era="midnight"] { --ink-accent:#2b3a67; --highlighter:rgba(90,110,180,0.42); --bead:#3d4f86; --page-wash:rgba(43,58,103,0.06); }
  body[data-era="debut"]      { --ink-accent:#3f7d54; --highlighter:rgba(120,185,135,0.42); --bead:#5a9e6e; --page-wash:rgba(63,125,84,0.05); }
  body[data-era="reputation"] { --ink-accent:#2c2c2e; --highlighter:rgba(80,80,86,0.42);   --bead:#3a3a3e; --page-wash:rgba(44,44,46,0.07); }
  body[data-era="lover"]      { --ink-accent:#b8487f; --highlighter:rgba(234,150,196,0.46); --bead:#d472a6; --page-wash:rgba(196,100,154,0.05); }
  body[data-era="evermore"]   { --ink-accent:#6b4a2e; --highlighter:rgba(160,120,80,0.42);  --bead:#8a6038; --page-wash:rgba(122,90,56,0.05); }

  * { box-sizing: border-box; }

  body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--type);
    color: var(--ink);
    /* Light blonde-oak desk, rendered as one non-repeating SVG (no tiling, no
       seams). The browser rasterizes the SVG's grain at display resolution, so
       it stays crisp at any window size. */
    background:
      url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='1600'%20height='1100'%20viewBox='0%200%201600%201100'%20preserveAspectRatio='xMidYMid%20slice'%3E%3Cdefs%3E%3ClinearGradient%20id='b'%20x1='0'%20y1='0'%20x2='0.1'%20y2='1'%3E%3Cstop%20offset='0'%20stop-color='%23dcc6a1'/%3E%3Cstop%20offset='0.55'%20stop-color='%23d0b78d'/%3E%3Cstop%20offset='1'%20stop-color='%23c5a97c'/%3E%3C/linearGradient%3E%3Cfilter%20id='g'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.006%200.1'%20numOctaves='2'%20seed='11'%20stitchTiles='stitch'/%3E%3CfeColorMatrix%20type='matrix'%20values='0%200%200%200%200.5%200%200%200%200%200.39%200%200%200%200%200.24%200%200%200%200.4%200'/%3E%3C/filter%3E%3C/defs%3E%3Crect%20width='1600'%20height='1100'%20fill='url(%23b)'/%3E%3Crect%20width='1600'%20height='1100'%20filter='url(%23g)'/%3E%3Cg%20fill='none'%20stroke='%239c7f56'%20stroke-opacity='0.14'%20stroke-width='1.5'%3E%3Cpath%20d='M0%20312%20H1600'/%3E%3Cpath%20d='M0%20742%20H1600'/%3E%3C/g%3E%3C/svg%3E")
        center / cover no-repeat fixed;
    background-color: #cdb389;
    display: flex;
    justify-content: center;
    padding: 20px 18px 64px;
  }

  .app { width: 100%; max-width: 660px; position: relative; z-index: 1; perspective: 1700px; perspective-origin: 50% 0%; }

  /* ---------- Desk props (decorative, desktop only) ----------
     Quiet, semi-realistic objects that straddle the screen edges — each runs
     roughly half off the viewport so the desk reads as continuing past the
     window. Hidden on narrow screens where they'd crowd the notebook. */
  .desk-items { position: fixed; inset: 0; z-index: 0; pointer-events: none; display: none; overflow: hidden; }
  /* December snowfall: full-viewport decorative canvas, above the notebook but
     below the settings modal (z 200). Shown/hidden + animated by app.js, gated on
     December (active timezone) and motion-allowed. */
  #snowfall { position: fixed; inset: 0; z-index: 50; pointer-events: none; display: none; }
  .desk-item {
    position: absolute; opacity: 0.92;
    filter: drop-shadow(3px 7px 6px rgba(46,32,14,0.30)) saturate(0.88);
  }
  .desk-item svg { display: block; width: 100%; height: auto; overflow: visible; }

  /* left edge — pinned to left:0, shifted so ~half hangs off the screen */
  .di-glasses { width: 170px; top: 10%;  left: 0; transform: translateX(-50%) rotate(-7deg); }
  .di-mug     { width: 142px; top: 39%;  left: 0; transform: translateX(-46%); }
  .di-pencil  { width: 216px; top: 72%;  left: 0; transform: translateX(-50%) rotate(7deg); }
  /* right edge */
  .di-floss   { width: 158px; top: 11%;  right: 0; transform: translateX(28%); }
  .di-cassette{ width: 190px; top: 40%;  right: 0; transform: translateX(50%) rotate(-5deg); }
  .di-picks   { width: 128px; top: 72%;  right: 0; transform: translateX(48%) rotate(6deg); }

  /* mug steam — faint wisps drifting up */
  .desk-steam path { animation: deskSteam 4.4s ease-in-out infinite; transform-origin: center bottom; }
  .desk-steam path:nth-child(2) { animation-delay: 1.3s; }
  .desk-steam path:nth-child(3) { animation-delay: 2.6s; }
  @keyframes deskSteam {
    0%   { opacity: 0; transform: translateY(4px) scaleY(0.75); }
    35%  { opacity: 0.55; }
    70%  { opacity: 0.18; }
    100% { opacity: 0; transform: translateY(-12px) scaleY(1.15); }
  }
  /* a dangling bead on the floss spool sways gently */
  .desk-sway { transform-box: fill-box; transform-origin: 50% 0%; animation: deskSway 5.2s ease-in-out infinite; }
  @keyframes deskSway { 0%,100% { transform: rotate(-2.4deg); } 50% { transform: rotate(2.4deg); } }

  @media (min-width: 1040px) { .desk-items { display: block; } }

  /* ---------- Title ---------- */
  header.title { text-align: center; margin-bottom: 22px; }
  header.title h1 {
    margin: 0;
    font-family: var(--hand);
    font-weight: 700;
    font-size: clamp(22px, 6.4vw, 44px);
    line-height: 1.1;
    white-space: nowrap;
    color: #4a3518;  /* a darker take on the settings-gear brown */
    transform: rotate(-1.4deg);
  }
  header.title p {
    margin: 10px 0 0;
    font-family: var(--type);
    font-size: 12px; letter-spacing: 1px; color: var(--ink-soft);
  }

  /* ---------- Paper page ---------- */
  .card {
    position: relative;
    background:
      /* red margin rule as a background layer so it spans the full scroll height
         (the old absolute ::before stopped at the visible box in scrolling cards). */
      linear-gradient(to right, transparent var(--rule-x, 44px), rgba(178, 58, 58, 0.38) var(--rule-x, 44px), rgba(178, 58, 58, 0.38) calc(var(--rule-x, 44px) + 2px), transparent calc(var(--rule-x, 44px) + 2px)),
      linear-gradient(var(--page-wash), var(--page-wash)),
      repeating-linear-gradient(
        to bottom,
        var(--paper) 0,
        var(--paper) calc(var(--line) - 1px),
        var(--rule) calc(var(--line) - 1px),
        var(--rule) var(--line)
      );
    background-color: var(--paper);
    border-radius: 3px;
    padding: 30px 30px 34px 58px;   /* extra left pad for the margin */
    box-shadow:
      0 1px 0 #fff inset,
      0 18px 40px rgba(60, 50, 35, 0.28),
      0 2px 6px rgba(60, 50, 35, 0.18);
    /* deckled / torn-ish edge softness */
    transition: background 0.5s ease;
  }
  /* tension vignette — the room dims as the timer runs out */
  .card::after {
    content: ""; position: absolute; inset: 0; border-radius: 3px;
    pointer-events: none; z-index: 5;
    background: radial-gradient(108% 82% at 50% 43%,
      transparent 36%, rgba(58,14,14,0.5) 76%, rgba(34,6,6,0.82) 100%);
    opacity: var(--tension, 0);
    transition: opacity 0.15s linear;
  }

  /* hurried tally scrawled in the outer margin in the final seconds */
  .margin-tally {
    position: absolute; left: 8px; top: 39%; z-index: 6;
    font-family: var(--hand); font-weight: 700; font-size: 42px;
    color: var(--margin); opacity: 0; transform: rotate(-9deg);
    pointer-events: none;
  }
  .margin-tally.show { animation: tally 0.95s ease-out; }
  @keyframes tally {
    0%   { opacity: 0; transform: rotate(-9deg) scale(0.6); }
    25%  { opacity: 0.95; transform: rotate(-9deg) scale(1.05); }
    100% { opacity: 0; transform: rotate(-9deg) scale(1.15) translateY(-8px); }
  }

  /* infinite-mode lives: pencil tally strokes scrawled down the outer margin,
     each crossed out as a life is spent */
  .lives-tally {
    position: absolute; left: 10px; top: 90px; z-index: 6;
    display: none; flex-direction: column; gap: 11px;
    pointer-events: none;
  }
  .lives-tally.show { display: flex; }
  .life-mark {
    position: relative; width: 4px; height: 26px; border-radius: 2px;
    background: var(--ink-soft);
    transform: rotate(-8deg); opacity: 0.85;
    transition: opacity 0.3s ease;
  }
  .life-mark.spent { opacity: 0.32; }
  /* the diagonal slash that crosses out a spent life */
  .life-mark.spent::after {
    content: ""; position: absolute; left: -7px; top: 11px;
    width: 20px; height: 2.5px; border-radius: 2px;
    background: var(--margin); transform: rotate(28deg);
    transform-origin: center;
    animation: strike 0.34s ease-out;
  }
  @keyframes strike {
    from { width: 0; opacity: 0; }
    to   { width: 20px; opacity: 1; }
  }

  /* adaptive-mode level gauge: the rarity level you're riding, shown as four lit
     pips with a promo sub-meter filling toward the next. Notebook-honest, not an XP bar. */
  .adaptive-gauge {
    display: none; align-items: center; justify-content: center; gap: 10px;
    flex-wrap: wrap; margin: 2px auto 10px; padding: 5px 12px;
    width: max-content; max-width: 90%;
    border: 1.4px solid rgba(43,39,34,0.18); border-radius: 16px;
    background: rgba(247,201,72,0.07);
  }
  .adaptive-gauge.show { display: flex; }
  .adapt-label {
    font-family: var(--type); font-size: 11px; letter-spacing: 0.4px;
    text-transform: uppercase; color: var(--ink); font-weight: 700; white-space: nowrap;
  }
  .adapt-pips { display: inline-flex; gap: 5px; }
  .adapt-pip {
    width: 9px; height: 9px; border-radius: 50%;
    border: 1.4px solid var(--ink-soft); background: transparent;
    transition: background 0.3s ease, transform 0.3s ease;
  }
  .adapt-pip.on { background: var(--ink-soft); }
  .adapt-pip.cur { background: var(--ink); border-color: var(--ink); transform: scale(1.35); }
  .adapt-meter {
    position: relative; width: 46px; height: 5px; border-radius: 3px;
    background: rgba(43,39,34,0.14); overflow: hidden;
  }
  .adapt-meter i {
    position: absolute; left: 0; top: 0; height: 100%; border-radius: 3px;
    background: var(--ink); transition: width 0.3s ease;
  }
  .adapt-meter--top { background: var(--highlighter, rgba(247,201,72,0.5)); }
  [data-reduce-motion="on"] .adapt-pip,
  [data-reduce-motion="on"] .adapt-meter i { transition: none; }

  /* Visually hidden but available to screen readers — used for live status/timer
     cues and any text alternative to a purely visual element. */
  .sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  /* A focused screen container shouldn't draw a focus ring (focus is moved there
     programmatically for screen-reader/keyboard users, not by tabbing). */
  .screen:focus { outline: none; }
  .screen:focus-visible { outline: none; }

  .screen { display: none; }
  .screen.active { display: block; animation: fade 0.4s ease; }
  @keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

  /* page turn — the answered page (a cloned sheet) lifts from its top edge and
     flips away toward the reader, revealing the next page already in place beneath */
  .page-flip-sheet {
    display: block; position: absolute; z-index: 40; pointer-events: none;
    transform-origin: top center; backface-visibility: hidden;
    box-shadow: 0 22px 44px rgba(60, 50, 35, 0.34);
    animation: pageFlip 0.5s cubic-bezier(.42,.04,.34,1) forwards;
    will-change: transform;
  }
  .page-flip-sheet .flip-shade {
    position: absolute; inset: 0; border-radius: 3px; pointer-events: none; z-index: 12;
    background: linear-gradient(to top, rgba(38,24,10,0.42), rgba(38,24,10,0.06) 48%, rgba(255,255,255,0.10) 100%);
    opacity: 0; animation: pageFlipShade 0.5s ease-in forwards;
  }
  @keyframes pageFlip {
    from { transform: rotateX(0deg); }
    to   { transform: rotateX(108deg); }
  }
  @keyframes pageFlipShade { from { opacity: 0; } to { opacity: 1; } }

  /* side-to-side page turns for screen navigation, both pivoting on the left spine.
     --side (FORWARD into a sub-page): the leaving page turns away to the left, revealing
     the destination beneath. --in (BACK / give-up): the destination page turns in from the
     left, landing on top of the page being left behind. */
  .page-flip-sheet.page-flip-sheet--side,
  .page-flip-sheet.page-flip-sheet--in {
    transform-origin: center left;
  }
  .page-flip-sheet.page-flip-sheet--side { animation-name: pageFlipSide; }
  .page-flip-sheet.page-flip-sheet--in   { animation-name: pageFlipIn; }
  .flip-shade.flip-shade--side,
  .flip-shade.flip-shade--in {
    background: linear-gradient(to left, rgba(38,24,10,0.42), rgba(38,24,10,0.06) 48%, rgba(255,255,255,0.10) 100%);
  }
  .flip-shade.flip-shade--in { animation-name: pageFlipShadeOut; }
  /* A frozen, non-animating backdrop clone of the page being left, sitting beneath the
     incoming sheet during a back/"in" turn (see flipInToScreen). Its shade is suppressed. */
  .page-flip-sheet.flip-static { animation: none; box-shadow: none; }
  .flip-shade.flip-shade--off { display: none; }
  @keyframes pageFlipSide {
    from { transform: rotateY(0deg); }
    to   { transform: rotateY(-104deg); }
  }
  @keyframes pageFlipIn {
    from { transform: rotateY(-104deg); }
    to   { transform: rotateY(0deg); }
  }
  @keyframes pageFlipShadeOut { from { opacity: 1; } to { opacity: 0; } }

  /* ---------- Buttons (hand-drawn / taped) ---------- */
  button {
    font-family: var(--type); cursor: pointer; border: none;
    transition: background 0.18s, color 0.18s, transform 0.12s, box-shadow 0.2s;
  }
  button:active { transform: translateY(1px) scale(0.99); }

  .btn-primary {
    display: block; width: 100%; margin: 0 auto;
    padding: 14px 18px; font-size: 15px; letter-spacing: 1px; font-weight: 700;
    color: var(--ink); background: var(--highlighter);
    border: 2px solid var(--ink);
    border-radius: 2px;
    box-shadow: 3px 3px 0 rgba(43, 39, 34, 0.18);
    transform: rotate(-0.6deg);
  }
  .btn-primary:hover { background: var(--ink); color: var(--paper); }

  /* ---------- "Start writing" — the hero CTA ----------
     Lifted out of the plain highlighter wash: a warm, fully-saturated gold fill, a
     hand-drawn pencil that rides along, a sketchy underline, and a near-imperceptible
     idle bob so it gently invites a click without shouting. */
  #playBtn {
    position: relative; overflow: visible;
    font-size: 17px;
    /* Solid colour fill + a CONSTANT translucent sheen as the image layer. Hover only
       swaps background-COLOR (gold → ink), so the fill stays opaque the whole time and
       there's no flash of the paper showing through (which happened when the old gradient
       background-image was wiped out instantly on hover). */
    background-color: #efb73e;
    background-image: linear-gradient(168deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0) 46%, rgba(43, 39, 34, 0.12) 100%);
    border-color: var(--ink);
    box-shadow: 3px 3px 0 rgba(43, 39, 34, 0.22);
    transition: background-color 0.24s ease, color 0.2s ease, transform 0.12s, box-shadow 0.2s;
  }
  #playBtn::before {
    content: "✎"; margin-right: 9px; font-size: 19px; vertical-align: -1px;
    display: inline-block; transform-origin: 70% 90%;
  }
  /* sketchy underline that "draws" under the label on hover/focus */
  #playBtn::after {
    content: ""; position: absolute; left: 16%; right: 16%; bottom: 9px; height: 2px;
    background: currentColor; border-radius: 2px;
    transform: scaleX(0); transform-origin: left center;
    transition: transform 0.28s ease;
    opacity: 0.7;
  }
  #playBtn:hover, #playBtn:focus-visible {
    background-color: var(--ink); color: var(--paper);
  }
  #playBtn:hover::after, #playBtn:focus-visible::after { transform: scaleX(1); }
  @media (prefers-reduced-motion: no-preference) {
    #playBtn { animation: playBob 2.8s ease-in-out infinite; }
    #playBtn::before { animation: playPencil 2.8s ease-in-out infinite; }
  }
  body[data-reduce-motion="on"] #playBtn,
  body[data-reduce-motion="on"] #playBtn::before { animation: none; }
  @keyframes playBob {
    0%, 100% { transform: rotate(-0.6deg) translateY(0); box-shadow: 3px 3px 0 rgba(43, 39, 34, 0.22); }
    50%      { transform: rotate(-0.6deg) translateY(-3px); box-shadow: 3px 6px 0 rgba(43, 39, 34, 0.18); }
  }
  @keyframes playPencil {
    0%, 100% { transform: rotate(0deg); }
    45%      { transform: rotate(-12deg) translateY(-1px); }
    55%      { transform: rotate(-12deg) translateY(-1px); }
  }

  .btn-ghost {
    width: 100%; margin-top: 14px; padding: 12px;
    font-size: 13px; letter-spacing: 1px; color: var(--ink);
    background: transparent; border: 1.5px dashed var(--ink-soft); border-radius: 2px;
  }
  .btn-ghost:hover { background: var(--highlighter); border-style: solid; }


  /* ---------- Hall of Fame (handwritten list) ---------- */
  .podium-title {
    font-family: var(--hand); font-weight: 700; font-size: 26px;
    color: var(--ink); margin: 0 0 6px; transform: rotate(-0.8deg);
  }

  /* ---------- Difficulty picker — notebook tabs ---------- */
  .mode-picker { margin: 0 0 20px; }
  .mode-picker-label {
    font-family: var(--type); font-size: 10px; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--ink-soft); margin: 0 0 7px;
  }
  .mode-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
  .mode-tab {
    font-family: var(--hand); font-size: 19px; line-height: 1; color: var(--ink-soft);
    background: transparent; cursor: pointer; padding: 6px 13px 7px;
    border: 1.5px solid rgba(43,39,34,0.18);
    border-bottom: none; border-radius: 6px 6px 0 0;
    transform: translateY(1px) rotate(-0.4deg);
    transition: color 0.15s, background 0.15s, transform 0.12s;
  }
  .mode-tab:nth-child(even) { transform: translateY(1px) rotate(0.5deg); }
  .mode-tab:hover { color: var(--ink); }
  .mode-tab.active {
    color: var(--ink); background: var(--highlighter);
    border-color: rgba(43,39,34,0.32); transform: translateY(0) rotate(0deg);
  }
  /* the Infinite stats tab — its own game type: set apart by the ∞ glyph and
     (when active) an inked fill instead of the pale highlighter wash */
  .mode-tab--inf.active {
    background: var(--ink); color: var(--paper); border-color: var(--ink);
  }
  .inf-glyph { font-size: 22px; font-weight: 700; margin-right: 5px; vertical-align: -2px; }
  .mode-blurb {
    font-family: var(--type); font-size: 11px; color: var(--ink-soft);
    margin: 9px 0 0; padding-top: 8px; border-top: 1px dashed rgba(43,39,34,0.16);
  }
  /* the tab rows reused on the stats page — two tiers (view / difficulty) */
  .stats-tabs { margin-bottom: 16px; }
  .stats-tabs:has(+ .stats-subtabs) { margin-bottom: 8px; }
  .stats-subtabs { margin-bottom: 16px; }
  /* #resultPodium holds the compact best line (classic/infinite) or the daily streak panel */
  .podium { list-style: none; margin: 0 0 4px; padding: 0; }

  /* "new personal best" banner above the records list */
  .new-best-banner {
    font-family: var(--hand); font-weight: 700; font-size: 22px;
    color: var(--ink-accent); text-align: center; margin: 6px 0 2px;
    transform: rotate(-0.6deg);
  }
  .new-best-banner.pop { animation: newBestPop 0.6s cubic-bezier(.34,1.56,.64,1); }
  @keyframes newBestPop {
    0%   { transform: rotate(-0.6deg) scale(0.6); opacity: 0; }
    60%  { transform: rotate(-0.6deg) scale(1.12); opacity: 1; }
    100% { transform: rotate(-0.6deg) scale(1); opacity: 1; }
  }

  /* ---------- "Your best" compact line (start + results) ---------- */
  .best-line { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 6px; }
  .best-num { font-family: var(--hand); font-weight: 700; font-size: 40px; line-height: 1; color: var(--ink-accent); }
  .best-unit { font-size: 21px; color: var(--ink-soft); }
  .best-meta { font-family: var(--type); font-size: 11px; letter-spacing: 0.5px; color: var(--ink-soft); }
  .best-empty { font-family: var(--hand); font-size: 20px; color: var(--ink-soft); opacity: 0.85; padding: 4px 0 8px; }

  /* ---------- Records page (personal bests + history) ---------- */
  .rec-sig { display: flex; align-items: center; gap: 18px; margin: 2px 0 16px; padding-bottom: 16px; border-bottom: 1px dashed rgba(43,39,34,0.16); }
  .rec-sig-text { min-width: 0; }
  .rec-sig-name { font-family: var(--hand); font-weight: 700; font-size: 30px; color: var(--ink); display: block; line-height: 1.05; transform: rotate(-0.6deg); }
  .rec-sig-sub { font-family: var(--type); font-size: 11px; letter-spacing: 0.5px; color: var(--ink-soft); display: block; margin-top: 5px; }
  .rec-sign-row { display: flex; align-items: center; gap: 8px; }
  .rec-sign-row .set-text { text-align: left; width: 190px; }
  .rec-sign-row .btn-ghost { width: auto; margin: 0; padding: 4px 16px; }
  .rec-pol-btn { flex: none; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; line-height: 0; }
  .rec-pol-btn:focus-visible { outline: 2px solid var(--ink-accent); outline-offset: 4px; border-radius: 3px; }

  /* Profile polaroid — a photo clipped to the page (records header + settings). */
  .polaroid {
    display: inline-block; position: relative; flex: none;
    background: #fffdf9; padding: 7px 7px 0; border: 1px solid rgba(43,39,34,0.12);
    border-radius: 2px; box-shadow: 0 2px 7px rgba(43,39,34,0.18);
    transform: rotate(var(--tilt, -4deg)); transition: transform 0.16s ease;
  }
  .rec-pol-btn:hover .polaroid { transform: rotate(calc(var(--tilt, -4deg) * 0.35)) scale(1.03); }
  .pol-photo {
    display: block; width: 96px; height: 96px; border-radius: 1px;
    background-color: var(--page-wash, #efe7d2); background-size: cover; background-position: center;
  }
  .pol-lip {
    display: block; height: 28px; line-height: 28px; max-width: 96px;
    font-family: var(--hand); font-weight: 700; font-size: 18px; color: var(--ink);
    text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  }
  .pol-tape {
    position: absolute; top: -8px; left: 50%; width: 50px; height: 17px;
    transform: translateX(-50%) rotate(-6deg);
    /* realistic washi surface comes from the shared .nav-tape rule; just tint it */
    --tape-color: var(--bead);
  }
  .polaroid.is-empty {
    background: var(--paper); border: 1.5px dashed rgba(43,39,34,0.34); box-shadow: none;
  }
  .polaroid.is-empty .pol-photo {
    background-color: transparent; display: flex; align-items: center; justify-content: center;
    color: var(--ink-soft);
  }
  .pol-add svg { width: 32px; height: 32px; }
  .polaroid.is-empty .pol-lip { color: var(--ink-soft); font-weight: 500; font-size: 16px; }
  .pol-clip { position: absolute; top: -7px; right: 8px; width: 20px; height: 20px; color: #9a958a; transform: rotate(14deg); }
  .polaroid-sm .pol-photo { width: 64px; height: 64px; }
  .polaroid-sm .pol-lip { width: 64px; max-width: 64px; height: 22px; line-height: 22px; font-size: 15px; }
  .polaroid-sm .pol-tape { width: 36px; height: 13px; top: -6px; }
  .polaroid-sm.is-empty .pol-lip { font-size: 13px; }
  .polaroid-sm .pol-add svg { width: 24px; height: 24px; }
  .polaroid-sm .pol-clip { width: 15px; height: 15px; top: -5px; right: 6px; }
  .set-avatar { display: flex; align-items: center; gap: 16px; }
  .set-avatar-actions { display: flex; flex-direction: column; gap: 6px; }
  .set-avatar-actions .btn-ghost { width: auto; margin: 0; padding: 4px 14px; white-space: nowrap; }
  @media (prefers-reduced-motion: reduce) { .polaroid { transition: none; } }

  .rec-group-label {
    font-family: var(--type); font-size: 10px; letter-spacing: 1px;
    color: var(--ink-soft); text-transform: uppercase; margin: 24px 0 10px;
  }

  /* Personal-best tiles — taped index cards scattered on the page. Each card is a
     near-opaque paper patch over the ruled lines, a washi-tape strip pinning the top,
     a tiny static tilt, and a per-mode accent (--pb-accent, set inline in pbTile). */
  .pb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 18px 14px; padding-top: 8px; }
  .pb-grid-inf { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 16px 12px; }
  .pb-tile {
    --pb-accent: var(--ink-accent);
    position: relative; border: 1px solid rgba(43,39,34,0.16); border-radius: 3px;
    padding: 16px 13px 13px; background: rgba(251,247,234,0.93);
    box-shadow: 0 1px 0 rgba(43,39,34,0.06);
    display: flex; flex-direction: column; gap: 3px;
  }
  /* washi tape pinning the card (realistic surface from the shared .nav-tape rule);
     tinted to match the tile's difficulty-accent text (--pb-accent). */
  .pb-tile::before {
    content: ""; position: absolute; top: -8px; left: 50%; width: 44px; height: 16px;
    transform: translateX(-50%) rotate(-3deg);
    --tape-color: var(--pb-accent);
  }
  /* subtle static scatter — deterministic per slot, not animated */
  .pb-grid .pb-tile:nth-child(4n+1) { transform: rotate(-1.4deg); }
  .pb-grid .pb-tile:nth-child(4n+2) { transform: rotate(1deg); }
  .pb-grid .pb-tile:nth-child(4n+3) { transform: rotate(-0.6deg); }
  .pb-grid .pb-tile:nth-child(4n)   { transform: rotate(1.5deg); }
  .pb-grid .pb-tile:nth-child(even)::before { transform: translateX(-50%) rotate(3.5deg); }
  .pb-tile.pb-empty { opacity: 0.5; }
  .pb-kicker { font-family: var(--type); font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); }
  .pb-mode { font-family: var(--type); font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--pb-accent); }
  .pb-score { font-family: var(--hand); font-weight: 700; font-size: 40px; line-height: 0.95; color: var(--ink); margin: 2px 0 1px; }
  .pb-inf .pb-score { font-size: 34px; }
  .pb-empty .pb-score { color: var(--ink-soft); }
  .pb-unit { font-size: 17px; color: var(--ink-soft); }
  .pb-sub { font-family: var(--type); font-size: 10px; color: var(--ink-soft); }
  @media (prefers-reduced-motion: reduce) {
    .pb-grid .pb-tile, .pb-grid .pb-tile::before { transform: none; }
    .pb-grid .pb-tile::before { left: 50%; margin-left: -21px; }
  }

  /* ---------- Challenges page — a master/detail entry in the notebook ----------
     Left: a contents list of challenges (gold tick / hollow ring / lock marks; the
     selected row flagged with a red play-arrow). Right: the selected challenge's
     rule + win written out. One ruled sheet (the .card paper) — no cork, no scraps. */
  .chall-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
  .chall-head-sub { font-family: var(--type); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-soft); }
  /* the token wallet — a denim sticky note with its own little gold pin */
  .chall-tokens {
    position: relative; font-family: var(--type); font-size: 12px; font-weight: 700;
    color: #274560; background: #cfdfea; padding: 8px 13px 9px; border-radius: 1px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.22); white-space: nowrap; transform: rotate(1.4deg);
  }
  .chall-tokens b { font-size: 14px; color: #1f3a52; }
  .chall-tokens::before {
    content: ""; position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
    width: 10px; height: 10px; border-radius: 50%;
    background: radial-gradient(circle at 36% 30%, #ffe08a, #d8a32f 60%, #9c6e14);
    box-shadow: 0 2px 3px rgba(0,0,0,0.38);
  }

  .chall-layout { display: grid; grid-template-columns: 208px 1fr; gap: 0; }

  /* ---- left: the contents list ---- */
  .chall-list { padding-right: 16px; padding-left: 14px; border-right: 1px solid rgba(60,40,18,0.16); }
  .chall-item {
    position: relative; display: grid; grid-template-columns: 1fr 22px;
    align-items: center; column-gap: 9px; width: 100%;
    padding: 8px 8px 8px 4px; min-height: 40px; cursor: pointer;
    background: none; border: none; border-radius: 2px; text-align: left;
    font: inherit; color: var(--ink); transition: background 0.12s;
  }
  .chall-item:hover { background: rgba(43,39,34,0.05); }
  .chall-item.selected { background: rgba(39,69,96,0.10); }
  .chall-item.selected::before {
    content: "\25B6"; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
    color: #b23a3a; font-size: 11px; line-height: 1;
  }
  .chall-item-num { font-family: var(--type); font-size: 11px; color: var(--ink-soft); text-align: right; }
  .chall-item-name { font-family: var(--hand); font-weight: 700; font-size: 22px; line-height: 1; color: var(--ink); }
  .chall-item.selected .chall-item-name { color: #1f3a52; }
  .chall-item-mark { display: flex; justify-content: center; }
  .chall-mark-svg { width: 20px; height: 20px; display: block; }

  /* difficulty: cassette tapes, coloured by tier (green → orange → red) */
  .chall-tapes { display: inline-flex; align-items: center; gap: 3px; }
  .tape-glyph { width: 20px; height: 13px; display: block; }
  .tape-glyph .tape-shell { fill: #2b2722; stroke: #211f1c; stroke-width: 1; }
  .tape-glyph .tape-label { fill: #efe7d4; }
  .tape-glyph .tape-reel  { fill: none; stroke: #efe7d4; stroke-width: 1.1; }
  .chall-tapes.t1 .tape-shell { fill: #4f7a45; stroke: #38602f; }
  .chall-tapes.t2 .tape-shell { fill: #cd8a2c; stroke: #9c6418; }
  .chall-tapes.t3 .tape-shell { fill: #b23a3a; stroke: #872a2a; }

  /* difficulty groups in the list */
  .chall-group + .chall-group { margin-top: 14px; }
  .chall-group-head {
    display: flex; align-items: center; gap: 8px;
    padding: 0 4px 5px; margin-bottom: 4px;
    border-bottom: 1px dashed #c7ba9b;
  }
  .chall-group-label {
    font-family: var(--type); font-size: 10px; letter-spacing: 1.6px;
    text-transform: uppercase; color: var(--ink-soft);
  }
  .chall-group-count {
    margin-left: auto; font-family: var(--type); font-size: 10px; color: #b3a584;
  }
  .chall-item.is-locked .chall-item-name { color: var(--ink-soft); }
  .chall-item.is-locked .chall-item-num { color: #c7bfac; }
  .chall-item.is-locked .chall-item-mark { color: #c4bca9; }
  .chall-tally {
    font-family: var(--type); font-size: 10px; letter-spacing: 0.6px; color: var(--ink-soft);
    text-align: center; margin-top: 10px; padding-top: 9px; border-top: 1px dashed #c7ba9b;
  }

  /* ---- right: the selected challenge ---- */
  .chall-detail { padding-left: 22px; min-width: 0; }
  .chall-detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
  .chall-detail-charm { color: var(--ink); display: flex; }
  .chall-detail-charm .charm { display: block; width: 30px; height: 30px; }
  .chall-detail-charm .charm svg { width: 100%; height: 100%; overflow: visible; }
  .chall-detail-charm .ink { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .chall-detail-charm .ink-fill { fill: #e0a32f; stroke: var(--ink); stroke-width: 1.2; }
  .chall-detail-name { font-family: var(--hand); font-weight: 700; font-size: 32px; line-height: 1; color: var(--ink); }
  .chall-detail-star { display: flex; }
  .chall-star-svg { width: 18px; height: 18px; display: block; }
  .chall-detail-stamp {
    font-family: var(--type); font-weight: 700; font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
    color: rgba(178,58,58,0.82); border: 2px double rgba(178,58,58,0.6); border-radius: 3px;
    padding: 2px 7px; transform: rotate(-4deg);
  }
  .chall-diff { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
  .chall-diff .chall-eyebrow { margin-bottom: 0; }
  .chall-diff .tape-glyph { width: 22px; height: 15px; }
  .chall-diff-word { font-family: var(--hand); font-weight: 700; font-size: 18px; color: var(--ink-soft); }
  .chall-sec { margin-bottom: 14px; }
  .chall-sec--beat { border-top: 1px dashed #c7ba9b; padding-top: 11px; }
  .chall-eyebrow { font-family: var(--type); font-size: 9.5px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 5px; }
  .chall-rule { font-family: var(--hand); font-size: 21px; line-height: 1.25; color: var(--ink); }
  .chall-goal { font-family: var(--hand); font-size: 22px; line-height: 1.2; color: var(--ink); margin-bottom: 4px; }
  .chall-mods { font-family: var(--type); font-size: 12px; line-height: 1.45; color: #5a5042; }
  .chall-act { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; }
  .chall-meta { font-family: var(--type); font-size: 10px; color: var(--ink-soft); flex: 1; }
  .chall-need {
    font-family: var(--type); font-size: 11px; color: #5a5042; text-align: center;
    border: 1px dashed #b3a584; border-radius: 1px; padding: 9px 18px; background: rgba(236,227,208,0.5);
  }

  /* primary action — the gold "Start writing" sticker, reused */
  .chall-go {
    font-family: var(--type); font-size: 15px; letter-spacing: 1px; font-weight: 700;
    color: var(--ink); background-color: #efb73e;
    background-image: linear-gradient(168deg, rgba(255,255,255,0.34) 0%, rgba(255,255,255,0) 46%, rgba(43,39,34,0.12) 100%);
    border: 2px solid var(--ink); border-radius: 2px;
    box-shadow: 3px 3px 0 rgba(43,39,34,0.22); transform: rotate(-0.6deg);
    padding: 11px 28px; cursor: pointer; white-space: nowrap;
    transition: background-color 0.24s ease, color 0.2s ease, transform 0.12s, box-shadow 0.2s;
  }
  .chall-go::before { content: "\270E"; margin-right: 9px; font-size: 17px; vertical-align: -1px; }
  .chall-go.is-unlock { background-color: #cfdfea; }
  .chall-go.is-unlock::before { content: none; margin-right: 0; }
  .chall-go:hover, .chall-go:focus-visible { background-color: var(--ink); color: var(--paper); }
  .chall-go:active { transform: rotate(-0.6deg) translateY(1px); box-shadow: 1px 1px 0 rgba(43,39,34,0.22); }

  @media (max-width: 620px) {
    .chall-layout { grid-template-columns: 1fr; }
    .chall-list { padding-right: 0; border-right: none; border-bottom: 1px solid rgba(60,40,18,0.16); padding-bottom: 8px; margin-bottom: 14px; }
    .chall-detail { padding-left: 0; }
  }
  @media (prefers-reduced-motion: reduce) {
    .chall-tokens, .chall-go { transform: none; }
    .chall-go:active { transform: translateY(1px); }
  }

  /* Challenge results panel (sandboxed — in place of the records board) */
  .chall-result-status { font-family: var(--hand); font-weight: 700; font-size: 22px; color: var(--ink-soft); margin-bottom: 4px; }
  .chall-result-status.win { color: #2b2722; }
  .chall-result-token { font-family: var(--type); font-size: 13px; color: #2b2722; margin-bottom: 4px; }
  .chall-result-meta { font-family: var(--type); font-size: 11px; color: var(--ink-soft); margin-bottom: 12px; }
  #backToChallenges { width: auto; margin: 0 auto; padding: 5px 18px; }

  /* ---------- Album Focus page — borrows the master/detail .chall-* layout ----------
     The album rows extend .chall-item with a colour dot + best score; the status mark
     scales with how hard the album was beaten (af-mark--perfect/beaten/played/none). */
  .af-item { grid-template-columns: 16px 1fr auto 22px; }
  .af-item-dot { width: 13px; height: 13px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(43,39,34,0.25); }
  .af-item-best { font-family: var(--type); font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
  .af-item.selected .af-item-best { color: #1f3a52; }
  .af-item.is-fresh .chall-item-name { color: var(--ink-soft); }
  .af-mark { display: flex; justify-content: center; align-items: center; }
  .af-mark--none { font-family: var(--type); font-size: 13px; color: #c4bca9; }
  .af-mark .chall-mark-svg, .af-mark .chall-star-svg { width: 19px; height: 19px; }
  /* a beaten-on-Hard tick reads a touch bolder/gold; the data-diff hook lets the tier scale */
  .af-mark--beaten[data-diff="hard"] .chall-mark-svg circle,
  .af-mark--beaten[data-diff="hard"] .chall-mark-svg path { stroke: #c8901c; }
  .af-mark--perfect .chall-star-svg { filter: drop-shadow(0 1px 1px rgba(176,130,31,0.5)); }

  .af-detail-spine { width: 7px; align-self: stretch; min-height: 30px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(43,39,34,0.2); }
  .af-stamp { color: rgba(60,90,70,0.85); border-color: rgba(60,90,70,0.55); }
  .af-diffs { display: flex; gap: 8px; margin-top: 10px; }
  .af-diff {
    font-family: var(--type); font-size: 12px; font-weight: 700; color: var(--ink-soft);
    background: rgba(236,227,208,0.5); border: 1.5px solid #c7ba9b; border-radius: 2px;
    padding: 6px 14px; cursor: pointer; transition: background 0.14s, color 0.14s, border-color 0.14s;
  }
  .af-diff:hover { background: rgba(43,39,34,0.06); }
  .af-diff.is-on { color: var(--paper); background: var(--ink); border-color: var(--ink); }
  #backToAlbumFocus { width: auto; margin: 0 auto; padding: 5px 18px; }

  /* Choose Your Path — mid-run perk fork. The overlay covers the answered page
     (the card is position:relative — see .quit-btn) until a perk is chosen. */
  .chall-path-overlay {
    position: absolute; inset: 0; z-index: 60;
    display: flex; align-items: center; justify-content: center;
    background: rgba(245, 239, 225, 0.9); animation: cpo-in 0.25s ease both;
  }
  @keyframes cpo-in { from { opacity: 0; } to { opacity: 1; } }
  .chall-path-panel { text-align: center; max-width: 460px; padding: 0 16px; }
  .chall-path-title { font-family: var(--hand); font-weight: 700; font-size: 30px; color: var(--ink); margin: 0 0 2px; }
  .chall-path-sub { font-family: var(--type); font-size: 12px; color: var(--ink-soft); margin: 0 0 18px; }
  .chall-path-cards { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
  .chall-path-card {
    flex: 1 1 0; min-width: 150px; max-width: 200px; cursor: pointer; text-align: center;
    background: var(--paper); border: 1.5px solid var(--ink-soft); border-radius: 4px;
    padding: 16px 14px; display: flex; flex-direction: column; align-items: center; gap: 6px;
    box-shadow: 2px 3px 0 rgba(43, 39, 34, 0.16); transition: transform 0.12s ease, box-shadow 0.12s ease;
  }
  .chall-path-card:hover { transform: translateY(-2px); box-shadow: 3px 5px 0 rgba(43, 39, 34, 0.22); }
  .cpc-icon { font-family: var(--type); font-weight: 700; font-size: 20px; color: #b23a3a; }
  .cpc-name { font-family: var(--hand); font-weight: 700; font-size: 19px; color: var(--ink); }
  .cpc-desc { font-family: var(--type); font-size: 11px; line-height: 1.35; color: var(--ink-soft); }
  .path-skip-btn {
    display: block; margin: 8px auto 0; cursor: pointer;
    font-family: var(--type); font-size: 12px; letter-spacing: 0.4px;
    color: var(--ink-soft); background: transparent; border: 1px dashed var(--ink-soft);
    border-radius: 3px; padding: 3px 10px;
  }
  .path-skip-btn:hover { color: var(--ink); border-color: var(--ink); }
  /* Devil's Path — the same fork overlay, but every choice is a curse: a darker,
     red-tinted wash so a fork visibly reads as a threat, not a treat. */
  .chall-path-overlay.is-devil { background: rgba(58, 30, 28, 0.93); }
  .chall-path-overlay.is-devil .chall-path-title { color: #f3e9da; }
  .chall-path-overlay.is-devil .chall-path-sub { color: #d9a59b; }
  .chall-path-overlay.is-devil .chall-path-card {
    background: #2c1f1c; border-color: #8a3a32;
    box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.35);
  }
  .chall-path-overlay.is-devil .chall-path-card:hover { box-shadow: 3px 5px 0 rgba(0, 0, 0, 0.45); }
  .chall-path-overlay.is-devil .cpc-icon { color: #e2725b; }
  .chall-path-overlay.is-devil .cpc-name { color: #f3e9da; }
  .chall-path-overlay.is-devil .cpc-desc { color: #c9a59c; }
  @media (prefers-reduced-motion: reduce) {
    .chall-path-overlay { animation: none; }
    .chall-path-card { transition: none; }
    .chall-path-card:hover { transform: none; }
  }

  /* Wildcard — the per-round rule banner above the prompt word */
  .chall-banner {
    text-align: center; margin: 2px 0 6px; font-family: var(--type);
    font-size: 12px; letter-spacing: 0.4px; color: var(--ink-soft);
  }
  .chall-banner-tag {
    font-weight: 700; text-transform: uppercase; font-size: 10px; letter-spacing: 1px;
    color: #b23a3a; border: 1px solid rgba(178, 58, 58, 0.5); border-radius: 3px;
    padding: 1px 5px; margin-right: 6px;
  }
  /* Deep Cut live album tally + One Of A Kind target name share the banner row */
  .chall-prog-name { font-weight: 700; }
  .chall-pips { display: inline-flex; gap: 4px; margin: 0 8px; vertical-align: middle; }
  .chall-pip {
    width: 9px; height: 9px; border-radius: 50%;
    border: 1.5px solid rgba(43, 39, 34, 0.35); background: transparent;
    transition: background 0.2s ease, border-color 0.2s ease;
  }
  /* One Of A Kind — a remaining guess (drains to a hollow pip as guesses are spent) */
  .chall-pip.filled { background: #b23a3a; border-color: #b23a3a; }
  .chall-prog-count { font-variant-numeric: tabular-nums; opacity: 0.8; }
  /* When the count sits directly after the name (no pips between — Shrinking Timer,
     Wrapped Like A Chain, On Tour!, It's A Clock!), keep them from butting together. */
  .chall-prog-name + .chall-prog-count { margin-left: 8px; }

  /* Challenge curtain — the full-screen reveal that precedes a round's word: Wildcard's
     per-round rule, One Of A Kind's target song, Choose Your Path's run intro. A paper
     curtain over the game card (position:relative). Opaque from frame one (no fade-in) so
     the round beneath is never glimpsed — only the card's own contents animate in; holds,
     then lifts away. */
  .chall-curtain {
    position: absolute; inset: 0; z-index: 70;
    display: flex; align-items: center; justify-content: center;
    /* the notebook page itself — red margin rule + horizontal rulings, matching .card —
       so the intro card floats on real ruled paper instead of a flat fill */
    background-color: var(--paper);
    background-image:
      linear-gradient(to right, transparent var(--rule-x, 44px), rgba(178, 58, 58, 0.38) var(--rule-x, 44px), rgba(178, 58, 58, 0.38) calc(var(--rule-x, 44px) + 2px), transparent calc(var(--rule-x, 44px) + 2px)),
      repeating-linear-gradient(to bottom, var(--paper) 0, var(--paper) calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px), var(--rule) var(--line));
    cursor: pointer;
  }
  .chall-curtain.leaving { animation: curtain-out 0.34s ease both; }
  @keyframes curtain-out { from { opacity: 1; } to { opacity: 0; } }
  .chall-curtain-card {
    position: relative; text-align: center; max-width: 460px;
    padding: 26px 30px 24px 38px;
    background: var(--paper); border: 1px solid rgba(43, 39, 34, 0.18);
    border-radius: 4px; box-shadow: 3px 5px 0 rgba(43, 39, 34, 0.14);
    animation: curtain-card-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  }
  /* the notebook's red margin rule down the left edge of the card */
  .chall-curtain-card::before {
    content: ""; position: absolute; top: 8px; bottom: 8px; left: 22px;
    border-left: 1.5px solid rgba(178, 58, 58, 0.55);
  }
  .leaving .chall-curtain-card { animation: curtain-card-out 0.3s ease both; }
  @keyframes curtain-card-in {
    from { opacity: 0; transform: translateY(14px) rotate(-1.2deg) scale(0.97); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes curtain-card-out {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateY(-12px) scale(0.98); }
  }
  .chall-curtain-kicker {
    font-family: var(--type); font-size: 10px; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--ink-soft); margin-bottom: 12px;
  }
  .chall-curtain-tag {
    display: block; width: fit-content; margin: 0 auto 12px;
    font-family: var(--type); font-weight: 700;
    text-transform: uppercase; font-size: 10px; letter-spacing: 1.5px;
    color: #b23a3a; border: 1px solid rgba(178, 58, 58, 0.5); border-radius: 3px;
    padding: 2px 8px;
  }
  .chall-curtain-rule {
    position: relative; display: inline-block;
    font-family: var(--hand); font-weight: 700; line-height: 1.1;
    font-size: clamp(28px, 7vw, 42px); color: var(--ink);
    padding-bottom: 6px;
  }
  /* a hand-drawn pen underline that sweeps in under the headline */
  .chall-curtain-rule::after {
    content: ""; position: absolute; left: -2px; right: -2px; bottom: -1px;
    height: 2px; background: var(--ink-accent, #b23a3a); border-radius: 2px;
    transform: scaleX(0); transform-origin: left center;
    animation: curtain-underline 0.5s ease 0.34s both;
  }
  @keyframes curtain-underline { to { transform: scaleX(1); } }
  /* optional supporting line under the headline (album / how-it-works) */
  .chall-curtain-sub {
    font-family: var(--type); font-size: 12.5px; line-height: 1.5;
    color: var(--ink-soft); max-width: 340px; margin: 14px auto 0;
  }
  /* The "to beat it" win condition under a challenge's round-1 intro. */
  .chall-curtain-win {
    display: inline-block; margin-top: 9px; font-style: italic;
    color: var(--ink); opacity: 0.82;
  }
  .chall-curtain-cue {
    font-family: var(--type); font-size: 12px; color: var(--ink-soft);
    margin-top: 16px; animation: curtain-cue 1.4s ease-in-out 0.6s infinite;
  }
  @keyframes curtain-cue { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.9; } }
  .chall-curtain-next {
    margin-top: 20px;
    font-family: var(--type); font-size: 14px; letter-spacing: 1px; font-weight: 700;
    color: var(--ink); background-color: #efb73e;
    background-image: linear-gradient(168deg, rgba(255,255,255,0.34) 0%, rgba(255,255,255,0) 46%, rgba(43,39,34,0.12) 100%);
    border: 2px solid var(--ink); border-radius: 2px;
    box-shadow: 3px 3px 0 rgba(43,39,34,0.22); transform: rotate(-0.6deg);
    padding: 10px 26px; cursor: pointer; white-space: nowrap;
    transition: background-color 0.24s ease, color 0.2s ease, transform 0.12s, box-shadow 0.2s;
  }
  .chall-curtain-next:hover, .chall-curtain-next:focus-visible { background-color: var(--ink); color: var(--paper); }
  .chall-curtain-next:active { transform: rotate(-0.6deg) translateY(1px); box-shadow: 1px 1px 0 rgba(43,39,34,0.22); }
  @media (prefers-reduced-motion: reduce) {
    .chall-curtain, .chall-curtain.leaving,
    .chall-curtain-card, .leaving .chall-curtain-card,
    .chall-curtain-rule::after, .chall-curtain-cue { animation: none; }
    .chall-curtain-rule::after { transform: scaleX(1); }
    .chall-curtain-next { transform: none; }
    .chall-curtain-next:active { transform: translateY(1px); }
  }

  /* Vanishing Word challenge — the prompt word fades out of view after a beat
     (still in state, so matching is unaffected). */
  .word-wrap.vanished #wordDisplay {
    color: transparent !important; -webkit-text-fill-color: transparent !important;
    transition: color 0.45s ease, -webkit-text-fill-color 0.45s ease;
  }
  .word-wrap.vanished #wordDisplay::after {
    content: "·  ·  ·"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    white-space: nowrap;   /* the three dots always sit on a single line, never wrapping */
    color: var(--ink-soft); -webkit-text-fill-color: var(--ink-soft); opacity: 0.55; letter-spacing: 2px;
  }
  @media (prefers-reduced-motion: reduce) { .word-wrap.vanished #wordDisplay { transition: none; } }

  /* Revolving Door challenge — each time the word swaps mid-round it spins in (a quick
     half-turn + fade), so the change reads as the door revolving. Motion-safe; the class
     is only added when motion is allowed. */
  .word-wrap.revolve-in #wordDisplay { animation: revolve-swap 0.4s cubic-bezier(0.22, 0.7, 0.3, 1) both; transform-origin: 50% 50%; }
  @keyframes revolve-swap {
    0%   { opacity: 0; transform: rotateY(-82deg) translateX(10px); }
    55%  { opacity: 1; }
    100% { opacity: 1; transform: rotateY(0deg) translateX(0); }
  }

  /* Word Games challenge — the prompt word is distorted (display only; matching reads
     state). Letters render as inline spans so each can tilt at the wobble tier. */
  .word-wrap[data-fx] #wordDisplay .fx-ch { display: inline-block; transform: rotate(var(--fx-rot, 0deg)); }
  .word-wrap[data-fx="2"] #wordDisplay .fx-ch,
  .word-wrap[data-fx="4"] #wordDisplay .fx-ch { letter-spacing: 0.5px; }
  @media (prefers-reduced-motion: no-preference) {
    .word-wrap[data-fx="4"] #wordDisplay .fx-ch { animation: fx-wobble 1.6s ease-in-out infinite; }
    @keyframes fx-wobble {
      0%, 100% { transform: rotate(var(--fx-rot, 0deg)); }
      50%      { transform: rotate(calc(var(--fx-rot, 0deg) * -1)) translateY(-1px); }
    }
  }

  /* Charm → token conversion (the escape valve) */
  .ach-page-tickets { font-family: var(--type); font-size: 10px; letter-spacing: 0.5px; color: #2b2722; margin-top: 4px; }
  .ach-trade-note { color: rgba(43,39,34,0.6); }
  .ach-sacrifice-note {
    font-family: var(--type); font-size: 10px; letter-spacing: 0.4px; color: #b23a3a;
    margin-top: 5px; font-weight: 600;
  }
  .ach--earned { position: relative; }
  .ach-ticket { position: absolute; top: 6px; right: 7px; font-size: 13px; line-height: 1; }
  .ach-cashin {
    position: absolute; top: 5px; right: 6px;
    font-family: var(--type); font-size: 9px; letter-spacing: 0.3px; white-space: nowrap;
    padding: 2px 6px; border-radius: 3px; cursor: pointer;
    border: 1px solid rgba(43,39,34,0.5); background: rgba(43,39,34,0.06); color: #2b2722;
    opacity: 0; transition: opacity 0.15s;
  }
  .ach--earned:hover .ach-cashin, .ach-cashin:focus-visible { opacity: 1; }
  .ach-cashin:hover { background: #2b2722; color: #fff; border-color: #2b2722; }
  /* armed (second-tap confirms): always shown, red, can't be missed */
  .ach-cashin.is-armed { opacity: 1; background: #b23a3a; color: #fff; border-color: #b23a3a; }
  @media (hover: none) { .ach-cashin { opacity: 1; } }

  /* a sacrificed charm — faded, struck through, given up for good */
  .ach--given { opacity: 0.5; filter: grayscale(0.85); position: relative; }
  .ach--given .ach-nm { text-decoration: line-through; text-decoration-color: rgba(43,39,34,0.5); }
  .ach--given .ach-dc { color: #b23a3a; }

  .hist-head, .hist-row {
    display: grid; grid-template-columns: 1fr 0.8fr 0.8fr 1.9fr 1.3fr;
    align-items: baseline; gap: 10px;
  }
  .hist-head > span, .hist-row > span { min-width: 0; }
  .hist-head {
    font-family: var(--type); font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
    color: var(--ink-soft); padding: 0 7px 6px; border-bottom: 1px solid rgba(43,39,34,0.12);
  }
  .hist-rows { margin-top: 2px; }
  .hist-row { padding: 7px; border-bottom: 1px solid rgba(43,39,34,0.07); }
  .hist-row.hist-pb { background: var(--highlighter); border-radius: 4px; border-bottom-color: transparent; }
  .hist-score { font-family: var(--hand); font-size: 22px; color: var(--ink); line-height: 1; }
  .hist-unit { font-family: var(--type); font-size: 11px; color: var(--ink-soft); }
  .hist-time { font-family: var(--type); font-size: 13px; color: var(--ink-soft); }
  .hist-verse { font-family: var(--type); font-size: 13px; color: var(--ink-soft); }
  .hist-verse-star { color: #e0a32f; margin-right: 2px; }
  .hist-mode, .hist-date { font-family: var(--type); font-size: 11px; color: var(--ink-soft); }
  /* PB crown — the same SVG as the achievement charm, sized to sit on the score baseline. */
  .hist-crown { display: inline-block; width: 15px; height: 15px; margin-right: 4px; vertical-align: -2px; }
  .hist-crown svg { width: 100%; height: 100%; display: block; overflow: visible; }
  .hist-crown .ink { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .hist-crown .ink-fill { fill: var(--ink); stroke: none; }
  #histMore { margin-top: 12px; }

  /* ---------- Records calendar heatmap (games played per day / per hour) ----------
     A contribution-grid in the notebook's gold "ink density". The grid spans the full
     content width: columns are 1fr (so they fill exactly, no right-edge remainder) and
     JS sets the row heights in px to keep the squares square; the day-label column
     shares those exact row heights so the labels line up with the rows. */
  .heat-wrap { margin-bottom: 4px; }
  .heat-controls {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap; margin-bottom: 14px;
  }
  /* timeframe dropdown — typewriter-styled; the right padding reserves room for the
     native arrow so the longest label ("last 7 days · by hour") never sits under it. */
  .heat-select {
    font-family: var(--type); font-size: 12px; color: var(--ink);
    background: var(--page-wash, #efe7d2);
    border: 1.5px solid var(--ink-soft); border-radius: 2px;
    padding: 6px 32px 6px 12px; outline: none; cursor: pointer; line-height: 1.2;
  }
  .heat-select:focus { border-color: var(--ink-accent); }
  .heat-legend { display: flex; align-items: center; gap: 6px; font-family: var(--type); font-size: 10px; letter-spacing: 1px; color: var(--ink-soft); }
  .heat-legend i { width: 11px; height: 11px; border-radius: 2px; border: 0.5px solid rgba(43,39,34,0.14); }

  .heat-row { display: flex; align-items: flex-start; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
  .heat-side { display: flex; flex-direction: column; flex: none; }
  .heat-days, .heat-hours {
    display: grid; gap: 3px; font-family: var(--type); font-size: 9px; color: var(--ink-soft);
  }
  .heat-days span, .heat-hours span { align-self: center; line-height: 1; white-space: nowrap; padding-right: 4px; }
  .heat-main { flex: 1; min-width: 0; }
  .heat-months, .heat-cols { font-family: var(--type); font-size: 9px; letter-spacing: 0.5px; color: var(--ink-soft); }
  .heat-months { position: relative; }
  .heat-months span { position: absolute; top: 0; white-space: nowrap; }
  .heat-cols { display: grid; }
  .heat-cols span { text-align: center; line-height: 16px; }
  .heat-grid { display: grid; gap: 3px; width: 100%; }
  .heat-cell { border-radius: 2px; }
  /* 30-day strip: one full-width row of days, with start/end date captions for orientation */
  .heat-strip { width: 100%; }
  .heat-strip-ends {
    display: flex; justify-content: space-between;
    font-family: var(--type); font-size: 9px; color: var(--ink-soft); margin-top: 5px;
  }
  .heat-foot { font-family: var(--hand); font-size: 18px; color: var(--ink-soft); margin-top: 12px; transform: rotate(-0.4deg); }
  .heat-foot b { color: var(--ink-accent); font-weight: 700; }

  /* ---------- Bracelet (round progress + score) ---------- */
  .bracelet-wrap { margin-bottom: 26px; }
  .bracelet-meta {
    display: flex; justify-content: space-between; align-items: center;
    font-family: var(--type); font-size: 12px; color: var(--ink-soft);
    margin-bottom: 8px; letter-spacing: 0.5px;
  }
  .bracelet-meta .charms { color: var(--ink-accent); font-weight: 700; }
  .bracelet { position: relative; padding: 4px 0 2px; }
  .bracelet svg { width: 100%; height: auto; display: block; overflow: visible; }

  /* SVG bracelet parts (colours flow from the era tokens) */
  .b-thread { fill: none; stroke: var(--ink-soft); stroke-linecap: round; }
  .b-knot { fill: none; stroke: var(--ink-soft); stroke-linecap: round; }
  .b-seed { fill: var(--bead); opacity: 0.45; }
  .b-future { fill: var(--paper); stroke: var(--ink-soft); opacity: 0.5; }
  .b-letter { fill: #fffdf6; stroke: var(--ink-soft); }
  .b-letter-text { fill: var(--ink-soft); font-family: "Courier Prime", "Courier New", monospace; font-weight: 700; }
  .b-miss { fill: var(--paper-edge); stroke: var(--ink-soft); }
  .b-miss-dot { fill: var(--ink-soft); opacity: 0.7; }
  .b-bead { fill: var(--bead); stroke: var(--ink); }
  .b-gloss { fill: #fff; opacity: 0.55; }
  /* pen-nib charm (word-perfect recall): a vent hole punched out + the slit */
  .b-nib-hole { fill: var(--paper); }
  .b-nib-slit { fill: none; stroke: var(--ink); opacity: 0.7; stroke-linecap: round; }
  /* the "H" stamped on a charm whose round used a hint */
  .b-hint-h { fill: #fffdf6; font-family: "Courier Prime", "Courier New", monospace; font-weight: 700; pointer-events: none; }

  .b-halo {
    fill: none; stroke: var(--bead);
    transform-box: fill-box; transform-origin: center;
    animation: halo 1.8s ease-out infinite;
  }
  @keyframes halo {
    0%   { transform: scale(0.8); opacity: 0.45; }
    70%  { transform: scale(1.55); opacity: 0; }
    100% { transform: scale(1.55); opacity: 0; }
  }

  /* charms dangle from the thread and sway gently; a fresh one swings in */
  .charm-dangle { transform-box: fill-box; transform-origin: 50% 0%; animation: sway 5.5s ease-in-out infinite; }
  .charm-dangle.fresh { animation: swingIn 1.4s cubic-bezier(.34,1.56,.64,1), sway 5.5s ease-in-out 1.4s infinite; }
  @keyframes sway {
    0%, 100% { transform: rotate(2.4deg); }
    50%      { transform: rotate(-2.4deg); }
  }
  @keyframes swingIn {
    0%   { transform: rotate(26deg); }
    40%  { transform: rotate(-14deg); }
    70%  { transform: rotate(7deg); }
    100% { transform: rotate(0deg); }
  }

  .bracelet-finished { max-width: 440px; margin: 0 auto 10px; }
  .bracelet-caption {
    text-align: center; font-family: var(--hand); font-size: 19px;
    color: var(--ink-soft); margin: 14px 0 0;
  }

  /* ---------- Results anthology — lines you wrote from memory (pressed-flower keepsake) ---------- */
  .verse-anthology {
    margin: 20px auto 4px; max-width: 30rem;
    border-top: 1px solid rgba(43,39,34,0.12);
    border-bottom: 1px solid rgba(43,39,34,0.12);
    padding: 12px 4px 14px;
  }
  .va-caption {
    text-align: center; font-family: var(--type); font-size: 10px;
    letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 10px;
  }
  .va-list { list-style: none; margin: 0; padding: 0; }
  .va-row {
    display: flex; align-items: baseline; gap: 9px; padding: 4px 0;
    font-family: var(--hand); font-size: 19px; line-height: 1.3; color: rgba(43,39,34,0.7);
  }
  .va-row + .va-row { border-top: 1px dotted rgba(43,39,34,0.1); }
  .va-mark { flex: none; color: var(--bead); font-size: 13px; letter-spacing: -1px; }
  .va-text { font-style: italic; }
  .va-text mark { background: var(--highlighter); color: var(--ink); padding: 0 2px; font-weight: 700; }

  /* ---------- Word + highlighter ---------- */
  .word-label {
    font-family: var(--type); font-size: 12px; letter-spacing: 1px;
    color: var(--ink-soft); margin-bottom: 6px; transform: rotate(-0.5deg);
  }
  .word-wrap { position: relative; text-align: center; margin: 6px 0 14px; animation: tremor 0.15s linear infinite; }
  /* amplitude scales with --tension, so it's perfectly still until time runs low */
  @keyframes tremor {
    0%   { transform: translate(calc(var(--tension) * -1.1px), calc(var(--tension) *  0.5px)); }
    25%  { transform: translate(calc(var(--tension) *  1.3px), calc(var(--tension) * -0.9px)); }
    50%  { transform: translate(calc(var(--tension) * -0.7px), calc(var(--tension) *  1.1px)); }
    75%  { transform: translate(calc(var(--tension) *  1.0px), calc(var(--tension) *  0.6px)); }
    100% { transform: translate(calc(var(--tension) * -1.1px), calc(var(--tension) *  0.5px)); }
  }
  .word {
    display: inline-block; position: relative;
    font-family: var(--hand); font-weight: 700;
    font-size: clamp(50px, 12vw, 80px); line-height: 1.05;
    color: var(--ink); padding: 0 10px;
    transform: rotate(-1.2deg);
  }
  /* highlighter swipe behind the word — its weight scales with --rarity
     (set per round from the word's answer count), so rarer words get a bolder,
     more saturated swipe while the hue stays era-driven. */
  .word::before {
    content: ""; position: absolute; z-index: -1;
    left: -2px; right: -2px;
    top: calc(38% - var(--rarity, 0) * 9%); bottom: 8%;
    background: var(--highlighter);
    opacity: calc(0.7 + var(--rarity, 0) * 0.3);
    transform: rotate(-1.6deg) skewX(-6deg);
    border-radius: 40% 55% 45% 50% / 60% 50% 55% 45%;
    transition: background 0.4s ease, opacity 0.4s ease, top 0.4s ease;
  }

  /* rubber-stamp rarity badge — a faded, rotated ink stamp pressed onto the
     page for notable (non-common) words. Colour deepens with rarity; common
     words show no stamp. mix-blend multiply lets the paper grain read through. */
  .rarity-stamp {
    position: absolute; top: -14px; right: 6%; z-index: 2;
    font-family: var(--type); font-weight: 700; font-size: 14px;
    letter-spacing: 2px; text-transform: uppercase; white-space: nowrap;
    padding: 3px 9px; border: 2px solid currentColor; border-radius: 3px;
    color: #6f655a; opacity: 0; pointer-events: none;
    mix-blend-mode: multiply;
    transform: rotate(7deg) scale(1.35);
    box-shadow: inset 0 0 0 1px currentColor;
  }
  .word-wrap[data-rarity="rare"]     .rarity-stamp { color: #b0512f; }
  .word-wrap[data-rarity="scarce"]   .rarity-stamp { color: #9e2b2b; }
  .word-wrap[data-rarity="singular"] .rarity-stamp { color: #7a1d1d; }
  .rarity-stamp.show { animation: stamp-in 0.45s cubic-bezier(.2,1.4,.4,1) forwards; }
  @keyframes stamp-in {
    0%   { opacity: 0;    transform: rotate(7deg) scale(1.6); }
    60%  { opacity: 0.7;  transform: rotate(7deg) scale(0.92); }
    100% { opacity: 0.58; transform: rotate(7deg) scale(1); }
  }

  /* ---------- Off-limits note (Hard/Ultra "not in the title" rule) ---------- */
  /* soft red-tinted pills — one per song whose title holds the prompt word */
  .excluded-note {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
    gap: 8px; margin: 16px auto 2px; max-width: 360px;
  }
  .excluded-note .ex-lead {
    flex-basis: 100%; text-align: center; margin-bottom: 2px;
    font-family: var(--type); font-size: 10.5px; letter-spacing: 0.5px;
    color: #9b2226; text-transform: uppercase;
  }
  .excluded-note .ex-title {
    font-family: var(--hand); font-weight: 700; font-size: 18px; line-height: 1;
    color: #9b2226; background: rgba(178,58,58,0.12);
    padding: 3px 12px; border-radius: 13px; white-space: nowrap;
  }
  .excluded-note .ex-more {
    font-family: var(--type); font-size: 11px; color: var(--ink-soft);
  }

  /* ---------- Timer (draining highlighter underline) ---------- */
  .timer-wrap { max-width: 320px; margin: 0 auto 30px; position: relative; }
  /* A flourish canvas riding above the bar: era-tinted sparks crackle off the
     draining edge like a lit fuse. Decorative only (pointer-events:none); it
     overlaps into the gap above the bar so sparks can rise. */
  .timer-spark {
    position: absolute; left: 0; top: -44px; width: 100%; height: 54px;
    pointer-events: none;
  }
  .timer-track {
    height: 8px; background: rgba(43,39,34,0.08); border-radius: 6px; overflow: hidden;
  }
  .timer-fill {
    height: 100%; width: 100%; border-radius: 6px;
    background: var(--bead);
    transition: width 0.1s linear, background 0.3s;
  }
  .timer-fill.low { background: var(--margin); }
  .timer-label {
    text-align: center; margin-top: 7px;
    font-family: var(--type); font-size: 12px; color: var(--ink-soft);
  }

  /* ---------- Input + dropdown ---------- */
  .input-area { position: relative; }
  /* a pencil resting at the start of the line you write on */
  .input-area::before {
    content: "\270E"; position: absolute; left: 1px; bottom: 9px;
    font-size: 17px; color: var(--ink-soft); pointer-events: none; z-index: 1;
    transform: rotate(8deg);
  }
  #songInput {
    width: 100%; padding: 10px 4px 10px 26px;
    font-family: var(--type); font-size: 17px;
    border: none; border-bottom: 2px solid var(--ink); border-radius: 0;
    background: transparent; color: var(--ink); outline: none;
    caret-color: var(--ink-accent);
  }
  #songInput::placeholder { color: var(--ink-soft); font-style: italic; }
  #songInput:focus { box-shadow: inset 0 -2px 0 var(--ink-accent); }
  .dropdown {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px);
    z-index: 100; display: none;
    background: var(--paper); border-radius: 3px; padding: 2px;
  }
  .dropdown.show { display: block; }
  .dropdown .item {
    position: relative;
    padding: 11px 14px; cursor: pointer;
    font-family: var(--type); font-size: 14px; color: var(--ink);
    background: var(--paper-edge);
    border: 1.5px solid var(--ink-soft); border-radius: 2px;
    margin: 9px 4px 6px; box-shadow: 2px 2px 0 rgba(43,39,34,0.12);
    transform: rotate(-0.4deg);
    transition: transform 0.12s, background 0.12s, box-shadow 0.12s;
  }
  /* a strip of washi tape pinning each card to the page (shared realistic surface) */
  .dropdown .item::before {
    content: ""; position: absolute; top: -7px; left: 50%;
    width: 32px; height: 14px; transform: translateX(-50%) rotate(-4deg);
    --tape-color: #e0c478;
  }
  .dropdown .item:nth-child(even) { transform: rotate(0.5deg); }
  .dropdown .item:nth-child(even)::before { transform: translateX(-50%) rotate(5deg); }
  .dropdown .item:nth-child(3n) { transform: rotate(-0.9deg); }
  .dropdown .item:last-child { margin-bottom: 4px; }
  .dropdown .item.active, .dropdown .item:hover {
    /* translucent highlighter composited over opaque paper so text can't bleed through */
    background: linear-gradient(var(--highlighter), var(--highlighter)), var(--paper-edge);
    transform: rotate(0deg) translateY(-2px) scale(1.015);
    box-shadow: 3px 5px 0 rgba(43,39,34,0.16); z-index: 2;
  }

  /* greyed-out off-limits entries in the dropdown (Normal mode) — still clickable,
     but selecting one triggers the reject-flash rather than scoring it. */
  .dropdown .item.off-limits {
    opacity: 0.55; color: var(--ink-soft);
    text-decoration: line-through; text-decoration-color: rgba(178,58,58,0.55);
  }
  .dropdown .item.off-limits .dd-tag {
    display: inline-block; margin-left: 8px; vertical-align: 1px;
    font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase;
    color: #9b2226; text-decoration: none;
  }
  .dropdown .item.off-limits.active, .dropdown .item.off-limits:hover {
    background: linear-gradient(rgba(178,58,58,0.10), rgba(178,58,58,0.10)), var(--paper-edge);
  }

  /* red reject-flash — pops above the input when a blocked title is picked, then
     fades. The input gets a matching red underline pulse. */
  .reject-flash {
    position: absolute; left: 0; right: 0; bottom: calc(100% + 8px);
    text-align: center; pointer-events: none; z-index: 60;
    font-family: var(--hand); font-size: 18px; color: #9b2226;
    background: rgba(178,58,58,0.12); border: 1.5px solid rgba(178,58,58,0.4);
    border-radius: 13px; padding: 5px 14px;
    opacity: 0; transform: translateY(6px) rotate(-0.5deg);
  }
  .reject-flash b { font-weight: 700; }
  .reject-flash.show { animation: reject-pop 1.7s ease forwards; }
  @keyframes reject-pop {
    0%   { opacity: 0; transform: translateY(6px) rotate(-0.5deg); }
    8%   { opacity: 1; transform: translateY(0) rotate(-0.5deg); }
    12%  { transform: translateY(0) rotate(0.8deg); }
    16%  { transform: translateY(0) rotate(-0.5deg); }
    80%  { opacity: 1; transform: translateY(0) rotate(-0.5deg); }
    100% { opacity: 0; transform: translateY(-4px) rotate(-0.5deg); }
  }
  #songInput.reject-pulse { animation: input-reject 0.5s ease; }
  @keyframes input-reject {
    0%, 100% { box-shadow: inset 0 -2px 0 var(--ink); }
    50%      { box-shadow: inset 0 -3px 0 #b23a3a; }
  }
  body[data-reduce-motion="on"] .reject-flash.show {
    animation: none; opacity: 1; transform: translateY(0) rotate(-0.5deg);
  }
  body[data-reduce-motion="on"] #songInput.reject-pulse { animation: none; }

  .hint {
    text-align: center; font-family: var(--hand); font-size: 17px;
    color: var(--ink-soft); margin-top: 16px;
  }

  /* ---------- Anniversary marginalia (start screen, milestone days only) ---------- */
  .anniversary-note[hidden] { display: none; }
  .anniversary-note {
    font-family: var(--hand); font-size: 18px; line-height: 1.3;
    color: var(--ink-accent); text-align: center;
    max-width: 34ch; margin: 0 auto 14px; padding-top: 2px;
    transform: rotate(-0.6deg); opacity: 0.88;
  }
  .anniversary-note::before {
    content: "✶"; display: block; font-size: 13px; opacity: 0.5;
    margin-bottom: 1px;
  }

  /* ---------- Live verse-bonus gauge (climbs as you write more of the line) ---------- */
  .verse-meter[hidden] { display: none; }
  .verse-meter {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 12px;
  }
  .vm-notch {
    width: 26px; height: 5px; border-radius: 3px;
    background: rgba(43,39,34,0.13); transition: background 0.22s ease;
  }
  .vm-notch.lit { background: var(--bead); }
  .vm-label {
    margin-left: 8px; font-family: var(--hand); font-size: 15px; color: var(--ink-soft);
    white-space: nowrap;
  }

  /* ---------- Quit / give-up (close the notebook) ---------- */
  .quit-btn {
    position: absolute; top: 10px; right: 12px; z-index: 7; cursor: pointer;
    font-family: var(--type); font-size: 10px; letter-spacing: 0.6px; text-transform: uppercase;
    color: var(--ink-soft); background: transparent; border: none;
    padding: 4px 6px; opacity: 0.65; transition: color 0.15s, opacity 0.15s;
  }
  .quit-btn::before { content: "✕ "; }
  .quit-btn:hover { color: var(--ink); opacity: 1; }
  .quit-btn.armed { color: var(--margin); opacity: 1; font-weight: 700; }

  /* ---------- Hints (progressive ladder) ---------- */
  .hint-btn[hidden] { display: none; }
  .hint-btn {
    display: block; margin: 10px auto 0; cursor: pointer;
    font-family: var(--hand); font-size: 19px; color: var(--ink-accent);
    background: transparent; border: 1.5px dashed var(--ink-accent);
    border-radius: 3px; padding: 3px 16px; transition: background 0.15s, opacity 0.15s;
  }
  .hint-btn:hover { background: var(--page-wash); }
  .hint-btn:disabled { color: var(--ink-soft); border-color: var(--ink-soft); cursor: default; opacity: 0.7; }
  .hint-btn.urge { animation: hintPulse 1.4s ease-in-out infinite; }
  @keyframes hintPulse {
    0%, 100% { transform: scale(1); background: transparent; }
    50% { transform: scale(1.05); background: var(--highlighter); }
  }
  .hint-box { text-align: center; margin-top: 10px; }
  .hint-tier {
    font-family: var(--hand); font-size: 20px; color: var(--ink); margin: 6px 0;
  }
  .hint-chip {
    display: inline-block; padding: 0 8px; border-radius: 10px;
    font-family: var(--type); font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase;
    color: #fffdf6; background: var(--chip, var(--bead)); vertical-align: middle;
  }
  .hint-line {
    font-family: var(--hand); font-size: 24px; color: var(--ink); line-height: 1.3;
    border-left: 3px solid var(--ink-accent); padding: 2px 0 2px 14px; margin: 8px 0 0;
    text-align: left;
  }
  .hint-line mark { background: var(--highlighter); color: var(--ink); padding: 0 3px; font-weight: 700; }
  .hint-used-note {
    font-family: var(--type); font-size: 11px; letter-spacing: 0.5px;
    color: var(--ink-soft); text-align: center; margin-top: 8px; opacity: 0.9;
  }
  @media (prefers-reduced-motion: reduce) {
    .hint-btn.urge { animation: none; }
    .feedback .sticker { animation: none; }
  }

  /* ---------- Pen-circle confirm ---------- */
  .circled-choice { text-align: center; padding: 24px 16px 30px; }
  .cc-box { position: relative; display: inline-block; padding: 9px 20px; max-width: 100%; }
  .cc-box .cc-text {
    position: relative; z-index: 1;
    font-family: var(--hand); font-weight: 700; color: var(--ink);
    font-size: clamp(28px, 7.5vw, 44px); line-height: 1.15;
  }
  /* the ring path fills its viewBox, so stretching it to the (padded) box keeps it
     hugging the edges uniformly — a small outward offset clears the text whether the
     title is one line or two. (an SVG is a replaced element, so it needs explicit
     width/height — top/bottom insets alone won't stretch it) */
  .cc-box svg { position: absolute; top: -6px; left: -5px; width: calc(100% + 10px); height: calc(100% + 12px); overflow: visible; pointer-events: none; }
  .cc-ring {
    fill: none; stroke: var(--ink-accent); stroke-width: 2.4; stroke-linecap: round;
    stroke-dasharray: 1; stroke-dashoffset: 1;
    animation: drawRing 0.55s ease-out forwards;
  }
  @keyframes drawRing { to { stroke-dashoffset: 0; } }

  /* ---------- Feedback ---------- */
  /* ---------- Feedback ---------- */
  .feedback { margin-top: 6px; }

  /* Correct: a satisfied ink mark written in the margin, era-accented */
  .feedback .banner.good {
    font-family: var(--hand); font-weight: 700; font-size: 32px;
    color: var(--ink-accent);
    transform: rotate(-1.2deg);
    display: inline-block; margin-bottom: 10px;
    padding: 0;
  }

  /* The correct-verdict header: the handwritten note and (when earned) the gold star
     sit on one baseline-centred row, so the sticker rides alongside the note instead
     of stacking above the lyric and shoving it down the page. */
  .feedback .fb-head {
    display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
    margin-bottom: 10px;
  }
  .feedback .fb-head .banner.good { margin-bottom: 0; }

  /* Verse bonus: a peel-and-stick gold foil star pressed into the margin for fuller
     recall — the teacher's gold star. A die-cut star (clip-path foil) carrying the
     bonus amount; tier wording lives in the banner. Escalates gold → rose (whole verse).
     Reusable sticker primitive (see PLAN.md). */
  .feedback .sticker {
    position: relative; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    width: 54px; height: 54px;
    rotate: -8deg;
    filter: drop-shadow(0 2px 2.5px rgba(43,39,34,0.32));
    animation: stickerPress 0.45s cubic-bezier(0.34,1.56,0.64,1) both;
  }
  .feedback .sticker--big { width: 64px; height: 64px; rotate: 6deg; }
  /* the foil itself — a CSS-gradient star, clip-path die-cut, with a soft top-left sheen */
  .sticker-foil {
    position: absolute; inset: 0;
    clip-path: polygon(50% 1%, 61% 35%, 98% 35%, 68% 57%, 79% 92%, 50% 70%, 21% 92%, 32% 57%, 2% 35%, 39% 35%);
    background:
      radial-gradient(70% 60% at 33% 26%, rgba(255,255,255,0.78), rgba(255,255,255,0) 55%),
      linear-gradient(152deg, #f7d165 0%, #e6ad36 48%, #c98a22 100%);
  }
  .sticker--rose .sticker-foil {
    background:
      radial-gradient(58% 52% at 33% 26%, rgba(255,255,255,0.6), rgba(255,255,255,0) 52%),
      linear-gradient(152deg, #ec92a6 0%, #d3637f 48%, #b54866 100%);
  }
  /* the bonus, inked across the star body (nudged into its visual centre of mass) */
  .sticker-amt {
    position: relative; z-index: 1;
    transform: translateY(3px);
    font-family: var(--hand); font-weight: 700; font-size: 19px; line-height: 1;
    color: #6b4a12; text-shadow: 0 1px 0 rgba(255,247,214,0.5);
  }
  .feedback .sticker--big .sticker-amt { font-size: 23px; transform: translateY(5px); }
  .sticker--rose .sticker-amt { color: #5e1f30; text-shadow: 0 1px 0 rgba(255,224,232,0.45); }
  @keyframes stickerPress {
    0% { opacity: 0; scale: 1.55; }
    100% { opacity: 1; scale: 1; }
  }
  .verse-firstnote {
    font-family: var(--hand); font-size: 16px; color: var(--ink-soft);
    text-align: center; margin: 0 auto 10px; max-width: 32ch; line-height: 1.35;
  }

  /* Wrong/timeout: a red-pen correction scrawled in the margin */
  .feedback .banner.bad {
    font-family: var(--hand); font-weight: 700; font-size: 22px;
    color: rgba(178,58,58,0.75);
    transform: rotate(-1.8deg);
    display: inline-block; margin-bottom: 4px;
    padding: 0;
    letter-spacing: 0.2px;
  }

  /* "songs that use X" — a small red-pen aside, not a label */
  .feedback .red-note {
    font-family: var(--hand); font-size: 17px;
    color: rgba(178,58,58,0.65);
    transform: rotate(-0.6deg);
    display: block; margin: 0 0 14px;
  }
  .feedback .red-note b { font-weight: 700; }

  /* Lyric cards — shared base */
  .lyric-card {
    border-left: 3px solid var(--album-color, var(--ink-soft));
    padding: 2px 0 2px 14px; margin-bottom: 14px;
  }
  .lyric-card .song-title {
    font-family: var(--type); font-size: 11px; letter-spacing: 1px;
    color: var(--ink-soft); margin-bottom: 4px;
  }
  .lyric-card .lyric-line {
    font-family: var(--hand); font-size: 24px; color: var(--ink); line-height: 1.3;
  }
  .lyric-card .lyric-line mark {
    background: var(--highlighter); color: var(--ink); padding: 0 3px; font-weight: 700;
  }
  /* album tag */
  .album-tag {
    display: inline-block; margin-left: 8px;
    font-family: var(--type); font-size: 9px; letter-spacing: 0.8px;
    color: var(--album-color, var(--ink-soft));
    vertical-align: middle; opacity: 0.85; text-transform: uppercase;
  }

  /* Wrong cards: album border stays, lyric slightly faded, keyword blushes */
  .lyric-card.wrong-card .lyric-line { color: var(--ink-soft); }
  .lyric-card.wrong-card .lyric-line mark {
    background: rgba(178,58,58,0.15); color: var(--ink);
  }

  .countdown {
    text-align: center; margin-top: 18px;
    font-family: var(--type); font-size: 12px; color: var(--ink-soft);
  }
  .countdown b { display: block; font-family: var(--hand); font-size: 46px; color: var(--ink-accent); line-height: 1.3; }
  .countdown-skip {
    margin-top: 8px;
    font-family: var(--type); font-size: 11px; letter-spacing: 1px;
    color: var(--ink-soft); background: transparent;
    border: none; border-bottom: 1px dashed var(--ink-soft);
    padding: 2px 1px; cursor: pointer;
  }
  .countdown-skip:hover { color: var(--ink); border-bottom-color: var(--ink); }

  /* ---------- Results ---------- */
  .final-score { text-align: center; margin-bottom: 18px; }
  .final-score .big {
    font-family: var(--hand); font-weight: 700; font-size: 88px; line-height: 1;
    color: var(--ink); transform: rotate(-2deg); display: inline-block;
  }
  .final-score .sub { font-family: var(--type); font-size: 12px; letter-spacing: 1px; color: var(--ink-soft); margin-top: 4px; }

  .name-prompt { margin-top: 18px; text-align: center; }
  .name-prompt p { font-family: var(--hand); font-size: 22px; color: var(--ink); margin: 0 0 10px; }
  .name-prompt input {
    width: 100%; padding: 8px 4px; text-align: center;
    font-family: var(--hand); font-size: 24px;
    border: none; border-bottom: 2px solid var(--ink); border-radius: 0;
    background: transparent; color: var(--ink); outline: none; margin-bottom: 12px;
  }

  .loading, .error {
    text-align: center; padding: 40px 16px;
    font-family: var(--hand); font-size: 24px; color: var(--ink-soft);
  }
  .error { color: var(--margin); }
  .error code { font-family: var(--type); font-size: 13px; background: rgba(43,39,34,0.08); padding: 2px 6px; }

  /* ---------- Stats page ---------- */
  #screen-stats.card { padding-top: 16px; }
  .stats-nav {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 18px;
  }
  .stats-nav .stats-title {
    font-family: var(--hand); font-weight: 700; font-size: 26px;
    color: var(--ink); transform: rotate(-0.8deg);
  }
  .btn-link {
    font-family: var(--type); font-size: 11px; letter-spacing: 1px;
    color: var(--ink-soft); background: none; border: none; cursor: pointer;
    text-decoration: underline; text-underline-offset: 3px; padding: 4px 0;
  }
  .btn-link:hover { color: var(--ink); }
  /* "By the numbers" header (design E): three primaries on top, then a
     recent-form sparkline beside the secondary stats. Transparent over paper,
     thin ruled dividers — no boxed border. */
  .statE-top {
    display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 16px;
  }
  .statE-cell { text-align: center; padding: 0 6px; }
  .statE-top .statE-cell + .statE-cell { border-left: 1px solid rgba(43,39,34,0.10); }
  .statE-val {
    font-family: var(--hand); font-weight: 700; color: var(--ink);
    font-size: 56px; line-height: 0.9; display: inline-block; vertical-align: top;
  }
  .statE-accent { color: var(--ink-accent); }
  .statE-best {
    background: linear-gradient(var(--highlighter), var(--highlighter)) bottom/100% 38% no-repeat;
    padding: 0 5px;
  }
  .statE-star {
    width: 18px; height: 18px; display: inline-block; color: var(--bead);
    vertical-align: top; margin: 4px 0 0 2px;
  }
  .statE-star svg { width: 100%; height: 100%; display: block; }
  .statE-lbl {
    font-family: var(--type); font-size: 10px; letter-spacing: 1.5px;
    color: var(--ink-soft); text-transform: uppercase; display: block; margin-top: 6px;
  }
  .statE-form {
    display: flex; align-items: center; gap: 18px;
    border-top: 1px solid rgba(43,39,34,0.10); padding-top: 14px; margin-bottom: 22px;
  }
  .statE-form-spark { flex: 1; min-width: 0; }
  .statE-form-lbl { margin: 0 0 4px; }
  .statE-form-empty {
    font-family: var(--type); font-size: 11px; color: var(--ink-soft);
    display: block; padding: 8px 0 4px;
  }
  .form-spark { display: block; overflow: visible; }
  .form-line {
    fill: none; stroke: var(--ink-accent); stroke-width: 2.4;
    stroke-linecap: round; stroke-linejoin: round;
  }
  .form-base { stroke: rgba(43,39,34,0.16); stroke-width: 1; stroke-dasharray: 3 4; }
  .form-dot { fill: var(--ink-accent); }
  .statE-chips { display: flex; gap: 20px; flex: none; }
  .statE-chips .statE-cell { padding-left: 18px; border-left: 1px solid rgba(43,39,34,0.10); }
  .statE-chips .statE-cell:first-child { border-left: none; padding-left: 0; }
  .statE-chips .statE-val { font-size: 40px; }
  .statE-chips .statE-star { width: 15px; height: 15px; }
  @media (max-width: 560px) {
    .statE-val { font-size: 46px; }
    .statE-form { flex-direction: column; align-items: stretch; gap: 14px; }
    .statE-chips { justify-content: center; gap: 28px; }
  }
  .streak-row {
    display: flex; gap: 0; border: 1.5px solid rgba(43,39,34,0.12);
    border-radius: 2px; margin-bottom: 22px;
  }
  .streak-cell {
    flex: 1; padding: 12px 8px 10px; text-align: center;
    border-right: 1.5px solid rgba(43,39,34,0.12);
  }
  .streak-cell:last-child { border-right: none; }
  .streak-cell .stat-val { font-family: var(--hand); font-size: 42px; font-weight: 700; color: var(--ink-accent); line-height: 1; display: block; }
  .streak-cell .stat-lbl { font-family: var(--type); font-size: 10px; letter-spacing: 1px; color: var(--ink-soft); display: block; margin-top: 4px; text-transform: uppercase; }
  /* "By the numbers" — a notebook bento: accuracy ring + album-spine meter,
     quick-stat tiles, daily footer. Cards are transparent over the ruled paper. */
  .num-card {
    border: 1.5px solid rgba(43,39,34,0.14); border-radius: 3px;
    padding: 13px 15px; position: relative;
  }
  .num-lbl {
    font-family: var(--type); font-size: 10px; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--ink-soft);
  }
  .num-sub {
    display: block; font-family: var(--type); font-size: 10px; letter-spacing: 0.5px;
    text-transform: uppercase; color: var(--ink-soft); line-height: 1.4;
  }
  .num-val {
    display: block; font-family: var(--hand); font-weight: 700; font-size: 34px;
    line-height: 1; color: var(--ink);
  }
  .num-val-md { font-size: 30px; }
  .num-gold { color: var(--ink-accent); }
  .num-ico {
    display: inline-block; width: 19px; height: 19px;
    color: var(--ink-soft); opacity: 0.7;
  }
  .num-ico svg { width: 100%; height: 100%; display: block; }
  .num-ico-lg { width: 22px; height: 22px; }
  .num-ico-gold { color: var(--ink-accent); opacity: 1; }
  .num-hero-row {
    display: grid; grid-template-columns: 1fr 1.2fr; gap: 12px; margin-bottom: 12px;
  }
  .num-acc { display: flex; align-items: center; gap: 16px; }
  .num-ring { position: relative; width: 92px; height: 92px; flex: none; }
  .num-ring svg { width: 100%; height: 100%; display: block; }
  .num-ring-track { fill: none; stroke: rgba(43,39,34,0.13); stroke-width: 11; }
  .num-ring-arc {
    fill: none; stroke: var(--ink-accent); stroke-width: 11; stroke-linecap: round;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.2,0.7,0.2,1);
  }
  .num-ring-val {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-family: var(--hand); font-weight: 700; color: var(--ink);
  }
  .num-ring-val b { font-size: 38px; line-height: 1; }
  .num-ring-val span { font-size: 19px; color: var(--ink-soft); }
  .num-albums { display: flex; flex-direction: column; justify-content: center; }
  .num-albums-head {
    display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 11px;
  }
  .num-count { font-family: var(--hand); font-weight: 700; font-size: 30px; color: var(--ink); line-height: 1; }
  .num-count i { font-style: normal; font-size: 17px; color: var(--ink-soft); }
  .num-spines { display: flex; gap: 3px; align-items: flex-end; height: 38px; }
  .num-spine { flex: 1; height: 100%; border-radius: 1px; }
  .num-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
  .num-tile { text-align: center; }
  .num-tile .num-ico { margin-bottom: 2px; }
  .num-tile .num-val { margin: 2px 0 3px; }
  .num-daily { display: flex; justify-content: space-around; align-items: center; margin-bottom: 22px; }
  .num-daily-item { display: flex; align-items: center; gap: 12px; }
  .num-daily-div { width: 1px; height: 46px; background: rgba(43,39,34,0.12); }
  .histogram-label {
    font-family: var(--type); font-size: 10px; letter-spacing: 1px;
    color: var(--ink-soft); text-transform: uppercase; margin-bottom: 10px;
  }
  .histogram {
    display: flex; align-items: flex-end; gap: 4px;
    height: 64px; margin-bottom: 4px;
  }
  .histogram-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .histogram-bar {
    width: 100%; background: var(--bead); opacity: 0.5; border-radius: 1px;
    min-height: 2px; transition: height 0.3s ease, opacity 0.15s ease, filter 0.15s ease;
  }
  .histogram-bar.has-you { opacity: 0.9; }
  .histogram-col:hover .histogram-bar { opacity: 1; filter: brightness(0.8); }
  .histogram-score {
    font-family: var(--type); font-size: 9px; color: var(--ink-soft);
    text-align: center; line-height: 1;
  }
  .stats-empty {
    font-family: var(--hand); font-size: 20px; color: var(--ink-soft);
    text-align: center; padding: 24px 0 8px; font-style: italic;
  }
  /* lifetime catalogue stats — hero meter + keepsake cards + circled nemesis */
  .cat-wrap { margin-bottom: 22px; }
  .cat-label {  /* shared type label: small uppercase typewriter */
    font-family: var(--type); font-size: 10px; letter-spacing: 1px;
    color: var(--ink-soft); text-transform: uppercase;
  }
  /* hero: songs discovered */
  .cat-meter {
    border: 1.5px solid rgba(43,39,34,0.12); border-radius: 3px;
    padding: 14px 16px 16px; margin-bottom: 12px;
  }
  .cat-meter-head {
    display: flex; justify-content: space-between; align-items: baseline;
    font-family: var(--type); font-size: 10px; letter-spacing: 1px;
    color: var(--ink-soft); text-transform: uppercase;
  }
  .cat-meter-num { font-family: var(--hand); font-size: 26px; color: var(--ink-soft); margin: 2px 0 10px; line-height: 1; }
  .cat-meter-num b { font-weight: 700; font-size: 44px; color: var(--ink); }
  .cat-bar {
    display: flex; gap: 1px; height: 11px; border-radius: 6px; overflow: hidden;
    background: rgba(43,39,34,0.10);
  }
  .cat-seg { height: 100%; }
  /* the songs-discovered meter doubles as a button into the songbook */
  .cat-meter--btn {
    display: block; width: 100%; text-align: left; cursor: pointer;
    background: var(--page-wash); font: inherit; color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
  }
  .cat-meter--btn:hover { border-color: rgba(43,39,34,0.3); background: rgba(212,160,23,0.08); }
  .cat-meter--btn:focus-visible { outline: 2px solid var(--ink-accent); outline-offset: 3px; }
  .cat-meter-cta {
    font-family: var(--type); font-size: 10px; letter-spacing: 0.5px;
    color: var(--ink-accent); margin-top: 9px;
  }
  .cat-meter-cta span { font-family: var(--hand); font-size: 16px; }
  /* two keepsake cards */
  .cat-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
  .cat-card {
    border: 1.5px solid rgba(43,39,34,0.12); border-left: 4px solid var(--ink-soft);
    border-radius: 0 3px 3px 0; padding: 11px 13px; min-width: 0;
  }
  .cat-card-head {
    display: flex; align-items: center; gap: 6px; margin-bottom: 3px;
    font-family: var(--type); font-size: 9px; letter-spacing: 1px;
    color: var(--ink-soft); text-transform: uppercase;
  }
  .cat-star { width: 15px; height: 15px; flex: none; color: var(--bead); }
  .cat-star svg { width: 100%; height: 100%; display: block; }
  .cat-dot { width: 11px; height: 11px; flex: none; border-radius: 50%; }
  .cat-card-val {
    font-family: var(--hand); font-weight: 700; font-size: 25px; line-height: 1.05;
    color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .cat-card-sub {
    font-family: var(--type); font-size: 10px; letter-spacing: 0.5px;
    text-transform: uppercase; margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* nemesis word, circled in red pen */
  .cat-nemesis {
    border: 1.5px solid rgba(43,39,34,0.12); border-radius: 3px;
    padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  }
  .cat-nemesis-sub { font-family: var(--type); font-size: 11px; color: rgba(155,34,38,0.85); }
  .cat-search-link { color: inherit; text-decoration: none; border-bottom: 1px dashed rgba(155,34,38,0.5); white-space: nowrap; }
  .cat-search-link:hover, .cat-search-link:focus-visible { color: #8f2e20; border-bottom-color: rgba(155,34,38,0.9); outline: none; }
  .cat-nemesis-word { position: relative; padding: 4px 10px; flex: none; }
  .cat-nemesis-word span {
    font-family: var(--hand); font-weight: 700; font-size: 34px;
    color: var(--ink); position: relative; z-index: 1;
  }
  .cat-nemesis-word svg {
    position: absolute; inset: -4px -2px;
    width: calc(100% + 4px); height: calc(100% + 8px); overflow: visible;
  }
  /* "from memory" verse-bonus tally, paired beside the nemesis word */
  .cat-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
  .cat-pair .cat-nemesis { margin: 0; }
  .cat-frommemory {
    border: 1.5px solid rgba(43,39,34,0.12); border-left: 4px solid var(--bead);
    border-radius: 0 3px 3px 0; padding: 12px 16px;
    display: flex; flex-direction: column; justify-content: center; min-width: 0;
  }
  .cat-fm-val {
    font-family: var(--hand); font-weight: 700; font-size: 34px; line-height: 1.05; color: var(--ink);
  }
  .cat-fm-sub {
    font-family: var(--type); font-size: 10px; letter-spacing: 0.5px;
    text-transform: uppercase; color: var(--ink-soft); margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* infinite-mode tab — a pen-circled headline medallion + a ruled run ledger */
  .inf-hero {
    display: flex; align-items: center; gap: 18px;
    border-bottom: 1.5px solid rgba(43,39,34,0.16);
    padding-bottom: 16px; margin-bottom: 18px;
  }
  .inf-medallion {
    flex: none; width: 92px; height: 92px; border-radius: 50%;
    border: 2px solid var(--ink); background: var(--highlighter, rgba(247,201,72,0.30));
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transform: rotate(-3deg);
  }
  .inf-medallion b {
    font-family: var(--hand); font-weight: 700; font-size: 50px; line-height: 0.78; color: var(--ink);
  }
  .inf-medallion span {
    font-family: var(--type); font-size: 9px; letter-spacing: 1px;
    text-transform: uppercase; color: var(--ink-soft); margin-top: 2px;
  }
  .inf-hero-title { font-family: var(--hand); font-size: 30px; line-height: 1; color: var(--ink); }
  .inf-hero-sub { font-family: var(--type); font-size: 12px; color: var(--ink-soft); margin-top: 6px; }

  .inf-ledger { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .inf-ledger thead th {
    font-family: var(--type); font-size: 11px; letter-spacing: 1px; font-weight: 700;
    text-transform: uppercase; color: var(--ink); text-align: center; padding: 0 0 10px; line-height: 1.5;
  }
  .inf-ledger thead th:first-child { width: 26%; }
  .inf-th-beads { display: block; margin-bottom: 3px; }
  .inf-th-beads i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin: 0 1px; }
  .inf-ledger tbody tr { border-top: 1px solid rgba(43,39,34,0.12); }
  .inf-ledger tbody tr:last-child { border-bottom: 1px solid rgba(43,39,34,0.12); }
  .inf-row-h {
    font-family: var(--hand); font-size: 23px; font-weight: 400; text-align: left;
    color: var(--ink); padding: 12px 0;
  }
  .inf-cell { text-align: center; padding: 12px 0; position: relative; }
  .inf-cell-num { font-family: var(--hand); font-weight: 700; font-size: 34px; line-height: 0.9; display: block; }
  .inf-cell-sub { font-family: var(--type); font-size: 10px; color: var(--ink-soft); display: block; margin-top: 2px; }
  .inf-cell--empty { font-family: var(--hand); font-size: 26px; color: rgba(43,39,34,0.25); }
  .inf-circle {
    position: absolute; left: 50%; top: 7px; width: 76px; height: 40px;
    transform: translateX(-50%) rotate(-4deg); pointer-events: none; overflow: visible;
  }
  .inf-foot {
    font-family: var(--type); font-size: 10px; color: var(--ink-soft);
    margin: 12px 0 4px; text-align: right;
  }

  /* adaptive stats ladder: the four rungs, lit up to the best peak reached */
  .adapt-ladder { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .adapt-ladder tbody tr { border-top: 1px solid rgba(43,39,34,0.12); }
  .adapt-ladder tbody tr:last-child { border-bottom: 1px solid rgba(43,39,34,0.12); }
  .adapt-rung { opacity: 0.4; }
  .adapt-rung.reached { opacity: 1; }
  .adapt-rung-lvl {
    font-family: var(--hand); font-size: 22px; font-weight: 700; text-align: left;
    color: var(--ink); padding: 10px 0; width: 18%;
  }
  .adapt-rung-name {
    font-family: var(--hand); font-size: 22px; font-weight: 400; color: var(--ink); padding: 10px 0;
  }
  .adapt-rung-mark {
    font-family: var(--type); font-size: 11px; letter-spacing: 0.5px; color: var(--ink-soft);
    text-align: right; padding: 10px 0;
  }
  .adapt-rung.peak .adapt-rung-mark { color: var(--ink); font-weight: 700; }

  /* ---------- Easter eggs (Phase 8) ---------- */
  /* Margin doodles — faint hand-drawn ink scribbles in the page corners */
  .doodle-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
  .doodle { position: absolute; color: var(--ink-soft); opacity: 0; animation: doodleIn 0.8s ease forwards; }
  .doodle svg { display: block; width: 100%; height: 100%; overflow: visible; }
  .doodle .ink { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .doodle .ink-fill { fill: var(--ink-soft); stroke: none; }
  .doodle.corner-br { right: 14px; bottom: 16px; }
  .doodle.corner-bl { left: 10px; bottom: 18px; }
  .doodle.snake .ink { stroke-dasharray: 200; stroke-dashoffset: 200; animation: slither 1.5s ease forwards; }
  @keyframes doodleIn { to { opacity: 0.5; } }
  @keyframes slither { to { stroke-dashoffset: 0; } }
  .doodle-note {
    position: absolute; left: 4px; z-index: 1; pointer-events: none;
    font-family: var(--hand); font-size: 15px; color: var(--ink-soft);
    opacity: 0; transform: rotate(-6deg); animation: doodleIn 0.8s ease forwards;
    max-width: 44px; line-height: 1.05;
  }

  /* reputation-era snake — a detailed serpent that slithers across the page */
  .snake-overlay {
    position: absolute; inset: 0; width: 100%; height: 100%;
    z-index: 3; pointer-events: none; overflow: visible;
    opacity: 0; animation: snakeFade 0.55s ease forwards;
    filter: drop-shadow(2px 4px 3px rgba(20,16,12,0.22));
  }
  .snake-overlay.leaving { animation: none; opacity: 0; transition: opacity 0.7s ease; }
  @keyframes snakeFade { to { opacity: 1; } }

  /* The three pens — a rare swap of the resting pencil */
  .input-area[data-pen]::before { content: none; }
  .pen-glyph { position: absolute; left: -2px; bottom: 5px; z-index: 1; width: 22px; height: 22px; pointer-events: none; color: var(--ink-soft); }
  .pen-glyph svg { width: 100%; height: 100%; overflow: visible; }
  .pen-glyph .barrel { fill: var(--paper); stroke: var(--ink-soft); stroke-width: 1.2; stroke-linejoin: round; }
  .pen-glyph .vane { fill: var(--paper); stroke: var(--ink-soft); stroke-width: 1.2; stroke-linejoin: round; }
  .pen-glyph .nib, .pen-glyph .tip { fill: var(--ink-soft); stroke: none; }
  .pen-glyph .spine { fill: none; stroke: var(--ink-soft); stroke-width: 1.1; stroke-linecap: round; }
  .pen-glyph .barb { fill: none; stroke: var(--ink-soft); stroke-width: 0.7; stroke-linecap: round; opacity: 0.75; }
  .pen-glyph .slit { fill: none; stroke: var(--paper); stroke-width: 0.7; stroke-linecap: round; }
  .pen-glyph .hole { fill: var(--paper); stroke: none; }
  .pen-glyph .band { fill: var(--ink-accent); stroke: none; }
  .pen-glyph .grip { fill: var(--ink-accent); stroke: none; opacity: 0.85; }
  .pen-glyph .glitter-spark { fill: var(--bead); stroke: none; }
  .pen-label {
    position: absolute; left: 24px; bottom: -17px; z-index: 1;
    font-family: var(--hand); font-size: 12px; color: var(--ink-soft);
    opacity: 0.7; white-space: nowrap; pointer-events: none;
  }
  .cc-box[data-pen="glitter"] .cc-ring { stroke: var(--bead); }

  /* "blue" wash */
  .blue-wash {
    position: absolute; inset: 0; z-index: 4; pointer-events: none;
    background: radial-gradient(120% 90% at 50% 42%, rgba(63,111,163,0.22), rgba(63,111,163,0) 70%);
    opacity: 0; animation: blueWash 1.6s ease forwards;
  }
  @keyframes blueWash { 0% { opacity: 0; } 28% { opacity: 1; } 100% { opacity: 0; } }

  /* sparkle when you type a real lyric line */
  .sparkle { position: absolute; z-index: 6; pointer-events: none; width: 16px; height: 16px; color: var(--bead); opacity: 0; animation: sparkle 0.9s ease forwards; }
  .sparkle svg { width: 100%; height: 100%; }
  @keyframes sparkle {
    0% { opacity: 0; transform: scale(0.4) rotate(0deg); }
    40% { opacity: 1; transform: scale(1) rotate(25deg); }
    100% { opacity: 0; transform: scale(0.8) rotate(45deg); }
  }

  /* title tapped 13 times */
  .secret-13 {
    position: absolute; left: 50%; top: -4px; transform: translateX(-50%);
    font-family: var(--hand); font-weight: 700; font-size: 18px; color: var(--ink-accent);
    white-space: nowrap; opacity: 0; pointer-events: none; animation: secret13 2.6s ease forwards;
  }
  @keyframes secret13 {
    0% { opacity: 0; transform: translate(-50%, 6px); }
    18% { opacity: 1; transform: translate(-50%, -6px); }
    82% { opacity: 1; transform: translate(-50%, -10px); }
    100% { opacity: 0; transform: translate(-50%, -18px); }
  }

  /* perfect 13/13 — gold star shower on the results page */
  .star-shower { position: absolute; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
  .star-shower .ss { position: absolute; top: -28px; color: var(--bead); animation: starFall linear forwards; }
  .star-shower .ss svg { width: 100%; height: 100%; }
  @keyframes starFall { to { transform: translateY(var(--fall, 480px)) rotate(220deg); opacity: 0.9; } }

  /* ---- Perfect-game shimmer (13/13): the whole notepad turns sparkly ---- */
  /* slow gold aura breathing around the card */
  .card.perfect { animation: perfectGlow 3.4s ease-in-out infinite; }
  @keyframes perfectGlow {
    0%, 100% { box-shadow: 0 1px 0 #fff inset, 0 18px 40px rgba(60,50,35,.28), 0 2px 6px rgba(60,50,35,.18), 0 0 0 rgba(224,163,47,0); }
    50%      { box-shadow: 0 1px 0 #fff inset, 0 18px 44px rgba(60,50,35,.30), 0 2px 6px rgba(60,50,35,.18), 0 0 36px rgba(224,163,47,.45); }
  }
  /* gold-foil shimmer running through the big score */
  .card.perfect .final-score .big {
    background: linear-gradient(100deg, #b8841f 0%, #e9c25a 26%, #fff4cf 46%, #e9c25a 62%, #b8841f 86%);
    background-size: 240% 100%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
    text-shadow: 0 0 16px rgba(224,163,47,.35);
    animation: foilShift 2.8s linear infinite;
    /* Caveat's glyph ink overhangs its advance width; background-clip:text clips the
       gold to the content box, so pad the box out to stop the right edge slicing the 3. */
    padding: 0.06em 0.2em;
  }
  @keyframes foilShift { to { background-position: -240% 0; } }
  /* a soft warm sheen that sweeps across the paper, like light catching the page */
  .shine-sweep { position: absolute; inset: 0; border-radius: 3px; pointer-events: none; z-index: 6; overflow: hidden; }
  .shine-sweep::before {
    content: ""; position: absolute; top: -20%; bottom: -20%; left: -60%; width: 42%;
    background: linear-gradient(105deg, transparent, rgba(255,250,230,.5) 44%, rgba(255,255,255,.72) 50%, rgba(255,250,230,.5) 56%, transparent);
    transform: skewX(-18deg); filter: blur(2px); mix-blend-mode: soft-light;
    animation: shineSweep 4.4s ease-in-out infinite;
  }
  @keyframes shineSweep { 0% { left: -60%; } 55%, 100% { left: 140%; } }
  /* a field of twinkling sparkles scattered over the page */
  .twinkle-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
  .twinkle-layer .tw {
    position: absolute; color: var(--bead, #e0a32f); opacity: 0; transform: scale(.3);
    filter: drop-shadow(0 0 3px rgba(224,163,47,.55)); animation: twinkle ease-in-out infinite;
  }
  .twinkle-layer .tw svg { width: 100%; height: 100%; display: block; }
  @keyframes twinkle {
    0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
    50%      { opacity: .85; transform: scale(1) rotate(45deg); }
  }

  /* ---------- Achievements ---------- */
  /* live toast (bottom-right) when one unlocks mid-game */
  .toast-layer {
    position: fixed; right: 16px; bottom: 16px; z-index: 200;
    display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
    pointer-events: none;
  }
  .toast {
    display: flex; align-items: center; gap: 11px;
    background: var(--paper); color: var(--ink);
    border: 1.5px solid var(--ink); border-radius: 3px;
    padding: 10px 14px 10px 11px; max-width: 280px;
    box-shadow: 3px 3px 0 rgba(43,39,34,0.18);
    transform: rotate(-1deg);
    /* No fill-mode: once the entrance ends the toast rests on the CSS transform
       above, so the JS FLIP drop (inline transform) isn't overridden by a
       lingering animation fill. The end keyframe equals this rest state. */
    animation: toastIn 0.4s cubic-bezier(.34,1.56,.64,1);
    pointer-events: auto;
  }
  .tip-pop {
    position: fixed; z-index: 300; left: 0; top: 0;
    max-width: 240px; padding: 5px 9px;
    font-family: var(--type); font-size: 12px; line-height: 1.35;
    color: var(--paper); background: var(--ink);
    border-radius: 3px; box-shadow: 2px 2px 0 rgba(43,39,34,0.22);
    pointer-events: none; opacity: 0; visibility: hidden;
    transition: opacity 0.1s ease;
  }
  .tip-pop.show { opacity: 1; visibility: visible; }
  .toast.leaving { animation: toastOut 0.4s ease forwards; }
  .toast .charm { width: 34px; height: 34px; flex: none; color: var(--bead); }
  .toast .charm svg { width: 100%; height: 100%; overflow: visible; }
  .toast .charm .ink { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .toast .charm .ink-fill { fill: var(--bead); stroke: var(--ink); stroke-width: 1.2; }
  .toast .t-label { font-family: var(--type); font-size: 10px; letter-spacing: 1px; color: var(--ink-soft); text-transform: uppercase; }
  .toast .t-name { font-family: var(--hand); font-weight: 700; font-size: 21px; color: var(--ink); line-height: 1.05; }
  @keyframes toastIn { from { opacity: 0; transform: translateX(30px) rotate(-1deg); } to { opacity: 1; transform: translateX(0) rotate(-1deg); } }
  @keyframes toastOut { to { opacity: 0; transform: translateX(30px) rotate(-1deg); } }

  /* newly-unlocked recap on the results page */
  .ach-recap { margin: 18px 0 4px; text-align: center; }
  .ach-recap .ach-recap-title { font-family: var(--type); font-size: 11px; letter-spacing: 1px; color: var(--ink-soft); text-transform: uppercase; margin-bottom: 10px; }
  .ach-recap-row { display: flex; flex-wrap: wrap; gap: 14px 18px; justify-content: center; }
  .ach-recap .ach-chip { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 84px;
    background: none; border: none; padding: 4px 2px; border-radius: 8px; cursor: pointer;
    font: inherit; transition: transform 0.12s ease, background 0.12s ease; }
  .ach-recap .ach-chip:hover { transform: translateY(-2px); background: var(--page-wash); }
  .ach-recap .ach-chip:focus-visible { outline: 2px solid var(--ink-accent); outline-offset: 2px; }
  .ach-recap .ach-chip .charm { width: 38px; height: 38px; color: var(--bead); }
  .ach-recap .ach-chip .charm svg { width: 100%; height: 100%; overflow: visible; }
  .ach-recap .ach-chip .charm .ink { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .ach-recap .ach-chip .charm .ink-fill { fill: var(--bead); stroke: var(--ink); stroke-width: 1.2; }
  .ach-recap .ach-chip .nm { font-family: var(--hand); font-size: 16px; color: var(--ink); line-height: 1.05; }

  /* charm tiles — used by the grouped grid on the Charm Collection page */
  .ach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 6px; }
  .ach {
    display: flex; align-items: center; gap: 10px;
    border: 1.5px solid rgba(43,39,34,0.12); border-radius: 2px; padding: 9px 11px;
  }
  .ach .charm { width: 30px; height: 30px; flex: none; color: var(--bead); }
  .ach .charm svg { width: 100%; height: 100%; overflow: visible; }
  .ach .charm .ink { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .ach .charm .ink-fill { fill: var(--bead); stroke: var(--ink); stroke-width: 1.2; }
  .ach .ach-text { min-width: 0; }
  .ach .ach-nm { font-family: var(--hand); font-weight: 700; font-size: 18px; color: var(--ink); line-height: 1.05; }
  .ach .ach-dc { font-family: var(--type); font-size: 10px; color: var(--ink-soft); line-height: 1.25; margin-top: 2px; }
  .ach.locked { opacity: 0.55; }
  .ach.locked .charm { color: var(--ink-soft); }
  .ach.locked .charm .ink-fill { fill: var(--ink-soft); }
  .ach.secret .charm-q { font-family: var(--hand); font-weight: 700; font-size: 22px; color: var(--ink-soft); width: 30px; text-align: center; flex: none; }

  /* Charm Collection page — header (title + by-theme breakdown + meter/latest), then grouped grid */
  .ach-page-head { margin-bottom: 14px; }
  .ach-page-title { font-family: var(--hand); font-weight: 700; font-size: 44px; color: var(--ink); line-height: 0.95; }
  .ach-page-sub { font-family: var(--type); font-size: 12px; letter-spacing: 1px; color: var(--ink-soft); }

  /* by-theme breakdown — a small colour-coded progress bar per group */
  .ach-themes { border: 1.5px solid rgba(43,39,34,0.12); border-radius: 3px; padding: 14px 16px; margin-bottom: 14px; }
  .ach-themes-label { font-family: var(--type); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 12px; }
  .ach-themes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 22px; }
  .ach-theme-head { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--type); font-size: 11px; color: var(--ink-soft); margin-bottom: 4px; }
  .ach-theme-name { display: flex; align-items: center; gap: 6px; }
  .ach-theme-bar { height: 7px; border-radius: 4px; background: rgba(43,39,34,0.10); overflow: hidden; }
  .ach-theme-bar > div { height: 100%; border-radius: 4px; }

  .ach-head-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; margin-bottom: 8px; }
  .ach-head-row .cat-meter { margin-bottom: 0; }

  /* latest charm — a proper keepsake: real icon + wrapping name + date */
  .ach-latest { border: 1.5px solid rgba(43,39,34,0.12); border-radius: 3px; padding: 13px 15px; display: flex; align-items: center; gap: 13px; }
  .ach-latest-charm { flex: none; }
  .ach-latest-charm .charm { display: block; width: 46px; height: 46px; color: var(--bead); }
  .ach-latest-charm .charm svg { width: 100%; height: 100%; overflow: visible; }
  .ach-latest-charm .charm .ink { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .ach-latest-charm .charm .ink-fill { fill: var(--bead); stroke: var(--ink); stroke-width: 1.2; }
  .ach-latest-text { min-width: 0; }
  .ach-latest-label { font-family: var(--type); font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); }
  .ach-latest-name { font-family: var(--hand); font-weight: 700; font-size: 23px; color: var(--ink); line-height: 1.05; margin: 1px 0; }
  .ach-latest-meta { font-family: var(--type); font-size: 10px; color: var(--ink-soft); line-height: 1.3; }
  .ach-latest--empty { opacity: 0.7; }

  .ach-section { margin-top: 22px; display: flex; align-items: center; gap: 7px; }
  .ach-group-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(43,39,34,0.25); }
  .ach-group-dot--secret { background: var(--ink-soft); opacity: 0.5; }

  /* the pinned "long game" quest card — catalogue completion ("I Hate It Here").
     Harmonises with the page's panel system but lifted: a gold accent edge, a faint
     wash, and the album-rainbow bar nothing else here carries. */
  .ach-quest {
    display: flex; gap: 16px; align-items: stretch; width: 100%; text-align: left;
    cursor: pointer; font: inherit; color: inherit; margin: 12px 0 6px;
    border: 2px solid var(--bead); border-radius: 3px; padding: 15px 17px;
    background: var(--page-wash);
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
  }
  .ach-quest:hover { background: rgba(212,160,23,0.09); transform: translateY(-1px); }
  .ach-quest:focus-visible { outline: 2px solid var(--ink-accent); outline-offset: 3px; }
  .ach-quest-main { flex: 1; min-width: 0; }
  .ach-quest-eyebrow {
    font-family: var(--type); font-size: 9.5px; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--ink-accent);
  }
  .ach-quest-name { font-family: var(--hand); font-weight: 700; font-size: 32px; color: var(--ink); line-height: 0.98; margin: 2px 0 1px; }
  .ach-quest-desc { font-family: var(--type); font-size: 10.5px; color: var(--ink-soft); }
  .ach-quest-meterhead {
    display: flex; justify-content: space-between; align-items: baseline; margin-top: 11px;
    font-family: var(--type); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft);
  }
  .ach-quest-meterhead b { font-family: var(--hand); font-size: 20px; text-transform: none; color: var(--ink); }
  .ach-quest-bar { margin-top: 5px; }
  .ach-quest-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 11px; flex-wrap: wrap; }
  .ach-quest-note { font-family: var(--hand); font-size: 17px; color: var(--margin); }
  .ach-quest.done .ach-quest-note { color: var(--ink-accent); }
  .ach-quest-cta { font-family: var(--type); font-size: 10.5px; letter-spacing: 0.5px; color: var(--ink-accent); white-space: nowrap; }
  .ach-quest-cta span { font-family: var(--hand); font-size: 16px; }
  .ach-quest-aside { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; flex: none; }
  .ach-quest-charm {
    width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: rgba(43,39,34,0.05); border: 2px dashed rgba(43,39,34,0.28);
  }
  .ach-quest-charm.earned { background: var(--page-wash); border-style: solid; border-color: var(--bead); }
  .ach-quest-charm .charm { display: block; width: 32px; height: 32px; color: var(--bead); opacity: 0.45; }
  .ach-quest-charm.earned .charm { opacity: 1; }
  .ach-quest-charm .charm svg { width: 100%; height: 100%; overflow: visible; }
  .ach-quest-charm .charm .ink { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .ach-quest-charm .charm .ink-fill { fill: var(--bead); stroke: var(--ink); stroke-width: 1.2; }
  .ach-quest-state { font-family: var(--type); font-size: 8.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); }

  /* Songbook — the per-album missing-songs checklist */
  .sb-meter {
    border: 1.5px solid rgba(43,39,34,0.12); border-radius: 3px;
    padding: 14px 16px 16px; margin-bottom: 18px; background: var(--page-wash);
  }
  .sb-meter.done { border-color: var(--bead); }
  .sb-sub { font-family: var(--hand); font-size: 19px; color: var(--margin); margin-top: 9px; line-height: 1; }
  .sb-meter.done .sb-sub { color: var(--ink-accent); }
  .sb-album { margin-bottom: 18px; }
  .sb-album-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
  .sb-spine { width: 5px; height: 19px; border-radius: 2px; flex: none; }
  .sb-album-name { font-family: var(--type); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink); font-weight: 700; }
  .sb-album-count { font-family: var(--hand); font-size: 19px; color: var(--ink-soft); margin-left: auto; }
  .sb-done-tag { color: var(--ink-accent); font-weight: 700; }
  .sb-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 18px; }
  .sb-song { display: flex; align-items: flex-start; gap: 9px; padding: 3px 0; min-width: 0; }
  .sb-title {
    font-family: var(--hand); font-size: 20px; line-height: 1.1; color: rgba(43,39,34,0.42); min-width: 0;
  }
  .sb-song.got .sb-title { color: var(--ink); }
  .sb-hollow { width: 13px; height: 13px; border: 1.6px solid rgba(43,39,34,0.3); border-radius: 50%; flex: none; margin-top: 4px; }
  .sb-tick { width: 15px; height: 15px; flex: none; color: var(--bead); margin-top: 3px; }
  .sb-tick svg { width: 100%; height: 100%; display: block; }

  @media (max-width: 560px) {
    .ach-head-row { grid-template-columns: 1fr; }
    .ach-themes-grid { grid-template-columns: 1fr; }
    .ach-quest { flex-direction: column; }
    .ach-quest-aside { flex-direction: row; align-self: flex-start; }
    .sb-list { grid-template-columns: 1fr; }
  }

  /* Daily Challenge — a pinned "second card" action: solid, denim-washed, lightly skewed
     so it reads as a sibling of the gold primary button without competing with it. */
  .daily-btn {
    position: relative;
    display: block; width: 100%; margin-top: 12px; padding: 12px;
    font-family: var(--type); font-size: 14px; letter-spacing: 1px; font-weight: 700;
    color: var(--ink); background: rgba(91, 135, 184, 0.28);
    border: 2px solid var(--ink); border-radius: 2px;
    box-shadow: 2px 2px 0 rgba(43, 39, 34, 0.16);
    transform: rotate(0.5deg);
  }
  .daily-btn:hover { background: rgba(91, 135, 184, 0.42); }

  /* "Not done today" state: a sketchy dashed ink border over a warm paper tint, with
     13 twinkling margin stars and a pinned sticky note — unmistakable next to the gold
     primary. Resets to the solid denim resting state (rules above) once played. */
  .daily-btn.undone {
    background: rgba(224, 120, 48, 0.12);
    border-style: dashed;
  }
  .daily-btn.undone:hover { background: rgba(224, 120, 48, 0.2); }
  /* Played-today resting state: dimmed and desaturated (not disabled — it still
     opens today's result), brightening back to full on hover. */
  .daily-btn.done { opacity: 0.66; filter: saturate(0.9); }
  .daily-btn.done:hover { opacity: 1; filter: none; }
  .daily-btn .daily-label { position: relative; z-index: 2; }
  .daily-btn .daily-streak-inline {
    display: block; position: relative; z-index: 2; margin-top: 3px;
    font-family: var(--type); font-weight: 400; font-size: 11px; letter-spacing: 0.5px;
    color: var(--ink-soft);
  }
  .daily-btn .daily-star {
    position: absolute; z-index: 1; pointer-events: none;
    font-family: var(--hand); font-size: 15px; line-height: 1; color: #e07830;
    transform: translate(-50%, -50%);
  }
  @media (prefers-reduced-motion: no-preference) {
    .daily-btn .daily-star { animation: dailyStarTwinkle 1.9s ease-in-out infinite; }
  }
  @keyframes dailyStarTwinkle {
    0%, 100% { opacity: 0.35; transform: translate(-50%, -50%) scale(0.8); }
    50%      { opacity: 1;    transform: translate(-50%, -50%) scale(1.18); }
  }
  .daily-btn .daily-tab {
    position: absolute; top: -14px; right: -8px;
    font-family: var(--hand); font-weight: 700; font-size: 15px; letter-spacing: 0;
    color: #5a3a3a; background: #f4e58a;
    padding: 5px 12px; transform: rotate(6deg);
    box-shadow: 1px 2px 4px rgba(43, 39, 34, 0.22);
  }
  @media (prefers-reduced-motion: no-preference) {
    .daily-btn.undone .daily-tab { animation: dailyTabNudge 2.6s ease-in-out infinite; }
  }
  @keyframes dailyTabNudge {
    0%, 92%, 100% { transform: rotate(6deg); }
    96% { transform: rotate(2deg); }
  }
  /* Left-side "next in …" reset countdown — a denim sticky note (distinct from the
     yellow done note), mirrored to the left. Inherits the .done dimming + hover. */
  .daily-btn .daily-countdown {
    position: absolute; top: -14px; left: -8px; z-index: 3;
    font-family: var(--hand); font-weight: 700; font-size: 15px; letter-spacing: 0;
    color: #2e3f52; background: #cfe0ef;
    padding: 5px 12px; transform: rotate(-6deg);
    box-shadow: -1px 2px 4px rgba(43, 39, 34, 0.22);
  }

  /* records / charms / stats — three taped index cards pinned to the page. Each is a
     real notebook keepsake: cream card stock, faint paper grain (::after), a strip of
     era-tinted washi tape (::before), a hand-built SVG icon seated on a tinted disc, a
     Caveat title with the carried-over dotted underline, and a Courier kicker. The era
     tint (gold/lavender/denim) is set per card via [data-era-tint]; --card-bg feeds the
     bracelet-knot fill in the markup's inline SVG. */
  /* Pull the row a touch wider than the ruled text column (negative side margins)
     so the cards read landscape and the titles fit on one line; the corner tape
     sitting over the red margin rule looks intentionally pinned-over-the-edge. */
  .see-also { display: flex; justify-content: center; align-items: stretch; gap: 14px; margin: 22px -12px 0; }
  /* Companion-tool entry: the lyrics searcher lives on its own page, so it reads as a
     margin note rather than one of the data nav-cards. Typewriter label, red-pen
     magnifier (matching the searcher), a hand-drawn underline that fills on hover. */
  .search-link {
    display: inline-flex; align-items: center; gap: 9px;
    margin: 16px auto 0; padding: 6px 4px 5px; width: fit-content;
    text-decoration: none; color: var(--ink-soft);
    border-bottom: 1.5px dashed rgba(178, 58, 58, 0.32);
    transition: color 0.16s ease, border-color 0.16s ease;
  }
  .search-link-ic { width: 17px; height: 17px; color: rgba(178, 58, 58, 0.85); flex: none; }
  .search-link-label { font-family: var(--type); font-size: 12px; letter-spacing: 0.04em; }
  .search-link-arrow { font-family: var(--type); font-size: 12px; opacity: 0; transform: translateX(-4px); transition: opacity 0.16s ease, transform 0.16s ease; }
  .search-link:hover, .search-link:focus-visible {
    color: var(--ink); border-bottom-color: rgba(178, 58, 58, 0.7); outline: none;
  }
  .search-link:hover .search-link-arrow, .search-link:focus-visible .search-link-arrow { opacity: 0.7; transform: translateX(0); }
  .nav-card {
    --card-bg: #fbf6e9;
    flex: 1; min-width: 0; width: auto; margin: 0;
    padding: 18px 10px 14px; text-align: center;
    color: var(--ink);
    /* paper grain baked into the card background (background-blend multiply keeps the
       speckle subtle) so both pseudo-elements are free to carry tape strips */
    background-color: var(--card-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='90' height='90' filter='url(%23n)' opacity='0.16'/%3E%3C/svg%3E");
    background-size: 90px 90px;
    background-blend-mode: multiply;
    border: 1px solid rgba(43, 39, 34, 0.2); border-radius: 3px;
    position: relative; box-shadow: 0 1px 2px rgba(43, 39, 34, 0.1);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
  }
  .nav-card[data-era-tint="gold"]     { --tint: 199, 149, 31; }
  .nav-card[data-era-tint="lavender"] { --tint: 139, 115, 201; }
  .nav-card[data-era-tint="denim"]    { --tint: 91, 135, 184; }
  .nav-card[data-era-tint="graphite"] { --tint: 43, 39, 34; }
  /* Sticky tape — OPAQUE pastel washi (a cream backing under a half-strength tint wash,
     plus a diagonal sheen), so the card never shows through. ::before is the primary
     strip, ::after an optional second strip; placement varies per card below so the row
     doesn't read as a repeated template. */
  /* ===== Shared realistic washi-tape surface =====================================
     One look, reused everywhere the site shows sticky tape: the nav keepsake cards
     (.nav-tape, injected + randomly torn per visit by app.js), the Records page
     personal-best tiles (.pb-tile::before), and the in-game suggestion dropdown
     (.dropdown .item::before). Realism comes from four physical cues rather than a flat
     gradient:
       · frosted TRANSLUCENCY — warm-white base + half-strength tint let the ruled paper
         read faintly through the strip, the way real semi-matte tape does;
       · a soft cast SHADOW via drop-shadow() (follows the torn silhouette, so the strip
         visibly lifts off the page);
       · a diagonal WRINKLE highlight + faint crease, so light catches an uneven surface;
       · longitudinal FIBRE grain + a bright top edge / shaded bottom edge for thickness.
     Per-context knobs: --tape-color (any CSS colour) tints the strip; --tape-clip
     supplies the hand-torn outline (nav strips set a fresh random one inline; the tiles
     and dropdown cycle a few preset tears below). */
  .nav-tape,
  .pol-tape,
  .pb-tile::before,
  .dropdown .item::before {
    background:
      /* diagonal wrinkle: a bright sheen band then a faint shadow crease */
      linear-gradient(102deg,
        rgba(255, 255, 255, 0) 26%, rgba(255, 255, 255, 0.30) 40%, rgba(255, 255, 255, 0) 52%,
        rgba(43, 39, 34, 0.05) 66%, rgba(255, 255, 255, 0.14) 78%, rgba(255, 255, 255, 0) 90%),
      /* fine paper fibre running along the strip */
      repeating-linear-gradient(90.5deg, rgba(74, 62, 42, 0.05) 0 1px, rgba(255, 255, 255, 0.025) 1px 3px),
      /* the tint (color-mix so any plain colour can drive it, e.g. the tile's accent) */
      linear-gradient(
        color-mix(in srgb, var(--tape-color, #c9b27a) 37%, transparent),
        color-mix(in srgb, var(--tape-color, #c9b27a) 29%, transparent)),
      /* frosted translucent base (lets the page show through, but still clearly present) */
      rgba(252, 248, 238, 0.62);
    box-shadow:
      inset 0 0.5px 0 rgba(255, 255, 255, 0.6),
      inset 0 -1px 1px rgba(43, 39, 34, 0.06);
    filter:
      drop-shadow(0 1px 1.2px rgba(43, 39, 34, 0.30))
      drop-shadow(0 0.5px 0.5px rgba(43, 39, 34, 0.16));
    clip-path: var(--tape-clip,
      polygon(5% 0%, 96% 0%, 91% 20%, 97% 40%, 88% 60%, 96% 80%, 90% 100%, 8% 100%, 4% 80%, 10% 60%, 3% 40%, 7% 20%));
  }
  /* Preset hand-torn outlines, cycled so neighbouring tiles/dropdown rows differ. */
  .pb-tile:nth-child(3n+2)::before,
  .dropdown .item:nth-child(3n+2)::before {
    --tape-clip: polygon(4% 0%, 95% 0%, 99% 25%, 90% 50%, 97% 75%, 93% 100%, 6% 100%, 10% 75%, 2% 50%, 9% 25%);
  }
  .pb-tile:nth-child(3n)::before,
  .dropdown .item:nth-child(3n)::before {
    --tape-clip: polygon(8% 0%, 92% 0%, 96% 33%, 89% 66%, 97% 100%, 7% 100%, 3% 66%, 11% 33%);
  }
  /* Geometry + tint for the nav-card strips (size/transform/clip are overridden inline). */
  .nav-tape {
    position: absolute; z-index: 3; width: 50px; height: 16px; pointer-events: none;
    --tape-color: rgb(var(--tint));
  }
  .nav-card-seat {
    width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 8px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(var(--tint), 0.13);
  }
  .nav-ic { display: block; }
  .nav-card-title {
    display: inline-block; font-family: var(--hand); font-weight: 700;
    font-size: 18px; line-height: 0.95; color: var(--ink); white-space: nowrap;
    border-bottom: 2px dotted var(--ink-soft); padding-bottom: 3px;
  }
  .nav-card-kicker {
    display: block; margin-top: 7px;
    font-family: var(--type); font-size: 8.5px; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--ink-soft);
  }
  .nav-card:hover, .nav-card:focus-visible {
    transform: translateY(-2px); box-shadow: 0 4px 9px rgba(43, 39, 34, 0.16);
    outline: none;
  }
  .nav-card:hover .nav-card-seat, .nav-card:focus-visible .nav-card-seat {
    background: rgba(var(--tint), 0.22);
  }
  .nav-card:hover .nav-card-title, .nav-card:focus-visible .nav-card-title { border-bottom-color: var(--ink); }
  .nav-card:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(43, 39, 34, 0.1); }
  [data-reduce-motion="true"] .nav-card { transition: none; }
  [data-reduce-motion="true"] .nav-card:hover, [data-reduce-motion="true"] .nav-card:focus-visible { transform: none; }
  @media (max-width: 480px) {
    .see-also { gap: 7px; margin: 18px -10px 0; }
    .nav-card { padding: 14px 5px 11px; }
    .nav-card-seat { width: 46px; height: 46px; }
    .nav-ic { width: 38px; height: 38px; }
    .nav-card-title { font-size: 16px; }
    .nav-card-kicker { font-size: 7.5px; letter-spacing: 1px; }
  }

  /* Album-focus corner badge — a colour-wheel of the 12 albums (gold star centre),
     pinned to the top-right corner of the start page, bleeding slightly over the edge
     like a sticker. Replaces the old "album focus" keepsake card in the .see-also row.
     Keeps id="albumFocusBtn" so the existing click handler (→ openAlbumFocus) is unchanged. */
  .album-focus-badge {
    position: absolute; top: 12px; right: 12px; z-index: 6;
    width: 50px; height: 50px; padding: 0; margin: 0; line-height: 0;
    background: none; border: none; cursor: pointer; border-radius: 50%;
    filter: drop-shadow(0 2px 3px rgba(43, 39, 34, 0.28));
    transition: transform 0.18s ease, filter 0.18s ease;
  }
  .album-focus-badge svg { display: block; }
  /* caption hidden by default — surfaces as a small ink label on hover/focus */
  .album-focus-badge-cap {
    position: absolute; top: 100%; right: 0; margin-top: 3px;
    font-family: var(--type); font-size: 8.5px; letter-spacing: 1.2px;
    text-transform: uppercase; color: var(--ink-soft); white-space: nowrap;
    opacity: 0; transform: translateY(-3px); pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }
  .album-focus-badge:hover, .album-focus-badge:focus-visible {
    transform: rotate(-7deg) scale(1.07);
    filter: drop-shadow(0 4px 7px rgba(43, 39, 34, 0.34));
    outline: none;
  }
  .album-focus-badge:hover .album-focus-badge-cap,
  .album-focus-badge:focus-visible .album-focus-badge-cap { opacity: 1; transform: translateY(0); }
  .album-focus-badge:active { transform: scale(0.97); }
  [data-reduce-motion="true"] .album-focus-badge { transition: none; }
  [data-reduce-motion="true"] .album-focus-badge:hover,
  [data-reduce-motion="true"] .album-focus-badge:focus-visible { transform: none; }
  @media (max-width: 480px) {
    .album-focus-badge { width: 44px; height: 44px; top: 9px; right: 9px; }
  }

  /* Daily-streak status line under the streak numbers on the Stats page. */
  .daily-streak-note { font-family: var(--type); font-size: 11px; letter-spacing: 0.5px; color: var(--ink-soft); text-align: center; margin-top: 8px; }

  /* Daily calendar on the Stats page — current month, today ringed in green
     marker, completed days struck out with hand-inked red marker X's. */
  .daily-cal { margin-top: 16px; }
  .cal-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; padding: 0 2px; }
  .cal-month { font-family: var(--hand); font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1; }
  .cal-year { font-family: var(--type); font-size: 12px; letter-spacing: 1px; color: var(--ink-soft); }
  .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
  .cal-dow { text-align: center; font-family: var(--type); font-size: 10px; letter-spacing: 0.5px; color: var(--ink-soft); padding-bottom: 4px; }
  .cal-cell { position: relative; height: 40px; display: flex; align-items: center; justify-content: center; }
  .cal-num { font-family: var(--type); font-size: 14px; color: var(--ink); position: relative; z-index: 1; }
  .cal-future .cal-num { color: rgba(43, 39, 34, 0.3); }
  .cal-today .cal-num { font-weight: 700; }
  .cal-ink { position: absolute; left: 5px; right: 5px; top: 5px; bottom: 5px; pointer-events: none; }
  .cal-mark { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }

  /* Share/copy button on the results screen — sits just below the bracelet. */
  .daily-share-btn { display: block; width: 100%; margin: 14px 0 10px; padding: 11px; font-size: 13px; letter-spacing: 1px; color: var(--ink-accent); border-color: var(--ink-accent); }
  .daily-share-btn:hover { background: var(--highlighter); border-style: solid; color: var(--ink); }

  /* Reduced motion is attribute-driven so the in-app "reduce motion" setting can
     OVERRIDE the OS preference (force ON beats a media query; force OFF restores
     motion). app.js's applySettings() sets data-reduce-motion to the effective
     value: the setting when explicit, else the OS preference. */
  body[data-reduce-motion="on"] .screen.active { animation: none; }
  body[data-reduce-motion="on"] .b-halo,
  body[data-reduce-motion="on"] .charm-dangle,
  body[data-reduce-motion="on"] .charm-dangle.fresh { animation: none; }
  body[data-reduce-motion="on"] .word-wrap { animation: none; }
  body[data-reduce-motion="on"] .margin-tally.show { animation: none; opacity: 0.9; }
  body[data-reduce-motion="on"] .life-mark.spent::after { animation: none; }
  body[data-reduce-motion="on"] .rarity-stamp.show { animation: none; opacity: 0.58; transform: rotate(7deg) scale(1); }
  body[data-reduce-motion="on"] .cc-ring { animation: none; stroke-dashoffset: 0; }
  body[data-reduce-motion="on"] .page-flip-sheet { display: none; }
  body[data-reduce-motion="on"] .card,
  body[data-reduce-motion="on"] .timer-fill,
  body[data-reduce-motion="on"] .word::before,
  body[data-reduce-motion="on"] .histogram-bar { transition: none; }
  /* easter eggs: show statically, no motion */
  body[data-reduce-motion="on"] .doodle,
  body[data-reduce-motion="on"] .doodle-note { animation: none; opacity: 0.5; }
  body[data-reduce-motion="on"] .doodle.snake .ink { animation: none; stroke-dashoffset: 0; }
  body[data-reduce-motion="on"] .secret-13 { animation: none; opacity: 1; }
  body[data-reduce-motion="on"] .blue-wash { animation: none; opacity: 0.16; }
  body[data-reduce-motion="on"] .sparkle,
  body[data-reduce-motion="on"] .star-shower,
  body[data-reduce-motion="on"] .twinkle-layer,
  body[data-reduce-motion="on"] .shine-sweep { display: none; }
  body[data-reduce-motion="on"] .card.perfect { animation: none; }
  body[data-reduce-motion="on"] .card.perfect .final-score .big { animation: none; -webkit-text-fill-color: var(--ink); color: var(--ink); }
  body[data-reduce-motion="on"] .toast,
  body[data-reduce-motion="on"] .toast.leaving { animation: none; }
  body[data-reduce-motion="on"] .desk-steam path,
  body[data-reduce-motion="on"] .desk-sway { animation: none; }
  body[data-reduce-motion="on"] .desk-steam { opacity: 0.3; }
  /* vignette stays (it's a colour/state change, not motion) */

  /* Animation speed — "fast" roughly halves the page-turn / pen-circle timings.
     "instant" is handled in JS (those animations are skipped outright). */
  body[data-anim-speed="fast"] .page-flip-sheet,
  body[data-anim-speed="fast"] .page-flip-sheet .flip-shade { animation-duration: 0.25s; }
  body[data-anim-speed="fast"] .cc-ring { animation-duration: 0.28s; }
  body[data-anim-speed="instant"] .screen.active { animation: none; }

  /* High contrast — darker ink, whiter paper, a bolder margin rule, and punchier
     era accents. Layered after the era palettes so it wins. */
  body[data-contrast="high"] {
    --paper: #ffffff;
    --paper-edge: #f0f0f0;
    --ink: #000000;
    --ink-soft: #3a3a3a;
    --rule: rgba(0, 0, 0, 0.14);
    --margin: rgba(190, 0, 0, 0.85);
  }
  body[data-contrast="high"][data-era="gold"]     { --ink-accent:#7a5300; --highlighter:rgba(230,180,0,0.7);  --bead:#7a5300; }
  body[data-contrast="high"][data-era="lavender"] { --ink-accent:#3f2c80; --highlighter:rgba(150,120,225,0.7); --bead:#3f2c80; }
  body[data-contrast="high"][data-era="red"]      { --ink-accent:#8a0008; --highlighter:rgba(210,40,45,0.6);  --bead:#8a0008; }
  body[data-contrast="high"][data-era="denim"]    { --ink-accent:#0d3f73; --highlighter:rgba(60,130,200,0.65); --bead:#0d3f73; }
  body[data-contrast="high"][data-era="graphite"] { --ink-accent:#222222; --highlighter:rgba(90,90,90,0.6);   --bead:#222222; }
  body[data-contrast="high"][data-era="midnight"] { --ink-accent:#101d4d; --highlighter:rgba(60,80,170,0.6);  --bead:#101d4d; }

  /* =========================================================
     SETTINGS — gear button, modal, and notebook-style controls
     ========================================================= */
  .settings-gear {
    position: fixed; top: 14px; right: 14px; z-index: 60;
    width: 42px; height: 42px; padding: 8.5px; border-radius: 50%;
    color: #5c4326; background: rgba(245, 239, 225, 0.82);
    border: 1.5px solid rgba(43, 39, 34, 0.32);
    box-shadow: 0 2px 6px rgba(60, 50, 35, 0.22);
    transition: transform 0.18s ease, background 0.18s, color 0.18s;
  }
  .settings-gear svg { display: block; width: 100%; height: 100%; }
  .settings-gear:hover { background: var(--highlighter); transform: scale(1.08); }
  @media (min-width: 1040px) { .settings-gear { top: 18px; right: 22px; } }

  .settings-modal { position: fixed; inset: 0; z-index: 200; display: none; }
  .settings-modal.open { display: block; }
  .settings-scrim { position: absolute; inset: 0; background: rgba(34, 24, 12, 0.5); animation: fade 0.25s ease; }
  .settings-card {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: min(540px, calc(100vw - 28px)); max-height: calc(100vh - 40px); overflow-y: auto;
    overscroll-behavior: contain;   /* don't chain scroll to the page behind */
    padding: 22px 24px 28px 48px;
    --rule-x: 34px;   /* nudge the red margin rule left so it isn't squished against the text */
  }
  /* Freeze the page behind an open modal so the background can't scroll. */
  body.modal-open { overflow: hidden; }
  body[data-reduce-motion="on"] .settings-scrim { animation: none; }

  .settings-nav {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px dashed rgba(43, 39, 34, 0.2);
  }
  .settings-title { font-family: var(--hand); font-weight: 700; font-size: 28px; color: var(--ink); transform: rotate(-0.8deg); }
  .btn-link {
    font-family: var(--type); font-size: 12px; letter-spacing: 1px; color: var(--ink-soft);
    background: transparent; border: none; cursor: pointer; padding: 4px 6px;
  }
  .btn-link:hover { color: var(--ink); }

  .set-section { margin: 0 0 18px; }
  .set-section-title {
    font-family: var(--type); font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase;
    color: var(--ink-soft); margin: 0 0 8px; padding-bottom: 4px;
  }
  .set-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 7px 0; min-height: 30px; border-bottom: 1px solid var(--rule);
    flex-wrap: wrap;
  }
  .set-row:last-child { border-bottom: none; }
  .set-label { display: flex; flex-direction: column; gap: 1px; }
  .set-name { font-family: var(--hand); font-size: 20px; line-height: 1.1; color: var(--ink); }
  .set-desc { font-family: var(--type); font-size: 10.5px; color: var(--ink-soft); }
  .set-control { flex: 0 0 auto; }

  /* on/off toggle — an inked switch */
  .set-toggle {
    position: relative; width: 46px; height: 25px; border-radius: 13px;
    border: 1.5px solid var(--ink-soft); background: var(--paper-edge); cursor: pointer; padding: 0;
  }
  .set-toggle::after {
    content: ""; position: absolute; top: 1.5px; left: 1.5px; width: 19px; height: 19px;
    border-radius: 50%; background: var(--ink-soft); transition: transform 0.16s ease, background 0.16s;
  }
  .set-toggle[aria-pressed="true"] { background: var(--highlighter); border-color: var(--ink); }
  .set-toggle[aria-pressed="true"]::after { transform: translateX(21px); background: var(--ink); }
  body[data-reduce-motion="on"] .set-toggle::after { transition: none; }

  /* multi-choice — reuse the notebook tab look, compact */
  .set-choice { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .set-choice .mode-tab { font-size: 16px; padding: 4px 9px 5px; border-bottom: 1.5px solid rgba(43,39,34,0.18); border-radius: 5px; transform: none; }
  .set-choice .mode-tab:nth-child(even) { transform: none; }
  .set-choice .mode-tab.active { transform: none; }

  /* notebook-name text field */
  .set-text {
    font-family: var(--hand); font-size: 18px; line-height: 1.4; width: 150px; text-align: right;
    border: none; border-bottom: 1.5px solid var(--ink-soft); background: transparent;
    /* Caveat's ink overhangs the advance width (a final f/l/d/t exit stroke runs
       well past it, and some glyphs are wider than their metrics); inputs clip at the
       border box, so pad the sides generously to keep the last (or, for the
       left-aligned sign field, first) glyph's flourish from being sliced off. */
    color: var(--ink); outline: none; padding: 2px 14px 15px;
  }
  .set-text:focus { border-bottom-color: var(--ink-accent); }
  .set-text::placeholder { color: var(--ink-soft); opacity: 0.7; }

  /* ---------- "Your name" flyleaf nameplate ----------
     The signature is the marquee setting, so it gets its own bookplate instead of
     a plain row: a cream index-card patch, a "this notebook belongs to" kicker, the
     name written large on a signature rule, and a heart-hands end-cap. The big line
     IS the input (id stays #set-playerName so the existing change handler is reused). */
  .nameplate {
    /* z-index lifts the whole bookplate above the card's ::after tension vignette
       (z-index 5) so the signature can never be painted over. */
    position: relative; z-index: 10; background: rgba(251, 247, 234, 0.93);
    border: 1px solid rgba(43, 39, 34, 0.16); border-radius: 3px;
    padding: 14px 18px 15px; margin: 2px 0 4px; transform: rotate(-0.4deg);
    box-shadow: 0 1px 0 rgba(43, 39, 34, 0.06);
  }
  .np-kicker {
    font-family: var(--type); font-size: 11px; letter-spacing: 0.5px;
    color: var(--ink-soft); margin: 0;
  }
  .np-sigrow {
    display: flex; align-items: flex-end; gap: 10px; margin-top: 4px;
    border-bottom: 1.5px solid var(--ink); padding-bottom: 2px;
  }
  .np-sigrow:focus-within { border-bottom-color: var(--ink-accent); }
  .np-name-input {
    flex: 1; min-width: 0; font-family: var(--hand); font-weight: 700;
    /* An <input> clips its text to its own box. At 38px, Caveat's descenders
       (g/y/p/j tails) hang below a tight line-box and get sliced off at the
       signature rule — so the line-height must be tall enough to contain them
       (1.05 clipped; 1.3 clears even an all-descender name). The row's reduced
       padding-bottom keeps the baseline sitting on the rule. */
    font-size: 38px; line-height: 1.3; color: var(--ink);
    background: transparent; border: none; outline: none;
    /* Caveat's exit strokes overhang the advance width — pad so the first/last
       glyph's flourish isn't clipped at the input's border box. */
    padding: 0 8px;
    /* keep the name itself on the very top layer of the plate, above the
       heart-hands sibling, so nothing can ever overlap or clip it. */
    position: relative; z-index: 200;
  }
  .np-name-input::placeholder { color: var(--ink-soft); opacity: 0.55; }
  /* fixed-size decoration: the flex row always reserves its space so the name's input
     box sits entirely to the left of it and can never be overlapped; it's also a layer
     below the name as a belt-and-suspenders guard. */
  .np-hands { flex: 0 0 auto; position: relative; z-index: 1; color: var(--ink-accent); margin-bottom: 3px; }
  .np-hint {
    font-family: var(--type); font-size: 10.5px; color: var(--ink-soft);
    margin: 7px 2px 0;
  }

  /* timezone select — typewriter-styled to match the notebook's functional layer.
     padding-right reserves room for the native arrow so it never overlaps the label,
     and the long zone names clip with an ellipsis instead of spilling. */
  .set-select {
    font-family: var(--type); font-size: 13px;
    max-width: 340px; width: 100%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: var(--ink); background: var(--page-wash, #efe7d2);
    border: 1.5px solid var(--ink-soft); border-radius: 2px;
    padding: 4px 30px 4px 8px; outline: none; cursor: pointer;
  }
  .set-select:focus { border-color: var(--ink-accent); }

  /* countdown slider */
  .set-slider-row { display: flex; align-items: center; gap: 10px; }
  .set-slider { width: 130px; accent-color: var(--ink-accent); cursor: pointer; }
  .set-slider-val { font-family: var(--type); font-size: 14px; color: var(--ink-accent); min-width: 26px; text-align: right; }

  .set-actions { display: flex; gap: 10px; flex-wrap: wrap; }
  .set-actions .btn-ghost { width: auto; flex: 1 1 0; margin-top: 0; }

  /* danger zone — set apart with a torn red border */
  .set-danger { margin: 22px 0; border: 1.5px dashed var(--margin); border-radius: 3px; padding: 14px 16px 16px; }
  .set-danger .set-section-title { color: var(--margin); }
  .set-danger-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .danger-btn {
    font-family: var(--type); font-size: 12px; letter-spacing: 0.5px; color: var(--margin);
    background: transparent; border: 1.4px solid var(--margin); border-radius: 2px; padding: 9px 8px; cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }
  .danger-btn:hover { background: rgba(178, 58, 58, 0.12); }
  .danger-btn.armed { background: var(--margin); color: #fff; font-weight: 700; }
  .danger-btn.wipe { grid-column: 1 / -1; }

  .set-about { font-family: var(--type); font-size: 11.5px; color: var(--ink-soft); line-height: 1.5; }
  .set-about a { color: var(--ink-accent); }
  .set-about p { margin: 4px 0; }

  /* Three pinned sticky notes — quick links out (code / Taylor / ELLE).
     The outer <a> carries the pin, the hover arrow and the drop-shadow; the inner
     .about-note-paper carries the colour + an irregular torn-paper clip-path (so the
     pin/arrow aren't clipped). filter:drop-shadow traces the wobbly silhouette. */
  .about-notes {
    display: flex; flex-wrap: wrap; gap: 18px 16px;
    justify-content: center; margin: 18px 4px 6px;
  }
  .about-note {
    position: relative; flex: 0 1 138px; min-width: 120px;
    text-decoration: none; text-align: center;
    filter: drop-shadow(1px 3px 4px rgba(0,0,0,0.34));
    transition: transform 0.16s ease, filter 0.16s ease;
  }
  .about-note--gh   { transform: rotate(-2.4deg); }
  .about-note--ts   { transform: rotate(1.8deg); }
  .about-note--elle { transform: rotate(-1deg); }
  .about-note:hover {
    transform: translateY(-3px) rotate(0deg);
    filter: drop-shadow(2px 6px 8px rgba(0,0,0,0.36));
  }
  .about-note:focus-visible { outline: 2px solid var(--ink-accent); outline-offset: 4px; }

  /* the paper itself — colour, padding, torn edges, a faint top-light/bottom-curl */
  .about-note-paper {
    display: flex; flex-direction: column; align-items: center; gap: 9px;
    width: 100%; padding: 20px 12px 16px;
    box-shadow: inset 0 2px 5px -3px rgba(255,255,255,0.45),
                inset 0 -8px 12px -7px rgba(0,0,0,0.28);
  }
  .about-note--gh   .about-note-paper { clip-path: polygon(2% 2.5%, 30% 1%, 58% 2.2%, 99% 1.4%, 98% 30%, 99.5% 58%, 98.4% 99%, 60% 97.4%, 28% 99%, 1.5% 98%, 1% 62%, 2.6% 30%); }
  .about-note--ts   .about-note-paper { clip-path: polygon(1% 1.5%, 28% 2.6%, 55% 0.8%, 98.6% 2.4%, 97.6% 33%, 99% 60%, 98% 98.6%, 62% 98%, 30% 99.2%, 2% 97.4%, 1.6% 64%, 0.8% 32%); }
  .about-note--elle .about-note-paper { clip-path: polygon(2% 2%, 32% 0.8%, 60% 2.3%, 98% 1%, 99% 34%, 97.8% 62%, 99% 98%, 58% 99%, 27% 97.4%, 1.5% 98.8%, 2.2% 60%, 1% 33%); }

  /* a little gold pin head pressed into the top of each note */
  .about-note::before {
    content: ""; position: absolute; top: -5px; left: 50%; transform: translateX(-50%);
    width: 11px; height: 11px; border-radius: 50%; z-index: 3;
    background: radial-gradient(circle at 36% 30%, #ffe08a, #d8a32f 60%, #9c6e14);
    box-shadow: 0 2px 3px rgba(0,0,0,0.45);
  }
  /* a "↗" that slides in at the top-right on hover */
  .about-note::after {
    content: "\2197"; position: absolute; top: 6px; right: 9px; z-index: 3;
    font-family: var(--type); font-weight: 700; font-size: 15px; line-height: 1;
    color: var(--note-arrow, rgba(0,0,0,0.55));
    opacity: 0; transform: translate(-3px, 3px);
    transition: opacity 0.16s ease, transform 0.16s ease; pointer-events: none;
  }
  .about-note:hover::after { opacity: 1; transform: translate(0, 0); }

  .about-note-ico { width: 32px; height: 32px; display: block; }
  .about-note-lbl { font-family: var(--hand); font-weight: 700; font-size: 18px; line-height: 1.05; }

  /* GitHub — a near-black note, white octocat */
  .about-note--gh { --note-arrow: #f3f3f0; }
  .about-note--gh .about-note-paper { background: #0a0d12; }
  .about-note--gh .about-note-ico path { fill: #f3f3f0; }
  .about-note--gh .about-note-lbl { color: #f3f3f0; }

  /* Taylor's website — a warm orange note with an aquamarine signature + label.
     Flat (no glitter), softened orange + a gentle top-light so it sits with the set
     instead of shouting. */
  .about-note--ts { --note-arrow: #34dcc0; }
  .about-note--ts .about-note-paper {
    background: linear-gradient(160deg, #d9622f 0%, #c45324 58%, #b04a1f 100%);
  }
  .about-note--ts .about-note-sig {
    width: 84px; height: auto; display: block; margin: 4px 0 2px;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3));
  }
  .about-note--ts .about-note-sig path { fill: #34dcc0; }
  .about-note--ts .about-note-lbl { color: #34dcc0; text-shadow: 0 1px 2px rgba(0,0,0,0.25); }

  /* ELLE's Song Association — a warm rose note with the YouTube logo */
  .about-note--elle { --note-arrow: #8a2b22; }
  .about-note--elle .about-note-paper { background: #f0d3d3; }
  .about-note--elle .about-note-ico--yt path { fill: #d6342a; }
  .about-note--elle .about-note-lbl { color: #8a2b22; }

  @media (prefers-reduced-motion: reduce) {
    .about-note, .about-note::after { transition: none; }
  }
  .set-note { font-family: var(--type); font-size: 10px; color: var(--ink-soft); font-style: italic; }
