/*!
 * SPEED RUSH - Industrial Zone
 * File: css/style.css
 * Styles for the loading screen, menus, HUD, results and touch controls.
 * UI accent colors are set from js/config.js (CSS variables in :root).
 */
@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../assets/fonts/orbitron-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../assets/fonts/orbitron-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url(../assets/fonts/orbitron-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../assets/fonts/rajdhani-500-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../assets/fonts/rajdhani-600-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../assets/fonts/rajdhani-700-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --cy: #22e3ff;
  --mg: #ff2e88;
  --or: #ffb020;
  --gl: rgba(10, 14, 28, 0.62);
  --bd: rgba(255, 255, 255, 0.12);
  --tx: #eaf6ff;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05060c;
  color: var(--tx);
  font-family: Rajdhani, "Segoe UI", sans-serif;
  user-select: none;
}
canvas#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.screen.on {
  opacity: 1;
  pointer-events: auto;
}
.orb {
  font-family: Orbitron, Rajdhani, sans-serif;
}
/* fade + letterbox */
#fade {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
  z-index: 90;
}
.bar {
  position: fixed;
  left: 0;
  right: 0;
  height: 0;
  background: #000;
  z-index: 40;
  transition: height 0.8s cubic-bezier(0.7, 0, 0.2, 1);
}
#barT {
  top: 0;
}
#barB {
  bottom: 0;
}
body.cine .bar {
  height: 11vh;
}
#vign {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}
#speedlines {
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 255, 255, 0) 0deg,
    rgba(255, 255, 255, 0) 3.2deg,
    rgba(200, 240, 255, 0.55) 3.5deg,
    rgba(255, 255, 255, 0) 3.9deg
  );
  -webkit-mask: radial-gradient(circle, transparent 30%, #000 70%);
  mask: radial-gradient(circle, transparent 30%, #000 70%);
  animation: spin 0.25s steps(3) infinite;
}
@keyframes spin {
  to {
    transform: rotate(7deg);
  }
}
/* LOADING */
#loading {
  z-index: 80;
  background: radial-gradient(ellipse at 50% 40%, #141a33 0%, #05060c 70%);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 34px;
}
.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  filter: drop-shadow(0 0 30px rgba(34, 227, 255, 0.35));
}
.logo svg {
  display: none !important;
}
.logo .t1 {
  font-family: Orbitron, sans-serif;
  font-weight: 900;
  font-size: clamp(34px, 7.2vw, 96px);
  letter-spacing: 0.08em;
  line-height: 0.95;
  padding: 0 0.14em 0 0.04em; /* italic overhang: stops the last letter being clipped */
  background: linear-gradient(180deg, #fff 0%, #bfefff 45%, #22e3ff 55%, #0a6c99 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: italic;
}
.logo .t2 {
  font-family: Orbitron, sans-serif;
  font-weight: 700;
  font-size: clamp(12px, 1.6vw, 20px);
  letter-spacing: 0.7em;
  color: var(--mg);
  text-shadow: 0 0 14px rgba(255, 46, 136, 0.8);
  padding-left: 0.7em;
}
.ldbar {
  width: min(420px, 70vw);
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}
.ldbar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--mg), var(--cy));
  box-shadow: 0 0 18px var(--cy);
  transition: width 0.2s;
}
.ldtx {
  font-size: 14px;
  letter-spacing: 0.35em;
  opacity: 0.6;
  text-transform: uppercase;
}
/* TITLE */
#title {
  z-index: 20;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background: linear-gradient(180deg, rgba(5, 6, 12, 0.15), rgba(5, 6, 12, 0) 40%, rgba(5, 6, 12, 0.75));
}
#title .logo {
  animation: float 4s ease-in-out infinite;
}
@keyframes float {
  50% {
    transform: translateY(-8px);
  }
}
.press {
  font-family: Orbitron;
  font-size: clamp(13px, 1.4vw, 18px);
  letter-spacing: 0.45em;
  animation: blink 1.6s ease-in-out infinite;
  margin-top: 6vh;
}
@keyframes blink {
  50% {
    opacity: 0.25;
  }
}
.foot {
  position: absolute;
  bottom: 22px;
  font-size: 12px;
  letter-spacing: 0.3em;
  opacity: 0.45;
}
/* MENU */
#menu {
  z-index: 20;
  align-items: center;
  background: linear-gradient(90deg, rgba(5, 6, 12, 0.88) 0%, rgba(5, 6, 12, 0.55) 34%, rgba(5, 6, 12, 0) 60%);
}
.menuL {
  margin-left: 7vw;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(400px, 80vw);
}
.menuL .logo {
  align-items: flex-start;
  margin-bottom: 26px;
}
.menuL .logo .t1 {
  font-size: clamp(30px, 4.6vw, 64px);
}
.menuL .logo .t2 {
  font-size: 13px;
  padding-left: 0;
}
.btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 22px;
  font-family: Orbitron;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.18em;
  color: #dfefff;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--bd);
  clip-path: polygon(0 0, 100% 0, 100% 70%, 94% 100%, 0 100%);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  text-transform: uppercase;
  outline: none;
}
.btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cy);
  box-shadow: 0 0 12px var(--cy);
  transform: scaleY(0);
  transition: transform 0.22s;
}
.btn small {
  margin-left: auto;
  font-family: Rajdhani;
  font-size: 13px;
  opacity: 0.5;
  letter-spacing: 0.1em;
}
.btn:hover,
.btn.sel {
  background: linear-gradient(90deg, rgba(34, 227, 255, 0.28), rgba(255, 46, 136, 0.08));
  transform: translateX(10px);
  border-color: rgba(34, 227, 255, 0.5);
  color: #fff;
}
.btn:hover::before,
.btn.sel::before {
  transform: scaleY(1);
}
.btn.pri {
  background: linear-gradient(90deg, var(--mg), #ff6a3d);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 40px -10px rgba(255, 46, 136, 0.7);
}
.btn.pri:hover,
.btn.pri.sel {
  background: linear-gradient(90deg, #ff4f9c, #ff8a4f);
}
/* PANELS */
.panel {
  background: var(--gl);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--bd);
  border-radius: 4px;
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.ph {
  font-family: Orbitron;
  font-weight: 900;
  letter-spacing: 0.2em;
  font-size: 22px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ph::before {
  content: "";
  width: 22px;
  height: 4px;
  background: linear-gradient(90deg, var(--mg), var(--cy));
}
/* GARAGE */
#garage {
  z-index: 20;
  justify-content: flex-end;
  align-items: stretch;
  background: linear-gradient(270deg, rgba(5, 6, 12, 0.85), rgba(5, 6, 12, 0) 55%);
}
.gpanel {
  width: min(460px, 92vw);
  margin: 5vh 4vw;
  padding: 28px 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}
.carname {
  font-family: Orbitron;
  font-weight: 900;
  font-size: 34px;
  font-style: italic;
  letter-spacing: 0.04em;
  line-height: 1;
}
.carcls {
  color: var(--cy);
  letter-spacing: 0.4em;
  font-size: 13px;
  font-weight: 700;
}
.carnav {
  display: flex;
  gap: 10px;
  align-items: center;
}
.arrow {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--bd);
  cursor: pointer;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.04);
  transition: 0.2s;
}
.arrow:hover {
  background: var(--cy);
  color: #000;
}
.dots {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
}
.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: 0.3s;
}
.dots i.on {
  background: var(--cy);
  box-shadow: 0 0 10px var(--cy);
  width: 24px;
  border-radius: 4px;
}
.stat {
  display: grid;
  grid-template-columns: 110px 1fr 40px;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  font-size: 13px;
}
.stat .sb {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 98% 100%, 0 100%);
}
.stat .sb i {
  position: absolute;
  inset: 0;
  width: 0;
  background: linear-gradient(90deg, var(--cy), var(--mg));
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.opt {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  letter-spacing: 0.15em;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.seg {
  display: flex;
  gap: 4px;
}
.seg b {
  padding: 6px 12px;
  border: 1px solid var(--bd);
  cursor: pointer;
  font-family: Orbitron;
  font-size: 11px;
  transition: 0.2s;
  font-weight: 700;
}
.seg b.on {
  background: var(--cy);
  color: #001;
  border-color: var(--cy);
  box-shadow: 0 0 16px rgba(34, 227, 255, 0.5);
}
.seg b:hover:not(.on) {
  background: rgba(255, 255, 255, 0.1);
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 170px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--cy);
  box-shadow: 0 0 10px var(--cy);
  cursor: pointer;
  transform: rotate(45deg);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--cy);
  border: none;
}
/* SETTINGS / CONTROLS (modal) */
.modal {
  z-index: 60;
  align-items: center;
  justify-content: center;
  background: rgba(3, 4, 10, 0.55);
}
.mbox {
  width: min(560px, 92vw);
  padding: 30px 34px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 26px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.keys div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
kbd {
  font-family: Orbitron;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-bottom-width: 3px;
  border-radius: 3px;
  margin-left: 4px;
  background: rgba(255, 255, 255, 0.05);
}
/* HUD */
#hud {
  z-index: 10;
  pointer-events: none;
}
#hud.on {
  pointer-events: none;
}
.hTL {
  position: absolute;
  left: 28px;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.posbox {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  font-family: Orbitron;
  font-weight: 900;
  font-style: italic;
}
.posbox .p {
  font-size: 76px;
  line-height: 0.8;
  background: linear-gradient(180deg, #fff, #9feeff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 16px rgba(34, 227, 255, 0.5));
}
.posbox .ps {
  font-size: 26px;
  opacity: 0.9;
}
.posbox .pt {
  font-size: 22px;
  opacity: 0.5;
  margin-left: 6px;
}
.lapbox {
  font-family: Orbitron;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2em;
}
.lapbox b {
  font-size: 26px;
  color: var(--cy);
}
.board {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
}
.board div {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 14px;
  padding: 3px 10px 3px 6px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));
  width: 210px;
  transition: all 0.3s;
}
.board div i {
  font-style: normal;
  font-family: Orbitron;
  font-size: 11px;
  width: 20px;
  text-align: center;
  opacity: 0.7;
}
.board div.me {
  background: linear-gradient(90deg, rgba(255, 46, 136, 0.75), rgba(255, 46, 136, 0));
}
.board div span {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.6;
}
.hTR {
  position: absolute;
  right: 28px;
  top: 24px;
  text-align: right;
  font-family: Orbitron;
}
.hTR .tm {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.hTR .sm {
  font-size: 13px;
  letter-spacing: 0.2em;
  opacity: 0.65;
  margin-top: 4px;
}
.hTR .sm b {
  color: var(--or);
  opacity: 1;
}
.hBR {
  position: absolute;
  right: 20px;
  bottom: 16px;
  width: 290px;
  height: 290px;
}
#gauge {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.spd {
  position: absolute;
  left: 0;
  right: 0;
  top: 96px;
  text-align: center;
  font-family: Orbitron;
  font-weight: 900;
  font-style: italic;
}
.spd .v {
  font-size: 66px;
  line-height: 1;
  text-shadow: 0 0 24px rgba(34, 227, 255, 0.6);
}
.spd .u {
  font-size: 12px;
  letter-spacing: 0.4em;
  opacity: 0.6;
}
.gear {
  position: absolute;
  left: 50%;
  top: 190px;
  transform: translateX(-50%);
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  font-family: Orbitron;
  font-weight: 900;
  font-size: 28px;
  border: 2px solid var(--cy);
  background: rgba(0, 0, 0, 0.4);
  transform: translateX(-50%) rotate(45deg);
}
.gear span {
  transform: rotate(-45deg);
}
.bars {
  position: absolute;
  right: 316px;
  bottom: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 220px;
}
.mb .lb {
  display: flex;
  justify-content: space-between;
  font-family: Orbitron;
  font-size: 11px;
  letter-spacing: 0.25em;
  margin-bottom: 5px;
  font-weight: 700;
}
.mb .tr {
  height: 10px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transform: skewX(-20deg);
  overflow: hidden;
}
.mb .tr i {
  display: block;
  height: 100%;
  width: 50%;
  transition: width 0.1s;
}
#nitroB i {
  background: linear-gradient(90deg, #1a6cff, var(--cy));
  box-shadow: 0 0 14px var(--cy);
}
#nitroB.full .tr {
  animation: pulse 0.8s infinite;
}
@keyframes pulse {
  50% {
    box-shadow: 0 0 18px var(--cy);
  }
}
#dmgB i {
  background: linear-gradient(90deg, #ffd000, #ff3b1f);
}
#dmgB.crit .tr {
  animation: crit 0.4s infinite;
}
@keyframes crit {
  50% {
    border-color: #ff3b1f;
    box-shadow: 0 0 18px #ff3b1f;
  }
}
.hBL {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(5, 8, 18, 0.55);
  backdrop-filter: blur(6px);
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.25);
}
#mini {
  width: 100%;
  height: 100%;
}
#center {
  position: absolute;
  left: 0;
  right: 0;
  top: 26%;
  text-align: center;
  pointer-events: none;
}
.msg {
  font-family: Orbitron;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.1em;
  animation: msgIn 1.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  text-shadow: 0 0 30px rgba(34, 227, 255, 0.7);
}
@keyframes msgIn {
  0% {
    opacity: 0;
    transform: scale(2.2);
    filter: blur(8px);
  }
  12% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
  80% {
    opacity: 1;
    transform: scale(1.02);
  }
  100% {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
}
.msg.big {
  font-size: clamp(40px, 7vw, 92px);
}
.msg.mid {
  font-size: clamp(22px, 3.4vw, 44px);
}
.msg.sub {
  font-size: 16px;
  letter-spacing: 0.45em;
  color: var(--or);
  text-shadow: 0 0 14px rgba(255, 176, 32, 0.8);
}
#count {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.cnt {
  font-family: Orbitron;
  font-weight: 900;
  font-size: clamp(90px, 18vw, 240px);
  font-style: italic;
  animation: cnt 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.4);
}
.cnt.go {
  color: #2bff88;
  text-shadow: 0 0 60px #2bff88;
}
.cnt.n {
  color: #fff;
  text-shadow: 0 0 50px var(--mg);
}
@keyframes cnt {
  0% {
    opacity: 0;
    transform: scale(3);
  }
  15% {
    opacity: 1;
    transform: scale(1);
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(0.6);
  }
}
#wrong {
  position: absolute;
  left: 50%;
  top: 16%;
  transform: translateX(-50%);
  font-family: Orbitron;
  font-weight: 900;
  font-size: 30px;
  letter-spacing: 0.2em;
  color: #ff3b3b;
  padding: 10px 26px;
  border: 2px solid #ff3b3b;
  background: rgba(80, 0, 0, 0.4);
  display: none;
  animation: blink 0.6s infinite;
}
#drift {
  position: absolute;
  left: 50%;
  top: 60%;
  transform: translateX(-50%);
  font-family: Orbitron;
  font-weight: 900;
  font-style: italic;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s;
}
#drift .d1 {
  font-size: 14px;
  letter-spacing: 0.5em;
  color: var(--or);
}
#drift .d2 {
  font-size: 40px;
  text-shadow: 0 0 20px rgba(255, 176, 32, 0.8);
}
.camhint {
  position: absolute;
  right: 28px;
  top: 110px;
  font-family: Orbitron;
  font-size: 11px;
  letter-spacing: 0.25em;
  opacity: 0;
  transition: opacity 0.4s;
}
#flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(circle, rgba(255, 80, 40, 0) 40%, rgba(255, 30, 30, 0.5));
  opacity: 0;
  transition: opacity 0.25s;
}
/* intro card */
#introCard {
  position: fixed;
  left: 6vw;
  bottom: 15vh;
  z-index: 45;
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}
body.cine #introCard {
  opacity: 1;
  transform: none;
}
#introCard .a {
  font-size: 14px;
  letter-spacing: 0.5em;
  color: var(--mg);
  font-weight: 700;
}
#introCard .b {
  font-family: Orbitron;
  font-weight: 900;
  font-style: italic;
  font-size: clamp(30px, 4.5vw, 60px);
  line-height: 1;
}
#introCard .c {
  font-size: 15px;
  letter-spacing: 0.3em;
  opacity: 0.7;
  margin-top: 6px;
}
#skip {
  position: fixed;
  right: 4vw;
  bottom: 13vh;
  z-index: 45;
  font-family: Orbitron;
  font-size: 11px;
  letter-spacing: 0.3em;
  opacity: 0;
  transition: opacity 0.6s;
}
body.cine #skip {
  opacity: 0.6;
}
/* RESULTS */
#results {
  z-index: 30;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(5, 6, 12, 0.3), rgba(5, 6, 12, 0.85));
}
.rbox {
  width: min(760px, 94vw);
  padding: 34px 40px;
}
.rhead {
  text-align: center;
  margin-bottom: 22px;
}
.rhead .k {
  font-family: Orbitron;
  letter-spacing: 0.6em;
  font-size: 14px;
  color: var(--mg);
  font-weight: 700;
}
.rhead .h {
  font-family: Orbitron;
  font-weight: 900;
  font-style: italic;
  font-size: clamp(40px, 6vw, 78px);
  line-height: 1.05;
  background: linear-gradient(180deg, #fff, #ffd27a 60%, #ff9a1f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 170, 40, 0.5));
}
.rhead .h.lose {
  background: linear-gradient(180deg, #fff, #ff8c8c 60%, #ff2e4f);
  -webkit-background-clip: text;
  background-clip: text;
}
.rhead .s {
  letter-spacing: 0.3em;
  opacity: 0.7;
  font-weight: 600;
  margin-top: 6px;
}
table.st {
  width: 100%;
  border-collapse: collapse;
  font-weight: 600;
  letter-spacing: 0.08em;
}
table.st th {
  font-family: Orbitron;
  font-size: 11px;
  letter-spacing: 0.25em;
  opacity: 0.5;
  text-align: left;
  padding: 8px 10px;
  font-weight: 700;
}
table.st td {
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 16px;
}
table.st tr {
  opacity: 0;
  animation: rowIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
table.st tr.me td {
  background: linear-gradient(90deg, rgba(255, 46, 136, 0.35), rgba(255, 46, 136, 0));
}
table.st td.pn {
  font-family: Orbitron;
  font-weight: 900;
  font-style: italic;
  font-size: 20px;
  width: 60px;
}
.medal1 {
  color: #ffd24a;
}
.medal2 {
  color: #dfe7ef;
}
.medal3 {
  color: #e39a5a;
}
.rstats {
  display: flex;
  gap: 12px;
  margin: 20px 0;
}
.rstats div {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--bd);
  background: rgba(255, 255, 255, 0.03);
}
.rstats small {
  display: block;
  font-size: 11px;
  letter-spacing: 0.3em;
  opacity: 0.55;
  font-weight: 700;
}
.rstats b {
  font-family: Orbitron;
  font-size: 20px;
}
.rbtns {
  display: flex;
  gap: 12px;
}
.rbtns .btn {
  flex: 1;
  justify-content: center;
}
.rbtns .btn:hover {
  transform: translateY(-3px);
}
/* PAUSE */
#pause .mbox {
  width: min(400px, 90vw);
}
/* touch */
#touch {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: none;
  pointer-events: none;
}
body.touch #touch.on {
  display: block;
}
.tb {
  position: absolute;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: grid;
  place-items: center;
  font-family: Orbitron;
  font-weight: 700;
  font-size: 13px;
  pointer-events: auto;
  backdrop-filter: blur(4px);
}
.tb.dn {
  background: rgba(34, 227, 255, 0.4);
}
@media (max-width: 820px) {
  .hBR {
    transform: scale(0.62);
    transform-origin: right bottom;
  }
  .bars {
    right: 200px;
    width: 150px;
    bottom: 14px;
  }
  .hBL {
    width: 130px;
    height: 130px;
  }
  .posbox .p {
    font-size: 48px;
  }
  .board {
    display: none;
  }
  .hTR .tm {
    font-size: 22px;
  }
}

.btn:focus-visible,
.arrow:focus-visible,
.seg b:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}
.mbox,
.rbox {
  max-height: 94vh;
  overflow: auto;
}
@media (max-width: 600px) {
  .logo .t1 {
    font-size: clamp(24px, 7.1vw, 42px);
  }
  .logo .t2 {
    letter-spacing: 0.4em;
    font-size: 12px;
  }
  .press {
    letter-spacing: 0.2em;
    font-size: 12px;
  }
  .foot {
    font-size: 10px;
    letter-spacing: 0.12em;
  }
  .menuL {
    width: 82vw;
    margin-left: 8vw;
  }
  .menuL .logo .t1 {
    font-size: 34px;
  }
  .menuL .logo .t2 {
    font-size: 11px;
  }
  .btn {
    font-size: 13px;
    letter-spacing: 0.12em;
    padding: 16px;
  }
  .gpanel {
    margin: 3vh 4vw;
    padding: 22px 18px;
    gap: 10px;
  }
  .carname {
    font-size: 27px;
  }
  .stat {
    grid-template-columns: 100px 1fr 28px;
    font-size: 12px;
  }
  .seg b {
    padding: 10px 8px;
    font-size: 10px;
    min-height: 38px;
  }
  .opt {
    font-size: 12px;
    letter-spacing: 0.08em;
  }
  .mbox {
    padding: 24px 18px;
  }
  .keys {
    grid-template-columns: 1fr;
    gap: 2px;
    font-size: 14px;
  }
  .ph {
    font-size: 20px;
    margin-bottom: 12px;
  }
  input[type="range"] {
    width: 125px;
  }
  .hTL {
    left: 16px;
    top: 16px;
  }
  .hTR {
    right: 16px;
    top: 16px;
  }
  .hTR .tm {
    font-size: 18px;
  }
  .hTR .sm {
    font-size: 10px;
  }
  .lapbox {
    font-size: 11px;
  }
  .lapbox b {
    font-size: 20px;
  }
  .posbox .p {
    font-size: 42px;
  }
  .posbox .ps {
    font-size: 18px;
  }
  .posbox .pt {
    font-size: 16px;
  }
  .hBL {
    left: 16px;
    bottom: 18px;
    width: 92px;
    height: 92px;
  }
  .hBR {
    right: 8px;
    bottom: 8px;
    transform: scale(0.5);
  }
  .bars {
    right: 160px;
    bottom: 26px;
    width: 100px;
    gap: 8px;
  }
  .mb .lb {
    font-size: 8px;
    letter-spacing: 0.1em;
  }
  .mb .tr {
    height: 7px;
  }
  .camhint {
    top: 90px;
    right: 16px;
    font-size: 9px;
  }
  #wrong {
    font-size: 16px;
    top: 24%;
    white-space: nowrap;
  }
  body.touch .bars {
    bottom: 15px;
  }
  body.touch .hBL {
    bottom: 110px;
    width: 76px;
    height: 76px;
  }
  .tb {
    width: 56px;
    height: 56px;
    font-size: 11px;
  }
  .tb[data-t="left"] {
    left: 16px !important;
    bottom: 48px !important;
  }
  .tb[data-t="right"] {
    left: 82px !important;
    bottom: 48px !important;
  }
  .tb[data-t="gas"] {
    right: 16px !important;
    bottom: 155px !important;
  }
  .tb[data-t="brake"] {
    right: 82px !important;
    bottom: 155px !important;
  }
  .tb[data-t="nitro"] {
    right: 16px !important;
    bottom: 222px !important;
  }
  .tb[data-t="hb"] {
    right: 82px !important;
    bottom: 222px !important;
  }
  .tb[data-t="pause"] {
    top: 105px !important;
    right: 16px !important;
    width: 40px !important;
    height: 40px !important;
  }
  .rbox {
    padding: 24px 14px;
  }
  .rhead .h {
    font-size: 38px;
  }
  .rhead .s {
    font-size: 11px;
    letter-spacing: 0.12em;
  }
  .rhead .k {
    font-size: 11px;
  }
  table.st th {
    font-size: 8px;
    letter-spacing: 0.04em;
    padding: 7px 4px;
  }
  table.st td {
    font-size: 12px;
    padding: 8px 4px;
  }
  table.st td.pn {
    font-size: 15px;
    width: 30px;
  }
  table.st td:nth-child(3),
  table.st th:nth-child(3) {
    display: none;
  }
  .rstats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 14px 0;
  }
  .rstats small {
    font-size: 9px;
  }
  .rstats b {
    font-size: 16px;
  }
  .rbtns {
    flex-direction: column;
    gap: 8px;
  }
  .rbtns .btn {
    padding: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .logo,
  .press,
  #speedlines,
  .cnt,
  .msg {
    animation: none !important;
  }
  * {
    transition-duration: 0.01s !important;
  }
}

/* ===== TITLE / FRONT SCREEN (logo icon removed, title higher + larger) ===== */
#title {
  display: block !important;
  background: linear-gradient(
    180deg,
    rgba(5, 6, 12, 0.7) 0%,
    rgba(5, 6, 12, 0.25) 22%,
    rgba(5, 6, 12, 0) 36%,
    rgba(5, 6, 12, 0) 72%,
    rgba(5, 6, 12, 0.75) 100%
  ) !important;
}
#title .lg {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(14% + env(safe-area-inset-top));
  display: flex;
  justify-content: center;
  padding: 0 10px;
}
#title .logo {
  gap: 6px;
  align-items: center;
  text-align: center;
}
#title .logo .t1 {
  font-size: clamp(30px, min(8.2vw, 11.5vh), 100px);
  white-space: nowrap;
  filter: drop-shadow(0 0 14px rgba(34, 227, 255, 0.35)) drop-shadow(0 3px 6px rgba(0, 0, 0, 0.8));
}
#title .logo .t2 {
  font-size: clamp(11px, min(2vw, 2.8vh), 20px);
  letter-spacing: 0.6em;
  padding-left: 0.6em;
  white-space: nowrap;
  text-shadow:
    0 0 10px rgba(0, 0, 0, 0.95),
    0 0 18px rgba(255, 46, 136, 0.5);
}
/* CLICK OR PRESS ENTER: just below the car */
#title .press {
  position: absolute !important;
  left: 50%;
  top: 67%;
  bottom: auto !important;
  transform: translateX(-50%);
  margin: 0 !important;
  width: max-content;
  max-width: 92vw;
  text-align: center;
  white-space: nowrap;
  padding: 7px 20px;
  border-radius: 999px;
  background: rgba(5, 6, 12, 0.45);
  text-shadow:
    0 0 12px rgba(0, 0, 0, 0.95),
    0 0 22px rgba(34, 227, 255, 0.55);
}
#title .press .tc {
  display: none;
}
/* credits: bottom of the screen */
#title .foot {
  position: absolute !important;
  left: 0;
  right: 0;
  bottom: calc(10px + env(safe-area-inset-bottom));
  top: auto !important;
  text-align: center;
  line-height: 1.5;
  padding: 0 12px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
}
/* touch devices */
@media (pointer: coarse) {
  #title .press .pc {
    display: none;
  }
  #title .press .tc {
    display: inline;
  }
}
/* tall / narrow phone (portrait) */
@media (max-aspect-ratio: 4/5) {
  #title .lg {
    top: calc(11% + env(safe-area-inset-top));
  }
  #title .logo .t1 {
    font-size: clamp(28px, 7.8vw, 64px);
  }
  #title .logo .t2 {
    letter-spacing: 0.42em;
    padding-left: 0.42em;
    font-size: clamp(10px, 2.9vw, 15px);
  }
  #title .press {
    top: 64%;
    letter-spacing: 0.3em;
    padding: 6px 14px;
  }
  #title .foot {
    font-size: 9px;
    letter-spacing: 0.08em;
  }
}
/* landscape phone (low height) */
@media (max-height: 520px) {
  #title .lg {
    top: calc(8% + env(safe-area-inset-top));
  }
  #title .logo .t1 {
    font-size: clamp(24px, 10.5vh, 48px);
  }
  #title .logo .t2 {
    font-size: clamp(9px, 2.6vh, 13px);
  }
  #title .press {
    padding: 4px 14px;
  }
  #title .foot {
    display: none;
  }
}
