/* Layout: Sticky Kopf mit Tabs, darunter eine Spalte (max 1080px) aus Abschnitten; Detailansicht ersetzt die Liste. */
:root {
  --bg: #EDF0F5; --surface: #FFFFFF; --sunk: #E3E8EF; --fg: #131A27; --muted: #586378; --line: #D3DAE4;
  --accent: #2346D8; --accent-fg: #FFFFFF;
  --kraft: #2346D8; --mob: #0D9784; --lauf: #C97C06; --rad: #B02F93; --pb: #DA4318;
  --heat0: #DCE2EB;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --r: 10px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0D121B; --surface: #151C29; --sunk: #1B2435; --fg: #E7EBF2; --muted: #96A2B6; --line: #263145;
  --accent: #7590FF; --accent-fg: #0D121B;
  --kraft: #7590FF; --mob: #2DC6AD; --lauf: #F0A63A; --rad: #E064C3; --pb: #FF7B54; --heat0: #1D2636; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0D121B; --surface: #151C29; --sunk: #1B2435; --fg: #E7EBF2; --muted: #96A2B6; --line: #263145;
  --accent: #7590FF; --accent-fg: #0D121B;
  --kraft: #7590FF; --mob: #2DC6AD; --lauf: #F0A63A; --rad: #E064C3; --pb: #FF7B54; --heat0: #1D2636; color-scheme: dark }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; line-height: 1.5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
.wrap { max-width: 1080px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; padding-block: 10px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: .02em; text-transform: uppercase; margin-right: auto; }
.brand small { font-weight: 500; color: var(--muted); letter-spacing: .04em; margin-left: 6px; font-size: 15px; }
nav { display: flex; gap: 4px; }
nav a { font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-decoration: none; padding: 4px 12px; border-radius: 999px; }
nav a[aria-current="page"] { background: var(--fg); color: var(--surface); }
nav a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, .row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.datachip { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
button { font: inherit; cursor: pointer; }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
main { padding-block: 24px 64px; display: grid; gap: 28px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; text-wrap: balance; margin: 0; }
h1 { overflow-wrap: anywhere; font-size: clamp(30px, 5vw, 44px); text-transform: uppercase; letter-spacing: .01em; }
h2 { font-size: 22px; text-transform: uppercase; letter-spacing: .04em; }
.sec { display: grid; gap: 12px; }
.sechead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.note { color: var(--muted); font-size: 13px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stat { background: var(--surface); padding: 14px 16px; display: grid; gap: 2px; }
.stat .v { font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.stat .v small { font-size: .55em; font-weight: 600; margin-left: 3px; }
.stats.wide { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat .s { font-size: 13px; color: var(--muted); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.scroll { overflow-x: auto; }
svg text { fill: var(--muted); font-family: var(--body); font-size: 11px; }
svg .axis { stroke: var(--line); }
.h0 { fill: var(--heat0); } .h1 { fill: color-mix(in srgb, var(--accent) 30%, var(--heat0)); } .h2 { fill: color-mix(in srgb, var(--accent) 55%, var(--heat0)); }
.h3 { fill: color-mix(in srgb, var(--accent) 80%, var(--heat0)); } .h4 { fill: var(--accent); }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.c-kraft { background: var(--kraft); } .c-mob { background: var(--mob); } .c-lauf { background: var(--lauf); } .c-rad { background: var(--rad); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 3px 12px; font-size: 13px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--surface); }
#tip { position: fixed; z-index: 20; pointer-events: none; background: var(--fg); color: var(--surface); font-size: 13px; padding: 6px 9px; border-radius: 6px; max-width: 260px; line-height: 1.35; }

/* Listen */
.list { display: grid; }
.row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.row:hover { background: var(--sunk); }
.row .dot { width: 10px; height: 10px; border-radius: 50%; }
.row .nm { font-weight: 600; overflow-wrap: anywhere; }
.row .meta { font-size: 13px; color: var(--muted); }
.row .rt { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; }
.row .rt b { font-family: var(--display); font-size: 18px; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tools input[type="search"] { flex: 1 1 220px; min-width: 0; font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); }
select { font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 3px 11px; font-size: 13px; font-weight: 600; }
.chip[aria-pressed="true"] { border-color: var(--fg); color: var(--fg); background: var(--sunk); }
.tag { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; padding: 1px 7px; border-radius: 4px; background: var(--sunk); color: var(--muted); }
.pbtag { background: color-mix(in srgb, var(--pb) 16%, transparent); color: var(--pb); }

/* Detail */
.back { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.dhead { display: grid; gap: 8px; }
.rounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.round { background: var(--sunk); border-radius: 8px; padding: 10px 12px; }
.round h3 { font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.round ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 14px; }
.round li { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 6px; }
.round li .q { font-family: var(--display); font-weight: 600; font-size: 16px; text-align: right; font-variant-numeric: tabular-nums; }
.round li.pause { color: var(--muted); }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.r, th.r { text-align: right; }

/* Upload */
.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 22px 16px; display: grid; gap: 8px; justify-items: start; background: var(--surface); }
.drop.over { border-color: var(--accent); background: var(--sunk); }
.drop input { font-size: 14px; max-width: 100%; }
.status { font-size: 14px; }
.status.err { color: var(--pb); font-weight: 600; }
.otd { display: grid; gap: 4px; }
.empty { color: var(--muted); padding: 20px 0; }
@media (prefers-reduced-motion: no-preference) { .row, nav a, .chip { transition: background-color .12s; } }

/* Ergänzungen: Übungen, Verlauf, PWA */
.exlink { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
.exlink:hover { color: var(--accent); border-color: var(--accent); }
.exbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: 14px; color: inherit; text-decoration: none; border-radius: 4px; }
.exbar:hover span:first-child { color: var(--accent); }
a { color: var(--accent); }
.hint { background: var(--sunk); border-bottom: 1px solid var(--line); font-size: 14px; }
.hint .wrap { display: flex; gap: 8px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding-block: 8px; }
.welcome { max-width: 640px; }
.welcome p { margin: 0; font-size: 17px; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
@media (max-width: 560px) { nav { width: 100%; overflow-x: auto; } nav a { font-size: 15px; padding: 4px 10px; white-space: nowrap; } }

/* Zuklappbare Abschnitte */
.fold > summary { display: flex; align-items: baseline; gap: 8px 12px; flex-wrap: wrap; cursor: pointer; list-style: none; border-radius: 6px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary h2 { margin-right: auto; }
.fold > summary .chev { width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); align-self: center; flex: none; }
.fold[open] > summary .chev { transform: rotate(45deg); }
.fold > summary:hover h2 { color: var(--accent); }
.fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.foldbody { margin-top: 12px; display: grid; gap: 12px; }
@media (prefers-reduced-motion: no-preference) { .fold > summary .chev { transition: transform .15s; } }

/* Dateiauswahl */
.drop .lead { margin: 0; font-size: 16px; max-width: 65ch; }
.pick { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.pick .btn { padding: 8px 16px; font-size: 15px; cursor: pointer; }
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.pick:has(+ .vh:focus-visible) .btn { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Hinweis: inoffiziell */
.brand small { text-transform: none; font-style: italic; }
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.45; }
.foot .wrap { padding-block: 16px 28px; max-width: 1080px; }
.welcome .unoff { font-size: 15px; background: var(--sunk); border-radius: 8px; padding: 10px 14px; color: var(--fg); }

/* Bestleistungen nach Tag und Uhrzeit */
.pbanswer { margin: 0; font-size: 17px; max-width: 70ch; }
.pbanswer b { color: var(--pb); }
.pbfacts { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 14px; color: var(--muted); }
.pbfacts b { color: var(--fg); }
.pbgrid { width: auto; min-width: 100%; border-collapse: separate; border-spacing: 3px; }
.pbgrid th { border: 0; text-align: center; padding: 2px 4px; font-size: 11px; }
.pbgrid tbody th { text-align: left; padding-right: 8px; }
.pbgrid td { border: 0; border-radius: 4px; text-align: center; padding: 8px 6px; min-width: 52px; font-family: var(--display); font-size: 16px; font-weight: 600; }
.pbgrid td.few { background: var(--sunk); color: var(--muted); }
.pbgrid td.best { outline: 2px solid var(--fg); outline-offset: -2px; }
:root { --pb-fg: #FFFFFF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --pb-fg: #0D121B; } }
:root[data-theme="dark"] { --pb-fg: #0D121B; }
/* Sprachumschalter */
.btn.lang { min-width: 40px; letter-spacing: .04em; }
.brand small { white-space: nowrap; }
@media (max-width: 560px) { .brand small { display: block; margin-left: 0; margin-top: 2px; } }

/* Fortschritt */
.techbars { display: grid; gap: 6px; }
.techrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) 56px; gap: 10px; align-items: center; font-size: 13px; }
.techrow .ty { color: var(--muted); font-variant-numeric: tabular-nums; }
.techrow .tn { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.tbar { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--sunk); }
.tbar span { display: block; height: 100%; }
.techrow.thin .tbar { opacity: .4; }
@media (max-width: 420px) { .stat .v { font-size: 27px; } }
/* Fortschritt: Werte rechts */
.prow .ftl { font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.prow .ftl b { color: var(--fg); font-size: 20px; }
.prow .ftl .arr { font-weight: 400; }
.prow .chg { font-size: 13px; font-weight: 600; }
.chg.up { color: var(--mob); } .chg.down { color: var(--pb); }
.howto { font-size: 13px; color: var(--muted); }
.howto summary { cursor: pointer; font-weight: 600; }
.howto p { margin: 6px 0 0; max-width: 75ch; }

/* Meine Ären */
.eras { display: grid; gap: 0; }
.era { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; position: relative; padding-bottom: 14px; }
.era::before { content: ""; position: absolute; left: 70px; top: 10px; bottom: 0; width: 2px; background: var(--line); }
.era:last-child::before { display: none; }
.eyr { font-size: 17px; font-weight: 700; color: var(--muted); padding-top: 1px; }
.ebody { padding-left: 16px; position: relative; min-width: 0; }
.ebody::before { content: ""; position: absolute; left: -7px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.enm { font-weight: 700; color: var(--fg); text-decoration: none; overflow-wrap: anywhere; }
.enm:hover { color: var(--accent); }
.enm .sw { margin-right: 6px; }
.ebody .meta { font-size: 13px; color: var(--muted); }
/* Verrücktester Tag */
.crazy { display: flex; align-items: center; gap: 14px; }
.cbig { font-family: var(--display); font-size: 64px; font-weight: 700; line-height: .9; color: var(--accent); }
.clead { font-family: var(--display); font-size: 20px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.grid2 > .panel.sec { align-content: start; }
.eyr { white-space: nowrap; }
.era { grid-template-columns: 72px minmax(0, 1fr); }
.era::before { left: 78px; }
.crazyfacts { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.crazyfacts b { color: var(--fg); }
