/* Park-Audio — bewusst schlicht: die Seite läuft oft auf dem Handy
   in der Hosentasche, nicht auf einem 4K-Monitor. */

:root {
  --bg: #0b1220;
  --bg-soft: #131d31;
  --card: #16203a;
  --line: #24314f;
  --text: #eef2fb;
  --muted: #94a3c4;
  --accent: #4da3ff;
  --accent-soft: #1e3a5f;
  --ok: #46d17f;
  --warn: #ffb347;
  --bad: #ff6b6b;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Hintergrundbild: leicht unscharf und abgedunkelt, damit die Karte
   darueber lesbar bleibt. Etwas vergroessert, sonst zeigt die Unschaerfe
   helle Raender. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("/background") center / cover no-repeat;
  filter: blur(6px) brightness(.72) saturate(1.1);
  transform: scale(1.08);
}

/* Dunkler Verlauf darueber: haelt den Text auch bei hellen Bildstellen lesbar */
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8,14,26,.2) 0%, rgba(8,14,26,.62) 100%);
}

.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
}

/* Logo ueber dem Fenster. Die Vorlage ist dunkelblau auf transparent —
   auf dem dunklen Hintergrund waere sie kaum zu sehen, deshalb wird sie
   per Filter in Weiss umgefaerbt. */
.brand {
  width: min(320px, 78%);
  height: auto;
  filter: brightness(0) invert(1) drop-shadow(0 2px 12px rgba(0, 0, 0, .55));
  opacity: .96;
}

.brand[hidden] { display: none; }

.card {
  width: 100%;
  max-width: 460px;
  /* Leicht durchscheinend, damit das Bild dahinter spuerbar bleibt */
  background: rgba(22, 32, 58, .82);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid rgba(120, 150, 200, .22);
  border-radius: var(--radius);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .55);
  padding: 28px 24px;
}

/* ---- Startbildschirm ---- */

.gate { text-align: center; }

.logo {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 32px;
  background: var(--accent-soft);
  color: var(--accent);
}

h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: .2px;
}

.lead {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.5;
}

.start {
  width: 100%;
  padding: 18px 20px;
  font-size: 18px;
  font-weight: 650;
  color: #06101f;
  background: var(--accent);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
}

.start:hover { filter: brightness(1.08); }
.start:active { transform: scale(.985); }

.hint {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.error {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 107, 107, .12);
  border: 1px solid rgba(255, 107, 107, .35);
  color: #ffd7d7;
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
}

/* ---- Hauptansicht ---- */

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.dot[data-state="online"]     { background: var(--ok);   box-shadow: 0 0 10px rgba(70, 209, 127, .7); }
.dot[data-state="connecting"] { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.dot[data-state="offline"]    { background: var(--bad); }

@keyframes pulse { 50% { opacity: .25; } }

.status {
  font-size: 14px;
  color: var(--muted);
}

/* Eigener Name, nicht ".player": diese Klasse traegt schon die Hauptkarte
   (<section class="card player">) — sonst wird die ganze Karte zur Zeile. */
.who {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Skin-Kopf: bewusst ohne Glaettung, sonst matscht die Pixeloptik */
.head {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  image-rendering: pixelated;
  background: var(--bg-soft);
  flex: none;
}

.player-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.now {
  padding: 26px 0 22px;
  text-align: center;
}

.now-label {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.zone-name {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 650;
  line-height: 1.25;
  word-break: break-word;
}

.layers {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.layers li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.layers .meter {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--bg-soft);
  overflow: hidden;
}

.layers .meter span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width .4s ease;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.mute {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.mute[aria-pressed="true"] {
  background: rgba(255, 107, 107, .14);
  border-color: rgba(255, 107, 107, .4);
  color: #ffd7d7;
}

.slider { display: block; }

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.slider-label b { color: var(--text); }

input[type="range"] {
  width: 100%;
  height: 28px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 99px;
  background: var(--bg-soft);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 99px;
  background: var(--bg-soft);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
}

.foot {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

/* Die Fusszeile ist normalerweise leer und soll dann keinen Platz kosten */
.foot:has(#hintText:empty) { margin: 0; }
.foot #hintText:not(:empty) { display: block; margin-top: 18px; }

@media (max-width: 380px) {
  .card { padding: 22px 18px; }
  .zone-name { font-size: 22px; }
  .brand { width: 72%; }
}

/* Auf niedrigen Fenstern zaehlt jeder Pixel fuer das eigentliche Fenster. */
@media (max-height: 620px) {
  .brand { width: min(220px, 60%); }
  .shell { gap: 14px; }
}

/* ---- Externe Abspieler ----
   Nicht display:none: ein ausgeblendetes Element wird von manchen Browsern
   angehalten. Stattdessen aus dem Sichtfeld schieben — der Ton läuft weiter. */

.offscreen {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.offscreen iframe {
  width: 1px;
  height: 1px;
  border: none;
}

/* Notfall-Knopf, falls der Browser das automatische Starten unterbindet */

.resume {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  color: #06101f;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  cursor: pointer;
}
