:root {
  --bg: #000000;
  --surface: #1C1C1E;
  --surface-2: #2C2C2E;
  --divider: rgba(255,255,255,0.09);
  --text: #F5F5F7;
  --text-secondary: #8E8E93;
  --accent-green: #30D158;
  --accent-blue: #0A84FF;
  --accent-pink: #FA114F;
  --accent-orange: #FF9F0A;
  --radius-lg: 20px;
  --radius-md: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.tabular { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, monospace; }

#app { display: flex; flex-direction: column; height: 100%; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(var(--safe-top) + 14px) 20px 12px;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--divider);
}
.topbar-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-date { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

main.view {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px calc(96px + var(--safe-bottom));
}
main.view.active { display: block; }

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  padding-bottom: var(--safe-bottom);
  background: rgba(20,20,22,0.78);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--divider);
  z-index: 20;
}
.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 6px;
  font-size: 11px;
  font-family: inherit;
}
.tab-icon { font-size: 20px; line-height: 1; }
.tab.active { color: var(--accent-green); }

/* ---- Karten ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

/* ---- Aktivitätsringe (Signature-Element) ---- */
.rings-card { display: flex; align-items: center; gap: 20px; }
.rings-wrap { position: relative; width: 108px; height: 108px; flex-shrink: 0; }
.rings-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.08); }
.ring-fg { fill: none; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.rings-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.legend-row { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-label { color: var(--text-secondary); }
.legend-value { margin-left: auto; font-weight: 600; }

/* ---- Übungen (Heute) ---- */
.exercise-card { padding: 16px 16px 8px; }
.exercise-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.exercise-name { font-size: 17px; font-weight: 600; }
.exercise-meta { font-size: 12px; color: var(--text-secondary); }
.caution-note {
  font-size: 12px;
  color: var(--accent-orange);
  margin: 4px 0 10px;
  line-height: 1.4;
}
.set-row {
  display: grid;
  grid-template-columns: 28px 1fr 78px 78px 34px;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid var(--divider);
}
.set-row:first-of-type { border-top: none; }
.set-num { color: var(--text-secondary); font-size: 13px; }
.set-target { font-size: 13px; color: var(--text-secondary); }
.set-target.recovery { color: var(--accent-blue); }
.set-input {
  background: var(--surface-2);
  border: none;
  border-radius: 10px;
  color: var(--text);
  padding: 8px 6px;
  font-size: 15px;
  text-align: center;
  width: 100%;
  font-family: inherit;
}
.set-check {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--divider);
  background: transparent;
  color: transparent;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.set-check.done { background: var(--accent-green); border-color: var(--accent-green); color: #04180a; }

.rest-day-card { text-align: center; padding: 40px 20px; }
.rest-day-card .big { font-size: 40px; margin-bottom: 8px; }

/* ---- Woche ---- */
.week-day-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--divider);
}
.week-day-row:first-child { border-top: none; }
.week-day-name { font-weight: 600; }
.week-day-group { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.week-day-exercises { font-size: 12px; color: var(--text-secondary); text-align: right; max-width: 55%; }
.rotation-note { font-size: 12px; color: var(--text-secondary); margin-top: 14px; text-align: center; }

/* ---- Statistik ---- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-box { background: var(--surface); border-radius: var(--radius-md); padding: 14px; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.chart-wrap { width: 100%; height: 160px; margin-top: 6px; }

/* ---- Einstellungen ---- */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--divider);
}
.setting-row:first-child { border-top: none; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button {
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--surface-2); color: var(--text);
  font-size: 18px;
}
.primary-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent-green);
  color: #04180a;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  margin-top: 6px;
}
.ghost-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--accent-pink);
  border: none;
  font-size: 15px;
  font-weight: 500;
}
.bw-input-row { display: flex; gap: 10px; }
.bw-input-row input { flex: 1; }

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 50;
}
.toast.show { opacity: 1; }
