/* =====================================================================
   TIDER (tider.hrcrvintercup.dk) — træningstavle i HRCR-stil · udkast v3 "Smal"
   TV: 16:9-scene. Under 1280 px tegnes den i 1280 × 720 og skaleres ned.
   Telefon (html.is-phone): almindelig side, der scroller.
   Venstre: dagens kørere. Højre: seneste runs som smalle kort med omgangene
   i én kolonne (fra første omgang til sluttiden). Klik på en kører → profil.
   Top: banerekord pr. klasse (Mod vises kun, når der kører en mod-bil).
   ===================================================================== */
:root {
  color-scheme: dark;
  --bg: #040918;
  --line: rgba(110, 150, 255, .14);
  --line-2: rgba(120, 165, 255, .3);
  --blue: #2a6dff;
  --blue-hi: #5aa2ff;
  --violet: #7a5cff;
  --pink: #ff2fa8;
  --pink-hi: #ff6fc6;
  --gold: #ffcc33;
  --gold-hi: #ffe7a3;
  --red: #ff6b86;
  --ink: #f3f7ff;
  --ink-2: #b6c4e4;
  --ink-3: #7c8db6;
  --blue-panel: linear-gradient(180deg, #2a6dff, #0d3bd1);
  --panel-grad: linear-gradient(170deg, rgba(16, 36, 90, .82), rgba(7, 17, 44, .7));
  --font: 'Saira', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .1, 1);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.4; -webkit-font-smoothing: antialiased; overflow: hidden; }
p, h1, h2, ol, ul { margin: 0; }
ol, ul { list-style: none; padding: 0; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #19e0ff; outline-offset: 2px; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
svg use { pointer-events: none; }

/* ---------- Scenen ---------- */
.wrap { height: 100%; display: grid; place-items: center; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); }
html.is-fs .wrap { padding: 0; }
.sizer { position: relative; overflow: hidden; width: var(--vw, 1280px); height: var(--vh, 720px); }
.stage {
  --u: calc(var(--sw, 1280px) / 100);
  position: absolute; left: 0; top: 0; transform-origin: 0 0; isolation: isolate; overflow: hidden;
  width: var(--sw, 1280px); height: var(--sh, 720px);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: calc(var(--u) * 1.1);
  padding: calc(var(--u) * 1.2) calc(var(--u) * 1.8) calc(var(--u) * .7);
  background:
    radial-gradient(38% 55% at 8% 34%, rgba(42, 109, 255, .18), transparent 72%),
    radial-gradient(34% 46% at 94% 12%, rgba(255, 47, 168, .11), transparent 70%),
    linear-gradient(180deg, #060e28, #040918 55%, #030713);
  font-size: calc(var(--u) * .9);
}
.num { font-weight: 800; font-style: italic; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chrome { background: linear-gradient(180deg, #fff 0%, #eef5ff 44%, #bcd6ff 56%, #5aa2ff 80%, #2a6dff 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chrome-gold { background: linear-gradient(180deg, #fff 0%, #fff6dc 42%, #ffd36b 60%, #ff9a1f 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.label { font-stretch: 75%; font-weight: 700; letter-spacing: .26em; text-transform: uppercase; font-size: calc(var(--u) * .62); color: var(--ink-3); white-space: nowrap; }

.portrait { position: relative; display: block; overflow: hidden; flex: none; background: radial-gradient(70% 60% at 50% 40%, #12286a, #070f2c); clip-path: polygon(16% 0, 100% 0, 84% 100%, 0 100%); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; z-index: 1; }
.portrait .sil { position: absolute; inset: 0; width: 100%; height: 100%; transform: scale(1.18) translateY(9%); }
.portrait::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: max(2px, 6%); z-index: 2; background: linear-gradient(90deg, var(--blue), var(--violet) 55%, var(--pink)); }
.portrait.unknown .sil { opacity: .55; }
.icon-btn { display: inline-grid; place-items: center; flex: none; cursor: pointer; border: 0; width: calc(var(--u) * 2.4); height: calc(var(--u) * 2.1); color: var(--ink-2); background: rgba(42, 109, 255, .12); box-shadow: inset 0 0 0 1px var(--line-2); clip-path: polygon(calc(var(--u) * .4) 0, 100% 0, calc(100% - calc(var(--u) * .4)) 100%, 0 100%); transition: background .2s, opacity .5s; }
.icon-btn:hover { background: rgba(42, 109, 255, .3); color: #fff; }
.icon-btn svg { width: 55%; height: 60%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fit { font-size: calc(var(--fit, 1) * 1em); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 111, 198, .75); } 100% { box-shadow: 0 0 0 .7em rgba(255, 111, 198, 0); } }

/* Klasse-mærker (kun Modified vises; Stock er standard) og "Mulig mod?" */
.ktag { display: inline-block; flex: none; padding: .08em .55em .04em .45em; font-weight: 900; font-style: italic; letter-spacing: .06em; text-transform: uppercase; line-height: 1.2; color: #fff; clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%); }
.ktag.mod2 { background: linear-gradient(90deg, #ff8a1f, #ff2fa8); }
.ktag.mod4 { background: linear-gradient(90deg, #ff2f5a, #b02aff); }
.ktag.flag { background: transparent; color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
button.ktag.flag { cursor: pointer; border: 0; font-family: inherit; animation: flagPulse 1.8s ease-in-out infinite; }
button.ktag.flag:hover { background: var(--gold); color: #2a1a00; animation: none; }
@keyframes flagPulse { 50% { background: rgba(255, 204, 51, .28); } }
.ktag.new { background: rgba(120, 165, 255, .16); color: var(--ink-2); font-style: normal; }
.chrome-mod { background: linear-gradient(180deg, #fff 0%, #ffe6d2 42%, #ff9a5a 62%, #ff2fa8 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* =====================================================================
   TOP
   ===================================================================== */
.top { display: flex; align-items: center; gap: calc(var(--u) * 1.5); min-width: 0; padding-bottom: calc(var(--u) * .8); border-bottom: 1px solid var(--line-2); }
.brand img { height: calc(var(--u) * 3); width: auto; filter: drop-shadow(0 0 calc(var(--u) * 1) rgba(42, 109, 255, .3)); }
.lay { flex: 1 1 auto; min-width: 0; padding-left: calc(var(--u) * 1.5); border-left: 1px solid var(--line-2); }
.lay .label.past { color: var(--gold); }
/* Dagvælgeren i toppen (en knap) */
button.lay { display: block; text-align: left; font: inherit; color: inherit; background: none; border: 0; border-left: 1px solid var(--line-2); cursor: pointer; }
button.lay > span { display: block; }
button.lay .label::after { content: ' ▾'; color: var(--blue-hi); }
button.lay:hover .lay-name, button.lay:focus-visible .lay-name { color: #fff; text-shadow: 0 0 .6em rgba(63, 140, 255, .6); }
button.lay:disabled { cursor: default; }
button.lay:disabled .label::after { content: none; }
.tracks .st.race { color: var(--gold); }
.tracks.days { max-height: calc(var(--u) * 24); }
/* Ingen har kørt i dag: knapper til de seneste dage */
.grid-empty { align-content: center; gap: 1.2em; }
.grid-empty .ge-k { margin-top: .8em; font-size: .8em; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.ge-days { display: flex; flex-wrap: wrap; justify-content: center; gap: .6em; }
.ge-days button { cursor: pointer; border: 0; font: inherit; color: var(--ink); background: rgba(14, 31, 77, .75); box-shadow: inset 0 0 0 1px var(--line-2); padding: .7em 1.2em; display: flex; flex-direction: column; gap: .25em; text-align: left; min-width: 13em; }
.ge-days button:hover, .ge-days button:focus-visible { box-shadow: inset 0 0 0 1px var(--blue-hi); }
.ge-days button b { font-size: 1.05em; font-weight: 900; font-style: italic; text-transform: none; color: #fff; }
.ge-days button small { font-size: .8em; color: var(--ink-3); }
.rows-empty .ge-days { margin-top: .8em; }
.lay-name { margin-top: calc(var(--u) * .2); font-weight: 900; font-style: italic; font-stretch: 108%; text-transform: uppercase; font-size: calc(var(--u) * 2.1); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: .1em; }
/* Banerekorder pr. klasse: Stock altid, Mod kun når en mod-bil har kørt i dag */
.recs-top { flex: none; display: flex; gap: calc(var(--u) * 1.5); min-width: 0; }
.rb { flex: none; padding-left: calc(var(--u) * .9); border-left: calc(var(--u) * .22) solid var(--gold); }
.rb > .label { color: #ffd98a; }
.rb > .label b { color: #fff; font-weight: 800; }
.rb.mod { border-left-color: #ff7a45; }
.rb.mod > .label { color: #ffb37a; }
.rb.day { border-left-color: var(--blue-hi); }
.rb.day > .label { color: #a9c8ff; }
.rb-v { display: flex; gap: calc(var(--u) * 1.2); margin-top: calc(var(--u) * .3); }
.rv { min-width: 0; }
.rv .k { display: block; font-stretch: 75%; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; font-size: calc(var(--u) * .5); color: var(--ink-3); }
.rv .n { display: block; margin-top: calc(var(--u) * .05); font-size: calc(var(--u) * 1.55); line-height: 1; padding-right: .08em; }
.rv .n i { opacity: .55; margin: 0 .04em; }
.rv .n.none { font-size: calc(var(--u) * 1.1); color: var(--ink-3); background: none; -webkit-text-fill-color: var(--ink-3); }
.rv .w { display: block; margin-top: calc(var(--u) * .15); font-size: calc(var(--u) * .6); font-weight: 600; color: var(--ink-2); white-space: nowrap; max-width: calc(var(--u) * 10.5); overflow: hidden; text-overflow: ellipsis; }
.rb.is-in { animation: rbIn .7s var(--ease) both; }
@keyframes rbIn { from { opacity: 0; transform: translateX(calc(var(--u) * 2)); } }
.rv.is-new { animation: recNew 2.6s var(--ease); }
@keyframes recNew { 0%, 30% { filter: brightness(1.9) drop-shadow(0 0 calc(var(--u) * 1) #ffcc33); } }
.admin-chip { display: inline-block; margin-right: .5em; padding: .1em .45em; font-style: normal; font-weight: 800; font-size: .72em; letter-spacing: .08em; text-transform: uppercase; color: #2a1a00; background: var(--gold); }
/* Bane-knappen (admin): ikon og tekst på én linje, samme form som de andre knapper i toppen */
#baneBtn { display: inline-flex; align-items: center; gap: .5em; width: auto; padding: 0 calc(var(--u) * 1) 0 calc(var(--u) * .85); font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .04em; font-size: calc(var(--u) * .72); white-space: nowrap; color: var(--ink); }
#baneBtn svg { flex: none; width: calc(var(--u) * 1); height: calc(var(--u) * 1); stroke-width: 2.2; }
.ctrls { flex: none; display: flex; align-items: center; gap: calc(var(--u) * .9); margin-left: auto; align-self: center; }
.modes, .views { flex: none; display: flex; gap: calc(var(--u) * .25); transition: opacity .5s; }
.views button { cursor: pointer; border: 0; height: calc(var(--u) * 1.9); padding: 0 calc(var(--u) * .85); font-weight: 800; font-size: calc(var(--u) * .74); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; color: var(--ink-2); background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); clip-path: polygon(calc(var(--u) * .4) 0, 100% 0, calc(100% - calc(var(--u) * .4)) 100%, 0 100%); transition: background .25s, color .25s; }
.views button:hover { color: #fff; background: rgba(122, 92, 255, .18); }
.views button[aria-pressed="true"] { color: #fff; background: linear-gradient(90deg, var(--violet), #b04bff); box-shadow: none; }
.modes button { cursor: pointer; border: 0; height: calc(var(--u) * 1.9); padding: 0 calc(var(--u) * .85); font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .03em; font-size: calc(var(--u) * .78); white-space: nowrap; color: var(--ink-2); background: rgba(42, 109, 255, .1); box-shadow: inset 0 0 0 1px var(--line-2); clip-path: polygon(calc(var(--u) * .4) 0, 100% 0, calc(100% - calc(var(--u) * .4)) 100%, 0 100%); transition: background .25s, color .25s; }
.modes button:hover { background: rgba(42, 109, 255, .26); color: #fff; }
.modes button[aria-pressed="true"] { background: var(--blue-panel); box-shadow: none; color: #fff; }
.clock { flex: none; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; font-size: calc(var(--u) * 3.1); line-height: .95; padding-right: .06em; filter: drop-shadow(0 0 calc(var(--u) * .8) rgba(42, 109, 255, .45)); }
.clock small { font-size: .42em; }
.stage.is-fs.is-still { cursor: none; }
.stage.is-fs.is-still :is(.modes, #fsBtn, #recBtn) { opacity: 0; pointer-events: none; transition: opacity .9s; }

/* =====================================================================
   TAVLEN
   ===================================================================== */
.board { display: grid; grid-template-columns: minmax(0, 24fr) minmax(0, 76fr); gap: calc(var(--u) * 1.5); min-height: 0; }
.head { display: flex; align-items: baseline; gap: calc(var(--u) * 1); margin-bottom: calc(var(--u) * .5); white-space: nowrap; min-width: 0; }
.head h2 { font-weight: 900; font-style: italic; text-transform: uppercase; font-size: calc(var(--u) * 1.2); line-height: 1; }
.head .label { overflow: hidden; text-overflow: ellipsis; }
.rows:empty { display: none; }
.rows-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--ink-3); border: 1px dashed var(--line-2); padding: calc(var(--u) * 2); }

/* ---------- Venstre: dagens kørere ---------- */
.day { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.cols, .row { --c-pos: calc(var(--u) * 2.1); --c-lap: calc(var(--u) * 4); --c-run: calc(var(--u) * 6.3); }
.cols { display: flex; padding: 0 calc(var(--u) * .8) calc(var(--u) * .3) 0; }
.cols span:first-child { flex: 1 1 auto; }
.cols .c2 { width: var(--c-lap); text-align: right; }
.cols .c3 { width: var(--c-run); text-align: right; color: #ffd98a; }
.rows { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: calc(var(--u) * .26); }
.ghead { flex: none; display: flex; align-items: center; gap: .8em; padding: calc(var(--u) * .25) 0 calc(var(--u) * .1); font-size: calc(var(--u) * .62); }
.ghead::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.ghead.mod { color: #ffb37a; }
.row {
  position: relative; flex: 1 1 0; min-height: 0; max-height: calc(var(--u) * 4.4); min-width: 0; container-type: size; cursor: pointer;
  display: flex; align-items: stretch;
  background: linear-gradient(90deg, rgba(14, 31, 77, .85), rgba(7, 17, 44, .55));
  clip-path: polygon(0 0, 100% 0, calc(100% - calc(var(--u) * .55)) 100%, 0 100%);
}
.row::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; z-index: 3; }
.row:hover::before { box-shadow: inset 0 0 0 1px var(--blue-hi); }
.row .pos { flex: none; width: var(--c-pos); display: grid; place-items: center; padding-right: calc(var(--u) * .35); background: var(--blue-panel); clip-path: polygon(0 0, 100% 0, calc(100% - calc(var(--u) * .6)) 100%, 0 100%); font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; font-size: clamp(9px, 46cqh, calc(var(--u) * 1.4)); line-height: 1; }
.row.p1 .pos { background: linear-gradient(160deg, #fff3b0, #ffcc33 45%, #c98a00); color: #2a1a00; }
.row.p2 .pos { background: linear-gradient(160deg, #fff, #c9d4ee 45%, #7486b8); color: #10183a; }
.row.p3 .pos { background: linear-gradient(160deg, #ffd2a8, #e08a4a 45%, #8c4a1c); color: #2a1200; }
.row.no-res .pos { background: rgba(42, 109, 255, .22); color: var(--ink-3); }
.row.is-unknown { background: linear-gradient(90deg, rgba(12, 22, 52, .7), rgba(7, 17, 44, .4)); }
.row.is-unknown .pos { background: rgba(120, 165, 255, .1); color: var(--ink-3); }
.row .portrait { height: 100%; width: min(96cqh, calc(var(--u) * 3.1)); margin-left: calc(var(--u) * -.2); }
.row .nm { flex: 1 1 auto; min-width: 0; align-self: center; display: flex; align-items: center; gap: .45em; padding: 0 calc(var(--u) * .3) 0 calc(var(--u) * .4); font-weight: 800; font-size: clamp(10px, 40cqh, calc(var(--u) * 1.15)); line-height: 1.1; white-space: nowrap; }
.row .nm b { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 800; font-size: calc(var(--fit, 1) * 1em); }
.row .nm .ktag { font-size: max(8px, .5em); }
.row.is-unknown .nm b { color: var(--ink-2); font-weight: 700; }
.row.is-on .nm::before { content: ''; flex: none; width: .5em; height: .5em; border-radius: 50%; background: var(--pink-hi); animation: pulse 1.6s ease-out infinite; }
.row .v { flex: none; display: flex; align-items: center; justify-content: flex-end; font-weight: 800; font-style: italic; font-variant-numeric: tabular-nums; font-stretch: 82%; white-space: nowrap; font-size: clamp(10px, 40cqh, calc(var(--u) * 1.05)); }
.row .v-lap { width: var(--c-lap); color: var(--ink-2); }
.row .v-run { width: var(--c-run); padding-right: calc(var(--u) * .8); }
.row .v span { padding: .04em .32em .02em .3em; }
.row .v i { font-style: italic; opacity: .5; margin: 0 .05em; }
.row .v .none { color: var(--ink-3); font-weight: 600; }
.row .v-lap.is-top span { color: #fff; background: linear-gradient(90deg, var(--pink), var(--violet)); clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
.row .v-run.is-top span { color: #2a1a00; background: linear-gradient(90deg, #ffe7a3, #ffb534); clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
.row::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 2; background: linear-gradient(100deg, transparent 30%, rgba(140, 200, 255, .18) 48%, rgba(255, 255, 255, .26) 50%, rgba(140, 200, 255, .18) 52%, transparent 70%); background-size: 250% 100%; }
.row.is-pass::after { animation: sweep .9s var(--ease); }
@keyframes sweep { 0% { opacity: 1; background-position: 100% 0; } 100% { opacity: 1; background-position: -50% 0; } }

/* ---------- Højre: seneste runs ---------- */
.runs { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.runs .head { align-items: center; }

/* ---------- Enkel visning: bedste omgang og bedste run, store linjer i 1–3 spalter ---------- */
.simple { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.simple .head { align-items: center; }
.s-heads { display: grid; grid-template-columns: repeat(var(--sc, 1), minmax(0, 1fr)); column-gap: calc(var(--u) * 1.6); padding-bottom: calc(var(--u) * .3); font-size: var(--sf, 16px); }
.s-heads div, .s-row { display: grid; grid-template-columns: 2.1em 2.4em minmax(0, 1fr) 5.2em 7.6em; column-gap: .7em; align-items: center; }
.s-heads span { font-size: max(9px, .42em); text-align: right; }
.s-heads span:nth-child(3) { text-align: left; }
.s-heads span.run { color: #ffd98a; }
.s-list { flex: 1 1 auto; min-height: 0; display: grid; grid-auto-flow: column; grid-template-columns: repeat(var(--sc, 1), minmax(0, 1fr)); grid-template-rows: repeat(var(--sr, 12), minmax(0, 1fr)); column-gap: calc(var(--u) * 1.6); row-gap: calc(var(--u) * .22); font-size: var(--sf, 16px); }
.s-row { position: relative; min-height: 0; cursor: pointer; background: linear-gradient(90deg, rgba(14, 31, 77, .85), rgba(7, 17, 44, .5)); clip-path: polygon(0 0, 100% 0, calc(100% - .5em) 100%, 0 100%); }
.s-row::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; }
.s-row:hover::before { box-shadow: inset 0 0 0 1px var(--blue-hi); }
.s-row .p { align-self: stretch; display: grid; place-items: center; padding-right: .25em; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; background: var(--blue-panel); clip-path: polygon(0 0, 100% 0, calc(100% - .45em) 100%, 0 100%); }
.s-row.p1 .p { background: linear-gradient(160deg, #fff3b0, #ffcc33 45%, #c98a00); color: #2a1a00; }
.s-row.p2 .p { background: linear-gradient(160deg, #fff, #c9d4ee 45%, #7486b8); color: #10183a; }
.s-row.p3 .p { background: linear-gradient(160deg, #ffd2a8, #e08a4a 45%, #8c4a1c); color: #2a1200; }
.s-row.no-res .p { background: rgba(42, 109, 255, .22); color: var(--ink-3); }
.s-row.is-unknown .p { background: rgba(120, 165, 255, .1); color: var(--ink-3); }
.s-row .portrait { align-self: stretch; height: auto; }
.s-row .n { min-width: 0; display: flex; align-items: center; gap: .5em; font-weight: 800; white-space: nowrap; }
.s-row .n b { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 800; }
.s-row.is-unknown .n b { color: var(--ink-2); font-weight: 700; }
.s-row .n .ktag { font-size: .5em; }
.s-row.is-on .n::before { content: ''; flex: none; width: .45em; height: .45em; border-radius: 50%; background: var(--pink-hi); animation: pulse 1.6s ease-out infinite; }
.s-row .t { justify-self: end; font-weight: 800; font-style: italic; font-variant-numeric: tabular-nums; white-space: nowrap; padding: .04em .3em .02em; }
.s-row .t i { opacity: .5; margin: 0 .05em; }
.s-row .t.lap { color: var(--ink-2); }
.s-row .t.run { margin-right: .5em; font-weight: 900; }
.s-row .t.none { color: var(--ink-3); font-weight: 600; }
.s-row .t.lap.is-top { color: #fff; background: linear-gradient(90deg, var(--pink), var(--violet)); clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
.s-row .t.run.is-top { color: #2a1a00; background: linear-gradient(90deg, #ffe7a3, #ffb534); clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
.s-g { display: flex; align-items: flex-end; gap: .8em; min-height: 0; padding-bottom: .15em; font-size: max(9px, .42em); }
.s-g::after { content: ''; flex: 1; height: 1px; margin-bottom: .45em; background: var(--line-2); }
.s-g.mod { color: #ffb37a; }
/* Én række smalle kort i fuld højde: omgangene står i én kolonne */
.grid { flex: 1 1 auto; min-height: 0; display: grid; gap: calc(var(--u) * .7); grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); }
.card {
  position: relative; min-width: 0; min-height: 0; container-type: size; cursor: pointer;
  background: var(--panel-grad);
  clip-path: polygon(0 0, calc(100% - calc(var(--u) * 1.2)) 0, 100% calc(var(--u) * 1.2), 100% 100%, 0 100%);
}
.card::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px var(--line-2); pointer-events: none; z-index: 3; }
.card:hover::before { box-shadow: inset 0 0 0 1px var(--blue-hi); }
.card::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--u) * .26); background: linear-gradient(180deg, #8ff7ff, var(--blue)); z-index: 3; }
.card.is-live::after { background: linear-gradient(180deg, var(--pink-hi), var(--violet)); box-shadow: 0 0 calc(var(--u) * 1) rgba(255, 47, 168, .6); }
.card.is-live::before { box-shadow: inset 0 0 0 1px rgba(255, 111, 198, .35); }
.card.is-rec::after { background: linear-gradient(180deg, var(--gold-hi), #ff9a1f); }
.card.is-empty { cursor: default; background: transparent; }
.card.is-empty::before { box-shadow: inset 0 0 0 1px var(--line); }
.card.is-empty::after { display: none; }
.card.is-empty .ci { justify-content: center; align-items: center; padding: 0 8cqw; text-align: center; }
.card.is-empty .label { white-space: normal; line-height: 1.5; font-size: max(8px, min(1.6cqh, 7cqw)); }
.card.is-new { animation: cardIn .6s var(--ease) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } }
.ci { --px: 7cqw; --pl: 10cqw; position: absolute; inset: 0; display: flex; flex-direction: column; gap: 1.1cqh; padding: 0 0 1.8cqh; }
/* Statuslinje øverst: På banen / Færdig / I pit */
.c-state { flex: none; display: flex; align-items: center; gap: .5em; height: max(14px, 3.3cqh); padding: 0 calc(var(--px) + 6cqw) 0 var(--pl); font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .07em; font-size: max(8px, min(1.75cqh, 8.5cqw)); white-space: nowrap; overflow: hidden; color: #fff; background: var(--blue-panel); }
.c-state i { flex: none; width: .6em; height: .6em; border-radius: 50%; background: #fff; animation: pulse 1.6s ease-out infinite; }
.card.is-live .c-state { background: linear-gradient(90deg, var(--pink), var(--violet)); }
.card.is-pit .c-state { background: rgba(120, 165, 255, .16); color: var(--ink-2); }
.card.is-rec .c-state { background: linear-gradient(90deg, #ffe7a3, #ffb534); color: #2a1a00; }
/* Portræt + run-nummer og klasse på én linje; navnet får hele kortets bredde nedenunder */
.c-head { flex: none; display: flex; align-items: center; gap: 5cqw; min-width: 0; height: max(24px, 6cqh); padding: 0 var(--px) 0 var(--pl); }
.c-head .portrait { height: 100%; aspect-ratio: 1; }
.c-id { flex: none; min-width: 0; line-height: 1.08; padding: 0 var(--px) 0 var(--pl); }
.c-first { font-weight: 900; font-size: calc(var(--fit, 1) * max(11px, min(2.7cqh, 17cqw))); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-last { font-weight: 600; color: var(--ink-2); font-size: calc(var(--fit, 1) * max(8px, min(1.9cqh, 12cqw))); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .unknown ~ .c-run, .card:has(.unknown) .c-first { color: var(--ink-2); }
.c-run { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-start; flex-direction: column; justify-content: center; gap: .4em; font-stretch: 80%; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: max(8px, min(1.6cqh, 8.5cqw)); color: var(--ink-3); white-space: nowrap; }
.c-run .ktag { letter-spacing: .06em; font-stretch: 100%; font-size: 1.05em; }
.laps { flex: 1 1 auto; min-height: 0; display: grid; grid-template-rows: repeat(var(--lr, 22), minmax(0, 1fr)); grid-template-columns: minmax(0, 1fr); padding: 0 var(--px) 0 var(--pl); font-size: var(--lf, 14px); }
.lap { display: flex; align-items: center; justify-content: space-between; gap: .3em; min-width: 0; min-height: 0; border-bottom: 1px solid rgba(120, 165, 255, .08); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lap i { flex: none; font-style: normal; font-weight: 600; font-size: .7em; color: var(--ink-3); }
.lap b { font-weight: 800; font-style: italic; padding: 0 .25em; }
.lap.more { justify-content: center; font-size: .7em; font-weight: 700; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; }
.lap.best b { color: #fff; background: linear-gradient(90deg, var(--pink), var(--violet)); clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%); }
.lap.win { background: rgba(255, 204, 51, .12); }
.lap.win b { color: var(--gold); }
.lap.win.best b { color: #2a1a00; background: linear-gradient(90deg, #ffe7a3, #ffb534); }
.lap.merged b::after { content: '*'; color: var(--ink-3); font-style: normal; margin-left: .1em; }
/* Ugyldig omgang (genvej/fejlmåling): grå og overstreget, tæller ikke som bedste omgang */
.lap.bad b { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: .08em; }
.lap.last { border-bottom-color: var(--gold); }
.lap.next b::before { content: ''; display: inline-block; width: .5em; height: .5em; border-radius: 50%; background: var(--pink-hi); animation: pulse 1.6s ease-out infinite; }
.lap.next b { color: var(--ink-3); font-weight: 600; }
.lap.empty { border-bottom-color: rgba(120, 165, 255, .04); }
.lap.is-in { animation: lapIn .7s var(--ease); }
@keyframes lapIn { 0% { background: rgba(255, 111, 198, .35); } }
.c-foot { flex: none; position: relative; display: flex; flex-direction: column; gap: .35cqh; margin: 0 var(--px) 0 var(--pl); padding-top: 1.3cqh; border-top: 1px solid var(--line-2); }
.c-foot .k { font-stretch: 78%; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; font-size: max(8px, min(1.5cqh, 7.5cqw)); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.c-foot .v { font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; font-size: max(12px, min(3.6cqh, 12cqw)); line-height: 1; white-space: nowrap; padding-right: .08em; }
.c-foot .v i { opacity: .5; margin: 0 .04em; }
.c-foot .v small { font-size: .5em; color: var(--ink-3); -webkit-text-fill-color: var(--ink-3); margin-left: .25em; font-weight: 700; }
.card.is-rec .c-foot .k { color: #ffd98a; }
.prog { position: absolute; left: 0; top: -1px; height: max(2px, .8cqh); width: var(--p, 0%); background: linear-gradient(90deg, var(--violet), var(--pink-hi)); transition: width .3s linear; }

/* ---------- Bund ---------- */
.foot { display: flex; align-items: center; justify-content: flex-end; gap: calc(var(--u) * 1); min-width: 0; font-size: calc(var(--u) * .62); color: var(--ink-3); }
.foot-status { flex: none; white-space: nowrap; }
.foot-status.warn { color: var(--gold); }

/* =====================================================================
   ARK (spørgsmål og formularer oven på tavlen): mod?, bil/transponder, bane
   ===================================================================== */
.sheet-bg { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(2, 6, 18, .7); animation: dIn .25s var(--ease); }
.sheet {
  position: relative; display: flex; flex-direction: column; gap: calc(var(--u) * 1.1);
  width: min(calc(var(--u) * 44), 94%); max-height: 92%; overflow-y: auto; scrollbar-width: thin;
  padding: calc(var(--u) * 1.5) calc(var(--u) * 1.8) calc(var(--u) * 1.6);
  font-size: calc(var(--u) * .92);
  background: linear-gradient(170deg, #10245c, #070f2c);
  clip-path: polygon(0 0, calc(100% - calc(var(--u) * 1.2)) 0, 100% calc(var(--u) * 1.2), 100% 100%, 0 100%);
}
.sheet::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px var(--line-2); pointer-events: none; }
.sh-body { display: flex; flex-direction: column; gap: calc(var(--u) * 1); }
html.is-phone .sh-body { gap: 14px; }
.sh-head { display: flex; align-items: flex-start; gap: calc(var(--u) * 1); }
.sh-head > div { flex: 1 1 auto; min-width: 0; }
.sh-head h2 { margin-top: calc(var(--u) * .25); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: calc(var(--u) * 1.7); line-height: 1.05; text-wrap: balance; }
.sheet p.txt { color: var(--ink-2); line-height: 1.5; max-width: 60ch; }
.sheet p.txt b { color: #fff; }
.sheet .hint { font-size: .85em; color: var(--ink-3); }
.sh-stats { display: flex; gap: calc(var(--u) * 1.6); padding: calc(var(--u) * .8) calc(var(--u) * 1); background: rgba(4, 9, 24, .5); box-shadow: inset 0 0 0 1px var(--line); }
.sh-stats .k { display: block; font-stretch: 75%; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; font-size: .62em; color: var(--ink-3); }
.sh-stats .n { display: block; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; font-size: 1.5em; line-height: 1.1; }
.sh-stats .n.hot { color: var(--gold); }
.field { display: flex; flex-direction: column; gap: .4em; }
.field > span { font-stretch: 75%; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; font-size: .66em; color: var(--ink-3); }
.field input { height: calc(var(--u) * 2.7); padding: 0 calc(var(--u) * .9); font: inherit; font-weight: 700; color: #fff; background: rgba(4, 9, 24, .75); border: 0; box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 0; }
.field input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue-hi); }
.field input:disabled { color: var(--ink-3); }
.picks { display: flex; flex-wrap: wrap; gap: .4em; }
.picks button { cursor: pointer; border: 0; padding: .45em .8em .4em; font: inherit; font-size: .85em; font-weight: 700; color: var(--ink-2); background: rgba(42, 109, 255, .12); box-shadow: inset 0 0 0 1px var(--line-2); clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
.picks button small { color: var(--ink-3); font-weight: 600; margin-left: .4em; }
.picks button:hover, .picks button[aria-pressed="true"] { background: var(--blue-panel); color: #fff; box-shadow: none; }
.picks button[aria-pressed="true"] small { color: #cfe0ff; }
.kopts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(var(--u) * .4); }
.kopts button { cursor: pointer; border: 0; text-align: left; display: flex; flex-direction: column; gap: .2em; padding: .75em .9em .7em; font: inherit; color: var(--ink-2); background: rgba(42, 109, 255, .1); box-shadow: inset 0 0 0 1px var(--line-2); clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); }
.kopts button b { font-weight: 900; font-style: italic; text-transform: uppercase; color: #fff; font-size: 1.05em; }
.kopts button small { font-size: .78em; color: var(--ink-3); line-height: 1.3; }
.kopts button:hover { background: rgba(42, 109, 255, .24); }
.kopts button[aria-pressed="true"] { background: var(--blue-panel); box-shadow: none; }
.kopts button[aria-pressed="true"] small { color: #cfe0ff; }
.kopts button[data-k="mod2"][aria-pressed="true"] { background: linear-gradient(135deg, #ff8a1f, #ff2fa8); }
.kopts button[data-k="mod4"][aria-pressed="true"] { background: linear-gradient(135deg, #ff2f5a, #b02aff); }
.sh-acts { display: flex; flex-wrap: wrap; gap: calc(var(--u) * .5); align-items: center; }
.btn { cursor: pointer; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: calc(var(--u) * 2.6); padding: 0 calc(var(--u) * 1.3); font: inherit; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .03em; color: #fff; background: var(--blue-panel); clip-path: polygon(calc(var(--u) * .45) 0, 100% 0, calc(100% - calc(var(--u) * .45)) 100%, 0 100%); }
.btn:hover { filter: brightness(1.15); }
.btn.mod { background: linear-gradient(90deg, #ff8a1f, #ff2fa8); }
.btn.mod4 { background: linear-gradient(90deg, #ff2f5a, #b02aff); }
.btn.ghost { background: rgba(42, 109, 255, .12); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.link { background: none; clip-path: none; padding: 0; min-height: 0; color: var(--ink-3); font-style: normal; font-weight: 700; text-transform: none; letter-spacing: 0; text-decoration: underline; text-underline-offset: 3px; }
.btn[disabled] { opacity: .45; cursor: default; filter: none; }
.sh-err { color: var(--red); font-weight: 700; }
.people { display: flex; flex-direction: column; gap: 3px; max-height: calc(var(--u) * 14); overflow-y: auto; }
.people button { cursor: pointer; border: 0; display: flex; align-items: center; gap: .7em; height: calc(var(--u) * 2.6); padding: 0 .8em 0 0; text-align: left; font: inherit; font-weight: 700; color: var(--ink); background: rgba(14, 31, 77, .75); box-shadow: inset 0 0 0 1px var(--line); }
.people button .portrait { height: 100%; aspect-ratio: 1; }
.people button small { margin-left: auto; color: var(--ink-3); font-weight: 600; }
.people button[aria-pressed="true"] { background: var(--blue-panel); box-shadow: none; }
.tracks { display: flex; flex-direction: column; gap: 3px; max-height: calc(var(--u) * 19); overflow-y: auto; scrollbar-width: thin; }
.tracks button { cursor: pointer; border: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .2em 1em; padding: .55em .9em; text-align: left; font: inherit; color: var(--ink); background: rgba(14, 31, 77, .75); box-shadow: inset 0 0 0 1px var(--line); }
.tracks button:hover { box-shadow: inset 0 0 0 1px var(--blue-hi); }
.tracks b { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tracks small { grid-column: 1; font-size: .78em; color: var(--ink-3); letter-spacing: .04em; }
.tracks .st { grid-row: 1 / span 2; grid-column: 2; font-size: .74em; font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); white-space: nowrap; }
.tracks .st.live { color: var(--pink-hi); }
.tracks .st.live::before { content: ''; display: inline-block; width: .6em; height: .6em; margin-right: .45em; border-radius: 50%; background: var(--pink-hi); animation: pulse 1.6s ease-out infinite; }
.tracks .home { background: linear-gradient(90deg, rgba(42, 109, 255, .35), rgba(14, 31, 77, .75)); }
.toast { position: absolute; left: 50%; bottom: calc(var(--u) * 2.2); z-index: 70; transform: translateX(-50%); max-width: 80%; padding: .7em 1.3em .65em; font-weight: 800; font-size: calc(var(--u) * .9); color: #fff; background: linear-gradient(90deg, #12307f, #2a1a6b); box-shadow: inset 0 0 0 1px var(--line-2), 0 10px 30px rgba(0, 0, 0, .45); clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); animation: dIn .3s var(--ease); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Profil: biler og transpondere + klassen for det valgte run */
.d-sub .car { cursor: pointer; border: 0; display: inline-flex; align-items: center; gap: .55em; padding: .3em .8em .28em .7em; font: inherit; font-weight: 700; color: var(--ink); background: rgba(42, 109, 255, .12); box-shadow: inset 0 0 0 1px var(--line-2); clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.d-sub .car small { color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.d-sub .car:hover { background: rgba(42, 109, 255, .3); }
.d-sub .car.add { color: #fff; background: linear-gradient(90deg, var(--blue), var(--violet)); box-shadow: none; }
.d-kl { display: flex; flex-direction: column; align-items: flex-start; gap: .35em; margin-left: auto; margin-right: calc(var(--u) * 1); }
.seg { display: flex; gap: 2px; }
.seg button { cursor: pointer; border: 0; height: calc(var(--u) * 1.9); padding: 0 calc(var(--u) * .75); font: inherit; font-size: calc(var(--u) * .72); font-weight: 900; font-style: italic; text-transform: uppercase; color: var(--ink-2); background: rgba(42, 109, 255, .1); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg button:hover { color: #fff; }
.seg button[aria-pressed="true"] { color: #fff; background: var(--blue-panel); box-shadow: none; }
.seg button[data-k="mod2"][aria-pressed="true"] { background: linear-gradient(90deg, #ff8a1f, #ff2fa8); }
.seg button[data-k="mod4"][aria-pressed="true"] { background: linear-gradient(90deg, #ff2f5a, #b02aff); }
.d-flag { font-size: calc(var(--u) * .68); font-weight: 800; color: var(--gold); white-space: nowrap; }
.d-runs .rk b .ktag { font-size: .62em; margin-left: .5em; vertical-align: .15em; }

/* =====================================================================
   PROFIL OG REKORDLISTER (lag over tavlen)
   ===================================================================== */
.detail {
  position: absolute; inset: 0; z-index: 40;
  display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: calc(var(--u) * 1);
  padding: calc(var(--u) * 1.3) calc(var(--u) * 1.8) calc(var(--u) * 1.2);
  background: radial-gradient(40% 60% at 6% 10%, rgba(42, 109, 255, .2), transparent 70%), var(--bg);
  animation: dIn .3s var(--ease);
}
@keyframes dIn { from { opacity: 0; transform: scale(.985); } }
.d-head { display: flex; align-items: center; gap: calc(var(--u) * 1.4); min-width: 0; padding-bottom: calc(var(--u) * .9); border-bottom: 1px solid var(--line-2); }
.d-head .portrait { height: calc(var(--u) * 5.2); aspect-ratio: 1; }
.d-id { flex: 1 1 auto; min-width: 0; }
.d-name { font-weight: 900; font-style: italic; text-transform: uppercase; font-stretch: 108%; font-size: calc(var(--u) * 2.5); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: .1em; }
.d-sub { display: flex; align-items: center; flex-wrap: wrap; gap: .5em .9em; margin-top: calc(var(--u) * .45); font-size: calc(var(--u) * .78); font-weight: 600; color: var(--ink-2); }
.d-sub .live { color: var(--pink-hi); font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: .06em; }
.d-sub .live::before { content: ''; display: inline-block; width: .6em; height: .6em; margin-right: .5em; border-radius: 50%; background: var(--pink-hi); vertical-align: .05em; animation: pulse 1.6s ease-out infinite; }
.d-sub a.btn-reg { display: inline-flex; align-items: center; gap: .5em; padding: .35em 1em .3em .9em; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .05em; text-decoration: none; color: #fff; background: linear-gradient(90deg, var(--pink), var(--violet)); clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.d-stats { flex: none; display: flex; gap: calc(var(--u) * 1.4); }
.d-stat { padding-left: calc(var(--u) * 1); border-left: calc(var(--u) * .22) solid var(--blue); }
.d-stat.gold { border-left-color: var(--gold); }
.d-stat.gold .label { color: #ffd98a; }
.d-stat .v { margin-top: calc(var(--u) * .2); font-size: calc(var(--u) * 1.75); line-height: 1; padding-right: .08em; }
.d-stat .v i { opacity: .55; margin: 0 .04em; }
.d-stat .s { margin-top: calc(var(--u) * .2); font-size: calc(var(--u) * .66); color: var(--ink-3); white-space: nowrap; }
.d-stat .s b { color: var(--gold); font-weight: 800; }
.d-close { margin-left: calc(var(--u) * .6); }
.d-days { display: flex; align-items: center; gap: calc(var(--u) * .3); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.d-days::-webkit-scrollbar { display: none; }
.d-days > span { flex: none; margin-right: .6em; }
.d-days button { flex: none; cursor: pointer; border: 0; height: calc(var(--u) * 2); padding: 0 calc(var(--u) * .85); font-size: calc(var(--u) * .74); font-weight: 700; white-space: nowrap; color: var(--ink-2); background: rgba(42, 109, 255, .1); box-shadow: inset 0 0 0 1px var(--line-2); clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.d-days button:hover { background: rgba(42, 109, 255, .26); color: #fff; }
.d-days button[aria-pressed="true"] { background: var(--blue-panel); color: #fff; box-shadow: none; }
.d-main { display: grid; grid-template-columns: minmax(0, 23fr) minmax(0, 77fr); gap: calc(var(--u) * 1.5); min-height: 0; }
.d-runs { display: flex; flex-direction: column; min-height: 0; }
.d-runs ol { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: calc(var(--u) * .35); overflow-y: auto; scrollbar-width: thin; }
.d-runs li { flex: 1 1 0; min-height: calc(var(--u) * 2.9); max-height: calc(var(--u) * 4.2); }
.d-runs button { width: 100%; height: 100%; text-align: left; cursor: pointer; border: 0; display: flex; align-items: center; justify-content: space-between; gap: 1em; padding: 0 calc(var(--u) * 1.1) 0 calc(var(--u) * 1.2); background: rgba(14, 31, 77, .75); box-shadow: inset 0 0 0 1px var(--line); clip-path: polygon(0 0, 100% 0, calc(100% - calc(var(--u) * .6)) 100%, 0 100%); }
.d-runs button:hover { box-shadow: inset 0 0 0 1px var(--blue-hi); }
.d-runs button[aria-pressed="true"] { background: var(--blue-panel); box-shadow: none; }
.d-runs .rk { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.d-runs .rk b { font-weight: 900; font-style: italic; text-transform: uppercase; font-size: calc(var(--u) * 1.05); white-space: nowrap; }
.d-runs .rk span { font-size: calc(var(--u) * .7); color: var(--ink-3); white-space: nowrap; }
.d-runs button[aria-pressed="true"] .rk span { color: #cfe0ff; }
.d-runs .rv { font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; font-size: calc(var(--u) * 1.3); white-space: nowrap; }
.d-runs .rv i { opacity: .55; margin: 0 .04em; }
.d-runs .rv.none { color: var(--ink-3); font-weight: 600; font-size: calc(var(--u) * .85); font-style: normal; }
.d-runs button.is-best .rv { color: var(--gold); }
.d-runs button.is-best[aria-pressed="true"] .rv { color: #ffe7a3; }
.d-runs button.on .rk b::after { content: ''; display: inline-block; width: .5em; height: .5em; margin-left: .5em; border-radius: 50%; background: var(--pink-hi); vertical-align: .12em; animation: pulse 1.6s ease-out infinite; }
.d-box { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: calc(var(--u) * 1) calc(var(--u) * 1.4) calc(var(--u) * .9) calc(var(--u) * 1.5); background: var(--panel-grad); clip-path: polygon(0 0, calc(100% - calc(var(--u) * 1.2)) 0, 100% calc(var(--u) * 1.2), 100% 100%, 0 100%); }
.d-box::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px var(--line-2); pointer-events: none; }
.d-top { display: flex; align-items: flex-end; justify-content: space-between; gap: calc(var(--u) * 2); padding-bottom: calc(var(--u) * .8); border-bottom: 1px solid var(--line-2); }
.d-top h2 { font-weight: 900; font-style: italic; text-transform: uppercase; font-size: calc(var(--u) * 1.5); line-height: 1; white-space: nowrap; }
.d-top h2 small { display: block; margin-top: .45em; font-style: normal; font-weight: 600; text-transform: none; font-size: .5em; color: var(--ink-3); letter-spacing: .02em; }
.d-final { text-align: right; }
.d-final .v { margin-top: calc(var(--u) * .2); font-size: calc(var(--u) * 2.8); line-height: .95; padding-right: .06em; }
.d-final .v i { opacity: .55; margin: 0 .04em; }
.d-final .v.none { font-size: calc(var(--u) * 1.4); color: var(--ink-3); background: none; -webkit-text-fill-color: var(--ink-3); }
.d-heads { display: grid; grid-template-columns: repeat(var(--lc, 3), minmax(0, 1fr)); column-gap: 1.4em; margin-top: calc(var(--u) * .7); font-size: var(--lf, 16px); }
.d-heads div { display: grid; grid-template-columns: 2.1em 1fr 1.4fr; column-gap: .5em; }
.d-heads span { font-stretch: 75%; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; font-size: max(9px, .5em); color: var(--ink-3); text-align: right; }
.d-heads span:first-child { text-align: left; }
.d-laps { flex: 1 1 auto; min-height: 0; margin-top: calc(var(--u) * .2); display: grid; grid-auto-flow: column; grid-template-rows: repeat(var(--lr, 12), minmax(0, 1fr)); grid-template-columns: repeat(var(--lc, 3), minmax(0, 1fr)); column-gap: 1.4em; font-size: var(--lf, 16px); }
.d-laps li { display: grid; grid-template-columns: 2.1em 1fr 1.4fr; column-gap: .5em; align-items: center; min-height: 0; border-bottom: 1px solid rgba(120, 165, 255, .08); font-variant-numeric: tabular-nums; white-space: nowrap; }
.d-laps .n { font-weight: 600; font-size: .8em; color: var(--ink-3); }
.d-laps .t { justify-self: end; font-weight: 800; font-style: italic; padding: 0 .3em; }
.d-laps .c { text-align: right; font-weight: 600; font-size: .86em; color: var(--ink-3); }
.d-laps li.best .t { color: #fff; background: linear-gradient(90deg, var(--pink), var(--violet)); clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%); }
.d-laps li.win { background: rgba(255, 204, 51, .12); }
.d-laps li.win .t { color: var(--gold); }
.d-laps li.win.best .t { color: #2a1a00; background: linear-gradient(90deg, #ffe7a3, #ffb534); }
.d-laps li.merged .t::after { content: '*'; color: var(--ink-3); font-style: normal; margin-left: .1em; }
.d-laps li.bad .t { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: .08em; }
.d-laps li.last { border-bottom: 2px solid var(--gold); }
.d-laps li.last .c { color: var(--gold); font-weight: 800; font-style: italic; }
.d-laps li.after { opacity: .32; }
.d-laps li.empty-msg { grid-column: 1 / -1; border: 0; color: var(--ink-3); }
.d-note { margin-top: calc(var(--u) * .6); font-size: calc(var(--u) * .7); color: var(--ink-3); }
.d-note b { color: var(--ink-2); font-weight: 700; }
.d-loading { margin: auto; color: var(--ink-3); }

/* Rekordlister */
.recs { grid-template-rows: auto minmax(0, 1fr); }
.r-classes { flex: none; display: flex; gap: calc(var(--u) * .25); }
.r-classes button { cursor: pointer; border: 0; height: calc(var(--u) * 2.4); padding: 0 calc(var(--u) * 1); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: calc(var(--u) * .85); color: var(--ink-2); background: rgba(42, 109, 255, .1); box-shadow: inset 0 0 0 1px var(--line-2); clip-path: polygon(calc(var(--u) * .4) 0, 100% 0, calc(100% - calc(var(--u) * .4)) 100%, 0 100%); }
.r-classes button[aria-pressed="true"] { background: var(--blue-panel); color: #fff; box-shadow: none; }
.r-grid { display: flex; flex-direction: column; min-height: 0; }
.r-modes button[aria-pressed="true"] { background: linear-gradient(90deg, var(--violet), #b04bff); }
/* Rekordlisten: én måling ad gangen, op til 30 navne spaltevis (1–10, 11–20, 21–30) */
.r-list { flex: 1 1 auto; min-height: 0; display: grid; grid-auto-flow: column; grid-template-columns: repeat(var(--rc, 3), minmax(0, 1fr)); grid-template-rows: repeat(var(--rr, 10), minmax(0, 1fr)); gap: calc(var(--u) * .28) calc(var(--u) * 1.6); }
.r-list li { position: relative; display: flex; align-items: center; gap: calc(var(--u) * .8); min-height: 0; padding-right: calc(var(--u) * 1); cursor: pointer; background: linear-gradient(90deg, rgba(14, 31, 77, .85), rgba(7, 17, 44, .5)); clip-path: polygon(0 0, 100% 0, calc(100% - calc(var(--u) * .5)) 100%, 0 100%); }
.r-list li::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; }
.r-list li:hover::before { box-shadow: inset 0 0 0 1px var(--blue-hi); }
.r-list .p { align-self: stretch; flex: none; width: calc(var(--u) * 2.6); display: grid; place-items: center; padding-right: calc(var(--u) * .3); font-weight: 900; font-style: italic; font-size: calc(var(--u) * 1.25); background: var(--blue-panel); clip-path: polygon(0 0, 100% 0, calc(100% - calc(var(--u) * .5)) 100%, 0 100%); }
.r-list .p1 .p { background: linear-gradient(160deg, #fff3b0, #ffcc33 45%, #c98a00); color: #2a1a00; }
.r-list .p2 .p { background: linear-gradient(160deg, #fff, #c9d4ee 45%, #7486b8); color: #10183a; }
.r-list .p3 .p { background: linear-gradient(160deg, #ffd2a8, #e08a4a 45%, #8c4a1c); color: #2a1200; }
.r-list .portrait { align-self: stretch; height: auto; aspect-ratio: 1; }
.r-list .n { flex: 1 1 auto; min-width: 0; line-height: 1.15; }
.r-list .n b { display: block; font-weight: 800; font-size: calc(var(--u) * 1.05); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-list .n small { font-size: calc(var(--u) * .62); color: var(--ink-3); }
.r-list .t { font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; font-size: calc(var(--u) * 1.3); white-space: nowrap; }
.r-list .t i { opacity: .55; margin: 0 .03em; }
.r-list .p1 .t { color: var(--gold); }
/* Tom tavle (ingen runs endnu i dag) */
.grid-empty { grid-column: 1 / -1; display: grid; place-items: center; text-align: center; border: 1px dashed var(--line-2); color: var(--ink-3); font-size: calc(var(--u) * 1); }
.grid-empty p { display: flex; flex-direction: column; gap: .5em; }
.grid-empty b { font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 1.6em; color: var(--ink-2); }
/* Tekstknapper i toppen (Admin, Bane): ikon og tekst på én linje */
.txt-btn { display: inline-flex; align-items: center; gap: .5em; width: auto; padding: 0 calc(var(--u) * 1) 0 calc(var(--u) * .85); font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .04em; font-size: calc(var(--u) * .72); white-space: nowrap; color: var(--ink); text-decoration: none; }
.txt-btn svg { flex: none; width: calc(var(--u) * 1) !important; height: calc(var(--u) * 1) !important; stroke-width: 2.2; }
.r-col { display: flex; flex-direction: column; min-height: 0; padding: calc(var(--u) * .9) calc(var(--u) * 1) calc(var(--u) * .8) calc(var(--u) * 1.2); background: var(--panel-grad); clip-path: polygon(0 0, calc(100% - calc(var(--u) * 1)) 0, 100% calc(var(--u) * 1), 100% 100%, 0 100%); position: relative; }
.r-col::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px var(--line-2); pointer-events: none; }
.r-col h3 { margin: 0 0 calc(var(--u) * .6); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: calc(var(--u) * 1.1); }
.r-col ol { flex: 1 1 auto; display: grid; grid-template-rows: repeat(10, minmax(0, 1fr)); gap: calc(var(--u) * .2); min-height: 0; }
.r-col li { display: flex; align-items: center; gap: calc(var(--u) * .6); min-height: 0; padding-right: calc(var(--u) * .4); border-bottom: 1px solid rgba(120, 165, 255, .08); cursor: pointer; }
.r-col li:hover { background: rgba(42, 109, 255, .12); }
.r-col li .p { width: 1.6em; flex: none; text-align: center; font-weight: 900; font-style: italic; color: var(--ink-3); }
.r-col li:nth-child(1) .p { color: var(--gold); }
.r-col li .portrait { height: 82%; aspect-ratio: 1; }
.r-col li .n { flex: 1 1 auto; min-width: 0; line-height: 1.1; }
.r-col li .n b { display: block; font-weight: 800; font-size: calc(var(--u) * .92); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-col li .n small { font-size: calc(var(--u) * .62); color: var(--ink-3); }
.r-col li .t { font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; font-size: calc(var(--u) * 1.05); white-space: nowrap; }
.r-col li .t i { opacity: .55; margin: 0 .03em; }
.r-col li:nth-child(1) .t { color: var(--gold); }
.r-col .r-empty { color: var(--ink-3); font-size: calc(var(--u) * .8); }

/* =====================================================================
   TELEFON: almindelig side, der scroller (html.is-phone sættes af tider.js)
   ===================================================================== */
html.is-phone, html.is-phone body { height: auto; overflow: auto; }
html.is-phone .wrap { display: block; place-items: normal; height: auto; padding: 0; }
html.is-phone .sizer { width: auto; height: auto; overflow: visible; }
html.is-phone .stage {
  --u: 4.2px;
  position: relative; transform: none !important; width: auto; height: auto; min-height: 100dvh;
  display: flex; flex-direction: column; gap: 14px;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px));
  font-size: 14px; overflow: visible;
}
html.is-phone .top { flex-wrap: wrap; gap: 10px 14px; }
html.is-phone .brand img { height: 34px; }
html.is-phone .lay { flex: 1 1 60%; padding-left: 12px; }
html.is-phone .lay-name { font-size: 20px; }
html.is-phone button.lay .label { white-space: normal; line-height: 1.3; }   /* "Fredag 6. november · Dagen før Afd. 1" må gå over to linjer */
html.is-phone .label { font-size: 10px; }
html.is-phone .recs-top { flex: 1 1 100%; flex-direction: column; gap: 10px; }
html.is-phone .rb { padding-left: 10px; border-left-width: 3px; }
html.is-phone .rb-v { gap: 18px; }
html.is-phone .rv .k { font-size: 9px; }
html.is-phone .rv .n { font-size: 20px; }
html.is-phone .rv .n.none { font-size: 15px; }
html.is-phone .rv .w { font-size: 11px; max-width: 150px; }
html.is-phone .runs .head { flex-wrap: wrap; row-gap: 8px; }
html.is-phone .ctrls { flex: 1 1 100%; margin-left: 0; flex-wrap: wrap; gap: 8px; }
html.is-phone .modes, html.is-phone .views { flex: 1 1 100%; }
html.is-phone .modes button, html.is-phone .views button { flex: 1; height: 38px; font-size: 13px; }
html.is-phone .simple .head { flex-wrap: wrap; row-gap: 8px; }
html.is-phone .s-heads { --sf: 15px !important; }
html.is-phone .s-list { --sf: 15px !important; display: flex; flex-direction: column; gap: 4px; }
html.is-phone .s-row { height: 50px; flex: none; }
html.is-phone .s-g { height: 26px; flex: none; font-size: 10px; }
html.is-phone .s-heads div, html.is-phone .s-row { grid-template-columns: 26px 36px minmax(0, 1fr) 56px 92px; column-gap: 7px; }
html.is-phone .s-row .n { white-space: normal; line-height: 1.1; font-size: 14px; }
html.is-phone .s-row .n b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html.is-phone .s-row .t { font-size: 14px; padding: .04em .2em; }
html.is-phone .s-row .t.run { margin-right: 4px; }
html.is-phone #baneBtn { font-size: 12px; padding: 0 10px; }
html.is-phone .clock, html.is-phone #fsBtn { display: none; }
html.is-phone .icon-btn { width: 40px; height: 36px; }
html.is-phone .board { display: flex; flex-direction: column; gap: 22px; }
/* Telefon: seneste runs (vandret stribe) først, så dagens liste */
html.is-phone .runs { order: -1; }
html.is-phone .head h2 { font-size: 18px; }
html.is-phone .rows { gap: 4px; }
html.is-phone .row { flex: none; height: 52px; max-height: none; }
html.is-phone .row .nm { font-size: 16px; }
html.is-phone .row .portrait { width: 46px; }
html.is-phone .d-top { flex-wrap: wrap; gap: 8px 16px; }
html.is-phone .d-top h2 { white-space: normal; }
html.is-phone .d-final { margin-left: auto; }
html.is-phone .row .v { font-size: 15px; }
html.is-phone .cols, html.is-phone .row { --c-pos: 32px; --c-lap: 62px; --c-run: 98px; }
html.is-phone .ghead { font-size: 10px; }
/* Telefon: de smalle kort ligger i en vandret stribe, man swiper igennem */
html.is-phone .grid { display: flex; align-items: flex-start; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 4px; }
html.is-phone .grid::-webkit-scrollbar { display: none; }
html.is-phone .card { flex: 0 0 min(44%, 180px); height: var(--ch, 560px); scroll-snap-align: start; }
html.is-phone .card.is-empty { display: none; }
html.is-phone .foot { font-size: 12px; justify-content: flex-start; }
html.is-phone .sheet-bg { position: fixed; place-items: end center; }
html.is-phone .sheet { width: 100%; max-height: 88dvh; font-size: 15px; padding: 18px 16px max(20px, env(safe-area-inset-bottom, 0px)); clip-path: none; }
html.is-phone .sh-head h2 { font-size: 22px; }
html.is-phone .field input { height: 46px; font-size: 16px; }
html.is-phone .kopts { grid-template-columns: 1fr; }
html.is-phone .btn { min-height: 46px; font-size: 15px; }
html.is-phone .people, html.is-phone .tracks { max-height: 42dvh; }
html.is-phone .people button { height: 46px; }
html.is-phone .toast { position: fixed; bottom: 18px; font-size: 14px; }
html.is-phone .d-kl { margin: 0; flex: 1 1 100%; order: 3; }
html.is-phone .seg button { height: 36px; font-size: 13px; padding: 0 12px; }
html.is-phone .d-flag { font-size: 12px; white-space: normal; }
html.is-phone .detail { position: fixed; inset: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: max(12px, env(safe-area-inset-top, 0px)) 14px 28px; }
html.is-phone .d-head { flex-wrap: wrap; gap: 12px; }
html.is-phone .d-head .portrait { height: 64px; }
html.is-phone .d-name { font-size: 24px; white-space: normal; }
html.is-phone .d-sub { font-size: 13px; }
html.is-phone .d-stats { order: 5; flex: 1 1 100%; gap: 14px; flex-wrap: wrap; }
html.is-phone .d-stat .v { font-size: 20px; }
html.is-phone .d-stat .s { font-size: 11px; }
html.is-phone .d-days button { height: 36px; font-size: 13px; padding: 0 12px; }
html.is-phone .d-main { display: flex; flex-direction: column; gap: 16px; }
html.is-phone .d-runs, html.is-phone .d-box { min-height: auto; }
html.is-phone .d-runs ol { flex: none; overflow: visible; }
html.is-phone .d-laps { flex: none; }
html.is-phone .lay-name { white-space: normal; }
html.is-phone .top > * { min-width: 0; }
html.is-phone .d-runs li { flex: none; height: 56px; min-height: 0; max-height: none; }
html.is-phone .d-runs .rk b { font-size: 16px; }
html.is-phone .d-runs .rk span { font-size: 12px; }
html.is-phone .d-runs .rv { font-size: 18px; }
html.is-phone .d-box { padding: 14px 14px 12px 16px; }
html.is-phone .d-top h2 { font-size: 18px; }
html.is-phone .d-final .v { font-size: 24px; }
html.is-phone .d-laps { grid-template-rows: repeat(var(--lr, 12), 34px); --lf: 15px !important; }
html.is-phone .d-heads { --lf: 15px !important; }
html.is-phone .d-note { font-size: 12px; }
html.is-phone .r-classes button { height: 36px; font-size: 13px; padding: 0 12px; }
html.is-phone .r-grid { display: flex; flex-direction: column; gap: 14px; }
html.is-phone .d-head .r-modes { order: 6; flex: 1 1 100%; flex-wrap: wrap; }
html.is-phone .r-list { display: flex; flex-direction: column; gap: 4px; }
html.is-phone .r-list li { height: 50px; flex: none; }
html.is-phone .r-list .p { width: 34px; font-size: 16px; }
html.is-phone .r-list .n b { font-size: 15px; }
html.is-phone .r-list .n small { font-size: 11px; }
html.is-phone .r-list .t { font-size: 16px; }
html.is-phone .txt-btn, html.is-phone #baneBtn { width: auto; font-size: 12px; padding: 0 10px; }
html.is-phone .grid-empty { flex: 1 1 100%; min-height: 160px; padding: 20px; font-size: 14px; }
html.is-phone .r-col { padding: 14px; }
html.is-phone .r-col h3 { font-size: 16px; }
html.is-phone .r-col ol { grid-template-rows: none; }
html.is-phone .r-col li { height: 44px; }
html.is-phone .r-col li .n b { font-size: 15px; }
html.is-phone .r-col li .n small { font-size: 11px; }
html.is-phone .r-col li .t { font-size: 16px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
