:root {
  --bg:           #fdf8f0;
  --bg-elevated:  #ffffff;
  --bg-gradient:  radial-gradient(circle at top right, #fef3da 0%, #fdf8f0 50%);
  --fg:           #181824;
  --fg-muted:     #58586a;
  --accent:       #c8a84b;
  --accent-soft:  #d8b85d;
  --accent-2:     #f5e9c8;
  --border:       #d4b97a;
  --border-soft:  rgba(212, 185, 122, 0.35);
  --tile-bg:      #ffffff;
  --glass-bg:     rgba(255, 255, 255, 0.55);
  --glass-border: rgba(24, 24, 36, 0.06);
  --shadow-xs:    0 1px 1px rgba(24, 24, 36, 0.04);
  --shadow-sm:    0 2px 6px rgba(24, 24, 36, 0.06);
  --shadow-md:    0 8px 28px rgba(24, 24, 36, 0.08);
  --shadow-lg:    0 16px 48px rgba(24, 24, 36, 0.10);
  --radius:       14px;
  --radius-sm:    10px;
  --radius-lg:    20px;
  --gutter:       16px;
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body:    'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease:         cubic-bezier(0.32, 0.72, 0.36, 1);
  --t-fast:       0.18s;
  --t-mid:        0.32s;
}

:root[data-theme="dark"] {
  --bg:           #07090e;
  --bg-elevated:  #11141c;
  --bg-gradient:  radial-gradient(circle at top right, #1a1d2c 0%, #07090e 60%);
  --fg:           #f5e9c8;
  --fg-muted:     #8a8a9a;
  --accent:       #e8c768;
  --accent-soft:  #c8a84b;
  --accent-2:     #2a2615;
  --border:       rgba(232, 199, 104, 0.20);
  --border-soft:  rgba(255, 255, 255, 0.06);
  --tile-bg:      #11141c;
  --glass-bg:     rgba(20, 24, 36, 0.55);
  --glass-border: rgba(255, 255, 255, 0.06);
  --shadow-xs:    0 1px 1px rgba(0, 0, 0, 0.4);
  --shadow-sm:    0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-md:    0 12px 32px rgba(0, 0, 0, 0.55);
  --shadow-lg:    0 24px 60px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; }

/* The `hidden` HTML attribute is supposed to set display:none, but it loses
   to any element-level `display:` rule. Make it strict so [hidden] always
   means hidden — was causing the flashcard 'Try again / Got it' buttons to
   show before flip, etc. */
[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg-gradient), var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
  padding-bottom: env(safe-area-inset-bottom);
}

/* Route transition — applies to whatever lives inside #app */
#app > section {
  animation: fade-up var(--t-mid) var(--ease);
  animation-fill-mode: backwards;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  #app > section { animation: none; }
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 900;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: var(--fg);
}

h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 4vw, 1.85rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, .button {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--accent-2);
  color: var(--fg);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  transition: transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              filter var(--t-fast) var(--ease);
}
button:hover, .button:hover {
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transform: translateY(-1px);
}
button:active, .button:active { transform: translateY(0); }
button:focus-visible, .button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Site header ─────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--glass-border);
}
.site-nav {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--fg);
  transition: background 0.1s ease;
}
.nav-link:hover { background: var(--accent-2); text-decoration: none; }

.site-brand {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.6rem;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.site-brand:hover { text-decoration: none; color: var(--accent); }

.site-subtitle {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Page container ──────────────────────────────────────── */
.app-container {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px var(--gutter) 64px;
}

.loading {
  text-align: center;
  color: var(--fg-muted);
  padding: 48px var(--gutter);
}

.error {
  text-align: center;
  color: #b22;
  padding: 48px var(--gutter);
}

/* ── Home screen ─────────────────────────────────────────── */
.home-intro {
  margin-bottom: 32px;
}
.home-intro p {
  color: var(--fg-muted);
  font-size: 1.1rem;
  margin: 0;
}

.stats-row {
  display: flex;
  gap: 24px;
  padding: 16px 20px;
  margin: 24px 0;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-value {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}
.stat-label {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.chapter-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 150px;
  padding: 18px 18px 16px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--fg);
  transition: transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
  position: relative;
  overflow: hidden;
}
.chapter-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent) 0%, transparent 40%);
  opacity: 0;
  transition: opacity var(--t-mid) var(--ease);
  pointer-events: none;
}
.chapter-tile:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.chapter-tile:hover::before { opacity: 0.05; }
.chapter-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chapter-due-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  background: var(--accent);
  color: #1a1a24;
  border-radius: 999px;
  z-index: 2;
}
.chapter-tile-bar {
  width: 100%;
  height: 4px;
  background: var(--accent-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 8px;
  position: relative;
  z-index: 1;
}
.chapter-tile-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  border-radius: 999px;
  transition: width 0.4s var(--ease);
}
.chapter-num {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}
.chapter-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.2;
  color: var(--fg);
  margin-bottom: 12px;
}
.chapter-meta {
  font-size: 0.8rem;
  color: var(--fg-muted);
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.chapter-meta .pill {
  background: transparent;
  color: var(--fg-muted);
  padding: 0;
  border-radius: 0;
  font-weight: 500;
}

/* ── Chapter screen ──────────────────────────────────────── */
.crumbs {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--fg-muted);
}
.crumbs a { color: var(--fg-muted); }

.chapter-header {
  margin-bottom: 28px;
}
.chapter-header h1 {
  margin-bottom: 4px;
}
.chapter-header .chapter-subtitle {
  color: var(--fg-muted);
  margin: 0;
  font-size: 1.05rem;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 16px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-left: 6px solid var(--mode-accent, var(--accent));
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--fg);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.mode-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.mode-card[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.mode-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--mode-accent, var(--fg));
}
.mode-desc {
  color: var(--fg-muted);
  font-size: 0.95rem;
  line-height: 1.35;
}
.mode-status {
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Home: hero level pill ─────────────────────────────── */
.level-pill {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin: 20px 0 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  color: #1a1a24;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-weight: 600;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}
.level-tag {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.4rem;
  line-height: 1;
  padding: 6px 12px;
  background: rgba(24, 24, 36, 0.16);
  border-radius: 8px;
  color: #1a1a24;
  letter-spacing: 0.04em;
}
.level-text {
  flex: 1;
  font-size: 0.95rem;
  color: rgba(24, 24, 36, 0.9);
  min-width: 180px;
}
.level-text strong {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.05rem;
}
.level-bar {
  flex-basis: 100%;
  height: 6px;
  background: rgba(24, 24, 36, 0.15);
  border-radius: 999px;
  overflow: hidden;
}
.level-fill {
  height: 100%;
  background: linear-gradient(90deg, #1a1a24, rgba(24,24,36,0.7));
  border-radius: 999px;
  transition: width 0.6s var(--ease);
}

/* ── Home: progress + goal ring ─────────────────────────── */
.home-progress {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 22px;
  margin: 0 0 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.progress-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 160px;
}
.progress-item { display: flex; flex-direction: column; gap: 2px; }
.progress-value {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--fg);
  line-height: 1.1;
}
.progress-label {
  font-size: 0.82rem;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.goal-ring { width: 120px; height: 120px; flex-shrink: 0; }
.ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
  opacity: 0.35;
}
.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}
.ring-text-big, .ring-text-small {
  fill: var(--fg);
  font-family: var(--font-heading);
  font-weight: 900;
  transform: rotate(90deg);
  transform-origin: 50px 50px;
  dominant-baseline: middle;
}
.ring-text-big { font-size: 22px; }
.ring-text-small { font-size: 11px; fill: var(--fg-muted); font-weight: 600; }

/* ── Search ───────────────────────────────────────────────── */
.search-row {
  display: flex;
  gap: 8px;
  margin: 20px 0 24px;
}
.search-input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 1.05rem;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--tile-bg);
  color: var(--fg);
  outline: none;
  transition: border-color 0.1s ease, box-shadow 0.1s ease;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.search-submit { flex-shrink: 0; }
.search-meta {
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin: 8px 0 16px;
}

/* ── Daily Mix / Mistakes CTAs ─────────────────────────────── */
.home-cta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.cta-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(135deg, var(--accent-2) 0%, var(--tile-bg) 100%);
  border: 1px solid var(--border);
  border-left: 6px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--fg);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.cta-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.cta-card.cta-disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}
.cta-card.cta-mistakes { border-left-color: #c75a1a; }
.cta-card.cta-starred  { border-left-color: var(--accent); }
.cta-starred .cta-icon { background: var(--accent); }
.cta-body { display: flex; flex-direction: column; gap: 2px; }
.cta-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cta-mistakes .cta-icon { background: #c75a1a; }
.cta-arrow {
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  transition: transform var(--t-fast) var(--ease);
}
.cta-card:hover .cta-arrow { transform: translateX(4px); color: var(--accent); }
.cta-eyebrow {
  font-size: 0.78rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cta-title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.4rem;
  color: var(--fg);
  line-height: 1.15;
}
.cta-desc { color: var(--fg-muted); font-size: 0.92rem; }

/* ── Entry list (chapter + search results) ─────────────────── */
.entries-header { margin-top: 32px; }
.entries-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
}
.entry-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  padding: 10px 14px;
  background: var(--tile-bg);
  border-bottom: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  align-items: baseline;
  transition: background 0.1s ease;
}
.entry-row:hover {
  background: var(--accent-2);
  text-decoration: none;
}
.entry-de {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--fg);
}
.entry-en {
  font-size: 0.95rem;
  color: var(--fg-muted);
}
.entry-loc {
  font-size: 0.78rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ── Word detail ──────────────────────────────────────────── */
.word-detail .word-header { margin-bottom: 24px; }
.word-detail .word-de-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  transition: color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}
.star-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-2);
}
.star-btn.is-starred {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-2);
}
.star-btn.is-starred:hover { transform: scale(1.05); }
.star-btn:active { transform: scale(0.92); }
.word-detail .word-de {
  font-size: clamp(2rem, 6vw, 2.8rem);
  margin: 0;
}
.word-detail .word-en {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--fg-muted);
  margin: 0 0 12px;
}
.word-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.word-meta .pill {
  background: var(--accent-2);
  color: var(--fg);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.word-meta .pill.type-noun     { background: #ead7e7; color: #6c3eb5; }
.word-meta .pill.type-verb     { background: #d6ebe3; color: #1d6a3f; }
.word-meta .pill.type-adjective{ background: #d2e6e6; color: #1a8a8a; }
.word-meta .pill.type-adverb   { background: #d2e0ea; color: #1a4a8a; }
.word-meta .pill.type-phrase   { background: #f0d9c4; color: #c75a1a; }
.word-meta .pill.type-other    { background: #efe7d0; color: #b8860b; }

:root[data-theme="dark"] .word-meta .pill.type-noun     { background: rgba(155, 111, 216, 0.18); color: #b48fe0; }
:root[data-theme="dark"] .word-meta .pill.type-verb     { background: rgba(108, 183, 135, 0.18); color: #82c7a0; }
:root[data-theme="dark"] .word-meta .pill.type-adjective{ background: rgba(63, 191, 191, 0.18); color: #6cd0d0; }
:root[data-theme="dark"] .word-meta .pill.type-adverb   { background: rgba(94, 142, 216, 0.18); color: #82a8e0; }
:root[data-theme="dark"] .word-meta .pill.type-phrase   { background: rgba(224, 127, 74, 0.18); color: #e89878; }
:root[data-theme="dark"] .word-meta .pill.type-other    { background: rgba(232, 199, 104, 0.18); color: #e8c768; }

.word-block { margin-bottom: 24px; }
.word-block h3 {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.word-block h3 .icon { color: var(--accent); }
.word-examples { display: flex; flex-direction: column; gap: 10px; }
.word-example-card {
  background: var(--accent-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.word-example-card.is-generated {
  background: var(--bg-elevated);
  border-style: dashed;
}
.example-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.example-text { flex: 1; }
.example-text .example-de {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--fg);
  margin: 0;
  line-height: 1.4;
}
.example-text .example-en {
  font-size: 0.98rem;
  color: var(--fg-muted);
  font-style: italic;
  margin: 4px 0 0;
  line-height: 1.4;
}
.example-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}
.example-note .icon { opacity: 0.7; }
.word-conjugation {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
  background: var(--accent-2);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 0;
}
.word-progress {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.prog-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.prog-num {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.6rem;
  color: var(--accent);
}
.prog-text { font-family: var(--font-heading); font-size: 1rem; color: var(--fg); }
.prog-label { font-size: 0.78rem; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.word-not-seen { color: var(--fg-muted); }

/* ── Settings page ───────────────────────────────────────── */
.settings-page h1 { margin-bottom: 8px; }
.settings-block {
  margin-bottom: 32px;
  padding: 20px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.settings-block h3 {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 14px;
  font-family: var(--font-body);
  font-weight: 600;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.settings-row:last-child { border-bottom: none; }
.settings-name {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
}
.settings-desc {
  display: block;
  color: var(--fg-muted);
  font-size: 0.88rem;
  margin-top: 2px;
}
.settings-row input[type="checkbox"] {
  width: 44px; height: 26px;
  -webkit-appearance: none; appearance: none;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.settings-row input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform 0.15s ease;
}
.settings-row input[type="checkbox"]:checked { background: var(--accent); }
.settings-row input[type="checkbox"]:checked::before { transform: translateX(18px); }
.settings-row select,
.settings-row .settings-num {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--tile-bg);
  color: var(--fg);
  max-width: 260px;
  flex-shrink: 0;
}
.settings-num { width: 80px; text-align: center; }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.settings-status { color: var(--fg-muted); font-size: 0.9rem; min-height: 1.2em; }
.status-error { color: #a8331a; }
.danger-block { border-color: #d8856e; }
.button-danger { background: #a8331a; color: white; border-color: #a8331a; }
.button-danger:hover { background: #872913; }
:root[data-theme="dark"] .status-error { color: #f08d76; }
:root[data-theme="dark"] .danger-block { border-color: rgba(216, 133, 110, 0.5); }
:root[data-theme="dark"] .button-danger { background: #c75a1a; border-color: #c75a1a; }
:root[data-theme="dark"] .button-danger:hover { background: #a8331a; }

/* ── Stats page ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.stat-card.stat-card-accent { border-color: var(--accent); }
.stat-card .stat-big {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 2.2rem;
  color: var(--accent);
  line-height: 1;
}
.stat-card .stat-bigger { font-size: 1rem; color: var(--fg-muted); margin-top: -4px; }
.stat-card .stat-cap {
  font-size: 0.82rem;
  color: var(--fg-muted);
  letter-spacing: 0.03em;
}

.chart {
  width: 100%;
  height: auto;
  max-height: 240px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-sizing: border-box;
  margin-bottom: 32px;
}
.chart-axis { stroke: var(--border); stroke-width: 1; }
.chart-area { fill: var(--accent); opacity: 0.15; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot  { fill: var(--accent); }
.chart-label { fill: var(--fg-muted); font-size: 11px; font-family: var(--font-body); }

.box-dist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.box-row {
  display: grid;
  grid-template-columns: 110px 1fr 48px;
  gap: 12px;
  align-items: center;
}
.box-label { font-size: 0.85rem; color: var(--fg-muted); }
.box-bar { height: 14px; background: var(--accent-2); border-radius: 7px; overflow: hidden; }
.box-fill { height: 100%; transition: width 0.4s ease; }
.box-fill.box-bg     { background: var(--border); opacity: 0.5; }
.box-fill.box-fill-1 { background: #d8856e; }
.box-fill.box-fill-2 { background: #d8a557; }
.box-fill.box-fill-3 { background: #c8a84b; }
.box-fill.box-fill-4 { background: #6cb787; }
.box-fill.box-fill-5 { background: #1d6a3f; }
.box-count { font-weight: 600; text-align: right; font-size: 0.9rem; color: var(--fg); }
.empty { color: var(--fg-muted); font-style: italic; padding: 24px 0; }

/* ── Icon defaults ─────────────────────────────────────── */
.icon { display: inline-block; vertical-align: -0.18em; flex-shrink: 0; }
.progress-icon-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.progress-icon-row .icon { color: var(--accent); }

/* ── Onboarding card (first visit) ─────────────────────── */
.onboarding-card {
  margin: 0 0 32px;
  padding: 28px;
  background: linear-gradient(135deg, var(--accent-2) 0%, var(--tile-bg) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.onboard-header { margin-bottom: 18px; }
.onboard-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}
.onboard-header h2 { margin: 0; font-size: clamp(1.4rem, 4vw, 1.85rem); }
.onboard-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.onboard-steps li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
}
.step-num,
.step-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.05rem;
  box-shadow: var(--shadow-sm);
}
.onboard-steps li > div { display: flex; flex-direction: column; gap: 2px; }
.onboard-steps strong { font-family: var(--font-heading); font-weight: 700; font-size: 1.05rem; }
.onboard-steps span { color: var(--fg-muted); font-size: 0.95rem; line-height: 1.45; }
.onboard-footer { margin: 16px 0 0; }

/* ── Chapter tip + recommended mode ────────────────────── */
.chapter-tip {
  background: var(--accent-2);
  border-left: 4px solid var(--accent);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 16px 0 20px;
  color: var(--fg);
  font-size: 0.95rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.chapter-tip .icon { color: var(--accent); flex-shrink: 0; margin-top: 1px; }

.mode-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--mode-accent) 14%, transparent);
  color: var(--mode-accent);
  margin-bottom: 4px;
}
.mode-when { display: none; }
.mode-status {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.7;
}
.mode-card:hover .mode-status { opacity: 1; }
.mode-card:hover .mode-status .icon { transform: translateX(3px); transition: transform var(--t-fast) var(--ease); }
.mode-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  background: var(--mode-accent);
  color: white;
  border-radius: 999px;
  opacity: 0.92;
}
.mode-recommended { position: relative; }
.mode-recommended {
  background: linear-gradient(135deg, color-mix(in srgb, var(--mode-accent) 8%, var(--tile-bg)) 0%, var(--tile-bg) 100%);
}

/* ── Help page ─────────────────────────────────────────── */
.help-page h1 { margin-bottom: 24px; }
.help-block {
  margin-bottom: 32px;
}
.help-block h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.help-block h3 .icon { color: var(--accent); }
.help-mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.help-mode-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--mode-accent) 14%, transparent);
  color: var(--mode-accent);
}
.help-block p { margin: 0 0 12px; line-height: 1.6; }
.help-block ul.help-tips {
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}
.help-tips li { line-height: 1.5; }
.help-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.help-mode {
  padding: 14px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--mode-accent);
  border-radius: var(--radius-sm);
}
.help-mode h4 {
  margin: 0 0 4px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
}
.help-mode p { margin: 0; font-size: 0.92rem; color: var(--fg-muted); line-height: 1.5; }
.help-mode-when {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mode-accent);
  display: block;
  margin-bottom: 4px;
}
.help-note {
  color: var(--fg-muted);
  font-style: italic;
  font-size: 0.95rem;
}
.kbd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.kbd-grid > div {
  padding: 10px 14px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}
kbd {
  font-family: var(--font-body);
  background: var(--accent-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-right: 2px;
  display: inline-block;
  min-width: 26px;
  text-align: center;
}

/* ── Chapter detail hero ───────────────────────────────── */
.chapter-page .chapter-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  padding: 28px;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--accent-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin: 0 0 28px;
  position: relative;
  overflow: hidden;
}
.chapter-page .chapter-hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  opacity: 0.15;
  pointer-events: none;
}
.chapter-hero-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1;
}
.chapter-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.chapter-hero-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.1;
}
.chapter-hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.hpill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg);
}
.chapter-hero-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.chp-bar {
  flex: 1;
  height: 8px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  max-width: 280px;
}
.chp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  border-radius: 999px;
  transition: width 0.4s var(--ease);
}
.chp-label { font-size: 0.95rem; color: var(--fg-muted); }
.chp-label strong { color: var(--fg); font-family: var(--font-heading); font-weight: 700; }
.chapter-hero-meta {
  display: flex;
  gap: 12px;
  align-items: stretch;
  flex-wrap: wrap;
  z-index: 1;
}
.chapter-hero-meta .dm-stat {
  background: var(--tile-bg);
  border: 1px solid var(--border);
  backdrop-filter: none;
}
.chapter-hero-meta .dm-stat-num { color: var(--accent); }

.chapter-page h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chapter-page h2 .icon { color: var(--accent); }

@media (max-width: 700px) {
  .chapter-page .chapter-hero { grid-template-columns: 1fr; padding: 22px; }
  .chapter-hero-meta { justify-content: flex-start; }
}

/* ── Daily Mix / Mistakes landing pages ────────────────── */
.dm-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  padding: 28px 28px 28px 32px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 70%);
  color: #1a1a24;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin: 0 0 28px;
  position: relative;
  overflow: hidden;
}
.dm-hero::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
  pointer-events: none;
}
.dm-hero-mistakes {
  background: linear-gradient(135deg, #c75a1a 0%, #d97b3e 100%);
  color: white;
}
.dm-hero-starred {
  background: linear-gradient(135deg, var(--accent) 0%, #d8b85d 100%);
  color: #1a1a24;
}
.dm-hero-text { display: flex; flex-direction: column; gap: 6px; }
.dm-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
}
.dm-hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  color: inherit;
}
.dm-hero p {
  margin: 6px 0 0;
  font-size: 1rem;
  opacity: 0.9;
  max-width: 540px;
  line-height: 1.5;
}
.dm-hero-meta {
  display: flex;
  gap: 18px;
  align-items: stretch;
  flex-wrap: wrap;
}
.dm-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  min-width: 88px;
}
.dm-hero-mistakes .dm-stat { background: rgba(255, 255, 255, 0.2); }
.dm-stat-num {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 2rem;
  line-height: 1;
  color: inherit;
}
.dm-stat-num small { font-size: 0.55em; font-weight: 700; margin-left: 1px; }
.dm-stat-label {
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  opacity: 0.85;
  text-transform: uppercase;
}

.dm-block { margin: 0 0 32px; }
.dm-block h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  margin: 0 0 6px;
}
.dm-block h2 .icon { color: var(--accent); }
.dm-block-desc { color: var(--fg-muted); margin: 0 0 16px; font-size: 0.95rem; }

.dm-modes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.dm-mode {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--mode-accent);
  border-radius: var(--radius);
  color: var(--fg);
  box-shadow: var(--shadow-xs);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  position: relative;
}
.dm-mode:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.dm-mode-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--mode-accent) 15%, transparent);
  color: var(--mode-accent);
  margin-bottom: 6px;
}
.dm-mode-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
}
.dm-mode-when {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mode-accent);
  opacity: 0.85;
}
.dm-mode-primary {
  background: linear-gradient(135deg, color-mix(in srgb, var(--mode-accent) 10%, var(--tile-bg)) 0%, var(--tile-bg) 100%);
}
.dm-mode-primary::after {
  content: 'Suggested';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--mode-accent);
  color: white;
  padding: 2px 8px;
  border-radius: 999px;
}

.dm-breakdown { display: flex; flex-direction: column; gap: 6px; }
.dm-chapter-row {
  display: grid;
  grid-template-columns: 48px 1fr 160px;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  transition: background var(--t-fast) var(--ease);
}
.dm-chapter-row:hover { text-decoration: none; background: var(--accent-2); }
.dm-ch-num {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.4rem;
  color: var(--accent);
  text-align: center;
}
.dm-ch-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dm-ch-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dm-ch-meta { color: var(--fg-muted); font-size: 0.85rem; }
.dm-ch-bar {
  height: 8px;
  background: var(--accent-2);
  border-radius: 999px;
  overflow: hidden;
}
.dm-ch-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  border-radius: 999px;
  transition: width 0.4s var(--ease);
}

.dm-explain {
  padding: 18px 20px;
  background: var(--accent-2);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
}
.dm-explain h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  margin: 0 0 6px;
}
.dm-explain h3 .icon { color: var(--accent); }
.dm-explain p { margin: 0; font-size: 0.95rem; line-height: 1.55; color: var(--fg); }

.dm-mistake-list { display: flex; flex-direction: column; gap: 6px; }
.dm-mistake-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  transition: background var(--t-fast) var(--ease);
}
.dm-mistake-row:hover { text-decoration: none; background: var(--accent-2); }
.dm-mistake-words { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dm-mistake-de {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
}
.dm-mistake-en { color: var(--fg-muted); font-size: 0.92rem; }
.dm-mistake-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.dm-mistake-pill {
  background: #faecea;
  color: #a8331a;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
:root[data-theme="dark"] .dm-mistake-pill { background: rgba(216, 133, 110, 0.2); color: #f08d76; }
.dm-mistake-ch {
  font-size: 0.78rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Empty state hero (Daily Mix / Mistakes when nothing's due) ─ */
.empty-hero {
  text-align: center;
  padding: 48px 24px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-2);
  color: var(--accent);
  margin: 0 auto 16px;
}
.empty-hero h2 { margin: 0 0 8px; }
.empty-hero p { color: var(--fg-muted); margin: 0 auto 20px; max-width: 460px; line-height: 1.5; }
.empty-hero .button { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 700px) {
  .dm-hero { grid-template-columns: 1fr; padding: 24px; }
  .dm-hero-meta { justify-content: flex-start; }
  .dm-chapter-row { grid-template-columns: 40px 1fr; }
  .dm-ch-bar { display: none; }
}

/* ── Mobile bottom navigation ──────────────────────────── */
.mobile-nav { display: none; }
@media (max-width: 768px) {
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    justify-content: space-around;
    padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
    background: var(--glass-bg);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid var(--glass-border);
  }
  .mobile-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    border-radius: 10px;
    color: var(--fg-muted);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    min-width: 56px;
    transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  }
  .mobile-nav a svg { width: 22px; height: 22px; opacity: 0.8; }
  .mobile-nav a.active,
  .mobile-nav a:hover {
    color: var(--accent);
    background: rgba(200, 168, 75, 0.10);
  }
  .mobile-nav a.active svg,
  .mobile-nav a:hover svg { opacity: 1; }
  body { padding-bottom: 78px; }
  .site-nav { display: none; }
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .app-container { padding: 24px var(--gutter) 48px; }
  .site-header { padding: 12px 18px; }
  .site-subtitle { display: none; }
  .chapter-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .chapter-tile { min-height: 120px; padding: 14px; }
  .chapter-num { font-size: 2rem; }
  .chapter-title { font-size: 1rem; }
  .home-progress { gap: 16px; }
  .goal-ring { width: 96px; height: 96px; }
  .entry-row { grid-template-columns: 1fr; gap: 4px; }
  .entry-loc { font-size: 0.72rem; }
  .box-row { grid-template-columns: 80px 1fr 40px; gap: 8px; }
  .settings-row { flex-direction: column; align-items: flex-start; gap: 10px; }
}
