/* Gym Tracker – Design-System „Liquid Glass“
 * Blauer Verlauf mit drei Farbflecken, darauf Glas (Unschärfe, Glanz, Lichtkante),
 * einfarbig: weiß im dunklen, tiefblau im hellen Design. Alle Farben, Abstände, Radien,
 * Dauern und Kurven sind Tokens. Animiert wird nur transform & opacity (einzige Ausnahme:
 * die Höhe der Tab-Leiste).
 */

/* =========================================================
 *  Tokens
 * ========================================================= */

/* „Liquid Glass“ – Werte wie in der Demo unter liquid-glass/ (Material, Farbflecken, Text, Akzent) */
:root,
:root[data-theme="dark"] {
  --bg: #081120;
  --bg-a: #060d1c;
  --bg-b: #0b1626;
  --orb-1: #1b6dff;
  --orb-2: #0fb89a;
  --orb-3: #e0762f;
  --surface: #1e1e22;
  --surface-2: #26262c;
  --surface-3: #34343c;
  --press: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.26);
  --text: #ffffff;
  --text-2: #f2f2f7;
  --muted: #e0e4ee;          /* Kontrast ≥ 4,5:1 auch vor den hellsten Farbflecken (geprüft per Pixel) */
  --faint: #7f8596;
  --inv: #ffffff;            /* aktive/primäre Fläche: im dunklen Design weiß … */
  --on-inv: #0b1220;
  --accent-ink: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.1);
  --accent-line: rgba(255, 255, 255, 0.34);
  --accent-glow: rgba(255, 255, 255, 0.22);
  --danger: #ff8fa3;
  --on-danger: #2a0610;
  --input-bg: rgba(255, 255, 255, 0.07);
  --input-border: rgba(255, 255, 255, 0.2);
  --glass: rgba(8, 17, 32, 0.82);
  --backdrop: rgba(0, 0, 0, 0.62);
  --sk: rgba(255, 255, 255, 0.07);
  --sk-hi: rgba(255, 255, 255, 0.16);
  --ring-track: rgba(255, 255, 255, 0.2);

  /* Material */
  --lg-blur: 44px;
  --lg-tint: 0.5;
  --lg-saturate: 1.7;
  --lg-brightness: 1.04;
  /* Regler „Klar ↔ Getönt“ (Einstellungen → Darstellung, wie in iOS 27): --lg-tint 0 … 1, Vorgabe 0,5 */
  --lg-fill: rgba(28, 28, 32, calc(0.58 + 0.3 * var(--lg-tint)));
  --lg-card-fill: rgba(28, 28, 32, calc(0.66 + 0.28 * var(--lg-tint)));
  --lg-fill-press: rgba(48, 48, 56, calc(0.7 + 0.28 * var(--lg-tint)));
  --lg-pill-fill: rgba(255, 255, 255, calc(0.05 + 0.06 * var(--lg-tint)));
  --lg-pill-spec: rgba(255, 255, 255, 0.03);
  --lg-fill-solid: rgb(34, 34, 38);
  --lg-card-fill-solid: rgb(30, 30, 34);
  --lg-text: #ffffff;
  --lg-text-active: #ffffff;
  --lg-edge-top: rgba(255, 255, 255, 0.52);
  --lg-edge-mid: rgba(255, 255, 255, 0.12);
  --lg-edge-bottom: rgba(0, 0, 0, 0.6);
  --lg-edge-corner: rgba(255, 255, 255, 0.34);
  --lg-edge-dark: rgba(0, 0, 0, 0.34);
  --lg-rim-top: rgba(255, 255, 255, 0.28);
  --lg-rim-bottom: rgba(0, 0, 0, 0.5);
  --lg-glow: rgba(255, 255, 255, 0.05);
  --lg-hairline: rgba(255, 255, 255, 0.08);
  --lg-spec-dome: rgba(255, 255, 255, 0.17);
  --lg-spec-spot: rgba(255, 255, 255, 0.2);
  --lg-spec-sheen: rgba(255, 255, 255, 0.05);
  /* Berührung: Licht unter dem Finger (Weiß, additiv) */
  --gt-a1: 0.3;
  --gt-a2: 0.1;
  --gt-edge: 0.5;
  --gt-blend: plus-lighter;
  --lg-shadow-a: rgba(0, 0, 0, 0.18);
  --lg-shadow-b: rgba(0, 0, 0, 0.2);
  --lg-shadow-c: rgba(0, 0, 0, 0.28);
  --lg-shadow-d: rgba(0, 0, 0, 0.4);
  /* ältere Namen (Timer, Toast, Sheets, Chips) zeigen auf dasselbe Material */
  --glass-fill: var(--lg-fill);
  --glass-fill-strong: rgba(28, 28, 32, 0.86);
  --glass-tint: rgba(255, 255, 255, 0.05);
  --glass-edge: rgba(255, 255, 255, 0.18);
  --glass-line: var(--lg-hairline);
  --glass-hi: var(--lg-rim-top);
  --glass-lo: rgba(255, 255, 255, 0.04);
  --glass-shadow: 0 14px 28px rgba(0, 0, 0, 0.28), 0 4px 10px rgba(0, 0, 0, 0.2);
  --glass-lens: rgba(255, 255, 255, 0.1);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f1f4fb;
  --bg-a: #eaf3ff;
  --bg-b: #fbf1e4;
  --orb-1: #6fb7ff;
  --orb-2: #7fe3c6;
  --orb-3: #ffbe8a;
  --surface: #fafafc;
  --surface-2: #f1f2f6;
  --surface-3: #e2e4ea;
  --press: rgba(29, 29, 31, 0.08);
  --border: rgba(29, 29, 31, 0.12);
  --border-strong: rgba(29, 29, 31, 0.3);
  --text: #1d1d1f;
  --text-2: #3a3a3f;
  --muted: #3d3d44;          /* Kontrast ≥ 4,5:1 auch vor den hellsten Farbflecken (geprüft per Pixel) */
  --faint: #9a9aa4;
  --inv: #0832a8;            /* … im hellen Design tiefblau (weißer Text darauf: 11:1) */
  --on-inv: #ffffff;
  --accent-ink: #0832a8;
  --accent-soft: rgba(8, 50, 168, 0.1);
  --accent-line: rgba(8, 50, 168, 0.36);
  --accent-glow: rgba(8, 50, 168, 0.3);
  --danger: #bb1d42;
  --on-danger: #ffffff;
  --input-bg: rgba(255, 255, 255, 0.7);
  --input-border: rgba(29, 29, 31, 0.22);
  --glass: rgba(241, 244, 251, 0.86);
  --backdrop: rgba(20, 28, 48, 0.28);
  --sk: rgba(29, 29, 31, 0.07);
  --sk-hi: rgba(255, 255, 255, 0.7);
  --ring-track: rgba(29, 29, 31, 0.14);

  --lg-fill: rgba(255, 255, 255, calc(0.4 + 0.3 * var(--lg-tint)));
  --lg-card-fill: rgba(255, 255, 255, calc(0.58 + 0.28 * var(--lg-tint)));
  --lg-fill-press: rgba(255, 255, 255, calc(0.74 + 0.24 * var(--lg-tint)));
  --lg-pill-fill: rgba(255, 255, 255, calc(0.78 + 0.2 * var(--lg-tint)));
  --lg-pill-spec: rgba(255, 255, 255, 0.55);
  --lg-fill-solid: rgb(244, 244, 247);
  --lg-card-fill-solid: rgb(250, 250, 252);
  --lg-text: #1d1d1f;
  --lg-text-active: #0832a8;
  --lg-edge-top: rgba(255, 255, 255, 0.95);
  --lg-edge-mid: rgba(255, 255, 255, 0.26);
  --lg-edge-bottom: rgba(0, 0, 0, 0.26);
  --lg-edge-corner: rgba(255, 255, 255, 0.7);
  --lg-edge-dark: rgba(20, 28, 48, 0.16);
  --lg-rim-top: rgba(255, 255, 255, 0.75);
  --lg-rim-bottom: rgba(0, 0, 0, 0.07);
  --lg-glow: rgba(255, 255, 255, 0.2);
  --lg-hairline: rgba(0, 0, 0, 0.07);
  --lg-spec-dome: rgba(255, 255, 255, 0.62);
  --lg-spec-spot: rgba(255, 255, 255, 0.55);
  --lg-spec-sheen: rgba(255, 255, 255, 0.18);
  --gt-a1: 0.55;   /* hell: Weiß liegt über dem Text – daher zurückhaltend, damit die Schrift lesbar bleibt */
  --gt-a2: 0.2;
  --gt-edge: 0.9;
  --gt-blend: normal;
  --lg-shadow-a: rgba(20, 28, 48, 0.06);
  --lg-shadow-b: rgba(20, 28, 48, 0.07);
  --lg-shadow-c: rgba(20, 28, 48, 0.09);
  --lg-shadow-d: rgba(20, 28, 48, 0.14);
  --glass-fill: var(--lg-fill);
  --glass-fill-strong: rgba(255, 255, 255, 0.84);
  --glass-tint: rgba(255, 255, 255, 0.7);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --glass-line: var(--lg-hairline);
  --glass-hi: var(--lg-rim-top);
  --glass-lo: rgba(0, 0, 0, 0.04);
  --glass-shadow: 0 14px 28px rgba(20, 28, 48, 0.09), 0 4px 10px rgba(20, 28, 48, 0.07);
  --glass-lens: rgba(29, 29, 31, 0.07);
  color-scheme: light;
}

:root {
  /* 8px-Raster */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  /* Radien */
  --r-card: 20px;
  --r-card-sm: 16px;
  --r-input: 12px;
  --r-pill: 999px;

  /* Maße */
  --tap: 44px;
  --gutter: 16px;
  --hdr-h: 44px;
  --tabbar-h: 62px;
  --tabbar-bottom: max(12px, calc(var(--safe-bottom) - 6px));
  --timer-h: 128px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Schrift */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;

  /* Bewegung – Ausblenden immer schneller als Einblenden */
  --d-tap: 110ms;
  --d-fast: 180ms;
  --d-base: 300ms;
  --d-slow: 460ms;
  --d-out: 200ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.12, 0.64, 1);  /* Fallback ohne linear(): gleiches, leichtes Nachfedern */
  --press-scale: 0.96;

  /* Tastatur (per visualViewport gesetzt) */
  --kb: 0px;
  --vvh: 100dvh;
}

/* Leichte Feder (≈ 4 % Überschwinger) – Safari 17.2+ */
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.063, 0.237, 0.459, 0.662 15.5%, 0.81, 0.909, 0.974 29.4%, 1.012, 1.032 38.5%, 1.037 43%, 1.033 48.6%, 1.01 62.1%, 0.998 76.3%, 1);
  }
}

/* =========================================================
 *  Basis
 * ========================================================= */

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior-y: none;
}
/* Als Home-Bildschirm-App: natürliches iOS-Nachfedern erlauben */
html.standalone body { overscroll-behavior-y: auto; }

svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
/* Linien-Icons (einheitliche Strichstärke) */
svg.i { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i .fill { fill: currentColor; stroke: none; }

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: 0.3; cursor: default; }
a { color: inherit; text-decoration: none; }

button, a, [role="button"], .tab, .chip, label.pick-row {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* Browser-Oberflächen gehören zum Design: Auswahl, Cursor, Formular-Akzent, Scrollleisten */
::selection { background: var(--inv); color: var(--on-inv); }
:root { accent-color: var(--text); scrollbar-color: var(--border-strong) transparent; }
input, textarea { caret-color: var(--text); }
/* Sortier-Griff: 44 pt Tippfläche (HIG), ohne das Layout zu verbreitern */
.drag-handle::after { content: ""; position: absolute; inset: 0 -4px; }
/* Kleine Bedienelemente: 44 pt Tippfläche, ohne sichtbar größer zu werden */
.chip, .toast-btn, .uid-btn { position: relative; }
.chip:not(.small)::after, .toast-btn::after, .uid-btn::after { content: ""; position: absolute; inset: -6px -2px; }

/* Ausgewogene Zeilenumbrüche: keine einzelnen Wörter in der letzten Zeile */
.large-title, .hdr-title, .modal-title, .setup-title, .intro-title, .auth-title, .card-title,
.social-cta h2, .profile-hero h2, .empty strong, .summary-hero h2 { text-wrap: balance; }
.hint, .modal-msg, .setup-text, .intro-text, .auth-sub, .notice, .social-cta p { text-wrap: pretty; }
:focus:not(:focus-visible) { outline: none; }

.muted { color: var(--muted); }
.accent { color: var(--text); font-weight: 650; }
.danger-text { color: var(--text) !important; }
.center { text-align: center; }
.num, .tabular { font-variant-numeric: tabular-nums; }

/* ---------- Tipp-Feedback: skaliert kurz und federt zurück ---------- */

.btn, .icon-btn, .hdr-btn, .chip, .tab, .tbtn, .timer-x, .step, .check, .day-card, .week-card,
.list-item, .body-tile, .cal-cell, .fav-btn, .ex-row-name, .ex-note, .segmented button,
.uid-btn, .active-banner, .toast-btn, .auth-logo, .drag-handle {
  transition:
    transform var(--d-base) var(--spring),
    background-color var(--d-fast) var(--ease-out),
    border-color var(--d-fast) var(--ease-out),
    color var(--d-fast) var(--ease-out),
    opacity var(--d-fast) var(--ease-out);
}
.btn:active, .icon-btn:active, .hdr-btn:active, .chip:active, .tab:active, .tbtn:active, .timer-x:active,
.step:active, .check:active, .day-card:active, .week-card:active, .list-item:active, .body-tile:active,
.cal-cell:active, .fav-btn:active, .ex-row-name:active, .ex-note:active,
.segmented button:active, .uid-btn:active, .active-banner:active, .toast-btn:active {
  transform: scale(var(--press-scale));
  transition-duration: var(--d-tap);
  transition-timing-function: var(--ease-out);
}
.btn:disabled:active, .icon-btn:disabled:active { transform: none; }

/* =========================================================
 *  Kopfzeile – transparent, beim Scrollen weich sichtbar
 * ========================================================= */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--s-2);
  height: calc(var(--hdr-h) + var(--safe-top));
  padding: var(--safe-top) calc(var(--s-2) + var(--safe-right)) 0 calc(var(--s-2) + var(--safe-left));
  view-transition-name: app-header;
}
.app-header[hidden] { display: none; }

.hdr-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  opacity: var(--hdr-bg, 0);
  pointer-events: none;
}

.hdr-title {
  margin: 0;
  font: 600 17px/1.2 var(--font);
  letter-spacing: -0.02em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 56vw;
}
.app-header.large .hdr-title { opacity: var(--hdr-title, 0); }

.hdr-side { display: flex; align-items: center; min-width: 0; }
.hdr-side.right { justify-content: flex-end; gap: 2px; }

.hdr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 var(--s-2);
  border-radius: var(--r-pill);
  color: var(--text);
  font-size: 17px;
  font-weight: 400;
  white-space: nowrap;
}
.hdr-btn svg { width: 22px; height: 22px; }
.hdr-btn:first-child svg:first-child { margin-left: -6px; }
.hdr-btn.accent {
  min-height: 34px;
  padding: 0 var(--s-4);
  margin-right: var(--s-1);
  background: var(--inv);
  color: var(--on-inv);
  font-size: 15px;
  font-weight: 600;
}
.hdr-btn.danger { color: var(--text); }

/* Großer Titel (iOS): scrollt mit dem Inhalt weg und schrumpft dabei */
.large-title {
  margin: var(--s-1) 0 var(--s-4);
  padding: 0 var(--s-1);
  font: 700 34px/1.1 var(--font-display);
  letter-spacing: -0.03em;
  transform-origin: left bottom;
  will-change: auto;
}
.large-eyebrow {
  display: block;
  margin-bottom: 2px;
  font: 600 13px/1.3 var(--font);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

/* =========================================================
 *  Inhalt
 * ========================================================= */

.view {
  display: block;
  max-width: 640px;
  margin: 0 auto;
  padding: var(--s-1) calc(var(--gutter) + var(--safe-right)) calc(var(--tabbar-h) + var(--tabbar-bottom) + var(--s-6)) calc(var(--gutter) + var(--safe-left));
  outline: none;
}
body.timer-on .view { padding-bottom: calc(var(--tabbar-h) + var(--timer-h) + var(--tabbar-bottom) + var(--s-6)); }
body.no-tabbar .view { padding-bottom: calc(var(--safe-bottom) + var(--s-6)); }

.section-label {
  margin: var(--s-5) var(--s-1) var(--s-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.view > .section-label:first-child,
.large-title + .section-label { margin-top: var(--s-1); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--s-4);
  margin-bottom: var(--s-3);
}
.card.flush { padding: 0; overflow: hidden; }

.hint { color: var(--muted); font-size: 14px; line-height: 1.45; margin: var(--s-3) var(--s-1); }
.hint svg { width: 16px; height: 16px; vertical-align: -3px; }
.hint.warn,
.notice.warn,
.form-error {
  position: relative;
  padding-left: 44px !important;
}
.hint.warn::before,
.notice.warn::before,
.form-error::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 12px;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 2.8 19.5h18.4zM12 10v4.5M12 17.2h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 2.8 19.5h18.4zM12 10v4.5M12 17.2h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.hint.warn {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: var(--s-3) var(--s-3);
  border-radius: var(--r-input);
}

.empty { text-align: center; padding: var(--s-6) var(--s-4); }
.empty p { margin: var(--s-1) 0; }

/* =========================================================
 *  Buttons
 * ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 50px;
  padding: 0 var(--s-5);
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
}
.btn svg { width: 20px; height: 20px; }
.btn.block { display: flex; width: 100%; margin-top: var(--s-3); }
.btn.lg { min-height: 56px; font-size: 17px; }
.btn.sm { min-height: var(--tap); font-size: 15px; padding: 0 var(--s-4); }

.btn.primary { background: var(--inv); color: var(--on-inv); }
.btn.soft { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost.danger-text { color: var(--text) !important; }

/* Zerstörende Aktionen: kein Rot, sondern Text + Warn-Icon */
.btn.danger { background: var(--inv); color: var(--on-inv); }
.btn.danger-soft { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn.danger::before,
.btn.danger-soft::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 2.8 19.5h18.4zM12 10v4.5M12 17.2h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 2.8 19.5h18.4zM12 10v4.5M12 17.2h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

.btn-row { display: flex; gap: var(--s-2); margin-top: var(--s-3); }
.btn-row .btn { flex: 1; min-width: 0; padding: 0 var(--s-3); }

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  color: var(--muted);
  flex: none;
}
.icon-btn:active { background: var(--press); }
.icon-btn.danger { color: var(--muted); }
.icon-btn.sm { width: 40px; }
.icon-btn.sm::after { content: ""; position: absolute; inset: -2px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chip svg { width: 16px; height: 16px; }
.chip.small { position: relative; min-height: 32px; font-size: 14px; padding: 0 var(--s-3); }
.chip.small::after { content: ""; position: absolute; inset: -6px -3px; }
.chip.dim { border-style: dashed; border-color: var(--border-strong); color: var(--muted); }
.chip.on { background: var(--inv); color: var(--on-inv); border-color: var(--inv); }

/* =========================================================
 *  Startseite
 * ========================================================= */

.day-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }

.day-card {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-5) var(--s-2) var(--s-5) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  cursor: pointer;
}
.day-card:active { background: var(--press); }
.day-card.is-active { border-color: var(--inv); }
.day-card .icon-btn { margin-top: -10px; }
.day-main { flex: 1; min-width: 0; }
.day-name { font: 700 24px/1.15 var(--font-display); letter-spacing: -0.03em; }
.day-meta { color: var(--muted); font-size: 14px; margin-top: 6px; }
.day-ex {
  margin-top: var(--s-3);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.active-banner {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-4) var(--s-4) var(--s-5);
  margin-bottom: var(--s-3);
  border-radius: var(--r-card);
  background: var(--inv);
  color: var(--on-inv);
}
.ab-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ab-text strong { font-weight: 650; }
.ab-text small { opacity: 0.65; font-size: 14px; }
.ab-go { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 15px; }
.ab-go svg { width: 18px; height: 18px; }

/* Ruhiger „läuft“-Puls: nur transform/opacity */
.pulse { position: relative; width: 10px; height: 10px; flex: none; }
.pulse::before,
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
}
.pulse::after { animation: pulse-ring 2s var(--ease-out) infinite; }
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.5; }
  80%, 100% { transform: scale(2.6); opacity: 0; }
}

.week-card {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-4);
  margin-bottom: var(--s-3);
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
}
.week-card:active { background: var(--press); }
.week-card > svg { color: var(--muted); }
.week-dots { display: flex; gap: 5px; flex: none; }
.week-dots i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--border-strong); }
.week-dots i.on { background: var(--inv); border-color: var(--inv); }
.week-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.week-text strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.week-text small { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.week-text small svg { width: 14px; height: 14px; }

.welcome { text-align: center; padding: var(--s-2) 0 0; }
.welcome-logo { width: 76px; height: 76px; border-radius: 18px; border: 1px solid var(--border); }
.welcome h2 { margin: var(--s-4) 0 var(--s-2); font: 700 28px/1.15 var(--font-display); letter-spacing: -0.03em; }
.welcome > p { margin: 0 auto var(--s-5); max-width: 34ch; color: var(--muted); font-size: 15px; }
.steps { list-style: none; counter-reset: step; margin: 0 0 var(--s-5); padding: 0; display: grid; gap: var(--s-2); text-align: left; }
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 32px 1fr;
  column-gap: var(--s-3);
  align-items: center;
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card-sm);
}
.steps li::before {
  content: counter(step);
  grid-row: span 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--inv);
  color: var(--on-inv);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.steps span { color: var(--muted); font-size: 14px; }

/* =========================================================
 *  Trainingstag bearbeiten
 * ========================================================= */

.ex-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-2);
}

.ex-row {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  grid-template-areas:
    "handle name actions"
    "handle chips chips"
    "handle note note";
  align-items: center;
  column-gap: 2px;
  padding: var(--s-2) var(--s-2) var(--s-3) var(--s-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card-sm);
}
.ex-row-main { display: contents; }
.ex-row .drag-handle { grid-area: handle; align-self: stretch; height: auto; min-height: 52px; }
.ex-row .ex-row-name { grid-area: name; }
.ex-row .ex-row-actions { grid-area: actions; display: flex; }
.ex-row .ex-chips { grid-area: chips; padding-right: var(--s-1); }
.ex-row .ex-note { grid-area: note; margin-top: var(--s-2); width: auto; }

.ex-list.sorting .ex-row { transition: transform var(--d-base) var(--ease-sheet); }
.ex-list.sorting .ex-row.dragging {
  transition: none;
  z-index: 5;
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 36px;
  color: var(--muted);
  touch-action: none;
  cursor: grab;
}
.dragging .drag-handle { color: var(--text); cursor: grabbing; }

.ex-row-name {
  max-width: 100%;
  min-height: 36px;
  text-align: left;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ex-chips, .ex-sub { display: flex; flex-wrap: wrap; gap: 6px; }

/* Dauerhafte Übungsnotiz */
.ex-note {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  width: 100%;
  min-height: 40px;
  margin-top: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-input);
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-align: left;
  font-size: 15px;
  color: var(--text-2);
}
.ex-note svg { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }

/* =========================================================
 *  Laufendes Training
 * ========================================================= */

.wk-meta { color: var(--muted); font-size: 14px; margin: 0 var(--s-1) var(--s-3); font-variant-numeric: tabular-nums; }

.ex-card { padding: var(--s-4) var(--s-3) var(--s-3) var(--s-4); }
.ex-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: 36px; }
.ex-head h2 { margin: 0; font: 700 20px/1.2 var(--font-display); letter-spacing: -0.03em; min-width: 0; }
.ex-head h2.sm { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; font-family: var(--font); }
.ex-head.link { min-height: var(--tap); margin: -10px 0 0; }
.ex-head.link svg { color: var(--muted); width: 18px; height: 18px; }
.ex-head .count { margin-left: auto; }
.ex-head .icon-btn.sm { margin-right: -8px; }
.count {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 2px 10px;
  border-radius: var(--r-pill);
}
.count.accent { background: var(--inv); color: var(--on-inv); }
.ex-sub { margin-top: var(--s-2); }

.prev { margin: var(--s-3) 0 var(--s-1); font-size: 14px; color: var(--text-2); line-height: 1.55; }
.prev span { color: var(--muted); margin-right: var(--s-1); }
.prev i { font-style: normal; color: var(--faint); margin: 0 6px; }
.prev b { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Steigerungsvorschlag */
.prog-hint {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  margin: var(--s-2) 0 2px;
  padding: 10px var(--s-3);
  border-radius: var(--r-input);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.45;
}
.prog-hint svg { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }
.prog-hint.increase { border-color: var(--inv); }
.prog-hint.increase svg { color: var(--text); }
.prog-hint b { font-weight: 700; font-variant-numeric: tabular-nums; }

.sets { position: relative; margin-top: var(--s-2); }

.set {
  position: relative;
  padding: 10px 0;
  background: var(--surface);
}
.set + .set { border-top: 1px solid var(--border); }

.set-main,
.set-steps { display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr) 48px; gap: var(--s-2); align-items: center; }
.set-no {
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.set-main .field,
.set-no { transition: opacity var(--d-base) var(--ease-out); }
.set.done .set-main .field,
.set.done .set-no { opacity: 0.42; }
.set.done .set-sub { opacity: 0.6; }

.field { position: relative; display: block; }
.field .unit {
  position: absolute;
  right: var(--s-3);
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
}

/* Eingabefelder: mind. 16px, damit iOS beim Fokussieren nicht zoomt */
.in {
  width: 100%;
  min-height: 48px;
  padding: 11px var(--s-3);
  border-radius: var(--r-input);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  font-size: 16px;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  transition: border-color var(--d-fast) var(--ease-out), background-color var(--d-fast) var(--ease-out);
}
.in:focus { border-color: var(--text); }
.in::placeholder { color: var(--muted); opacity: 0.8; }
.in.num {
  font-size: 20px;
  font-weight: 600;
  padding-right: 44px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
input[type="search"].in::-webkit-search-decoration,
input[type="search"].in::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Satz abhaken: Kreis füllt sich weiß, Haken wird gezeichnet */
.check {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.check-c {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--border-strong);
  color: var(--on-inv);
  transition: background-color var(--d-base) var(--ease-out), border-color var(--d-base) var(--ease-out);
}
.check-c svg { width: 20px; height: 20px; stroke-width: 2.6; }
.check-c svg path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.check[aria-pressed="true"] .check-c { background: var(--inv); border-color: var(--inv); }
.check[aria-pressed="true"] .check-c svg path { stroke-dashoffset: 0; }

.set.pop .check-c { animation: check-pop var(--d-slow) var(--spring); }
.set.pop .check-c svg path { animation: check-draw 340ms var(--ease-out) 90ms both; }
.set.pop .set-main .field,
.set.pop .set-no { animation: set-dim var(--d-slow) var(--ease-out) both; }
.set.unpop .check-c { animation: check-unfill var(--d-base) var(--ease-out); }
.set.unpop .set-main .field,
.set.unpop .set-no { animation: set-undim var(--d-base) var(--ease-out) both; }
@keyframes check-pop { 0% { transform: scale(0.72); } 100% { transform: none; } }
@keyframes check-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes check-unfill { from { background-color: var(--inv); border-color: var(--inv); } }
@keyframes set-dim { from { opacity: 1; } to { opacity: 0.42; } }
@keyframes set-undim { from { opacity: 0.42; } to { opacity: 1; } }

.set-sub { display: flex; align-items: center; gap: 6px; margin-top: var(--s-2); padding-left: 30px; transition: opacity var(--d-base) var(--ease-out); }
.in.note {
  min-height: 40px;
  padding: var(--s-2) var(--s-3);
  font-size: 16px;
  background: transparent;
  border-color: transparent;
  border-bottom-color: var(--border);
  border-radius: 0;
}
.in.note:focus { border-bottom-color: var(--text); }
.in.effort { flex: none; width: 72px; min-height: 40px; padding: var(--s-2) 10px; text-align: center; font-variant-numeric: tabular-nums; }
.set-sub .icon-btn { color: var(--muted); }

/* +/− unter dem aktuellen Satz (gedrückt halten = schneller) */
.set-steps { margin-top: var(--s-2); animation: fade-up var(--d-base) var(--ease-out) both; }
.stepper { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.step {
  min-height: var(--tap);
  border-radius: var(--r-pill);
  background: transparent;
  border: 1px solid var(--border-strong);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.step:active { background: var(--inv); color: var(--on-inv); border-color: var(--inv); }
.step.repeating { background: var(--inv); color: var(--on-inv); border-color: var(--inv); transform: scale(var(--press-scale)); }

.ex-card.skipped { opacity: 0.5; padding-bottom: var(--s-3); }
.ex-card.skipped .count { font-style: italic; }

.wk-end { margin-top: var(--s-6); }

/* =========================================================
 *  Verlauf, Statistik, Diagramme
 * ========================================================= */

.segmented {
  position: relative;
  display: flex;
  padding: 3px;
  margin-bottom: var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  isolation: isolate;
}
.segmented button {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 0 var(--s-1);
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.segmented button[aria-selected="true"] { background: var(--inv); color: var(--on-inv); }
/* Mit gleitendem „Daumen“ (per JS) übernimmt dieser die Fläche */
.segmented.has-thumb button[aria-selected="true"] { background: transparent; }
.seg-thumb {
  position: absolute;
  z-index: 0;
  top: 3px;
  bottom: 3px;
  left: 0;
  border-radius: var(--r-pill);
  background: var(--inv);
  transform-origin: left center;
  pointer-events: none;
}
.segmented.small button { min-height: 34px; font-size: 14px; }
.segmented.four button { font-size: 14px; }
.card .segmented { margin-bottom: var(--s-3); }

.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
.list-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 64px;
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card-sm);
  margin-bottom: var(--s-2);
}
.list-item:active { background: var(--press); }
.list .list-item { margin-bottom: 0; }
.list-item > svg { color: var(--faint); width: 18px; height: 18px; }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.li-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.li-side { text-align: right; display: flex; flex-direction: column; }
.li-side strong { font-variant-numeric: tabular-nums; font-weight: 650; }
.li-side small { color: var(--muted); font-size: 12px; }
/* Lange Listen: nur Sichtbares rendern */
.list-item.card-like,
#lib-list > .list-item { content-visibility: auto; contain-intrinsic-size: auto 66px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); margin-bottom: var(--s-3); }
.stats div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card-sm);
  padding: var(--s-3) var(--s-3) 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.stats strong { font: 700 clamp(16px, 4.6vw, 22px)/1.2 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stats small { color: var(--muted); font-size: 13px; }

.set-table { margin: var(--s-2) 0 0; padding: 0; list-style: none; counter-reset: s; }
.set-table li {
  counter-increment: s;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  padding: 10px 0 10px 30px;
  position: relative;
  border-top: 1px solid var(--border);
}
.set-table li:first-child { border-top: 0; }
.set-table li::before {
  content: counter(s);
  position: absolute;
  left: 4px;
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.st-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.st-e1 { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.st-note { flex-basis: 100%; color: var(--muted); font-size: 14px; font-style: italic; }

.chart-head { display: flex; align-items: baseline; gap: var(--s-2); margin: var(--s-1) 2px var(--s-2); }
.chart-head strong { font: 700 24px/1.2 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .c-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .c-label { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .c-value { fill: var(--text); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.chart .c-line {
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 1;
  animation: draw-line 900ms var(--ease-out) both;
}
.chart .c-area { animation: fade-in 700ms var(--ease-out) 250ms both; }
.chart .c-dot { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; animation: fade-in 400ms var(--ease-out) 500ms both; }
.chart .c-dot-last { fill: var(--text); stroke: var(--surface); stroke-width: 2.5; animation: fade-in 400ms var(--ease-out) 700ms both; }
.chart .c-stop1 { stop-color: var(--text); stop-opacity: 0.14; }
.chart .c-stop2 { stop-color: var(--text); stop-opacity: 0; }
@keyframes draw-line { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* Wochenziel & Kalender */
.week-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); text-align: center; }
.week-summary div { display: flex; flex-direction: column; align-items: center; }
.week-summary strong { font: 700 22px/1.25 var(--font-display); font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 4px; }
.week-summary strong svg { width: 18px; height: 18px; }
.week-summary small { color: var(--muted); font-size: 12px; }

.cal { padding: var(--s-3); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head strong { font-size: 17px; font-weight: 650; }
.cal-head .icon-btn { color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.cal-cell {
  position: relative;
  aspect-ratio: 1;
  min-height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.cal-cell.has { color: var(--text); font-weight: 700; }
.cal-cell i { position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--border-strong); color: var(--text); }
.cal-cell.sel { background: var(--inv); color: var(--on-inv); box-shadow: none; }

/* Körper */
.body-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: var(--s-2); margin: var(--s-3) 0; }
.body-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px var(--s-3);
  border-radius: var(--r-card-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
}
.body-tile.sel { background: var(--inv); color: var(--on-inv); border-color: var(--inv); }
.body-tile strong { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.body-tile strong small { font-size: 12px; opacity: 0.6; font-weight: 500; }
.body-tile span { font-size: 12px; opacity: 0.65; }
.body-tile em { font-style: normal; font-weight: 600; margin-left: 2px; font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-3); }
.form-grid .wide { grid-column: 1 / -1; }
input[type="date"].in { min-height: 48px; }

/* Rekorde & Zusammenfassung */
.records { border-color: var(--border-strong); }
.records-title { display: flex; align-items: center; gap: var(--s-2); margin: 0 0 6px; font: 700 18px/1.3 var(--font-display); letter-spacing: -0.02em; }
.records-title svg { width: 20px; height: 20px; }
.records ul { list-style: none; margin: 0; padding: 0; }
.records li { display: flex; flex-direction: column; padding: 10px 0; border-top: 1px solid var(--border); }
.records li:first-child { border-top: 0; }
.records li span { color: var(--muted); font-size: 14px; }
.records li b { color: var(--text); font-variant-numeric: tabular-nums; }

.summary-hero { text-align: center; padding: var(--s-2) 0 var(--s-5); }
.hero-icon {
  display: inline-grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--inv);
  color: var(--on-inv);
  animation: hero-pop 700ms var(--spring) both;
}
.hero-icon svg { width: 36px; height: 36px; stroke-width: 1.6; }
.hero-icon.outline { background: transparent; color: var(--text); border: 1.5px solid var(--border-strong); }
@keyframes hero-pop { from { transform: scale(0.6); opacity: 0; } }
.summary-hero h2 { margin: var(--s-4) 0 var(--s-1); font: 700 28px/1.15 var(--font-display); letter-spacing: -0.03em; }
.summary-hero p { margin: 0; color: var(--muted); }

.compare p { margin: 0 0 10px; font-size: 14px; }
.compare-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.compare-row div { display: flex; flex-direction: column; min-width: 0; }
.compare-row strong { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.compare-row small { color: var(--muted); font-size: 13px; }
.compare-row .down strong { color: var(--muted); }

/* Geteilter Plan */
.plan-list { margin: 0; padding-left: 22px; }
.plan-list li { padding: 6px 0; }
.plan-list li span { display: block; color: var(--muted); font-size: 14px; }
.share-text { width: 100%; min-height: 160px; font-size: 14px; resize: vertical; }

/* Übungsvorschau */
.pv-list { list-style: none; margin: 0; padding: 0; }
.pv-item { display: flex; gap: var(--s-3); padding: var(--s-4); border-top: 1px solid var(--border); }
.pv-item:first-child { border-top: 0; }
.pv-no {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pv-main { flex: 1; min-width: 0; }
.pv-name { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.pv-meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.pv-note { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; font-size: 14px; color: var(--text-2); }
.pv-note svg { width: 14px; height: 14px; margin-top: 3px; color: var(--muted); }
.pv-prev { margin-top: 6px; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.pv-hint { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 14px; font-weight: 600; }
.pv-hint svg { width: 16px; height: 16px; }
.pv-actions { margin-top: var(--s-4); }
.pv-actions .btn-row { margin-top: var(--s-2); }

/* Nutzerverwaltung */
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  vertical-align: 2px;
}
.badge.danger { background: var(--inv); color: var(--on-inv); border-color: var(--inv); }
.uid-btn {
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  min-height: 32px;
}

/* =========================================================
 *  Einstellungen (gruppierte Listen wie in iOS)
 * ========================================================= */

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 54px;
  padding: 10px var(--s-4);
  text-align: left;
  transition: background-color var(--d-fast) var(--ease-out);
}
.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--s-4);
  right: 0;
  border-top: 1px solid var(--border);
}
.row:active { background: var(--press); transition-duration: var(--d-tap); }
.row-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.row-text small { color: var(--muted); font-size: 13px; }
.row-value { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-value svg { width: 18px; height: 18px; color: var(--faint); }

/* Schalter: aus = Rahmen, an = invertiert */
.switch {
  width: 51px;
  height: 31px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  position: relative;
  flex: none;
  transition: background-color var(--d-base) var(--ease-out), box-shadow var(--d-base) var(--ease-out);
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--text);
  transition: transform var(--d-slow) var(--spring), background-color var(--d-base) var(--ease-out);
}
.switch-row[aria-checked="true"] .switch { background: var(--inv); box-shadow: inset 0 0 0 1px var(--inv); }
.switch-row[aria-checked="true"] .switch::after { transform: translateX(20px); background: var(--on-inv); }
.switch-row:active .switch::after { transform: scaleX(1.12); transform-origin: left; }
.switch-row[aria-checked="true"]:active .switch::after { transform: translateX(17px) scaleX(1.12); }

.kv { display: flex; justify-content: space-between; gap: var(--s-3); margin: 10px 2px; font-size: 15px; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { text-align: right; }

.notice {
  margin-top: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-input);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}
.notice:first-child { margin-top: 0; }
.notice.warn { border-color: var(--border-strong); color: var(--text); }
.notice.warn::before { top: 14px; }
.notice.ok { border-color: var(--inv); color: var(--text); }
.notice strong:first-child { display: block; margin-bottom: 4px; font-size: 15px; color: var(--text); }
.notice ol { margin: 6px 0; padding-left: 20px; }
.notice p { margin: var(--s-2) 0 0; }

/* =========================================================
 *  Anmelden / Konto
 * ========================================================= */

.auth { max-width: 420px; margin: 0 auto; padding-top: calc(var(--s-6) + var(--safe-top)); }
.app-header:not([hidden]) + .view .auth { padding-top: var(--s-2); }
.auth-logo { display: block; width: 80px; height: 80px; margin: 0 auto var(--s-4); border-radius: 20px; border: 1px solid var(--border); animation: hero-pop 700ms var(--spring) both; }
.auth-title { margin: 0; text-align: center; font: 700 30px/1.15 var(--font-display); letter-spacing: -0.03em; }
.auth-sub { margin: var(--s-2) 0 var(--s-5); text-align: center; color: var(--muted); font-size: 15px; }
.auth .notice { margin: var(--s-5) 0 var(--s-2); }

.auth-form { display: grid; gap: var(--s-4); }
.auth-form .btn.block { margin-top: var(--s-1); }
.lbl { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.lbl .in { color: var(--text); font-weight: 400; }
.form-error {
  margin: 0;
  padding: var(--s-3) var(--s-3);
  border-radius: var(--r-input);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 15px;
  animation: fade-up var(--d-base) var(--ease-out) both;
}
.form-error::before { top: 13px; }
.form-error[hidden] { display: none; }

.divider { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-5) 0 var(--s-1); color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.break { overflow-wrap: anywhere; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }

/* =========================================================
 *  Pausentimer – schwebende Karte über der Navigation
 * ========================================================= */

.timer-bar {
  position: fixed;
  left: calc(var(--s-2) + var(--safe-left));
  right: calc(var(--s-2) + var(--safe-right));
  bottom: calc(var(--tabbar-h) + var(--tabbar-bottom) + var(--s-2));
  z-index: 30;
  max-width: 624px;
  margin: 0 auto;
  padding: 0 var(--s-3) var(--s-3) var(--s-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  overflow: hidden;
  transform: translateY(calc(100% + var(--tabbar-h) + var(--tabbar-bottom) + 16px));
  opacity: 0;
  visibility: hidden;
  transition:
    transform 260ms var(--ease-in),
    opacity var(--d-out) var(--ease-in),
    visibility 0s linear 260ms,
    background-color var(--d-base) var(--ease-out),
    border-color var(--d-base) var(--ease-out),
    color var(--d-base) var(--ease-out);
  view-transition-name: app-timer;
}
.timer-bar[hidden] { display: none; }
.timer-bar.show {
  transform: none;
  opacity: 1;
  visibility: visible;
  transition:
    transform var(--d-slow) var(--ease-sheet),
    opacity var(--d-base) var(--ease-out),
    visibility 0s,
    background-color var(--d-base) var(--ease-out),
    border-color var(--d-base) var(--ease-out),
    color var(--d-base) var(--ease-out);
}

.timer-progress { height: 3px; margin: 0 calc(var(--s-3) * -1) 0 calc(var(--s-4) * -1); background: var(--surface-3); overflow: hidden; }
.timer-progress-fill { height: 100%; background: var(--text); transform-origin: left; transform: scaleX(0); transition: transform 250ms linear; }

.timer-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); height: 34px; }
.timer-label { font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-x {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 var(--s-1) 0 10px;
  margin-right: -4px;
  border-radius: var(--r-pill);
  color: var(--muted);
  font-size: 13px;
}
.timer-x::after { content: ""; position: absolute; inset: -8px -4px; }
.timer-x svg { width: 14px; height: 14px; }

.timer-row { display: flex; align-items: center; gap: var(--s-2); }
.timer-time {
  flex: none;
  font: 700 clamp(34px, 10.5vw, 44px)/1 var(--font-display);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.timer-controls { flex: 1; min-width: 0; display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.timer-controls[hidden] { display: none; }
.tbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: 46px;
  min-width: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tbtn:active { background: var(--press); }
.tbtn-accent {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 150px;
  padding: 0 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: var(--r-pill);
  background: var(--inv);
  color: var(--on-inv);
  border-color: var(--inv);
}
.tbtn-accent:active { background: var(--inv); opacity: 0.85; }
.tbtn-wide { max-width: none; }

/* Pause vorbei: invertiert + zwei ruhige Pulse (kein hartes Blinken) */
.timer-bar.done { background: var(--inv); color: var(--on-inv); border-color: var(--inv); }
.timer-bar.done.show { animation: timer-pulse 1.1s var(--ease-inout) 2; }
.timer-bar.done .timer-label { color: inherit; opacity: 0.7; font-weight: 600; }
.timer-bar.done .timer-progress,
.timer-bar.done .timer-x { visibility: hidden; }
.timer-bar.done .tbtn-accent { background: var(--on-inv); color: var(--inv); border-color: var(--on-inv); }
@keyframes timer-pulse {
  0%, 100% { transform: none; }
  45% { transform: scale(1.025); }
}

/* =========================================================
 *  Tab-Leiste
 * ========================================================= */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  height: calc(var(--tabbar-h) + var(--tabbar-bottom));
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
  transition: transform var(--d-base) var(--ease-sheet), opacity var(--d-fast) var(--ease-out);
  view-transition-name: app-tabbar;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  position: relative;
}
.tab svg { width: 24px; height: 24px; stroke-width: 1.7; }
.tab.active { color: var(--text); }
.tab.active svg { stroke-width: 2.1; animation: tab-bump 420ms var(--spring); }
@keyframes tab-bump { 0% { transform: scale(0.86); } 100% { transform: none; } }
.tab-dot {
  position: absolute;
  top: 6px;
  left: calc(50% + 10px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 2px var(--bg);
}
.tab-dot[hidden] { display: none; }

body.no-tabbar .tabbar { display: none; }

/* Bildschirmtastatur offen: feste Leisten weich ausblenden */
body.kb-open .tabbar { transform: translateY(100%); opacity: 0; pointer-events: none; }
body.kb-open .timer-bar.show { transform: translateY(calc(100% + var(--tabbar-h) + var(--tabbar-bottom) + 16px)); opacity: 0; pointer-events: none; }

/* =========================================================
 *  Toast (mit optionalem „Rückgängig“)
 * ========================================================= */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--tabbar-bottom) + var(--s-3));
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: max-content;
  max-width: calc(100% - 32px);
  min-height: 46px;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  background: var(--inv);
  color: var(--on-inv);
  font-size: 15px;
  font-weight: 600;
  transform: translate(-50%, 16px) scale(0.96);
  opacity: 0;
  transition: transform var(--d-out) var(--ease-in), opacity var(--d-out) var(--ease-in);
  pointer-events: none;
}
.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
  transition: transform var(--d-slow) var(--spring), opacity var(--d-base) var(--ease-out);
}
.toast.has-action { padding-right: 6px; pointer-events: auto; }
.toast-btn {
  min-height: 36px;
  padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  border: 1px solid color-mix(in srgb, var(--on-inv) 35%, transparent);
  color: var(--on-inv);
  font-weight: 650;
  font-size: 15px;
}
body.timer-on .toast { bottom: calc(var(--tabbar-h) + var(--timer-h) + var(--tabbar-bottom)); }
body.no-tabbar .toast { bottom: calc(var(--safe-bottom) + var(--s-5)); }
body.modal-open .toast,
body.kb-open .toast { top: calc(var(--safe-top) + var(--s-3)); bottom: auto; transform: translate(-50%, -16px) scale(0.96); }
body.modal-open .toast.show,
body.kb-open .toast.show { transform: translate(-50%, 0); }

/* =========================================================
 *  Bottom Sheets – folgen dem Finger (JS)
 * ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform: translateY(calc(var(--kb) * -1));
  transition: transform var(--d-base) var(--ease-sheet);
}
.modal-backdrop {
  position: absolute;
  inset: -40px 0 calc(var(--kb) * -1 - 40px);
  background: var(--backdrop);
  touch-action: none;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: min(92vh, calc(var(--vvh) - var(--safe-top) - 12px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 26px calc(var(--s-4) + var(--safe-right)) calc(var(--s-4) + var(--safe-bottom)) calc(var(--s-4) + var(--safe-left));
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  touch-action: none;
}
.modal-card.scrolls { touch-action: pan-y; }
.modal-card .scroll-list,
.modal-card textarea,
.modal-card select { touch-action: pan-y; }
.modal-card.dragging { user-select: none; -webkit-user-select: none; }

/* Griff oben – die ganze obere Kante ist greifbar */
.sheet-grabber {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  touch-action: none;
  cursor: grab;
}
.sheet-grabber::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 36px;
  height: 5px;
  margin-left: -18px;
  border-radius: var(--r-pill);
  background: var(--border-strong);
}

.modal-title { margin: 0 0 6px; font: 700 21px/1.25 var(--font-display); letter-spacing: -0.03em; }
.modal-msg { margin: 0 0 var(--s-3); color: var(--muted); font-size: 15px; }
.modal-input { margin: 6px 0 var(--s-1); font-size: 17px; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-3) 0 var(--s-1); }
.modal-actions { display: flex; gap: var(--s-2); margin-top: var(--s-4); }
.modal-actions .btn { flex: 1; min-width: 0; padding: 0 var(--s-3); }
.modal-actions.stack { flex-direction: column; }
.modal-actions.stack .btn { width: 100%; }
.modal-actions.stack .btn.soft { justify-content: flex-start; padding: 0 var(--s-5); }
.modal-actions.stack .btn.danger-soft { justify-content: flex-start; padding: 0 var(--s-5); }
.modal-actions.stack .btn svg { color: var(--muted); }

@media (min-width: 700px) {
  .modal { align-items: center; }
  .modal-card { border-radius: 24px; border-bottom: 1px solid var(--border); padding-bottom: var(--s-5); }
  .sheet-grabber { display: none; }
}

/* Zahlen-Kacheln (Skeleton im Bibliotheks-Sheet, Aufwärmen) */
.pn-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-2); margin-bottom: var(--s-3); }
.pn { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-input); padding: 10px 4px; text-align: center; min-width: 0; }
.pn span { display: block; color: var(--muted); font-size: 12px; }
.pn strong { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Formulare */
.ff { display: grid; gap: var(--s-3); }
.ff textarea.in, textarea.in { width: 100%; min-height: 90px; resize: vertical; font-family: inherit; line-height: 1.45; }
select.in {
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 18px center, right 13px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

/* =========================================================
 *  Barcode-Scanner (Vollbild)
 * ========================================================= */

.modal.modal-scanner { align-items: stretch; transform: none; background: #000; }
.modal-scanner .modal-backdrop { display: none; }
.modal-scanner .modal-card {
  display: flex;
  flex-direction: column;
  max-width: none;
  max-height: none;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #000;
  color: #fff;
  overflow: hidden;
}
.scanner { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #000; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(78vw, 340px);
  height: min(46vw, 200px);
  transform: translate(-50%, -50%);
  border-radius: 20px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5);
  transition: transform var(--d-base) var(--spring);
}
.scan-frame i { position: absolute; width: 34px; height: 34px; border: 3px solid #fff; }
.scan-frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 20px; }
.scan-frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 20px; }
.scan-frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 20px; }
.scan-frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 20px; }
.scan-frame::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 50%;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.85);
  animation: scan-line 1.8s var(--ease-inout) infinite alternate;
}
.scan-frame.hit { transform: translate(-50%, -50%) scale(1.06); }
.scan-frame.hit::after { opacity: 0; }
@keyframes scan-line { from { transform: translateY(-38px); } to { transform: translateY(38px); } }
.scan-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(var(--safe-top) + var(--s-4)) var(--s-5) var(--s-4);
  text-align: center;
}
.scan-title { margin: 0; font: 700 20px/1.3 var(--font-display); letter-spacing: -0.02em; }
.scan-hint { margin: 4px 0 0; color: rgba(255, 255, 255, 0.7); font-size: 15px; }
.scan-bar {
  display: flex;
  gap: var(--s-2);
  padding: var(--s-4) calc(var(--s-4) + var(--safe-right)) calc(var(--s-4) + var(--safe-bottom)) calc(var(--s-4) + var(--safe-left));
  background: #000;
}
.scan-bar .btn { flex: 1; }
.scan-bar .btn.soft { background: #1a1a1a; color: #fff; border-color: #2c2c2c; }
.scan-bar .btn.primary { background: #fff; color: #000; }

/* Scroll-Liste in Sheets */
.scroll-list { max-height: 46vh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; margin: 10px 0; }
.modal-full .modal-card { max-height: min(92vh, calc(var(--vvh) - var(--safe-top) - 12px)); }

/* Favoriten-Stern */
.fav-btn { position: relative; flex: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--muted); }
.fav-btn svg { width: 22px; height: 22px; }
.fav-btn.on { color: var(--text); }
.fav-btn.on svg { fill: currentColor; }
.list-item .fav-btn { margin: -6px -6px -6px -4px; }
.hdr-btn .fav-on { fill: currentColor; }

/* =========================================================
 *  Bibliothek
 * ========================================================= */

.search { position: relative; display: block; margin-bottom: var(--s-2); }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .in { padding-left: 42px; border-radius: var(--r-pill); background: var(--surface-2); border-color: var(--border); }
.search .in:focus { border-color: var(--text); }

/* Filter-Chips: horizontal wischbar mit Scroll-Snap */
.filter-chips {
  flex-wrap: nowrap;
  margin: 6px calc(var(--gutter) * -1 - var(--safe-right)) 0 calc(var(--gutter) * -1 - var(--safe-left));
  padding: 4px calc(var(--gutter) + var(--safe-right)) 4px calc(var(--gutter) + var(--safe-left));
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding: 0 var(--gutter);
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chips .chip { min-height: 36px; scroll-snap-align: start; }
.filter-chips .chip.small::after { inset: -4px -3px; }
.filter-chips .chip:not(.dim) { background: var(--inv); color: var(--on-inv); border-color: var(--inv); }
.filter-chips .chip.dim { border-style: solid; color: var(--text-2); }

.lib-ic {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.lib-ic svg { width: 22px; height: 22px; stroke-width: 1.6; }
.list-item .lib-ic { margin-left: -4px; }

.ex-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s-3); }
.tag { border: 1px solid var(--border-strong); border-radius: var(--r-pill); padding: 4px 10px; font-size: 13px; font-weight: 500; }
.tag.ghost { border-style: dashed; color: var(--muted); }
.tag.accent { background: var(--inv); color: var(--on-inv); border-color: var(--inv); }
.ex-tags-label { align-self: center; margin-right: 2px; font-size: 13px; color: var(--muted); }
.lib-hero { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }
.lib-hero .lib-ic { width: 52px; height: 52px; }
.lib-hero .lib-ic svg { width: 28px; height: 28px; }
.steps-list { margin: var(--s-1) 0 0; padding-left: 20px; }
.steps-list li { padding: var(--s-1) 0; line-height: 1.5; color: var(--text-2); }
.steps-list li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Übungs-Picker: runde Auswahl-Kreise statt Systemfarben */
.pick-row { display: flex; align-items: center; gap: var(--s-3); min-height: 56px; padding: 10px var(--s-1); border-top: 1px solid var(--border); cursor: pointer; }
.pick-row:first-child { border-top: 0; }
.pick-row input {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  transition: background-color var(--d-fast) var(--ease-out), border-color var(--d-fast) var(--ease-out), transform var(--d-base) var(--spring);
}
.pick-row input::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid var(--on-inv);
  border-width: 0 2.2px 2.2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform var(--d-base) var(--spring);
}
.pick-row input:checked { background: var(--inv); border-color: var(--inv); }
.pick-row input:checked::after { transform: rotate(45deg) scale(1); }
.pick-row:active input { transform: scale(0.9); }
.pick-main { display: flex; flex-direction: column; min-width: 0; }
.pick-name { font-weight: 500; }
.pick-sub { color: var(--muted); font-size: 13px; }

/* =========================================================
 *  Gesten: Wischen zum Löschen, Ziehen, Skeletons
 * ========================================================= */

.swipe-bg {
  position: absolute;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding-right: var(--s-5);
  border-radius: inherit;
  background: var(--inv);
  color: var(--on-inv);
  font-size: 15px;
  font-weight: 650;
  pointer-events: none;
}
.swipe-bg svg { width: 20px; height: 20px; transition: transform var(--d-base) var(--spring); }
.swipe-bg.armed svg { transform: scale(1.25); }
.swiping { z-index: 1; touch-action: pan-y; }
[data-swipe] { touch-action: pan-y; }

/* Skeleton-Platzhalter (Schimmer nur per transform) */
.sk {
  position: relative;
  overflow: hidden;
  background: var(--sk);
  border-radius: var(--r-input);
}
.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--sk-hi), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s var(--ease-inout) infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 14px; border-radius: 7px; }
.sk-title { height: 24px; width: 60%; border-radius: 8px; margin-bottom: var(--s-2); }
.sk-item { display: flex; align-items: center; gap: var(--s-3); min-height: 66px; padding: var(--s-3) var(--s-4); margin-bottom: var(--s-2); border: 1px solid var(--border); border-radius: var(--r-card-sm); background: var(--surface); }
.sk-item .sk-circle { width: 42px; height: 42px; border-radius: 50%; flex: none; }
.sk-item .sk-lines { flex: 1; display: grid; gap: 8px; }

/* =========================================================
 *  Kleine Animationen
 * ========================================================= */

@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } }
.fade-in { animation: fade-in var(--d-base) var(--ease-out) both; }

/* =========================================================
 *  Seitenübergänge (View Transitions API)
 * ========================================================= */

::view-transition-group(*) { animation-duration: var(--d-base); animation-timing-function: var(--ease-sheet); }
::view-transition-old(app-header) { animation: vt-fade-out 140ms var(--ease-in) both; }
::view-transition-new(app-header) { animation: vt-fade-in 300ms var(--ease-out) both; }

html[data-nav="push"]::view-transition-old(root),
html[data-nav="push"]::view-transition-new(root),
html[data-nav="pop"]::view-transition-old(root),
html[data-nav="pop"]::view-transition-new(root) { mix-blend-mode: normal; }

html[data-nav="push"]::view-transition-old(root) { animation: vt-push-out 480ms var(--ease-sheet) both; }
html[data-nav="push"]::view-transition-new(root) { animation: vt-push-in 480ms var(--ease-sheet) both; }
html[data-nav="pop"]::view-transition-old(root) { z-index: 1; animation: vt-pop-out 400ms var(--ease-sheet) both; }
html[data-nav="pop"]::view-transition-new(root) { animation: vt-pop-in 400ms var(--ease-sheet) both; }
html[data-nav="tab"]::view-transition-old(root) { animation: vt-fade-out 130ms var(--ease-in) both; }
html[data-nav="tab"]::view-transition-new(root) { animation: vt-tab-in 320ms var(--ease-out) 40ms both; }
html[data-nav="fade"]::view-transition-old(root) { animation: vt-fade-out 160ms var(--ease-in) both; }
html[data-nav="fade"]::view-transition-new(root) { animation: vt-fade-in 260ms var(--ease-out) both; }

@keyframes vt-push-in { from { transform: translateX(100%); } }
@keyframes vt-push-out { to { transform: translateX(-24%); opacity: 0.4; } }
@keyframes vt-pop-out { to { transform: translateX(100%); } }
@keyframes vt-pop-in { from { transform: translateX(-24%); opacity: 0.4; } }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }
@keyframes vt-tab-in { from { opacity: 0; transform: translateY(8px); } }

/* =========================================================
 *  Weniger Bewegung: nur einfache Überblendungen
 * ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 1ms !important;
    transition-delay: 0s !important;
  }
  .btn:active, .icon-btn:active, .chip:active, .tab:active, .check:active, .step:active,
  .day-card:active, .list-item:active, .week-card:active { transform: none; }
  .pulse::after, .scan-frame::after, .sk::after { animation: none !important; }
  .toast, .toast.show, .timer-bar, .timer-bar.show { transition: opacity 150ms linear !important; }
  .toast, body.modal-open .toast { transform: translate(-50%, 0); }
  html[data-nav]::view-transition-old(root) { animation: vt-fade-out 150ms linear both !important; }
  html[data-nav]::view-transition-new(root) { animation: vt-fade-in 150ms linear both !important; }
}

/* =========================================================
 *  Eigener Seitenübergang (wo die View Transitions API nicht genutzt wird)
 * ========================================================= */

.nav-ghost { position: fixed; inset: 0; z-index: 12; overflow: hidden; pointer-events: none; background: var(--bg); }
.nav-ghost.over { z-index: 18; }
.nav-ghost-hdr { position: fixed !important; top: 0; left: 0; right: 0; z-index: 21; pointer-events: none; }
body.navving .view { position: relative; z-index: 15; background: var(--bg); min-height: 100vh; min-height: 100dvh; }

/* Theme-Wechsel ohne View Transition: kurze Farbüberblendung */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color 380ms var(--ease-out), border-color 380ms var(--ease-out), color 380ms var(--ease-out), fill 380ms var(--ease-out), stroke 380ms var(--ease-out) !important;
}

/* =========================================================
 *  Liquid Glass (iOS 26)
 *  Die Navigationsebene schwebt als Glas über dem Inhalt:
 *  Unschärfe + Sättigung, helle Lichtkante oben, Glanzverlauf,
 *  weicher Schatten. Inhalte bleiben auf festen Flächen (lesbar).
 * ========================================================= */

:root {
  --glass-blur: blur(22px) saturate(190%);
  --glass-blur-strong: blur(34px) saturate(200%);
  --r-card: 24px;
  --r-card-sm: 20px;
  --r-sheet: 34px;
}

/* Gemeinsames Material */
.tabbar,
.timer-bar,
.toast,
.hdr-btn,
.modal-card,
.lg {
  background:
    linear-gradient(180deg, var(--glass-tint) 0%, transparent 42%),
    var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 var(--glass-hi),          /* Lichtkante oben */
    inset 0 -1px 0 var(--glass-lo),         /* Reflex unten */
    0 0 0 0.5px var(--glass-line),
    var(--glass-shadow);
}

/* Glas ohne eigene Unschärfe für Bedienelemente im Inhalt (spart Rechenleistung) */
.btn.soft,
.chip,
.segmented,
.search .in,
.step,
.tbtn:not(.tbtn-accent) {
  background:
    linear-gradient(180deg, var(--glass-tint) 0%, transparent 60%),
    var(--glass-lens);
  border-color: var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 0.5px var(--glass-line);
}
.chip.dim { background: transparent; box-shadow: none; border-color: var(--border-strong); }
.filter-chips .chip.dim { background: linear-gradient(180deg, var(--glass-tint) 0%, transparent 60%), var(--glass-lens); border-style: solid; border-color: var(--glass-edge); }
.chip.on, .filter-chips .chip:not(.dim), .step:active, .step.repeating {
  background: var(--inv);
  border-color: var(--inv);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* Primäre Aktion: weiße Kapsel mit Glanz */
.btn.primary,
.btn.danger {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 55%), var(--inv);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 8px 24px rgba(0, 0, 0, 0.18);
}

/* ---------- Kopfzeile: runde Glas-Buttons, weicher Rand beim Scrollen ---------- */

.app-header { gap: var(--s-2); padding-left: calc(var(--s-3) + var(--safe-left)); padding-right: calc(var(--s-3) + var(--safe-right)); }
.hdr-side.right { gap: var(--s-2); }
.hdr-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  color: var(--text);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.hdr-btn svg { width: 21px; height: 21px; }
.hdr-side:not(.right) .hdr-btn svg { margin-left: -2px; }
.hdr-side:not(.right) .hdr-btn span { display: none; }  /* Zurück nur als Chevron (wie iOS 26) */
.hdr-btn.accent {
  width: auto;
  min-width: 0;
  height: 44px;
  padding: 0 var(--s-5);
  margin-right: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 55%), var(--inv);
  color: var(--on-inv);
  border-color: transparent;
}
/* Glas „gibt nach“: Buttons wachsen beim Drücken leicht (statt zu schrumpfen) */
.hdr-btn:active, .tbtn:active, .timer-x:active { transform: scale(1.08); }
.hdr-btn:active { background: linear-gradient(180deg, var(--glass-tint), transparent 50%), var(--glass-fill-strong); }

/* Scroll-Kante: Inhalt verschwimmt weich unter der Kopfzeile statt hart abgeschnitten */
.hdr-bg {
  inset: 0 0 -28px 0;
  border-bottom: 0;
  background: linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 78%, transparent) 55%, transparent 100%);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}

/* ---------- Schwebende Tab-Leiste mit gleitender Glas-Linse ---------- */

.tabbar {
  left: calc(var(--s-4) + var(--safe-left));
  right: calc(var(--s-4) + var(--safe-right));
  bottom: var(--tabbar-bottom);
  max-width: 560px;
  margin: 0 auto;
  height: var(--tabbar-h);
  padding: 5px;
  border-radius: var(--r-pill);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  backdrop-filter: var(--glass-blur-strong);
  isolation: isolate;
}
.tab { z-index: 1; border-radius: var(--r-pill); padding-top: 0; gap: 2px; }
.tab span { font-size: 11px; font-weight: 600; white-space: nowrap; letter-spacing: -0.01em; }
.tab:active { transform: scale(0.94); }
.tab-lens {
  position: absolute;
  z-index: 0;
  top: 5px;
  bottom: 5px;
  left: 0;
  width: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, var(--glass-tint), transparent 70%), var(--glass-lens);
  box-shadow: inset 0 1px 0 var(--glass-hi), inset 0 0 0 0.5px var(--glass-edge);
  pointer-events: none;
  transform-origin: center;
}
.tab-dot { top: 7px; }
body.kb-open .tabbar { transform: translateY(calc(100% + var(--tabbar-bottom) + 20px)); }

/* Weicher Übergang unten: Inhalt blendet hinter der Leiste aus */
body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  height: calc(var(--tabbar-h) + var(--tabbar-bottom) + 28px);
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 88%, transparent));
  pointer-events: none;
}
body.no-tabbar::after,
body.kb-open::after { opacity: 0; }

/* ---------- Timer als Glas-Kapsel ---------- */

.timer-bar {
  bottom: calc(var(--tabbar-h) + var(--tabbar-bottom) + 10px);
  left: calc(var(--s-3) + var(--safe-left));
  right: calc(var(--s-3) + var(--safe-right));
  border-radius: 30px;
  background: linear-gradient(180deg, var(--glass-tint) 0%, transparent 42%), var(--glass-fill-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  backdrop-filter: var(--glass-blur-strong);
  transform: translateY(calc(100% + var(--tabbar-h) + var(--tabbar-bottom) + 24px));
}
body.kb-open .timer-bar.show { transform: translateY(calc(100% + var(--tabbar-h) + var(--tabbar-bottom) + 24px)); }
.timer-progress { background: var(--glass-lens); }
.timer-bar.done {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 55%), var(--inv);
  border-color: var(--inv);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ---------- Toast als Glas-Kapsel ---------- */

.toast {
  color: var(--text);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  backdrop-filter: var(--glass-blur-strong);
  background: linear-gradient(180deg, var(--glass-tint), transparent 50%), var(--glass-fill-strong);
}
.toast-btn { color: var(--on-inv); background: var(--inv); border-color: var(--inv); }
body.timer-on .toast { bottom: calc(var(--tabbar-h) + var(--timer-h) + var(--tabbar-bottom) + 4px); }

/* ---------- Sheets: schwebendes Glas mit großen Radien ---------- */

.modal-card {
  width: calc(100% - 16px);
  margin: 0 8px calc(8px + var(--safe-bottom));
  padding: 28px calc(var(--s-5) + var(--safe-right)) var(--s-5) calc(var(--s-5) + var(--safe-left));
  border-radius: var(--r-sheet);
  border-bottom: 1px solid var(--glass-edge);
  background: linear-gradient(180deg, var(--glass-tint), transparent 40%), var(--glass-fill-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  backdrop-filter: var(--glass-blur-strong);
  max-height: min(90vh, calc(var(--vvh) - var(--safe-top) - var(--safe-bottom) - 24px));
}
.modal-full .modal-card { max-height: min(90vh, calc(var(--vvh) - var(--safe-top) - var(--safe-bottom) - 24px)); }
.sheet-grabber::before { background: var(--glass-edge); opacity: 1; width: 38px; }
.modal-card .in { background: color-mix(in srgb, var(--input-bg) 70%, transparent); }
.modal-card .pn,
.modal-card .notice { background: var(--glass-lens); border-color: var(--glass-edge); }
.modal-actions.stack .btn.soft { background: var(--glass-lens); }

/* Vollbild-Scanner bleibt randlos */
.modal-scanner .modal-card {
  width: 100%;
  margin: 0;
  border-radius: 0;
  border: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: #000;
  max-height: none;
}
.scan-bar .btn.soft {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 60%), rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.scan-bar { background: transparent; position: absolute; left: 0; right: 0; bottom: 0; }
.scanner { flex: 1; }

/* ---------- Karten & Listen: größere, konzentrische Radien ---------- */

.card, .day-card, .week-card, .active-banner { border-radius: var(--r-card); }
.list-item, .ex-row, .stats div, .body-tile, .steps li, .sk-item { border-radius: var(--r-card-sm); }
.active-banner {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 55%), var(--inv);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.segmented { padding: 4px; }
.seg-thumb {
  top: 4px;
  bottom: 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 60%), var(--inv);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 2px 8px rgba(0, 0, 0, 0.15);
}
.check[aria-pressed="true"] .check-c { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5); }

/* Tastatur offen / Seitenübergang: Glas-Leisten ohne Schatten-Reste */
body.navving .view { background: var(--bg); }

@media (prefers-reduced-transparency: reduce) {
  .tabbar, .timer-bar, .toast, .hdr-btn, .modal-card {
    background: var(--surface-2);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* Ohne Unschärfe-Unterstützung: deckende Glasfläche statt durchscheinendem Inhalt */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabbar, .timer-bar, .toast, .hdr-btn, .modal-card { background: linear-gradient(180deg, var(--glass-tint), transparent 45%), var(--surface-2); }
}

/* =========================================================
 *  Einführung (erstes Öffnen)
 * ========================================================= */

.intro,
.setup {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding-top: var(--safe-top);
}
.intro-skip,
.setup-skip {
  min-height: 40px;
  padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}
.intro-skip {
  position: absolute;
  z-index: 2;
  top: calc(var(--safe-top) + var(--s-3));
  right: calc(var(--s-4) + var(--safe-right));
  color: var(--text);
  background: linear-gradient(180deg, var(--glass-tint), transparent 60%), var(--glass-lens);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.intro-track {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.intro-track::-webkit-scrollbar { display: none; }
.intro-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-7) calc(var(--s-6) + var(--safe-right)) var(--s-4) calc(var(--s-6) + var(--safe-left));
  text-align: center;
}
.intro-art {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: min(300px, 38vh);
  margin-bottom: var(--s-6);
}
.intro-title { margin: 0 0 var(--s-3); font: 700 30px/1.15 var(--font-display); letter-spacing: -0.03em; }
.intro-text { margin: 0 auto; max-width: 32ch; color: var(--muted); font-size: 16px; line-height: 1.5; }
.intro-foot { padding: var(--s-3) calc(var(--s-5) + var(--safe-right)) calc(var(--safe-bottom) + var(--s-5)) calc(var(--s-5) + var(--safe-left)); }
.intro-dots { display: flex; justify-content: center; margin-bottom: var(--s-3); }
.intro-dots i {
  width: 20px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--text);
  opacity: 0.25;
  transform: scaleX(0.35);
  transition: transform var(--d-slow) var(--spring), opacity var(--d-base) var(--ease-out);
}
.intro-dots i.on { opacity: 1; transform: none; }

/* Illustrationen: kleine Glas-Vorschauen der App */
.ia-logo {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 34px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--glass-tint), transparent 50%), var(--glass-lens);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--glass-shadow);
}
.ia-logo img { width: 104px; height: 104px; border-radius: 26px; }
.ia-logo::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 46px;
  border: 1px solid var(--glass-edge);
  animation: ia-breathe 3.2s var(--ease-inout) infinite;
}
@keyframes ia-breathe { 0%, 100% { transform: scale(0.96); opacity: 0.3; } 50% { transform: scale(1.06); opacity: 0.9; } }

.ia-card,
.ia-timer {
  width: min(310px, 84vw);
  padding: var(--s-4);
  border-radius: 26px;
  background: linear-gradient(180deg, var(--glass-tint), transparent 45%), var(--surface);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--glass-shadow);
  text-align: left;
}
.ia-set {
  display: grid;
  grid-template-columns: 18px 1fr 1fr 34px;
  align-items: center;
  gap: var(--s-2);
  padding: 10px 0;
  font-variant-numeric: tabular-nums;
}
.ia-set + .ia-set { border-top: 1px solid var(--border); }
.ia-no { color: var(--muted); font-weight: 700; font-size: 14px; }
.ia-set b { font-size: 17px; font-weight: 600; }
.intro-slide.on .ia-set:not(:nth-child(3)) .check-c { animation: ia-check 520ms var(--spring) both; animation-delay: calc(var(--i) * 450ms + 350ms); }
.intro-slide.on .ia-set:not(:nth-child(3)) .check-c svg path { animation: check-draw 360ms var(--ease-out) both; animation-delay: calc(var(--i) * 450ms + 450ms); }
.intro-slide.on .ia-set:not(:nth-child(3)) b { animation: set-dim 400ms var(--ease-out) both; animation-delay: calc(var(--i) * 450ms + 400ms); }
@keyframes ia-check {
  0% { transform: scale(0.7); background-color: transparent; }
  100% { transform: none; background-color: var(--inv); border-color: var(--inv); }
}
.ia-hint {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
  padding: 10px var(--s-3);
  border-radius: var(--r-input);
  border: 1px solid var(--inv);
  font-size: 14px;
  opacity: 0;
}
.ia-hint svg { width: 16px; height: 16px; }
.intro-slide.on .ia-hint { animation: fade-up 420ms var(--ease-out) 1.4s both; }

.ia-timer { padding: 0 var(--s-4) var(--s-4); border-radius: 30px; overflow: hidden; }
.ia-timer-bar { height: 3px; margin: 0 calc(var(--s-4) * -1) var(--s-4); background: var(--glass-lens); overflow: hidden; }
.ia-timer-bar i { display: block; height: 100%; background: var(--text); transform-origin: left; transform: scaleX(0.7); }
.intro-slide.on .ia-timer-bar i { animation: ia-count 6s linear infinite; }
@keyframes ia-count { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.ia-timer-row { display: flex; align-items: center; gap: 6px; }
.ia-timer-time { flex: 1; font: 700 40px/1 var(--font-display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.ia-round,
.ia-pill {
  display: inline-grid;
  place-items: center;
  height: 42px;
  min-width: 42px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--glass-edge);
  background: var(--glass-lens);
}
.ia-pill { padding: 0 var(--s-3); background: var(--inv); color: var(--on-inv); border-color: var(--inv); }
.intro-slide.on .ia-pill { animation: ia-press 2.4s var(--ease-inout) 1s infinite; }
@keyframes ia-press { 0%, 70%, 100% { transform: none; } 78% { transform: scale(0.94); } }

.ia-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.ia-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; fill: none; }
.ia-line { fill: none; stroke: var(--text); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.ia-dot { fill: var(--text); opacity: 0; }
.intro-slide.on .ia-line { animation: draw-line 1200ms var(--ease-out) 250ms both; }
.intro-slide.on .ia-dot { animation: fade-in 300ms var(--ease-out) 1.3s both; }
.ia-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-pill);
  background: var(--inv);
  color: var(--on-inv);
  font-size: 14px;
  font-weight: 650;
  opacity: 0;
}
.ia-badge svg { width: 18px; height: 18px; }
.intro-slide.on .ia-badge { animation: hero-pop 600ms var(--spring) 1.4s both; }

.ia-daily { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); }
.ia-ring { width: 130px; height: 130px; }
.ia-ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 10; }
.ia-ring-fg { fill: none; stroke: var(--text); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.ia-ring text { fill: var(--text); font: 700 24px var(--font-display); text-anchor: middle; letter-spacing: -0.03em; }
.intro-slide.on .ia-ring-fg { animation: ia-ring 1300ms var(--ease-out) 250ms both; }
@keyframes ia-ring { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0.28; } }
.ia-chips { display: flex; gap: var(--s-2); }
.ia-chips span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--glass-edge);
  background: var(--glass-lens);
  font-size: 14px;
  font-weight: 600;
}
.ia-chips svg { width: 16px; height: 16px; }

/* =========================================================
 *  Einrichtung (nach dem Registrieren / ohne Konto)
 * ========================================================= */

.setup-top {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) calc(var(--s-4) + var(--safe-right)) var(--s-2) calc(var(--s-4) + var(--safe-left));
}
.setup-top-sp { width: 44px; height: 44px; }
.setup-progress { display: flex; gap: 6px; }
.setup-progress i { flex: 1; height: 4px; border-radius: var(--r-pill); background: var(--surface-3); transition: background-color var(--d-base) var(--ease-out); }
.setup-progress i.on { background: var(--text); }
.setup-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s-5) calc(var(--s-5) + var(--safe-right)) var(--s-4) calc(var(--s-5) + var(--safe-left));
  text-align: center;
}
.setup-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto var(--s-5);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--glass-tint), transparent 55%), var(--glass-lens);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.setup-icon svg { width: 34px; height: 34px; stroke-width: 1.6; }
.setup-icon-done { background: var(--inv); color: var(--on-inv); border-color: var(--inv); animation: hero-pop 700ms var(--spring) both; }
.setup-title { margin: 0 0 var(--s-3); font: 700 28px/1.15 var(--font-display); letter-spacing: -0.03em; }
.setup-text { margin: 0 auto; max-width: 34ch; color: var(--muted); font-size: 16px; line-height: 1.5; }
.setup-note { margin: var(--s-4) 0 0; color: var(--muted); font-size: 14px; }

.setup-goal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: var(--s-6); }
.goal-tile {
  aspect-ratio: 0.8;
  border-radius: var(--r-card-sm);
  background: linear-gradient(180deg, var(--glass-tint), transparent 60%), var(--surface);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  font-variant-numeric: tabular-nums;
  transition: transform var(--d-base) var(--spring), background-color var(--d-fast) var(--ease-out), color var(--d-fast) var(--ease-out);
}
.goal-tile b { font-size: 19px; font-weight: 700; }
.goal-tile:active { transform: scale(0.94); }
.goal-tile.on { background: var(--inv); color: var(--on-inv); border-color: var(--inv); animation: star-pop 420ms var(--spring); }
@keyframes star-pop { 0% { transform: scale(0.9); } 100% { transform: none; } }

.setup-opts { display: grid; gap: 10px; margin-top: var(--s-5); text-align: left; }
.setup-opt,
.setup-tip {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: var(--s-4);
  border-radius: 22px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  text-align: left;
  transition: transform var(--d-base) var(--spring), border-color var(--d-fast) var(--ease-out), background-color var(--d-fast) var(--ease-out);
}
button.setup-opt:active { transform: scale(0.97); }
.setup-opt.on { border-color: var(--inv); background: linear-gradient(180deg, var(--glass-tint), transparent 60%), var(--surface); }
.setup-opt > svg { width: 18px; height: 18px; color: var(--faint); }
.setup-opt-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass-lens);
  border: 1px solid var(--glass-edge);
}
.setup-opt-ic svg { width: 21px; height: 21px; }
.setup-opt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.setup-opt-text b { font-size: 16px; font-weight: 600; }
.setup-opt-text small { color: var(--muted); font-size: 14px; line-height: 1.4; }
.setup-radio {
  flex: none;
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  transition: background-color var(--d-fast) var(--ease-out), border-color var(--d-fast) var(--ease-out);
}
.setup-radio::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--on-inv);
  transform: scale(0);
  transition: transform var(--d-base) var(--spring);
}
.setup-opt.on .setup-radio { background: var(--inv); border-color: var(--inv); }
.setup-opt.on .setup-radio::after { transform: none; }

.setup-foot { padding: var(--s-3) calc(var(--s-5) + var(--safe-right)) calc(var(--safe-bottom) + var(--s-5)) calc(var(--s-5) + var(--safe-left)); }
.setup-foot .btn.block { margin-top: 0; }

/* Vorteile beim Registrieren */
.auth-perks { display: grid; gap: 10px; margin-bottom: var(--s-5); }
.auth-perks > div {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--glass-tint), transparent 60%), var(--surface);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
  animation: fade-up 420ms var(--ease-out) both;
}
.auth-perks > div + div { animation-delay: 80ms; }
.auth-perks svg { width: 22px; height: 22px; margin-top: 1px; color: var(--text); }
.auth-perks b { display: block; color: var(--text); font-size: 15px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .ia-hint, .ia-badge, .ia-dot { opacity: 1; }
  .ia-line { stroke-dashoffset: 0; }
  .ia-ring-fg { stroke-dashoffset: 0.28; }
}

/* =========================================================
 *  Einstellungen: Profilkarte + Menü mit Unterseiten
 * ========================================================= */

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: var(--s-4);
  margin-bottom: var(--s-3);
  border-radius: var(--r-card);
  background: linear-gradient(180deg, var(--glass-tint), transparent 55%), var(--surface);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  transition: transform var(--d-base) var(--spring), background-color var(--d-fast) var(--ease-out);
}
.profile-card:active { transform: scale(0.98); background-color: var(--press); transition-duration: var(--d-tap); }
.profile-card > svg { width: 18px; height: 18px; color: var(--faint); }
.profile-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 55%), var(--inv);
  color: var(--on-inv);
  font: 700 24px/1 var(--font-display);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.profile-avatar svg { width: 30px; height: 30px; }
.profile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.profile-text b { font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.profile-text small { color: var(--muted); font-size: 14px; }

.menu-row { gap: 14px; min-height: 60px; }
.row-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--glass-tint), transparent 60%), var(--glass-lens);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  color: var(--text);
}
.row-ic svg { width: 19px; height: 19px; }
/* Trennlinie beginnt nach der Icon-Kachel (wie iOS) */
.menu-row + .menu-row::before { left: calc(var(--s-4) + 48px); }
.row-value svg.i:not(:last-child) { color: var(--text); }
.menu-row .row-text span { font-weight: 500; }

/* Darstellung: kleine Vorschau je Theme */
.theme-previews { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-1) var(--s-2);
  border-radius: 20px;
  border: 1.5px solid var(--border);
  transition: transform var(--d-base) var(--spring), border-color var(--d-fast) var(--ease-out);
}
.theme-pick:active { transform: scale(0.96); }
.theme-pick.on { border-color: var(--inv); }
.theme-pick.on .setup-radio { background: var(--inv); border-color: var(--inv); }
.theme-pick.on .setup-radio::after { transform: none; }
.theme-mock {
  position: relative;
  width: 100%;
  max-width: 88px;
  aspect-ratio: 0.62;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 7px;
}
.theme-mock i { display: block; height: 14px; border-radius: 5px; }
.theme-mock i:first-child { height: 8px; width: 55%; border-radius: 3px; }
.theme-mock.dark { background: #000; }
.theme-mock.dark i { background: #1f1f1f; }
.theme-mock.dark i:first-child { background: #fff; }
.theme-mock.light { background: #f2f2f2; }
.theme-mock.light i { background: #fff; }
.theme-mock.light i:first-child { background: #000; }
.theme-mock.system { background: linear-gradient(135deg, #f2f2f2 50%, #000 50%); }
.theme-mock.system i { background: rgba(128, 128, 128, 0.45); }
.theme-mock.system i:first-child { background: #808080; }
.theme-name { font-size: 14px; font-weight: 600; }

/* =========================================================
 *  Training: eine Übung pro Seite, wischen zur nächsten
 * ========================================================= */

.wk-pager {
  position: sticky;
  top: calc(var(--hdr-h) + var(--safe-top));
  z-index: 15;
  margin: 0 calc(var(--gutter) * -1 - var(--safe-right)) var(--s-2) calc(var(--gutter) * -1 - var(--safe-left));
  padding: 6px calc(var(--gutter) + var(--safe-right)) 10px calc(var(--gutter) + var(--safe-left));
  background: linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 85%, transparent) 75%, transparent);
}
.wk-pills { display: flex; gap: 5px; }
.wk-pill {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  transition: background-color var(--d-base) var(--ease-out), transform var(--d-base) var(--spring);
}
.wk-pill::after { content: ""; position: absolute; inset: -12px 0; }   /* große Tippfläche */
.wk-pill.done { background: var(--muted); }
.wk-pill.skipped { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
.wk-pill.on { background: var(--text); transform: scaleY(1.35); }
.wk-pager-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-top: 10px; min-height: 28px; }
#wk-pos { font-size: 13px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wk-next-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 32px;
  padding: 0 6px 0 12px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: linear-gradient(180deg, var(--glass-tint), transparent 60%), var(--glass-lens);
  border: 1px solid var(--glass-edge);
}
.wk-next-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-next-link svg { width: 16px; height: 16px; flex: none; }
.wk-next-link[hidden] { display: none; }

.wk-track {
  display: flex;
  align-items: flex-start;
  margin: 0 calc(var(--gutter) * -1 - var(--safe-right)) 0 calc(var(--gutter) * -1 - var(--safe-left));
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  transition: height 360ms var(--ease-sheet);
}
.wk-track::-webkit-scrollbar { display: none; }
.wk-slide {
  flex: 0 0 100%;
  min-width: 0;
  padding: 2px calc(var(--gutter) + var(--safe-right)) 0 calc(var(--gutter) + var(--safe-left));
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
.wk-slide > .card { margin-bottom: var(--s-2); transform-origin: center top; }
.wk-advance { margin-top: var(--s-2); }
.wk-advance svg { width: 18px; height: 18px; }

/* ---------- Laufendes Training: Seite steht fest, nur seitlich wischen ----------
 * Die Ansicht ist genau so hoch wie der freie Bereich zwischen Kopfzeile und Tab-Leiste
 * (bzw. Pausentimer oder Tastatur). Die Übungskarte füllt ihn; ist sie länger, scrollt nur sie. */
html:has(body.wk-lock),
body.wk-lock,
html.standalone body.wk-lock { overflow: hidden; overscroll-behavior: none; }
body.wk-lock .view {
  --wk-bottom: calc(var(--tabbar-h) + var(--tabbar-bottom) + var(--s-3));
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--hdr-h) - var(--safe-top));
  height: calc(100dvh - var(--hdr-h) - var(--safe-top));
  padding-bottom: var(--wk-bottom);
  overflow: hidden;
}
body.wk-lock.timer-on .view { --wk-bottom: calc(var(--tabbar-h) + var(--timer-h) + var(--tabbar-bottom) + var(--s-2)); }
/* Tastatur offen: Tab-Leiste und Timer sind weg, sichtbar ist nur noch der Bereich über der Tastatur */
body.wk-lock.kb-open .view { height: calc(var(--vvh) - var(--hdr-h) - var(--safe-top)); --wk-bottom: var(--s-2); }
body.wk-lock .view > * { flex: none; }
body.wk-lock .wk-pager { position: relative; top: auto; }
body.wk-lock .wk-track {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  align-items: stretch;
  transition: none;
}
body.wk-lock .wk-slide {
  position: relative;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--s-2);
  /* weich ausblenden, wenn eine lange Karte unter den unteren Rand läuft */
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 20px), transparent);
}
body.wk-lock .wk-slide::-webkit-scrollbar { display: none; }
body.wk-lock .wk-slide > .card { margin-bottom: var(--s-4); }

/* =========================================================
 *  Freunde: Profil, Anfragen, Vergleich, Rangliste
 *  Nur Schwarz/Weiß/Grau: „Du“ = invertierte Fläche (--inv), Freund = Grau (--muted)
 * ========================================================= */

/* Profilfoto: rund, ohne Foto grauer Platzhalter */
.avatar {
  flex: none;
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-3);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; animation: fade-in var(--d-base) var(--ease-out) both; }
.avatar svg { width: 24px; height: 24px; stroke-width: 1.6; }
.avatar.md { width: 52px; height: 52px; }
.avatar.md svg { width: 30px; height: 30px; }
.avatar.lg { width: 72px; height: 72px; }
.avatar.lg svg { width: 42px; height: 42px; stroke-width: 1.4; }
.avatar.xl { width: 104px; height: 104px; }
.avatar.xl svg { width: 60px; height: 60px; stroke-width: 1.2; }
.avatar.sk { box-shadow: none; }
.list-item .avatar { margin-left: -4px; }

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--s-2) var(--s-4) var(--s-5);
}
.profile-hero .avatar { margin-bottom: var(--s-3); animation: hero-pop 600ms var(--spring) both; }
.profile-hero h2 { margin: 0; font: 700 26px/1.2 var(--font-display); letter-spacing: -0.03em; }
.profile-hero p { margin: 4px 0 var(--s-3); color: var(--muted); font-size: 15px; }
.avatar-link { border-radius: 50%; }

.stats strong svg { width: 0.85em; height: 0.85em; vertical-align: -0.08em; margin-right: 3px; }

.card-title { display: flex; align-items: center; gap: var(--s-2); margin: 0 0 var(--s-3); font: 650 17px/1.3 var(--font-display); letter-spacing: -0.02em; }
.card-title svg { width: 20px; height: 20px; }
.card-title small { color: var(--muted); font: 400 13px/1 var(--font); letter-spacing: 0; }

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: var(--inv);
  color: var(--on-inv);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fav-rec .li-sub { margin: 0 0 2px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.fav-rec .lib-ic svg { stroke-width: 1.7; }

/* Hinweis-Karte: Konto nötig / Profil einrichten */
.social-cta { text-align: center; padding: var(--s-5) var(--s-4); }
.social-cta-ic {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: var(--s-2);
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.social-cta-ic svg { width: 28px; height: 28px; stroke-width: 1.6; }
.social-cta h2 { margin: 0 0 var(--s-2); font: 700 20px/1.25 var(--font-display); letter-spacing: -0.02em; }
.social-cta p { margin: 0 0 var(--s-2); color: var(--text-2); line-height: 1.45; }
.social-cta p.muted { color: var(--muted); font-size: 14px; }

/* Datenschutz */
.privacy .privacy-intro { margin: 0 0 var(--s-3); color: var(--text-2); line-height: 1.45; }
.privacy-h { margin: var(--s-3) 0 var(--s-1); font-size: 13px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.privacy-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.privacy-list li { position: relative; padding-left: 24px; line-height: 1.45; }
.privacy-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--text);
}
.privacy-list:not(.private) li::before { background: var(--inv); border-color: var(--inv); }
.privacy-list small { color: var(--muted); }
.modal-card .privacy { border: 0; padding: 0; background: none; margin: 0 0 var(--s-2); }

/* Mit Apple anmelden (Apple-Vorgabe: schwarz bzw. weiß) */
.btn.apple { background: var(--inv); color: var(--on-inv); gap: 6px; }
.btn.apple .apple-logo { width: 19px; height: 19px; margin-top: -3px; }
.auth .btn.apple { margin-top: 0; }
#apple-error { margin-top: var(--s-3); }

/* Profil bearbeiten */
.avatar-edit { display: flex; flex-direction: column; align-items: center; margin: var(--s-2) 0 var(--s-5); }
.avatar-edit .btn-row { width: 100%; max-width: 360px; }
.avatar-edit .btn.ghost { max-width: 360px; margin-top: var(--s-1); }
.avatar-btn { position: relative; border-radius: 50%; transition: transform var(--d-base) var(--spring); }
.avatar-btn:active { transform: scale(0.95); transition-duration: var(--d-tap); }
.avatar-cam {
  position: absolute;
  right: 0;
  bottom: 2px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--inv);
  color: var(--on-inv);
  box-shadow: 0 0 0 3px var(--bg);
}
.avatar-cam svg { width: 18px; height: 18px; }
.uname { position: relative; display: block; }
.uname-at { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 500; font-size: 17px; pointer-events: none; }
.uname .in { padding-left: 32px; }
.uname-status { margin: calc(var(--s-2) * -1) var(--s-1) 0; min-height: 20px; font-size: 14px; }
.uname-status span { display: inline-flex; align-items: center; gap: 6px; }
.uname-status svg { width: 16px; height: 16px; flex: none; }
.uname-status .ok { color: var(--text); font-weight: 600; }
.uname-status .bad { color: var(--text); }
.uname-status .info { color: var(--muted); }

/* Personen-Listen (Suche, Anfragen, Freunde) */
.list-item.person { gap: var(--s-3); }
.list-item.person .btn.sm { min-height: var(--tap); padding: 0 14px; font-size: 14px; flex: none; }
.list-item.person .btn.sm svg { width: 17px; height: 17px; }
.list-item.person .tag { flex: none; }
.req-actions { display: flex; align-items: center; gap: 4px; flex: none; }
#friend-results { min-height: 66px; }
#friend-results > .hint { margin: var(--s-3) var(--s-1); }

/* Einladung per Link / QR-Code */
.invite { display: flex; flex-direction: column; align-items: center; }
.qr-tile {
  width: min(220px, 62vw);
  aspect-ratio: 1;
  padding: 6px;
  border-radius: var(--r-card-sm);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--border);
}
.qr-tile svg { display: block; width: 100%; height: 100%; animation: fade-in var(--d-base) var(--ease-out) both; }
.qr-tile .sk { width: 100%; height: 100%; }
.invite-name { margin: var(--s-3) 0 0; font: 700 18px/1.2 var(--font-display); letter-spacing: -0.02em; }
.invite .hint { margin: var(--s-2) 0 0; }
.invite .btn-row { width: 100%; }

.offline-note { display: flex; flex-direction: column; align-items: center; margin: var(--s-3) 0; }
.offline-note .hint { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 var(--s-1) var(--s-2); }
.offline-note .hint svg { flex: none; width: 17px; height: 17px; }
.offline-note .btn.sm { padding: 0 var(--s-4); }

/* Vergleich: Du vs. Freund */
.vs-hero { display: flex; align-items: center; justify-content: center; gap: var(--s-4); padding: var(--s-2) 0 var(--s-3); }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); min-width: 0; max-width: 40%; text-align: center; }
.vs-side b { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.vs-side .avatar { animation: hero-pop 600ms var(--spring) both; }
.vs-side:last-child .avatar { animation-delay: 80ms; }
.vs-mid { color: var(--muted); font: 700 15px/1 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; }

.cmp-legend { display: flex; justify-content: center; gap: var(--s-4); margin: 0 0 var(--s-3); font-size: 13px; color: var(--muted); }
.cmp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cmp-legend span::before { content: ""; width: 12px; height: 12px; border-radius: 4px; }
.cmp-legend .me::before { background: var(--inv); }
.cmp-legend .them::before { background: var(--muted); }

.cmp { padding: var(--s-3) 0; border-top: 1px solid var(--border); }
.card-title + .cmp, .segmented + .cmp { border-top: 0; padding-top: 0; }
.cmp-label { margin-bottom: var(--s-2); font-size: 14px; font-weight: 600; color: var(--text-2); }
.cmp-bar { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 26px; }
.cmp-bar + .cmp-bar { margin-top: 4px; }
.cmp-who { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-bar.me .cmp-who { color: var(--text); font-weight: 600; }
.cmp-track { position: relative; display: block; height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.cmp-track i { position: absolute; inset: 0; border-radius: 6px; transform-origin: left center; }
.cmp-bar.me .cmp-track i { background: var(--inv); }
.cmp-bar.them .cmp-track i { background: var(--muted); }
.cmp-bar b { min-width: 56px; text-align: right; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cmp-bar.them b { color: var(--text-2); font-weight: 550; }
/* Wer vorne liegt, steht kräftig da – der andere Wert tritt zurück (keine Symbole, keine Farbe) */
.lead-me .cmp-bar.them b, .lead-them .cmp-bar.me b { color: var(--muted); font-weight: 500; }
.lead-them .cmp-bar.them b { color: var(--text); font-weight: 700; }
.lead-me .cmp-bar.me b { font-weight: 700; }

/* Rangliste */
.lb-chips { margin-bottom: var(--s-3); }
.lb-row { gap: var(--s-3); }
.lb-row.me { border-color: var(--inv); box-shadow: inset 0 0 0 1px var(--inv); }
.lb-rank { flex: none; width: 26px; text-align: center; font: 700 17px/1 var(--font-display); color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-row.top .lb-rank { color: var(--text); }
.lb-row.top:first-child .lb-rank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--inv);
  color: var(--on-inv);
  font-size: 15px;
}
.lb-track { height: 6px; margin-top: 7px; }
.lb-track i { background: var(--muted); }
.lb-row.me .lb-track i { background: var(--inv); }
.lb-val { flex: none; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* =========================================================
 *  Kontrast erhöhen (iOS-Bedienungshilfen „Kontrast erhöhen“ / prefers-contrast)
 *  Nebentexte und Linien deutlicher, Glasflächen weniger durchscheinend.
 * ========================================================= */

@media (prefers-contrast: more) {
  :root, :root[data-theme="dark"] {
    --muted: #b3b3b3;
    --faint: #8f8f8f;
    --border: #3d3d3d;
    --border-strong: #6b6b6b;
    --input-border: #5a5a5a;
    --glass: rgba(8, 17, 32, 0.94);
    --glass-fill: rgba(30, 30, 34, 0.92);
    --glass-edge: rgba(255, 255, 255, 0.4);
    --lg-fill: rgba(30, 30, 34, 0.94);
    --lg-card-fill: rgba(30, 30, 34, 0.94);
  }
  :root[data-theme="light"] {
    --muted: #3d3d3d;
    --faint: #636363;
    --border: #b3b3b3;
    --border-strong: #6b6b6b;
    --input-border: #8a8a8a;
    --glass: rgba(241, 244, 251, 0.96);
    --glass-fill: rgba(255, 255, 255, 0.92);
    --glass-edge: rgba(0, 0, 0, 0.3);
    --lg-fill: rgba(255, 255, 255, 0.95);
    --lg-card-fill: rgba(255, 255, 255, 0.95);
  }
}

/* =========================================================
 *  Mein Gym (Startseite): Name, Adresse, Route
 * ========================================================= */

.gym-card {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  margin-bottom: var(--s-3);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3);
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
}
.gym-card.gym-empty { border-style: dashed; border-color: var(--border-strong); background: transparent; min-height: 64px; padding-right: var(--s-3); }
.gym-card.gym-empty > svg { width: 18px; height: 18px; color: var(--faint); }
.gym-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-3); min-height: 48px; text-align: left; border-radius: var(--r-card-sm); }
.gym-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.gym-ic svg { width: 21px; height: 21px; }
.gym-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.gym-text b, .gym-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gym-text b { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.gym-empty .gym-text small { white-space: normal; }
.gym-text small { color: var(--muted); font-size: 13px; }
.gym-go { flex: none; }
.gym-go svg { width: 18px; height: 18px; }
.gym-pos { display: flex; align-items: flex-start; gap: 6px; margin: 0 2px; min-height: 20px; font-size: 14px; line-height: 1.4; }
.gym-pos svg { flex: none; width: 17px; height: 17px; margin-top: 1px; }
#gym-form .segmented { margin: 6px 0 0; }

/* ---------- Aufwärmsätze ---------- */
.set-adds { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); margin-top: var(--s-3); }
.set-adds .btn { width: 100%; }
.set-adds .btn svg { width: 18px; height: 18px; }
.set.warm .set-no { font-size: 13px; font-weight: 600; letter-spacing: -0.02em; }
.set-table li.warm { counter-increment: none; color: var(--muted); }
.set-table li.warm::before { content: 'A'; }
.set-table li.warm .st-val { font-weight: 500; }
.st-tag { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
#warm-form .field { margin-top: 6px; }
#warm-form .switch-row { margin: var(--s-3) 0 0; padding-left: 0; padding-right: 0; background: none; }
.warm-preview { min-height: 132px; margin-top: var(--s-2); }
.warm-preview .set-table { margin: 0; }
.warm-preview p { margin: var(--s-3) 2px; font-size: 15px; }
.set.passed .set-main .field,
.set.passed .set-no { opacity: 0.42; }

/* =========================================================
 *  Mitglieder-Chat
 *  Nur Schwarz/Weiß/Grau: eigene Nachrichten = invertierte Fläche (--inv), fremde = Fläche (--surface-2).
 *  Die Seite steht fest (wie im Training): nur die Nachrichtenliste scrollt, das Eingabefeld bleibt unten.
 * ========================================================= */

.avatar.sm { width: 32px; height: 32px; }
.avatar.sm svg { width: 18px; height: 18px; }
.avatar.xs { width: 24px; height: 24px; }
.avatar.xs svg { width: 14px; height: 14px; }

html:has(body.chat-lock),
body.chat-lock,
html.standalone body.chat-lock { overflow: hidden; overscroll-behavior: none; }
body.chat-lock .view {
  --chat-bottom: calc(var(--tabbar-h) + var(--tabbar-bottom) + var(--s-2));
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--hdr-h) - var(--safe-top));
  height: calc(100dvh - var(--hdr-h) - var(--safe-top));
  padding-top: 0;
  padding-bottom: var(--chat-bottom);
  overflow: hidden;
}
body.chat-lock.kb-open .view { height: calc(var(--vvh) - var(--hdr-h) - var(--safe-top)); --chat-bottom: var(--s-2); }

.chat { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: var(--s-2); }

/* Verbindungshinweis */
.chat-note { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); border: 1px dashed var(--border-strong); border-radius: var(--r-card-sm); color: var(--muted); font-size: 14px; }
.chat-note svg { width: 18px; height: 18px; flex: none; }
.chat-note span { flex: 1; }
.chat-note:empty { display: none; }

/* Heute im Gym */
.chat-today { flex: none; padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r-card-sm); background: var(--surface); }
body.kb-open .chat-today { display: none; }
.today-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); }
.today-title { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.02em; white-space: nowrap; }
.today-head .btn { flex: none; margin-left: auto; white-space: nowrap; padding: 0 var(--s-3); gap: 6px; }
.today-head .btn svg { width: 16px; height: 16px; }
.today-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 4px; padding: 0 6px; border-radius: var(--r-pill); background: var(--inv); color: var(--on-inv); font-size: 13px; font-weight: 600; vertical-align: 1px; }
.today-empty { margin: var(--s-2) 0 0; color: var(--muted); font-size: 14px; }
.today-list { display: flex; gap: var(--s-2); margin: var(--s-3) calc(var(--s-3) * -1) 0; padding: 0 var(--s-3); overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.today-list::-webkit-scrollbar { display: none; }
.today-item { flex: none; display: grid; gap: 2px; min-width: 112px; min-height: 52px; padding: var(--s-2) var(--s-3); border: 1px solid var(--border-strong); border-radius: var(--r-input); text-align: left; scroll-snap-align: start; }
.today-item strong { font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.today-item span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.today-item.past { opacity: 0.55; }

/* Nachrichtenliste */
.chat-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; padding: var(--s-2) 0; scrollbar-width: none; }
.chat-list::-webkit-scrollbar { display: none; }
.chat-day { display: flex; justify-content: center; margin: var(--s-4) 0 var(--s-2); }
.chat-day span { padding: 3px 12px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.chat-start, .chat-older { margin: var(--s-2) 0 var(--s-3); text-align: center; color: var(--muted); font-size: 13px; }
.chat-empty { padding-top: var(--s-6); }
.chat-skel { display: grid; gap: var(--s-3); padding: var(--s-3) 0; }
.sk-bubble { height: 40px; border-radius: 18px; }
.sk-bubble.r { margin-left: auto; }

.msg { display: flex; align-items: flex-end; gap: var(--s-2); margin-top: 2px; }
.msg.first { margin-top: var(--s-3); }
.msg.mine { justify-content: flex-end; }
.msg-col { display: flex; flex-direction: column; min-width: 0; max-width: min(78%, 480px); }
.msg.mine .msg-col { align-items: flex-end; }
.avatar-gap { flex: none; width: 32px; }
.msg-name { margin: 0 var(--s-3) 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.bubble {
  display: block;
  padding: 9px 14px;
  border-radius: 18px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 38px;
}
.msg.mine .bubble { background: var(--inv); color: var(--on-inv); }
.msg.theirs.last .bubble { border-bottom-left-radius: 6px; }
.msg.mine.last .bubble { border-bottom-right-radius: 6px; }
button.bubble:active { opacity: 0.8; }
.msg-meta { margin: 2px var(--s-3) 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.msg:not(.last):not(.plan-row) .msg-meta { display: none; }
.msg-state { display: inline-flex; align-items: center; gap: 4px; }
.msg-state svg { width: 14px; height: 14px; }
.msg-state.bad { color: var(--text); font-weight: 600; }
.msg.pending .bubble, .plan.pending { opacity: 0.6; }
.msg.failed .bubble { background: transparent; color: var(--text); border: 1px dashed var(--text); }
.msg-retry { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.msg.failed .msg-meta { display: block; }
.msg.flash .bubble, .msg.flash .plan { outline: 2px solid var(--text); outline-offset: 2px; }

/* Gym-Karte: breiter und mit Umriss hervorgehoben */
.msg.plan-row { flex-direction: column; align-items: flex-start; gap: 0; margin-top: var(--s-3); }
.msg.plan-row.mine { align-items: flex-end; }
.plan { width: min(88%, 420px); padding: var(--s-3) var(--s-4) var(--s-4); border: 1.5px solid var(--border-strong); border-radius: var(--r-card); background: var(--surface); }
.plan.past { opacity: 0.6; }
.plan-head { display: flex; align-items: center; gap: var(--s-3); margin-right: calc(var(--s-2) * -1); }
.plan-ic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--inv); color: var(--on-inv); }
.plan-ic svg { width: 22px; height: 22px; }
.plan-title { flex: 1; min-width: 0; display: grid; }
.plan-title strong { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; }
.plan-title small { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.plan-note { margin: var(--s-3) 0 0; font-size: 15px; overflow-wrap: anywhere; }
.plan-people { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-3) 0 0; font-size: 14px; }
.plan-people.muted { color: var(--muted); }
.plan-faces { display: inline-flex; }
.plan-faces .avatar + .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.plan .btn.block { margin-top: var(--s-3); }
.plan-state { margin-top: var(--s-2); font-size: 13px; }

/* Neue Nachrichten (wenn weiter oben gelesen wird) */
.chat-jump { position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); z-index: 2; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 var(--s-4); border-radius: var(--r-pill); background: var(--inv); color: var(--on-inv); font-size: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); }
.chat-jump[hidden] { display: none; }
.chat-jump svg { width: 16px; height: 16px; }

/* Eingabefeld */
.chat-composer { flex: none; display: flex; align-items: flex-end; gap: var(--s-2); }
.chat-composer textarea.in { min-height: 44px; max-height: 120px; padding: 10px var(--s-4); border-radius: 22px; resize: none; line-height: 1.3; font-family: inherit; }
.send-btn { background: var(--inv); color: var(--on-inv); }
.send-btn:active { background: var(--inv); opacity: 0.8; }
.send-btn svg { width: 22px; height: 22px; stroke-width: 2.2; }

/* Formular „Ich gehe ins Gym“ */
.time-row { display: flex; align-items: center; gap: var(--s-2); }
.time-row select.in { width: auto; flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.time-row > span { color: var(--muted); font-weight: 600; }
.plan-chips { margin: 0; }
.plan-chips .chip[aria-pressed="true"] { background: var(--inv); color: var(--on-inv); border-color: var(--inv); }
.plan-preview { margin: 0; min-height: 20px; color: var(--muted); font-size: 14px; }

/* Sehr schmale Bildschirme (≤ 359 px): im Timer passt „Überspringen“ nicht neben −15/+15 – dort steht „Weiter“ */
.tbtn-short { display: none; }
@media (max-width: 359px) {
  .tbtn-long { display: none; }
  .tbtn-short { display: inline; }
}

/* nur für Screenreader */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* =========================================================
 *  Liquid Glass – Erscheinungsbild
 *  Wie die Demo unter liquid-glass/: blauer Verlauf mit drei Farbflecken, darauf Glas aus fünf Schichten
 *  (Unschärfe, getönte Fläche, Glanz, Lichtkante, Schatten). Einfarbig: weiß (dunkel) bzw. tiefblau (hell).
 * ========================================================= */

:root {
  --r-card: 24px;
  --r-card-sm: 20px;
  --r-input: 14px;
  --r-sheet: 34px;
  --tabbar-hc: 54px;          /* Tab-Leiste ohne Beschriftung (beim Herunterscrollen) */
  --lg-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --lg-ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  /* Hintergrund: Verlauf + drei ruhige Farbflecken (Mittelpunkt/Radius wie in der Demo) */
  --stage:
    radial-gradient(circle 37vmax at 15vmax 11vmax, color-mix(in srgb, var(--orb-1) 85%, transparent), transparent),
    radial-gradient(circle 37vmax at calc(100vw - 3vmax) calc(22vh + 37vmax), color-mix(in srgb, var(--orb-2) 80%, transparent), transparent),
    radial-gradient(circle 37vmax at 31vmax calc(100vh - 3vmax), color-mix(in srgb, var(--orb-3) 80%, transparent), transparent),
    linear-gradient(165deg, var(--bg-a), var(--bg-b));
}

/* ---------- Hintergrund ---------- */

/* Der Körper ist durchsichtig: die Farbflecken (z-index −1) liegen über der Fläche von <html> */
body { background: transparent; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--stage);
}
.nav-ghost { background: var(--stage); }
body.navving .view { background: var(--stage); background-attachment: fixed; }
.hdr-bg {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 84%, transparent) 0%, color-mix(in srgb, var(--bg) 55%, transparent) 55%, transparent 100%);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
}
body::after { background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 60%, transparent)); }
.wk-pager {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 62%, transparent) 0%, color-mix(in srgb, var(--bg) 40%, transparent) 70%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent);
  mask-image: linear-gradient(180deg, #000 72%, transparent);
}

:focus-visible { outline-color: var(--lg-text-active); }
:root { accent-color: var(--inv); }
input, textarea { caret-color: var(--lg-text-active); }
.accent { color: var(--lg-text-active); }
.danger-text, .btn.ghost.danger-text, .hdr-btn.danger { color: var(--danger) !important; }

/* ---------- Material ---------- */

/* Schichten 1, 2, 5: Unschärfe + getönte Fläche + gestaffelte Schatten.
   Leisten und Knöpfe (.lg-surface in der Demo) */
.tabbar, .timer-bar, .toast, .hdr-btn, .segmented {
  background: var(--lg-fill);
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate)) brightness(var(--lg-brightness));
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate)) brightness(var(--lg-brightness));
  border: 0;
  color: var(--lg-text);
  box-shadow:
    inset 0 1px 0 var(--lg-rim-top),
    inset 0 -1px 0 var(--lg-rim-bottom),
    inset 0 0 22px var(--lg-glow),
    inset 0 0 14px -3px var(--lg-edge-dark),
    0 0 0 0.5px var(--lg-hairline),
    0 1px 2px var(--lg-shadow-a),
    0 4px 10px var(--lg-shadow-b),
    0 14px 28px var(--lg-shadow-c);
}
/* Flächen mit Fließtext (.lg-card): deckender */
.card, .profile-card, .day-card, .week-card, .gym-card:not(.gym-empty), .stats div {
  background: var(--lg-card-fill);
  -webkit-backdrop-filter: blur(32px) saturate(var(--lg-saturate)) brightness(var(--lg-brightness));
  backdrop-filter: blur(32px) saturate(var(--lg-saturate)) brightness(var(--lg-brightness));
  border: 0;
  color: var(--text);
  box-shadow:
    inset 0 1px 0 var(--lg-rim-top),
    inset 0 -1px 0 var(--lg-rim-bottom),
    inset 0 0 18px var(--lg-glow),
    inset 0 0 14px -3px var(--lg-edge-dark),
    0 0 0 0.5px var(--lg-hairline),
    0 1px 2px var(--lg-shadow-a),
    0 6px 16px var(--lg-shadow-b),
    0 18px 36px var(--lg-shadow-c);
}
/* Listeneinträge: gleiches Aussehen, aber ohne eigene Unschärfe (lange Listen, Rechenleistung) */
.list-item, .ex-row, .body-tile {
  background: var(--lg-card-fill);
  border: 0;
  box-shadow:
    inset 0 1px 0 var(--lg-rim-top),
    inset 0 -1px 0 var(--lg-rim-bottom),
    inset 0 0 12px -3px var(--lg-edge-dark),
    0 0 0 0.5px var(--lg-hairline),
    0 1px 2px var(--lg-shadow-a),
    0 6px 14px var(--lg-shadow-b);
}
.steps li { background: var(--lg-card-fill); border: 0; box-shadow: inset 0 1px 0 var(--lg-rim-top), 0 0 0 0.5px var(--lg-hairline); }

.card, .profile-card, .day-card, .week-card, .gym-card:not(.gym-empty), .stats div,
.list-item, .ex-row, .body-tile, .hdr-btn { position: relative; }
.card, .profile-card, .day-card, .week-card, .gym-card:not(.gym-empty), .stats div,
.list-item, .ex-row, .body-tile, .tabbar, .timer-bar, .toast, .hdr-btn, .segmented { isolation: isolate; }

/* Schicht 3 – Glanz: Kuppel oben, Glanzpunkt oben links. Liegt hinter dem Inhalt (z-index −1 im eigenen Stapel). */
:is(.card, .profile-card, .day-card, .week-card, .gym-card:not(.gym-empty), .stats div,
    .list-item, .ex-row, .body-tile, .tabbar, .timer-bar, .toast, .hdr-btn, .segmented)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% -22%, var(--lg-spec-dome) 0%, transparent 62%),
    radial-gradient(46% 62% at var(--spec-x, 11%) 6%, var(--lg-spec-spot) 0%, transparent 72%),
    linear-gradient(180deg, var(--lg-spec-sheen) 0%, transparent 42%);
}
/* Schicht 4 – Lichtkante: 1-px-Verlaufsrahmen (nur der Rand wird gezeichnet) */
:is(.card, .profile-card, .day-card, .week-card, .gym-card:not(.gym-empty), .stats div,
    .list-item, .ex-row, .body-tile, .tabbar, .timer-bar, .toast, .hdr-btn, .segmented)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(135deg, var(--lg-edge-corner) 0%, transparent 28%, transparent 72%, var(--lg-edge-corner) 100%),
    linear-gradient(180deg, var(--lg-edge-top) 0%, var(--lg-edge-mid) 38%, transparent 58%, var(--lg-edge-bottom) 100%);
  -webkit-mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);
  -webkit-mask-clip: content-box, border-box;
  -webkit-mask-composite: xor;
  mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);
  mask-clip: content-box, border-box;
  mask-composite: exclude;
}
.timer-bar.done::before, .timer-bar.done::after { display: none; }

/* Gedrückt: etwas hellere Fläche (die älteren Regeln setzen eine durchsichtige Farbe) */
.day-card:active, .week-card:active, .list-item:active { background: var(--lg-fill-press); }
.day-card.is-active {
  border-color: transparent;
  box-shadow:
    inset 0 0 0 1.5px var(--lg-text-active),
    0 1px 2px var(--lg-shadow-a),
    0 6px 16px var(--lg-shadow-b),
    0 18px 36px var(--lg-shadow-c);
}
.gym-card.gym-empty { border: 1.5px dashed var(--border-strong); background: var(--lg-card-fill); }
.ex-list.sorting .ex-row.dragging { background: var(--lg-fill-press); }

/* Sheets: Material ohne Pseudo-Elemente (die Karte scrollt) */
.modal-card {
  background: var(--lg-card-fill);
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate)) brightness(var(--lg-brightness));
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate)) brightness(var(--lg-brightness));
  border: 0;
  box-shadow:
    inset 0 1px 0 var(--lg-rim-top),
    inset 0 0 22px var(--lg-glow),
    inset 0 0 14px -3px var(--lg-edge-dark),
    0 0 0 0.5px var(--lg-hairline),
    0 4px 10px var(--lg-shadow-b),
    0 14px 28px var(--lg-shadow-c),
    0 28px 56px var(--lg-shadow-d);
}
.toast { background: var(--lg-card-fill); }
.timer-bar { background: var(--lg-card-fill); }
.timer-bar.done { background: var(--inv); color: var(--on-inv); }

/* ---------- Titel & Beschriftungen ---------- */

.large-title { font-size: clamp(34px, 9vw, 44px); line-height: 1.05; font-weight: 750; letter-spacing: -0.03em; margin-bottom: var(--s-4); }
.large-eyebrow { margin-bottom: 4px; color: var(--text-2); font-size: 13px; font-weight: 600; letter-spacing: 0.06em; }
.section-label { color: var(--text-2); letter-spacing: 0.06em; }
.day-name { font-weight: 750; letter-spacing: -0.03em; }

/* ---------- Schaltflächen ---------- */

.btn.primary,
.hdr-btn.accent {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 55%), var(--inv);
  color: var(--on-inv);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 10px 26px -6px var(--accent-glow), 0 2px 6px var(--lg-shadow-b);
}
.hdr-btn.accent::before, .hdr-btn.accent::after { display: none; }
.btn.danger {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 55%), var(--danger);
  color: var(--on-danger);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn.danger-soft { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.badge.danger { background: var(--danger); color: var(--on-danger); border-color: var(--danger); }
.msg-state.bad { color: var(--danger); }
.msg.failed .bubble { color: var(--danger); border-color: var(--danger); }
.swipe-bg { background: var(--danger); color: var(--on-danger); }
.input-error, .form-error { color: var(--danger); }
.btn.apple { background: #ffffff; color: #000000; box-shadow: none; }
:root[data-theme="light"] .btn.apple { background: #000000; color: #ffffff; }

/* Glas-Pillen (wie die aktive Pille in der Demo): weich, mit Randlicht */
.btn.soft, .chip, .step, .tbtn:not(.tbtn-accent), .search .in {
  background: var(--lg-pill-fill);
  border-color: transparent;
  box-shadow:
    inset 0 1px 0 var(--lg-rim-top),
    inset 0 -1px 0 var(--lg-rim-bottom),
    0 0 0 0.5px var(--lg-hairline),
    0 1px 1px var(--lg-shadow-a),
    0 4px 10px var(--lg-shadow-b);
}
.chip.dim { background: transparent; box-shadow: none; border: 1px dashed var(--border-strong); }
.filter-chips .chip.dim { background: var(--lg-pill-fill); border: 1px solid transparent; }
.chip.on, .filter-chips .chip:not(.dim), .plan-chips .chip[aria-pressed="true"], .step:active, .step.repeating {
  background: var(--inv);
  color: var(--on-inv);
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.tag.accent { background: var(--inv); color: var(--on-inv); border-color: var(--inv); }

/* ---------- Segment & Eingaben ---------- */

.segmented button[aria-selected="true"] { background: var(--lg-pill-fill); color: var(--lg-text-active); }
.segmented.has-thumb button[aria-selected="true"] { background: transparent; }
.seg-thumb {
  background: radial-gradient(90% 80% at 30% -10%, var(--lg-pill-spec), transparent 65%), var(--lg-pill-fill);
  box-shadow:
    inset 0 1px 0 var(--lg-rim-top),
    inset 0 -1px 0 var(--lg-rim-bottom),
    0 0 0 0.5px var(--lg-hairline),
    0 1px 1px var(--lg-shadow-a),
    0 4px 10px var(--lg-shadow-b),
    0 8px 20px var(--lg-shadow-c);
}
.in:focus { border-color: var(--lg-text-active); box-shadow: 0 0 0 3px var(--accent-soft); }
.in.note:focus { box-shadow: none; }
.set { background: transparent; }

/* ---------- Tab-Leiste: gleitende Glas-Pille, beim Herunterscrollen nur Icons ---------- */

.tabbar {
  transition:
    transform var(--d-base) var(--ease-sheet),
    opacity var(--d-fast) var(--ease-out),
    height var(--d-base) var(--ease-sheet);
}
.tab { color: var(--lg-text); }
.tab span { height: 13px; font-size: 11px; line-height: 13px; letter-spacing: 0.01em; overflow: hidden; transition: height var(--d-base) var(--ease-sheet), margin var(--d-base) var(--ease-sheet), opacity var(--d-fast) var(--ease-out); }
.tab.active { color: var(--lg-text-active); }
.tab-lens {
  background: radial-gradient(90% 80% at 30% -10%, var(--lg-pill-spec), transparent 65%), var(--lg-pill-fill);
  box-shadow:
    inset 0 1px 0 var(--lg-rim-top),
    inset 0 -1px 0 var(--lg-rim-bottom),
    0 0 0 0.5px var(--lg-hairline),
    0 1px 1px var(--lg-shadow-a),
    0 4px 10px var(--lg-shadow-b),
    0 8px 20px var(--lg-shadow-c);
}
.tab-dot { background: var(--inv); box-shadow: 0 0 0 2px var(--lg-fill-solid); }
body.tabs-compact .tabbar { height: var(--tabbar-hc); }
body.tabs-compact .tab span { height: 0; margin-top: -2px; opacity: 0; }
body.tabs-compact .tab-dot { top: 4px; }
body.kb-open.tabs-compact .tabbar { height: var(--tabbar-h); }
@media (prefers-reduced-motion: reduce) {
  .tabbar, .tab span, .ring-fg { transition-duration: 1ms !important; animation: none !important; }
}

/* Mini-Vorschauen der Darstellung */
.theme-mock.dark { background: #060d1c; }
.theme-mock.dark i { background: rgba(255, 255, 255, 0.14); }
.theme-mock.dark i:first-child { background: #ffffff; }
.theme-mock.light { background: #eaf3ff; }
.theme-mock.light i { background: #ffffff; }
.theme-mock.light i:first-child { background: #0832a8; }
.theme-mock.system { background: linear-gradient(135deg, #eaf3ff 50%, #060d1c 50%); }

/* ---------- Fallbacks (wie in der Demo) ---------- */

@media (prefers-reduced-transparency: reduce) {
  .tabbar, .timer-bar, .toast, .hdr-btn, .segmented, .modal-card,
  .card, .profile-card, .day-card, .week-card, .gym-card:not(.gym-empty), .stats div {
    background: var(--lg-card-fill-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabbar, .timer-bar, .toast, .hdr-btn, .segmented, .modal-card,
  .card, .profile-card, .day-card, .week-card, .gym-card:not(.gym-empty), .stats div { background: var(--lg-card-fill-solid); }
}
@media (prefers-contrast: more) {
  :is(.card, .profile-card, .day-card, .gym-card:not(.gym-empty), .stats div, .list-item, .ex-row, .body-tile, .tabbar, .timer-bar, .toast, .hdr-btn, .segmented)::after {
    padding: 2px;
    background: linear-gradient(var(--text), var(--text));
  }
}
@media (forced-colors: active) {
  .card, .profile-card, .day-card, .gym-card, .stats div, .list-item, .ex-row, .body-tile, .tabbar, .timer-bar, .toast, .hdr-btn, .segmented, .modal-card {
    background: Canvas;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
    border: 1px solid CanvasText;
  }
  :is(.card, .profile-card, .day-card, .gym-card, .stats div, .list-item, .ex-row, .body-tile, .tabbar, .timer-bar, .toast, .hdr-btn, .segmented)::before,
  :is(.card, .profile-card, .day-card, .gym-card, .stats div, .list-item, .ex-row, .body-tile, .tabbar, .timer-bar, .toast, .hdr-btn, .segmented)::after { display: none; }
  .ring-fg { stroke: Highlight; }
  .ring-bg { stroke: GrayText; }
}

/* =========================================================
 *  Daily: Gewicht eintragen & Mealplan abhaken
 * ========================================================= */

/* Die letzten 7 Tage – antippen wechselt den Tag; der Punkt zeigt den Fortschritt (leer / halb / voll) */
.dstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 0 0 var(--s-4); }
.dstrip-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 68px;
  padding: 8px 0 8px;
  border-radius: var(--r-pill);
  color: var(--text);
  background: var(--lg-pill-fill);
  box-shadow:
    inset 0 1px 0 var(--lg-rim-top),
    inset 0 -1px 0 var(--lg-rim-bottom),
    0 0 0 0.5px var(--lg-hairline),
    0 1px 1px var(--lg-shadow-a),
    0 4px 10px var(--lg-shadow-b);
}
.dstrip-day small { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.dstrip-day b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dstrip-day.today:not(.sel) small { color: var(--lg-text-active); }
.dstrip-day.sel { background: var(--inv); color: var(--on-inv); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 6px 16px -4px var(--accent-glow); }
.dstrip-day.sel small { color: inherit; }
.dstrip-dot { width: 8px; height: 8px; margin-top: 2px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px currentColor; }
.dstrip-dot.part { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.dstrip-dot.full { background: currentColor; }

.daily-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: 28px; margin-bottom: var(--s-3); }
.daily-head .card-title { margin: 0; font: 650 17px/1.3 var(--font); letter-spacing: -0.02em; }
.daily-head .count { display: inline-flex; align-items: center; gap: 4px; }
.daily-head .count svg { width: 16px; height: 16px; stroke-width: 2.4; }
.daily-sub { margin: var(--s-3) 0 0; }
.daily-chart { margin-top: var(--s-3); }

.weight-form { display: flex; align-items: center; gap: var(--s-2); }
.weight-field { flex: 1; min-width: 0; }
.weight-form .btn { flex: none; min-height: 48px; padding: 0 var(--s-5); }
.daily-weight > .btn.ghost { margin-top: var(--s-2); padding-left: 0; }

.meter { height: 6px; margin: 0 0 var(--s-2); border-radius: var(--r-pill); background: var(--ring-track); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--lg-text-active); transform-origin: left center; transition: transform 500ms var(--lg-ease-spring); }

.meal-list { list-style: none; margin: 0; padding: 0; }
.meal-list li + li { border-top: 1px solid var(--border); }
.meal-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 64px;
  padding: 6px 2px;
  text-align: left;
  border-radius: 16px;
  transition: background-color var(--d-fast) var(--ease-out), transform var(--d-base) var(--spring);
}
.meal-row:active { background: var(--press); transform: scale(0.99); }
.meal-row .check-c {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--border-strong);
  color: var(--on-inv);
  transition: background-color var(--d-base) var(--ease-out), border-color var(--d-base) var(--ease-out);
}
.meal-row .check-c svg { width: 20px; height: 20px; stroke-width: 2.6; }
.meal-row .check-c svg path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 300ms var(--ease-out); }
.meal-row[aria-checked="true"] .check-c { background: var(--inv); border-color: var(--inv); }
.meal-row[aria-checked="true"] .check-c svg path { stroke-dashoffset: 0; }
.meal-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; transition: opacity var(--d-base) var(--ease-out); }
.meal-text b { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.meal-text small { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.meal-row.done .meal-text { opacity: 0.72; }
.meal-row.done .meal-text b { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.meal-kcal { flex: none; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meal-kcal small { font-size: 12px; font-weight: 500; color: var(--muted); }
.daily-meals > .btn { margin-top: var(--s-3); }
.daily-meals > .btn.primary { margin-top: var(--s-3); }

/* Mealplan bearbeiten */
.meal-edit-list { list-style: none; margin: var(--s-2) 0; padding: 0; }
.meal-edit { gap: 2px; min-height: 64px; padding: 6px 6px 6px var(--s-4); }
.meal-edit-main { flex: 1; min-width: 0; min-height: 48px; display: flex; flex-direction: column; justify-content: center; text-align: left; }
.meal-edit-main .li-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meal-edit .icon-btn.sm { flex: none; }

@media (prefers-reduced-motion: reduce) {
  .meter i, .meal-row .check-c svg path { transition-duration: 1ms; }
}

/* Chat freischalten (Hilfe-Sheet) und Hinweisleiste mit Knöpfen */
.help-steps { margin: 0 0 var(--s-3); padding-left: 22px; display: grid; gap: var(--s-2); font-size: 15px; line-height: 1.45; }
.help-steps li::marker { font-weight: 700; color: var(--text-2); }
.rules-box { min-height: 140px; margin-bottom: var(--s-3); font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }
.chat-note-actions { display: flex; flex-wrap: wrap; flex: 1 1 100%; gap: var(--s-2); }

/* =========================================================
 *  Liquid Glass wie in iOS 27 – Formen, Berührung, Bewegung
 *  Grundlage: Apples Entwickler-Dokumentation (WWDC25 „Meet Liquid Glass“, „Get to know the new design system“,
 *  „Build a SwiftUI app with the new design“, HIG „Materials“, WWDC26 „What’s new in design / SwiftUI“).
 *  Apple nennt dort Prinzipien, aber keine Zahlen – alle Werte unten sind eigene, auf Apples Beschreibung
 *  abgestimmte Näherungen (siehe DESIGN.md → „Liquid Glass wie in iOS 27“).
 * ========================================================= */

/* ---------- Formen: fest · Kapsel · konzentrisch ---------- */

:root {
  --r-card: 26px;             /* Abschnitte/Karten: größerer Radius als vorher (Apple: „increased corner radius“) */
  --r-card-sm: 22px;
  --r-sheet: 40px;            /* Halb-Sheet: Ecke des Displays minus 8 pt Abstand – schmiegt sich an die runden Ecken */
  --r-dialog: 30px;           /* Dialoge auf großen Bildschirmen */
  --r-capsule: 999px;         /* Kapsel: Radius = halbe Höhe (Leisten, Knöpfe, Chips, Segmente) */
  --sheet-gap: 8px;           /* Abstand des schwebenden Sheets zum Bildschirmrand */
}
/* Konzentrisch: Radius innen = Radius außen − Abstand zum Rand. Im Sheet (Rand 20 px) ergibt das 20 px. */
.modal-card { --r-input: max(12px, calc(var(--r-sheet) - var(--s-5))); }
.card, .profile-card { --r-input: max(12px, calc(var(--r-card) - var(--s-4))); }
.tabbar, .segmented, .toast, .chip, .tbtn, .step, .dstrip-day { border-radius: var(--r-capsule); }
.tabbar .tab, .tab-lens, .segmented button, .seg-thumb { border-radius: var(--r-capsule); }

/* Halb-Sheet: schwebt mit Abstand, ragt unten in den Home-Indikator-Bereich. Wird es höchstmöglich (scrollt der
   Inhalt), verankert es sich unten am Rand und wird deckender – Apple: „bottom edges pull in … opaque at full height“. */
.modal-card {
  margin: 0 var(--sheet-gap) var(--sheet-gap);
  padding-bottom: calc(var(--s-5) + max(0px, var(--safe-bottom) - var(--sheet-gap)));
  border-radius: var(--r-sheet);
  transition: border-radius var(--d-base) var(--ease-sheet), margin var(--d-base) var(--ease-sheet), background-color var(--d-base) var(--ease-out);
}
.modal-card.scrolls,
.modal-card.stretched {
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: color-mix(in srgb, var(--lg-card-fill-solid) 94%, transparent);
}
@media (min-width: 700px) {
  .modal-card { margin: 0; border-radius: var(--r-dialog); border-bottom: 0; padding-bottom: var(--s-5); }
  .modal-card.scrolls { margin-bottom: 0; border-bottom-left-radius: var(--r-dialog); border-bottom-right-radius: var(--r-dialog); }
}
.modal-scanner .modal-card { margin: 0; border-radius: 0; }

/* ---------- Material (iOS 27): dunklere Kante, hellere Glanzlichter, mehr Diffusion ---------- */

/* Der Glanzpunkt von Kopfzeile, Tab-Leiste und Timer wandert beim Scrollen (--spec-x, vom Skript gesetzt) */

/* ---------- Berührung: Licht unter dem Finger ---------- */

.gt-lit {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 500;
  pointer-events: none;
  overflow: hidden;
  contain: layout paint style;
  transform-origin: 50% 50%;
  mix-blend-mode: var(--gt-blend, plus-lighter);
  background: radial-gradient(circle var(--gr, 0px) at var(--gx, 50%) var(--gy, 50%),
    rgb(255 255 255 / calc(var(--ga, 0) * var(--gt-a1, 0.3))) 0%,
    rgb(255 255 255 / calc(var(--ga, 0) * var(--gt-a2, 0.1))) 46%,
    rgb(255 255 255 / 0) 100%);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / calc(var(--ga, 0) * var(--gt-edge, 0.5))),
    inset 0 0 18px rgb(255 255 255 / calc(var(--ga, 0) * 0.14));
}

/* Skalieren/Verschieben übernimmt das Skript (Federn) – die alten :active-Verkleinerungen entfallen dort */
html.gt :is(.hdr-btn, .btn, .icon-btn, .chip, .tbtn, .timer-x, .step:not(.repeating), .dstrip-day, .toast-btn, .send-btn,
    .avatar-btn, .theme-pick, .setup-opt, .goal-tile, .fav-btn, .tab, .segmented button, .body-tile,
    .day-card, .week-card, .list-item, .profile-card):active { transform: none; }
.gt-down:is(.day-card, .week-card, .list-item, .profile-card) { z-index: 2; }

/* Tab-Leiste: Wischen über die Reiter (Linse folgt dem Finger, gewechselt wird beim Loslassen) */
.tabbar { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.tab { -webkit-user-drag: none; }
.tab.over { color: var(--lg-text-active); }
.tab-lens { transform-origin: 50% 50%; }

/* Schalter: der Knopf wird beim Berühren zu durchsichtigem Glas und streckt sich (Apple: Knopf „transforms into Liquid Glass“) */
.switch::after { transition: transform var(--d-slow) var(--spring), background-color var(--d-base) var(--ease-out), box-shadow var(--d-base) var(--ease-out); }
.switch-row:active .switch::after {
  transform: scale(1.36, 1.16);
  transform-origin: left center;
  background: color-mix(in srgb, var(--text) 64%, transparent);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.7), inset 0 -2px 4px rgb(0 0 0 / 0.16), 0 4px 10px rgb(0 0 0 / 0.28);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.switch-row[aria-checked="true"]:active .switch::after {
  transform: translateX(20px) scale(1.36, 1.16);
  transform-origin: right center;
  background: color-mix(in srgb, var(--on-inv) 60%, transparent);
}

/* ---------- Regler „Klar ↔ Getönt“ ---------- */

.glass-demo {
  position: relative;
  height: 116px;
  margin-bottom: var(--s-4);
  border-radius: var(--r-input);
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(165deg, var(--bg-a), var(--bg-b));
}
.gd-orb { position: absolute; border-radius: 50%; }
.gd-orb.a { width: 120px; height: 120px; left: -28px; top: -38px; background: var(--orb-1); }
.gd-orb.b { width: 150px; height: 150px; right: -18px; bottom: -64px; background: var(--orb-2); }
.gd-orb.c { width: 110px; height: 110px; left: 46%; bottom: -58px; background: var(--orb-3); }
.gd-pane {
  position: absolute;
  inset: 20px 22px;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-5);
  border-radius: 22px;
  color: var(--text);
  background: var(--lg-card-fill);
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate));
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate));
  box-shadow:
    inset 0 1px 0 var(--lg-rim-top),
    inset 0 -1px 0 var(--lg-rim-bottom),
    inset 0 0 14px -3px var(--lg-edge-dark),
    0 0 0 0.5px var(--lg-hairline),
    0 8px 20px var(--lg-shadow-c);
}
.gd-pane b { font-size: 26px; font-weight: 750; letter-spacing: -0.03em; }
.gd-pane span { font-size: 15px; font-weight: 600; }
.glass-slider { display: flex; align-items: center; gap: var(--s-3); font-size: 13px; font-weight: 650; letter-spacing: 0.02em; color: var(--text-2); }
.lg-range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}
.lg-range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: var(--r-capsule);
  background: linear-gradient(90deg, var(--inv) 0 var(--v, 50%), var(--ring-track) var(--v, 50%) 100%);
  box-shadow: inset 0 1px 1px rgb(0 0 0 / 0.24), 0 0 0 0.5px var(--lg-hairline);
}
.lg-range::-moz-range-track { height: 8px; border-radius: var(--r-capsule); background: var(--ring-track); box-shadow: inset 0 1px 1px rgb(0 0 0 / 0.24); }
.lg-range::-moz-range-progress { height: 8px; border-radius: var(--r-capsule); background: var(--inv); }
.lg-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -11px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.36), 0 0 0 0.5px rgb(0 0 0 / 0.14);
  transition: transform var(--d-slow) var(--spring), background var(--d-base) var(--ease-out), box-shadow var(--d-base) var(--ease-out);
}
.lg-range::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.36), 0 0 0 0.5px rgb(0 0 0 / 0.14);
  transition: transform var(--d-slow) var(--spring), background var(--d-base) var(--ease-out);
}
/* Berührt: der Knopf wird größer und zu durchsichtigem Glas (Linse) */
.lg-range:active::-webkit-slider-thumb {
  transform: scale(1.46, 1.26);
  background: radial-gradient(75% 75% at 34% 24%, rgb(255 255 255 / 0.95), rgb(255 255 255 / 0.5) 58%, rgb(255 255 255 / 0.3));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.75), inset 0 -3px 5px rgb(0 0 0 / 0.14), 0 8px 18px rgb(0 0 0 / 0.32);
}
.lg-range:active::-moz-range-thumb {
  transform: scale(1.46, 1.26);
  background: radial-gradient(75% 75% at 34% 24%, rgb(255 255 255 / 0.95), rgb(255 255 255 / 0.5) 58%, rgb(255 255 255 / 0.3));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.75), 0 8px 18px rgb(0 0 0 / 0.32);
}
.lg-range:focus-visible { outline: 0; }
.lg-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent-line), 0 2px 6px rgb(0 0 0 / 0.36); }

/* ---------- Materialisierung: Glas „entsteht“, statt nur einzublenden ---------- */

.toast {
  transform: translate(-50%, 14px) scale(0.84);
  -webkit-backdrop-filter: blur(0px) saturate(1);
  backdrop-filter: blur(0px) saturate(1);
  transition:
    transform var(--d-out) var(--ease-in),
    opacity var(--d-out) var(--ease-in),
    backdrop-filter var(--d-out) var(--ease-in),
    -webkit-backdrop-filter var(--d-out) var(--ease-in);
}
.toast.show {
  transform: translate(-50%, 0);
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate)) brightness(var(--lg-brightness));
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate)) brightness(var(--lg-brightness));
  transition:
    transform var(--d-slow) var(--spring),
    opacity var(--d-base) var(--ease-out),
    backdrop-filter 520ms var(--ease-out),
    -webkit-backdrop-filter 520ms var(--ease-out);
}
body.modal-open .toast,
body.kb-open .toast { transform: translate(-50%, -14px) scale(0.84); }
body.modal-open .toast.show,
body.kb-open .toast.show { transform: translate(-50%, 0); }

/* „Transparenz reduzieren“: auch das hochgezogene Sheet bleibt voll deckend */
@media (prefers-reduced-transparency: reduce) {
  .modal-card.scrolls, .modal-card.stretched { background: var(--lg-card-fill-solid); }
}

/* „Bewegung verringern“: nichts federt, nichts wächst – nur Aufhellen und Ausblenden */
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.show, .modal-card { transition-duration: 1ms !important; }
  .toast { transform: translate(-50%, 0); }
  body.modal-open .toast, body.kb-open .toast { transform: translate(-50%, 0); }
  .switch-row:active .switch::after, .switch-row[aria-checked="true"]:active .switch::after { transform: none; }
  .switch-row[aria-checked="true"]:active .switch::after { transform: translateX(20px); }
  .lg-range:active::-webkit-slider-thumb, .lg-range:active::-moz-range-thumb { transform: none; }
}
@media (forced-colors: active) {
  .gt-lit { display: none; }
}

/* =========================================================
 *  Avatare ohne Foto: großer Anfangsbuchstabe auf Farbhintergrund
 *  Die Farbe ergibt sich aus dem Namen (avatarIndex in app.js: immer dieselbe pro Person).
 *  Alle zehn Farben tragen weiße Schrift mit ≥ 4,5:1 (geprüft in tests/liquid-glass.test.mjs).
 * ========================================================= */

.avatar { --av: 42px; }
.avatar.xs { --av: 24px; }
.avatar.sm { --av: 32px; }
.avatar.md { --av: 52px; }
.avatar.pc { --av: 58px; width: 58px; height: 58px; }
.avatar.lg { --av: 72px; }
.avatar.xl { --av: 104px; }
.avatar-initial {
  color: #ffffff;
  background: hsl(var(--ac, 215 40% 36%));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.2), inset 0 1px 0 rgb(255 255 255 / 0.3);
  user-select: none;
  -webkit-user-select: none;
}
.avatar-initial > span {
  font: 700 calc(var(--av) * 0.46) / 1 var(--font-display);
  letter-spacing: -0.02em;
  padding-bottom: calc(var(--av) * 0.02);
}
.ac0 { --ac: 2 56% 40%; }
.ac1 { --ac: 24 56% 38%; }
.ac2 { --ac: 45 56% 31%; }
.ac3 { --ac: 98 56% 29%; }
.ac4 { --ac: 150 56% 30%; }
.ac5 { --ac: 176 56% 29%; }
.ac6 { --ac: 204 56% 38%; }
.ac7 { --ac: 232 56% 44%; }
.ac8 { --ac: 272 56% 42%; }
.ac9 { --ac: 320 56% 40%; }
@media (forced-colors: active) {
  .avatar-initial { forced-color-adjust: none; }
}

/* =========================================================
 *  Chats: Liste (Gym-Chat, Gruppen, Kontakte), Gruppeninfo
 * ========================================================= */

.chat-home { display: flex; flex-direction: column; gap: var(--s-2); }
.chat-home .list { margin-bottom: var(--s-2); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin: var(--s-5) 0 var(--s-2); }
.section-head .section-label { margin: 0 var(--s-1); }
.section-head .btn { min-height: 32px; padding: 0 var(--s-2); }
.chat-row { display: flex; align-items: center; gap: var(--s-3); min-height: 68px; }
.chat-row .li-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .li-main { min-width: 0; }
.chat-row.unread .li-title { font-weight: 750; }
.chat-row.unread .li-sub { color: var(--text); }
.chat-row-meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 40px; color: var(--muted); }
.chat-row-meta small { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.unread-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lg-text-active); box-shadow: 0 0 0 2px var(--lg-fill-solid); }
.avatar.avatar-room { background: var(--inv); color: var(--on-inv); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.4); }
.chat-empty-small { display: grid; justify-items: start; gap: var(--s-3); padding: var(--s-2) 0 var(--s-4); }
.chat-empty-small p { margin: 0; }
.grp-member { min-height: 56px; }
.pick-row .avatar { flex: none; }
.pick-row .pick-main { min-width: 0; }
.modal-card .section-label { margin-top: var(--s-4); }
