/* Liegestütz-Challenge: dunkles, sportliches Design, mobile-first für iPhone Safari */

@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/barlow-condensed-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/barlow-condensed-800.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}

:root {
  --bg: #0d0e10;
  --surface: #17191d;
  --surface-2: #22252b;
  --line: #2e3238;
  --text: #f3f4f6;
  --muted: #8d939c;
  --accent: #d4ff3a;       /* Signalfarbe: Fortschritt, geschafft */
  --accent-ink: #0d0e10;   /* Text auf der Signalfarbe */
  --danger: #ff5a47;
  --radius: 14px;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --gutter: 16px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* Safe-Area: Notch oben, Home-Indikator unten */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  min-height: 100dvh;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(32px + env(safe-area-inset-bottom));
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }

/* ---------- Kopfzeile ---------- */
.topbar {
  max-width: 560px;
  margin: 0 auto;
  padding: 14px var(--gutter) 6px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.topbar-date { font-size: 17px; }
.topbar-day { font-size: 15px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 6px; }

/* Runder Knopf nur mit Symbol (Zahnrad, Schließen) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:active { background: var(--surface-2); }

/* ---------- Tagesfortschritt ---------- */
.hero {
  position: relative;
  margin: 6px 0 18px;
  padding: 18px 18px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: background-color 0.4s, color 0.4s;
}
.hero-count {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--display);
  font-weight: 800;
  line-height: 0.85;
  font-variant-numeric: tabular-nums;
}
.hero-done { font-size: clamp(96px, 30vw, 156px); letter-spacing: -0.02em; }
.hero-goal { font-size: clamp(34px, 10vw, 52px); color: var(--muted); }

.bar {
  margin-top: 16px;
  height: 14px;
  border-radius: 7px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 7px;
  transition: width 0.5s cubic-bezier(.2,.8,.2,1);
}
.hero-sub {
  margin-top: 12px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 24px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Ziel geschafft: die ganze Fläche wird zur Signalfarbe */
.hero.is-done { background: var(--accent); color: var(--accent-ink); }
.hero.is-done .hero-goal { color: rgba(13, 14, 16, 0.55); }
.hero.is-done .bar { background: rgba(13, 14, 16, 0.18); }
.hero.is-done .bar-fill { background: var(--accent-ink); }
.hero.is-before-start { opacity: 0.6; }

.hero.celebrate { animation: celebrate 0.9s ease-out; }
@keyframes celebrate {
  0% { transform: scale(1); }
  20% { transform: scale(1.04); }
  45% { transform: scale(0.99); }
  100% { transform: scale(1); }
}

/* ---------- Karten ---------- */
.card {
  margin-bottom: 18px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
}
.card-title {
  margin: 0 0 12px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.card-count { color: var(--text); margin-left: 4px; }
.empty { margin: 4px 0; color: var(--muted); }

/* ---------- Liste der Sätze ---------- */
.sets { list-style: none; margin: 0; padding: 0; }
.set {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  border-top: 1px solid var(--line);
}
.set:first-child { border-top: 0; }
.set-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.set-main { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.set-reps {
  font-family: var(--display);
  font-weight: 800;
  font-size: 32px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.set-meta { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.badge-camera { color: var(--accent); }

/* Löschen mit zweitem Tippen als Rückfrage */
.set-delete {
  min-width: 48px;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  transition: background-color 0.2s, color 0.2s;
}
.set-delete svg { width: 20px; height: 20px; vertical-align: middle; }
.set-delete.is-armed { background: var(--danger); color: #fff; }

.field input:focus { outline: none; border-color: var(--accent); }

.chips { display: flex; gap: 8px; }
.chip {
  flex: 1;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: transparent;
  font-family: var(--display);
  font-weight: 600;
  font-size: 20px;
}
.chip:active { background: var(--surface-2); }

.field { display: grid; gap: 6px; }
.field-label { font-size: 14px; color: var(--muted); }
.field input {
  height: 52px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}
.hint { margin: -4px 0 0; font-size: 14px; color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  width: 100%;
  height: 58px;
  border: 0;
  border-radius: 12px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 24px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:active { filter: brightness(0.9); }
.btn:disabled { opacity: 0.5; }

/* ---------- Meldungen ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(12px + env(safe-area-inset-top));
  transform: translateX(-50%);
  max-width: calc(100% - 2 * var(--gutter));
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 30; /* auch über Einstellungen und Kamera */
}
.toast.is-error { background: var(--danger); color: #fff; }

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

/* ---------- Kamera-Satz starten ---------- */
.btn-camera {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 64px;
  margin-bottom: 18px;
}
.btn-camera svg { width: 28px; height: 28px; }
.btn-ghost { background: var(--surface-2); color: var(--text); }

/* ---------- Kamera-Ansicht (Vollbild) ----------
   Das iPhone steht 1–1,5 m entfernt, deshalb ist alles sehr groß. */
body.cam-open { overflow: hidden; }

.cam {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #000;
  color: #fff;
  overflow: hidden;
  transition: background-color 0.4s;
}
.cam[hidden] { display: none; }

/* Video und Linien gespiegelt wie ein Spiegel, beide gleich zugeschnitten */
.cam-video, .cam-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.cam-video { opacity: 0.45; }

.cam-top {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cam-close {
  min-width: 52px;
  height: 52px;
  padding: 0 14px;
  border: 0;
  border-radius: 26px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 22px;
  font-weight: 600;
}
.cam-close.is-armed { background: var(--danger); font-size: 17px; }
.cam-day {
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}

.cam-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 64px 0 var(--gutter);
  pointer-events: none;
  text-align: center;
}
.cam-count {
  font-family: var(--display);
  font-weight: 800;
  font-size: min(48vh, 70vw);
  line-height: 0.85;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
}
.cam-count.bump { animation: bump 0.35s ease-out; }
@keyframes bump {
  0% { transform: scale(1.18); color: var(--accent); }
  100% { transform: scale(1); }
}
.cam-status {
  min-height: 1.2em;
  margin-top: 12px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(30px, 9vw, 52px);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.7);
}
.cam-status.is-flash { color: var(--accent); }
.cam-status.is-error { color: var(--danger); font-size: 24px; text-transform: none; }

/* Höhen-Balken rechts: voll = oben, Markierungen bei 85 % und 55 % */
.cam-depth {
  position: absolute;
  right: var(--gutter);
  top: 22%;
  bottom: 24%;
  width: 22px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.cam-depth-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: #fff;
  transition: height 0.08s linear;
}
.cam-depth.is-low .cam-depth-fill { background: var(--accent); }
.cam-depth.is-idle { opacity: 0.4; }
.cam-depth-mark {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
}
/* Position setzt camera.js nach den eingestellten Schwellen */
.cam-depth-mark-up { bottom: 85%; background: rgba(255, 255, 255, 0.7); }
.cam-depth-mark-down { bottom: 55%; }

.cam-bottom {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
}
.cam-debug {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font: 12px/1.4 ui-monospace, Menlo, monospace;
  white-space: pre-line;
}

/* Tagesziel während des Satzes geschafft: Hintergrund in Signalfarbe */
.cam.is-done { background: var(--accent); color: var(--accent-ink); }
.cam.is-done .cam-video { opacity: 0.25; }
.cam.is-done .cam-count, .cam.is-done .cam-status { text-shadow: none; }
.cam.is-done .cam-status.is-flash { color: var(--accent-ink); }
.cam.is-done .cam-count.bump { animation-name: bump-done; }
@keyframes bump-done {
  0% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.cam.is-done .btn-primary { background: var(--accent-ink); color: var(--accent); }

/* ---------- Einstellungen ---------- */
body.sheet-open { overflow: hidden; }
.sheet {
  position: fixed;
  inset: 0;
  z-index: 15;
  overflow-y: auto;
  background: var(--bg);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.sheet[hidden] { display: none; }
.sheet-head {
  max-width: 560px;
  margin: 0 auto;
  padding: 10px var(--gutter) 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sheet-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 30px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sheet-body {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(32px + env(safe-area-inset-bottom));
}
.card-text { margin: 0 0 14px; color: var(--muted); }
.card-small { margin: 10px 0 0; font-size: 14px; }

.start-form { display: grid; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.option:has(input:checked) { border-color: var(--accent); }
.option input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: none; }
.option span { display: grid; gap: 2px; }
.option strong { font-weight: 600; }
.option small { color: var(--muted); font-size: 14px; }
.start-date { display: grid; gap: 10px; }
.start-date[hidden] { display: none; }
.start-date input {
  height: 52px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}
.start-date input:focus { outline: none; border-color: var(--accent); }
.start-date .chip { font-size: 18px; }
.preview { margin: 4px 0 6px; color: var(--accent); font-weight: 600; }

.btn-danger { background: transparent; color: var(--danger); border: 2px solid var(--danger); }
.btn-danger.is-armed { background: var(--danger); color: #fff; font-size: 20px; }

/* Schwellen der Kamera-Zählung */
.threshold-form { display: grid; gap: 12px; }
.threshold-row { display: grid; grid-template-columns: 30px 1fr; gap: 18px; align-items: stretch; }
.threshold-bar {
  position: relative;
  min-height: 220px;
  border-radius: 15px;
  background: var(--surface-2);
  overflow: hidden;
}
.threshold-zone { position: absolute; left: 0; right: 0; background: rgba(212, 255, 58, 0.25); }
.threshold-mark { position: absolute; left: 0; right: 0; height: 3px; margin-bottom: -1px; }
.threshold-mark-up { background: #fff; }
.threshold-mark-down { background: var(--accent); }
.threshold-controls { display: grid; gap: 6px; align-content: start; }
.threshold-controls .card-small { margin: 0 0 10px; color: var(--muted); }
.threshold-controls strong { color: var(--text); font-variant-numeric: tabular-nums; }
.threshold-controls input[type="range"] { width: 100%; height: 32px; margin: 0; accent-color: var(--accent); }
.btn-row { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }

/* ---------- Verlauf ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.tile { padding: 14px; border-radius: var(--radius); background: var(--surface); min-width: 0; }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value {
  margin-top: 4px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
}
.tile-sub { margin-top: 6px; font-size: 13px; color: var(--muted); }
.card-sub { color: var(--muted); font-weight: 600; letter-spacing: 0.02em; text-transform: none; font-size: 15px; }

/* Diagramm */
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -4px 0 10px; font-size: 13px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.key-done { background: var(--accent); }
.key-open { background: #6b717b; }
.key-goal { height: 2px; width: 14px; border-radius: 1px; background: var(--text); }
.key-partial { background: rgba(212, 255, 58, 0.3); }
.key-missed { background: rgba(255, 90, 71, 0.45); }
.chart { position: relative; width: 100%; overflow: hidden; }
.chart svg { display: block; width: 100%; height: auto; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-bar { fill: #6b717b; }
.chart-bar.is-done { fill: var(--accent); }
.chart-goal { fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-hit:hover { fill: rgba(255, 255, 255, 0.05); }
.card { position: relative; }
.chart-tip {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}
.chart-table { margin-top: 10px; font-size: 14px; color: var(--muted); }
.chart-table summary { cursor: pointer; }
.chart-table table { width: 100%; margin-top: 8px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: 4px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }

/* Kalender */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-nav .icon-btn { margin: 0; font-size: 30px; color: var(--text); }
.cal-title { margin: 0; color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 2px; }
.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-width: 0;
  padding: 2px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.1;
}
.cal-num { font-size: 11px; color: var(--muted); }
.cal-done { font-family: var(--display); font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.cal-day.is-done { background: var(--accent); color: var(--accent-ink); }
.cal-day.is-done .cal-num { color: rgba(13, 14, 16, 0.6); }
.cal-day.is-partial { background: rgba(212, 255, 58, 0.22); }
.cal-day.is-missed { background: rgba(255, 90, 71, 0.28); }
.cal-day.is-before { opacity: 0.35; }
.cal-day.is-future { background: transparent; opacity: 0.4; cursor: default; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--text); }
.cal-day.is-selected { box-shadow: inset 0 0 0 3px #4da3ff; }
.cal-legend { margin: 12px 0 0; }
.day-summary { margin: -4px 0 8px; color: var(--muted); }
#day-detail .btn { margin-top: 12px; }

/* Verlauf als eigene Seite am iPhone: Platz für die Kopfzeile */
.history .sheet-head { padding-top: 10px; }

/* ---------- PC: Dashboard zum Auswerten ----------
   Ab 1000 px Breite stehen "Heute" und der Verlauf nebeneinander. Den
   Kamera-Satz gibt es dort nicht, der ist fürs iPhone am Boden. */
@media (min-width: 1000px) {
  .topbar { max-width: 1440px; padding: 18px 32px 8px; }
  .layout {
    display: grid;
    grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
    gap: 28px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 32px 40px;
    align-items: start;
  }
  main { max-width: none; margin: 0; padding: 0; }
  .btn-camera, #history-open { display: none; }

  .history, .history[hidden] {
    display: block;
    position: static;
    z-index: auto;
    overflow: visible;
    padding: 0;
    background: transparent;
  }
  .history .sheet-head { display: none; }
  .history .sheet-body { max-width: none; padding: 0; }
  .tiles { grid-template-columns: repeat(4, 1fr); margin-top: 6px; }
  .tile-value { font-size: 44px; }

  /* Ganzes Jahr: drei Monate pro Zeile */
  .cal.is-year { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 26px; }
  .cal-month-title {
    margin-bottom: 6px;
    font-family: var(--display);
    font-weight: 600;
    font-size: 17px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
  }
  .cal.is-year .cal-grid { gap: 3px; }
  .cal.is-year .cal-day { padding: 1px; border-radius: 6px; }
  .cal.is-year .cal-done { font-size: 12px; letter-spacing: -0.02em; }
  .cal.is-year .cal-num { font-size: 9px; }
  .cal-day:not(:disabled):hover { outline: 2px solid var(--muted); }
}

@media (min-width: 1400px) {
  .cal.is-year { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Tiefster Punkt des letzten Versuchs (Kamera-Ansicht) */
.cam-last {
  min-height: 1.3em;
  text-align: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}
.cam.is-done .cam-last { text-shadow: none; }

/* Kalibrierung */
.calib { display: grid; gap: 10px; margin-bottom: 18px; }
.calib .card-text { margin: 0; }
.calib-info { margin: 0; font-weight: 600; color: var(--accent); }
.link-btn {
  justify-self: start;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  font-size: 15px;
}
.sub-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}
.cam-figure { width: min(40vh, 60vw); color: var(--accent); }
.cam-figure svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.6)); }
.cam.is-calib .cam-depth { display: none; }
.cam.is-calib .cam-count { font-size: min(20vh, 40vw); }
.cam.is-calib .cam-status { text-transform: none; font-size: clamp(26px, 7.5vw, 40px); }
@media (min-width: 1000px) {
  .calib { display: none; } /* Kalibrieren geht nur am iPhone mit Kamera */
}

/* Hinweis "Ton aus" in der Kamera-Ansicht */
.cam-sound {
  height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 26px;
  background: var(--danger);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  animation: pulse 1.6s ease-in-out infinite;
}
.cam-sound[hidden] { display: none; }
@keyframes pulse { 50% { opacity: 0.7; } }

/* Offline */
.offline-badge {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--danger);
  color: #fff;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.offline-badge[hidden] { display: none; }
.badge-pending { color: var(--danger); }
.set.is-pending { opacity: 0.75; }

/* Auswahl in einer Reihe (Sprachansage) */
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
}
.segmented input:checked + span { border-color: var(--accent); background: rgba(212, 255, 58, 0.12); color: var(--accent); }
.segmented input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }

/* Meilensteine im Verlauf */
.ms-next { display: grid; gap: 12px; margin-bottom: 14px; }
.ms-text { margin-bottom: 6px; font-weight: 600; }
.ms-bar { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.ms-fill { height: 100%; border-radius: 5px; background: var(--accent); }
.ms-list { list-style: none; margin: 0; padding: 0; }
.ms-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border-top: 1px solid var(--line);
}
.ms-icon { font-size: 20px; }
.ms-date { color: var(--muted); font-size: 14px; }
.ms-empty { color: var(--muted); }
@media (min-width: 1000px) {
  .ms-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
}

/* Erinnerungen */
.push-actions { display: grid; gap: 10px; margin-bottom: 18px; }
.push-actions:empty { display: none; }
.reminder-form { display: grid; gap: 10px; }
.reminder-form .sub-title { margin: 0; }
.reminder-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.reminder-list:empty { display: none; }
.reminder-item { display: grid; grid-template-columns: 1fr auto 48px; gap: 10px; align-items: center; }
.reminder-item input[type="time"] {
  height: 52px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  -webkit-appearance: none;
  appearance: none;
}
.reminder-item.is-off input[type="time"] { opacity: 0.45; }
.reminder-remove {
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 20px;
}
/* Kippschalter aus einer Checkbox */
.switch { position: relative; display: inline-block; width: 56px; height: 32px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: var(--surface-2);
  transition: background-color 0.2s;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  background: var(--muted);
  transition: transform 0.2s, background-color 0.2s;
}
.switch input:checked + span { background: rgba(212, 255, 58, 0.3); }
.switch input:checked + span::after { transform: translateX(24px); background: var(--accent); }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: none; }

/* ---------- Anmeldung (auth.js) ---------- */
.auth {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px var(--gutter);
}
.auth[hidden] { display: none; }
body.is-auth .topbar, body.is-auth .layout { display: none; }
.auth-box { width: 100%; max-width: 400px; }
.auth-title {
  margin: 0 0 18px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 48px;
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--accent);
}
.auth-text { margin: 0 0 18px; color: var(--muted); }
.auth-text[hidden] { display: none; }
.auth-form { display: grid; gap: 14px; }
.auth-form[hidden], .auth-form .field[hidden] { display: none; }
.auth-error { margin: 0; color: var(--danger); font-weight: 600; }
.auth-error[hidden] { display: none; }

/* ---------- Rangliste (board.js) ---------- */
.board { list-style: none; margin: 0; padding: 0; }
.board-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.board-row:first-child { border-top: 0; }
.board-rank { font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--muted); }
.board-row:first-child .board-rank { color: var(--accent); }
.board-who { display: grid; min-width: 0; }
.board-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-check { color: var(--accent); }
.board-detail { font-size: 14px; color: var(--muted); }
.board-total { font-family: var(--display); font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; }
.board-row.is-me .board-name::after { content: " (du)"; font-weight: 400; color: var(--muted); }
.board-hint { margin-bottom: 0; }

/* ---------- Konto und Mitglieder (account.js) ---------- */
#logout { margin-top: 12px; }
#logout.is-armed { background: var(--danger); color: #fff; font-size: 18px; }
.account-password summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.account-password .auth-form { margin-top: 12px; }
.admin-list { list-style: none; margin: 12px 0 18px; padding: 0; display: grid; gap: 10px; }
.admin-list:empty { display: none; }
.admin-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}
.admin-name { font-weight: 700; }
.admin-meta { font-size: 14px; color: var(--muted); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.admin-item .link-btn.is-armed { color: var(--danger); font-weight: 700; }
.invite-item input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 14px;
}

/* ---------- Über die App: Patchnotes (about.js) ---------- */
.changelog-box summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.changelog { margin-top: 8px; font-size: 15px; }
.changelog h3 {
  margin: 18px 0 6px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  color: var(--accent);
}
.changelog p { margin: 10px 0 4px; }
.changelog ul { margin: 0; padding-left: 20px; color: var(--muted); }
.changelog li { margin: 4px 0; }
.changelog code { font-size: 13px; }
