/* ============================================================
   LernArena — Design-System
   Ästhetik: "Arena Broadcast" — warmes Papier, tiefe Tinte,
   Arena-Orange als Signal. Light = Beamer-Modus (Default im Host).
   ============================================================ */

@font-face {
  font-family: 'Bricolage';
  src: url('/fonts/BricolageGrotesque.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: 'Schibsted';
  src: url('/fonts/SchibstedGrotesk.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: 'Spline Mono';
  src: url('/fonts/SplineSansMono.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #f6f1e7;
  --surface: #fffdf9;
  --surface-2: #f0e9db;
  --ink: #1b1710;
  --ink-2: #5c564a;
  --ink-3: #938b79;
  --line: #e4dccb;
  --accent: #e8500a;
  --accent-deep: #c34106;
  --accent-ink: #ffffff;
  --good: #0ca30c;
  --good-text: #006300;
  --code-bg: #241d12;
  --code-ink: #f3ecdc;
  --code-key: #ffb464;
  --opt-a: #2a78d6;  --opt-a-ink: #ffffff;
  --opt-b: #eda100;  --opt-b-ink: #241d12;
  --opt-c: #4a3aa7;  --opt-c-ink: #ffffff;
  --opt-d: #eb6834;  --opt-d-ink: #241d12;
  --shadow: 0 1px 2px rgba(27, 23, 16, 0.05), 0 8px 28px rgba(27, 23, 16, 0.07);
  --ring-ink: rgba(27, 23, 16, 0.045);
  --font-display: 'Bricolage', 'Avenir Next', system-ui, sans-serif;
  --font-body: 'Schibsted', system-ui, -apple-system, sans-serif;
  --font-mono: 'Spline Mono', ui-monospace, 'SF Mono', monospace;
}

[data-theme="dark"] {
  --bg: #141310;
  --surface: #201f1c;
  --surface-2: #2b2922;
  --ink: #f4efe4;
  --ink-2: #b7b09d;
  --ink-3: #7e7767;
  --line: #38352b;
  --accent: #ff6a1f;
  --accent-deep: #ff8145;
  --accent-ink: #1b1006;
  --good: #0ca30c;
  --good-text: #56cf56;
  --code-bg: #12110d;
  --code-ink: #e9e2cf;
  --code-key: #ffab5c;
  --opt-a: #3987e5;  --opt-a-ink: #ffffff;
  --opt-b: #c98500;  --opt-b-ink: #141310;
  --opt-c: #9085e9;  --opt-c-ink: #141310;
  --opt-d: #d95926;  --opt-d-ink: #141310;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 32px rgba(0, 0, 0, 0.45);
  --ring-ink: rgba(244, 239, 228, 0.05);
}

/* ---------- Basis ---------- */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: clip;
}

/* Arena-Atmosphäre: konzentrische Ringe + feines Korn */
.arena-rings {
  position: fixed;
  left: 50%;
  bottom: -42vh;
  width: 130vh;
  height: 130vh;
  transform: translateX(-50%);
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle at center,
    var(--ring-ink) 0 1.5px,
    transparent 1.5px 56px
  );
  -webkit-mask-image: radial-gradient(circle at center, #000 0%, transparent 72%);
  mask-image: radial-gradient(circle at center, #000 0%, transparent 72%);
  pointer-events: none;
  z-index: 0;
}
.grain {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
  z-index: 0;
}
[data-theme="dark"] .grain { opacity: 0.05; }

.shell {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 40px) 40px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Logo ---------- */

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
}
.logo .bolt {
  align-self: center;
  width: 0.62em;
  height: 0.86em;
  color: var(--accent);
  transform: translateY(0.02em);
}
.logo .l2 { color: var(--accent); }
.logo-lg { font-size: clamp(3rem, 9vw, 5.4rem); }
.logo-sm { font-size: 1.35rem; }

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0 18px;
}
.topbar .spacer { flex: 1; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip strong {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.08em;
}
.chip .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--good);
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.phase-badge.hot { background: var(--accent); color: var(--accent-ink); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 24px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-size: 1.05rem;
}
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn-ghost { background: transparent; }
.btn-sm { padding: 9px 16px; font-size: 0.88rem; border-radius: 11px; }

.icon-btn {
  width: 42px; height: 42px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
}

/* Sehr schmale Geräte (altes iPhone SE: 320px): Kopfzeile eindampfen */
@media (max-width: 400px) {
  .shell { padding-left: 12px; padding-right: 12px; }
  .topbar { gap: 8px; }
  .topbar .logo-sm { font-size: 1.02rem; }
  .chip { padding: 5px 10px; font-size: 0.76rem; gap: 6px; }
  .icon-btn { width: 34px; height: 34px; font-size: 0.9rem; }
}

/* ---------- Karten & Stage ---------- */

.stage { flex: 1; display: flex; flex-direction: column; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 3vw, 32px);
}

.card-flat { box-shadow: none; }

.kicker {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

h1, h2, .display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.muted { color: var(--ink-2); }
.tiny { font-size: 0.85rem; color: var(--ink-3); }

/* ---------- Frage-Darstellung ---------- */

.q-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.q-topic {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.q-prompt {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.6vw, 2rem);
  font-weight: 650;
  line-height: 1.35;
  margin-bottom: 18px;
  text-wrap: pretty;
}

/* Inline-Code: hebt Fachbegriffe hervor und bricht nie mittendrin um.
   Überlange Snippets scrollen intern, statt das Layout zu sprengen. */
.ic {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 1px 7px;
  border-radius: 7px;
  white-space: nowrap;
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  vertical-align: bottom;
}
.sql-block .ic { background: transparent; padding: 0; }

/* Erklärung: Kernsatz, Schritte, Falle */
.expl-kern {
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  font-weight: 700;
  line-height: 1.4;
  text-wrap: pretty;
}
.expl-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.expl-list li {
  position: relative;
  padding-left: 20px;
  line-height: 1.45;
  color: var(--ink-2);
  text-wrap: pretty;
}
.expl-list li strong { color: var(--ink); }
.expl-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--accent);
}
.expl-falle {
  margin-top: 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  line-height: 1.45;
  text-wrap: pretty;
}
.falle-badge {
  flex: none;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Beamer: Aufgabe links, Phasen-Inhalt rechts (Diskussion & Auflösung) */
.split-stage {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  align-items: start;
}
.split-stage > *,
.play-wrap > * { min-width: 0; }

/* In Spalten-Layouts darf die Code-Schrift nicht mit dem Viewport wachsen —
   die Spalte ist gedeckelt, sonst clasht eine lange WHERE-Zeile */
.split-stage .sql-block,
.play-wrap .sql-block {
  font-size: clamp(0.85rem, 1.25vw, 1.05rem);
}
@media (max-width: 980px) { .split-stage { grid-template-columns: 1fr; } }

.sql-block {
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: var(--font-mono);
  font-size: clamp(0.95rem, 1.7vw, 1.25rem);
  line-height: 1.65;
  border-radius: 14px;
  padding: 18px 22px;
  overflow-x: auto;
  white-space: pre;
  margin-bottom: 18px;
}
.sql-block .kw { color: var(--code-key); font-weight: 700; }

/* Find the Bug: SQL als anfassbare, nummerierte Zeilen */
.code-lines {
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: var(--font-mono);
  font-size: clamp(0.95rem, 1.7vw, 1.25rem);
  line-height: 1.6;
  border-radius: 14px;
  padding: 10px 8px;
  overflow-x: auto;
  margin-bottom: 18px;
}
.code-line {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-radius: 9px;
  border: 1.5px solid transparent;
  white-space: pre;
}
.code-line .ln {
  text-align: right;
  font-size: 0.75em;
  opacity: 0.45;
  user-select: none;
}
.code-line .kw { color: var(--code-key); font-weight: 700; }
.code-line.clickable { cursor: pointer; }
.code-line.clickable:hover { border-color: color-mix(in srgb, var(--code-ink) 35%, transparent); }
.code-line.marked { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.code-line.bug { border-color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.code-line .line-n {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85em;
  min-width: 26px;
  text-align: right;
  opacity: 0.9;
}
.code-line .line-check { color: var(--good); font-weight: 800; }

.data-table {
  border-collapse: collapse;
  font-size: clamp(0.85rem, 1.5vw, 1.05rem);
  margin-bottom: 18px;
  width: 100%;
  max-width: 640px;
}
.data-table caption {
  caption-side: top;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-3);
  padding-bottom: 6px;
  letter-spacing: 0.05em;
}
.data-table th {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85em;
  text-align: left;
  background: var(--surface-2);
  padding: 8px 14px;
  border: 1px solid var(--line);
}
.data-table td {
  padding: 7px 14px;
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.data-table td.null { color: var(--ink-3); font-style: italic; }

/* ---------- Antwortoptionen ---------- */

.opt-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
}
.opt-badge.sm { width: 30px; height: 30px; font-size: 0.9rem; border-radius: 9px; }
.opt-A .opt-badge, .opt-badge.b-A { background: var(--opt-a); color: var(--opt-a-ink); }
.opt-B .opt-badge, .opt-badge.b-B { background: var(--opt-b); color: var(--opt-b-ink); }
.opt-C .opt-badge, .opt-badge.b-C { background: var(--opt-c); color: var(--opt-c-ink); }
.opt-D .opt-badge, .opt-badge.b-D { background: var(--opt-d); color: var(--opt-d-ink); }

.opt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}
.opt-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  font-weight: 500;
  text-wrap: pretty;
}
.opt-tile.slim { padding: 10px 14px; border-radius: 13px; }
.opt-tile.correct {
  border-color: var(--good);
  box-shadow: 0 0 0 2px var(--good);
}
.opt-tile .check {
  margin-left: auto;
  color: var(--good-text);
  font-weight: 800;
  white-space: nowrap;
}

/* ---------- Fortschritt (Abstimmung läuft) ---------- */

.vote-progress { margin-top: 22px; }
.vote-progress .nums {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.vote-progress .big {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.track {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.track .fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  width: 0%;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Balken-Chart ---------- */

.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row {
  display: grid;
  grid-template-columns: 40px minmax(120px, 1fr) minmax(45%, 2fr) 76px;
  align-items: center;
  gap: 14px;
}
.bars.compact .bar-row { grid-template-columns: 40px 1fr 82px; }
.bar-row .opt-text {
  font-size: 0.98rem;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  background: var(--surface-2);
  border-radius: 0 6px 6px 0;
  height: 24px;
}
.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 0 4px 4px 0;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.opt-A .bar-fill { background: var(--opt-a); }
.opt-B .bar-fill { background: var(--opt-b); }
.opt-C .bar-fill { background: var(--opt-c); }
.opt-D .bar-fill { background: var(--opt-d); }
.bar-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.bar-num small { font-weight: 400; color: var(--ink-3); font-size: 0.8em; }

/* ---------- Stat-Tiles ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 20px;
}
.stat .label { font-size: 0.85rem; color: var(--ink-2); }
.stat .value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
}
.stat .value .unit { font-size: 0.55em; font-weight: 600; color: var(--ink-3); }
.stat.hot { border-color: var(--accent); }
.stat.hot .value { color: var(--accent); }

/* ---------- Flow / Meinungswanderung ---------- */

.flow-wrap { overflow-x: auto; }
.flow-svg { display: block; margin: 0 auto; max-width: 100%; }
.flow-svg text {
  font-family: var(--font-display);
  font-weight: 800;
  fill: var(--ink);
}
.flow-svg .flow-count {
  font-family: var(--font-body);
  font-weight: 700;
  fill: var(--ink-2);
}
.flow-svg .col-label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  fill: var(--ink-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- Host: Lobby ---------- */

.lobby-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: stretch;
}
@media (max-width: 860px) { .lobby-grid { grid-template-columns: 1fr; } }

.join-code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(4rem, 11vw, 7.5rem);
  letter-spacing: 0.14em;
  line-height: 1;
  color: var(--ink);
  margin: 8px 0 4px;
}
.join-url {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 1.6vw, 1.1rem);
  color: var(--ink-2);
  word-break: break-all;
}
#qr-box {
  background: #ffffff;
  border-radius: 16px;
  padding: 12px;
  display: inline-block;
  border: 1px solid var(--line);
}
#qr-box svg { display: block; }

.player-count {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.player-count .n {
  font-family: var(--font-display);
  font-size: clamp(3rem, 6vw, 4.5rem);
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.player-count .n.pop { animation: pop 0.4s ease; }

.q-picker { display: flex; flex-direction: column; gap: 8px; }
.q-group-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 6px;
}
.q-group-label:first-child { margin-top: 0; }
.q-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface);
}
.q-pick:hover { border-color: var(--ink-3); }
.q-pick input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.q-pick .t { font-weight: 700; }
.q-pick .s { font-size: 0.8rem; color: var(--ink-3); }

/* ---------- Host: Steuerleiste ---------- */

.dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.dock .info {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-2);
  padding: 0 10px;
  white-space: nowrap;
}
.dock-pad { height: 92px; }

/* ---------- Player ---------- */

.narrow { max-width: 520px; margin: 0 auto; width: 100%; }

/* Adaptives Schüler-Layout: schmal = eine Spalte, ab Tablet-Breite
   Frage links, Antworten rechts. Kein Geräte-Sniffing, nur Viewport. */
.play-head { margin-bottom: 16px; }
.play-wrap { display: grid; gap: 18px; }
.play-center {
  max-width: 560px;
  width: 100%;
  margin: max(4vh, 24px) auto 0;
}
.play-center.wide { max-width: 720px; }
.play-center h2 { font-size: clamp(1.5rem, 2.6vw, 2.2rem); }

@media (min-width: 900px) {
  .play-wrap {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 24px;
    align-items: start;
  }
  .play-answers { position: sticky; top: 24px; }
  .opt-btn { padding: 18px 20px; font-size: 1.12rem; }
  .conf-btn { padding: 14px 8px; font-size: 0.95rem; }
}

/* Knappe Bildschirmhöhe (z.B. iPad quer): oben Luft rausnehmen,
   Antwort-Spalte verdichten, damit die Sicherheits-Buttons nie
   unter die Kante rutschen. */
@media (min-width: 900px) and (max-height: 1080px) {
  .shell { padding-top: 8px; padding-bottom: 24px; }
  .topbar { padding: 0 0 8px; }
  .topbar .logo-sm { font-size: 1.15rem; }
  .icon-btn { width: 36px; height: 36px; font-size: 0.95rem; }
  .play-head { margin-bottom: 8px; }
  .play-wrap { gap: 16px; }
  .play-answers { gap: 8px; }
  .play-answers .opt-btn { padding: 12px 16px; font-size: 1.02rem; }
  .conf-btn { padding: 10px 8px; font-size: 0.88rem; }
  .conf-card { padding: 12px 14px; }
  .play-q { padding: 16px 20px; }
  .play-q .q-head { margin-bottom: 8px; }
  .play-q .q-prompt {
    font-size: clamp(1.15rem, 1.9vw, 1.5rem);
    margin-bottom: 12px;
  }
  .play-q .sql-block {
    padding: 12px 16px;
    font-size: clamp(0.9rem, 1.4vw, 1.05rem);
    margin-bottom: 12px;
  }
  .play-q .data-table { font-size: clamp(0.82rem, 1.3vw, 0.95rem); }
  .play-q .data-table th { padding: 5px 12px; }
  .play-q .data-table td { padding: 4px 12px; }
}

/* Kompakter Runde-2-Hinweis (ersetzt die frühere dicke Karte) */
.r2-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 2px 4px 6px;
}
.r2-hint .tiny { font-weight: 700; }

.conf-card { padding: 16px 18px; }

.cd-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ---------- Powered by ---------- */

.powered {
  text-align: center;
  padding: 20px 0 2px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.powered a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}
.powered a:hover { color: var(--accent); border-color: var(--accent); }

.opt-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 15px 16px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
}
.opt-btn:active { transform: scale(0.98); }
.opt-btn.sel-A { border-color: var(--opt-a); box-shadow: 0 0 0 1.5px var(--opt-a); }
.opt-btn.sel-B { border-color: var(--opt-b); box-shadow: 0 0 0 1.5px var(--opt-b); }
.opt-btn.sel-C { border-color: var(--opt-c); box-shadow: 0 0 0 1.5px var(--opt-c); }
.opt-btn.sel-D { border-color: var(--opt-d); box-shadow: 0 0 0 1.5px var(--opt-d); }

.conf-row { display: flex; gap: 8px; }
.conf-btn {
  flex: 1;
  padding: 12px 8px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.conf-btn.sel {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent);
}

.reflect-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.reflect-btn.sel {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.big-icon { font-size: 3rem; line-height: 1; }

.pulse-ring {
  width: 86px; height: 86px;
  margin: 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--accent-ink);
  position: relative;
}
.pulse-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: pulse 1.8s ease-out infinite;
}
.pulse-ring svg { width: 38px; height: 38px; }

.verdict {
  border-radius: 16px;
  padding: 18px 20px;
  font-weight: 700;
  font-size: 1.1rem;
}
.verdict.ok { background: color-mix(in srgb, var(--good) 14%, var(--surface)); color: var(--good-text); }
.verdict.nope { background: var(--surface-2); color: var(--ink); }

.path-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 700;
}
.path-chip .arrow { color: var(--accent); font-weight: 800; }

/* ---------- Code-Eingabe (Landing) ---------- */

.code-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  text-align: center;
  padding: 14px 0;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.code-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.step .num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--accent);
}

/* ---------- Utility & Motion ---------- */

.stack { display: flex; flex-direction: column; gap: 18px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.center { text-align: center; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 18px; }
.hidden { display: none !important; }

.stagger > * { animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }
.stagger > *:nth-child(1) { animation-delay: 0.03s; }
.stagger > *:nth-child(2) { animation-delay: 0.09s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.21s; }
.stagger > *:nth-child(5) { animation-delay: 0.27s; }
.stagger > *:nth-child(6) { animation-delay: 0.33s; }
.stagger > *:nth-child(7) { animation-delay: 0.39s; }
.stagger > *:nth-child(8) { animation-delay: 0.45s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.22); }
  100% { transform: scale(1); }
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.65); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 640px) {
  .bar-row { grid-template-columns: 30px 1fr 60px; }
  .bar-row .opt-text { display: none; }
  .dock { width: calc(100% - 24px); justify-content: space-between; }
}
