/* Melder-Gerät (gemeinsam für Leitstelle, Melder-Fenster und Toolbar-Mod) */
@font-face { font-family: 'LRS Pixel'; src: url('../fonts/vt323-latin-400-normal.woff2') format('woff2'); font-display: swap; }

.pg { --pg-led: #ff3b30; position: relative; container-type: inline-size; width: 100%; user-select: none; -webkit-user-select: none; }
.pg-dev { position: relative; width: 100%; aspect-ratio: var(--pg-ar, 360 / 232); }
.pg-svgwrap, .pg-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pg-svg { filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .45)) drop-shadow(0 3px 4px rgba(0, 0, 0, .35)); overflow: visible; }
.pg-svg .pg-led { fill: #3a1512; transition: fill .15s; }
.pg-svg rect.pg-led { fill: #2a0f0d; }

/* LCD */
.pg-lcd {
  --lcd-bg: #9eab8c; --lcd-ink: #161a10; --lcd-ghost: rgba(22, 26, 16, .08);
  position: absolute; border-radius: 3px; overflow: hidden; background: var(--lcd-bg); color: var(--lcd-ink);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(0, 0, 0, .35);
  font-family: 'LRS Pixel', 'VT323', 'Courier New', monospace; font-size: var(--fs, 4cqw); line-height: 1.02; text-transform: uppercase;
  transition: background .25s ease, color .25s ease, box-shadow .25s ease;
}
.pg-lcd[data-tint="grau"] { --lcd-bg: #bcc0bb; }
.pg-lcd[data-tint="alt"] { --lcd-bg: #8f9a79; --lcd-ink: #1a1f12; }
.pg-lcd.lit[data-light="gruen"] { --lcd-bg: #b9e46f; --lcd-ink: #0f1806; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .3), 0 0 18px rgba(170, 230, 90, .45); }
.pg-lcd.lit[data-light="bernstein"] { --lcd-bg: #ffbd45; --lcd-ink: #2a1500; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .3), 0 0 18px rgba(255, 180, 60, .5); }
.pg-lcd.lit[data-light="blau"] { --lcd-bg: #7cc6ff; --lcd-ink: #04111f; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .3), 0 0 18px rgba(110, 190, 255, .5); }
/* leichter Glanz auf dem Display */
.pg-lcd::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(160deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, .05) 38%, transparent 40%); }
/* LCD-Pixelraster */
.pg-lcd::before { content: ''; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(var(--lcd-ghost) 1px, transparent 1px), linear-gradient(90deg, var(--lcd-ghost) 1px, transparent 1px); background-size: 3px 3px; }
.pg-screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 3% 4%; }
.pg-hdr, .pg-ftr { display: flex; align-items: center; gap: .45em; font-size: .82em; flex: none; }
.pg-hdr i { display: inline-flex; width: 1.15em; height: .95em; }
.pg-hdr i svg { width: 100%; height: 100%; }
.pg-hdr .grow { flex: 1; }
[data-orient="portrait"] .pg-hdr { justify-content: space-between; }
.pg-ftr { justify-content: space-between; border-top: 1px solid currentColor; padding-top: 1%; margin-top: 1%; }
.pg-body { position: relative; flex: 1; min-height: 0; overflow: hidden; margin-top: 2%; }
.pg-body > div { white-space: nowrap; overflow: hidden; text-overflow: clip; }
.pg-roll > div { white-space: normal; overflow-wrap: anywhere; }
.pg-roll.rolling { animation: pgRoll linear infinite; }
@keyframes pgRoll { 0%, 18% { transform: translateY(0); } 82%, 100% { transform: translateY(var(--roll)); } }
.pg-lcd .inv { background: var(--lcd-ink); color: var(--lcd-bg); padding: 0 .2em; }
.pg-lcd b { font-weight: 400; }
.pg-title { border-bottom: 1px solid currentColor; margin-bottom: 2%; font-size: .85em; }
.pg-flash { background: var(--lcd-ink); color: var(--lcd-bg); text-align: center; margin-bottom: 2%; animation: pgBlink 1s steps(2) 3; }
@keyframes pgBlink { 50% { opacity: .35; } }
.pg-idle { height: 100%; display: flex; align-items: center; justify-content: center; }
.pg-box { border: .12em solid currentColor; padding: .25em .5em; text-align: center; max-width: 100%; }
.pg-box > div { white-space: nowrap; overflow: hidden; }
.pg-lcd.big { line-height: .98; }
.pg-bar { display: flex; gap: 3%; height: 1em; margin: 4% 0; }
.pg-bar i { flex: 1; border: 1px solid currentColor; }
.pg-bar i.on { background: currentColor; }

/* Tasten (unsichtbare Trefferflächen über dem SVG; Druck wird angedeutet) */
.pg-keys { position: absolute; inset: 0; pointer-events: none; }
.pg-key { position: absolute; pointer-events: auto; border: 0; padding: 0; background: transparent; cursor: pointer; border-radius: 6px; -webkit-tap-highlight-color: transparent; transition: background .08s, box-shadow .08s; }
.pg-key.round, .pg-key.pill { border-radius: 999px; }
.pg-key:hover { background: rgba(255, 255, 255, .06); }
.pg-key.down, .pg-key:active { background: rgba(0, 0, 0, .35); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .6); }
.pg-key:focus-visible { outline: 2px solid var(--accent, #e10600); outline-offset: 2px; }
.pg-key:disabled { cursor: default; }

/* Alarm: LED blinkt, Gerät vibriert */
.pg.alarming .pg-svg .pg-led { animation: pgLed .5s steps(2, jump-none) infinite; }
@keyframes pgLed { 0% { fill: var(--pg-led); filter: drop-shadow(0 0 5px var(--pg-led)); } 100% { fill: #3a1512; filter: none; } }
.pg.shake .pg-dev { animation: pgShake .42s linear infinite; }
@keyframes pgShake {
  0%, 100% { transform: translate(0, 0) rotate(0); } 15% { transform: translate(-1.5px, 0) rotate(-.6deg); } 30% { transform: translate(1.5px, 0) rotate(.6deg); }
  45% { transform: translate(-1.2px, 0) rotate(-.4deg); } 60% { transform: translate(1.2px, 0) rotate(.4deg); } 80% { transform: translate(-.6px, 0) rotate(-.2deg); }
}
@media (prefers-reduced-motion: reduce) { .pg.shake .pg-dev { animation: none; } .pg-roll.rolling { animation-duration: 30s !important; } }

/* Modellauswahl mit Vorschaubildern */
.pg-models { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.pg-model { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font: 600 13px var(--font); text-align: center; transition: border-color .15s, transform .15s, background .15s; }
.pg-model:hover { transform: translateY(-2px); }
.pg-model[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 6px 20px var(--accent-glow); }
.pg-model .th { height: 72px; width: 100%; display: flex; align-items: center; justify-content: center; }
.pg-model .th { position: relative; }
.pg-model .th svg.pg-svg { position: static; inset: auto; max-width: 100%; max-height: 72px; width: auto; height: 72px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); }
.pg-model small { color: var(--muted); font-weight: 500; font-size: 11px; }
.pg-model .approx { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--warn, #f5a623); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border-strong, rgba(255,255,255,.2)); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.pg-stage { display: flex; align-items: center; justify-content: center; padding: 20px; border-radius: 14px; background: radial-gradient(ellipse at 50% 35%, #2b2f37 0%, #15171c 75%); min-height: 260px; }
.pg-stage .pg { max-width: 360px; }
.pg-stage .pg[data-orient="portrait"] { max-width: 210px; }

/* Ersatz-Melder als Overlay (wenn Popups gesperrt sind) */
.pg-overlay { position: fixed; right: 24px; bottom: 24px; z-index: 3000; width: 340px; padding: 14px 14px 10px; border-radius: 16px; background: rgba(16, 17, 20, .92); border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); backdrop-filter: blur(8px); }
.pg-overlay .pg[data-orient="portrait"] { width: 62%; margin: 0 auto; }
.pg-overlay header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font: 700 12px var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 480px) { .pg-overlay { left: 12px; right: 12px; width: auto; bottom: 80px; } }

/* Einstellungsbereich (Dienst & Fahrzeug) */
.melder-cfg { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 24px; align-items: start; }
.melder-fields { display: grid; gap: 14px; }
.melder-fields .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.melder-fields .field > span { font: 600 12px var(--font); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.melder-fields .check { color: var(--text); font-size: 14px; }
.melder-fields .check { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.melder-fields .row .input { flex: 1; min-width: 0; }
@media (max-width: 768px) { .melder-cfg { grid-template-columns: minmax(0, 1fr); } }
