/* Teilnehmer-Oberfläche im Stil von andronik.ai – Tokens kommen aus /static/shared/tokens.css */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 400 16px/1.6 var(--font); color: var(--text); background: var(--bg);
  min-height: 100dvh; overflow-x: hidden; -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
.hidden { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.page-dither { position: fixed; right: 0; bottom: 0; width: min(560px, 70vw); z-index: 0; color: var(--accent); opacity: 0.22; pointer-events: none; transition: opacity 0.6s; }
.page-dither .dither { position: static; width: 100%; height: auto; opacity: 1; }
body.in-interview .page-dither { opacity: 0.08; }

/* ---- Kopfzeile -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px;
  padding: 16px clamp(16px, 2.4vw, 32px); background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.15rem; letter-spacing: -0.02em; color: var(--deep-blue); margin-right: auto; }
:root[data-theme="dark"] .brand { color: var(--text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand { color: var(--text); } }
.brand-mark { width: 24px; height: 24px; color: var(--accent); }
.stepper { display: flex; gap: clamp(12px, 3vw, 28px); list-style: none; margin: 0; padding: 0; font: 400 0.78rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.stepper li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 2px solid transparent; transition: color 0.3s, border-color 0.3s; }
.stepper .sq { width: 7px; height: 7px; border: 1px solid currentColor; border-radius: 1px; }
.stepper li.active { color: var(--text); border-bottom-color: var(--accent); }
.stepper li.active .sq, .stepper li.done .sq { background: var(--accent); border-color: var(--accent); }
.stepper li.done { color: var(--muted); }
@media (max-width: 560px) { .stepper li span:not(.sq) { display: none; } .stepper li.active span { display: inline; } }

/* ---- Layout ----------------------------------------------------------------------------- */
main { position: relative; z-index: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: clamp(24px, 7vh, 72px) clamp(16px, 2.4vw, 32px) 64px; }
.view { animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.eyebrow { margin: 0 0 18px; }
h1 { font-weight: 320; font-size: clamp(2.1rem, 6vw, 3.4rem); line-height: 1.06; letter-spacing: -0.035em; margin: 0 0 22px; }
h2 { font-weight: 400; letter-spacing: -0.02em; }
.lead { color: var(--muted); font-size: clamp(1.05rem, 2.2vw, 1.25rem); line-height: 1.6; margin: 0 0 36px; max-width: 34em; }
.intro { white-space: pre-line; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px; margin-top: 28px; }
.btn-lg { height: 52px; padding: 0 28px; }
.error { color: var(--danger); margin: 16px 0 0; min-height: 1.2em; }
.fine { color: var(--faint); font-size: 0.88rem; margin: 0; }
.text-link { margin-top: 14px; font: 400 0.75rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); padding: 6px 0; }
.text-link::after { content: " →"; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---- Code-Eingabe ----------------------------------------------------------------------- */
.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 76px)); gap: clamp(6px, 1.6vw, 12px); }
.otp input {
  width: 100%; aspect-ratio: 0.86; text-align: center; padding: 0;
  font: 400 clamp(1.5rem, 6vw, 2.2rem)/1 var(--mono); text-transform: uppercase;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-bottom-width: 3px;
  border-radius: 12px; outline: none; caret-color: var(--accent); transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.otp input:focus { border-color: var(--accent); background: var(--surface); transform: translateY(-2px); }
.otp input.filled { border-bottom-color: var(--accent); }
.otp.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---- Infos & Einwilligung --------------------------------------------------------------- */
.facts { list-style: none; margin: 0 0 32px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); }
.facts li { padding: 16px 16px 0 0; display: grid; gap: 6px; }
.facts strong { font-weight: 450; font-size: 1rem; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } .facts li { padding: 12px 0; border-bottom: 1px solid var(--border); grid-template-columns: 120px 1fr; align-items: baseline; } }

.tone-card.block { padding: 22px clamp(18px, 3vw, 28px) 24px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.mono-label.strong { color: var(--text); }
.consents { display: grid; gap: 2px; }
.consent { display: flex; gap: 14px; align-items: flex-start; padding: 12px 4px; cursor: pointer; border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.consent:last-child { border-bottom: 0; }
.consent input { position: absolute; opacity: 0; pointer-events: none; }
.consent .box { flex: none; width: 22px; height: 22px; margin-top: 2px; border-radius: 6px; border: 1.5px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; transition: background 0.2s, border-color 0.2s; }
.consent .box svg { width: 14px; height: 14px; stroke-width: 3; color: var(--surface); opacity: 0; transform: scale(0.4); transition: all 0.2s; }
.consent input:checked ~ .box { background: var(--accent); border-color: var(--accent); }
.consent input:checked ~ .box svg { opacity: 1; transform: none; }
.consent input:focus-visible ~ .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.consent .opt { font: 400 0.7rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin-left: 6px; }

.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode input { position: absolute; opacity: 0; }
.mode-card { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; }
.mode-card svg { width: 26px; height: 26px; color: var(--faint); }
.mode-card strong { display: block; font-weight: 500; }
.mode-card small { color: var(--faint); font-size: 0.85rem; }
.mode input:checked + .mode-card { border-color: var(--tone); box-shadow: inset 0 0 0 1px var(--tone); }
.mode input:checked + .mode-card svg { color: var(--tone); }
.mode input:focus-visible + .mode-card { outline: 2px solid var(--accent); outline-offset: 2px; }
.mic-check { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
#mic-bars { flex: 1; min-width: 0; width: 100%; height: 32px; }
.ok { color: var(--ok); }
@media (max-width: 520px) { .mode-switch { grid-template-columns: 1fr; } .mic-check { flex-wrap: wrap; } }

/* ---- Interview ---------------------------------------------------------------------------- */
main:has(.stage-wrap:not(.hidden)) { max-width: 820px; padding-top: 16px; }
.stage-wrap { display: flex; flex-direction: column; align-items: center; min-height: calc(100dvh - 110px); padding-bottom: 120px; animation: rise 0.6s both; }
.meta-row { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.live { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.live i { width: 7px; height: 7px; border-radius: 1px; background: var(--danger); animation: blink 1.4s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
.timer { font-variant-numeric: tabular-nums; }
.progress { width: 100%; height: 2px; background: var(--border); margin-top: 12px; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 1s linear; }

.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; width: 100%; padding-top: 16px; }
.orb-wrap { width: min(80vw, 380px); aspect-ratio: 1; }
.orb-wrap canvas { width: 100%; height: 100%; display: block; }
.who { margin: 8px 0 6px; color: var(--text); }
.status { color: var(--muted); font-size: 1.15rem; font-weight: 320; letter-spacing: -0.01em; min-height: 1.6em; margin: 0; }
.caption {
  max-width: 600px; margin: 22px 0 0; padding: 18px 22px; text-align: left; font-size: 1.1rem; font-weight: 350; line-height: 1.55;
  background: var(--surface-2); border-radius: var(--radius); border-left: 4px solid var(--accent); animation: rise 0.35s both;
}
.done-btn { margin-top: 10px; animation: rise 0.3s both; }

.composer { width: 100%; display: flex; gap: 8px; align-items: flex-end; margin-top: 18px; padding: 8px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border-strong); animation: rise 0.3s both; }
.composer:focus-within { border-color: var(--accent); }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; color: var(--text); font: inherit; font-size: 1.05rem; padding: 10px 12px; max-height: 180px; }
.composer .send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: var(--ink-fg); transition: background 0.2s; }
.composer .send:hover { background: var(--accent); }

.dock { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.dock-btn { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; color: var(--muted); font: 400 0.72rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; transition: background 0.2s, color 0.2s; }
.dock-btn svg { width: 17px; height: 17px; }
.dock-btn:hover { background: var(--surface-2); color: var(--text); }
.dock-btn[aria-pressed="true"] { background: var(--ink); color: var(--ink-fg); }
.dock-btn.danger:hover { background: var(--danger); color: #fff; }
@media (max-width: 480px) { .dock-btn span { display: none; } .dock-btn { width: 48px; justify-content: center; padding: 0; } }

/* ---- Ende ------------------------------------------------------------------------------- */
.end-card { padding: clamp(28px, 5vw, 48px); min-height: 360px; }
.end-card .lead { margin-bottom: 40px; }
.done-mark { width: 56px; height: 56px; margin-bottom: 28px; }
.done-mark svg { width: 100%; height: 100%; stroke-width: 2.4; }
.done-mark circle { stroke: var(--ok); stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw 0.8s 0.1s ease-out forwards; }
.done-mark path { stroke: var(--ok); stroke-dasharray: 36; stroke-dashoffset: 36; animation: draw 0.4s 0.75s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- Dialog ----------------------------------------------------------------------------- */
.sheet { border: 0; border-top: 6px solid var(--danger); border-radius: var(--radius); padding: 28px; max-width: 420px; width: calc(100% - 32px); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.sheet::backdrop { background: rgba(7, 24, 39, 0.4); backdrop-filter: blur(4px); }
.sheet h2 { margin: 0 0 8px; font-size: 1.6rem; font-weight: 320; letter-spacing: -0.03em; }
.sheet p:not(.eyebrow) { color: var(--muted); margin: 0 0 24px; }
.sheet .eyebrow { margin-bottom: 10px; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.danger-solid { background: var(--danger); color: #fff; }
.danger-solid:hover:not(:disabled) { background: var(--danger); color: #fff; filter: brightness(1.1); }

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

/* ---- Kopfhörer-Schalter, Rückmeldung --------------------------------------------------- */
.consent.headphones { margin-top: 14px; }
.consent.headphones small { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.feedback { position: relative; z-index: 1; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); text-align: left; display: grid; gap: 12px; }
.fb-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.scale { display: flex; gap: 6px; }
.scale button { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border-strong); background: transparent; color: var(--text); font: 400 0.85rem var(--mono); cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.scale button:hover { border-color: var(--accent); }
.scale button.on { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.fb-legend { display: flex; justify-content: space-between; color: var(--faint); font-size: 0.8rem; margin: 0; }
.feedback textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); padding: 10px 12px; font: inherit; resize: vertical; }
.feedback .btn { justify-self: start; }
