@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f5f1;
  --text: #1e2b2f;
  --muted: #56666b;
  --card: #ffffff;
  --accent: #2d7a74;
  --accent-text: #ffffff;
  --accent-soft: #dcece9;
  --line: #e2e6e4;
  --radius: 24px;
  --gutter: 18px;
  --rot: #a13c2f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14201f;
    --text: #eef3f1;
    --muted: #a9bab6;
    --card: #1d2d2b;
    --accent: #6fc2b9;
    --accent-text: #10201e;
    --accent-soft: #24403c;
    --line: #2c3f3c;
    --rot: #f0a193;
  }
}

:root[data-theme="dark"] {
  --bg: #14201f;
  --text: #eef3f1;
  --muted: #a9bab6;
  --card: #1d2d2b;
  --accent: #6fc2b9;
  --accent-text: #10201e;
  --accent-soft: #24403c;
  --line: #2c3f3c;
  --rot: #f0a193;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; font-weight: 800; }
h1 { font-size: clamp(2.3rem, 9vw, 4rem); }
h2 { font-size: clamp(1.5rem, 5vw, 2rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 12px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

.skip {
  position: absolute; left: -9999px; top: 8px;
  background: var(--card); color: var(--text); padding: 8px 12px; border-radius: 999px; z-index: 10;
}
.skip:focus { left: 8px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Kopf */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 60px; padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}
.brand { color: var(--text); text-decoration: none; font-weight: 800; }

/* Knöpfe als Pille, mindestens 44 px hoch */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 22px;
  border-radius: 999px; border: 2px solid var(--accent);
  background: var(--accent); color: var(--accent-text);
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-klein { min-height: 44px; padding: 8px 16px; font-size: 0.95rem; }
.btn-gross { width: 100%; font-size: 1.05rem; }
.btn-geist { background: transparent; color: var(--accent); margin-top: 8px; }
.btn-klein.btn-geist { margin-top: 0; }

/* Kopf mit Name und Abmelden */
.kopf-rechts { display: flex; align-items: center; gap: 10px; }
.kopf-name { font-weight: 800; color: var(--muted); font-size: 0.95rem; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Reiter für Neu dabei / Schon dabei */
.reiter { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg); padding: 4px; border-radius: 999px; margin-bottom: 18px; }
.reiter-knopf {
  min-height: 44px; border: 0; border-radius: 999px; background: transparent; color: var(--muted);
  font: inherit; font-weight: 800; cursor: pointer;
}
.reiter-knopf[aria-selected="true"] { background: var(--accent); color: var(--accent-text); }

/* Häkchen mit Text */
.haken { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; font-weight: 600; }
.haken input { width: 22px; height: 22px; min-height: 22px; margin: 2px 0 0; padding: 0; accent-color: var(--accent); }
.haken span { font-size: 0.95rem; color: var(--muted); }

/* Gesperrte Bereiche: Hinweis statt Inhalt */
.gesperrt-text p { color: var(--muted); margin: 0; }
.gesperrt .block-titel { color: var(--muted); }
.rang-zeile.du { border-color: var(--accent); }

/* App-Installation */
.schritte-app { display: grid; gap: 22px; }
.schritte-app h3 { margin-bottom: 4px; }
.schritte-app p { color: var(--muted); margin-bottom: 14px; }
@media (min-width: 768px) {
  .schritte-app { grid-template-columns: 1fr 1fr; }
}

/* Bühne: Scrollweg, in dem das Männchen trainiert */
.stage { position: relative; height: 260vh; }
.buehne {
  position: sticky; top: 0; height: 100vh; min-height: 560px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px var(--gutter); text-align: center;
}
.kicker { color: var(--accent); font-weight: 800; margin-bottom: 4px; }
.lead { color: var(--muted); max-width: 30ch; margin: 0 auto 12px; }
.figur-bereich { width: min(92vw, 520px); margin-top: 8px; }
.figur { width: 100%; display: block; }
.boden { stroke: var(--line); stroke-width: 3; }
.koerper { stroke: var(--text); stroke-width: 16; stroke-linecap: round; }
.glied { stroke: var(--text); stroke-width: 9; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.kopf { fill: var(--accent); }
.zaehler { font-size: 1.15rem; font-weight: 800; margin-top: 4px; }
.scroll-hinweis { color: var(--muted); font-size: 0.9rem; margin-top: 12px; }

/* Blöcke */
.block { padding: 32px var(--gutter) 8px; max-width: 760px; margin: 0 auto; }
.karte {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 16px;
  min-width: 0;
}
.karte-klein {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 14px 18px; margin-bottom: 12px;
}
.status { color: var(--muted); }
.entwurf { color: var(--muted); font-style: italic; font-size: 0.95rem; }
.hinweis { color: var(--muted); font-size: 0.9rem; margin: 8px 0 0; }
.optional { font-weight: 400; color: var(--muted); font-size: 0.8em; }

/* So geht's */
.schritte { display: grid; gap: 12px; }
.schritt {
  display: grid; grid-template-columns: 44px 1fr; gap: 4px 14px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.schritt h3 { grid-column: 2; margin: 0; }
.schritt p { grid-column: 2; margin: 0; color: var(--muted); }
.nummer {
  grid-row: span 2; width: 44px; height: 44px; border-radius: 999px;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800;
}

/* Rangliste */
.rang-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rang-zeile {
  display: grid; grid-template-columns: 30px 44px 1fr auto; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px 8px 10px;
}
.rang-platz { font-weight: 800; color: var(--muted); text-align: center; }
.platz-1 .rang-platz, .platz-2 .rang-platz, .platz-3 .rang-platz { color: var(--accent); }
.rang-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rang-zahlen { color: var(--muted); font-weight: 700; font-size: 0.95rem; white-space: nowrap; }

/* Profilbilder */
.avatar {
  display: inline-grid; place-items: center; border-radius: 999px;
  object-fit: cover; background: var(--accent-soft); flex: none;
}
.avatar-ohne { color: var(--accent); font-weight: 800; font-size: 0.95em; }
.profil-kopf { display: flex; justify-content: center; margin-bottom: 12px; }
.profil-kopf .avatar { width: 96px; height: 96px; }
.vorschau { display: block; width: 128px; height: 128px; border-radius: 999px; object-fit: cover; margin: 4px 0; }

/* Formulare */
.form { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.form > * { min-width: 0; }
label { display: grid; gap: 6px; font-weight: 700; min-width: 0; }
input[type=file] { max-width: 100%; }
input, select { width: 100%; min-width: 0; }
input, select {
  font: inherit; font-size: 16px; color: var(--text);
  min-height: 48px; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px;
}
input:focus, select:focus { border-color: var(--accent); outline: none; }
input[type=file] { padding: 10px; }
.hp { position: absolute; left: -9999px; }
.form-msg { min-height: 1.4em; margin: 0; font-weight: 700; }
.form-msg.fehler { color: var(--rot); }
.form-msg.ok { color: var(--accent); }
.cf-turnstile { min-height: 65px; }
@media (max-width: 340px) {
  .cf-turnstile { zoom: 0.85; }
}

/* Tag und Zähler */
.tag-wahl { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.tag-wahl legend { font-weight: 700; padding: 0; margin-bottom: 8px; }
.pille { display: inline-block; }
.pille input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pille span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 18px;
  border-radius: 999px; border: 2px solid var(--line); background: var(--bg); font-weight: 800; cursor: pointer;
}
.pille input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.pille input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 3px; }

.zaehl-wahl { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.zaehl-wahl input {
  width: 110px; min-height: 64px; text-align: center; font-size: 2rem; font-weight: 800;
  border-radius: 999px; font-variant-numeric: tabular-nums;
}
.rund {
  width: 52px; height: 52px; border-radius: 999px; border: 2px solid var(--accent);
  background: var(--card); color: var(--accent); font: inherit; font-weight: 800; font-size: 1rem; cursor: pointer;
}
.rund:active { background: var(--accent-soft); }

/* Code-Kasten */
.code-kasten { background: var(--accent-soft); border-radius: 20px; padding: 16px 18px; }
.code-kasten p { margin: 0 0 6px; }
.code-kasten .code {
  font-size: 1.6rem; font-weight: 800; letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums; color: var(--accent);
}

/* Statistik */
.fortschritt-text { font-weight: 800; margin-top: 4px; text-align: center; }
.fortschritt { height: 14px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; margin: 8px 0 20px; }
.fortschritt span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width 0.4s ease; }
.kennzahlen { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 20px; }
.kennzahlen div { background: var(--bg); border: 1px solid var(--line); border-radius: 20px; padding: 12px 14px; }
.kennzahlen dt { color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.kennzahlen dd { margin: 2px 0 0; font-size: 1.25rem; font-weight: 800; }
.verlauf {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px;
  align-items: end; height: 170px;
}
.verlauf li { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.verlauf-zahl { font-size: 0.75rem; font-weight: 800; }
.verlauf-bar { display: block; width: 100%; max-width: 22px; border-radius: 999px; background: var(--accent); margin: 4px 0; }
.verlauf-bar.leer { background: var(--line); }
.verlauf-tag { font-size: 0.7rem; color: var(--muted); }
.verlauf li:nth-child(even) .verlauf-tag { visibility: hidden; }
@media (min-width: 768px) {
  .verlauf li:nth-child(even) .verlauf-tag { visibility: visible; }
}

/* Telegram, Fragen, Fuß */
.telegram p { color: var(--muted); }
details summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; }
details p { margin-top: 8px; color: var(--muted); }
.foot {
  display: flex; gap: 20px; justify-content: center; flex-wrap: wrap;
  padding: 24px var(--gutter) 32px; border-top: 1px solid var(--line); margin-top: 32px;
}
.foot a { color: var(--muted); min-height: 44px; display: inline-flex; align-items: center; }
.noscript { margin: 24px var(--gutter); padding: 16px; background: var(--card); border-radius: var(--radius); }

/* Auf dem Tablet und größer */
@media (min-width: 768px) {
  .schritte { grid-template-columns: repeat(3, 1fr); }
  .kennzahlen { grid-template-columns: repeat(3, 1fr); }
  .buehne { min-height: 100vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
  .stage { height: auto; }
  .buehne { position: relative; height: auto; min-height: 0; padding-top: 40px; padding-bottom: 40px; }
  .scroll-hinweis { display: none; }
}
