:root {
  --grund: #0B110F;
  --flaeche: #15201C;
  --linie: #2A3A34;
  --text: #F7F5F0;
  --leise: #A9B5AF;
  --holz: #C8A16E;
  --tanne: #1E3B33;
  --gruen: #5FD08A;
  --gelb: #F2C14E;
  --rot: #FF6B57;
  --radius: 22px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--grund);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(30, 59, 51, 0.55), transparent 60%),
    var(--grund);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.app {
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: grid;
  gap: clamp(12px, 2.4vmin, 24px);
  grid-template-areas: "kopf" "anzeige" "knoepfe" "info";
  grid-template-rows: auto 1fr auto auto;
  max-width: 1600px;
  margin: 0 auto;
}

/* Querformat (Auto-Display): Anzeige links, Knöpfe rechts. */
@media (orientation: landscape) and (min-width: 700px) {
  .app {
    grid-template-columns: 1.4fr 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "kopf kopf" "anzeige knoepfe" "info info";
  }
}

.kopf { grid-area: kopf; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.marke { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: clamp(20px, 3.2vmin, 30px); }
.untertitel { color: var(--leise); font-size: clamp(16px, 2.4vmin, 22px); }
.chip {
  margin-left: auto;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--linie);
  font-size: clamp(15px, 2.2vmin, 20px);
  color: var(--leise);
}
.chip.gut { color: var(--gruen); border-color: rgba(95, 208, 138, 0.5); }
.chip.schlecht { color: var(--rot); border-color: rgba(255, 107, 87, 0.6); }

.anzeige {
  grid-area: anzeige;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: clamp(18px, 3.5vmin, 36px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(14px, 2.8vmin, 28px);
}

.status { display: flex; align-items: center; gap: 16px; }
.status p { margin: 0; font-size: clamp(24px, 4.6vmin, 46px); font-weight: 650; line-height: 1.15; }
.punkt { flex: none; width: clamp(16px, 2.6vmin, 24px); aspect-ratio: 1; border-radius: 50%; background: var(--leise); }
.status[data-zustand="aktiv"] .punkt { background: var(--gruen); box-shadow: 0 0 0 0 rgba(95, 208, 138, 0.6); animation: puls 1.6s infinite; }
.status[data-zustand="aufnahme"] .punkt { background: var(--rot); animation: puls-rot 1s infinite; }
.status[data-zustand="wiedergabe"] .punkt { background: var(--holz); }
.status[data-zustand="fehler"] .punkt { background: var(--rot); }

@keyframes puls { 70% { box-shadow: 0 0 0 16px rgba(95, 208, 138, 0); } 100% { box-shadow: 0 0 0 0 rgba(95, 208, 138, 0); } }
@keyframes puls-rot { 50% { opacity: 0.35; } }

.fehler {
  margin: 0;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(255, 107, 87, 0.12);
  border: 1px solid rgba(255, 107, 87, 0.5);
  color: #FFD3CC;
  font-size: clamp(18px, 2.9vmin, 26px);
  line-height: 1.35;
}

.pegel {
  position: relative;
  height: clamp(54px, 11vmin, 110px);
  border-radius: 16px;
  background: #0A0F0D;
  border: 1px solid var(--linie);
  overflow: hidden;
}
.pegel-balken {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--gruen) 0%, var(--gruen) 62%, var(--gelb) 82%, var(--rot) 100%);
  clip-path: inset(0 100% 0 0);
}
.pegel-spitze {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 4px; margin-left: -2px;
  background: var(--text);
  opacity: 0;
  transition: left 80ms linear, opacity 300ms;
}
.pegel-skala {
  position: absolute; inset: auto 12px 6px 12px;
  display: flex; justify-content: space-between;
  font-size: clamp(12px, 1.8vmin, 16px);
  color: rgba(247, 245, 240, 0.55);
  pointer-events: none;
}

.pegel-zeile { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.db { font-variant-numeric: tabular-nums; font-size: clamp(22px, 4vmin, 40px); font-weight: 600; }
.signal { font-size: clamp(18px, 3vmin, 28px); color: var(--leise); }
.signal.ja { color: var(--gruen); font-weight: 650; }

.knoepfe { grid-area: knoepfe; display: grid; gap: clamp(12px, 2.4vmin, 22px); align-content: stretch; }

.knopf {
  appearance: none;
  border: 2px solid var(--linie);
  background: var(--flaeche);
  color: var(--text);
  border-radius: var(--radius);
  min-height: clamp(72px, 14vmin, 140px);
  padding: 12px 20px;
  font: inherit;
  font-size: clamp(24px, 4.4vmin, 42px);
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 120ms ease, background-color 200ms, border-color 200ms, opacity 200ms;
}
.knopf:active:not(:disabled) { transform: scale(0.97); }
.knopf:focus-visible { outline: 4px solid var(--holz); outline-offset: 3px; }
.knopf:disabled { opacity: 0.38; cursor: default; }
.knopf.haupt { background: var(--holz); border-color: var(--holz); color: #17201C; }
.knopf.haupt.an { background: transparent; color: var(--holz); }
.knopf.laeuft { border-color: var(--rot); color: var(--rot); }
.knopf.klein { min-height: 56px; font-size: clamp(18px, 2.6vmin, 22px); padding: 10px 18px; }

.info {
  grid-area: info;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 4px 20px;
  font-size: clamp(17px, 2.6vmin, 22px);
}
.info summary { cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--leise); list-style-position: inside; }
.info[open] { padding-bottom: 18px; }
.info dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 4px 0 18px; }
.info dt { color: var(--leise); }
.info dd { margin: 0; overflow-wrap: anywhere; }
.auswahl { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.auswahl select {
  font: inherit; color: var(--text); background: #0A0F0D;
  border: 1px solid var(--linie); border-radius: 12px; padding: 12px 14px; min-height: 52px; max-width: 100%;
}

/* ---------- Gespräch ---------- */
a.chip { text-decoration: none; }
.agent .anzeige { justify-content: flex-start; min-height: 0; }
.agent .knoepfe { align-content: center; }
.pegel.duenn { height: 14px; border-radius: 7px; flex: none; }
.status[data-zustand="hoert"] .punkt { background: var(--gruen); animation: puls 1.6s infinite; }
.status[data-zustand="spricht"] .punkt { background: var(--holz); animation: puls-holz 1.2s infinite; }
@keyframes puls-holz { 70% { box-shadow: 0 0 0 16px rgba(200, 161, 110, 0); } 0% { box-shadow: 0 0 0 0 rgba(200, 161, 110, 0.6); } }

.verlauf {
  list-style: none; margin: 0; padding: 0;
  flex: 1 1 auto; min-height: 120px; max-height: 52vh;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  font-size: clamp(20px, 3.4vmin, 32px); line-height: 1.3;
  scroll-behavior: smooth;
}
.verlauf li { max-width: 92%; padding: 10px 16px; border-radius: 16px; }
.verlauf li.ich { align-self: flex-end; background: #0A0F0D; border: 1px solid var(--linie); color: var(--leise); }
.verlauf li.agent { align-self: flex-start; background: rgba(200, 161, 110, 0.12); border: 1px solid rgba(200, 161, 110, 0.35); }
.verlauf li.hinweis { align-self: center; color: var(--leise); font-size: 0.75em; padding: 2px 8px; }
.knopf.stop { background: transparent; border-color: var(--rot); color: var(--rot); }
.knopf.aktiv { border-color: var(--gelb); color: var(--gelb); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
