:root {
  --color-bg: #f4f7f5;
  --color-surface: #ffffff;
  --color-primary: #2f6e5c;
  --color-primary-dark: #23523f;
  --color-text: #1e2b26;
  --color-text-muted: #5b6f68;
  --color-border: #dde5e1;
  --color-danger: #b3432d;
  --illus-figure: #2f6e5c;
  --illus-furniture: #9fb0a8;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(30, 43, 38, 0.08);
}

* { box-sizing: border-box; }

/* [hidden] hat von Haus aus dieselbe Spezifität wie eine einzelne Klasse —
   jede Regel, die auf einem Element mit hidden-Attribut zusätzlich display
   setzt (z.B. .daily-recap, .study-fact), gewinnt sonst je nach Reihenfolge
   gegen [hidden] und macht die Box trotz hidden sichtbar (leer, da der
   Text nur bei Bedarf gesetzt wird). Deshalb hier hart erzwungen. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  padding-bottom: 2rem;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--color-primary);
  color: #fff;
}

.app-header h1 {
  font-size: 1.3rem;
  margin: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.view-switch, .rotation-switch {
  display: flex;
  gap: 0.4rem;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 999px;
  width: 2.1rem;
  height: 2.1rem;
  font-size: 1.05rem;
  cursor: pointer;
  color: #fff;
}

.view-tab {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.view-tab.is-active {
  background: #fff;
  color: var(--color-primary-dark);
  font-weight: 600;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
}

.app-footer {
  max-width: 640px;
  margin: 1rem auto 0;
  padding: 1.25rem 1rem 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  justify-content: center;
  border-top: 1px solid var(--color-border);
}
.app-footer a {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-decoration: none;
}
.app-footer a:hover { color: var(--color-text); }

.view { display: none; }
.view.is-active { display: block; }

.rotation-switch {
  margin-bottom: 1rem;
}

.rotation-tab {
  flex: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.5rem;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

.rotation-tab.is-active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.mode-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.mode-switch-label { font-size: 0.8rem; color: var(--color-text-muted); }
.mode-switch { display: flex; gap: 0.3rem; }
.mode-tab {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--color-text-muted);
}
.mode-tab.is-active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.timer-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.25rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.timer-icon { font-size: 2.5rem; }
.timer-icon.has-illustration { font-size: 0; line-height: 0; }
.timer-icon .posture-illustration-svg { width: 72px; height: 72px; }
.timer-name { font-size: 1.15rem; font-weight: 600; margin-top: 0.25rem; }
.timer-note { font-size: 0.85rem; color: var(--color-text-muted); min-height: 1.1em; margin-top: 0.15rem; }
.timer-clock { font-size: 2.5rem; font-weight: 700; margin: 0.75rem 0 0.5rem; font-variant-numeric: tabular-nums; }

.timer-progress {
  height: 6px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.timer-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  transition: width 0.3s linear;
}

.timer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-primary { background: var(--color-primary); color: #fff; min-width: 6.5rem; }
.btn-secondary { background: #e4efe9; color: var(--color-primary-dark); }
.btn-ghost { background: transparent; color: var(--color-text-muted); font-size: 1.3rem; padding: 0.3rem 0.6rem; }
.btn-link { background: none; color: var(--color-text-muted); text-decoration: underline; padding: 0.4rem; margin-top: 0.5rem; font-size: 0.85rem; }
.timer-link-row { display: flex; justify-content: center; gap: 1rem; }
.btn-danger { background: #fbe4de; color: var(--color-danger); }
.btn-ghost-text { background: none; color: var(--color-text-muted); padding: 0.6rem 0.5rem; }
.btn-block { width: 100%; margin-top: 1rem; }
.btn:disabled { opacity: 0.5; cursor: default; }

.break-banner {
  text-align: center;
  padding: 1rem 0 0.25rem;
}
.break-banner .break-icon { font-size: 2.5rem; }
.break-banner p { color: var(--color-text-muted); margin: 0.5rem 0 0.9rem; }

.next-posture {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: -0.75rem 0 0.75rem;
}
.next-posture strong { color: var(--color-text); }

.walk-info {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: -0.4rem 0 1.25rem;
}

.study-fact {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: var(--color-accent-soft-bg, #e4efe9);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  margin: -0.4rem 0 1.25rem;
  font-size: 0.82rem;
  color: var(--color-text);
  line-height: 1.4;
}
.study-fact-icon { flex: none; }
.study-fact span:not(.study-fact-icon) { flex: 1; }
.study-fact-dismiss {
  flex: none;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 0 0 0.25rem;
}

.onboarding-progress {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.onboarding-progress .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--color-border);
}
.onboarding-progress .dot.is-active { background: var(--color-primary); }
.onboarding-progress .dot.is-done { background: var(--color-primary); opacity: 0.5; }

.onboarding-hint {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0 0 0.85rem;
}

.tile-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.tile {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.tile.is-selected {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.tile-grid-list {
  flex-direction: column;
}
.tile-grid-list .tile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
}
.tile-grid-list .tile .p-cat {
  font-size: 0.78rem;
  opacity: 0.75;
  margin-left: auto;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  font-size: 0.95rem;
}
.switch-row input { width: 1.15rem; height: 1.15rem; }

.switch-hint {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin: -0.35rem 0 0.6rem;
}

.notify-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.notify-row .switch-row { flex: 1; padding: 0.35rem 0; }

.btn-test {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  color: var(--color-primary-dark);
  cursor: pointer;
  white-space: nowrap;
}

.onboarding-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1rem;
}
.onboarding-nav .btn-primary { flex: 1; }

.walk-prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.75rem;
}
.walk-prompt-actions .btn { width: 100%; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.section-head h2 { font-size: 1.05rem; margin: 0; }

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.entry-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  background: var(--color-surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.6rem 0.8rem;
}

.entry-row .entry-icon { font-size: 1.3rem; }
.entry-row .entry-name { flex: 1; font-weight: 500; }
.entry-row .entry-duration { color: var(--color-text-muted); font-size: 0.85rem; white-space: nowrap; }
.entry-timeofday {
  background: #eef3f1;
  border: none;
  border-radius: 999px;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
  cursor: pointer;
}
.entry-row .entry-actions { display: flex; gap: 0.2rem; }
.entry-row .entry-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--color-text-muted);
  padding: 0.2rem 0.35rem;
}
.entry-row .entry-actions button:disabled { opacity: 0.3; cursor: default; }

.entry-weight-row {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.3rem;
  border-top: 1px solid var(--color-border);
}
.entry-weight-label { font-size: 0.75rem; color: var(--color-text-muted); white-space: nowrap; }
.entry-weight-slider { flex: 1; }
.entry-weight-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
  min-width: 1.2rem;
  text-align: right;
}

.empty-hint {
  display: none;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem 0;
}

.db-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.db-toolbar input[type="search"] {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  font-size: 0.95rem;
}

.db-group { margin-bottom: 1.25rem; }
.db-group h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: 0 0 0.4rem;
}

.posture-card {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  background: var(--color-surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.posture-card .p-icon { font-size: 1.4rem; }
.posture-card .p-visual { flex-shrink: 0; display: flex; align-items: flex-start; }
.posture-card .p-visual .posture-illustration-svg { width: 52px; height: 52px; }
.posture-card .p-body { flex: 1; }
.posture-card .p-name { font-weight: 600; }
.posture-card .p-meta { font-size: 0.8rem; color: var(--color-text-muted); }
.posture-card .p-note {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--color-text);
  line-height: 1.4;
}
.posture-card .p-duration-hint {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  color: var(--color-primary-dark);
  line-height: 1.3;
}

.why-toggle {
  display: block;
  background: none;
  border: none;
  padding: 0.35rem 0 0;
  margin: 0;
  font-size: 0.78rem;
  color: var(--color-primary-dark);
  cursor: pointer;
}
.why-hint {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}
.why-hint.hidden { display: none; }

.sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 26, 0.45);
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}

.sheet-overlay.is-open { display: flex; }

.sheet {
  background: var(--color-surface);
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 1.25rem;
}

/* Der Fragebogen (Onboarding) hat pro Schritt teils viel Inhalt (Möbel-
   Kacheln, Haltungs-Vorschläge) und lag als bodenständiges Sheet mit den
   Navigations-Buttons direkt an der Bildschirmunterkante — auf Handys
   landet das oft unter der Browser-/System-Leiste und ist nicht sichtbar.
   Deshalb hier zentriert statt bodenständig, mit Luft nach allen Seiten. */
#onboarding-overlay {
  align-items: center;
  padding: 1rem 0.75rem;
}
#onboarding-overlay .sheet {
  max-height: 85vh;
  border-radius: 18px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.sheet-head h2 { margin: 0; font-size: 1.1rem; }

.btn-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

.sheet-field { margin-bottom: 0.85rem; display: flex; flex-direction: column; gap: 0.3rem; }
.sheet-field label { font-size: 0.85rem; color: var(--color-text-muted); }
.sheet-field input, .sheet-field textarea {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  font-size: 0.95rem;
  font-family: inherit;
}

.sheet-actions { display: flex; justify-content: space-between; gap: 0.5rem; }

#picker-search {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.picker-list {
  max-height: 40vh;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}

.picker-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.4rem;
  border-radius: 8px;
  cursor: pointer;
}

.picker-row.is-selected { background: #e4efe9; }
.picker-row .p-icon { font-size: 1.2rem; }
.picker-row .p-name { flex: 1; }
.picker-row .p-cat { font-size: 0.78rem; color: var(--color-text-muted); }

#picker-confirm { width: 100%; }

/* ---------- Werbefläche (nur Datenbank-Ansicht, nie im Timer) ---------- */
.ad-area { margin: 1.75rem 0 0.5rem; }
.ad-slot.hidden { display: none; }

/* ---------- Cookie-Consent-Banner ---------- */
.consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 10px rgba(30, 43, 38, 0.1);
}
.consent-banner.hidden { display: none; }
.consent-banner p {
  flex: 1 1 240px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text);
  line-height: 1.5;
}
.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-left: auto;
}
/* Beide Buttons bewusst mit identischem visuellem Gewicht (Größe, Rahmen,
   Hintergrund) — keine Option ist als "bevorzugt" gestaltet, siehe
   Kommentar bei .consent-actions in index.html. */
.btn-consent {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn-consent:hover { background: var(--color-bg); }

/* ---------- Einstellungen: Werbe-Cookies + Unterstützen ---------- */
.settings-divider {
  border-top: 1px solid var(--color-border);
  margin: 1.25rem 0;
}
.settings-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.settings-select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  font-family: inherit;
}
.settings-support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.support-link { text-decoration: none; }

/* ---------- Tagesrückblick ---------- */
.daily-recap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--color-text);
}
.daily-recap span:first-child { flex: 1; }
.daily-recap button {
  flex: none;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.85rem;
}

/* ---------- Statistik-Ansicht ---------- */
.stats-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.stats-today { display: flex; gap: 1.5rem; }
.stats-today-item { display: flex; flex-direction: column; }
.stats-today-value { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-today-label { font-size: 0.8rem; color: var(--color-text-muted); }
.stats-streak-row {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--color-text);
}

.stats-history-title { font-size: 1.05rem; margin: 0 0 0.5rem; }
.stats-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.stats-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--color-surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
}
.stats-row-label { flex: 1; font-weight: 500; }
.stats-row-value { color: var(--color-text-muted); white-space: nowrap; }

.screeninfo-content {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
}
.screeninfo-content h2 { font-size: 1.15rem; margin: 0 0 0.6rem; }
.screeninfo-content h3 { font-size: 1rem; margin: 1.1rem 0 0.4rem; }
.screeninfo-content p { margin: 0 0 0.7rem; line-height: 1.5; font-size: 0.92rem; }
.screeninfo-content ul { margin: 0 0 0.7rem; padding-left: 1.2rem; line-height: 1.6; font-size: 0.92rem; }
.screeninfo-content li { margin-bottom: 0.2rem; }
.screeninfo-content a { color: var(--color-primary); }
.screeninfo-content .screeninfo-disclaimer {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.screeninfo-asof {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-align: right;
}
