/* ==========================================================================================
   Live-Übersetzung · Design-System
   Ruhig, hochwertig, gut lesbar. Systemschriften (Serif zum Lesen, Sans für Bedienung),
   keine externen Ressourcen. Hell = warmes Papier, Dunkel = tiefes Schwarz mit Bronze-Akzent.
   ========================================================================================== */

:root {
  --bg: #f5f3ee;
  --bg-2: #efece5;
  --surface: #ffffff;
  --surface-2: #f3f0ea;
  --surface-3: #e9e5dc;
  --line: #e1dcd2;
  --line-2: #d3cdc1;
  --text: #141519;
  --text-2: #45464c;
  --text-3: #85827a;
  --text-old: #6b6861;
  --accent: #96702f;
  --accent-2: #b08640;
  --accent-soft: rgb(150 112 47 / .11);
  --live: #d6363b;
  --live-soft: rgb(214 54 59 / .1);
  --ok: #2b8a57;
  --warn: #b5761b;
  --error: #c4343a;
  --shadow-sm: 0 1px 2px rgb(30 25 15 / .05);
  --shadow: 0 1px 2px rgb(30 25 15 / .04), 0 10px 30px -8px rgb(30 25 15 / .12);
  --shadow-lg: 0 24px 60px -12px rgb(30 25 15 / .28);
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --fs: 1.4rem;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI Variable Display', 'Segoe UI', system-ui, Roboto, sans-serif;
  --read: ui-serif, 'New York', 'Iowan Old Style', 'Charter', 'Source Serif 4', 'Source Serif Pro', 'Noto Serif', Georgia, serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #0b0c0f;
  --bg-2: #101115;
  --surface: #15171b;
  --surface-2: #1b1e23;
  --surface-3: #23262d;
  --line: #262930;
  --line-2: #33373f;
  --text: #f3f0e9;
  --text-2: #bdb9af;
  --text-3: #77746c;
  --text-old: #8d897f;
  --accent: #d4b178;
  --accent-2: #e2c48f;
  --accent-soft: rgb(212 177 120 / .13);
  --live: #ff5a5f;
  --live-soft: rgb(255 90 95 / .14);
  --ok: #58c88b;
  --warn: #e9b25c;
  --error: #ff6a6f;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow: 0 1px 2px rgb(0 0 0 / .35), 0 14px 34px -10px rgb(0 0 0 / .55);
  --shadow-lg: 0 30px 70px -12px rgb(0 0 0 / .7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0b0c0f;
    --bg-2: #101115;
    --surface: #15171b;
    --surface-2: #1b1e23;
    --surface-3: #23262d;
    --line: #262930;
    --line-2: #33373f;
    --text: #f3f0e9;
    --text-2: #bdb9af;
    --text-3: #77746c;
    --text-old: #8d897f;
    --accent: #d4b178;
    --accent-2: #e2c48f;
    --accent-soft: rgb(212 177 120 / .13);
    --live: #ff5a5f;
    --live-soft: rgb(255 90 95 / .14);
    --ok: #58c88b;
    --warn: #e9b25c;
    --error: #ff6a6f;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow: 0 1px 2px rgb(0 0 0 / .35), 0 14px 34px -10px rgb(0 0 0 / .55);
    --shadow-lg: 0 30px 70px -12px rgb(0 0 0 / .7);
    color-scheme: dark;
  }
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em; font-family: var(--display); }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
svg { flex: none; display: block; }
img { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent-soft); }

/* ---------- Bausteine ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 44px; padding: 0 1.15em;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
  font-weight: 600; font-size: .94rem; letter-spacing: -0.005em; text-decoration: none; white-space: nowrap;
  transition: background .18s, border-color .18s, color .18s, transform .12s var(--ease), box-shadow .18s;
}
.btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--text); border-color: var(--text); color: var(--bg); box-shadow: var(--shadow); }
.btn.primary:hover { background: color-mix(in srgb, var(--text) 88%, var(--bg)); }
.btn.live { background: var(--live); border-color: var(--live); color: #fff; box-shadow: 0 10px 24px -8px var(--live); }
.btn.live:hover { background: color-mix(in srgb, var(--live) 88%, #000); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { min-height: 36px; padding: 0 .95em; font-size: .86rem; }
.btn.big { min-height: 56px; padding: 0 1.7em; font-size: 1.02rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--text-2);
  transition: background .18s, color .18s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.filled { background: var(--surface-2); }

input[type=text], input[type=password], select, textarea {
  width: 100%; min-height: 48px; padding: .65em .95em;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
select {
  appearance: none; -webkit-appearance: none; padding-inline-end: 2.4em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2385827a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .85em center;
}
textarea { min-height: 6em; resize: vertical; line-height: 1.5; }
.field { display: grid; gap: .45em; }
.field > span, .label { font-size: .8rem; font-weight: 650; color: var(--text-2); letter-spacing: .01em; }
.field small { font-weight: 400; color: var(--text-3); font-size: .82rem; }

.eyebrow { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-3); font-size: .875rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 22px; display: grid; gap: 16px; align-content: start;
}

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.segmented button { min-height: 40px; padding: 0 .9em; border: 0; border-radius: 10px; background: transparent; font-weight: 600; font-size: .9rem; color: var(--text-2); white-space: nowrap; transition: background .18s, color .18s, box-shadow .18s; }
.segmented button:hover:not(:disabled) { color: var(--text); }
.segmented button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 2px 8px rgb(0 0 0 / .06); }
:root[data-theme='dark'] .segmented button[aria-pressed='true'] { background: var(--surface-3); }
.segmented button:disabled { opacity: .38; cursor: not-allowed; }

.switch { position: relative; width: 52px; height: 32px; flex: none; border-radius: 999px; border: 0; background: var(--line-2); transition: background .22s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / .25); transition: transform .22s var(--ease); }
.switch[aria-checked='true'] { background: var(--ok); }
.switch[aria-checked='true']::after { transform: translateX(20px); }
.switch:disabled { opacity: .4; }

.brand { display: inline-flex; align-items: center; gap: .6em; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--text); color: var(--bg); flex: none; }
.brand-mark svg { width: 18px; height: 18px; }

/* Toasts */
.toasts { position: fixed; z-index: 90; top: calc(16px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: .7em; padding: .8em 1.05em; border-radius: 14px;
  background: var(--text); color: var(--bg); font-size: .92rem; line-height: 1.4; box-shadow: var(--shadow-lg);
  animation: toast-in .3s var(--ease); pointer-events: auto;
}
.toast::before { content: ''; width: 8px; height: 8px; margin-top: .45em; border-radius: 50%; background: var(--accent-2); flex: none; }
.toast.error::before { background: var(--live); }
.toast.warn::before { background: var(--warn); }
.toast.ok::before { background: var(--ok); }
.toast.out { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }

/* Bottom-Sheet (am Desktop zentrierter Dialog) */
dialog.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0; padding: 0; border: 0;
  width: 100%; max-width: 100%; max-height: 90dvh; overflow: auto;
  border-radius: 28px 28px 0 0; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog.sheet[open] { animation: sheet-up .38s var(--ease); }
dialog.sheet::backdrop { background: rgb(6 6 8 / .5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade-in .3s ease; }
@keyframes sheet-up { from { transform: translateY(60px); opacity: .4; } }
@keyframes fade-in { from { opacity: 0; } }
.sheet-inner { padding: 10px 22px calc(26px + env(safe-area-inset-bottom)); display: grid; gap: 22px; }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto -6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font-size: 1.4rem; font-weight: 700; }
.sheet-head .sub { color: var(--text-3); font-size: .9rem; margin-top: .3em; }
@media (min-width: 640px) {
  dialog.sheet { inset: 0; margin: auto; max-width: 440px; height: fit-content; border-radius: 28px; }
  .grabber { display: none; }
}

@keyframes pulse { 50% { opacity: .25; } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.7); opacity: .5; } }

/* ==========================================================================================
   Startseite
   ========================================================================================== */
.home { min-height: 100dvh; display: grid; place-items: center; padding: 28px 20px; }
.home main { width: min(400px, 100%); display: grid; gap: 34px; }
.home h1 { font-size: 2.2rem; font-weight: 700; margin-top: 26px; }
.home .lead { color: var(--text-2); margin-top: .6em; font-size: 1.05rem; }
.codeform { display: grid; gap: 12px; }
.codeform input { font: 700 2rem/1 var(--mono); letter-spacing: .34em; text-indent: .34em; text-align: center; text-transform: uppercase; min-height: 72px; border-radius: 18px; }
.home .organiser { border-top: 1px solid var(--line); padding-top: 22px; font-size: .92rem; color: var(--text-3); }
.home .organiser a { color: var(--text-2); font-weight: 600; text-decoration: none; }
.home .organiser a:hover { color: var(--text); }

/* ==========================================================================================
   Publikum (Smartphone)
   ========================================================================================== */
.listen { min-height: 100dvh; }

.lt-head {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
}
.lt-head::after { content: ''; position: absolute; inset: 100% 0 auto; height: 26px; background: linear-gradient(var(--bg), transparent); opacity: .9; pointer-events: none; }
.lt-id { min-width: 0; display: grid; gap: 3px; }
.lt-id h1 { font-size: .95rem; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.status { display: inline-flex; align-items: center; gap: .5em; font-size: .7rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.live { color: var(--live); }
.status.live i { animation: breathe 1.8s ease-in-out infinite; }
.status.offline { color: var(--warn); }

.lang-seg { display: inline-flex; flex: none; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.lang-seg button { min-height: 34px; padding: 0 .95em; border: 0; border-radius: 999px; background: transparent; font-weight: 650; font-size: .86rem; color: var(--text-3); transition: background .2s, color .2s; }
.lang-seg button[aria-pressed='true'] { background: var(--text); color: var(--bg); }
.lang-btn { display: inline-flex; align-items: center; gap: .45em; flex: none; min-height: 40px; padding: 0 .8em 0 1em; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 650; font-size: .9rem; }
.lang-btn svg { width: 16px; height: 16px; color: var(--text-3); }

.lt-banner {
  position: sticky; top: calc(66px + env(safe-area-inset-top)); z-index: 29; margin: 0 16px;
  display: flex; align-items: center; justify-content: center; gap: .6em;
  padding: .6em 1em; border-radius: 12px; font-size: .86rem; font-weight: 600;
  background: color-mix(in srgb, var(--warn) 16%, var(--surface)); color: var(--text);
  animation: toast-in .3s var(--ease);
}
.lt-banner::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); animation: pulse 1s infinite; }

.lt-main { max-width: 38rem; margin: 0 auto; padding: 20px 22px calc(130px + env(safe-area-inset-bottom)); }

.lt-feed { font-family: var(--read); font-size: var(--fs); line-height: 1.52; letter-spacing: .003em; font-weight: 450; }
.lt-feed p {
  position: relative; margin: 0 0 .95em; color: var(--text-old);
  transition: color .6s ease; overflow-wrap: break-word; hyphens: manual;
}
.lt-feed p:nth-last-child(2) { color: var(--text-2); }
.lt-feed p:last-child { color: var(--text); }
.lt-feed p:last-child::before {
  content: ''; position: absolute; inset-block: .28em; inset-inline-start: -14px; width: 3px; border-radius: 2px; background: var(--accent);
  animation: fade-in .6s ease;
}
.lt-feed p.enter { animation: sentence-in .55s var(--ease); }
.lt-feed p.untranslated { font-style: italic; }
@keyframes sentence-in { from { opacity: 0; transform: translateY(10px); filter: blur(2px); } }

.lt-speaking { height: 30px; display: flex; align-items: center; gap: 6px; opacity: 0; transition: opacity .4s ease; }
.lt-speaking.on { opacity: 1; }
.lt-speaking i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: dot 1.3s ease-in-out infinite; }
.lt-speaking i:nth-child(2) { animation-delay: .16s; }
.lt-speaking i:nth-child(3) { animation-delay: .32s; }
@keyframes dot { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-5px); opacity: 1; } }

.lt-waiting { min-height: calc(100dvh - 260px); display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; padding: 0 8px; }
.lt-waiting h2 { font-family: var(--read); font-size: 1.85rem; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; color: var(--text); max-width: 18ch; text-wrap: balance; }
.lt-waiting p { color: var(--text-2); font-size: 1rem; max-width: 30ch; text-wrap: balance; }
.wave { display: flex; align-items: center; gap: 5px; height: 34px; margin-bottom: 10px; }
.wave i { width: 4px; height: 100%; border-radius: 3px; background: var(--accent); transform: scaleY(.25); opacity: .55; }
.wave.on i { animation: wave 1.2s ease-in-out infinite; opacity: 1; }
.wave.on i:nth-child(2) { animation-delay: .12s; }
.wave.on i:nth-child(3) { animation-delay: .24s; }
.wave.on i:nth-child(4) { animation-delay: .36s; }
.wave.on i:nth-child(5) { animation-delay: .48s; }
@keyframes wave { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }

.lt-jump {
  position: fixed; z-index: 31; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: .45em; min-height: 40px; padding: 0 1.1em;
  border: 0; border-radius: 999px; background: var(--text); color: var(--bg);
  font-weight: 650; font-size: .88rem; box-shadow: var(--shadow-lg); animation: toast-in .3s var(--ease);
}
.lt-jump svg { width: 16px; height: 16px; }

.lt-dock {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px));
  display: flex; align-items: center; gap: 4px; padding: 5px;
  border-radius: 999px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(20px); -webkit-backdrop-filter: saturate(1.6) blur(20px);
  box-shadow: var(--shadow-lg);
}
.dock-btn { display: inline-flex; align-items: center; gap: .5em; min-height: 48px; padding: 0 1.15em; border: 0; border-radius: 999px; background: transparent; font-weight: 650; font-size: .92rem; color: var(--text-2); white-space: nowrap; transition: background .2s, color .2s; }
.dock-btn:hover { background: var(--surface-2); color: var(--text); }
.dock-btn svg { width: 19px; height: 19px; }
.dock-btn[aria-pressed='true'] { background: var(--accent-soft); color: var(--text); }
.dock-btn[aria-pressed='true'] svg { color: var(--accent); }
.dock-btn:disabled { opacity: .4; }
.dock-sep { width: 1px; height: 22px; background: var(--line); }
.aa { font-family: var(--read); font-weight: 600; font-size: 1.05rem; letter-spacing: -0.02em; }

/* Einstellungen */
.setting { display: grid; gap: 10px; }
.size-preview { font-family: var(--read); color: var(--text); padding: 16px 18px; border-radius: 16px; background: var(--surface-2); line-height: 1.45; transition: font-size .2s var(--ease); min-height: 4.2em; display: flex; align-items: center; }
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.steps button { display: grid; place-items: center; min-height: 52px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); font-family: var(--read); font-weight: 600; color: var(--text-2); transition: border-color .18s, background .18s; }
.steps button[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); }
.switch-row b { font-weight: 650; }
.switch-row .hint { color: var(--text-3); font-size: .84rem; margin-top: 2px; }
.sheet-note { color: var(--text-3); font-size: .82rem; text-align: center; }

.lang-list { display: grid; gap: 10px; }
.lang-option { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 64px; padding: 12px 18px; border: 1.5px solid var(--line); border-radius: 18px; background: var(--surface); text-align: start; }
.lang-option .name { font-size: 1.25rem; font-weight: 650; }
.lang-option .tag { display: block; margin-top: 2px; font-size: .8rem; color: var(--text-3); }
.lang-option .check { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: transparent; }
.lang-option[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.lang-option[aria-pressed='true'] .check { background: var(--accent); border-color: var(--accent); color: var(--bg); }

/* Leinwand-Modus (?screen=1): große Untertitel für Beamer */
body.screen { background: #000; color: #fff; overflow: hidden; }
body.screen .lt-head, body.screen .lt-dock, body.screen .lt-jump, body.screen .lt-banner, body.screen .lt-speaking { display: none !important; }
body.screen .lt-main { max-width: none; padding: 0; }
body.screen .lt-feed {
  position: fixed; inset: auto 0 0 0; padding: 3vh 7vw 7vh;
  font-family: var(--display); font-size: clamp(28px, 4.2vw, 84px); line-height: 1.22; font-weight: 600; letter-spacing: -0.01em;
}
body.screen .lt-feed p { color: rgb(255 255 255 / .42); margin-bottom: .32em; }
body.screen .lt-feed p:last-child { color: #fff; }
body.screen .lt-feed p:last-child::before { display: none; }
body.screen .lt-waiting { min-height: 100dvh; }
body.screen .lt-waiting h2 { color: #fff; font-size: clamp(32px, 4vw, 72px); max-width: 24ch; }
body.screen .lt-waiting p { color: #999; font-size: clamp(16px, 1.6vw, 28px); }

/* ==========================================================================================
   Bühne
   ========================================================================================== */
.stage { min-height: 100dvh; background: var(--bg); }
.st-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  height: 68px; padding: 0 26px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(1.5) blur(16px); -webkit-backdrop-filter: saturate(1.5) blur(16px);
  border-bottom: 1px solid var(--line);
}
.st-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.st-titles { min-width: 0; display: grid; }
.st-titles h1 { font-size: 1.02rem; font-weight: 680; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-sub { font-size: .78rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.code-badge { font: 700 .86rem/1 var(--mono); letter-spacing: .16em; padding: .55em .75em; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.status-pill {
  display: inline-flex; align-items: center; gap: .55em; height: 34px; padding: 0 .95em;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: .78rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
}
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-pill.live { color: var(--live); background: var(--live-soft); border-color: transparent; }
.status-pill.live i { animation: breathe 1.8s ease-in-out infinite; }
.status-pill .timer { font: 650 .82rem/1 var(--mono); letter-spacing: .02em; color: var(--text-2); text-transform: none; }
.status-pill.live .timer { color: var(--live); }

.wrap { max-width: 1360px; margin: 0 auto; padding: 26px; }

/* Anlegen */
.setup { max-width: 1040px; margin: 3vh auto 0; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.setup-main { display: grid; gap: 22px; }
.setup .intro h2 { font-size: 2.1rem; font-weight: 720; }
.setup .intro p { color: var(--text-2); margin-top: .55em; font-size: 1.05rem; max-width: 46ch; }
.setup form { gap: 20px; padding: 26px; }
details.more { border-top: 1px solid var(--line); padding-top: 16px; }
details.more summary { cursor: pointer; color: var(--text-2); font-weight: 600; font-size: .92rem; list-style: none; display: flex; align-items: center; gap: .5em; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: '+'; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
details.more[open] summary::before { content: '–'; }
details.more > div { margin-top: 14px; }
.howto { display: grid; gap: 4px; padding: 22px; }
.howto ol { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 16px; counter-reset: step; }
.howto li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; counter-increment: step; }
.howto li::before { content: counter(step); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: .88rem; color: var(--text-2); }
.howto li b { display: block; font-weight: 650; }
.howto li span { color: var(--text-3); font-size: .9rem; }
.recent-list { display: grid; gap: 8px; }
.recent-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; font-weight: 600; transition: border-color .18s, transform .12s; }
.recent-list a:hover { border-color: var(--line-2); transform: translateY(-1px); }
.recent-list a span { color: var(--text-3); font: 600 .82rem var(--mono); letter-spacing: .1em; }

/* Steuerpult */
.console { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
.side { display: grid; gap: 18px; position: sticky; top: 94px; }
.maincol { display: grid; gap: 20px; min-width: 0; }
.qr-card { justify-items: center; text-align: center; gap: 14px; }
.qr-card .qr-frame { padding: 12px; border-radius: 20px; background: #fff; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .06); cursor: zoom-in; transition: transform .2s var(--ease); }
.qr-card .qr-frame:hover { transform: scale(1.015); }
.qr-card img { width: 210px; height: 210px; }
.qr-card .url { font: 600 .9rem/1.3 var(--mono); color: var(--text-2); word-break: break-all; }
.audience-count { display: flex; align-items: baseline; gap: 10px; }
.audience-count .total { font-family: var(--display); font-size: 2.6rem; font-weight: 720; line-height: 1; letter-spacing: -0.03em; }
.breakdown { display: flex; flex-wrap: wrap; gap: 6px; }
.breakdown span { padding: .25em .7em; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .8rem; font-weight: 600; color: var(--text-2); }
.link-list { display: grid; gap: 2px; margin: 0 -8px; }
.link-list a, .link-list button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 8px; border: 0; border-radius: 12px;
  background: transparent; text-align: start; text-decoration: none; font-weight: 600; font-size: .92rem; color: var(--text);
  transition: background .18s;
}
.link-list a:hover, .link-list button:hover { background: var(--surface-2); }
.link-list svg { width: 18px; height: 18px; color: var(--text-3); }
.link-list .danger { color: var(--error); }
.link-list .danger svg { color: var(--error); }
.link-list small { display: block; font-weight: 400; color: var(--text-3); font-size: .8rem; }

.live-card { gap: 20px; padding: 24px; transition: border-color .3s, box-shadow .3s; }
.live-card[data-state='live'] { border-color: color-mix(in srgb, var(--live) 45%, var(--line)); box-shadow: 0 0 0 4px var(--live-soft), var(--shadow); }
.lc-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.lc-state { display: flex; align-items: center; gap: 16px; min-width: 0; }
.lc-dot { position: relative; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); flex: none; }
.lc-dot svg { width: 22px; height: 22px; }
.live-card[data-state='live'] .lc-dot { background: var(--live); color: #fff; }
.live-card[data-state='live'] .lc-dot::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--live); animation: ring 1.8s ease-out infinite; }
.live-card[data-state='connecting'] .lc-dot { background: color-mix(in srgb, var(--warn) 20%, var(--surface-2)); color: var(--warn); }
.live-card[data-state='error'] .lc-dot { background: color-mix(in srgb, var(--error) 18%, var(--surface-2)); color: var(--error); }
@keyframes ring { from { transform: scale(.85); opacity: .8; } to { transform: scale(1.25); opacity: 0; } }
.lc-title { font-family: var(--display); font-size: 1.45rem; font-weight: 720; letter-spacing: -0.02em; }
.lc-sub { color: var(--text-3); font-size: .9rem; margin-top: 2px; }
.lc-meter { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.lc-mic { display: inline-flex; align-items: center; gap: .5em; font-size: .84rem; font-weight: 600; color: var(--text-2); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-mic svg { width: 16px; height: 16px; color: var(--text-3); }
.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--ok) 0%, var(--ok) 65%, var(--warn) 85%, var(--live) 100%); background-size: 100vw 100%; transition: width .07s linear; }
.lc-opts { display: grid; grid-template-columns: minmax(200px, 1fr) auto; gap: 14px; align-items: end; }
.manual { display: grid; gap: 10px; }
.guide { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-top: 16px; border-top: 1px dashed var(--line); color: var(--text-3); font-size: .86rem; }
.guide span { display: inline-flex; align-items: center; gap: .5em; }
.guide b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); font-size: .72rem; }

.board { padding: 0; gap: 0; overflow: hidden; }
.board-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.follow { display: inline-flex; align-items: center; gap: .5em; font-size: .84rem; color: var(--text-2); cursor: pointer; }
.follow input { accent-color: var(--accent); width: 16px; height: 16px; }
.board-scroll { overflow-x: auto; }
.board-head, .board-row { display: grid; grid-template-columns: 92px repeat(var(--cols, 2), minmax(240px, 1fr)); }
.board-head { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.board-head > div { padding: 11px 18px; font-size: .7rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.board-head > div b { color: var(--text); font-weight: 750; }
.board-body { max-height: min(56vh, 620px); overflow: auto; scroll-behavior: smooth; }
.board-row { border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); animation: fade-in .4s ease; }
.board-row > div { padding: 13px 18px; font-size: .98rem; line-height: 1.5; overflow-wrap: anywhere; }
.board-row > .time { font: 600 .75rem/1.95 var(--mono); color: var(--text-3); padding-inline-end: 0; white-space: nowrap; }
.board-row > div + div:not(.time), .board-head > div + div { border-inline-start: 1px solid color-mix(in srgb, var(--line) 65%, transparent); }
.board-row:last-child { background: var(--accent-soft); }
.board-row .interim { color: var(--text-3); }
.board-row .pending { color: var(--text-3); font-style: italic; }
.board-row .untranslated { font-style: italic; color: var(--warn); }
.board-empty { display: grid; place-items: center; gap: 6px; padding: 54px 18px; text-align: center; color: var(--text-3); }
.board-empty b { color: var(--text-2); font-weight: 650; }

.overlay { position: fixed; inset: 0; z-index: 100; background: #fff; color: #111; display: grid; place-items: center; text-align: center; padding: 4vh 4vw; cursor: zoom-out; animation: fade-in .25s ease; }
.overlay img { width: min(62vh, 78vw); height: auto; aspect-ratio: 1; margin: 0 auto; }
.overlay .big { font: 700 clamp(26px, 3.6vw, 56px)/1.15 var(--display); letter-spacing: -0.02em; margin-top: 3vh; }
.overlay .big span { display: block; font-weight: 500; color: #666; font-size: .62em; margin-top: .3em; letter-spacing: 0; }
.overlay .url { font: 650 clamp(18px, 2.2vw, 32px)/1.3 var(--mono); color: #333; margin-top: 2vh; }
.overlay .code { display: inline-block; font: 700 clamp(18px, 2vw, 28px)/1 var(--mono); letter-spacing: .14em; color: #777; margin-top: 1vh; }

/* ---------- Responsiv ---------- */
@media (max-width: 1100px) {
  .setup { grid-template-columns: 1fr; max-width: 620px; }
}
@media (max-width: 980px) {
  .console { grid-template-columns: 1fr; }
  .side { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .lc-opts { grid-template-columns: 1fr; }
  .wrap { padding: 16px; }
  .st-top { padding: 0 16px; }
  .st-sub, .code-badge { display: none; }
}
@media (max-width: 520px) {
  .lc-head .btn.big { width: 100%; }
  .board-head, .board-row { grid-template-columns: repeat(var(--cols, 2), minmax(200px, 1fr)); }
  .board-row > .time, .board-head > div:first-child { display: none; }
}

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