/* Nordschleife Racer v2 — UI styles (menus, HUD, overlays). Everything is scoped under .nr-ui.
   Sizing: one root font-size that follows the viewport (crisp from 720p to 4K); all sizes in em. */

html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
/* Full-screen WebGL canvas (id used by index.html; class for anything else). */
canvas#c, canvas.nr-game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.nr-ui {
  --bg: #07090c;
  --glass: rgba(13, 16, 21, 0.72);
  --glass-2: rgba(22, 26, 33, 0.82);
  --hud: rgba(8, 10, 14, 0.66);
  --hud-2: rgba(8, 10, 14, 0.82);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.16);
  --txt: #f3f5f8;
  --txt-2: rgba(232, 237, 244, 0.70);
  --txt-3: rgba(232, 237, 244, 0.44);
  --txt-hud: rgba(232, 237, 244, 0.6);   /* small HUD captions: a notch brighter than --txt-3 so they stay legible over bright scenery */
  --accent: #ff3b2f;
  --accent-2: #ff7a2f;
  --purple: #b45cff;
  --green: #2fd36b;
  --yellow: #ffd23a;
  --red: #ff453a;
  --amber: #ffad1f;
  --blue: #3a8bff;
  --font: 'Titillium Web', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-num: 'Barlow Condensed', 'Titillium Web', 'Arial Narrow', -apple-system, 'Segoe UI', sans-serif;
  --fs-min: 9.5px;      /* legibility floor for labels: below ~9 px small caps blur at 720p */
  --r: 0.55em;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  position: fixed; inset: 0; z-index: 10;
  pointer-events: none;
  font-family: var(--font);
  font-size: clamp(11px, min(1.6vh, 1.15vw), 36px);
  line-height: 1.25;
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none; -webkit-user-select: none;
  font-variant-numeric: tabular-nums;
}
.nr-ui *, .nr-ui *::before, .nr-ui *::after { box-sizing: border-box; }
.nr-ui [hidden] { display: none !important; }
/* Zero-specificity reset so every component class below wins without !important. */
:where(.nr-ui) :where(button) { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; margin: 0; }
.nr-ui kbd {
  display: inline-block; min-width: 1.6em; padding: 0.1em 0.45em; border-radius: 0.3em;
  font: 600 max(var(--fs-min), 0.72em)/1.4 var(--font); letter-spacing: 0.04em; text-align: center;
  color: var(--txt-2); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom-width: 2px;
}
.nr-screen { position: absolute; inset: 0; pointer-events: auto; }
/* Stacking order of the layers inside .nr-ui (explicit, not DOM order: every layer is its own stacking context,
   so z-indices used inside a screen — the menu columns, sticky table heads — can never leak above another
   screen). HUD 1 < start lights 2 < toasts 3 < results 4 < pause 5 < menu 6 < loading 7 < controls help 8.
   The lights and toasts sit under every full-screen overlay: a pause during the start sequence blurs the
   gantry like the rest of the scene. */
.nr-hud { z-index: 1; }
.nr-results { z-index: 4; }
.nr-pause { z-index: 5; }
.nr-menu { z-index: 6; isolation: isolate; }
.nr-loading { z-index: 7; }
.nr-help { z-index: 8; }
.nr-ui :focus { outline: none; }
.nr-ui .nr-btn:focus-visible, .nr-ui .nr-chip:focus-visible, .nr-ui .nr-start:focus-visible {
  outline: 2px solid #fff; outline-offset: 3px;
}

/* ============================================================================================
   Buttons / chips
   ============================================================================================ */
.nr-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 1em;
  min-width: 11em; padding: 0.8em 1.1em; border-radius: var(--r);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-2) !important;
  font-weight: 700; font-size: 0.95em; letter-spacing: 0.09em; text-transform: uppercase;
  transition: background 0.18s, transform 0.18s var(--ease), border-color 0.18s;
}
.nr-btn:hover, .nr-btn:focus-visible { background: rgba(255, 255, 255, 0.13); border-color: rgba(255, 255, 255, 0.4) !important; }
.nr-btn.primary { background: linear-gradient(100deg, var(--accent), var(--accent-2)); border-color: transparent !important; color: #fff; }
.nr-btn.primary kbd { color: #fff; background: rgba(0, 0, 0, 0.18); border-color: rgba(255, 255, 255, 0.35); }
.nr-btn.primary:hover, .nr-btn.primary:focus-visible { filter: brightness(1.08); }
.nr-btn.ghost { min-width: 0; padding: 0.55em 1em; }
.nr-btn:active { transform: scale(0.97); }

.nr-chip {
  display: inline-flex; align-items: center; gap: 0.55em; height: 2.3em; padding: 0 0.95em;
  border-radius: 2em; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-2) !important;
  font-weight: 600; font-size: 0.85em; letter-spacing: 0.04em; color: var(--txt-2);
  transition: background 0.18s, color 0.18s;
}
.nr-chip:hover { background: rgba(255, 255, 255, 0.12); color: var(--txt); }
.nr-led {
  display: inline-block; width: 0.6em; height: 0.6em; border-radius: 50%; flex: none;
  background: #6b7280; box-shadow: 0 0 0 0.18em rgba(107, 114, 128, 0.2);
}
[data-status="connected"] .nr-led { background: var(--green); box-shadow: 0 0 0 0.18em rgba(47, 211, 107, 0.25), 0 0 0.8em var(--green); }
[data-status="ready"] .nr-led { background: var(--amber); box-shadow: 0 0 0 0.18em rgba(255, 173, 31, 0.22); animation: nr-pulse 1.6s infinite; }
[data-status="connecting"] .nr-led, [data-status="starting"] .nr-led { background: var(--blue); animation: nr-pulse 1s infinite; }
[data-status="offline"] .nr-led { background: var(--red); box-shadow: 0 0 0 0.18em rgba(255, 69, 58, 0.2); }
@keyframes nr-pulse { 50% { opacity: 0.35; } }

/* ============================================================================================
   Main menu
   ============================================================================================ */
.nr-menu {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 1.1em;
  padding: 1.5em 2em 1.3em;
  background: var(--bg);
  overflow: hidden;
}
.nr-menu-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(70em 45em at 8% -10%, rgba(38, 120, 70, 0.30), transparent 60%),
    radial-gradient(60em 40em at 105% 110%, rgba(255, 59, 47, 0.16), transparent 60%),
    radial-gradient(50em 40em at 60% 40%, rgba(80, 110, 160, 0.10), transparent 70%),
    linear-gradient(180deg, #0a0d11 0%, #06080a 100%);
}
.nr-menu-bgmap { position: absolute; inset: -4% -6% -10% 30%; transform: rotate(-8deg); opacity: 0.9; }
.nr-menu-bgmap svg { width: 100%; height: 100%; }
.nr-menu-bgmap svg .nr-map-base { stroke: rgba(255, 255, 255, 0.025); stroke-width: 34px; }
.nr-menu-bgmap svg .nr-map-line { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1.5px; }
.nr-menu-bgmap svg .nr-map-glow { display: none; }
.nr-menu-grain { position: absolute; inset: 0;
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay; }
.nr-menu > header, .nr-menu > main, .nr-menu > footer { position: relative; z-index: 1; }

.nr-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 2em; }
.nr-brand { display: flex; align-items: center; gap: 1em; }
.nr-brand-mark {
  width: 3.2em; height: 3.2em; border-radius: 0.6em; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--accent), #b3160d); color: #fff;
  box-shadow: 0 0.6em 1.6em rgba(255, 59, 47, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transform: skewX(-8deg);
}
.nr-brand-mark svg { width: 62%; height: 62%; transform: skewX(8deg); }
.nr-brand h1 {
  margin: 0; font: italic 800 2.5em/0.95 var(--font-num); letter-spacing: 0.01em; text-transform: uppercase;
}
.nr-brand h1 b { color: var(--accent); font-weight: 800; }
.nr-brand p { margin: 0.25em 0 0; color: var(--txt-3); font-size: max(var(--fs-min), 0.82em); letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; }
.nr-head-right { display: flex; gap: 0.7em; }

.nr-menu-grid {
  display: grid; grid-template-columns: 1.1fr 1fr 0.94fr; gap: 1.1em; min-height: 0;
}
.nr-col {
  min-height: 0; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 0.35em;
  padding: 1em 1em 1.1em;
  border-radius: 0.9em;
  background: linear-gradient(180deg, rgba(20, 24, 30, 0.78), rgba(12, 15, 19, 0.78));
  border: 1px solid var(--line);
  box-shadow: 0 1.5em 3em rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px) saturate(130%); -webkit-backdrop-filter: blur(12px) saturate(130%);
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.nr-sec-title {
  display: flex; align-items: center; gap: 0.7em; margin: 0.25em 0.5em 0.35em;
  font: 700 max(var(--fs-min), 0.78em)/1 var(--font); letter-spacing: 0.22em; text-transform: uppercase; color: var(--txt-2);
}
.nr-sec-title span { font: italic 800 1.25em/1 var(--font-num); color: var(--accent); letter-spacing: 0.02em; }
.nr-sec-title:not(:first-child) { margin-top: 0.9em; }

/* Rows */
.nr-row {
  position: relative; display: grid; gap: 0.4em; padding: 0.5em 0.6em; border-radius: 0.55em;
  transition: background 0.2s;
  outline: none;
}
.nr-row::before {
  content: ''; position: absolute; left: 0; top: 0.55em; bottom: 0.55em; width: 0.2em; border-radius: 0.2em;
  background: var(--accent); transform: scaleY(0); transition: transform 0.25s var(--ease);
}
.nr-row:focus { background: rgba(255, 255, 255, 0.045); }
.nr-row:focus::before { transform: scaleY(1); }
.nr-row.disabled { opacity: 0.38; }
.nr-row.disabled .nr-ctl { pointer-events: none; }
.nr-row-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.6em;
  font-weight: 700; font-size: max(var(--fs-min), 0.72em); letter-spacing: 0.15em; text-transform: uppercase; color: var(--txt-3);
}
.nr-row:focus .nr-row-label { color: var(--txt-2); }
.nr-row-badge { font-style: normal; letter-spacing: 0.06em; color: var(--txt-2); font-weight: 600; text-transform: none; font-size: 1.05em; }
.nr-row-note { font-size: max(var(--fs-min), 0.8em); color: var(--txt-3); line-height: 1.35; min-height: 1.35em; }
.nr-row.compact { grid-template-columns: minmax(7.5em, 0.9fr) 1.5fr; align-items: center; padding: 0.38em 0.6em; }
.nr-row.compact .nr-row-label { font-size: max(var(--fs-min), 0.7em); }

/* Segmented control */
.nr-ctl-seg {
  display: flex; gap: 0.2em; padding: 0.2em; border-radius: 0.5em;
  background: rgba(0, 0, 0, 0.38); border: 1px solid var(--line);
}
.nr-ctl-seg .nr-opt {
  flex: 1 1 0; min-width: 0; padding: 0.42em 0.4em; border-radius: 0.36em;
  font-weight: 600; font-size: 0.88em; color: var(--txt-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.nr-ctl-seg .nr-opt:hover { color: var(--txt); background: rgba(255, 255, 255, 0.06); }
.nr-ctl-seg .nr-opt.sel {
  background: linear-gradient(180deg, #ffffff, #dfe3e8); color: #0b0d10; font-weight: 700;
  box-shadow: 0 0.2em 0.6em rgba(0, 0, 0, 0.35);
}
.nr-row.compact .nr-ctl-seg .nr-opt { font-size: max(var(--fs-min), 0.8em); padding: 0.36em 0.3em; }
.nr-row:focus .nr-ctl-seg .nr-opt.sel { box-shadow: 0 0 0 1px #fff, 0 0.25em 0.9em rgba(255, 255, 255, 0.18); }

/* Cards (track / car) */
.nr-ctl-cards { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.55em; }
.nr-ctl-cards .nr-opt {
  text-align: left; border-radius: 0.6em; padding: 0.6em 0.65em;
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line) !important;
  color: var(--txt-2); transition: border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
}
.nr-ctl-cards .nr-opt:hover { background: rgba(255, 255, 255, 0.06); color: var(--txt); }
.nr-ctl-cards .nr-opt.sel {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border-color: rgba(255, 255, 255, 0.75) !important; color: var(--txt);
  box-shadow: 0 0.6em 1.5em rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.nr-row:focus .nr-ctl-cards .nr-opt.sel { border-color: #fff !important; box-shadow: 0 0 0 1px #fff, 0 0.6em 1.6em rgba(0, 0, 0, 0.4); }

.nr-tcard { display: grid; grid-template-columns: 3.4em 1fr; gap: 0.6em; align-items: center; }
.nr-tcard-map { width: 3.4em; height: 2.6em; }
.nr-tcard-map svg { width: 100%; height: 100%; }
.nr-tcard-map .nr-map-base { stroke: rgba(255, 255, 255, 0.12); stroke-width: 4px; }
.nr-tcard-map .nr-map-line { stroke: currentColor; stroke-width: 1.4px; }
.nr-opt.sel .nr-tcard-map .nr-map-line { stroke: var(--accent); }
.nr-tcard-txt b { display: block; font-weight: 700; font-size: 1em; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-tcard-txt span { font-size: max(var(--fs-min), 0.8em); color: var(--txt-3); }

/* Track detail */
.nr-track-detail {
  display: grid; grid-template-rows: auto minmax(7em, 1fr) auto auto; gap: 0.5em;
  flex: 1 1 auto; min-height: 15em; margin: 0.2em 0.6em 0;
}
.nr-detail-name b { display: block; font: italic 800 1.6em/1 var(--font-num); text-transform: uppercase; letter-spacing: 0.01em; }
.nr-detail-name span { font-size: max(var(--fs-min), 0.8em); color: var(--txt-3); }
.nr-detail-map {
  position: relative; min-height: 0; border-radius: 0.6em; overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.04), transparent 70%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 2.2em),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 2.2em),
    rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
}
.nr-detail-map > svg { position: absolute; inset: 0.6em; width: calc(100% - 1.2em); height: calc(100% - 1.2em); }
.nr-map-missing { position: absolute; inset: 0; display: grid; place-items: center; color: var(--txt-3); font-size: 0.85em; }
.nr-map .nr-map-glow { stroke: rgba(255, 59, 47, 0.18); stroke-width: 12px; filter: blur(3px); }
.nr-map .nr-map-base { stroke: rgba(0, 0, 0, 0.75); stroke-width: 7px; }
.nr-map .nr-map-line { stroke: rgba(255, 255, 255, 0.9); stroke-width: 2.4px; }
.nr-map .nr-map-sector { stroke-width: 2.6px; }
.nr-map .nr-map-sector.s1 { stroke: #ff5145; }
.nr-map .nr-map-sector.s2 { stroke: #39a8ff; }
.nr-map .nr-map-sector.s3 { stroke: #ffd23a; }
.nr-map .nr-map-tick { stroke: #fff; stroke-width: 2px; }
.nr-map .nr-map-start { stroke: #fff; stroke-width: 4px; }
.nr-map .nr-map-arrow { stroke: #fff; stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
.nr-map-legend { position: absolute; right: 0.6em; bottom: 0.5em; display: flex; gap: 0.7em; font-size: max(var(--fs-min), 0.7em); font-weight: 700; color: var(--txt-2); letter-spacing: 0.08em; }
.nr-map-legend i { display: inline-block; width: 1.1em; height: 0.25em; border-radius: 1em; margin-right: 0.35em; vertical-align: middle; }
.nr-map-legend i.s1 { background: #ff5145; } .nr-map-legend i.s2 { background: #39a8ff; } .nr-map-legend i.s3 { background: #ffd23a; }

.nr-detail-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4em; }
.nr-stat { padding: 0.4em 0.5em; border-radius: 0.45em; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); min-width: 0; }
.nr-stat span { display: block; font-size: max(var(--fs-min), 0.62em); letter-spacing: 0.13em; text-transform: uppercase; color: var(--txt-3); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-stat b { font: 700 1.25em/1.1 var(--font-num); }
.nr-detail-elev { display: grid; gap: 0.2em; }
.nr-elev-head { display: flex; justify-content: space-between; font-size: max(var(--fs-min), 0.66em); font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--txt-3); }
.nr-elev { width: 100%; height: 3.4em; display: block; }
.nr-elev .nr-elev-stop-a { stop-color: rgba(47, 211, 107, 0.45); }
.nr-elev .nr-elev-stop-b { stop-color: rgba(47, 211, 107, 0.02); }
.nr-elev .nr-elev-line { stroke: #6ff0a0; stroke-width: 1.5px; }
.nr-elev .nr-elev-sep { stroke: rgba(255, 255, 255, 0.22); stroke-width: 1px; stroke-dasharray: 3 3; }

/* Car card */
.nr-ccard { display: grid; gap: 0.45em; min-width: 0; }
.nr-ccard-head { display: flex; align-items: center; gap: 0.5em; min-width: 0; }
.nr-class {
  font: italic 800 0.8em/1 var(--font-num); letter-spacing: 0.06em; padding: 0.25em 0.45em; border-radius: 0.25em;
  background: var(--amber); color: #111; flex: none;
}
.nr-class.f1 { background: var(--accent); color: #fff; }
.nr-ccard-name { font-weight: 700; font-size: 1.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-ccard-sub { font-size: max(var(--fs-min), 0.74em); color: var(--txt-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25em 0.6em; }
.nr-spec span { display: block; font-size: max(var(--fs-min), 0.6em); letter-spacing: 0.14em; text-transform: uppercase; color: var(--txt-3); font-weight: 700; white-space: nowrap; }
.nr-spec b { font: 700 1.3em/1.05 var(--font-num); color: var(--txt); }
.nr-spec small { font: 600 max(var(--fs-min), 0.55em) var(--font); color: var(--txt-3); margin-left: 0.25em; letter-spacing: 0.04em; }
.nr-bars { display: grid; gap: 0.25em; }
.nr-bar { display: grid; grid-template-columns: 5.6em 1fr; align-items: center; gap: 0.5em; }
.nr-bar span { font-size: max(var(--fs-min), 0.6em); letter-spacing: 0.12em; text-transform: uppercase; color: var(--txt-3); font-weight: 700; }
.nr-bar i { height: 0.32em; border-radius: 1em; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.nr-bar u { display: block; height: 100%; border-radius: 1em; background: linear-gradient(90deg, rgba(255, 255, 255, 0.5), #fff); }
.nr-opt.sel .nr-bar u { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* Car silhouettes */
.nr-ccard-art { height: 3.4em; margin: 0.15em 0 0; }
.nr-car-art { width: 100%; height: 100%; display: block; overflow: visible; }
.nr-art-shadow { fill: rgba(0, 0, 0, 0.55); }
.nr-art-body, .nr-art-wing { fill: rgba(255, 255, 255, 0.13); stroke: rgba(255, 255, 255, 0.32); stroke-width: 0.6; stroke-linejoin: round; transition: fill 0.25s; }
.nr-art-glass { fill: rgba(6, 9, 13, 0.85); }
.nr-art-stripe { stroke: var(--accent); stroke-width: 2.2; opacity: 0; transition: opacity 0.25s; }
.nr-art-detail { stroke: rgba(0, 0, 0, 0.35); stroke-width: 0.8; }
.nr-art-tyre { fill: #07090b; stroke: rgba(255, 255, 255, 0.22); stroke-width: 0.6; }
.nr-art-rim { fill: #31363e; }
.nr-art-hub { fill: #b9c0c9; }
.nr-opt.sel .nr-art-body, .nr-opt.sel .nr-art-wing { fill: #e8ecf1; stroke: #fff; }
.nr-opt.sel .nr-art-stripe { opacity: 1; }
.nr-opt.sel .nr-art-rim { fill: #8c96a1; }

/* Toggle */
.nr-ctl-toggle { display: flex; align-items: center; gap: 0.7em; justify-content: flex-end; }
.nr-switch {
  position: relative; width: 2.7em; height: 1.45em; border-radius: 1em; background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line-2) !important; transition: background 0.22s;
}
.nr-switch-knob {
  position: absolute; top: 50%; left: 0.18em; width: 1.05em; height: 1.05em; border-radius: 50%;
  background: #cfd5dc; transform: translate(0, -50%); transition: transform 0.25s var(--ease), background 0.2s;
  box-shadow: 0 0.1em 0.3em rgba(0, 0, 0, 0.5);
}
.nr-switch.on { background: var(--green); border-color: transparent !important; }
.nr-switch.on .nr-switch-knob { transform: translate(1.22em, -50%); background: #fff; }
.nr-switch-text { width: 2em; font-size: max(var(--fs-min), 0.82em); font-weight: 700; color: var(--txt-2); }

/* Stepper */
.nr-ctl-stepper { display: grid; grid-template-columns: 2.2em 3.6em 2.2em 1fr; align-items: center; gap: 0.35em; }
.nr-step {
  height: 2.2em; border-radius: 0.4em; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line-2) !important;
  font-size: 1em; font-weight: 700;
}
.nr-step:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); }
.nr-step:disabled { opacity: 0.3; cursor: default; }
.nr-step-val { text-align: center; font: 700 1.5em/1 var(--font-num); }
.nr-dots { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 0.22em; margin-left: 0.4em; height: 1.25em; }
.nr-dot { border-radius: 0.2em; background: rgba(255, 255, 255, 0.07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); transition: background 0.15s, transform 0.15s; }
.nr-dot.on { background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.6)); }
.nr-dot:hover { transform: scaleY(1.15); }
.nr-row:focus .nr-dot.on { background: #fff; }

/* Slider */
.nr-ctl-slider { display: flex; align-items: center; gap: 0.7em; }
.nr-slider { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 0.35em; border-radius: 1em; outline: none; cursor: pointer; margin: 0;
  background: linear-gradient(90deg, #fff var(--fill, 50%), rgba(255, 255, 255, 0.14) var(--fill, 50%)); }
.nr-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 1.1em; height: 1.1em; border-radius: 50%; background: #fff; box-shadow: 0 0 0 0.25em rgba(255, 255, 255, 0.15); }
.nr-slider::-moz-range-thumb { width: 1.1em; height: 1.1em; border: 0; border-radius: 50%; background: #fff; }
.nr-slider-val { width: 2.8em; text-align: right; font: 700 1.05em var(--font-num); color: var(--txt-2); }

/* Phone panel */
.nr-phone {
  display: grid; grid-template-columns: 6.6em 1fr; gap: 0.85em; align-items: center;
  margin: 0.8em 0.4em 0; padding: 0.75em; border-radius: 0.7em;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line);
}
.nr-phone[data-status="connected"] { border-color: rgba(47, 211, 107, 0.5); background: linear-gradient(135deg, rgba(47, 211, 107, 0.12), rgba(255, 255, 255, 0.02)); }
.nr-qr { width: 6.6em; height: 6.6em; padding: 0.4em; border-radius: 0.45em; background: #fff; display: grid; place-items: center; }
.nr-qr svg { width: 100%; height: 100%; display: block; }
.nr-qr-wait { color: #445; font-size: max(var(--fs-min), 0.7em); font-weight: 700; text-align: center; }
.nr-phone[data-status="connected"] .nr-qr { opacity: 0.55; }
.nr-phone-txt { min-width: 0; }
.nr-phone-title { font-weight: 700; font-size: 0.92em; }
.nr-phone-codeline { display: flex; align-items: baseline; gap: 0.5em; margin-top: 0.15em; }
.nr-phone-codeline span { font-size: max(var(--fs-min), 0.66em); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--txt-3); }
.nr-qr-code { font: 800 1.55em/1 var(--font-num); letter-spacing: 0.16em; color: #fff; }
.nr-qr-status { display: flex; align-items: center; gap: 0.5em; margin-top: 0.3em; font-size: max(var(--fs-min), 0.8em); font-weight: 600; color: var(--txt-2); }
.nr-phone-steps { margin-top: 0.3em; font-size: max(var(--fs-min), 0.72em); line-height: 1.35; color: var(--txt-3); }
.nr-qr-url { margin-top: 0.2em; font-size: max(var(--fs-min), 0.66em); color: var(--txt-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Footer */
.nr-menu-foot { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1.5em; }
.nr-hints { display: flex; gap: 1.1em; color: var(--txt-3); font-size: max(var(--fs-min), 0.8em); font-weight: 600; }
.nr-hint { display: inline-flex; align-items: center; gap: 0.4em; white-space: nowrap; }
.nr-summary { text-align: right; font-size: 0.88em; font-weight: 600; color: var(--txt-2); letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-start {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 1em;
  height: 3.3em; padding: 0 1.6em 0 1.9em; border-radius: 0.6em;
  background: linear-gradient(100deg, var(--accent) 0%, #ff5a2a 60%, var(--accent-2) 100%);
  color: #fff; font: italic 800 1.4em/1 var(--font-num); letter-spacing: 0.06em; text-transform: uppercase;
  box-shadow: 0 0.7em 2em rgba(255, 59, 47, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transform: skewX(-6deg);
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.nr-start > span, .nr-start > kbd { transform: skewX(6deg); }
.nr-start kbd { font-style: normal; color: #fff; background: rgba(0, 0, 0, 0.2); border-color: rgba(255, 255, 255, 0.4); font-size: max(var(--fs-min), 0.48em); }
.nr-start:hover, .nr-start:focus-visible { box-shadow: 0 0.9em 2.4em rgba(255, 59, 47, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.nr-start-sheen {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transform: translateX(-120%); animation: nr-sheen 3.6s ease-in-out infinite 1.2s;
}
@keyframes nr-sheen { 0% { transform: translateX(-120%); } 35%, 100% { transform: translateX(120%); } }

/* Narrow screens: two columns, the setup column spans the bottom, the grid scrolls. */
@media (max-width: 1180px), (max-aspect-ratio: 4/3) {
  /* Rows must size to their content (max-content), otherwise the scrolling grid squeezes them to fit. */
  .nr-menu-grid { grid-template-columns: 1fr 1fr; grid-auto-rows: max-content; overflow-y: auto; align-content: start;
    scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; padding-right: 0.2em; }
  .nr-col { overflow: visible; min-height: auto; }
  .nr-track-detail { min-height: 0; grid-template-rows: auto 13em auto auto; }
  .nr-col-setup { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; column-gap: 1em; align-items: start; }
  .nr-col-setup > .nr-phone { grid-column: 1 / -1; }
  .nr-hints { display: none; }
  .nr-menu-foot { grid-template-columns: minmax(0, 1fr) auto; }
}

/* ============================================================================================
   HUD
   ============================================================================================ */
.nr-hud { position: absolute; inset: 0; pointer-events: none; font-size: 1em; }
.nr-hud-tl { position: absolute; left: 1.5em; top: 1.5em; width: 14.5em; display: grid; gap: 0.45em; }
.nr-hud-tr { position: absolute; right: 1.5em; top: 1.5em; width: 28em; display: grid; gap: 0.4em; }
.nr-hud-bl { position: absolute; left: 1.5em; bottom: 1.5em; }
.nr-hud-br { position: absolute; right: 1.5em; bottom: 1.5em; }

.nr-session {
  display: flex; align-items: center; gap: 0.6em; padding: 0.4em 0.7em; border-radius: 0.4em;
  background: var(--hud-2); border-left: 0.22em solid var(--accent);
  font-size: max(var(--fs-min), 0.8em); text-transform: uppercase; letter-spacing: 0.12em;
}
.nr-session b { font-weight: 800; white-space: nowrap; flex: none; }
.nr-session span { min-width: 0; color: var(--txt-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Timing tower */
.nr-tower { border-radius: 0.5em; overflow: hidden; background: var(--hud); box-shadow: 0 0.6em 1.6em rgba(0, 0, 0, 0.35); }
.nr-tower.hidden { display: none; }
.nr-tower-head {
  display: flex; justify-content: space-between; align-items: center; padding: 0.4em 0.7em;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  font-size: max(var(--fs-min), 0.74em); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--txt-2);
}
.nr-tower-head b { color: var(--txt); font: 800 1.25em/1 var(--font-num); letter-spacing: 0.04em; }
.nr-tower-list { list-style: none; margin: 0; padding: 0.2em 0; }
.nr-trow {
  position: relative; display: grid; grid-template-columns: 1.9em 0.22em 3.2em 1fr auto; align-items: center; gap: 0.45em;
  height: 1.62em; padding: 0 0.6em 0 0.2em; font-size: 0.92em;
}
.nr-tower.dense .nr-trow { height: 1.46em; font-size: 0.86em; }
.nr-trow + .nr-trow { border-top: 1px solid rgba(255, 255, 255, 0.04); }
.nr-trow-pos { text-align: center; font: 700 1.05em/1 var(--font-num); color: var(--txt-2); }
.nr-trow-team { height: 1.05em; border-radius: 0.1em; background: var(--team, #888); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }
.nr-trow-abbr { font: 700 1.08em/1 var(--font-num); letter-spacing: 0.06em; }
.nr-trow-tag { font: 700 max(var(--fs-min), 0.72em)/1 var(--font); color: var(--yellow); justify-self: start; }
.nr-trow-tag.pen { padding: 0.15em 0.3em; border-radius: 0.2em; background: rgba(255, 210, 58, 0.15); }
.nr-trow-gap { font: 600 1em/1 var(--font-num); color: var(--txt-2); text-align: right; letter-spacing: 0.02em; white-space: nowrap; }
.nr-trow-gap.none { font: 700 max(var(--fs-min), 0.72em)/1 var(--font); letter-spacing: 0.12em; color: var(--txt-3); }
.nr-trow.me .nr-trow-gap.none { color: rgba(11, 13, 16, 0.55); }
.nr-trow.me { background: linear-gradient(90deg, #fff, #e9edf2); color: #0b0d10; }
.nr-trow.me .nr-trow-pos, .nr-trow.me .nr-trow-gap { color: #0b0d10; }
.nr-trow.up::after, .nr-trow.down::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 100%; pointer-events: none;
  background: linear-gradient(90deg, rgba(47, 211, 107, 0.45), transparent 60%); animation: nr-fade 2.2s forwards;
}
.nr-trow.down::after { background: linear-gradient(90deg, rgba(255, 69, 58, 0.45), transparent 60%); }
.nr-trow.done .nr-trow-gap::before { content: '\2691\00a0'; color: inherit; }
@keyframes nr-fade { 0%, 40% { opacity: 1; } 100% { opacity: 0; } }

/* Position / lap / timing panel. Two short rows (about 8.5em in all, bottom edge at ~10em = 0.14 of the screen height
   at 720p): the cockpit's rear-view mirror starts at ~0.21 of the screen height on the right and the panel used to
   cover its top (the sector boxes), so it has to stay above that line in every view. */
.nr-trtop { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 0.4em; }
.nr-big {
  min-width: 4.8em; padding: 0.4em 0.7em 0.45em; border-radius: 0.5em; background: var(--hud-2);
  box-shadow: 0 0.6em 1.6em rgba(0, 0, 0, 0.3);
}
.nr-big > span { display: block; font-size: max(var(--fs-min), 0.66em); font-weight: 700; letter-spacing: 0.2em; color: var(--txt-hud); }
.nr-big b { font: 700 2.5em/0.95 var(--font-num); display: inline-block; transform-origin: 0 80%; }
.nr-big small { font: 600 1.3em/1 var(--font-num); color: var(--txt-3); margin-left: 0.12em; }
.nr-pos.solo { opacity: 0.45; }
.nr-timing {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5em; min-width: 0;
  padding: 0.4em 0.75em 0.45em; border-radius: 0.5em; background: var(--hud-2); box-shadow: 0 0.6em 1.6em rgba(0, 0, 0, 0.3);
}
.nr-cur { min-width: 0; }
.nr-curtag { display: block; font-size: max(var(--fs-min), 0.66em); font-weight: 700; letter-spacing: 0.2em; color: var(--txt-hud); white-space: nowrap; }
.nr-curtime { font: 700 2.3em/0.98 var(--font-num); letter-spacing: 0.01em; white-space: nowrap; }
.nr-cur.invalid .nr-curtag { color: var(--red); font-weight: 800; }
.nr-cur.invalid .nr-curtime { color: var(--txt-3); text-decoration: line-through; text-decoration-thickness: 0.06em; text-decoration-color: var(--red); }
.nr-delta {
  flex: none; min-width: 4.9em; padding: 0.2em 0.5em; border-radius: 0.3em; text-align: center;
  font: 700 1.2em/1.1 var(--font-num); letter-spacing: 0.02em; color: #fff; background: rgba(255, 255, 255, 0.08);
  transition: background 0.25s;
}
.nr-delta:empty { visibility: hidden; }
.nr-delta[data-sign="neg"] { background: #17a34a; }
.nr-delta[data-sign="pos"] { background: #d4302a; }
.nr-trbot {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 0.6em; align-items: center;
  padding: 0.45em 0.6em 0.5em; border-radius: 0.5em; background: var(--hud); box-shadow: 0 0.6em 1.6em rgba(0, 0, 0, 0.3);
}
.nr-lb { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5em; }
.nr-lb > div { padding: 0.2em 0.35em; margin: -0.2em -0.35em; border-radius: 0.3em; }
.nr-lb span { display: block; font-size: max(var(--fs-min), 0.62em); font-weight: 700; letter-spacing: 0.18em; color: var(--txt-hud); }
.nr-lb b { font: 600 1.18em/1.1 var(--font-num); white-space: nowrap; }
.nr-lb .best.ob b { color: var(--purple); }
.nr-sectors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.3em; }
.nr-sector {
  position: relative; padding: 0.2em 0.4em 0.25em; border-radius: 0.3em; background: rgba(255, 255, 255, 0.06);
  border-bottom: 0.2em solid rgba(255, 255, 255, 0.12);
}
.nr-sector span { display: block; font-size: max(var(--fs-min), 0.6em); font-weight: 800; letter-spacing: 0.14em; color: var(--txt-hud); }
.nr-sector b { display: block; min-height: 1.1em; font: 600 0.95em/1.1 var(--font-num); white-space: nowrap; }
.nr-sector.active { border-bottom-color: rgba(255, 255, 255, 0.7); animation: nr-pulse 1.4s infinite; }
.nr-sector.ob { border-bottom-color: var(--purple); background: rgba(180, 92, 255, 0.22); }
.nr-sector.pb { border-bottom-color: var(--green); background: rgba(47, 211, 107, 0.2); }
.nr-sector.slow { border-bottom-color: var(--yellow); background: rgba(255, 210, 58, 0.16); }
.nr-sector.inv { border-bottom-color: var(--red); background: rgba(255, 69, 58, 0.10); }
.nr-sector.inv b { color: var(--txt-2); text-decoration: line-through; text-decoration-color: rgba(255, 69, 58, 0.8); }
/* Narrow windows (portrait): the wide panel would run into the start-light gantry, so it stacks again. */
@media (max-width: 880px) {
  .nr-hud-tr { width: 19em; }
  .nr-trtop { grid-template-columns: 1fr 1fr; }
  .nr-timing { grid-column: 1 / -1; }
  .nr-trbot { grid-template-columns: minmax(0, 1fr); gap: 0.45em; }
}

/* Minimap */
.nr-minimap {
  position: relative; width: 15.5em; height: 12em; border-radius: 0.6em; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, rgba(20, 26, 32, 0.6), rgba(6, 8, 11, 0.72));
  box-shadow: 0 0.6em 1.6em rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.nr-minimap-canvas { position: absolute; left: 0; top: 0; width: 100%; height: calc(100% - 2em); display: block; }
.nr-minimap-corner {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2em; display: flex; align-items: center; justify-content: space-between; gap: 0.5em;
  padding: 0 0.7em; background: rgba(0, 0, 0, 0.45); border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.nr-minimap-corner b { font: 700 1.02em/1 var(--font-num); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-minimap-corner span { font: 600 max(var(--fs-min), 0.82em)/1 var(--font-num); color: var(--txt-3); white-space: nowrap; }

/* Instrument cluster */
.nr-cluster {
  width: 22.5em; padding: 0.75em 0.9em 0.7em; border-radius: 0.8em;
  background: linear-gradient(180deg, rgba(10, 12, 16, 0.72), rgba(6, 8, 11, 0.84));
  box-shadow: 0 0.8em 2em rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: grid; gap: 0.5em;
}
.nr-leds { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 0.28em; padding: 0 0.1em; }
.nr-leds i {
  aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0.08em 0.15em rgba(0, 0, 0, 0.6);
}
.nr-leds i.on.g { background: radial-gradient(circle at 40% 35%, #c9ffd9, #23d160 55%, #0f7a35); box-shadow: 0 0 0.6em rgba(35, 209, 96, 0.8); }
.nr-leds i.on.r { background: radial-gradient(circle at 40% 35%, #ffd0cc, #ff3b2f 55%, #a5170f); box-shadow: 0 0 0.6em rgba(255, 59, 47, 0.85); }
.nr-leds i.on.b { background: radial-gradient(circle at 40% 35%, #d2e5ff, #3a8bff 55%, #1747a6); box-shadow: 0 0 0.6em rgba(58, 139, 255, 0.9); }
.nr-leds.flash i { background: radial-gradient(circle at 40% 35%, #d2e5ff, #3a8bff 55%, #1747a6); box-shadow: 0 0 0.7em rgba(58, 139, 255, 0.95); animation: nr-blink 0.12s steps(1) infinite alternate; }
@keyframes nr-blink { 50% { opacity: 0.12; } }
.nr-rpmrow { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.6em; }
.nr-rpm { position: relative; height: 0.5em; border-radius: 0.25em; overflow: hidden; background: rgba(255, 255, 255, 0.08); }
.nr-rpm-fill {
  position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); will-change: transform;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.55), #fff 55%, var(--amber) 80%, var(--red));
}
.nr-rpm-red { position: absolute; top: 0; bottom: 0; right: 0; background: repeating-linear-gradient(135deg, rgba(255, 69, 58, 0.55) 0 0.25em, rgba(255, 69, 58, 0.2) 0.25em 0.5em); }
.nr-rpm-ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0, 0, 0, 0.55) calc(10% - 1px) 10%); }
.nr-rpm.lim .nr-rpm-fill { animation: nr-blink 0.1s steps(1) infinite alternate; }
.nr-rpm-txt { font: 600 max(var(--fs-min), 0.8em)/1 var(--font-num); color: var(--txt-hud); min-width: 5.6em; text-align: right; }

.nr-mainrow { display: grid; grid-template-columns: 4.6em 1fr auto; align-items: center; gap: 0.8em; }
.nr-gear {
  position: relative; height: 4.9em; border-radius: 0.55em; display: grid; place-items: center; align-content: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.nr-gear b { font: 800 3.6em/0.9 var(--font-num); display: block; }
.nr-gear span { font-size: max(var(--fs-min), 0.56em); font-weight: 800; letter-spacing: 0.1em; color: var(--txt-hud); margin-top: 0.2em; }
.nr-gear.shifting b { color: var(--amber); }
.nr-speed { display: flex; align-items: baseline; justify-content: flex-end; gap: 0.35em; }
.nr-speed b { font: 700 4.3em/0.9 var(--font-num); letter-spacing: -0.01em; min-width: 2.2em; text-align: right; }
.nr-speed span { font-size: max(var(--fs-min), 0.8em); font-weight: 700; letter-spacing: 0.1em; color: var(--txt-hud); text-transform: uppercase; }
.nr-pedals { display: flex; gap: 0.3em; height: 4.4em; }
.nr-ped { position: relative; width: 0.55em; border-radius: 0.3em; overflow: hidden; background: rgba(255, 255, 255, 0.08); }
.nr-ped i { position: absolute; inset: 0; transform-origin: 50% 100%; transform: scaleY(0); will-change: transform; border-radius: 0.3em; }
.nr-ped.thr i { background: linear-gradient(0deg, #13a84a, #4ff08f); }
.nr-ped.brk i { background: linear-gradient(0deg, #b3150d, #ff5145); }

.nr-lamps { display: flex; align-items: center; gap: 0.35em; }
.nr-lamps .nr-sp { flex: 1; }
.nr-lamp {
  padding: 0.22em 0.5em; border-radius: 0.25em; font-size: max(var(--fs-min), 0.68em); font-weight: 800; letter-spacing: 0.1em;
  color: var(--txt-2); background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: background 0.08s, color 0.08s, box-shadow 0.08s;
}
.nr-lamp.off { color: rgba(255, 255, 255, 0.22); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05); background: transparent; text-decoration: line-through; }
.nr-lamp.act { color: #1a1200; background: var(--amber); box-shadow: 0 0 0.8em rgba(255, 173, 31, 0.8); }
.nr-hud:not(.f1) .nr-lamp-drs, .nr-hud:not(.f1) .nr-ers { display: none; }
.nr-hud.f1 .nr-lamp.avail { color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.nr-hud.f1 .nr-lamp.on { color: #04140a; background: var(--green); box-shadow: 0 0 0.8em rgba(47, 211, 107, 0.8); }
.nr-ers { display: flex; align-items: center; gap: 0.35em; }
.nr-ers span { font-size: max(var(--fs-min), 0.62em); font-weight: 800; letter-spacing: 0.1em; color: var(--txt-hud); }
.nr-ers-bar { width: 4.6em; height: 0.5em; border-radius: 0.25em; overflow: hidden; background: rgba(255, 255, 255, 0.08); }
.nr-ers-bar i { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(1); background: linear-gradient(90deg, #00b3a4, #3af0d6); }
.nr-ers.deploy .nr-ers-bar i { background: linear-gradient(90deg, #ffb31f, #ffe066); box-shadow: 0 0 0.6em rgba(255, 196, 0, 0.8); }

/* ============================================================================================
   Start lights
   ============================================================================================ */
.nr-lights { position: absolute; left: 50%; top: 0; transform: translateX(-50%); pointer-events: none; z-index: 2; }
.nr-lights-housing {
  position: relative; display: flex; gap: 0.7em; padding: 0.9em 1em 1em; border-radius: 0 0 0.9em 0.9em;
  background: linear-gradient(180deg, #15181d, #0a0c0f);
  box-shadow: 0 1.2em 3em rgba(0, 0, 0, 0.65), inset 0 -1px 0 rgba(255, 255, 255, 0.07);
}
.nr-pod {
  display: grid; gap: 0.45em; padding: 0.55em; border-radius: 0.55em;
  background: linear-gradient(180deg, #050607, #101215); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.nr-pod i { display: block; width: 2.5em; height: 2.5em; border-radius: 50%; }
.nr-lamp-off, .nr-lamp-r { background: radial-gradient(circle at 40% 35%, #2a2d33, #121418 65%); box-shadow: inset 0 0.15em 0.4em rgba(0, 0, 0, 0.8); }
.nr-pod.on .nr-lamp-r {
  background: radial-gradient(circle at 42% 38%, #fff1ee 0%, #ff6b5c 22%, #ff1e0a 48%, #a00800 78%);
  box-shadow: 0 0 1.2em 0.25em rgba(255, 30, 10, 0.8), 0 0 3em rgba(255, 30, 10, 0.45);
}
.nr-lights-beam {
  position: absolute; left: 50%; top: 0; width: 160%; height: 280%; transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 15%, rgba(255, 30, 10, 0.55), transparent 65%); opacity: 0; pointer-events: none;
}

/* ============================================================================================
   Toasts
   ============================================================================================ */
/* Under the start-light gantry while it is down (lights come before toasts in the DOM). */
.nr-lights:not([hidden]) ~ .nr-toasts { top: 16.5em; }
.nr-toasts {
  position: absolute; left: 50%; top: 11em; transform: translateX(-50%); width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 0.45em; pointer-events: none; z-index: 3;
}
.nr-toast {
  display: flex; align-items: stretch; min-width: 17em; max-width: 30em; width: max-content; overflow: hidden;
  border-radius: 0.5em; background: rgba(9, 11, 15, 0.86); box-shadow: 0 0.8em 2em rgba(0, 0, 0, 0.45);
}
.nr-toast-bar { width: 0.32em; flex: none; background: #fff; }
.nr-toast-body { padding: 0.5em 1.2em 0.55em 0.85em; }
.nr-toast [hidden] { display: none !important; }
.nr-toast-title { font-size: max(var(--fs-min), 0.72em); font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: var(--txt-2); }
.nr-toast-text { font: 700 1.55em/1.1 var(--font-num); letter-spacing: 0.02em; }
.nr-toast.small .nr-toast-text { font-size: 1.15em; }
.nr-toast.k-good .nr-toast-bar { background: var(--green); } .nr-toast.k-good .nr-toast-title { color: #7ff0ac; }
.nr-toast.k-bad .nr-toast-bar { background: var(--red); } .nr-toast.k-bad .nr-toast-title { color: #ff8a80; }
.nr-toast.k-warn .nr-toast-bar { background: var(--amber); } .nr-toast.k-warn .nr-toast-title { color: #ffc966; }
.nr-toast.k-purple { background: linear-gradient(90deg, rgba(120, 40, 200, 0.92), rgba(40, 14, 70, 0.92)); }
.nr-toast.k-purple .nr-toast-bar { background: #e2b8ff; } .nr-toast.k-purple .nr-toast-title { color: #f0dcff; }
.nr-toast.k-final, .nr-toast.k-flag { background: #fff; color: #0b0d10; }
.nr-toast.k-final .nr-toast-title, .nr-toast.k-flag .nr-toast-title { color: #0b0d10; font-size: 1.05em; letter-spacing: 0.24em; }
.nr-toast.k-final .nr-toast-bar, .nr-toast.k-flag .nr-toast-bar {
  width: 1.4em; background: repeating-conic-gradient(#0b0d10 0 25%, #fff 0 50%) 0 0 / 0.7em 0.7em;
}

/* ============================================================================================
   Loading
   ============================================================================================ */
.nr-loading {
  display: grid; place-items: center;
  background: radial-gradient(60em 40em at 50% 30%, rgba(38, 120, 70, 0.22), transparent 65%), #06080a;
}
.nr-load-inner { width: min(40em, 86vw); display: grid; gap: 0.8em; }
.nr-load-map { height: 20em; }
.nr-load-map svg { width: 100%; height: 100%; }
.nr-load-map .nr-map-base { stroke: rgba(255, 255, 255, 0.07); stroke-width: 8px; }
.nr-load-map .nr-map-line { stroke: #fff; stroke-width: 2.5px; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6)); }
.nr-load-map .nr-map-glow { stroke: rgba(47, 211, 107, 0.12); stroke-width: 18px; }
.nr-load-kicker { text-align: center; font-size: max(var(--fs-min), 0.72em); font-weight: 800; letter-spacing: 0.3em; text-transform: uppercase; color: var(--accent); margin-bottom: -0.4em; }
.nr-load-title { font: italic 800 2.6em/1 var(--font-num); text-transform: uppercase; letter-spacing: 0.01em; text-align: center; }
.nr-load-sub { text-align: center; color: var(--txt-2); font-size: 0.9em; font-weight: 600; letter-spacing: 0.06em; margin: -0.3em 0 0.6em; min-height: 1.2em; }
.nr-load-bar { height: 0.3em; border-radius: 1em; overflow: hidden; background: rgba(255, 255, 255, 0.1); }
.nr-load-bar i { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 1em rgba(255, 59, 47, 0.7); }
.nr-load-row { display: flex; justify-content: space-between; font-size: 0.9em; color: var(--txt-2); font-weight: 600; }
.nr-load-row b { font: 700 1.2em var(--font-num); color: var(--txt); }
.nr-load-tip { margin-top: 1.2em; min-height: 2.8em; text-align: center; color: var(--txt-3); font-size: 0.92em; line-height: 1.45; }

/* ============================================================================================
   Pause / help
   ============================================================================================ */
.nr-pause, .nr-help {
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 50%, rgba(5, 6, 8, 0.45), rgba(5, 6, 8, 0.8));
  backdrop-filter: blur(10px) saturate(120%); -webkit-backdrop-filter: blur(10px) saturate(120%);
}
.nr-pause-card {
  width: 25em; padding: 1.6em 1.6em 1.5em; border-radius: 1em;
  background: linear-gradient(180deg, rgba(24, 28, 35, 0.92), rgba(12, 14, 18, 0.92));
  border: 1px solid var(--line-2); box-shadow: 0 2em 5em rgba(0, 0, 0, 0.6);
}
.nr-pause-kicker { font-size: max(var(--fs-min), 0.72em); font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); }
.nr-pause-card h2 { margin: 0.1em 0 0.15em; font: italic 800 3.2em/1 var(--font-num); text-transform: uppercase; }
.nr-pause-info { min-height: 1.3em; color: var(--txt-2); font-size: 0.9em; font-weight: 600; margin-bottom: 1.1em; }
.nr-pause-btns { display: grid; gap: 0.5em; }
.nr-pause-btns .nr-btn { width: 100%; }

.nr-help-inner {
  width: min(70em, 92vw); max-height: 90vh; overflow: auto; padding: 1.5em; border-radius: 1em;
  background: linear-gradient(180deg, rgba(24, 28, 35, 0.94), rgba(12, 14, 18, 0.94)); border: 1px solid var(--line-2);
}
.nr-help-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1em; }
.nr-help-head h2 { margin: 0; font: italic 800 2.4em/1 var(--font-num); text-transform: uppercase; }
.nr-help-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1em; }
.nr-help-card { padding: 1em 1.1em; border-radius: 0.8em; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.nr-help-title { display: flex; align-items: center; gap: 0.6em; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.85em; margin-bottom: 0.8em; }
.nr-help-ico { display: grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 0.4em; background: var(--accent); color: #fff; font-size: 1.1em; letter-spacing: 0; }
.nr-help-ico svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nr-help-card dl { display: grid; grid-template-columns: auto 1fr; gap: 0.55em 0.9em; margin: 0; align-items: center; }
.nr-help-card dt { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3em; }
.nr-help-card dt em { font-size: max(var(--fs-min), 0.7em); color: var(--txt-3); font-style: normal; }
.nr-help-card dt kbd { font-size: max(var(--fs-min), 0.8em); color: var(--txt); }
.nr-help-card dd { margin: 0; font-size: 0.88em; color: var(--txt-2); }
@media (max-width: 1000px) { .nr-help-grid { grid-template-columns: 1fr 1fr; } }

/* ============================================================================================
   Results
   ============================================================================================ */
.nr-results { display: grid; place-items: center; overflow: hidden; }
.nr-res-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(50em 30em at 50% 20%, rgba(255, 210, 58, 0.10), transparent 65%),
    radial-gradient(60em 40em at 0% 100%, rgba(38, 120, 70, 0.18), transparent 60%),
    rgba(5, 6, 8, 0.86);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.nr-res-inner {
  position: relative; width: min(68em, 94vw); max-height: min(100%, 60em); padding: 1.6em 0 1.4em;
  display: flex; flex-direction: column; gap: 1em; min-height: 0;
}
.nr-res-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 2em; }
.nr-res-kicker { font-size: max(var(--fs-min), 0.78em); font-weight: 800; letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent); }
.nr-res-head h2 { margin: 0.05em 0; font: italic 800 3.4em/1 var(--font-num); text-transform: uppercase; }
.nr-res-sub { color: var(--txt-2); font-weight: 600; font-size: 0.92em; letter-spacing: 0.04em; }
.nr-res-flag { width: 7em; height: 3.2em; border-radius: 0.3em; opacity: 0.85; transform: skewX(-10deg); flex: none;
  background: repeating-conic-gradient(#f3f5f8 0 25%, #0b0d10 0 50%) 0 0 / 0.8em 0.8em; box-shadow: 0 0.6em 1.4em rgba(0, 0, 0, 0.5); }

.nr-podium { flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 0.8em; height: 12.5em; padding: 0 6%; }
.nr-pod-col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0; }
.nr-pod-who { text-align: center; padding-bottom: 0.5em; }
.nr-pod-who b { display: block; font-weight: 700; font-size: 1.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-pod-who span { display: block; font-size: max(var(--fs-min), 0.75em); color: var(--txt-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-pod-who em { display: block; font: 600 1.05em/1.2 var(--font-num); font-style: normal; color: var(--txt-2); }
.nr-pod-block {
  position: relative; display: grid; place-items: center; border-radius: 0.5em 0.5em 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  border-top: 0.3em solid var(--team, #999); transform-origin: 50% 100%;
}
.nr-pod-block span { font: italic 800 3em/1 var(--font-num); color: rgba(255, 255, 255, 0.85); }
.nr-pod-col.p1 .nr-pod-block { height: 7.2em; background: linear-gradient(180deg, rgba(255, 210, 58, calc(0.18 + 0.2 * var(--glow, 0))), rgba(255, 210, 58, 0.04)); box-shadow: 0 0 calc(3em * var(--glow, 0)) rgba(255, 210, 58, 0.35); }
.nr-pod-col.p2 .nr-pod-block { height: 5.3em; }
.nr-pod-col.p3 .nr-pod-block { height: 4em; }
.nr-pod-col.me .nr-pod-who b { color: #fff; }
.nr-pod-col.me .nr-pod-who b::after { content: 'YOU'; margin-left: 0.5em; font-size: max(var(--fs-min), 0.62em); font-weight: 800; letter-spacing: 0.18em; color: var(--accent); vertical-align: middle; }

.nr-res-tablewrap { flex: 0 1 auto; min-height: 0; overflow: auto; border-radius: 0.7em; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); scrollbar-width: thin; }
.nr-res-table { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.nr-res-table th {
  position: sticky; top: 0; z-index: 1; padding: 0.6em 0.7em; text-align: left; background: #12151a;
  font-size: max(var(--fs-min), 0.7em); font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--txt-3);
}
.nr-res-table th.num { text-align: right; }
.nr-res-table td { padding: 0.42em 0.7em; border-top: 1px solid rgba(255, 255, 255, 0.05); white-space: nowrap; }
.nr-res-table .num { text-align: right; font-family: var(--font-num); font-size: 1.08em; font-weight: 600; }
.nr-res-table td.pos { font: 700 1.2em var(--font-num); width: 2.4em; text-align: center; }
.nr-res-table td.team { width: 0.6em; padding: 0; }
.nr-res-table td.team i { display: block; width: 0.28em; height: 1.4em; border-radius: 0.1em; background: var(--team); margin: 0 auto; }
.nr-res-table td.no { color: var(--txt-3); font-family: var(--font-num); width: 2.6em; }
.nr-res-table td.drv b { font-weight: 700; }
.nr-res-table td.drv span { margin-left: 0.6em; font-size: max(var(--fs-min), 0.78em); color: var(--txt-3); letter-spacing: 0.1em; font-weight: 700; }
.nr-res-table td.tm { color: var(--txt-2); font-size: max(var(--fs-min), 0.88em); }
.nr-res-table td.fl { color: var(--purple); }
.nr-res-table td.pen { color: var(--yellow); }
.nr-res-table tr.me td { background: rgba(255, 255, 255, 0.92); color: #0b0d10; }
.nr-res-table tr.me td.no, .nr-res-table tr.me td.drv span, .nr-res-table tr.me td.tm { color: rgba(11, 13, 16, 0.6); }
.nr-res-table tr.me td.fl { color: #7a1fd1; }
.nr-res-table tr.running td { color: var(--txt-3); font-style: italic; }
.nr-res-table.laps tr.best td { font-weight: 700; }
.nr-res-table.laps tr.best td:first-child { box-shadow: inset 0.22em 0 0 var(--purple); }
.nr-res-table.laps tr.invalid td { color: var(--txt-3); text-decoration: line-through; text-decoration-color: rgba(255, 69, 58, 0.7); }
.nr-res-table.laps tr.invalid td:last-child { text-decoration: none; color: var(--red); }
.nr-res-foot { flex: none; display: flex; justify-content: flex-end; gap: 0.7em; margin-top: 0.2em; }
/* Dense classification (more than 10 cars): lower podium and tighter rows so 16 rows fit at 720p..4K. */
.nr-results.dense .nr-res-inner { gap: 0.7em; padding: 1.1em 0 1em; }
.nr-results.dense .nr-res-head h2 { font-size: 2.8em; }
.nr-results.dense .nr-podium { height: 8.4em; }
.nr-results.dense .nr-pod-col.p1 .nr-pod-block { height: 4.5em; }
.nr-results.dense .nr-pod-col.p2 .nr-pod-block { height: 3.4em; }
.nr-results.dense .nr-pod-col.p3 .nr-pod-block { height: 2.6em; }
.nr-results.dense .nr-pod-block span { font-size: 2.1em; }
.nr-results.dense .nr-pod-who { padding-bottom: 0.35em; }
.nr-results.dense .nr-res-table th { padding-top: 0.45em; padding-bottom: 0.45em; }
.nr-results.dense .nr-res-table td { padding-top: 0.22em; padding-bottom: 0.22em; }
.nr-results.dense .nr-res-table td.team i { height: 1.15em; }
.nr-res-table .nr-running { font: 700 max(var(--fs-min), 0.62em)/1 var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber);
  padding: 0.25em 0.45em; border-radius: 0.25em; background: rgba(255, 173, 31, 0.12); font-style: normal; vertical-align: 0.15em; }
.nr-res-table td.empty { padding: 2em; text-align: center; color: var(--txt-3); }
.nr-res-table.laps td.dl { color: var(--txt-3); font-size: 0.95em; }
.nr-res-table.laps td.ob { color: var(--purple); }
.nr-res-table.laps td.st { font-weight: 700; font-size: 0.85em; letter-spacing: 0.08em; text-transform: uppercase; }
.nr-res-table.laps tr.best td.lt { color: var(--purple); }
/* Summary cards (time trial / practice / solo race) */
.nr-res-cards { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.7em; }
.nr-res-card {
  position: relative; padding: 0.8em 1em 0.85em; border-radius: 0.7em; overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)); border: 1px solid var(--line);
}
.nr-res-card span { display: block; font-size: max(var(--fs-min), 0.68em); font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--txt-3); }
.nr-res-card b { display: block; margin-top: 0.15em; font: 700 2.1em/1 var(--font-num); letter-spacing: 0.01em; }
.nr-res-card small { display: block; margin-top: 0.35em; font-size: max(var(--fs-min), 0.75em); color: var(--txt-3); font-weight: 600; }
.nr-res-card.purple { border-color: rgba(180, 92, 255, 0.45); background: linear-gradient(160deg, rgba(180, 92, 255, 0.28), rgba(60, 20, 110, 0.12)); }
.nr-res-card.purple b { color: #e6ccff; }
.nr-res-card.pen { border-color: rgba(255, 210, 58, 0.35); }
.nr-res-card.pen small { color: var(--yellow); }

@media (prefers-reduced-motion: reduce) {
  .nr-start-sheen, .nr-sector.active, [data-status] .nr-led { animation: none !important; }
}
