:root {
  --orange: #eb870d;
  --purple: #3e1277;
  --ink: #06070b;
  --panel: rgba(10, 12, 18, 0.86);
  --line: rgba(255, 255, 255, 0.15);
  --text: #f6f3ef;
  --muted: #b8b4c2;
  --cyan: #59d5d8;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overscroll-behavior: none;
}

button,
input,
select {
  font: inherit;
}

#app,
#gameCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#gameCanvas {
  display: block;
  background: #090b11;
  touch-action: none;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 3vw, 36px);
  isolation: isolate;
}

.screen.is-active {
  display: flex;
  animation: screenFadeIn 520ms ease both;
}

.screen-bg,
.cinematic-bg,
.menu-slideshow,
.garage-screen::after,
.level-screen::after {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
}

@keyframes screenFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cinematic-bg {
  z-index: 0;
  opacity: 0;
  filter: saturate(1.08) contrast(1.04) brightness(0.72);
  transform: scale(1.04);
  transition: opacity 520ms ease, transform 1800ms ease;
}

.loading-screen.is-cinematic .loading-poster,
.transition-screen.is-active .transition-poster {
  opacity: 1;
  transform: scale(1);
}

.loading-screen .loading-poster,
.loading-screen:not(.is-cinematic) .loading-poster span {
  opacity: 0;
}

.loading-screen:not(.is-cinematic) .loading-poster::after {
  opacity: 0;
}

.loading-screen.is-cinematic .brand-logo {
  opacity: 0;
  transform: translateY(-12px) scale(0.96);
}

.loading-poster,
.transition-poster {
  background-image: url("../assets/ui/Slide1.png");
}

.menu-slideshow,
.cinematic-slideshow {
  z-index: 0;
  overflow: hidden;
  opacity: 1;
  background: #05060a url("../assets/ui/Slide1.png") center / cover no-repeat;
}

.menu-slideshow {
  position: absolute;
  inset: 0;
  display: block;
}

.cinematic-slideshow {
  background-image: url("../assets/ui/Slide1.png");
}

.menu-slideshow span,
.cinematic-slideshow span {
  display: block;
  position: absolute;
  inset: 0;
  background-image: var(--slide-image);
  background-position: center;
  background-size: cover;
  opacity: 0;
  filter: saturate(1.2) contrast(1.12) brightness(0.74);
  transform: scale(1.07);
  transition: opacity 900ms ease, transform 2200ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.menu-slideshow::after,
.cinematic-slideshow::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.1), transparent 36%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0.08) 44%, rgba(0, 0, 0, 0.3)),
    linear-gradient(180deg, rgba(2, 3, 8, 0.08), rgba(2, 3, 8, 0.28));
  pointer-events: none;
}

.menu-slideshow span.is-active,
.cinematic-slideshow span.is-active {
  opacity: 1;
  transform: scale(1.018);
}

.garage-screen::after {
  content: "";
  z-index: 0;
  background-image: url("../assets/ui/BG_garage.jpg");
  filter: saturate(1.05) contrast(1.08) brightness(0.54);
  transform: scale(1.03);
}

.garage-screen.is-active {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
  background: #07080b;
}

.garage-screen::after,
.garage-screen::before {
  display: none;
}

.garage-screen > .garage-stage {
  position: absolute !important;
  z-index: 1;
  inset: 0 410px 0 0;
  overflow: hidden;
  background: #07080b;
  transition: right 260ms ease, height 260ms ease;
}

.garage-screen > .garage-stage::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: url("../assets/ui/BG_garage.jpg") center / cover no-repeat;
  opacity: 0.2;
  mix-blend-mode: screen;
  mask-image: radial-gradient(circle at 52% 54%, transparent 18%, rgba(0, 0, 0, 0.32) 52%, #000 100%);
  pointer-events: none;
}

#garageCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.garage-vehicle-loader {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: rgba(5, 6, 9, 0.62);
  backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
  pointer-events: none;
}

.garage-vehicle-loader.is-active {
  opacity: 1;
  visibility: visible;
}

.garage-vehicle-loader strong {
  color: #fff;
  font-size: 0.88rem;
  text-transform: uppercase;
}

.garage-loader-track {
  width: min(230px, 46vw);
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.16);
}

.garage-loader-track span {
  display: block;
  width: var(--garage-load, 8%);
  height: 100%;
  background: #f28a12;
  transition: width 120ms linear;
}

#gameCanvas.quality-high {
  filter: saturate(1.04) contrast(1.02);
}

#gameCanvas.quality-ultra {
  filter: saturate(1.1) contrast(1.04) brightness(1.02);
}

.garage-brand-hud {
  position: absolute;
  z-index: 2;
  top: max(22px, env(safe-area-inset-top));
  left: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(560px, calc(100% - 48px));
  padding: 10px 18px 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-left: 3px solid #f28a12;
  background: rgba(5, 6, 9, 0.68);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.34);
  pointer-events: none;
  transition: max-width 220ms ease, padding 220ms ease;
}

.garage-brand-hud img {
  width: 64px;
  height: 58px;
  object-fit: contain;
}

.garage-brand-hud div {
  min-width: 0;
}

.garage-brand-hud span,
.garage-brand-hud strong,
.garage-brand-hud small {
  display: block;
}

.garage-brand-hud span {
  color: #f28a12;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.garage-brand-hud strong {
  margin: 2px 0 4px;
  overflow: hidden;
  color: #fff;
  font-size: clamp(1rem, 1.7vw, 1.45rem);
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.garage-brand-hud small {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 12px;
  color: #d9d6df;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.garage-brand-hud small b {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.garage-brand-hud small i {
  color: #f28a12;
  font-style: normal;
}

#garageHudToggle {
  align-self: stretch;
  width: 34px;
  min-height: 34px;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  pointer-events: auto;
}

.garage-brand-hud.is-collapsed {
  padding: 4px;
  border-left-width: 1px;
}

.garage-brand-hud.is-collapsed > img,
.garage-brand-hud.is-collapsed > .garage-brand-copy {
  display: none;
}

.garage-brand-hud.is-collapsed #garageHudToggle {
  border-left: 0;
}

.garage-focus-points {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 22px;
  display: flex;
  gap: 6px;
  transform: translateX(-50%);
}

.garage-focus-points button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  color: #fff;
  background: rgba(5, 6, 9, 0.74);
  backdrop-filter: blur(10px);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.garage-focus-points button:hover,
.garage-focus-points button:focus-visible {
  border-color: #f28a12;
  background: rgba(242, 138, 18, 0.82);
}

.garage-orbit-hint {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(242, 138, 18, 0.6);
  border-radius: 50%;
  color: #fff;
  background: rgba(5, 6, 9, 0.64);
  box-shadow: 0 0 26px rgba(242, 138, 18, 0.22);
  font-size: 0.72rem;
  font-weight: 900;
  pointer-events: none;
}

.garage-screen > .garage-panel {
  position: absolute !important;
  z-index: 2;
  inset: 0 0 0 auto;
  width: 410px;
  max-height: none;
  border-radius: 0;
  padding: 24px;
  background: rgba(8, 9, 13, 0.92);
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(16px);
  transition: transform 260ms ease;
}

.garage-vehicle-toggle {
  position: absolute !important;
  z-index: 4 !important;
  top: 50%;
  right: 410px;
  width: 34px;
  height: 64px;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  color: #fff;
  background: rgba(7, 8, 12, 0.84);
  font-size: 1.55rem;
  cursor: pointer;
  transition: right 260ms ease;
}

.garage-screen.vehicle-panel-hidden > .garage-stage {
  right: 0;
}

.garage-screen.vehicle-panel-hidden > .garage-panel {
  transform: translateX(100%);
}

.garage-screen.vehicle-panel-hidden > .garage-vehicle-toggle {
  right: 0;
}

.garage-panel .garage-grid {
  grid-template-columns: 1fr;
  gap: 9px;
}

.garage-panel .car-card {
  display: grid;
  grid-template-columns: 106px 1fr;
  column-gap: 12px;
  padding: 9px;
}

.garage-panel .car-preview {
  grid-row: 1 / span 4;
  min-height: 88px;
  margin: 0;
}

.garage-panel .car-preview img {
  width: 142%;
}

.garage-panel .car-card h3 {
  margin: 2px 0 0;
  font-size: 0.9rem;
}

.garage-panel .car-meta {
  margin: 2px 0 5px;
  font-size: 0.66rem;
}

.garage-panel .car-specs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  gap: 3px;
}

.garage-panel .car-specs span {
  padding: 4px;
  font-size: 0.62rem;
}

.garage-panel .stats {
  display: none;
}

.level-screen::after {
  content: "";
  z-index: 0;
  background-image: url("../assets/ui/BG_nivel.jpg");
  filter: saturate(1.02) contrast(1.05) brightness(0.5);
  transform: scale(1.03);
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(235, 135, 13, 0.12), transparent 32%, rgba(62, 18, 119, 0.18)),
    radial-gradient(circle at 50% 115%, rgba(89, 213, 216, 0.14), transparent 38%),
    rgba(0, 0, 0, 0.18);
}

.screen > :not(.cinematic-bg):not(.menu-slideshow) {
  position: relative;
  z-index: 1;
}

.loading-screen {
  flex-direction: column;
  gap: 28px;
  background: #000;
}

.loading-screen:not(.is-cinematic) .brand-logo {
  width: min(310px, 64vw);
}

.loading-screen:not(.is-cinematic) .loading-card {
  display: none;
}

.loading-screen.is-cinematic .loading-card {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.loading-screen .loading-card {
  transition: opacity 420ms ease, transform 420ms ease;
}

.transition-screen {
  z-index: 20;
  background: #05060a;
}

.transition-load {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  width: min(720px, 88vw);
  justify-items: center;
  padding: 22px;
  transform: translateY(12vh);
}

.transition-load .progress-track {
  width: 100%;
  height: 18px;
  border: 1px solid rgba(235, 135, 13, 0.28);
  background: rgba(0, 0, 0, 0.42);
  box-shadow: 0 0 26px rgba(235, 135, 13, 0.18);
}

.transition-load .loading-label {
  margin: -6px 0 0;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
  text-shadow: 0 3px 14px #000;
}

.brand-logo {
  width: min(220px, 52vw);
  max-height: 210px;
  object-fit: contain;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.55));
}

.brand-logo.large {
  width: min(178px, 42vw);
}

.loading-tire-icon {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border: 1px solid rgba(235, 135, 13, 0.34);
  border-radius: 50%;
  color: var(--orange);
  background:
    radial-gradient(circle at 50% 50%, rgba(235, 135, 13, 0.18), rgba(4, 5, 9, 0.16) 58%, rgba(4, 5, 9, 0.62)),
    rgba(4, 5, 9, 0.44);
  box-shadow: 0 0 28px rgba(235, 135, 13, 0.24), inset 0 0 22px rgba(235, 135, 13, 0.12);
  animation: tireSpin 1.25s linear infinite;
}

.loading-tire-icon.compact {
  width: 74px;
  height: 74px;
  margin: 0;
}

.loading-tire-icon svg {
  width: 52px;
  height: 52px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 12px rgba(235, 135, 13, 0.68));
}

@keyframes tireSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loading-card,
.panel,
.menu-shell {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.loading-card {
  width: min(560px, 86vw);
  padding: 0;
  border: 0;
  border-radius: 0;
  text-align: center;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.loading-card img {
  width: 100%;
  border-radius: 6px;
  object-fit: cover;
}

.loading-card p {
  margin: 16px 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.progress-track {
  position: relative;
  height: 14px;
  overflow: visible;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--orange);
  transition: width 180ms ease;
}

.loading-progress {
  height: 18px;
  margin-top: 30px;
  border: 1px solid rgba(235, 135, 13, 0.32);
  background: rgba(0, 0, 0, 0.46);
  box-shadow: 0 0 24px rgba(235, 135, 13, 0.16);
}

.loading-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #b94f06, #eb870d 46%, #ffb340),
    var(--orange);
  box-shadow: 0 0 18px rgba(235, 135, 13, 0.5);
}

.loading-progress b {
  position: absolute;
  right: 0;
  bottom: calc(100% + 7px);
  display: block;
  min-width: 54px;
  padding: 2px 8px;
  border: 1px solid rgba(235, 135, 13, 0.36);
  border-radius: 999px;
  background: rgba(5, 6, 10, 0.82);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1.35;
  text-shadow: 0 2px 8px #000;
  text-align: center;
  letter-spacing: 0;
}

.menu-shell {
  width: min(330px, 88vw);
  padding: clamp(16px, 3vw, 24px);
  border-radius: 8px;
  text-align: center;
  background: rgba(8, 9, 14, 0.38);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58), inset 0 0 0 1px rgba(235, 135, 13, 0.1);
}

.powered-by {
  position: fixed !important;
  z-index: 2 !important;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: none;
  transition: color 160ms ease, opacity 160ms ease;
}

.powered-by:hover {
  color: rgba(255, 255, 255, 0.76);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(1.35rem, 3.3vw, 2.45rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1.08;
}

h3 {
  margin-bottom: 14px;
  font-size: 1.08rem;
}

.menu-shell p {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}

.menu-actions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.btn {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 0 18px;
  color: #fff;
  background: var(--purple);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  text-transform: uppercase;
  transition: transform 140ms ease, filter 140ms ease, background 140ms ease;
}

.btn:hover,
.car-card:hover,
.level-tile:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn.primary {
  background: var(--orange);
}

.btn.quiet {
  background: rgba(255, 255, 255, 0.08);
}

.btn.stock {
  background: #111923;
  border-color: rgba(89, 213, 216, 0.34);
}

.btn.block {
  width: 100%;
}

.panel {
  width: min(520px, 94vw);
  max-height: min(86vh, 820px);
  overflow: auto;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 8px;
}

.panel.wide {
  width: min(980px, 96vw);
}

.garage-screen .panel,
.level-screen .panel {
  background: rgba(7, 8, 12, 0.52);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 28px 86px rgba(0, 0, 0, 0.56), inset 0 0 0 1px rgba(235, 135, 13, 0.08);
}

.garage-screen .car-card,
.level-screen .level-tile {
  background: rgba(9, 10, 16, 0.6);
  backdrop-filter: blur(10px);
}

.level-screen .level-tile {
  min-height: 92px;
}

.panel.small {
  width: min(360px, 92vw);
}

.panel-header {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.panel-header span {
  display: block;
  color: var(--orange);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.panel-header h2 {
  margin: 0;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.garage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.paint-selector {
  display: flex;
  gap: 10px;
  margin: 0 0 16px;
}

.paint-selector button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 0 14px;
  color: #fff;
  background: rgba(5, 6, 10, 0.68);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.paint-selector button span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paint);
  box-shadow: 0 0 18px color-mix(in srgb, var(--paint) 72%, transparent);
}

.paint-selector button.paint-original span {
  background: conic-gradient(#d7d9dc, #282a30, #ad1724, #24568d, #d7d9dc);
}

.paint-selector button.is-selected {
  border-color: var(--orange);
  box-shadow: inset 0 0 0 1px rgba(235, 135, 13, 0.45);
}

.car-card,
.level-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, filter 140ms ease;
}

.car-card {
  position: relative;
  padding: 16px;
}

.car-card.is-locked {
  opacity: 0.62;
  filter: grayscale(0.95);
  cursor: default;
}

.car-card.is-selected,
.level-tile.is-selected {
  border-color: var(--orange);
  box-shadow: inset 0 0 0 1px rgba(235, 135, 13, 0.45);
}

.car-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 168px;
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--car-color) 22%, transparent), transparent 56%),
    radial-gradient(circle at 50% 112%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 46%),
    rgba(0, 0, 0, 0.42);
}

.car-preview::after {
  content: "";
  position: absolute;
  inset: auto 14px 14px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}

.car-preview img {
  width: 112%;
  max-width: none;
  aspect-ratio: 2.22;
  object-fit: cover;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.5));
}

.car-preview span {
  position: relative;
  z-index: 1;
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
}

.car-preview b {
  position: absolute;
  inset: auto 10px 10px;
  z-index: 2;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.car-meta {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.car-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: -4px 0 14px;
}

.car-specs span {
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stats {
  display: grid;
  gap: 10px;
}

.stats label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stats span {
  height: 7px;
  border-radius: 999px;
  background: var(--cyan);
}

.ranking-list {
  display: grid;
  gap: 10px;
  padding-left: 24px;
}

.ranking-list li {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  accent-color: var(--orange);
}

.quality-note {
  margin: -8px 0 16px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.level-tile {
  padding: 14px;
  color: var(--text);
  text-align: left;
}

.level-tile strong,
.level-tile span {
  display: block;
}

.level-tile span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.82rem;
}

.level-tile.is-locked {
  opacity: 0.42;
  cursor: default;
}

.overlay-panel {
  background: rgba(0, 0, 0, 0.32);
}

.result-panel {
  text-align: center;
}

.result-art {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 12px;
}

.badge {
  width: 116px;
  height: 90px;
  object-fit: contain;
  margin-top: -52px;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.5));
}

.stars {
  min-height: 34px;
  margin-bottom: 16px;
  color: #ffc857;
  font-size: 2rem;
  letter-spacing: 0;
}

.stars span {
  display: inline-block;
  margin: 0 5px;
  color: rgba(255, 255, 255, 0.18);
  filter: none;
  transform: scale(0.9);
}

.stars span.is-earned {
  color: #ffc857;
  filter: drop-shadow(0 0 10px rgba(255, 168, 36, 0.72));
  transform: scale(1);
}

.hud {
  position: fixed;
  z-index: 6;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: none;
  grid-template-columns: 58px repeat(6, auto);
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 24px);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(4, 5, 9, 0.74);
  backdrop-filter: blur(14px);
}

.hud.is-active {
  display: grid;
}

.hud img {
  width: 52px;
  height: 42px;
  object-fit: contain;
}

.hud div {
  min-width: 74px;
}

.hud span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hud strong {
  font-size: 1rem;
}

.hud meter {
  width: 82px;
  height: 12px;
  accent-color: var(--orange);
}

.wrong-way {
  position: fixed;
  z-index: 7;
  top: 96px;
  left: 50%;
  display: none;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  padding: 8px 14px;
  border: 1px solid rgba(255, 99, 53, 0.7);
  border-radius: 6px;
  color: #fff;
  background: rgba(142, 20, 12, 0.82);
  box-shadow: 0 0 24px rgba(255, 62, 31, 0.32);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  pointer-events: none;
}

.wrong-way.is-active {
  display: flex;
  animation: wrongWayPulse 820ms ease-in-out infinite alternate;
}

.wrong-way b {
  font-size: 1.35rem;
}

@keyframes wrongWayPulse {
  to { transform: translateX(-50%) scale(1.04); filter: brightness(1.16); }
}

.speedometer {
  position: fixed;
  z-index: 6;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: none;
  width: min(330px, 27vw);
  aspect-ratio: 1.32;
  pointer-events: none;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.72));
  opacity: 0.98;
  overflow: visible;
}

.speedometer.is-active {
  display: block;
}

.speedometer-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-mask-image: radial-gradient(ellipse 48% 58% at 50% 56%, #000 64%, rgba(0, 0, 0, 0.72) 69%, transparent 74%);
  mask-image: radial-gradient(ellipse 48% 58% at 50% 56%, #000 64%, rgba(0, 0, 0, 0.72) 69%, transparent 74%);
  filter: saturate(1.12) contrast(1.08);
}

.speedometer-readout {
  position: absolute;
  left: 50%;
  bottom: 24%;
  width: 39%;
  height: 19%;
  transform: translateX(-50%);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(3, 4, 10, 0.96), rgba(15, 7, 24, 0.96)),
    radial-gradient(circle at 50% 0%, rgba(235, 135, 13, 0.18), transparent 72%);
  border: 1px solid rgba(235, 135, 13, 0.28);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.9), 0 0 12px rgba(235, 135, 13, 0.22);
}

.speedometer i {
  position: absolute;
  left: 50%;
  top: 51%;
  width: 31%;
  height: 4px;
  transform-origin: 0 50%;
  transform: rotate(90deg);
  border-radius: 999px;
  background: linear-gradient(90deg, #fff3c8, #ff8a00 58%, rgba(255, 138, 0, 0));
  box-shadow: 0 0 calc(9px + var(--speed-glow, 0) * 24px) #ff8a00;
  transition: transform 90ms linear;
}

.speedometer strong,
.speedometer span {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  text-shadow: 0 3px 10px #000;
}

.speedometer strong {
  bottom: 29%;
  font-size: clamp(1.55rem, 3vw, 3.3rem);
  line-height: 1;
  font-style: italic;
  letter-spacing: 0;
}

.speedometer span {
  bottom: 23%;
  font-size: 0.78rem;
  font-weight: 900;
}

.mobile-controls {
  position: fixed;
  z-index: 7;
  left: 0;
  right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: none;
  grid-template-columns: 60px 60px 1fr 1fr 1fr 76px;
  gap: 10px;
  padding: 0 14px;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-controls.is-active {
  display: grid;
}

.mobile-controls button {
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  background: rgba(9, 10, 15, 0.75);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  font-weight: 900;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-controls button[data-control="accelerate"],
.mobile-controls button[data-control="turbo"] {
  background: rgba(235, 135, 13, 0.82);
}

.mobile-controls button[data-control="handbrake"] {
  background: rgba(78, 27, 139, 0.82);
}

#headlightButton.is-on {
  border-color: #f6d56f;
  background: rgba(246, 213, 111, 0.2);
  box-shadow: 0 0 20px rgba(246, 213, 111, 0.34);
}

.camera-controls {
  position: fixed;
  z-index: 8;
  right: max(16px, env(safe-area-inset-right));
  top: 104px;
  display: none;
  gap: 8px;
}

.camera-controls.is-active {
  display: flex;
}

.camera-controls button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  color: #fff;
  background: rgba(7, 8, 12, 0.66);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.camera-controls button:first-child {
  width: 70px;
  grid-template-columns: 20px 1fr;
}

.camera-controls button span {
  color: #f28a12;
  font-size: 1.25rem;
}

.camera-controls button b {
  font-size: 0.7rem;
  letter-spacing: 0;
}

@media (max-width: 760px) {
  .screen {
    align-items: stretch;
    padding: 14px;
  }

  .menu-screen {
    align-items: center;
  }

  .panel,
  .panel.wide {
    width: 100%;
    max-height: calc(100vh - 28px);
  }

  .garage-screen > .garage-stage {
    inset: 0 0 auto;
    height: 48vh;
  }

  .garage-brand-hud {
    top: max(8px, env(safe-area-inset-top));
    left: 8px;
    max-width: calc(100% - 16px);
    padding: 6px 10px 6px 6px;
  }

  .garage-brand-hud img {
    width: 45px;
    height: 42px;
  }

  .garage-brand-hud strong {
    max-width: 240px;
    font-size: 0.86rem;
  }

  .showroom-specs b:nth-child(n + 4) {
    display: none;
  }

  .garage-focus-points {
    bottom: 8px;
    width: calc(100% - 16px);
    justify-content: center;
  }

  .garage-focus-points button {
    min-width: 0;
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.6rem;
  }

  .garage-screen > .garage-panel {
    inset: 45vh 0 0;
    width: 100%;
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-left: 0;
  }

  .garage-vehicle-toggle {
    top: 45vh;
    right: 8px;
    width: 52px;
    height: 30px;
    transform: translateY(-100%) rotate(90deg);
    transform-origin: right bottom;
  }

  .garage-screen.vehicle-panel-hidden > .garage-stage {
    height: 100vh;
  }

  .garage-screen.vehicle-panel-hidden > .garage-panel {
    transform: translateY(100%);
  }

  .garage-screen.vehicle-panel-hidden > .garage-vehicle-toggle {
    top: auto;
    right: 8px;
    bottom: 8px;
    transform: rotate(90deg);
  }

  .garage-panel .panel-header {
    margin-bottom: 9px;
  }

  .garage-panel .garage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .garage-panel .car-card {
    display: block;
  }

  .garage-panel .car-preview {
    min-height: 74px;
    margin-bottom: 6px;
  }

  .garage-panel .car-meta,
  .garage-panel .car-specs {
    display: none;
  }

  .hud {
    top: max(8px, env(safe-area-inset-top));
    grid-template-columns: 42px repeat(3, minmax(58px, 1fr));
    gap: 7px;
    padding: 6px;
  }

  .hud div:nth-of-type(4),
  .hud div:nth-of-type(6) {
    display: none;
  }

  .hud img {
    width: 38px;
    height: 34px;
  }

  .hud div {
    min-width: 0;
  }

  .hud strong {
    font-size: 0.82rem;
  }

  .hud meter {
    width: 58px;
  }

  .wrong-way {
    top: 68px;
  }

  .speedometer {
    width: min(210px, 44vw);
    right: 8px;
    bottom: 86px;
    opacity: 0.9;
  }

  .camera-controls {
    top: 76px;
    right: max(8px, env(safe-area-inset-right));
  }

  .camera-controls button {
    width: 46px;
    height: 46px;
  }

  .mobile-controls {
    grid-template-columns: 48px 48px repeat(3, minmax(0, 1fr)) 62px;
    gap: 6px;
    padding: 0 8px;
  }

  .mobile-controls button {
    min-height: 54px;
    font-size: 0.72rem;
  }
}

@media (max-width: 820px), (pointer: coarse) {
  .loading-poster,
  .transition-poster,
  .menu-slideshow {
    background-image: url("../assets/ui/mobile/Slide1.png");
    background-position: center center;
  }

  .level-screen::after {
    background-image: url("../assets/ui/mobile/BG_nivel.jpg");
    background-position: center center;
  }

  .garage-screen::after {
    background-image: url("../assets/ui/mobile/BG_garage.jpg");
    background-position: center center;
  }
}
