/* Six Pack – Designsystem
   Gestalterische Interpretation von Apples Liquid-Glass-Richtung in Webtechnik:
   Glas (backdrop-filter) nur für die schwebende Navigations- und Steuerungsebene,
   Inhalte liegen auf ruhigen, deckenden Flächen. Keine Nachbildung echter Systemelemente. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  /* Safe Areas – über Variablen, damit sie sich für Tests simulieren lassen */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  --gutter: 16px;
  --radius-xl: 30px;
  --radius-l: 24px;
  --radius-m: 18px;
  --radius-s: 12px;
  --tabbar-h: 62px;
  --tabbar-gap: max(10px, calc(var(--sab) - 12px));
  --maxw: 600px;

  /* Hell */
  --bg: #F2F2F7;
  --bg-tint-1: rgba(255, 128, 64, 0.20);
  --bg-tint-2: rgba(64, 170, 255, 0.16);
  --surface: #FFFFFF;
  --surface-2: #F5F5F8;
  --surface-3: #ECECF1;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --label: #0B0B0F;
  --label-2: rgba(60, 60, 67, 0.76);
  --label-3: rgba(60, 60, 67, 0.52);
  --sep: rgba(60, 60, 67, 0.16);

  --accent: #D63E0F;
  --accent-text: #C2380C;
  --on-accent: #FFFFFF;
  --accent-soft: rgba(214, 62, 15, 0.12);
  --rest: #0066D6;
  --rest-soft: rgba(0, 102, 214, 0.12);
  --success: #248A3D;
  --success-soft: rgba(36, 138, 61, 0.12);
  --bonus: #B25E00;
  --bonus-fill: #FFB020;
  --bonus-soft: rgba(255, 176, 32, 0.18);
  --danger: #D70015;
  --warn-soft: rgba(255, 159, 10, 0.16);

  --stage: #FFFFFF;
  --stage-floor: #F3F4F7;
  --mat: #86CFC9;
  --mat-side: #5DAAA4;
  --fig-shadow: rgba(0, 0, 0, 0.12);

  --glass-bg: rgba(250, 250, 252, 0.62);
  --glass-bg-strong: rgba(250, 250, 252, 0.8);
  --glass-stroke: rgba(255, 255, 255, 0.8);
  --glass-edge: rgba(0, 0, 0, 0.06);
  --glass-hi: rgba(255, 255, 255, 0.95);
  --glass-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.06);
  --glass-blur: blur(22px) saturate(180%);
  --tint-glass: rgba(214, 62, 15, 0.88);

  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px -12px rgba(0, 0, 0, 0.16);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-tint-1: rgba(255, 106, 51, 0.22);
    --bg-tint-2: rgba(10, 132, 255, 0.16);
    --surface: #1C1C1E;
    --surface-2: #232326;
    --surface-3: #2C2C2E;
    --fill: rgba(120, 120, 128, 0.24);
    --fill-strong: rgba(120, 120, 128, 0.36);
    --label: #FFFFFF;
    --label-2: rgba(235, 235, 245, 0.74);
    --label-3: rgba(235, 235, 245, 0.48);
    --sep: rgba(84, 84, 88, 0.62);
    --accent: #FF6A33;
    --accent-text: #FF7A45;
    --on-accent: #1B0A02;
    --accent-soft: rgba(255, 106, 51, 0.18);
    --rest: #0A84FF;
    --rest-soft: rgba(10, 132, 255, 0.2);
    --success: #30D158;
    --success-soft: rgba(48, 209, 88, 0.18);
    --bonus: #FFD60A;
    --bonus-fill: #FFD60A;
    --bonus-soft: rgba(255, 214, 10, 0.16);
    --danger: #FF453A;
    --stage: #1C1C1E;
    --stage-floor: #232326;
    --mat: #2F6F6B;
    --mat-side: #20504D;
    --fig-shadow: rgba(0, 0, 0, 0.45);
    --glass-bg: rgba(44, 44, 48, 0.56);
    --glass-bg-strong: rgba(44, 44, 48, 0.78);
    --glass-stroke: rgba(255, 255, 255, 0.16);
    --glass-edge: rgba(0, 0, 0, 0.4);
    --glass-hi: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 10px 30px -6px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
    --tint-glass: rgba(255, 106, 51, 0.9);
    --card-shadow: 0 0 0 0 transparent;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-tint-1: rgba(255, 106, 51, 0.22);
  --bg-tint-2: rgba(10, 132, 255, 0.16);
  --surface: #1C1C1E;
  --surface-2: #232326;
  --surface-3: #2C2C2E;
  --fill: rgba(120, 120, 128, 0.24);
  --fill-strong: rgba(120, 120, 128, 0.36);
  --label: #FFFFFF;
  --label-2: rgba(235, 235, 245, 0.74);
  --label-3: rgba(235, 235, 245, 0.48);
  --sep: rgba(84, 84, 88, 0.62);
  --accent: #FF6A33;
  --accent-text: #FF7A45;
  --on-accent: #1B0A02;
  --accent-soft: rgba(255, 106, 51, 0.18);
  --rest: #0A84FF;
  --rest-soft: rgba(10, 132, 255, 0.2);
  --success: #30D158;
  --success-soft: rgba(48, 209, 88, 0.18);
  --bonus: #FFD60A;
  --bonus-fill: #FFD60A;
  --bonus-soft: rgba(255, 214, 10, 0.16);
  --danger: #FF453A;
  --stage: #1C1C1E;
  --stage-floor: #232326;
  --mat: #2F6F6B;
  --mat-side: #20504D;
  --fig-shadow: rgba(0, 0, 0, 0.45);
  --glass-bg: rgba(44, 44, 48, 0.56);
  --glass-bg-strong: rgba(44, 44, 48, 0.78);
  --glass-stroke: rgba(255, 255, 255, 0.16);
  --glass-edge: rgba(0, 0, 0, 0.4);
  --glass-hi: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 10px 30px -6px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
  --tint-glass: rgba(255, 106, 51, 0.9);
  --card-shadow: 0 0 0 0 transparent;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.35;
  color: var(--label);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
a { color: var(--accent-text); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--font-rounded); font-variant-numeric: tabular-nums; }

/* Farbige, ruhige Hintergrundflächen, damit das Glas Kontext hat */
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 40% at 90% -5%, var(--bg-tint-1), transparent 70%),
    radial-gradient(55% 35% at -10% 8%, var(--bg-tint-2), transparent 70%),
    var(--bg);
}

/* ---------- Glas (nur Navigations-/Steuerungsebene) ---------- */
.glass {
  position: relative;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 0.5px solid var(--glass-stroke);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi), inset 0 -0.5px 0 var(--glass-edge);
}
/* Lichtkante (spekulares Highlight) */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(160deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 28%, rgba(255,255,255,0) 70%, rgba(255,255,255,0.18) 100%);
  mix-blend-mode: soft-light;
}
.glass-tint {
  background: var(--tint-glass);
  color: var(--on-accent);
  border-color: color-mix(in srgb, white 35%, transparent);
}
.glass-tint.rest { background: color-mix(in srgb, var(--rest) 90%, transparent); color: #fff; }
.glass-tint.bonus { background: color-mix(in srgb, var(--bonus-fill) 92%, transparent); color: #1B1300; }

/* Reduzierte Transparenz: deckende Flächen, keine Unschärfe */
:root[data-transparency="reduced"] .glass { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; border-color: var(--sep); }
:root[data-transparency="reduced"] .glass::before { display: none; }
:root[data-transparency="reduced"] .glass-tint { background: var(--accent); }
:root[data-transparency="reduced"] .glass-tint.rest { background: var(--rest); }
:root[data-transparency="reduced"] .glass-tint.bonus { background: var(--bonus-fill); }
:root[data-transparency="reduced"] .backdrop { background: var(--bg); }
@media (prefers-reduced-transparency: reduce) {
  :root:not([data-transparency="full"]) .glass { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; border-color: var(--sep); }
  :root:not([data-transparency="full"]) .glass::before { display: none; }
  :root:not([data-transparency="full"]) .glass-tint { background: var(--accent); }
  :root:not([data-transparency="full"]) .glass-tint.rest { background: var(--rest); }
  :root:not([data-transparency="full"]) .glass-tint.bonus { background: var(--bonus-fill); }
  :root:not([data-transparency="full"]) .topbar::after { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; -webkit-mask-image: none; mask-image: none; inset: 0; }
}
@media (prefers-contrast: more) {
  .glass { background: var(--glass-bg-strong); border: 1px solid var(--label-3); }
  .card, .tile { border: 1px solid var(--sep); }
}

/* ---------- App-Gerüst ---------- */
#app { min-height: 100vh; min-height: 100dvh; }
.screen {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: calc(var(--sat) + 12px) calc(var(--gutter) + var(--sar)) calc(var(--tabbar-h) + var(--tabbar-gap) + var(--sab) + 28px) calc(var(--gutter) + var(--sal));
}
.screen.no-tabbar { padding-bottom: calc(var(--sab) + 120px); }
.screen.has-cta { padding-bottom: calc(var(--tabbar-h) + var(--tabbar-gap) + var(--sab) + 104px); }
.screen.no-tabbar.has-cta { padding-bottom: calc(var(--sab) + 120px); }

.view-enter { animation: viewIn 0.32s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Kompakte Kopfzeile, erscheint beim Scrollen (Scroll-Edge-Effekt) */
.topbar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 30;
  padding: calc(var(--sat) + 6px) calc(12px + var(--sar)) 8px calc(12px + var(--sal));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  pointer-events: none;
}
/* Scroll-Edge-Effekt: Inhalt wird unter Statusleiste und Kopfzeile weichgezeichnet und ausgeblendet */
.topbar::after {
  content: ""; position: absolute; inset: 0 0 -22px 0; z-index: -1;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--bg) 92%, transparent) 0,
    color-mix(in srgb, var(--bg) 92%, transparent) calc(var(--sat) + 4px),
    color-mix(in srgb, var(--bg) 55%, transparent) 70%,
    transparent 100%);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 72%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0, #000 72%, transparent 100%);
  opacity: 0; transition: opacity 0.2s;
}
:root[data-transparency="reduced"] .topbar::after { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; -webkit-mask-image: none; mask-image: none; inset: 0; }
.topbar.scrolled::after { opacity: 1; }
.topbar > * { pointer-events: auto; }
.topbar .t-left { justify-self: start; display: flex; gap: 8px; }
.topbar .t-right { justify-self: end; display: flex; gap: 8px; }
.topbar .t-title {
  font-weight: 600; font-size: 17px; opacity: 0; transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw;
}
.topbar.scrolled .t-title, .topbar.always .t-title { opacity: 1; transform: none; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--label);
  transition: transform 0.15s var(--ease);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 22px; height: 22px; }
.pill-btn {
  height: 44px; padding: 0 16px; border-radius: 22px; font-weight: 600; font-size: 16px;
  display: inline-flex; align-items: center; gap: 6px; color: var(--label);
}
.pill-btn svg { width: 18px; height: 18px; }

.large-title {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin: 44px 0 14px;
}
.large-title h1 { font-family: var(--font-display); font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.large-title .sub { color: var(--label-2); font-size: 15px; margin-top: 2px; }

/* ---------- Tab-Leiste (schwebendes Glas) ---------- */
.tabbar {
  position: fixed; z-index: 40;
  left: calc(16px + var(--sal)); right: calc(16px + var(--sar));
  bottom: calc(var(--tabbar-gap));
  max-width: 460px; margin: 0 auto;
  height: var(--tabbar-h); border-radius: 31px;
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 5px;
}
.tabbar a {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 26px; text-decoration: none; color: var(--label-2);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em;
  transition: color 0.2s, background 0.25s var(--ease);
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent-text); background: var(--fill); }

/* Schwebende Hauptaktion über der Tab-Leiste */
.cta-dock {
  position: fixed; z-index: 39;
  left: calc(16px + var(--sal)); right: calc(16px + var(--sar));
  bottom: calc(var(--tabbar-gap) + var(--tabbar-h) + 12px);
  max-width: 460px; margin: 0 auto;
}
.screen.no-tabbar ~ .cta-dock, .cta-dock.no-tabbar { bottom: calc(var(--sab) + 14px); }
.cta {
  width: 100%; height: 58px; border-radius: 29px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
  transition: transform 0.15s var(--ease), filter 0.2s;
}
.cta:active { transform: scale(0.98); }
.cta svg { width: 22px; height: 22px; }
.cta[disabled] { background: var(--surface-3); color: var(--label-3); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.cta[disabled]::before { display: none; }

/* ---------- Inhaltsflächen (deckend) ---------- */
.card {
  background: var(--surface); border-radius: var(--radius-l);
  box-shadow: var(--card-shadow); padding: 16px;
}
.card + .card, .section + .card { margin-top: 12px; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 8px; }
.section-head h2 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.section-head .aside { color: var(--label-2); font-size: 15px; }
.muted { color: var(--label-2); }
.small { font-size: 13px; }
.footnote { font-size: 13px; color: var(--label-2); line-height: 1.4; }
.center { text-align: center; }

.list { background: var(--surface); border-radius: var(--radius-m); box-shadow: var(--card-shadow); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px;
  position: relative; width: 100%; text-align: left; color: var(--label);
}
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--sep); }
.row.with-thumb + .row::before, .row + .row.with-thumb::before { left: 84px; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 17px; }
.row .subtitle { font-size: 14px; color: var(--label-2); margin-top: 1px; }
.row .value { color: var(--label-2); font-size: 16px; white-space: nowrap; }
.row .chev { color: var(--label-3); width: 18px; height: 18px; flex: none; display: grid; place-items: center; }
.row .chev svg, .row > svg { width: 18px; height: 18px; flex: none; }
a.row, a.tile, a.btn { text-decoration: none; color: inherit; }
a.btn.primary { color: var(--on-accent); }
a.btn.tinted { color: var(--accent-text); }
.row .lead-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.row .lead-icon svg { width: 18px; height: 18px; }
button.row:active, a.row:active { background: var(--fill); }
.row.danger-row .title { color: var(--danger); }
.row .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.thumb {
  width: 60px; height: 42px; flex: none; border-radius: 10px; background: var(--stage-floor);
  display: grid; place-items: center; overflow: hidden;
}
.thumb svg { width: 100%; height: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle;
  background: var(--fill); color: var(--label-2);
}
.badge.belegt { background: var(--success-soft); color: var(--success); }
.badge.rekonstruiert { background: var(--warn-soft); color: color-mix(in srgb, var(--bonus) 80%, var(--label)); }
.badge.eigenes { background: var(--rest-soft); color: var(--rest); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 16px; background: var(--fill); font-size: 14px; font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px; border-radius: 25px; font-weight: 600; font-size: 17px;
  transition: transform 0.15s var(--ease), background 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.secondary { background: var(--fill); color: var(--label); }
.btn.tinted { background: var(--accent-soft); color: var(--accent-text); }
.btn.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 15px; border-radius: 18px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.link-btn { color: var(--accent-text); font-weight: 600; font-size: 15px; padding: 8px 0; }

/* Segmentierte Auswahl */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; gap: 2px;
  background: var(--fill); border-radius: 12px;
}
.segmented button { height: 34px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--label-2); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--label); box-shadow: 0 2px 8px rgba(0,0,0,0.12); }

/* Schalter */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--fill-strong); transition: background 0.2s; pointer-events: none; }
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,0.15), 0 1px 1px rgba(0,0,0,0.16); transition: transform 0.25s var(--ease);
}
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(20px); }

/* Zähler (Stepper) */
.stepper { display: inline-flex; align-items: center; background: var(--fill); border-radius: 10px; height: 34px; }
.stepper button { width: 40px; height: 34px; display: grid; place-items: center; color: var(--label); }
.stepper button svg { width: 16px; height: 16px; }
.stepper button[disabled] { opacity: 0.3; }
.stepper output { min-width: 58px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px; }

input.text, textarea.text, select.text {
  width: 100%; border: 0; border-radius: 12px; background: var(--fill); padding: 13px 14px; font-size: 17px; color: var(--label);
}
textarea.text { min-height: 84px; resize: vertical; }

/* ---------- Programmübersicht ---------- */
.hero {
  display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center;
  padding: 18px;
}
.ring { position: relative; width: 104px; height: 104px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--fill-strong); }
.ring .bar { stroke: var(--accent); transition: stroke-dashoffset 0.8s var(--ease); }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .ring-label b { font-family: var(--font-rounded); font-size: 30px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.ring .ring-label span { font-size: 12px; color: var(--label-2); margin-top: 2px; }
.hero .kicker { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-text); }
.hero .day { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin: 2px 0 4px; }
.hero .meta { color: var(--label-2); font-size: 15px; }
.level-dots { display: flex; gap: 4px; margin-top: 10px; }
.level-dots i { flex: 1; height: 6px; border-radius: 3px; background: var(--fill-strong); }
.level-dots i.done { background: var(--accent); }
.level-dots i.now { background: color-mix(in srgb, var(--accent) 40%, transparent); }

.banner {
  display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius-m);
  background: var(--surface); box-shadow: var(--card-shadow); margin-bottom: 12px;
  border-left: 4px solid var(--accent);
}
.banner .grow { flex: 1; min-width: 0; }
.banner b { display: block; }
.banner .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.banner.info { border-left-color: var(--rest); }

.tip { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.tip .tip-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--bonus-soft); color: var(--bonus); }
.tip .tip-icon svg { width: 20px; height: 20px; }
.tip h3 { margin: 0 0 2px; font-size: 16px; }
.tip p { margin: 0; color: var(--label-2); font-size: 15px; }

/* ---------- Übungsbibliothek ---------- */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 520px) { .grid2 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile {
  background: var(--surface); border-radius: var(--radius-m); overflow: hidden; box-shadow: var(--card-shadow);
  display: flex; flex-direction: column; text-align: left; color: var(--label);
  transition: transform 0.15s var(--ease);
}
.tile:active { transform: scale(0.98); }
.tile .tile-stage { aspect-ratio: 16 / 10; background: var(--stage-floor); position: relative; }
.tile .tile-stage svg { width: 100%; height: 100%; display: block; }
.tile .fav { position: absolute; top: 6px; right: 6px; color: var(--bonus-fill); }
.tile .fav svg { width: 18px; height: 18px; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25)); }
.tile .tile-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tile .tile-name { font-weight: 600; font-size: 15px; line-height: 1.25; }
.tile .tile-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }
.level { display: inline-flex; gap: 3px; align-items: center; font-size: 12px; color: var(--label-2); font-weight: 600; }
.level i { width: 5px; height: 12px; border-radius: 2px; background: var(--fill-strong); }
.level i.on { background: var(--accent); }

.scope-note {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-m);
  background: var(--surface); box-shadow: var(--card-shadow); font-size: 14px; color: var(--label-2); margin-bottom: 12px;
}
.scope-note svg { width: 20px; height: 20px; flex: none; color: var(--rest); margin-top: 1px; }
.scope-note b { color: var(--label); }

/* Bühne für den Trainer (deckend – Lesbarkeit vor Glas) */
.stage {
  position: relative; background: linear-gradient(to bottom, var(--stage) 0%, var(--stage) 62%, var(--stage-floor) 100%);
  border-radius: var(--radius-l); overflow: hidden;
}
.stage svg.figure { width: 100%; height: 100%; display: block; }
.stage .stage-caption {
  position: absolute; left: 10px; bottom: 8px; font-size: 11px; font-weight: 600; color: var(--label-3);
  letter-spacing: 0.02em;
}
.fig-mat { fill: var(--mat); }
.fig-mat-side { fill: var(--mat-side); }
.fig-shadow { fill: var(--fig-shadow); }
.fig-focus { animation: focusPulse 2.4s ease-in-out infinite; transform-box: fill-box; }
@keyframes focusPulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 8px 0; }
.steps li::before {
  content: counter(step); width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text);
  font-weight: 700; font-size: 14px; display: grid; place-items: center; font-family: var(--font-rounded);
}
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-s); background: var(--warn-soft); font-size: 15px; }
.callout svg { width: 20px; height: 20px; flex: none; color: var(--bonus); }

/* ---------- Workout-Player ---------- */
.player {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: calc(var(--sat) + 8px) calc(12px + var(--sar)) calc(var(--sab) + 12px) calc(12px + var(--sal));
  overflow: hidden;
}
.player .p-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.player .p-top .p-where { text-align: center; font-size: 14px; font-weight: 600; color: var(--label-2); }
.player .p-top .p-where b { color: var(--label); display: block; font-size: 15px; }
.player .p-stage-wrap { position: relative; min-height: 0; margin: 10px 0 8px; display: grid; }
.player .stage { height: 100%; min-height: 150px; }
.player .next-label {
  position: absolute; top: 10px; left: 12px; z-index: 2;
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 12px; background: var(--rest-soft); color: var(--rest);
}
.player .p-info { text-align: center; padding: 4px 4px 10px; }
.player .p-ex-name { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.player .p-set { font-size: 16px; color: var(--label-2); margin-top: 2px; }
.player .p-counter {
  font-family: var(--font-rounded); font-variant-numeric: tabular-nums; font-weight: 700;
  font-size: clamp(64px, 20vw, 112px); line-height: 1; letter-spacing: -0.03em; margin: 8px 0 0;
}
.player .p-counter small { font-size: 0.42em; color: var(--label-2); font-weight: 600; letter-spacing: 0; }
.player .p-unit { font-size: 15px; color: var(--label-2); font-weight: 600; }
.player.is-rest .p-counter { color: var(--rest); }
.player.is-prep .p-counter { color: var(--accent-text); }
.player .extra-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 12px; border-radius: 14px;
  background: var(--rest-soft); color: var(--rest); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums;
}
.player .extra-chip[hidden], .player .next-label[hidden] { display: none; }
.player .p-progress { display: grid; gap: 6px; padding: 0 4px 12px; }
.segbar { display: flex; gap: 3px; height: 8px; }
.segbar i { flex: 1; border-radius: 4px; background: var(--fill-strong); position: relative; overflow: hidden; }
.segbar i > b { position: absolute; inset: 0; width: 0; background: var(--accent); border-radius: inherit; }
.segbar i.done > b { width: 100%; }
.segbar i.skipped { background: repeating-linear-gradient(45deg, var(--fill-strong) 0 4px, transparent 4px 8px); }
.p-progress .p-times { display: flex; justify-content: space-between; font-size: 14px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.p-progress .p-times b { color: var(--label); font-weight: 700; }
.p-controls {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  height: 92px; border-radius: 46px; padding: 0 14px; margin: 0 auto; width: 100%; max-width: 460px;
}
.p-controls .ctl {
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--label);
  min-width: 64px; min-height: 64px; justify-content: center; border-radius: 32px;
}
.p-controls .ctl svg { width: 26px; height: 26px; }
.p-controls .ctl:active { background: var(--fill); }
.p-controls .ctl[hidden] { visibility: hidden; display: flex; }
.p-controls .main {
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  transition: transform 0.15s var(--ease);
}
.p-controls .main:active { transform: scale(0.95); }
.p-controls .main svg { width: 34px; height: 34px; }
.wake-note { text-align: center; font-size: 12px; color: var(--label-3); margin-top: 6px; min-height: 16px; }

/* Querformat: Trainer links, Zahlen rechts (z. B. iPhone quer auf dem Boden) */
@media (orientation: landscape) and (max-height: 560px) {
  .player {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    column-gap: 16px;
  }
  .player .p-top { grid-column: 1 / -1; }
  .player .p-stage-wrap { grid-row: 2 / 4; margin: 8px 0 0; }
  .player .p-right { grid-row: 2; display: flex; flex-direction: column; justify-content: center; }
  .player .p-controls { grid-column: 2; grid-row: 3; height: 76px; }
  .player .p-controls .main { width: 64px; height: 64px; }
  .player .p-counter { font-size: clamp(52px, 14vh, 88px); }
}

/* Overlays (Pause, Bonus) */
.overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: end center;
  background: rgba(0, 0, 0, 0.38);
  padding: calc(var(--sat) + 20px) calc(12px + var(--sar)) calc(var(--sab) + 12px) calc(12px + var(--sal));
  animation: fadeIn 0.2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-width: 520px; background: var(--surface); border-radius: 32px; padding: 22px 20px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35); animation: sheetIn 0.36s var(--ease) both;
  max-height: calc(100dvh - var(--sat) - var(--sab) - 40px); overflow: auto;
}
@keyframes sheetIn { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.01em; text-align: center; }
.sheet p { margin: 0 0 12px; color: var(--label-2); text-align: center; }
.sheet .sheet-actions { display: grid; gap: 10px; margin-top: 16px; }
.sheet .sheet-actions.two { grid-template-columns: 1fr 1fr; }
.sheet-grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--fill-strong); margin: -10px auto 12px; }
.medal { width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--bonus-soft); color: var(--bonus); }
.medal svg { width: 44px; height: 44px; }
.medal.success { background: var(--success-soft); color: var(--success); }

/* ---------- Ergebnis ---------- */
.result-hero { text-align: center; margin: 56px 0 18px; }
.result-hero h1 { font-family: var(--font-display); font-size: 34px; margin: 6px 0 4px; letter-spacing: -0.02em; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border-radius: var(--radius-m); padding: 14px 16px; box-shadow: var(--card-shadow); }
.stat b { display: block; font-family: var(--font-rounded); font-size: 34px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat span { color: var(--label-2); font-size: 14px; }
.stat.accent b { color: var(--accent-text); }
.moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.moods button {
  height: 56px; border-radius: 16px; font-size: 28px; background: var(--fill); transition: transform 0.15s var(--ease), background 0.2s;
}
.moods button[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); transform: scale(1.04); }

/* ---------- Verlauf ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border-radius: var(--radius-m); padding: 12px; box-shadow: var(--card-shadow); }
.kpi b { display: block; font-family: var(--font-rounded); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--label-2); }
.weekbars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; align-items: end; height: 96px; padding-top: 8px; }
.weekbars div { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.weekbars i { width: 100%; max-width: 26px; border-radius: 6px 6px 3px 3px; background: var(--accent); min-height: 3px; }
.weekbars i.zero { background: var(--fill-strong); }
.weekbars span { font-size: 11px; color: var(--label-3); }
.month-head { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--label-2); margin: 20px 4px 8px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); flex: none; }
.status-dot.abgebrochen { background: var(--label-3); }

/* ---------- Onboarding ---------- */
.onb { text-align: center; }
.onb h1 { font-family: var(--font-display); font-size: 34px; letter-spacing: -0.02em; margin: 56px 0 8px; line-height: 1.1; }
.onb .lead { color: var(--label-2); font-size: 17px; margin: 0 auto 22px; max-width: 34ch; }
.trainers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trainer-card {
  background: var(--surface); border-radius: var(--radius-l); overflow: hidden; box-shadow: var(--card-shadow);
  text-align: center; padding-bottom: 12px; position: relative; transition: transform 0.15s var(--ease), box-shadow 0.2s;
}
.trainer-card .tc-stage { aspect-ratio: 1 / 1; background: var(--stage-floor); }
.trainer-card .tc-stage svg { width: 100%; height: 100%; }
.trainer-card b { display: block; font-size: 20px; margin-top: 8px; }
.trainer-card span { font-size: 13px; color: var(--label-2); }
.trainer-card[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--accent), var(--card-shadow); }
.trainer-card .check {
  position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: none; place-items: center;
}
.trainer-card .check svg { width: 16px; height: 16px; }
.trainer-card[aria-pressed="true"] .check { display: grid; }
.privacy { display: flex; gap: 12px; text-align: left; align-items: flex-start; margin-top: 16px; }
.privacy svg { width: 26px; height: 26px; color: var(--success); flex: none; }

/* ---------- Baukasten ---------- */
.builder-step { display: grid; grid-template-columns: 60px 1fr; gap: 12px; padding: 12px 14px; position: relative; }
.builder-step + .builder-step::before { content: ""; position: absolute; top: 0; left: 86px; right: 0; border-top: 0.5px solid var(--sep); }
.builder-step .bs-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.builder-step .bs-order { display: flex; gap: 2px; margin-left: auto; }
.builder-step .bs-order .icon-btn { width: 36px; height: 36px; background: var(--fill); }
.builder-step .bs-order .icon-btn svg { width: 18px; height: 18px; }
.picker-list { max-height: 55dvh; overflow: auto; margin: 0 -20px; padding: 0 8px; }
.search { position: relative; margin-bottom: 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; z-index: 80; transform: translateX(-50%);
  bottom: calc(var(--tabbar-gap) + var(--tabbar-h) + 84px);
  padding: 12px 18px; border-radius: 22px; font-size: 15px; font-weight: 600; max-width: calc(100vw - 32px);
  animation: toastIn 0.3s var(--ease) both; text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.empty { text-align: center; padding: 28px 16px; color: var(--label-2); }
.empty svg { width: 40px; height: 40px; color: var(--label-3); margin-bottom: 8px; }
.error-box { white-space: pre-wrap; font-family: ui-monospace, monospace; font-size: 13px; }

/* ---------- Reduzierte Bewegung ---------- */
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after {
  animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- Test-Simulation einer iPhone-Hardware (nur mit ?sim=iphone) ---------- */
:root.sim-iphone { --sat: 59px; --sab: 34px; }
.sim-island {
  position: fixed; top: 11px; left: 50%; transform: translateX(-50%); width: 124px; height: 36px; border-radius: 20px;
  background: #000; z-index: 1000; pointer-events: none;
}
.sim-home {
  position: fixed; bottom: 8px; left: 50%; transform: translateX(-50%); width: 140px; height: 5px; border-radius: 3px;
  background: var(--label); opacity: 0.85; z-index: 1000; pointer-events: none;
}
.sim-status {
  position: fixed; top: 0; left: 0; right: 0; height: 54px; z-index: 999; pointer-events: none;
  display: flex; justify-content: space-between; align-items: center; padding: 6px 34px 0; font-weight: 600; font-size: 16px;
}
