:root {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --surface-2: #232321;
  --surface-3: #2c2c2a;
  --border: rgba(255, 255, 255, 0.10);
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --accent: #e5322d;      /* Marke (kein Datenfarbton) */
  --accent-soft: rgba(229, 50, 45, 0.15);
  --fav: #fab219;
  --good: #0ca30c;
  /* Kategoriale Datenfarben (validierte Dark-Mode-Stufen) */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.45;
}
a { color: inherit; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; color: var(--text-secondary); font-weight: 600; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.tnum { font-variant-numeric: tabular-nums; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .75rem 1.5rem;
  background: rgba(13, 13, 13, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { text-decoration: none; font-weight: 800; letter-spacing: .08em; font-size: 1.1rem; white-space: nowrap; }
.brand { display: flex; align-items: center; line-height: 0; }
.brand-logo { height: 44px; width: auto; display: block; border-radius: 6px; }
@media (max-width: 760px) { .brand-logo { height: 32px; } }
.brand-mark { color: var(--accent); }
.brand-sub { font-weight: 400; color: var(--text-muted); letter-spacing: 0; font-size: .85rem; margin-left: .25rem; }
/* Menü: Symbol (☰) mit Ausklapp-Liste – öffnet bei Mausberührung oder Klick */
.menu { position: relative; flex-shrink: 0; }
.menu::after { content: ""; position: absolute; left: 0; top: 100%; width: 240px; height: 10px; } /* Brücke, damit die Liste beim Hinfahren offen bleibt */
.menu-btn { font-size: 1.4rem; line-height: 1; padding: .35rem .55rem; color: var(--text-primary); }
.menu.open .menu-btn { background: var(--surface-3); }
.nav {
  position: absolute; top: 100%; left: 0; z-index: 60; margin-top: 8px;
  display: flex; flex-direction: column; gap: 2px; min-width: 220px; padding: .35rem;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.menu.open .nav { opacity: 1; visibility: visible; transform: none; }
@media (hover: hover) { .menu:not(.hold):hover .nav { opacity: 1; visibility: visible; transform: none; } }
.nav a {
  display: flex; align-items: center; gap: .7rem;
  text-decoration: none; padding: .55rem .8rem; border-radius: 8px;
  color: var(--text-secondary); white-space: nowrap;
}
.nav .ni { width: 1.4em; text-align: center; }
.nav { max-height: calc(100vh - 90px); overflow-y: auto; overscroll-behavior: contain; }
/* Menü-Gruppen: Überschrift + zugehörige Seiten, durch Linie getrennt */
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-top: .3rem; padding-top: .3rem; border-top: 1px solid var(--border); }
.nav-head {
  padding: .3rem .8rem .15rem; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted);
  user-select: none;
}
.nav-group a { padding-left: 1.1rem; }
.nav a:hover, .nav a:focus-visible { background: var(--surface-2); color: var(--text-primary); }
.nav a.active { background: var(--accent-soft); color: var(--text-primary); box-shadow: inset 3px 0 0 var(--accent); }
@media (prefers-reduced-motion: reduce) { .nav { transition: none; } }
.topbar-actions { display: flex; gap: .5rem; }

/* ---------- Mein Profil (schlichte Übersicht) ---------- */
.me-empty { text-align: center; padding: 2rem 1rem; }
.me-empty .btn { margin-top: .6rem; }
.me-list { list-style: none; margin: 0; padding: 0; }
.me-list li {
  display: grid; grid-template-columns: 1fr auto 5.5rem; align-items: center; gap: 1rem;
  padding: .65rem .2rem; border-top: 1px solid var(--border);
}
.me-list li:first-child { border-top: 0; }
.me-track { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.me-track .plink { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-track .muted { font-size: .8rem; }
.me-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; }
.me-pos { text-align: right; font-variant-numeric: tabular-nums; }
.me-pos.pos-1 { color: var(--accent); font-weight: 700; }
@media (max-width: 760px) { .me-list li { grid-template-columns: 1fr auto; gap: .5rem; } .me-pos { grid-column: 2; } }

.container { max-width: 1240px; margin: 0 auto; padding: 1.5rem; }

/* Layout */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: 0; color: var(--text-muted); }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat .label { color: var(--text-muted); font-size: .85rem; }
.stat .value { font-size: 2rem; font-weight: 700; }
.stat .sub { color: var(--text-secondary); font-size: .85rem; }

/* Forms */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=date], input[type=search], input[type=email], input[type=password], select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .5rem .65rem;
  min-width: 0;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label { font-size: .8rem; color: var(--text-muted); }
.field.wide { grid-column: 1 / -1; }
.hint { font-size: .8rem; color: var(--text-muted); }
.error { color: var(--series-8); font-size: .85rem; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: .55rem 1rem; cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
a.btn { text-decoration: none; }
.mini td { white-space: normal; }
table.wrap td { white-space: normal; }
.onboarding { border-color: rgba(229, 50, 45, .45); }
.onboarding .step { display: flex; flex-direction: column; gap: .35rem; text-decoration: none; background: var(--surface-2); }
.onboarding .step:hover { border-color: rgba(229, 50, 45, .55); }
table.wrap td:first-child, table.wrap td:last-child { white-space: nowrap; }
.btn.ghost { background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border); font-weight: 500; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.small { padding: .35rem .7rem; font-size: .85rem; }
.btn.danger { background: transparent; color: var(--series-8); border: 1px solid rgba(230, 103, 103, .4); }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: .25rem .4rem; border-radius: 6px; font-size: 1rem; }
.icon-btn:hover { background: var(--surface-3); color: var(--text-primary); }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.seg button { background: none; border: none; padding: .35rem .8rem; border-radius: 6px; cursor: pointer; color: var(--text-secondary); }
.seg button.active { background: var(--surface-3); color: var(--text-primary); font-weight: 600; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: rgba(255, 255, 255, .02); }
tr.is-me td { background: rgba(57, 135, 229, .08); }
tr.is-fav td:first-child { box-shadow: inset 3px 0 0 var(--fav); }
.pos { font-weight: 700; width: 2.5rem; }
.pos-1 { color: var(--fav); }
.empty { text-align: center; color: var(--text-muted); padding: 2rem 1rem; }

/* Badges */
.badge { white-space: nowrap; display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; padding: .12rem .5rem; border-radius: 999px; background: var(--surface-3); color: var(--text-secondary); border: 1px solid var(--border); }
.badge.cls { color: var(--text-primary); font-weight: 600; font-size: .7rem; letter-spacing: .02em; }
.badge.nass { color: #9ec5f4; }
.badge.org { color: var(--text-primary); border-color: rgba(229, 50, 45, .45); }
.badge.org::before { content: "🏁"; }
.org-info a { color: var(--series-1); margin-left: .5rem; }
code { background: var(--surface-3); padding: 0 .3rem; border-radius: 4px; }
.badge.kind-freunde::before { content: "👥"; }
.badge.kind-renngruppe::before { content: "🏁"; }
.badge.kind-rennteam::before { content: "🛠"; }
.star { cursor: pointer; background: none; border: none; font-size: 1.15rem; line-height: 1; color: var(--text-muted); padding: .1rem .25rem; }
.star.on { color: var(--fav); }
.star:hover { transform: scale(1.15); }
.fav-mark { color: var(--fav); }

/* Track cards */
.track-card { display: flex; flex-direction: column; gap: .5rem; cursor: pointer; transition: border-color .15s; }
.track-card:hover { border-color: rgba(229, 50, 45, .55); }
.track-card .title { font-weight: 600; }
.track-card .records { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: auto; }
.record { background: var(--surface-2); border-radius: 8px; padding: .45rem .6rem; }
.record .k { font-size: .75rem; color: var(--text-muted); }
.record .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.record .who { font-size: .78rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Group cards */
.group-card { cursor: pointer; display: flex; flex-direction: column; gap: .6rem; }
.group-card:hover { border-color: rgba(229, 50, 45, .55); }
.avatars { display: flex; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; background: var(--surface-3); border: 2px solid var(--surface-1); color: var(--text-primary);
}
.avatars .avatar + .avatar { margin-left: -8px; }
.avatar.fav { box-shadow: 0 0 0 2px var(--fav); }

.member-list { list-style: none; margin: 0; padding: 0; }
.member-list li { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--grid); }
.member-list li:last-child { border-bottom: none; }
.member-list .name { flex: 1; }

/* Compare */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; color: var(--text-secondary); font-size: .88rem;
}
.chip:hover { border-color: var(--text-muted); }
.chip.on { color: var(--text-primary); border-color: var(--text-secondary); background: var(--surface-3); }
.chip .swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--axis); }
.chip.disabled { opacity: .4; cursor: not-allowed; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; color: var(--text-secondary); margin-bottom: .5rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.swatch-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; vertical-align: middle; margin-right: .35rem; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--text-secondary); font-size: 12px; }
.chart .val { fill: var(--text-primary); font-size: 12px; font-weight: 600; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .crosshair { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }

.tooltip {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .1s;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 8px;
  padding: .5rem .65rem; font-size: .82rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); max-width: 280px;
}
.tooltip.show { opacity: 1; }
.tooltip .t-title { font-weight: 600; margin-bottom: .2rem; }
.tooltip .t-row { display: flex; gap: .75rem; justify-content: space-between; color: var(--text-secondary); }
.tooltip .t-row b { color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 1.4rem; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }

/* Kundenkonto: Anmelden / Registrieren */
.account-btn { flex-shrink: 0; }
.account-btn[hidden] { display: none; }
.account-chip {
  display: inline-flex; align-items: center; gap: .45rem; padding: .2rem .75rem .2rem .2rem; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; color: var(--text-primary);
}
.account-chip:hover { background: var(--surface-3); }
.account-chip .avatar { width: 28px; height: 28px; border: none; background: var(--accent); color: #fff; font-size: .72rem; }
@media (max-width: 760px) { .account-chip { padding: .2rem; } .account-chip .nl { display: none; } }

.auth { display: flex; flex-direction: column; gap: .95rem; }
.auth h2 { margin: 0 0 .3rem; }
.auth p { margin: 0; }
.auth form { display: flex; flex-direction: column; gap: .8rem; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.auth-tabs button { background: none; border: none; padding: .5rem; border-radius: 6px; cursor: pointer; color: var(--text-secondary); }
.auth-tabs button.active { background: var(--surface-3); color: var(--text-primary); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.auth-steps { display: flex; gap: .6rem; list-style: none; margin: 0; padding: 0; }
.auth-steps li { flex: 1; display: flex; align-items: center; gap: .45rem; font-size: .8rem; color: var(--text-muted); padding-bottom: .5rem; border-bottom: 3px solid var(--surface-3); }
.auth-steps li span { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--surface-3); font-size: .72rem; font-weight: 700; }
.auth-steps li.active { color: var(--text-primary); border-color: var(--accent); }
.auth-steps li.active span { background: var(--accent); color: #fff; }
.auth-steps li.done { color: var(--text-secondary); border-color: rgba(229, 50, 45, .45); }
.auth-steps li.done span { background: var(--good); color: #fff; }
.auth-perks { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .25rem; color: var(--text-secondary); font-size: .88rem; }
.auth-perks li::before { content: "✓ "; color: var(--good); font-weight: 700; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; padding-right: 2.4rem; }
.pw-toggle { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); }
.pw-meter { height: 4px; margin-top: -.45rem; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.pw-hint { margin-top: -.5rem !important; }
.check { display: flex; align-items: flex-start; gap: .55rem; font-size: .88rem; color: var(--text-secondary); cursor: pointer; }
.check input { margin-top: .2rem; accent-color: var(--accent); flex-shrink: 0; }
.auth details { font-size: .82rem; color: var(--text-muted); }
.auth details p { margin-top: .4rem; }
.auth summary { cursor: pointer; }
.auth-submit { width: 100%; padding: .7rem 1rem; }
.auth-submit:disabled { opacity: .6; cursor: wait; }
.auth-switch { text-align: center; font-size: .88rem; }
.auth-switch a { color: var(--series-1); }
.auth-current { color: var(--good); font-size: .9rem; }
input[aria-invalid=true] { border-color: var(--series-8); }
.auth-done { text-align: center; }
.auth-hero { font-size: 2.6rem; line-height: 1; margin-bottom: .4rem; }
.auth-next { display: grid; gap: .5rem; }
.auth-next a { display: flex; align-items: center; gap: .8rem; text-decoration: none; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.auth-next a:hover { border-color: rgba(229, 50, 45, .55); }
.auth-next .ic { font-size: 1.4rem; }
.auth-next small { display: block; color: var(--text-muted); }
.signup-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
  border-color: rgba(229, 50, 45, .45); background: linear-gradient(120deg, var(--accent-soft), transparent 60%), var(--surface-1);
}
.signup-banner h2 { margin: 0 0 .25rem; }
.signup-banner p { margin: 0; }
.account-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.account-head h2 { margin: 0; }
.avatar.big { width: 52px; height: 52px; font-size: 1.1rem; background: var(--accent); color: #fff; border: none; }
.account-facts { display: grid; grid-template-columns: auto 1fr; gap: .6rem 1rem; margin: 0 0 1rem; align-items: center; }
.account-facts dt { color: var(--text-muted); font-size: .85rem; }
.account-facts dd { margin: 0; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* Profil: Benutzername, Profilbild, Garage */
img.avatar { object-fit: cover; padding: 0; background: var(--surface-3); }
.account-chip img.avatar { border: none; }
.avatar.sm { width: 26px; height: 26px; font-size: .68rem; border-width: 1px; flex-shrink: 0; }
.avatar.xl { width: 84px; height: 84px; font-size: 1.6rem; background: var(--accent); color: #fff; border: none; flex-shrink: 0; }
img.avatar.big, img.avatar.xl { background: var(--surface-3); }
.rider { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; vertical-align: middle; }
.rider-names { display: inline-flex; flex-direction: column; line-height: 1.15; }
.rider-names small { color: var(--text-muted); font-size: .74rem; font-weight: 400; }
.rider-handle { color: var(--accent); font-weight: 600; margin: .1rem 0 .3rem; display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.rider-nat { color: var(--text-secondary); font-weight: 500; }
.nat-flag { font-weight: 400; cursor: help; }
.driver-head { display: flex; align-items: center; gap: 1rem; }
.driver-head h1 { margin-bottom: 0; }
.bike-cell { display: inline-flex; align-items: center; gap: .45rem; }
.bike-thumb { width: 34px; height: 24px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.track-bike { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; padding: .7rem 1rem; }
.track-bike label { font-weight: 600; }
.profile-avatar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.stack-sm { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.profile-form { display: flex; flex-direction: column; gap: .5rem; }
.profile-form .error:empty { display: none; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span { display: inline-flex; align-items: center; padding: 0 .6rem; background: var(--surface-3); border: 1px solid var(--border); border-right: none; border-radius: 8px 0 0 8px; color: var(--text-muted); font-weight: 600; }
.input-prefix input { flex: 1; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.profile-preview { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .6rem .8rem; border: 1px dashed var(--border); border-radius: 10px; }
.garage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.bike-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; }
.bike-photo { position: relative; aspect-ratio: 16 / 10; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-size: 2.2rem; overflow: hidden; }
.bike-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bike-no { position: absolute; right: .4rem; bottom: .4rem; background: rgba(0, 0, 0, .65); color: #fff; font-weight: 700; font-size: .8rem; padding: .1rem .45rem; border-radius: 6px; }
.bike-body { padding: .6rem .75rem .75rem; display: flex; flex-direction: column; gap: .3rem; }
.bike-facts { display: flex; gap: .35rem .6rem; flex-wrap: wrap; align-items: center; font-size: .85rem; color: var(--text-secondary); }
.bike-tracks { display: flex; gap: .3rem; flex-wrap: wrap; }
.bike-tracks .chip { font-size: .75rem; padding: .15rem .5rem; text-decoration: none; }
.bike-notes { font-size: .8rem; }
.bike-actions { margin-top: .2rem; justify-content: space-between; }
.bike-photo-field { display: flex; align-items: center; gap: 1rem; flex-direction: row !important; }
.bike-photo-field .bike-photo { width: 160px; flex-shrink: 0; border-radius: 8px; }
@media (max-width: 560px) { .driver-head .avatar.xl { width: 56px; height: 56px; } .bike-photo-field { flex-direction: column !important; align-items: flex-start; } }

/* Einstellungen */
.settings-btn { font-size: 1.25rem; line-height: 1; padding: .35rem .5rem; flex-shrink: 0; }
.settings-section { border: 1px solid var(--border); border-radius: 10px; padding: .9rem 1rem 1rem; margin: 0; }
.settings-section legend { padding: 0 .4rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.lang-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .4rem; margin-bottom: .6rem; }
.lang-opt { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.lang-opt:hover { background: var(--surface-3); }
.lang-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.lang-opt input { accent-color: var(--accent); margin: 0; }
.lang-flag { font-size: 1.2rem; }

.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-3); border: 1px solid var(--border); padding: .6rem 1rem; border-radius: 8px;
  opacity: 0; transition: all .2s; z-index: 70; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.delta-good { color: var(--good); }
.delta-bad { color: var(--text-muted); }

.track-card .records.single { grid-template-columns: 1fr; }
.group-layout { grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 900px) { .group-layout { grid-template-columns: minmax(0, 1fr); } }
/* Raster-/Stapel-Kinder dürfen schmaler werden als ihr Inhalt (sonst wird die Seite am Handy breiter als der Bildschirm) */
.grid > *, .stack > * { min-width: 0; }

@media (max-width: 1100px) {
  .brand-sub { display: none; }
}

/* Handy */
@media (max-width: 760px) {
  .topbar { gap: .5rem; padding: .6rem 1rem; padding-top: calc(.6rem + env(safe-area-inset-top)); backdrop-filter: none; background: var(--page); }
  body { overflow-x: hidden; }
  .stats { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat { padding: .8rem; }
  .topbar .brand { flex: 1; }
  .topbar-actions #btn-export, .topbar-actions label.btn { display: none; }
  .nav a { padding: .7rem .8rem; font-size: 1rem; }
  .nav .nav-group a { padding-left: 1.1rem; }
  .container { padding: 1rem; padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 1.35rem; }
  .stat .value { font-size: 1.6rem; }
}

/* ---------- Fahrersuche ---------- */
.picker-host { position: relative; }
.picker { position: absolute; left: 0; right: 0; top: 100%; z-index: 50; margin-top: 4px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.5); overflow: hidden; }
.picker:empty { display: none; }
.picker button { display: block; width: 100%; text-align: left; background: none; border: none; padding: .5rem .7rem; cursor: pointer; color: var(--text-primary); }
.picker button:hover, .picker button:focus { background: var(--surface-2); }

/* ---------- Karte ---------- */
.map-card { padding: .75rem; }
#map { height: min(68vh, 640px); border-radius: 8px; background: #1a1a19; }
.map-legend { margin: .1rem .25rem .6rem; }
.map-legend .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 2px solid #1a1a19; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }
.leaflet-container { font: inherit; background: #1a1a19; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.leaflet-popup-content { margin: .8rem .9rem; min-width: 230px; }
.leaflet-popup-content a.btn { color: #fff; }
.leaflet-popup-content a.btn.ghost { color: var(--text-primary); }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-muted); }
.leaflet-tooltip { background: var(--surface-3); color: var(--text-primary); border: 1px solid var(--border); box-shadow: none; }
.leaflet-tooltip-top:before { border-top-color: var(--surface-3); }
.leaflet-control-attribution { background: rgba(13,13,13,.7) !important; color: var(--text-muted) !important; }
.leaflet-control-attribution a { color: var(--text-secondary) !important; }
.leaflet-bar a { background: var(--surface-2); color: var(--text-primary); border-color: var(--border); }
.map-pop .records { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.map-pop .records.single { grid-template-columns: 1fr; }

/* ---------- Fortschritt & Statistik ---------- */
.delta-bad { color: var(--text-muted); }
td small { font-size: .78rem; }
.chart a { cursor: pointer; }

@media (max-width: 760px) {
  #map { height: 60vh; }
}

/* OSM-Kacheln im Dunkelmodus */
.map-tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.6); }


/* Karte bleibt unter Menüleiste & Dialogen */
#map { isolation: isolate; z-index: 0; }


/* ---------- Globale Suche ---------- */
.gsearch { position: relative; flex: 0 1 300px; min-width: 180px; }
.gsearch input { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .45rem .9rem; }
.gres { min-width: 340px; max-height: 70vh; overflow: auto; }
.gres-h { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: .55rem .7rem .2rem; }
.gres-hint { padding: .6rem .7rem; }
a.plink { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--text-muted); }
a.plink:hover { color: var(--text-primary); border-bottom-color: var(--accent); }
a.chip { text-decoration: none; }
.claim-box { display: grid; gap: .5rem; padding: .75rem 0; margin-bottom: .5rem; border-bottom: 1px solid var(--border, rgba(127,127,127,.25)); }
.claim-list { flex-wrap: wrap; gap: .4rem; }
.claim-list .chip { display: inline-flex; align-items: center; gap: .4rem; cursor: default; }
@media (max-width: 1100px) { .gsearch { flex-basis: 200px; } }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .gsearch { order: 5; flex: 1 1 100%; }
  .gres { min-width: 0; }
}

/* Kopfzeile: Menü in eigener Zeile (Platz für die Suche) */
@media (min-width: 761px) {
  .topbar { flex-wrap: wrap; row-gap: .4rem; }
  .gsearch { flex: 1 1 320px; max-width: 520px; margin-left: auto; }
}

/* ---------- Startseiten-Auswahl & Veranstalter ---------- */
.chooser { border-color: rgba(229, 50, 45, .45); }
.chooser-input { width: 100%; font-size: 1.05rem; padding: .7rem 1rem !important; border-radius: 10px !important; margin-bottom: .6rem; }
.chooser-res { display: flex; flex-direction: column; max-height: 460px; overflow: auto; }
.ch-item { display: grid; grid-template-columns: minmax(200px, 1.2fr) 2fr auto; gap: .75rem; align-items: center; padding: .55rem .6rem; border-bottom: 1px solid var(--grid); text-decoration: none; border-radius: 6px; }
a.ch-item:hover, .ch-item:hover { background: var(--surface-2); }
.ch-item .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
/* Streckenlayout schimmert dezent im Hintergrund der Auswahl */
.chooser-list { position: relative; isolation: isolate; }
.chooser-list > .chooser-res { position: relative; z-index: 1; }
.chooser-bg { position: absolute; z-index: 0; left: 15%; top: 4%; width: 70%; height: 92%; pointer-events: none;
  fill: none; stroke: var(--series-1); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke;
  opacity: 0; transform: scale(.97); transition: opacity .3s, transform .4s; filter: drop-shadow(0 0 6px var(--series-1)); }
.chooser-bg.on { opacity: .13; transform: none; }
.ch-track { position: relative; padding-right: 3.6rem; }
.ch-track:hover, .ch-track:focus-visible { background: rgba(255, 255, 255, .045); }
.ch-track > .track-bg { position: absolute; right: .6rem; top: 4px; width: 2.6rem; height: calc(100% - 8px);
  fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke;
  opacity: .45; pointer-events: none; transition: opacity .2s, color .2s; }
.ch-track:hover > .track-bg, .ch-track:focus-visible > .track-bg { opacity: .85; color: var(--series-1); }
/* Gruppen-Rangliste: Layout der gewählten Strecke dauerhaft im Hintergrund */
.has-track-bg { position: relative; overflow: hidden; isolation: isolate; }
.has-track-bg > :not(.card-track-bg) { position: relative; z-index: 1; }
.card-track-bg { position: absolute; z-index: 0; left: 15%; top: 12%; width: 70%; height: 84%; pointer-events: none;
  fill: none; stroke: var(--series-1); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke;
  opacity: .12; filter: drop-shadow(0 0 6px var(--series-1)); }
/* Karte/Liste: Filter „von mir / vom Team gefahren“ – befahrene Strecken stechen in der Filterfarbe heraus */
.track-card.is-ridden { border-color: var(--ride); box-shadow: 0 0 0 1px var(--ride), 0 0 18px -4px var(--ride); }
.track-card.is-ridden:hover { border-color: var(--ride); }
.track-card.is-ridden .ride-track-bg { stroke: var(--ride); opacity: .22; filter: drop-shadow(0 0 6px var(--ride)); }
.track-card.not-ridden { opacity: .5; }
.track-card.not-ridden:hover { opacity: .85; }
.ride-badge { display: inline-block; align-self: flex-start; font-size: .8rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px;
  color: #fff; background: var(--ride); }
.ride-pop { display: flex; gap: .6rem; align-items: center; margin: .45rem 0; }
.ride-pop .ride-badge { margin-bottom: .2rem; }
.ride-pop-svg { flex: 0 0 56px; width: 56px; height: 56px; fill: none; stroke: var(--ride); stroke-width: 2.5; stroke-linejoin: round;
  stroke-linecap: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 4px var(--ride)); }
.ride-dot { border-color: #fff !important; }
.leaflet-interactive.ride-marker { filter: drop-shadow(0 0 6px rgba(255,255,255,.55)); }
/* Kalender (Monatsansicht): Layout der Strecke des Termins im Tagesfeld */
.cal-day.has-track { position: relative; isolation: isolate; }
.cal-day.has-track > :not(.cal-track) { position: relative; z-index: 1; }
.cal-track { position: absolute; z-index: 0; left: 8%; top: 40%; width: 84%; height: 54%; pointer-events: none;
  fill: none; stroke: var(--ev-track, var(--series-1)); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke;
  opacity: .55; transition: opacity .2s; }
.cal-day.has-track:hover .cal-track { opacity: .9; }
@media (prefers-reduced-motion: reduce) { .chooser-bg { transition: opacity .3s; transform: none; } }
.badge.ok { color: var(--good); border-color: rgba(12, 163, 12, .4); }
.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin: .6rem 0 .4rem; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.crawl-pill { font-size: .8rem; padding: .3rem .7rem; border-radius: 99px; background: var(--accent-soft); color: var(--text-primary); text-decoration: none; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 50vh; color: var(--text-muted); }
.spinner { width: 38px; height: 38px; border: 3px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.laps-row td { background: var(--surface-2) !important; }
.laps-detail { padding: .4rem 0; max-width: 720px; }
.lapbar { display: inline-block; height: 8px; border-radius: 4px; background: var(--series-1); vertical-align: middle; }
tr.lap-best td { color: var(--text-primary); }
@media (max-width: 760px) {
  .ch-item { grid-template-columns: 1fr; gap: .15rem; }
  .crawl-pill { order: 6; max-width: 100%; }
}

/* ---------- Kalender ---------- */
.cal-layout { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); align-items: start; }
@media (max-width: 1000px) { .cal-layout { grid-template-columns: 1fr; } }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); text-align: center; padding-bottom: .2rem; }
.cal-day { min-height: 86px; background: var(--surface-2); border: 1px solid transparent; border-radius: 8px; padding: .3rem; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal-day:hover { border-color: var(--border); background: var(--surface-3); }
.cal-day.other { opacity: .45; }
.cal-day.today { border-color: var(--accent); }
.cal-day.today .cal-num { background: var(--accent); color: #fff; }
.cal-num { font-size: .8rem; font-weight: 600; align-self: flex-start; min-width: 1.5em; text-align: center; border-radius: 99px; padding: 0 .3rem; color: var(--text-secondary); }
.cal-ev { display: block; font-size: .72rem; line-height: 1.3; padding: .1rem .35rem; border-radius: 4px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--ev) 22%, transparent); border-left: 3px solid var(--ev); color: var(--text-primary); }
.cal-ev.mine { font-weight: 700; }
.cal-ev:hover { background: color-mix(in srgb, var(--ev) 38%, transparent); }
.cal-more { font-size: .7rem; padding-left: .3rem; }
.ev-list { display: flex; flex-direction: column; }
.ev-item { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .6rem .4rem; border-bottom: 1px solid var(--grid); text-decoration: none; border-radius: 6px; }
.ev-item:last-child { border-bottom: none; }
.ev-item:hover { background: var(--surface-2); }
.ev-date { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 8px; padding: .3rem 0; background: color-mix(in srgb, var(--ev) 18%, transparent); border-top: 3px solid var(--ev); }
.ev-date b { font-size: 1.25rem; line-height: 1.1; }
.ev-date span { font-size: .7rem; text-transform: uppercase; color: var(--text-secondary); }
.ev-body { min-width: 0; }
.ev-body .muted { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.countdown { color: var(--text-primary); border-color: rgba(57, 135, 229, .5); }
.ev-dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; }
.ev-dl dt { color: var(--text-muted); font-size: .85rem; }
.ev-dl dd { margin: 0; }
.ev-dl a { color: var(--series-1); }
.ev-notes { white-space: pre-wrap; }
textarea { resize: vertical; }
@media (max-width: 760px) {
  .cal-day { min-height: 54px; padding: .2rem; }
  .cal-ev { font-size: 0; height: 6px; padding: 0; border-left-width: 0; background: var(--ev); }
  .ev-item { grid-template-columns: 46px minmax(0, 1fr); }
  .ev-who { display: none; }
}

/* ---------- Auto-Update-Hinweis ---------- */
.update-banner { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; gap: .75rem;
  background: var(--surface-3); border: 1px solid var(--accent); border-radius: 10px; padding: .5rem .6rem .5rem 1rem; box-shadow: 0 10px 30px rgba(0,0,0,.5); white-space: nowrap; }
@media (max-width: 760px) { .update-banner { top: auto; bottom: calc(5rem + env(safe-area-inset-bottom)); } }

/* ---------- Global Chat ---------- */
.chat-layout { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.chat-feed { display: flex; flex-direction: column; gap: .9rem; }
.chat-composer { display: flex; flex-direction: column; gap: .7rem; }
.chat-guest { align-items: flex-start; }
.chat-guest p { margin: 0; color: var(--text-secondary); }
.chat-compose-row { display: flex; gap: .7rem; align-items: flex-start; }
.chat-compose-row .avatar { flex-shrink: 0; width: 38px; height: 38px; object-fit: cover; }
.chat-compose-row textarea { flex: 1; resize: vertical; min-height: 3.2rem; }
textarea { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .5rem .65rem; min-width: 0; }
.chat-post { display: flex; flex-direction: column; gap: .65rem; }
.chat-post.has-pb { border-color: rgba(229, 50, 45, .35); }
.chat-head { display: flex; align-items: center; gap: .6rem; }
.chat-author { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; }
.chat-author .avatar { width: 36px; height: 36px; object-fit: cover; flex-shrink: 0; }
a.chat-author:hover b { text-decoration: underline; }
.chat-small { font-size: .8rem; }
.chat-text { white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
.chat-text a, .chat-comment a { color: var(--series-1); }
.chat-pb {
  display: flex; flex-direction: column; gap: .45rem; padding: .8rem 1rem; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface-2); border: 1px solid var(--border);
}
.chat-pb-main { display: flex; align-items: baseline; gap: .4rem 1rem; flex-wrap: wrap; }
.chat-pb-label { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); width: 100%; }
.chat-pb-time { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.chat-pb-track { font-weight: 600; }
.chat-pb-meta { display: flex; align-items: center; gap: .35rem .7rem; flex-wrap: wrap; font-size: .85rem; color: var(--text-secondary); }
.chat-pb-meta a { text-decoration: none; }
.chat-actions { display: flex; gap: .4rem; border-top: 1px solid var(--border); padding-top: .55rem; }
.chat-act {
  display: inline-flex; align-items: center; gap: .35rem; background: none; border: 1px solid transparent; border-radius: 999px;
  padding: .3rem .75rem; cursor: pointer; color: var(--text-secondary);
}
.chat-act:hover { background: var(--surface-2); color: var(--text-primary); }
.chat-act.on { color: var(--text-primary); border-color: rgba(229, 50, 45, .45); background: var(--accent-soft); }
.chat-act:disabled { opacity: .6; cursor: progress; }
@media (prefers-reduced-motion: no-preference) { .chat-act.on { animation: chat-pop .25s ease-out; } }
@keyframes chat-pop { 50% { transform: scale(1.12); } }
.chat-comments { display: flex; flex-direction: column; gap: .55rem; padding-left: .2rem; }
.chat-comment { display: flex; gap: .55rem; align-items: flex-start; }
.chat-comment .avatar { object-fit: cover; }
.chat-comment-body { background: var(--surface-2); border-radius: 10px; padding: .4rem .7rem; overflow-wrap: anywhere; font-size: .92rem; }
.chat-comment-name { font-weight: 700; margin-right: .25rem; }
.chat-cform { display: flex; gap: .5rem; }
.chat-cform input { flex: 1; }
.linkish { background: none; border: none; padding: 0; color: var(--series-1); cursor: pointer; font: inherit; align-self: flex-start; }
.linkish:hover { text-decoration: underline; }
.modal .chat-pb { margin-top: .5rem; }
/* Streckenlayout in geteilten Bestzeiten */
.chat-pb-layout {
  display: flex; align-items: center; justify-content: center; height: 130px; margin: -.3rem -.4rem .2rem;
  border-radius: 8px; background: radial-gradient(ellipse at center, rgba(229, 50, 45, .12), transparent 70%); color: var(--accent);
}
.chat-pb-svg { height: 100%; width: 100%; max-width: 340px; padding: .6rem 0; overflow: visible; }
.chat-pb-svg path {
  fill: none; stroke: currentColor; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px currentColor);
}
a.chat-pb-layout:hover { background: radial-gradient(ellipse at center, rgba(229, 50, 45, .22), transparent 70%); }
@media (max-width: 520px) { .chat-pb-layout { height: 105px; } }

/* ---------- Rangliste ---------- */
.rk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem .75rem; }
.rk-grid label { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.rk-grid label > span { font-size: .78rem; color: var(--text-muted); }
.rk-grid select { width: 100%; min-width: 0; }
.rk-grid .rk-track-field { grid-column: span 2; }
@media (max-width: 520px) { .rk-grid .rk-track-field { grid-column: auto; } }
.rk-table td.pos { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rk-note { font-size: .8rem; margin: .75rem 0 0; }
/* Streckenkarte über der Rangliste: Layout + Eckdaten */
.rk-hero { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 1.25rem; align-items: center; margin-bottom: 1rem; }
.rk-hero-layout { display: flex; align-items: center; justify-content: center; height: 220px; border-radius: 12px; color: var(--accent); text-decoration: none;
  background: radial-gradient(ellipse at center, rgba(229, 50, 45, .14), transparent 70%); transition: background .2s; }
a.rk-hero-layout:hover { background: radial-gradient(ellipse at center, rgba(229, 50, 45, .26), transparent 72%); }
.rk-layout-svg { width: 100%; height: 100%; padding: .9rem; overflow: visible; }
.rk-layout-svg path { fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 6px currentColor); }
.rk-hero-nolayout { display: flex; flex-direction: column; align-items: center; gap: .4rem; color: var(--text-muted); }
.rk-hero-flag { font-size: 3.2rem; line-height: 1; }
.rk-hero-info h2 { margin: 0 0 .2rem; }
.rk-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem 1rem; margin: .9rem 0 1rem; }
.rk-facts dt { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.rk-facts dd { margin: .15rem 0 0; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.rk-facts dd small { display: block; font-weight: 400; font-size: .75rem; color: var(--text-muted); }
@media (max-width: 720px) { .rk-hero { grid-template-columns: 1fr; } .rk-hero-layout { height: 170px; } }
/* Suche in der Rangliste: Platz der gefundenen Fahrer */
.rk-search { margin: 0 0 .85rem; }
.rk-search input { width: 100%; font-size: 1rem; padding: .7rem .9rem; }
.rk-hits { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.rk-hit { display: flex; align-items: center; gap: .8rem; padding: .6rem .8rem; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.rk-hit.is-me { border-left-color: var(--series-1); }
.rk-hit-pos { flex: none; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 3.6rem; }
.rk-hit-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.rk-hit-main small { color: var(--text-muted); font-size: .78rem; }
.rk-hit-more { align-self: center; font-size: .85rem; padding: .3rem .4rem; }
.rk-chip { display: inline-flex; align-items: center; gap: .4rem; }
.rk-chip-svg { width: 1.5rem; height: 1.5rem; flex: none; color: var(--accent); }
.rk-chip-svg path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

/* ---------- Pedala Pro ---------- */
.pro-badge { display: inline-block; vertical-align: middle; font-size: .62rem; font-weight: 800; letter-spacing: .06em; line-height: 1; padding: .2rem .38rem; border-radius: 4px; background: var(--fav); color: #1a1a19; margin-left: .25rem; }
.pro-badge.big { font-size: .9rem; padding: .35rem .6rem; margin: 0 0 .4rem; }
.account-chip .pro-badge { margin-left: .35rem; }
.pro-lock { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; border: 1px dashed var(--fav); background: linear-gradient(135deg, rgba(250, 178, 25, .08), transparent 60%), var(--surface-1); }
.pro-lock > div:nth-child(2) { flex: 1; min-width: 220px; }
.pro-lock h2 { margin: 0 0 .25rem; font-size: 1.05rem; }
.pro-lock p { margin: 0; }
.pro-lock-icon { font-size: 1.8rem; }
.pro-hint { margin: .7rem 0 0; font-size: .85rem; color: var(--text-muted); }
.pro-hint a { color: var(--fav); }
.pro-modal { max-width: 640px; }
.pro-hero { text-align: center; margin-bottom: .8rem; }
.pro-hero h2 { margin: 0 0 .3rem; }
.pro-features { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .5rem; }
.pro-features li { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .7rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.pro-features li.hl { border-color: var(--fav); background: rgba(250, 178, 25, .1); }
.pro-features small { display: block; color: var(--text-muted); }
.pro-prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-bottom: .6rem; }
.pro-price { position: relative; display: flex; flex-direction: column; align-items: center; gap: .25rem; text-align: center; padding: .9rem .6rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); }
.pro-price.best { border-color: var(--fav); }
.pro-price .btn { margin-top: .35rem; }
.pro-amount { font-size: 1.4rem; font-weight: 800; }
.pro-ribbon { position: absolute; top: -.6rem; font-size: .68rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: var(--fav); color: #1a1a19; }
.theme-opt.locked { opacity: .6; cursor: pointer; }
.nav-pro .nl { color: var(--fav); font-weight: 700; }

/* Gratis/Pro-Umschalter (nur Admin-Konten) */
.preview-switch { position: fixed; right: 1rem; bottom: 1rem; z-index: 900; display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; border: 1px solid var(--fav); background: var(--surface-1); box-shadow: 0 4px 14px rgba(0, 0, 0, .35); cursor: pointer; font: inherit; font-size: .75rem; font-weight: 800; letter-spacing: .04em; }
.preview-switch span { padding: .3rem .65rem; border-radius: 999px; color: var(--text-muted); }
.preview-switch span.on { background: var(--fav); color: #1a1a19; }
.preview-switch.is-free span.on { background: var(--surface-3); color: var(--text-primary); }

/* Selbst eingetragene Zeiten (nicht aus der Zeitnahme) */
.self-lap { display: inline-flex; align-items: center; justify-content: center; min-width: 1.35rem; height: 1.25rem; padding: 0 .25rem; margin-left: .15rem; border-radius: 4px; font-size: .78rem; font-weight: 400; line-height: 1; vertical-align: middle; color: var(--series-7); background: rgba(144, 133, 233, .16); border: 1px dashed var(--series-7); cursor: help; }
tr.is-self td { background: rgba(144, 133, 233, .07); }
tr.is-self td:first-child { box-shadow: inset 3px 0 0 var(--series-7); }
tr.is-self.is-fav td:first-child { box-shadow: inset 3px 0 0 var(--fav), inset 6px 0 0 var(--series-7); }
tr.is-self td.num b { color: var(--series-7); }
.self-legend { margin: .5rem 0 0; font-size: .78rem; color: var(--text-muted); }

/* Fußzeile mit Impressum / Datenschutz (Pflichtangaben) */
.site-footer { max-width: 1240px; margin: 0 auto; padding: 1rem 1.5rem 1.5rem; text-align: center; font-size: .82rem; color: var(--text-muted); }
.site-footer a { color: var(--text-muted); text-decoration: none; margin: 0 .5rem; }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--text-primary); text-decoration: underline; }

/* =====================================================================
   HANDY: Menüleiste unten + Menü als Bottom-Sheet (nur ≤ 760px)
   ===================================================================== */
.tabbar { display: none; }
@media (max-width: 760px) {
  :root { --tabbar-h: 62px; }

  /* Kopfzeile: ☰ wandert in die Menüleiste unten */
  .topbar .menu-btn { display: none; }
  .menu::after { display: none; }
  .topbar { row-gap: .5rem; flex-wrap: wrap; }
  .topbar .brand { flex: 1 1 0; min-width: 0; }
  .topbar .brand-logo { height: 30px; max-width: 100%; object-fit: contain; object-position: left center; }
  .gsearch input { padding: .55rem 1rem; }

  /* Menüleiste */
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 0 .25rem env(safe-area-inset-bottom);
    background: var(--surface-1); border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .28);
  }
  .tabbar a, .tabbar button {
    flex: 1 1 0; min-width: 0; position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    background: none; border: none; padding: 0; cursor: pointer;
    color: var(--text-muted); text-decoration: none; font-size: .68rem; font-weight: 600; letter-spacing: .01em;
    -webkit-tap-highlight-color: transparent; transition: color .15s;
  }
  .tabbar .ti {
    font-size: 1.3rem; line-height: 1; display: grid; place-items: center;
    width: 3.1rem; height: 1.9rem; border-radius: 999px;
    filter: grayscale(1); opacity: .75; transition: background .15s, filter .15s, opacity .15s, transform .15s;
  }
  .tabbar .tl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .tabbar .active, .tabbar .open { color: var(--text-primary); }
  .tabbar .active .ti, .tabbar .open .ti { filter: none; opacity: 1; background: var(--accent-soft); }
  .tabbar a:active .ti, .tabbar button:active .ti { transform: scale(.9); }
  .tabbar .active::before {
    content: ""; position: absolute; top: -1px; left: 30%; right: 30%; height: 3px;
    border-radius: 0 0 3px 3px; background: var(--accent);
  }

  /* Menü als Blatt, das über der Menüleiste aufklappt */
  .nav {
    position: fixed; left: 0; right: 0; top: auto; margin: 0; z-index: 61;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    min-width: 0; max-height: calc(100dvh - var(--tabbar-h) - 90px);
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px; align-content: start;
    padding: 1.4rem .8rem .9rem;
    border-radius: 18px 18px 0 0; border-bottom: none;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .5);
    transform: translateY(24px); transition: opacity .2s, transform .22s ease-out, visibility .2s;
  }
  .nav::before { /* Griff */
    content: ""; position: absolute; top: .55rem; left: 50%; width: 40px; height: 4px;
    margin-left: -20px; border-radius: 99px; background: var(--surface-3);
  }
  .menu.open .nav { transform: none; }
  .menu.open::before { /* abgedunkelter Hintergrund – Tippen schließt */
    content: ""; position: fixed; inset: 0; z-index: 59; background: rgba(0, 0, 0, .55);
  }
  .nav-group { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: .45rem; padding-top: .45rem; }
  .nav-head { grid-column: 1 / -1; padding: .25rem .4rem .2rem; }
  .nav a, .nav .nav-group a {
    padding: .75rem .7rem; min-height: 48px; font-size: .95rem;
    background: var(--surface-2); border-radius: 10px; white-space: normal; line-height: 1.2;
  }
  .nav a.active { box-shadow: inset 0 0 0 1px var(--accent); }
  .nav .ni { font-size: 1.15rem; flex-shrink: 0; }
  .nav-pro { grid-column: 1 / -1; margin-top: .45rem; justify-content: center; }
  body.sheet-open { overflow: hidden; }
  body.sheet-open .theme-switch, body.sheet-open .preview-switch { display: none; }
  .card select, .card input { max-width: 100%; min-width: 0; }
  /* Filterzeilen: Felder teilen sich die Breite statt über den Rand zu ragen */
  .card-head > .row { width: 100%; min-width: 0; }
  .card-head > .row > select, .card-head > .row > input[type=search] { flex: 1 1 140px; width: auto !important; }

  /* Platz für die Menüleiste: Inhalt & schwebende Elemente nach oben schieben */
  .container { padding-bottom: calc(var(--tabbar-h) + 1.5rem + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(var(--tabbar-h) + 1rem + env(safe-area-inset-bottom)); max-width: calc(100% - 2rem); }
  body .theme-switch { bottom: calc(var(--tabbar-h) + .75rem + env(safe-area-inset-bottom)); }
  .preview-switch { bottom: calc(var(--tabbar-h) + .75rem + env(safe-area-inset-bottom)); }
  .update-banner { bottom: calc(var(--tabbar-h) + 1rem + env(safe-area-inset-bottom)); }
  .site-footer { padding-bottom: calc(var(--tabbar-h) + 1rem + env(safe-area-inset-bottom)); }
  .container:has(+ .site-footer) { padding-bottom: 1rem; }

  /* Dialoge als Blatt von unten – mit dem Daumen gut erreichbar */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%; max-height: 92dvh; border-radius: 18px 18px 0 0; border-bottom: none;
    padding: 1.2rem 1rem calc(1.2rem + env(safe-area-inset-bottom));
  }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; min-height: 44px; }

  /* Bedienung mit dem Finger: größere Ziele, kein Auto-Zoom auf iOS */
  input[type=text], input[type=date], input[type=search], input[type=email], input[type=password], input[type=number], select, textarea { font-size: 16px; }
  .btn { min-height: 40px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg button { flex-shrink: 0; padding: .45rem .8rem; }
  .table-wrap { -webkit-overflow-scrolling: touch; margin: 0 -.25rem; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .nav, .tabbar .ti { transition: none; }
}

/* =====================================================================
   RANGLISTE: gespeicherte Ranglisten, „Deine Strecken“, eigener Platz
   ===================================================================== */
.rk-quick { display: flex; flex-direction: column; gap: .8rem; margin-bottom: 1rem; }
.rk-quick-h { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); margin-bottom: .45rem; }
.rk-quick-h .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.rk-quick-list { display: flex; flex-wrap: wrap; gap: .45rem; }
.rk-saved { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); overflow: hidden; max-width: 100%; }
.rk-saved.on { border-color: var(--fav); background: color-mix(in srgb, var(--fav) 14%, var(--surface-2)); }
.rk-saved button { background: none; border: none; color: var(--text-primary); cursor: pointer; font: inherit; }
.rk-saved-go { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .3rem .45rem .8rem; min-width: 0; font-size: .9rem; }
.rk-saved-go span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-saved-del { padding: 0 .75rem 0 .45rem; color: var(--text-muted) !important; font-size: .8rem; }
.rk-saved-go:hover, .rk-saved-del:hover { background: var(--surface-3); }
.rk-saved-del:hover { color: var(--accent) !important; }
.rk-mytrack {
  display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .45rem .4rem .75rem; cursor: pointer; font: inherit; font-size: .9rem;
  color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; max-width: 100%;
}
.rk-mytrack:hover { background: var(--surface-3); }
.rk-mytrack.on { border-color: var(--series-1); background: color-mix(in srgb, var(--series-1) 14%, var(--surface-2)); }
.rk-mytrack > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-mypos { font-variant-numeric: tabular-nums; font-size: .8rem; padding: .12rem .5rem; border-radius: 999px; background: color-mix(in srgb, var(--series-1) 25%, transparent); color: var(--text-primary); }
.rk-mypos.top { background: color-mix(in srgb, var(--fav) 25%, transparent); font-size: .95rem; padding: 0 .35rem; }

/* Dein Platz */
.rk-me {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; margin-bottom: 1rem;
  border-color: color-mix(in srgb, var(--series-1) 55%, transparent);
  background: linear-gradient(100deg, color-mix(in srgb, var(--series-1) 16%, var(--surface-1)), var(--surface-1) 65%);
}
.rk-me-pos { display: flex; flex-direction: column; align-items: center; min-width: 5.5rem; line-height: 1.05; }
.rk-me-pos b { font-size: 2.3rem; font-variant-numeric: tabular-nums; }
.rk-me-pos small { color: var(--text-muted); font-size: .8rem; }
.rk-me-info { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.rk-me-h { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--series-1); }
.rk-me-time { font-size: 1.25rem; font-weight: 700; }

/* Eigene Zeile in der Tabelle */
tr.is-me td { background: color-mix(in srgb, var(--series-1) 16%, transparent) !important; }
tr.is-me td:first-child { box-shadow: inset 4px 0 0 var(--series-1); }
.me-badge { background: var(--series-1); color: #fff; border-color: transparent; font-weight: 700; }
tr.rk-gap-row td { text-align: center; color: var(--text-muted); font-size: .85rem; padding: .35rem; background: var(--surface-2); }
@keyframes rk-flash { 0%, 60% { background: color-mix(in srgb, var(--series-1) 45%, transparent); } }
tr.is-me.flash td { animation: rk-flash 1.6s ease-out; }
@media (prefers-reduced-motion: reduce) { tr.is-me.flash td { animation: none; } }

/* Weitere Filter: nur am Handy einklappbar */
.rk-toggle { display: none; }
@media (max-width: 760px) {
  .rk-toggle { display: inline-flex; grid-column: 1 / -1; justify-self: start; }
  .rk-grid.rk-collapsed > label:not(.rk-track-field) { display: none; }
  .rk-grid.rk-collapsed ~ .row { display: none; }
  /* Schnellauswahl: wischbar in einer Zeile statt vieler Zeilen */
  .rk-quick-list { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; scroll-snap-type: x proximity; }
  .rk-quick-list::-webkit-scrollbar { display: none; }
  .rk-quick-list > * { flex: none; max-width: 80vw; scroll-snap-align: start; }
  .rk-me { gap: .8rem; }
  .rk-me .btn { width: 100%; }
  .rk-me-pos b { font-size: 2rem; }
  .rk-table .hide-m { display: none; }
  .page-head #rk-save { width: 100%; }
}

/* Rangliste am Handy: nur Platz + Fahrer, Bestzeit & Details klein darunter (kein Querscrollen) */
.rk-sub { display: none; }
@media (max-width: 760px) {
  .rk-table th:nth-child(n+3), .rk-table td:nth-child(n+3) { display: none; }
  .rk-table td.pos { width: 2.6rem; vertical-align: top; padding-top: .7rem; }
  .rk-table td.rk-name { white-space: normal; padding-top: .55rem; padding-bottom: .55rem; }
  .rk-table td.rk-name > a { font-weight: 600; }
  .rk-sub { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; margin-top: .2rem; font-size: .8rem; color: var(--text-muted); line-height: 1.35; }
  .rk-sub b { color: var(--text-primary); font-size: .9rem; }
  .rk-sub > span + span::before { content: "·"; margin-right: .5rem; opacity: .6; }
  .rk-sub-bike { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rk-table thead { display: none; }
}
