/* /hoeren: Funkgerät oben links, Monitorliste rechts, darunter die Kacheln
   der aktiven Gruppen und die Liste des zuletzt Gehörten.

   Jedes Netz hat eine Farbe, die überall gleich bleibt: am Gerät, an der
   Kachel, in der Liste. Man soll auf einen Blick sehen, woher etwas kommt. */

:root {
  --hr-bm: #ff7a45;
  --hr-fm: #2fd18a;
  --hr-glanz: rgba(255, 255, 255, 0.06);
}
@media (prefers-color-scheme: light) {
  :root {
    --hr-bm: #d4521f;
    --hr-fm: #0f9a5c;
    --hr-glanz: rgba(20, 30, 60, 0.04);
  }
}

[data-netz="bm"] { --hr-farbe: var(--hr-bm); }
[data-netz="fm"] { --hr-farbe: var(--hr-fm); }

.hr-buehne {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr);
  gap: 1.2rem; align-items: start; margin-top: 0.4rem;
}
@media (max-width: 900px) { .hr-buehne { grid-template-columns: 1fr; } }

/* --- das Gerät ----------------------------------------------------------- */

.hr-jetzt {
  position: relative; overflow: hidden;
  padding: 1.3rem 1.4rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--hr-farbe) 35%, var(--border));
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(700px 260px at 0% 0%, color-mix(in srgb, var(--hr-farbe) 16%, transparent), transparent 70%),
    var(--card-bg);
  box-shadow: var(--shadow);
  transition: border-color 0.4s;
}
.hr-jetzt.spricht {
  border-color: var(--hr-farbe);
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--hr-farbe) 40%, transparent),
    0 0 40px -8px color-mix(in srgb, var(--hr-farbe) 55%, transparent);
}

.hr-jetzt-kopf { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.hr-netz {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--hr-farbe); background: color-mix(in srgb, var(--hr-farbe) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--hr-farbe) 40%, transparent);
}
.hr-live {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: 0.15rem 0.55rem; border-radius: 999px; border: 1px solid var(--border);
}
.hr-live.an { color: #fff; background: #e5484d; border-color: transparent; }
.hr-live.an::before {
  content: ""; display: inline-block; width: 0.45rem; height: 0.45rem; margin-right: 0.35rem;
  border-radius: 50%; background: #fff; vertical-align: 0.05rem; animation: hr-blink 1.4s infinite;
}
.hr-modus-text { margin-left: auto; font-size: 0.85rem; color: var(--muted); }

.hr-jetzt-mitte { display: grid; gap: 0.3rem; margin: 0.9rem 0 0.6rem; }
.hr-jetzt-tg { display: flex; align-items: baseline; gap: 0.9rem; flex-wrap: wrap; min-width: 0; }
.hr-tg-nr {
  font-size: clamp(2.6rem, 6vw, 4.2rem); font-weight: 800; line-height: 1; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; color: var(--hr-farbe);
  text-shadow: 0 0 30px color-mix(in srgb, var(--hr-farbe) 35%, transparent);
}
.hr-tg-name { font-size: clamp(1.1rem, 2.2vw, 1.5rem); font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.hr-sprecher { display: flex; align-items: center; gap: 0.6rem; min-height: 2.2rem; font-size: 1.15rem; }
.hr-punkt {
  width: 0.7rem; height: 0.7rem; border-radius: 50%; flex: 0 0 auto;
  background: var(--border);
}
.spricht .hr-punkt {
  background: var(--hr-farbe);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--hr-farbe) 60%, transparent);
  animation: hr-puls 1.3s infinite;
}
.hr-ruf { font-weight: 700; letter-spacing: 0.02em; }
.hr-jetzt:not(.spricht) .hr-ruf { font-weight: 500; color: var(--muted); font-size: 1rem; }
.hr-dauer { color: var(--muted); font-variant-numeric: tabular-nums; }

.hr-anzeige {
  display: block; width: 100%; height: 110px; margin: 0.4rem 0 0.9rem;
  border-radius: 12px; background: linear-gradient(180deg, var(--hr-glanz), transparent);
  border: 1px solid var(--border);
}

.hr-regler { display: flex; align-items: center; gap: 0.9rem 1.2rem; flex-wrap: wrap; }
.hr-start {
  display: inline-flex; align-items: center; gap: 0.55rem;
  min-height: 3.2rem; padding: 0 1.5rem 0 1.15rem; border-radius: 999px; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 1.05rem;
  color: #fff; background: linear-gradient(135deg, var(--hr-farbe), color-mix(in srgb, var(--hr-farbe) 55%, var(--accent2)));
  box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--hr-farbe) 70%, transparent);
  transition: transform 0.12s, filter 0.2s;
}
.hr-start:hover { filter: brightness(1.08); }
.hr-start:active { transform: scale(0.97); }
.hr-start svg { width: 1.4rem; height: 1.4rem; }
.hr-start .hr-start-aus, .hr-start[aria-pressed="true"] .hr-start-an { display: none; }
.hr-start[aria-pressed="true"] .hr-start-aus { display: inline; }

.hr-laut { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--muted); }
.hr-laut svg { width: 1.3rem; height: 1.3rem; }
.hr-laut input { width: 9rem; accent-color: var(--hr-farbe); }
.hr-modus { display: inline-flex; gap: 0.35rem; margin-left: auto; }

.hr-wahl {
  display: grid; grid-template-columns: minmax(10rem, auto) minmax(0, 1fr) auto; gap: 0.6rem 0.8rem;
  margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border);
}
@media (max-width: 640px) { .hr-wahl { grid-template-columns: 1fr; } }
.hr-meldung { margin: 0.6rem 0 0; min-height: 1.2rem; font-size: 0.88rem; color: var(--muted); }
.hr-meldung.fehler { color: #ef4444; }

/* --- Monitorliste -------------------------------------------------------- */

.hr-monitor {
  padding: 1.1rem 1.1rem 1rem; border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
  background: var(--card-bg);
}
.hr-monitor-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.hr-monitor h2 { margin: 0; font-size: 1.1rem; }
.hr-monitor-hilfe { margin: 0.4rem 0 0.8rem; font-size: 0.84rem; color: var(--muted); }
.hr-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; counter-reset: hr-platz; }
.hr-liste:empty::before {
  content: "Noch leer. Unten an einer Kachel auf + tippen oder oben eine Gruppe eintragen.";
  display: block; padding: 0.9rem; border: 1px dashed var(--border); border-radius: 12px;
  color: var(--muted); font-size: 0.88rem;
}
.hr-eintrag {
  counter-increment: hr-platz;
  display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; align-items: center; gap: 0.2rem 0.6rem;
  padding: 0.5rem 0.55rem 0.5rem 0.6rem; border-radius: 12px;
  border: 1px solid var(--border); border-left: 4px solid var(--hr-farbe);
  background: var(--bg2); transition: box-shadow 0.3s, border-color 0.3s;
}
.hr-eintrag::before {
  content: counter(hr-platz); grid-row: span 2;
  font-weight: 800; font-size: 1.05rem; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums;
}
.hr-eintrag.spricht { border-color: var(--hr-farbe); box-shadow: 0 0 18px -6px var(--hr-farbe); }
.hr-eintrag.zu-hoeren { background: color-mix(in srgb, var(--hr-farbe) 12%, var(--bg2)); }
.hr-eintrag.stumm { opacity: 0.55; }
.hr-e-titel { display: flex; align-items: baseline; gap: 0.45rem; min-width: 0; }
.hr-e-tg { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--hr-farbe); }
.hr-e-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
.hr-e-zustand { grid-column: 2; font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hr-eintrag.spricht .hr-e-zustand { color: var(--fg); font-weight: 600; }
.hr-e-knoepfe { grid-column: 3; grid-row: 1 / span 2; display: flex; gap: 0.2rem; }
.hr-e-knoepfe button {
  width: 2rem; height: 2rem; padding: 0; display: inline-grid; place-items: center;
  border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.hr-e-knoepfe button:hover:not(:disabled) { border-color: var(--border); color: var(--fg); background: var(--card-hover); }
.hr-e-knoepfe button:disabled { opacity: 0.3; cursor: default; }
.hr-e-knoepfe button[aria-pressed="true"] { color: #f59e0b; }
.hr-e-knoepfe svg { width: 1.05rem; height: 1.05rem; }
.hr-e-knoepfe .hr-weg { color: #ef4444; }
.hr-gast { font-size: 0.9rem; }
.hr-gast p { margin: 0 0 0.7rem; }
.hr-reflektor { margin: 0.8rem 0 0; }

/* --- Kacheln ------------------------------------------------------------- */

.hr-filter { align-items: end; }
.hr-haken { align-items: center; gap: 0.45rem; white-space: nowrap; min-height: 2.5rem; }

.hr-kacheln {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: 0.7rem;
}
.hr-kachel {
  position: relative; display: grid; min-height: 7.4rem;
  border-radius: 14px; border: 1px solid var(--border);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--hr-farbe) 10%, transparent), transparent 60%),
    var(--card-bg);
  transition: border-color 1s, box-shadow 1s, opacity 1.2s, transform 0.15s;
  animation: hr-auf 0.35s ease-out;
}
.hr-kachel:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--hr-farbe) 60%, var(--border)); }
.hr-kachel.ruhig { opacity: 0.7; }
/* Ruhig halten: bei Brandmeister wechseln Dutzende Kacheln im Sekundentakt
   zwischen belegt und frei. Langsame Übergänge statt Aufblitzen. */
.hr-kachel.spricht {
  border-color: var(--hr-farbe);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hr-farbe) 35%, transparent);
}
.hr-kachel.gewaehlt { outline: 2px solid var(--accent); outline-offset: 2px; }
.hr-k-hoeren {
  all: unset; box-sizing: border-box; cursor: pointer; display: grid; align-content: start; gap: 0.15rem;
  padding: 0.75rem 0.85rem 0.7rem; border-radius: 14px; min-width: 0;
}
.hr-k-hoeren:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hr-k-kopf { display: flex; align-items: center; gap: 0.45rem; font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--hr-farbe); padding-right: 2.2rem; }
.hr-k-tg { font-size: 1.55rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hr-k-name { font-size: 0.86rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-k-fuss { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.35rem; font-size: 0.88rem; min-width: 0; }
.hr-k-ruf { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-k-zeit { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.hr-k-plus {
  position: absolute; top: 0.45rem; right: 0.45rem; width: 1.9rem; height: 1.9rem;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer; font: inherit; font-size: 1.15rem; line-height: 1;
  border: 1px solid var(--border); background: var(--bg2); color: var(--fg);
}
.hr-k-plus:hover { border-color: var(--hr-farbe); color: var(--hr-farbe); }
.hr-k-plus[aria-pressed="true"] { background: var(--hr-farbe); color: #fff; border-color: transparent; }
.hr-k-hinweis { font-size: 0.72rem; color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }

/* Drei Balken, die hüpfen, solange gesprochen wird. */
.hr-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 0.8rem; }
.hr-eq i { width: 3px; height: 30%; border-radius: 1px; background: var(--hr-farbe); }
.spricht .hr-eq i { animation: hr-eq 0.9s infinite ease-in-out; }
.spricht .hr-eq i:nth-child(2) { animation-delay: -0.3s; }
.spricht .hr-eq i:nth-child(3) { animation-delay: -0.6s; }

.hr-leer { margin-top: 0.4rem; }

/* --- Tabelle ------------------------------------------------------------- */

.hr-tabelle tbody tr { cursor: pointer; }
.hr-tabelle tbody tr:hover td { background: var(--card-hover); }
.hr-tabelle .hr-t-netz { font-weight: 700; color: var(--hr-farbe); font-size: 0.82rem; }
.hr-tabelle tr.offen .hr-t-dauer::after { content: " ●"; color: #e5484d; }

@keyframes hr-puls {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--hr-farbe) 60%, transparent); }
  70% { box-shadow: 0 0 0 0.6rem transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes hr-blink { 50% { opacity: 0.25; } }
@keyframes hr-eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }
@keyframes hr-auf { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  .hr-kachel, .spricht .hr-punkt, .spricht .hr-eq i, .hr-live.an::before { animation: none; }
}

/* --- Zahlen je Netz ------------------------------------------------------ */

.hr-zahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; margin: 1.6rem 0 0.4rem; }
.hr-stat {
  display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0.1rem 0.8rem;
  padding: 1rem 1.2rem; border-radius: calc(var(--radius) + 4px);
  border: 1px solid color-mix(in srgb, var(--hr-farbe) 35%, var(--border));
  background:
    radial-gradient(400px 160px at 0% 0%, color-mix(in srgb, var(--hr-farbe) 14%, transparent), transparent 70%),
    var(--card-bg);
}
.hr-stat-netz { grid-column: 1 / -1; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--hr-farbe); }
.hr-stat-zahl { font-size: 2.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--hr-farbe); }
.hr-stat-wort { font-weight: 600; }
.hr-stat-text { grid-column: 1 / -1; font-size: 0.84rem; color: var(--muted); }
.hr-stat-hinweis { display: none; grid-column: 1 / -1; font-size: 0.84rem; color: var(--muted); margin-top: 0.4rem; }
.hr-stat .btn-sm { grid-column: 1 / -1; justify-self: start; margin-top: 0.6rem; }
.hr-stat.aus { --hr-farbe: var(--muted); filter: saturate(0.2); }
.hr-stat.aus .hr-stat-hinweis { display: block; }
.hr-stat.aus .hr-stat-text { display: none; }
.hr-stat.aus .btn-sm { filter: none; border-color: var(--hr-fm); }
[data-filter-netz]:disabled { opacity: 0.45; cursor: not-allowed; }

/* --- Länder und Muster --------------------------------------------------- */

.hr-laender-feld { position: relative; }
.hr-laender > summary {
  list-style: none; cursor: pointer; min-height: 2.5rem; display: flex; align-items: center;
  padding: 0 2rem 0 0.8rem; min-width: 13rem; max-width: 22rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg2); position: relative;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hr-laender > summary::-webkit-details-marker { display: none; }
.hr-laender > summary::after { content: "▾"; position: absolute; right: 0.7rem; color: var(--muted); }
.hr-laender[open] > summary { border-color: var(--accent); }
.hr-laender-kasten {
  position: absolute; z-index: 20; top: calc(100% + 0.3rem); left: 0; width: min(26rem, 90vw);
  padding: 0.8rem; border-radius: 12px; border: 1px solid var(--border); background: var(--bg2); box-shadow: var(--shadow);
}
.hr-laender-liste { max-height: 18rem; overflow-y: auto; margin: 0.6rem 0 0.4rem; display: grid; }
.hr-land { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 0.5rem;
  padding: 0.25rem 0.3rem; border-radius: 6px; cursor: pointer; font-size: 0.92rem; }
.hr-land:hover { background: var(--card-hover); }
.hr-flagge { font-size: 1.1rem; line-height: 1; }
.hr-land-mcc { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hr-muster-feld input { min-width: 13rem; }
.hr-muster-feld input.falsch { border-color: #ef4444; }
.hr-haken.klein { min-height: 0; font-size: 0.82rem; color: var(--muted); }

/* --- Zugangsdialog ------------------------------------------------------- */

.hr-dialog {
  width: min(34rem, calc(100vw - 2rem)); padding: 1.3rem 1.4rem; border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border); background: var(--bg2); color: var(--fg); box-shadow: var(--shadow);
}
.hr-dialog::backdrop { background: rgba(5, 8, 20, 0.6); backdrop-filter: blur(2px); }
.hr-dialog h2 { margin: 0 0 0.4rem; font-size: 1.2rem; }
.hr-z-felder { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem 0.9rem; margin: 1rem 0 0.4rem; }
@media (max-width: 520px) { .hr-z-felder { grid-template-columns: 1fr; } }
.hr-haken input { flex: 0 0 auto; }

/* --- C4FM ---------------------------------------------------------------- */

:root { --hr-c4fm: #a98bff; }
@media (prefers-color-scheme: light) { :root { --hr-c4fm: #6d4bd8; } }
[data-netz="c4fm"] { --hr-farbe: var(--hr-c4fm); }
.hr-c4fm {
  display: inline-block; margin-left: 0.35rem; padding: 0 0.35rem; border-radius: 4px;
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.05em; line-height: 1.5;
  color: var(--hr-c4fm); border: 1px solid color-mix(in srgb, var(--hr-c4fm) 50%, transparent);
  transition: background 1s, color 1s;
}
.hr-c4fm.jetzt { background: var(--hr-c4fm); color: #fff; border-color: transparent; }
