/* Dashboard-only styles. Loaded on /fortschritt/ alone. */

.dash-section { margin-bottom: 40px; }
.dash-head { margin-bottom: 16px; }
.dash-head h2 { margin: 0 0 4px; font-size: 1.25rem; font-weight: 800; }
.dash-head p { margin: 0; color: var(--muted); font-size: .92rem; }

.sub-h { font-size: 1rem; font-weight: 700; margin: 22px 0 12px; }

.dash-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  background: var(--surface-2);
}
.dash-empty p { margin: 0 0 12px; color: var(--muted); font-size: .93rem; }

.dash-ok {
  border: 1px solid var(--ok-line);
  background: var(--ok-bg);
  border-radius: var(--radius);
  padding: 18px;
}
.dash-ok b { color: var(--ok); }
.dash-ok p { margin: 6px 0 0; color: var(--ink-soft); font-size: .92rem; }

/* --- stat cards --- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
}
.stat-grid.compact { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-k { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat-v {
  font-size: 1.6rem; font-weight: 800; line-height: 1.25;
  font-family: var(--font-de); color: var(--ink);
}
.stat-sub { font-size: .78rem; color: var(--muted); }
.stat-ring { flex: none; width: 58px; }

.delta { font-size: .76rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; }
.delta.up { background: var(--ok-bg); color: var(--ok); }
.delta.down { background: var(--bad-bg); color: var(--bad); }
.delta.flat { background: var(--surface-2); color: var(--muted); }

/* --- rings, charts --- */

.ring { width: 100%; height: auto; }
.ring circle { fill: none; stroke-width: 8; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--brand); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring.ok .ring-fg { stroke: var(--ok); }
.ring.mid .ring-fg { stroke: var(--accent); }
.ring.bad .ring-fg { stroke: var(--bad); }
.ring-text {
  font-family: var(--font-de); font-size: 19px; font-weight: 800;
  fill: var(--ink); direction: ltr;
}

.chart-row { margin-bottom: 16px; }
.chart-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.chart-box h3 { margin: 0 0 12px; font-size: 1rem; font-weight: 700; }
.chart { width: 100%; height: 200px; display: block; direction: ltr; }
.chart-note { margin: 8px 0 0; font-size: .8rem; color: var(--muted); }

.ch-grid { stroke: var(--line-soft); stroke-width: 1; }
.ch-axis { font-size: 10px; fill: var(--muted); font-family: var(--font-de); }
.ch-pass { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: .8; }
.ch-area { fill: color-mix(in srgb, var(--brand) 14%, transparent); stroke: none; }
.ch-line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ch-fit { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.ch-dot { fill: var(--brand); stroke: var(--surface); stroke-width: 1.5; }
.ch-dot.ok { fill: var(--ok); }
.ch-dot.bad { fill: var(--bad); }
.ch-bar { fill: var(--brand); opacity: .85; }
.ch-bar.empty { fill: var(--line); }

.spark { width: 80px; height: 22px; display: block; direction: ltr; }
.spark polyline { fill: none; stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; }

/* --- period selector --- */

.period-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.period-bar button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.period-bar button:hover { background: var(--surface-2); }
.period-bar button.active { background: var(--brand); color: #fff; border-color: transparent; }
html[data-theme="dark"] .period-bar button.active { color: #06181b; }

/* --- weaknesses --- */

.weak-card {
  border: 1px solid var(--bad-line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
  margin-bottom: 14px;
}
.weak-head { display: flex; align-items: center; gap: 14px; }
.weak-head > div:first-child { flex: 1; min-width: 0; }
.weak-head b { font-size: 1.02rem; display: block; }
.weak-meta { font-size: .82rem; color: var(--muted); }
.weak-score { flex: none; width: 62px; }
.weak-why { margin: 10px 0; font-size: .92rem; color: var(--ink-soft); }
.weak-recs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.weak-recs-label { font-size: .84rem; font-weight: 700; color: var(--muted); }
.rec-chip {
  border: 1px solid var(--brand);
  color: var(--brand-ink);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: .85rem;
  font-weight: 600;
}
.rec-chip:hover { text-decoration: none; filter: brightness(1.05); }

.pattern-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--surface-2);
  margin-bottom: 12px;
}
.pattern-box b { font-size: .95rem; }
.pattern-box p { margin: 8px 0 0; }

.plain-list { margin: 8px 0 0; padding-inline-start: 20px; }
.plain-list li { font-size: .9rem; margin-bottom: 5px; color: var(--ink-soft); }

/* --- subjects --- */

.subject-summary { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.sum-box {
  flex: 1 1 180px;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--line);
}
.sum-box.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.sum-box.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.sum-box b { display: block; font-size: 1.7rem; font-weight: 800; font-family: var(--font-de); }
.sum-box.ok b { color: var(--ok); }
.sum-box.bad b { color: var(--bad); }
.sum-box span { font-size: .85rem; color: var(--ink-soft); }

.subject-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.subject-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line-soft);
}
.subject-row:first-child { border-top: 0; }
.subj-name b { display: block; font-size: .96rem; }
.subj-bar {
  position: relative;
  height: 24px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.subj-fill { height: 100%; border-radius: 999px; background: var(--brand); }
.subject-row.strong .subj-fill { background: var(--ok); }
.subject-row.weak .subj-fill { background: var(--bad); }
.subj-pct {
  position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%);
  font-size: .8rem; font-weight: 800; font-family: var(--font-de); color: var(--ink);
}
.subj-trend { display: flex; align-items: center; gap: 8px; }

/* --- exam list --- */

.exam-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.exam-item { border-top: 1px solid var(--line-soft); }
.exam-item:first-child { border-top: 0; }
.exam-item summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  padding: 13px 16px; cursor: pointer; font-size: .9rem;
}
.exam-item summary::-webkit-details-marker { display: none; }
.exam-item summary:hover { background: var(--surface-2); }
.exam-title { font-family: var(--font-de); direction: ltr; font-weight: 700; flex: 1; min-width: 130px; }
.exam-date { font-size: .82rem; color: var(--muted); }
.exam-score { font-family: var(--font-de); font-weight: 800; }
.exam-score.ok { color: var(--ok); }
.exam-score.bad { color: var(--bad); }
.exam-item.failed summary { background: color-mix(in srgb, var(--bad) 5%, transparent); }

.exam-detail { padding: 4px 16px 18px; border-top: 1px dashed var(--line); }
.exam-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px; margin: 14px 0;
}
.exam-facts > div {
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 9px 12px;
}
.exam-facts span { display: block; font-size: .76rem; color: var(--muted); }
.exam-facts b { font-size: .92rem; font-family: var(--font-de); }
.exam-detail h4 { margin: 14px 0 8px; font-size: .88rem; color: var(--muted); }

.qdots { display: flex; flex-wrap: wrap; gap: 5px; }
.qdot {
  width: 20px; height: 20px; border-radius: 5px;
  background: var(--ok); display: inline-block;
}
.qdot.bad { background: var(--bad); }
.cmp {
  margin: 14px 0 0; font-size: .88rem;
  background: var(--brand-soft); color: var(--brand-ink);
  padding: 9px 12px; border-radius: var(--radius-sm);
}

/* --- goals --- */

.goal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
  margin-bottom: 12px;
}
.goal-card.behind { border-color: var(--bad-line); }
.goal-card.ahead, .goal-card.done { border-color: var(--ok-line); }
.goal-head { display: flex; align-items: center; gap: 11px; margin-bottom: 11px; }
.goal-head > div { flex: 1; min-width: 0; }
.goal-head b { display: block; font-size: .98rem; }
.goal-head .count-note { display: block; }
.goal-icon { font-size: 1.3rem; }
.icon-btn.tiny { width: 28px; height: 28px; font-size: .8rem; border-radius: 8px; }

.goal-bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.goal-fill { height: 100%; background: var(--brand); border-radius: 999px; }
.goal-card.behind .goal-fill { background: var(--bad); }
.goal-card.ahead .goal-fill, .goal-card.done .goal-fill { background: var(--ok); }
.goal-facts { display: flex; flex-wrap: wrap; gap: 14px; font-size: .84rem; color: var(--muted); }
.goal-facts b { color: var(--ink); font-family: var(--font-de); }

.goal-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface-2);
  margin-top: 16px;
}
.goal-fields {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px; margin-bottom: 14px;
}
.goal-fields label { display: flex; flex-direction: column; gap: 5px; font-size: .84rem; font-weight: 600; color: var(--ink-soft); }
.goal-fields input, .goal-fields select {
  padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: inherit; font-size: .9rem;
}
.goal-fields input:focus, .goal-fields select:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
  border-color: var(--brand);
}

/* --- achievements --- */

.ach-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px;
}
.ach {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  background: var(--surface);
  text-align: center;
  opacity: .68;
}
.ach.earned {
  opacity: 1;
  border-color: var(--accent);
  background: linear-gradient(160deg, var(--accent-soft), var(--surface));
}
.ach-icon { font-size: 1.7rem; display: block; margin-bottom: 6px; }
.ach b { display: block; font-size: .92rem; margin-bottom: 3px; }
.ach span { font-size: .78rem; color: var(--muted); }
.ach-bar { height: 5px; background: var(--surface-2); border-radius: 999px; margin: 9px 0 5px; overflow: hidden; }
.ach-bar div { height: 100%; background: var(--brand); border-radius: 999px; }

/* --- prediction --- */

.pred-grid {
  display: grid; grid-template-columns: minmax(210px, .8fr) minmax(0, 1.6fr);
  gap: 16px; align-items: stretch; margin-bottom: 16px;
}
.pred-main {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; justify-content: center;
}
.pred-score {
  font-size: 2.6rem; font-weight: 800; font-family: var(--font-de);
  color: var(--brand-ink); line-height: 1.15; margin: 4px 0;
}
.pred-conf { margin-top: 10px; font-size: .85rem; }
.pred-chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; overflow: hidden; }
.pred-chart h3 { margin: 0 0 10px; font-size: 1rem; }
.pred-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px;
}
.pred-facts > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.pred-facts span { display: block; font-size: .78rem; color: var(--muted); }
.pred-facts b { font-size: .95rem; }

@media (max-width: 760px) {
  .pred-grid { grid-template-columns: 1fr; }
  .subject-row { grid-template-columns: 1fr; gap: 8px; }
  .subj-trend { justify-content: flex-start; }
  .stat-v { font-size: 1.4rem; }
  .exam-item summary { font-size: .85rem; gap: 7px; }
  .exam-title { min-width: 100%; }
  .chart { height: 170px; }
}

/* ---------------------------------------------------------- momentum hero */

.dash-section { opacity: 1; }
.dash-section.hero-section { margin-bottom: 30px; }

.momentum {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(240px, .85fr);
  gap: 26px;
  align-items: center;
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--line);
  background:
    radial-gradient(720px 260px at 88% -30%, color-mix(in srgb, var(--brand) 26%, transparent), transparent 62%),
    radial-gradient(520px 220px at 4% 120%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 60%),
    var(--surface);
  box-shadow: var(--shadow);
}
.momentum.start { grid-template-columns: 1fr; text-align: center; }
.momentum.start .mom-left { align-items: center; }

.mom-left { display: flex; flex-direction: column; min-width: 0; }
.mom-kicker {
  display: inline-flex; align-items: center; gap: 7px;
  align-self: flex-start;
  font-size: .8rem; font-weight: 800;
  color: var(--brand-ink); background: var(--brand-soft);
  padding: 5px 14px; border-radius: 999px; margin-bottom: 12px;
}
.momentum h2 {
  margin: 0 0 14px;
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -.01em;
}
.momentum h2 [data-count] { font-family: var(--font-de); color: var(--brand-ink); }
.momentum.start p { margin: 0 0 18px; color: var(--ink-soft); max-width: 52ch; }

.mom-bar {
  height: 12px; border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden; margin-bottom: 10px;
}
.mom-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 1s cubic-bezier(.2, .8, .3, 1);
}
.mom-next { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.mom-next b { font-family: var(--font-de); color: var(--brand-ink); }

.mom-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.mom-streak { display: flex; align-items: center; gap: 10px; }
.mom-streak b {
  font-family: var(--font-de); font-size: 2rem; font-weight: 800;
  line-height: 1; color: var(--ink);
}
.streak-flame { font-size: 1.6rem; filter: grayscale(1); opacity: .45; }
.streak-flame.hot { filter: none; opacity: 1; animation: flame 2.4s ease-in-out infinite; }
@keyframes flame {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  50% { transform: scale(1.12) rotate(2deg); }
}

.day-strip { display: flex; gap: 4px; flex-wrap: wrap; }
.day-dot {
  width: 15px; height: 15px; border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}
.day-dot.l1 { background: color-mix(in srgb, var(--brand) 34%, transparent); border-color: transparent; }
.day-dot.l2 { background: color-mix(in srgb, var(--brand) 66%, transparent); border-color: transparent; }
.day-dot.l3 { background: var(--brand); border-color: transparent; }

.mom-milestone {
  display: flex; gap: 11px; align-items: center;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
}
.mom-milestone > span:first-child { font-size: 1.4rem; }
.mom-milestone > div { flex: 1; min-width: 0; }
.mom-milestone b { display: block; font-size: .88rem; margin-bottom: 5px; }
.mini-bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.mini-bar div {
  height: 100%; width: 0; border-radius: 999px; background: var(--accent);
  transition: width .9s cubic-bezier(.2, .8, .3, 1);
}

/* --------------------------------------------------- reveal + interactions */

@media (prefers-reduced-motion: no-preference) {
  /* Hidden state is opt-in via .anim, added by JS, so a dashboard whose
     script fails still renders fully visible. */
  .dash-section.anim { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
  .dash-section.anim.in { opacity: 1; transform: none; }
  .stat-card { transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
  .stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 32%, var(--line)); }
  .subj-fill, .goal-fill, .ach-bar div { transition: width .8s cubic-bezier(.2, .8, .3, 1); }
  .rec-chip { transition: transform .12s ease, filter .12s ease; }
  .rec-chip:active { transform: scale(.96); }
  .ach.earned { transition: transform .16s ease; }
  .ach.earned:hover { transform: translateY(-3px) rotate(-.6deg); }
  .exam-item summary { transition: background .14s ease; }
  .period-bar button { transition: background .14s ease, color .14s ease; }
}

@media (max-width: 860px) {
  .momentum { grid-template-columns: 1fr; gap: 20px; padding: 22px; }
}
@media (max-width: 700px) {
  .momentum { padding: 18px; }
  .mom-streak b { font-size: 1.7rem; }
  .day-dot { width: 13px; height: 13px; }
}

/* ============================================ adaptive learning (Pro tier) */

/* --- next best session --- */

.nbs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  border-radius: var(--radius-lg);
  padding: 26px;
  border: 1px solid var(--accent);
  background:
    radial-gradient(600px 220px at 90% -30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 62%),
    var(--surface);
  box-shadow: var(--shadow);
}
.nbs.empty { border-color: var(--line); background: var(--surface); }
.nbs-main { min-width: 0; }
.nbs-kicker {
  display: inline-block; font-size: .76rem; font-weight: 800;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 4px 13px; border-radius: 999px; margin-bottom: 10px;
}
.nbs h3 { margin: 0 0 8px; font-size: clamp(1.2rem, 2.6vw, 1.6rem); font-weight: 800; }
.nbs-de { font-family: var(--font-de); direction: ltr; font-size: .8em; color: var(--muted); font-weight: 600; }
.nbs p { margin: 0 0 12px; color: var(--ink-soft); font-size: .96rem; max-width: 58ch; }
.nbs-facts { display: flex; flex-wrap: wrap; gap: 14px; font-size: .85rem; color: var(--muted); }
.nbs-cta { display: flex; flex-direction: column; gap: 7px; align-items: stretch; text-align: center; }
.nbs-cta .btn { white-space: nowrap; }
@media (max-width: 760px) { .nbs { grid-template-columns: 1fr; padding: 20px; } }

/* --- study plan --- */

.plan-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.plan-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.plan-day {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; background: var(--surface);
  display: flex; flex-direction: column; gap: 5px;
}
.plan-day.today { border-color: var(--brand); border-width: 2px; background: var(--brand-soft); }
.plan-day.rest { background: var(--surface-2); opacity: .75; }
.plan-dow { font-size: .78rem; font-weight: 800; color: var(--muted); }
.plan-day.today .plan-dow { color: var(--brand-ink); }
.plan-task { font-size: .95rem; }
.plan-detail { font-size: .8rem; color: var(--muted); flex: 1; }
.plan-rest { font-size: .85rem; color: var(--muted); }
.plan-go { font-size: .82rem; font-weight: 700; color: var(--brand-ink); }

.plan-prefs { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--surface-2); }
.plan-prefs h4 { margin: 0 0 12px; font-size: .95rem; }
.plan-dows { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 14px; }
.dow-chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px;
  font-size: .84rem; cursor: pointer; background: var(--surface);
}
.dow-chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); font-weight: 700; }
.dow-chip input { display: none; }

/* --- mastery --- */

.mastery-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.mg-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); text-align: center; }
.mg-icon { font-size: 1.5rem; display: block; margin-bottom: 5px; }
.mg-card b { display: block; font-size: .9rem; margin-bottom: 6px; }
.mg-pct { font-family: var(--font-de); font-size: 1.7rem; font-weight: 800; color: var(--brand-ink); line-height: 1.1; }
.mg-card .mini-bar { margin: 8px 0 6px; }

.mastery-gap { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.mastery-gap b { color: var(--accent-ink); }

.mastery-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.mastery-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1.1fr) minmax(0, 1.2fr) auto auto;
  gap: 12px; align-items: center;
  padding: 12px 15px; border-top: 1px solid var(--line-soft);
}
.mastery-row:first-child { border-top: 0; }
.mr-dot { font-size: .8rem; }
.mr-name b { display: block; font-size: .92rem; }
.mr-n { white-space: nowrap; }
@media (max-width: 860px) {
  .mastery-row { grid-template-columns: auto minmax(0, 1fr); }
  .mastery-row .subj-bar { grid-column: 1 / -1; }
}

/* --- practice runner --- */

.pr-shell { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 22px; box-shadow: var(--shadow-sm); }
.pr-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.pr-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pr-meta b { font-size: 1rem; }
.pr-timer { font-family: var(--font-de); font-weight: 800; font-size: 1.1rem; color: var(--brand-ink); background: var(--brand-soft); padding: 4px 13px; border-radius: 999px; }
.pr-timer.low { background: var(--bad-bg); color: var(--bad); }
.pr-score { font-family: var(--font-de); font-size: .9rem; color: var(--muted); font-weight: 700; }
.pr-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-bottom: 18px; }
.pr-bar div { height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s ease; }

.pr-flag { display: inline-block; font-size: .74rem; font-weight: 800; padding: 3px 11px; border-radius: 999px; margin-bottom: 10px; }
.pr-flag.retry { background: var(--warn-bg); color: var(--warn); }
.pr-flag.similar { background: var(--brand-soft); color: var(--brand-ink); }
.pr-concepts { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pr-sentence {
  font-family: var(--font-read); direction: ltr; text-align: left;
  font-size: 1.12rem; line-height: 1.85; margin: 0 0 18px;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 16px 18px;
}
.pr-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 9px; }
.pr-opt {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); background: var(--surface);
  /* Buttons do not inherit colour; without this the option text falls back to
     the UA black and disappears on the dark theme. */
  color: var(--ink);
  border-radius: var(--radius-sm); padding: 13px 15px;
  font-family: var(--font-de); direction: ltr; text-align: left;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: border-color .13s ease, background .13s ease, transform .1s ease;
}
.pr-opt:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.pr-opt:active:not(:disabled) { transform: scale(.985); }
.pr-opt:disabled { cursor: default; }
.pr-opt.right { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.pr-opt.wrong { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }
.pr-key {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted);
  display: grid; place-items: center; font-size: .74rem; font-weight: 800;
}

.pr-feedback { margin-top: 18px; border-radius: var(--radius-sm); padding: 16px; }
.pr-feedback.good { background: var(--ok-bg); color: var(--ok); }
.pr-feedback.bad { background: var(--bad-bg); }
.pr-feedback b { display: block; font-size: 1.02rem; margin-bottom: 8px; }
.pr-feedback.bad b { color: var(--bad); }
.pr-feedback p { margin: 6px 0 0; font-size: .92rem; }
.pr-correction { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; font-family: var(--font-de); }
.pr-correction del { color: var(--bad); text-decoration-thickness: 2px; }
.pr-correction ins { color: var(--ok); text-decoration: none; font-weight: 800; }
.pr-why { background: var(--surface); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px; }
.pr-why-t { display: block; font-size: .78rem; font-weight: 800; color: var(--accent-ink); margin-bottom: 5px; }
.pr-why p { margin: 0; color: var(--ink-soft); font-size: .9rem; line-height: 1.7; }
.pr-fb-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.pr-done { text-align: center; padding: 14px 0; }
.pr-done-ring { width: 130px; margin: 0 auto 14px; }
.pr-done h2 { margin: 0 0 6px; font-size: 1.5rem; font-weight: 800; }
.pr-done-line { margin: 0 0 14px; color: var(--muted); }
.pr-best { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px; }
.pr-best p { margin: 6px 0 0; font-size: .92rem; }
.pr-added { font-size: .9rem; color: var(--muted); margin: 0 0 16px; }
.pr-added.ok { color: var(--ok); }

/* --- daily challenge --- */

.daily-hero {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px; text-align: center; box-shadow: var(--shadow-sm);
  background:
    radial-gradient(600px 200px at 50% -20%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 65%),
    var(--surface);
}
.daily-today { margin-bottom: 18px; }
.daily-today span { display: block; font-size: .85rem; color: var(--muted); }
.daily-today b { display: block; font-family: var(--font-de); font-size: 2.4rem; font-weight: 800; color: var(--brand-ink); line-height: 1.2; }
.daily-today.best b { color: var(--ok); }
.daily-today.pending b { font-size: 1.3rem; color: var(--ink); }

/* --- mistake bank --- */

.mb-group { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 14px; overflow: hidden; }
.mb-group-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; background: var(--surface-2); }
.mb-group-head b { flex: 1; min-width: 0; font-size: 1rem; }
.mb-hint { margin: 0; padding: 12px 16px; font-size: .88rem; color: var(--ink-soft); background: var(--accent-soft); }
.mb-item { border-top: 1px solid var(--line-soft); }
.mb-item summary { display: flex; align-items: center; gap: 9px; padding: 12px 16px; cursor: pointer; font-size: .9rem; }
.mb-item summary::-webkit-details-marker { display: none; }
.mb-item summary:hover { background: var(--surface-2); }
.mb-q { flex: 1; min-width: 0; font-family: var(--font-de); direction: ltr; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-detail { padding: 4px 16px 16px; }
.mb-sentence { font-family: var(--font-read); direction: ltr; text-align: left; background: var(--surface-2); border-radius: var(--radius-sm); padding: 13px 15px; margin: 0 0 12px; }
.mb-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--muted); margin-bottom: 12px; }

/* --- simulator --- */

.sim-setup { text-align: center; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 30px 24px; background: var(--surface); }
.sim-setup h2 { margin: 0 0 8px; font-size: 1.4rem; font-weight: 800; }
.sim-setup > p { margin: 0 auto 22px; max-width: 52ch; color: var(--ink-soft); }
.sim-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.sim-level {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  /* A button does not inherit colour: without this the label falls back to the
     UA black, which vanishes on the dark theme surface. */
  background: var(--surface); color: var(--ink); cursor: pointer; text-align: center;
  display: flex; flex-direction: column; gap: 5px;
  transition: border-color .15s ease, transform .15s ease;
}
.sim-level:hover { border-color: var(--brand); transform: translateY(-2px); }
.sim-level b { font-family: var(--font-de); font-size: 2rem; font-weight: 800; color: var(--brand-ink); }

.sim-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.sim-steps { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.sim-step { font-size: .76rem; padding: 4px 11px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-family: var(--font-de); }
.sim-step.now { background: var(--brand); color: #fff; font-weight: 700; }
html[data-theme="dark"] .sim-step.now { color: #06181b; }
.sim-step.done { background: var(--ok-bg); color: var(--ok); }
.sim-timer { font-family: var(--font-de); font-weight: 800; background: var(--brand-soft); color: var(--brand-ink); padding: 5px 14px; border-radius: 999px; }
.sim-timer.low { background: var(--bad-bg); color: var(--bad); }
.sim-frame-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.sim-frame { width: 100%; height: 68vh; border: 0; display: block; }
.sim-actions { justify-content: space-between; }

.sim-result { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; background: var(--surface); }
.sim-score { text-align: center; margin-bottom: 18px; }
.sim-score b { display: block; font-family: var(--font-de); font-size: 3.2rem; font-weight: 800; color: var(--brand-ink); line-height: 1.1; }

/* gate variants for the Pro tier */
.gate-card.pro { border-color: var(--accent); background: linear-gradient(160deg, var(--accent-soft), transparent 60%), var(--surface); }
.gate-preview { margin: 0 auto 14px; max-width: 380px; }
.value-card.pro .value-icon { background: var(--accent-soft); }

.exam-item-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.plan-grid.three { max-width: 1100px; }


/* ═══════════════════════════════════════════ full-screen Prüfung

   A running exam used to sit in a 68vh iframe inside the normal page, which
   left the reading column about 370px tall — far too little to sit a Lesen
   section through. The exam now takes over the viewport, the way it does on
   paper: bar on top, the paper itself filling everything left, controls
   pinned at the bottom. */

body.sim-locked { overflow: hidden; }

.sim-run.sim-full {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column;
  /* --canvas is the inverted near-black surface, not the page ground. */
  background: var(--paper);
  padding: 10px 16px 0;
}
.sim-run.sim-full .sim-bar { margin-bottom: 10px; }
.sim-run.sim-full .sim-frame-wrap {
  flex: 1; min-height: 0;
}
.sim-run.sim-full .sim-frame { height: 100%; }
.sim-run.sim-full .sim-actions {
  flex: none; margin: 0; padding: 12px 0;
  align-items: center;
}
.sim-exit { margin-inline-start: auto; flex: none; }

@media (max-width: 620px) {
  .sim-run.sim-full { padding: 8px 10px 0; }
  .sim-run.sim-full .sim-actions { padding: 10px 0; }
  .sim-run.sim-full .sim-steps { max-height: 44px; overflow: hidden; }
}


/* ══════════════════════════════════════════════════════ tool rail

   The guided Practice page and the Mistake Bank had one inbound link between
   them, which made the whole adaptive loop unreachable by clicking. Every
   part of it is named here, at the top of the Dashboard. */

.tool-rail {
  display: grid; gap: 10px; margin-bottom: 20px;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}
.tool-card {
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  text-decoration: none;
  transition: border-color .15s ease, transform .12s ease;
}
.tool-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.tool-i { font-size: 1.05rem; color: var(--brand-ink); line-height: 1; }
.tool-t { font-weight: 700; font-size: .95rem; }
.tool-s { font-size: .76rem; color: var(--muted); line-height: 1.45; }

@media (max-width: 620px) {
  .tool-rail { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
  .tool-card { padding: 12px 13px; }
  .tool-s { display: none; }
}


/* ══════════════════════════════════════════════════════════ Training

   Short recall drills, one card at a time. Deliberately quieter than the exam
   pages: no timers, no scoring pressure, just the word and the choices. */

.train-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.train-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); text-decoration: none;
  transition: border-color .15s ease, transform .12s ease;
}
.train-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.train-i { font-size: 1.3rem; color: var(--brand-ink); line-height: 1; }
.train-de { font-family: var(--font-de); font-weight: 800; font-size: 1.06rem; }
.train-ar { font-size: .9rem; color: var(--ink); }
.train-n { font-size: .76rem; color: var(--muted); font-weight: 700; }
.train-b { font-size: .8rem; color: var(--muted); line-height: 1.5; margin-top: 4px; }

.tg-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tg-progress {
  flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden;
}
.tg-progress span { display: block; height: 100%; background: var(--brand); transition: width .25s ease; }
.tg-count { font-size: .78rem; font-weight: 700; color: var(--muted); font-family: var(--font-de); }

.tg-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); padding: 26px;
}
.tg-kicker { font-size: .72rem; font-weight: 700; color: var(--muted); }
.tg-word {
  font-family: var(--font-de); font-size: 2rem; font-weight: 800;
  margin: 6px 0 14px; color: var(--ink); line-height: 1.2;
}
.tg-prompts { margin: -6px 0 16px; }
.tg-prompts p {
  margin: 0 0 6px; font-family: var(--font-de); font-size: .98rem;
  color: var(--ink-soft, var(--muted)); line-height: 1.6;
}
.tg-options { display: grid; gap: 9px; }
.tg-opt {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font-family: var(--font-de); font-size: 1rem; font-weight: 600;
  text-align: left; cursor: pointer;
  transition: border-color .13s ease, background .13s ease;
}
.tg-opt:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.tg-opt:disabled { cursor: default; }
.tg-opt.right { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.tg-opt.wrong { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }
.tg-key {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted);
  font-size: .74rem; font-weight: 700;
}

.tg-feedback {
  margin-top: 14px; padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: .9rem; line-height: 1.6;
}
.tg-feedback.ok { background: var(--ok-bg); color: var(--ok); }
.tg-feedback.bad { background: var(--bad-bg); color: var(--bad); }

.tg-actions { display: flex; gap: 10px; margin-top: 18px; justify-content: space-between; }

.tg-rail-wrap { margin-top: 20px; }
.tg-rail-label { font-size: .74rem; font-weight: 700; color: var(--muted); }
.tg-rail { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tr-letter {
  min-width: 27px; padding: 4px 6px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--ink);
  font-family: var(--font-de); font-size: .78rem; font-weight: 700; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.tr-letter:hover { border-color: var(--brand); background: var(--brand-soft); }

.tg-hint { margin-top: 16px; font-size: .82rem; color: var(--muted); line-height: 1.6; }

.tg-done { text-align: center; padding: 40px 20px; }
.tg-done h2 { margin: 0 0 10px; font-size: 1.4rem; font-weight: 800; }
.tg-score { font-family: var(--font-de); font-size: 2.2rem; font-weight: 800; margin: 0 0 20px; color: var(--brand-ink); }
.tg-score span { font-size: 1.1rem; color: var(--muted); }

@media (max-width: 620px) {
  .tg-card { padding: 18px; }
  .tg-word { font-size: 1.6rem; }
  .tg-opt { padding: 12px 13px; font-size: .95rem; }
}

/* ═══════════════════════════════════════════════════ Hören training

   One recording, several statements. The audio stays available while the
   answers are checked — the aim here is training the ear, not rehearsing
   exam pressure, which is what the simulator is for. */

.hz-group + .hz-group { margin-top: 30px; }
.hz-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.hz-item {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); text-decoration: none;
  transition: border-color .13s ease, transform .1s ease;
}
.hz-item:hover { border-color: var(--brand); transform: translateY(-1px); }
.hz-no {
  flex: none; min-width: 34px; padding: 3px 7px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand-ink);
  font-family: var(--font-de); font-size: .74rem; font-weight: 800; text-align: center;
}
.hz-t { flex: 1; font-family: var(--font-de); font-weight: 600; font-size: .92rem; }
.hz-meta { flex: none; font-size: .74rem; color: var(--muted); }

.hz-audio {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 18px; margin-bottom: 20px;
}
.hz-audio audio { width: 100%; display: block; }
.hz-note { margin: 10px 0 0; font-size: .78rem; color: var(--muted); }

.hz-q { padding: 16px 0; border-bottom: 1px solid var(--line); }
.hz-q:last-child { border-bottom: 0; }
.hz-stmt { margin: 0 0 11px; font-family: var(--font-de); font-size: .98rem; line-height: 1.6; color: var(--ink); }
.hz-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.hz-opt {
  padding: 9px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font-family: var(--font-de); font-size: .92rem; font-weight: 600; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.hz-opt:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.hz-opt.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.hz-opt:disabled { cursor: default; }
.hz-opt.right { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.hz-opt.wrong { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }

.hz-why {
  margin-top: 11px; padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: .86rem; line-height: 1.65;
}
.hz-why.ok { background: var(--ok-bg); color: var(--ok); }
.hz-why.bad { background: var(--bad-bg); color: var(--bad); }

.hz-actions { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.hz-result { margin-top: 22px; text-align: center; }
.hz-score { font-family: var(--font-de); font-size: 2rem; font-weight: 800; margin: 0 0 16px; color: var(--brand-ink); }
.hz-score span { font-size: 1rem; color: var(--muted); }

@media (max-width: 620px) {
  .hz-list { grid-template-columns: 1fr; }
  .hz-audio { padding: 14px; }
}


/* Teaching rows inside a Training correction. Same shape the exam practice
   uses, so a learner meets one explanation format across the whole product. */
.tg-teach {
  margin-top: 12px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
}
.tg-teach .tx-row { display: grid; gap: 3px; margin-bottom: 11px; }
.tg-teach .tx-row:last-child { margin-bottom: 0; }
.tg-teach .tx-l {
  font-size: .7rem; font-weight: 700; letter-spacing: .02em; color: var(--muted);
}
.tg-teach .tx-row p { margin: 0; font-size: .88rem; line-height: 1.7; color: var(--ink); }
.tg-teach .tx-row.bad .tx-l { color: var(--bad); }
.tg-teach .tx-row.ok .tx-l { color: var(--ok); }
.tg-teach .tx-row.rule .tx-l,
.tg-teach .tx-row.applied .tx-l,
.tg-teach .tx-row.ex .tx-l { color: var(--brand-ink); }

@media (max-width: 620px) {
  .tg-teach { padding: 12px 13px; }
  .tg-teach .tx-row p { font-size: .85rem; }
}

/* The drilled word sits in its own row so the translate control has a
   place to anchor without covering the word. */
.tg-wordrow { position: relative; padding-top: 26px; }
.tg-wordrow .tg-word { margin-top: 0; }
