:root {
  --bg: #14101f;
  --bg-2: #1d1730;
  --surface: #241d3a;
  --surface-2: #2e2549;
  --border: #3b3160;
  --text: #f2eefb;
  --muted: #b3a9cf;
  --accent: #f5c542;
  --accent-ink: #2b1a00;
  --primary: #8b5cf6;
  --primary-ink: #fff;
  --good: #34c77b;
  --bad: #ef5a6f;
  --warn: #f0a33a;
  --info: #5aa9ef;
  --red-suit: #e0475b;
  --black-suit: #1b1b22;
  --card-bg: #fffdf7;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f3fc;
    --bg-2: #efeaf9;
    --surface: #ffffff;
    --surface-2: #f3eefc;
    --border: #ddd3f0;
    --text: #1f1733;
    --muted: #64597f;
    --primary: #6d3fe0;
    --accent: #a8650a;
    --accent-ink: #fff;
    --shadow: 0 6px 20px rgba(60, 30, 120, 0.12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, var(--bg-2), var(--bg));
  background-color: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; }
input[type="range"] { padding: 0; accent-color: var(--primary); }
input[type="checkbox"] { width: auto; accent-color: var(--primary); }

.page { max-width: 720px; margin: 0 auto; padding: 0 16px 48px; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 0 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
}
.topbar h1 { flex: 1; font-size: 1.15rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  font-size: 1.4rem; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.brand-dot { color: var(--accent); font-size: 1.4rem; width: 40px; text-align: center; }
main { display: flex; flex-direction: column; gap: 14px; }

.hero {
  background: linear-gradient(135deg, #3a2470, #23164a); color: #fff; border-radius: 20px; padding: 20px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px;
}
.hero h2 { margin: 0; font-size: 1.35rem; line-height: 1.3; }
.eyebrow { margin: 0; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; }
.hero-stats { display: flex; gap: 24px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.8rem; line-height: 1; }
.hero-stats span { color: #d6ccf5; font-size: .85rem; }

.section-title { margin: 12px 0 0; font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.section-title.red { color: var(--red-suit); }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tile {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: transform .1s;
}
.tile:not(:disabled):active { transform: scale(.98); }
.tile:disabled { opacity: .5; cursor: default; }
.tile-icon { font-size: 1.6rem; width: 40px; text-align: center; }
.tile-text { flex: 1; display: flex; flex-direction: column; }
.tile-text small { color: var(--muted); }

.btn {
  border: 1px solid var(--border); background: var(--surface); padding: 10px 16px; border-radius: 12px; cursor: pointer;
  font-weight: 600;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.good { background: var(--good); border-color: var(--good); color: #062b16; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.link { background: none; border: none; color: var(--accent); padding: 6px 0; font-weight: 500; }
.btn.wide { width: 100%; }
.btn.big { padding: 16px; font-size: 1.05rem; }
.hero .btn.primary { background: #f5c542; border-color: #f5c542; color: #2b1a00; }
.hero .eyebrow { color: #f5c542; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row select { width: auto; }
.grow { flex: 1; }
.center { text-align: center; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: .85rem; color: var(--muted); font-weight: 600; }
.field .row { gap: 8px; }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; }

.hint { color: var(--muted); margin: 0; }
.small, .hint.small { font-size: .85rem; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.ok-text { color: var(--good); margin: 0; }
.warn-text { color: var(--warn); margin: 0; }
.ok-text p, .warn-text p { margin: 2px 0; }
.counter { margin: 0; color: var(--muted); font-size: .85rem; text-align: center; }
.toast { background: var(--surface-2); border: 1px solid var(--border); padding: 10px 14px; border-radius: 12px; }

.badge { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.badge-ok { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }
.badge-warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge-bad { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }
.badge-info { background: color-mix(in srgb, var(--info) 20%, transparent); color: var(--info); }

.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .3s; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.steps button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.step-n {
  width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: var(--surface-2); border: 2px solid var(--primary);
}
.steps li.done .step-n { background: var(--good); border-color: var(--good); color: #062b16; }
.step-text { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.step-text small { color: var(--muted); }
.chev { color: var(--muted); font-size: 1.4rem; }

/* Spielkarten */
.pcard {
  position: relative; background: var(--card-bg); border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.35);
  border: 1px solid #d9d2c3; display: inline-grid; place-items: center; flex: none; font-family: Georgia, "Times New Roman", serif;
}
.pcard.red { color: var(--red-suit); }
.pcard.black { color: var(--black-suit); }
.pcard-sm { width: 38px; height: 54px; border-radius: 6px; }
.pcard-md { width: 70px; height: 100px; }
.pcard-lg { width: 110px; height: 156px; border-radius: 14px; }
.pcard-corner { position: absolute; top: 4px; left: 6px; font-size: .8rem; line-height: 1; text-align: center; font-weight: 700; }
.pcard-sm .pcard-corner { display: none; }
.pcard-center { font-size: 2.2rem; line-height: 1; }
.pcard-lg .pcard-center { font-size: 3.6rem; }
.pcard-sm .pcard-center { font-size: 1rem; position: absolute; bottom: 4px; }
.pcard-value { position: absolute; bottom: 4px; right: 6px; font-weight: 700; font-size: .8rem; }
.pcard-sm .pcard-value { position: absolute; top: 3px; left: 0; right: 0; text-align: center; font-size: .95rem; }
.pcard-lg .pcard-value { font-size: 1.1rem; }
.pcard-back { background: repeating-linear-gradient(45deg, #5b2d91, #5b2d91 6px, #44206f 6px, #44206f 12px); }
.card-inline { font-weight: 700; white-space: nowrap; }
.card-inline.red, td.red, .red { color: var(--red-suit); }

/* Eingabe */
.picker { display: flex; flex-direction: column; gap: 10px; }
.picker-suits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.suit-btn {
  display: flex; flex-direction: column; align-items: center; padding: 8px 0 6px; font-size: 1.8rem; line-height: 1.1;
  background: var(--card-bg); border: 2px solid transparent; border-radius: 12px; cursor: pointer;
}
.suit-btn small { font-size: .7rem; color: #555; font-family: system-ui; }
.suit-btn.red { color: var(--red-suit); }
.suit-btn.black { color: var(--black-suit); }
.suit-btn.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent); }
.picker-values { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.value-btn, .numpad-grid button {
  padding: 12px 0; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 700;
  font-size: 1.1rem; cursor: pointer;
}
.value-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.numpad { display: flex; flex-direction: column; gap: 8px; max-width: 360px; margin: 0 auto; width: 100%; }
.numpad-display { text-align: center; font-size: 2rem; font-weight: 800; min-height: 2.6rem; letter-spacing: .1em; }
.numpad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numpad-grid button { padding: 14px 0; font-size: 1.3rem; }
.numpad-grid button.ok { background: var(--primary); border-color: var(--primary); color: #fff; }
button:disabled { cursor: default; }

/* Fragen / Lernen */
.question, .intro { display: flex; flex-direction: column; gap: 14px; }
.q { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; }
.q p { margin: 0; font-size: 1.05rem; }
.q h2, .intro h2 { margin: 0; font-size: 1.8rem; }
.sub { color: var(--muted); margin: 0; }
.big-num { font-size: 3.6rem; font-weight: 900; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.intro.center { align-items: center; }
.intro.center p { margin: 0; }
.instruction { background: color-mix(in srgb, var(--primary) 15%, transparent); border-left: 3px solid var(--primary); padding: 10px 12px; border-radius: 8px; text-align: left; }
.code-line { font-family: ui-monospace, Menlo, monospace; color: var(--muted); }
.link-visual { display: flex; align-items: center; justify-content: center; gap: 16px; }
.link-part { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.link-plus { font-size: 1.6rem; color: var(--muted); }
.link-visual.small .big-num { font-size: 2.2rem; }
.station { margin: 0; padding: 8px 12px; background: var(--surface); border-radius: 10px; border: 1px dashed var(--border); }
.scene { font-style: italic; margin: 0; }
.hints { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hint-line { margin: 0; padding: 8px 12px; background: var(--surface); border-radius: 10px; width: 100%; }
.reveal { display: flex; flex-direction: column; gap: 12px; }
.reveal h2 { margin: 0; }
.feedback { border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; border: 2px solid var(--border); }
.feedback h3 { margin: 0; }
.feedback p { margin: 0; }
.feedback.correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.feedback.slow, .feedback.hinted { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.feedback.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.solution { display: flex; flex-direction: column; gap: 8px; }
.flash-ok { animation: flashok .25s; }
.flash-bad { animation: flashbad .25s; }
@keyframes flashok { from { background: color-mix(in srgb, var(--good) 30%, transparent); } }
@keyframes flashbad { from { background: color-mix(in srgb, var(--bad) 30%, transparent); } }
.seq-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.seq-slot { width: 44px; height: 60px; border-radius: 8px; border: 1px dashed var(--border); display: grid; place-items: center; color: var(--muted); }
.seq-slot.ok { border: 2px solid var(--good); }
.seq-slot.bad { border: 2px solid var(--bad); }

.done-box { display: flex; flex-direction: column; gap: 12px; text-align: center; padding: 12px 0; }
.done-box h2, .done-box h3 { margin: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; align-items: center; }
.stat strong { font-size: 1.6rem; }
.stat span { font-size: .8rem; color: var(--muted); }
.stat.good strong { color: var(--good); }
.stat.bad strong { color: var(--bad); }

/* Listen */
.lex-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lex-row {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.lex-key { min-width: 38px; text-align: center; }
.num { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.lex-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lex-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.scene-preview { font-style: italic; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; }
.lex-code { font-family: ui-monospace, Menlo, monospace; color: var(--muted); font-size: .85rem; }
.editor, .scene-editor, .card-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.editor, .scene-editor { margin-top: 6px; background: var(--surface-2); }
.card-box h3 { margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: .9rem; }
.chip:disabled { opacity: .45; text-decoration: line-through; }
.suggestions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.suggestion {
  width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
.suggestion small { color: var(--accent); font-weight: 700; text-transform: uppercase; font-size: .7rem; letter-spacing: .06em; }
.ai-box { display: flex; flex-direction: column; gap: 8px; }
.palace-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.stations { margin: 0; padding-left: 22px; color: var(--muted); font-size: .9rem; }
.stations .more { list-style: none; margin-left: -22px; }
.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }

.boxbar { display: flex; flex-direction: column; gap: 6px; }
.boxbar-track { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.boxbar-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .75rem; color: var(--muted); }
.legend::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; background: currentColor; }
.box-1 { --c: #ef5a6f; } .box-2 { --c: #f0833a; } .box-3 { --c: #f0c03a; } .box-4 { --c: #b6d84a; }
.box-5 { --c: #5cc77b; } .box-6 { --c: #3fb3a8; } .box-7 { --c: #5a8def; }
.boxbar-seg { background: var(--c); }
.legend.box-1::before, .legend.box-2::before, .legend.box-3::before, .legend.box-4::before,
.legend.box-5::before, .legend.box-6::before, .legend.box-7::before { background: var(--c); }
.daychart { display: flex; align-items: flex-end; gap: 4px; height: 90px; padding: 8px; background: var(--surface); border-radius: 12px; border: 1px solid var(--border); }
.daycol { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.daybar { width: 100%; background: linear-gradient(var(--accent), var(--primary)); border-radius: 4px 4px 0 0; min-height: 2px; }
.daycol small { font-size: .65rem; color: var(--muted); }

/* Methode */
.prose { line-height: 1.6; }
.prose h2 { font-size: 1.2rem; margin: 24px 0 8px; color: var(--accent); }
.prose h3 { font-size: 1rem; margin: 16px 0 6px; }
.prose .lead { font-size: 1.05rem; }
.prose ul { padding-left: 20px; }
.examples { columns: 2; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 8px 0; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td small { color: var(--muted); }

@media (max-width: 420px) {
  .picker-values { grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .value-btn { padding: 10px 0; font-size: 1rem; }
  .big-num { font-size: 3rem; }
  .prose table { font-size: .8rem; }
}

/* PoC: Sync-Anzeige */
.boot { text-align: center; color: #b3a9cf; padding-top: 30vh; font-family: system-ui, sans-serif; }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.sync-dot.sync-ok { background: var(--good); }
.sync-dot.sync-off { background: var(--bad); }
.sync-dot.sync-busy { background: var(--warn); }
.sync-code { font-family: ui-monospace, Menlo, monospace; font-size: 1.4rem; letter-spacing: .12em; text-align: center; margin: 0; padding: 10px; background: var(--surface-2); border-radius: 10px; user-select: all; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; }

/* Sprache */
.mic-wrap { display: inline-flex; flex-direction: column; gap: 2px; }
.btn.mic.rec { border-color: var(--bad); color: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.recorder { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.rec-time { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rec-time small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.rec-time.over { color: var(--bad); }

/* Präsentationscoach */
.coach-hero { background: linear-gradient(135deg, #5b2340, #2b1a4a); }
.hero-list { margin: 0; padding-left: 18px; color: #e5dcf7; font-size: .92rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.tab { flex: none; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; font-size: .9rem; }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.script-text { line-height: 1.75; font-size: 1.05rem; }
.script-text p { margin: 0 0 10px; }
.mark { display: inline-block; font-size: .78rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin: 0 2px; vertical-align: 1px; line-height: 1.5; }
.mark.pause { background: color-mix(in srgb, var(--info) 22%, transparent); color: var(--info); }
.mark.pause.long { background: color-mix(in srgb, var(--info) 38%, transparent); }
.mark.audience { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good); }
.mark.action { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.emph { color: var(--accent); }
.legend-line { line-height: 1.9; }
.changes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.diff { display: flex; flex-direction: column; gap: 2px; }
.diff del { color: var(--bad); }
.diff ins { color: var(--good); text-decoration: none; }
.regie li { padding: 4px 0; }
.cue { background: var(--surface); border: 1px dashed var(--border); border-radius: 12px; padding: 10px 12px; }
.cue small { color: var(--muted); }
.outline li { padding: 6px 0; font-size: 1.05rem; }
.outline .hidden-line { color: var(--muted); }
.quote { font-style: italic; color: var(--muted); }
.alternatives { padding-left: 18px; }
.alternatives li { margin: 6px 0; }
details summary { cursor: pointer; color: var(--muted); }

/* Admin */
.voice-row { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.voice-pick li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.voice-pick audio { height: 32px; max-width: 220px; }
