:root {
  --bg: #0b0d10;
  --fg: #f2f4f7;
  --muted: #9aa4b2;
  --ok: #35d07f;
  --warn: #ffb020;
  --bad: #ff5c5c;
  --pad: max(14px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--fg);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}

#view {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #000;
}

#flash {
  position: fixed; inset: 0; background: #fff; opacity: 0;
  pointer-events: none; transition: opacity .12s ease-out;
}
#flash.on { opacity: .85; transition: none; }

body.privat #view { outline: 4px solid var(--bad); outline-offset: -4px; }
body.gesperrt #view { outline: 4px solid var(--warn); outline-offset: -4px; }
body.privat.gesperrt #view {
  outline-color: var(--bad);
  box-shadow: inset 0 0 0 8px var(--warn);
}

.bar {
  position: fixed; left: 0; right: 0;
  display: flex; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  z-index: 3;
}
.bar.top {
  top: 0; justify-content: space-between;
  background: linear-gradient(#000c, #0000);
}
/* Auslöser mittig, je ein Schalter links und rechts davon. */
.bar.bottom {
  bottom: 0; justify-content: space-between;
  padding: 12px 24px var(--pad);
  background: linear-gradient(#0000, #000c);
}

.oben-rechts { display: flex; align-items: center; gap: 8px; }
.chip.rund { padding: 7px 10px; font-size: 16px; line-height: 1; }

.conn { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.conn .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 8px currentColor; }
.conn.on .dot { background: var(--ok); }
.conn.off .dot { background: var(--bad); }

.chip {
  appearance: none; border: 1px solid #ffffff2e; background: #0009; color: var(--fg);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; backdrop-filter: blur(6px);
}
.chip b { font-weight: 600; }

.shutter {
  appearance: none; border: 4px solid #fff; background: #fff3;
  width: 78px; height: 78px; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  transition: transform .08s ease;
}
.shutter span { width: 60px; height: 60px; border-radius: 50%; background: #fff; display: block; }
.shutter:active { transform: scale(.92); }
.shutter[disabled] { opacity: .45; }
body.privat .shutter { border-color: var(--bad); }
body.privat .shutter span { background: var(--bad); }

.side {
  appearance: none; border: 0; background: transparent; color: var(--fg);
  display: grid; justify-items: center; gap: 4px; width: 72px; padding: 6px 0;
  font-size: 11px; letter-spacing: .02em;
}
.side .ico {
  font-size: 21px; width: 50px; height: 50px; border-radius: 50%;
  background: #ffffff1f; display: grid; place-items: center;
}
/* Fernauslösung gesperrt: gelb, weil es nichts unkenntlich macht,
   sondern nur mich aussperrt. */
#lockBtn[aria-pressed="true"] .ico { background: var(--warn); }
#lockBtn[aria-pressed="true"] .ico::after { border-color: var(--warn); }
#lockBtn[aria-pressed="true"] .lbl { color: var(--warn); }
.side[aria-pressed="true"] .ico { background: var(--bad); }
.side[aria-pressed="true"] .ico::after {
  content: ''; position: absolute; width: 50px; height: 50px; border-radius: 50%;
  border: 2px solid var(--bad); animation: puls 1.6s ease-out infinite;
}
@keyframes puls { to { transform: scale(1.35); opacity: 0; } }
.side .ico { position: relative; }
.side .lbl { color: var(--muted); }
.side[aria-pressed="true"] .lbl { color: var(--bad); font-weight: 600; }

.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  z-index: 5; max-width: 88vw;
  background: #000c; border: 1px solid #ffffff2e; backdrop-filter: blur(8px);
  padding: 9px 15px; border-radius: 999px; font-size: 13px;
}

/* Letzte Aufnahme samt Bewertung — bleibt stehen, bis die nächste kommt.
   Die Stufe steckt im Rahmen des Vorschaubilds, der Ablageort liegt darauf. */
.last {
  position: fixed; left: 14px; bottom: calc(var(--pad) + 100px); z-index: 4;
  display: flex; align-items: center; gap: 10px;
  background: #000a; border: 1px solid #ffffff1f; backdrop-filter: blur(8px);
  border-radius: 12px; padding: 7px; width: fit-content;
}
.last .bild { position: relative; flex: none; }
.last img {
  width: 58px; height: 58px; object-fit: cover; display: block;
  border-radius: 8px; background: #222; border: 2px solid var(--muted);
}
.last.normal img   { border-color: var(--ok); }
.last.sexy img     { border-color: var(--warn); }
.last.explizit img { border-color: var(--bad); }
.last .ort {
  position: absolute; left: 2px; right: 2px; bottom: 2px;
  background: #000c; color: var(--fg);
  font-size: 8px; line-height: 1.5; text-align: center;
  border-radius: 0 0 6px 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Stufen-Anzeige in der Vorschau. Bewusst ohne Rahmen und Pillenform —
   die sah aus wie ein Schalter und lud zum Drücken ein. */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em;
}
.badge .sym { width: 14px; height: 14px; display: grid; place-items: center; flex: none; }
.badge .sym svg { width: 14px; height: 14px; display: block; fill: currentColor; }
.badge b { font-weight: 600; }

.badge.normal   { color: var(--ok); }
.badge.sexy     { color: var(--warn); }
.badge.explizit { color: var(--bad); }

/* Drei Messwerte: Symbol, Name, Prozent. Über der Schwelle wird die Zeile
   farbig und fett — darunter bleibt sie gedämpft. */
.last .rechts { display: grid; gap: 6px; padding-right: 4px; }
.last .alter {
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.werte { display: grid; gap: 5px; }
.wert {
  display: grid; grid-template-columns: 15px auto; align-items: center; gap: 7px;
  font-size: 13px; color: var(--muted);
}
.wert svg { width: 15px; height: 15px; display: block; fill: currentColor; opacity: .8; }
.wert .zahl { font-variant-numeric: tabular-nums; font-weight: 600; }

.wert.aktiv { color: currentColor; font-weight: 600; }
.wert.aktiv svg { opacity: 1; }
.wert.aktiv.sexy { color: var(--warn); }
.wert.aktiv.porn, .wert.aktiv.hentai { color: var(--bad); }

.overlay {
  position: fixed; inset: 0; z-index: 9; display: grid; place-items: center;
  background: #0b0d10ee; padding: 24px;
}
/* Muss nach .overlay stehen: sonst gewinnt display:grid gegen das
   [hidden]-Attribut und beide Overlays liegen sichtbar übereinander. */
.overlay[hidden] { display: none; }
.overlay .card { max-width: 420px; }
.overlay h1 { font-size: 19px; margin: 0 0 8px; }
.overlay p { color: var(--muted); margin: 0 0 18px; }
.overlay .hint {
  border-left: 3px solid var(--warn); padding-left: 12px;
  color: var(--fg); font-size: 14px;
}
.primary {
  appearance: none; border: 0; border-radius: 10px; padding: 12px 18px;
  background: var(--fg); color: #0b0d10; font-weight: 600; font-size: 15px;
}

/* Ordnerauswahl: bereits benutzte Themen antippen statt abtippen. */
.card.blatt { width: min(400px, 88vw); }
.card.blatt h1 { margin-bottom: 14px; }

.liste { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto; margin-bottom: 14px; }
.liste .eintrag {
  appearance: none; width: 100%; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid #ffffff24; background: #ffffff0f; color: var(--fg);
  border-radius: 10px; padding: 12px 14px; font-size: 15px;
}
.liste .eintrag:active { background: #ffffff24; }
.liste .eintrag.aktiv { border-color: var(--ok); color: var(--ok); font-weight: 600; }
.liste .eintrag .zahl { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.liste .eintrag.aktiv .zahl { color: var(--ok); }
.liste .leer { color: var(--muted); font-size: 13px; padding: 4px 2px; }

.neu { display: flex; gap: 8px; margin-bottom: 6px; }
.neu input {
  flex: 1; min-width: 0; appearance: none;
  border: 1px solid #ffffff2e; background: #0006; color: var(--fg);
  border-radius: 10px; padding: 12px 14px; font-size: 15px;
}
.neu input:focus { outline: none; border-color: var(--fg); }

.text {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font-size: 14px; padding: 10px 0; width: 100%;
}
