:root {
  --bg: #072643; --bg-2: #0b3358; --card: rgba(255, 255, 255, 0.05); --line: rgba(154, 186, 217, 0.25);
  --text: #e8f1fa; --muted: #9db6cf; --gold: #e7ac12; --blue: #409cff; --link: #7cc0ff; --yes: #3ddc84; --no: #ff7b7b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0; min-height: 100vh;
  background: var(--bg) radial-gradient(ellipse at top, var(--bg-2) 0%, var(--bg) 60%) no-repeat;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
}

a { color: var(--link); text-decoration: none; }
a:hover, a:focus-visible { color: var(--gold); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* Header + Navigation */
.site-header { text-align: center; padding: 28px 16px 8px; }
.logo img { width: 100%; max-width: 240px; height: auto; display: inline-block; }
.nav { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 18px 0 8px; padding: 0; list-style: none; }
.nav a { display: block; padding: 8px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 600; font-size: 0.95rem; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--gold); border-color: var(--gold); color: #1a1200; text-decoration: none; }

/* Sections */
main { padding-bottom: 24px; }
section { margin-top: 40px; scroll-margin-top: 16px; }
h2 { margin: 0 0 16px; color: var(--gold); font-size: 1.5rem; letter-spacing: 0.02em; }

/* Naechster Start */
.next-up { display: none; margin: 0 0 16px; padding: 14px 18px; border-radius: 12px; border: 1px solid rgba(231, 172, 18, 0.5); background: rgba(231, 172, 18, 0.12); }
.next-up.show { display: block; }
.next-up .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); }
.next-up .what { font-size: 1.15rem; font-weight: 700; }
.next-up .when { color: var(--muted); }

/* Tabelle */
.table-card { border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; background: var(--card); }
table.races { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.races th { background: var(--blue); color: #fff; text-align: left; font-weight: 600; padding: 11px 12px; white-space: nowrap; }
.races td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.races tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.03); }
.races tbody tr:hover { background: rgba(64, 156, 255, 0.12); }
.races .c { text-align: center; }
.races td.time { font-variant-numeric: tabular-nums; }
.races tr.past td { opacity: 0.6; }
.races tr.next td { background: rgba(231, 172, 18, 0.18); }
.races tr.next td:first-child { box-shadow: inset 4px 0 0 var(--gold); }
.badge { font-weight: 700; font-size: 1.05rem; }
.badge.yes { color: var(--yes); }
.badge.no { color: var(--no); }

/* Video */
.video-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #000; max-width: 760px; margin: 0 auto; }
.video-card video { display: block; width: 100%; height: auto; }

/* Regeln */
.rules { list-style: none; padding: 0; margin: 0; counter-reset: rule; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.rules li { counter-increment: rule; display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.rules li::before { content: counter(rule); flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #1a1200; font-weight: 800; }

/* Mediathek-Teaser */
.teaser { text-align: center; }
.teaser img { width: 100%; max-width: 300px; height: auto; border-radius: 12px; border: 1px solid var(--line); }
.teaser a:hover img { border-color: var(--gold); }

/* Footer */
.site-footer { margin-top: 48px; padding: 24px 16px 36px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 0.85rem; }
.site-footer img { display: block; margin: 0 auto 10px; opacity: 0.85; }
.site-footer a:hover img { opacity: 1; }

/* Player (Mediathek) */
.player { max-width: 640px; margin: 0 auto; }
.now-playing { padding: 18px; border-radius: 14px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--card); }
.np-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.np-title { font-size: 1.2rem; font-weight: 700; margin-top: 2px; }
.np-artist { color: var(--muted); font-size: 0.9rem; }
.controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0 6px; }
.ctrl { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; display: grid; place-items: center; }
.ctrl:hover { background: rgba(255, 255, 255, 0.1); }
.ctrl.main { width: 56px; height: 56px; background: var(--gold); border-color: var(--gold); color: #1a1200; }
.ctrl.main:hover { filter: brightness(1.1); }
.seek { display: flex; align-items: center; gap: 10px; }
.seek input[type="range"] { flex: 1; accent-color: var(--gold); height: 24px; cursor: pointer; }
.time-label { font-size: 0.8rem; color: var(--muted); min-width: 36px; font-variant-numeric: tabular-nums; }
.time-label.end { text-align: right; }
.tracks { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.track { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
.track:hover { background: rgba(255, 255, 255, 0.09); }
.track.active { border-color: var(--gold); background: rgba(231, 172, 18, 0.14); }
.track-num { min-width: 22px; text-align: center; color: var(--muted); font-size: 0.85rem; }
.track-info { flex: 1; min-width: 0; }
.track-name, .track-artist { display: block; }
.track-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track.active .track-name { color: var(--gold); }
.track-artist { font-size: 0.8rem; color: var(--muted); }
.track-state { width: 16px; color: var(--gold); text-align: center; }
.back { text-align: center; margin-top: 28px; }

/* Mobile: Tabelle als Karten */
@media (max-width: 760px) {
  .races thead { position: absolute; left: -9999px; }
  .races, .races tbody, .races td { display: block; width: 100%; }
  .races tr { display: flex; flex-direction: column; padding: 10px 14px; border-top: 1px solid var(--line); }
  .races tr:first-child { border-top: 0; }
  .races td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .races td:empty { display: none; }
  .races td::before { content: attr(data-label); color: var(--muted); font-size: 0.8rem; text-align: left; flex: 0 0 auto; }
  .races td.name { order: -1; font-size: 1.05rem; font-weight: 700; justify-content: flex-start; text-align: left; }
  .races td.name::before { display: none; }
  .races tr.next td:first-child { box-shadow: none; }
  .races tr.next { box-shadow: inset 4px 0 0 var(--gold); }
  .rules { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Fixierte Navigation */
.topnav { position: sticky; top: 0; z-index: 50; padding: 10px 16px; margin-top: 8px; background: rgba(7, 38, 67, 0.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topnav .nav { margin: 0; }
section { scroll-margin-top: 84px; }

/* Nach-oben-Button */
.to-top { position: fixed; right: 18px; bottom: 18px; z-index: 60; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--gold); color: #1a1200; cursor: pointer; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity 0.2s, transform 0.2s, visibility 0.2s; }
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { filter: brightness(1.1); }

@media (max-width: 520px) {
  .topnav { padding: 8px 10px; }
  .topnav .nav { gap: 6px; }
  .nav a { padding: 7px 12px; font-size: 0.85rem; }
}
@media (prefers-reduced-motion: reduce) { .to-top { transition: none; } }

/* Fruehere Termine einklappen */
.races tr.older-hidden { display: none !important; }
.toggle-past { display: block; width: 100%; margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.toggle-past:hover, .toggle-past:focus-visible { border-color: var(--gold); color: var(--gold); }

/* Mitglieder */
.members { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.member { border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; text-align: center; }
.member img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; background: #0b3358; }
.member h3 { margin: 12px 0 2px; color: var(--gold); font-size: 1.25rem; }
.member p { margin: 0 0 14px; color: var(--muted); font-size: 0.85rem; }

@media (max-width: 520px) {
  .nav a { padding: 6px 10px; font-size: 0.82rem; }
}

/* Ueberschriften zentriert */
h2 { text-align: center; }

/* Mitglieder ohne M */
.members-sub { text-align: center; color: var(--muted); font-size: 1.1rem; font-weight: 600; margin: 40px 0 20px; padding-top: 24px; border-top: 1px dashed var(--line); }
.members-2 { max-width: 680px; margin: 0 auto; }

/* Foto-Fenster */
.member-name { color: inherit; border-bottom: 1px dotted currentColor; }
.member-name:hover, .member-name:focus-visible { text-decoration: none; }
.photo-dialog { border: 0; padding: 0; background: transparent; width: 92vw; max-width: 720px; overflow: visible; color: var(--text); }
.photo-dialog::backdrop { background: rgba(3, 14, 26, 0.85); }
.photo-box { position: relative; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.photo-box img { display: block; max-width: 100%; max-height: 78vh; margin: 0 auto; border-radius: 8px; }
.photo-box h3 { margin: 10px 0 2px; color: var(--gold); }
.photo-close { position: absolute; top: -14px; right: -10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--gold); color: #1a1200; font-size: 1.6rem; font-weight: 700; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.photo-close:hover { filter: brightness(1.1); }

.members-2 { max-width: none; }
