/* FullRange - ein Stylesheet, Marken als Variablen. Dunkel überschreibt nur
   die Marken, nie einzelne Regeln. Die Akzente der drei Übungsarten ziehen
   sich durch Tags, Bilder, Diagramme. */
:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ebe6db;
  --ink: #1d1e22;
  --ink-2: #5b5d66;
  --line: #ddd6c8;
  --brand: #1d1e22;
  --brand-ink: #fffdf8;
  --focus: #2f6fed;
  --strength: #e4572e;
  --strength-soft: #fbe1d8;
  --stretch: #138d83;
  --stretch-soft: #d3efeb;
  --mobility: #7c5cdb;
  --mobility-soft: #e6dffa;
  --danger: #c2362b;
  --ok: #1f8a4c;
  --shadow: 0 1px 2px rgb(30 25 10 / 6%), 0 4px 16px rgb(30 25 10 / 5%);
  --radius: 14px;
  --nav-h: 64px;
  --img-dim: none;
  /* Schrift auf den hellen *-soft-Flächen: die Akzente selbst schaffen dort keine 4,5:1. */
  --strength-ink: #b13a17; --stretch-ink: #0b6b63; --mobility-ink: #5b3cc0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161a; --surface: #1e2026; --surface-2: #2a2d35; --ink: #eceae4; --ink-2: #a3a6b0;
    --line: #33363f; --brand: #eceae4; --brand-ink: #15161a; --focus: #7aa5ff;
    --strength: #ff7a52; --strength-soft: #3d241c; --stretch: #3cc4b7; --stretch-soft: #173431;
    --mobility: #a68cff; --mobility-soft: #2a2343; --danger: #ff6b5e; --ok: #4cc47e;
    --strength-ink: #ff8a66; --stretch-ink: #45d0c3; --mobility-ink: #b49cff;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%); color-scheme: dark; --img-dim: brightness(.88) saturate(.95);
  }
}
:root[data-theme="dark"] {
  --bg: #15161a; --surface: #1e2026; --surface-2: #2a2d35; --ink: #eceae4; --ink-2: #a3a6b0;
  --line: #33363f; --brand: #eceae4; --brand-ink: #15161a; --focus: #7aa5ff;
  --strength: #ff7a52; --strength-soft: #3d241c; --stretch: #3cc4b7; --stretch-soft: #173431;
  --mobility: #a68cff; --mobility-soft: #2a2343; --danger: #ff6b5e; --ok: #4cc47e;
  --strength-ink: #ff8a66; --stretch-ink: #45d0c3; --mobility-ink: #b49cff;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%); color-scheme: dark; --img-dim: brightness(.88) saturate(.95);
}

*, *::before, *::after { box-sizing: border-box; }
/* hidden muss gewinnen - sonst überstimmt etwa .stack { display: grid } das Attribut. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.015em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 750; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
a { color: inherit; }
/* height: auto - sonst schlägt das height-Attribut jedes aspect-ratio und Bilder
   werden riesig und schief beschnitten (width/height bleiben für die Platzreserve). */
img { max-width: 100%; height: auto; display: block; }
/* Im Dunkeln leuchten die cremefarbenen Illustrationen sonst grell. */
.view img, dialog img { filter: var(--img-dim); }
small { font-size: .82em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.muted { color: var(--ink-2); }
.lead { font-size: 1.08rem; }
.hint { font-size: .85rem; color: var(--ink-2); margin-top: .6em; }
.eyebrow { text-transform: uppercase; font-size: .75rem; letter-spacing: .08em; color: var(--ink-2); font-weight: 650; margin-bottom: .3em; }
.eyebrow a { text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
.noscript { padding: 24px; }

/* --- Hülle ------------------------------------------------------------------------- */
.shell { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; text-decoration: none; font-size: 1.1rem; margin-right: auto; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--brand); color: var(--brand-ink); font-weight: 700; text-decoration: none;
}
.avatar.sm { width: 32px; height: 32px; font-size: .85rem; background: var(--surface-2); color: var(--ink); }
.main { padding: 8px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); outline: none; min-width: 0; }
.view { max-width: 1040px; margin: 0 auto; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.shell[data-auth="out"] .nav, .shell[data-auth="out"] .topbar { display: none; }
.shell[data-auth="out"] .main { padding-top: 0; padding-bottom: 0; }
/* Ab Tablet sieht die Hülle, bis feststeht, ob jemand angemeldet ist, aus wie
   abgemeldet (ohne Kopfzeile und Leiste): Sonst erscheinen beide und
   verschwinden für die Anmeldung wieder, und alles springt (CLS 0,165 am
   Desktop). Am Handy nicht: Ohne Kopfzeile meldet Lighthouse mobil "kein
   Inhalt gemalt" (NO_FCP), und dort springt es ohnehin kaum (0,06). */
@media (min-width: 600px) {
  .shell[data-auth="pending"] .nav, .shell[data-auth="pending"] .topbar { display: none; }
  .shell[data-auth="pending"] .main { padding-top: 0; padding-bottom: 0; }
}

/* Unten auf schmalen Geräten, links ab Tablet quer. */
.nav {
  position: fixed; inset: auto 0 0 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; height: var(--nav-h); }
.nav li { flex: 1; min-width: 0; }
.nav a {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; font-size: .7rem; color: var(--ink-2); font-weight: 600;
}
.nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* Unten ist wenig Platz: kurze Beschriftung, in der Seitenleiste die lange. */
.nav .l-long { display: none; }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] .ico { stroke: var(--ink); stroke-width: 2.2; }
@media (max-width: 599px) {
  .nav .ico { box-sizing: content-box; padding: 3px 14px; border-radius: 99px; transition: background .15s; }
  .nav a[aria-current="page"] .ico { background: var(--surface-2); }
}
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
/* Tablet hochkant: schmale Leiste links (Symbol über Beschriftung) - unten
   wäre auf 800 px Breite viel Weg für den Daumen und wenig Platz für Inhalt. */
@media (min-width: 600px) and (max-width: 899px) {
  .shell { grid-template-columns: 88px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .nav { position: sticky; top: 64px; inset: auto; align-self: start; height: calc(100dvh - 64px); border-top: 0; border-right: 1px solid var(--line); padding: 8px 6px; }
  .nav ul { flex-direction: column; height: auto; gap: 4px; }
  .nav a { padding: 8px 2px; border-radius: 12px; font-size: .72rem; }
  .nav .ico { box-sizing: content-box; padding: 4px 16px; border-radius: 99px; }
  .nav a[aria-current="page"] .ico { background: var(--surface-2); }
  .main { padding: 8px 28px 40px; }
  .shell[data-auth="out"], .shell[data-auth="pending"] { grid-template-columns: 1fr; }
  .toasts { bottom: 24px; }
  .sticky-actions { bottom: 16px; }
}
@media (min-width: 900px) {
  .shell { grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .nav { position: sticky; top: 64px; inset: auto; align-self: start; background: none; border: 0; padding: 12px; }
  .nav ul { flex-direction: column; height: auto; gap: 2px; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; font-size: .95rem; border-radius: 10px; }
  .nav a:hover { background: var(--surface-2); }
  .nav a[aria-current="page"] { background: var(--surface); box-shadow: var(--shadow); }
  .nav .l-long { display: inline; }
  .nav .l-short { display: none; }
  .main { padding: 8px 32px 48px; }
  .shell[data-auth="out"], .shell[data-auth="pending"] { grid-template-columns: 1fr; }
}

/* --- Bausteine -------------------------------------------------------------------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 12px 0 20px; }
.page-head h1 { margin-bottom: .1em; }
.page-head p { margin: 0; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; border: 1px solid var(--line); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + section { margin-top: 16px; }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.wrap { align-items: flex-end; }
.row.tight { gap: 2px; flex-wrap: nowrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.link { font-size: .9rem; color: var(--ink-2); }
.notice { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; }
.empty { text-align: center; padding: 32px 16px; color: var(--ink-2); }
.empty.card { color: inherit; }
.loading { padding: 48px; text-align: center; color: var(--ink-2); }

.btn {
  --b: var(--surface-2); --c: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 11px; border: 1px solid transparent; background: var(--b); color: var(--c); font: inherit; font-weight: 650;
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(.96); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { --b: var(--brand); --c: var(--brand-ink); }
.btn.danger { --b: var(--danger); --c: #fff; }
.btn.ghost { --b: transparent; border-color: var(--line); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn.icon { min-height: 36px; width: 36px; padding: 0; border: 0; }
.danger-text { color: var(--danger) !important; }

label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; min-width: 0;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); }
.code-input { font-size: 1.6rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.search { background: var(--surface); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; letter-spacing: .02em; vertical-align: middle; }
.tag-strength { background: var(--strength-soft); color: var(--strength-ink); }
.tag-stretch { background: var(--stretch-soft); color: var(--stretch-ink); }
.tag-mobility { background: var(--mobility-soft); color: var(--mobility-ink); }
.tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.scope, .pill { font-size: .75rem; color: var(--ink-2); background: var(--surface-2); padding: 2px 8px; border-radius: 99px; display: inline-flex; gap: 4px; align-items: center; margin: 2px 4px 2px 0; }
.pill-x { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 2px; font-size: .8rem; }
.badge { font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); }
.badge.live { background: var(--strength); color: #fff; }
.badge.pending { background: var(--mobility-soft); color: var(--mobility-ink); }
.sync { font: inherit; font-size: .8rem; font-weight: 700; border: 0; border-radius: 99px; padding: 6px 12px; cursor: pointer; background: var(--mobility-soft); color: var(--mobility-ink); }
.sync[data-state="offline"] { background: var(--surface-2); color: var(--ink); }
.sync[data-state="offline"]::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-2); margin-right: 6px; vertical-align: 1px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: .9rem; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 6px 14px; border-radius: 99px; cursor: pointer; min-height: 36px; }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip-strength[aria-pressed="true"] { background: var(--strength); border-color: var(--strength); color: #fff; }
.chip-stretch[aria-pressed="true"] { background: var(--stretch); border-color: var(--stretch); color: #fff; }
.chip-mobility[aria-pressed="true"] { background: var(--mobility); border-color: var(--mobility); color: #fff; }
/* Tags: kleiner als die Art-Filter, damit die zwei Reihen unterscheidbar bleiben. */
.chip.small { font-size: .82rem; padding: 4px 11px; min-height: 32px; font-weight: 550; }
a.chip { text-decoration: none; display: inline-flex; align-items: center; }
.tag-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pick legend { width: 100%; margin-bottom: 4px; }
.tag-pick label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px 4px 8px; cursor: pointer; }
.tag-pick label:has(input:checked) { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 2px; text-decoration: none; width: 100%; background: none; border: 0; font: inherit; color: inherit; text-align: left; }
a.list-row:hover, button.list-row:hover { background: color-mix(in srgb, var(--surface-2) 50%, transparent); border-radius: 8px; }
.list-row .grow, a.grow { display: grid; gap: 2px; text-decoration: none; }
.list-row .muted { font-size: .88rem; }
.list.compact .list-row { padding: 8px 2px; }
.month { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin: 18px 0 4px; }
.month:first-child { margin-top: 0; }
.date-chip { display: grid; place-items: center; width: 44px; height: 48px; border-radius: 10px; background: var(--surface-2); font-size: .7rem; color: var(--ink-2); line-height: 1.1; flex: none; }
.date-chip b { font-size: 1.15rem; color: var(--ink); }
.stat { display: grid; text-align: right; font-size: .82rem; color: var(--ink-2); }
.stat b { font-size: 1.1rem; color: var(--ink); }
.stat.good b { color: var(--ok); }
.stat.idle b { color: var(--ink-2); }
.thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-2); }
.thumb-strength { background: var(--strength-soft); }
.thumb-stretch { background: var(--stretch-soft); }
.thumb-mobility { background: var(--mobility-soft); }

/* --- Anmeldung ----------------------------------------------------------------------------- */
/* Illustration (scripts/generate-login-art.py): am Desktop die linke Hälfte,
   am Handy ein Kopfbanner. --login-art-bg ist die Papierfarbe oben im Bild -
   so gehen Ränder und Ausblendung nahtlos ins Bild über. */
:root { --login-art: url("../img/login-light.webp"); --login-art-bg: #f8eeda; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --login-art: url("../img/login-dark.webp"); --login-art-bg: #232226; } }
:root[data-theme="dark"] { --login-art: url("../img/login-dark.webp"); --login-art-bg: #232226; }

.view.bleed { max-width: none; margin: 0 -16px; }
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
.login > * { min-width: 0; }
/* Oben deckend in der Papierfarbe, nach unten frei - darauf steht der Titel. */
.login-art {
  background:
    linear-gradient(to bottom, var(--login-art-bg) 0%, var(--login-art-bg) 18%, color-mix(in srgb, var(--login-art-bg) 0%, transparent) 46%),
    var(--login-art-bg) var(--login-art) center bottom / 100% auto no-repeat;
  /* Am Handy: Text oben, das Bild (4:5) darunter - die Bögen beginnen unter der Unterzeile. */
  min-height: calc(220px + 100vw * 1.1);
  padding: calc(env(safe-area-inset-top) + 24px) 20px 0;
  display: flex; align-items: flex-start;
}
.login-hero h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); margin: 12px 0 6px; }
.login-hero .lead { max-width: 30ch; color: var(--ink-2); margin-bottom: 0; }
.login-hero img { border-radius: 14px; }
.kinds { list-style: none; padding: 0; display: flex; gap: 8px; margin: 14px 0 0; }
.kinds .tag { font-size: .85rem; padding: 4px 12px; }
/* Die Karte schiebt sich am Handy über den unteren Bildrand. */
.login-side { padding: 0 16px 32px; margin-top: -56px; display: grid; gap: 16px; align-content: start; position: relative; }
.login-card { padding: 24px; margin: 0; width: 100%; max-width: 440px; justify-self: center; box-shadow: 0 10px 40px rgb(30 25 10 / 14%); }
.login-card .btn { white-space: normal; text-align: center; }
.login-install { margin: 0; width: 100%; max-width: 440px; justify-self: center; }
@media (min-width: 600px) and (max-width: 999px) {
  .login-art { min-height: 64dvh; padding: 48px 48px 0; background-size: auto, cover; background-position: 0 0, center 78%; }
  .login-side { margin-top: -72px; padding: 0 32px 40px; }
}
@media (min-width: 1000px) {
  .login { grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr); grid-template-rows: none; }
  .login-art {
    min-height: 100dvh; padding: 56px 56px 0;
    background:
      linear-gradient(to bottom, var(--login-art-bg) 0%, var(--login-art-bg) 22%, color-mix(in srgb, var(--login-art-bg) 0%, transparent) 50%),
      var(--login-art-bg) var(--login-art) center bottom / cover no-repeat;
  }
  .login-side { margin: 0; padding: 48px; align-content: center; justify-items: center; }
}
@media (min-width: 600px) and (max-width: 899px) { .view.bleed { margin: 0 -28px; } }
@media (min-width: 900px) { .view.bleed { margin: 0 -32px; } }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: .85rem; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* --- Übersicht --------------------------------------------------------------------------- */
.resume { display: flex; align-items: center; gap: 14px; text-decoration: none; border-color: var(--strength); }
.resume div { display: grid; flex: 1; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--strength); flex: none; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px transparent; } 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--strength) 50%, transparent); } }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .bar { fill: var(--surface-2); }
.chart .bar.now { fill: var(--brand); }
.chart .bar-label { font-size: 9px; fill: var(--ink-2); font-weight: 600; }
.chart .axis { font-size: 9px; fill: var(--ink-2); }
.chart .line-path { stroke: var(--strength); stroke-width: 2.5; stroke-linejoin: round; }
.chart .dot-pt { fill: var(--surface); stroke: var(--strength); stroke-width: 2; }
.kind-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin: 16px 0 10px; gap: 2px; }
.seg { flex: 0 1 0; min-width: 0; }
.seg-strength { background: var(--strength); }
.seg-stretch { background: var(--stretch); }
.seg-mobility { background: var(--mobility); }
.legend { list-style: none; padding: 0; margin: 0; display: flex; gap: 16px; flex-wrap: wrap; font-size: .9rem; }
.legend li { display: flex; gap: 6px; align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-strength { background: var(--strength); }
.dot-stretch { background: var(--stretch); }
.dot-mobility { background: var(--mobility); }

/* --- Bibliothek ----------------------------------------------------------------------------- */
.filters { display: grid; gap: 12px; margin-bottom: 18px; }
/* Am Handy zwei Spalten - eine Spalte großer Karten hieß endloses Scrollen. */
.ex-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
@media (min-width: 700px) { .ex-grid { gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }
.ex-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; display: grid; box-shadow: var(--shadow); transition: transform .12s; }
.ex-card:hover { transform: translateY(-2px); }
.ex-card img, .ex-ph { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; background: #f4f1ea; }
.ex-ph { display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; }
.ex-ph-strength { background: var(--strength-soft); color: var(--strength-ink); }
.ex-ph-stretch { background: var(--stretch-soft); color: var(--stretch-ink); }
.ex-ph-mobility { background: var(--mobility-soft); color: var(--mobility-ink); }
.ex-body { padding: 10px 12px 12px; display: grid; gap: 4px; align-content: start; }
.ex-body strong { line-height: 1.25; }
.ex-body .muted { font-size: .85rem; }
.hero-img { width: 100%; border-radius: var(--radius); aspect-ratio: 4 / 3; object-fit: cover; background: #f4f1ea; }
.prose h3 { margin-top: 1em; }
.facts { display: grid; gap: 8px; margin: 16px 0; }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.facts dt { color: var(--ink-2); font-size: .9rem; }
.facts dd { margin: 0; }
.seg-control { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.seg-control legend { grid-column: 1 / -1; }
.seg-control label { position: relative; }
.seg-control input { position: absolute; opacity: 0; }
.seg-control span { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; cursor: pointer; text-align: center; }
.seg-control input:checked + span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.seg-control input:focus-visible + span { outline: 3px solid var(--focus); }

/* --- Pläne ----------------------------------------------------------------------------------- */
.plan-items, .edit-items, .blocks { list-style: none; padding: 0; margin: 0 0 16px; }
.plan-item { display: flex; gap: 14px; align-items: center; }
.plan-item .num { font-weight: 800; color: var(--ink-2); width: 1.5em; text-align: center; flex: none; }
.plan-item a { text-decoration: none; }
.target { margin: 4px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.edit-item { display: grid; gap: 12px; }
.edit-item > .row.between { flex-wrap: nowrap; align-items: flex-start; }
.sticky-actions { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); background: var(--surface); padding: 10px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); z-index: 5; }
@media (min-width: 900px) { .sticky-actions { bottom: 16px; } }
.people { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.people li { background: var(--surface-2); padding: 4px 10px; border-radius: 99px; font-size: .9rem; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; max-height: 50vh; overflow: auto; }
.check { display: flex; gap: 12px; align-items: center; font-weight: 500; padding: 8px; border-radius: 8px; cursor: pointer; }
.check:hover { background: var(--surface-2); }
.check span { display: grid; }

/* --- Einheit ----------------------------------------------------------------------------------- */
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: -8px 0 18px; }
.progress span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .3s; }
.wblock { display: grid; gap: 12px; }
.wblock.complete { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.block-head { display: flex; gap: 12px; align-items: flex-start; }
.block-head a { text-decoration: none; }
.block-head .thumb { width: 72px; height: 54px; }
.check-mark { width: 32px; height: 32px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.cues summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.cues p { margin: 6px 0 0; }
.sets { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.sets li { display: flex; align-items: center; gap: 10px; background: var(--bg); padding: 6px 6px 6px 8px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.set-no { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: .8rem; font-weight: 700; flex: none; }
.now-img { width: 100%; max-width: 420px; justify-self: center; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: #f4f1ea; }
.log { display: grid; gap: 10px; border-top: 1px dashed var(--line); padding-top: 12px; }
@media (min-width: 900px) {
  .wblock .log { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; column-gap: 20px; }
  .wblock .log > .row { grid-column: 1 / -1; }
}
.log-fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
.log-fields input { font-size: 1.2rem; font-variant-numeric: tabular-nums; text-align: center; }
.rom { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rom legend { width: 100%; }
.rom label { position: relative; }
.rom input { position: absolute; opacity: 0; }
.rom span { display: grid; place-items: center; min-width: 44px; height: 40px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; font-weight: 700; padding: 0 6px; }
.rom input:checked + span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.rom input:focus-visible + span { outline: 3px solid var(--focus); }
.feel span { font-size: 1.4rem; min-width: 52px; height: 48px; }
.comments { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 12px; }
.comments li { border-left: 3px solid var(--line); padding-left: 12px; }
.comments p { margin: 0; }

/* Infoblatt einer Übung */
.ex-sheet { gap: 12px; }
.ex-sheet h2 { margin: 4px 0 2px; font-size: 1.4rem; }
.ex-sheet h3 { margin: 0 0 4px; font-size: .95rem; }
.ex-sheet .facts { margin: 0; }
.sheet-img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: #f4f1ea; }
.sheet-actions { position: sticky; bottom: -20px; background: var(--surface); padding: 12px 0 4px; margin-top: 4px; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.thumb-btn, .link-btn { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.link-btn:hover strong { text-decoration: underline; }

/* --- Dialoge --------------------------------------------------------------------------------- */
dialog.sheet {
  overflow-y: auto; overscroll-behavior: contain;
  border: 0; padding: 0; background: var(--surface); color: var(--ink); border-radius: 18px; width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 48px); box-shadow: 0 20px 60px rgb(0 0 0 / 25%);
}
dialog.sheet::backdrop { background: rgb(10 10 15 / 45%); backdrop-filter: blur(2px); }
@media (max-width: 600px) {
  dialog.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
.sheet-body { padding: 20px; display: grid; gap: 14px; }
.picker { max-height: calc(100dvh - 60px); grid-template-rows: auto auto auto 1fr; }
.pick-list { overflow: auto; max-height: 55dvh; }
.timer { text-align: center; justify-items: center; }
.ring { position: relative; width: min(240px, 60vw); aspect-ratio: 1; }
/* Mit Bild wird der Ring kleiner, damit alles ohne Scrollen aufs Handy passt. */
.ring.small { width: min(170px, 42vw, 24vh); }
.timer-img { width: min(320px, 100%); max-height: 30vh; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 12px; background: #f4f1ea; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg { stroke: var(--stretch); stroke-linecap: round; transition: stroke-dasharray 1s linear; }
.timer .t-label { font-size: 1.4rem; font-weight: 800; margin: 0; }
.timer[data-phase="hold"] .ring-fg { stroke: var(--stretch); }
.timer[data-phase="switch"] .ring-fg, .timer[data-phase="prep"] .ring-fg { stroke: var(--mobility); }
.timer[data-phase="rest"] .ring-fg { stroke: var(--ink-2); }
.timer[data-phase="switch"] .t-label { color: var(--mobility); }
.ring .time { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* --- Verwaltung ----------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table select { min-height: 36px; padding: 6px 8px; width: auto; font-size: .9rem; }
@media (max-width: 640px) {
  .table-wrap { margin: 0; padding: 0; overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; display: grid; gap: 6px; }
  .table td { border: 0; padding: 0; }
  .table td[data-label] { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
  .table td[data-label]::before { content: attr(data-label); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 650; }
  .table .td-actions { display: flex; justify-content: flex-end; }
}
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; }
.kpi b { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--ink-2); font-size: .85rem; }
.log-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: .92rem; }
.switch { display: flex; align-items: center; gap: 8px; font-weight: 500; }

.install ol { margin: 8px 0; padding-left: 1.3em; display: grid; gap: 4px; }
.install p { margin-bottom: 8px; }
.ico.inline { width: 1.1em; height: 1.1em; vertical-align: -3px; }
.login-install { grid-column: 1 / -1; }
.install-card { display: grid; gap: 8px; justify-items: start; }

.request { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; border-color: var(--mobility); }
.request p { margin: 4px 0 0; }
.pill.pending { background: var(--mobility-soft); color: var(--mobility-ink); }
.list-row small { display: block; }

/* --- Trainingsbuddy ---------------------------------------------------------------------------- */
.buddies { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); margin-top: 8px; }
.buddy { font: inherit; color: inherit; display: grid; gap: 4px; justify-items: center; text-align: center; padding: 8px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--bg); cursor: pointer; }
.buddy img, .buddy-ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #f4f1ea; }
.buddy-ph { display: grid; place-items: center; font-size: 2rem; font-weight: 800; color: var(--ink-2); }
.buddy[aria-checked="true"] { border-color: var(--brand); background: var(--surface); }
.buddy.none { align-content: center; min-height: 100px; }
.buddy-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; object-position: 50% 30%; background: #f4f1ea; }
.buddy-card[data-open="false"] .buddy-pick { display: none; }
.buddy-card[data-open="true"] .buddy-pick { display: block; margin-top: 12px; }

/* --- Bilder ----------------------------------------------------------------------------------- */
.chars { display: grid; gap: 16px; margin-bottom: 20px; }
.char { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
@media (min-width: 760px) { .char { grid-template-columns: 300px 1fr; } }
.char-previews { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start; }
.char-previews img, .cand img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #f4f1ea; }
.char-empty, .cand-ph { grid-column: 1 / -1; aspect-ratio: 4 / 3; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); font-size: .85rem; text-align: center; padding: 8px; }
.cand-ph.failed { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.char-busy { position: absolute; inset: auto 6px 6px; background: var(--brand); color: var(--brand-ink); font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; text-align: center; animation: pulse-o 1.4s infinite; }
@keyframes pulse-o { 50% { opacity: .6; } }
.buddy-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); margin-bottom: 16px; }
.buddy-tile { display: grid; padding: 0; overflow: hidden; text-decoration: none; margin: 0; transition: transform .12s; }
.buddy-tile:hover { transform: translateY(-2px); }
.buddy-tile img, .buddy-tile .char-empty { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #f4f1ea; border-radius: 0; }
.buddy-tile-body { display: grid; gap: 6px; padding: 12px 14px 14px; }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: var(--ok); }
.switch.big { font-size: 1rem; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.coverage { display: grid; gap: 4px; }
.coverage-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.coverage-bar span { display: block; height: 100%; width: 0; background: var(--ok); }
.char-error { grid-column: 1 / -1; margin: 0; font-size: .82rem; color: var(--danger); }
.prompt summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.prompt > .stack { margin-top: 10px; }
.prompt textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.prompt-out { white-space: pre-wrap; background: var(--surface-2); padding: 10px 12px; border-radius: 8px; font-size: .82rem; margin: 0; }
.new-char { border-top: 1px dashed var(--line); padding-top: 16px; }
.candidates { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); margin-top: 16px; }
.cand { margin: 0; display: grid; gap: 6px; }
.cand.current img { outline: 3px solid var(--ok); outline-offset: 2px; }
.cand figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ex-grid.small { grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); }
@media (min-width: 700px) { .ex-grid.small { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } }
code { font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* --- Hinweise ------------------------------------------------------------------------------------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); z-index: 100; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--brand); color: var(--brand-ink); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; transition: opacity .4s, transform .4s; }
.toast-error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
@media (min-width: 600px) { .toasts { bottom: 24px; } }
@media (max-width: 480px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Website, Impressum, Datenschutz - auf der Anmeldeseite und im Profil. */
.about-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 14px 0 0; font-size: .9rem; }
.about-links a { color: var(--ink-2); }
.login-side > .about-links { justify-content: center; }
/* Eigenständige 404-Seite (src/404.html), ohne App-Hülle. */
.notfound { max-width: 520px; margin: 12vh auto; padding: 0 16px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.notfound h1 { margin: 0; }
