@font-face {
  font-family: "Atkinson Hyperlegible";
  font-weight: 700;
  font-style: normal;
  font-display: block;
  src: url("../assets/fonts/atkinson-hyperlegible-700.woff2") format("woff2");
}

:root {
  --bg: #101114;
  --card: #1b1d22;
  --line: #2c2f36;
  --text: #eceef2;
  --muted: #9aa0ab;
  --accent: #ffcc00;
  --accent-text: #1a1400;
  --danger: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.screen { display: none; }
.screen.active { display: block; }

/* ---------- Therapeutenbereich ---------- */

#menu {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

.top { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.top h1 { margin: 0; font-size: 28px; }
.top .sub { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 14px; font-size: 19px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label, .field .label { display: block; color: var(--muted); margin-bottom: 6px; font-size: 15px; }
.field output { color: var(--text); font-weight: 600; margin-left: 6px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row select { flex: 1; min-width: 200px; }

input[type=text], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: #0e0f12;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
}
input[type=range] { width: 100%; accent-color: var(--accent); height: 32px; }

button {
  font: inherit;
  color: var(--text);
  background: #2a2d35;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
}
button:active { transform: scale(0.98); }
button.primary {
  display: block;
  width: 100%;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  font-size: 21px;
  font-weight: 700;
  padding: 18px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
button.danger { color: var(--danger); }
button.link { background: none; border: none; color: var(--muted); padding: 4px; text-decoration: underline; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.segmented button { border: none; border-radius: 0; background: transparent; padding: 10px 22px; }
.segmented button.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }

.toggle { display: flex; align-items: center; gap: 12px; padding: 6px 0; cursor: pointer; }
.toggle input { width: 24px; height: 24px; accent-color: var(--accent); }

.ex-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.ex {
  text-align: left;
  padding: 14px 16px;
  background: #0e0f12;
}
.ex.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.ex .stufe { display: block; font-size: 13px; color: var(--accent); margin-bottom: 2px; }
.ex .title { display: block; font-weight: 700; font-size: 18px; }
.ex .desc { display: block; font-size: 14px; color: var(--muted); margin-top: 4px; }

.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 4px 24px; }

.note { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

.summary h2 { color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { background: #0e0f12; border-radius: 10px; padding: 10px 12px; }
.stat .v { font-size: 24px; font-weight: 700; display: block; }
.stat .k { font-size: 13px; color: var(--muted); }

.region { margin-top: 18px; }
.region h3 { margin: 0 0 10px; font-size: 16px; }
.region-grid { display: grid; gap: 8px; max-width: 520px; }
.region-cell {
  --rate: 0;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  background: color-mix(in srgb, var(--accent) calc(var(--rate) * 70%), #0e0f12);
  color: var(--text);
  min-height: 72px;
}
.region-cell .v { display: block; font-size: 20px; font-weight: 700; }
.region-cell .k { display: block; font-size: 13px; opacity: 0.85; }
.region-cell.empty-cell { background: transparent; border: 1px dashed var(--line); }

.log-list { margin-bottom: 14px; }
.log-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.log-item:last-child { border-bottom: none; }
.log-item .meta { color: var(--muted); }
.empty { color: var(--muted); }

.foot { color: var(--muted); font-size: 14px; text-align: center; margin-top: 10px; }

/* ---------- Patientenansicht ---------- */

#stage {
  position: fixed;
  inset: 0;
  background: #000;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;   /* iPad: kein Menü beim langen Drücken */
  cursor: none;
}
#stage canvas, #rating-bar { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
#stage.active { display: block; }
#canvas { display: block; width: 100%; height: 100%; }

/* Rückmeldung für die Beenden-Geste, erscheint erst nach 1 s Halten */
#exit-hint {
  position: absolute;
  top: 18px; left: 18px;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 3px solid #555;
  opacity: 0;
  pointer-events: none;
}
#exit-hint.holding { animation: exit-hold 3s linear forwards; }
@keyframes exit-hold {
  0%, 33% { opacity: 0; transform: scale(0.6); }
  100% { opacity: 1; transform: scale(1); border-color: #aaa; }
}

/* ---------- Inhalte ---------- */
#inhalte-liste details { border-top: 1px solid var(--line); padding: 8px 0; }
#inhalte-liste summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.inhalte-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 8px; }
.inhalt { display: flex; align-items: center; gap: 10px; background: #0e0f12; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.inhalt canvas { width: 52px; height: 52px; border-radius: 6px; cursor: pointer; flex: none; }
.inhalt .name { flex: 1; cursor: pointer; }
.inhalt.aus canvas, .inhalt.aus .name { opacity: 0.3; text-decoration: line-through; }
.inhalt .snd { display: flex; gap: 4px; align-items: center; }
.inhalt .snd button { padding: 6px 10px; font-size: 15px; }
.inhalt .snd button.rec { color: var(--danger); }
.inhalt .eigen { font-size: 12px; color: var(--accent); }
.note.warn { color: var(--danger); font-size: 16px; margin: 0 0 10px; }
.verlauf { font-size: 15px; color: var(--text); }

/* ---------- Bewertungsleiste (Benennen) ---------- */
#rating-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; gap: 8px; justify-content: center; padding: 8px;
  background: #0b0b0b;
}
#rating-bar[hidden] { display: none; }
#rating-bar button { background: #1c1c1c; color: #8a8a8a; border: 1px solid #2a2a2a; padding: 12px 18px; font-size: 16px; }
