:root {
  --bg: #faf7f5;
  --fg: #1d1b1a;
  --muted: #6b6560;
  --card: #fff;
  --line: #e4dedb;
  --accent: #b3261e;
  --accent-fg: #fff;
  --me: #fde8e6;
  --them: #fff;
  --sys: #eef1f5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161413;
    --fg: #f1ece9;
    --muted: #a39b96;
    --card: #211e1d;
    --line: #36312f;
    --accent: #e5564d;
    --accent-fg: #1a0a09;
    --me: #3b2220;
    --them: #262221;
    --sys: #1f2429;
  }
}
* { box-sizing: border-box; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
/* Fokusring bei Tastaturbedienung immer sichtbar; nur programmatischer Fokus per Maus/Touch bleibt ohne Ring */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1:focus:not(:focus-visible) { outline: none; }
html, body { height: 100%; margin: 0; }
/* dvh: sichtbarer Viewport auf Mobilgeräten (ohne Adressleiste), sonst scrollt die Seite zusätzlich zum Log */
body.app { height: 100dvh; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1; font-size: 1.1rem; margin: 0; text-align: center; }
.icon-btn {
  background: none; border: 0; color: var(--fg);
  font-size: 1.4rem; width: 44px; height: 44px; border-radius: 50%;
}
.icon-btn[hidden] { display: block; visibility: hidden; }
main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
section { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px; }
section[hidden] { display: none; }
.lead { color: var(--muted); margin: 0 0 14px; flex: none; }
a { color: var(--accent); }

/* nur die Fallliste scrollt – Einleitung und Modus behalten ihre Höhe */
.scenario-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; margin: 0 -6px; } /* Platz, damit der Fokusring nicht abgeschnitten wird */
.scenario-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mode {
  flex: none; display: flex; gap: 0; margin: 0 0 8px; padding: 0; min-width: 0;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.mode label { flex: 1; text-align: center; position: relative; }
.mode input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.mode span { display: block; padding: 10px; color: var(--muted); }
.mode input:checked + span { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.mode input:focus-visible + span { outline: 3px solid var(--fg); outline-offset: -5px; }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); margin: 0; }
.msg .who { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 1px; }
.msg.kollege { background: var(--sys); }
.msg.funk { background: var(--sys); border-style: dashed; font-family: ui-monospace, Menlo, monospace; font-size: .92rem; }
.msg.befund { font-style: italic; }
.group { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; }
.scenario-list section { padding: 0; display: block; }
.scenario-list section:first-child .group { margin-top: 10px; }
.scenario {
  display: flex; gap: 14px; align-items: center; text-align: left;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; font: inherit; width: 100%;
}
.scenario .letter {
  flex: none; width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; font-weight: 700; font-size: 1.2rem;
}
.scenario .letter.small { font-size: .9rem; }
.scenario small { display: block; color: var(--muted); }

.log { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 8px; padding: 0 0 8px; margin: 0; list-style: none; }
.msg { max-width: 85%; padding: 9px 13px; border-radius: 16px; border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--me); border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: var(--them); border-bottom-left-radius: 4px; }
.msg.sys { align-self: stretch; max-width: none; background: var(--sys); color: var(--muted); border-radius: 10px; font-size: .92rem; }
.msg.debrief { align-self: stretch; max-width: none; border-color: var(--accent); }
.msg.interim { opacity: .6; }

.status { min-height: 1.4em; color: var(--muted); font-size: .9rem; padding: 2px 4px; margin: 0; }
.status.error { color: var(--accent); }

.input-bar { display: flex; gap: 8px; align-items: center; }
.input-bar input[type=text] {
  flex: 1; min-width: 0; font: inherit; color: var(--fg); background: var(--card);
  border: 1px solid var(--line); border-radius: 24px; padding: 12px 16px;
}
.mic, .send {
  flex: none; width: 52px; height: 52px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-fg); font-size: 1.3rem;
}
.send { width: 44px; height: 44px; background: var(--card); color: var(--fg); border: 1px solid var(--line); }
.mic.listening { animation: pulse 1.1s infinite; }
@media (prefers-reduced-motion: reduce) { .mic.listening { animation: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }

.actions { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; }
.toggle { display: flex; gap: 8px; align-items: center; color: var(--muted); }
button.secondary { background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; font: inherit; }

dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--fg); width: min(92vw, 420px); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog h2 { margin-top: 0; }
dialog label { display: block; margin-bottom: 12px; font-size: .9rem; color: var(--muted); }
dialog input[type=url], dialog input[type=password], dialog input[type=text] {
  display: block; width: 100%; margin-top: 4px; font: inherit; color: var(--fg);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px;
}
dialog input[type=range] { width: 100%; }
dialog .field { margin-bottom: 12px; font-size: .9rem; color: var(--muted); }
dialog .field label { display: inline; margin: 0; }
.hint { font-size: .8rem; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 12px 0 0; }
button.primary { background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 10px; padding: 8px 16px; font: inherit; }

