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

html, body { height: 100%; }
body {
  font-family: var(--font-text-family);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 9px; font-family: var(--font-display-family); font-size: 20px; font-weight: 700; color: var(--accent); letter-spacing: -0.5px; }
.logo::before { content: ''; width: 30px; height: 30px; flex-shrink: 0; background: url('../assets/brand/app-icon.png') center / contain no-repeat; }
.logo span { color: var(--text); opacity: 0.72; font-family: var(--font-text-family); font-weight: 400; font-size: 13px; margin-left: 0; }

/* Der MIDI-Status war Punkt + „Nicht verbunden" + Geraetename + Knopf
   nebeneinander — dreimal dieselbe Aussage. Jetzt ein Chip: verbunden traegt er
   den Geraetenamen, sonst die Aufforderung. */
.kopf-status {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto; font-size: 13px; color: var(--muted);
}
.midi-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted); font: inherit; font-size: 12px;
  cursor: pointer; white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.midi-chip:hover:not(.verbunden) { border-color: var(--accent); color: var(--text); }
.midi-chip:disabled { cursor: default; opacity: .7; }
/* Verbunden ist kein Knopf mehr, sondern eine Anzeige */
.midi-chip.verbunden {
  cursor: default; color: var(--success);
  background: var(--success-soft); border-color: var(--success-border);
}
.midi-chip #midi-status {
  max-width: 150px; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 750px) { .midi-chip #midi-status { max-width: 90px; } }
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.connected    { background: var(--success); box-shadow: 0 0 6px var(--success); }
.dot.disconnected { background: var(--muted); }

#midi-device { color: var(--text); font-size: 12px; }

.btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-medium);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: opacity var(--duration-fast) var(--curve);
}
.btn:hover:not(:disabled) { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--card); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
/* ── Seitenleiste ─────────────────────────────────────────────────────────── */
/* Sieben Reiter quer brauchten die volle Breite und brachen bei schmalem
   Fenster in eine zweite Zeile um — Platz, der jedem Notenbild fehlte. */

/* Der Streifen der Seitenleiste wird auf den RAHMEN gezeichnet, nicht auf die
   Leiste selbst. Die ist `sticky` und deshalb nur so hoch wie ihre Knöpfe —
   ohne das endete die Trennlinie mitten auf der Seite. */
.rahmen {
  display: flex; align-items: flex-start;
  min-height: calc(100vh - 57px);
  background: linear-gradient(to right,
    var(--surface) 0 185px, var(--border) 185px 186px, transparent 186px);
}
.rahmen.schmal {
  background: linear-gradient(to right,
    var(--surface) 0 51px, var(--border) 51px 52px, transparent 52px);
}

.seitenleiste {
  display: flex; flex-direction: column; gap: 2px;
  width: 186px; flex-shrink: 0;
  padding: 10px 8px;
  /* Hintergrund und Trennlinie kommen vom Rahmen — siehe oben */
  /* Bleibt beim Scrollen stehen, sobald der Header oben raus ist */
  position: sticky; top: 0;
  max-height: 100vh; overflow-y: auto;
  transition: width .18s;
}

.tab-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  background: none; border: none;
  border-left: 2px solid transparent; border-radius: 0 7px 7px 0;
  color: var(--muted); cursor: pointer;
  font-size: 14px; font-weight: 500; font-family: inherit; text-align: left;
  white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.tab-btn:hover  { color: var(--text); background: var(--card); }
.tab-btn.active {
  color: var(--accent2); border-left-color: var(--accent); background: var(--accent-soft);
}
.tab-icon { font-size: 16px; width: 20px; flex-shrink: 0; text-align: center; }
.tab-name { overflow: hidden; text-overflow: ellipsis; }

.seitenleiste-klapp {
  margin-top: auto; padding: 8px;
  background: none; border: none; border-top: 1px solid var(--border);
  color: var(--muted); cursor: pointer; font-size: 14px; font-family: inherit;
}
.seitenleiste-klapp:hover { color: var(--text); }
.seitenleiste-klapp::after { content: '« Einklappen'; font-size: 12px; }

/* Eingeklappt: nur die Symbole. Der Name verschwindet, der Platz auch. */
.rahmen.schmal .seitenleiste { width: 52px; padding: 10px 6px; }
.rahmen.schmal .tab-name { display: none; }
.rahmen.schmal .tab-btn { justify-content: center; padding: 9px 4px; gap: 0; }
.rahmen.schmal .seitenleiste-klapp::after { content: '»'; }

/* ── Main layout ──────────────────────────────────────────────────────────── */
/* `min-width: 0` ist Pflicht, nicht Kosmetik: ein Flex-Item wird sonst nie
   schmaler als sein Inhalt, und das Notenbild schoebe die Seitenleiste weg.
   Derselbe Fehler wie damals beim Grid im Progressions-Tab. */
main { flex: 1; min-width: 0; padding: 20px; max-width: 1200px; }

/* Schmales Fenster: die Namen fallen von selbst weg, bevor es eng wird. */
@media (max-width: 900px) {
  .rahmen, .rahmen.schmal {
    background: linear-gradient(to right,
      var(--surface) 0 51px, var(--border) 51px 52px, transparent 52px);
  }
  .seitenleiste { width: 52px; padding: 10px 6px; }
  .tab-name { display: none; }
  .tab-btn { justify-content: center; padding: 9px 4px; gap: 0; }
  .seitenleiste-klapp { display: none; }
}

/* Sehr schmal: quer über den Inhalt, waagerecht scrollbar. */
@media (max-width: 600px) {
  /* `align-items: stretch` statt `flex-start`: sonst schrumpft die quer
     liegende Leiste auf die Breite ihrer Symbole und der Streifen endet
     mitten auf dem Bildschirm. */
  .rahmen, .rahmen.schmal {
    flex-direction: column; align-items: stretch; background: none;
  }
  /* Auch `.rahmen.schmal .seitenleiste` nennen: die Klapp-Regel ist
     spezifischer und liesse die Leiste sonst bei 52 px stehen — wer am Rechner
     einklappt, bekaeme am Telefon einen 52 px breiten Streifen quer. */
  .seitenleiste,
  .rahmen.schmal .seitenleiste {
    flex-direction: row; width: auto; max-height: none; padding: 0 6px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    overflow-x: auto; overflow-y: hidden; position: static;
  }
  .tab-btn {
    width: auto; border-left: none; border-bottom: 2px solid transparent;
    border-radius: 7px 7px 0 0;
  }
  .tab-btn.active { border-left-color: transparent; border-bottom-color: var(--accent); }
  main { width: 100%; }
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.card-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 12px;
}

/* ── Practice Tab ─────────────────────────────────────────────────────────── */
/* Mobile-first: single column stack */
.practice-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
/* Desktop: chord+staff side-by-side, controls below chord, piano full-width */
@media (min-width: 800px) {
  .practice-layout {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "chord  staff"
      "controls staff"
      "piano  piano";
  }
  .chord-display { grid-area: chord; }
  .staff-card    { grid-area: staff; }
  .controls-row  { grid-area: controls; }
  .piano-wrap    { grid-area: piano; }
}

.chord-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  position: relative;
}

.chord-symbol {
  font-size: 72px;
  font-weight: 800;
  color: var(--accent2);
  line-height: 1;
  letter-spacing: -2px;
}
.chord-name { font-size: 18px; color: var(--text); font-weight: 500; }
.chord-desc { font-size: 13px; color: var(--muted); text-align: center; max-width: 260px; }

.play-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--accent2);
  background: transparent;
  color: var(--accent2);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  line-height: 1;
  padding-left: 2px;
}
.play-btn:hover  { background: var(--accent2); color: var(--bg); }
.play-btn:active { transform: scale(0.92); }

.type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.type-badge.major  { background: #4f86f720; color: #93c5fd; border: 1px solid #4f86f740; }
.type-badge.minor  { background: #a78bfa20; color: #c4b5fd; border: 1px solid #a78bfa40; }
.type-badge.dom7   { background: #f59e0b20; color: #fcd34d; border: 1px solid #f59e0b40; }
.type-badge.maj7   { background: #4ade8020; color: #86efac; border: 1px solid #4ade8040; }
.type-badge.min7   { background: #818cf820; color: #a5b4fc; border: 1px solid #818cf840; }
.type-badge.dim    { background: #f8717120; color: #fca5a5; border: 1px solid #f8717140; }

.note-pills { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.note-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: monospace;
  transition: background 0.15s, border-color 0.15s;
}
.note-pill.hit {
  background: var(--success-strong);
  border-color: var(--success);
}
.pill-note {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.note-pill.hit .pill-note {
  color: var(--success);
}
.pill-intv {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
}
.note-pill.hit .pill-intv {
  color: color-mix(in srgb, var(--success) 72%, var(--text));
}

.hand-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.staff-card { /* grid-area set by media query */ }
.staff-card .card-title { margin-bottom: 8px; }

#staff-container svg,
#prog-staff svg,
#theory-staff svg { width: 100% !important; height: auto !important; display: block; }
.staff-bg { background: #fff; border-radius: 6px; padding: 4px; overflow: hidden; overflow-x: auto; scroll-behavior: smooth; }

.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.feedback {
  font-size: 42px;
  font-weight: 700;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
}
.feedback.success { color: var(--success); }

.stats {
  display: flex;
  gap: 16px;
  margin-left: auto;
}
.stat { text-align: center; }
.stat-val { font-size: 22px; font-weight: 700; color: var(--accent2); }
.stat-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Piano container ──────────────────────────────────────────────────────── */
.piano-wrap {
  grid-column: 1 / -1;
  overflow-x: auto;
}
#piano-container, #prog-piano, #theory-piano {
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#piano-container svg, #prog-piano svg, #theory-piano svg {
  width: 100%;
  max-width: 750px;
  height: auto;
}

/* ── Progression Tab ──────────────────────────────────────────────────────── */
.prog-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}
/* Grid-Items haben von sich aus min-width:auto und werden nie schmaler als ihr
   Inhalt. Der Notenbereich setzt aber eine min-width, damit er lesbar bleibt
   (siehe notation.js) — ohne die Null hier drückt die die Spalte auf und die
   ganze Seite scrollt horizontal, statt dass .staff-bg scrollt. */
.prog-layout > * { min-width: 0; }
@media (max-width: 750px) {
  .prog-layout { grid-template-columns: 1fr; }
}

.prog-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.prog-chord {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.15s;
}
.prog-chord.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  transform: scale(1.05);
}

.prog-nav { display: flex; gap: 8px; align-items: center; }
#prog-step { color: var(--muted); font-size: 13px; min-width: 50px; text-align: center; }

/* ── WEIL-Panel ────────────────────────────────────────────────────────────── */
.weil-card { border-color: var(--accent-border); }
.weil-current {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.weil-fn-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}
.weil-arrow-line {
  width: 2px;
  height: 18px;
  background: var(--border);
  margin: 4px 0 4px 14px;
}
.weil-next {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.weil-next-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.weil-next strong { font-size: 17px; color: var(--text); }
.weil-reason {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  align-items: flex-start;
}
.weil-emoji { font-size: 22px; flex-shrink: 0; line-height: 1.3; }
.weil-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.weil-text  { font-size: 13px; color: var(--muted); line-height: 1.6; }
.weil-end   { font-size: 13px; color: var(--success); padding: 8px 0; }

/* ── Theory Tab ───────────────────────────────────────────────────────────── */
.theory-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 750px) {
  .theory-layout { grid-template-columns: 1fr; }
}

.diatonic-table {
  width: 100%;
  border-collapse: collapse;
}
.diatonic-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.diatonic-table td { padding: 7px 8px; border-bottom: 1px solid var(--border)20; }
.diatonic-table tr:last-child td { border-bottom: none; }
.diatonic-table tr:hover td { background: var(--surface); }

.degree { font-size: 15px; font-weight: 700; color: var(--muted); width: 40px; }
.sym-cell { font-weight: 600; }
.fn-name  { font-size: 12px; color: var(--muted); }
.chord-notes { font-size: 12px; color: var(--muted); font-family: monospace; }

.fn-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid;
}

.chord-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 3px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
}
.chord-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.theory-preview {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.preview-chord-name { font-size: 28px; font-weight: 700; color: var(--accent2); }

.key-prog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.key-prog-card:hover { border-color: var(--accent); }
.kp-header { display: flex; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.kp-sub    { font-size: 12px; color: var(--muted); }
.kp-chords { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kp-chord  { background: var(--card); border: 1px solid var(--border); border-radius: 5px; padding: 2px 8px; font-size: 14px; font-weight: 600; }
.kp-arrow  { color: var(--muted); font-size: 12px; }

.fn-legend { display: flex; flex-direction: column; gap: 8px; }
.fn-item   { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.fn-dot    { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }

/* ── Keyboard hint ────────────────────────────────────────────────────────── */
.kb-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  text-align: center;
}
.kb-hint kbd {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 11px;
}

/* ── Select ───────────────────────────────────────────────────────────────── */
select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}
select:focus { border-color: var(--accent); }

/* ── Impro & Flow Tab ─────────────────────────────────────────────────────── */
.impro-layout { display: flex; flex-direction: column; gap: 14px; }

.impro-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
}
.impro-topbar-left  { display: flex; align-items: center; gap: 8px; }
.impro-topbar-right { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; }
.impro-goal-label   { font-size: 13px; color: var(--muted); white-space: nowrap; }

.impro-goals { display: flex; gap: 6px; flex-wrap: wrap; }
.goal-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 13px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.goal-chip:hover { border-color: var(--accent); color: var(--text); }
.goal-chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.impro-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 800px) {
  .impro-main { grid-template-columns: 260px 1fr; align-items: start; }
}

.impro-current-card  { display: flex; flex-direction: column; }
.impro-current-inner { text-align: center; padding: 16px 8px 10px; }
.impro-chord-sym     { font-size: 68px; font-weight: 800; line-height: 1; letter-spacing: -2px; }
.impro-chord-name    { font-size: 16px; font-weight: 500; margin: 6px 0 4px; }
.impro-fn-label      { font-size: 12px; color: var(--muted); }
.impro-detect-status {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
  min-height: 18px;
  transition: color 0.2s;
}
.impro-detect-status.detected { color: var(--success); font-weight: 600; }

.impro-right { display: flex; flex-direction: column; gap: 12px; }

.impro-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.impro-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.12s;
}
.impro-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
}
.impro-card-hl { box-shadow: 0 0 0 1px currentColor inset; }
.impro-card-top   { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.impro-card-chord { font-size: 34px; font-weight: 800; line-height: 1; }
.impro-card-tag   { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.impro-card-why   { font-size: 12px; color: var(--muted); line-height: 1.55; margin-bottom: 8px; }
.impro-card-term  { font-size: 11px; color: var(--accent2); font-style: italic; }

.impro-empty { font-size: 13px; color: var(--muted); padding: 12px 0; }

.impro-learning {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.impro-learning.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.impro-learning-row  { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.impro-learning-tag  { font-weight: 700; color: var(--text); }
.impro-learning-term { font-weight: 600; color: var(--accent2); }
.impro-learning-why  { color: var(--muted); }
.impro-new-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 4px;
}

.impro-vocab { display: flex; flex-wrap: wrap; gap: 6px; }
.impro-vocab-tag {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 12px;
  color: var(--accent2);
}

/* ── Trainer Tab ──────────────────────────────────────────────────────────── */
.trainer-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 800px) {
  .trainer-layout { grid-template-columns: 240px 1fr; }
}

.lesson-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 8px;
}
.lesson-card:hover  { border-color: var(--accent); }
.lesson-card.active { background: var(--surface); border-color: var(--accent); }
.lesson-card-title  { font-weight: 600; font-size: 14px; }
.lesson-card-sub    { font-size: 12px; color: var(--muted); margin-top: 2px; }

.trainer-main { display: flex; flex-direction: column; gap: 12px; }
#trainer-content { display: flex; flex-direction: column; gap: 12px; }

.trainer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.trainer-lesson-title { font-size: 20px; font-weight: 700; color: var(--accent2); }
.trainer-lesson-sub   { font-size: 13px; color: var(--muted); }

.trainer-progress { display: flex; gap: 8px; align-items: center; }
.progress-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.2s;
}
.progress-dot.active { background: var(--accent); transform: scale(1.3); }
.progress-dot.done   { background: var(--success); }

.trainer-theory-box {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  align-items: flex-start;
}
.trainer-theory-icon { font-size: 20px; flex-shrink: 0; line-height: 1.4; }
.trainer-theory-text { font-size: 14px; color: var(--text); line-height: 1.65; }
.trainer-theory-text strong { color: var(--accent2); }
.trainer-theory-text em { color: var(--warn); font-style: normal; }

.trainer-play-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
}
.trainer-play-top    { display: flex; align-items: center; gap: 8px; }
.trainer-fn-label    { font-size: 13px; color: var(--muted); }
.trainer-play-prompt { font-size: 16px; font-weight: 600; color: var(--text); margin-top: 4px; }
.trainer-chord-big   { font-size: 60px; font-weight: 800; line-height: 1; letter-spacing: -2px; }

.trainer-insight-box {
  display: flex;
  gap: 12px;
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  align-items: flex-start;
  animation: trainerFadeUp 0.35s ease;
}
.trainer-insight-icon { font-size: 20px; flex-shrink: 0; line-height: 1.4; }
.trainer-insight-text { font-size: 14px; color: var(--text); line-height: 1.65; }
.trainer-insight-text strong { color: var(--success); }

.trainer-bridge-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  animation: trainerFadeUp 0.4s ease;
}
.trainer-bridge-text { font-size: 14px; color: var(--text); line-height: 1.5; flex: 1; }
.trainer-bridge-text strong { color: var(--accent2); }

.trainer-done {
  text-align: center;
  padding: 48px 20px;
}
.trainer-done-icon  { font-size: 52px; margin-bottom: 14px; }
.trainer-done-title { font-size: 28px; font-weight: 700; color: var(--accent2); }
.trainer-done-sub   { font-size: 16px; color: var(--success); margin-top: 6px; font-weight: 600; }
.trainer-done-desc  { font-size: 14px; color: var(--muted); margin-top: 14px; max-width: 420px; margin-left: auto; margin-right: auto; line-height: 1.7; }
.trainer-done-btns  { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

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

/* ── Rhythm trainer ──────────────────────────────────────────────────────── */
.rhythm-transport-card {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.rhythm-play-btn {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 10px;
  padding: 14px 28px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  min-width: 130px;
}
.rhythm-play-btn:hover  { background: var(--accent2); }
.rhythm-play-btn:active { transform: scale(0.96); }
.rhythm-play-btn.playing { background: var(--danger); }
.rhythm-play-btn.playing:hover { background: color-mix(in srgb, var(--danger) 85%, var(--text)); }

.rhythm-transport-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rhythm-beats { display: flex; gap: 10px; }
.beat-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.08s;
}
.beat-dot.active {
  background: var(--accent2);
  border-color: var(--accent2);
  color: var(--bg);
  transform: scale(1.12);
  box-shadow: 0 0 12px var(--accent2);
}
.rhythm-bar-count { font-size: 13px; color: var(--muted); }

.rhythm-metro-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
#rhythm-bpm { accent-color: var(--accent2); }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Dojo ─────────────────────────────────────────────────────────────────── */

.dojo-live {
  font-size: 12px; color: var(--accent2); font-variant-numeric: tabular-nums;
  opacity: 0; transition: opacity .3s;
}
.dojo-live.an { opacity: 1; }

.dojo-layout { display: flex; flex-direction: column; gap: 14px; }
.dojo-layout > #dojo-content { display: flex; flex-direction: column; gap: 14px; }

.dojo-hinweis { font-size: 12px; color: var(--muted); line-height: 1.5; }
.dojo-warnung {
  margin-top: 8px; font-size: 12px; color: var(--warn);
  background: var(--warn-soft); border: 1px solid var(--warn-border);
  border-radius: 6px; padding: 8px 10px;
}

/* Kacheln */
.dojo-kacheln { display: flex; gap: 10px; flex-wrap: wrap; }
.dojo-kachel {
  flex: 1 1 110px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
}
.dojo-wert {
  font-size: 24px; font-weight: 700; color: var(--accent2);
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.dojo-lbl { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Rang */
.dojo-rang { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.dojo-rang-name { font-size: 20px; font-weight: 700; }
.dojo-rang-kurz { font-size: 12px; color: var(--muted); }
.dojo-rang-bar {
  flex: 1 1 160px; height: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 4px; overflow: hidden;
}
.dojo-rang-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .4s;
}
.dojo-rang-next { font-size: 12px; color: var(--muted); }

/* Verlauf */
.dojo-verlauf {
  display: flex; align-items: flex-end; gap: 3px; height: 56px; margin-top: 12px;
}
.dojo-balken {
  flex: 1; height: 100%; display: flex; align-items: flex-end;
  background: var(--surface); border-radius: 3px; overflow: hidden;
}
.dojo-balken.leer { opacity: .4; }
.dojo-balken-fill {
  width: 100%; background: var(--accent); border-radius: 3px; min-height: 0;
}

/* Mastery-Liste */
.dojo-mastery { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.dojo-zeile {
  display: grid; grid-template-columns: 62px 62px 1fr 38px 68px;
  align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px;
}
.dojo-zeile:nth-child(odd) { background: var(--text-faint); }
.dojo-sym { font-weight: 700; font-size: 14px; }
.dojo-grad { font-size: 9px; color: var(--warn); letter-spacing: 1px; }
.dojo-grad-rest { color: var(--border); }
.dojo-bar {
  height: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 3px; overflow: hidden;
}
.dojo-bar-fill {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--danger), var(--warn) 55%, var(--success));
}
.dojo-zahl {
  font-size: 12px; color: var(--muted); text-align: right;
  font-variant-numeric: tabular-nums;
}
.dojo-zeit {
  font-size: 11px; color: var(--muted); text-align: right;
  font-variant-numeric: tabular-nums;
}

.dojo-daten { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dojo-gefahr { color: var(--danger); border-color: var(--danger-border); }

@media (max-width: 750px) {
  .dojo-zeile { grid-template-columns: 52px 52px 1fr 34px; }
  .dojo-zeit { display: none; }
}

.dojo-session { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.dojo-session-text { flex: 1 1 280px; }
.dojo-session-lage { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.dojo-punkt {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--muted); margin-top: 5px;
}
.dojo-punkt.an {
  background: var(--success); box-shadow: 0 0 6px var(--success);
  animation: dojo-puls 2s ease-in-out infinite;
}
@keyframes dojo-puls { 50% { opacity: .45; } }
.dojo-session-knoepfe { margin-left: auto; }

/* Wochenserie */
.dojo-serie {
  display: flex; align-items: baseline; gap: 8px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.dojo-serie-zahl {
  font-size: 26px; font-weight: 800; color: var(--warn);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.dojo-serie-text { font-size: 12px; color: var(--muted); }

/* Trend */
.dojo-trend-kopf { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dojo-trend-wert {
  font-size: 22px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.dojo-trend-wert.gut      { color: var(--success); }
.dojo-trend-wert.schlecht { color: var(--warn); }
.dojo-trend {
  display: flex; align-items: flex-end; gap: 6px; height: 48px; margin-top: 12px;
}
.dojo-tbalken {
  flex: 1; height: 100%; display: flex; align-items: flex-end;
  background: var(--surface); border-radius: 3px; overflow: hidden;
}
.dojo-tbalken.leer { opacity: .35; }
.dojo-tbalken-fill {
  width: 100%; border-radius: 3px;
  background: linear-gradient(180deg, var(--accent2), var(--accent));
}

/* Mischung + Empfehlung */
.dojo-mischung {
  margin-top: 10px; font-size: 11px; color: var(--muted);
  display: flex; gap: 10px; flex-wrap: wrap;
}
.dojo-mischung span {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 10px;
}
.dojo-vorschlag { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dojo-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: 8px; padding: 6px 12px; font-weight: 700; font-size: 15px;
}
.dojo-chip em {
  font-style: normal; font-weight: 400; font-size: 11px; color: var(--muted);
}

/* Erledigte Lektionen */
.lesson-card.fertig .lesson-card-title { color: var(--success); }
.lesson-card.fertig { opacity: .85; }

/* Nächste Stufe — Quest-Liste */
.dojo-quest {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.dojo-quest.fertig { color: var(--success); font-weight: 600; }
.dojo-quest-kopf { font-size: 13px; margin-bottom: 8px; }
.dojo-quest-liste { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.dojo-quest-zeile {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font-size: 13px;
}
.dojo-quest-box  { color: var(--accent2); font-size: 14px; line-height: 1; }
.dojo-quest-sym  { font-weight: 700; min-width: 48px; }
.dojo-quest-text { color: var(--text); }
.dojo-quest-stand {
  margin-left: auto; font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Questbuch ────────────────────────────────────────────────────────────── */
.quest-kopf { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.quest-kopf-name { font-size: 20px; font-weight: 700; }
.quest-punkt {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); flex-shrink: 0;
}
.quest-belt-emblem { width: 58px; height: 58px; flex-shrink: 0; object-fit: contain; filter: drop-shadow(0 4px 8px color-mix(in srgb, var(--bg) 75%, transparent)); }
.quest-stufe-kopf .quest-belt-emblem { width: 42px; height: 42px; }

.quest-stufe { opacity: .75; transition: opacity .2s; }
.quest-stufe.aktiv     { opacity: 1; border-color: var(--accent); }
.quest-stufe.bestanden { opacity: .55; }
.quest-stufe-kopf {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; font-size: 15px; flex-wrap: wrap;
}
.quest-bestanden {
  margin-left: auto; font-size: 11px; color: var(--success);
  border: 1px solid var(--success); border-radius: 20px; padding: 1px 10px;
}

.quest-skills {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px;
}
.quest-skill {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.quest-skill.fertig       { border-color: var(--success); }
.quest-skill.laufend      { border-color: var(--accent); }
.quest-skill.gesperrt     { opacity: .5; }
.quest-skill.vorbereitung { border-style: dashed; opacity: .7; }

.quest-skill-kopf { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.quest-icon { font-size: 13px; }
.quest-skill-name { font-weight: 700; font-size: 14px; }
.quest-saeule { margin-left: auto; font-size: 10px; color: var(--muted); white-space: nowrap; }
.quest-skill-text { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 6px 0; }
.quest-skill-fuss {
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.quest-bar {
  height: 4px; background: var(--bg); border-radius: 2px;
  overflow: hidden; margin: 8px 0 5px;
}
.quest-bar span {
  display: block; height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* ── Füllstand-Ring und Modal ─────────────────────────────────────────────── */
.fuellstand {
  background: none; border: none; padding: 0; cursor: pointer;
  line-height: 0; opacity: .85; transition: opacity .15s, transform .1s;
}
.fuellstand:hover  { opacity: 1; }
.fuellstand:active { transform: scale(.94); }

.fs-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: var(--overlay); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.fs-modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  max-width: 480px; width: 100%; max-height: 85vh; overflow-y: auto;
  position: relative;
}
.fs-zu {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.fs-zu:hover { color: var(--text); }

.fs-kopf { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.fs-sym  { font-size: 30px; font-weight: 800; color: var(--accent2); line-height: 1.1; }
.fs-name { font-size: 13px; color: var(--muted); }

.fs-abschnitt { margin-top: 16px; }
.fs-titel {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .8px; color: var(--muted); margin-bottom: 8px;
}
.fs-text  { font-size: 13px; line-height: 1.6; color: var(--text); }
.fs-warn  { color: var(--warn); }
.fs-gut   { color: var(--success); }
.fs-liste { font-size: 13px; line-height: 1.7; padding-left: 18px; color: var(--text); }
.fs-zahlen {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px;
  font-size: 11px; color: var(--muted);
}
.fs-zahlen span {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px;
}

/* ── Profile ──────────────────────────────────────────────────────────────── */
.dojo-profile { display: flex; gap: 8px; flex-wrap: wrap; }
.dojo-profil {
  /* Seit dem Avatar liegen Bild und Text nebeneinander, nicht mehr untereinander */
  display: flex; flex-direction: row; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; cursor: pointer;
  color: var(--text); text-align: left; font-family: inherit;
  transition: border-color .15s, background .15s;
}
.dojo-profil:hover { border-color: var(--accent); }
.dojo-profil.aktiv { border-color: var(--accent); background: var(--accent-soft); }
.dojo-profil.neu   { color: var(--muted); border-style: dashed; justify-content: center; }
.dojo-profil.neu   { align-items: center; }
.dojo-profil-name  { font-weight: 700; font-size: 14px; }
.dojo-profil-info  { font-size: 11px; color: var(--muted); }

.dojo-mini {
  background: none; border: none; color: var(--accent2);
  font-size: 11px; cursor: pointer; padding: 0 0 0 10px;
  font-family: inherit; text-decoration: underline;
}
.dojo-mini.gefahr { color: var(--danger); }

/* Klickbare Skills */
.quest-skill.klickbar { cursor: pointer; }
.quest-skill.klickbar:hover { border-color: var(--accent2); background: var(--accent2-soft); }
.quest-los {
  font-size: 11px; color: var(--accent2); margin-top: 6px; opacity: 0;
  transition: opacity .15s;
}
.quest-skill.klickbar:hover .quest-los { opacity: 1; }

/* Weg-Kurzliste im Profil */
.dojo-wegliste { display: flex; flex-direction: column; gap: 4px; }
.dojo-weg {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 11px; cursor: pointer;
  color: var(--text); font-family: inherit; font-size: 13px; text-align: left;
  transition: border-color .15s;
}
.dojo-weg:hover:not(:disabled) { border-color: var(--accent2); }
.dojo-weg:disabled { opacity: .45; cursor: default; }
.dojo-weg.fertig  { border-color: var(--success-border); }
.dojo-weg.laufend { border-color: var(--accent); }
.dojo-weg-icon { font-size: 12px; width: 14px; flex-shrink: 0; }
.dojo-weg-name { flex: 1; }
.dojo-weg-zahl {
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}

/* Fokus-Banner in der Übung */
.practice-fokus {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-color: var(--accent);
}
.pf-text { display: flex; flex-direction: column; }
.pf-bar {
  flex: 1 1 100px; min-width: 80px; height: 5px;
  background: var(--surface); border-radius: 3px; overflow: hidden;
}
.pf-bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* ── Karten-Runner ─────────────────────────────────────────────────────────── */

.runner-typen { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.runner-typ-chip {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: var(--success-soft); color: var(--success); border: 1px solid var(--success-border);
  white-space: nowrap;
}
/* Griff-Karten brauchen ein Instrument — andere Farbe, damit man vor dem Start
   sieht, was ohne Keyboard geht und was nicht. */
.runner-typ-chip.instrument {
  background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border);
}

.runner-skills { display: flex; flex-direction: column; gap: 6px; }
.runner-skill {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font: inherit;
}
.runner-skill:hover { border-color: var(--accent2); background: var(--accent2-soft); }
.runner-skill-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.runner-skill-los  { color: var(--accent2); font-size: 13px; }

.runner-kopf { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.runner-kopf-text { display: flex; flex-direction: column; flex: 1; min-width: 140px; }
.runner-kopf-text strong { font-size: 15px; }
.runner-kopf .btn { margin-left: auto; }

.runner-uhr { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.runner-uhr-bahn {
  flex: 1; height: 8px; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--border); overflow: hidden;
}
.runner-uhr-fill {
  height: 100%; background: var(--accent);
  transition: width .1s linear, background-color .2s;
}
.runner-uhr-fill.knapp { background: var(--danger); }
.runner-uhr-sek {
  font-variant-numeric: tabular-nums; font-size: 13px;
  color: var(--muted); min-width: 52px; text-align: right;
}

.runner-typ-zeile { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.runner-karte { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.runner-sym {
  font-size: 60px; font-weight: 800; line-height: 1;
  letter-spacing: -2px; color: var(--accent2);
}
.runner-sym-name { font-size: 14px; color: var(--muted); }

.runner-karte .piano-wrap { width: 100%; }
/* Das Notenbild ist 400x260 gezeichnet. Auf voller Kartenbreite skaliert es auf
   das Doppelte hoch und schiebt die Klaviatur unter den Falz — beides muss
   zusammen sichtbar bleiben, sonst spielt man ohne zu sehen was liegt. */
.runner-karte .staff-bg { width: 100%; max-width: 440px; }
.runner-karte #runner-staff svg { width: 100% !important; height: auto !important; display: block; }

/* ── Antwort: Symbol waehlen ────────────────────────────────────────────────── */

.runner-wahl {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 8px; width: 100%; max-width: 420px;
}
@media (min-width: 600px) { .runner-wahl { grid-template-columns: repeat(4, 1fr); } }
.runner-wahl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 6px; cursor: pointer; font: inherit; color: var(--text);
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
}
.runner-wahl-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.runner-wahl-btn:disabled { cursor: default; }
.runner-wahl-sym  { font-size: 20px; font-weight: 700; }
.runner-wahl-name { font-size: 11px; color: var(--muted); }
.runner-wahl-btn.richtig { border-color: var(--success); background: var(--success-soft); }
.runner-wahl-btn.falsch  { border-color: var(--danger);  background: var(--danger-soft); }
.runner-wahl-btn.aus     { opacity: .4; }

/* ── Antwort: Toene waehlen ─────────────────────────────────────────────────── */

.runner-toene {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 6px; width: 100%; max-width: 420px;
}
@media (min-width: 600px) { .runner-toene { grid-template-columns: repeat(6, 1fr); } }
.runner-ton {
  padding: 10px 4px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; color: var(--text);
  background: var(--card); border: 1px solid var(--border); border-radius: 7px;
}
.runner-ton:hover:not(:disabled) { border-color: var(--accent); }
.runner-ton.an      { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.runner-ton.richtig { border-color: var(--success); color: var(--success); }
.runner-ton.an.richtig { background: var(--success-strong); color: var(--success); }
.runner-ton.falsch  { background: var(--danger-strong); border-color: var(--danger); color: var(--danger); }
.runner-toene-stand { font-size: 12px; color: var(--muted); }

.runner-hoeren { display: flex; align-items: center; gap: 10px; padding: 6px 0 4px; }

/* ── Aufloesung ─────────────────────────────────────────────────────────────── */

.runner-fuss {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-top: 14px;
}
.runner-fuss:empty { margin-top: 0; }
.runner-loesung { font-size: 15px; font-weight: 600; }
.runner-loesung.gut     { color: var(--success); }
.runner-loesung.schlecht { color: var(--warn); }
.runner-aufloesung {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  justify-content: center; font-size: 14px;
}
.runner-aufloesung strong { font-size: 20px; color: var(--accent2); }

/* ── Bilanz ─────────────────────────────────────────────────────────────────── */

.runner-liste { display: flex; flex-direction: column; gap: 2px; }
.runner-zeile {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 8px; border-radius: 5px; font-size: 13px;
}
.runner-zeile:nth-child(odd) { background: var(--text-faint); }
.runner-zeile.daneben .runner-zeile-icon { color: var(--muted); }
.runner-zeile-nr   { color: var(--muted); font-size: 11px; min-width: 18px; }
.runner-zeile-sym  { font-weight: 700; min-width: 54px; }
.runner-zeile-typ  { color: var(--muted); font-size: 12px; flex: 1; }
.runner-zeile-zeit { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.runner-zeile-icon { color: var(--success); min-width: 14px; text-align: right; }

/* Questbuch: Runner-Start und der alte Fokus-Weg nebeneinander */
.quest-los-reihe { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
/* Sichtbar bleiben, nicht erst beim Hovern auftauchen: der zweite Knopf waere
   auf einem Touchgeraet sonst unsichtbar, aber trotzdem anklickbar. */
.quest-los-reihe .quest-los { margin: 0; opacity: .6; }
.quest-skill.klickbar:hover .quest-los-reihe .quest-los { opacity: 1; }
.quest-fokus { flex-shrink: 0; }

/* ── Avatar im Kopf ────────────────────────────────────────────────────────── */

.avatar-btn {
  display: flex; align-items: center; gap: 9px;
  margin-left: auto; padding: 4px 10px 4px 4px;
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  cursor: pointer; color: var(--text); font: inherit;
}
.avatar-btn:hover  { background: var(--card); border-color: var(--border); }
.avatar-btn.aktiv  { background: var(--card); border-color: var(--accent); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  font-size: 12px; font-weight: 700; letter-spacing: .5px; color: var(--text);
}
.avatar-gross { width: 60px; height: 60px; font-size: 21px; }
.avatar-klein { width: 26px; height: 26px; font-size: 10px; }
.avatar-text  { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.avatar-name  { font-size: 13px; font-weight: 600; }
.avatar-rang  { font-size: 10px; color: var(--muted); }

@media (max-width: 750px) { .avatar-text { display: none; } }

/* ── Profil-Ansicht ────────────────────────────────────────────────────────── */

.sensei-guide {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  background: linear-gradient(115deg, var(--card), color-mix(in srgb, var(--accent) 10%, var(--card)));
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.sensei-guide-image { width: 92px; height: 92px; object-fit: contain; filter: drop-shadow(0 8px 12px color-mix(in srgb, var(--bg) 75%, transparent)); }
.sensei-guide-copy { min-width: 0; }
.sensei-guide-copy strong { display: block; margin-bottom: 4px; font-family: var(--font-display-family); font-size: 18px; color: var(--accent); }
.sensei-guide-copy p { color: var(--muted); line-height: 1.5; }
@media (max-width: 600px) {
  .sensei-guide { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; }
  .sensei-guide-image { width: 76px; height: 76px; }
  .sensei-guide .btn { grid-column: 1 / -1; width: 100%; }
}

.profil-kopf {
  position: relative;
  min-height: 170px;
  margin-bottom: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  background-image:
    linear-gradient(90deg, color-mix(in srgb, var(--card) 98%, transparent) 0%, color-mix(in srgb, var(--card) 88%, transparent) 48%, color-mix(in srgb, var(--card) 58%, transparent) 100%),
    url('../assets/brand/profile-hero.jpg');
  background-position: center;
  background-size: cover;
  box-shadow: var(--shadow-floating);
}
.profil-kopf-zeile { position: relative; width: 100%; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profil-kopf-text  { flex: 1; min-width: 200px; }
.profil-name { font-size: 22px; font-weight: 700; margin-bottom: 2px; }
.profil-kopf-zahlen { display: flex; gap: 10px; flex-wrap: wrap; }

.profil-reiter {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); margin-bottom: 14px;
}
.profil-reiter-btn {
  padding: 9px 14px; background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer;
}
.profil-reiter-btn:hover  { color: var(--text); }
.profil-reiter-btn.active { color: var(--accent2); border-bottom-color: var(--accent); }

.profil-abschnitt { display: none; }
.profil-abschnitt.active { display: block; }

/* Profil-Auswahl: jetzt mit Avatar statt nur Text */
.dojo-profil-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }

/* ── Aus dem Profil in die Übung ───────────────────────────────────────────── */
/* Quest-Zeilen, Vorschlags-Chips und Mastery-Liste sind jetzt Knöpfe. Sie
   brauchen die Button-Vorgaben zurückgesetzt und einen sichtbaren Hinweis
   darauf, dass ein Klick etwas tut — sonst sehen sie aus wie vorher und
   niemand probiert es. */

.dojo-chip[data-uebe],
.dojo-zeile[data-uebe],
.dojo-quest-zeile[data-uebe] {
  font-family: inherit; color: var(--text); text-align: left;
  cursor: pointer; width: 100%;
  transition: border-color .15s, background .15s;
}
.dojo-chip[data-uebe] { width: auto; }

.dojo-chip[data-uebe]:hover { background: var(--accent); color: var(--on-accent); }
.dojo-chip[data-uebe]:hover em { color: color-mix(in srgb, var(--on-accent) 80%, transparent); }

.dojo-zeile[data-uebe] {
  border: 1px solid transparent; background: none;
}
.dojo-zeile[data-uebe]:nth-child(odd) { background: var(--text-faint); }
.dojo-zeile[data-uebe]:hover { border-color: var(--accent); background: var(--accent-soft); }

.dojo-quest-zeile[data-uebe]:hover { border-color: var(--accent2); background: var(--accent2-soft); }
.dojo-quest-los {
  margin-left: auto; color: var(--accent2); font-size: 11px;
  opacity: 0; transition: opacity .15s;
}
.dojo-quest-zeile[data-uebe]:hover .dojo-quest-los { opacity: 1; }

/* Die Bereiche zum freien Üben */
.profil-bereiche { display: flex; gap: 8px; flex-wrap: wrap; }
.profil-bereiche .dojo-chip {
  font-weight: 500; font-size: 13px; border-color: var(--border);
  cursor: pointer; font-family: inherit; color: var(--text);
}
.profil-bereiche .dojo-chip:hover { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

/* ── Karten: einzelne Note und Notenbild-Auswahl ───────────────────────────── */

.runner-einzelnote { width: 100%; max-width: 300px; }
.runner-einzelnote svg { width: 100% !important; height: auto !important; display: block; }

/* Vier Notenbilder zur Wahl. Zwei Spalten, damit sie gross genug bleiben, um
   Notenkoepfe auseinanderzuhalten — vier nebeneinander waeren zu klein. */
.runner-bilder {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; width: 100%; max-width: 520px;
}
@media (min-width: 900px) { .runner-bilder { grid-template-columns: repeat(4, 1fr); } }
.runner-bild {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px; cursor: pointer; font: inherit; color: var(--text);
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
}
.runner-bild:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.runner-bild:disabled { cursor: default; }
.runner-bild .staff-bg { width: 100%; padding: 2px; }
.runner-bild svg { width: 100% !important; height: auto !important; display: block; }
.runner-bild-sym { font-size: 15px; font-weight: 700; }
.runner-bild.richtig { border-color: var(--success); background: var(--success-soft); }
.runner-bild.falsch  { border-color: var(--danger);  background: var(--danger-soft); }
.runner-bild.aus     { opacity: .4; }

/* Rückmeldung nach einer durchgespielten Progression */
.prog-runde {
  margin-left: auto; font-size: 12px; opacity: 0;
  transition: opacity .25s; white-space: nowrap;
}
.prog-runde.gut  { color: var(--success); font-weight: 600; }
.prog-runde.teil { color: var(--muted); }
.rhythm-wertung { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 18px; }
.rhythm-wertung .prog-runde { margin-left: 0; }

/* ── Freischaltungen ───────────────────────────────────────────────────────── */

/* Die Meldung schwebt über allem: sie soll auch dann ankommen, wenn man gerade
   im Karten-Runner sitzt und der Rhythmus-Tab weit weg ist. */
.belohnung-melder {
  position: fixed; top: 70px; right: 16px; z-index: 60;
  max-width: 320px; pointer-events: none;
  opacity: 0; transform: translateY(-8px);
  transition: opacity .35s, transform .35s;
}
.belohnung-melder.an { opacity: 1; transform: translateY(0); }
.belohnung-box {
  background: var(--card); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 12px 14px;
  box-shadow: var(--shadow-floating);
}
.belohnung-kopf {
  font-size: 13px; font-weight: 700; color: var(--accent2);
  margin-bottom: 8px;
}
.belohnung-zeile { display: flex; gap: 9px; align-items: flex-start; margin-bottom: 6px; }
.belohnung-icon { font-size: 15px; line-height: 1.3; flex-shrink: 0; }
.belohnung-text { display: flex; flex-direction: column; font-size: 13px; }
.belohnung-text span { font-size: 11px; color: var(--muted); }

/* Zähler am Profil-Reiter */
.profil-punkt {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; margin-left: 5px;
  border-radius: 8px; background: var(--accent); color: var(--on-accent);
  font-size: 10px; font-weight: 700;
}

/* Schatzkammer: Gesperrtes steht mit dabei — wer nicht sieht, was es noch gibt,
   hat auch keinen Grund, es zu wollen. */
.schatz-liste { display: flex; flex-direction: column; gap: 4px; }
.schatz {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px;
  background: var(--surface); border: 1px solid var(--border);
  opacity: .5;
}
.schatz.frei { opacity: 1; border-color: var(--success-border); background: var(--success-soft); }
.schatz-icon { font-size: 15px; width: 20px; flex-shrink: 0; }
.schatz-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.schatz-text strong { font-size: 13px; }

/* ── Auskunft beim Hovern über die Seitenleiste ────────────────────────────── */
/* Eingeklappt steht dort nur ein Symbol. Ein `title`-Attribut täte es nicht:
   es kommt erst nach einer Sekunde, kann keine zwei Zeilen und sieht in jedem
   Browser anders aus. */

.modul-tip {
  position: fixed; z-index: 70; width: 260px;
  padding: 11px 13px;
  background: var(--card); border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-floating);
  opacity: 0; pointer-events: none;
  transform: translateX(-6px);
  transition: opacity .13s, transform .13s;
}
.modul-tip.an { opacity: 1; transform: translateX(0); }
.modul-tip-name  { font-size: 14px; font-weight: 700; color: var(--accent2); margin-bottom: 5px; }
.modul-tip-zweck { font-size: 12px; color: var(--text); line-height: 1.55; }
.modul-tip-fuss  {
  font-size: 11px; color: var(--muted); margin-top: 8px;
  padding-top: 7px; border-top: 1px solid var(--border);
}

/* Am Telefon liegt die Leiste quer — dort wäre ein Panel neben dem Knopf falsch
   platziert und im Weg. */
@media (max-width: 600px) { .modul-tip { display: none; } }

/* ── Konto ────────────────────────────────────────────────────────────────── */
.konto-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-width: 360px; }
.konto-form input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.konto-form input:focus { border-color: var(--accent); }

.sync-status { margin-top: 6px; min-height: 1.5em; }
.sync-status[data-status="ok"]      { color: var(--success); }
.sync-status[data-status="fehler"],
.sync-status[data-status="offline"] { color: var(--warn); }

a.btn { text-decoration: none; display: inline-block; font-weight: 500; line-height: normal; }
