/* italianwords — modern friendly app
   Manrope throughout. White surfaces, rust primary, sage for success,
   saffron for streak/achievement. Soft shadows, rounded corners, no cream. */

:root {
  /* Palette — true white surfaces */
  --bg:              #ffffff;   /* page background */
  --surface:         #ffffff;   /* cards */
  --surface-alt:     #f7f7f6;   /* stat cells, hover backgrounds */
  --ink:             #1a1a1a;
  --ink-soft:        #6b7280;
  --rust:            #c4441c;   /* primary accent */
  --rust-dk:         #8e2f10;
  --sage:            #5a8a6e;   /* success / correct */
  --sage-dk:         #3f6a52;
  --saffron:         #e6a948;   /* streak / achievement */
  --saffron-dk:      #c98920;
  --hairline:        rgba(26, 26, 26, 0.08);
  --hairline-strong: rgba(26, 26, 26, 0.14);

  /* Legacy aliases — kept so existing rules don't break while we transition */
  --bone:            var(--bg);
  --bone-soft:       var(--surface-alt);
  --paper:           var(--surface);

  /* Shape + depth */
  --radius:          12px;
  --radius-sm:       8px;
  --radius-pill:     999px;
  --shadow-card:     0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.05);
  --shadow-lift:     0 2px 4px rgba(0, 0, 0, 0.05), 0 12px 28px rgba(0, 0, 0, 0.08);
  --shadow-rust:     0 4px 18px rgba(196, 68, 28, 0.22);
  --shadow-sage:     0 4px 18px rgba(90, 138, 110, 0.22);
  --shadow-saffron:  0 4px 18px rgba(230, 169, 72, 0.25);

  --font-sans:       'Manrope', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-serif:      var(--font-sans); /* all display now uses sans */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font-sans);
  background: var(--bone);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(circle at 88% -12%, rgba(196, 68, 28, 0.05), transparent 50%),
    var(--bone);
  background-attachment: fixed;
  min-height: 100vh;
}

a {
  color: var(--rust);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--rust-dk); }

::selection { background: var(--rust); color: var(--paper); }

/* ─── Topbar ──────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--hairline);
  gap: 2rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 1.45rem;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand:hover .brand-mark { transform: rotate(-4deg); }
.brand-mark {
  flex-shrink: 0;
  display: block;
  transition: transform 0.18s cubic-bezier(.2, .7, .3, 1.4);
  filter: drop-shadow(0 1px 2px rgba(196, 68, 28, 0.18));
}
.brand i { color: var(--rust); font-style: italic; font-weight: 700; }

.topbar nav { display: flex; align-items: center; gap: 1.75rem; flex-wrap: wrap; }
.nav-divider {
  display: inline-block;
  width: 1px;
  height: 1.2rem;
  background: var(--hairline);
}
.topbar nav a {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.topbar nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--rust);
  text-decoration: none;
}

/* ─── Layout grid (sidebar + main) ───────────────────────── */

.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1360px;
  margin: 0 auto;
}

/* Sidebar shown by default on app pages. Marketing/auth pages opt out with
   `{% block sidebar %}{% endblock %}` which leaves it empty → :empty hides. */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  padding: 3rem 1rem 4rem 1.5rem;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  overflow-y: auto;
}
.sidebar:empty { display: none; }

/* ─── Container ───────────────────────────────────────────── */

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
  flex: 1 1 0;
  min-width: 0;
}

/* When sibling sidebar has content, the container loses its independent
   centering — it fills the remaining flex space. */
.layout:has(.sidebar:not(:empty)) > .container {
  margin: 0;
}

/* Data-heavy pages (dashboard, words browser, stats) need horizontal room
   for grids and tables. Study-card pages stay at the focused 720px. */
.container.wide { max-width: 1080px; }

/* ─── Sidebar nav ────────────────────────────────────────── */

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.sidebar-home {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.1s ease;
}
.sidebar-home:hover { background: rgba(196, 68, 28, 0.06); text-decoration: none; color: var(--ink); }
.sidebar-home.is-current { background: var(--rust); color: var(--paper); }
.sidebar-home.is-current:hover { background: var(--rust-dk); color: var(--paper); }
.sidebar-home-icon { font-size: 1.05rem; line-height: 1; }

.sidebar-section { display: flex; flex-direction: column; gap: 0.15rem; }
.sidebar-section-title {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0 0.75rem 0.5rem;
}
.sidebar-tile {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.1s ease, color 0.1s ease;
}
.sidebar-tile:hover {
  background: rgba(196, 68, 28, 0.06);
  text-decoration: none;
  color: var(--ink);
}
.sidebar-tile.is-current {
  background: rgba(196, 68, 28, 0.1);
  color: var(--rust);
  font-weight: 600;
}
.sidebar-tile.is-current:hover { background: rgba(196, 68, 28, 0.14); color: var(--rust); }
.sidebar-icon { display: inline-flex; color: currentColor; flex-shrink: 0; }
.sidebar-icon .ic { width: 18px; height: 18px; }
.sidebar-label { flex: 1; }

.mobile-only-modes { display: none; }

/* ─── Eyebrow + Hero ──────────────────────────────────────── */

.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.hero-meta .page-eyebrow { margin-bottom: 0; }

.badge-free {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--rust);
  padding: 0.35rem 0.75rem;
  line-height: 1;
  border-radius: var(--radius-pill);
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--saffron-dk);
  background: rgba(230, 169, 72, 0.12);
  border: 1px solid rgba(230, 169, 72, 0.45);
  padding: 0.35rem 0.85rem;
  line-height: 1;
  border-radius: var(--radius-pill);
}
.streak-flame {
  font-size: 1.05em;
}
.streak-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 0.4em;
  align-items: center;
}
.streak-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(230, 169, 72, 0.25);
}
.streak-dot.is-active { background: var(--saffron); }

.page-eyebrow {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--rust);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 1.1rem;
}
.page-eyebrow::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--rust);
  margin-right: 0.65rem;
  border-radius: 50%;
}

.hero { margin-bottom: 3.5rem; }
.hero-sm { margin-bottom: 2.5rem; }

.hero h1 {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(2.2rem, 5.5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
  max-width: 22ch;
}
.hero h1 .word { color: var(--rust); }
.hero h1 em { font-style: italic; font-weight: 700; }
.hero h1 .word[lang="it"] { font-style: italic; }

.hero .tagline {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-top: 1.1rem;
  max-width: 36rem;
}
.hero .tagline em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink);
  font-weight: 500;
}

/* ─── CTA cards ───────────────────────────────────────────── */

.cta-row {
  display: grid;
  /* Same 5-column track as the secondary row so both rows align cleanly.
     Primary card (`.cta-card.primary`) spans 3 of the 5 columns; the two
     adjacent cards each take one column, matching secondary widths below. */
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
  margin-top: 2rem;
}
.cta-row-solo {
  grid-template-columns: 1fr;
  max-width: 26rem;
}
.cta-row-secondary {
  grid-template-columns: repeat(5, 1fr);
  margin-top: 0.85rem;
}
.cta-card.primary {
  grid-column: span 3;
}
.cta-card.secondary {
  min-height: 5.5rem;
  padding: 1.2rem 1.4rem;
  background: var(--surface-alt);
  border-color: transparent;
  box-shadow: none;
}
.cta-card.secondary:hover {
  background: var(--surface);
  border-color: var(--hairline);
  box-shadow: var(--shadow-card);
}
.cta-card.secondary .cta-title { font-size: 1.15rem; margin-top: 0.4rem; }
.cta-card.secondary .cta-title .ic { color: var(--rust); }

/* Inline icon glyph (used in CTAs and small UI accents) */
.ic {
  width: 1.2em;
  height: 1.2em;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  stroke-width: 2;
}
.ic-lg { width: 2rem; height: 2rem; }

.cta-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem 1.4rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: var(--ink);
  min-height: 7.5rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.15s ease;
  position: relative;
}
.cta-card.primary {
  min-height: 11rem;
  padding: 1.75rem 1.75rem 1.5rem;
  background: var(--rust);
  border-color: var(--rust);
  color: var(--paper);
  box-shadow: var(--shadow-rust);
}
.cta-card.primary:hover {
  background: var(--rust-dk);
  border-color: var(--rust-dk);
  color: var(--paper);
  box-shadow: var(--shadow-lift);
}
.cta-card.primary .cta-label { color: rgba(255, 255, 255, 0.75); }
.cta-card.primary .cta-title { font-size: 1.85rem; margin-top: 0.7rem; color: var(--paper); }
.cta-card.primary .cta-title .ic { width: 1.4em; height: 1.4em; color: var(--paper); }
.cta-card:hover {
  border-color: var(--ink);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  text-decoration: none;
  color: var(--ink);
}
.cta-card:active { transform: translateY(-1px) scale(0.99); }
.cta-card.primary {
  background: var(--rust);
  border-color: var(--rust);
  color: var(--paper);
  box-shadow: var(--shadow-rust);
}
.cta-card.primary:hover {
  background: var(--rust-dk);
  border-color: var(--rust-dk);
  color: var(--paper);
}

.cta-label {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.75;
}
.cta-title {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.4rem;
  margin-top: 0.5rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cta-title .ic { flex-shrink: 0; }

.dir-toggle {
  display: inline-flex;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--ink);
  background: var(--paper);
}
.dir-pill {
  padding: 0.6rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink-soft);
  border-right: 1px solid var(--hairline);
  transition: background 0.12s ease, color 0.12s ease;
}
.dir-pill:last-child { border-right: 0; }
.dir-pill:hover { color: var(--ink); text-decoration: none; }
.dir-pill.is-active {
  background: var(--ink);
  color: var(--paper);
}
.dir-pill.is-active:hover { color: var(--paper); text-decoration: none; }
.dir-arrow {
  display: inline-block;
  margin: 0 0.25em;
  font-family: var(--font-serif);
  font-style: italic;
  opacity: 0.7;
}

.grammar-link {
  margin-top: 2rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.grammar-link a {
  color: var(--rust);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  margin-left: 0.25em;
}

/* ─── Today-intake mini bar ───────────────────────────────── */

.today-bar {
  margin-top: 1.25rem;
  max-width: 26rem;
}
.today-bar-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}
.today-bar-track {
  height: 6px;
  background: var(--surface-alt);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.today-bar-fill {
  display: block;
  height: 100%;
  background: var(--saffron);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

/* ─── "All modes" disclosure ──────────────────────────────── */

.other-modes {
  margin-top: 2rem;
}
.other-modes summary {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.6rem 0;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.15s ease;
}
.other-modes summary:hover { color: var(--ink); }
.other-modes summary::-webkit-details-marker { display: none; }
.other-modes summary::after {
  content: '▾';
  font-size: 0.8em;
  color: var(--rust);
  transition: transform 0.15s ease;
}
.other-modes[open] summary::after { transform: rotate(180deg); }
.other-modes .cta-row:first-of-type { margin-top: 0.5rem; }

/* ─── Buttons ─────────────────────────────────────────────── */

.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.4rem;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: var(--radius);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}
.btn:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 3px;
}
.btn-primary {
  background: var(--rust);
  border-color: var(--rust);
  color: var(--paper);
  box-shadow: var(--shadow-rust);
}
.btn-primary:hover {
  background: var(--rust-dk);
  border-color: var(--rust-dk);
  color: var(--paper);
  box-shadow: var(--shadow-lift);
}

/* ─── Listening exercise ────────────────────────────────────── */

.listening-card { text-align: center; padding: 4rem 2.5rem 2.5rem; }

.listening-play {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--rust);
  color: var(--paper);
  border: 1px solid var(--rust);
  padding: 1.4rem 2rem;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-rust);
  transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.15s ease;
}
.listening-play:hover { background: var(--rust-dk); border-color: var(--rust-dk); box-shadow: var(--shadow-lift); }
.listening-play:active { transform: scale(0.96); }
.listening-play:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.listening-play-icon { width: 1.4em; height: 1.4em; }
.listening-play-label { font-family: var(--font-sans); }

.listening-card .typing-form { margin-top: 1.75rem; }

.listening-reveal {
  margin-top: 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}
.listening-reveal summary {
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
  display: inline-block;
  padding: 0.25rem 0;
  letter-spacing: 0.04em;
}
.listening-reveal summary::-webkit-details-marker { display: none; }
.listening-reveal summary::after { content: ' \2193'; opacity: 0.6; }
.listening-reveal[open] summary::after { content: ' \2191'; }
.listening-reveal-text {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--ink);
  margin-top: 0.5rem;
  display: inline-block;
}

/* ─── Cloze exercise ──────────────────────────────────────── */

.cloze-sentence {
  font-family: var(--font-sans);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  line-height: 1.45;
  color: var(--ink);
  margin: 0.5rem auto 1.5rem;
  max-width: 30rem;
}
.cloze-blank {
  display: inline-block;
  border-bottom: 2px solid var(--rust);
  min-width: 5em;
  height: 1em;
  vertical-align: baseline;
  margin: 0 0.15em;
}
.cloze-hint {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  margin-top: 0.25rem;
  margin-bottom: 1rem;
}

/* ─── Conjugation exercise ────────────────────────────────── */

.conjugate-prompt {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4em;
  margin-top: 0.25rem;
}
.pronoun {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  color: var(--rust);
}
.conjugate-target {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink-soft);
}

.conjugate-infinitive {
  text-align: center;
  margin-top: 1rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
}
.conjugate-inf-word {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  color: var(--ink);
}
.conjugate-inf-en {
  color: var(--ink-soft);
  margin-left: 0.3rem;
}

.pronoun-sm {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  color: var(--rust);
  margin-right: 0.4em;
}

.conjugate-table {
  margin-top: 1.5rem;
  text-align: left;
}
.conjugate-table summary {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--rust);
  cursor: pointer;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  list-style: none;
  padding: 0.4rem;
}
.conjugate-table summary::-webkit-details-marker { display: none; }
.conjugate-table summary::after { content: ' \2193'; }
.conjugate-table[open] summary::after { content: ' \2191'; }
.conjugate-table summary span {
  font-style: italic;
  font-family: var(--font-serif);
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.forms-table {
  width: 100%;
  margin: 0.75rem auto 0;
  border-collapse: collapse;
  font-family: var(--font-sans);
  max-width: 22rem;
}
.forms-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--hairline);
}
.forms-table tr:last-child td { border-bottom: 0; }
.forms-pronoun {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  color: var(--rust);
  width: 30%;
}
.forms-value {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--ink);
}
.forms-speak { width: 1.8rem; text-align: right; }
.this-row .forms-value { font-weight: 800; }
.this-row .forms-pronoun { font-weight: 600; }

/* ─── Speaker button (pronunciation) ──────────────────────── */

.say {
  background: none;
  border: 0;
  padding: 0;
  margin-left: 0.35em;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  border-radius: 0;
  line-height: 0;
  transition: color 0.12s ease, transform 0.08s ease;
}
.say:hover { color: var(--rust); }
.say:active { transform: scale(0.92); }
.say:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}
.say-icon {
  width: 0.7em;
  height: 0.7em;
}

/* Use a slightly subdued size near display-sized prompts so the icon
   doesn't compete with the giant word. */
.say.say-lg .say-icon { width: 0.45em; height: 0.45em; }
.say.say-inline .say-icon { width: 0.9em; height: 0.9em; }

/* ─── Topbar level chip + popover ─────────────────────────── */

.level-chip-wrap {
  position: relative;
  margin-right: auto;
  margin-left: 0.5rem;
}
.level-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--hairline);
  background: var(--paper);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease;
}
.level-chip:hover { border-color: var(--ink-soft); }
.level-chip:active { transform: scale(0.97); }
.level-chip:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
.level-chip[aria-expanded="true"] {
  border-color: var(--rust);
  background: rgba(196, 68, 28, 0.04);
}
.level-chip-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.level-chip-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--rust);
  letter-spacing: 0.04em;
}
.level-chip-caret {
  font-size: 0.7rem;
  color: var(--ink-soft);
  transition: transform 0.14s ease;
}
.level-chip[aria-expanded="true"] .level-chip-caret { transform: rotate(180deg); }

.level-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 220px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 0.55rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.level-popover[hidden] { display: none; }
.level-popover-title {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0.4rem 0.7rem 0.55rem;
}
.level-popover-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: none;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s ease, color 0.1s ease;
}
.level-popover-row:hover { background: rgba(196, 68, 28, 0.06); }
.level-popover-row:focus-visible { outline: 2px solid var(--rust); outline-offset: -2px; }
.level-popover-row.is-active { color: var(--rust); }
.level-popover-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border: 1.5px solid var(--hairline);
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--paper);
  flex-shrink: 0;
}
.level-popover-row.is-active .level-popover-check {
  background: var(--rust);
  border-color: var(--rust);
}
.level-popover-name { letter-spacing: 0.04em; }
.level-popover-hint {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--ink-soft);
  padding: 0.5rem 0.7rem 0.3rem;
  border-top: 1px solid var(--hairline);
  margin-top: 0.2rem;
}

/* ─── Stats grid ──────────────────────────────────────────── */

.stats {
  margin-top: 4rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--hairline);
}
.stats-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
}
.stat {
  background: var(--bone-soft);
  padding: 1.5rem 1.1rem;
  text-align: left;
  border-radius: var(--radius-sm);
}
.stat-num {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 2.2rem;
  line-height: 1;
  color: var(--saffron-dk);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-label {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  color: var(--ink-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.5rem;
  font-weight: 600;
}
.stat-bar {
  margin-top: 0.6rem;
  height: 4px;
  background: rgba(230, 169, 72, 0.18);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.stat-bar-fill {
  display: block;
  height: 100%;
  background: var(--saffron);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

.stats-list {
  margin-top: 2rem;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.stats-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--hairline);
  gap: 1rem;
}
.stats-list > div:last-child { border-bottom: 0; }
.stats-list dt {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}
.stats-list dd {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ─── Card surface ────────────────────────────────────────── */

.card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 3.5rem 2.5rem;
  margin-top: 1rem;
  animation: fade-in 0.35s ease-out both;
}
.question-card { padding: 4rem 2.5rem 2.5rem; text-align: center; }

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

.prompt-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--rust);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}
.prompt {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(2.6rem, 7vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink);
  display: block;
}
.prompt[lang="it"] { font-style: italic; font-weight: 700; }
.pos {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  color: var(--ink-soft);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 1.1rem;
  display: block;
  font-weight: 500;
}

/* ─── MC options ──────────────────────────────────────────── */

.options {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  text-align: left;
}
.option {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  padding: 1rem 1.2rem;
  text-align: left;
  border: 1px solid var(--hairline);
  background: var(--bone-soft);
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.option:active { transform: scale(0.985); }
.option:hover { box-shadow: var(--shadow-card); }
.option:hover {
  border-color: var(--ink);
  background: var(--paper);
}
.option:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: -1px;
  border-color: var(--rust);
}

/* ─── Typing form ─────────────────────────────────────────── */

.typing-form {
  margin: 2.5rem auto 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: end;
  max-width: 30rem;
}
.typing-form input[type="text"] {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 400;
  padding: 0.5rem 0;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  width: 100%;
}
.typing-form input[type="text"]::placeholder {
  color: var(--ink-soft);
  opacity: 0.5;
  font-size: 1rem;
}
.typing-form input[type="text"]:focus {
  outline: none;
  border-bottom-color: var(--rust);
  border-bottom-width: 2px;
  padding-bottom: calc(0.5rem - 1px);
}

/* ─── Flashcard reveal ────────────────────────────────────── */

.reveal { margin-top: 2.5rem; }
.reveal summary {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--rust);
  cursor: pointer;
  list-style: none;
  display: inline-block;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--rust);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.reveal summary::-webkit-details-marker { display: none; }
.reveal[open] summary {
  color: var(--ink-soft);
  border-bottom-color: var(--ink-soft);
}
.reveal .answer {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 2rem;
  color: var(--ink);
  margin-top: 1.25rem;
  letter-spacing: -0.02em;
  animation: fade-in 0.25s ease-out both;
}
.reveal .answer[lang="it"] { font-style: italic; }
.reveal .example {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-top: 0.9rem;
}
.reveal .example .it {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink);
  font-weight: 500;
}

/* ─── Flashcard ratings ───────────────────────────────────── */

.ratings {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}
.rating {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.85rem 0.5rem;
  border: 1px solid var(--hairline);
  background: var(--bone-soft);
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease, transform 0.1s ease;
}
.rating:active { transform: scale(0.96); }
.rating:hover { border-color: var(--ink); }
.rating-again:hover { color: var(--rust); border-color: var(--rust); }
.rating:focus-visible { outline: 2px solid var(--rust); outline-offset: -1px; }

/* ─── Feedback ────────────────────────────────────────────── */

.feedback {
  text-align: center;
  padding: 3.5rem 2.5rem 2.5rem;
  position: relative;   /* anchor for absolutely-positioned confetti burst */
  overflow: hidden;     /* keep stray dots inside the card */
}
.feedback.correct { box-shadow: var(--shadow-sage); border-color: rgba(90, 138, 110, 0.4); }
.feedback.wrong   { box-shadow: var(--shadow-rust); border-color: rgba(196, 68, 28, 0.4); }
.feedback.correct .verdict { color: var(--sage-dk); }
.feedback.wrong   .verdict { color: var(--rust); }

.verdict {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.verdict-sub {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  color: var(--ink-soft);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-top: 1rem;
  font-weight: 500;
}

.answer-row {
  margin-top: 2.5rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.answer-row .it {
  font-family: var(--font-sans);
  font-style: italic;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--ink);
}
.answer-row .sep {
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.answer-row .en { color: var(--ink-soft); }

.user-was {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 1rem;
}
.user-was strong {
  font-weight: 500;
  color: var(--rust);
}

.example {
  font-family: var(--font-sans);
  color: var(--ink-soft);
  margin-top: 1.2rem;
  font-size: 0.95rem;
}
.example .it {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink);
  font-weight: 500;
}

.feedback .btn { margin-top: 2rem; }

/* Correct: verdict pulses; small confetti burst from center */
.feedback.correct .verdict {
  animation: pulse 0.6s cubic-bezier(.2, .7, .3, 1.4) both;
}
@keyframes pulse {
  0%   { transform: scale(0.85); opacity: 0; }
  60%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Confetti is positioned absolutely over the verdict (~30% down inside the
   feedback card), so dots radiate out from where the user's eyes are. */
.confetti {
  position: absolute;
  top: 30%;
  left: 50%;
  width: 1px; height: 1px;
  pointer-events: none;
  z-index: 2;
}
.confetti-dot {
  position: absolute;
  top: 0; left: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  opacity: 0;
  --dx: 0px; --dy: 0px;
  animation: confetti-burst 1.4s cubic-bezier(.18, .8, .32, 1) forwards;
}
.confetti-dot.c1 { background: var(--sage);    --dx: -100px; --dy: -80px;  animation-delay: 0ms; }
.confetti-dot.c2 { background: var(--saffron); --dx:  100px; --dy: -85px;  animation-delay: 40ms; }
.confetti-dot.c3 { background: var(--rust);    --dx: -130px; --dy:  20px;  animation-delay: 80ms; }
.confetti-dot.c4 { background: var(--sage);    --dx:  130px; --dy:  30px;  animation-delay: 120ms; }
.confetti-dot.c5 { background: var(--saffron); --dx:  -50px; --dy:  110px; animation-delay: 60ms; }
.confetti-dot.c6 { background: var(--rust);    --dx:   60px; --dy:  100px; animation-delay: 100ms; }
@keyframes confetti-burst {
  0%   { transform: translate(0px, 0px) scale(0.4); opacity: 0; }
  15%  { transform: translate(calc(var(--dx) * 0.15), calc(var(--dy) * 0.15)) scale(1.1); opacity: 1; }
  70%  { transform: translate(calc(var(--dx) * 0.85), calc(var(--dy) * 0.85)) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.8); opacity: 0; }
}

/* gentle nudge on wrong */
.feedback.wrong .verdict {
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* ─── Done state ──────────────────────────────────────────── */

.done { text-align: center; padding: 5rem 2rem; }
.done .page-eyebrow { color: var(--ink-soft); }
.done .page-eyebrow::before { background: var(--ink-soft); }
.done h2 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 3rem);
  color: var(--ink);
  margin-top: 0.5rem;
}
.done p {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink-soft);
  margin-top: 1.2rem;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Misc ────────────────────────────────────────────────── */

.muted {
  font-family: var(--font-sans);
  color: var(--ink-soft);
  text-align: center;
  padding: 3rem 1rem;
}

/* ─── Word index / detail pages ──────────────────────────── */

.back-nav {
  margin-top: -2rem;
  margin-bottom: 1.5rem;
}
.back-nav a {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.back-nav a:hover { color: var(--rust); }

.word-search {
  margin-top: 2rem;
  margin-bottom: 1rem;
}
.word-search input[type="search"] {
  width: 100%;
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--hairline);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.word-search input[type="search"]:focus {
  outline: none;
  border-color: var(--rust);
  box-shadow: var(--shadow-rust);
}
.word-search input[type="search"]::placeholder {
  font-family: var(--font-sans);
  font-style: normal;
  color: var(--ink-soft);
  opacity: 0.6;
}

.word-section {
  margin-top: 2.5rem;
}
.word-section-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--ink);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--hairline);
}

.word-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--hairline);
}
.word-row {
  display: grid;
  grid-template-columns: minmax(8rem, auto) 1fr auto;
  align-items: baseline;
  gap: 1.25rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--hairline);
}
.word-row:last-child { border-bottom: 0; }
.word-row:hover { background: var(--bone); }

.word-emoji {
  display: inline-block;
  font-size: 1.2rem;
  margin-right: 0.5rem;
  vertical-align: middle;
  line-height: 1;
}
.word-it {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}
.word-it:hover {
  color: var(--rust);
  text-decoration: underline;
}
.word-en {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.word-gender {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust);
  border: 1px solid var(--hairline);
  padding: 0.12rem 0.45rem;
  align-self: center;
}

/* ─── Word detail page (modern card-based) ──────────────────── */

.word-hero-card {
  text-align: center;
  padding: 2.5rem 2rem 2rem;
  margin-top: 0.5rem;
}
.word-hero-tags {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.word-tag {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  background: var(--surface-alt);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  text-transform: lowercase;
}
.word-tag-level { color: var(--rust); background: rgba(196, 68, 28, 0.08); }
.word-tag-rank  { color: var(--saffron-dk); background: rgba(230, 169, 72, 0.14); }

.word-hero-emoji {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.word-headline {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0.3rem 0 1.25rem;
  font-style: italic;  /* explicit; lang="it" semantic */
}

.word-hero-play {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--rust);
  color: var(--paper);
  border: 0;
  padding: 0.7rem 1.4rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-rust);
  transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.15s ease;
  margin-bottom: 1.25rem;
}
.word-hero-play:hover { background: var(--rust-dk); box-shadow: var(--shadow-lift); }
.word-hero-play:active { transform: scale(0.96); }
.word-hero-play svg { width: 1.1em; height: 1.1em; flex-shrink: 0; }

.word-hero-en {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--ink-soft);
  margin: 0;
}

/* Example sentence card */
.word-example-card {
  margin-top: 0.85rem;
  padding: 1.5rem 1.75rem;
}
.word-card-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.6rem;
}
.example-it {
  font-family: var(--font-sans);
  font-style: italic;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 0.4rem;
}
.example-en {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0;
}

.word-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.related { margin-top: 2.5rem; }

/* Related-words chips */
.related-chips {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.related-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.55rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-sans);
  transition: border-color 0.12s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.related-chip:hover {
  border-color: var(--ink);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: var(--ink);
  transform: translateY(-1px);
}
.related-chip-emoji { font-size: 1rem; }
.related-chip-it { font-style: italic; font-weight: 700; font-size: 0.95rem; }
.related-chip-en { color: var(--ink-soft); font-size: 0.85rem; }

/* ─── Topbar auth element ─────────────────────────────────── */

.nav-form { display: inline; margin: 0; padding: 0; }
.nav-link-btn {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  padding: 0.25rem 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-link-btn:hover { color: var(--ink); border-bottom-color: var(--rust); }
/* Higher specificity than `.topbar nav a` so the white-on-rust pill wins.
   Applies to both anchors (Save progress, Log in CTA) and the Log out
   submit button so all auth-state CTAs share the same highlight. */
.topbar nav a.nav-link-cta,
.topbar nav button.nav-link-cta {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--paper);
  background: var(--rust);
  padding: 0.4rem 0.85rem;
  border: 0;
  border-radius: var(--radius-pill);
  text-decoration: none;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.topbar nav a.nav-link-cta:hover,
.topbar nav button.nav-link-cta:hover {
  background: var(--rust-dk);
  color: var(--paper);
  text-decoration: none;
}

/* ─── Auth forms (signup, login) ──────────────────────────── */

.auth-form { display: flex; flex-direction: column; gap: 1.5rem; }
.auth-form label { display: flex; flex-direction: column; gap: 0.35rem; }
.form-label {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.auth-form input[type="email"],
.auth-form input[type="password"] {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--hairline);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--rust);
  box-shadow: var(--shadow-rust);
}
.form-hint {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.form-error {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--rust-dk);
  background: rgba(196, 68, 28, 0.08);
  border: 1px solid rgba(196, 68, 28, 0.25);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}
.form-foot {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 1.5rem;
  text-align: center;
}

/* ─── Save-progress + verify-email banners ────────────────── */

.nudge-banner, .verify-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
  flex-wrap: wrap;
}
.verify-banner {
  background: rgba(230, 169, 72, 0.08);
  border-color: rgba(230, 169, 72, 0.35);
}
.nudge-body { display: flex; flex-direction: column; gap: 0.25rem; }
.nudge-body strong {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}
.nudge-sub {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.nudge-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.nudge-dismiss {
  background: transparent;
  border-color: var(--hairline);
  color: var(--ink-soft);
}
.nudge-dismiss:hover { background: var(--surface-alt); color: var(--ink); border-color: var(--ink-soft); }

/* ─── Landing sections (cils-b1) ──────────────────────────── */

.hero-foot {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 1rem;
  font-style: italic;
}

.landing-preview {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--hairline);
}
.preview-card {
  pointer-events: none;
  user-select: none;
  margin-top: 1rem;
  position: relative;
  opacity: 0.96;
}
.preview-options {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  text-align: left;
}
.preview-options .option { cursor: default; }
.preview-caption {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-top: 1.25rem;
  max-width: 36rem;
  line-height: 1.5;
}

.landing-block {
  margin-top: 3.5rem;
}
.landing-block h2 {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 1rem;
}
.landing-block p {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.65;
  max-width: 38rem;
  margin-bottom: 0.85rem;
}
.landing-block p em {
  font-style: italic;
  color: var(--ink);
}

.landing-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  max-width: 38rem;
}
.landing-list li {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.6;
  padding: 0.85rem 0;
  border-top: 1px solid var(--hairline);
}
.landing-list li:first-child { border-top: 0; }

/* FAQ: native <details> styling tuned to match the design system. */
.faq details {
  border-top: 1px solid var(--hairline);
  padding: 1rem 0;
}
.faq details:last-of-type { border-bottom: 1px solid var(--hairline); }
.faq summary {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  color: var(--rust);
  font-weight: 600;
  font-size: 1.4rem;
  line-height: 1;
  transition: transform 0.15s ease;
}
.faq details[open] summary::after {
  content: '−';
}
.faq details p {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.65;
  margin-top: 0.85rem;
  max-width: 38rem;
}

.landing-cta {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--hairline);
}
.landing-cta h2 {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}
.landing-cta p {
  font-family: var(--font-sans);
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
}

/* ─── Footer ──────────────────────────────────────────────── */

.site-footer {
  margin-top: 6rem;
  padding: 2.5rem 1.5rem 3rem;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.footer-row {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-row nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-row a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.footer-row a:hover {
  color: var(--ink);
  border-bottom-color: var(--rust);
}

/* ─── Responsive ──────────────────────────────────────────── */

@media (max-width: 700px) {
  html, body { font-size: 17px; }
  .topbar { padding: 1rem 1.25rem; }
  .topbar nav { gap: 1.1rem; }
  .topbar nav a { font-size: 0.88rem; }
  .container { padding: 2.5rem 1rem 4rem; }
  .cta-row { grid-template-columns: 1fr; }
  .options { grid-template-columns: 1fr; }
  .ratings { grid-template-columns: 1fr 1fr; }
  .typing-form { grid-template-columns: 1fr; max-width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 2.5rem 1.25rem; }
  .question-card { padding: 3rem 1.25rem 2rem; }
  .feedback { padding: 2.5rem 1.25rem 2rem; }
  .word-row { grid-template-columns: 1fr; gap: 0.25rem; padding: 0.85rem 1rem; }
  .word-def { grid-template-columns: 1fr; gap: 0.4rem 0; }
  .word-def dd { margin-bottom: 0.75rem; }
  .word-card { padding: 2rem 1.25rem; }
  .sidebar { display: none; }
  .layout { display: block; }
  .mobile-only-modes { display: block; }
  .level-chip-wrap { margin-left: 0; margin-right: 0; }
  .level-chip { padding: 0.35rem 0.7rem; }
  .level-chip-label { display: none; }
  .level-popover { right: 0; left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
