:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --sidebar: #1a1f2e;
  --sidebar-text: #c8cdd8;
  --sidebar-active: #ffffff;
  --accent: #c9a227;
  --accent-soft: #f5ecd4;
  --danger: #b83a3a;
  --success: #2d6a4f;
  --success-bg: #d8f3dc;
  --error-bg: #fde8e8;
  --text: #1a1f2e;
  --muted: #5c6370;
  --border: #e2ddd3;
  --german: #1e3a5f;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(26, 31, 46, 0.08);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-german: Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1rem;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--sidebar-active);
  font-weight: 600;
}

.sidebar-brand p {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  opacity: 0.75;
}

.sidebar nav a {
  display: block;
  padding: 0.45rem 1.25rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.88rem;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-active);
}

.sidebar nav a.active {
  background: rgba(201, 162, 39, 0.15);
  color: var(--accent);
  border-left-color: var(--accent);
}

.sidebar-section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 1rem 1.25rem 0.35rem;
  opacity: 0.5;
}

.main {
  padding: 2rem 2.5rem 4rem;
  max-width: 920px;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.85rem;
  font-weight: 700;
}

.page-header .subtitle {
  color: var(--muted);
  margin: 0;
}

.hero-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s;
}

.hero-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.hero-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.hero-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.hero-card .badge {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.72rem;
  background: var(--accent-soft);
  color: #7a6520;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.lesson-part {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.lesson-part h2 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  color: var(--german);
}

.lesson-part .part-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.lesson-part h3 {
  margin: 1.5rem 0 0.65rem;
  font-size: 1.05rem;
}

.lesson-part p {
  margin: 0.65rem 0;
}

.recap {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.15rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 1.5rem;
}

.recap h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7a6520;
}

.recap ul {
  margin: 0;
  padding-left: 1.2rem;
}

.recap li {
  margin: 0.25rem 0;
}

.de {
  font-family: var(--font-german);
  font-weight: 600;
  color: var(--german);
}

.de-inline {
  font-family: var(--font-german);
  font-weight: 600;
  color: var(--german);
}

.en-hint {
  font-family: var(--font);
  font-weight: 400;
  font-size: 0.88em;
  color: var(--muted);
  font-style: italic;
  white-space: normal;
}

.de-list .en-hint {
  margin-right: 0.15rem;
}

.pron-inline {
  font-family: var(--font);
  font-weight: 400;
  font-size: 0.82em;
  color: #2a5080;
  font-style: normal;
}

.learn-line {
  display: block;
  margin-top: 0.45rem;
  padding: 0.55rem 0.7rem;
  background: #eef3f9;
  border-left: 3px solid #6b9bd1;
  border-radius: 6px;
  font-size: 0.86rem;
  line-height: 1.55;
}

.learn-line .de-alt + .pron-row {
  margin-top: 0.35rem;
}

.de-say-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  font-style: normal;
}

.pron-row .pron-hint,
.learn-line .pron-hint {
  color: #1e3a5f;
  font-family: var(--font);
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.script-body p {
  margin: 0.35rem 0;
}

.script-body .learn-line {
  margin-bottom: 0.65rem;
}

.vocab-tip {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 0.85rem 1rem;
  margin: 0 0 1.5rem;
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.vocab-tip strong {
  color: var(--text);
}

table.vocab-en th:nth-child(2),
table.vocab-en td:nth-child(2) {
  color: var(--muted);
  font-style: italic;
}

.ok { color: var(--success); }
.bad { color: var(--danger); }

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

th,
td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  text-align: left;
}

th {
  background: #f0ece4;
  font-weight: 600;
}

code,
.pre-block {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  background: #f0ece4;
  border-radius: 6px;
}

.pre-block {
  display: block;
  padding: 1rem;
  white-space: pre-wrap;
  line-height: 1.5;
  margin: 1rem 0;
}

.tree {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  background: #f0ece4;
  padding: 1rem;
  border-radius: var(--radius);
  white-space: pre;
  overflow-x: auto;
}

.exercise-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.exercise-section h2 {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
  color: var(--german);
}

.exercise-section .section-tag {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.exercise-group h3 {
  margin: 1.25rem 0 0.75rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.question {
  margin: 0.85rem 0;
  padding: 0.85rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid transparent;
}

.question.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.question.incorrect {
  border-color: var(--danger);
  background: var(--error-bg);
}

.question-label {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

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

input[type="text"],
textarea,
select {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  min-width: 180px;
  flex: 1;
}

textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
}

.btn {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.15s;
}

.btn:hover {
  opacity: 0.88;
}

.btn-primary {
  background: var(--german);
  color: #fff;
}

.btn-accent {
  background: var(--accent);
  color: #1a1f2e;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.answer-reveal {
  margin-top: 0.5rem;
  font-size: 0.88rem;
  color: var(--success);
  display: none;
}

.answer-reveal.visible {
  display: block;
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}

.score-bar {
  margin-left: auto;
  font-size: 0.88rem;
  color: var(--muted);
  align-self: center;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.checklist input[type="checkbox"] {
  margin-top: 0.25rem;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.prep-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.prep-card h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--german);
}

.mc-options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.mc-options label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.92rem;
}

.reading-text {
  background: #f0ece4;
  padding: 1rem;
  border-radius: 8px;
  font-style: italic;
  margin-bottom: 0.75rem;
}

.script-card {
  background: linear-gradient(135deg, #1a1f2e 0%, #2a3347 100%);
  color: #f0ece4;
  padding: 1.75rem;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  border-left: 5px solid var(--accent);
  box-shadow: var(--shadow);
}

.script-card h3 {
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.script-card .script-body {
  font-family: var(--font-german);
  font-size: 1.15rem;
  line-height: 1.85;
}

.script-card .script-body p {
  margin: 0.35rem 0;
}

.script-card .script-note {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
  opacity: 0.85;
  font-family: var(--font);
}

.script-card .de,
.script-card .de-inline {
  color: #f5ecd4;
}

.script-card .en-hint {
  color: #b8c4d4;
}

.script-card .pron-inline {
  color: #9ec5e8;
}

.script-card .learn-line {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent);
}

.script-card .learn-line .de-say-label {
  color: var(--accent);
}

.script-card .learn-line .pron-hint {
  color: #e8f0f8;
}

.class-repeat {
  background: #eef6ff;
  border: 1px solid #c5d9f0;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
}

.class-repeat h4 {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1e3a5f;
}

.details-table td:first-child {
  font-weight: 600;
  width: 38%;
}

/* ---------- concept cards (grammar-concepts / cheat-sheet) ---------- */

.concept-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.concept-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  color: var(--german);
}

.concept-card .plain {
  background: #eef6ff;
  border-left: 4px solid #6b9bd1;
  padding: 0.8rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 0.75rem 0;
  font-size: 0.95rem;
}

.concept-card .plain strong { color: #1e3a5f; }

.hack {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 0.8rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 0.75rem 0;
  font-size: 0.92rem;
}

.hack strong { color: #7a6520; }

.example-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.6rem 0;
  font-size: 0.92rem;
}

.example-pair .ex-de {
  background: #f0f4fa;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-family: var(--font-german);
  font-weight: 600;
  color: var(--german);
}

.example-pair .ex-en {
  background: var(--bg);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  color: var(--muted);
  font-style: italic;
}

.toc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
}

.toc-chips a {
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}

.toc-chips a:hover { border-color: var(--accent); }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
}

.table-scroll table {
  margin: 0;
  min-width: 480px;
}

.warn-note {
  background: var(--error-bg);
  border-left: 4px solid var(--danger);
  padding: 0.8rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

/* ---------- mobile ---------- */

.mobile-topbar {
  display: none;
}

@media (max-width: 768px) {
  body {
    font-size: 15px;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--sidebar);
    color: var(--sidebar-active);
    padding: 0.65rem 1rem;
    padding-top: calc(0.65rem + env(safe-area-inset-top, 0));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  }

  .mobile-topbar-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-menu-btn {
    flex: 0 0 auto;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-active);
    border-radius: 8px;
    padding: 0.55rem 0.9rem;
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 44px;
    min-width: 72px;
    cursor: pointer;
  }

  .mobile-menu-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
    position: relative;
    height: auto;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  body.nav-open .sidebar {
    display: block;
  }

  .sidebar-brand {
    display: none;
  }

  .sidebar nav {
    display: flex;
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 0.4rem;
    padding: 0.25rem 1rem 0.6rem;
  }

  .sidebar nav a {
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    font-size: 0.84rem;
    white-space: nowrap;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  .sidebar nav a.active {
    border-color: var(--accent);
    background: rgba(201, 162, 39, 0.15);
  }

  .sidebar-section {
    padding: 0.65rem 1rem 0.15rem;
    width: 100%;
  }

  .main {
    padding: 1.1rem 1rem 3.5rem;
    max-width: 100%;
  }

  .page-header {
    margin-bottom: 1.25rem;
  }

  .page-header h1 {
    font-size: 1.4rem;
    line-height: 1.25;
  }

  .page-header .subtitle {
    font-size: 0.92rem;
  }

  .vocab-tip {
    font-size: 0.88rem;
    padding: 0.85rem 1rem;
  }

  .hero-cards {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin: 1.25rem 0;
  }

  .hero-card {
    padding: 1.1rem 1rem;
  }

  .hero-card h2 {
    font-size: 1.05rem;
  }

  .lesson-part,
  .exercise-section,
  .concept-card,
  .prep-card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .toolbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .toolbar .btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.6rem 0.5rem;
    font-size: 0.9rem;
    text-align: center;
  }

  .toolbar .score-bar {
    flex: 1 0 100%;
    margin-left: 0;
    text-align: right;
  }

  .example-pair {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .table-scroll {
    margin: 0.75rem -0.25rem;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
  }

  .table-scroll::after {
    content: "swipe →";
    display: block;
    font-size: 0.7rem;
    color: var(--muted);
    text-align: right;
    padding: 0.2rem 0.5rem 0;
  }

  .table-scroll table {
    min-width: 520px;
  }

  table {
    font-size: 0.82rem;
  }

  th,
  td {
    padding: 0.5rem 0.55rem;
  }

  .pre-block {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.8rem;
    padding: 0.85rem;
  }

  .cheat-grid {
    grid-template-columns: 1fr !important;
  }

  .toc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .toc-chips a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .question-row {
    flex-wrap: wrap;
  }

  input[type="text"],
  select,
  textarea,
  .btn {
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .btn {
    padding: 0.65rem 1rem;
    min-height: 44px;
  }

  .checklist li {
    padding: 0.35rem 0;
  }

  .checklist input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    min-width: 1.15rem;
  }

  textarea {
    min-height: 140px;
    width: 100%;
  }
}

@media (max-width: 420px) {
  .page-header h1 {
    font-size: 1.25rem;
  }

  .sidebar nav a {
    font-size: 0.78rem;
    padding: 0.5rem 0.75rem;
  }

  .toolbar .btn {
    font-size: 0.85rem;
    padding: 0.6rem 0.4rem;
  }
}

/* ---------- Solve all toolbar (mobile-first) ---------- */

.solve-toolbar {
  position: sticky;
  bottom: 0;
  z-index: 180;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.65rem 0.85rem;
  padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0));
  background: rgba(26, 31, 46, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.18);
}

.solve-toolbar .btn {
  flex: 1 1 auto;
  min-width: 4rem;
  min-height: 44px;
  padding: 0.6rem 0.5rem;
  font-size: 0.85rem;
  justify-content: center;
  text-align: center;
}

.solve-toolbar .btn[aria-pressed="true"] {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Height is measured at runtime: the bar wraps to 2 rows on narrow phones,
   so a fixed padding would let it cover the last question. */
body.has-solve-toolbar .main {
  padding-bottom: calc(var(--solve-toolbar-h, 5.5rem) + 1.5rem);
}

.solve-meta {
  display: none;
  margin-top: 0.45rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

body.hints-on .question .solve-meta,
body.en-on .question .solve-meta,
body.why-on .question .solve-meta,
body.solve-mode .question .solve-meta,
.question.show-why .solve-meta {
  display: block;
}

/* ---------- worked solution ("Why") ---------- */

.why-line {
  display: none;
  margin-top: 0.4rem;
  padding: 0.55rem 0.7rem;
  background: #eef6ff;
  border-left: 3px solid #6b9bd1;
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}

.why-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1e3a5f;
  background: #d8e6f5;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  margin-right: 0.35rem;
  vertical-align: 0.05em;
}

body.why-on .why-line,
body.solve-mode .why-line,
.question.show-why .why-line {
  display: block;
}

.why-line[hidden] {
  display: none !important;
}

/* An explained mistake should read as guidance, not just failure. */
.question.incorrect .why-line {
  background: #fff6ed;
  border-left-color: #d08b3f;
}

.question.incorrect .why-label {
  color: #8a4f12;
  background: #f6e2cc;
}

body.hints-on .hint-line,
body.solve-mode .hint-line {
  display: block;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

body.en-on .en-line,
body.solve-mode .en-line {
  display: block;
  color: var(--german);
  font-style: italic;
}

.hint-line[hidden],
.en-line[hidden] {
  display: none !important;
}

body:not(.hints-on):not(.solve-mode) .hint-line {
  display: none;
}

body:not(.en-on):not(.solve-mode) .en-line {
  display: none;
}

.question.solved-open .answer-reveal.visible {
  display: inline-block;
  margin-top: 0.35rem;
}

@media (min-width: 769px) {
  .solve-toolbar {
    position: sticky;
    border-radius: 12px 12px 0 0;
    margin: 0 auto;
    max-width: 920px;
  }
}

/* ---------- tap-to-hear ---------- */

.speakable {
  cursor: pointer;
  border-bottom: 1px dotted rgba(30, 58, 95, 0.35);
  transition: background 0.15s;
}

.speakable::after {
  content: "🔊";
  font-size: 0.72em;
  margin-left: 0.25em;
  opacity: 0.35;
  vertical-align: 0.08em;
}

.speakable:hover,
.speakable:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.speakable:hover::after,
.speakable:focus-visible::after {
  opacity: 0.9;
}

.speakable.speaking {
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent);
  border-radius: 4px;
}

.script-card .speakable {
  border-bottom-color: rgba(245, 236, 212, 0.4);
}

.script-card .speakable:hover,
.script-card .speakable.speaking {
  background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 768px) {
  /* Bigger tap target on a phone. */
  .speakable {
    padding: 0.1rem 0.15rem;
    margin: -0.1rem -0.15rem;
    border-radius: 4px;
  }

  .speakable::after {
    opacity: 0.6;
  }
}

/* ---------- Vocab deep cards ---------- */

.vocab-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 0.85rem 0;
  box-shadow: var(--shadow);
}

.vocab-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  color: var(--german);
  font-family: var(--font-german);
}

.vocab-card .v-meaning {
  margin: 0.25rem 0 0.65rem;
  font-size: 1rem;
}

.vocab-card .v-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.55rem 0 0.2rem;
}

.vocab-card .v-usage {
  margin: 0;
  color: var(--text);
}

.vocab-card .v-examples {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.vocab-card .v-examples li {
  margin: 0.35rem 0;
}

.vocab-card .v-examples .de {
  font-family: var(--font-german);
  color: var(--german);
  font-weight: 600;
}

.vocab-card .v-examples .en {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

.vocab-card .v-edge {
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  font-size: 0.92rem;
}

.vocab-card .v-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.vocab-card .v-pill {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #eef1f6;
  color: var(--muted);
}

/* ---------- Hub command center ---------- */

.hub-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
}

.hub-mode-tabs button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.hub-mode-tabs button.is-active {
  background: var(--sidebar);
  color: #fff;
  border-color: var(--sidebar);
}

.today-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.85rem;
}

.today-steps li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.today-steps .step-num {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.today-steps .step-link {
  display: inline-block;
  font-weight: 700;
  color: var(--german);
  text-decoration: none;
  font-size: 1.05rem;
}

.today-steps .step-link:hover {
  text-decoration: underline;
}

.today-steps .step-note {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.hub-panel-intro {
  color: var(--muted);
  margin: 0 0 1rem;
}

.after-class-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.after-class-controls select {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  min-height: 44px;
  background: var(--surface);
}

.exam-week-path .today-steps .step-num {
  color: var(--danger);
}

.sessions-archive-link {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: 0.92rem;
}

/* ---------- Vocab trainer / practice mode ---------- */

.vocab-toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 0;
  margin-bottom: 1rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.vocab-toolbar input[type="search"],
.vocab-toolbar select {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  min-height: 44px;
}

.vocab-toolbar input[type="search"] {
  flex: 1 1 160px;
}

.vocab-toolbar .btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  min-height: 44px;
}

.vocab-toolbar .btn.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
}

body.hide-example-en .vocab-card .v-examples .en {
  display: none;
}

.vocab-card.is-practice .v-body {
  display: none;
}

.vocab-card.is-practice.is-revealed .v-body {
  display: block;
}

.vocab-card .v-reveal-btn {
  margin: 0.35rem 0 0.5rem;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  min-height: 40px;
}

.vocab-card.is-practice.is-revealed .v-reveal-btn {
  display: none;
}

.learn-test-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.learn-test-tabs button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.learn-test-tabs button.is-active {
  background: var(--sidebar);
  color: #fff;
}

/* ---------- Study path strip ---------- */

.study-path {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0 0 1.25rem;
  box-shadow: var(--shadow);
}

.study-path strong {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--german);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.study-path ol {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.2rem;
  font-size: 0.9rem;
}

.study-path a {
  color: var(--german);
  font-weight: 600;
}

.study-path li.is-current {
  font-weight: 700;
}

.grammar-practice-cta {
  display: inline-block;
  margin-top: 0.85rem;
  padding: 0.55rem 0.9rem;
  background: var(--sidebar);
  color: #fff !important;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}
