/* Online multiplayer (src/online/): the Online Multiplayer screen, the lobby, the on-screen
   keyboard, the question box, and the online parts of the car select and the results. Like
   main.css, everything is placed in the game's 1080 x 720 layout (--g is one of its units) and
   drawn with the game's own art and fonts. */

/* The page's notice (main.js's toast) stays in the page once it has faded; it must not take the
   clicks meant for what is under it (the Online Multiplayer screen's name field is up there). */
.toast { pointer-events: none; }

/* ---- the Online Multiplayer screen ------------------------------------------------------- */

.online__label {                         /* a field's name, centred on its position (like a slider's) */
  margin: 0;
  translate: -50% -50%;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}
.online__label--right { translate: -100% -50%; }   /* ends at its position, beside its field */
.online-button { --tx: 150; --ty: 45; --tw: 300; --th: 90; --label-y: 0; }   /* the game's Large button, 300 wide */
.online-button .game-button__label { font-size: calc(40 * var(--g)); }
.lan [data-action="join"] .game-button__label { font-size: calc(34 * var(--g)); }   /* Join with Address: in the button */
.online.is-pending .online-button,
.online.is-pending .text-field,
.online.is-pending .room-list { opacity: .6; }   /* waiting for the server: only Back works */

/* The public races (room-list.js): the car select's panel (UI/Frame_Background in UI/Frame_Square),
   690 x 452 from its position, six rows on show, 72 apart, in the results' rows (UI/Table_Row;
   the focused one UI/Table_Row_selected, pulsing like any focused part). A row: the host's driver
   face, the room's name (font Medium) over the host's name and the track (font Small), the track's
   picture in its rounded mask, racers/10 and Open (the game's yellow) or Full / Racing, the row
   at half strength. The list scrolls a row at a time; the game's arrows show there is more. */
.room-list {
  position: absolute;
  width: calc(690 * var(--g));
  height: calc(452 * var(--g));
  background: url(../assets/ui/loading_background.png) center / 100% 100% no-repeat;
  pointer-events: auto;
  touch-action: none;
  outline: none;
  will-change: scale;
}
.room-list::after {
  content: '';
  position: absolute;
  inset: calc(-10 * var(--g)) calc(-10 * var(--g)) calc(-5 * var(--g));
  border: calc(30 * var(--g)) solid transparent;
  border-image: url(../assets/ui/frame_square.png) 33% / calc(30 * var(--g)) stretch;
  pointer-events: none;
}
.room-list__window { position: absolute; inset: calc(10 * var(--g)) calc(12 * var(--g)); overflow: hidden; }
.room-list__rows {
  position: absolute;
  inset: 0;
  translate: 0 calc(-72 * var(--first, 0) * var(--g));
  transition: translate .15s ease-out;
}
.room-row {
  position: absolute;
  left: 0;
  top: calc(72 * var(--i) * var(--g));
  width: 100%;
  height: calc(66 * var(--g));
  cursor: pointer;
}
.room-row::before {                      /* the row's picture: it pulses with the focus, its text doesn't */
  content: '';
  position: absolute;
  inset: 0;
  background: url(../assets/ui/table_row.png) center / 100% 100% no-repeat;
}
.room-row.is-focused::before {
  background-image: url(../assets/ui/table_row_selected.png);
  animation: focus-pulse 1s ease-in-out infinite;
}
.room-row.is-focused { color: rgb(255 249 71); }   /* the highlighted row's yellow (the results', the lobby's) */
.room-row.is-closed { opacity: .5; cursor: default; }
/* a room new to the list, or a racer new to the lobby, pops into its row on a springy overshoot
   (the first rows of a list one after another) */
.room-row.is-new,
.lobby__row.is-new { animation: row-pop .45s var(--bounce) both; }
.room-row.is-new { animation-delay: calc(min(var(--i), 6) * 45ms); }
@keyframes row-pop { from { scale: .4; opacity: 0; } }
.room-row.is-pressed { transform: scale(.97); }
.room-row > * { position: absolute; margin: 0; line-height: 1; white-space: nowrap; pointer-events: none; }
.room-row__face { left: calc(6 * var(--g)); top: 50%; width: calc(56 * var(--g)); height: calc(56 * var(--g)); translate: 0 -50%; }
.room-row__name { left: calc(72 * var(--g)); top: calc(18 * var(--g)); translate: 0 -50%; scale: var(--fit, 1); transform-origin: 0 50%; }
.room-row__detail { left: calc(72 * var(--g)); top: calc(48 * var(--g)); translate: 0 -50%; scale: calc(.95 * var(--fit, 1)) var(--fit, 1); transform-origin: 0 50%; }
.room-row__track {
  left: calc(418 * var(--g));
  top: 50%;
  width: calc(58 * var(--g));
  height: calc(58 * var(--g));
  translate: 0 -50%;
  -webkit-mask: var(--mask) center / 100% 100% no-repeat;
  mask: var(--mask) center / 100% 100% no-repeat;
}
.room-row__players { left: calc(530 * var(--g)); top: 50%; translate: -50% -50%; font-size: calc(36 * var(--g)); }
.room-row__state { right: calc(12 * var(--g)); top: 50%; translate: 0 -50%; font-size: calc(30 * var(--g)); paint-order: stroke fill; -webkit-text-stroke: .15em #000; }
.room-row.is-open .room-row__state {     /* the game's yellow with its dark red outline, as the Host badge */
  color: rgb(255 230 41);
  -webkit-text-stroke: .22em rgb(166 2 0);
}
.room-list__message {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(560 * var(--g));
  margin: 0;
  translate: -50% -50%;
  text-align: center;
  line-height: 1.15;
  pointer-events: none;
}
.room-list__more {                       /* the switch's arrow, turned to point up or down */
  position: absolute;
  right: calc(-16 * var(--g));
  width: calc(44 * var(--g));
  height: calc(40 * var(--g));
  background: url(../assets/ui/arrow_left.png) center / 100% 100% no-repeat;
  filter: drop-shadow(0 calc(var(--g) * 3) calc(var(--g) * 3) rgba(0, 0, 0, .35));
  pointer-events: none;
}
.room-list__more--up { top: calc(-14 * var(--g)); rotate: 90deg; }
.room-list__more--down { bottom: calc(-14 * var(--g)); rotate: -90deg; }

/* A text field: the game's Large frame, --w x 90 about its position (the one its sliders and
   switches sit in), highlighted and pulsing with the focus, the text centred in the game's font */
.text-field {
  --w: 500;
  position: absolute;
  width: calc(var(--w) * var(--g));
  height: calc(90 * var(--g));
  margin: calc(-45 * var(--g)) 0 0 calc(var(--w) * var(--g) / -2);
  pointer-events: auto;
  outline: none;
  cursor: text;
}
.text-field__frame {
  position: absolute;
  inset: 0;
  background: url(../assets/ui/button_large.png) center / 100% 100% no-repeat;
  --shadow: drop-shadow(0 calc(var(--g) * 5) calc(var(--g) * 5) rgba(0, 0, 0, .35));
  filter: var(--shadow);
  pointer-events: none;
}
.text-field.is-selected .text-field__frame {
  background-image: url(../assets/ui/button_large_selected.png);
  animation: focus-pulse 1s ease-in-out infinite;
}
.text-field.is-pressed { transform: scale(.95); }
.text-field__input {
  position: absolute;
  left: calc(26 * var(--g));
  top: 0;
  width: calc(100% - 52 * var(--g));
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--white);
  font-family: inherit;
  text-align: center;
  line-height: 1;
  outline: none;
  caret-color: rgb(255 230 41);          /* the game's yellow */
  pointer-events: auto;
}
.text-field__input::placeholder { color: rgb(255 255 255 / .4); -webkit-text-stroke-color: rgb(0 0 0 / .25); }
.text-field--code .text-field__input { letter-spacing: .25em; text-indent: .25em; }   /* its four letters apart */

/* ---- the on-screen keyboard (keyboard.js) -------------------------------------------------
   Over the blurred screen like a message box: the game's post-race panel (panel_back in three
   slices, 780 x 540 about (540, 385)) with the field's name on its tab, the text typed so far in a
   Large frame, and the keys: 10 columns of the game's square buttons, 68 apart (wide keys its
   Medium button), 5 rows 64 apart. */
.osk { position: fixed; inset: 0; z-index: 22; pointer-events: auto; }   /* over the screens and boxes */
.osk__blur {
  position: absolute;
  inset: 0;
  background: rgba(0, 12, 40, .12);
  -webkit-backdrop-filter: blur(calc(var(--g) * 8));
  backdrop-filter: blur(calc(var(--g) * 8));
  animation: fade-in .2s ease both;
}
.osk.is-closing .osk__blur { animation: fade-out .3s ease both; }
.osk__window {
  position: absolute;
  left: 50vw;
  top: 50vh;
  width: calc(780 * var(--g));
  height: calc(540 * var(--g));
  margin: calc(-245 * var(--g)) 0 0 calc(-390 * var(--g));
  will-change: scale;
}
.osk__back {
  position: absolute;
  top: 0;
  height: 100%;
  background: url(../assets/ui/panel_back.png) 0 0 / 100% 100% no-repeat;
}
.osk__back--left { left: 0; width: calc(140 * var(--g)); }
.osk__back--middle { left: calc(139 * var(--g)); width: calc(502 * var(--g)); background-size: 400% 100%; background-position: 100% 0; }
.osk__back--right { right: 0; width: calc(140 * var(--g)); scale: -1 1; }
.osk__title {                            /* on the panel's tab */
  position: absolute;
  left: 50%;
  top: calc(50 * var(--g));
  margin: 0;
  translate: -50% -50%;
  line-height: 1;
  white-space: nowrap;
}
.osk__text {                             /* the text so far, in a Large frame 600 x 76 */
  position: absolute;
  left: calc(90 * var(--g));
  top: calc(112 * var(--g));
  width: calc(600 * var(--g));
  height: calc(76 * var(--g));
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url(../assets/ui/button_large.png) center / 100% 100% no-repeat;
  line-height: 1;
  white-space: pre;
}
.osk--code .osk__value { letter-spacing: .25em; }
.osk__caret {                            /* a blinking yellow caret after the text */
  display: inline-block;
  width: calc(5 * var(--g));
  height: calc(46 * var(--g));
  margin-left: calc(3 * var(--g));
  background: rgb(255 230 41);
  box-shadow: 0 0 0 calc(2 * var(--g)) #000;
  animation: osk-caret 1s steps(1) infinite;
}
@keyframes osk-caret { 50% { opacity: 0; } }
.osk__keys { position: absolute; left: calc(56 * var(--g)); top: calc(208 * var(--g)); }
.osk__key {
  position: absolute;
  left: calc(68 * var(--c) * var(--g));
  top: calc(64 * var(--r) * var(--g));
  width: calc((68 * var(--w) - 6) * var(--g));
  height: calc(58 * var(--g));
  padding: 0;
  border: 0;
  background: url(../assets/ui/button_square_a.png) center / 100% 100% no-repeat;
  color: var(--white);
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  --shadow: drop-shadow(0 calc(var(--g) * 3) calc(var(--g) * 3) rgba(0, 0, 0, .35));
  filter: var(--shadow);
}
.osk__key.button-font { font-size: calc(38 * var(--g)); }
.osk__key--wide { background-image: url(../assets/ui/button_medium.png); }
.osk__key.is-selected {
  background-image: url(../assets/ui/button_square_a_selected.png);
  animation: focus-pulse 1s ease-in-out infinite;
}
.osk__key--wide.is-selected { background-image: url(../assets/ui/button_medium_selected.png); }
.osk__key.is-pressed { transform: scale(.95); }
.osk__key.is-disabled { opacity: .3; cursor: default; }
.osk__key.is-on { color: rgb(255 230 41); }   /* Shift, while the next letter is a capital */

/* ---- the question box (confirm-box.js): the message box with No and Yes ------------------
   Yes stands where OK does ((750, 530)), No mirrors it at (330, 530); the focused one shows the
   game's highlighted button, pulsing, the other its plain one. */
.confirm-box .message-box__button::before {
  background-image: url(../assets/ui/button_medium.png);
  animation: none;
}
.confirm-box .message-box__button.is-selected::before {
  background-image: url(../assets/ui/button_medium_selected.png);
  animation: focus-pulse 1s ease-in-out infinite;
}
.confirm-box__no { margin-left: calc(var(--g) * -335); }
.confirm-box__no::before { transform: none; }

/* ---- a room's name and Public (room-box.js): the question box, 70 taller, under the message
   box (a message over it stays on top), with the Room Name field (540 wide) and the Public check
   box; its buttons hang from its bottom edge as OK does from the message box's ---------------- */
.room-box { z-index: 19; }
.room-box .message-box__window {
  height: calc(var(--g) * 420);
  margin-top: calc(var(--g) * -235);
  transform-origin: calc(var(--g) * 340) calc(var(--g) * 225);
}
.room-box .message-box__button { margin-top: calc(var(--g) * 157); }
.room-box__label {
  position: absolute;
  left: 50%;
  top: calc(118 * var(--g));
  margin: 0;
  translate: -50% -50%;
  line-height: 1;
  white-space: nowrap;
}
.room-box__name { left: 50%; top: calc(190 * var(--g)); --w: 540; }
.room-box__public { left: calc(215 * var(--g)); top: calc(300 * var(--g)); }

/* ---- the lobby ------------------------------------------------------------------------------ */

/* the room's name (font HUD_Medium, shrunk to fit 520) and under it its code and Public or Private
   (the Host badge's yellow; Private in the game's plain white), both centred on their position */
.lobby__title,
.lobby__sub {
  margin: 0;
  translate: -50% -50%;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.lobby__sub { display: flex; align-items: center; gap: calc(14 * var(--g)); }
.lobby__code { letter-spacing: .12em; }
.lobby__visibility { font-size: calc(26 * var(--g)); }
.lobby__visibility.is-private { color: var(--white); -webkit-text-stroke: .22em #000; }
.copy-button { --tx: 110; --ty: 40; --tw: 220; --th: 80; --label-y: 0; }   /* the game's Medium button (Defaults'), 220 wide */
.copy-button .game-button__label { font-size: calc(38 * var(--g)); }
/* the host's Room button: Back's round button in the other corner, with the settings gears */
.corner-button { --tx: 65; --ty: 55; --tw: 130; --th: 120; --label-y: 45; }
.corner-button .game-button__image { left: calc(18 * var(--g)); top: calc(10 * var(--g)); width: calc(90 * var(--g)); height: calc(85 * var(--g)); }
.corner-button .game-button__icon { --ix: -30; --iy: -34; --iw: 58; --ih: 58; }
.lobby:not(.is-host) .corner-button { visibility: hidden; }
.lobby-button { --tx: 150; --ty: 45; --tw: 300; --th: 90; --label-y: 0; }   /* the Large button, 300 wide */
.lobby-button .game-button__label { font-size: calc(45 * var(--g)); }
.game-button.is-disabled { opacity: .5; }   /* the game draws what can't be used at half strength */

/* the racers: the car select's panel (UI/Frame_Background in UI/Frame_Square), 620 x 406 from its
   position, with a row each, 39 apart, in the results' rows (UI/Table_Row; this player's
   UI/Table_Row_selected with yellow letters): the face, the name, the car, then the tick or the
   host's badge at the end; the rows still free are there at half strength */
.lobby__panel {
  position: absolute;
  width: calc(620 * var(--g));
  height: calc(406 * var(--g));
  background: url(../assets/ui/loading_background.png) center / 100% 100% no-repeat;
  will-change: scale;
}
.lobby__panel::after {
  content: '';
  position: absolute;
  inset: calc(-10 * var(--g)) calc(-10 * var(--g)) calc(-5 * var(--g));
  border: calc(30 * var(--g)) solid transparent;
  border-image: url(../assets/ui/frame_square.png) 33% / calc(30 * var(--g)) stretch;
  pointer-events: none;
}
.lobby__rows { position: absolute; inset: 0; }
.lobby__row {
  position: absolute;
  left: calc(16 * var(--g));
  top: calc((10 + 39 * var(--i)) * var(--g));
  width: calc(588 * var(--g));
  height: calc(37 * var(--g));
  background: url(../assets/ui/table_row.png) center / 100% 100% no-repeat;
}
.lobby__row.is-me { background-image: url(../assets/ui/table_row_selected.png); color: rgb(255 249 71); }
.lobby__row.is-empty { opacity: .5; }
.lobby__row.is-away { opacity: .6; }
.lobby__row > * { position: absolute; top: 50%; translate: 0 -50%; margin: 0; line-height: 1; white-space: nowrap; }
.lobby__face { left: calc(4 * var(--g)); width: calc(44 * var(--g)); height: calc(44 * var(--g)); }
.lobby__name { left: calc(58 * var(--g)); scale: var(--fit, 1); transform-origin: 0 50%; }
.lobby__car { left: calc(320 * var(--g)); scale: calc(.95 * var(--fit, 1)) var(--fit, 1); transform-origin: 0 50%; }   /* font Small, 95% wide */
.lobby__tick {                           /* the check box's tick (UI/CheckBox_On) */
  right: calc(18 * var(--g));
  width: calc(36 * var(--g));
  height: calc(36 * var(--g));
  background: url(../assets/ui/checkbox_on.png) center / 100% 100% no-repeat;
  display: none;
}
.lobby__row.is-ready .lobby__tick { display: block; }
.lobby__host { right: calc(10 * var(--g)); display: none; }
/* the host's X on another racer's row: the game's square button (UI/Button_Square_B) in red, a
   white cross on it; selected, the button's white-edged version. The button is a bigger touch
   area than its picture (a finger on a phone) */
.lobby__kick {
  right: calc(51 * var(--g));
  width: calc(56 * var(--g));
  height: calc(39 * var(--g));
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;                  /* (a screen takes none: each of its buttons its own) */
  outline: none;
  display: none;
}
.lobby__row.can-kick .lobby__kick { display: block; }
.lobby__kick-image {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(38 * var(--g));
  height: calc(33 * var(--g));
  translate: -50% -50%;
}
.lobby__kick-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url(../assets/ui/button_square_b.png) center / 100% 100% no-repeat;
  filter: hue-rotate(148deg) saturate(1.5);
}
.lobby__kick.is-selected .lobby__kick-image::before { background-image: url(../assets/ui/button_square_b_selected.png); }
.lobby__kick::before,
.lobby__kick::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(23 * var(--g));
  height: calc(5.2 * var(--g));
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 calc(1.5 * var(--g)) rgb(110 12 8);
  translate: -50% -50%;
  rotate: 45deg;
  z-index: 1;                            /* over the button's picture */
}
.lobby__kick::after { rotate: -45deg; }
.lobby__kick:active { scale: .95; }
.lobby__row.is-host .lobby__host { display: block; }
/* the host's badge: the game's yellow lettering with its dark red outline (as the credits') */
.host-font {
  font-size: calc(28 * var(--g));
  color: rgb(255 230 41);
  paint-order: stroke fill;
  -webkit-text-stroke: .22em rgb(166 2 0);
}

/* the track: a Quick Race track card (card-list.js's rects: the card 300 x 440, the picture in
   its frame, the name on the tab) at 80% about its position, the host's arrows either side; a
   cup: the Choose Championship card (VuChampListEntity: the picture 300 x 300 from 80 down, the
   name on the tab 50 down) with its number of races under the picture */
.lobby__track { position: absolute; width: 0; height: 0; outline: none; will-change: scale; }
.lobby__card {
  position: absolute;
  left: calc(-150 * var(--g));
  top: calc(-220 * var(--g));
  width: calc(300 * var(--g));
  height: calc(440 * var(--g));
  scale: .8;
}
.lobby__track.is-cup .lobby__track-image,
.lobby__track.is-cup .lobby__track-frame { left: 0; top: calc(80 * var(--g)); width: calc(300 * var(--g)); height: calc(300 * var(--g)); }
.lobby__track.is-cup .lobby__track-name { top: calc(50 * var(--g)); }
.lobby__card-note {
  left: calc(150 * var(--g));
  top: calc(410 * var(--g));
  translate: -50% -50%;
  line-height: 1;
  white-space: nowrap;
}
.lobby.is-host .lobby__track.is-cup .lobby__card { pointer-events: auto; cursor: pointer; }   /* the host's: Choose Championship */
.lobby__card.is-pressed { transform: scale(.95); }

/* Single Race or Championship: the game's switch (UI/Button_Switch) above the card; the others
   see the host's choice without its arrows, and it is at half strength while a race is on */
.lobby__mode .switch__value { font-size: calc(38 * var(--g)); }
.lobby:not(.is-host) .lobby__mode .switch__arrow { display: none; }
.lobby:not(.is-host) .lobby__mode { pointer-events: none; }
.lobby__mode.is-disabled { opacity: .5; }
.lobby__card > * { position: absolute; pointer-events: none; }
.lobby__card-back { inset: 0; background: url(../assets/ui/card.png) center / 100% 100% no-repeat; }
.lobby__track.is-selected .lobby__card-back {
  background-image: url(../assets/ui/card_selected.png);
  animation: focus-pulse 1s ease-in-out infinite;
}
.lobby__track-image,
.lobby__track-frame {
  left: calc(-10 * var(--g));
  top: calc(75 * var(--g));
  width: calc(320 * var(--g));
  height: calc(320 * var(--g));
}
.lobby__track-image {                    /* the picture takes the rounded shape of its mask */
  -webkit-mask: var(--mask) center / 100% 100% no-repeat;
  mask: var(--mask) center / 100% 100% no-repeat;
}
.lobby__track-name {
  left: calc(150.5 * var(--g));
  top: calc(48 * var(--g));
  translate: -50% -50%;
  scale: var(--fit, 1);
  line-height: 1;
  white-space: nowrap;
}
.lobby__arrow {                          /* the switch's arrows (UI/ArrowL, UI/ArrowR), 100 x 100 to touch */
  position: absolute;
  top: calc(-37 * var(--g));
  width: calc(100 * var(--g));
  height: calc(100 * var(--g));
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  display: none;
}
.lobby.is-host .lobby__arrow { display: block; }
.lobby__arrow--left { left: calc(-192 * var(--g)); }
.lobby__arrow--right { left: calc(92 * var(--g)); }
.lobby__arrow.is-pressed { transform: scale(.95); }
.lobby__arrow-image {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(64 * var(--g));
  height: calc(60 * var(--g));
  translate: -50% -50%;
  background: url(../assets/ui/arrow_left.png) center / 100% 100% no-repeat;
  filter: drop-shadow(0 calc(var(--g) * 4) calc(var(--g) * 4) rgba(0, 0, 0, .35));
}
.lobby__arrow--right .lobby__arrow-image { background-image: url(../assets/ui/arrow_right.png); }

/* news in the footer for a moment (a racer joined or left, a new host, the link copied): in the
   yellow of this player's row, popping in on a spring-like overshoot */
.lobby .footer-text.is-news {
  color: rgb(255 249 71);
  animation: news-pop .35s var(--bounce) both;
}
@keyframes news-pop { from { transform: scale(.6); } }

/* the host's AI Racers check box: the others see it at half strength */
.lobby:not(.is-host) .lobby__ai { opacity: .5; pointer-events: none; cursor: default; }

/* Ready: the check box's tick (or cross) in the button, left of the name */
.lobby__go-tick {
  position: absolute;
  left: calc(28 * var(--g));
  top: 50%;
  width: calc(44 * var(--g));
  height: calc(44 * var(--g));
  translate: 0 -50%;
  background: url(../assets/ui/checkbox_off.png) center / 100% 100% no-repeat;
  pointer-events: none;
}
[data-action='go'].is-ticked .lobby__go-tick { background-image: url(../assets/ui/checkbox_on.png); }
.lobby:not(.is-host) [data-action='go'] { --label-x: 22; }
.lobby.is-host .lobby__go-tick { display: none; }

/* ---- the results, online ----------------------------------------------------------------------
   The name cell shrinks to fit; an AI racer's has a small "AI" after it. Past 6 rows the panel
   grows to 580 high from y 20 (its tab and heading with it) and the rows close up to 42 apart,
   centred in it; Continue moves down to (540, 660). */
.results.is-online .results__cell--driver { scale: var(--fit, 1); transform-origin: 0 50%; }
.results__ai {
  display: inline-block;
  margin-left: .4em;
  padding: .12em .32em .08em;
  border-radius: .35em;
  background: rgb(0 0 0 / .35);
  font-size: calc(22 * var(--g));
  line-height: 1;
  vertical-align: middle;
  -webkit-text-stroke: 0;
  text-shadow: none;
}
.results.is-long .results__panel-part {
  top: calc(50vh - 340 * var(--g));
  height: calc(580 * var(--g));
  transform-origin: calc((540 - var(--px)) * var(--g)) calc(320 * var(--g));
}
.results.is-long .results__heading { top: calc(50vh - 286 * var(--g)); }
.results.is-long .results__row {
  top: calc((-214 + (10 - var(--n)) * 21 + 42 * var(--i)) * var(--g));
  height: calc(40 * var(--g));
}
.results.is-long [data-action='continue'] { top: calc(50vh + 300 * var(--g)); }
.results.is-long .results__cell--place { left: auto; right: calc(508 * var(--g)); }   /* "10" ends where "1" does */

/* ---- a cup's results and standings (cup-results.js): HUDs/SplitScreenPostGameHUD -----------------
   In the game's 1080 x 720 layout: the band (UI/Frame_Background's right quarter, 1080 x 300 from
   y 190, 200/255, across the whole width), the panel (UI/MessageBoxBack: 140 + 300 + 140 wide, 550
   high from (250, 40)) with the cup's name at the top of its tab and a race icon either side, the
   heading centred on y 170, the rows (UI/Table_Row) 520 x 40 from (280, 200), 50 apart, the track
   and EVENT lines centred on y 515 and 550, the pictures (260 x 250 in a UI/Frame_Square frame 280 x
   270 from (10, 203) and (790, 203), half way to the screen's edges), the footer bar (1080 x 60 from
   y 620, 200/255) with the buttons on it. Past 6 rows the panel is 590 high from y 15 and the rows
   38 apart from y 145. */
.cup-results {
  --top: 40; --height: 550; --icon-y: 48; --tab-y: 65; --head-y: 170;
  --row-y: 200; --row-step: 50; --row-h: 40; --sub-a: 515; --sub-b: 550;
}
.cup-results.is-long {
  --top: 15; --height: 590; --icon-y: 23; --tab-y: 38; --head-y: 124;
  --row-y: 150; --row-step: 38; --row-h: 34; --sub-a: 550; --sub-b: 581;
}
.cup-results.is-long .cup-results__cell--place { left: auto; right: calc(482 * var(--g)); }   /* "10" ends where "1" does */
.cup-results__darken { background: rgb(0 0 0 / .392); opacity: 0; transition: opacity .3s; }
.cup-results__darken.is-shown { opacity: 1; }
.cup-results__band,
.cup-results__footer {
  position: absolute;
  left: calc(50vw - 540 * var(--g) - var(--spare-x));
  width: calc(1080 * var(--g) + 2 * var(--spare-x));
  background: url(../assets/ui/loading_background.png) 100% 0 / 400% 100% no-repeat;
  filter: opacity(.784);
  pointer-events: none;
}
.cup-results__band { top: calc(50vh - 170 * var(--g)); height: calc(300 * var(--g)); }
.cup-results__footer { top: calc(50vh + 260 * var(--g) + .5 * var(--spare-y)); height: calc(60 * var(--g)); }
.cup-results__group {                   /* the panel, the results and the standings: each springs about (540, 340) */
  position: absolute;
  inset: 0;
  transform-origin: 50vw calc(50vh - 20 * var(--g));
  pointer-events: none;
}
.cup-results__group > * { position: absolute; margin: 0; }
.cup-results__panel-part {
  left: calc(50vw + (var(--px) - 540) * var(--g));
  top: calc(50vh + (var(--top) - 360) * var(--g));
  width: calc(var(--pw) * var(--g));
  height: calc(var(--height) * var(--g));
  background: url(../assets/ui/panel_back.png) 0 0 / 100% 100% no-repeat;
}
.cup-results__panel-part--left { --px: 250; --pw: 140; }
.cup-results__panel-part--middle { --px: 390; --pw: 300; background-size: 400% 100%; background-position: 100% 0; }
.cup-results__panel-part--right { --px: 690; --pw: 140; scale: -1 1; }
.cup-results__icon {                     /* VuGameTypeImageEntity: 110 x 90 from (325, 48) and (645, 48) */
  left: calc(50vw + (var(--ix) - 540) * var(--g));
  top: calc(50vh + (var(--icon-y) - 360) * var(--g));
  width: calc(110 * var(--g));
  height: calc(90 * var(--g));
}
.cup-results__icon--left { --ix: 325; }
.cup-results__icon--right { --ix: 645; scale: -1 1; }
.cup-results__cup,                       /* [[CHAMP_NAME]] from the top of the tab; the rest centred on their line */
.cup-results__header,
.cup-results__sub {
  left: 50vw;
  line-height: 1;
  white-space: nowrap;
  translate: -50% -50%;
  scale: var(--fit, 1);
}
.cup-results__cup { top: calc(50vh + (var(--tab-y) - 360) * var(--g)); translate: -50% 0; }
.cup-results__header { top: calc(50vh + (var(--head-y) - 360) * var(--g)); }
.cup-results__sub--a { top: calc(50vh + (var(--sub-a) - 360) * var(--g)); }
.cup-results__sub--b { top: calc(50vh + (var(--sub-b) - 360) * var(--g)); }
.cup-results__table { left: 0; top: 0; width: 0; height: 0; }
.cup-results__row {
  position: absolute;
  left: calc(50vw - 260 * var(--g));
  top: calc(50vh + (var(--row-y) + var(--row-step) * var(--i) - 360) * var(--g));
  width: calc(520 * var(--g));
  height: calc(var(--row-h) * var(--g));
  background: url(../assets/ui/table_row.png) center / 100% 100% no-repeat;
}
.cup-results__row.is-player { background-image: url(../assets/ui/table_row_selected.png); color: rgb(255 249 71); }
.cup-results__cell { position: absolute; top: 50%; translate: 0 -50%; line-height: 1; white-space: nowrap; }
.cup-results__cell--place { left: calc(20 * var(--g)); }
.cup-results__cell--driver { left: calc(60 * var(--g)); scale: var(--fit, 1); transform-origin: 0 50%; }
.cup-results__cell--car { left: calc(260 * var(--g)); translate: 0 calc(-50% + 3 * var(--g)); scale: calc(.95 * var(--fit, 1)) var(--fit, 1); transform-origin: 0 50%; }
.cup-results__cell--points { right: calc(20 * var(--g)); }
.cup-results__arrow {                    /* UI/Arrow at 150/255: to the track (left) and the next one (right) */
  top: calc(50vh + 140 * var(--g));
  width: calc(60 * var(--g));
  height: calc(60 * var(--g));
  background: url(../assets/ui/icon_arrow.png) center / 100% 100% no-repeat;
  opacity: .588;
}
.cup-results.is-long .cup-results__arrow { display: none; }
.cup-results__arrow--left { left: calc(50vw - 240 * var(--g)); scale: -1 1; }
.cup-results__arrow--right { left: calc(50vw + 180 * var(--g)); }
.cup-results__event {                    /* the picture 260 x 250 inside its 280 x 270 frame */
  width: calc(280 * var(--g));
  height: calc(270 * var(--g));
  pointer-events: none;
}
.cup-results__event-image {
  position: absolute;
  left: calc(10 * var(--g));
  top: calc(10 * var(--g));
  width: calc(260 * var(--g));
  height: calc(250 * var(--g));
}
.cup-results__event::after {
  content: '';
  position: absolute;
  inset: 0;
  border: calc(30 * var(--g)) solid transparent;
  border-image: url(../assets/ui/frame_square.png) 33% / calc(30 * var(--g)) stretch;
}
.cup-results [data-action] { top: calc(50vh + 290 * var(--g) + .5 * var(--spare-y)); }   /* on the footer bar, y 650 */
.cup-results__status {                   /* the next race's countdown, between Leave and Continue */
  position: absolute;
  left: 50vw;
  top: calc(50vh + 290 * var(--g) + .5 * var(--spare-y));
  margin: 0;
  translate: -50% -50%;
  scale: var(--fit, 1);
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

/* The connection dropped in a room and is coming back (net/client.js resume; online.js): a notice
   at the top, where the page's notice (toast) shows, while the race goes on under it. */
.net-reconnecting {
  position: fixed;
  left: 50%;
  top: calc(var(--u) * 3);
  z-index: 41;
  translate: -50% 0;
  margin: 0;
  padding: calc(var(--u) * 1) calc(var(--u) * 3);
  border-radius: 99px;
  background: rgba(150, 24, 24, .82);
  font-size: calc(var(--u) * 3.2);
  pointer-events: none;
  animation: net-reconnecting 0.8s ease-in-out infinite alternate;
}
@keyframes net-reconnecting {
  from { opacity: .6; }
  to { opacity: 1; }
}
