/* Design „Schwimmbahn“. Farben, Größen und Rundungen nur über diese Variablen. */
@font-face { font-family: 'Red Hat Text'; src: url('red-hat-text.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }
:root {
  color-scheme: light dark;
  --bg: #fff; --surface: #fff; --tint: #e3f2f6; --soft: #f1f3f4; --ink: #06283d; --muted: #4f5d66; --line: #e2e5e7; --field: #fff;
  --accent: #00628b; --on-accent: #fff; --float: #f2b705; --on-float: #06283d; --pale: #a9cddc; --danger: #b3261e;
  --s: 14px; --m: 17px; --l: 20px; --xl: 32px; --xxl: clamp(38px, 11.5vw, 48px);
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214; --surface: #1a1d20; --tint: #23272b; --soft: #23272b; --ink: #f4f6f7; --muted: #a8b0b6; --line: #343a40; --field: #101214;
    --accent: #5bb6e0; --on-accent: #062233; --float: #f2c53d; --on-float: #06283d; --pale: #5d666d; --danger: #ff9488;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
::selection { background: var(--float); color: var(--on-float); }
body {
  margin: 0; background: var(--bg); color: var(--ink); caret-color: var(--accent);
  font: var(--m)/1.4 'Red Hat Text', -apple-system, system-ui, sans-serif; touch-action: manipulation;
}
main {
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 160px);
}
h1 { font-size: var(--xl); line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; margin: 8px 0 16px; text-wrap: balance; }
h2 { font-size: var(--l); line-height: 1.25; font-weight: 700; margin: 0; text-wrap: balance; }
h3 { font-size: var(--m); margin: 16px 0 4px; }
p { margin: 4px 0; text-wrap: pretty; }
.muted { color: var(--muted); font-size: 15px; }
.danger { color: var(--danger); }
#goalerr:empty, #focus > .danger:empty { display: none; }
.num, .lane, .bigtime, .f input, td, .value { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 0 0 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; gap: 4px; }
.row.center { justify-content: center; }
.card > .row + .row, .card > .muted + .row, .card > h2 + form { margin-top: 12px; }
.tag, .delta { font-size: 15px; font-weight: 600; border-radius: 99px; padding: 4px 12px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; background: var(--soft); color: var(--ink); }
.tag.done, .delta.up { background: var(--float); color: var(--on-float); }
.tag svg { width: 16px; height: 16px; stroke-width: 3; }
select { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: var(--r); min-height: 44px; padding: 8px 12px; }
.plain { list-style: none; margin: 8px 0 0; padding: 0; }
.plain li + li { margin-top: 4px; }
.warn { background: var(--surface); border: 2px solid var(--danger); border-radius: var(--r); padding: 12px; }

button, .btn {
  font: inherit; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); min-height: 44px; padding: 8px 16px; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; transition: transform 120ms ease-out, opacity 120ms ease-out;
}
button:active, .btn:active { transform: scale(0.96); }
button:disabled { opacity: 0.4; cursor: default; }
:focus-visible, .btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 700; }
.quiet { background: none; border-color: transparent; font-weight: 500; padding: 8px 12px; }
.danger.quiet { color: var(--danger); }
.wide { width: 100%; margin-top: 8px; min-height: 52px; }
.big { min-width: 140px; min-height: 60px; font-size: var(--l); }

/* Kopf zum Aufklappen: Trainings auf der Startseite, Übungen im Fortschritt */
.day, .ex { padding: 0; overflow: hidden; }
.day.next { background: var(--tint); }
.day.next .exname { font-size: 24px; letter-spacing: -0.01em; }
.day.next .exname .muted { display: table; background: var(--float); color: var(--on-float); border-radius: 99px; padding: 2px 12px; margin-top: 4px; font-weight: 600; }
.day.next select { background: var(--surface); }
.day.next .tag { background: var(--surface); }
.exhead { width: 100%; border: 0; border-radius: 0; background: none; padding: 12px 16px; min-height: 68px; gap: 12px; display: flex; align-items: center; justify-content: flex-start; text-align: left; font-weight: 700; }
.exhead:active { transform: none; opacity: 0.6; }
.exhead:focus-visible { outline-offset: -3px; }
.exname { flex: 1; min-width: 0; }
.exname span { display: block; font-size: 15px; font-weight: 400; letter-spacing: 0; }
.exhead > svg:last-child { flex: none; color: var(--muted); }
[aria-expanded="true"] > svg:last-child { transform: rotate(180deg); }
.exbody { padding: 0 16px 16px; }
.exbody > .wide { margin: 12px 0; }

/* Fortschritt */
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 3px; margin: 0 0 12px; background: var(--soft); border-radius: var(--r); }
.seg button { border: 0; border-radius: 10px; background: none; color: var(--muted); padding: 6px 2px; min-height: 52px; min-width: 0; font-size: clamp(11px, 3.3vw, 14px); line-height: 1.2; }
.seg [aria-pressed="true"] { background: var(--surface); color: var(--accent); font-weight: 700; }
.index { display: flex; align-items: center; gap: 12px; background: var(--soft); border-color: transparent; }
.index > div { flex: 1; min-width: 0; }
.index b { font-size: var(--xl); line-height: 1; letter-spacing: -0.02em; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin: 0 0 12px; }
.stats dt { color: var(--muted); font-size: var(--s); }
.bestkey::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--float); border: 2px solid var(--accent); margin-right: 6px; }
.stats dd { margin: 0; font-size: var(--l); font-weight: 700; font-variant-numeric: tabular-nums; }
summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; font-weight: 600; cursor: pointer; border-top: 1px solid var(--line); list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; font-size: 22px; font-weight: 400; color: var(--muted); }
[open] > summary::after { content: '−'; }

/* Fokusmodus */
.segs { display: flex; gap: 6px; margin: -8px 0 0; }
.segs progress::-webkit-progress-value { background: var(--float); }
.segs button { flex: 1; min-width: 0; padding: 0; border: 0; background: none; border-radius: 6px; }
.segs progress { height: 8px; pointer-events: none; }
.segs [aria-current] progress { height: 14px; border-radius: 7px; }
#focus h1 { margin: 4px 0 0; }
.where { margin: 0 0 12px; font-size: var(--m); }
#focus .card { margin-bottom: 8px; padding: 12px 16px; }
#focus h2 { font-size: var(--m); font-weight: 600; }
.value { font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 4px; }
.card.now { background: var(--tint); border-color: transparent; }
.note { font-size: var(--s); margin: 0; }
svg.rope { display: block; width: 100%; height: auto; stroke: none; }
.rope line { stroke: var(--line); stroke-width: 2; }
.then circle { fill: var(--pale); }
.rope.now circle { fill: var(--accent); }
.rope.now line { stroke: var(--pale); }
.rope.now .end { fill: var(--float); }
.stepper { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 8px; margin-top: 8px; }
.stepper > button { background: var(--surface); color: var(--ink); border: 2px solid var(--line); min-height: 60px; padding: 0; font-size: 30px; line-height: 1; }
.stepper .fields { justify-content: center; gap: 12px; }
.stepper .f { flex: 0 1 auto; justify-content: center; background: none; border: 0; padding: 0 4px; border-radius: 8px; }
.stepper .f span { font-size: var(--m); font-weight: 600; color: var(--ink); }
.stepper .f input { font-size: var(--xxl); font-weight: 700; height: 60px; width: 2.6em; text-align: center; padding: 0 3px; }
.stepper .f input::placeholder { opacity: 1; font-weight: 700; }
@supports (field-sizing: content) { .stepper .f input { field-sizing: content; width: auto; min-width: 1.4em; max-width: 3.2em; } }
.stepper .f + .f, .stepper .f:has(+ .f) { flex-direction: column; align-items: center; gap: 0; }
.stepper .f + .f input, .stepper .f:has(+ .f) input { font-size: 34px; height: 44px; }
.stepper .f + .f span, .stepper .f:has(+ .f) span { font-size: var(--s); line-height: 1.1; padding-bottom: 2px; }
.card.now > .row { min-height: 36px; flex-wrap: nowrap; }
.duel { margin: 0; color: var(--muted); font-size: 15px; }
.duel b { color: var(--ink); }
.duel.up b { background: var(--float); color: var(--on-float); border-radius: 99px; padding: 2px 10px; }
.setnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.setnav > button { width: 44px; padding: 0; }
.setnav > [aria-current] { background: var(--float); color: var(--on-float); border: 2px solid var(--on-float); }
.setnav > span { margin-left: auto; }

/* Alle Übungen untereinander */
[data-act="listview"].wide { margin: 8px 0 16px; }
.sets { list-style: none; margin: 8px 0 0; padding: 0; }
li.set { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.lane { width: 20px; font-size: var(--l); font-weight: 700; color: var(--muted); }
.set.done .lane { color: var(--accent); }
.fields { display: flex; gap: 8px; flex: 1; min-width: 0; }
.f { display: flex; align-items: baseline; gap: 4px; flex: 1; min-width: 0; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; }
.f span { color: var(--muted); font-size: var(--s); }
.f input { font: inherit; font-size: var(--l); font-weight: 600; width: 100%; min-width: 0; height: 46px; border: 0; background: none; color: var(--ink); outline: 0; padding: 0; }
.f input::placeholder { color: var(--muted); opacity: 0.85; font-weight: 400; }
.f:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
li.amrap .fields { flex-wrap: wrap; }
li.amrap .f { flex-basis: 40%; }
@media (max-width: 360px) { li.amrap, li.time { flex-wrap: wrap; justify-content: flex-end; } li.amrap .fields, li.time .fields { flex: 1 0 calc(100% - 28px); } }
#goalform .fields { flex-basis: 100%; }
.tick, .icon { width: 48px; min-height: 48px; padding: 0; font-size: var(--l); flex: none; }
.tick { color: var(--muted); }
.set.done .tick { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.icon.on { background: var(--accent); color: var(--on-accent); border-color: transparent; }
svg:not(#chart, .rope, .spark) { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg:not(#chart, .rope, .spark, .tag svg) { width: 24px; height: 24px; }

.goal { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 15px; margin: 8px 0; }
progress { grid-column: 1 / -1; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 4px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

#chart { display: block; width: 100%; height: auto; touch-action: pan-y; border-radius: 8px; }
.spark { width: 72px; height: 28px; flex: none; }
.readout { font-size: var(--l); min-height: 28px; }
.grid { stroke: var(--line); stroke-width: 1; }
.axis { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.index .dot { stroke: var(--soft); }
.dot.best { fill: var(--float); stroke: var(--accent); }
.sel { fill: none; stroke: var(--accent); stroke-width: 2; }
.cross { stroke: var(--muted); stroke-width: 1; }
.goalline { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 5 4; }
.goallabel { fill: var(--ink); font-size: 12px; font-weight: 600; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th { text-align: left; font-size: var(--s); color: var(--muted); font-weight: 500; padding: 4px 0; }
td { border-top: 1px solid var(--line); padding: 8px 0; vertical-align: top; }

.watch { text-align: center; padding: 32px 0; }
.bigtime { font-size: clamp(60px, 21vw, 108px); font-weight: 700; line-height: 1; letter-spacing: -0.03em; margin: 0 0 32px; }
.bigtime.over { color: var(--accent); }
.laps { list-style: none; margin: 8px 0 0; padding: 0; }
.laps li { display: grid; grid-template-columns: 1fr auto 80px; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.laps li span:last-child { text-align: right; }

footer { position: fixed; inset: auto 0 0; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#tabs, .mini { max-width: 560px; margin: 0 auto; display: flex; }
#tabs button { flex: 1; flex-direction: column; gap: 2px; min-height: 60px; padding: 6px 0; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 500; }
#tabs span { padding-bottom: 3px; border-bottom: 3px solid transparent; }
#tabs [aria-current] { color: var(--accent); font-weight: 700; }
#tabs [aria-current] span { border-color: var(--float); }
.mini { align-items: center; justify-content: space-between; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.minitime { gap: 8px; padding-left: 0; min-width: 0; }
.minitime .num { font-size: 22px; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { button { transition: none; } button:active { transform: none; } }
