/* The Garage and Upgrades screens: HTML laid over the 3D showroom (js/ui/garage.js builds it, js/render3d/showroom.js draws what is behind it).
   Everything is sized in --u, one "unit" that scales with the window (about 8 px at 1280x720, 12 px at 1920x1080, 8.6 px on a 390 px wide phone), so the
   same layout works at every size. The block between the top bar and the panel (.gx-zone) is where the 3D car is drawn: nothing is ever put over it. */
.gx { position: absolute; inset: 0; container-type: size; line-height: 1.25; color: #f3f6fb; pointer-events: none; opacity: 0; transition: opacity 0.35s;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; --team: #ffb21a; --team-rgb: 255, 178, 26; }
.gx[hidden] { display: none; }
.gx.in { opacity: 1; }
.gx * { box-sizing: border-box; }
.gx-in { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden;
  --u: max(6px, min(0.62vw, 1.1vh)); /* (a browser without container units sizes it from the window instead) */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
@supports (container-type: size) { .gx-in { --u: max(6px, min(0.62cqw, 1.1cqh)); } }
@container (max-aspect-ratio: 9/10) { .gx-in { --u: max(6px, 2.2cqw); } }

/* ---- top bar ---- */
.gx-top { display: flex; justify-content: space-between; align-items: center; padding: calc(var(--u) * 1.8) calc(var(--u) * 2.6) 0; flex: none; }
.gx-title { display: flex; align-items: baseline; gap: calc(var(--u) * 1.4); font-size: calc(var(--u) * 3.4); font-weight: 900; font-style: italic; letter-spacing: 0.08em; text-transform: uppercase; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.gx-title::before { content: ""; align-self: stretch; width: calc(var(--u) * 0.55); margin: calc(var(--u) * 0.3) 0; border-radius: 2px; background: var(--team); box-shadow: 0 0 calc(var(--u) * 1.4) rgba(var(--team-rgb), 0.9); transform: skewX(-14deg); }
.gx-title small { font-size: calc(var(--u) * 1.5); font-weight: 600; font-style: normal; letter-spacing: 0.12em; color: rgba(255, 255, 255, 0.6); }
.gx-coins { display: flex; align-items: center; gap: calc(var(--u) * 1); padding: calc(var(--u) * 0.7) calc(var(--u) * 1.8) calc(var(--u) * 0.7) calc(var(--u) * 0.8); border-radius: 99px; font-size: calc(var(--u) * 2.5); font-weight: 800; font-variant-numeric: tabular-nums; background: rgba(10, 12, 20, 0.5); border: 1px solid rgba(255, 255, 255, 0.14); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.gx-coins svg { width: calc(var(--u) * 3.2); height: calc(var(--u) * 3.2); flex: none; }
.gx-coins.pop { animation: gxPop 0.5s; }

/* ---- the free area: the 3D car lives here; drag in it to turn the car ---- */
.gx-zone { flex: 1 1 0; min-height: 0; }
/* the one-time tip (js/ui/hints.js): a small glass bubble under the top bar. It sits in the column's flow (the zone gives up the room it takes),
   so it never covers the car or a button; collapsed it takes no room at all. */
.gx-tip { align-self: center; display: flex; align-items: center; gap: calc(var(--u) * 1); max-width: 92%; max-height: 0; margin-top: 0; opacity: 0; overflow: hidden;
  padding: 0 calc(var(--u) * 1.6) 0 calc(var(--u) * 0.8); border-radius: 99px; font-size: calc(var(--u) * 1.8); font-weight: 700; flex: none;
  background: linear-gradient(180deg, rgba(24, 28, 42, 0.78), rgba(9, 11, 18, 0.86)); border: 1px solid rgba(255, 178, 26, 0.55);
  transition: max-height 0.25s, margin-top 0.25s, opacity 0.25s, padding 0.25s; }
.gx-tip b { font-size: calc(var(--u) * 1.2); font-weight: 900; color: #1a1006; background: #ffb21a; border-radius: 99px; padding: calc(var(--u) * 0.2) calc(var(--u) * 0.8); flex: none; }
.gx-tip.on { max-height: calc(var(--u) * 6); margin-top: calc(var(--u) * 1.2); opacity: 1; padding-top: calc(var(--u) * 0.7); padding-bottom: calc(var(--u) * 0.7); }

/* ---- the panel ---- */
.gx-dock { flex: none; margin: 0 calc(var(--u) * 2.4) calc(var(--u) * 2.2); pointer-events: auto; position: relative; }
.gx-panel { position: relative; border-radius: calc(var(--u) * 2); padding: calc(var(--u) * 2.2); border: 1px solid rgba(255, 255, 255, 0.14); border-top-color: rgba(var(--team-rgb), 0.75);
  background: linear-gradient(180deg, rgba(24, 28, 42, 0.62), rgba(9, 11, 18, 0.74)); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
  box-shadow: 0 calc(var(--u) * 1.2) calc(var(--u) * 4) rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 calc(var(--u) * 6) rgba(var(--team-rgb), 0.14); }
.gx-page { display: none; animation: gxPageIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; } /* (Garage <-> Upgrades: the page that appears slides and fades in) */
@keyframes gxPageIn { from { opacity: 0; transform: translateY(calc(var(--u) * 1.6)); } to { opacity: 1; transform: none; } }
.gx[data-page="garage"] .gx-p-garage { display: grid; }
.gx[data-page="upgrades"] .gx-p-upgrades { display: grid; }
.gx-p-garage { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr); gap: calc(var(--u) * 2.6); align-items: stretch; }
.gx-p-garage > section { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.gx-p-garage > section + section { border-left: 1px solid rgba(255, 255, 255, 0.1); padding-left: calc(var(--u) * 2.6); }

/* info */
.gx-eyebrow { display: flex; align-items: center; gap: calc(var(--u) * 1); font-size: calc(var(--u) * 1.3); font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); }
.gx-badge { padding: calc(var(--u) * 0.35) calc(var(--u) * 1); border-radius: 99px; color: #08100a; background: #7cfc9a; }
.gx-badge.owned { background: rgba(255, 255, 255, 0.85); }
.gx-badge.locked { background: rgba(255, 255, 255, 0.14); color: #fff; }
.gx-name { margin: calc(var(--u) * 0.3) 0 calc(var(--u) * 0.2); white-space: nowrap; font-size: calc(var(--u) * 5.2); line-height: 1.05; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: 0.015em; text-shadow: 0 0 calc(var(--u) * 3) rgba(var(--team-rgb), 0.45); }
.gx-tag { margin: 0; font-size: calc(var(--u) * 1.75); color: rgba(255, 255, 255, 0.78); }
.gx-liv { display: flex; align-items: center; gap: calc(var(--u) * 0.9); margin-top: calc(var(--u) * 1.5); font-size: calc(var(--u) * 1.3); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); }
.gx-liv i { width: calc(var(--u) * 2.6); height: calc(var(--u) * 2.6); border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.5); }
.gx-swap { animation: gxIn 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

/* stats */
.gx-sh { margin: 0 0 calc(var(--u) * 1.1); font-size: calc(var(--u) * 1.3); font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); }
.gx-stat { display: grid; grid-template-columns: minmax(0, 8.2em) minmax(0, 1fr) minmax(0, 7.4em); align-items: center; gap: calc(var(--u) * 1.1); font-size: calc(var(--u) * 1.5); margin-bottom: calc(var(--u) * 1); }
.gx-stat > span { font-weight: 700; color: rgba(255, 255, 255, 0.9); white-space: nowrap; }
.gx-stat > em { font-style: normal; font-size: 0.92em; text-align: right; color: rgba(255, 255, 255, 0.6); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gx-stat > span em { display: none; }
.gx-bar { position: relative; height: calc(var(--u) * 1); border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.gx-bar b { position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.85)); }
.gx-bar b + b { background: linear-gradient(90deg, var(--team), #fff); box-shadow: 0 0 calc(var(--u) * 1.2) rgba(var(--team-rgb), 0.9); border-radius: 0 99px 99px 0; }

/* actions */
.gx-browse { display: flex; align-items: center; justify-content: space-between; gap: calc(var(--u) * 1.2); margin-bottom: calc(var(--u) * 1.4); }
.gx-arrow { width: calc(var(--u) * 5.2); height: calc(var(--u) * 5.2); flex: none; padding: 0; border-radius: 50%; font-size: calc(var(--u) * 3); line-height: 1; color: #fff; cursor: pointer; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.22); transition: background 0.15s, transform 0.1s, border-color 0.15s; }
.gx-arrow:hover { background: rgba(var(--team-rgb), 0.3); border-color: rgba(var(--team-rgb), 0.9); }
.gx-arrow:active { transform: scale(0.92); }
.gx-count { text-align: center; font-variant-numeric: tabular-nums; }
.gx-count b { font-size: calc(var(--u) * 3); font-weight: 900; }
.gx-count span { font-size: calc(var(--u) * 2); font-weight: 600; color: rgba(255, 255, 255, 0.6); }
.gx-dots { display: flex; justify-content: center; gap: calc(var(--u) * 0.5); margin-top: calc(var(--u) * 0.5); }
.gx-dots i { width: calc(var(--u) * 0.8); height: calc(var(--u) * 0.8); border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.5); transition: all 0.2s; }
.gx-dots i.own { background: rgba(255, 255, 255, 0.55); }
.gx-dots i.cur { background: var(--team); border-color: var(--team); transform: scale(1.5); box-shadow: 0 0 calc(var(--u) * 1) var(--team); }

.gx button { font-family: inherit; }
.gx-btn { display: flex; align-items: center; justify-content: center; gap: calc(var(--u) * 0.9); width: 100%; cursor: pointer; color: #fff; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.08); border-radius: calc(var(--u) * 1.4);
  transition: transform 0.1s, background 0.15s, border-color 0.15s, box-shadow 0.15s; outline: none; }
.gx-btn:hover, .gx-btn.sel { border-color: rgba(255, 255, 255, 0.85); background: rgba(255, 255, 255, 0.16); }
.gx-btn:active { transform: scale(0.98); }
.gx-btn.sel { box-shadow: 0 0 0 2px rgba(var(--team-rgb), 0.9), 0 0 calc(var(--u) * 2.4) rgba(var(--team-rgb), 0.45); }
.gx-main { height: calc(var(--u) * 6.2); font-size: calc(var(--u) * 2.1); font-weight: 900; letter-spacing: 0.02em; color: #0b0d12; border-color: transparent; background: linear-gradient(180deg, #fff, rgba(255, 255, 255, 0.82)); }
.gx-main:hover, .gx-main.sel { background: linear-gradient(180deg, #fff, rgba(255, 255, 255, 0.92)); border-color: transparent; }
.gx-main.buy { background: linear-gradient(180deg, color-mix(in srgb, var(--team) 80%, #fff), var(--team)); box-shadow: 0 calc(var(--u) * 0.6) calc(var(--u) * 2.4) rgba(var(--team-rgb), 0.45); }
.gx-main.buy.sel { box-shadow: 0 0 0 2px #fff, 0 0 calc(var(--u) * 3) rgba(var(--team-rgb), 0.8); }
.gx-main.need { color: rgba(255, 255, 255, 0.75); background: rgba(255, 255, 255, 0.1); border: 1px dashed rgba(255, 255, 255, 0.35); box-shadow: none; }
.gx-main.need.sel { border-style: solid; box-shadow: 0 0 0 2px rgba(255, 123, 123, 0.9); }
.gx-main.eq { color: #7cfc9a; background: rgba(124, 252, 154, 0.12); border: 1px solid rgba(124, 252, 154, 0.55); }
.gx-main svg { width: calc(var(--u) * 2.8); height: calc(var(--u) * 2.8); flex: none; }
.gx-need { min-height: calc(var(--u) * 2.6); margin: calc(var(--u) * 0.7) 0 calc(var(--u) * 0.9); display: flex; align-items: center; justify-content: center; gap: calc(var(--u) * 0.6); font-size: calc(var(--u) * 1.55); font-weight: 700; color: rgba(255, 255, 255, 0.6); text-align: center; }
.gx-need.bad { color: #ff8f8f; }
.gx-need svg { width: calc(var(--u) * 1.9); height: calc(var(--u) * 1.9); }
.gx-row { display: flex; gap: calc(var(--u) * 1.2); }
.gx-sec { height: calc(var(--u) * 4.6); font-size: calc(var(--u) * 1.7); font-weight: 700; }
.gx-hint { margin-top: calc(var(--u) * 1.2); font-size: calc(var(--u) * 1.15); text-align: center; letter-spacing: 0.04em; color: rgba(255, 255, 255, 0.42); }
.gx-shake { animation: gxShake 0.35s; }

/* upgrades */
.gx-p-upgrades { grid-template-columns: minmax(0, 0.8fr) minmax(0, 3.4fr); gap: calc(var(--u) * 2.6); align-items: stretch; }
.gx-uphead { display: flex; flex-direction: column; justify-content: center; gap: calc(var(--u) * 1); }
.gx-uphead h2 { margin: 0; font-size: calc(var(--u) * 3.6); font-weight: 900; font-style: italic; text-transform: uppercase; line-height: 1; text-shadow: 0 0 calc(var(--u) * 3) rgba(var(--team-rgb), 0.45); }
.gx-uphead p { margin: 0 0 calc(var(--u) * 0.6); font-size: calc(var(--u) * 1.5); color: rgba(255, 255, 255, 0.7); }
.gx-ups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: calc(var(--u) * 1.4); }
.gx-up { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: calc(var(--u) * 0.7); padding: calc(var(--u) * 1.4); text-align: left; height: auto; }
.gx-up-top { display: flex; align-items: center; gap: calc(var(--u) * 1); font-size: calc(var(--u) * 2); font-weight: 800; }
.gx-up-top svg { width: calc(var(--u) * 2.8); height: calc(var(--u) * 2.8); color: var(--team); flex: none; }
.gx-pips { display: flex; gap: calc(var(--u) * 0.6); }
.gx-pips i { flex: 1; height: calc(var(--u) * 0.9); border-radius: 99px; background: rgba(255, 255, 255, 0.16); transition: background 0.3s, box-shadow 0.3s; }
.gx-pips i.on { background: var(--team); box-shadow: 0 0 calc(var(--u) * 1) rgba(var(--team-rgb), 0.9); }
.gx-pips i.pop { animation: gxPop 0.55s; }
.gx-badge.pop { animation: gxPop 0.5s; }
.gx-up-now { font-size: calc(var(--u) * 1.4); color: rgba(255, 255, 255, 0.85); min-height: 2.5em; }
.gx-up-next { font-size: calc(var(--u) * 1.3); color: rgba(255, 255, 255, 0.55); }
.gx-up-buy { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: calc(var(--u) * 0.6); padding-top: calc(var(--u) * 0.6); font-size: calc(var(--u) * 1.8); font-weight: 900; color: #ffd23f; }
.gx-up-buy small { font-size: calc(var(--u) * 1.2); font-weight: 700; color: rgba(255, 255, 255, 0.5); text-transform: uppercase; letter-spacing: 0.08em; }
.gx-up.need .gx-up-buy { color: #ff8f8f; }
.gx-up.max .gx-up-buy { color: #7cfc9a; }
.gx-up-buy span { display: flex; align-items: center; gap: calc(var(--u) * 0.5); }
.gx-up-buy svg { width: calc(var(--u) * 2); height: calc(var(--u) * 2); }

/* the white flash when you buy a car */
.gx-flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: radial-gradient(circle at 50% 38%, #fff 0%, rgba(var(--team-rgb), 0.55) 45%, rgba(var(--team-rgb), 0) 80%); }

@keyframes gxIn { from { opacity: 0; transform: translateX(calc(var(--u) * -1.6)); } to { opacity: 1; transform: none; } }
@keyframes gxPop { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes gxShake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .gx-swap, .gx-coins.pop, .gx-pips i.pop, .gx-badge.pop, .gx-shake, .gx-page { animation: none; } .gx { transition: none; } }

/* ---- a portrait phone: the car in the top half, the panel in the bottom half ---- */
@container (max-aspect-ratio: 9/10) {
  .gx-top { padding: calc(var(--u) * 1.6) calc(var(--u) * 2) 0; }
  .gx-title { font-size: calc(var(--u) * 3.6); }
  .gx-title small { display: none; }
  .gx-dock { margin: 0 calc(var(--u) * 1.6) calc(var(--u) * 1.6); }
  .gx-panel { padding: calc(var(--u) * 1.8); }
  .gx-p-garage { grid-template-columns: 1fr; gap: calc(var(--u) * 1.4); }
  .gx-p-garage > section + section { border-left: 0; padding-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: calc(var(--u) * 1.4); }
  .gx-name { font-size: calc(var(--u) * 5.4); }
  .gx-liv { margin-top: calc(var(--u) * 1); }
  .gx-stats-sec .gx-sh { display: none; }
  .gx-stats-sec { display: grid !important; grid-template-columns: 1fr 1fr; gap: 0 calc(var(--u) * 2); }
  .gx-stat { grid-template-columns: 1fr; gap: calc(var(--u) * 0.4); margin-bottom: calc(var(--u) * 0.9); font-size: calc(var(--u) * 1.6); }
  .gx-stat > span { display: flex; justify-content: space-between; }
  .gx-stat > span em { display: inline; font-style: normal; font-weight: 600; color: rgba(255, 255, 255, 0.6); }
  .gx-stat > em { display: none; }
  .gx-main { height: calc(var(--u) * 6.4); }
  .gx-hint { display: none !important; }
  .gx-p-upgrades { grid-template-columns: 1fr; gap: calc(var(--u) * 1.2); }
  .gx-uphead { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .gx-uphead p { display: none; }
  .gx-uphead h2 { font-size: calc(var(--u) * 3.2); }
  .gx-uphead .gx-sec { width: auto; padding: 0 calc(var(--u) * 2.4); }
  .gx-ups { grid-template-columns: 1fr 1fr; gap: calc(var(--u) * 1.1); }
  .gx-up { padding: calc(var(--u) * 1.2); gap: calc(var(--u) * 0.5); }
  .gx-up-next { display: none; }
  .gx-up-now { min-height: 2.5em; font-size: calc(var(--u) * 1.4); }
}

/* button prompts in the hint line: key caps, controller face buttons, sticks and pills (js/ui/devices.js picks them for the device you are using) */
.gx-hint { display: flex; flex-wrap: wrap; justify-content: center; gap: calc(var(--u) * 0.5) calc(var(--u) * 1.4); color: rgba(255, 255, 255, 0.62); }
.gp { display: inline-flex; align-items: center; gap: 0.3em; white-space: nowrap; }
.gp > span { margin-left: 0.15em; }
.gp-k, .gp-f, .gp-s, .gp-d, .gp-p { display: inline-flex; align-items: center; justify-content: center; min-width: 1.7em; height: 1.7em; padding: 0 0.35em; box-sizing: border-box; font: 700 0.82em/1 sans-serif; }
.gp-k { background: #f4f5f7; color: #17181c; border-radius: 0.35em; box-shadow: 0 0.14em 0 #8d929c; }
.gp-f { border-radius: 50%; background: #16181d; color: var(--c); border: 0.12em solid var(--c); padding: 0; }
.gp-s, .gp-d { border-radius: 50%; background: #16181d; color: #fff; border: 0.1em solid #cfd3da; padding: 0; }
.gp-p { border-radius: 0.85em; background: #16181d; color: #fff; border: 0.08em solid #cfd3da; }
.gp-j { font-style: normal; opacity: 0.7; }
body.dev-pad, body.dev-pad * { cursor: none !important; } /* playing with a controller: no mouse pointer over the game */

/* ---- the Garage's glass under the canvas menus (js/ui/glass.js): the same look as .gx-panel, placed exactly under each panel the canvas draws ---- */
#glassLayer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
#glassLayer > div { position: absolute; left: 0; top: 0; box-sizing: border-box; opacity: 0; transition: opacity 0.22s ease-out; --acc: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.14); border-top-color: var(--acc);
  background: linear-gradient(180deg, rgba(24, 28, 42, 0.5), rgba(9, 11, 18, 0.66)); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
#glassLayer > div.on { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc), 0 0 26px color-mix(in srgb, var(--acc) 45%, transparent), 0 10px 34px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, color-mix(in srgb, var(--acc) 16%, rgba(30, 34, 50, 0.6)), rgba(9, 11, 18, 0.7)); }
#glassLayer.flat > div { backdrop-filter: none; -webkit-backdrop-filter: none; background: linear-gradient(180deg, rgba(24, 28, 42, 0.86), rgba(9, 11, 18, 0.92)); } /* Low: no blur */
@media (prefers-reduced-motion: reduce) { #glassLayer > div { transition: none; } }
