/* Muskelkater – Design-Tokens */
:root {
  color-scheme: light;
  --bg: #f6f3ef;
  --surface: #ffffff;
  --surface-2: #f1ede7;
  --surface-3: #e7e1d8;
  --text: #1a1612;
  --text-2: #5a544c;
  --muted: #857f75;
  --border: rgba(26, 22, 18, 0.09);
  --accent: #eb6834;
  --accent-strong: #c94d1c;
  --accent-ink: #ffffff;
  --accent-soft: #fde7dd;
  --violet: #6250d6;
  --violet-soft: #e9e6fb;
  --good: #0ca30c;
  --good-text: #006300;
  --good-soft: #e1f5e1;
  --warn: #fab219;
  --danger: #d03b3b;
  --danger-soft: #fbe3e3;
  --hero-1: #ff7a45;
  --hero-2: #e8456f;
  /* Charts */
  --series: #eb6834;
  --grid: #ebe6de;
  --axis: #c3c2b7;
  --chart-surface: #ffffff;
  --shadow: 0 1px 2px rgba(26, 22, 18, 0.05), 0 8px 28px rgba(26, 22, 18, 0.07);
  --shadow-lg: 0 18px 50px rgba(26, 22, 18, 0.18);
  --radius: 22px;
  --radius-sm: 14px;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0f0d0c;
    --surface: #1a1816;
    --surface-2: #242120;
    --surface-3: #312d2a;
    --text: #f4f0ea;
    --text-2: #c4bdb2;
    --muted: #8f887d;
    --border: rgba(255, 255, 255, 0.08);
    --accent: #f06a35;
    --accent-strong: #ff8f60;
    --accent-soft: #3a2117;
    --violet: #9085e9;
    --violet-soft: #26213f;
    --good-text: #3cc93c;
    --good-soft: #142a14;
    --danger-soft: #3a1818;
    --series: #d95926;
    --grid: #2c2c2a;
    --axis: #383835;
    --chart-surface: #1a1816;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f0d0c;
  --surface: #1a1816;
  --surface-2: #242120;
  --surface-3: #312d2a;
  --text: #f4f0ea;
  --text-2: #c4bdb2;
  --muted: #8f887d;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #f06a35;
  --accent-strong: #ff8f60;
  --accent-soft: #3a2117;
  --violet: #9085e9;
  --violet-soft: #26213f;
  --good-text: #3cc93c;
  --good-soft: #142a14;
  --danger-soft: #3a1818;
  --series: #d95926;
  --grid: #2c2c2a;
  --axis: #383835;
  --chart-surface: #1a1816;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: 28px; font-weight: 850; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 750; }
p { margin: 0; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- Layout ---------- */
#app { min-height: 100dvh; }
.view {
  max-width: 600px;
  margin: 0 auto;
  padding: calc(16px + var(--safe-t)) 16px calc(var(--tabbar-h) + 32px + var(--safe-b));
  animation: view-in 0.25s ease-out;
}
.view.no-tabbar { padding-bottom: calc(32px + var(--safe-b)); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view > section + section, .view > .card + .card, .view > section + .card, .view > .card + section { margin-top: 18px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.topbar .eyebrow { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.back {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px 8px 8px; margin: -4px 0 12px -8px;
  border: 0; background: none; color: var(--text-2); font-weight: 650; cursor: pointer; border-radius: 12px; text-decoration: none;
}
.back:hover { background: var(--surface-2); }
.avatar {
  width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; font-size: 26px;
  background: var(--surface); box-shadow: var(--shadow); text-decoration: none; flex: none;
}

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; border: 1px solid var(--border); }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.card-title h2, .card-title h3 { flex: 1; }
.card-title a, .link-btn { color: var(--accent-strong); font-weight: 700; font-size: 14px; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 4px; }
.section-title { font-size: 13px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 26px 4px 10px; }

.hero {
  position: relative; overflow: hidden; color: #fff; border-radius: 26px; padding: 22px;
  background: linear-gradient(135deg, var(--hero-1), var(--hero-2));
  box-shadow: 0 14px 40px rgba(232, 69, 111, 0.28);
}
.hero::after {
  content: '🐾'; position: absolute; right: -14px; bottom: -26px; font-size: 130px; opacity: 0.13; transform: rotate(-18deg); pointer-events: none;
}
.hero .eyebrow { font-size: 13px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.85; }
.hero h2 { font-size: 26px; font-weight: 850; margin: 6px 0 8px; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-weight: 650; opacity: 0.95; font-size: 15px; }
.hero .ex-preview { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 18px; }
.hero .ex-preview span { background: rgba(255, 255, 255, 0.2); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 650; }
.hero .actions { display: flex; gap: 10px; position: relative; z-index: 1; }
.hero.rest { background: linear-gradient(135deg, #6250d6, #3b8fd6); box-shadow: 0 14px 40px rgba(98, 80, 214, 0.28); }
.hero.done { background: linear-gradient(135deg, #1baf7a, #0c8a5a); box-shadow: 0 14px 40px rgba(27, 175, 122, 0.28); }
.hero.empty { background: linear-gradient(135deg, #2a2420, #4a3a32); box-shadow: var(--shadow); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 16px; border: 0; cursor: pointer;
  font-weight: 750; font-size: 16px; text-decoration: none; white-space: nowrap;
  background: var(--surface-2); color: var(--text);
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px rgba(235, 104, 52, 0.32); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.white { background: #fff; color: #1a1612; }
.btn.glass { background: rgba(255, 255, 255, 0.2); color: #fff; }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 58px; font-size: 18px; border-radius: 18px; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--surface-2); color: var(--text); font-size: 20px; flex: none;
}
.icon-btn svg { width: 22px; height: 22px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 6px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-weight: 650; font-size: 14px;
  cursor: pointer; white-space: nowrap; transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.chip:active { transform: scale(0.96); }
.chip[aria-pressed='true'], .chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.chip.solid { background: var(--surface-2); border-color: transparent; }

/* ---------- Formulare ---------- */
.field { display: block; }
.field > span { display: block; font-size: 14px; font-weight: 700; color: var(--text-2); margin: 0 0 6px 2px; }
.input, textarea.input, select.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--border);
  background: var(--surface-2); font-size: 16px; outline: none; transition: border-color 0.15s, background 0.15s;
}
.input:focus { border-color: var(--accent); background: var(--surface); }
textarea.input { min-height: 90px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
input[type='range'] { width: 100%; accent-color: var(--accent); height: 32px; }

.seg { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button {
  flex: 1; min-height: 42px; border: 0; border-radius: 11px; background: transparent; font-weight: 700; cursor: pointer; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; font-size: 14px;
}
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }

.switch-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.switch-row .grow p { font-weight: 700; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background 0.2s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); transition: transform 0.2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.option-card {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 18px; text-align: left;
  border: 2px solid var(--border); background: var(--surface); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.option-card[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.option-card .emoji { font-size: 28px; }
.option-card b { display: block; font-size: 16px; }
.option-card small { color: var(--text-2); font-size: 13px; }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 10px; }
.toggle-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 96px; padding: 10px 6px;
  border-radius: 18px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; text-align: center; font-weight: 700; font-size: 13px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.toggle-tile .emoji { font-size: 28px; }
.toggle-tile[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.toggle-tile:active { transform: scale(0.96); }
.toggle-tile[disabled] { opacity: 0.6; cursor: default; }

/* ---------- Tabbar ---------- */
#tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-b)); z-index: 50;
  width: min(calc(100% - 24px), 520px); height: var(--tabbar-h); display: flex; align-items: center; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-radius: 24px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); padding: 0 6px;
}
#tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; text-decoration: none; color: var(--muted);
  font-size: 11px; font-weight: 700; border-radius: 16px; position: relative;
}
#tabbar a svg { width: 24px; height: 24px; }
#tabbar a[aria-current='page'] { color: var(--accent-strong); }
#tabbar a[aria-current='page']::before { content: ''; position: absolute; top: 2px; width: 22px; height: 3px; border-radius: 3px; background: var(--accent); }
#tabbar .dot { position: absolute; top: 6px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }

/* ---------- Heute ---------- */
.level-card { display: flex; align-items: center; gap: 14px; }
.level-card .emoji { font-size: 34px; width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--violet-soft); flex: none; }
.xp-bar { height: 10px; border-radius: 999px; background: var(--violet-soft); overflow: hidden; margin-top: 8px; }
.xp-bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), #b38cf0); transition: width 1.2s cubic-bezier(0.2, 0.8, 0.2, 1); }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-day {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 8px; border-radius: 16px; text-decoration: none;
  background: var(--surface); box-shadow: var(--shadow); font-size: 12px; font-weight: 700; color: var(--muted); border: 2px solid transparent;
}
.week-day b { font-size: 17px; color: var(--text); font-weight: 800; }
.week-day i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); }
.week-day.planned i { background: transparent; border: 2.5px solid var(--accent); }
.week-day.done i { background: var(--good); }
.week-day.skipped i { background: var(--muted); opacity: 0.5; }
.week-day.today { border-color: var(--accent); }
.week-day.today b { color: var(--accent-strong); }

.goal-ring { position: relative; width: 64px; height: 64px; flex: none; }
.goal-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.goal-ring circle { fill: none; stroke-width: 7; }
.goal-ring .track { stroke: var(--surface-3); }
.goal-ring .fill { stroke: var(--good); stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.goal-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 850; font-size: 16px; }

.adjust-row { margin-top: 14px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border-radius: 20px; border: 0; cursor: pointer; text-align: left;
  background: var(--surface); box-shadow: var(--shadow); text-decoration: none; transition: transform 0.12s;
}
.quick:active { transform: scale(0.97); }
.quick .emoji { font-size: 28px; }
.quick b { font-size: 15px; }
.quick small { color: var(--muted); font-size: 13px; line-height: 1.3; }

.stat-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-tiles.three { grid-template-columns: repeat(3, 1fr); }
.stat-tile { background: var(--surface); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.stat-tile .label { font-size: 13px; color: var(--text-2); font-weight: 650; }
.stat-tile .value { font-size: 28px; font-weight: 850; letter-spacing: -0.02em; margin-top: 2px; }
.stat-tile .sub { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Listen ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit;
  background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; cursor: pointer;
}
.list-item:last-child { border-bottom: 0; }
.list-item .emoji { font-size: 22px; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.list-item .title { font-weight: 750; }
.list-item .sub { font-size: 13px; color: var(--muted); }
.list-item .chev { color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 750; background: var(--surface-2); color: var(--text-2); }
.pill.good { background: var(--good-soft); color: var(--good-text); }
.pill.accent { background: var(--accent-soft); color: var(--accent-strong); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }

/* ---------- Plan ---------- */
.plan-day { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: stretch; }
.plan-day:last-child { border-bottom: 0; }
.plan-day .date { width: 46px; flex: none; text-align: center; padding-top: 6px; }
.plan-day .date b { display: block; font-size: 20px; font-weight: 850; }
.plan-day .date small { font-size: 12px; font-weight: 750; color: var(--muted); text-transform: uppercase; }
.plan-day.is-today .date b, .plan-day.is-today .date small { color: var(--accent-strong); }
.plan-day .rest { color: var(--muted); font-size: 14px; display: flex; align-items: center; padding: 8px 0; }
.plan-card {
  flex: 1; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; text-decoration: none; color: inherit;
  background: var(--surface-2); min-width: 0;
}
.plan-card .title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-card .sub { font-size: 13px; color: var(--text-2); }
.plan-card.done { background: var(--good-soft); }
.plan-card.skipped { opacity: 0.55; }

/* ---------- Workout-Detail ---------- */
.block { margin-top: 14px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.block-head h3 { font-size: 16px; }
.block-head small { color: var(--muted); font-weight: 650; font-size: 13px; }
.ex { border-bottom: 1px solid var(--border); }
.ex:last-child { border-bottom: 0; }
.ex summary { display: flex; align-items: center; gap: 12px; padding: 12px 2px; cursor: pointer; list-style: none; }
.ex summary::-webkit-details-marker { display: none; }
.ex .num { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; font-size: 13px; flex: none; }
.ex .name { font-weight: 750; flex: 1; min-width: 0; }
.ex .dose { font-weight: 800; white-space: nowrap; }
.ex .dose small { color: var(--muted); font-weight: 650; }
.ex .more { padding: 0 2px 14px 44px; font-size: 14px; color: var(--text-2); }
.ex .more .variants { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.flames { letter-spacing: -2px; }
.coach-note { display: flex; gap: 12px; align-items: flex-start; background: var(--violet-soft); border-radius: 18px; padding: 14px; }
.coach-note .cat { font-size: 26px; }
.sticky-cta { position: sticky; bottom: calc(var(--tabbar-h) + 20px + var(--safe-b)); margin-top: 18px; z-index: 5; }

/* ---------- Coach ---------- */
.coach-view { display: flex; flex-direction: column; min-height: calc(100dvh - var(--tabbar-h) - 40px); padding-bottom: calc(var(--tabbar-h) + 110px + var(--safe-b)); }
.coach-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.coach-head .cat { width: 50px; height: 50px; border-radius: 18px; background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); display: grid; place-items: center; font-size: 28px; flex: none; }
.coach-head .status { font-size: 13px; color: var(--muted); font-weight: 650; }
.coach-head .status.busy { color: var(--accent-strong); }
.messages { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.bubble { max-width: 86%; padding: 12px 15px; border-radius: 20px; line-height: 1.45; overflow-wrap: anywhere; animation: pop 0.25s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
.bubble.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.bubble.assistant { align-self: flex-start; background: var(--surface); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.bubble.error { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.bubble p + p, .bubble p + ul, .bubble ul + p { margin-top: 8px; }
.bubble ul { margin: 6px 0 0; padding-left: 20px; }
.bubble li + li { margin-top: 3px; }
.event { align-self: center; max-width: 92%; text-align: center; font-size: 13px; font-weight: 650; color: var(--text-2); background: var(--surface-2); padding: 8px 14px; border-radius: 14px; }
.applied { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.applied a, .applied span { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 10px; background: var(--surface-2); text-decoration: none; color: var(--text); }
.typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.thinking-text { font-size: 13px; color: var(--muted); margin-top: 4px; font-weight: 600; }
.composer {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 18px + var(--safe-b)); z-index: 40;
  width: min(calc(100% - 24px), 576px); display: flex; flex-direction: column; gap: 8px;
}
.composer form { display: flex; gap: 8px; align-items: flex-end; background: var(--surface); border-radius: 22px; padding: 6px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.composer textarea { flex: 1; border: 0; background: transparent; resize: none; padding: 10px 12px; max-height: 140px; min-height: 44px; outline: none; font-size: 16px; line-height: 1.4; }
.composer .send { width: 44px; height: 44px; border-radius: 16px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.composer .send:disabled { opacity: 0.4; }
.composer .send svg { width: 22px; height: 22px; }
.composer .context { align-self: flex-start; font-size: 13px; font-weight: 700; background: var(--violet-soft); color: var(--violet); padding: 6px 8px 6px 12px; border-radius: 12px; display: inline-flex; align-items: center; gap: 6px; }
.composer .context button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 16px; padding: 0 4px; }
.suggestions { margin-top: 6px; }

/* ---------- Fortschritt & Charts ---------- */
.level-hero { display: flex; align-items: center; gap: 16px; }
.level-hero .big-emoji { font-size: 54px; width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.18); flex: none; }
.level-hero .xp-bar { background: rgba(255, 255, 255, 0.25); }
.level-hero .xp-bar > i { background: #fff; }
.viz { position: relative; }
.viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz .gridline { stroke: var(--grid); stroke-width: 1; }
.viz .baseline { stroke: var(--axis); stroke-width: 1; }
.viz .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz .bar { fill: var(--series); }
.viz .bar.zero { fill: var(--surface-3); }
.viz .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz .area { fill: var(--series); opacity: 0.1; }
.viz .dot { fill: var(--series); stroke: var(--chart-surface); stroke-width: 2; }
.viz .band { fill: var(--good); opacity: 0.08; }
.viz .band-label { fill: var(--muted); font-size: 11px; }
.viz .end-label { fill: var(--text); font-size: 12px; font-weight: 750; }
.viz .hit { fill: transparent; cursor: default; outline: none; }
.viz .hit-group .xh { stroke: var(--axis); stroke-width: 1; opacity: 0; }
.viz .hit-group:hover .xh, .viz .hit-group:focus-within .xh { opacity: 1; }
.viz .hit-group:hover .bar, .viz .hit-group:focus-within .bar { filter: brightness(1.12); }
.viz .cell { rx: 3px; }
.viz-tip {
  position: fixed; z-index: 200; pointer-events: none; background: var(--text); color: var(--bg); padding: 8px 11px; border-radius: 10px;
  font-size: 13px; line-height: 1.3; box-shadow: var(--shadow-lg); transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; opacity: 0; transition: opacity 0.1s;
}
.viz-tip.show { opacity: 1; }
.viz-tip b { display: block; font-size: 15px; }
.viz-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 10px; justify-content: flex-end; }
.viz-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
details.viz-table { margin-top: 10px; font-size: 13px; }
details.viz-table summary { cursor: pointer; color: var(--muted); font-weight: 650; }
details.viz-table table { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
details.viz-table td, details.viz-table th { padding: 4px 6px; text-align: left; border-bottom: 1px solid var(--border); }
details.viz-table td:last-child, details.viz-table th:last-child { text-align: right; }

.ex-row { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.ex-row:last-child { border-bottom: 0; }
.ex-row .best { font-weight: 850; font-size: 18px; text-align: right; white-space: nowrap; }
.ex-row .best small { font-size: 12px; color: var(--muted); font-weight: 650; display: block; }
.ex-row svg.spark { width: 64px; height: 26px; flex: none; }
.spark path { fill: none; stroke: var(--series); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark circle { fill: var(--series); }

.test-row + .test-row { margin-top: 16px; }
.test-bar { position: relative; height: 12px; border-radius: 999px; background: var(--accent-soft); margin-top: 8px; }
.test-bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: var(--series); }
.test-bar > em { position: absolute; top: -4px; bottom: -4px; width: 3px; border-radius: 2px; background: var(--text-2); }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.badge {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px 10px; border-radius: 18px; border: 0; cursor: pointer;
  background: var(--surface-2); text-align: center; font-size: 12px; font-weight: 750; line-height: 1.2;
}
.badge .emoji { font-size: 34px; }
.badge.locked .emoji { filter: grayscale(1); opacity: 0.35; }
.badge.locked { color: var(--muted); }
.badge.earned { background: linear-gradient(160deg, var(--accent-soft), var(--violet-soft)); }
.badge .mini-bar { width: 70%; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.badge .mini-bar i { display: block; height: 100%; background: var(--muted); }

/* ---------- Player ---------- */
.player {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: #12100f; color: #fff;
  padding: calc(12px + var(--safe-t)) 18px calc(18px + var(--safe-b));
}
.player.rest { background: radial-gradient(circle at 50% 30%, #2b2366, #12100f 70%); }
.player.work { background: radial-gradient(circle at 50% 25%, #4a1f12, #12100f 70%); }
.player-top { display: flex; align-items: center; gap: 12px; }
.player-top .icon-btn { background: rgba(255, 255, 255, 0.1); color: #fff; }
.player-top .info { flex: 1; min-width: 0; }
.player-top .info b { display: block; font-size: 15px; }
.player-top .info small { color: rgba(255, 255, 255, 0.6); font-weight: 650; }
.player-top .clock { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 17px; color: rgba(255, 255, 255, 0.85); }
.player-progress { height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.12); margin: 12px 0 0; overflow: hidden; }
.player-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--hero-1), var(--hero-2)); transition: width 0.4s ease; }
.player-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; max-width: 560px; width: 100%; margin: 0 auto; overflow-y: auto; padding: 12px 0; }
.player .phase { font-size: 13px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--hero-1); }
.player.rest .phase { color: #a99cff; }
.player .ex-name { font-size: clamp(30px, 8vw, 44px); font-weight: 900; letter-spacing: -0.03em; line-height: 1.05; }
.player .target { font-size: clamp(76px, 24vw, 132px); font-weight: 900; letter-spacing: -0.05em; line-height: 0.95; font-variant-numeric: tabular-nums; }
.player .target small { font-size: 22px; font-weight: 750; letter-spacing: 0; color: rgba(255, 255, 255, 0.6); margin-left: 6px; }
.player .cue { color: rgba(255, 255, 255, 0.72); font-size: 16px; max-width: 440px; }
.player .side-tag { display: inline-block; background: rgba(255, 255, 255, 0.14); padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 750; }
.ring { position: relative; width: min(64vw, 280px); aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring .track { stroke: rgba(255, 255, 255, 0.1); }
.ring .prog { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.player.rest .ring .prog { stroke: #a99cff; }
.ring .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .center b { font-size: clamp(56px, 18vw, 92px); font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; line-height: 1; }
.ring .center small { color: rgba(255, 255, 255, 0.6); font-weight: 700; margin-top: 4px; }
.ring.over .prog { stroke: var(--good); }
.counter { display: flex; align-items: center; gap: 18px; }
.counter button { width: 60px; height: 60px; border-radius: 20px; border: 0; background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 30px; font-weight: 700; cursor: pointer; }
.counter button:active { background: rgba(255, 255, 255, 0.22); }
.variant-seg { display: flex; gap: 6px; background: rgba(255, 255, 255, 0.08); padding: 4px; border-radius: 14px; width: 100%; max-width: 440px; }
.variant-seg button { flex: 1; min-height: 40px; border: 0; border-radius: 11px; background: transparent; color: rgba(255, 255, 255, 0.7); font-weight: 700; font-size: 13px; cursor: pointer; padding: 4px 6px; line-height: 1.15; }
.variant-seg button[aria-pressed='true'] { background: rgba(255, 255, 255, 0.95); color: #12100f; }
.player-actions { display: flex; gap: 10px; width: 100%; max-width: 560px; margin: 0 auto; }
.player-actions .btn { flex: 1; }
.player .btn.ghost { color: rgba(255, 255, 255, 0.75); background: rgba(255, 255, 255, 0.08); }
.player .next-up { background: rgba(255, 255, 255, 0.08); border-radius: 18px; padding: 12px 16px; font-weight: 650; }
.player .next-up small { display: block; color: rgba(255, 255, 255, 0.55); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 800; }
.player .countdown { font-size: 140px; font-weight: 900; animation: zoom 1s ease-out infinite; }
@keyframes zoom { from { transform: scale(1.3); opacity: 0.3; } 30% { opacity: 1; } to { transform: scale(0.9); opacity: 0.7; } }

.rpe-scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; width: 100%; }
.rpe-scale button { aspect-ratio: 0.8; border: 0; border-radius: 10px; font-weight: 850; font-size: 15px; cursor: pointer; background: var(--surface-2); color: var(--text); }
.rpe-scale button[aria-pressed='true'] { background: var(--accent); color: #fff; transform: scale(1.08); }
.mood-row { display: flex; justify-content: space-between; gap: 6px; }
.mood-row button { flex: 1; border: 2px solid transparent; background: var(--surface-2); border-radius: 16px; padding: 8px 2px; cursor: pointer; font-size: 30px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mood-row button small { font-size: 11px; font-weight: 750; color: var(--text-2); }
.mood-row button[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }

.celebrate { text-align: center; }
.celebrate .big { font-size: 72px; animation: bounce 0.9s ease-out; }
@keyframes bounce { 0% { transform: scale(0.3); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.celebrate .xp { font-size: 46px; font-weight: 900; color: var(--violet); font-variant-numeric: tabular-nums; }
.reward { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); animation: pop 0.4s ease-out both; }
.reward .emoji { font-size: 28px; }
.levelup { background: linear-gradient(135deg, var(--violet), #b38cf0); color: #fff; border-radius: 22px; padding: 18px; animation: pop 0.5s ease-out both; }

/* ---------- Overlays ---------- */
#modal-root .backdrop { position: fixed; inset: 0; background: rgba(10, 8, 7, 0.5); z-index: 150; animation: fade 0.2s ease-out; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 160; width: min(100%, 600px); max-height: 88dvh; overflow-y: auto;
  background: var(--surface); border-radius: 28px 28px 0 0; padding: 10px 20px calc(24px + var(--safe-b)); box-shadow: var(--shadow-lg);
  animation: sheet-up 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet::before { content: ''; display: block; width: 42px; height: 5px; border-radius: 5px; background: var(--surface-3); margin: 0 auto 14px; }
@keyframes sheet-up { from { transform: translate(-50%, 100%); } }
.sheet h2 { margin-bottom: 8px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 20px; }
.sheet .actions .btn { flex: 1; }
#toast-root { position: fixed; top: calc(14px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; width: min(calc(100% - 32px), 460px); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 16px; font-weight: 650; box-shadow: var(--shadow-lg); animation: toast-in 0.25s ease-out; pointer-events: auto; }
.toast.error { background: var(--danger); color: #fff; }
.toast.good { background: var(--good-text); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 400; }

/* ---------- Login & Onboarding ---------- */
.splash { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; max-width: 420px; margin: 0 auto; padding: 24px 20px; }
.mascot { width: 112px; height: 112px; margin: 0 auto 18px; display: block; filter: drop-shadow(0 14px 30px rgba(232, 69, 111, 0.35)); animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-2deg); } }
.splash h1 { text-align: center; font-size: 34px; }
.splash .lead { text-align: center; color: var(--text-2); margin: 8px 0 24px; }
.steps-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 22px; }
.steps-dots i { width: 8px; height: 8px; border-radius: 8px; background: var(--surface-3); transition: width 0.3s, background 0.3s; }
.steps-dots i.on { width: 26px; background: var(--accent); }
.onb-actions { display: flex; gap: 10px; margin-top: 26px; }
.onb-actions .btn { flex: 1; }

.empty-state { text-align: center; padding: 26px 10px; color: var(--text-2); }
.empty-state .emoji { font-size: 44px; display: block; margin-bottom: 8px; }
.kbd-hint { font-size: 12px; color: var(--muted); }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-size: 13px; min-height: 44px; }

@media (min-width: 720px) {
  .view { padding-top: 32px; }
  h1 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
