/* 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); }
}

/* ---------- Gehäuse (nach „Bedienelemente“ im Sepura-Handbuch) ---------- */
.radio { position: relative; width: calc(61 * var(--u)); height: calc(133 * var(--u)); margin-top: calc(20 * var(--u)); margin-left: calc(6 * var(--u)); flex: none; }
.body { position: absolute; inset: 0; border-radius: calc(7 * var(--u)) calc(7 * var(--u)) calc(13 * var(--u)) calc(13 * var(--u)) / calc(7 * var(--u)) calc(7 * var(--u)) calc(18 * var(--u)) calc(18 * var(--u));
  background: linear-gradient(90deg, #111315 0%, #26292d 6%, #1f2225 50%, #26292d 94%, #111315 100%);
  box-shadow: 0 calc(3 * var(--u)) calc(10 * var(--u)) #000b, inset 0 calc(.5 * var(--u)) 0 #ffffff12, inset 0 calc(-1 * var(--u)) calc(2 * var(--u)) #0008;
  padding: calc(2.5 * var(--u)) calc(4 * var(--u)) calc(6 * var(--u)); display: flex; flex-direction: column; gap: calc(1.6 * var(--u)); }
/* Oben: Drehknopf links, Notruftaste am Fuß der Antenne, Antenne rechts */
.knob { position: absolute; left: calc(13 * var(--u)); top: calc(-11 * var(--u)); width: calc(11 * var(--u)); height: calc(12 * var(--u));
  border-radius: calc(2 * var(--u)) calc(2 * var(--u)) 0 0;
  background: repeating-linear-gradient(90deg, #15171a 0 calc(.7 * var(--u)), #3a3e43 calc(.7 * var(--u)) calc(1.4 * var(--u)));
  box-shadow: inset 0 calc(1 * var(--u)) calc(1 * var(--u)) #ffffff18; cursor: ns-resize; touch-action: none; overflow: hidden; }
.knob::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: calc(1.6 * var(--u)); background: #2c3034; }
.knob-mark { position: absolute; top: 0; bottom: 0; width: calc(1 * var(--u)); background: #dee2e6; left: 50%; opacity: .7; transition: left .08s; }
.k-notruf { position: absolute; left: calc(29 * var(--u)); top: calc(-2.6 * var(--u)); width: calc(6 * var(--u)); height: calc(3 * var(--u));
  border: 0; border-radius: calc(1 * var(--u)) calc(1 * var(--u)) 0 0; background: linear-gradient(#ffa94d, #e8590c); box-shadow: inset 0 calc(-.5 * var(--u)) 0 #0005; touch-action: none; padding: 0; }
.antenna { position: absolute; left: calc(37 * var(--u)); top: calc(-19 * var(--u)); width: calc(9 * var(--u)); height: calc(20 * var(--u));
  border-radius: calc(4.5 * var(--u)) calc(4.5 * var(--u)) calc(1 * var(--u)) calc(1 * var(--u)); background: linear-gradient(90deg, #0b0c0d, #2a2d30 45%, #101112); }
/* Links: Schnellwahltaste DMO/TMO über der langen, gerillten PTT */
.side { position: absolute; left: calc(-5 * var(--u)); top: calc(22 * var(--u)); display: flex; flex-direction: column; gap: calc(2.5 * var(--u)); align-items: flex-end; }
.k-side { width: calc(5 * var(--u)); height: calc(8 * var(--u)); border: 0; border-radius: calc(1.5 * var(--u)) 0 0 calc(1.5 * var(--u)); background: linear-gradient(90deg, #1b1d20, #33373b); touch-action: none; padding: 0; }
.k-ptt { width: calc(6 * var(--u)); height: calc(30 * var(--u)); border: 0; border-radius: calc(2.5 * var(--u)) 0 0 calc(2.5 * var(--u)); padding: 0;
  background: repeating-linear-gradient(0deg, #25282c 0 calc(1.6 * var(--u)), #34383d calc(1.6 * var(--u)) calc(2.2 * var(--u))); box-shadow: inset calc(.5 * var(--u)) 0 0 #ffffff10; touch-action: none; }
.k-ptt.down, .k-side.down, .k-oval.down, .k-notruf.down { filter: brightness(1.6); }
/* Vorne oben: Mode-Taste | Schriftzug | Taste „verpasste Ereignisse“, LEDs außen */
.face-top { display: flex; align-items: center; justify-content: space-between; gap: calc(1.5 * var(--u)); height: calc(5 * var(--u)); padding: 0 calc(.5 * var(--u)); }
.brand { flex: 1; text-align: center; font: 700 calc(3 * var(--u))/1 "Arial Rounded MT Bold", "Helvetica Neue", Arial, sans-serif; color: #e9ecef; letter-spacing: -.02em; }
.k-oval { width: calc(9 * var(--u)); height: calc(3.2 * var(--u)); border: 0; border-radius: 50%; background: linear-gradient(#55595e, #2a2d31); box-shadow: 0 calc(.4 * var(--u)) 0 #000a; touch-action: none; padding: 0; }
.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); }
/* Kontexttasten (klein, rund) außen, 4-Wege-Wippe in der Mitte, grün/rot darunter */
.nav { display: grid; grid-template-columns: 1fr 2.4fr 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: "cl dp cr" "gr dp rd";
  height: calc(16 * var(--u)); gap: calc(.8 * var(--u)) calc(1.2 * var(--u)); margin-top: calc(.6 * var(--u)); }
.ctx { width: calc(6 * var(--u)); height: calc(4 * var(--u)); border-radius: calc(2 * var(--u)); justify-self: center; align-self: center; }
.ctx i { width: calc(1.4 * var(--u)); height: calc(1.4 * var(--u)); border-radius: 50%; background: #adb5bd; opacity: .7; }
.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 { background: #fff; color: #000; 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: #000; color: #fff; 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: #e8101e; 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: #0b1a6e; color: #fff; 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: #fff; border: 2px solid #1d2a7a; 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 #1d2a7a; 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: #1c7ed6; color: #fff; }
.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: #1d2a7a; 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: linear-gradient(#f8f9fa, #dee2e6); 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 #ccc; }
.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: 24px; font-weight: 700; } .boot .logo span { color: #ff922b; }
.vol { position: absolute; left: 3px; top: 34px; width: 22px; bottom: 24px; background: #fff; border: 2px solid #1d2a7a; border-radius: 4px; display: flex; flex-direction: column-reverse; padding: 2px; gap: 1px; }
.vol i { flex: 1; background: #dfe3ea; } .vol i.an { background: #1c7ed6; }
/* ---------- 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 #1d2a7a; border-radius: 5px 5px 0 0; padding: 1px 6px; font-size: 14px; background: linear-gradient(#fff, #e7ecff); }
.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: #555; }
.raster > div.sel { background: #1c7ed6; border-color: #1d2a7a; } .raster > div.sel span { color: #fff; }
.text.edit { font-size: 15px; } .cursor { display: inline-block; width: 1px; height: 15px; background: #000; vertical-align: -2px; animation: blink 1s steps(2, start) infinite; }
