:root {
  --bg: #f5f3ee; --card: #ffffff; --text: #1d2430; --muted: #66707e;
  --accent: #e2542f; --accent-text: #ffffff; --rest: #2f7d6d; --line: #e3dfd6;
  --fig: #17324d; --ground: #cfc9bd; --prop: #d9d3c7;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --card: #1e232b; --text: #eef0f3; --muted: #9aa3af;
    --accent: #ff6a43; --accent-text: #14171c; --rest: #4fb39d; --line: #2c333d;
    --fig: #e6edf5; --ground: #3a414c; --prop: #2c333d;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
button { font: inherit; }

/* Layout */
.screen { max-width: 520px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.6rem; margin: 0.4em 0; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 1.2em 0 0.5em; }
p { margin: 0.4em 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row { display: flex; gap: 10px; margin-top: 10px; }
.row > * { flex: 1; }
.meta, small { color: var(--muted); }
.streak { font-weight: 600; }
.done-today { color: var(--rest); font-weight: 600; }

/* Knöpfe */
button { cursor: pointer; border: 0; border-radius: 14px; min-height: 48px; padding: 10px 16px; touch-action: manipulation; }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.primary { display: block; width: 100%; margin-top: 18px; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 1.1rem; }
.primary.big { min-height: 64px; font-size: 1.3rem; }
.secondary { background: var(--card); color: var(--text); border: 2px solid var(--line); font-weight: 600; width: 100%; margin-top: 8px; }
.ghost { background: transparent; color: var(--muted); width: 100%; margin-top: 8px; }
.danger { background: transparent; color: #c0392b; width: 100%; margin-top: 28px; }
.icon { background: transparent; color: var(--text); font-size: 1.6rem; min-width: 48px; padding: 0; }
.round { width: 48px; height: 48px; padding: 0; border-radius: 50%; background: var(--card); color: var(--text); border: 2px solid var(--line); font-size: 1.4rem; font-weight: 700; }

/* Auswahl */
.choices { display: grid; gap: 10px; }
.choices.inline { grid-template-columns: repeat(3, 1fr); }
.choice { text-align: left; background: var(--card); color: var(--text); border: 2px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.choice.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* Einstellungen */
.stepper { display: grid; grid-template-columns: 1fr 48px 64px 48px; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.stepper output { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.total { font-weight: 700; margin-top: 12px; }

/* Karten und Plan */
.card { background: var(--card); border-radius: 16px; padding: 14px 16px; margin: 12px 0; border: 1px solid var(--line); }
.card.rest h2, .card.prog h2 { margin-top: 0; }
.plan { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.plan li { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); }
.plan li small { display: block; }
.mini { width: 64px; height: 64px; flex: none; }
.mini svg { width: 100%; height: 100%; }

/* Training */
.run { text-align: center; min-height: 100dvh; display: flex; flex-direction: column; }
.run.resting { --fig: var(--rest); }
.run .progress { color: var(--muted); font-weight: 600; margin-top: 4px; }
.run .phase { color: var(--rest); font-weight: 700; min-height: 1.4em; }
.fig-big { width: min(78vw, 340px); aspect-ratio: 1; margin: 0 auto; }
.fig-big svg { width: 100%; height: 100%; }
.run h2 { margin: 4px 0; font-size: 1.4rem; }
.count { font-size: clamp(4.5rem, 24vw, 7rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.run.resting .count { color: var(--rest); }
.run details { text-align: left; margin: 8px 0; }
.run summary { cursor: pointer; color: var(--muted); min-height: 32px; }
.controls button { margin-top: 0; }
.done { text-align: center; padding-top: 18vh; }

/* Figur */
.fig .fig-body { fill: var(--fig); }
.fig .fig-gap { fill: var(--fig-gap, var(--bg)); }
.plan li { --fig-gap: var(--card); }
.fig-ground { stroke: var(--ground); stroke-width: 3; stroke-linecap: round; }
.fig-prop { fill: var(--prop); }
.fig-prop-line { fill: none; stroke: var(--prop); stroke-width: 6; stroke-linejoin: round; }
