/* ==========================================================================
   OpenLaps – Design System
   Dunkles, sportliches Theme · Akzent: Neon-Lime · Display-Schrift für Zahlen
   ========================================================================== */

:root {
  --bg: #0a0d12;
  --bg-elev: #10151d;
  --surface: #151c26;
  --surface-2: #1c2431;
  --border: #243040;
  --border-strong: #34425a;
  --text: #eef2f7;
  --text-muted: #93a0b4;
  --text-dim: #5f6c80;
  --accent: #c8ff4a;
  --accent-ink: #12200a;
  --accent-soft: rgba(200, 255, 74, 0.12);
  --live: #ff4d6d;
  --ok: #3ddc97;
  --warn: #ffb347;
  --gold: #ffd166;
  --silver: #cfd8e3;
  --bronze: #d98c5f;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --container: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(200, 255, 74, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(255, 77, 109, 0.06), transparent 60%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: 2.4rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 1em; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.small { font-size: .875rem; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.display { font-family: var(--display); font-weight: 700; letter-spacing: .01em; }
.inline { display: inline; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 2rem; }
.hide { display: none !important; }

.container { width: min(var(--container), 100% - 2rem); margin-inline: auto; }
.page { padding: 2.5rem 0 4rem; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10, 13, 18, 0.75);
  border-bottom: 1px solid var(--border);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand__mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); }
.nav { display: flex; align-items: center; gap: 1.25rem; }
.nav__link { color: var(--text-muted); font-weight: 500; }
.nav__link:hover { color: var(--text); text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .7rem 1.2rem; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; transition: transform .12s ease, background .15s ease, border-color .15s ease;
  background: var(--surface-2); color: var(--text); text-decoration: none !important; line-height: 1.2; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); background: #232d3c; }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: #d9ff70; }
.btn--danger { background: rgba(255, 77, 109, 0.14); color: #ff8aa0; border-color: rgba(255, 77, 109, 0.35); }
.btn--danger:hover { background: rgba(255, 77, 109, 0.24); }
.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--text-muted); }
.btn--ghost:hover { color: var(--text); background: var(--surface); }
.btn--sm { padding: .45rem .9rem; font-size: .875rem; }
.btn--lg { padding: .95rem 1.8rem; font-size: 1.05rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Cards / Panels ---------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0)) , var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem;
}
.card--tight { padding: 1rem 1.25rem; }
.card + .card { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.section { margin-top: 3rem; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section__head h2 { margin: 0; }
.eyebrow { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 700; }

/* ---------- Flash ---------- */
.flash { padding: .85rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem; font-weight: 500; border: 1px solid; }
.flash--ok { background: rgba(61, 220, 151, 0.1); border-color: rgba(61, 220, 151, 0.35); color: #9cf0cd; }
.flash--err { background: rgba(255, 77, 109, 0.1); border-color: rgba(255, 77, 109, 0.35); color: #ffa3b5; }

/* ---------- Badges / Pills ---------- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge--accent { background: var(--accent-soft); color: var(--accent); border-color: rgba(200,255,74,.3); }
.badge--live { background: rgba(255, 77, 109, 0.14); color: #ff8aa0; border-color: rgba(255,77,109,.35); }
.badge--ok { background: rgba(61, 220, 151, 0.12); color: #7fe8bd; border-color: rgba(61,220,151,.3); }
.badge--warn { background: rgba(255, 179, 71, 0.12); color: #ffc97a; border-color: rgba(255,179,71,.3); }
.badge--dim { opacity: .7; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(255,77,109,.6); animation: pulse 1.6s infinite; display: inline-block; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,77,109,.55);} 70% { box-shadow: 0 0 0 10px rgba(255,77,109,0);} 100% { box-shadow: 0 0 0 0 rgba(255,77,109,0);} }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; padding: 5rem 0 4rem;
  border-bottom: 1px solid var(--border);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, transparent 0 88%, rgba(255,255,255,.04) 88% 100%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.035) 0 14px, transparent 14px 28px);
  mask-image: linear-gradient(90deg, transparent 55%, black 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 55%, black 100%);
  pointer-events: none;
}
.hero__inner { position: relative; display: grid; gap: 2rem; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); align-items: center; }
.hero h1 { font-family: var(--display); font-size: clamp(3rem, 7vw, 5.6rem); font-weight: 800; text-transform: uppercase; line-height: .95; letter-spacing: .005em; margin-bottom: 1rem; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { font-size: 1.15rem; color: var(--text-muted); max-width: 46ch; }
.hero__actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.hero__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat__value { font-family: var(--display); font-size: 2.4rem; font-weight: 800; line-height: 1; color: var(--text); }
.stat__label { font-size: .8rem; color: var(--text-muted); margin-top: .35rem; text-transform: uppercase; letter-spacing: .08em; }
.stat--accent .stat__value { color: var(--accent); }

/* ---------- Event cards ---------- */
.event-card {
  display: grid; grid-template-columns: 84px 1fr; gap: 1.25rem; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem;
  transition: transform .15s ease, border-color .15s ease; color: inherit; text-decoration: none !important;
}
.event-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.event-card--live { border-color: rgba(255,77,109,.5); box-shadow: 0 0 0 1px rgba(255,77,109,.25), 0 12px 40px rgba(255,77,109,.08); }
.date-block { text-align: center; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: .6rem .3rem; }
.date-block__day { font-family: var(--display); font-size: 2.2rem; font-weight: 800; line-height: 1; }
.date-block__month { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.event-card__title { font-size: 1.25rem; font-weight: 700; margin: .15rem 0 .35rem; }
.event-card__meta { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; color: var(--text-muted); font-size: .9rem; }
.event-card__meta strong { color: var(--text); font-weight: 600; }

/* ---------- Event header ---------- */
.event-head { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2rem; align-items: end; margin-bottom: 2rem; }
.event-head h1 { font-family: var(--display); font-size: clamp(2.4rem, 5vw, 4rem); text-transform: uppercase; line-height: .95; font-weight: 800; }
.event-head__meta { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; color: var(--text-muted); margin-top: .75rem; }
.event-head__meta span strong { color: var(--text); }
.subnav { display: flex; gap: .35rem; border-bottom: 1px solid var(--border); margin-bottom: 1.75rem; overflow-x: auto; }
.subnav a { padding: .7rem 1rem; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.active { color: var(--accent); border-bottom-color: var(--accent); }

.fact-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.fact { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem 1rem; }
.fact__label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); }
.fact__value { font-family: var(--display); font-size: 1.6rem; font-weight: 700; margin-top: .1rem; }
.prose { color: var(--text-muted); white-space: pre-line; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); font-weight: 700; background: var(--bg-elev); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.02); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.small { white-space: nowrap; }
.bib { display: inline-grid; place-items: center; min-width: 46px; height: 32px; padding: 0 .5rem; border-radius: 7px; background: #fff; color: #0a0d12; font-family: var(--display); font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; }
.rank { font-family: var(--display); font-weight: 800; font-size: 1.3rem; }
.rank--1 { color: var(--gold); } .rank--2 { color: var(--silver); } .rank--3 { color: var(--bronze); }
.time { font-family: var(--display); font-weight: 700; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.laps-bar { display: inline-flex; gap: 3px; }
.laps-bar i { width: 10px; height: 10px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border-strong); }
.laps-bar i.done { background: var(--accent); border-color: var(--accent); }
.row-finished td:first-child { border-left: 3px solid var(--accent); }
.row-running td:first-child { border-left: 3px solid var(--live); }
.row-dnf { opacity: .55; }
.video-link { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; font-weight: 600; }

/* ---------- Filter chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chip { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--border-strong); background: transparent; color: var(--text-muted); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Recent finishers strip ---------- */
.finishers { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .9rem; margin-bottom: 2rem; }
.finisher { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; animation: slidein .4s ease; }
.finisher video, .finisher .finisher__novideo { width: 100%; aspect-ratio: 16 / 9; background: #000; display: block; object-fit: cover; }
.finisher__novideo { display: grid; place-items: center; color: var(--text-dim); font-size: .8rem; background: repeating-linear-gradient(45deg, #0e1218 0 10px, #10151d 10px 20px); }
.finisher__body { padding: .6rem .8rem; display: flex; gap: .6rem; align-items: center; min-width: 0; }
.finisher__body > div { min-width: 0; }
.finisher__name { font-weight: 600; line-height: 1.2; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finisher__meta { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.finisher__time { margin-left: auto; text-align: right; flex-shrink: 0; }
.finisher__time .time { font-size: 1.1rem; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: none;} }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1rem; }
.form--narrow { max-width: 520px; }
.field { display: grid; gap: .35rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.field .hint { font-size: .78rem; color: var(--text-dim); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=file], select, textarea {
  width: 100%; padding: .7rem .85rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=date], input[type=time] { color-scheme: dark; }
textarea { min-height: 120px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; align-items: start; }
.field { align-content: start; }
.check { display: flex; align-items: center; gap: .6rem; font-size: .95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem 1.5rem; margin: 0; }
legend { padding: 0 .5rem; font-weight: 700; color: var(--accent); font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; padding: .45rem .6rem; }
.inline-form input.w-sm { width: 90px; }
.inline-form input.w-md { width: 200px; }
.inline-form select { width: auto; padding: .45rem 2rem .45rem .6rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Auth ---------- */
.auth { max-width: 460px; margin: 3rem auto; }
.auth .card { padding: 2rem; }
.auth h1 { font-size: 1.8rem; }

/* ---------- Timeline/steps ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; counter-reset: step; }
.step { position: relative; padding: 1.25rem 1.25rem 1.25rem 3.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.step::before { counter-increment: step; content: counter(step, decimal-leading-zero); position: absolute; left: 1.1rem; top: 1.05rem; font-family: var(--display); font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.step h3 { margin-bottom: .3rem; }
.step p { margin: 0; color: var(--text-muted); font-size: .92rem; }

/* ---------- Cockpit ---------- */
.cockpit-status { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.clock { font-family: var(--display); font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .92rem; }
.kv dt { color: var(--text-dim); } .kv dd { margin: 0; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
pre { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; overflow-x: auto; }
code.key { background: var(--bg-elev); border: 1px solid var(--border); padding: .2rem .45rem; border-radius: 6px; user-select: all; }
details summary { cursor: pointer; font-weight: 600; color: var(--text-muted); }
details[open] summary { margin-bottom: .75rem; }

/* ---------- Live board ---------- */
.board { padding: 2rem; min-height: 100vh; background: var(--bg); }
.board__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.board__head h1 { font-family: var(--display); text-transform: uppercase; font-size: 3rem; margin: 0; }
.board__grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.5rem; }
.board .clock { font-size: 4.5rem; }
.board table { font-size: 1.25rem; }

.board .time { font-size: 1.7rem; }
.board .bib { font-size: 1.5rem; height: 40px; min-width: 60px; }
.board td strong { white-space: nowrap; }
.board .finisher__name { font-size: 1.1rem; }
.board .finisher__time .time { font-size: 1.6rem; }
.board .finishers { grid-template-columns: 1fr; }
.board .finisher video { aspect-ratio: 16/9; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 1.5rem 0; color: var(--text-dim); font-size: .85rem; }
.footer__inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.footer a { color: var(--text-muted); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

@media (max-width: 800px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero { padding: 3rem 0 2.5rem; }
  .event-head { grid-template-columns: 1fr; }
  .board__grid { grid-template-columns: 1fr; }

  .nav { gap: .75rem; }
  .nav__link { display: none; }
}

/* ---------- Cockpit: Aktionszeile unter einem Teilnehmer ---------- */
tr.actions-row td { background: var(--bg-elev); padding: .8rem 1rem; }
