/* Funkgerät: Gehäuse in Einheiten von --u (≈ 1 mm am echten Gerät, 61 × 133 mm), skaliert auf den Bildschirm */
:root {
  --bg: #0d1013; --text: #e7ecf0; --muted: #8d98a3; --accent: #e8590c;
  --u: min(calc(100dvh / 168), calc(100vw / 78), 5.6px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: radial-gradient(ellipse at 50% 30%, #1d242b 0%, var(--bg) 70%); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Registrierung ---------- */
.reg { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.reg-card { width: 100%; max-width: 420px; background: #161b21; border: 1px solid #28313a; border-radius: 20px; padding: 24px; text-align: center; }
.reg-head { display: flex; gap: 12px; align-items: center; text-align: left; margin-bottom: 20px; }
.reg-head b { display: block; font-size: 18px; } .reg-head span { color: var(--muted); font-size: 14px; }
.reg-label { color: var(--muted); margin: 0 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
.reg-code { font: 700 clamp(40px, 13vw, 58px)/1.1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .12em; padding: 16px 8px;
  background: #0b0e11; border: 2px dashed #3a4652; border-radius: 14px; color: #ffd8a8; margin-bottom: 16px; user-select: all; -webkit-user-select: all; }
.reg p { margin: 0 0 12px; }
.reg-net { color: var(--muted); font-size: 14px; }
.reg-net.ok { color: #8ce99a; }
.reg-install { text-align: left; color: var(--muted); font-size: 14px; border-top: 1px solid #28313a; padding-top: 12px; }
.reg-install summary { cursor: pointer; color: var(--text); }

/* ---------- Bühne ---------- */
.stage { min-height: 100%; display: flex; align-items: center; justify-content: center; gap: 32px; padding: max(8px, env(safe-area-inset-top)) 16px max(8px, env(safe-area-inset-bottom)); }
.beside { max-width: 300px; display: grid; gap: 12px; }
.who { font-size: 15px; color: var(--muted); } .who b { color: var(--text); display: block; font-size: 17px; }
.hint { font-size: 14px; color: #ffd8a8; min-height: 1em; }
.help-btn { background: #1d242b; border: 1px solid #2f3943; border-radius: 10px; padding: 8px 14px; justify-self: start; }
@media (max-width: 700px) {
  .stage { flex-direction: column; gap: 4px; justify-content: flex-start; }
  .beside { order: -1; max-width: none; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .who { font-size: 13px; } .who b { font-size: 14px; display: inline; } .hint { display: none; }
  .help-btn { padding: 4px 10px; font-size: 13px; }
  :root { --u: min(calc((100dvh - 44px) / 156), calc(100vw / 74), 5.6px); }
}

/* ---------- Gemeinsame Teile der Gehäuse (Typen: public/geraete/<typ>.css) ---------- */
.led { width: calc(1.8 * var(--u)); height: calc(1.8 * var(--u)); border-radius: 50%; background: #2b2f33; box-shadow: inset 0 0 calc(.5 * var(--u)) #000; flex: none; }
.led.green { background: #51cf66; box-shadow: 0 0 calc(2 * var(--u)) #51cf66; }
.led.red { background: #ff3b30; box-shadow: 0 0 calc(2 * var(--u)) #ff3b30; }
.led.blue { background: #339af0; box-shadow: 0 0 calc(2 * var(--u)) #339af0; }
.led.yellow { background: #fcc419; box-shadow: 0 0 calc(2 * var(--u)) #fcc419; }
.led.blink { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.bezel { background: #070809; border-radius: calc(2 * var(--u)); padding: calc(2 * var(--u)) calc(3.5 * var(--u)); box-shadow: inset 0 0 calc(1 * var(--u)) #000; }
.lcd-wrap { width: 100%; aspect-ratio: 176 / 220; position: relative; overflow: hidden; }
.lcd { position: absolute; left: 0; top: 0; width: 176px; height: 220px; transform-origin: 0 0; transform: scale(var(--s, 1)); }
.lcd.gedreht { transform: scale(var(--s, 1)) rotate(180deg) translate(-176px, -220px); }

/* Tasten vorne */
.k { border: 0; color: #f1f3f5; touch-action: none; display: grid; place-items: center; padding: 0; line-height: 1;
  background: linear-gradient(#3d4146, #24272b); box-shadow: 0 calc(.45 * var(--u)) 0 #000c, inset 0 calc(.25 * var(--u)) 0 #ffffff20; }
.k.down { transform: translateY(calc(.35 * var(--u))); box-shadow: 0 calc(.1 * var(--u)) 0 #000c; filter: brightness(1.3); }
.dpad { grid-area: dp; position: relative; justify-self: center; width: calc(17 * var(--u)); height: 100%;
  background: radial-gradient(circle, #1b1d20 32%, #2c3034 34%); border-radius: 50%; box-shadow: 0 calc(.4 * var(--u)) 0 #000c, inset 0 calc(.3 * var(--u)) 0 #ffffff18; }
.dpad .arrow { position: absolute; width: calc(6 * var(--u)); height: calc(5 * var(--u)); background: transparent; box-shadow: none; font-size: calc(2.2 * var(--u)); color: #ced4da; }
/* Position über data-k, nicht über Klassen: „down“ ist zugleich die Klasse für „gedrückt“ */
.dpad .arrow.down { filter: brightness(1.6); transform: none; }
.dpad [data-k="up"] { left: 50%; top: 0; translate: -50% 0; } .dpad [data-k="down"] { left: 50%; bottom: 0; translate: -50% 0; }
.dpad [data-k="left"] { left: 0; top: 50%; translate: 0 -50%; } .dpad [data-k="right"] { right: 0; top: 50%; translate: 0 -50%; }
.call { width: calc(9 * var(--u)); height: calc(5.5 * var(--u)); border-radius: calc(2.2 * var(--u)); justify-self: center; align-self: center; }
.call svg { width: calc(3.4 * var(--u)); height: calc(3.4 * var(--u)); }
.call.green { background: linear-gradient(#2fa84f, #1c7a37); } .call.green svg { fill: #fff; }
.call.red { background: linear-gradient(#e03131, #a51d1d); } .call.red svg { fill: #fff; transform: rotate(135deg); }
.pad { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: calc(1.4 * var(--u)) calc(3 * var(--u)); padding: calc(.6 * var(--u)) calc(3.5 * var(--u)) 0; }
.num { font: 600 calc(3.2 * var(--u))/1 Arial, Helvetica, sans-serif; grid-template-rows: auto auto; align-content: center; gap: calc(.2 * var(--u)); border-radius: calc(1.6 * var(--u)); }
.num small { font-size: calc(1.5 * var(--u)); color: #ced4da; font-weight: 400; min-height: 1em; }


/* ---------- Display: 176 × 220 Pixel, Aufbau nach den Bildschirmfotos im Handbuch ---------- */
.lcd svg { height: 13px; width: auto; flex: none; vertical-align: middle; }
.lcd { --d-bg: #fff; --d-fg: #000; --d-sb: #000; --d-sb-fg: #fff; --d-sk: #0b1a6e; --d-sk-fg: #fff; --d-sel: #1c7ed6; --d-sel-fg: #fff; --d-rand: #1d2a7a; --d-box: #fff; --d-dim: #555; --d-stl: #e8101e; --d-kopf: linear-gradient(#f8f9fa, #dee2e6);
  background: var(--d-bg); color: var(--d-fg); font: 14px/1.2 Tahoma, "Segoe UI", Arial, sans-serif; display: flex; flex-direction: column; overflow: hidden; }
.lcd.off { background: #050607; }
.lcd.gross { font-size: 18px; }
.sb { height: 16px; background: var(--d-sb); color: var(--d-sb-fg); display: flex; align-items: center; gap: 3px; padding: 0 3px; font-size: 11px; flex: none; }
.sb .sp { flex: 1; } .sb svg { height: 12px; width: auto; display: block; }
.l2 { display: flex; justify-content: space-between; padding: 1px 4px 0; font-size: 14px; line-height: 16px; flex: none; }
.stl { margin: 1px 3px 0; background: var(--d-stl); color: #fff; padding: 0 4px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; line-height: 18px; }
.home { flex: 1; padding: 2px 4px 0; min-height: 0; display: flex; flex-direction: column; gap: 1px; }
.row { display: flex; align-items: center; gap: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.grp { font-size: 17px; } .gross .row.grp { font-size: 22px; }
.row.kw { padding-left: 18px; }
.row svg { height: 14px; width: auto; flex: none; }
.sk { height: 18px; display: flex; justify-content: space-between; gap: 2px; flex: none; margin-top: auto; }
.sk span { background: var(--d-sk); color: var(--d-sk-fg); padding: 0 5px; line-height: 18px; font-size: 13px; min-width: 52px; }
.sk span:empty { background: transparent; }
.sk span:last-child { text-align: right; }
.sk.drei span { flex: 1; text-align: center; min-width: 0; }
/* Einblendung (Dialog) mit Rahmen über dem Grundbild */
.over { position: absolute; left: 3px; right: 3px; top: 34px; bottom: 21px; display: flex; flex-direction: column; }
.box { background: var(--d-box); border: 2px solid var(--d-rand); border-radius: 5px; box-shadow: 0 1px 3px #0006; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.box.voll { flex: 1; }
.box-t { text-align: center; border-bottom: 1px solid var(--d-rand); padding: 1px 4px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.box-l { padding: 1px 4px; display: flex; justify-content: space-between; gap: 4px; align-items: center; white-space: nowrap; }
.box-l svg { height: 13px; width: auto; }
.list { position: relative; overflow: hidden; flex: 1; min-height: 0; padding-right: 7px; }
.list > div { padding: 0 4px; display: flex; justify-content: space-between; gap: 4px; white-space: nowrap; line-height: 18px; height: 18px; }
.list > div > span { overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; }
.list > div > span svg { height: 13px; width: auto; flex: none; }
.list > div.sel { background: var(--d-sel); color: var(--d-sel-fg); }
.list > div.aus { color: #999; }
.list > div.ungelesen > span:first-child { font-weight: 700; }
.nr { border: 1px solid #1d2a7a; border-radius: 2px; padding: 0 2px; font-size: 11px; line-height: 13px; color: #1d2a7a; background: #e7ecff; align-self: center; }
.sel .nr { color: #fff; background: #1c7ed6; border-color: #fff; }
.sbar { position: absolute; right: 1px; top: 1px; bottom: 1px; width: 4px; background: #dfe3ea; border-radius: 2px; }
.sbar b { position: absolute; left: 0; right: 0; background: var(--d-rand); border-radius: 2px; }
/* Menü-Reiter */
.tabs { display: flex; align-items: center; gap: 1px; padding: 3px 1px 0; }
.tabs > i { font-style: normal; color: #1d2a7a; font-size: 10px; }
.tab { flex: 1; height: 24px; border: 1px solid #8a93a6; border-bottom: 0; border-radius: 5px 5px 0 0; background: linear-gradient(#fff, #d9dee8); display: grid; place-items: center; }
.tab svg { height: 16px; width: auto; }
.tab.sel { background: #fff; border-color: #1d2a7a; height: 27px; }
.tab-name { margin: 0 2px; border: 2px solid #1d2a7a; border-radius: 0 0 6px 6px; padding: 2px 5px; font-size: 15px; }
/* Gespräche */
.ruf-k { height: 16px; background: var(--d-kopf); border-bottom: 1px solid #adb5bd; display: flex; justify-content: space-between; align-items: center; padding: 0 4px; font-size: 13px; flex: none; }
.ruf { margin: 3px; }
.ruf .box-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.tx-mark { color: #e8101e; font-weight: 700; } .rx-mark { color: #1c7ed6; }
.warn svg { width: 100%; height: 100%; }
.ruf-k svg { height: 12px; }
.warn { position: absolute; left: 50%; top: 52%; translate: -50% -50%; width: 96px; height: 84px; opacity: .85; pointer-events: none; }
.text { padding: 2px 4px; white-space: pre-wrap; word-break: break-word; overflow: hidden; flex: 1; position: relative; }
.wahl { font-size: 26px; text-align: right; padding: 4px 6px; letter-spacing: 1px; border-bottom: 1px solid var(--d-dim); }
.wahl.lang { font-size: 18px; letter-spacing: 0; word-break: break-all; line-height: 1.15; }
.center { flex: 1; display: grid; place-items: center; text-align: center; padding: 6px; gap: 6px; align-content: center; }
.boot { background: #000; color: #fff; }
.boot .logo { font-size: 19px; font-weight: 700; white-space: nowrap; letter-spacing: -.3px; } .boot .logo span { color: #ff922b; }
.vol { position: absolute; left: 3px; top: 34px; width: 22px; bottom: 24px; background: var(--d-box); border: 2px solid var(--d-rand); border-radius: 4px; display: flex; flex-direction: column-reverse; padding: 2px; gap: 1px; }
.vol i { flex: 1; background: #dfe3ea; } .vol i.an { background: var(--d-sel); }
/* ---------- Hilfe ---------- */
.help { max-width: 560px; background: #161b21; color: var(--text); border: 1px solid #2f3943; border-radius: 16px; padding: 20px 24px; }
.help::backdrop { background: #000a; }
.help h2 { margin: 0 0 8px; }
.help dt { font-weight: 700; margin-top: 10px; } .help dd { margin: 2px 0 0; color: #ced4da; font-size: 15px; }
.help button { margin-top: 16px; background: var(--accent); border: 0; border-radius: 10px; padding: 10px 18px; color: #fff; font-weight: 700; }

/* Hauptmenü als Symbolraster 1–9 (Nds.-Konfiguration) */
.menu-t { margin: 3px 3px 0; border: 2px solid var(--d-rand); border-radius: 5px 5px 0 0; padding: 1px 6px; font-size: 14px; background: var(--d-kopf); }
.raster { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 3px; padding: 4px 6px; min-height: 0; }
.raster > div { position: relative; display: grid; place-items: center; border: 1px solid transparent; border-radius: 5px; }
.raster > div svg { height: 26px; width: auto; }
.raster > div span { position: absolute; right: 3px; bottom: 1px; font-size: 10px; color: var(--d-dim); }
.raster > div.sel { background: var(--d-sel); border-color: var(--d-rand); } .raster > div.sel span { color: #fff; }
.text.edit { font-size: 15px; } .cursor { display: inline-block; width: 1px; height: 15px; background: currentColor; vertical-align: -2px; animation: blink 1s steps(2, start) infinite; }

/* Halten der Ein-/Aus-Taste: Hintergrundbeleuchtung kommt langsam, Fortschritt unten; Countdown beim Ausschalten */
.aufwachen { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, #f1f3f5 0%, #9fb0c4 70%, #5b6b7d 100%); }
.halte-balken { position: absolute; left: 20px; right: 20px; bottom: 18px; height: 4px; background: #ffffff30; border-radius: 2px; }
.halte-balken b { display: block; height: 100%; background: #fff; border-radius: 2px; }
.countdown { font-size: 44px; font-weight: 700; text-align: center; line-height: 1.2; padding: 4px 0 6px; }

/* Alarmierung */
.alarm-k { height: 22px; background: #e8101e; color: #fff; font-weight: 700; letter-spacing: 4px; text-align: center; line-height: 22px; animation: alarm 0.7s steps(2, start) infinite; flex: none; }
.alarm-box { flex: 1; border-color: #e8101e; display: flex; flex-direction: column; min-height: 0; }
.alarm-stw { font-size: 19px; font-weight: 700; padding: 3px 5px 0; color: #c92a2a; line-height: 1.15; }
.alarm-ort { font-weight: 700; white-space: normal; }
.alarm-text { font-size: 13px; }
@keyframes alarm { 50% { background: #7a0000; } }
.alarm-box .alarm-ort { white-space: normal; overflow: visible; }
.alarm-box .alarm-fuss { display: flex; justify-content: space-between; margin-top: auto; font-size: 11px; color: var(--d-dim); }

/* Gemeinsame Ergänzungen für die Gerätetypen */
.sk-over { position: absolute; left: -3px; right: -3px; bottom: -21px; }
.box-l.trenn { border-top: 1px solid var(--d-rand); }
.dim { color: var(--d-dim); }
.sb-dmo { color: #ffd43b; font-size: 10px; }
.lcd.dunkel::after { content: ""; position: absolute; inset: 0; background: #000; opacity: .45; pointer-events: none; }
.led.orange { background: #ff922b; box-shadow: 0 0 calc(2 * var(--u)) #ff922b; }
/* Navigationsring mit OK (Typen C und Fahrzeug) */
.ring { position: relative; border-radius: 50%; background: radial-gradient(circle, #1b1d20 34%, #2c3034 36%); box-shadow: 0 calc(.4 * var(--u)) 0 #000c, inset 0 calc(.3 * var(--u)) 0 #ffffff18; flex: none; }
.ring .arrow { position: absolute; width: 30%; height: 28%; background: transparent; box-shadow: none; font-size: calc(2.2 * var(--u)); color: #ced4da; }
.ring .arrow.down { filter: brightness(1.6); transform: none; }
.ring [data-k="up"] { left: 50%; top: 0; translate: -50% 0; } .ring [data-k="down"] { left: 50%; bottom: 0; translate: -50% 0; }
.ring [data-k="left"] { left: 0; top: 50%; translate: 0 -50%; } .ring [data-k="right"] { right: 0; top: 50%; translate: 0 -50%; }
.ring .ok { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 38%; height: 38%; border-radius: 50%; font: 700 calc(2.1 * var(--u))/1 Arial, sans-serif; }
.ring .ok.down { translate: -50% -45%; }
.reg-install + .reg-install { margin-top: 12px; }
.reg-install a { color: #8cc4ff; }

/* ---------- Rückmeldung beim Drücken (für alle Gerätetypen) ---------- */
/* Gedrückte Taste: heller Rand, damit der Druck auch neben dem Finger sichtbar ist */
.radio [data-k].down { outline: 2px solid #ffe066; outline-offset: 2px; }
.dpad .arrow.down, .ring .arrow.down { outline: 0; color: #ffe066; filter: brightness(1.6) drop-shadow(0 0 4px #ffe066); }
/* Kleine Tasten am Rand des Gehäuses: größere, unsichtbare Trefferfläche */
.k-notruf, .k-oval, .k-side { position: relative; }
.k-notruf::after, .k-oval::after, .k-side::after { content: ""; position: absolute; inset: calc(-2.5 * var(--u)); }
.k-notruf::after { inset: calc(-4 * var(--u)) calc(-3 * var(--u)) calc(-1 * var(--u)); }
.k-side::after { inset: calc(-1 * var(--u)) calc(-1 * var(--u)) calc(-1 * var(--u)) calc(-4 * var(--u)); }
/* Schild über dem Finger: Name der Taste, bei Haltetasten ein Balken bis zum Auslösen */
.druck { position: fixed; z-index: 50; pointer-events: none; min-width: 64px; padding: 6px 12px 7px; border-radius: 10px;
  background: #11161bf2; border: 1px solid #ffe06699; box-shadow: 0 4px 16px #000a; text-align: center; display: grid; gap: 5px;
  font: 600 14px/1.15 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #fff; white-space: nowrap; }
.druck-bar { display: none; height: 5px; border-radius: 3px; background: #ffffff26; overflow: hidden; }
/* Balken erst nach kurzem Halten, damit normales Tippen ruhig bleibt */
.druck.halten .druck-bar { display: block; opacity: 0; animation: druck-da 0s .25s forwards; }
@keyframes druck-da { to { opacity: 1; } }
.druck-bar i { display: block; height: 100%; width: 100%; background: #ffe066; transform-origin: 0 50%; transform: scaleX(0); }
.druck.halten .druck-bar i { animation: druck-voll var(--ms) linear forwards; }
@keyframes druck-voll { to { transform: scaleX(1); } }
.druck.fertig { border-color: #69db7c; }
.druck.fertig .druck-bar i { background: #69db7c; animation: none; transform: scaleX(1); }
.antenna, .buchse { pointer-events: none; } /* Deko, soll Fingern an Notruf- und Nachbartasten nicht im Weg sein */
