/* Ilvuna: ruhig, grosse Schrift, hoher Kontrast. Jede Person hat ihre Farbe: Patient warm, Personal blau.
   Systemschriften, weil sie alle Schriften der Patientensprachen abdecken und nichts nachladen. */
:root {
  --bg: #f2f0ec; --fg: #14181c; --muted: #4c5258; --line: #cfcbc3; --flaeche: #ffffff;
  --pat: #8a3b12; --pat-hover: #743110; --pat-soft: #fbf1e4; --pat-line: #e7d3b8; --pat-on: #ffffff;
  --per: #0f4c75; --per-hover: #0c3f61; --per-soft: #e8f1f7; --per-line: #bdd3e2; --per-on: #ffffff;
  --ok: #17603a; --ok-soft: #e0f2e8; --warn: #8f1f1a; --warn-soft: #fbe6e3; --warn-line: #e5a9a2; --vorl: #7a5200;
  --schrift: 1; --grund: clamp(26px, 3.6vmax, 52px);
  --schatten: 0 1px 2px rgba(20, 24, 28, .12);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Ethiopic", "Noto Sans Tamil", "Noto Naskh Arabic", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --fg: #f1f2f3; --muted: #b3b8bd; --line: #3b4046; --flaeche: #1f2226;
    --pat: #e9a877; --pat-hover: #f2bb92; --pat-soft: #2a2019; --pat-line: #4f3b2b; --pat-on: #1c1209;
    --per: #8cc3e8; --per-hover: #a6d3f1; --per-soft: #18242d; --per-line: #2f4656; --per-on: #06141d;
    --ok: #7ad6a4; --ok-soft: #15291e; --warn: #f4a59d; --warn-soft: #351a18; --warn-line: #6e3a35; --vorl: #e3bb6a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font-size: 18px; line-height: 1.35; overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--per); outline-offset: 2px; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
.vorrat { position: absolute; width: 0; height: 0; }
.ic { width: 24px; height: 24px; fill: currentColor; flex: none; }
.ic.gross { width: 34px; height: 34px; }

/* Startseite */
.start { min-height: 100%; max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.start-kopf { display: flex; align-items: center; gap: 14px; }
.start-kopf img { border-radius: 14px; }
.start h1 { margin: 0; font-size: 1.9rem; line-height: 1.1; }
.start-kopf p { margin: 2px 0 0; color: var(--muted); }
.start-kopf .leitsatz { font-style: italic; }
.start h2 { margin: 8px 0 0; font-size: 1.35rem; }
.sprachen { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.sprache { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: start; padding: 22px 20px; min-height: 132px;
  background: var(--flaeche); border: 2px solid var(--per); border-radius: 18px; box-shadow: var(--schatten); }
.sprache:hover { background: var(--per-soft); }
.sprache b { font-size: 2rem; line-height: 1.1; color: var(--per); }
.sprache span { font-size: 1.05rem; }
.sprache small { color: var(--vorl); font-size: .9rem; }
.bald { margin: 0; color: var(--muted); }
.regeln { margin: auto 0 0; padding: 16px 0 0; list-style: none; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 1rem; }
.meldung { margin: 0; padding: 12px 16px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.meldung.fehler { background: var(--warn-soft); color: var(--warn); }
.code { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; }
.code label { grid-column: 1 / -1; font-weight: 600; }
.code input, .tipp input { min-height: 54px; min-width: 0; width: 100%; padding: 0 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--flaeche); }
.code button { min-height: 54px; padding: 0 22px; border: 0; border-radius: 12px; background: var(--per); color: var(--per-on); font-weight: 700; }

/* Gespräch: Hochformat übereinander, Querformat nebeneinander */
.gespraech { height: 100vh; height: 100dvh; display: grid; grid-template: auto minmax(0, 1fr) minmax(0, 1fr) / minmax(0, 1fr);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
@media (orientation: landscape) and (min-width: 700px) {
  .gespraech { grid-template: auto minmax(0, 1fr) / minmax(0, 1fr) minmax(0, 1fr); }
  .leiste { grid-column: 1 / -1; }
}
.leiste { display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: var(--flaeche); border-bottom: 1px solid var(--line); }
.marke { font-size: 1.05rem; }
.sprachname { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; font-weight: 600; }
.sprachname { flex: 0 1 auto; }
.sprachzeile { display: flex; flex-wrap: wrap; gap: 0 .45em; min-width: 0; }
.eigen::after { content: "·"; margin-inline-start: .45em; color: var(--muted); }
.sprachname small { color: var(--vorl); font-weight: 500; font-size: .78rem; }
.leiste-rechts { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.leiste button { min-height: 44px; min-width: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; border: 1px solid var(--line); border-radius: 10px; font-size: .95rem; }
.leiste .gruppe { display: inline-flex; }
.leiste .gruppe button:first-child { border-radius: 10px 0 0 10px; border-inline-end: 0; }
.leiste .gruppe button:last-child { border-radius: 0 10px 10px 0; }
.leiste .beenden { border-color: var(--warn); color: var(--warn); font-weight: 700; }
@media (max-width: 699px) {
  .marke, #bVerlauf span { display: none; }
  #bEinst { font-size: 0; padding: 0; width: 44px; }
  #bEinst::before { content: "⚙"; font-size: 22px; }
  .sprachname small, .eigen { display: none; }
  .leiste { gap: 8px; padding: 6px 8px; }
  .leiste-rechts { gap: 6px; }
  .leiste button { padding: 0 9px; }
}

.seite { min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; }
.patient { background: var(--pat-soft); --farbe: var(--pat); --farbe-hover: var(--pat-hover); --auf: var(--pat-on); --linie: var(--pat-line); }
.personal { background: var(--per-soft); --farbe: var(--per); --farbe-hover: var(--per-hover); --auf: var(--per-on); --linie: var(--per-line); }
.gespraech:not(.gedreht) .personal { border-block-start: 1px solid var(--line); }
@media (orientation: landscape) and (min-width: 700px) { .gespraech .personal { border-block-start: 0; border-inline-start: 1px solid var(--line); } }
.gedreht .patient { transform: rotate(180deg); }

.kopf { min-height: 24px; }
.wer { color: var(--farbe); font-weight: 700; font-size: 1rem; }
.anzeige { flex: 1 1 0; min-height: 60px; overflow-y: auto; display: flex; }
.text { margin: auto 0; width: 100%; font-size: calc(var(--grund) * var(--schrift) * var(--fit, 1)); line-height: 1.22; font-weight: 600; overflow-wrap: anywhere; }
.text.warte { color: var(--muted); font-weight: 500; }

.hilfen { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; }
.hilfe { min-height: 52px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; background: var(--flaeche); border: 2px solid var(--linie); border-radius: 12px; font-weight: 600; }
.hilfe:disabled { opacity: .45; }
.hilfe.ja { border-color: var(--ok); color: var(--ok); }
.hilfe.nein { border-color: var(--warn); color: var(--warn); }

.tasten { display: flex; gap: 8px; }
.mic { position: relative; flex: 1; min-height: 92px; display: flex; align-items: center; justify-content: center; gap: 12px; overflow: hidden;
  background: var(--farbe); color: var(--auf); border: 0; border-radius: 18px; font-size: 1.55rem; font-weight: 700; box-shadow: var(--schatten); }
.mic:hover:not(:disabled) { background: var(--farbe-hover); }
.mic:disabled { opacity: .35; }
.mic > *:not(.pegel) { position: relative; }
.pegel { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--pegel, 0)); background: rgba(255, 255, 255, .22); transition: transform 80ms linear; }
.mic.an { outline: 5px solid var(--farbe); outline-offset: 3px; animation: puls 1.3s ease-in-out infinite; }
.neben { min-height: 92px; min-width: 92px; padding: 8px 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--flaeche); color: var(--farbe); border: 2px solid var(--linie); border-radius: 18px; font-weight: 600; font-size: .95rem; }
.neben:disabled { opacity: .45; }
@keyframes puls { 50% { outline-offset: 7px; } }
@media (prefers-reduced-motion: reduce) { .mic.an { animation: none; } .pegel { transition: none; } }

/* Kontrolle für das Personal */
.kontrolle { padding: 8px 12px; border-radius: 12px; background: var(--flaeche); border: 1px solid var(--linie); }
.stand { margin: 0; font-weight: 600; font-size: .98rem; }
.stand.ok { color: var(--ok); }
.rueck { margin: 4px 0 0; color: var(--muted); font-size: .95rem; }
.rueckmeldung { margin: 0; padding: 8px 12px; border-radius: 12px; font-weight: 700; background: var(--ok-soft); color: var(--ok); }
.rueckmeldung.nein { background: var(--warn-soft); color: var(--warn); }
.warnung { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); border: 2px solid var(--warn-line); color: var(--warn); font-weight: 600; }
.warnung p { margin: 0; }
.warn-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.warn-knoepfe button { min-height: 48px; padding: 0 14px; background: var(--flaeche); border: 2px solid var(--warn-line); border-radius: 10px; color: var(--fg); font-weight: 600; }
.warn-knoepfe .stark { background: var(--warn); border-color: var(--warn); color: var(--flaeche); }
.tipp { display: flex; gap: 8px; }
.tipp .stark { min-height: 54px; padding: 0 18px; background: var(--per); color: var(--per-on); border: 0; border-radius: 12px; font-weight: 700; }

/* Blätter und Rückfrage */
dialog { color: var(--fg); background: var(--flaeche); border: 0; padding: 0; }
dialog::backdrop { background: rgba(10, 12, 14, .55); }
.blatt { width: min(760px, 100vw); max-width: 100vw; height: min(92dvh, 900px); max-height: 100dvh; border-radius: 18px; padding: 16px; overflow-y: auto; }
.blatt-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.blatt-kopf h2 { margin: 0; font-size: 1.35rem; }
.zu { min-height: 48px; padding: 0 16px; background: transparent; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; flex: none; }
.blatt-hinweis { margin: 8px 0 12px; color: var(--muted); }
.gruppe-titel { margin: 18px 0 8px; font-size: 1.05rem; color: var(--per); }
.satz { width: 100%; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; margin-bottom: 8px; min-height: 60px; text-align: start;
  background: var(--per-soft); border: 1px solid var(--per-line); border-radius: 12px; }
.satz b { font-size: 1.1rem; font-weight: 600; }
.satz span { color: var(--muted); font-size: .98rem; }
.bedarf { height: auto; }
.kacheln { display: grid; gap: 10px; margin-top: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.kachel { min-height: clamp(120px, 20vh, 190px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px;
  background: var(--pat-soft); border: 2px solid var(--pat-line); border-radius: 16px; font-size: 1.25rem; font-weight: 700; }
.kachel .bild { font-size: 3.2rem; line-height: 1; }
.eintrag { padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.eintrag.patient { background: var(--pat-soft); }
.eintrag.personal { background: var(--per-soft); }
.eintrag p { margin: 0; grid-column: 1; }
.eintrag .de { font-weight: 600; }
.eintrag .fremd { color: var(--muted); }
.eintrag button { grid-column: 2; grid-row: 1 / span 2; width: 52px; height: 52px; display: grid; place-items: center; background: var(--flaeche); border: 1px solid var(--line); border-radius: 12px; }
.schalter { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); margin-top: 8px; }
.schalter input { width: 26px; height: 26px; flex: none; }
.frage { width: min(460px, calc(100vw - 32px)); border-radius: 18px; padding: 20px; }
.frage h2 { margin: 0 0 6px; }
.frage p { margin: 0 0 16px; }
.frage-knoepfe { display: grid; gap: 10px; }
.frage-knoepfe button { min-height: 60px; border-radius: 14px; font-weight: 700; background: transparent; border: 2px solid var(--line); }
.frage-knoepfe .beenden-stark { background: var(--warn); border-color: var(--warn); color: var(--flaeche); }

/* Kleine Telefone: Knöpfe bleiben gross, Beschriftung rückt zusammen */
@media (max-width: 480px) {
  .leiste { gap: 6px; padding: 4px 6px; }
  .leiste-rechts { gap: 4px; }
  .leiste button { padding: 0 6px; min-width: 38px; font-size: .86rem; }
  #bEinst { width: 38px; }
  .sprachname { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mic { min-height: 74px; font-size: 1.3rem; }
  .neben { min-height: 74px; min-width: 66px; font-size: .82rem; padding: 4px; }
  .ic.gross { width: 28px; height: 28px; }
  .hilfe { min-height: 46px; padding: 0 10px; font-size: .92rem; }
  .hilfen { min-height: 46px; gap: 6px; }
  .seite { padding: 6px 8px 8px; gap: 6px; }
}
