/* Wettkampf-Tagebuch – hell, sportlich, für das Smartphone */
@font-face { font-family: 'Inter'; src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('../fonts/barlow-condensed-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('../fonts/barlow-condensed-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --grund: #F4F5F2;
  --karte: #FFFFFF;
  --tinte: #15171A;
  --text: #2B2F33;
  --leise: #5B6168;
  --linie: #E2E4DF;
  --linie-zart: #EEF0EC;
  --fuellung: #EEF0EC;
  --akzent: #C2410C;
  --akzent-dunkel: #9A3412;
  --akzent-hell: #FFEDD5;
  --hell-auf-dunkel: #C9CDD2;
  --orange-auf-dunkel: #FDBA74;
  --blau-hell: #DBEAFE;
  --blau-dunkel: #1E3A8A;
  --gelb-hell: #FEF3C7;
  --gelb-dunkel: #78350F;
  --gruen-hell: #DCFCE7;
  --gruen-dunkel: #14532D;
  --rot: #B91C1C;
  --rot-hell: #FEE2E2;
  --zahl: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --schrift: 'Inter', system-ui, -apple-system, sans-serif;
  --tabs: calc(64px + env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--tinte);
  font-family: var(--schrift); font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.sheet-offen { overflow: hidden; }
a { color: var(--akzent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

.ansicht {
  max-width: 560px; margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(var(--tabs) + 24px);
  display: flex; flex-direction: column; gap: 12px;
}
.ansicht.ohne-tabs { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }

/* ---------- Kopf ---------- */
.kopf { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 12px 4px 2px; }
.kopf-titel { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ueber { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--leise); }
.kopf h1 { font-family: var(--zahl); font-size: 40px; font-weight: 700; line-height: 1; }
.rund-knopf {
  width: 44px; height: 44px; border-radius: 22px; border: none; background: var(--tinte); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.leiste { display: flex; justify-content: space-between; align-items: center; min-height: 48px; gap: 8px; }
.zurueck { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; font-size: 15px; font-weight: 600; }

/* ---------- Chips und Segmente ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid #D6D9D3; background: var(--karte);
  font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; flex-shrink: 0;
}
.chip[aria-pressed="true"] { background: var(--akzent); border-color: var(--akzent); color: #fff; }

.segmente { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; background: #E6E8E3; border-radius: 12px; padding: 4px; }
.segmente button { height: 36px; border: none; border-radius: 9px; background: transparent; font-size: 13px; font-weight: 600; color: var(--text); }
.segmente button[aria-pressed="true"] { background: var(--karte); color: var(--tinte); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.mini-schalter { display: flex; gap: 4px; }
.mini-schalter button { height: 32px; padding: 0 10px; border-radius: 16px; border: 1px solid #D6D9D3; background: var(--karte); font-size: 12px; font-weight: 600; color: var(--text); }
.mini-schalter button[aria-pressed="true"] { background: var(--tinte); border-color: var(--tinte); color: #fff; }

/* ---------- Karten ---------- */
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.karte.betont { border: 2px solid var(--tinte); }
.karte.dunkel { background: var(--tinte); border-color: var(--tinte); color: #fff; border-radius: 22px; padding: 20px; }
.karte h2 { font-size: 15px; font-weight: 700; }
.karte-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.leise { color: var(--leise); }
.klein { font-size: 12px; }
.notiz { font-size: 13px; line-height: 1.45; color: var(--text); }
.leer { text-align: center; color: var(--leise); padding: 48px 16px; }

.jahr-kopf { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 4px 0; }
.jahr-kopf span:first-child { font-family: var(--zahl); font-size: 22px; font-weight: 700; }
.jahr-kopf span:last-child { font-size: 13px; color: var(--leise); }

/* ---------- Laufkarte in der Liste ---------- */
.lauf-karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; color: var(--tinte); }
.lauf-karte:active { background: #FAFAF8; }
.lauf-oben { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.lauf-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.lauf-name strong { font-size: 15px; font-weight: 600; }
.lauf-name span { font-size: 13px; color: var(--leise); }
.distanz { flex-shrink: 0; font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 6px; background: var(--tinte); color: #fff; }
.lauf-mitte { display: flex; align-items: center; gap: 10px; }
.lauf-zeit { display: flex; align-items: baseline; gap: 10px; flex: 1; min-width: 0; }
.zeit-gross { font-family: var(--zahl); font-size: 32px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.wert-box { flex-shrink: 0; width: 64px; height: 48px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.wert-box b { font-family: var(--zahl); font-size: 24px; font-weight: 700; line-height: 1; }
.wert-box small { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.wert-box.stark { background: var(--tinte); color: #fff; }
.wert-box.gut { background: #E6E8E3; color: var(--tinte); }
.wert-box.schwach { background: var(--karte); color: var(--leise); border: 1.5px dashed #9AA0A6; }
.marken { display: flex; gap: 6px; flex-wrap: wrap; }
.marke { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px; background: var(--fuellung); color: var(--text); }
.marke.bestzeit { background: var(--akzent-hell); color: var(--akzent-dunkel); font-weight: 700; }
.marke.podium { background: var(--blau-hell); color: var(--blau-dunkel); font-weight: 700; }
.marke.klein-feld { background: var(--gelb-hell); color: var(--gelb-dunkel); font-weight: 700; }

/* ---------- Detail ---------- */
.held-oben { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.held h1 { font-size: 20px; font-weight: 700; }
.held .unter { font-size: 13px; color: var(--hell-auf-dunkel); }
.held .distanz { background: #fff; color: var(--tinte); }
.zeit-riesig { font-family: var(--zahl); font-size: 72px; font-weight: 700; line-height: .95; font-variant-numeric: tabular-nums; }
.held-marke { align-self: flex-start; font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 999px; background: var(--orange-auf-dunkel); color: #431407; }

.balken { height: 8px; border-radius: 4px; background: var(--linie-zart); overflow: hidden; flex: 1 1 auto; min-width: 0; min-height: 8px; }
.balken > div { height: 100%; border-radius: 4px; background: var(--akzent); }
.platz-zeile { display: flex; flex-direction: column; gap: 6px; }
.platz-zeile .oben { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.platz-zeile .oben strong { font-family: var(--zahl); font-size: 22px; }
.platz-zeile .unten { display: flex; align-items: center; gap: 10px; }
.platz-zeile .unten span { width: 64px; text-align: right; font-size: 13px; font-weight: 700; }

.rennwert-kopf { display: flex; align-items: center; gap: 14px; }
.rennwert-zahl { width: 76px; height: 76px; border-radius: 16px; background: var(--tinte); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.rennwert-zahl b { font-family: var(--zahl); font-size: 40px; font-weight: 700; line-height: .9; }
.rennwert-zahl small { font-size: 11px; color: var(--hell-auf-dunkel); }
.rennwert-zahl.gut { background: #E6E8E3; color: var(--tinte); }
.rennwert-zahl.gut small { color: var(--leise); }
.rennwert-zahl.schwach { background: var(--karte); color: var(--leise); border: 2px dashed #9AA0A6; }
.rennwert-zahl.schwach small { color: var(--leise); }
.faktor { display: flex; flex-direction: column; gap: 5px; }
.faktor .oben { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.faktor .oben span { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.trenner { border-top: 1px solid var(--linie-zart); padding-top: 14px; }
.feldbild { height: 72px; display: flex; align-items: flex-end; gap: 3px; }
.feldbild div { flex: 1; border-radius: 3px 3px 0 0; background: #D6D9D3; min-height: 3px; }
.feldbild div.eigen { background: var(--akzent); }
.achse { display: flex; justify-content: space-between; font-size: 11px; color: var(--leise); }

.kacheln { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kacheln.zwei { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kachel { background: var(--grund); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kachel span { font-size: 12px; color: var(--leise); }
.kachel b { font-size: 17px; font-weight: 700; }
.kachel b.zahl { font-family: var(--zahl); font-size: 24px; }

.wava-kreis { width: 84px; height: 84px; border-radius: 42px; border: 6px solid var(--akzent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wava-kreis b { font-family: var(--zahl); font-size: 24px; font-weight: 700; }
.reihe { display: flex; flex-direction: row; align-items: center; gap: 16px; }
.spalte { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.jahr-zeile { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--linie-zart); color: var(--tinte); }
.jahr-zeile .jahr { font-family: var(--zahl); font-size: 20px; font-weight: 700; }
.diff { font-size: 13px; font-weight: 700; padding: 4px 8px; border-radius: 6px; background: var(--fuellung); color: var(--text); white-space: nowrap; }
.diff.besser { background: var(--gruen-hell); color: var(--gruen-dunkel); }
.diff.schlechter { background: var(--rot-hell); color: var(--rot); }

/* ---------- Bestzeiten und Entwicklung ---------- */
.raster-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pb-karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px; color: var(--tinte); min-width: 0; }
.pb-karte .distanz { align-self: flex-start; padding: 3px 8px; }
.pb-karte .zeit { font-family: var(--zahl); font-size: 34px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.pb-karte .fuss { border-top: 1px solid var(--linie-zart); padding-top: 6px; display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--text); }
.stat { background: var(--karte); border: 1px solid var(--linie); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat b { font-family: var(--zahl); font-size: 28px; font-weight: 700; color: var(--akzent); line-height: 1.1; }
.stat span { font-size: 12px; color: var(--leise); line-height: 1.3; }
.gross-zahl { font-family: var(--zahl); font-size: 64px; font-weight: 700; line-height: .9; color: var(--orange-auf-dunkel); }
.diagramm { width: 100%; height: auto; display: block; touch-action: pan-y; }
.diagramm text { font-family: var(--schrift); font-size: 11px; fill: var(--leise); }
.diagramm .punkt { cursor: pointer; }

/* ---------- Formulare ---------- */
.formular { display: flex; flex-direction: column; gap: 12px; }
.feld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.feld-label { font-size: 13px; font-weight: 600; color: var(--text); }
.feld-hilfe { font-size: 12px; color: var(--leise); }
.eingabe {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid #D6D9D3;
  background: var(--karte); font-size: 16px; color: var(--tinte); -webkit-appearance: none; appearance: none;
}
textarea.eingabe { min-height: 110px; resize: vertical; font-variant-numeric: tabular-nums; }
select.eingabe { background-image: linear-gradient(45deg, transparent 50%, var(--leise) 50%), linear-gradient(135deg, var(--leise) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.eingabe[aria-invalid="true"] { border-color: var(--rot); }
.feld-reihe { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.feld-reihe.drei { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fehler { color: var(--rot); font-size: 13px; font-weight: 600; }
details.aufklapp summary { cursor: pointer; font-size: 15px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
details.aufklapp summary::-webkit-details-marker { display: none; }
details.aufklapp summary::after { content: '+'; font-size: 20px; color: var(--leise); }
details.aufklapp[open] summary::after { content: '−'; }
details.aufklapp > div { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

.knopf {
  min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid #D6D9D3; background: var(--karte);
  font-size: 15px; font-weight: 600; color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.knopf.akzent { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.dunkel { background: var(--tinte); border-color: var(--tinte); color: #fff; }
.knopf.breit { width: 100%; }
.knopf.klein { min-height: 36px; font-size: 13px; padding: 0 12px; }
.knopf.gefahr { color: var(--rot); }
.knopf:disabled { opacity: .55; }
.knopf-reihe { display: flex; gap: 8px; flex-wrap: wrap; }
.text-link { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-size: 14px; font-weight: 600; background: none; border: none; padding: 0; color: var(--akzent); }

.zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--linie-zart); min-height: 52px; }
.zeile:first-child { border-top: none; }
.zeile-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.zeile-text strong { font-size: 15px; font-weight: 600; }
.zeile-text span { font-size: 13px; color: var(--leise); }
.adresse { display: block; word-break: break-all; background: var(--grund); border-radius: 10px; padding: 10px 12px; font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
.hinweis-box { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--gelb-hell); color: var(--gelb-dunkel); font-size: 13px; line-height: 1.45; }
.hinweis-box svg { flex-shrink: 0; margin-top: 1px; }
.hinweis-box.rot { background: var(--rot-hell); color: var(--rot); }
.hinweis-box a { color: inherit; font-weight: 700; text-decoration: underline; }
.status-punkt { width: 10px; height: 10px; border-radius: 5px; flex-shrink: 0; }
.status-punkt.gruen { background: #16A34A; }
.status-punkt.gelb { background: #CA8A04; }
.status-punkt.rot { background: var(--rot); }
.stand { text-align: center; font-size: 12px; color: var(--leise); padding: 8px 0; }

/* ---------- Tab-Leiste ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(255,255,255,.96);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--linie);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding-bottom: env(safe-area-inset-bottom); height: var(--tabs);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--leise); }
.tabs a.aktiv { color: var(--akzent); font-weight: 700; }

/* ---------- Blatt, Hinweise ---------- */
.sheet-hintergrund { position: fixed; inset: 0; background: rgba(21,23,26,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--grund); width: 100%; max-width: 560px; max-height: 92vh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.sheet-kopf { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 8px; }
.sheet-kopf h2 { font-size: 17px; font-weight: 700; }
.sheet-inhalt { overflow-y: auto; padding: 4px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.icon-knopf { width: 44px; height: 44px; border: none; background: transparent; display: inline-flex; align-items: center; justify-content: center; border-radius: 22px; color: var(--text); }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs) + 12px); z-index: 50;
  background: var(--tinte); color: #fff; padding: 10px 14px; border-radius: 14px; display: flex; gap: 14px; align-items: center;
  font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px);
}
.toast button { background: none; border: none; color: var(--orange-auf-dunkel); font-weight: 700; padding: 6px 0; }
.update-hinweis { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 50; background: var(--tinte); color: #fff; border-radius: 14px; padding: 8px 8px 8px 14px; display: flex; gap: 10px; align-items: center; font-size: 14px; }
.update-hinweis button { background: var(--akzent); color: #fff; border: none; border-radius: 10px; padding: 8px 12px; font-weight: 700; }

/* ---------- Anmeldung ---------- */
.login { max-width: 400px; margin: 0 auto; padding: calc(64px + env(safe-area-inset-top)) 24px 32px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login h1 { font-family: var(--zahl); font-size: 40px; font-weight: 700; }
.login form { display: flex; flex-direction: column; gap: 12px; text-align: left; margin-top: 8px; }
.login-logo { align-self: center; border-radius: 16px; }

@media (min-width: 600px) {
  .tabs { left: 50%; transform: translateX(-50%); max-width: 560px; border: 1px solid var(--linie); border-bottom: none; border-radius: 18px 18px 0 0; }
}
