/* prov: 2026-09-26 claude-opus-5-5 edited (from git trailer; backfilled 2026-09-30); 2026-09-27 claude-opus-5-5 edited (from git trailer; backfilled 2026-09-30) | fable_review: pending */
/* ============================================================
   The Mnemonicon — the memory room of the Wordhoard.
   WORDHOARD THEME v1 (adopted 2026-07-29, integrated 2026-07-30):
   IM Fell English / IM Fell English SC / Courier Prime on the
   warm parchment ground shared by every room of the suite
   (canonical tokens: thewordhoard-site/wordhoard-theme.css).
   The room keeps its own furniture — plaque masthead, gauge
   plates, the typed record, the control panel — re-cast from
   municipal navy into parchment, ink, oxblood, and gold.
   All layout, touch-target, and responsiveness behavior is
   preserved from the prior design.
   ============================================================ */

:root {
  /* ---- Wordhoard theme v1 — canonical tokens ---- */
  --parchment: #f9f6f0;       /* the shared ground */
  --parchment-deep: #eeeae1;  /* recessed surfaces */
  --ink: #2b2621;             /* warm dark-brown ink */
  --ink-deep: #1b1712;
  --ink-soft: #5b5247;
  --oxblood: #872e26;         /* the accent — danger, urgency, the red wax */
  --gold: #7a6021;            /* the metallic — rules, rings, commendations */
  --rule: #d4c8b8;            /* hairlines */
  --card: #fffcf4;            /* raised paper — forms, records, flashcards */
  --green: #31513a;           /* "holding firm" — memorized, good */

  /* ---- legacy aliases (older token names used below) ---- */
  --cream: var(--parchment);
  --cream-dark: var(--parchment-deep);
  --accent: var(--oxblood);
  --crimson: var(--oxblood);
  --line: var(--rule);
  --paper: var(--card);
  --parchment-dark: var(--parchment-deep);
  --parchment-light: var(--parchment);

  /* ---- type ---- */
  --serif: 'IM Fell English', 'Palatino Linotype', Palatino, Georgia, serif;
  --serif-sc: 'IM Fell English SC', 'IM Fell English', Georgia, serif;
  --mono: 'Courier Prime', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --stencil: var(--serif-sc);      /* signage — was Nimbus Sans */
  --typewriter: var(--mono);       /* documents — the typed record */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--parchment);
  /* the suite's parchment vignette — light at the head, shaded at the edges */
  background-image: radial-gradient(ellipse at 50% 0%,
    rgba(255,255,255,0.4), rgba(43,38,33,0.055) 130%);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;                /* never allow sideways scroll */
  /* keep content clear of iPad/iPhone notches and home bars */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

main { max-width: 720px; margin: 0 auto; padding: 1rem 1.25rem 4rem; }

/* comfortable touch targets everywhere (Apple's 44px guideline) */
button {
  min-height: 44px;
  touch-action: manipulation;        /* no double-tap zoom delay on buttons */
}

/* ---------- the hoard-mark: the front door's crest, echoed here ----------
   thewordhoard.com opens every page on a centered gold ❦ above the
   title. Same glyph, same color, so this room reads as part of the
   same house the moment it loads. */
.hoard-mark {
  text-align: center;
  color: var(--gold);
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

/* ---------- masthead: the room's titulus over a double rule ----------
   Rule color matches the front door's own card/header convention
   (--rule, not --ink) — confirmed against thewordhoard.com and
   Patrimonium's header, both 3px double var(--rule). */
.masthead {
  text-align: center;
  padding: 1.6rem 1rem 0;
  background: transparent;
  color: var(--ink);
  border-bottom: 3px double var(--rule);
}
.masthead h1 {
  margin: 0;
  font-family: var(--serif-sc);
  font-weight: 400;
  font-size: 2.4rem;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.tagline {
  margin: 0.15rem 0 0.9rem;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.5rem; }
.nav-btn {
  font-family: var(--serif-sc);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  background: none; border: none; border-bottom: 4px solid transparent;
  padding: 0.4rem 1rem; cursor: pointer; color: var(--ink-soft);
}
.nav-btn.active { color: var(--ink); border-bottom-color: var(--gold); }

.badge {
  background: var(--oxblood); color: var(--parchment);
  border-radius: 999px; padding: 0 0.5em; font-size: 0.8em;
  font-family: var(--serif);
}

/* ---------- stats: the gauge plates ----------
   Same border recipe as the front door's room cards —
   3px double var(--rule) on --parchment-deep — just scaled down
   to a compact tile instead of a full nav card. */
.stats-row {
  display: flex; gap: 0.75rem; flex-wrap: wrap;
  justify-content: center; margin: 1.25rem 0;
}
.stat {
  background: var(--parchment-deep);
  border: 3px double var(--rule);
  padding: 0.4rem 0.9rem; text-align: center; min-width: 90px;
}
.stat b { display: block; font-size: 1.35rem; font-family: var(--serif-sc); font-weight: normal; }
.stat span {
  font-size: 0.72rem; color: var(--ink-soft);
  font-family: var(--serif-sc); letter-spacing: 0.1em;
}

/* ---------- streak: a quiet commendation under the gauges ---------- */
.streak-note {
  text-align: center; margin: -0.75rem 0 1rem;
  font-family: var(--serif-sc); letter-spacing: 0.1em;
  font-size: 0.78rem; color: var(--green);
}

/* ---------- toolbar & buttons ---------- */
.toolbar { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.spacer { flex: 1; }

/* ---------- search: the card-catalog drawer ---------- */
.search-row { margin-bottom: 0.75rem; }
.search-row input { margin-top: 0; font-size: 0.95rem; }

button { font-family: inherit; cursor: pointer; }
.primary, .ghost, .tag-chip, .mode-btn, .grade-btn, .nav-btn {
  transition: background-color 120ms ease, color 120ms ease,
              border-color 120ms ease, box-shadow 120ms ease, transform 80ms ease;
}
.primary {
  font-family: var(--serif-sc);
  letter-spacing: 0.07em;
  background: var(--ink); color: var(--parchment);
  border: 1px solid var(--ink-deep);
  border-radius: 2px;
  padding: 0.5rem 1.1rem; font-size: 1rem;
}
.ghost {
  font-family: var(--serif-sc);
  letter-spacing: 0.06em;
  font-size: 0.95rem;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink-soft);
  padding: 0.45rem 0.9rem;
}
/* pressed-state feedback for touch (hover styles don't fire on tap) */
.primary:active {
  background: var(--oxblood); border-color: var(--oxblood);
  box-shadow: inset 0 2px 3px rgba(0,0,0,0.3);
  transform: translateY(1px);
}
.ghost:active { border-color: var(--ink-soft); color: var(--ink); transform: translateY(1px); }
.danger { color: var(--oxblood); }
.danger.ghost { border-color: #c4a08e; }
.primary:disabled, .ghost:disabled { opacity: 0.4; cursor: not-allowed; }
.primary:disabled:active, .ghost:disabled:active { transform: none; box-shadow: none; }

/* ---------- tag bar & collections: stamped tags ---------- */
.tag-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.tag-chip {
  background: none; border: 1px solid var(--rule); border-radius: 999px;
  padding: 0.15rem 0.8rem; font-size: 0.78rem; color: var(--ink-soft);
  font-family: var(--serif-sc); letter-spacing: 0.08em;
}
.tag-chip.active {
  background: var(--ink); border-color: var(--ink-deep); color: var(--parchment);
}
.collection-actions { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
/* stages: the same stamped chips, set apart from the tags by a rule */
.stage-bar { padding-bottom: 0.6rem; border-bottom: 1px dotted var(--rule); }
.collection-actions select { font: inherit; font-size: 0.85rem; }

/* ---------- piece list: the ledger ---------- */
.piece-list { list-style: none; margin: 0; padding: 0; }
.piece-list li {
  display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.7rem 0.4rem; border-bottom: 1px solid var(--rule);
  cursor: pointer; min-height: 44px;
}
.piece-list li:active { background: var(--parchment-deep); }
.piece-list .p-title { font-weight: bold; flex: 1; }
.piece-list .p-source { color: var(--ink-soft); font-style: italic; font-size: 0.9rem; }
.piece-list .p-due { font-size: 0.8rem; color: var(--ink-soft); white-space: nowrap; }
.piece-list .p-due.overdue { color: var(--oxblood); font-weight: bold; }
/* the Memoria knows this piece: a quiet word, not a badge */
.piece-list .p-vault { font-family: var(--serif-sc); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--ink-soft); white-space: nowrap; }
/* …and the same word on the piece's own page, with what it means */
.d-vault { color: var(--ink-soft); font-style: italic; font-size: 0.9rem; margin: -0.6rem 0 1rem; }
/* a piece still waiting its turn, in a mixed list */
.piece-list .p-stage { font-family: var(--serif-sc); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--ink-soft); white-space: nowrap; }
.stage-panel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; margin: 0 0 1rem; }
.stage-panel select { font: inherit; margin-left: 0.4rem; }
/* copy or move to another card */
.give-dialog { border: 1px solid var(--line); background: var(--paper); color: var(--ink); max-width: min(32rem, calc(100vw - 2rem)); padding: 1rem 1.2rem; }
.give-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.give-dialog h3 { margin-top: 0; overflow-wrap: anywhere; }
.give-dialog label { display: block; margin: 0.5rem 0; }
.give-dialog select { font: inherit; display: block; width: 100%; margin-top: 0.2rem; }
.give-mode { border: none; padding: 0; margin: 0.6rem 0; }
.give-mode label { display: flex; gap: 0.5rem; align-items: baseline; }
.d-vault .p-vault { font-family: var(--serif-sc); font-style: normal; font-size: 0.78rem; letter-spacing: 0.08em; }

/* this browser changed hands between accounts: said plainly, once */
.account-note { border: 1px solid var(--line); border-left: 4px solid var(--oxblood); background: var(--paper);
  padding: 0.7rem 0.9rem; margin: 0 0 1rem; }
.account-note p { margin: 0 0 0.5rem; }
/* …and what was set aside with no account to give it back to (sync panel) */
.aside-area { border-top: 1px solid var(--line); margin-top: 0.8rem; padding-top: 0.6rem; }
.aside-shelf { margin: 0.4rem 0 0.8rem; }
.aside-shelf p { margin: 0; overflow-wrap: anywhere; }

.chip {
  font-size: 0.68rem; font-family: var(--serif-sc);
  letter-spacing: 0.08em;
  border: 1px solid; border-radius: 999px; padding: 0.05rem 0.6rem; white-space: nowrap;
}
.chip.learning  { color: var(--gold);  border-color: var(--gold); }
.chip.memorized { color: var(--green); border-color: var(--green); }
.chip.maintained{ color: var(--ink);   border-color: var(--ink); }

.empty-note { text-align: center; color: var(--ink-soft); font-style: italic; margin-top: 2.5rem; }

/* ---------- forms: filled out in triplicate ---------- */
form label {
  display: block; margin-bottom: 0.9rem;
  font-family: var(--serif-sc);
  letter-spacing: 0.06em; font-size: 0.95rem;
}
form small { font-family: var(--serif); letter-spacing: normal; color: var(--ink-soft); }
input[type="text"], input[type="search"], input[type="email"], select, textarea {
  display: block; width: 100%; margin-top: 0.25rem;
  font-family: var(--serif); font-size: 1rem; color: var(--ink);
  background: var(--card); border: 1px solid var(--rule); border-radius: 2px;
  padding: 0.5rem;
  box-shadow: inset 0 1px 3px rgba(43,38,33,0.09);
}
textarea { resize: vertical; font-family: var(--typewriter); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1.25rem; }

/* ---------- detail & recitation: the typed record ---------- */
.meta { color: var(--ink-soft); font-style: italic; margin: 0.2rem 0 1rem; }
.notes { color: var(--ink-soft); border-left: 4px solid var(--gold); padding-left: 0.8rem; }

h2 { font-family: var(--serif-sc); font-weight: normal; letter-spacing: 0.05em; }
h3 { font-family: var(--serif); font-weight: normal; }

.piece-text {
  font-family: var(--typewriter); font-size: 1rem; line-height: 1.75;
  background: var(--card); border: 1px solid var(--rule);
  box-shadow: inset 0 0 12px rgba(43,38,33,0.045);
  padding: 1.25rem 1.5rem; white-space: pre-wrap; overflow-x: auto;
}
.recite { min-height: 8rem; }
.hidden-line { color: transparent; text-shadow: 0 0 8px var(--ink-soft); cursor: pointer; }

/* ---------- review history: the service record ---------- */
.history-panel {
  border: 3px double var(--rule); background: var(--card);
  padding: 1rem 1.25rem; margin: 1.25rem 0;
}
.history-panel h3 {
  margin: 0 0 0.25rem;
  font-family: var(--serif-sc); letter-spacing: 0.1em;
  font-size: 1rem;
}
.history-panel .meta { margin-bottom: 0.6rem; }
.h-chart {
  display: flex; align-items: flex-end; gap: 2px;
  height: 64px; border-bottom: 2px solid var(--rule); padding-bottom: 1px;
}
.h-bar { flex: 1 1 auto; max-width: 14px; min-height: 4px; border-radius: 1px 1px 0 0; }
.h-again { background: var(--oxblood); }
.h-hard  { background: var(--gold); }
.h-good  { background: var(--green); }
.h-easy  { background: var(--ink); }

/* ---------- record & loop: the control panel ----------
   The room's signature machine — set off with the suite's
   double-ruled box (the KCCS countdown-plate treatment). */
.audio-panel {
  border: 1px solid var(--ink); outline: 3px double var(--ink);
  outline-offset: 2px;
  background: var(--parchment-deep);
  padding: 1rem 1.25rem; margin: 1.4rem 0.25rem;
}
.audio-panel h3 {
  margin: 0 0 0.25rem;
  font-family: var(--serif-sc); letter-spacing: 0.1em;
  font-size: 1rem;
}
.audio-panel .form-actions { margin-top: 0.75rem; }
.loop-controls {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.4rem 0.5rem; margin-top: 0.85rem;
}
.loop-label {
  font-family: var(--serif-sc); letter-spacing: 0.1em;
  font-size: 0.74rem; color: var(--ink-soft);
}
.loop-label + .loop-group { margin-right: 0.6rem; }
.loop-group { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.loop-opt {
  background: none; border: 1px solid var(--rule); border-radius: 999px;
  padding: 0.15rem 0.7rem; font-size: 0.78rem; color: var(--ink-soft);
  font-family: var(--serif-sc); letter-spacing: 0.05em;
  min-height: 34px;   /* inside a panel; the 44px rule is for page-level targets */
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.loop-opt.active {
  background: var(--ink); border-color: var(--ink-deep); color: var(--parchment);
}

.rec-live {
  background: var(--oxblood); border-color: var(--oxblood);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.65; } }

#r-loop { display: block; margin: 0.75rem auto 0; }

/* ---------- review ---------- */
.mode-row { display: flex; gap: 0.4rem; margin: 0.75rem 0; }
.mode-btn {
  background: none; border: 1px solid var(--rule); border-radius: 2px;
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem; color: var(--ink-soft);
  font-family: var(--serif-sc); letter-spacing: 0.07em;
}
.mode-btn.active { border-color: var(--ink); color: var(--ink); background: var(--parchment-deep); }

.grade-hint { text-align: center; font-style: italic; color: var(--ink-soft); margin: 1.25rem 0 0.5rem; }
.kbd-hint { font-size: 0.8em; opacity: 0.8; }
@media (hover: none) { .kbd-hint { display: none; } }  /* touch screens have no number keys handy */

#review-empty { text-align: center; }
#btn-cram { margin-top: 0.75rem; }
.review-summary {
  display: inline-block; margin: 0.25rem auto 0.75rem;
  padding: 0.5rem 1.1rem;
  font-family: var(--serif-sc); letter-spacing: 0.07em;
  font-size: 0.9rem; color: var(--green);
  border: 1px solid var(--green); border-radius: 2px;
  box-shadow: inset 0 0 0 2px var(--card), inset 0 0 0 3px rgba(49,81,58,0.25);
}
.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.grade-btn {
  padding: 0.6rem 0.25rem; font-size: 0.95rem;
  font-family: var(--serif-sc); letter-spacing: 0.05em;
  border: 1px solid var(--rule); border-radius: 2px; background: var(--card);
  box-shadow: 0 1px 0 var(--rule);
}
.grade-btn small { display: block; font-family: var(--serif); letter-spacing: normal; font-size: 0.72rem; color: var(--ink-soft); }
.grade-btn:active { background: var(--parchment-deep); transform: translateY(1px); box-shadow: none; }

/* ---------- footer ----------
   thewordhoard.com's own footer: a plain 1px --rule hairline,
   0.9rem, ink-soft — quiet, not another double rule. */
footer {
  text-align: center; font-size: 0.9rem; color: var(--ink-soft);
  border-top: 1px solid var(--rule); padding: 1rem; margin-top: 2rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

/* ---------- hover effects: mouse/trackpad only ----------
   On touch screens, :hover "sticks" after a tap — so these live
   behind a hover-capability check and phones/tablets never see them. */
@media (hover: hover) and (pointer: fine) {
  .primary:hover { background: var(--oxblood); border-color: var(--oxblood); }
  .ghost:hover { border-color: var(--ink-soft); color: var(--ink); }
  .tag-chip:hover { border-color: var(--ink-soft); color: var(--ink); }
  .piece-list li:hover { background: var(--parchment-deep); }
  .hidden-line:hover { text-shadow: 0 0 6px var(--ink); }
  .grade-btn.again:hover { border-color: var(--oxblood); color: var(--oxblood); }
  .grade-btn.hard:hover  { border-color: var(--gold);    color: var(--gold); }
  .grade-btn.good:hover,
  .grade-btn.easy:hover  { border-color: var(--green);   color: var(--green); }
}

/* ---------- phones ---------- */
@media (max-width: 520px) {
  .form-row { grid-template-columns: 1fr; }
  .masthead h1 { font-size: 1.8rem; }
  /* Fell small caps run wide — let rows wrap and trim type on phones.
     Four nav items (Bank/Playlists/Decks/Review) need the extra trim. */
  .toolbar, .collection-actions { flex-wrap: wrap; }
  .nav-btn { font-size: 0.85rem; padding: 0.4rem 0.55rem; letter-spacing: 0.05em; }
  .primary { font-size: 0.9rem; padding: 0.5rem 0.85rem; }
  .ghost { font-size: 0.84rem; padding: 0.45rem 0.6rem; }
  .mode-btn { font-size: 0.7rem; padding: 0.35rem 0.5rem; letter-spacing: 0.04em; }
}

/* ---------- tablets (iPad portrait & landscape) ----------
   Give the reading column a little more air and larger recitation text. */
@media (min-width: 768px) {
  main { max-width: 780px; padding: 1.5rem 2rem 4rem; }
  .piece-text { font-size: 1.1rem; padding: 1.5rem 1.75rem; }
  .grade-btn { padding: 0.8rem 0.25rem; }
}

/* ---------- sync corner (footer) ----------
   Deliberately quiet: one small link until you open it. */
.sync-area { margin-top: 0.8rem; text-align: center; }
.sync-toggle {
  background: none; border: none; cursor: pointer;
  font: inherit; font-size: 0.85rem; color: var(--ink-soft);
  text-decoration: underline dotted; padding: 0.2rem 0.6rem;
}
.sync-toggle:active { color: var(--ink); }
.sync-panel {
  max-width: 420px; margin: 0.8rem auto 0; padding: 1rem 1.2rem;
  text-align: left; background: var(--parchment-deep);
  border: 1px solid var(--rule); border-radius: 3px;
  font-size: 0.92rem;
}
.sync-panel label { display: block; margin: 0.6rem 0 0.3rem; font-size: 0.85rem; color: var(--ink-soft); }
.sync-panel input {
  width: 100%; box-sizing: border-box; padding: 0.5rem 0.6rem;
  font: inherit; background: var(--card); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 2px;
}
.sync-panel .form-actions { margin-top: 0.6rem; }


/* ---------- playlists: folders you build by hand ----------
   Reuses the ledger (.piece-list), the stamped tag-chip (for
   "in this playlist" pills and their × to remove), and the
   dashed-gold box for the add-pieces picker — a lighter cousin
   of the audio panel's double rule. */
.playlist-panel { margin: 1rem 0 1.25rem; }
.playlist-panel .meta { margin-bottom: 0.5rem; }
.playlist-panel label {
  display: block; font-family: var(--serif-sc);
  letter-spacing: 0.06em; font-size: 0.95rem;
}
.playlist-panel select {
  display: block; width: 100%; margin-top: 0.25rem;
  font-family: var(--serif); font-size: 1rem; color: var(--ink);
  background: var(--card); border: 1px solid var(--rule); border-radius: 2px;
  padding: 0.5rem;
}
.pl-picker {
  margin: 1rem 0; padding: 1rem;
  border: 2px dashed var(--gold); background: var(--parchment-deep);
}
.pl-picker .search-row { margin-bottom: 0.6rem; }
.picker-check {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; cursor: pointer; padding: 0.2rem 0;
}
.picker-check input {
  width: 18px; height: 18px; min-height: 0; flex: none;
  accent-color: var(--ink);
}

/* ---------- decks & flashcards (decks.js) ----------
   The study card is the same "typed record" paper as recitation;
   .flash-grade mirrors .grade-btn (kept as its own class so app.js's
   review wiring never grabs these buttons). */
.flash-face {
  font-family: var(--serif); font-size: 1.15rem; line-height: 1.7;
  background: var(--card); border: 1px solid var(--rule);
  box-shadow: inset 0 0 12px rgba(43,38,33,0.045);
  padding: 1.25rem 1rem; margin: 0.75rem 0; border-radius: 2px;
  overflow-wrap: break-word;
}
.flash-back { border-color: var(--ink); }
.flash-face img { max-width: 100%; height: auto; display: block; margin: 0.5rem auto; }
.flash-face .cloze { color: var(--oxblood); font-weight: bold; }
.flash-face hr { border: none; border-top: 1px solid var(--rule); margin: 0.7rem 0; }

.flash-grade {
  padding: 0.6rem 0.25rem; text-align: center; cursor: pointer;
  font-family: var(--serif-sc); letter-spacing: 0.05em;
  border: 1px solid var(--rule); border-radius: 2px; background: var(--card);
  color: var(--ink); font-size: 0.85rem;
}
.flash-grade small { display: block; font-family: var(--serif); letter-spacing: normal; font-size: 0.72rem; color: var(--ink-soft); }
.flash-grade:active { background: var(--parchment-deep); transform: translateY(1px); box-shadow: none; }

.pager { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin: 1rem 0; }
.pager .meta { margin: 0; }

@media (hover: hover) and (pointer: fine) {
  .flash-grade.again:hover { border-color: var(--oxblood); color: var(--oxblood); }
  .flash-grade.hard:hover  { border-color: var(--gold);    color: var(--gold); }
  .flash-grade.good:hover,
  .flash-grade.easy:hover  { border-color: var(--green);   color: var(--green); }
}

/* ---------- keyboard focus: a gold ring, only for key users ----------
   :focus-visible fires for keyboard tabbing but not for taps/clicks,
   so touch users never see a stray outline. */
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- typing mode: free-form dictation with character accuracy feedback ---------- */
#typing-area { margin: 0.75rem 0; }
#typing-prompt { margin: 0.4rem 0 0.6rem; }
.typing-input {
  font-family: var(--typewriter);
  min-height: 12rem;
  resize: vertical;
  line-height: 1.6;
}
.typing-feedback {
  margin-top: 0.75rem; padding: 0.75rem 1rem;
  background: var(--parchment-deep);
  border-left: 4px solid var(--gold);
  font-family: var(--typewriter);
  font-size: 0.9rem;
}
.typing-feedback .accuracy { font-weight: bold; color: var(--ink); }
.typing-feedback .correct { color: var(--green); }
.typing-feedback .incorrect { color: var(--oxblood); }
.typing-feedback .sample {
  margin-top: 0.4rem; padding-top: 0.4rem;
  border-top: 1px solid var(--rule);
  font-size: 0.8rem; color: var(--ink-soft);
}

/* ---------- reduced motion: respect the OS setting ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- print: a clean broadside of the open piece ----------
   Print (or Save as PDF) from a piece's detail page and you get just
   the title, meta, text, and notes in plain black on white. */
@media print {
  .masthead nav, .toolbar, .search-row, .tag-bar, .collection-actions, .streak-note,
  .stats-row, .audio-panel, .playlist-panel, .form-actions, .mode-row, .grade-hint,
  .grade-row, footer, #btn-back, #btn-reveal-line, #r-loop, #btn-cram,
  #history-panel, #typing-area { display: none !important; }
  body { background: #fff; color: #000; }
  .masthead { background: none; color: #000; border: none; box-shadow: none; padding: 0 0 0.5rem; }
  .masthead h1 { color: #000; text-shadow: none; font-size: 1.5rem; }
  .tagline { color: #555; }
  main { max-width: none; padding: 0; }
  .piece-text { background: none; border: none; box-shadow: none; padding: 0; font-size: 12pt; }
  .meta, .notes { color: #333; }
}

/* ============================================================
   THE SHELF — family cards (profiles.js)
   A card catalog over the whole room: one library card per
   keeper, set in the same parchment/ink/gold furniture.
   ============================================================ */
.cards-toggle {
  display: block;
  margin: 0.5rem auto 0.9rem;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-family: var(--serif-sc);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  padding: 0.2rem 0.9rem;
  min-height: 34px;
  cursor: pointer;
}
.cards-toggle:active { border-color: var(--ink-soft); color: var(--ink); }
.ct-stamp {
  display: inline-block;
  width: 0.65em; height: 0.65em;
  border-radius: 50%;
  background: var(--stamp, var(--gold));
  margin-right: 0.45em;
  vertical-align: baseline;
}

.shelf {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  background: var(--parchment);
  background-image: radial-gradient(ellipse at 50% 0%,
    rgba(255,255,255,0.4), rgba(43,38,33,0.055) 130%);
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.shelf-inner { max-width: 720px; margin: 0 auto; padding: 2.2rem 1.25rem 3rem; }
.shelf-mark { text-align: center; color: var(--gold); font-size: 1.3rem; margin: 0 0 0.3rem; }
.shelf-title {
  text-align: center;
  font-family: var(--serif-sc);
  font-weight: 400;
  font-size: 1.9rem;
  letter-spacing: 0.06em;
  margin: 0;
}
.shelf-sub {
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  margin: 0.2rem 0 1.6rem;
}

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.8rem;
}
.shelf-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(43,38,33,0.08);
  padding: 0.9rem 0.9rem 0.8rem;
  min-height: 96px;
  cursor: pointer;
  font-family: var(--serif);
  color: var(--ink);
}
.shelf-card:active { background: var(--parchment-deep); transform: translateY(1px); }
.shelf-card.current { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.sc-stamp {
  width: 2.2rem; height: 0.45rem;
  border-radius: 2px;
  background: var(--stamp, var(--gold));
  margin-bottom: 0.2rem;
}
.sc-name {
  font-family: var(--serif-sc);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.sc-counts { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-soft); }
.sc-edit {
  position: absolute;
  top: 0.4rem; right: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  padding: 0.25rem 0.35rem;   /* a comfortable little touch target */
  border-radius: 3px;
}
.sc-edit:active { color: var(--ink); background: var(--parchment-deep); }
.shelf-add {
  border-style: dashed;
  background: transparent;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--ink-soft);
}
.shelf-add .sc-name { font-size: 1.05rem; }

.shelf-editor {
  margin-top: 1.4rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1rem 1.1rem 1.2rem;
}
.shelf-editor h3 {
  font-family: var(--serif-sc);
  font-weight: 400;
  letter-spacing: 0.05em;
  margin: 0 0 0.6rem;
}
.shelf-label {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0.9rem 0 0.35rem;
}
.stamp-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.stamp-swatch {
  width: 2rem; height: 2rem;
  min-height: 2rem;               /* overrides the global 44px button floor on purpose */
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.stamp-swatch.active { border-color: var(--ink); box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--ink); }

.shelf-foot {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.8rem;
}

@media (max-width: 420px) {
  .shelf-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ---------- Resources: the shelf (resources.js) ----------
   Each resource is a card on the front door's recipe — 3px double
   rule on raised paper — with its buy links as plain ghost buttons
   and the ownership affirmation set off in the gold of commendation. */
.res-card {
  background: var(--card); border: 3px double var(--rule);
  padding: 1rem 1.1rem; margin: 0 0 1.1rem;
}
.res-card h3 { margin: 0.1rem 0 0.2rem; font-size: 1.2rem; }
.res-kind {
  margin: 0; font-family: var(--serif-sc); letter-spacing: 0.1em;
  font-size: 0.72rem; color: var(--gold);
}
.res-maker { margin: 0 0 0.6rem; color: var(--ink-soft); font-style: italic; font-size: 0.92rem; }
.res-links { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; }
.res-link { text-decoration: none; font-size: 0.85rem; padding: 0.25rem 0.7rem; }
.res-releases { margin: 0.5rem 0; font-size: 0.9rem; }
.res-releases summary { cursor: pointer; font-family: var(--serif-sc); letter-spacing: 0.06em; color: var(--ink-soft); }
.res-releases ul { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.res-releases li { margin-bottom: 0.45rem; }
.res-year { color: var(--ink-soft); font-size: 0.85rem; }
.res-contents { color: var(--ink-soft); font-size: 0.88rem; }
.res-own { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.8rem;
  padding-top: 0.7rem; border-top: 1px solid var(--rule); }
.res-own-hint, .res-own-note { color: var(--ink-soft); font-style: italic; font-size: 0.88rem; }
.res-own-note { margin: 0.8rem 0 0; padding-top: 0.7rem; border-top: 1px solid var(--rule); }
.res-owned { color: var(--gold); font-family: var(--serif-sc); letter-spacing: 0.06em; font-size: 0.85rem; }
.res-withdraw { font-size: 0.8rem; padding: 0.2rem 0.6rem; }
.res-attest { margin-top: 0.8rem; padding: 0.8rem 0.9rem; background: var(--parchment-deep);
  border-left: 4px solid var(--gold); }
.res-attest p:first-child { margin-top: 0; font-style: italic; }
.res-check { display: flex; gap: 0.5rem; align-items: center; margin: 0.4rem 0 0.2rem; }
.res-check input { width: auto; margin: 0; }
.res-text { margin-top: 0.9rem; }
.res-pieces { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto;
  border: 1px solid var(--rule); background: var(--parchment); }
.res-pieces li { border-bottom: 1px solid var(--rule); }
.res-pieces label { display: grid; grid-template-columns: auto 1fr auto; gap: 0.15rem 0.6rem;
  padding: 0.55rem 0.7rem; cursor: pointer; }
.res-pieces input { grid-row: 1 / span 3; width: auto; margin: 0.2rem 0 0; align-self: start; }
.res-p-title { font-weight: bold; }
.res-p-have { font-family: var(--serif-sc); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--gold); white-space: nowrap; }
.res-p-source { grid-column: 2 / span 2; color: var(--ink-soft); font-style: italic; font-size: 0.85rem; }
.res-p-text { grid-column: 2 / span 2; white-space: pre-line; font-size: 0.88rem; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.res-have { opacity: 0.6; }
