/* ─────────────────────────────────────────────────────────────────
   Dani Dashboard — design system
   Latin-warm aesthetic: paper-cream backgrounds, terracotta accent,
   deep navy from the flags, real typography (Fraunces + Inter),
   soft layered shadows, generous whitespace, intentional motion.
   ───────────────────────────────────────────────────────────────── */

:root {
  /* Palette */
  --paper: #FAF8F5;
  --card: #FFFFFF;
  --ink: #1F1B16;
  --ink-soft: #4A433C;
  --muted: #837A6F;
  --border: #EBE5DB;
  --border-strong: #DCD3C5;

  --terracotta: #C4684E;
  --terracotta-soft: #F4DDD2;
  --terracotta-deep: #8E4632;

  --navy: #1E3A5F;
  --navy-soft: #D6DEE8;

  --sun: #D9A04E;
  --sun-soft: #F8E8C8;

  --green: #52A86F;
  --green-soft: #DCEFE2;

  --shadow-sm: 0 1px 2px rgba(31, 27, 22, 0.04);
  --shadow-md: 0 2px 4px rgba(31, 27, 22, 0.04), 0 8px 24px rgba(31, 27, 22, 0.06);
  --shadow-lg: 0 4px 8px rgba(31, 27, 22, 0.06), 0 24px 48px rgba(31, 27, 22, 0.10);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

  --t-fast: 0.15s ease;
  --t-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--terracotta);
  text-decoration: none;
  transition: color var(--t-fast);
}

a:hover { color: var(--terracotta-deep); }

::selection {
  background: var(--sun-soft);
  color: var(--ink);
}

/* ── Topbar ───────────────────────────────────────────────────── */
.topbar {
  background: rgba(250, 248, 245, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.brand:hover { color: var(--ink); text-decoration: none; }

.brand-flag {
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: inline-block;
  transition: transform var(--t-base);
  user-select: none;
  vertical-align: -4px;
}

.brand-flag:hover { transform: scale(1.15); }
.brand-flag.flipping { transform: rotateY(180deg) scale(1.35); }

.nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.nav a {
  color: var(--ink-soft);
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--t-fast);
}

.nav a:hover {
  color: var(--ink);
  background: var(--terracotta-soft);
  text-decoration: none;
}

.nav a.active {
  color: var(--terracotta-deep);
  background: var(--terracotta-soft);
}

.nav a svg {
  width: 16px;
  height: 16px;
}

/* ── Main containers ──────────────────────────────────────────── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
  animation: fadeUp 0.4s var(--t-base);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Headers / typography ─────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.15;
}

h1 { font-size: 2rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.5rem; }

.page-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.page-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 2rem;
}

.muted { color: var(--muted); font-size: 0.9rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--terracotta);
}

/* ── Hero on home page ────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--terracotta-soft) 0%, var(--sun-soft) 100%);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
  pointer-events: none;
}

.hero-greeting {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  letter-spacing: -0.025em;
  color: var(--terracotta-deep);
  position: relative;
}

.hero-tagline {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: 540px;
  position: relative;
}

.hero-meta {
  display: flex;
  gap: 2rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  position: relative;
}

.hero-meta-item {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.hero-meta-num {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--terracotta-deep);
  letter-spacing: -0.02em;
}

.hero-meta-label {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ── Stat cards ───────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base), box-shadow var(--t-base);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -0.025em;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  font-weight: 500;
}

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card h2 { margin-top: 0; }

.card.compact { padding: 1rem 1.25rem; }

.card-link {
  display: block;
  color: inherit;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}

.card-link:hover {
  color: inherit;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--terracotta-soft);
}

/* ── Tables ───────────────────────────────────────────────────── */
table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table.data th,
table.data td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

table.data th {
  background: var(--paper);
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

table.data tr:last-child td { border-bottom: none; }
table.data tbody tr {
  transition: background var(--t-fast);
}
table.data tbody tr:hover { background: rgba(196, 104, 78, 0.03); }

table.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink-soft);
}

table.data td a {
  font-weight: 600;
  color: var(--navy);
}

table.data td a:hover { color: var(--terracotta); }

/* ── Charts ───────────────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 260px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .chart-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Vocab toolbar (search + add button) ─────────────────────── */
.vocab-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.vocab-toolbar .search-input {
  flex: 1;
  margin-bottom: 0;
}

.vocab-toolbar .btn {
  white-space: nowrap;
}

/* ── Vocab row remove button (hover-reveal on saved-* rows) ──── */
.vocab-row-action-th {
  width: 36px;
}

.vocab-row-action {
  text-align: center;
  width: 36px;
}

.vocab-remove-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: all var(--t-fast);
}

.vocab-table tbody tr:hover .vocab-remove-btn {
  opacity: 1;
}

.vocab-remove-btn:hover {
  background: var(--terracotta-soft);
  color: var(--terracotta-deep);
  opacity: 1;
}

.vocab-remove-btn:focus-visible {
  outline: 2px solid var(--terracotta);
  opacity: 1;
}

/* ── Related-forms toggle + chips ─────────────────────────────── */
/* Compact pill next to the canonical Spanish word that opens the
   row's inflectional-variants chip list. Mark uses this to learn
   the lemma when he flagged a conjugated form (saw "iban", saved
   "iban", later wants to remember it's a form of "ir"). */
.vocab-forms-toggle {
  display: inline-block;
  margin-left: 0.55rem;
  padding: 0.05rem 0.45rem;
  background: var(--terracotta-soft, #f7e2cf);
  color: var(--terracotta-deep, #8a3a14);
  border: 1px solid var(--terracotta, #c1521e);
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  font-family: inherit;
  vertical-align: middle;
}
.vocab-forms-toggle:hover {
  background: var(--terracotta, #c1521e);
  color: #fff;
}
.vocab-forms-toggle:focus-visible {
  outline: 2px solid var(--terracotta, #c1521e);
  outline-offset: 1px;
}
.vocab-forms-toggle[aria-expanded="true"] {
  background: var(--terracotta, #c1521e);
  color: #fff;
}

/* :not([hidden]) so we only apply the flex layout when the list is
   actually visible. Plain `display: flex` would override the
   `hidden` attribute's `display: none`, leaving every row's chips
   expanded on initial paint. */
.vocab-forms-list:not([hidden]) {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.vocab-form-chip {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  background: #fff8ed;
  border: 1px solid #ead9bd;
  border-radius: 4px;
  font-size: 0.82rem;
  color: #6a5840;
}
/* Dani-mode flips the chrome to the conversation palette. Keep the
   chip neutral so the wall of variants is calm against either theme. */
body.theme-dani .vocab-forms-list .vocab-form-chip {
  background: #f2efe9;
  border-color: #d9d3c8;
}

/* ── Search input ─────────────────────────────────────────────── */
.search-input {
  width: 100%;
  padding: 0.75rem 1.125rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  background: var(--card);
  font-family: inherit;
  color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px var(--terracotta-soft);
}

/* ── Empty state / footnote ──────────────────────────────────── */
.empty-state {
  background: var(--card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--muted);
}

.footnote {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
  margin-top: 2rem;
  font-style: italic;
}

.footer {
  border-top: 1px solid var(--border);
  background: rgba(250, 248, 245, 0.6);
  margin-top: 4rem;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

/* ── Easter-egg toast ─────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  transition: transform var(--t-slow);
  z-index: 200;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ── Pills / badges ───────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--navy-soft);
  color: var(--navy);
  margin-right: 0.35rem;
  margin-bottom: 0.35rem;
}

.pill.warm { background: var(--terracotta-soft); color: var(--terracotta-deep); }
.pill.sun { background: var(--sun-soft); color: #7E5A1F; }
.pill.green { background: var(--green-soft); color: #2A6B41; }

/* ── List styling ─────────────────────────────────────────────── */
.card ul {
  padding-left: 1.25rem;
  margin: 0.5rem 0 0;
}

.card ul li {
  margin-bottom: 0.4rem;
  color: var(--ink-soft);
}

.card ul li::marker {
  color: var(--terracotta);
}

/* ── Practice (Phase 2) ───────────────────────────────────────── */
.practice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.practice-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}

.practice-tile.available { cursor: pointer; }

.practice-tile.available:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--terracotta-soft);
}

.practice-tile.coming-soon {
  opacity: 0.65;
  cursor: default;
  background: var(--paper);
}

.practice-tile-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--terracotta-soft);
  color: var(--terracotta-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.practice-tile-icon svg {
  width: 22px;
  height: 22px;
}

.practice-tile h3 {
  font-family: var(--font-display);
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.practice-tile p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.practice-tile a {
  color: inherit;
  display: block;
}

.practice-tile a:hover { text-decoration: none; }

/* ── SR (spaced repetition) bar ──────────────────────────────── */
.sr-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0.65rem 1rem;
  background: var(--sun-soft);
  border: 1px solid var(--sun-soft);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
}

.sr-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  color: #7E5A1F;
}

.sr-stat strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--sun);
}

.sr-stat-quiet {
  color: var(--muted);
  margin-left: auto;
}

.sr-stat-quiet strong {
  color: var(--muted);
}

/* ── Mode toggle (Flip / Quiz) ────────────────────────────────── */
.mode-toggle {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.mode-toggle button {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.45rem 1.1rem;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--t-fast);
}

.mode-toggle button:hover { color: var(--ink); }

.mode-toggle button.active {
  background: var(--terracotta-soft);
  color: var(--terracotta-deep);
  font-weight: 600;
}

/* ── Quiz mode ────────────────────────────────────────────────── */
.quiz-stage {
  max-width: 560px;
  margin: 1.5rem auto 0;
}

.quiz-prompt {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.25rem;
  position: relative;
}

.quiz-prompt-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.quiz-prompt-text {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--terracotta-deep);
  margin: 0;
}

.quiz-prompt-lesson {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 540px) {
  .choices { grid-template-columns: 1fr; }
}

.choice {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  padding: 1rem 1.25rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: all var(--t-fast);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 64px;
  box-shadow: var(--shadow-sm);
}

.choice:hover:not(:disabled) {
  border-color: var(--terracotta);
  background: var(--terracotta-soft);
  transform: translateY(-1px);
}

.choice-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.choice:hover:not(:disabled) .choice-num {
  background: var(--terracotta);
  color: white;
}

.choice:disabled { cursor: default; }

.choice.correct {
  border-color: var(--green);
  background: var(--green-soft);
  color: #1F4F2F;
  animation: choice-pulse 0.4s ease;
}

.choice.correct .choice-num {
  background: var(--green);
  color: white;
}

.choice.wrong {
  border-color: var(--terracotta);
  background: var(--terracotta-soft);
  color: var(--terracotta-deep);
}

.choice.wrong .choice-num {
  background: var(--terracotta);
  color: white;
}

.choice.dimmed {
  opacity: 0.4;
}

@keyframes choice-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* ── Lifetime stats banner (above flashcards) ─────────────────── */
.lifetime-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  background: var(--navy-soft);
  border: 1px solid var(--navy-soft);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.lifetime-stats-empty {
  grid-template-columns: 1fr;
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  background: var(--paper);
  border: 1px dashed var(--border-strong);
}

.lifetime-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.lifetime-stat-num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.lifetime-stat-label {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 0.25rem;
}

/* ── Flashcards ───────────────────────────────────────────────── */
.flashcard-stage {
  perspective: 1500px;
  margin: 2rem auto;
  max-width: 480px;
}

.flashcard {
  position: relative;
  height: 280px;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.flashcard-face.back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, var(--terracotta-soft) 0%, var(--sun-soft) 100%);
  border-color: var(--terracotta-soft);
}

.flashcard-spanish {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--terracotta-deep);
  margin: 0 0 0.5rem;
}

/* Spanish-only context shown on the prompt side — gives usage pattern
   without revealing the English meaning. Styled subtly so it reads as
   a quiet hint, not a primary element. */
.flashcard-prompt-hint,
.quiz-prompt-hint {
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-style: italic;
  margin: 0.5rem 1rem 0;
  line-height: 1.45;
  min-height: 1.2em;
}

.quiz-prompt-hint {
  margin-top: 0.75rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.flashcard-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: auto;
}

.flashcard-english {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 1rem;
  letter-spacing: -0.015em;
}

.flashcard-context {
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-style: italic;
  margin: 0;
}

.flashcard-lesson-tag {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.flashcard-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.btn {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--t-fast);
  background: var(--card);
  color: var(--ink-soft);
  border-color: var(--border-strong);
}

.btn:hover {
  background: var(--paper);
  color: var(--ink);
}

.btn.primary {
  background: var(--terracotta);
  color: white;
  border-color: var(--terracotta);
}

.btn.primary:hover { background: var(--terracotta-deep); border-color: var(--terracotta-deep); color: white; }

.btn.success {
  background: var(--green-soft);
  color: #2A6B41;
  border-color: var(--green-soft);
}

.btn.success:hover { background: var(--green); color: white; border-color: var(--green); }

.btn.danger {
  background: var(--card);
  color: var(--terracotta-deep);
  border-color: var(--terracotta-soft);
}

.btn.danger:hover { background: var(--terracotta-soft); color: var(--terracotta-deep); }

.btn svg { width: 16px; height: 16px; }

/* ── Flashcard stats bar ──────────────────────────────────────── */
.practice-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.practice-bar-stats {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.practice-bar-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.practice-bar-stat strong {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
}

.streak-flame {
  color: var(--terracotta);
  display: inline-flex;
  align-items: center;
}

.streak-flame svg { width: 18px; height: 18px; }

.streak-active {
  animation: streak-pulse 1.6s ease-in-out infinite;
}

@keyframes streak-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ── Reading passages ─────────────────────────────────────────── */
.reading-actions {
  margin: 1.5rem 0 2rem;
}

.reading-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .reading-list { grid-template-columns: 1fr 1fr; }
}

.reading-passage {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  white-space: pre-wrap;
}

.reading-translation {
  background: var(--navy-soft);
  border: 1px solid var(--navy-soft);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
  white-space: pre-wrap;
}

.reading-controls {
  margin-bottom: 1rem;
}

.reading-audio-panel {
  margin: 1rem 0 1.25rem;
  padding: .85rem 1rem 1rem;
  background: var(--paper-warm, #f7f2ea);
  border: 1px solid var(--border-soft, #e6dfd3);
  border-radius: 8px;
}

.reading-audio-heading {
  margin: 0 0 .6rem;
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.reading-audio-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1rem;
  align-items: center;
  margin-bottom: .6rem;
}

.reading-audio-controls select {
  padding: .3rem .5rem;
  border: 1px solid var(--border-soft, #d6ccbe);
  border-radius: 4px;
  background: white;
  font-size: .9rem;
}

.reading-audio-hidepassage {
  display: inline-flex;
  gap: .35rem;
  align-items: center;
  font-size: .85rem;
  color: var(--ink-soft);
}

.reading-audio-panel audio {
  width: 100%;
  max-width: 480px;
}

.reading-card-audio-badge {
  display: inline-flex;
  align-items: center;
  color: var(--brand, #b64a2e);
  flex-shrink: 0;
}

/* Two-click destructive-action arm state — used on Delete buttons
   (Study Plans, later on plan items + students). First click swaps
   the label + adds this class; second click within 4s actually
   executes. Auto-disarms after 4s if no second click. Uses a warm
   destructive red rather than the brand terracotta so it reads as
   "danger" without competing with primary buttons. */
.btn-arm-destructive {
  background: #c93b3b !important;
  color: white !important;
  border-color: #c93b3b !important;
  transition: background 120ms, color 120ms;
}

.vocab-highlight {
  background: linear-gradient(transparent 0%, transparent 60%, var(--sun-soft) 60%, var(--sun-soft) 100%);
  cursor: help;
  border-radius: 2px;
  padding: 0 2px;
  transition: background 0.2s;
}

.vocab-highlight:hover {
  background: var(--sun-soft);
}

/* Just-saved pulse — green ring fades out after a moment, while the
   underlying sun-gold underline of .vocab-highlight remains. Gives
   confirmation that the save landed without permanently altering the
   look (next page load, the word is indistinguishable from other
   highlighted vocab). */
.vocab-highlight-just-saved {
  animation: just-saved-pulse 1.8s ease-out;
}

@keyframes just-saved-pulse {
  0% {
    box-shadow: 0 0 0 4px var(--green-soft), 0 0 12px 4px rgba(82, 168, 111, 0.4);
    background-color: var(--green-soft);
    border-radius: 4px;
  }
  60% {
    box-shadow: 0 0 0 2px var(--green-soft);
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
    background-color: transparent;
    border-radius: 2px;
  }
}

.vocab-tooltip {
  position: absolute;
  background: var(--ink);
  color: var(--paper);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.4;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  pointer-events: none;
}

.vocab-tooltip-en {
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.vocab-tooltip-ctx {
  font-style: italic;
  font-size: 0.78rem;
  color: var(--border);
  margin-bottom: 0.2rem;
}

.vocab-tooltip-lesson {
  font-size: 0.72rem;
  color: var(--muted);
}

/* ── Save-to-vocab popover (appears on selection) ─────────────── */
.save-popover {
  position: absolute;
  z-index: 90;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  padding: 0.25rem;
}

.save-popover .btn {
  border: none;
  background: var(--terracotta);
  color: white;
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.save-popover .btn:hover {
  background: var(--terracotta-deep);
  color: white;
}

/* ── Save-to-vocab modal ──────────────────────────────────────── */
.save-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* HTML's `hidden` attribute defaults to `display: none`, but a more
   specific selector with `display: flex` overrides that. Re-establish
   the hide here so [hidden] actually hides — otherwise the modal
   shows on page load and Cancel can't dismiss it. */
.save-modal[hidden] {
  display: none;
}

.save-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 27, 22, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.save-modal-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem 1.75rem;
  max-width: 480px;
  width: calc(100% - 2rem);
  margin: 0 1rem;
}

.save-modal-title {
  font-family: var(--font-display);
  margin: 0 0 1.25rem;
  font-size: 1.25rem;
  color: var(--ink);
}

.save-modal-field {
  margin-bottom: 1rem;
}

.save-modal-field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.save-modal-field input,
.save-modal-field textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  resize: vertical;
}

.save-modal-field input:focus,
.save-modal-field textarea:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px var(--terracotta-soft);
}

.save-modal-status {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  font-style: italic;
}

.save-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--terracotta);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  padding: 0;
  font-weight: 500;
}

.btn-link:hover {
  color: var(--terracotta-deep);
  text-decoration: underline;
}

/* ── Number drill ─────────────────────────────────────────────── */
.number-range-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.number-range-btn {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  cursor: pointer;
  text-align: center;
  min-width: 110px;
  transition: all var(--t-fast);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.number-range-btn input { display: none; }

.number-range-btn span {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}

.number-range-btn small {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.number-range-btn:hover {
  border-color: var(--terracotta);
}

.number-range-btn.active {
  border-color: var(--terracotta);
  background: var(--terracotta-soft);
}

.number-range-btn.active span { color: var(--terracotta-deep); }
.number-range-btn.active small { color: var(--terracotta-deep); }

.number-stage {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  margin: 1.5rem auto 1rem;
  max-width: 640px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.number-display {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 600;
  color: var(--terracotta-deep);
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin-bottom: 1.5rem;
  position: relative;
  transition: color var(--t-base);
}

/* Subtle indicator when a number is being re-shown because the user
   missed it earlier in the session — small "review" label above the
   number, no harsh color change. */
.number-display.number-review::before {
  content: 'review';
  position: absolute;
  top: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sun);
  padding: 0.15rem 0.5rem;
  background: var(--sun-soft);
  border-radius: var(--radius-full);
}

@media (max-width: 640px) {
  .number-display { font-size: 3rem; }
}

.number-input {
  width: 100%;
  max-width: 480px;
  padding: 0.85rem 1.25rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1.1rem;
  text-align: center;
  background: var(--paper);
  margin-bottom: 1rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.number-input:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px var(--terracotta-soft);
}

.number-input:disabled {
  opacity: 0.6;
  cursor: default;
}

.number-feedback {
  min-height: 1.8rem;
  font-size: 1rem;
  margin: 0.75rem 0;
  font-family: var(--font-body);
}

.number-feedback.correct {
  color: #1F4F2F;
  font-weight: 500;
}

.number-feedback.wrong {
  color: var(--terracotta-deep);
  font-weight: 500;
}

.number-feedback.wrong strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.number-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

/* ── Conversation: starter tiles ──────────────────────────────── */
.starter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.starter-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: all var(--t-fast);
  font-family: inherit;
}

.starter-tile:hover:not(:disabled) {
  border-color: var(--terracotta);
  background: var(--terracotta-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.starter-tile:disabled {
  opacity: 0.6;
  cursor: default;
}

.starter-tile-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}

.starter-tile-sub {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Conversation: chat container + bubbles ──────────────────── */
.chat-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
  min-height: 200px;
}

.chat-turn {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.chat-turn.mark { align-items: flex-end; }
.chat-turn.claude { align-items: flex-start; }

.chat-bubble {
  max-width: 80%;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.chat-bubble.mark {
  background: var(--navy);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-bubble.claude {
  background: var(--terracotta-soft);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

.chat-bubble.claude.error {
  background: #fde2dc;
  color: var(--terracotta-deep);
}

/* Loading dots while waiting for Claude's reply */
.chat-turn.loading .chat-bubble {
  display: flex;
  gap: 0.3rem;
  padding: 1rem 1.2rem;
}

.chat-turn.loading .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--terracotta-deep);
  opacity: 0.4;
  animation: dot-pulse 1.2s ease-in-out infinite;
}

.chat-turn.loading .dot:nth-child(2) { animation-delay: 0.15s; }
.chat-turn.loading .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-pulse {
  0%, 60%, 100% { opacity: 0.4; transform: scale(1); }
  30% { opacity: 1; transform: scale(1.3); }
}

/* Corrections toggle + panel attached to mark turns */
.corrections-toggle {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  margin-top: 0.35rem;
  font-family: inherit;
  transition: all var(--t-fast);
}

.corrections-toggle:hover {
  color: var(--terracotta);
  border-color: var(--terracotta);
}

.corrections-panel {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-top: 0.4rem;
  max-width: 80%;
  align-self: flex-end;
}

.correction-item {
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

.correction-item:last-child { margin-bottom: 0; }

.correction-original {
  text-decoration: line-through;
  color: var(--terracotta-deep);
  font-style: italic;
}

.correction-corrected {
  color: var(--green);
  font-weight: 600;
}

.correction-reason {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

/* Chat input row */
.chat-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  margin-top: 1rem;
}

.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  resize: vertical;
  min-height: 60px;
  max-height: 180px;
  background: var(--card);
  color: var(--ink);
}

.chat-input:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px var(--terracotta-soft);
}

.chat-input-row .btn {
  white-space: nowrap;
}

/* ── Sparkle / celebration ────────────────────────────────────── */
.sparkle-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.sparkle {
  position: absolute;
  color: var(--sun);
  animation: sparkle-fly 1.2s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

.sparkle svg { width: 20px; height: 20px; }

@keyframes sparkle-fly {
  0% { transform: translate(0, 0) scale(0) rotate(0deg); opacity: 1; }
  30% { transform: translate(var(--dx-mid), var(--dy-mid)) scale(1.2) rotate(180deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0) rotate(360deg); opacity: 0; }
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  main { padding: 1.5rem 1rem 4rem; }
  .topbar-inner { padding: 0.75rem 1rem; gap: 0.75rem; }
  .nav { gap: 0; }
  .nav a { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
  .nav a span { display: none; }
  .hero { padding: 2rem 1.5rem; }
  .hero-greeting { font-size: 1.85rem; }
  .stat-value { font-size: 1.85rem; }
  .flashcard-spanish { font-size: 1.85rem; }
}

/* ── Misc ─────────────────────────────────────────────────────── */
code, pre {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.88em;
}

code {
  background: var(--paper);
  padding: 0.125rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.sparkline {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.95rem;
  margin: 0 0 1rem;
  color: var(--navy);
}

/* ── Tense drill ──────────────────────────────────────────────── */
.tense-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tense-focus-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tense-focus-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.tense-focus-select {
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--paper);
  color: var(--ink);
  min-width: 280px;
}

.tense-focus-select:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px var(--terracotta-soft);
}

.tense-hint-card {
  background: var(--terracotta-soft);
  border-left: 3px solid var(--terracotta);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.tense-hint-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.tense-hint-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--terracotta-deep);
  font-weight: 600;
}

.tense-hint-name-en {
  font-size: 0.85rem;
  color: var(--muted);
}

.tense-hint-desc {
  font-size: 0.92rem;
  margin: 0.25rem 0 0.4rem;
  color: var(--ink);
  line-height: 1.45;
}

.tense-hint-example {
  font-size: 0.88rem;
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.tense-hint-example-en {
  color: var(--muted);
}

.tense-stage {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.25rem 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.tense-prompt-meta {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tense-prompt-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--navy);
  color: var(--paper);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 500;
}

.tense-prompt-tag-muted {
  background: var(--paper);
  color: var(--muted);
  border: 1px solid var(--border);
}

.tense-prompt {
  font-family: var(--font-display);
  font-size: 1.8rem;
  line-height: 1.35;
  margin: 0.5rem 0 1rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.tense-prompt.tense-review {
  position: relative;
}

.tense-prompt.tense-review::after {
  content: 'review';
  position: absolute;
  top: -0.5rem;
  right: 0;
  font-family: var(--font-body);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--terracotta);
}

.tense-blank {
  color: var(--terracotta-deep);
  background: var(--terracotta-soft);
  padding: 0.05em 0.35em;
  border-radius: 4px;
  font-style: italic;
  font-weight: 500;
}

.tense-explanation {
  margin-top: 0.4rem;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.45;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 640px) {
  .tense-prompt { font-size: 1.35rem; }
  .tense-focus-select { min-width: 100%; }
}

/* ── Cloze drill ──────────────────────────────────────────────── */
.cloze-meta {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.cloze-prompt {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.5;
  margin: 0.5rem 0 0.5rem;
  color: var(--ink);
  letter-spacing: -0.005em;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.cloze-blank {
  display: inline-block;
  background: var(--terracotta-soft);
  color: var(--terracotta-deep);
  padding: 0.05em 0.5em;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.cloze-hint {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0.4rem auto 1.1rem;
  font-style: italic;
  max-width: 640px;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .cloze-prompt { font-size: 1.2rem; }
}

/* ── Reports page ─────────────────────────────────────────────── */
.reports-section {
  margin: 2rem 0;
}

.reports-section-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink);
  margin: 0 0 0.5rem;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.reports-section-sub {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.reports-empty {
  color: var(--muted);
  font-style: italic;
  font-size: 0.92rem;
}

.reports-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}

.reports-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.reports-table th,
.reports-table td {
  padding: 0.5rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.reports-table th {
  background: var(--paper);
  font-weight: 500;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.reports-table tr:last-child td { border-bottom: none; }

.reports-table .num { text-align: right; }
.reports-table td.muted { color: var(--muted); }

.acc-pill {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: var(--font-body);
}

.acc-pill.good { background: #DDF3E2; color: #1F4F2F; }
.acc-pill.ok   { background: #FEF3CC; color: #6F4E00; }
.acc-pill.bad  { background: #FDDCD3; color: #7A1F0E; }

.reports-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.reports-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.94rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.reports-list li:last-child { border-bottom: none; }

.reports-list-compact li {
  padding: 0.3rem 0;
  font-size: 0.88rem;
}

.item-prompt {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.88rem;
  background: var(--paper);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  word-break: break-word;
  max-width: 100%;
}

.volume-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 130px;
  padding: 0.5rem 0;
}

.volume-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}

.volume-bar {
  width: 100%;
  background: var(--terracotta);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  transition: opacity var(--t-fast);
}

.volume-bar:hover { opacity: 0.85; }

.volume-bar-count {
  position: absolute;
  top: -1.1rem;
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--font-body);
}

.volume-bar-label {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.25rem;
  white-space: nowrap;
}

.dani-band {
  margin: 3rem 0 2rem;
  padding: 1.5rem 1.5rem 0.5rem;
  background: var(--terracotta-soft);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--terracotta);
}

.dani-band-header { margin-bottom: 0.5rem; }

.dani-band-eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--terracotta-deep);
  font-weight: 600;
}

.dani-band-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 0.25rem 0 0.5rem;
  color: var(--ink);
}

.dani-band-sub {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 0.5rem;
}

.dani-band .reports-section-title { color: var(--ink); }
.dani-band .reports-table-wrap { background: var(--paper); }

.fallback-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.fallback-chip {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--ink);
}

.fallback-chip-tense {
  background: var(--navy);
  color: var(--paper);
  border-color: var(--navy);
}

@media (max-width: 640px) {
  .reports-table { font-size: 0.82rem; }
  .reports-table th, .reports-table td { padding: 0.35rem 0.5rem; }
  .volume-bars { height: 90px; }
  .volume-bar-label { font-size: 0.6rem; }
}

/* ── Correction-categories bar chart (Reports → Dani band) ─────── */
.category-bar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.category-row {
  display: grid;
  grid-template-columns: 11rem 1fr 3rem;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
}

.category-label {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

.category-track {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  height: 0.6rem;
  overflow: hidden;
}

.category-fill {
  background: var(--terracotta);
  height: 100%;
  border-radius: 4px;
  transition: width var(--t-fast);
}

.category-count {
  color: var(--muted);
  font-family: var(--font-body);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .category-row { grid-template-columns: 8rem 1fr 2.5rem; font-size: 0.8rem; }
}

/* Conversation corrections list on Reports page. Reuses
   .correction-original and .correction-corrected from the chat UI. */
.reports-correction-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.reports-correction {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.reports-correction:last-child { border-bottom: none; }

.reports-correction-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.correction-arrow {
  color: var(--muted);
  font-size: 0.9rem;
}

.reports-correction-reason {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.15rem;
  font-style: italic;
}

/* ── Vocabulary review page ───────────────────────────────────── */
.review-counts {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.review-count {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  font-size: 0.92rem;
  transition: all var(--t-fast);
}

.review-count:hover {
  border-color: var(--terracotta);
  background: var(--terracotta-soft);
}

.review-count.active {
  border-color: var(--terracotta);
  background: var(--terracotta-soft);
  color: var(--terracotta-deep);
}

.review-count strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.review-filters {
  display: flex;
  gap: 1rem;
  align-items: end;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.review-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.review-filters select,
.review-filters input {
  padding: 0.45rem 0.7rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.92rem;
  min-width: 12rem;
}

.review-bulk {
  margin: 1rem 0;
}

.review-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.92rem;
}

.review-table thead th {
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.review-table tbody td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.review-row-candidate { background: rgba(255, 200, 0, 0.04); }
.review-row-rejected { opacity: 0.55; }

.review-context {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 22rem;
}

.review-badge {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.review-badge-candidate { background: rgba(255, 180, 0, 0.18); color: #8a5a00; }
.review-badge-approved { background: rgba(40, 140, 60, 0.15); color: #1F4F2F; }
.review-badge-rejected { background: rgba(160, 50, 50, 0.12); color: #7a2020; }

.review-actions { display: flex; gap: 0.3rem; justify-content: flex-end; }
.inline-form { display: inline; margin: 0; }

.btn-mini {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
}

.btn-mini:hover { background: var(--card); }
.btn-mini.btn-approve:hover { background: rgba(40, 140, 60, 0.12); border-color: #1F4F2F; }
.btn-mini.btn-reject:hover { background: rgba(160, 50, 50, 0.08); border-color: #7a2020; }
.btn-mini.btn-delete:hover { background: rgba(160, 50, 50, 0.08); border-color: #7a2020; }

/* ── Vocabulary review: multi-select + bulk bar ──────────────── */
.review-table .select-col {
  width: 2rem;
  text-align: center;
}

.review-row {
  cursor: pointer;
}

.review-row:hover {
  background: rgba(196, 104, 78, 0.04);
}

.bulk-bar {
  position: sticky;
  bottom: 1rem;
  margin: 1.5rem auto 0;
  background: var(--card);
  border: 1px solid var(--terracotta);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 10;
}

.bulk-bar-count {
  font-size: 0.92rem;
  color: var(--ink);
}

.bulk-bar-count strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--terracotta-deep);
  margin-right: 0.2rem;
}

.bulk-bar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-danger {
  border-color: #7a2020;
  color: #7a2020;
}

.btn-danger:hover {
  background: rgba(160, 50, 50, 0.08);
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
  padding: 0.25rem;
}

.btn-link:hover { color: var(--ink); }

/* ── /Process page ─────────────────────────────────────────── */
.pending-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-left: 4px solid #ea580c;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  transition: background 120ms;
}
.pending-banner:hover { background: #ffedd5; }
.pending-banner-icon { font-size: 1.4rem; }
.pending-banner-text { font-size: 0.95rem; }

.process-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 2rem;
  font-size: 0.92rem;
}
.process-table th,
.process-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid #ebe2d6;
  text-align: left;
}
.process-table th { font-weight: 600; color: #6c5b3d; }
.process-table td.num,
.process-table th.num { text-align: right; }
.process-parse-form { display: inline; margin: 0; }

.process-ingested {
  list-style: none;
  padding: 0.5rem 0 0 0;
  margin: 0;
  columns: 2;
  font-size: 0.88rem;
  color: #6c5b3d;
}
.process-ingested li { padding: 0.15rem 0; }

.process-result {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  border: 1px solid;
}
.process-result.ok   { background: #f0fdf4; border-color: #86efac; }
.process-result.fail { background: #fef2f2; border-color: #fca5a5; }
.process-result h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.05rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.process-result-code {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: #6c5b3d;
  font-weight: normal;
}
.process-result pre {
  background: #fdf6e3;
  border: 1px solid #ebe2d6;
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
  font-size: 0.82rem;
  overflow-x: auto;
  white-space: pre-wrap;
}
.process-result details { margin-top: 0.5rem; }
.process-result summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #6c5b3d;
}

.section-heading {
  margin-top: 2rem;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: #6c5b3d;
  font-weight: 600;
  text-transform: uppercase;
}

/* Pending-banner stack + CTA on the right */
.pending-stack { display: flex; flex-direction: column; gap: 0.6rem; margin: 1.25rem 0; }
.pending-stack .pending-banner { margin: 0; justify-content: space-between; }
.pending-banner-cta {
  margin-left: auto;
  font-weight: 600;
  font-size: 0.88rem;
  color: #ea580c;
  white-space: nowrap;
}
.pending-banner-vocab {
  background: #fef3c7;
  border-color: #fcd34d;
  border-left-color: #d97706;
}
.pending-banner-vocab:hover { background: #fde68a; }
.pending-banner-vocab .pending-banner-cta { color: #d97706; }

/* Status pills + job output rows in the Recordings table */
.status-pill {
  font-size: 0.82rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill.running { background: #fef3c7; color: #92400e; }
.status-pill.ok      { background: #dcfce7; color: #15803d; }
.status-pill.fail    { background: #fee2e2; color: #991b1b; }

.process-job-output td {
  background: #fdfbf6;
  padding: 0.4rem 0.8rem;
}
.process-job-output pre {
  max-height: 280px;
  overflow-y: auto;
  font-size: 0.78rem;
  margin: 0.4rem 0;
  background: #fdf6e3;
  border: 1px solid #ebe2d6;
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
  white-space: pre-wrap;
}
.process-job-output pre.stderr { background: #fef2f2; border-color: #fca5a5; }

.pending-banner-recording {
  background: #ede9fe;
  border-color: #c4b5fd;
  border-left-color: #7c3aed;
}
.pending-banner-recording:hover { background: #ddd6fe; }
.pending-banner-recording .pending-banner-cta { color: #7c3aed; }

/* Current-user chip in the topbar (Phase 3.7a) */
.topbar-inner { gap: 1rem; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.7rem 0.25rem 0.3rem;
  border-radius: 999px;
  background: #f5ede0;
  border: 1px solid #ebe2d6;
  font-size: 0.85rem;
  color: #6c5b3d;
  white-space: nowrap;
}
.user-chip-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #ea580c;
  color: white;
  font-weight: 600;
  font-size: 0.78rem;
}
.user-chip-name { font-weight: 500; }
@media (max-width: 720px) {
  .user-chip-name { display: none; }
}

/* ── Per-user theming (Phase 3.7b) ─────────────────────────────
   Mark's view is the default (terracotta accent). Dani's view
   swaps to a violet-on-cream palette so it's instantly obvious
   you're not in your own pool. */
body.theme-dani {
  --terracotta: #7c3aed;        /* violet swap of the accent */
  --terracotta-soft: #ede9fe;
  --terracotta-deep: #5b21b6;
  --sun: #f59e0b;               /* warmer companion */
  --sun-soft: #fef3c7;
}
body.theme-dani .user-chip-avatar { background: #7c3aed; }
body.theme-dani .pending-banner   { border-left-color: #7c3aed; }
body.theme-dani .pending-banner-cta { color: #7c3aed; }

/* Topbar gets a faint user-tinted band so the "whose seat?"
   answer is visible without reading the chip. */
body.theme-mark .topbar { box-shadow: inset 0 -2px 0 var(--terracotta-soft); }
body.theme-dani .topbar { box-shadow: inset 0 -2px 0 #ede9fe; }

/* ── Spectate mode (Phase 3.7c.5) ──────────────────────────────
   Banner across the very top of the page when you're viewing
   someone else's dashboard. High visual contrast — should be
   impossible to miss. */
.spectate-banner {
  background: #1e293b;
  color: #f1f5f9;
  padding: 0.55rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  border-bottom: 2px solid #475569;
}
.spectate-banner-text strong { color: #fde68a; font-weight: 700; }
.spectate-banner-action {
  color: #fde68a;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
  border-bottom: 1px dashed #fde68a;
  padding-bottom: 1px;
}
.spectate-banner-action:hover { color: white; border-bottom-color: white; }

.spectate-link {
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.spectate-link:hover { background: var(--paper); color: var(--ink); border-color: var(--border-strong); }

/* When spectating, fade out the brand identity slightly so you
   know the whole UI is in someone else's seat. */
body.is-spectating .topbar { opacity: 0.92; }

/* ── User menu dropdown (3.7 polish) ───────────────────────────
   Replaces the plain user-chip + sibling "View Daniela" links
   with a native <details> dropdown. No JS — `details/summary`
   handles open/close. Body click outside auto-closes via the
   open attribute toggle. */
.user-menu { position: relative; }
.user-menu > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  /* When this is a summary, add the chevron back */
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary::marker { display: none; }
.user-menu > summary .user-chip-chevron {
  width: 12px;
  height: 12px;
  margin-left: 0.2rem;
  opacity: 0.6;
  transition: transform 0.15s;
}
.user-menu[open] > summary .user-chip-chevron { transform: rotate(180deg); }

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 100;
  min-width: 280px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 0.4rem;
  font-size: 0.88rem;
  color: var(--ink);
}

.user-menu-header {
  padding: 0.65rem 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.3rem;
}
.user-menu-header-name { font-weight: 600; color: var(--ink); font-size: 0.95rem; }
.user-menu-header-meta { color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem; }

.user-menu-section { padding: 0.4rem 0; border-top: 1px solid var(--border); }
.user-menu-section:first-of-type { border-top: none; padding-top: 0.2rem; }
.user-menu-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0.2rem 0.75rem 0.3rem;
  font-weight: 600;
}
.user-menu-section-footer { border-top-color: var(--border-strong); }

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.88rem;
  cursor: pointer;
}
.user-menu-item:hover { background: var(--paper); }
.user-menu-item.disabled {
  color: var(--muted);
  cursor: default;
  font-style: italic;
}
.user-menu-item.disabled:hover { background: transparent; }
.user-menu-item-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--terracotta);
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.user-menu-item-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 400;
  margin-top: 0.05rem;
}
.user-menu-item-spectate { font-size: 0.83rem; color: var(--ink-soft); }

/* Profile page definition list */
.profile-dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.5rem; margin: 0; }
.profile-dl dt { color: var(--muted); font-size: 0.85rem; }
.profile-dl dd { margin: 0; color: var(--ink); font-weight: 500; }

/* ── Song lyrics layout (Reading kind=song) ─────────────────── */
.song-lines {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.song-line {
  border-left: 3px solid var(--border);
  padding: 0.55rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--card);
  border-radius: 4px;
}
.song-line:hover { border-left-color: var(--terracotta); }
.song-line-blank { border: none; background: none; padding: 0.35rem 0; }
.song-line-original {
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.4;
}
.song-line-translation {
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.45;
  font-style: italic;
}
.song-line-annotation {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.4rem;
  padding: 0.5rem 0.7rem;
  background: var(--sun-soft);
  border-left: 3px solid var(--sun);
  border-radius: 4px;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.45;
}
.song-line-annotation svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--sun);
  margin-top: 1px;
}
body.theme-dani .song-line-annotation {
  background: #ede9fe;
  border-left-color: #7c3aed;
}
body.theme-dani .song-line-annotation svg { color: #7c3aed; }

/* Song-add form */
.song-form { display: flex; flex-direction: column; gap: 1.25rem; max-width: 720px; }
.song-form-row { display: flex; flex-direction: column; gap: 0.35rem; }
.song-form-row label { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.song-form-row input,
.song-form-row textarea,
.song-form-row select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: white;
  color: var(--ink);
}
.song-form-row textarea { resize: vertical; min-height: 320px; font-family: 'SFMono-Regular', Consolas, monospace; font-size: 0.9rem; line-height: 1.45; }
.song-form-row input:focus,
.song-form-row textarea:focus,
.song-form-row select:focus { outline: 2px solid var(--terracotta); outline-offset: 1px; border-color: var(--terracotta); }
body.theme-dani .song-form-row input:focus,
body.theme-dani .song-form-row textarea:focus,
body.theme-dani .song-form-row select:focus { outline-color: #7c3aed; border-color: #7c3aed; }

/* Native <select> needs explicit appearance-reset to break out of the
   OS-default chrome, plus a custom SVG arrow since the browser-drawn
   arrow can't be styled. Padding-right makes room for the arrow image. */
.song-form-row select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%237a6f5a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='1,1.5 6,6.5 11,1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  cursor: pointer;
}
.song-form-hint { font-size: 0.8rem; color: var(--muted); margin: 0; }
.song-form-actions { margin-top: 0.5rem; }

/* ──────────────────────────────────────────────────────────────
   Side-by-side transcript on /Lessons/{date}
   The markdown is a standard 4-column table (#, Tiempo, Español,
   English). We render via Markdig → raw HTML, then scope styles
   to .transcript-body so other tables on the site are unaffected.
   ────────────────────────────────────────────────────────────── */
.transcript-card { margin-top: 1rem; }
.transcript-body {
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--ink);
}
.transcript-body h1 {
    font-size: 1.15rem;
    margin: 0.5rem 0 0.75rem;
    color: var(--ink);
}
.transcript-body h2 {
    font-size: 1rem;
    margin: 1.5rem 0 0.5rem;
    color: var(--terracotta-deep);
    border-bottom: 1px solid var(--terracotta-soft);
    padding-bottom: 0.3rem;
}
.transcript-body p { margin: 0.4rem 0; }
.transcript-body hr {
    border: none;
    border-top: 1px dashed var(--terracotta-soft);
    margin: 1rem 0;
}
.transcript-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0 1.5rem;
    table-layout: fixed;
}
.transcript-body th,
.transcript-body td {
    padding: 0.4rem 0.55rem;
    vertical-align: top;
    border-bottom: 1px solid #EBE5DB;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.transcript-body th {
    background: var(--terracotta-soft);
    color: var(--terracotta-deep);
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
/* 4-column layout: # | Tiempo | Español | English */
.transcript-body table th:nth-child(1),
.transcript-body table td:nth-child(1) {
    width: 3rem;
    color: var(--ink-soft);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.transcript-body table th:nth-child(2),
.transcript-body table td:nth-child(2) {
    width: 5rem;
    color: var(--ink-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem;
}
.transcript-body table th:nth-child(3),
.transcript-body table td:nth-child(3) {
    width: 46%;
}
.transcript-body table th:nth-child(4),
.transcript-body table td:nth-child(4) {
    width: 46%;
    color: var(--ink-soft);
}
.transcript-body table tr:nth-child(even) td { background: rgba(196, 104, 78, 0.03); }
.transcript-body strong { font-weight: 600; color: var(--terracotta-deep); }
.transcript-body code {
    background: rgba(196, 104, 78, 0.08);
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    font-size: 0.82rem;
}
.transcript-body a { color: var(--terracotta); }
.transcript-body a:hover { color: var(--terracotta-deep); }

/* ── Vocabulary frequency-coverage panel + badges + filter chips ── *
 *
 * Phase 2 of the frequency-aware vocab work. Zipf/rank data lives in
 * spanish_frequencies; vocab_entries.zipf_frequency + a subquery for
 * rank feed the badges. Colors go from warm-green (top 1k = most
 * useful vocab to know) toward cooler / neutral shades as we move down
 * the frequency band. Unranked = neutral gray so phrases and regional
 * words don't get visually marked as "less than."
 */

/* Reference color palette for bands — reused by bars, chips, and badges. */
:root {
  --freq-top1k-bg:      #dcf0dc;
  --freq-top1k-fg:      #1f4f2f;
  --freq-top1k-border:  #a5cfa5;
  --freq-top3k-bg:      #d5e6f2;
  --freq-top3k-fg:      #1e4a6b;
  --freq-top3k-border:  #a2c3d9;
  --freq-top5k-bg:      #ded9ef;
  --freq-top5k-fg:      #3a2f6a;
  --freq-top5k-border:  #b4a9d0;
  --freq-above5k-bg:    #ececec;
  --freq-above5k-fg:    #4d4d4d;
  --freq-above5k-border:#c9c9c9;
  --freq-unranked-bg:   #f2f0eb;
  --freq-unranked-fg:   #7a7365;
  --freq-unranked-border:#d9d3c8;
}

.freq-panel {
  background: var(--cream, #fbf7ef);
  border: 1px solid var(--border, #e8dcc4);
  border-radius: var(--radius, 8px);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.freq-panel-title {
  margin: 0 0 0.15rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink, #2b1e10);
}
.freq-panel-hint {
  margin: 0 0 0.85rem 0;
  color: var(--muted, #7a6a55);
  font-size: 0.85rem;
}
.freq-bars {
  display: grid;
  gap: 0.4rem;
}
.freq-bar-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr 5.5rem;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.86rem;
}
.freq-bar-plain {
  grid-template-columns: 5.5rem 1fr;
}
.freq-bar-label {
  font-weight: 500;
  color: var(--ink, #2b1e10);
}
.freq-bar-count {
  color: var(--muted, #7a6a55);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.freq-bar-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.freq-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease-out;
}
.freq-bar-fill.freq-band-top1k    { background: #4f9856; }
.freq-bar-fill.freq-band-top3k    { background: #4a80a8; }
.freq-bar-fill.freq-band-top5k    { background: #7160a8; }

/* Filter chip row — sits inside .vocab-toolbar between search + add. */
.freq-filter {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}
.freq-chip {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border, #e8dcc4);
  background: #fff;
  color: var(--ink-soft, #4a3a25);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.freq-chip:hover {
  background: rgba(0, 0, 0, 0.03);
}
.freq-chip.active {
  border-color: var(--terracotta, #c1521e);
  background: var(--terracotta-soft, #f7e2cf);
  color: var(--terracotta-deep, #8a3a14);
  font-weight: 600;
}

/* Per-band chip tinting when NOT active — subtle so the "All" chip
 * doesn't look like the odd one out. Active-state override above
 * takes precedence. */
.freq-chip.freq-band-top1k    { background: var(--freq-top1k-bg);    color: var(--freq-top1k-fg);    border-color: var(--freq-top1k-border); }
.freq-chip.freq-band-top3k    { background: var(--freq-top3k-bg);    color: var(--freq-top3k-fg);    border-color: var(--freq-top3k-border); }
.freq-chip.freq-band-top5k    { background: var(--freq-top5k-bg);    color: var(--freq-top5k-fg);    border-color: var(--freq-top5k-border); }
.freq-chip.freq-band-above5k  { background: var(--freq-above5k-bg);  color: var(--freq-above5k-fg);  border-color: var(--freq-above5k-border); }
.freq-chip.freq-band-unranked { background: var(--freq-unranked-bg); color: var(--freq-unranked-fg); border-color: var(--freq-unranked-border); }

/* Row-level badge that appears next to each Spanish word. Same color
 * scheme as the chips but smaller / less visually loud. */
.freq-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.42rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  vertical-align: middle;
  white-space: nowrap;
}
.freq-badge.freq-band-top1k    { background: var(--freq-top1k-bg);    color: var(--freq-top1k-fg);    border-color: var(--freq-top1k-border); }
.freq-badge.freq-band-top3k    { background: var(--freq-top3k-bg);    color: var(--freq-top3k-fg);    border-color: var(--freq-top3k-border); }
.freq-badge.freq-band-top5k    { background: var(--freq-top5k-bg);    color: var(--freq-top5k-fg);    border-color: var(--freq-top5k-border); }
.freq-badge.freq-band-above5k  { background: var(--freq-above5k-bg);  color: var(--freq-above5k-fg);  border-color: var(--freq-above5k-border); }
.freq-badge.freq-band-unranked { background: var(--freq-unranked-bg); color: var(--freq-unranked-fg); border-color: var(--freq-unranked-border); }

/* Wrap the toolbar so the chip row can drop below on narrow screens
 * without cramming search + chips + add on a single line. */
.vocab-toolbar {
  flex-wrap: wrap;
}
.vocab-toolbar .freq-filter {
  order: 3;
  flex-basis: 100%;
}

/* Reading generator's inline band picker. Sits on its own row above
 * the action buttons so the "Target vocabulary" label + chips read as
 * a single group. Compact styling so it doesn't dominate the page. */
.reading-band-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  width: 100%;
}
.reading-band-picker .freq-panel-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted, #7a6a55);
}

/* Practice/Vocabulary band filter — same chip look, tucked between
 * the practice bar and the flip card so it doesn't compete with the
 * lifetime stats bar visually. */
.practice-band-filter {
  margin: 0.35rem 0 1rem 0;
}

/* Vocabulary gaps panel — "words to add next" surface. Uses the
 * shared .freq-panel container so it visually rhymes with the
 * coverage panel above it. */
.vocab-gaps-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
/* Chip row always drops to its own line under the title block so
 * tiny rank-range width differences (e.g. "200 – 15000" vs "500 – 25000")
 * don't flip the layout between CEFR levels. Consistent placement,
 * mobile-friendly on narrow viewports too. */
.vocab-gaps-cefr {
  flex-basis: 100%;
  flex-shrink: 0;
}

/* Recent imports (paste-a-passage log on /Vocabulary/Import). Each
 * row is a <details> so the passage text expands on click. */
.import-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.import-row {
  background: var(--cream, #fbf7ef);
  border: 1px solid var(--border, #e8dcc4);
  border-radius: var(--radius, 8px);
  padding: 0.6rem 0.85rem;
}
.import-row summary {
  cursor: pointer;
  list-style: none;
}
.import-row summary::-webkit-details-marker { display: none; }
.import-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.import-row-preview {
  margin: 0.35rem 0 0 0;
  font-size: 0.9rem;
  line-height: 1.4;
}
.import-row[open] .import-row-preview { display: none; }
.import-row-body {
  margin-top: 0.6rem;
  border-top: 1px solid var(--border, #e8dcc4);
  padding-top: 0.6rem;
}
.import-passage {
  margin: 0;
  padding: 0.6rem 0.75rem;
  background: #fff;
  border: 1px solid var(--border, #e8dcc4);
  border-radius: var(--radius-sm, 4px);
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 24rem;
  overflow-y: auto;
}
.vocab-gaps-cefr .freq-chip {
  min-width: 2.4rem;
  text-align: center;
  text-decoration: none;
}
.vocab-gaps .vocab-gap-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.vocab-gap-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  background: #fff;
  border: 1px solid var(--border, #e8dcc4);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.86rem;
  color: var(--ink, #2b1e10);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.vocab-gap-item:hover {
  background: var(--freq-top1k-bg, #dcf0dc);
  border-color: var(--freq-top1k-border, #a5cfa5);
}
.vocab-gap-item:active {
  transform: translateY(1px);
}
.vocab-gap-rank {
  font-size: 0.72rem;
  color: var(--muted, #7a6a55);
  font-variant-numeric: tabular-nums;
}
.vocab-gap-lemma {
  font-weight: 600;
}
.vocab-gap-pos {
  font-size: 0.72rem;
  color: var(--muted, #7a6a55);
  font-style: italic;
  text-transform: lowercase;
}

/* Row wrapper — chip + ✓/× button side by side. Gap is small so the
 * action button feels attached, not floating. */
.vocab-gap-row {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}
.vocab-gap-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid var(--border, #e8dcc4);
  border-radius: 999px;
  background: #fff;
  color: var(--muted, #7a6a55);
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.05s;
}
.vocab-gap-action:hover {
  background: var(--terracotta-soft, #f7e2cf);
  border-color: var(--terracotta, #c1521e);
  color: var(--terracotta-deep, #8a3a14);
}
.vocab-gap-action:active {
  transform: translateY(1px);
}
.vocab-gap-mark-known:hover {
  background: var(--freq-top1k-bg, #dcf0dc);
  border-color: var(--freq-top1k-border, #a5cfa5);
  color: var(--freq-top1k-fg, #1f4f2f);
}

/* Known-tab styling: neutral tone so it reads as "utility" rather than
 * "another CEFR level." */
.vocab-gaps-known-tab {
  background: #f2efe9;
  border-color: #d9d3c8;
  color: var(--muted, #7a6a55);
}
.vocab-gaps-known-tab.active {
  background: var(--terracotta-soft, #f7e2cf);
  border-color: var(--terracotta, #c1521e);
  color: var(--terracotta-deep, #8a3a14);
}

/* Known-list body: chips styled slightly muted so they read as
 * "previously dismissed" rather than "actionable recommendations." */
.vocab-gap-list-known .vocab-gap-item {
  background: #faf7f0;
  color: var(--ink-soft, #4a3a25);
}
.vocab-gap-list-known .vocab-gap-item:hover {
  background: #f2efe9;
  border-color: var(--border, #e8dcc4);
}
