/* Hover racer page – the game box itself is in css/game-stage.css */

/* The HUD font: Orbitron (OFL, self-hosted in public/fonts/ like the site's other fonts – licence Orbitron-OFL.txt).
   Chosen (Oct 2026) as the free font closest to Wipeout 3's HUD: wide rounded-square digits, a flag on the "1". */
@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../../fonts/orbitron-latin-500.woff2") format("woff2");
}

@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../../fonts/orbitron-latin-700.woff2") format("woff2");
}

.stage {
  /* Behind the 3D picture until it has loaded: the morning sky */
  background: linear-gradient(to bottom, #7fb2e5 0%, #f3dcc0 60%, #4e7536 100%);
  /* the start/result screen fits itself to the game box's height (see "Short game box" at the end) */
  container-type: size;
}

.stage canvas#game {
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

/* ----- Race info: Wipeout 3's layout (owner's screenshots, Oct 2026) -----
   Flat see-through blue panels with cut corners, white digits, small lowercase labels. The blue is deeper than the
   original's light blue so white digits stay readable against our bright morning sky. */
/* The race info grows with the game box: --hud (hoverracer.js resize(): 1 at 960 x 540 or smaller, at most 2.5) zooms
   the panels and the little map. Zoom also grows their distance to the box's edge, so those distances are divided by
   --hud: the panels stay just as close to the corner buttons, which keep their size (owner, 2026-10-11: the
   fullscreen and sound buttons don't need to grow). */
.hr-panel,
.stage .hr-minimap {
  zoom: var(--hud, 1);
}

.hr-panel {
  --panel: rgba(64, 98, 186, 0.55);
  --corner: 0.45rem;
  position: absolute;
  display: flex;
  align-items: stretch;
  gap: 0.2rem;
  font-family: "Orbitron", var(--font-display);
  font-weight: 700;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #fff;
  pointer-events: none;
}

/* One fixed-width cell per digit (hoverracer.js setDigits): Orbitron's digits aren't all as wide ("1" is narrow) and it
   has no tabular digits, so the clocks jumped and fidgeted as the hundredths ticked (owner, Oct 2026). 0.84em = its
   widest digits (0 and 8). */
.hr-digit {
  display: inline-block;
  width: 0.84em;
  text-align: center;
}

.hr-digits {
  padding: 0.22rem 0.5rem 0.16rem;
  font-size: 2rem;
  background: var(--panel);
  clip-path: polygon(var(--corner) 0, 100% 0, 100% calc(100% - var(--corner)), calc(100% - var(--corner)) 100%,
    0 100%, 0 var(--corner));
}

.hr-inverse {
  color: #23305f;
  background: rgba(246, 249, 255, 0.92);
}

.hr-small {
  align-self: flex-end;
  padding: 0.15rem 0.3rem;
  font-size: 1rem;
}

.hr-label {
  align-self: center;
  padding: 0 0.3rem;
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 2px rgba(10, 16, 40, 0.6);
}

/* top left: lap 1/3 (right of the pause button) */
.hr-lap {
  top: calc((0.6rem + var(--safe-top)) / var(--hud, 1));
  left: calc((3.8rem + var(--safe-left)) / var(--hud, 1));
}

.hr-of {
  margin: 0 0.12em;
  color: rgba(255, 255, 255, 0.6);
}

/* top middle: the record, in a magenta tag (where Wipeout 3 has its "pit" panel) */
.hr-best {
  top: calc((0.75rem + var(--safe-top)) / var(--hud, 1));
  left: 50%;
  transform: translateX(-50%);
}

.hr-tag {
  padding: 0.3rem 0.55rem;
  font-size: 1.1rem;
  background: rgba(255, 63, 180, 0.85);
  clip-path: polygon(0.3rem 0, 100% 0, 100% calc(100% - 0.3rem), calc(100% - 0.3rem) 100%, 0 100%, 0 0.3rem);
}

/* "träff!" (your rocket hit someone): right of the record / place tag */
.hr-best .hr-callout {
  top: 50%;
  left: calc(100% + 0.4rem);
  translate: 0 -50%;
}

/* top middle, under the record / place tag: the MODULE waiting to be used (items.js; owner, 2026-10-13: "moduler" =
   the weapons and defences). Its icon in the module's colour – the attacks (raketer, jägare, minor) magenta, the
   defences (sköld, autopilot, turbo) yellow-green, the modulplatta's two colours –, its name, and the time left of a
   module that lasts (sköld, autopilot, turbo). A touch screen taps it to use the module (hoverracer.js). */
.hr-module {
  top: calc((0.75rem + var(--safe-top)) / var(--hud, 1) + 2.3rem);
  left: 50%;
  translate: -50% 0;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  pointer-events: auto;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.hr-module[hidden] {
  display: none;
}

.hr-module-icon {
  display: grid;
  place-items: center;
  width: 4.8rem;                        /* owner, 2026-10-16: "en större ikon" (was 3.2rem) */
  height: 4.8rem;
  background: var(--panel);
  clip-path: polygon(var(--corner) 0, 100% 0, 100% calc(100% - var(--corner)), calc(100% - var(--corner)) 100%,
    0 100%, 0 var(--corner));
}

.hr-module-icon svg {
  width: 3.7rem;
  height: 3.7rem;
  filter: drop-shadow(0 0 0.25rem currentColor);
}

.hr-module.is-attack .hr-module-icon { color: #ff3fb4; }
.hr-module.is-defence .hr-module-icon { color: #b8ff3a; }

.hr-module-bar {
  width: 4.8rem;
  height: 0.45rem;
  background: var(--panel);
}

.hr-module-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: #b8ff3a;
}

.hr-module:not(.is-timed) .hr-module-bar {
  visibility: hidden;
}

/* A robot opponent's attack on its way (hoverracer.js drawIncoming): the module's icon in magenta, blinking, with two
   chevrons under it pointing back – it comes from behind. Bottom middle, above the speed bar's row. */
.hr-incoming {
  --corner: 0.45rem;
  position: absolute;
  left: 50%;
  bottom: calc((4.6rem + var(--safe-bottom, 0px)) / var(--hud, 1));
  translate: -50% 0;
  zoom: var(--hud, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  color: #ff3fb4;
  pointer-events: none;
  animation: hr-incoming 0.3s steps(1) infinite;
}

.hr-incoming[hidden] {
  display: none;
}

.hr-incoming-icon {
  display: grid;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  background: rgba(40, 6, 30, 0.72);
  border: 2px solid currentColor;
  clip-path: polygon(var(--corner) 0, 100% 0, 100% calc(100% - var(--corner)), calc(100% - var(--corner)) 100%,
    0 100%, 0 var(--corner));
}

.hr-incoming-icon svg {
  width: 2.7rem;
  height: 2.7rem;
  filter: drop-shadow(0 0 0.3rem currentColor);
}

.hr-incoming-arrows {
  width: 1.6rem;
  height: 1.2rem;
  background: currentColor;
  clip-path: polygon(0 0, 50% 40%, 100% 0, 100% 30%, 50% 70%, 0 30%, 0 50%, 50% 90%, 100% 50%, 100% 60%, 50% 100%, 0 60%);
  filter: drop-shadow(0 0 0.3rem currentColor);
}

@keyframes hr-incoming {
  50% { color: #ffffff; }
}

@media (prefers-reduced-motion: reduce) {
  .hr-incoming { animation: none; }
}

/* The Jägare's sight (hoverracer.js drawHunterSight): two outline squares, nothing filled (owner, 2026-10-16). Its
   place and size are set every picture; --aim goes 0 -> 1 while it aims (the outer square closes in and turns
   straight), .is-locked = locked on: the inner square shows and both pulse. Not zoomed with the HUD: it follows the
   ship on the screen. */
.hr-sight {
  position: absolute;
  left: 0;
  top: 0;
  width: 3rem;
  height: 3rem;
  pointer-events: none;
  z-index: 1;
  --sight: #ff3fb4;
}

.hr-sight[hidden] {
  display: none;
}

.hr-sight i {
  position: absolute;
  inset: 0;
  border: var(--sight-line, 2px) solid var(--sight);
  box-shadow: 0 0 0.4rem var(--sight), inset 0 0 0.4rem var(--sight);
}

.hr-sight-outer {
  opacity: calc(0.45 + 0.55 * var(--aim, 0));
  transform: scale(calc(2 - var(--aim, 0))) rotate(calc((1 - var(--aim, 0)) * 90deg));
}

.hr-sight-inner {
  inset: 24% !important;
  visibility: hidden;
}

.stage.in-menu .hr-sight {
  display: none;
}

.hr-sight.is-locked i {
  animation: hr-sight-locked 0.5s ease-in-out infinite alternate;
}

.hr-sight.is-locked .hr-sight-inner {
  visibility: visible;
}

@keyframes hr-sight-locked {
  from { border-color: var(--sight); }
  to { border-color: #ffffff; }
}

/* a new module pops in; one waiting to be used glows softly; a press that did nothing shakes it */
.hr-module.is-new .hr-module-icon {
  animation: hr-module-pop 0.35s ease-out;
}

.hr-module.is-ready:not(.is-new) .hr-module-icon svg {
  animation: hr-module-ready 1.2s ease-in-out infinite;
}

.hr-module.is-nope {
  animation: hr-module-nope 0.3s linear;
}

@keyframes hr-module-pop {
  from { transform: scale(0.4); }
  70% { transform: scale(1.15); }
}

@keyframes hr-module-ready {
  50% { filter: drop-shadow(0 0 0.6rem currentColor); }
}

@keyframes hr-module-nope {
  25% { transform: translateX(-0.3rem); }
  75% { transform: translateX(0.3rem); }
}

/* the last ENDING_SECONDS of a shield or an autopilot (hoverracer.js drawModuleBox): the icon and its bar blink white,
   faster the last second, so nobody is surprised when it stops (owner, 2026-10-16) */
.hr-module.is-ending .hr-module-icon,
.hr-module.is-ending .hr-module-bar span {
  animation: hr-module-ending 0.4s steps(1) infinite;
}

.hr-module.is-ending.is-last .hr-module-icon,
.hr-module.is-ending.is-last .hr-module-bar span {
  animation-duration: 0.2s;
}

@keyframes hr-module-ending {
  50% { color: #ffffff; background: #ffffff; }
}

.hr-module.is-ending .hr-module-icon {
  animation-name: hr-module-ending-icon;
}

@keyframes hr-module-ending-icon {
  50% { color: #ffffff; background: rgba(255, 255, 255, 0.35); }
}

@media (prefers-reduced-motion: reduce) {
  .hr-module.is-new .hr-module-icon,
  .hr-module.is-ready .hr-module-icon svg,
  .hr-module.is-nope {
    animation: none;
  }
  .hr-module.is-ending .hr-module-icon { animation: none; color: #ffffff; }   /* still clear: white instead of blinking */
}

/* top right: the race time (left of the fullscreen button) */
.hr-time {
  top: calc((0.6rem + var(--safe-top)) / var(--hud, 1));
  right: calc((3.8rem + var(--safe-right)) / var(--hud, 1));
}

/* bottom left: this lap's time, the best lap on a small line above it */
.hr-laptime {
  left: calc((0.6rem + var(--safe-left)) / var(--hud, 1));
  bottom: calc((0.6rem + var(--safe-bottom)) / var(--hud, 1));
}

.hr-line {
  position: absolute;
  bottom: calc(100% + 0.2rem);
  left: 0;
  font-size: 0.85rem;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(10, 16, 40, 0.7);
}

/* bottom right: speed and a long bar towards the edge (left of the sound button) */
.hr-speed {
  left: 42%;
  right: calc((3.8rem + var(--safe-right)) / var(--hud, 1));
  bottom: calc((0.6rem + var(--safe-bottom)) / var(--hud, 1));
  align-items: center;
  gap: 0.5rem;
}

.hr-speed-number {
  display: flex;
  align-items: baseline;
  padding: 0.15rem 0.4rem;
  background: var(--panel);
  clip-path: polygon(var(--corner) 0, 100% 0, 100% calc(100% - var(--corner)), calc(100% - var(--corner)) 100%,
    0 100%, 0 var(--corner));
}

.hr-speed-number strong {
  min-width: calc(3 * 0.84em);           /* room for three digit cells */
  text-align: right;
  font-size: 1.45rem;
}

.hr-speed-number .hr-label {
  font-size: 0.8rem;
  text-shadow: none;
}

.hr-speed-bar {
  position: relative;
  flex: 1;
  height: 1rem;
  background: var(--panel);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0.5rem 100%);
}

.hr-speed-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(246, 249, 255, 0.92);
}

/* The speed bar with the SHIELD over it (energy.js; owner, 2026-11-16): green = full, magenta and blinking when low,
   an empty blinking frame when the ship is broken, brighter while it fills in a depot lane (the lane is green too). */
.hr-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hr-bars .hr-speed-bar { flex: none; }

/* the shield ON TOP of the speed and as thick as it (owner, 2026-11-16: "tjockare och ligga ovanpå hastighetsmätaren") */
.hr-energy-bar {
  order: -1;
  position: relative;
  height: 1rem;
  background: var(--panel);
  clip-path: polygon(0.5rem 0, 100% 0, 100% 100%, 0 100%);
}

.hr-energy-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  background: #3dffa8;
  box-shadow: 0 0 0.4rem #3dffa8;
}

.hr-energy-bar.is-low span { background: #ff3fb4; animation: hr-energy-blink 0.5s steps(1) infinite; }
.hr-energy-bar.is-broken { animation: hr-energy-blink 0.35s steps(1) infinite; background: #ff3fb4; }
/* filling in a depot lane: the bar pulses bright (the energy flying into the ship: pit-fx.js) */
.hr-energy-bar.is-filling span { animation: hr-energy-fill 0.35s ease-in-out infinite alternate; }

@keyframes hr-energy-fill {
  from { filter: brightness(1.1); box-shadow: 0 0 0.3rem #3dffa8; }
  to { filter: brightness(1.9); box-shadow: 0 0 0.9rem #3dffa8; }
}

@keyframes hr-energy-blink {
  50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .hr-energy-bar.is-low span,
  .hr-energy-bar.is-broken,
  .hr-energy-bar.is-filling span { animation: none; }
  .hr-energy-bar.is-filling span { filter: brightness(1.6); }
}

/* ----- The little map, top left under the lap (".stage" too: game-stage.css makes every canvas in the box full size)
   Its canvas gets as many pixels as it covers on the screen (hoverracer.js), so it stays sharp when it grows. */
.stage .hr-minimap {
  position: absolute;
  top: calc((0.6rem + var(--safe-top)) / var(--hud, 1) + 3.4rem);
  left: calc((0.6rem + var(--safe-left)) / var(--hud, 1));
  width: 6rem;
  height: 6rem;
  opacity: 0.85;
  pointer-events: none;
}

/* ----- Big text in the middle (3, 2, 1, KÖR!, Varv 2 ...) ----- */
.hr-message,
.hr-note {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-family: "Orbitron", var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  pointer-events: none;
}

.hr-message {
  top: 20%;
  font-size: clamp(2.2rem, 9vw, calc(5rem * var(--hud, 1)));
  color: #fff;
  text-shadow: 0 0 18px rgba(127, 242, 226, 0.75), 0 2px 4px rgba(10, 16, 40, 0.8);
}

.hr-note {
  top: calc(20% + clamp(2.8rem, 10vw, calc(5.8rem * var(--hud, 1))));
  font-size: clamp(1rem, 3.4vw, calc(1.6rem * var(--hud, 1)));
  color: #7ff2e2;
  text-shadow: 0 0 10px rgba(127, 242, 226, 0.6), 0 2px 3px rgba(10, 16, 40, 0.8);
}

.hr-message.is-go {
  color: #3dff6e;
  text-shadow: 0 0 22px rgba(61, 255, 110, 0.8), 0 2px 4px rgba(10, 16, 40, 0.8);
}

/* ----- Callouts (hoverracer.js callout()): a panel flashes yellow and a small yellow tag shows beside it -----
   (owner, Oct 2026: lap and record texts in big letters in the middle covered the road) */
.hr-callout {
  position: absolute;
  padding: 0.28rem 0.5rem 0.22rem;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: lowercase;
  white-space: nowrap;
  color: #23305f;
  background: var(--yellow);
  clip-path: polygon(0.3rem 0, 100% 0, 100% calc(100% - 0.3rem), calc(100% - 0.3rem) 100%, 0 100%, 0 0.3rem);
  animation: hr-callout-in 0.2s ease-out;
}

.hr-panel:not(.is-callout) .hr-callout,
.hr-callout:empty {
  display: none;
}

.hr-lap .hr-callout {                    /* right of "1/3 varv" */
  top: 50%;
  left: calc(100% + 0.4rem);
  translate: 0 -50%;
}

.hr-time .hr-callout {                   /* under the race time */
  top: calc(100% + 0.35rem);
  right: 0;
}

.hr-laptime .hr-callout {                /* in the place of "bästa varv" over the lap time */
  bottom: calc(100% + 0.2rem);
  left: 0;
}

.hr-laptime.is-callout .hr-line {
  visibility: hidden;
}

.hr-speed .hr-callout {                  /* over the speed */
  bottom: calc(100% + 0.35rem);
  left: 0;
}

/* the panel's numbers blink yellow three times */
.hr-panel.is-callout .hr-digits,
.hr-panel.is-callout .hr-speed-number {
  animation: hr-flash 0.36s steps(1) 3;
}

@keyframes hr-flash {
  0% { color: #23305f; background: var(--yellow); }
  50% { color: #fff; background: var(--panel); }
}

@keyframes hr-callout-in {
  from { opacity: 0; transform: scale(0.8); }
}

@media (prefers-reduced-motion: reduce) {
  .hr-callout,
  .hr-panel.is-callout .hr-digits,
  .hr-panel.is-callout .hr-speed-number {
    animation: none;
  }
}

/* ----- The menus (menu.js; owner, 2026-10-11: "everything in one place got messy") -----------------------------------
   One thing at a time: a panel on the left with a title and a few big choices, a card on the right beside the ship
   turning on the grid, grey key tabs along the bottom. The race info's look – flat see-through blue, cut corners,
   Orbitron, white letters, a mint glow, yellow for what is chosen – with a nod to Wipeout's menus by The Designers
   Republic: flat colour cards, big letters, small technical notes. Not the website's look on purpose (owner). */
.stage .overlay.hr-menu {
  /* every size in the menus is in --u: 1rem at 960 x 540, growing with the game box like the race info (--hud) */
  --u: calc(1rem * var(--hud, 1));
  --menu-ink: #0a1030;                      /* the panel, and dark letters on light colours */
  --menu-blue: rgba(64, 98, 186, 0.55);     /* the race info's panels */
  --menu-blue-soft: rgba(64, 98, 186, 0.3);
  --menu-mint: #7ff2e2;
  --menu-white: #f6f9ff;
  --menu-corner: calc(0.6 * var(--u));
  --menu-width: min(calc(30 * var(--u)), 46%);
  display: block;
  overflow: visible;                        /* (not the other games' scrolling start screen: the panel scrolls itself) */
  padding: 0;
  text-align: left;
  font-family: "Orbitron", var(--font-display);
  background: linear-gradient(90deg, rgba(8, 12, 36, 0.5), rgba(8, 12, 36, 0) 75%);
}

.stage .overlay.hr-menu[hidden] {
  display: none;
}

/* While a menu shows, the race info, the big texts and the pause button are hidden (hoverracer.js: .in-menu) */
.stage.in-menu .hr-panel,
.stage.in-menu .hr-incoming,
.stage.in-menu .hr-minimap,
.stage.in-menu .hr-message,
.stage.in-menu .hr-note,
.stage.in-menu .pause-button {
  visibility: hidden;
}

/* The panel: dark navy with an angled right edge, and a thin mint line along that edge */
.hr-menu-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--menu-width);
  padding: calc(calc(1.4 * var(--u)) + var(--safe-top)) calc(3 * var(--u)) calc(calc(3.4 * var(--u)) + var(--safe-bottom)) calc(calc(1.6 * var(--u)) + var(--safe-left));
  overflow-y: auto;
  background: rgba(10, 16, 48, 0.9);
  clip-path: polygon(0 0, 100% 0, calc(100% - calc(2.2 * var(--u))) 100%, 0 100%);
  scrollbar-width: thin;
  scrollbar-color: rgba(127, 242, 226, 0.4) transparent;
}

.stage .overlay.hr-menu::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--menu-width);
  background: var(--menu-mint);
  clip-path: polygon(calc(100% - 3px) 0, 100% 0, calc(100% - calc(2.2 * var(--u)) + 3px) 100%, calc(100% - calc(2.2 * var(--u))) 100%);
  opacity: 0.8;
  pointer-events: none;
}

/* A small note above the title, with Wipeout-like flat yellow square */
.stage .overlay.hr-menu .hr-menu-kicker {
  display: flex;
  align-items: center;
  gap: calc(0.5 * var(--u));
  max-width: none;
  margin: 0 0 calc(0.35 * var(--u));
  font-size: calc(0.72 * var(--u));
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: var(--menu-mint);
}

.hr-menu-kicker::before {
  content: "";
  flex: none;
  width: calc(0.65 * var(--u));
  height: calc(0.65 * var(--u));
  background: var(--yellow);
}

.hr-menu-kicker:empty {
  visibility: hidden;
}

.stage .overlay.hr-menu .hr-menu-title {
  margin: 0;
  font-family: "Orbitron", var(--font-display);
  font-style: normal;
  font-weight: 700;
  font-size: calc(2.7 * var(--u));
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--menu-white);
  text-shadow: 0 0 18px rgba(127, 242, 226, 0.35);
}

/* the flat yellow bar under the title */
.hr-menu-title::after {
  content: "";
  display: block;
  width: calc(3.5 * var(--u));
  height: calc(0.35 * var(--u));
  margin-top: calc(0.5 * var(--u));
  background: var(--yellow);
}

.stage .overlay.hr-menu .hr-menu-text {
  max-width: calc(26 * var(--u));
  margin: calc(0.8 * var(--u)) 0 0;
  font-family: var(--font-body);
  font-size: calc(1 * var(--u));
  line-height: 1.4;
  white-space: pre-line;
  color: rgba(234, 246, 255, 0.88);
}

.hr-menu-content > * {
  margin-top: calc(1 * var(--u));
}

/* ----- The big choices ----- */
.hr-menu-items {
  display: flex;
  flex-direction: column;
  gap: calc(0.45 * var(--u));
  margin-top: calc(1.2 * var(--u));
}

.hr-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(0.15 * var(--u));
  width: 100%;
  padding: calc(0.7 * var(--u)) calc(1.1 * var(--u)) calc(0.65 * var(--u));
  font: inherit;
  text-align: left;
  color: var(--menu-white);
  background: var(--menu-blue);
  border: none;
  clip-path: polygon(var(--menu-corner) 0, 100% 0, 100% calc(100% - var(--menu-corner)),
    calc(100% - var(--menu-corner)) 100%, 0 100%, 0 var(--menu-corner));
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s, transform 0.12s;
}

/* A button with an icon (menu-icons.js): the icon on the left over both lines, the label and its note beside it */
.hr-item.has-icon {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: calc(0.75 * var(--u));
  row-gap: 0;
}

.hr-item.has-icon > :not(.hr-item-icon) {
  grid-column: 2;
}

.hr-item.has-icon .hr-item-note {
  margin-top: calc(0.15 * var(--u));
}

/* (every icon's box is as wide as the main button's, so the labels line up) */
.hr-item-icon {
  grid-row: 1 / span 2;
  width: calc(2.4 * var(--u));
  height: calc(2 * var(--u));
  /* reaches into the button's padding, so a button with no note under it doesn't grow */
  margin-block: calc(-0.3 * var(--u));
  overflow: visible;
}

.hr-item.is-primary .hr-item-icon {
  height: calc(2.4 * var(--u));
}

.hr-icon-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.hr-icon-fill {
  fill: currentColor;
}

.hr-item-label {
  font-size: calc(1.1 * var(--u));
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hr-item-note {
  font-family: var(--font-body);
  font-size: calc(0.82 * var(--u));
  color: rgba(234, 246, 255, 0.72);
}

/* The main choice (KÖR!, Starta loppet …): flat yellow, bigger */
.hr-item.is-primary {
  color: var(--menu-ink);
  background: var(--yellow);
}

.hr-item.is-primary .hr-item-label {
  font-size: calc(1.45 * var(--u));
}

.hr-item.is-primary .hr-item-note {
  color: rgba(10, 16, 48, 0.78);
}

/* Under the mouse: a stronger blue, a little to the right */
.hr-item:not(:disabled):hover {
  background: rgba(64, 98, 186, 0.9);
  transform: translateX(calc(0.45 * var(--u)));
}

.hr-item.is-primary:not(:disabled):hover {
  background: #fff27e;
}

/* The one you are on with the keys: white with an arrow (the main one stays yellow, with a dark frame) */
.hr-item:focus-visible {
  outline: none;
  color: var(--menu-ink);
  background: var(--menu-white);
  transform: translateX(calc(0.45 * var(--u)));
}

.hr-item:focus-visible .hr-item-note {
  color: rgba(10, 16, 48, 0.72);
}

.hr-item.is-primary:focus-visible {
  background: var(--yellow);
  box-shadow: inset 0 0 0 3px var(--menu-ink);
}

.hr-item:focus-visible .hr-item-label::before {
  content: "› ";
}

.hr-item:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ----- Choices in a list (ships, tracks) or a row (the speed) ----- */
.hr-choice {
  margin-top: calc(1.1 * var(--u));
}

.hr-choice-label {
  display: block;
  margin-bottom: calc(0.4 * var(--u));
  font-size: calc(0.75 * var(--u));
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: var(--menu-mint);
}

.hr-choice-options {
  display: flex;
  flex-direction: column;
  gap: calc(0.35 * var(--u));
}

.hr-choice.is-row .hr-choice-options {
  flex-direction: row;
}

/* one at a time with an arrow on each side (menu.js "carousel": the ships and the tracks; owner, 2026-10-17: "pilar
   till höger och vänster så att man bläddrar"): the chosen one big and yellow in the middle, a dot per option under it */
.hr-carousel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: calc(0.35 * var(--u));
}

.hr-carousel-show {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(2.9 * var(--u));
  padding: calc(0.45 * var(--u)) calc(0.6 * var(--u)) calc(0.4 * var(--u));
  color: var(--menu-ink);
  background: var(--yellow);
  clip-path: polygon(calc(0.45 * var(--u)) 0, 100% 0, 100% calc(100% - calc(0.45 * var(--u))), calc(100% - calc(0.45 * var(--u))) 100%, 0 100%, 0 calc(0.45 * var(--u)));
  touch-action: pan-y;             /* a swipe sideways flips it, up and down still scrolls the panel */
  user-select: none;
}

.hr-carousel-label {
  overflow: hidden;
  max-width: 100%;
  font-size: calc(1.2 * var(--u));
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.hr-carousel-note {
  margin-top: calc(0.15 * var(--u));
  font-family: var(--font-body);
  font-size: calc(0.78 * var(--u));
  opacity: 0.8;
}

/* the arrows: a drawn triangle on the soft blue of the other buttons */
.hr-carousel-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(2.6 * var(--u));
  padding: 0;
  color: var(--menu-white);
  background: var(--menu-blue-soft);
  border: none;
  clip-path: polygon(calc(0.45 * var(--u)) 0, 100% 0, 100% calc(100% - calc(0.45 * var(--u))), calc(100% - calc(0.45 * var(--u))) 100%, 0 100%, 0 calc(0.45 * var(--u)));
  cursor: pointer;
}

.hr-carousel-arrow::before {
  content: "";
  border-block: calc(0.6 * var(--u)) solid transparent;
}

.hr-carousel-arrow.is-back::before {
  border-inline-end: calc(0.8 * var(--u)) solid currentColor;
}

.hr-carousel-arrow.is-next::before {
  border-inline-start: calc(0.8 * var(--u)) solid currentColor;
}

.hr-carousel-arrow:hover {
  background: var(--menu-blue);
}

/* the keys are on it: the same dark frame as a chosen option has (menu.js sets is-focused) */
.hr-choice.is-carousel.is-focused .hr-carousel-show {
  box-shadow: inset 0 0 0 3px var(--menu-ink);
}

.hr-choice.is-carousel.is-focused .hr-carousel-arrow {
  background: var(--menu-blue);
}

/* the dots: small diamonds, the chosen one yellow (each a button: a tap jumps there) */
.hr-choice.is-carousel .hr-carousel-dots {
  flex-direction: row;
  justify-content: center;
  gap: 0;
  margin-top: calc(0.15 * var(--u));
}

.hr-choice.is-carousel .hr-carousel-dots .hr-option {
  justify-content: center;
  align-items: center;
  width: calc(1.25 * var(--u));
  height: calc(1.25 * var(--u));
  padding: 0;
  background: none;
  box-shadow: none;
  clip-path: none;
}

.hr-choice.is-carousel .hr-carousel-dots .hr-option::before {
  content: "";
  width: calc(0.5 * var(--u));
  height: calc(0.5 * var(--u));
  background: rgba(246, 249, 255, 0.35);
  transform: rotate(45deg);
}

.hr-choice.is-carousel .hr-carousel-dots .hr-option:hover::before {
  background: var(--menu-white);
}

.hr-choice.is-carousel .hr-carousel-dots .hr-option[aria-checked="true"]::before {
  background: var(--yellow);
}

/* two choices in one row (menu.js "beside": "fart" and "moduler" in "Välj bana och fart"); their buttons a little
   narrower, so the pair stays one row in the panel beside the card (an iPad held upright) */
.hr-choice-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: calc(0.9 * var(--u));
}

.hr-choice-pair > .hr-choice {
  margin-top: 0;
}

.hr-choice-pair .hr-choice.is-row .hr-option {
  min-width: calc(2.6 * var(--u));
  padding-right: calc(0.5 * var(--u));
  padding-left: calc(0.5 * var(--u));
}

.hr-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: calc(1 * var(--u));
  padding: calc(0.6 * var(--u)) calc(0.9 * var(--u)) calc(0.55 * var(--u));
  font: inherit;
  text-align: left;
  color: rgba(246, 249, 255, 0.85);
  background: var(--menu-blue-soft);
  border: none;
  clip-path: polygon(calc(0.45 * var(--u)) 0, 100% 0, 100% calc(100% - calc(0.45 * var(--u))), calc(100% - calc(0.45 * var(--u))) 100%, 0 100%, 0 calc(0.45 * var(--u)));
  cursor: pointer;
}

.hr-choice.is-row .hr-option {
  justify-content: center;
  min-width: calc(3.6 * var(--u));
}

.hr-option-label {
  font-size: calc(1 * var(--u));
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hr-option-note {
  font-family: var(--font-body);
  font-size: calc(0.78 * var(--u));
  opacity: 0.8;
}

.hr-option:hover {
  color: var(--menu-white);
  background: var(--menu-blue);
}

/* the chosen one: flat yellow (like the race info's callouts) */
.hr-option[aria-checked="true"] {
  color: var(--menu-ink);
  background: var(--yellow);
}

/* the one you are on with the keys: a white frame inside it (the cut corners would cut an outline off) */
.hr-option:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--menu-white);
}

.hr-option[aria-checked="true"]:focus-visible {
  box-shadow: inset 0 0 0 3px var(--menu-ink);
}

.hr-choice-note {
  display: block;
  margin-top: calc(0.4 * var(--u));
  font-family: var(--font-body);
  font-size: calc(0.85 * var(--u));
  color: rgba(234, 246, 255, 0.8);
}

/* ----- Tabs (Inställningar: Grafik, Ljud, Kontroll): grey like the key tabs along the bottom, the open one yellow ----- */
.hr-choice.is-tabs .hr-choice-options {
  gap: calc(0.25 * var(--u));
}

.hr-choice.is-tabs .hr-option {
  min-width: 0;
  padding: calc(0.4 * var(--u)) calc(1.2 * var(--u)) calc(0.32 * var(--u)) calc(0.75 * var(--u));
  color: #1a1f3a;
  background: rgba(205, 209, 220, 0.92);
  clip-path: polygon(0 0, calc(100% - calc(0.6 * var(--u))) 0, 100% calc(0.6 * var(--u)), 100% 100%, 0 100%);
}

.hr-choice.is-tabs .hr-option-label {
  font-size: calc(0.8 * var(--u));
}

.hr-choice.is-tabs .hr-option:hover {
  color: var(--menu-ink);
  background: var(--menu-white);
}

.hr-choice.is-tabs .hr-option[aria-checked="true"] {
  color: var(--menu-ink);
  background: var(--yellow);
}

/* ----- Sliders (the volumes): slanted parts like the ship card's star bars, the number beside them ----- */
.hr-slider {
  margin-top: calc(0.7 * var(--u));
}

.hr-slider-row {
  display: flex;
  align-items: center;
  gap: calc(0.8 * var(--u));
}

.hr-slider-bar {
  display: flex;
  flex: 1;
  gap: 3px;
  max-width: calc(17 * var(--u));
  padding: calc(0.5 * var(--u)) calc(0.7 * var(--u));
  background: var(--menu-blue-soft);
  clip-path: polygon(calc(0.45 * var(--u)) 0, 100% 0, 100% calc(100% - calc(0.45 * var(--u))), calc(100% - calc(0.45 * var(--u))) 100%, 0 100%, 0 calc(0.45 * var(--u)));
  cursor: pointer;
  touch-action: none;                       /* a finger drags the slider, not the page */
}

.hr-slider-part {
  flex: 1;
  height: calc(1 * var(--u));
  background: rgba(246, 249, 255, 0.14);
  transform: skewX(-20deg);
}

.hr-slider-part.is-on {
  background: var(--menu-white);
  box-shadow: 0 0 6px rgba(127, 242, 226, 0.5);
}

.hr-slider-bar:hover {
  background: var(--menu-blue);
}

/* the one you are on with the keys: a white frame, and the parts that are on turn yellow (← → change it) */
.hr-slider-bar:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--menu-white);
}

.hr-slider-bar:focus-visible .hr-slider-part.is-on {
  background: var(--yellow);
}

.hr-slider-value {
  min-width: calc(2 * var(--u));
  font-size: calc(1 * var(--u));
  font-weight: 700;
  color: var(--menu-white);
}

/* ----- The controls (Inställningar → Kontroll): what it does, then the keys as small grey keycaps (or, on a touch
   screen, what the fingers do) ----- */
.hr-menu-content > .hr-controls {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: calc(0.22 * var(--u)) calc(0.9 * var(--u));
  align-items: center;
  margin: calc(0.7 * var(--u)) 0 0;
}

/* paus | börja om, helskärm | ljud: two a row (the autogas choice must fit under the list, 2026-10-15) */
.hr-menu-content > .hr-controls.is-pairs {
  grid-template-columns: auto auto auto 1fr;
  margin-top: calc(0.12 * var(--u));
}

/* the keys' rows a little tighter (with the autogas choice under them it must fit a Chromebook's box) */
.hr-menu-content > .hr-controls:not(.is-touch) {
  row-gap: calc(0.12 * var(--u));
}

.hr-controls dt {
  font-family: var(--font-body);
  font-size: calc(0.82 * var(--u));
  color: rgba(234, 246, 255, 0.88);
}

.hr-controls dd {
  display: flex;
  flex-wrap: wrap;
  gap: calc(0.25 * var(--u));
  margin: 0;
  font-family: var(--font-body);
  font-size: calc(0.82 * var(--u));
  color: var(--menu-white);
}

.hr-key {
  min-width: calc(1.5 * var(--u));
  padding: calc(0.14 * var(--u)) calc(0.45 * var(--u)) calc(0.1 * var(--u));
  font-family: "Orbitron", var(--font-display);
  font-size: calc(0.7 * var(--u));
  font-weight: 700;
  text-align: center;
  color: #1a1f3a;
  background: rgba(205, 209, 220, 0.92);
  clip-path: polygon(0 0, calc(100% - calc(0.35 * var(--u))) 0, 100% calc(0.35 * var(--u)), 100% 100%, 0 100%);
}

/* ----- The record (main menu), in the race info's look ----- */
.stage .overlay.hr-menu .hr-menu-record {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: calc(0.15 * var(--u)) calc(0.9 * var(--u));
  align-items: baseline;
  max-width: none;
  margin: calc(1 * var(--u)) 0 0;
  padding: calc(0.5 * var(--u)) calc(0.9 * var(--u));
  background: var(--menu-blue);
  clip-path: polygon(calc(0.45 * var(--u)) 0, 100% 0, 100% calc(100% - calc(0.45 * var(--u))), calc(100% - calc(0.45 * var(--u))) 100%, 0 100%, 0 calc(0.45 * var(--u)));
}

.hr-menu-record-label {
  font-size: calc(0.7 * var(--u));
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: rgba(246, 249, 255, 0.72);
}

.hr-menu-record-time {
  font-size: calc(1.05 * var(--u));
  font-weight: 700;
  color: var(--menu-white);
}

/* ----- The card on the right (a ship, a track, the code), like Wipeout's team cards: at the top, so the ship turning
   on the grid shows below it ----- */
.hr-menu-aside {
  position: absolute;
  top: calc(calc(3.8 * var(--u)) + var(--safe-top));
  right: calc(calc(1.4 * var(--u)) + var(--safe-right));
  width: min(calc(19 * var(--u)), 34%);
}

/* the code in the waiting room: on the right when there is room, else in the panel */
.hr-menu-aside .hr-net-code {
  padding: calc(0.9 * var(--u)) calc(1 * var(--u)) calc(1 * var(--u));
  background: rgba(10, 16, 48, 0.88);
  clip-path: polygon(0 0, calc(100% - calc(1.2 * var(--u))) 0, 100% calc(1.2 * var(--u)), 100% 100%, 0 100%);
}

.hr-menu-content .hr-net-code {
  display: none;
}

.hr-menu-aside[hidden] {
  display: none;
}

.hr-card {
  padding-bottom: calc(0.8 * var(--u));
  color: var(--menu-white);
  background: rgba(10, 16, 48, 0.88);
  clip-path: polygon(0 0, calc(100% - calc(1.2 * var(--u))) 0, 100% calc(1.2 * var(--u)), 100% 100%, 0 100%);
}

.hr-card-band {
  display: flex;
  flex-direction: column;
  gap: calc(0.1 * var(--u));
  padding: calc(0.75 * var(--u)) calc(1 * var(--u)) calc(0.85 * var(--u));
  color: var(--team-ink, var(--menu-white));
  background: var(--menu-blue);
}

/* a ship's own colours, in flat diagonal stripes */
.hr-ship-card .hr-card-band {
  background:
    linear-gradient(115deg, transparent 60%, var(--team-light) 60% 67%, transparent 67% 73%, var(--team-detail) 73% 77%,
      transparent 77%),
    var(--team);
}

.hr-card-kicker {
  font-size: calc(0.66 * var(--u));
  letter-spacing: 0.16em;
  text-transform: lowercase;
  opacity: 0.85;
}

.hr-card-name {
  font-size: calc(1.55 * var(--u));
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.stage .overlay.hr-menu .hr-card-note,
.stage .overlay.hr-menu .hr-card-about {
  max-width: none;
  margin: calc(0.55 * var(--u)) calc(1 * var(--u)) 0;
  font-family: var(--font-body);
  font-size: calc(0.85 * var(--u));
  line-height: 1.35;
  color: rgba(234, 246, 255, 0.88);
}

.stage .overlay.hr-menu .hr-card-about {
  font-size: calc(0.75 * var(--u));
  color: rgba(234, 246, 255, 0.65);
}

.hr-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(0.55 * var(--u)) calc(1 * var(--u));
  padding: calc(0.8 * var(--u)) calc(1 * var(--u)) 0;
}

.hr-stat {
  display: flex;
  flex-direction: column;
  gap: calc(0.25 * var(--u));
}

.hr-stat-name {
  font-size: calc(0.66 * var(--u));
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--menu-mint);
}

.hr-stat-bar {
  display: flex;
  gap: 3px;
}

.hr-stat-bar span {
  flex: 1;
  height: calc(0.55 * var(--u));
  background: rgba(246, 249, 255, 0.14);
  transform: skewX(-20deg);
}

.hr-stat-bar span.is-on {
  background: var(--menu-white);
  box-shadow: 0 0 6px rgba(127, 242, 226, 0.5);
}

/* the track seen from above (".stage": game-stage.css makes every canvas in the box full size) */
.stage .hr-track-map {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  background: var(--menu-blue-soft);
}

/* ----- The result (racing alone): the time big, every lap, the records ----- */
.hr-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(0.15 * var(--u));
}

.hr-result-label {
  font-size: calc(0.75 * var(--u));
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: var(--menu-mint);
}

.hr-result-time {
  font-size: calc(2.6 * var(--u));
  font-weight: 700;
  color: var(--yellow);
  text-shadow: 0 0 16px rgba(255, 233, 77, 0.4);
}

.hr-result-laps {
  display: flex;
  flex-wrap: wrap;
  gap: calc(0.35 * var(--u));
  margin: calc(0.5 * var(--u)) 0 calc(0.2 * var(--u));
  padding: 0;
  list-style: none;
}

.hr-result-laps li {
  display: flex;
  flex-direction: column;
  padding: calc(0.35 * var(--u)) calc(0.75 * var(--u));
  background: var(--menu-blue);
  clip-path: polygon(calc(0.4 * var(--u)) 0, 100% 0, 100% calc(100% - calc(0.4 * var(--u))), calc(100% - calc(0.4 * var(--u))) 100%, 0 100%, 0 calc(0.4 * var(--u)));
}

.hr-result-laps li span:first-child {
  font-size: calc(0.65 * var(--u));
  letter-spacing: 0.08em;
  color: rgba(246, 249, 255, 0.72);
}

.hr-result-laps li span:last-child {
  font-size: calc(1 * var(--u));
  font-weight: 700;
}

/* the best lap of the race */
.hr-result-laps li.is-best {
  color: var(--menu-ink);
  background: var(--menu-white);
}

.hr-result-laps li.is-best span:first-child {
  color: rgba(10, 16, 48, 0.7);
}

.stage .overlay.hr-menu .hr-result-note {
  max-width: none;
  margin: calc(0.3 * var(--u)) 0 0;
  font-family: var(--font-body);
  font-size: calc(0.92 * var(--u));
}

/* The medals this race won (js/medals.js showRoundMedals): a quiet, small row under the result, in the menu's sizes.
   A kid's first race can win five or six at once, so it is tight: two or three to a line. */
.stage .overlay.hr-menu .medal-row {
  justify-content: flex-start;
  gap: calc(0.2 * var(--u)) calc(0.6 * var(--u));
  margin: calc(0.5 * var(--u)) 0 0;
  font-family: var(--font-body);
  font-size: calc(0.78 * var(--u));
}

.stage .overlay.hr-menu .medal-row-item {
  gap: calc(0.25 * var(--u));
}

.stage .overlay.hr-menu .medal-row-item .medal-picture {
  width: calc(1.05 * var(--u));
  height: calc(1.26 * var(--u));
}

/* ----- The grey key tabs along the bottom (Wipeout's tabs; how to drive / how the menu works) ----- */
.hr-menu-keys {
  position: absolute;
  left: calc(calc(0.8 * var(--u)) + var(--safe-left));
  right: calc(calc(4 * var(--u)) + var(--safe-right));
  bottom: calc(calc(0.75 * var(--u)) + var(--safe-bottom));
  display: flex;
  flex-wrap: wrap;
  gap: calc(0.35 * var(--u));
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.hr-menu-keys[hidden] {
  display: none;
}

.hr-menu-keys li {
  padding: calc(0.32 * var(--u)) calc(1.1 * var(--u)) calc(0.26 * var(--u)) calc(0.6 * var(--u));
  font-size: calc(0.7 * var(--u));
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: #1a1f3a;
  background: rgba(205, 209, 220, 0.92);
  clip-path: polygon(0 0, calc(100% - calc(0.6 * var(--u))) 0, 100% calc(0.6 * var(--u)), 100% 100%, 0 100%);
}

/* Chrome's "swipe to exit fullscreen" message (game-stage.css .toast-room): room above it */
.stage.toast-room .hr-menu-panel {
  padding-bottom: calc(calc(6.5 * var(--u)) + var(--safe-bottom));
}

.stage.toast-room .hr-menu-keys {
  bottom: calc(calc(5.5 * var(--u)) + var(--safe-bottom));
}

@media (prefers-reduced-motion: reduce) {
  .hr-item {
    transition: none;
  }

  .hr-item:not(:disabled):hover,
  .hr-item:focus-visible {
    transform: none;
  }
}

.hr-about {
  margin-top: 0;
  color: var(--text-muted);
  font-style: italic;
}

.hr-about a {
  color: inherit;
}

/* ----- Racing together (net-lobby.js): the code, the drivers, the picture pad, the result list ----- */
/* the code: four big pictures with their names – "show these to your friends" */
.hr-net-code {
  display: flex;
  flex-direction: column;
  gap: calc(0.4 * var(--u));
}

.hr-net-code-label {
  font-size: calc(0.75 * var(--u));
  letter-spacing: 0.12em;
  color: var(--menu-mint);
}

.hr-net-code-row {
  display: flex;
  gap: calc(0.55 * var(--u));
}

.hr-net-picture {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(0.25 * var(--u));
  width: calc(4.2 * var(--u));
  font-family: var(--font-body);
  font-size: calc(0.75 * var(--u));
  font-weight: 700;
  color: var(--menu-white);
}

.hr-net-picture .picture {
  width: calc(4 * var(--u));
  height: calc(4 * var(--u));
  padding: calc(0.4 * var(--u));
  background: var(--menu-ink);
  border: 2px solid rgba(246, 249, 255, 0.5);
}

/* the drivers, one chip each */
.hr-net-players {
  display: flex;
  flex-wrap: wrap;
  gap: calc(0.35 * var(--u));
  padding: 0;
  list-style: none;
}

.hr-net-player {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: calc(9 * var(--u));
  padding: calc(0.35 * var(--u)) calc(1.8 * var(--u)) calc(0.35 * var(--u)) calc(0.7 * var(--u));
  background: var(--menu-blue);
  clip-path: polygon(calc(0.4 * var(--u)) 0, 100% 0, 100% calc(100% - calc(0.4 * var(--u))), calc(100% - calc(0.4 * var(--u))) 100%, 0 100%, 0 calc(0.4 * var(--u)));
}

.hr-net-player.is-you {
  color: var(--menu-ink);
  background: var(--yellow);
}

.hr-net-player.is-gone {
  opacity: 0.45;
}

.hr-net-name {
  font-family: var(--font-body);
  font-weight: 800;
}

.hr-net-about {
  font-family: var(--font-body);
  font-size: calc(0.72 * var(--u));
  opacity: 0.8;
}

.hr-net-kick {
  position: absolute;
  top: calc(0.15 * var(--u));
  right: calc(0.3 * var(--u));
  padding: 0 calc(0.3 * var(--u));
  font: inherit;
  font-weight: 700;
  color: inherit;
  background: none;
  border: none;
  opacity: 0.7;
  cursor: pointer;
}

.hr-net-kick:hover,
.hr-net-kick:focus-visible {
  opacity: 1;
  color: var(--magenta);
  outline: none;
}

.stage .overlay.hr-menu .hr-net-info,
.stage .overlay.hr-menu .hr-net-status,
.stage .overlay.hr-menu .hr-net-privacy {
  max-width: none;
  margin-bottom: 0;
  font-family: var(--font-body);
  font-size: calc(0.88 * var(--u));
}

.stage .overlay.hr-menu .hr-net-status {
  font-weight: 700;
  color: var(--magenta);
}

.stage .overlay.hr-menu .hr-net-privacy {
  font-size: calc(0.75 * var(--u));
  color: rgba(234, 246, 255, 0.65);
}

.hr-net-privacy a {
  color: inherit;
}

/* the picture key's pad (account-ui.js picturePad), dark like the menu */
.hr-net-pad .picture-pad {
  max-width: calc(17 * var(--u));
  margin: 0;
  gap: calc(0.35 * var(--u));
}

.hr-net-pad .picture-button {
  padding: calc(0.45 * var(--u));
  background: var(--menu-blue-soft);
  border: 2px solid rgba(246, 249, 255, 0.25);
}

.hr-net-pad .picture-button:hover,
.hr-net-pad .picture-button:focus-visible {
  border-color: var(--menu-white);
  box-shadow: none;
}

.hr-net-pad .key-slots {
  justify-content: flex-start;
  margin-bottom: calc(0.6 * var(--u));
}

.hr-net-pad .key-slot {
  width: calc(2.8 * var(--u));
  height: calc(2.8 * var(--u));
  border-color: rgba(127, 242, 226, 0.6);
}

/* the result list: place, name, time */
.hr-net-results {
  padding: 0;
  list-style: none;
}

.hr-net-result {
  display: grid;
  grid-template-columns: calc(2.2 * var(--u)) 1fr auto;
  gap: calc(0.6 * var(--u));
  align-items: baseline;
  margin-bottom: calc(0.3 * var(--u));
  padding: calc(0.4 * var(--u)) calc(0.8 * var(--u));
  background: var(--menu-blue);
  clip-path: polygon(calc(0.4 * var(--u)) 0, 100% 0, 100% calc(100% - calc(0.4 * var(--u))), calc(100% - calc(0.4 * var(--u))) 100%, 0 100%, 0 calc(0.4 * var(--u)));
}

.hr-net-result.is-you {
  color: var(--menu-ink);
  background: var(--yellow);
}

/* the result's places against robot opponents (hoverracer.js standingsCard): tighter rows, so 8 fit beside the ship */
.hr-standings-card .hr-net-results {
  margin: calc(0.5 * var(--u)) calc(0.8 * var(--u)) 0;
  font-size: calc(0.85 * var(--u));
}

.hr-standings-card .hr-net-result {
  margin-bottom: calc(0.18 * var(--u));
  padding: calc(0.28 * var(--u)) calc(0.7 * var(--u));
}

.hr-standings-card .hr-net-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hr-net-place {
  font-weight: 700;
}

.hr-net-name {
  overflow-wrap: anywhere;
}

.hr-net-time {
  font-weight: 700;
}

/* Phones: smaller info so it doesn't cover the road */
@media (max-width: 600px) {
  .hr-digits { font-size: 1.15rem; }
  .hr-small, .hr-tag { font-size: 0.75rem; }
  .hr-label, .hr-line { font-size: 0.65rem; }
  .hr-callout { font-size: 0.7rem; }
  .hr-lap { left: calc((3.4rem + var(--safe-left)) / var(--hud, 1)); }
  .hr-time { right: calc((3.4rem + var(--safe-right)) / var(--hud, 1)); }
  .hr-best { display: none; }               /* no room between lap and time on a phone */
  .hr-module { top: calc((0.6rem + var(--safe-top)) / var(--hud, 1) + 2.6rem); }   /* under the lap and the time */
  .hr-module-icon, .hr-module-bar { width: 3.8rem; }
  .hr-module-icon { height: 3.8rem; }
  .hr-module-icon svg { width: 2.9rem; height: 2.9rem; }
  .hr-speed { left: 50%; right: calc((3.4rem + var(--safe-right)) / var(--hud, 1)); }
  .hr-speed-number strong { font-size: 0.95rem; }
  .stage .hr-minimap {
    top: calc((0.6rem + var(--safe-top)) / var(--hud, 1) + 2.4rem);
    width: 3.5rem;
    height: 3.5rem;
  }
}

/* The sizes that fit the 960 x 540 game box (the box on the page). A bigger box (fullscreen) shows the same layout,
   only bigger: every size is in --u, which grows with the box like the race info. */
.hr-menu-panel {
  padding-top: calc(calc(0.9 * var(--u)) + var(--safe-top));
  padding-bottom: calc(calc(2.8 * var(--u)) + var(--safe-bottom));
}

.stage .overlay.hr-menu .hr-menu-title {
  font-size: calc(1.8 * var(--u));
}

.hr-menu-title::after {
  margin-top: calc(0.35 * var(--u));
}

.stage .overlay.hr-menu .hr-menu-text {
  margin-top: calc(0.55 * var(--u));
  font-size: calc(0.9 * var(--u));
}

.hr-menu-content > *,
.hr-choice {
  margin-top: calc(0.7 * var(--u));
}

.hr-menu-items {
  gap: calc(0.35 * var(--u));
  margin-top: calc(0.8 * var(--u));
}

.hr-item {
  padding: calc(0.5 * var(--u)) calc(0.95 * var(--u)) calc(0.45 * var(--u));
}

.hr-item-label {
  font-size: calc(0.95 * var(--u));
}

.hr-item.is-primary .hr-item-label {
  font-size: calc(1.2 * var(--u));
}

.hr-item-note {
  font-size: calc(0.74 * var(--u));
}

.hr-option {
  padding: calc(0.45 * var(--u)) calc(0.8 * var(--u)) calc(0.4 * var(--u));
}

.hr-card-name {
  font-size: calc(1.25 * var(--u));
}

.hr-menu-aside {
  top: calc(calc(3.4 * var(--u)) + var(--safe-top));
}

.hr-net-picture {
  width: calc(3.4 * var(--u));
}

.hr-net-picture .picture {
  width: calc(3.2 * var(--u));
  height: calc(3.2 * var(--u));
}

.hr-result-time {
  font-size: calc(2 * var(--u));
}

.hr-menu-keys li {
  font-size: calc(0.62 * var(--u));
}

/* ----- The menus on small game boxes ---------------------------------------------------------------------------------
   Narrow (a phone held upright, a small window): the panel covers the whole box; the card on the right has no room
   (what it says is in the choices' notes too). */
@container (max-width: 720px) {
  .stage .overlay.hr-menu {
    --menu-width: 100%;
  }

  .hr-menu-panel {
    clip-path: none;
    padding-right: calc(calc(1.4 * var(--u)) + var(--safe-right));
  }

  .stage .overlay.hr-menu::before,
  .hr-menu-aside {
    display: none;
  }

  .hr-menu-content .hr-net-code {
    display: flex;
  }
}

/* Lower than 960 x 540 allows (a phone held sideways, ~390 px high): only what is needed */
@container (max-height: 440px) {
  .stage .overlay.hr-menu .hr-menu-kicker,
  .hr-item-note,
  .stage .overlay.hr-menu .hr-card-about {
    display: none;
  }

  .stage .overlay.hr-menu .hr-menu-title {
    font-size: calc(1.35 * var(--u));
  }

  /* a row of "Öppna lopp" keeps its note: who is in the race is what the row is for */
  .hr-item.is-race .hr-item-note {
    display: block;
  }

  .hr-menu-keys {
    display: none;
  }

  /* thinner buttons, so the main menu's five fit (an iPad held upright: a 768 x 432 box) */
  .hr-menu-items {
    gap: calc(0.25 * var(--u));
  }

  .hr-item {
    padding: calc(0.32 * var(--u)) calc(0.95 * var(--u)) calc(0.28 * var(--u));
  }

  /* (the icon only as tall as the one line, or the main menu's five no longer fit) */
  .hr-item-icon {
    height: calc(1.5 * var(--u));
  }

  .hr-item.is-primary .hr-item-icon {
    height: calc(1.8 * var(--u));
  }

  /* ... and tighter lists, without their small notes ("toppfart …"), so "Välj bana och fart" fits too */
  .hr-choice-note {
    display: none;
  }

  .hr-choice {
    margin-top: calc(0.6 * var(--u));
  }

  .hr-choice-label {
    margin-bottom: calc(0.2 * var(--u));
  }

  .hr-choice-options {
    gap: calc(0.2 * var(--u));
  }

  .hr-option {
    padding-top: calc(0.32 * var(--u));
    padding-bottom: calc(0.28 * var(--u));
  }

  .hr-carousel-show {
    min-height: calc(2.2 * var(--u));
  }

  /* The result screens (a phone held sideways): no room kept at the bottom for the key tabs (hidden here; but kept
     while Chrome's fullscreen message needs it: .toast-room above) and the big time a little tighter – so the race's
     new medals (the row under the result) fit beside the places too */
  .stage:not(.toast-room) .overlay.hr-menu[data-screen="result"] .hr-menu-panel,
  .stage:not(.toast-room) .overlay.hr-menu[data-screen="net-result"] .hr-menu-panel {
    padding-bottom: calc(calc(0.8 * var(--u)) + var(--safe-bottom));
  }

  .hr-result-time {
    line-height: 1.15;
  }

  .stage .overlay.hr-menu .medal-row {
    row-gap: calc(0.1 * var(--u));
    margin-top: calc(0.3 * var(--u));
  }

  .stage .overlay.hr-menu .medal-row-item .medal-picture {
    width: calc(0.92 * var(--u));
    height: calc(1.1 * var(--u));
  }
}

/* ---------- The flaps lab (?flapslabb, flaps-lab.js): sliders for the airbrakes while you drive ----------
   Middle right, where the race info leaves room; it grows with the box like the race info (--hud). */
.hr-lab {
  position: absolute;
  z-index: 6;
  top: 50%;
  right: calc((0.6rem + var(--safe-right)) / var(--hud, 1));
  transform: translateY(-50%);
  zoom: var(--hud, 1);
  width: 15rem;
  padding: 0.55rem 0.7rem 0.6rem;
  background: rgba(14, 22, 64, 0.78);
  border-left: 3px solid #7ff2e2;
  clip-path: polygon(0.5rem 0, 100% 0, 100% calc(100% - 0.5rem), calc(100% - 0.5rem) 100%, 0 100%, 0 0.5rem);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.2;
}

.hr-lab[hidden] {
  display: none;
}

.hr-lab-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.4rem;
  font-family: "Orbitron", var(--font-display);
  font-size: 0.8rem;
  text-transform: lowercase;
}

.hr-lab-key {
  font-family: inherit;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.55);
}

.hr-lab-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.hr-lab-button {
  flex: 1;
  padding: 0.3rem 0.4rem;
  border: 0;
  background: rgba(64, 98, 186, 0.9);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.hr-lab-button:hover {
  background: rgba(96, 132, 222, 0.95);
}

.hr-lab-sliders {
  display: grid;
  gap: 0.3rem;
}

.hr-lab-slider {
  display: grid;
  gap: 0.1rem;
  cursor: pointer;
}

.hr-lab-name {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.hr-lab-value {
  color: #ffe94d;
  font-weight: 700;
  white-space: nowrap;
}

.hr-lab-slider input {
  width: 100%;
  margin: 0;
  accent-color: #7ff2e2;
}

.hr-lab-now {
  margin: 0.45rem 0;
  min-height: 2.4em;             /* two lines kept, so the panel doesn't jump */
  color: rgba(255, 255, 255, 0.75);
}

.hr-lab-copy {
  width: 100%;
  background: #ffe94d;
  color: #0a1030;
}

.hr-lab-copy:hover {
  background: #fff27f;
}

/* ---------- The balance lab (?balanslabb, balance-lab.js): each ship's handling numbers while you drive ----------
   The flaps lab's look; taller, so it scrolls when the box is low. */
.hr-ballab {
  top: 4.4rem;
  bottom: 5rem;
  transform: none;
  width: 16rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.hr-ballab .hr-lab-button {
  white-space: nowrap;
}

.hr-ballab .hr-lab-row {
  flex-wrap: wrap;               /* four presets: two rows if they don't fit */
}

.hr-lab-button.is-chosen {
  background: #7ff2e2;
  color: #0a1030;
}

.hr-ballab-tiers,
.hr-ballab-robot {
  width: 100%;
  margin-top: 0.45rem;
}

.hr-ballab-robot:disabled {
  opacity: 0.6;
  cursor: wait;
}

.hr-ballab-robots {
  margin-bottom: 0;
  min-height: 2.4em;
}

/* ---------- The module lab (?modullabb, module-lab.js): a test room for the moduler ----------
   Taller than the flaps lab: from under the race time down to over the speed, scrolling when it doesn't fit. The
   groups fold up (<details>), so only what is being tried takes room. */
.hr-modlab {
  top: 4.4rem;
  bottom: 5rem;
  transform: none;
  width: 16rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.hr-modlab .hr-lab-row {
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.hr-modlab .hr-lab-button {
  white-space: nowrap;
}

.hr-modlab .hr-lab-copy {
  width: auto;
}

.hr-lab-group {
  margin-top: 0.35rem;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(127, 242, 226, 0.25);
}

.hr-lab-group > summary {
  cursor: pointer;
  font-family: "Orbitron", var(--font-display);
  font-size: 0.66rem;
  text-transform: lowercase;
  color: #7ff2e2;
  list-style: none;
}

.hr-lab-group > summary::-webkit-details-marker {
  display: none;
}

.hr-lab-group > summary::before {
  content: "▸ ";
}

.hr-lab-group[open] > summary {
  margin-bottom: 0.35rem;
}

.hr-lab-group[open] > summary::before {
  content: "▾ ";
}

.hr-lab-group .hr-lab-sliders[hidden] {
  display: none;
}

.hr-lab-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
}

.hr-lab-choice {
  flex: 1 0 auto;
  padding: 0.22rem 0.35rem;
  border: 0;
  background: rgba(64, 98, 186, 0.55);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.hr-lab-choice:hover {
  background: rgba(96, 132, 222, 0.85);
}

.hr-lab-choice.is-chosen {
  background: #ffe94d;
  color: #0a1030;
  font-weight: 700;
}

.hr-lab-note {
  margin: 0 0 0.3rem;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.64rem;
}

.hr-lab-select {
  width: 100%;
  padding: 0.15rem;
  border: 1px solid rgba(127, 242, 226, 0.5);
  background: #0e1640;
  color: #fff;
  font: inherit;
}

.hr-lab-colour-row {
  grid-template-columns: 1fr 3.2rem;
  align-items: center;
}

.hr-lab-colour {
  width: 100%;
  height: 1.3rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

/* ---------- The debug mode (admin page -> Felsökning; debug-tools.js): small numbers in the top left corner ----------
   Owner, 2026-10-13: "a small font in the top left corner, for me to read live". During the race it sits right of the
   little map, so none of the race info is covered; on the menus right of the menu's panel. It never takes a click. */
.hr-debug {
  position: absolute;
  z-index: 6;
  top: calc(0.6rem + var(--safe-top) + 3.4rem * var(--hud, 1));
  left: calc(0.6rem + var(--safe-left) + 6.6rem * var(--hud, 1));
  margin: 0;
  padding: 0.2rem 0.4rem;
  font: 600 10px/1.25 ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
  white-space: pre;
  color: #eafff9;
  background: rgba(8, 12, 36, 0.72);
  border-left: 2px solid #7ff2e2;
  pointer-events: none;
}

.stage.in-menu .hr-debug {
  top: calc(0.6rem + var(--safe-top));
  left: calc(min(30rem * var(--hud, 1), 46%) + 0.8rem);
}

/* ----- TOUCH CONTROLS (owner, 2026-10-17: "visible controls, like Vattenkrig's") -----
   Vattenkrig's look (its touch.css): round see-through buttons with a 2 px neon ring. At each edge a big STEER button
   (cyan) with the OTHER side's AIRBRAKE above it (yellow; owner: steer left with one thumb, the other thumb takes the
   left airbrake for a tighter turn), and "Modul" on both sides a little in towards the middle (magenta
   for an attack, yellow-green for a defence, like the module box; dim with "modul" while none is waiting). They sit
   above the bottom row of race info and keep their size in fullscreen (a thumb doesn't grow). --tb = their unit,
   smaller in a low box (a phone held sideways without fullscreen). */
.hr-touch {
  --tb: 1rem;
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;                 /* the fingers reach the picture; only the buttons take them */
}

.hr-touch[hidden],
.stage.in-menu .hr-touch {
  display: none;
}

.hr-touch-button {
  --ring: var(--cyan);
  --fill: rgba(94, 240, 255, 0.16);
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--ring);
  background: var(--fill);
  color: var(--ring);
  font: inherit;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  opacity: 0.8;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.hr-touch-button[hidden] {
  display: none;
}

.hr-touch-button svg {
  width: 55%;
  height: 55%;
  filter: drop-shadow(0 0 0.2rem currentColor);
}

.hr-touch-button.is-held {
  opacity: 1;
  transform: scale(0.94);
  box-shadow: 0 0 18px var(--ring);
}

/* steer: big, at the edge where the thumb rests, over the lap time / speed row */
.hr-touch-steer {
  width: calc(5.4 * var(--tb));
  height: calc(5.4 * var(--tb));
  bottom: calc(4 * var(--tb) + var(--safe-bottom));
}

.hr-touch-steer.is-held {
  background: rgba(94, 240, 255, 0.32);
}

/* an airbrake: above the steer button – the right side has the LEFT airbrake, the left side the right one */
.hr-touch-flap {
  --ring: var(--yellow);
  --fill: rgba(255, 233, 77, 0.16);
  width: calc(4 * var(--tb));
  height: calc(4 * var(--tb));
  bottom: calc(10.2 * var(--tb) + var(--safe-bottom));
}

.hr-touch-flap.is-held {
  background: rgba(255, 233, 77, 0.32);
}

/* "Modul": a little in towards the middle, level with the steer buttons */
.hr-touch-use {
  --ring: #b8ff3a;
  --fill: rgba(184, 255, 58, 0.14);
  width: calc(4.2 * var(--tb));
  height: calc(4.2 * var(--tb));
  bottom: calc(4.6 * var(--tb) + var(--safe-bottom));
  font-family: "Orbitron", var(--font-display);
  font-style: normal;
  font-size: calc(0.7 * var(--tb));
  letter-spacing: 0.04em;
}

.hr-touch-use.is-attack {
  --ring: #ff3fb4;
  --fill: rgba(255, 63, 180, 0.16);
}

.hr-touch-use:not(.is-ready) {
  --ring: rgba(200, 210, 255, 0.55);
  --fill: rgba(64, 98, 186, 0.18);
  opacity: 0.55;
}

.hr-touch-use.is-ready svg {
  width: 70%;
  height: 70%;
}

.hr-touch-left.hr-touch-steer { left: calc(1 * var(--tb) + var(--safe-left)); }
.hr-touch-left.hr-touch-flap { left: calc(1.7 * var(--tb) + var(--safe-left)); }
.hr-touch-left.hr-touch-use { left: calc(7.6 * var(--tb) + var(--safe-left)); }
.hr-touch-right.hr-touch-steer { right: calc(1 * var(--tb) + var(--safe-right)); }
.hr-touch-right.hr-touch-flap { right: calc(1.7 * var(--tb) + var(--safe-right)); }
.hr-touch-right.hr-touch-use { right: calc(7.6 * var(--tb) + var(--safe-right)); }

/* the right side's arrow points the other way, and so does the right airbrake (on the left side) */
.hr-touch-right.hr-touch-steer svg,
[data-touch="brakeRight"] svg {
  transform: scaleX(-1);
}

/* a low box (a phone held sideways, not in fullscreen): smaller, so the airbrake stays under the little map */
@container (max-height: 330px) {
  .hr-touch { --tb: 0.68rem; }
}
