/* ============================================================
   style.css — Telc B1 Prep App
   Mobile-first, CSS custom properties, dark/light theme
   ============================================================ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #2563eb;
  --primary-dark: #1d4ed8;
  --success:      #16a34a;
  --warning:      #d97706;
  --danger:       #dc2626;
  --info:         #0891b2;

  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --surface2:     #f8fafc;
  --border:       #e2e8f0;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --text-light:   #94a3b8;

  --radius-sm:    0.375rem;
  --radius:       0.75rem;
  --radius-lg:    1.25rem;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow:       0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:    0 8px 24px rgba(0,0,0,.14);

  --nav-height:   64px;
  --header-height:56px;
  --transition:   0.2s ease;

  /* ring colors per module */
  --ring-vocab:     #8b5cf6;
  --ring-sb:        #2563eb;
  --ring-writing:   #16a34a;
  --ring-speaking:  #f59e0b;
}

[data-theme="dark"] {
  --bg:         #0f172a;
  --surface:    #1e293b;
  --surface2:   #162032;
  --border:     #334155;
  --text:       #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #475569;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout skeleton ── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-left { display: flex; align-items: center; gap: .6rem; }
.app-logo { font-size: 1.6rem; }
.app-title { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.app-subtitle { font-size: .7rem; color: var(--text-muted); }
.header-titles { display: flex; flex-direction: column; }

.header-right { display: flex; align-items: center; gap: .75rem; }

.day-badge {
  background: var(--primary);
  color: #fff;
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .3rem .5rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
  transition: background var(--transition);
}
.icon-btn:hover { background: var(--bg); }

/* Bottom nav */
.app-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .7rem;
  padding: .4rem .2rem;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.nav-btn .nav-icon { font-size: 1.3rem; }
.nav-btn.active { color: var(--primary); }
.nav-btn:hover { color: var(--primary); }

/* Main */
.app-main {
  padding-top: calc(var(--header-height) + .5rem);
  padding-bottom: calc(var(--nav-height) + 1rem);
  min-height: 100vh;
}

/* Screens */
.screen { display: none; padding: 1rem; max-width: 680px; margin: 0 auto; }
.screen.active { display: block; }
.hidden { display: none !important; }

/* ── Shared components ── */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .75rem;
}

.screen-header { margin-bottom: 1.25rem; }
.screen-title { font-size: 1.4rem; font-weight: 700; }
.screen-desc { color: var(--text-muted); font-size: .9rem; margin-top: .2rem; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: .65rem 1.25rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform .1s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(.97); }

.text-input {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition);
  margin-bottom: .75rem;
}
.text-input:focus { border-color: var(--primary); }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 1rem);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: .6rem 1.25rem;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 500;
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s;
}
.toast.show { opacity: 1; }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-small { max-width: 380px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: var(--text-muted);
  width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 1rem 1.25rem; }
.modal-body p { color: var(--text-muted); margin-bottom: .75rem; }

.exam-date-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}
.exam-date-row label { font-size: .85rem; color: var(--text-muted); white-space: nowrap; }
.exam-date-row .text-input { margin-bottom: 0; }

/* ── DASHBOARD ── */
.dashboard-header {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  color: #fff;
  margin-bottom: 1.25rem;
}
.greeting { font-size: 1.4rem; font-weight: 700; }
.exam-countdown { font-size: .95rem; opacity: .9; margin-top: .2rem; }

.progress-rings {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin-bottom: 1.5rem;
}

.ring-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: .75rem .5rem;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: box-shadow var(--transition);
}
.ring-card:hover { box-shadow: var(--shadow); }

.ring-wrap { position: relative; width: 56px; height: 56px; }
.ring-svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 3; }
.ring-fill {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray .6s ease;
}
#ring-vocab    { stroke: var(--ring-vocab); }
#ring-sb       { stroke: var(--ring-sb); }
#ring-writing  { stroke: var(--ring-writing); }
#ring-speaking { stroke: var(--ring-speaking); }

.ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text);
}
.ring-label { font-size: .72rem; color: var(--text-muted); font-weight: 500; }

/* Today's tasks */
.task-list { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.5rem; }

.task-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.task-item:hover { box-shadow: var(--shadow-sm); }
.task-item.done { opacity: .55; }
.task-item.done .task-check { background: var(--success); border-color: var(--success); }
.task-check {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .75rem;
  transition: background var(--transition);
}
.task-icon { font-size: 1.2rem; }
.task-text { flex: 1; font-size: .9rem; font-weight: 500; }
.task-action { font-size: .8rem; color: var(--primary); font-weight: 600; }

/* Calendar grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .4rem;
  margin-bottom: 1rem;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.cal-day.today {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
}
[data-theme="dark"] .cal-day.today { background: #1e3a5f; }
.cal-day.done { background: var(--success); border-color: var(--success); color: #fff; }
.cal-day.past { opacity: .5; }

/* ── VOCABULARY ── */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}

.topic-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.topic-card:hover { box-shadow: var(--shadow); border-color: var(--primary); }

.topic-icon { font-size: 1.6rem; margin-bottom: .4rem; }
.topic-name { font-weight: 600; font-size: .9rem; margin-bottom: .5rem; }
.topic-progress {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: .3rem;
}
.topic-progress-fill {
  height: 100%;
  background: var(--ring-vocab);
  border-radius: 999px;
  transition: width .4s;
}
.topic-progress-text { font-size: .72rem; color: var(--text-muted); }

/* Deck header */
.deck-header {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: 1rem;
}
.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  padding: .3rem 0;
  width: fit-content;
}

.deck-info { display: flex; flex-direction: column; gap: .3rem; }
.deck-topic-name { font-size: 1.1rem; font-weight: 700; }
.deck-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.deck-progress-fill {
  height: 100%;
  background: var(--ring-vocab);
  border-radius: 999px;
  transition: width .4s;
}
.deck-progress-text { font-size: .8rem; color: var(--text-muted); }

.deck-filter {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.filter-btn {
  padding: .3rem .7rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Flashcard */
.card-area {
  perspective: 1000px;
  margin-bottom: 1rem;
}
.flashcard {
  height: 200px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .45s cubic-bezier(.4,0,.2,1);
}
.flashcard.flipped .card-inner { transform: rotateY(180deg); }

.card-front, .card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.card-back { transform: rotateY(180deg); }

.card-difficulty {
  position: absolute;
  top: .6rem; right: .75rem;
  font-size: .7rem;
  padding: .15rem .45rem;
  border-radius: 999px;
  font-weight: 600;
}
.diff-1 { background: #dcfce7; color: #15803d; }
.diff-2 { background: #fef9c3; color: #a16207; }
.diff-3 { background: #fee2e2; color: #b91c1c; }
[data-theme="dark"] .diff-1 { background: #14532d; color: #86efac; }
[data-theme="dark"] .diff-2 { background: #422006; color: #fcd34d; }
[data-theme="dark"] .diff-3 { background: #450a0a; color: #fca5a5; }

.card-german {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .5rem;
}
.card-hint { font-size: .78rem; color: var(--text-light); }

.card-english {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: .6rem;
}
.card-example {
  font-size: .85rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}

.card-empty {
  height: 200px;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  text-align: center;
  padding: 1rem;
}
.empty-icon { font-size: 2rem; }

/* Card action buttons */
.card-actions {
  display: flex;
  gap: .6rem;
  justify-content: center;
}
.btn-review, .btn-know, .btn-flip {
  flex: 1;
  padding: .65rem .5rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  max-width: 140px;
}
.btn-review { background: #fff7ed; color: var(--warning); border: 1.5px solid #fed7aa; }
.btn-review:hover { background: #ffedd5; }
.btn-flip   { background: var(--bg); color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-flip:hover { background: var(--border); }
.btn-know   { background: #f0fdf4; color: var(--success); border: 1.5px solid #bbf7d0; }
.btn-know:hover { background: #dcfce7; }

.card-counter { text-align: center; margin-top: .6rem; font-size: .82rem; color: var(--text-muted); }

/* ── SPRACHBAUSTEINE ── */
.sb-controls {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.category-tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.cat-tab {
  padding: .3rem .7rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.cat-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.sb-session-score { font-size: .85rem; color: var(--text-muted); white-space: nowrap; align-self: center; }

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

.exercise-category {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

.exercise-sentence {
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 1.1rem;
  color: var(--text);
}
.exercise-sentence .gap {
  display: inline-block;
  min-width: 80px;
  border-bottom: 2.5px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  padding: 0 .25rem;
  text-align: center;
  vertical-align: middle;
}

.exercise-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-bottom: .75rem;
}
.option-btn {
  padding: .6rem .75rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
}
.option-btn:hover:not(:disabled) { border-color: var(--primary); background: #eff6ff; }
.option-btn.correct  { background: #dcfce7; border-color: var(--success); color: var(--success); }
.option-btn.incorrect { background: #fee2e2; border-color: var(--danger); color: var(--danger); }
.option-btn:disabled { cursor: not-allowed; }

.exercise-feedback {
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.feedback-result {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .4rem;
}
.feedback-result.correct { color: var(--success); }
.feedback-result.incorrect { color: var(--danger); }

.feedback-explanation {
  font-size: .88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: .4rem;
}
.feedback-hint {
  font-size: .82rem;
  color: var(--info);
  font-style: italic;
  margin-bottom: .85rem;
}

/* Stats */
.sb-stats { margin-top: 1.5rem; }
.sb-stats h3 { font-size: .9rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .75rem; }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: .75rem;
}
.stat-label { font-size: .75rem; color: var(--text-muted); margin-bottom: .25rem; }
.stat-bar { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: .2rem; }
.stat-bar-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s; }
.stat-numbers { font-size: .78rem; color: var(--text-muted); }

/* ── WRITING ── */
.scenario-selector {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.scenario-selector label { font-size: .9rem; font-weight: 600; white-space: nowrap; }
.scenario-selector select {
  flex: 1;
  padding: .5rem .75rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  cursor: pointer;
  outline: none;
  min-width: 180px;
}
.scenario-selector select:focus { border-color: var(--primary); }

.writing-workspace {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.email-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden;
}
.email-header {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1rem;
}
.email-from { font-size: .78rem; color: var(--text-muted); margin-bottom: .2rem; }
.email-subject { font-size: .95rem; font-weight: 700; }
.email-body {
  padding: .9rem 1rem;
  font-size: .88rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
}

.reply-panel {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.leitpunkte-checklist h3 {
  font-size: .88rem;
  font-weight: 700;
  margin-bottom: .5rem;
}
.lp-count { color: var(--text-muted); font-weight: 400; }

.leitpunkte-checklist ul { list-style: none; display: flex; flex-direction: column; gap: .3rem; }
.lp-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .85rem;
  padding: .3rem .5rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.lp-item.detected { background: #f0fdf4; color: var(--success); font-weight: 500; }
.lp-checkbox {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem;
  transition: all var(--transition);
}
.lp-item.detected .lp-checkbox { background: var(--success); border-color: var(--success); color: #fff; }

.reply-toolbar { display: flex; gap: .5rem; flex-wrap: wrap; }
.tool-btn {
  padding: .4rem .8rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.tool-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

#replyTextarea {
  width: 100%;
  height: 180px;
  padding: .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
}
#replyTextarea:focus { border-color: var(--primary); }

.word-counter {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.wc-label { font-size: .82rem; color: var(--text-muted); }
.wc-number {
  font-size: .9rem;
  font-weight: 700;
  min-width: 2rem;
  text-align: center;
}
.wc-number.low    { color: var(--danger); }
.wc-number.good   { color: var(--success); }
.wc-number.over   { color: var(--warning); }
.wc-target { font-size: .78rem; color: var(--text-light); }
.wc-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  min-width: 60px;
}
.wc-fill { height: 100%; border-radius: 999px; transition: width .3s, background .3s; }

/* Phrase bank modal */
.phrase-category { margin-bottom: 1rem; }
.phrase-category h4 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .5rem;
}
.phrase-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.phrase-chip {
  padding: .35rem .75rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: .82rem;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
}
.phrase-chip:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── SPEAKING ── */
.speaking-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}
.sp-tab {
  flex: 1;
  padding: .55rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.sp-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.speaking-task-info {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: .8rem 1rem;
  margin-bottom: 1rem;
}
.task-label { font-size: .95rem; font-weight: 700; margin-bottom: .25rem; }
.task-description { font-size: .83rem; color: var(--text-muted); }

.speaking-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .5rem;
}

.drill-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  cursor: pointer;
  user-select: none;
}
.drill-toggle input { display: none; }
.toggle-slider {
  width: 38px; height: 22px;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition);
}
.toggle-slider::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.drill-toggle input:checked + .toggle-slider { background: var(--primary); }
.drill-toggle input:checked + .toggle-slider::after { transform: translateX(16px); }

.sp-score { font-size: .85rem; color: var(--text-muted); }

.phrase-list { display: flex; flex-direction: column; gap: .6rem; }

.phrase-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: .9rem 1rem;
  cursor: pointer;
  transition: box-shadow var(--transition);
  position: relative;
}
.phrase-card:hover { box-shadow: var(--shadow-sm); }
.phrase-card.revealed { border-color: var(--primary); }

.phrase-context {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-light);
  margin-bottom: .35rem;
}
.phrase-en {
  font-size: .88rem;
  color: var(--text-muted);
  margin-bottom: .35rem;
}
.phrase-de {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.phrase-de.hidden-text {
  filter: blur(5px);
  user-select: none;
  pointer-events: none;
}

.phrase-star {
  position: absolute;
  top: .6rem; right: .75rem;
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  opacity: .4;
  transition: opacity var(--transition);
  padding: .2rem;
  -webkit-tap-highlight-color: transparent;
}
.phrase-star:hover, .phrase-star.starred { opacity: 1; }

.phrase-reveal-hint {
  font-size: .72rem;
  color: var(--text-light);
  margin-top: .3rem;
}

/* ── Practice Cards (Speaking topics & planning) ── */
.practice-card {
  background: var(--surface);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.2rem;
}
.practice-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}
.practice-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}
.practice-card-prompt {
  font-size: .9rem;
  color: var(--text);
  margin: 0 0 .8rem;
  line-height: 1.5;
}
.btn-ghost-sm {
  font-size: .78rem;
  padding: .3rem .7rem;
  border-radius: 6px;
  border: 1.5px solid var(--primary);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  white-space: nowrap;
}
.btn-ghost-sm:hover { background: var(--primary); color: #fff; }

.btn-reveal {
  display: block;
  width: 100%;
  padding: .55rem;
  margin-top: .6rem;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-reveal:hover { opacity: .88; }

.args-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .7rem;
  margin-bottom: .6rem;
}
@media (min-width: 540px) {
  .args-grid { grid-template-columns: 1fr 1fr; }
}
.args-col h4 {
  font-size: .8rem;
  font-weight: 700;
  margin: 0 0 .4rem;
}
.args-col ul {
  list-style: disc;
  padding-left: 1.1rem;
  margin: 0;
}
.args-col li {
  font-size: .82rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: .2rem;
}
.args-pro h4 { color: var(--success); }
.args-contra h4 { color: var(--danger); }
.args-opinion {
  grid-column: 1 / -1;
  font-size: .85rem;
  background: var(--bg);
  border-left: 3px solid var(--primary);
  padding: .5rem .7rem;
  border-radius: 0 6px 6px 0;
  color: var(--text);
}
.args-vocab {
  grid-column: 1 / -1;
  font-size: .8rem;
  color: var(--text-light);
  margin-top: .3rem;
}

.planning-points {
  list-style: none;
  padding: 0;
  margin: 0 0 .5rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.planning-points li {
  font-size: .88rem;
  background: var(--bg);
  border-radius: 6px;
  padding: .45rem .7rem;
  color: var(--text);
}

/* ── Model Answer in phrase modal ── */
.model-answer-wrap {
  display: flex;
  flex-direction: column;
  gap: .8rem;
}
.model-answer-label {
  font-size: .85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.model-answer-text {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: .88rem;
  line-height: 1.65;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--text);
  margin: 0;
}

/* ── Tablet / Desktop ── */
@media (min-width: 480px) {
  .app-nav .nav-label { display: inline; }
}

@media (min-width: 640px) {
  .topic-grid { grid-template-columns: repeat(3, 1fr); }
  .progress-rings { gap: 1rem; }
}

@media (min-width: 768px) {
  .writing-workspace {
    flex-direction: row;
    align-items: flex-start;
  }
  .email-panel {
    flex: 0 0 46%;
    max-height: 560px;
    overflow-y: auto;
  }
  .email-body { max-height: none; }
  .reply-panel { flex: 1; }
}

@media (min-width: 900px) {
  .app-nav {
    top: var(--header-height);
    bottom: auto;
    left: 0;
    right: auto;
    width: 200px;
    height: calc(100vh - var(--header-height));
    border-top: none;
    border-right: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem .5rem;
    justify-content: flex-start;
    gap: .25rem;
  }
  .nav-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: .6rem;
    padding: .65rem .85rem;
    border-radius: var(--radius);
    font-size: .9rem;
  }
  .nav-btn .nav-icon { font-size: 1.1rem; }
  .nav-btn.active { background: #eff6ff; }
  [data-theme="dark"] .nav-btn.active { background: #1e3a5f; }

  .app-main {
    padding-left: 200px;
    padding-bottom: 1rem;
  }
}
