/* =====================================================================
   HRCR PRACTICE — træningsur
   Samme mørke neon-udtryk som hrcrvintercup.dk (farver, Saira, skrå kanter).
   Uret skalerer med --u, så det fylder et 16:9-TV på samme måde som en bærbar.
   ===================================================================== */
:root {
  color-scheme: dark;
  --bg: #040918;
  --panel: rgba(10, 22, 58, .78);
  --panel-solid: #0a1636;
  --line: rgba(110, 150, 255, .16);
  --line-2: rgba(120, 165, 255, .32);

  --blue: #2a6dff;
  --blue-hi: #5aa2ff;
  --cyan: #19e0ff;
  --pink: #ff2fa8;
  --pink-hi: #ff6fc6;
  --gold: #ffcc33;
  --up: #5ee3a1;
  --red: #ff4d6d;

  --ink: #f3f7ff;
  --ink-2: #b6c4e4;
  --ink-3: #7c8db6;

  --brand-grad: linear-gradient(90deg, var(--blue), #7a5cff 55%, var(--pink));
  --blue-panel: linear-gradient(180deg, #2a6dff, #0d3bd1);

  --font: 'Saira', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --ease: cubic-bezier(.2, .7, .1, 1);

  /* Urets måleenhed: 1 % af bredden, men aldrig mere end højden tillader (16:9) */
  --u: min(1vw, 1.78vh);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
::selection { background: var(--pink); color: #fff; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
[hidden] { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
svg use { pointer-events: none; }

/* ---------- Portræt (samme som kørerkortene på hrcrvintercup.dk) ---------- */
.portrait { position: relative; display: block; overflow: hidden; background: radial-gradient(70% 60% at 50% 40%, #12286a, #070f2c); }
.portrait .sil { position: absolute; inset: 0; width: 100%; height: 100%; }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; z-index: 1; }
.portrait .ini {
  position: absolute; left: 0; right: 0; top: 8%; text-align: center; pointer-events: none;
  font-weight: 900; font-style: italic; font-stretch: 125%; font-size: 2.2em; line-height: 1;
  color: transparent; -webkit-text-stroke: 1px rgba(120, 170, 255, .35);
}

/* =====================================================================
   URET
   ===================================================================== */
.clock {
  /* Sættes af JS. Hver farve har en mellemtone (--x) og en gradient fra lys (--xa) til dyb (--xb). */
  --gc: #46b9ff; --gca: #8ff7ff; --gcb: #2a6dff;   /* gruppen på banen */
  --gn: #9b6dff; --gna: #d4b8ff; --gnb: #6a35ff;   /* næste gruppe */
  --pc: #5aa2ff; --pca: #bcd6ff; --pcb: #2a6dff;   /* fasen: kørsel / skift (guld) / sidste 30 sek (rød) / pause (krom) */
  position: relative;
  height: 100vh; height: 100dvh; min-height: 520px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: calc(var(--u) * 1.1);
  padding: calc(var(--u) * 1.5) calc(var(--u) * 2.4) calc(var(--u) * 1.5);
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);
}
.clock-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(38% 58% at 24% 62%, color-mix(in srgb, var(--pcb) 22%, transparent), transparent 72%),
    radial-gradient(30% 42% at 32% 40%, color-mix(in srgb, var(--pca) 9%, transparent), transparent 70%),
    radial-gradient(40% 55% at 84% 42%, color-mix(in srgb, var(--gnb) 14%, transparent), transparent 70%),
    linear-gradient(180deg, #060e28, #040918 55%, #030713);
  transition: background 1s;
}
.clock-bg::after {
  /* svage banelinjer, som på forsiden */
  content: ''; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(120, 165, 255, .05) 0 1px, transparent 1px calc(var(--u) * 6)),
    repeating-linear-gradient(0deg, rgba(120, 165, 255, .04) 0 1px, transparent 1px calc(var(--u) * 6));
  -webkit-mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent 85%);
  mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent 85%);
}

/* ---------- Top ---------- */
.clock-top { display: flex; align-items: center; gap: calc(var(--u) * 1.6); min-width: 0; }
.brand img { height: calc(var(--u) * 4.2); width: auto; filter: drop-shadow(0 0 calc(var(--u) * 1.2) rgba(42, 109, 255, .35)); }
.brand-tag { display: flex; flex-direction: column; line-height: 1.02; padding-left: calc(var(--u) * 1.6); border-left: 1px solid var(--line-2); }
.brand-tag b {
  font-weight: 900; font-style: italic; font-stretch: 125%; text-transform: uppercase;
  font-size: calc(var(--u) * 2.3); letter-spacing: .02em; padding-right: .1em;
  background: linear-gradient(90deg, #fff, #9cc4ff 45%, var(--pink-hi)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-tag span { white-space: nowrap; font-stretch: 75%; letter-spacing: .32em; text-transform: uppercase; font-size: max(11px, calc(var(--u) * .82)); color: var(--ink-2); font-weight: 600; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: calc(var(--u) * 1.4); }
.wall { font-weight: 800; font-style: italic; font-variant-numeric: tabular-nums; font-size: calc(var(--u) * 3.1); line-height: 1; letter-spacing: .01em; }
.wall small { font-size: .52em; color: var(--ink-3); margin-left: .06em; }
.top-actions { display: flex; gap: calc(var(--u) * .5); transition: opacity .4s; }
.icon-btn { white-space: nowrap;
  display: inline-flex; align-items: center; gap: .55em;
  height: max(34px, calc(var(--u) * 2.7)); padding: 0 calc(var(--u) * 1.1) 0 calc(var(--u) * .95);
  border: 0; cursor: pointer; text-decoration: none;
  background: rgba(42, 109, 255, .14); box-shadow: inset 0 0 0 1px var(--line-2);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  font-weight: 700; font-stretch: 87.5%; letter-spacing: .12em; text-transform: uppercase; font-size: max(11px, calc(var(--u) * .78));
  transition: background .2s;
}
.icon-btn:hover { background: rgba(42, 109, 255, .3); }
.icon-btn--hi { background: var(--blue-panel); box-shadow: none; }
.icon-btn svg { width: 1.5em; height: 1.5em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.is-off { color: var(--ink-3); }

/* Fuld skærm: knapperne forsvinder, når musen står stille */
.clock.is-fs.is-idle { cursor: none; }
.clock.is-fs.is-idle .top-actions { opacity: 0; pointer-events: none; }

/* ---------- Midten: urskive + højre side ---------- */
.clock-main { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: calc(var(--u) * 2.6); min-height: 0; }
.dial-wrap { container-type: size; min-height: 0; display: grid; place-items: center; }
.dial-box { position: relative; width: min(100cqw, 100cqh); aspect-ratio: 1; container-type: inline-size; }
.dial { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dial-track { fill: none; stroke: rgba(120, 165, 255, .08); stroke-width: 52; }
.dial-tick { stroke: rgba(160, 190, 255, .28); stroke-width: 3; }
.dial-tick.is-major { stroke: rgba(200, 220, 255, .65); stroke-width: 5; }
.dial-num { fill: var(--ink-3); font: 600 26px var(--font); font-stretch: 87.5%; letter-spacing: .08em; text-anchor: middle; dominant-baseline: central; }
/* Kørslerne får hver deres gradient (sat af JS); skift er en tynd guldstreg */
.seg { fill: none; stroke-width: 52; }
#dialSegs { transition: opacity .6s; }
#dialSegs.is-preview { opacity: .3; }
.seg-xfer { stroke: rgba(255, 191, 61, .32); stroke-width: 20; }
.seg.is-cur { filter: drop-shadow(0 0 16px var(--c)); }
.seg-xfer.is-cur { stroke: #ffbf3d; --c: #ffbf3d; }
.seg-lbl { fill: #fff; font: 900 34px var(--font); font-style: italic; text-anchor: middle; dominant-baseline: central; pointer-events: none; paint-order: stroke; stroke: rgba(4, 9, 24, .45); stroke-width: 6px; }
.dial-prog-bg { fill: none; stroke: rgba(120, 165, 255, .1); stroke-width: 8; }
.dial-prog { fill: none; stroke: url(#gProg); stroke-width: 8; stroke-linecap: round; filter: drop-shadow(0 0 8px var(--pc)); }
.dial .pa { stop-color: var(--pca); }
.dial .pb { stop-color: var(--pcb); }
.dial-hand line { stroke: #fff; stroke-width: 7; stroke-linecap: round; filter: drop-shadow(0 0 10px rgba(255, 255, 255, .9)); }
.dial-hand circle { fill: #fff; stroke: var(--bg); stroke-width: 5; }
.clock[data-mode="idle"] .dial-prog { opacity: 0; }

.dial-center {
  position: absolute; inset: 19%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.dial-center p { margin: 0; }
.phase {
  display: inline-flex; align-items: center; gap: .7em;
  font-stretch: 75%; font-weight: 700; letter-spacing: .34em; text-transform: uppercase;
  font-size: 2.9cqw; color: var(--pc); padding-left: .34em;
}
.phase::before, .phase::after { content: ''; width: 2.4em; height: 2px; background: linear-gradient(90deg, transparent, currentColor); box-shadow: 0 0 8px currentColor; }
.phase::after { transform: scaleX(-1); }
.gname {
  margin-top: .5cqw !important;
  font-weight: 900; font-style: italic; font-stretch: 112%; text-transform: uppercase;
  font-size: 6.6cqw; line-height: 1; letter-spacing: .01em; padding-right: .08em;
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.gtag { font-size: 2.5cqw; color: var(--ink-2); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; min-height: 1.4em; }
.count {
  font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums;
  font-size: 18.5cqw; line-height: .9; letter-spacing: -.01em; padding: .06em .08em 0 0;
  /* Krom-look som logoet: hvid top, knæk i midten, fasens gradient i bunden */
  background: linear-gradient(180deg, #ffffff 0%, #f1f7ff 44%, var(--pca) 52%, var(--pc) 72%, var(--pcb) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 2.4cqw color-mix(in srgb, var(--pcb) 55%, transparent));
}
.count.is-long { font-size: 13.5cqw; }
.until { margin-top: .9cqw !important; font-size: 2.45cqw; color: var(--ink-2); font-weight: 500; }
.until b { color: var(--ink); font-weight: 800; }
.clock.is-final .count { animation: beat 1s steps(1) infinite; }
.clock[data-mode="paused"] .count { animation: blink 1.6s ease-in-out infinite; }
@keyframes beat { 50% { opacity: .55; } }
@keyframes blink { 50% { opacity: .35; } }

/* ---------- Højre side: næste hold + på banen ---------- */
.side { display: flex; flex-direction: column; gap: calc(var(--u) * 1.3); min-height: 0; }
.next {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: calc(var(--u) * 1);
  padding: calc(var(--u) * 1.5) calc(var(--u) * 1.6) calc(var(--u) * 1.6);
  background: linear-gradient(180deg, rgba(14, 31, 77, .78), rgba(7, 17, 44, .62));
  clip-path: polygon(0 0, calc(100% - calc(var(--u) * 2)) 0, 100% calc(var(--u) * 2), 100% 100%, 0 100%);
}
.next::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px var(--line-2); pointer-events: none; }
.next::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--u) * .35); background: linear-gradient(180deg, var(--gna), var(--gnb)); box-shadow: 0 0 calc(var(--u) * 1.5) var(--gn); }
.clock[data-phase="transfer"] .next::before { box-shadow: inset 0 0 0 2px var(--gn), inset 0 0 calc(var(--u) * 4) color-mix(in srgb, var(--gn) 35%, transparent); animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: inset 0 0 0 2px var(--gn), inset 0 0 calc(var(--u) * 1.5) color-mix(in srgb, var(--gn) 15%, transparent); } }
.side-head p, .side-head h2 { margin: 0; }
.side-kicker { font-stretch: 75%; font-weight: 700; letter-spacing: .32em; text-transform: uppercase; font-size: max(11px, calc(var(--u) * .95)); color: var(--gn); }
.side-title {
  font-weight: 900; font-style: italic; font-stretch: 112%; text-transform: uppercase;
  font-size: calc(var(--u) * 3.1); line-height: 1.02; letter-spacing: .01em; margin-top: calc(var(--u) * .25) !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-title span { font-size: .45em; font-style: normal; font-weight: 600; letter-spacing: .14em; color: var(--ink-2); margin-left: .7em; vertical-align: .35em; }
.side-meta { font-size: calc(var(--u) * 1.25); color: var(--ink-2); margin-top: calc(var(--u) * .3) !important; }
.side-meta b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 800; }

.cards {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 2), minmax(0, 1fr));
  gap: calc(var(--u) * .8);
}
.pcard {
  position: relative; min-height: 0; min-width: 0;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0f2462, #08143c 70%);
  clip-path: polygon(0 0, calc(100% - calc(var(--u) * 1)) 0, 100% calc(var(--u) * 1), 100% 100%, 0 100%);
  animation: popIn .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
}
.pcard::before { content: ''; position: absolute; inset: 0; z-index: 3; box-shadow: inset 0 0 0 1px var(--line-2); pointer-events: none; }
.pcard .portrait { flex: 1; min-height: 0; font-size: calc(var(--u) * 1.4); }
.pcard .portrait::after { content: ''; position: absolute; inset: 60% 0 0; z-index: 2; background: linear-gradient(0deg, #08143c, transparent); }
.pcard-name {
  position: relative; z-index: 2; margin: calc(var(--u) * -1.6) 0 0;
  padding: 0 calc(var(--u) * .7) calc(var(--u) * .65);
  font-weight: 900; font-style: italic; text-transform: uppercase; font-size: calc(var(--u) * 1.15); line-height: 1.05;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pcard-name span { display: block; font-weight: 500; font-style: normal; text-transform: none; font-size: .78em; color: var(--ink-2); }
.cards-empty { grid-column: 1 / -1; grid-row: 1 / -1; display: grid; place-items: center; color: var(--ink-3); font-size: calc(var(--u) * 1.2); border: 1px dashed var(--line-2); }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }

.now { flex: 0 0 auto; padding: 0 calc(var(--u) * .3); }
.now-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; }
.now-head p { margin: 0; }
.now .side-kicker { color: var(--gc); }
.marshals { font-size: max(11px, calc(var(--u) * .95)); color: var(--ink-3); font-weight: 600; letter-spacing: .06em; }
.marshals b { color: var(--ink-2); }
.chips {
  list-style: none; margin: calc(var(--u) * .7) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: calc(var(--u) * .55) calc(var(--u) * 1);
}
.chips li { display: flex; align-items: center; gap: calc(var(--u) * .6); min-width: 0; font-size: calc(var(--u) * 1.02); font-weight: 700; line-height: 1.1; }
.chips li > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips .av {
  position: relative; width: calc(var(--u) * 2.3); height: calc(var(--u) * 2.3); flex: none; font-size: calc(var(--u) * .6);
}
.chips .av .portrait { width: 100%; height: 100%; }
.chips .av::after { content: ''; position: absolute; inset: 0; z-index: 5; box-shadow: inset 0 0 0 2px var(--gc); }
.chips-empty { color: var(--ink-3); font-size: calc(var(--u) * 1); grid-column: 1 / -1; }

/* ---------- Programmet nederst ---------- */
.strip { display: flex; gap: calc(var(--u) * .6); min-width: 0; }
.strip-item {
  --c: var(--ink-3);
  position: relative; flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; gap: calc(var(--u) * .8);
  padding: calc(var(--u) * .7) calc(var(--u) * 1.1) calc(var(--u) * .8);
  background: rgba(10, 22, 58, .7);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  font-size: calc(var(--u) * 1.02); line-height: 1.1; white-space: nowrap;
}
.strip-item::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--ca), var(--cb)); box-shadow: 0 0 10px var(--c); }
.strip-item time { font-weight: 800; font-style: italic; font-variant-numeric: tabular-nums; font-size: 1.25em; }
.strip-item b { display: grid; place-items: center; min-width: 1.7em; height: 1.7em; padding: 0 .3em; background: linear-gradient(135deg, var(--ca), var(--cb)); color: #fff; text-shadow: 0 1px 2px rgba(4, 9, 24, .5); font-weight: 900; font-style: italic; clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
.strip-item span { overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); font-weight: 600; }
.strip-item small { margin-left: auto; color: var(--ink-3); font-size: .85em; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.strip-item.is-now { background: linear-gradient(90deg, color-mix(in srgb, var(--ca) 22%, rgba(10, 22, 58, .9)), color-mix(in srgb, var(--cb) 30%, rgba(10, 22, 58, .9))); }
.strip-item.is-preview { opacity: .6; }
.strip-item.is-now span { color: var(--ink); }
.strip-empty { flex: 1; padding: calc(var(--u) * .9) calc(var(--u) * 1.2); color: var(--ink-3); background: rgba(10, 22, 58, .5); font-size: calc(var(--u) * 1.02); clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }

/* =====================================================================
   GRUPPE-VISNING ("Grupper"): urskiven fylder venstre halvdel, og alle
   grupper står som bånd i højre halvdel i køre-rækkefølge: gruppen på
   banen øverst og størst (fyldt med gruppens farve), så næste hold
   (guldkant og et tydeligt "NÆSTE"-mærke), så resten mindre og dæmpet.
   Højderne sættes af JS (FOCUS), og hvert bånd vælger selv sit kørergitter
   (fitGroups → --gc-cols/--gc-rows). Små bånd (fx ved 6 grupper) lægger
   gruppens navn til venstre og kørerne til højre.
   ===================================================================== */
.groups-view { display: none; }
.clock[data-layout="groups"] { grid-template-rows: auto minmax(0, 1fr); }
.clock[data-layout="groups"] .strip,
.clock[data-layout="groups"] .side { display: none; }
.clock[data-layout="groups"] .clock-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: calc(var(--u) * 2); }
.clock[data-layout="groups"] .groups-view {
  display: grid; min-width: 0; min-height: 0;
  grid-template-rows: repeat(var(--bands, 3), minmax(0, 1fr));
  gap: calc(var(--u) * 1.1);
}
.gv-band {
  --c: #46b9ff; --ca: #8ff7ff; --cb: #2a6dff;
  position: relative; min-width: 0; min-height: 0;
  container-type: size;
  background: rgba(8, 18, 48, .55);
  clip-path: polygon(0 0, calc(100% - calc(var(--u) * 1.2)) 0, 100% calc(var(--u) * 1.2), 100% 100%, 0 100%);
  animation: popIn .5s var(--ease) both;
}
.gv-band::before { content: ''; position: absolute; inset: 0; z-index: 2; box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; }
.gv-band::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--u) * .45);
  background: linear-gradient(180deg, var(--ca), var(--cb)); box-shadow: 0 0 calc(var(--u) * 1.4) var(--c);
}
.gv-inner {
  position: relative; height: 100%;
  display: flex; flex-direction: column; gap: min(4cqh, calc(var(--u) * .8));
  padding: min(6cqh, calc(var(--u) * 1.1)) calc(var(--u) * 1.4) min(5cqh, calc(var(--u) * .9)) calc(var(--u) * 1.8);
}

/* På banen: fyldt med gruppens farve og en kraftig kant */
.gv-band.is-now { background: linear-gradient(100deg, color-mix(in srgb, var(--cb) 58%, #0b1a46), color-mix(in srgb, var(--cb) 20%, #07112c)); }
.gv-band.is-now::before { box-shadow: inset 0 0 0 3px var(--c), inset 0 0 calc(var(--u) * 4) color-mix(in srgb, var(--c) 40%, transparent); }
/* Næste hold: guldkant (pulserer under skiftet, når de skal køre ud) */
.gv-band.is-next { background: linear-gradient(100deg, rgba(255, 191, 61, .16), rgba(8, 18, 48, .65) 55%); }
.gv-band.is-next::before { box-shadow: inset 0 0 0 2px #ffbf3d; }
.gv-band.is-go::before { animation: gvGlow 1.2s ease-in-out infinite; }
@keyframes gvGlow { 50% { box-shadow: inset 0 0 0 3px #ffbf3d, inset 0 0 calc(var(--u) * 3) rgba(255, 191, 61, .45); } }
/* Resten: dæmpet, så de to øverste står tydeligt frem */
.gv-band.is-later .gv-inner, .gv-band.is-done .gv-inner { opacity: .7; }

/* Hoved: bogstav · navn · status på én linje */
.gv-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "letter title state";
  align-items: center; column-gap: .5em; row-gap: .3em; min-width: 0;
  font-size: min(14cqh, 3.2cqw);
}
.gv-band.is-now .gv-head { font-size: min(14cqh, 4cqw); }
.gv-letter {
  grid-area: letter; display: grid; place-items: center; width: 1.4em; height: 1.4em;
  font-weight: 900; font-style: italic; color: #fff; text-shadow: 0 1px 3px rgba(4, 9, 24, .5);
  background: linear-gradient(135deg, var(--ca), var(--cb));
  clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
}
.gv-title { grid-area: title; min-width: 0; line-height: 1.02; }
.gv-title b { display: block; font-weight: 900; font-style: italic; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: .1em; }
.gv-title span { display: block; margin-top: .15em; font-size: .4em; color: var(--ink-2); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gv-state { grid-area: state; display: flex; align-items: center; gap: .4em; justify-self: end; min-width: 0; white-space: nowrap; }
.gv-pill {
  font-size: .5em; font-weight: 800; font-stretch: 87.5%; letter-spacing: .14em; text-transform: uppercase; line-height: 1;
  padding: .55em 1em .5em; color: var(--ink-2); background: rgba(124, 141, 182, .22);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
.gv-time { font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; font-size: .9em; line-height: 1; }
.gv-sub { font-size: .4em; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gv-band.is-now .gv-pill { background: linear-gradient(135deg, var(--ca), var(--cb)); color: #fff; text-shadow: 0 1px 2px rgba(4, 9, 24, .5); }
.gv-band.is-now .gv-time {
  font-size: 1.25em;
  background: linear-gradient(180deg, #ffffff 0%, #f1f7ff 44%, var(--ca) 52%, var(--c) 72%, var(--cb) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gv-band.is-next .gv-pill { font-size: .6em; background: linear-gradient(135deg, #ffe7a3, #ff9a1f); color: #2b1600; box-shadow: 0 0 calc(var(--u) * 1.2) rgba(255, 191, 61, .5); }
.gv-band.is-next .gv-time { color: #ffd479; }
.gv-band.is-next .gv-sub { color: #ffe2a8; }
.gv-band.is-done .gv-pill { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }

/* Kørerne i et gitter */
.gv-list {
  flex: 1; min-width: 0; min-height: 0; margin: 0; padding: 0; list-style: none;
  container-type: size;
  display: grid; align-content: center; gap: 0 calc(var(--u) * 1);
  grid-template-columns: repeat(var(--gc-cols, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--gc-rows, 2), minmax(0, 1fr));
}
.gv-row {
  display: flex; align-items: center; gap: .45em; min-width: 0;
  font-size: min(calc(100cqh / var(--gc-rows, 2) * .38), calc(100cqw / var(--gc-cols, 4) * .118), calc(var(--u) * 2.6));
}
.gv-row .av { position: relative; flex: none; width: 1.8em; height: 1.8em; }
.gv-row .av .portrait { width: 100%; height: 100%; font-size: .4em; }
.gv-row .av::after { content: ''; position: absolute; inset: 0; z-index: 5; box-shadow: inset 0 0 0 2px var(--c); }
.gv-nm { min-width: 0; line-height: 1.04; font-stretch: 82%; } /* smal Saira, så lange efternavne kan stå helt */
.gv-nm small { display: block; font-size: .62em; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gv-nm b { display: block; font-weight: 900; font-style: italic; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: .1em; }
.gv-empty { grid-column: 1 / -1; grid-row: 1 / -1; align-self: center; color: var(--ink-3); font-size: min(20cqh, 3cqw); }

/* Små bånd: navn og status til venstre, kørerne til højre */
@container (max-height: 175px) {
  .gv-inner { flex-direction: row; align-items: stretch; gap: calc(var(--u) * 1.2); }
  .gv-head {
    flex: none; width: 34%; align-content: center;
    grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "letter title" "state state";
    font-size: min(21cqh, 2.6cqw);
  }
  .gv-state { justify-self: start; }
}

/* Knappen "Ur | Grupper" i topbjælken: kommer frem, når musen bevæges, og gemmer sig igen efter 2½ sekund
   (pladsen bliver stående, så klokken og knapperne ikke hopper) */
.view-toggle {
  position: relative; z-index: 25;
  display: flex; gap: 2px; padding: 3px;
  background: rgba(4, 9, 24, .85); box-shadow: inset 0 0 0 1px var(--line-2), 0 10px 30px rgba(0, 0, 0, .45);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  transition: opacity .4s, transform .4s var(--ease);
}
.view-toggle button {
  display: inline-flex; align-items: center; gap: .5em;
  height: max(34px, calc(var(--u) * 2.6)); padding: 0 calc(var(--u) * 1.2);
  border: 0; cursor: pointer; background: transparent; color: var(--ink-2);
  font-weight: 700; font-stretch: 87.5%; letter-spacing: .12em; text-transform: uppercase; font-size: max(11px, calc(var(--u) * .8));
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  transition: background .2s, color .2s;
}
.view-toggle button svg { width: 1.4em; height: 1.4em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.view-toggle button:hover { color: #fff; background: rgba(42, 109, 255, .25); }
.view-toggle button[aria-pressed="true"] { background: var(--blue-panel); color: #fff; }
.clock.is-idle .view-toggle { opacity: 0; pointer-events: none; transform: translateY(-8px); }

/* ---------- Alarm-banner + lyd-knap ---------- */
.flash {
  position: absolute; left: 50%; top: 77%; z-index: 30; /* under nedtællingen, så tallet altid kan ses */
  transform: translate(-50%, -50%) skewX(-10deg) scale(.6);
  padding: calc(var(--u) * 1.6) calc(var(--u) * 5);
  max-width: 92%;
  color: #fff; border: calc(var(--u) * .35) solid transparent;
  background: linear-gradient(#071233, #071233) padding-box, linear-gradient(100deg, var(--pca), var(--pcb)) border-box;
  font-weight: 900; font-style: italic; font-stretch: 112%; text-transform: uppercase; text-align: center;
  font-size: calc(var(--u) * 5.4); line-height: 1.05; text-wrap: balance;
  box-shadow: 0 0 calc(var(--u) * 6) color-mix(in srgb, var(--pcb) 60%, transparent), inset 0 0 calc(var(--u) * 3) color-mix(in srgb, var(--pc) 30%, transparent);
  opacity: 0; pointer-events: none;
  transition: opacity .35s, transform .45s var(--ease);
}
/* Vises/skjules af JS (ikke en animation, så den også virker med "reducer bevægelse" slået til) */
.flash.is-on { opacity: 1; transform: translate(-50%, -50%) skewX(-10deg) scale(1); }
/* Browseren må først spille lyd efter et klik — knappen sidder i toppen ved siden af klokken */
.audio-gate { background: linear-gradient(180deg, #ff3fb3, #c2137f); box-shadow: none; color: #fff; animation: blink 2s ease-in-out infinite; }
.audio-gate b { font-weight: 800; }

/* ---------- Smal / stående skærm (telefon) ---------- */
@media (max-aspect-ratio: 5/4) {
  .clock { --u: clamp(7px, 2.3vw, 14px); height: auto; min-height: 100svh; grid-template-rows: auto auto auto auto; }
  .clock-top { flex-wrap: wrap; }
  .top-right { width: 100%; justify-content: space-between; }
  .clock-main { grid-template-columns: 1fr; }
  .dial-wrap { height: min(92vw, 62svh); }
  .dial-box { width: min(100cqw, 100cqh); }
  .cards { grid-template-rows: none; grid-auto-rows: auto; }
  .pcard .portrait { flex: none; aspect-ratio: 4 / 5; }
  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip { flex-wrap: wrap; }
  .strip-item { flex: 1 1 40%; }
  .brand-tag span, .icon-btn span { display: none; }
  /* Grupper på telefon: urskiven øverst, båndene under hinanden med almindelig højde */
  .clock[data-layout="groups"] { grid-template-rows: auto auto; }
  .clock[data-layout="groups"] .clock-main { grid-template-columns: 1fr; }
  .clock[data-layout="groups"] .groups-view { grid-template-rows: none !important; } /* fokus-højderne fra JS gælder kun på TV/skærm */
  .gv-band { container-type: inline-size; }
  .gv-inner { height: auto; padding: 12px 14px 12px 18px; gap: 10px; }
  .gv-head { font-size: 20px; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "letter title" "state state"; }
  .gv-band.is-now .gv-head { font-size: 22px; }
  .gv-state { justify-self: start; }
  .gv-list { container-type: normal; grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gv-row { font-size: 15px; padding: 4px 0; }
  .gv-empty { font-size: 15px; }
  .view-toggle { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); }
  .clock.is-idle .view-toggle { transform: translate(-50%, 8px); }
}

/* =====================================================================
   OPSÆTNING
   ===================================================================== */
.setup { position: relative; background: linear-gradient(180deg, #040918, #050d26 40%, #040918); border-top: 1px solid var(--line); padding-bottom: 96px; }
.wrap { width: min(100% - 2 * var(--gutter), 1320px); margin-inline: auto; }

/* Styring (følger med ned) */
.ctl { position: sticky; top: 0; z-index: 40; background: rgba(4, 9, 24, .86); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.ctl-in { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 12px 0; }
.ctl-status { flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.ctl-status span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.ctl-status .dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--ink-3); }
.ctl[data-mode="running"] .dot { background: var(--up); box-shadow: 0 0 10px var(--up); }
.ctl[data-mode="waiting"] .dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.ctl[data-mode="paused"] .dot { background: var(--pink); box-shadow: 0 0 10px var(--pink); animation: blink 1.6s infinite; }
.ctl-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* Knapper (som på hrcrvintercup.dk) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 26px 13px 22px;
  border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  font-weight: 700; font-stretch: 87.5%; font-size: 14px; letter-spacing: .14em; text-transform: uppercase;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  transition: transform .25s var(--ease), filter .25s, background-color .25s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.15); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: default; transform: none; filter: none; }
.btn--primary { background: var(--blue-panel); color: #fff; box-shadow: 0 10px 30px -10px rgba(42, 109, 255, .8); }
.btn--pink { background: linear-gradient(180deg, #ff3fb3, #c2137f); color: #fff; }
.btn--ghost { background: rgba(42, 109, 255, .14); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn--ghost:hover { background: rgba(42, 109, 255, .28); }
.btn--sm { padding: 9px 18px 9px 15px; font-size: 12px; }

.kicker {
  margin: 0 0 10px; display: inline-flex; align-items: center; gap: 12px;
  font-stretch: 75%; font-weight: 600; font-size: 13px; letter-spacing: .38em; text-transform: uppercase; color: var(--blue-hi);
}
.kicker::before { content: ''; width: 36px; height: 1px; background: linear-gradient(90deg, transparent, currentColor); box-shadow: 0 0 8px currentColor; }
.kicker--pink { color: var(--pink-hi); }


.panel { margin-top: 64px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 28px; margin-bottom: 22px; }
.panel-head h2 {
  margin: -.12em 0 0; padding: .12em .1em 0 0;
  font-weight: 900; font-style: italic; font-stretch: 115%; text-transform: uppercase;
  font-size: clamp(30px, 3.4vw, 48px); line-height: .95;
  background: linear-gradient(180deg, #ffffff 0%, #eef5ff 46%, #9cc4ff 54%, #4a86ff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { margin: 10px 0 0; color: var(--ink-2); max-width: 64ch; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.box {
  position: relative; padding: clamp(16px, 2.2vw, 28px);
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--line);
}
.note { color: var(--ink-3); font-size: 14px; margin: 14px 0 0; }
.note b { color: var(--ink-2); }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; color: var(--cyan); background: rgba(25, 224, 255, .08); padding: 1px 5px; }
.count-line { margin: 0 0 12px; color: var(--ink-2); font-weight: 600; }
.count-line b { color: var(--ink); }
.source { margin: 18px 0 0; color: var(--ink-3); font-size: 13px; }

/* Felter */
.input {
  height: 44px; padding: 0 14px; min-width: 0;
  background: rgba(4, 9, 24, .75); border: 0; color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-2);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
.input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--cyan), inset 0 0 14px rgba(25, 224, 255, .15); }
.input::placeholder { color: var(--ink-3); }
.input--time { width: 120px; font-variant-numeric: tabular-nums; }
.input--sel { height: 40px; padding-right: 8px; }
.search { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; min-width: min(260px, 100%); background: rgba(10, 22, 58, .8); box-shadow: inset 0 0 0 1px var(--line-2); clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
.search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; }
.check-line { display: flex; align-items: center; gap: 10px; margin-top: 16px; color: var(--ink-2); font-size: 14px; cursor: pointer; }
.check-line input { width: 18px; height: 18px; accent-color: var(--blue); }

/* ---------- Trin 1: kørere ---------- */
/* "I dag" øverst (dagens hold), kørerlisten nedenunder. Kortene ligner kørerkortene på hrcrvintercup.dk. */
.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-bottom: 14px; }
.list-head h3 { margin: 0; display: flex; align-items: center; gap: 12px; font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 22px; letter-spacing: .02em; }
.list-count { display: grid; place-items: center; min-width: 34px; height: 28px; padding: 0 8px; font-size: 16px; font-variant-numeric: tabular-nums; background: var(--blue-panel); clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.roster .list-count { background: rgba(124, 141, 182, .25); color: var(--ink-2); }
.link-btn { border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--red); }
.today {
  position: relative; padding: 20px 20px 22px;
  background: linear-gradient(180deg, rgba(42, 109, 255, .16), rgba(10, 22, 58, .55));
  box-shadow: inset 0 0 0 1px var(--line-2);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%);
}
.today::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand-grad); background: linear-gradient(180deg, var(--cyan), var(--blue), #7a5cff); }
.roster { margin-top: 30px; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 10px; }
.picks-label { grid-column: 1 / -1; margin: 12px 0 0; font-stretch: 75%; font-weight: 600; font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--ink-3); }
.picks-empty { grid-column: 1 / -1; margin: 0; padding: 22px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line-2); }
.pick { position: relative; min-width: 0; }
.pick.is-hidden { display: none; }
.pick-main {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column; padding: 0; border: 0; cursor: pointer; text-align: left;
  background: linear-gradient(180deg, #0f2462, #08143c 70%);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  transition: transform .25s var(--ease), filter .25s;
}
.pick-main::before { content: ''; position: absolute; inset: 0; z-index: 3; box-shadow: inset 0 0 0 1px var(--line-2); pointer-events: none; transition: box-shadow .2s; }
.pick-main:hover { transform: translateY(-2px); }
.pick-main:hover::before { box-shadow: inset 0 0 0 1px var(--blue-hi), inset 0 0 24px rgba(42, 109, 255, .25); }
.pick-ph { display: block; aspect-ratio: 4 / 5; font-size: 13px; }
.pick-ph .portrait { width: 100%; height: 100%; }
.pick-ph .portrait::after { content: ''; position: absolute; inset: 62% 0 0; z-index: 2; background: linear-gradient(0deg, #08143c, transparent); }
.pick-txt { position: relative; z-index: 2; display: block; min-width: 0; margin-top: -22px; padding: 0 10px; line-height: 1.08; }
.pick-txt span { display: block; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-txt b { display: block; font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-car {
  align-self: flex-start; margin: 6px 10px 10px; padding: 2px 7px; max-width: calc(100% - 20px);
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
  background: rgba(42, 109, 255, .18); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pick-car--guest { background: rgba(255, 47, 168, .18); color: var(--pink-hi); }
.pick-main > .pick-txt:last-of-type { padding-bottom: 10px; }
.pick-badge {
  position: absolute; top: 8px; right: 8px; z-index: 4;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-style: normal; font-weight: 700; font-size: 18px; line-height: 1;
  background: rgba(4, 9, 24, .7); box-shadow: inset 0 0 0 1.5px var(--line-2); color: var(--ink-2);
}
.pick-badge svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
/* Kørerlisten: lidt dæmpet, så "I dag" står tydeligt */
.roster .pick-main { filter: saturate(.55) brightness(.82); }
.roster .pick-main:hover { filter: none; }
.roster .pick-main:hover .pick-badge { background: var(--blue); color: #fff; box-shadow: 0 0 12px var(--blue); }
/* Valgt i dag: farvet kant og flueben (bliver til × ved hover) */
.pick.is-on .pick-main::before { box-shadow: inset 0 0 0 2px var(--blue-hi), inset 0 0 22px rgba(42, 109, 255, .3); }
.pick.is-on .pick-badge { background: var(--blue); box-shadow: 0 0 12px var(--blue); }
.pick.is-on .pick-main:hover .pick-badge { background: var(--red); box-shadow: 0 0 12px var(--red); }
.pick.is-on .pick-main:hover .pick-badge svg { display: none; }
.pick.is-on .pick-main:hover .pick-badge::after { content: '×'; color: #fff; }
.pick-del {
  position: absolute; top: 8px; left: 8px; z-index: 5;
  width: 26px; height: 26px; border: 0; cursor: pointer; border-radius: 50%;
  background: rgba(4, 9, 24, .75); color: var(--red); font-weight: 800; line-height: 1;
}
.pick-del:hover { background: var(--red); color: #fff; }

.guest-form { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.guest-row { display: flex; flex-wrap: wrap; gap: 8px; }
.guest-row .input:first-child { flex: 1 1 240px; max-width: 360px; }
.input--sm { width: 200px; }

/* ---------- Trin 2: grupper ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; align-items: start; }
.col { --c: var(--ink-3); position: relative; min-width: 0; background: rgba(10, 22, 58, .62); box-shadow: inset 0 0 0 1px var(--line); }
.col::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--ca), var(--cb)); box-shadow: 0 0 16px var(--c); }
.col--pool { background: rgba(4, 9, 24, .55); }
.col--pool::before { background: repeating-linear-gradient(90deg, var(--ink-3) 0 8px, transparent 8px 14px); box-shadow: none; }
.col-head { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; padding: 16px 12px 10px; }
.col-letter { display: grid; place-items: center; width: 34px; height: 34px; background: linear-gradient(135deg, var(--ca), var(--cb)); color: #fff; text-shadow: 0 1px 2px rgba(4, 9, 24, .5); font-weight: 900; font-style: italic; font-size: 18px; border: 0; cursor: pointer; clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.col--pool .col-letter { background: rgba(124, 141, 182, .25); color: var(--ink-2); cursor: default; }
.col-name, .col-tag { min-width: 0; width: 100%; background: transparent; border: 0; padding: 2px 4px; outline: none; box-shadow: inset 0 -1px 0 transparent; transition: box-shadow .2s; }
.col-name { font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 18px; line-height: 1.2; }
.col-tag { grid-column: 2 / 3; font-size: 13px; color: var(--ink-2); }
.col-name:hover, .col-tag:hover { box-shadow: inset 0 -1px 0 var(--line-2); }
.col-name:focus, .col-tag:focus { box-shadow: inset 0 -1px 0 var(--cyan); }
.col-title { font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 18px; }
.col-count { font-weight: 800; font-style: italic; font-size: 20px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.col-tools { grid-column: 3; grid-row: 2; display: flex; gap: 2px; justify-content: flex-end; }
.col-tools button { width: 26px; height: 24px; border: 0; cursor: pointer; background: rgba(42, 109, 255, .14); color: var(--ink-2); font-size: 14px; line-height: 1; }
.col-tools button:hover { background: rgba(42, 109, 255, .35); color: #fff; }
.col-tools button[data-gdel]:hover { background: var(--red); }
.col-body { min-height: 140px; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 6px; transition: background .15s, box-shadow .15s; }
.col-body.is-over { background: color-mix(in srgb, var(--c) 12%, transparent); box-shadow: inset 0 0 0 2px var(--c); }
.col--pool .col-body.is-over { --c: var(--blue-hi); }
.col-empty { padding: 26px 10px; text-align: center; color: var(--ink-3); font-size: 13px; border: 1px dashed var(--line-2); }
.col-foot { padding: 0 12px 12px; color: var(--ink-3); font-size: 12px; letter-spacing: .06em; }

.chip {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 4px 10px 4px 4px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  background: rgba(4, 9, 24, .78); box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .15s, opacity .15s;
}
.chip:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.chip:focus-visible { outline-offset: 1px; }
.chip.is-src { opacity: .3; }
.chip-av { width: 34px; height: 34px; flex: none; font-size: 9px; }
.chip-av .portrait { width: 100%; height: 100%; }
.chip-name { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-car { color: var(--ink-3); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.chip-guest { color: var(--pink-hi); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.ghost { position: fixed; z-index: 1000; left: 0; top: 0; width: 240px; pointer-events: none; transform-origin: 20% 50%; box-shadow: 0 18px 40px rgba(0, 0, 0, .55), inset 0 0 0 1px var(--cyan); cursor: grabbing; }
.drop-mark { height: 3px; margin: -1.5px 0; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }

.menu { position: fixed; z-index: 900; min-width: 230px; padding: 6px; background: var(--panel-solid); box-shadow: 0 18px 50px rgba(0, 0, 0, .6), inset 0 0 0 1px var(--line-2); }
.menu p { margin: 6px 10px 6px; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; cursor: pointer; text-align: left; font-weight: 600; }
.menu button:hover, .menu button:focus-visible { background: rgba(42, 109, 255, .22); outline: none; }
.menu button[aria-current="true"] { color: var(--ink-3); }
.menu i { width: 12px; height: 12px; flex: none; background: var(--ink-3); }
.menu [style] i { background: linear-gradient(135deg, var(--ca), var(--cb)); }
.menu small { margin-left: auto; color: var(--ink-3); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .danger { color: var(--red); }

/* ---------- Trin 3: tidsplan ---------- */
.fields { display: flex; flex-wrap: wrap; align-items: stretch; gap: 14px; }
.field { flex: 1 1 300px; padding: 14px 16px; background: rgba(4, 9, 24, .45); box-shadow: inset 0 0 0 1px var(--line); }
.field label, .mini-label { display: block; margin: 0 0 10px; font-stretch: 75%; font-weight: 700; font-size: 12px; letter-spacing: .26em; text-transform: uppercase; color: var(--ink-3); }
.switch--auto {
  flex: 1 1 100%; display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 4px 14px;
  padding: 14px 16px; background: rgba(42, 109, 255, .12); box-shadow: inset 0 0 0 1px var(--line-2);
}
.switch--auto b { font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 17px; }
.switch--auto small { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  min-width: 52px; height: 46px; padding: 0 12px; border: 0; cursor: pointer;
  font-weight: 900; font-style: italic; font-size: 20px; font-variant-numeric: tabular-nums;
  background: rgba(42, 109, 255, .14); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  transition: background .2s, color .2s;
}
.pill:hover { background: rgba(42, 109, 255, .32); color: var(--ink); }
.pill.is-on { background: var(--blue-panel); color: #fff; box-shadow: 0 0 18px -4px var(--blue); }
/* Custom: feltet foldes først ud, når man trykker på knappen */
.pill--custom { font-size: 13px; font-style: normal; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.pill--custom.is-open { box-shadow: inset 0 0 0 1px var(--cyan); color: var(--ink); }
.custom-in { display: inline-flex; align-items: center; gap: 6px; animation: popIn .3s var(--ease) both; }
.input--custom { width: 112px; height: 46px; text-align: center; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.input--custom.is-bad { box-shadow: inset 0 0 0 2px var(--red), inset 0 0 14px rgba(255, 77, 109, .2); }
.pills .hint { flex-basis: 100%; margin: 4px 0 0; font-size: 13px; color: var(--ink-3); }
/* Automatisk: valget vises, men lidt dæmpet — et tryk gør det til et fast valg */
.pills.is-auto .pill.is-on { background: linear-gradient(180deg, rgba(42, 109, 255, .55), rgba(13, 59, 209, .55)); }
.summary { margin-top: 18px; padding: 18px 20px; background: rgba(42, 109, 255, .1); box-shadow: inset 3px 0 0 var(--blue-hi); }
.plan-text { margin: 0; max-width: 72ch; font-size: 17px; color: var(--ink-2); }
.plan-text b { color: var(--ink); }
.facts { display: flex; flex-wrap: wrap; gap: 10px 34px; margin-top: 14px; }
.facts div { display: flex; flex-direction: column; }
.facts b { font-weight: 900; font-style: italic; font-size: 26px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.facts span { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.summary .warn { margin: 12px 0 0; color: var(--gold); font-size: 14px; }
.hourbar-wrap { margin-top: 22px; }
.hourbar { position: relative; height: 54px; display: flex; background: rgba(4, 9, 24, .6); box-shadow: inset 0 0 0 1px var(--line); }
.hb { position: absolute; top: 0; bottom: 18px; display: grid; place-items: center; overflow: hidden; }
.hb-run { background: linear-gradient(90deg, var(--ca), var(--cb)); color: #fff; text-shadow: 0 1px 2px rgba(4, 9, 24, .5); font-weight: 900; font-style: italic; font-size: 14px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.hb-xfer { background: repeating-linear-gradient(135deg, rgba(255, 191, 61, .38) 0 4px, transparent 4px 8px); }
.hb-t { position: absolute; bottom: 0; transform: translateX(-50%); font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.startrow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin-top: 26px; }
.startnote { flex: 1 1 320px; margin: 0; color: var(--ink-3); font-size: 14px; }
.startnote b { color: var(--ink-2); }

/* ---------- Trin 4: lyd ---------- */
.sound-top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { position: relative; width: 48px; height: 26px; border-radius: 26px; background: rgba(124, 141, 182, .35); transition: background .2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--blue); box-shadow: 0 0 12px var(--blue); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 3px; }
.range, .sel { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.range input { width: 140px; accent-color: var(--blue); }
.cues-head, .cue { display: grid; grid-template-columns: 54px 230px minmax(180px, 1fr) 260px 92px; gap: 10px; align-items: center; }
.cues-head { margin-top: 22px; padding: 0 10px 8px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; border-bottom: 1px solid var(--line); }
.cues { display: flex; flex-direction: column; }
.cue { padding: 10px; border-bottom: 1px solid var(--line); }
.cue.is-off { opacity: .45; }
.cue-when { display: flex; gap: 6px; }
.cue-when .input { width: 74px; text-align: center; font-variant-numeric: tabular-nums; padding: 0 8px; }
.cue-when select { flex: 1; min-width: 0; }
.cue-sound { display: flex; flex-direction: column; gap: 6px; }
.file-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; cursor: pointer; background: rgba(255, 47, 168, .14); box-shadow: inset 0 0 0 1px rgba(255, 111, 198, .4); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:hover { background: rgba(255, 47, 168, .26); }
.cue-acts { display: flex; gap: 4px; justify-content: flex-end; }
.cue-acts button { height: 36px; min-width: 36px; padding: 0 10px; border: 0; cursor: pointer; background: rgba(42, 109, 255, .16); font-weight: 700; font-size: 13px; }
.cue-acts button:hover { background: rgba(42, 109, 255, .4); }
.cue-acts button svg { width: 14px; height: 14px; fill: currentColor; vertical-align: -2px; }
.cue-acts button[data-del-cue]:hover { background: var(--red); }
.cue .input { height: 38px; width: 100%; }
.cue .cue-when .input { width: 74px; flex: none; }
.cue .cue-when select.input { flex: 1; width: auto; min-width: 0; }
.tgl { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.tgl input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tgl span { position: absolute; inset: 0; border-radius: 24px; background: rgba(124, 141, 182, .35); transition: background .2s; }
.tgl span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.tgl input:checked + span { background: var(--blue); }
.tgl input:checked + span::after { transform: translateX(20px); }
.tgl input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.cue-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.panel--keys { margin-top: 48px; }
.keys { color: var(--ink-3); font-size: 14px; margin: 0; }
.keys b { color: var(--ink-2); }
kbd { display: inline-block; padding: 1px 7px; font: 700 12px var(--font); color: var(--ink); background: rgba(42, 109, 255, .2); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .35), inset 0 0 0 1px var(--line-2); }

@media (max-width: 700px) {
  .ctl { position: static; }
}
@media (max-width: 1100px) {
  .cues-head { display: none; }
  .cue { grid-template-columns: 54px 1fr; grid-template-areas: "on when" "text text" "sound sound" "acts acts"; }
  .cue > :nth-child(1) { grid-area: on; }
  .cue > :nth-child(2) { grid-area: when; }
  .cue > :nth-child(3) { grid-area: text; }
  .cue > :nth-child(4) { grid-area: sound; }
  .cue > :nth-child(5) { grid-area: acts; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
