/* ── SINGLE THEME: parchment amber · dusty lavender · slate periwinkle ─────
   Warm aged-paper amber on one end, cool bookish periwinkle-slate on the
   other. No pink. No green. Completely gender-neutral and literary.        */
:root {
  --bg:             linear-gradient(145deg, oklch(96% 0.04 15) 0%, oklch(94% 0.04 295) 50%, oklch(92% 0.05 265) 100%);
  --surface:        oklch(99%  0.006  76);
  --surface-alt:    oklch(96%  0.016 288);   /* lavender tint — no plain gray */
  --surface-locked: oklch(95%  0.018 284);
  --border:         oklch(88%  0.024 280);
  --border-locked:  oklch(91%  0.015 280);
  --text:           oklch(22%  0.025  62);   /* warm dark brown ink */
  --text-muted:     oklch(52%  0.018  62);
  --text-faint:     oklch(72%  0.012 270);
  --accent:         oklch(56%  0.15   74);   /* antique amber */
  --accent-light:   oklch(96%  0.04   74);
  --accent-hover:   oklch(50%  0.17   74);
  --accent2:        oklch(55%  0.12  275);   /* slate periwinkle / old ink */
  --correct:        oklch(56%  0.15   74);   /* amber — correct / won */
  --wrong:          oklch(52%  0.14  265);   /* slate blue — wrong / lost */
  --shadow-sm: 0 1px 6px  oklch(58% 0.05 280 / 0.10);
  --shadow:    0 3px 18px oklch(58% 0.05 280 / 0.13);
  --shadow-lg: 0 8px 48px oklch(58% 0.05 280 / 0.17);
}
  
/* ── RESET ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { min-height: 100%; scroll-padding-top: 72px; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); background-attachment: fixed; color: var(--text); display: flex; flex-direction: column; min-height: 100vh; }
#main-content { flex: 1; }

a { color: inherit; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="on"]) *, html:not([data-motion="on"]) *::before, html:not([data-motion="on"]) *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
  transition: none !important;
  animation: none !important;
  scroll-behavior: auto !important;
}

/* ── HEADER (storysleuth-specific additions) ─────────────────────────────── */
.header-sub { font-size: 17px; letter-spacing: 0.08em; text-transform: uppercase; margin-left: 10px; }
.title-group { display: flex; align-items: center; }
.nav-btn--active { color: var(--accent); background: oklch(96% 0.04 74 / 0.55); }
.nav-btn--active:hover { background: oklch(93% 0.05 74 / 0.7); }

/* Hide nav button text until 860px — 5-button storysleuth nav overlaps the centered title below this */
@media (max-width: 859px) { .nav-btn-text { display: none; } }
@media (min-width: 860px) { .nav-btn { min-width: auto; } .nav-btn-text { display: inline; } }

/* ── PUZZLE NAV (archive prev/next) ─────────────────────────────────────── */
.puzzle-nav {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 10px;
}
.puzzle-nav-side {
  display: flex; align-items: center; gap: 4px; cursor: pointer;
  height: 36px; padding: 0 8px 0 4px; border-radius: 6px;
  transition: background 0.15s;
}
.puzzle-nav-side--r { padding: 0 4px 0 8px; }
.puzzle-nav-side--r:hover { background: var(--surface-alt); }
.puzzle-nav-side--r:hover .puzzle-nav-btn,
.puzzle-nav-side--r:hover .puzzle-nav-num { color: var(--text); }
.puzzle-nav-side:not(.puzzle-nav-side--r):hover { background: oklch(95% 0.05 52); }
.puzzle-nav-side:not(.puzzle-nav-side--r):hover .puzzle-nav-btn,
.puzzle-nav-side:not(.puzzle-nav-side--r):hover .puzzle-nav-num { color: oklch(50% 0.16 50); }
.puzzle-nav-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: none; background: none;
  color: var(--accent); cursor: pointer; flex-shrink: 0;
  transition: color 0.15s;
}
.puzzle-nav-btn:focus-visible { outline: none; box-shadow: none; }
.puzzle-nav-side:has(.puzzle-nav-btn:focus-visible) { outline: 1px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.puzzle-nav-num {
  font-size: 13px; font-weight: 500; letter-spacing: 0.02em; color: var(--accent);
  transition: color 0.15s;
}

/* ── GAME AREA ───────────────────────────────────────────────────────────── */
.game-wrapper { max-width: 680px; margin: 0 auto; padding: 36px 20px 0; }


/* Puzzle card */
.puzzle-card {
  background: oklch(99% 0.010 72);
  border: 1px solid oklch(78% 0.07 74);
  border-radius: 16px;
  box-shadow: 0 2px 18px oklch(55% 0.08 74 / 0.09), inset 0 1px 0 oklch(100% 0 0 / 0.7);
  overflow: hidden;
  margin-bottom: 16px;
}

.card-eyebrow {
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent);
  padding: 18px 24px 0;
}
.eyebrow-dot { font-size: 16px; line-height: 1; }

.summary-text {
  font-family: 'Playfair Display', serif;
  font-style: italic; font-size: 17px; line-height: 1.7; color: var(--text);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  text-align: center;
  padding: 14px 28px 0;
  overflow-wrap: break-word; word-wrap: break-word;
}
mark.summary-highlight {
  background: none;
  color: var(--accent);
  font-size: 1.1em;
}

/* Quick-help hint link */
.qh-hint {
  text-align: center; font-size: 12px; color: var(--text); margin: 10px 0 0;
}
.qh-hint button {
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: 12px; color: var(--accent); font-family: 'DM Sans', sans-serif;
  text-decoration: none;
}
.qh-hint button:hover { color: var(--accent-hover); }

/* Chapter rule inside the index card */
.card-chapter-rule { margin: 14px 20px 0; }

/* Clue row — three columns */
.clue-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
}
.clue-slot {
  padding: 14px 12px 20px;
  position: relative;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.clue-slot:not(:last-child)::after {
  content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 1px; height: 80%; background: oklch(87% 0.032 72);
}
.clue-slot-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.clue-slot-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: oklch(28% 0.12 275); margin-bottom: 8px;
}
.clue-slot-value {
  font-family: 'Cutive Mono', 'Courier Prime', 'Courier New', monospace;
  font-size: 18px; font-weight: 400; color: var(--text); line-height: 1.25;
  word-break: normal;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
}
/* Locked clue slot */
.clue-slot--locked .clue-slot-label { color: oklch(36% 0.012 270); }
.clue-slot-dash {
  display: block; font-size: 16px; color: var(--text-faint); margin-bottom: 4px;
}
.clue-slot-hint { font-size: 11px; color: oklch(36% 0.012 270); font-style: italic; }

@keyframes revealIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

/* ── GUESS INPUT ─────────────────────────────────────────────────────────── */
.guess-area-wrap {
  padding: 6px 20px max(20px, env(safe-area-inset-bottom));
}
.guess-zone { max-width: 420px; margin: 0 auto; padding: 8px 16px 12px; }
.guess-history {
  max-width: 420px; margin: 0 auto; padding: 0 16px 8px; margin-top: 12px;
}
.guess-history:empty { display: none; }
.guess-history-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: oklch(48% 0.012 270); margin-bottom: 4px; text-align: center;
}
.guess-history-list { list-style: none; padding: 0; margin: 0; text-align: center; }
.guess-history-item {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 14px; color: var(--text-muted); padding: 2px 0;
  text-decoration: line-through; text-decoration-color: var(--accent);
}
.search-outer { position: relative; }
.search-wrap {
  display: flex; border-radius: 999px;
  background: var(--accent); box-shadow: var(--shadow), 0 0 0 2px var(--accent);
  overflow: hidden; transition: background 0.15s, box-shadow 0.2s;
}
.search-wrap:has(.search-btn:hover) { background: var(--accent-hover); box-shadow: var(--shadow), 0 0 0 2px var(--accent-hover); }
.search-input {
  flex: 1; border: none; background: var(--surface); outline: none;
  padding: 12px 18px; font-size: 16px; font-family: 'DM Sans', sans-serif; color: var(--text);
  font-style: italic;
}
.search-input::placeholder { color: oklch(52% 0.012 270); font-style: italic; }
.search-btn {
  padding: 0 22px; border: none; background: var(--accent); color: white; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: 'DM Sans', sans-serif; transition: background 0.15s;
  border-radius: 0 999px 999px 0;
}
.search-btn:hover { background: var(--accent-hover); }
.search-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.search-btn:focus-visible { outline: none; }
#guess-input:focus-visible { outline: none; }
/* Light mode: inset ring for input focus (matches dark mode approach so the curve blends into the button) */
.search-outer::after {
  content: ''; position: absolute; inset: 0; border-radius: 999px;
  pointer-events: none; transition: box-shadow 0.15s;
}
.search-outer:has(:focus-within):not(:has(.search-btn:focus-visible))::after {
  box-shadow: inset 0 0 0 3px var(--accent);
}
.search-outer:has(:focus-within):not(:has(.search-btn:focus-visible)):has(.search-btn:hover)::after {
  box-shadow: inset 0 0 0 3px var(--accent-hover);
}
.search-outer:has(.search-btn:focus-visible)::after {
  box-shadow: inset 0 0 0 2px var(--surface);
}
.search-wrap:has(:focus-within):not(:has(.search-btn:focus-visible)) {
  box-shadow: var(--shadow);
}
.guess-footer { margin-top: 8px; padding: 4px 10px; }
.skip-default { display: flex; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap; }
.skip-armed  { display: flex; align-items: center; justify-content: center; gap: 8px; }
.skip-default[hidden], .skip-armed[hidden] { display: none; }
.guess-hint { font-size: 14px; color: oklch(36% 0.012 270); text-align: center; }
.guess-sep  { font-size: 14px; color: oklch(36% 0.012 270); user-select: none; }
.skip-btn {
  background: none; border: none; cursor: pointer; white-space: nowrap;
  font-family: 'DM Sans', sans-serif; font-size: 14px; color: oklch(36% 0.012 270);
  padding: 2px 0; text-decoration: underline; text-underline-offset: 2px;
  transition: color 0.15s;
}
.skip-btn:hover { color: var(--accent); }
.skip-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.skip-armed-text {
  font-family: 'DM Sans', sans-serif; font-size: 14px; color: oklch(36% 0.012 270);
  white-space: nowrap;
}
.skip-yes-btn {
  background: oklch(56% 0.15 74); color: #fff;
  border: 1px solid oklch(56% 0.15 74);
  padding: 5px 14px; border-radius: 8px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-size: 14px; white-space: nowrap;
  transition: background 0.12s;
}
.skip-yes-btn:hover { background: oklch(50% 0.17 74); border-color: oklch(50% 0.17 74); }
.skip-yes-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px oklch(56% 0.15 74); border-radius: 8px; }
.skip-cancel-btn {
  background: transparent; color: oklch(52% 0.018 62);
  border: 1px solid oklch(88% 0.024 280);
  padding: 5px 14px; border-radius: 8px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-size: 14px; white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.skip-cancel-btn:hover { background: oklch(96% 0.016 288); }
.skip-cancel-btn:focus-visible { outline: none; box-shadow: 0 0 0 1px oklch(56% 0.15 74); border-color: oklch(56% 0.15 74); border-radius: 8px; }
/* Hint rows in guess history */
.guess-history-item--hint {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 14px; color: var(--text-muted);
  text-decoration: none; letter-spacing: 0.01em;
}

/* ── AUTOCOMPLETE DROPDOWN ───────────────────────────────────────────── */
.autocomplete-list {
  position: absolute; top: calc(100% + 8px); bottom: auto; left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); z-index: 20; max-height: 210px; overflow-y: auto;
  display: none;
}
.autocomplete-list.show { display: block; }

.autocomplete-item { 
  padding: 10px 14px; cursor: pointer; font-size: 14px; 
  border-bottom: 1px solid var(--border); 
  transition: background 0.1s; 
  color: var(--text);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.highlighted {
  background: var(--accent-light);
}
.autocomplete-item strong { 
  color: var(--accent); 
  font-weight: 500; 
}

.autocomplete-loading {
  padding: 12px 14px;
  text-align: center;
  font-size: 12px;
  color: oklch(36% 0.012 270);
  font-style: italic;
}

.autocomplete-no-results {
  padding: 12px 14px;
  text-align: center;
  font-size: 12px;
  color: oklch(36% 0.012 270);
}


/* ── PUZZLE CARD RESULT SECTION ─────────────────────────────────────────── */
.puzzle-card__result {
  border-top: 1px solid oklch(87% 0.032 72);
  padding: 24px 28px 30px;
  text-align: center;
  animation: revealIn 0.4s cubic-bezier(0.22,1,0.36,1);
}
/* Won state — title emphasis (both modes) */
.puzzle-card__result--won { position: relative; overflow: visible; isolation: isolate; }
.puzzle-card__result--won .pgb-title { font-size: 28px; line-height: 1.15; }

/* ── WIN BLOOM ANIMATION ──────────────────────────────────────────────── */
/* Halo glow */
.pgb-bloom { position: absolute; inset: 0; pointer-events: none; z-index: -1; }
/* Halo lives inside origin — centered at -90px/-90px so origin is its center */
.pgb-bloom-halo {
  position: absolute; left: -120px; top: -120px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, oklch(56% 0.15 74 / 0.28) 0%, transparent 65%);
  transform: scale(0.5); opacity: 0;
  will-change: transform, opacity;
  animation: pgb-bloom-halo 4.5s 0.2s linear forwards;
}
html.dark .pgb-bloom-halo {
  background: radial-gradient(circle, oklch(80% 0.15 78 / 0.38) 0%, transparent 65%);
}
@keyframes pgb-bloom-halo {
  0%   { transform: scale(0.5); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}
/* Origin is positioned by JS to match the separator rule's center */
.pgb-bloom-origin { position: absolute; }
/* Diamond sparks */
.pgb-bloom-spark {
  position: absolute;
  width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px;
  background: oklch(56% 0.15 74);
  transform: rotate(45deg) scale(0); opacity: 0;
  filter: drop-shadow(0 0 5px oklch(56% 0.15 74 / 0.65));
  animation: pgb-bloom-spark 2.4s var(--d, 0s) linear forwards;
}
html.dark .pgb-bloom-spark {
  background: oklch(80% 0.15 78);
  filter: drop-shadow(0 0 6px oklch(80% 0.15 78 / 0.80));
}
@keyframes pgb-bloom-spark {
  0%   { transform: translate(0,0) rotate(45deg) scale(0); opacity: 0; }
  12%  { transform: translate(calc(var(--tx,0)*.18), calc(var(--ty,0)*.18)) rotate(45deg) scale(1.2); opacity: 1; }
  100% { transform: translate(calc(var(--tx,0)*1.4), calc(var(--ty,0)*1.4)) rotate(45deg) scale(0); opacity: 0; }
}
/* Mini dots */
.pgb-bloom-dot {
  position: absolute;
  width: 2px; height: 2px; margin: -1px 0 0 -1px;
  border-radius: 50%;
  background: oklch(56% 0.15 74); opacity: 0;
  animation: pgb-bloom-dot 2.4s var(--d, 0s) linear forwards;
}
html.dark .pgb-bloom-dot { background: oklch(80% 0.15 78); }
@keyframes pgb-bloom-dot {
  0%   { transform: translate(0,0) scale(0); opacity: 0; }
  15%  { transform: translate(calc(var(--tx,0)*.2), calc(var(--ty,0)*.2)) scale(1); opacity: 0.85; }
  100% { transform: translate(calc(var(--tx,0)*1.6), calc(var(--ty,0)*1.6)) scale(0.3); opacity: 0; }
}

/* ── SEPARATOR RULE ANIMATION ─────────────────────────────────────────── */

/* Bookish symbol particles */
.pgb-bloom-sym {
  position: absolute;
  margin: -6px 0 0 -6px;
  color: oklch(56% 0.15 74);
  opacity: 0;
  filter: drop-shadow(0 0 4px oklch(56% 0.15 74 / 0.55));
  animation: pgb-bloom-sym 2.4s var(--d, 0s) linear forwards;
}
html.dark .pgb-bloom-sym {
  color: oklch(80% 0.15 78);
  filter: drop-shadow(0 0 5px oklch(80% 0.15 78 / 0.65));
}
@keyframes pgb-bloom-sym {
  0%   { transform: translate(0,0) rotate(0deg) scale(0); opacity: 0; }
  12%  { transform: translate(calc(var(--tx,0)*.15), calc(var(--ty,0)*.15)) rotate(calc(var(--r,15deg)*.1)) scale(var(--s,1)); opacity: 0.9; }
  100% { transform: translate(var(--tx,0), var(--ty,0)) rotate(var(--r,15deg)) scale(calc(var(--s,1) * 0.3)); opacity: 0; }
}

/* Reduced motion — show static result, skip all motion */
@media (prefers-reduced-motion: reduce) {
  .pgb-bloom-halo, .pgb-bloom-spark, .pgb-bloom-dot,
  .pgb-bloom-sym { animation: none; opacity: 0; }
}

/* Icon is interactive — cursor + hover + focus ring */
.pc-result-star[role="button"] {
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.pc-result-star[role="button"]:hover { transform: scale(1.2); filter: brightness(1.1); }
.pc-result-star[role="button"]:active { transform: scale(0.92); }
.pc-result-star[role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Star ornament between eyebrow and title */
.pc-result-star {
  color: var(--accent);
  display: block; width: fit-content; margin: 0 auto 10px;
}
.pc-result-star svg { display: block; width: 22px; height: 22px; }

.pgb-section-rule { margin: 14px 0; }
.pgb-eyebrow {
  font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text); margin-bottom: 8px;
}
.pgb-title {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 26px; font-weight: 700; line-height: 1.2; margin-bottom: 6px; color: var(--text);
}
.pgb-author { font-size: 13px; color: var(--text); }
.pgb-divider { height: 1px; background: var(--border); margin: 16px 0; }
.pgb-stats { display: flex; }
pgb-stat { flex: 1; padding: 4px 8px; border-right: 1px solid var(--border); }
pgb-stat:last-child { border-right: none; }
.pgb-stat-value {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 28px; font-weight: 700; color: var(--accent); display: block; line-height: 1;
}
.pgb-stat-label {
  font-size: 9px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text); display: block; margin-top: 4px;
}
.pgb-footer { text-align: center; }
.pgb-ledger-link { font-size: 13px; color: var(--text); margin-top: 20px; margin-bottom: 14px; }
.pgb-ledger-link a { color: var(--accent); text-decoration: underline; }
.pgb-footer chapter-rule { margin: 0 0 16px; }
.pgb-timer-wrap { display: inline-block; }
.pgb-timer-label { font-size: 10px; color: var(--text); letter-spacing: 0.1em; text-transform: uppercase; display: block; margin-bottom: 2px; }
.pgb-timer-val { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 700; color: oklch(28% 0.12 275); letter-spacing: 1px; }
.pgb-library-prompt { font-size: 13px; color: var(--text); margin-top: 10px; }
.pgb-library-prompt a { color: var(--accent); text-decoration: underline; }

/* ── MOBILE RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner { padding: 0 16px; }
  .game-wrapper { padding: 28px 16px 0; }
  .guess-area-wrap { padding: 4px 12px 16px; }

  .nav-btn { width: 32px; height: 32px; font-size: 12px; }

  .summary-text { font-size: 16px; }
  .clue-slot { padding: 12px 10px 16px; }
  .clue-slot-value { font-size: 16px; }
}

@media (max-width: 525px) {
  .header-inner { padding-left: 80px; }
}
@media (max-width: 480px) {
  .header-inner { padding: 0 116px 0 72px; height: 52px; }
  .header-title { font-size: 18px; }
  .header-sub { font-size: 13px; letter-spacing: 0; }
  .game-wrapper { padding: 24px 12px 0; }

  .summary-text { font-size: 15px; line-height: 1.6; }
  .clue-slot { padding: 10px 8px 14px; }
  .clue-slot:not(:last-child)::after { height: 60%; }
  .clue-slot-value { font-size: 14px; }
  .clue-slot-label { font-size: 8px; letter-spacing: 0.10em; }
  .clue-row { grid-template-columns: 1fr 1fr 2fr; }

  .search-input { font-size: 16px; }
  .search-btn { font-size: 13px; }
}

/* ── LEDGER ──────────────────────────────────────────────────────────────── */
.ledger-page { max-width: 780px; margin: 0 auto; padding: 36px 20px 20px; }

/* ── Paper boxes ── */
.ledger-paper { padding: 20px 24px; margin-bottom: 14px; }
.ledger-paper:last-child { margin-bottom: 0; }

/* ── Stamps ── */
.ledger-stamps {
  display: grid; grid-template-columns: repeat(3, 1fr); justify-items: center;
  margin: 0 auto;
}
.stamp-wrap { display: flex; flex-direction: column; align-items: center; }
.stamp-svg { width: 148px; height: 148px; color: var(--accent); overflow: visible; }
.stamp-arc-label { font-size: 10px; }
.stamp-label {
  display: none;
  font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); text-align: center; margin-bottom: 6px;
}
.stamp-caption { font-size: 14px; color: var(--text-muted); text-align: center; margin-top: 10px; }

/* ── Plates ── */
.ledger-plates {
  display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 0;
}
.ledger-plate {
  display: flex; flex-direction: column;
}
.ledger-plate:not(:last-child) { border-right: 1px solid var(--border); padding-right: 24px; }
.ledger-plate:not(:first-child) { padding-left: 24px; }
.ledger-plate-title {
  font-family: 'Playfair Display', serif; font-size: 17px; font-weight: 600;
  color: var(--text); margin-bottom: 3px; line-height: 1.3; text-align: center;
}
/* Guess distribution bars */
.ledger-dist { margin-top: 0; margin-bottom: 10px; display: flex; flex-direction: column; }
.lbar-row {
  display: grid; grid-template-columns: 26px 1fr 22px;
  align-items: center; gap: 7px; padding: 9px 0; min-height: 46px;
  border-bottom: 1px dashed var(--border);
}
.lbar-row:last-child { border-bottom: none; }
.lbar-label {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 14px; color: var(--text-muted); text-align: right;
}
.lbar-label--peak { color: var(--accent); font-weight: 700; }
.lbar-track {
  height: 13px; background: transparent; border-radius: 3px; overflow: hidden;
}
.lbar-track--zero { background: transparent; }
.lbar-fill { height: 100%; background: var(--accent); opacity: 0.80; border-radius: 3px; }
.lbar-row--peak .lbar-fill { opacity: 1; }
.lbar-num { font-size: 14px; color: var(--text-muted); text-align: right; }
.lbar-num--peak { color: var(--text); font-weight: 700; }
/* Recent editions */
.re-list { display: flex; flex-direction: column; flex: 1; }
.re-row {
  display: grid; grid-template-columns: 28px 14px 22px 1fr;
  align-items: center; gap: 6px; padding: 9px 0; min-height: 46px;
  border-bottom: 1px dashed var(--border); font-size: 14px;
}
.re-row:last-child { border-bottom: none; }
.re-date {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: oklch(48% 0.012 270);
}
.re-title {
  display: flex; align-items: center; gap: 4px; min-width: 0; padding-right: 8px;
}
.re-crown {
  flex-shrink: 0; color: var(--accent); display: flex; align-items: center;
}
.re-title-text {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 14px; color: var(--text); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.re-icon { font-size: 11px; display: flex; align-items: center; justify-content: center; }
.re-icon--won { color: var(--correct); }
.re-icon--lost { color: var(--wrong); }
.re-guesses {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 14px; color: var(--text-muted); text-align: center;
}
.re-empty {
  font-size: 13px; color: oklch(48% 0.012 270); font-style: italic;
  text-align: center; padding: 20px 0;
}

/* ── Tomes ── */
.ledger-tomes-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.ledger-tome { padding: 0; }
.ledger-tome:not(:last-child) { border-right: 1px solid var(--border); padding-right: 24px; }
.ledger-tome:not(:first-child) { padding-left: 24px; }
.lt-title {
  font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 600;
  color: var(--text); margin-bottom: 14px; line-height: 1.3; text-align: center;
}
.lt-rows { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.lt-row { display: flex; align-items: baseline; font-size: 14px; line-height: 1.4; }
.lt-label { color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.lt-dots { flex: 1; border-bottom: 1px dotted oklch(84% 0.028 74); margin: 0 4px 3px; min-width: 8px; }
.lt-val {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 16px; font-weight: 600; color: var(--accent); white-space: nowrap; flex-shrink: 0;
}

.ledger-section-rule { margin: 14px 0 20px; }

/* ── Ledger responsive ── */
@media (max-width: 600px) {
  .ledger-plates { grid-template-columns: 1fr; }
  .ledger-plate:not(:last-child) { border-right: none; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 24px; }
  .ledger-plate:not(:first-child) { padding-left: 0; padding-top: 24px; }
  .ledger-tomes-grid { grid-template-columns: 1fr; }
  .ledger-tome:not(:last-child) { border-right: none; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 24px; }
  .ledger-tome:not(:first-child) { padding-left: 0; padding-top: 24px; }
  .stamp-svg { width: 110px; height: 110px; }
  .stamp-arc-label { display: none; }
  .stamp-inner { r: 63; }
  .stamp-dot-l { cx: 22; }
  .stamp-dot-r { cx: 126; }
  .stamp-label { display: block; min-height: 2.4em; }
  .ledger-stamps { margin: 16px auto 0; }
  .ledger-paper { padding: 16px 16px; }
  .ledger-page { padding: 28px 16px 16px; }
}
@media (max-width: 420px) {
  .stamp-svg { width: 84px; height: 84px; }
  .stamp-caption { font-size: 11px; }
  .ledger-stamps { margin: 16px auto 20px; }
}

/* ── LUCIDE ICONS ────────────────────────────────────────────────────────── */
.stat-icon {
  width: 16px;
  height: 16px;
  vertical-align: -2px;
  margin-right: 2px;
}

.status-icon {
  width: 14px;
  height: 14px;
  vertical-align: -1px;
  margin-right: 4px;
}

.link-icon {
  width: 12px;
  height: 12px;
  vertical-align: -1px;
  margin-left: 2px;
}

.status-icon.success {
  color: var(--won);
}

.status-icon.locked {
  color: var(--text-faint);
}

.status-icon.retry {
  color: var(--accent);
}

.status-icon.new {
  color: var(--text-muted);
}

#stat-daily-win-streak .stat-icon {
  color: #ff6b35; /* Fire orange */
}

#stat-daily-play-streak .stat-icon {
  color: var(--accent2);
}

#library-status .status-icon {
  color: var(--correct);
}

#library-status.has-replayable .status-icon {
  color: var(--accent);
}

/* ── SKIP LINK ───────────────────────────────────────────────────────────── */
/* skip-link styles live in shared.css */

/* ── CELEBRATION OVERLAY ────────────────────────────────────────────────── */

[tabindex="-1"]:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ── PANEL (shared page container for stats / guide) ────────────────────── */
.panel { flex: 1; }

/* ── BOOKCASE / LIBRARY ──────────────────────────────────────────────────── */
:root {
  --wood-light: oklch(66% 0.085 52);
  --wood-mid:   oklch(55% 0.095 48);
  --wood-dark:  oklch(36% 0.080 46);
  --wood-h:     20px;
}

.library-page {
  max-width: 980px; margin: 0 auto; padding: 36px 28px 28px;
}
.library-heading {
  font-family: 'Playfair Display', serif; font-size: 26px; font-weight: 700; font-style: italic;
  margin-bottom: 0; text-align: center;
}
chapter-header .library-heading { margin-bottom: 0; }
.shelf-row { margin-bottom: 36px; padding-top: 20px; }
.shelf {
  display: flex; align-items: flex-end; gap: 4px;
  padding: 24px 16px 0; overflow: visible;
}
.shelf-plank {
  height: var(--wood-h);
  margin: 0 8px;
  border-radius: 0 0 5px 5px;
  background:
    linear-gradient(to bottom,
      var(--wood-light) 0%,
      var(--wood-mid) 60%,
      var(--wood-dark) 100%);
  box-shadow: 0 6px 20px oklch(28% 0.07 48 / 0.38), 0 2px 4px oklch(28% 0.07 48 / 0.20);
}

.book {
  flex-shrink: 0; display: block; position: relative; color: inherit; text-decoration: none;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1); cursor: pointer;
}
.book:hover { transform: translateY(-14px); z-index: 20; }
body:has(.book:focus-visible) .book:not(:focus-visible):hover { transform: none; z-index: auto; }
body:has(.book:focus-visible) .book:not(:focus-visible):hover .book-tip { opacity: 0; }
.book:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); border-radius: 4px; transform: translateY(-14px); z-index: 20; }
.book:focus-visible .book-tip { opacity: 1; }

.book-inner {
  width: 100%; height: 100%;
  border-radius: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 12px 5px 56px; position: relative; overflow: hidden;
  box-shadow:
    inset -4px 0 8px oklch(0% 0 0 / 0.18),
    inset  2px 0 5px oklch(100% 0 0 / 0.10),
    3px 0 10px oklch(0% 0 0 / 0.20),
    -1px 0 3px oklch(0% 0 0 / 0.08);
}
.book-inner::before {
  content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 7px;
  background: linear-gradient(to right, oklch(100% 0 0 / 0.30), transparent);
  pointer-events: none;
}

.book-rule-bottom {
  position: absolute; left: 6px; right: 6px; height: 1px;
  background: oklch(0% 0 0 / 0.18); z-index: 2; pointer-events: none; bottom: 35px;
}
.book-ornament {
  position: absolute; bottom: 8px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 7px; height: 7px; z-index: 2; pointer-events: none;
}
.book.won  .book-ornament { background: oklch(36% 0.16  74); }
.book.lost .book-ornament { background: oklch(32% 0.12 265); }
.book.unplayed .book-ornament { display: none; }
.book-ornament-dark { display: none; }

.book-title {
  writing-mode: vertical-rl; text-orientation: mixed; transform: rotate(180deg);
  font-family: 'Playfair Display', serif;
  font-size: 13px; font-weight: 600; font-style: italic;
  line-height: 1.25; letter-spacing: 0.02em; text-align: center;
  max-height: 150px; overflow: hidden; position: relative; z-index: 1; flex: 1;
}
.book-num {
  font-size: 9px; font-weight: 500; letter-spacing: 0.06em; opacity: 0.6;
  font-family: 'DM Sans', sans-serif;
  position: absolute; bottom: 20px; left: 50%;
  transform: translateX(-50%); z-index: 1; white-space: nowrap;
}

.book-tip {
  position: absolute; bottom: calc(100% + 10px); left: 50%;
  transform: translateX(-50%);
  background: oklch(98.5% 0.010 55); color: var(--text);
  border: 1px solid oklch(90% 0.014 58);
  padding: 13px 18px 14px; border-radius: 10px;
  min-width: 200px; max-width: 240px; text-align: center;
  pointer-events: none; opacity: 0; transition: opacity 0.15s 0.05s; z-index: 100;
  box-shadow:
    0 1px 2px oklch(55% 0.08 74 / 0.07),
    0 4px 18px oklch(55% 0.08 74 / 0.14);
}
.book-tip::after {
  content: ''; position: absolute; top: 100%; left: var(--arrow-left, 50%); transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: oklch(90% 0.014 58);
}
.book-tip::before {
  content: ''; position: absolute; top: calc(100% - 1px); left: var(--arrow-left, 50%); transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: oklch(98.5% 0.010 55); z-index: 1;
}
.book:hover .book-tip { opacity: 1; }
.tip-title {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 13px; font-weight: 600; margin-bottom: 8px; line-height: 1.35;
  color: var(--text);
}
.tip-meta   { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.tip-result { font-size: 12px; font-weight: 600; margin-top: 5px; }
.tip-result.won  { color: var(--correct); }
.tip-result.lost { color: var(--wrong); }

.book.unplayed .book-inner {
  background: linear-gradient(160deg, oklch(88% 0.035 62), oklch(83% 0.038 56));
  box-shadow:
    inset -4px 0 8px oklch(0% 0 0 / 0.10),
    inset  2px 0 5px oklch(100% 0 0 / 0.15),
    2px 0 6px oklch(0% 0 0 / 0.12);
}
.book.unplayed .book-title {
  color: oklch(48% 0.025 52); font-style: normal;
  letter-spacing: 0.4em; opacity: 0.55;
}
.book.unplayed .book-num { color: oklch(55% 0.02 65); }

.bc-rose       .book-inner { background: linear-gradient(160deg, oklch(78% 0.08  15), oklch(72% 0.09  12)); }
.bc-caramel    .book-inner { background: linear-gradient(160deg, oklch(78% 0.10  65), oklch(72% 0.11  62)); }
.bc-periwinkle .book-inner { background: linear-gradient(160deg, oklch(75% 0.09 278), oklch(69% 0.10 275)); }
.bc-mauve      .book-inner { background: linear-gradient(160deg, oklch(76% 0.08 340), oklch(70% 0.09 337)); }
.bc-peach      .book-inner { background: linear-gradient(160deg, oklch(79% 0.10  55), oklch(73% 0.11  52)); }
.bc-lavender   .book-inner { background: linear-gradient(160deg, oklch(76% 0.08 300), oklch(70% 0.09 297)); }
.bc-blush      .book-inner { background: linear-gradient(160deg, oklch(80% 0.06  20), oklch(74% 0.07  17)); }
.bc-slate      .book-inner { background: linear-gradient(160deg, oklch(73% 0.07 272), oklch(67% 0.08 270)); }

.bc-rose       .book-title, .bc-rose       .book-num,
.bc-caramel    .book-title, .bc-caramel    .book-num,
.bc-periwinkle .book-title, .bc-periwinkle .book-num,
.bc-mauve      .book-title, .bc-mauve      .book-num,
.bc-peach      .book-title, .bc-peach      .book-num,
.bc-lavender   .book-title, .bc-lavender   .book-num,
.bc-blush      .book-title, .bc-blush      .book-num,
.bc-slate      .book-title, .bc-slate      .book-num { color: oklch(22% 0.025 50); }

/* ── GUIDE / HELP PAGE ───────────────────────────────────────────────────── */
#view-guide .panel { max-width: 720px; }

guide-step { display: flex; align-items: center; gap: 16px; padding: 10px 0; }
.step-num {
  flex-shrink: 0; color: var(--accent);
  width: 32px; height: 32px;
}
.step-body { flex: 1; }
.step-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; color: var(--text); }
.step-desc  { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

.guide-section-h {
  font-family: 'Playfair Display', serif; font-size: 19px; font-weight: 700;
  margin: 20px 0 12px; color: var(--text);
}

.clue-ladder { display: flex; flex-direction: column; margin-bottom: 4px; }
.clue-ladder-row {
  display: flex; gap: 16px; align-items: baseline;
  padding: 9px 0;
}
.clue-ladder-row + .clue-ladder-row { border-top: 1px solid var(--border); }
.clue-ladder dt {
  font-size: 13px; font-weight: 700; color: var(--text);
  min-width: 108px; flex-shrink: 0;
}
.clue-ladder dd { font-size: 14px; color: var(--text-muted); line-height: 1.55; }
.example-puzzle-card {
  margin-top: 26px;
  background: oklch(99% 0.010 72);
  border: 1px solid oklch(87% 0.032 72);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 2px 18px oklch(55% 0.08 74 / 0.09), inset 0 1px 0 oklch(100% 0 0 / 0.7);
}
.example-puzzle-card .example-summary { border-bottom-color: oklch(87% 0.032 72); }

.example-wrap {
  margin-top: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  display: grid; grid-template-columns: max-content 1fr;
  box-shadow: 0 1px 6px oklch(58% 0.05 280 / 0.09);
}
.example-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); padding: 12px 18px 8px; border-bottom: 1px solid var(--border);
  grid-column: 1 / -1;
}
.example-summary {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 15px; line-height: 1.65; color: var(--text); text-align: center;
  padding: 14px 18px 16px; border-bottom: 1px solid var(--border);
  grid-column: 1 / -1;
}
.example-clue {
  grid-column: 1 / -1; display: grid; grid-template-columns: subgrid;
  column-gap: 12px; align-items: baseline;
  padding: 9px 18px; border-bottom: 1px solid var(--border);
}
.example-clue:last-child { border-bottom: none; }
.ecl {
  font-size: 10px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: oklch(42% 0.12 275); white-space: nowrap;
}
.ecl.locked-label { color: oklch(48% 0.012 270); }
.ecv { font-size: 13px; color: var(--text); }
.ecv.locked { color: oklch(48% 0.012 270); font-style: italic; }

.guide-help {
  margin-top: 10px; font-size: 12px; color: var(--text);
  text-align: center; line-height: 1.6;
}
.guide-help a { color: var(--text); text-decoration: underline; }
.guide-help a:hover { color: var(--accent); }

/* ── DARK MODE ─ Cozy Night Sky ────────────────────────────────────────── */
html.dark {
  --bg:             linear-gradient(145deg, oklch(23% 0.11 310) 0%, oklch(22% 0.095 300) 20%, oklch(22% 0.08 230) 52%, oklch(15% 0.065 260) 100%);
  --surface-locked: oklch(23% 0.010 60);
  --border-locked:  var(--border);
  --accent-light:   var(--surface);
  --accent2:        oklch(76% 0.018 80);
  --correct:        var(--accent);
  --wrong:          oklch(72% 0.04 240);
  --wood-light:     oklch(30% 0.065 48);
  --wood-mid:       oklch(21% 0.055 44);
  --wood-dark:      oklch(12% 0.040 40);
}

html.dark .nav-btn--active { color: oklch(78% 0.15 76); background: oklch(72% 0.15 76 / 0.14); filter: none; }
html.dark .nav-btn--active:hover { color: oklch(85% 0.15 76); background: oklch(72% 0.15 76 / 0.22); filter: none; }
html.dark .puzzle-nav-btn:focus-visible { outline: none; box-shadow: none; filter: none; }
html.dark .puzzle-nav-side:hover { background: oklch(72% 0.15 76 / 0.22); }
html.dark .puzzle-nav-side:hover .puzzle-nav-btn,
html.dark .puzzle-nav-side:hover .puzzle-nav-num { color: oklch(82% 0.15 76); }
html.dark .puzzle-nav-side:has(.puzzle-nav-btn:focus-visible) { outline: 1px solid oklch(72% 0.15 76); outline-offset: 3px; border-radius: 6px; }
html.dark .book:focus-visible { outline: none; box-shadow: 0 0 0 2px oklch(72% 0.15 76), 0 0 16px oklch(72% 0.15 76 / 0.45); border-radius: 4px; }

html.dark .puzzle-card {
  background: linear-gradient(160deg, oklch(25% 0.07 285 / 0.58) 0%, oklch(18% 0.07 298 / 0.44) 100%);
  backdrop-filter: blur(12px);
  border-color: oklch(82% 0.08 74 / 0.75);
  box-shadow: 0 4px 28px oklch(0% 0 0 / 0.50), inset 0 1px 0 oklch(100% 0 0 / 0.06);
}

html.dark .clue-slot:not(:last-child)::after { background: oklch(88% 0.04 88 / 0.45); }
html.dark .example-puzzle-card {
  background: linear-gradient(160deg, oklch(25% 0.07 285 / 0.58) 0%, oklch(18% 0.07 298 / 0.44) 100%);
  backdrop-filter: blur(12px);
  border-color: oklch(88% 0.04 88 / 0.52);
  box-shadow: 0 4px 28px oklch(0% 0 0 / 0.50), inset 0 1px 0 oklch(100% 0 0 / 0.06);
}
html.dark .example-puzzle-card .example-summary { border-bottom-color: oklch(88% 0.04 88 / 0.45); }
html.dark .clue-slot-label { color: var(--text-muted); }
html.dark .clue-slot--locked .clue-slot-label { color: var(--text-muted); }
html.dark .clue-slot-hint { color: var(--text-muted); }

/* Ring via ::after on search-outer — sits above clip, covering anti-aliasing at the pill boundary */
html.dark .search-outer::after {
  content: ''; position: absolute; inset: 0; border-radius: 999px;
  box-shadow: inset 0 0 0 2px var(--accent); pointer-events: none; transition: box-shadow 0.15s;
}
html.dark .search-outer:has(:focus-within)::after { box-shadow: inset 0 0 0 3px var(--accent); }
html.dark .search-outer:has(.search-btn:focus-visible)::after { box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 5px oklch(15% 0.04 260); }
html.dark .search-outer:has(.search-btn:hover)::after { box-shadow: inset 0 0 0 2px var(--accent-hover); }
html.dark .search-outer:has(.search-btn:hover):has(:focus-within)::after { box-shadow: inset 0 0 0 3px var(--accent-hover); }
html.dark .search-wrap { background: transparent; overflow: hidden; box-shadow: none; outline: none; }
html.dark .search-wrap:has(.search-btn:hover) { background: transparent; box-shadow: none; }
html.dark .search-wrap:focus-within { box-shadow: none; }
html.dark .search-wrap:has(.search-btn:hover):focus-within { box-shadow: none; }
html.dark .search-wrap:has(:focus-within):not(:has(.search-btn:focus-visible)) { box-shadow: none; }
html.dark .search-wrap:has(.search-btn:focus-visible) { box-shadow: none; }
html.dark .search-btn:focus-visible { outline: none; box-shadow: inset 0 0 0 2px oklch(15% 0.04 260); }
html.dark .search-input { background: oklch(17% 0.06 290 / 0.55); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
html.dark .search-btn { color: oklch(22% 0.010 60); border-radius: 0; }

html.dark .guess-history-label { color: var(--text-muted); }
html.dark .guess-hint { color: oklch(76% 0.018 80); }
html.dark .guess-sep { color: oklch(76% 0.018 80); }
html.dark .skip-btn { color: oklch(76% 0.018 80); }
html.dark .skip-btn:hover { color: oklch(93% 0.020 84); }
html.dark .skip-armed-text { color: oklch(76% 0.018 80); }
html.dark .skip-yes-btn { background: var(--accent); color: oklch(22% 0.010 60); border-color: var(--accent); }
html.dark .skip-yes-btn:hover { background: var(--accent-hover); }
html.dark .skip-yes-btn:focus-visible { box-shadow: 0 0 0 2px oklch(22% 0.06 290), 0 0 0 4px oklch(72% 0.15 76); border-radius: 8px; }
html.dark .skip-cancel-btn { color: var(--text-muted); border-color: var(--border); }
html.dark .skip-cancel-btn:focus-visible { outline: none; box-shadow: 0 0 0 1px oklch(72% 0.15 76); border-color: oklch(72% 0.15 76); border-radius: 8px; }
html.dark .skip-cancel-btn:hover { background: var(--surface-alt); color: var(--text); }
html.dark .guess-history-item {
  color: oklch(60% 0.010 80);
  text-decoration-color: oklch(54% 0.07 240 / 0.75);
}
html.dark .autocomplete-loading,
html.dark .autocomplete-no-results { color: var(--text-muted); }
html.dark .autocomplete-list { background: oklch(22% 0.08 230); }
html.dark .autocomplete-item:hover,
html.dark .autocomplete-item.highlighted { background: oklch(35% 0.08 230); }

html.dark .pgb-timer-val { color: var(--text-muted); }

/* Post-game — shared dark mode hierarchy */
html.dark .pgb-eyebrow { color: var(--text-muted); }
html.dark .pgb-author  { color: var(--text-muted); }
html.dark .pgb-stat-label { color: var(--text-muted); }

/* Result section divider */
html.dark .puzzle-card__result { border-top-color: oklch(88% 0.04 88 / 0.40); }

/* Won state — ceremonial reveal */
html.dark .puzzle-card__result--won .pgb-eyebrow {
  color: var(--accent);
  letter-spacing: 0.22em;
}
html.dark .puzzle-card__result--won .pgb-title {
  color: oklch(97% 0.024 84);
  text-shadow: 0 0 48px oklch(72% 0.15 76 / 0.18);
}
html.dark .pc-result-star {
  filter: drop-shadow(0 0 4px oklch(72% 0.15 76 / 0.55))
          drop-shadow(0 0 12px oklch(72% 0.15 76 / 0.28));
}

/* Lost state — gentle, complete */
html.dark .puzzle-card__result--lost .pgb-eyebrow { color: var(--text-faint); }
html.dark .puzzle-card__result--lost .pgb-title   { color: oklch(82% 0.014 82); }

/* Ledger — stamps */
html.dark .stamp-svg text:not(.stamp-arc-label) { fill: oklch(94% 0.028 84); }
html.dark .stamp-caption { color: oklch(80% 0.016 84); }

/* Ledger — plate titles */
html.dark .ledger-plate-title { color: oklch(94% 0.028 84); margin-bottom: 8px; }

/* Ledger — guess distribution */
html.dark .lbar-label { color: var(--text-muted); }
html.dark .lbar-num   { color: var(--text-muted); }

/* Ledger — recent puzzles */
html.dark .re-date { color: oklch(72% 0.014 84); }
html.dark .re-empty { color: var(--text-muted); }
html.dark .re-title-text { color: oklch(94% 0.028 84); }

/* Ledger — stat tomes */
html.dark .lt-title { color: oklch(94% 0.028 84); }
html.dark .lt-dots { border-bottom-color: var(--text-faint); }
html.dark .lt-label { color: oklch(72% 0.014 84); }

/* Ledger — panel framing: no borders; graduated surface grounds the lower sections */
html.dark .ledger-paper:has(.ledger-stamps),
html.dark .ledger-paper:has(.ledger-plates),
html.dark .ledger-paper:has(.ledger-tomes) {
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
html.dark .ledger-paper:has(.ledger-stamps) { background: transparent; }
html.dark .ledger-paper:has(.ledger-plates) { background: oklch(22% 0.05 280 / 0.22); }
html.dark .ledger-paper:has(.ledger-tomes)  { background: oklch(22% 0.05 280 / 0.32); }
/* Strengthen internal column dividers now that outer borders are gone */
html.dark .ledger-plate:not(:last-child) { border-right-color: oklch(88% 0.04 88 / 0.45); }
html.dark .ledger-tome:not(:last-child)  { border-right-color: oklch(88% 0.04 88 / 0.45); }
/* More breathing room between sections */
html.dark .ledger-section-rule { margin: 20px 0 24px; }

html.dark #stat-daily-win-streak .stat-icon { color: oklch(72% 0.20 42); }
html.dark #stat-daily-play-streak .stat-icon { color: oklch(72% 0.14 275); }

html.dark .guide-section-h { color: oklch(97% 0.024 84); }
html.dark .example-wrap {
  background: oklch(22% 0.05 280 / 0.55);
  border-color: oklch(88% 0.04 88 / 0.38);
  box-shadow: 0 2px 12px oklch(0% 0 0 / 0.30);
}
html.dark .example-summary { color: var(--text); border-bottom-color: oklch(88% 0.04 88 / 0.28); }
html.dark .example-clue { border-bottom-color: oklch(88% 0.04 88 / 0.20); }
html.dark .clue-ladder-row + .clue-ladder-row { border-top-color: oklch(88% 0.04 88 / 0.14); }
html.dark .ecl { color: oklch(58% 0.12 225); }
html.dark .ecl.locked-label { color: var(--text-muted); }
html.dark .ecv.locked { color: var(--text-muted); }

.book-dot-border { display: none; }
html.dark .book.unplayed .book-dot-border { display: block; }
html.dark .book.unplayed:hover .book-inner,
html.dark .book.unplayed:focus-visible .book-inner {
  background: oklch(0% 0 0 / 0.22);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.10), 2px 0 10px oklch(0% 0 0 / 0.35);
}
html.dark .book.unplayed:hover .book-ornament-dark,
html.dark .book.unplayed:focus-visible .book-ornament-dark {
  display: block;
  color: oklch(76% 0.11 78 / 0.65);
}
html.dark .book.unplayed:hover .book-dot-border rect,
html.dark .book.unplayed:focus-visible .book-dot-border rect {
  stroke: oklch(78% 0.12 78);
  stroke-width: 2;
}
html.dark .book.unplayed:hover .book-num,
html.dark .book.unplayed:focus-visible .book-num { color: oklch(82% 0.10 80 / 0.80); }

html.dark .book.unplayed .book-inner {
  background: oklch(0% 0 0 / 0.12);
  box-shadow: none;
}
html.dark .book.unplayed .book-inner::before { display: none; }

html.dark .book-tip {
  background: oklch(20% 0.07 285);
  border-color: oklch(62% 0.10 78);
  color: var(--text);
  box-shadow: 0 2px 4px oklch(0% 0 0 / .50), 0 6px 24px oklch(0% 0 0 / .60);
}
html.dark .book-tip::after  { border-top-color: oklch(62% 0.10 78); }
html.dark .book-tip::before { border-top-color: oklch(20% 0.07 285); }

html.dark .book-inner {
  box-shadow:
    inset -4px 0 8px oklch(0% 0 0 / 0.35),
    inset  2px 0 5px oklch(100% 0 0 / 0.04),
    3px 0 10px oklch(0% 0 0 / 0.40),
    -1px 0 3px oklch(0% 0 0 / 0.18);
}
html.dark .book:not(.unplayed):hover .book-inner {
  box-shadow:
    inset -4px 0 8px oklch(0% 0 0 / 0.42),
    inset  2px 0 5px oklch(100% 0 0 / 0.06),
    4px 0 14px oklch(0% 0 0 / 0.52),
    -1px 0 4px oklch(0% 0 0 / 0.22);
}
html.dark .book:not(.unplayed) .book-title { color: oklch(96% 0.06 85); font-weight: 700; }
html.dark .book:not(.unplayed) .book-num { color: var(--text-faint); opacity: 1; }
html.dark .book:not(.unplayed) .book-rule-bottom { background: var(--text-faint); }

html.dark .book-ornament { display: none; }
html.dark .book-ornament-dark {
  display: block; position: absolute; bottom: 8px; left: 50%;
  transform: translateX(-50%); width: 10px; height: 10px; z-index: 2; pointer-events: none;
}
html.dark .book.won  .book-ornament-dark { color: oklch(82% 0.16 72); filter: drop-shadow(0 0 3px oklch(82% 0.16 72 / 0.65)); }
html.dark .book.lost .book-ornament-dark { color: oklch(72% 0.04 240); filter: none; }
html.dark .book.unplayed .book-ornament-dark { display: none; }
html.dark .book.unplayed .book-title { color: oklch(88% 0.12 82 / 0.75); opacity: 1; }
html.dark .book.unplayed .book-num  { color: oklch(74% 0.08 80 / 0.50); opacity: 1; }

html.dark .bc-rose       .book-inner { background: linear-gradient(160deg, oklch(50% 0.11 68),  oklch(42% 0.12 64));  } /* amber     h=68  antique gold    */
html.dark .bc-caramel    .book-inner { background: linear-gradient(160deg, oklch(36% 0.09 260), oklch(28% 0.10 258)); } /* navy      h=260 midnight        */
html.dark .bc-periwinkle .book-inner { background: linear-gradient(160deg, oklch(46% 0.10 28),  oklch(38% 0.11 25));  } /* rust      h=28  dark terracotta  */
html.dark .bc-mauve      .book-inner { background: linear-gradient(160deg, oklch(38% 0.11 318), oklch(30% 0.12 315)); } /* plum      h=318 aubergine        */
html.dark .bc-peach      .book-inner { background: linear-gradient(160deg, oklch(38% 0.09 205), oklch(30% 0.10 202)); } /* forest    h=205 cool teal        */
html.dark .bc-lavender   .book-inner { background: linear-gradient(160deg, oklch(40% 0.12 348), oklch(32% 0.13 345)); } /* burgundy  h=348 deep wine        */
html.dark .bc-blush      .book-inner { background: linear-gradient(160deg, oklch(36% 0.10 235), oklch(28% 0.11 232)); } /* teal      h=235 deep blue-teal   */
html.dark .bc-slate      .book-inner { background: linear-gradient(160deg, oklch(38% 0.11 295), oklch(30% 0.12 293)); } /* violet    h=295 dusty violet     */

/* ── SETTINGS PAGE ───────────────────────────────────────────────────────── */
.stt-section { margin-top: 28px; }

.stt-entry {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow-sm);
}
html.dark .stt-entry {
  background: oklch(22% 0.06 290 / 0.45); backdrop-filter: blur(10px);
  border-color: oklch(88% 0.04 88 / 0.30);
}
.stt-entry--soon { opacity: 0.4; pointer-events: none; }

.stt-entry-row { display: flex; align-items: center; gap: 20px; }
.stt-entry-left { flex: 1; min-width: 0; }
.stt-entry-right { flex-shrink: 0; }

@media (max-width: 460px) {
  .stt-entry-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .stt-choices { display: flex; }
}

.stt-entry-heading {
  font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 3px;
}
html.dark .stt-entry-heading { color: oklch(93% 0.020 84); }

.stt-entry-desc { font-size: 13px; color: var(--text-muted); line-height: 1.45; margin: 0; }

.stt-note {
  font-size: 12px; color: var(--text-faint); line-height: 1.5; margin: 10px 0 0;
}

.stt-choices { display: inline-flex; gap: 10px; }

.stt-choice {
  flex: 1; appearance: none; cursor: pointer; white-space: nowrap;
  border: 1.5px solid var(--border); background: none; border-radius: 8px;
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
  color: var(--text-muted); padding: 6px 13px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.stt-choice:hover { border-color: var(--text-faint); color: var(--text); }
.stt-choice[aria-pressed="true"] {
  border-color: var(--accent); color: var(--accent);
  background: oklch(72% 0.15 76 / 0.09); font-weight: 600;
}
html.dark .stt-choice[aria-pressed="true"] { background: oklch(72% 0.15 76 / 0.18); }
/* Unselected focused → border unchanged, gap blends into background, one amber ring visible */
.stt-choice:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px oklch(56% 0.15 74); border-radius: 8px; }
html.dark .stt-choice:focus-visible { box-shadow: 0 0 0 2px oklch(22% 0.06 290), 0 0 0 3.5px oklch(72% 0.15 76); border-radius: 8px; }
/* Selected focused → amber border creates inner ring; outer ring same width (1.5px each) */
.stt-choice[aria-pressed="true"]:focus-visible { border-color: oklch(56% 0.15 74); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px oklch(56% 0.15 74); }
html.dark .stt-choice[aria-pressed="true"]:focus-visible { border-color: oklch(72% 0.15 76); box-shadow: 0 0 0 2px oklch(22% 0.06 290), 0 0 0 3.5px oklch(72% 0.15 76); }

.stt-soon-label { font-size: 12px; color: var(--text-faint); font-style: italic; }