/* ═══════════════════════════════════════════════
   style.css — The Daily Word — Newspaper Theme
════════════════════════════════════════════════ */

/* ── Tokens ───────────────────────────────────── */
:root {
  --paper:        #F4EFE4;
  --paper-dark:   #EBE4D5;
  --paper-light:  #FAF7F2;
  --ink:          #1A1714;
  --ink-soft:     #3D3830;
  --ink-muted:    #7A7060;
  --gold:         #C8973A;
  --gold-light:   #F0D060;
  --gold-pale:    #FDF3D0;
  --red:          #B5341C;
  --red-pale:     #FCE8E4;
  --cream-border: #C8B99A;
  --shadow:       rgba(26,23,20,0.18);

  /* Rainbow drag colors */
  --drag-1: #FF6B6B;
  --drag-2: #FFA94D;
  --drag-3: #FFD43B;
  --drag-4: #69DB7C;
  --drag-5: #4DABF7;
  --drag-6: #CC5DE8;

  /* Fonts */
  --font-display:  'Playfair Display', Georgia, serif;
  --font-display-sc: 'Playfair Display SC', Georgia, serif;
  --font-body:     'Libre Baskerville', Georgia, serif;
  --font-mono:     'IBM Plex Mono', 'Courier New', monospace;

  /* Layout */
  --max-width: 900px;
  --header-h:  64px;
}

/* ── Reset ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
input, button { font-family: inherit; }

/* ── Paper grain texture ─────────────────────── */
.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.045;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 300px 300px;
}

/* ── Screen routing ───────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
}
.screen.active { display: flex; }

/* ════════════════════════════════════════════════
   MASTHEAD
════════════════════════════════════════════════ */
.masthead {
  text-align: center;
  padding: 1.5rem 1rem 0;
}
.masthead-rule {
  border: none;
  border-top: 3px solid var(--ink);
  margin: 0.3rem auto;
  max-width: 600px;
}
.masthead-rule.double {
  border-top: 1px solid var(--ink);
  margin-top: 0.15rem;
  box-shadow: 0 3px 0 0 var(--ink);
  padding-bottom: 3px;
}
.masthead-inner {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.4rem 0;
}
.masthead-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.masthead-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 4.8rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.masthead-tagline {
  font-family: var(--font-display-sc);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* ════════════════════════════════════════════════
   HOME SCREEN
════════════════════════════════════════════════ */
.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  gap: 2rem;
}
.home-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}
.home-byline {
  font-size: 0.9rem;
  color: var(--ink-muted);
  font-style: italic;
}
.input-row { width: 100%; }
.name-input {
  width: 100%;
  padding: 0.85rem 1.1rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  background: var(--paper-light);
  border: 2px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  outline: none;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.name-input::placeholder { color: var(--ink-muted); }
.name-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,151,58,0.2);
}
.home-nav {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 0.7rem;
}

/* ── Buttons ──────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display-sc);
  font-size: 1rem;
  letter-spacing: 0.1em;
  border: 2px solid var(--ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.btn-primary:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display-sc);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  border: 2px solid var(--cream-border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.btn-secondary:hover {
  border-color: var(--ink);
  background: var(--paper-dark);
}
.btn-secondary:active { transform: scale(0.98); }

.btn-icon { font-size: 1.1em; }

.btn-back {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--cream-border);
  letter-spacing: 0.02em;
  transition: color 0.15s, border-color 0.15s;
}
.btn-back:hover { color: var(--ink); border-color: var(--ink); }

.home-decoration {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  max-width: 420px;
}
.deco-rule { flex: 1; height: 1px; background: var(--cream-border); }
.deco-ornament {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--gold);
  letter-spacing: 0.3em;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════
   PAGE HEADER (shared by Setup, Leaderboard, Help)
════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
}

/* ════════════════════════════════════════════════
   SETUP SCREEN
════════════════════════════════════════════════ */
.setup-main {
  flex: 1;
  padding: 1.2rem 1rem 6rem;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}
.setup-section {}
.setup-label {
  font-family: var(--font-display-sc);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--ink-muted);
  margin-bottom: 0.7rem;
  border-bottom: 1px solid var(--cream-border);
  padding-bottom: 0.3rem;
}

/* Difficulty buttons */
.difficulty-row {
  display: flex;
  gap: 0.7rem;
}
.diff-btn {
  flex: 1;
  padding: 0.8rem 0.5rem;
  background: var(--paper-light);
  border: 2px solid var(--cream-border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  transition: border-color 0.15s, background 0.15s;
}
.diff-btn:hover { border-color: var(--ink-soft); }
.diff-btn.active {
  border-color: var(--ink);
  background: var(--paper-dark);
  box-shadow: 3px 3px 0 var(--ink);
}
.diff-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}
.diff-desc {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-muted);
}

/* Time buttons */
.time-row { display: flex; gap: 0.7rem; }
.time-btn {
  flex: 1;
  padding: 0.7rem;
  background: var(--paper-light);
  border: 2px solid var(--cream-border);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.time-btn:hover { border-color: var(--ink-soft); }
.time-btn.active {
  border-color: var(--ink);
  background: var(--paper-dark);
  box-shadow: 3px 3px 0 var(--ink);
}

/* Topic search */
.setup-topics { flex: 1; }
.topic-search-wrap { margin-bottom: 0.8rem; }
.topic-search {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 2px solid var(--cream-border);
  background: var(--paper-light);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
}
.topic-search:focus { border-color: var(--gold); }

/* Category tabs */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}
.cat-tab {
  padding: 0.25rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  border: 1px solid var(--cream-border);
  background: transparent;
  cursor: pointer;
  color: var(--ink-soft);
  transition: background 0.12s, border-color 0.12s;
}
.cat-tab:hover { border-color: var(--ink-soft); background: var(--paper-dark); }
.cat-tab.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Topic grid */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  max-height: 360px;
  overflow-y: auto;
  padding: 0.2rem;
  border: 1px solid var(--cream-border);
  background: var(--paper-light);
}
.topic-grid::-webkit-scrollbar { width: 6px; }
.topic-grid::-webkit-scrollbar-track { background: var(--paper-dark); }
.topic-grid::-webkit-scrollbar-thumb { background: var(--cream-border); }

.topic-card {
  padding: 0.55rem 0.5rem;
  background: var(--paper);
  border: 1px solid var(--cream-border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-align: center;
  transition: border-color 0.12s, background 0.12s, transform 0.1s;
}
.topic-card:hover { border-color: var(--ink-soft); background: var(--paper-dark); }
.topic-card.selected {
  border-color: var(--ink);
  background: var(--gold-pale);
  box-shadow: 2px 2px 0 var(--gold);
}
.topic-card.selected .topic-card-name { font-weight: 700; }
.topic-card-emoji { font-size: 1.3rem; line-height: 1; }
.topic-card-name {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--ink);
  line-height: 1.3;
}

.setup-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: var(--paper);
  border-top: 2px solid var(--ink);
  z-index: 20;
}
.btn-start { max-width: var(--max-width); margin: 0 auto; }

/* ════════════════════════════════════════════════
   GAME SCREEN
════════════════════════════════════════════════ */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 0.5rem;
}
.game-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.game-topic-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.85rem, 3vw, 1.1rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.game-stats {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-muted);
  display: flex;
  gap: 0.4rem;
}
.stat-score { color: var(--gold); font-weight: 700; }
.stat-timer { letter-spacing: 0.05em; }
.stat-timer.warning { color: var(--red); animation: pulse-red 1s ease-in-out infinite; }
@keyframes pulse-red { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.game-diff-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--cream-border);
  white-space: nowrap;
  color: var(--ink-muted);
}

/* Game layout */
.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  gap: 1rem;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 700px) {
  .game-main {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
  }
}

/* Grid */
.grid-wrapper {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.grid-container {
  display: inline-grid;
  border: 2px solid var(--ink);
  background: var(--paper-light);
  cursor: url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 2L14 14M14 2L2 14" stroke="%231a1714" stroke-width="2.5" stroke-linecap="round"/></svg>') 8 8, crosshair;
  box-shadow: 4px 4px 0 var(--ink);
  touch-action: none;
}
.grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  border: 1px solid rgba(26,23,20,0.08);
  position: relative;
  transition: color 0.1s;
  cursor: url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 2L14 14M14 2L2 14" stroke="%231a1714" stroke-width="2.5" stroke-linecap="round"/></svg>') 8 8, crosshair;
}
.grid-cell.drag-active {
  color: var(--paper);
  z-index: 2;
}
.grid-cell.found {
  background: var(--gold-pale) !important;
  color: var(--ink-soft) !important;
}
.grid-cell.found::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(200,151,58,0.25);
}
.grid-cell.hint-glow {
  animation: hint-pulse 0.5s ease-in-out 3;
}
@keyframes hint-pulse {
  0%, 100% { background: var(--paper-light); }
  50%       { background: var(--gold-light); box-shadow: 0 0 8px var(--gold); }
}

/* Drag rainbow — applied via JS inline style */
.grid-cell.drag-1 { background: var(--drag-1); }
.grid-cell.drag-2 { background: var(--drag-2); }
.grid-cell.drag-3 { background: var(--drag-3); }
.grid-cell.drag-4 { background: var(--drag-4); }
.grid-cell.drag-5 { background: var(--drag-5); }
.grid-cell.drag-6 { background: var(--drag-6); }

.grid-cell.shake {
  animation: cell-shake 0.35s ease;
}
@keyframes cell-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-3px) rotate(-1deg); }
  40%     { transform: translateX(3px) rotate(1deg); }
  60%     { transform: translateX(-2px); }
  80%     { transform: translateX(2px); }
}

/* Found word stamp animation */
@keyframes stamp-in {
  0%   { transform: scale(1.4); opacity: 0; }
  60%  { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}
.cell-found-anim { animation: stamp-in 0.35s cubic-bezier(.175,.885,.32,1.275) both; }

/* Word list */
.word-list-panel {
  width: 100%;
  max-width: 300px;
}
@media (min-width: 700px) {
  .word-list-panel {
    width: 200px;
    max-width: 200px;
    flex-shrink: 0;
  }
}
.word-list-header {
  font-family: var(--font-display-sc);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--cream-border);
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
}
.word-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 0.8rem;
}
@media (min-width: 700px) {
  .word-list { grid-template-columns: 1fr; }
}
.word-list-item {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
  padding: 0.15rem 0;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.word-list-item.found-word {
  color: var(--ink-muted);
  text-decoration: line-through;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
}

/* ── Hint Bubble ──────────────────────────────── */
.hint-bubble {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50px;
  padding: 0.65rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 4px 16px var(--shadow);
  opacity: 0;
  transform: translateY(20px) scale(0.85);
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s cubic-bezier(.175,.885,.32,1.275);
}
.hint-bubble.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
  animation: hint-bob 2s ease-in-out infinite;
}
@keyframes hint-bob {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-6px); }
}
.hint-mascot { font-size: 1.2rem; }
.hint-text {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.85rem;
  white-space: nowrap;
}

.hint-flash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%) scale(0.7);
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 2rem;
  padding: 0.8rem 2rem;
  border: 3px solid var(--ink);
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition: opacity 0.2s, transform 0.2s;
}
.hint-flash.show {
  opacity: 1;
  transform: translate(-50%,-50%) scale(1);
}

/* ════════════════════════════════════════════════
   RESULTS SCREEN
════════════════════════════════════════════════ */
.results-header {
  text-align: center;
  padding: 2rem 1rem 0.5rem;
}
.results-headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 900;
  color: var(--ink);
  margin: 0.5rem 0;
}
.results-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 2rem;
}
.results-card {
  width: 100%;
  max-width: 460px;
  border: 2px solid var(--ink);
  background: var(--paper-light);
  padding: 2rem;
  box-shadow: 5px 5px 0 var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.results-score-big {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}
.results-player {
  font-family: var(--font-display-sc);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}
.results-topic-info {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-align: center;
}
.results-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  border-top: 1px solid var(--cream-border);
  border-bottom: 1px solid var(--cream-border);
  padding: 1rem 0;
}
.result-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.result-stat-val {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
}
.result-stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  text-transform: uppercase;
}
.results-actions {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 0.6rem;
}

/* Confetti */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ════════════════════════════════════════════════
   LEADERBOARD SCREEN
════════════════════════════════════════════════ */
.leaderboard-main {
  flex: 1;
  padding: 1.2rem 1rem 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}
.lb-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.lb-filter-btn {
  padding: 0.4rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  border: 1px solid var(--cream-border);
  background: transparent;
  cursor: pointer;
  color: var(--ink-soft);
  transition: background 0.12s, border-color 0.12s;
}
.lb-filter-btn.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lb-filter-btn:hover:not(.active) { border-color: var(--ink-soft); }

.lb-table-wrap { overflow-x: auto; }
.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.88rem;
}
.lb-table th {
  font-family: var(--font-display-sc);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  border-bottom: 2px solid var(--ink);
  padding: 0.5rem 0.8rem;
  text-align: left;
}
.lb-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--cream-border);
  vertical-align: middle;
}
.lb-table tr:nth-child(even) td { background: var(--paper-dark); }
.lb-table tr.my-score td { background: var(--gold-pale); font-weight: 700; }
.lb-rank { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-muted); }
.lb-rank.top3 { font-weight: 700; color: var(--gold); }
.lb-score-val { font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--gold); }
.lb-diff {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--cream-border);
}
.lb-empty {
  display: none;
  text-align: center;
  padding: 3rem;
  font-style: italic;
  color: var(--ink-muted);
  font-family: var(--font-body);
}

/* ════════════════════════════════════════════════
   HELP SCREEN
════════════════════════════════════════════════ */
.help-main {
  flex: 1;
  padding: 1.5rem 1rem 2rem;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}
.help-steps { display: flex; flex-direction: column; gap: 1.4rem; }
.help-step {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
}
.help-step-num {
  flex-shrink: 0;
  width: 2.2rem;
  height: 2.2rem;
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.1rem;
  background: var(--paper-dark);
}
.help-step-body h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.3rem;
}
.help-step-body p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.highlight-demo {
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
}
.highlight-demo.gold { background: var(--gold-light); color: var(--ink); }

.help-scoring-table {
  margin-top: 2rem;
  border: 1px solid var(--cream-border);
  padding: 1.2rem;
}
.help-section-title {
  font-family: var(--font-display-sc);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--ink-muted);
  text-align: center;
  margin-bottom: 0.8rem;
}
.help-scoring-table table { width: 100%; border-collapse: collapse; }
.help-scoring-table td {
  padding: 0.5rem 0.5rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--cream-border);
}
.help-scoring-table td:last-child { text-align: right; }

/* ════════════════════════════════════════════════
   MODAL
════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,23,20,0.65);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 2rem;
  max-width: 380px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}
.modal-body {
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.modal-actions { display: flex; flex-direction: column; gap: 0.6rem; }

/* ════════════════════════════════════════════════
   RESPONSIVE GRID CELL SIZE
════════════════════════════════════════════════ */
/* Sizes set via JS based on grid size and viewport */

/* ════════════════════════════════════════════════
   SCROLLBAR GLOBAL
════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--paper-dark); }
::-webkit-scrollbar-thumb { background: var(--cream-border); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

/* ════════════════════════════════════════════════
   ANIMATIONS & TRANSITIONS
════════════════════════════════════════════════ */
@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
/* Exclude hint elements and confetti — they control their own visibility */
.screen.active > *:not(.paper-grain):not(.hint-bubble):not(.hint-flash):not(.confetti-container) {
  animation: slide-up 0.3s ease both;
}
.screen.active > .paper-grain { animation: none; }

/* Stagger child animations on setup topic grid */
.topic-card { animation: slide-up 0.2s ease both; }
