/* Rohrkamera: ruhige Oberfläche, hell und dunkel nach Systemeinstellung. */

:root {
  --bg: #f3f4f6;
  --karte: #ffffff;
  --text: #14181f;
  --leise: #586270;
  --linie: #dde1e7;
  --knopf: #eceff3;
  --knopf-hover: #e1e5eb;
  --akzent: #1b64d6;
  --auf-akzent: #ffffff;
  --gut: #17884a;
  --warn: #b86a00;
  --live: #d92d20;
  --aufnahme: rgba(27, 100, 214, 0.55);
  --spur: #d5dae2;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1115;
    --karte: #171b21;
    --text: #e8ebf0;
    --leise: #9aa4b2;
    --linie: #29303a;
    --knopf: #232932;
    --knopf-hover: #2c343f;
    --akzent: #5b9bff;
    --auf-akzent: #07101d;
    --gut: #3ec27a;
    --warn: #f0a23c;
    --live: #ff5a4d;
    --aufnahme: rgba(91, 155, 255, 0.6);
    --spur: #2a313b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.symbole { position: absolute; width: 0; height: 0; overflow: hidden; }

.nur-schirmleser {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

[hidden] { display: none !important; }

h1 { margin: 0; font-size: 1.05rem; font-weight: 650; letter-spacing: 0.01em; }
h2 { margin: 0; font-size: 1rem; font-weight: 650; }

.kopf { max-width: 1440px; margin: 0 auto; padding: 12px 16px 8px; }

.seite {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

/* Auf dem Handy ist alles eine Spalte: Bild oben (bleibt beim Scrollen stehen), Bedienung darunter. */
.hauptspalte, .seitenspalte { display: contents; }

.buehne-huelle {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 0 0 4px;
}

.buehne {
  position: relative;
  width: 100%;
  height: 56vw;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}

.buehne video {
  position: absolute;
  left: 50%;
  top: 50%;
  background: #000;
  transform: translate(-50%, -50%);
}

.pille {
  position: absolute;
  left: 10px;
  top: 10px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 20px);
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
}

.punkt { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #9aa4b2; }
.pille.gut .punkt { background: #3ec27a; }
.pille.warn .punkt { background: #f0a23c; }
.pille.aufnahme .punkt { background: #5b9bff; }

.mitte {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.gross { width: 56px; height: 56px; fill: #6b7482; }

/* Karten */
.karte {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 14px;
}
.karte > h2 { margin-bottom: 10px; }

.leer { margin: 0; color: var(--leise); font-size: 0.9rem; }

/* Knöpfe */
.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--knopf);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.knopf:hover:not(:disabled) { background: var(--knopf-hover); }
.knopf:disabled { opacity: 0.45; cursor: default; }
.knopf svg { flex: none; width: 22px; height: 22px; fill: currentColor; }
.knopf.symbol { width: 44px; padding: 0; }
.knopf.text { padding: 0 10px; gap: 4px; }
.knopf.text span { font-size: 0.875rem; }

:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }

.knopf.live { gap: 8px; }
.livepunkt { width: 10px; height: 10px; border-radius: 50%; background: var(--leise); }
.knopf.live[aria-pressed="true"] .livepunkt { background: var(--live); }
.knopf.live[aria-pressed="true"] { cursor: default; }

.knopf.ton { padding: 0 12px; text-align: left; flex: none; white-space: nowrap; }
.zweizeilig { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.zweizeilig small { font-size: 0.72rem; font-weight: 500; color: var(--leise); }
.knopf.ton[aria-pressed="true"] { background: var(--akzent); color: var(--auf-akzent); }
.knopf.ton[aria-pressed="true"] small { color: inherit; opacity: 0.85; }

/* Steuerung unter dem Bild */
.steuerung { display: flex; flex-direction: column; gap: 14px; }

.leiste { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; }
.gruppe { display: flex; flex-wrap: wrap; gap: 6px; }

/* Zeitleiste */
.zeitleiste { padding: 4px 0 0; }
.spur {
  position: relative;
  height: 34px;
  border-radius: 8px;
  background: var(--spur);
  touch-action: none;
  cursor: pointer;
}
.bereiche { position: absolute; inset: 0; border-radius: 8px; overflow: hidden; }
.bereich { position: absolute; top: 0; bottom: 0; background: var(--aufnahme); }
.kopfmarke {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 4px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--text);
  pointer-events: none;
}
.kopfmarke.live { background: var(--live); }
.hinweisblase {
  position: absolute;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--text);
  color: var(--karte);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}
.skala { position: relative; height: 20px; margin-top: 4px; font-size: 0.75rem; color: var(--leise); }
.skala span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.skala span.rand-links { transform: none; }
.skala span.rand-rechts { transform: translateX(-100%); }

/* Ausschnitt abspielen: einfache eigene Leiste statt der Zeitleiste */
.sichleiste { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
.sichtitel { grid-column: 1 / -1; margin: 0; font-weight: 600; }
.sichleiste input[type="range"] { width: 100%; }

/* Notknopf */
.sichern { display: flex; flex-direction: column; gap: 6px; }
.gross-knopf {
  width: 100%;
  min-height: 56px;
  font-size: 1.05rem;
  background: var(--akzent);
  color: var(--auf-akzent);
}
.gross-knopf:hover:not(:disabled) { background: var(--akzent); filter: brightness(1.08); }
.meldung { margin: 0; min-height: 1.4em; color: var(--leise); font-size: 0.9rem; }
.meldung.fehler { color: var(--warn); }

/* Liste der Sicherungen */
.liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.liste li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--linie);
  border-radius: 10px;
}
.liste li.aktiv { border-color: var(--akzent); }
.liste .wann { font-weight: 600; }
.liste .wie { color: var(--leise); font-size: 0.85rem; }
.liste .aktionen { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; }
.liste .knopf { min-height: 40px; }

/* Regler */
.reglerkarte > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.reglerkarte > summary::-webkit-details-marker { display: none; }
.reglerkarte > summary::after { content: "+"; font-size: 1.3rem; color: var(--leise); }
.reglerkarte[open] > summary::after { content: "–"; }
.reglerkarte[open] > summary { margin-bottom: 12px; }
.regler { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.regler li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.regler .name { font-size: 0.92rem; font-weight: 600; }
.regler .wert { color: var(--leise); font-size: 0.85rem; font-variant-numeric: tabular-nums; margin-left: 6px; font-weight: 500; }
.regler input[type="range"] { grid-column: 1 / -1; width: 100%; min-height: 32px; }
.regler .standard {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--akzent);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.regler .standard:disabled { visibility: hidden; }
.schalter { position: relative; width: 48px; height: 28px; }
.schalter input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.schalter .balken { position: absolute; inset: 0; border-radius: 14px; background: var(--spur); pointer-events: none; }
.schalter .balken::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
}
.schalter input:checked + .balken { background: var(--akzent); }
.schalter input:checked + .balken::after { left: 23px; }
.schalter input:focus-visible + .balken { outline: 3px solid var(--akzent); outline-offset: 2px; }

input[type="range"] { accent-color: var(--akzent); }

.regler li.gedaempft { opacity: 0.45; }

/* Fotos vom Handy: neuestes oben */
.fotoliste { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fotoliste:empty { display: none; }
.fotoeintrag {
  display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 6px; text-align: left;
  border: 1px solid var(--linie); border-radius: 10px; background: none; color: inherit; font: inherit; cursor: pointer;
}
.fotoeintrag:hover { border-color: var(--akzent); }
.fotobild { position: relative; width: 100%; background: var(--spur); border-radius: 6px; overflow: hidden; }
.fotobild img { position: absolute; left: 50%; top: 50%; background: var(--spur); }
.fotozeile { display: flex; justify-content: space-between; gap: 6px; font-size: 0.85rem; }
.fotozeile .wann { font-weight: 600; }
.fotozeile .stand { color: var(--leise); text-align: right; }
.fotozeile .stand.gut { color: var(--gut); }
.fotozeile .stand.fehler { color: var(--warn); }
.knopf.mehr { margin-top: 10px; width: 100%; }

dialog { border: 0; padding: 12px; border-radius: var(--radius); background: var(--karte); color: var(--text); max-width: 100vw; max-height: 100vh; }
dialog::backdrop { background: rgba(0, 0, 0, 0.72); }
.dialogkopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dialogkopf p { margin: 0; font-weight: 650; }
.grossbild { position: relative; background: var(--spur); border-radius: 8px; overflow: hidden; margin: 0 auto; }
.grossbild img { position: absolute; left: 50%; top: 50%; }
.dialogfuss { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.dialogfuss .knopf { text-decoration: none; }
.dialogfuss .knopf span { font-size: 0.95rem; }
#fotoDialogHinweis:empty { display: none; }

/* Fotos (Stand 2026-11-25): nur die Bilder vom Handy, kein Live-Bild. Der Klick auf ein Bild
   legt es in die Zwischenablage, der JPEG-Knopf lädt dieselbe Datei herunter. */
.kopfzeile { margin: 4px 0 0; color: var(--leise); font-size: 0.85rem; }

.kartenkopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.kartenkopf h2 { margin: 0; }

.hinweis { margin: 0 0 10px; color: var(--leise); font-size: 0.85rem; line-height: 1.5; }
.hinweis .jetzt { color: var(--text); font-weight: 600; }
.hinweis .mini { width: 14px; height: 14px; fill: currentColor; vertical-align: -2px; }

.fotoliste { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-items: start; }
.fotoeintrag { cursor: default; gap: 8px; }
.fotobild {
  display: block; width: 100%; padding: 0; border: 0; border-radius: 8px;
  background: var(--spur); overflow: hidden; cursor: pointer; line-height: 0;
}
.fotobild:hover { outline: 2px solid var(--akzent); outline-offset: 1px; }
.fotobild img { position: static; display: block; width: 100%; height: auto; transform: none; }
.fotoleiste { display: flex; gap: 6px; }
.fotoleiste .knopf { flex: 1; min-height: 40px; text-decoration: none; }

/* Großansicht: das Bild in seiner echten Größe, so weit der Bildschirm reicht. */
#gross { max-width: 100vw; max-height: 100vh; }
#gross .grossbild { display: grid; place-items: center; }
#gross .grossbild img {
  position: static;
  display: block;
  width: auto;
  height: auto;
  max-width: min(92vw, 1700px);
  max-height: 76vh;
}
.blaettern {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
}
.blaettern svg { width: 26px; height: 26px; fill: currentColor; }
.blaettern.links { left: 8px; }
.blaettern.rechts { right: 8px; }
.blaettern:hover:not(:disabled) { background: rgba(0, 0, 0, 0.68); }
.blaettern:disabled { opacity: 0.25; cursor: default; }
#grossMeldung:empty { display: none; }
#gross .dialogfuss .knopf { min-height: 44px; }

/* Breiten */
@media (max-width: 440px) {
  /* Schmale Handys: Ton, Drehen und Foto sollen mit Beschriftung in eine Zeile passen. */
  .gruppe { gap: 4px; }
  .knopf.ton, #foto { padding: 0 8px; }
}

@media (min-width: 600px) {
  .buehne { height: 44vw; }
}

@media (min-width: 1024px) {
  .seite {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
    gap: 16px;
  }
  .hauptspalte, .seitenspalte { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .buehne-huelle { position: static; padding: 0; background: none; }
  .buehne { height: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
