/* Dunkles Design: schont im Gym die Augen und den Akku (OLED-Display). */
:root {
  --bg: #111418;
  --surface: #1c2128;
  --surface-2: #262d36;
  --border: #333b45;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #4caf50;
  --accent-text: #0b1a0c;
  --danger: #ef5350;
  --tap: 56px; /* Mindesthöhe für Knöpfe: gut mit dem Daumen treffbar */
  --tabbar-h: 60px;
}

* { box-sizing: border-box; }

/* "hidden" soll immer verstecken, auch wenn eine Klasse display setzt */
[hidden] { display: none !important; }

html { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.35;
  /* Platz für Kamera-Loch oben und Navigation + Timer unten */
  padding: env(safe-area-inset-top) 16px calc(var(--tabbar-h) + 90px + env(safe-area-inset-bottom));
}

h1 { font-size: 1.4rem; margin: 20px 0 14px; }
h2 { font-size: 1.15rem; margin: 22px 0 10px; }
h3 { font-size: 0.85rem; margin: 18px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
h1 small { font-size: 0.8rem; font-weight: normal; }

a { color: var(--accent); }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

/* --- Knöpfe --- */
.btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: var(--tap);
  margin: 10px 0;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.stack .btn { margin: 0; }
.btn small { font-weight: normal; color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.btn:active { filter: brightness(1.25); }
.btn-big { min-height: 80px; font-size: 1.2rem; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary small { color: var(--accent-text); opacity: 0.75; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-outline { background: transparent; border-color: var(--danger); color: var(--danger); margin-top: 28px; }
.btn:disabled { opacity: 0.4; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.btn-small {
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

/* --- Listenzeilen (Übungen, Trainings) --- */
.row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 6px;
}
.row:active { filter: brightness(1.25); }
.row-title { font-weight: 600; }
.row-sub { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.row-done { border-left: 4px solid var(--accent); }
.row.selected { border-color: var(--accent); background: var(--surface-2); }

/* --- Übungs-Bildschirm --- */
.last-time {
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.last-time strong { display: block; color: var(--muted); font-size: 0.8rem; font-weight: normal; }

.stepper { margin-bottom: 12px; }
.stepper label { display: block; color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
.stepper-row { display: flex; gap: 8px; }
.stepper-row button {
  width: 72px;
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.8rem;
  font-weight: 600;
}
.stepper-row button:active { filter: brightness(1.3); }
.stepper-row input {
  flex: 1;
  min-width: 0;
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
}

.chips { display: flex; gap: 6px; margin-bottom: 8px; }
.chips button {
  flex: 1;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.chips button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }

.back { display: inline-block; padding: 14px 0 0; text-decoration: none; font-size: 0.95rem; }
.small-label { display: block; font-size: 0.85rem; margin-bottom: 4px; }
.error { color: var(--danger); margin: 6px 0; }

.set-row { flex-direction: row; justify-content: space-between; align-items: center; }
.set-row .set-no { color: var(--muted); font-size: 0.85rem; }
.set-row.editing { border-color: var(--accent); }

/* --- Formulare (Einstellungen) --- */
.field { margin-bottom: 14px; }
.field label { display: block; color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
.field input[type="text"], .field input[type="number"], .field select {
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.check { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); }

.tpl-item { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.tpl-item span { flex: 1; padding: 10px 12px; background: var(--surface); border-radius: 10px; }
.tpl-item button { width: 44px; min-height: 44px; }

/* --- Hinweise --- */
.banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #3a2f12;
  color: #ffe08a;
  font-size: 0.95rem;
}
.info { background: var(--surface); border-radius: 12px; padding: 12px 14px; font-size: 0.95rem; }

/* --- Pausentimer --- */
.timer {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 16px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.timer .time { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer .label { flex: 1; color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer button { min-height: 48px; }
.timer.finished { background: var(--accent); color: var(--accent-text); }
.timer.finished .label { color: var(--accent-text); }

/* --- Navigation unten --- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabbar a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.tabbar a.active { color: var(--accent); font-weight: 700; }

/* Kleine Knöpfe, die eigentlich Links sind (z. B. "Sichern" im Hinweis) */
a.btn-small { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
