/* Lauf-Statistik · Zielzeit-Look mit drei Farbdesigns (Einstellungen) */
:root {
  /* Grundwerte = Design «Himbeer & Mint». Weitere Designs unten (body.t-…). */
  --bg: #090c10; --card: #10151b; --tile: #04060a; --top: #04060a; --text: #e8edf2; --muted: #8796a3; --navtext: #b5c0cc; --navhi: #ffffff;
  --line: #1f2a34; --border2: #33414e; --btnbg: #172029; --input: #05070a; --mapfill: #0b1117; --track: #5b6675;
  --accent: #ff3d7f; --good: #5eead4; --bad: #ff5d5d; --link: #ff7aa6; --on-accent: #1a0410; --on-good: #04201b; --dotline: #000;
  --accent-soft: rgba(255, 61, 127, .08); --pattern: rgba(255, 61, 127, .05);
  --glow: 0 0 12px rgba(255, 61, 127, .45); --glow-g: 0 0 12px rgba(94, 234, 212, .45); --glow-map: drop-shadow(0 0 4px rgba(255, 61, 127, .35));
  --f-body: "Chakra Petch", system-ui, sans-serif; --f-num: "Share Tech Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
body.t-neon {
  --bg: #0d0716; --card: #170e24; --tile: #07030d; --top: #07030d; --text: #f1e9ff; --muted: #9d8fb5; --navtext: #c4b6dc; --navhi: #ffffff;
  --line: #2b1f3d; --border2: #44345c; --btnbg: #1f1430; --input: #07030d; --mapfill: #12091d; --track: #6a5a85;
  --accent: #ff4fd8; --good: #b48cff; --link: #ff8de6; --on-accent: #1a0614; --on-good: #12081f; --dotline: #000;
  --accent-soft: rgba(255, 79, 216, .08); --pattern: rgba(255, 79, 216, .05);
  --glow: 0 0 12px rgba(255, 79, 216, .5); --glow-g: 0 0 12px rgba(180, 140, 255, .5); --glow-map: drop-shadow(0 0 4px rgba(255, 79, 216, .35));
}
body.t-pastell {
  --bg: #120f17; --card: #1b1722; --tile: #0a080d; --top: #0a080d; --text: #f3eef7; --muted: #9a90a6; --navtext: #c3b9cf; --navhi: #ffffff;
  --line: #2d2737; --border2: #463e52; --btnbg: #221d2a; --input: #0a080d; --mapfill: #17131d; --track: #6b6178;
  --accent: #f7a8c8; --good: #c8b6ff; --link: #f9bfd6; --on-accent: #2a0d1b; --on-good: #1b1233; --dotline: #000;
  --accent-soft: rgba(247, 168, 200, .08); --pattern: rgba(247, 168, 200, .04);
  --glow: 0 0 10px rgba(247, 168, 200, .35); --glow-g: 0 0 10px rgba(200, 182, 255, .35); --glow-map: drop-shadow(0 0 4px rgba(247, 168, 200, .3));
}
body.t-pink {
  --bg: #07090c; --card: #10141a; --tile: #000; --top: #000; --text: #e8edf2; --muted: #8a95a5; --navtext: #b5bfcc; --navhi: #ffffff;
  --line: #232b36; --border2: #3a4554; --btnbg: #1a2029; --input: #05070a; --mapfill: #0b1017; --track: #5b6675;
  --accent: #ff2fa8; --good: #ffb3d9; --link: #ff7ac6; --on-accent: #000; --on-good: #000; --dotline: #000;
  --accent-soft: rgba(255, 47, 168, .07); --pattern: rgba(255, 47, 168, .05);
  --glow: 0 0 12px rgba(255, 47, 168, .45); --glow-g: 0 0 12px rgba(255, 179, 217, .5); --glow-map: drop-shadow(0 0 4px rgba(255, 47, 168, .35));
}
body.t-gelb {
  --bg: #07090c; --card: #10141a; --tile: #000; --top: #000; --text: #e8edf2; --muted: #8a95a5; --navtext: #b5bfcc; --navhi: #ffffff;
  --line: #232b36; --border2: #3a4554; --btnbg: #1a2029; --input: #05070a; --mapfill: #0b1017; --track: #5b6675;
  --accent: #ffb000; --good: #3ddc84; --link: #ffc94d; --on-accent: #000; --on-good: #000; --dotline: #000;
  --accent-soft: rgba(255, 176, 0, .07); --pattern: rgba(255, 176, 0, .05);
  --glow: 0 0 12px rgba(255, 176, 0, .45); --glow-g: 0 0 12px rgba(61, 220, 132, .5); --glow-map: drop-shadow(0 0 4px rgba(255, 176, 0, .35));
}
body.t-koralle {
  --bg: #061116; --card: #0b1a21; --tile: #020a0d; --top: #020a0d; --text: #e6f3f6; --muted: #7d9aa3; --navtext: #a9c3ca; --navhi: #ffffff;
  --line: #17303a; --border2: #2a4752; --btnbg: #102530; --input: #03090c; --mapfill: #08161c; --track: #4f6a73;
  --accent: #ff6f61; --good: #3fd7f2; --link: #ff9a8f; --on-accent: #210704; --on-good: #03222a; --dotline: #000;
  --accent-soft: rgba(255, 111, 97, .08); --pattern: rgba(255, 111, 97, .05);
  --glow: 0 0 12px rgba(255, 111, 97, .45); --glow-g: 0 0 12px rgba(63, 215, 242, .45); --glow-map: drop-shadow(0 0 4px rgba(255, 111, 97, .35));
}
body.t-hell {
  --bg: #fff4f7; --card: #ffffff; --tile: #fff9fb; --top: #ffffff; --text: #3a1027; --muted: #8f6178; --navtext: #7a4a62; --navhi: #3a1027;
  --line: #f3d3e0; --border2: #e5b5c9; --btnbg: #fff0f5; --input: #ffffff; --mapfill: #fff0f5; --track: #d9b3c5;
  --accent: #d81b6a; --good: #7b3f9e; --bad: #c62828; --link: #c0175e; --on-accent: #ffffff; --on-good: #ffffff; --dotline: #ffffff;
  --accent-soft: rgba(216, 27, 106, .06); --pattern: rgba(216, 27, 106, .05);
  --glow: none; --glow-g: none; --glow-map: none;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--f-body);
  background-image: radial-gradient(var(--pattern) 1px, transparent 1px); background-size: 6px 6px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1140px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
h1, h2, h3 { margin: 0; font-weight: 700; text-wrap: balance; }
h1 { font-size: 2.1rem; line-height: 1.1; }
h2 { font-size: 1.2rem; margin-bottom: 12px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
h2 a.small { margin-left: auto; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .82rem; }
.good { color: var(--good) !important; }
code { font-family: var(--f-num); background: var(--btnbg); padding: 1px 5px; border-radius: 3px; }

/* Kopf */
.top { background: var(--top); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-block: 12px; }
.brand { font: 1.55rem/1 var(--f-num); color: var(--accent); text-shadow: var(--glow); letter-spacing: .06em; text-transform: uppercase; display: flex; gap: 10px; align-items: center; }
.brand:hover { text-decoration: none; }
.brand .bib { font-size: 1rem; color: var(--good); border: 1px solid var(--good); padding: 2px 7px; text-shadow: var(--glow-g); border-radius: 2px; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; }
.nav a { color: var(--navtext); padding: 6px 10px; border-bottom: 3px solid transparent; }
.nav a:hover { color: var(--navhi); text-decoration: none; }
.nav a.active { color: var(--navhi); border-bottom-color: var(--accent); font-weight: 700; }
.nav a.logout { color: var(--muted); }

main.wrap { display: grid; gap: 18px; padding-block: 22px 40px; }
.foot { color: var(--muted); font-size: .8rem; padding-block: 0 30px; }
.back { margin: 0; }

/* Karten, Kacheln */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; min-width: 0; }
.card.narrow { max-width: 460px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.hero { display: flex; gap: 18px; align-items: center; }
.hero-text { display: grid; gap: 10px; min-width: 0; }
.avatar { flex: none; width: 84px; height: 84px; border-radius: 50%; border: 2px solid var(--accent); display: grid; place-items: center;
  font: 1.9rem var(--f-num); color: var(--accent); text-shadow: var(--glow); background: var(--tile); box-shadow: var(--glow); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--tile); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 6px; align-content: start; }
.tile b { font: 2.3rem/1 var(--f-num); color: var(--accent); text-shadow: var(--glow); font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile span { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.tile.hi { border-color: var(--good); }
.tile.hi b { color: var(--good); text-shadow: var(--glow-g); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 4px 12px; font: .85rem var(--f-body); cursor: pointer; }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }

/* Bestzeiten */
.pbgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.pbcard { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 6px; padding: 12px; background: var(--tile); color: var(--text); transition: border-color .15s; }
.pbcard:hover { border-color: var(--accent); text-decoration: none; }
.pbcard .d { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pbcard .t { font: 2rem/1.1 var(--f-num); color: var(--accent); text-shadow: var(--glow); }

/* Diagramme */
svg.chart { width: 100%; height: auto; display: block; }
svg text { fill: var(--muted); font: 11px var(--f-body); }
svg .lbl { fill: var(--text); font-weight: 700; }
svg .grid { stroke: var(--line); stroke-width: 1; }
svg .ln { fill: none; stroke: var(--track); stroke-width: 2; }
svg .dot { fill: var(--accent); stroke: var(--dotline); stroke-width: 1.5; }
svg .dot.hi { fill: var(--good); }
svg a:hover .dot { stroke: var(--text); stroke-width: 2; }
.bars { display: grid; gap: 6px; margin-block: 12px 6px; }
.barrow { display: grid; grid-template-columns: 44px 80px 1fr auto; gap: 10px; align-items: center; color: var(--text); font-size: .85rem; }
.barrow:hover { text-decoration: none; }
.barrow:hover .track i { filter: brightness(1.25); }
.barrow .y { font-family: var(--f-num); font-size: 1rem; }
.barrow .k { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow .track { height: 20px; background: var(--tile); border: 1px solid var(--line); border-radius: 3px; position: relative; overflow: hidden; }
.barrow .track i { position: absolute; inset: 0 auto 0 0; background: var(--track); border-radius: 3px; }
.barrow .track i.hi { background: var(--accent); }
.barrow .v { font-family: var(--f-num); white-space: nowrap; }

/* Tabellen */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 500; }
table.sortable th { cursor: pointer; user-select: none; }
table.sortable th:hover { color: var(--text); }
td.num, th.num { text-align: right; }
td.num { font-family: var(--f-num); font-size: 1rem; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--accent-soft); }
.pb { display: inline-block; font: 700 .68rem var(--f-body); padding: 1px 5px; border-radius: 3px; background: var(--good); color: var(--on-good); margin-left: 6px; vertical-align: 2px; }
.tag { font: 700 .72rem var(--f-body); padding: 1px 6px; border: 1px solid var(--bad); color: var(--bad); border-radius: 3px; }
.medal { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: 0; }
.medal.m1 { background: #f5c542; } .medal.m2 { background: #c9d1d9; } .medal.m3 { background: #d08a4b; }
.pct { display: grid; gap: 4px; min-width: 110px; }
.bar { height: 7px; background: var(--line); border-radius: 4px; position: relative; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--good); border-radius: 4px; }

/* Lauf-Detail */
.detailhead { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.headrow { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.kv div { border-left: 3px solid var(--accent); padding: 2px 10px; }
.kv span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.kv b { font: 1.5rem var(--f-num); color: var(--accent); text-shadow: var(--glow); }
.place { display: grid; gap: 6px; margin-top: 30px; }
.place .scale { position: relative; height: 30px; background: var(--tile); border-radius: 6px; border: 1px solid var(--line); }
.place .scale i { position: absolute; top: 0; bottom: 0; width: 4px; background: var(--good); box-shadow: var(--glow-g); }
.place .scale em { position: absolute; top: -24px; transform: translateX(-50%); font: 700 .8rem var(--f-body); white-space: nowrap; }
.place .ends { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.notebox { border-left: 3px solid var(--accent); padding: 4px 12px; font-style: italic; margin-bottom: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Galerie */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.gallery.small-g { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.gitem { position: relative; display: block; border-radius: 6px; overflow: hidden; background: var(--tile); aspect-ratio: 4 / 3; }
.gitem img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.gitem:hover img { transform: scale(1.04); }
.gcap { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px; font-size: .75rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.8)); }
.upload .drop { display: grid; gap: 4px; border: 1px dashed var(--border2); border-radius: 6px; padding: 16px; text-align: center; cursor: pointer; }
.upload .drop:hover, .upload.over .drop { border-color: var(--accent); background: var(--accent-soft); }
.upload input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.progress { display: grid; gap: 4px; margin-top: 8px; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.94); display: grid; place-items: center; padding: 50px 60px 90px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox button.lb-close, .lightbox button.lb-prev, .lightbox button.lb-next { position: absolute; background: none; border: 0; color: #fff; font-size: 2.6rem; cursor: pointer; padding: 6px 14px; }
.lb-close { top: max(8px, env(safe-area-inset-top)); right: 8px; }
.lb-prev { left: 4px; top: 45%; } .lb-next { right: 4px; top: 45%; }
.lb-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: center; }
.lb-info { color: #ddd; }

/* Karte */
.mapwrap { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }
svg.map { width: 100%; height: auto; display: block; }
svg.map .ch { fill: var(--mapfill); stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; filter: var(--glow-map); }
svg.map .pin { fill: var(--accent); fill-opacity: .85; stroke: var(--dotline); stroke-width: 1.5; cursor: pointer; }
svg.map .pin.sel { fill: var(--good); }
svg.map a:hover .pin { stroke: var(--text); }
svg.map .lbl { font-size: 12px; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; }

/* Formulare, Knöpfe */
.btn { display: inline-block; font: 700 .9rem var(--f-body); padding: 8px 14px; border-radius: 5px; border: 1px solid var(--border2); background: var(--btnbg); color: var(--text); cursor: pointer; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 9px; font-size: .8rem; }
.danger-text { color: var(--bad); }
.form { display: grid; gap: 12px; align-content: start; }
.form > .btn { justify-self: start; }
.form label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.form label.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
input, select, textarea { font: 1rem var(--f-body); color: var(--text); background: var(--input); border: 1px solid var(--border2); border-radius: 5px; padding: 8px 10px; width: 100%; min-width: 0; }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: var(--glow); }
.inline { display: inline-flex; gap: 6px; align-items: center; }
.inline input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px 14px; display: grid; gap: 12px; margin: 0; min-width: 0; }
legend { color: var(--accent); font-weight: 700; padding: 0 6px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pace-out { display: grid; gap: 2px; }
.pace-out b { font: 1.5rem var(--f-num); color: var(--accent); text-shadow: var(--glow); }
.card.danger { border-color: var(--bad); }
.flash { padding: 10px 14px; border-radius: 6px; border: 1px solid var(--good); color: var(--good); background: var(--accent-soft); }
.flash.err { border-color: var(--bad); color: var(--bad); background: rgba(255,93,93,.07); }

/* Login */
.page-login .top { display: none; }
.login { min-height: 70vh; display: grid; place-items: center; }
.login.has-img { background: linear-gradient(90deg, rgba(7,9,12,1) 20%, rgba(7,9,12,.6) 60%, rgba(7,9,12,.2)), var(--img) center / cover; border-radius: 10px; }
.login-box { width: min(380px, 100%); display: grid; gap: 14px; }
.login-box .clock { font: 1rem var(--f-num); color: var(--good); text-shadow: var(--glow-g); letter-spacing: .1em; }
.login-box h1 { font: 2.6rem/1 var(--f-num); color: var(--accent); text-shadow: var(--glow); text-transform: uppercase; font-weight: 400; }

@media (max-width: 820px) {
  .grid2, .mapwrap { grid-template-columns: 1fr; }
  h1 { font-size: 1.7rem; }
  .nav { margin-left: 0; }
  .top { position: static; }
  .avatar { width: 60px; height: 60px; font-size: 1.3rem; }
  .tile b { font-size: 1.9rem; }
  .barrow { grid-template-columns: 40px 1fr auto; }
  .barrow .k { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
svg.map .lead { stroke: var(--muted); stroke-width: 1; }

/* Auswahl Farbdesign */
.themes { display: grid; gap: 8px; }
.form label.themeopt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; color: var(--text); font-size: .95rem; }
.form label.themeopt:hover { border-color: var(--accent); }
.themeopt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.themeopt input { width: auto; accent-color: var(--accent); }
.themeopt .sw { display: inline-flex; gap: 4px; padding: 5px; border-radius: 5px; border: 1px solid var(--border2); }
.themeopt .sw i { width: 18px; height: 18px; border-radius: 3px; display: block; }
