:root {
  --bg: #0b0c14;
  --bezel: #171928;
  --border: #2f3556;
  --neon-cyan: #2de2e6;
  --neon-pink: #ff2a85;
  --neon-yellow: #ffd319;
  --neon-green: #38f276;
  --text: #f3f5ff;
  --muted: #98a2c7;
  --font-display: 'Orbitron', 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --font-pixel: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at center, #181b2c 0%, var(--bg) 75%);
  color: var(--text);
  font-family: var(--font-pixel);
  font-size-adjust: from-font;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  overflow: hidden;
}

#arcade-cabinet {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
}

#top-bar, #controls-bar {
  width: min(1740px, 97vw);
  width: min(1740px, 97dvw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

#stage-layout {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  width: min(1740px, 97vw);
  width: min(1740px, 97dvw);
}

#leaderboard-panel {
  width: 314px;
  max-height: calc(100dvh - 78px);
  flex-shrink: 0;
  background: linear-gradient(180deg, #161b36 0%, #0d1124 100%);
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.75),
    0 0 18px rgba(45, 226, 230, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-cyan) #0d1124;
}

.lb-title {
  font-family: var(--font-display);
  font-size: 0.90rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.2;
  color: var(--neon-yellow);
  text-align: center;
  text-shadow: 0 0 10px rgba(255, 211, 25, 0.45);
  border-bottom: 2px solid rgba(45, 226, 230, 0.35);
  padding-bottom: 4px;
  flex-shrink: 0;
}

.lb-current {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(90deg, rgba(45, 226, 230, 0.16), rgba(56, 242, 118, 0.14));
  border: 1.5px solid rgba(45, 226, 230, 0.55);
  border-radius: 5px;
  padding: 5px 8px;
  flex-shrink: 0;
}

.lb-real-score-fixed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.lb-cur-label {
  font-size: 0.66rem;
  font-weight: 800;
  color: #e2e8f0;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.lb-cur-val {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(45, 226, 230, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-list {
  list-style: none;
  margin: 0;
  padding: 0 2px 0 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text);
  flex: 0 1 auto;
  max-height: 156px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-cyan) #0d1124;
}

.lb-empty {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  padding: 4px;
}

.lb-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(152, 162, 199, 0.22);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
}

.lb-score-row.rank-1 {
  border-color: rgba(255, 211, 25, 0.6);
  background: rgba(255, 211, 25, 0.12);
}

.lb-score-row.rank-2 {
  border-color: rgba(203, 213, 225, 0.45);
  background: rgba(203, 213, 225, 0.08);
}

.lb-score-row.rank-3 {
  border-color: rgba(255, 107, 53, 0.5);
  background: rgba(255, 107, 53, 0.09);
}

.lb-rank {
  min-width: 24px;
  font-weight: 700;
  color: var(--neon-yellow);
  flex-shrink: 0;
}

.lb-pilot-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f8fafc;
}

.lb-pts {
  color: var(--neon-green);
  font-weight: 700;
  flex-shrink: 0;
}

.lb-pts small {
  font-size: 0.65rem;
  color: var(--muted);
}

.lb-subtitle {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.25;
  color: var(--neon-cyan);
  text-align: center;
  border-top: 2px solid rgba(47, 53, 86, 0.85);
  border-bottom: 1px solid rgba(47, 53, 86, 0.85);
  padding: 4px 0 3px;
  flex-shrink: 0;
}

.lb-tracks {
  list-style: none;
  margin: 0;
  padding: 0 2px 0 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text);
  flex: 1 1 0;
  min-height: 112px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-cyan) #0d1124;
}

.lb-tracks li {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  background: rgba(19, 24, 48, 0.88);
  border: 1px solid rgba(47, 53, 86, 0.9);
  border-radius: 5px;
  padding: 5px 7px;
  font-size: 0.74rem;
  line-height: 1.25;
  flex-shrink: 0;
}

.lb-trk-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.lb-trk-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.lb-ghost-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  line-height: 1;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(240, 171, 252, 0.16);
  border: 1px solid rgba(232, 121, 249, 0.55);
  box-shadow: 0 0 6px rgba(232, 121, 249, 0.28);
  flex-shrink: 0;
}

.lb-tracks li.active-stage {
  border-color: var(--neon-yellow);
  background: rgba(255, 211, 25, 0.14);
  box-shadow: 0 0 10px rgba(255, 211, 25, 0.18);
}

.lb-track-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 3px;
  flex-shrink: 0;
}

.lb-tab-btn {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid rgba(45, 226, 230, 0.35);
  background: rgba(15, 23, 42, 0.75);
  color: #cbd5e1;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.lb-tab-btn.is-active {
  border-color: var(--neon-cyan);
  color: #0b1120;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(45, 226, 230, 0.35);
}

.lb-custom-empty {
  color: #94a3b8;
  font-size: 0.72rem;
  text-align: center;
  padding: 10px 6px;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  border-radius: 4px;
}

.lb-trk-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.lb-minimap-canvas {
  display: block;
  width: 48px;
  height: 27px;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  background: #070a14;
  border: 1px solid rgba(45, 226, 230, 0.45);
  border-radius: 3px;
}

.lb-tracks li.active-stage .lb-minimap-canvas {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 6px rgba(255, 211, 25, 0.35);
}

.lb-trk-num {
  color: var(--neon-pink);
  font-weight: 700;
  font-size: 0.7rem;
  min-width: 21px;
  flex-shrink: 0;
}

.lb-trk-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f1f5f9;
  font-weight: 600;
  font-size: 0.76rem;
}

.lb-trk-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.lb-trk-pilot {
  background: rgba(45, 226, 230, 0.15);
  border: 1px solid rgba(45, 226, 230, 0.45);
  color: var(--neon-cyan);
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 0.7rem;
  max-width: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-trk-time {
  color: var(--neon-yellow);
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-meta a {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}

.footer-meta a:hover {
  color: var(--neon-cyan);
}

.version-badge {
  background: #1d2136;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan) !important;
  padding: 2px 6px;
  font-weight: 700;
}

.score-form {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
}

.score-input {
  font-family: var(--font-pixel);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 10px;
  width: 170px;
  background: #13172b;
  color: var(--neon-yellow);
  border: 2px solid var(--neon-cyan);
  text-align: center;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(760px, 95%);
  margin: 0 0 16px;
  text-align: left;
}

.legend-item {
  background: #13172b;
  border: 2px solid var(--border);
  padding: 7px 9px;
  font-size: 11px;
  line-height: 1.35;
}

.legend-item strong {
  display: block;
  color: var(--neon-yellow);
  margin-bottom: 2px;
}

.chassis-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chassis-btn {
  font-family: var(--font-pixel);
  font-size: 11px;
  padding: 7px 10px;
  background: #13172b;
  color: var(--text);
  border: 2px solid var(--border);
  cursor: pointer;
  text-align: left;
}

.chassis-btn.active {
  border-color: var(--neon-yellow);
  background: #231f33;
}

.chassis-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(45, 226, 230, 0.45);
}

.brand-helmet-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 4px rgba(5, 217, 232, 0.55));
}

.badge {
  background: var(--neon-pink);
  color: #fff;
  padding: 2px 6px;
  font-size: 11px;
  margin-left: 6px;
  border: 2px solid #fff;
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.arcade-btn {
  font-family: var(--font-pixel);
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
  background: #1d2136;
  color: var(--text);
  border: 2px solid var(--border);
  cursor: pointer;
  text-shadow: 0 1px 2px #000;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}

.arcade-btn:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.arcade-btn:active {
  transform: translateY(1px);
}

.arcade-btn.active-pause {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  background: #2b2412;
}

.arcade-btn.active-mute {
  border-color: var(--neon-pink);
  color: #fda4af;
  background: #2b1322;
}

#screen-frame {
  position: relative;
  align-self: center;
  width: min(1410px, calc(97dvw - 328px), calc((94dvh - 76px) * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #000;
  border: 6px solid var(--bezel);
  outline: 3px solid var(--border);
  box-shadow:
    0 0 0 2px #000,
    0 18px 50px rgba(0, 0, 0, 0.75),
    0 0 32px rgba(45, 226, 230, 0.12);
  overflow: hidden;
}

#arcade-cabinet.size-medium #top-bar,
#arcade-cabinet.size-medium #controls-bar,
#arcade-cabinet.size-medium #stage-layout {
  width: min(1240px, 94vw);
  width: min(1240px, 94dvw);
}

#arcade-cabinet.size-medium #screen-frame {
  width: min(910px, calc(94dvw - 320px), calc((85dvh - 86px) * 16 / 9));
}

#arcade-cabinet.size-medium #leaderboard-panel {
  width: 304px;
  max-height: calc(85dvh - 86px);
}

#arcade-cabinet.size-large #top-bar,
#arcade-cabinet.size-large #controls-bar,
#arcade-cabinet.size-large #stage-layout {
  width: min(1740px, 97vw);
  width: min(1740px, 97dvw);
}

#arcade-cabinet.size-large #screen-frame {
  width: min(1410px, calc(97dvw - 328px), calc((94dvh - 76px) * 16 / 9));
}

#arcade-cabinet.size-large #leaderboard-panel {
  width: 316px;
  max-height: min(793px, calc(94dvh - 76px));
}

#arcade-cabinet.size-full #top-bar,
#arcade-cabinet.size-full #controls-bar,
#arcade-cabinet.size-full #stage-layout {
  width: 99dvw;
  max-width: 99dvw;
}

#arcade-cabinet.size-full #screen-frame {
  flex: 1;
  width: auto;
  max-width: calc((100dvh - 74px) * 16 / 9);
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto;
}

/* Optional 80s CRT Scanline + Vignette */
#crt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.28) 50%),
    radial-gradient(circle at center, transparent 62%, rgba(0, 0, 0, 0.55) 100%);
  background-size: 100% 4px, 100% 100%;
}

#screen-frame.crt-on #crt-overlay {
  opacity: 1;
}

/* Overlay UI */
#ui-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 20, 0.86);
  display: flex;
  flex-direction: column;
  align-items: center;
  align-items: safe center;
  justify-content: center;
  justify-content: safe center;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 16px 20px;
  text-align: center;
  z-index: 5;
}

#ui-overlay.title-theme {
  background: radial-gradient(circle at 50% 45%, rgba(16, 12, 36, 0.34), rgba(6, 7, 16, 0.72));
  backdrop-filter: blur(2px);
}

#ui-overlay.hidden,
.hidden {
  display: none !important;
}

.overlay-title {
  font-family: var(--font-display);
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 1.1rem + 1.5vw, 2.1rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-wrap: balance;
  color: var(--neon-yellow);
  text-shadow: 3px 3px 0 var(--neon-pink), 0 0 18px rgba(255, 211, 25, 0.4);
}

.overlay-subtitle {
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--neon-cyan);
  max-width: 720px;
  line-height: 1.48;
  text-shadow: 0 2px 4px #000, 0 0 2px #000;
}

.standings-table {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(700px, 95%);
  margin-bottom: 16px;
}

.standing-pill {
  background: #14172b;
  border: 2px solid var(--border);
  padding: 9px 7px;
  font-size: 14px;
  text-shadow: 0 2px 4px #000, 0 0 2px #000;
}

.standing-pill.player {
  border-color: var(--neon-yellow);
  background: #231f33;
  color: #ffffff;
}

.standing-pill.player .standing-name {
  color: #ffd319 !important;
  text-shadow: 0 2px 4px #000, 0 0 8px rgba(255, 211, 25, 0.55);
}

.draft-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  width: min(880px, 97%);
  margin: 6px 0 10px;
}

.upgrade-card {
  background: #13172b;
  border: 2px solid var(--neon-cyan);
  padding: 13px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  text-shadow: 0 1px 3px #000;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.upgrade-card:hover {
  transform: translateY(-3px);
  border-color: var(--neon-yellow);
  box-shadow: 0 0 16px rgba(255, 211, 25, 0.35);
}

.upgrade-card.upgrade-draft-card {
  border-radius: 8px;
  padding: 11px 12px;
  align-items: center;
  text-align: center;
  justify-content: flex-start;
  gap: 7px;
  color: var(--text);
}

.upgrade-card.upgrade-draft-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.28);
  transform: none;
}

.upgrade-card.upgrade-draft-card:not(:disabled):hover,
.upgrade-card.upgrade-draft-card:not(:disabled):focus-visible {
  transform: translateY(-4px);
}

.upgrade-frame-box {
  position: relative;
  width: 92px;
  height: 92px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  margin: 2px auto;
}

.upgrade-frame-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.upgrade-icon-art {
  position: relative;
  z-index: 1;
  width: 78%;
  height: 78%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.upgrade-meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  align-items: center;
}

.upgrade-rarity-pill {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(8, 12, 26, 0.9);
  border: 1px solid currentColor;
  text-shadow: 0 1px 2px #000;
}

.upgrade-tag {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
  text-transform: uppercase;
  text-shadow: 0 1px 2px #000;
}

.upgrade-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  color: var(--neon-yellow);
  text-shadow:
    -1.5px -1.5px 0 #050711,
     1.5px -1.5px 0 #050711,
    -1.5px  1.5px 0 #050711,
     1.5px  1.5px 0 #050711,
     0 3px 8px rgba(0, 0, 0, 0.95);
}

.upgrade-desc {
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.35;
  text-shadow: 0 1px 2px #000;
}

.upgrade-cta {
  margin-top: auto;
  width: 100%;
  padding: 5px 8px;
  border-radius: 5px;
  background: rgba(8, 12, 26, 0.85);
  border: 1px solid rgba(56, 242, 118, 0.45);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--neon-green);
  text-shadow: 0 1px 3px #000;
}

.upgrade-card:disabled .upgrade-cta {
  border-color: rgba(253, 164, 175, 0.4);
  color: #fda4af;
}

.prestage-tire-bar {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 5px 12px;
  margin-bottom: 4px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(45, 226, 230, 0.35);
  border-radius: 6px;
  font-size: 11.5px;
  color: #cbd5e1;
}

.prestage-tire-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(9, 13, 28, 0.9);
  cursor: pointer;
  font-weight: 800;
  font-size: 11px;
  color: #e2e8f0;
}

.prestage-tire-pill:has(> input:checked) {
  border-color: var(--neon-yellow);
  background: rgba(255, 211, 25, 0.16);
  color: #ffffff;
}

@media (max-width: 720px) {
  .draft-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.primary-btn {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 800;
  padding: 10px 22px;
  background: var(--neon-pink);
  color: #fff;
  border: 3px solid #fff;
  cursor: pointer;
  letter-spacing: 0.08em;
  box-shadow: 4px 4px 0 #000;
  transition: transform 0.08s ease;
}

.primary-btn:hover:not(:disabled) {
  background: var(--neon-cyan);
  color: #080a14;
}

.primary-btn:active:not(:disabled) {
  transform: translate(2px, 2px);
}

.primary-btn:disabled {
  background: #2b314d;
  color: #94a3b8;
  border-color: #475569;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary-btn {
  font-family: var(--font-pixel);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  background: #1d2136;
  color: var(--neon-yellow);
  border: 2px solid var(--neon-yellow);
  cursor: pointer;
}

.secondary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.overlay-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(760px, 95%);
  margin: 0 0 16px;
  text-align: left;
}

.legend-item {
  background: #13172b;
  border: 2px solid var(--border);
  padding: 7px 9px;
  font-size: 11px;
  line-height: 1.35;
}

.legend-item strong {
  display: block;
  color: var(--neon-yellow);
  margin-bottom: 2px;
}

.chassis-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chassis-btn {
  font-family: var(--font-pixel);
  font-size: 11px;
  padding: 7px 10px;
  background: #13172b;
  color: var(--text);
  border: 2px solid var(--border);
  cursor: pointer;
  text-align: left;
}

.chassis-btn.active {
  border-color: var(--neon-yellow);
  background: #231f33;
}

.chassis-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.track-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  width: min(900px, 98%);
  margin: 8px 0 10px;
}

.upgrade-card.track-choice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 7px;
  padding: 11px;
  border: 2px solid rgba(45, 226, 230, 0.65);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(20, 26, 52, 0.96) 0%, rgba(11, 15, 31, 0.98) 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.upgrade-card.track-choice-card:hover,
.upgrade-card.track-choice-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--neon-yellow);
  background: linear-gradient(180deg, rgba(30, 39, 74, 0.98) 0%, rgba(16, 22, 44, 0.99) 100%);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.65), 0 0 18px rgba(255, 211, 25, 0.42);
}

.track-choice-minimap {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  margin: 0;
  background: #070a14;
  border: 1.5px solid rgba(45, 226, 230, 0.55);
  border-radius: 5px;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.72), 0 3px 10px rgba(0, 0, 0, 0.45);
}

.track-choice-stage {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--neon-pink);
  text-transform: uppercase;
  text-shadow: 0 1px 3px #000;
}

.track-choice-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.03em;
  color: var(--neon-yellow);
  text-shadow:
    -1.5px -1.5px 0 #050711,
     1.5px -1.5px 0 #050711,
    -1.5px  1.5px 0 #050711,
     1.5px  1.5px 0 #050711,
     0 3px 8px rgba(0, 0, 0, 0.95);
}

.track-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.track-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  color: #f1f5f9;
  background: rgba(8, 12, 26, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.35);
  text-shadow: 0 1px 2px #000;
}

.track-badge-pill.badge-biome {
  border-color: rgba(45, 226, 230, 0.55);
  color: #a5f3fc;
}

.track-badge-pill.badge-weather {
  border-color: rgba(96, 165, 250, 0.55);
  color: #dbeafe;
}

.track-badge-pill.badge-laps {
  border-color: rgba(255, 211, 25, 0.55);
  color: #fef08a;
}

.track-badge-pill.badge-hazard {
  border-color: rgba(251, 146, 60, 0.65);
  background: rgba(67, 20, 7, 0.6);
  color: #fed7aa;
}

.track-badge-pill.badge-mod {
  border-color: rgba(255, 42, 133, 0.65);
  background: rgba(76, 5, 45, 0.55);
  color: #fbcfe8;
}

.track-choice-mod-desc {
  font-size: 11px;
  line-height: 1.3;
  color: #cbd5e1;
  text-shadow: 0 1px 2px #000;
}

.track-choice-footer {
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--neon-green);
  text-shadow: 0 1px 3px #000;
}

.prerace-preview-wrap {
  display: flex;
  justify-content: center;
  margin: 4px 0 8px;
}

.prerace-minimap-canvas {
  display: block;
  width: 192px;
  height: 108px;
  aspect-ratio: 16 / 9;
  background: #070a14;
  border: 1.5px solid rgba(45, 226, 230, 0.55);
  border-radius: 5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}

@media (max-width: 720px) {
  .track-choice-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

#controls-bar {
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}

kbd {
  background: #1c2035;
  border: 1px solid #454d75;
  padding: 1px 5px;
  color: var(--neon-yellow);
  font-family: var(--font-pixel);
  font-size: 11px;
  margin-right: 3px;
}

/* Title Hero & Garage Selection */
.title-hero-box {
  background: rgba(10, 12, 26, 0.72);
  border: 2px solid rgba(255, 42, 133, 0.55);
  box-shadow: 0 0 28px rgba(255, 42, 133, 0.25);
  padding: 26px 36px;
  border-radius: 6px;
  max-width: 660px;
}

.title-eyebrow {
  font-size: 11px;
  letter-spacing: 2.5px;
  color: var(--neon-cyan);
  margin-bottom: 6px;
  font-weight: 700;
}

.garage-panel {
  background: rgba(10, 12, 26, 0.90);
  border: 2px solid var(--border);
  padding: 12px 18px;
  width: min(928px, 97%);
  max-height: 94%;
  overflow-y: auto;
  border-radius: 6px;
}

.garage-columns {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 14px;
  text-align: left;
}

.garage-col-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--neon-yellow);
  letter-spacing: 1.5px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.garage-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.garage-card {
  display: flex;
  align-items: center;
  gap: 11px;
  background: #141932;
  border: 2px solid #2e375e;
  padding: 7px 11px;
  color: var(--text);
  font-family: var(--font-pixel);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.garage-card:hover:not(:disabled) {
  border-color: var(--neon-cyan);
  background: #1a2142;
}

.garage-card.active {
  border-color: var(--neon-yellow);
  background: #231e3b;
  box-shadow: 0 0 14px rgba(255, 211, 25, 0.28);
}

.garage-card:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.car-preview-canvas {
  background: rgba(6, 8, 16, 0.85);
  border: 1px solid #394473;
  border-radius: 4px;
  flex-shrink: 0;
}

.garage-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14.5px;
  line-height: 1.38;
  flex: 1;
  min-width: 0;
  text-shadow: 0 2px 4px #000, 0 0 2px #000;
}

.garage-card-info strong {
  font-size: 15px;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 4px #000, 0 0 2px #000;
}

.garage-card-info span {
  color: #e6ecff;
  font-size: 13.5px;
  line-height: 1.4;
  font-weight: 600;
  text-shadow: 0 1px 3px #000;
}

.garage-pilot-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 900;
  color: var(--neon-yellow);
}

.garage-pilot-row .score-input {
  padding: 5px 9px;
  font-size: 13px;
  width: 165px;
  border: 2px solid var(--neon-cyan);
}

.score-saved-banner {
  background: rgba(56, 242, 118, 0.14);
  border: 1px solid var(--neon-green);
  color: var(--neon-green);
  font-size: 12px;
  padding: 7px 14px;
  margin-bottom: 14px;
}

/* Live Standings Mini-Panel inside Sidebar */
.lb-live-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  max-height: 215px;
  overflow-y: auto;
}

.lb-live-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(15, 23, 42, 0.55);
}

.lb-live-row.is-player {
  background: rgba(255, 42, 133, 0.16);
  border: 1px solid rgba(255, 42, 133, 0.45);
}

.lb-pos-pill {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 3px;
  min-width: 24px;
  text-align: center;
}

.lb-live-name {
  flex: 1;
  text-align: left;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-live-lap {
  font-family: var(--font-display);
  font-size: 0.68rem;
  color: var(--neon-cyan);
  font-weight: 800;
}

/* 8-Car Garage & Pit Stop Workshop */
.garage-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.wrench-wallet-pill {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 900;
  color: var(--neon-yellow);
  background: rgba(255, 211, 25, 0.12);
  border: 2px solid var(--neon-yellow);
  padding: 6px 12px;
  border-radius: 4px;
  white-space: nowrap;
}

.garage-scroll {
  max-height: 292px;
  overflow-y: auto;
  padding-right: 4px;
}

.workshop-panel {
  background: rgba(10, 12, 26, 0.94);
  border: 2px solid var(--border);
  padding: 12px 18px;
  width: min(928px, 97%);
  max-height: 94%;
  overflow-y: auto;
  border-radius: 6px;
}

.workshop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 330px;
  overflow-y: auto;
  padding-right: 4px;
  margin-top: 8px;
  text-align: left;
}

.garage-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.chassis-badge {
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.chassis-badge.is-active {
  background: var(--neon-yellow);
  color: #090612;
}

.chassis-badge.is-owned {
  background: rgba(45, 226, 230, 0.18);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
}

.chassis-badge.is-price {
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid #64748b;
  color: #cbd5e1;
}

.chassis-badge.is-price.can-buy {
  background: rgba(56, 242, 118, 0.18);
  border-color: var(--neon-green);
  color: var(--neon-green);
}

.stat-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
  margin: 3px 0;
  width: 100%;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.stat-lbl {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  color: #e2e8f0;
  width: 34px;
  min-width: 34px;
  flex-shrink: 0;
  text-align: left;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px #000;
}

.stat-track-10 {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 2px;
  flex: 1;
  min-width: 66px;
  height: 7px;
  align-items: center;
}

.stat-sq {
  display: block;
  height: 6px;
  background: #0b0e1d;
  border: 1px solid #2d3659;
  border-radius: 1px;
  image-rendering: pixelated;
}

.stat-sq.on {
  border-color: rgba(255, 255, 255, 0.48);
}

.chassis-desc {
  font-size: 12.5px !important;
  color: #e2e8f0 !important;
  line-height: 1.28 !important;
  text-shadow: 0 1px 2px #000;
}

/* Paid Upgrade Card Rarities & Weapon Warning */
.upgrade-card.rarity-normal,
.upgrade-card.rarity-comune {
  border-color: #2A84EC;
  background: linear-gradient(180deg, rgba(20, 34, 68, 0.96) 0%, rgba(11, 16, 34, 0.98) 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55), 0 0 14px rgba(42, 132, 236, 0.28);
}

.upgrade-card.rarity-rare,
.upgrade-card.rarity-rara {
  border-color: #EEB81C;
  background: linear-gradient(180deg, rgba(48, 38, 16, 0.96) 0%, rgba(18, 15, 22, 0.98) 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55), 0 0 16px rgba(238, 184, 28, 0.30);
}

.upgrade-card.rarity-legendary,
.upgrade-card.rarity-leggendaria {
  border-color: #B240EA;
  background: linear-gradient(180deg, rgba(46, 20, 68, 0.96) 0%, rgba(17, 11, 32, 0.98) 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55), 0 0 18px rgba(178, 64, 234, 0.36);
}

.admin-rarity-weights-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 10px;
  padding: 9px 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #33406b;
  border-radius: 6px;
  font-size: 12px;
}

.admin-rarity-weights-bar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.admin-weights-sum {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 9px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 11px;
  border: 1px solid #334155;
  background: rgba(8, 12, 26, 0.85);
}

.admin-weights-sum.is-ok {
  color: #38f276;
  border-color: rgba(56, 242, 118, 0.45);
}

.admin-weights-sum.is-warn {
  color: #ffd319;
  border-color: rgba(255, 211, 25, 0.55);
}

.admin-upg-row-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-upg-preview {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #2A84EC;
  border-radius: 5px;
  background: #0b1020;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-upg-preview.rarity-normal {
  border-color: #2A84EC;
  box-shadow: 0 0 10px rgba(42, 132, 236, 0.45);
}

.admin-upg-preview.rarity-rare {
  border-color: #EEB81C;
  box-shadow: 0 0 10px rgba(238, 184, 28, 0.48);
}

.admin-upg-preview.rarity-legendary {
  border-color: #B240EA;
  box-shadow: 0 0 12px rgba(178, 64, 234, 0.55);
}

.admin-upg-frame-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: pixelated;
  pointer-events: none;
}

.admin-upg-icon-img {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.75));
}

.weapon-warn {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 800;
  color: #ffd319;
  background: rgba(255, 42, 133, 0.22);
  border: 1px solid #ff2a85;
  border-radius: 3px;
}

/* Mobile / Narrow Screen Advisory Banner */
.mobile-touch-banner {
  display: none;
  width: min(1480px, 98vw);
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  background: linear-gradient(90deg, rgba(255, 211, 25, 0.16), rgba(45, 226, 230, 0.14));
  border: 1px solid var(--neon-yellow);
  border-radius: 5px;
  color: var(--neon-yellow);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
}

.mobile-banner-close {
  flex-shrink: 0;
  background: #1d2136;
  color: var(--text);
  border: 1px solid var(--neon-cyan);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.mobile-banner-close:hover {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
}

.mobile-touch-banner.hidden {
  display: none !important;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .mobile-touch-banner {
    display: flex;
  }
}

/* v0.15 Rev Pill, Leaderboard Highlight, NEW RECORD Flash, Attract, Export/Import & Admin */
.rev-pill {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  color: var(--neon-yellow);
  background: rgba(255, 211, 25, 0.14);
  border: 1px solid rgba(255, 211, 25, 0.55);
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.rev-home-badge {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--neon-cyan);
  background: rgba(45, 226, 230, 0.12);
  border: 1px solid var(--neon-cyan);
  padding: 3px 10px;
  border-radius: 4px;
  letter-spacing: 0.08em;
}

.admin-trigger-btn {
  border-color: rgba(152, 162, 199, 0.45);
  color: #cbd5e1;
  font-size: 11px;
}

.lb-score-row.is-my-pilot {
  border-color: var(--neon-pink) !important;
  background: linear-gradient(90deg, rgba(255, 42, 133, 0.22), rgba(45, 226, 230, 0.14)) !important;
  box-shadow: 0 0 8px rgba(255, 42, 133, 0.25);
}

.lb-score-row.is-my-pilot .lb-pilot-name {
  color: var(--neon-yellow);
  font-weight: 800;
}

.lb-trk-pilot.is-my-pilot {
  background: rgba(255, 42, 133, 0.28);
  border-color: var(--neon-pink);
  color: #ffffff;
}

@keyframes recordPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 10px rgba(255, 211, 25, 0.7);
  }
  50% {
    opacity: 0.55;
    transform: scale(1.04);
    box-shadow: 0 0 2px rgba(255, 42, 133, 0.4);
  }
}

.lb-tracks li.is-new-record {
  border-color: var(--neon-yellow);
  background: rgba(255, 211, 25, 0.2);
}

.lb-new-record-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
  color: #090612;
  background: var(--neon-yellow);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  animation: recordPulse 0.65s infinite;
}

.mini-btn {
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  background: #171d36;
  color: var(--neon-cyan);
  border: 1px solid var(--neon-cyan);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.mini-btn:hover {
  background: var(--neon-cyan);
  color: #090612;
}

.secondary-btn.copied-flash {
  background: var(--neon-green) !important;
  border-color: #ffffff !important;
  color: #090612 !important;
}

/* Attract Mode Overlay */
#ui-overlay.attract-mode {
  background: rgba(6, 7, 16, 0.08);
  backdrop-filter: none;
  justify-content: flex-start;
  align-items: center;
  padding: 46px 20px 14px;
}

.attract-top-pill {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--neon-cyan);
  background: rgba(9, 12, 26, 0.86);
  border: 1px solid var(--neon-cyan);
  padding: 4px 12px;
  border-radius: 4px;
  letter-spacing: 0.12em;
}

#attract-bottom-dock,
.attract-bottom-dock {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, 95%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(7, 10, 22, 0.90);
  border: 1.5px solid rgba(255, 211, 25, 0.78);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.78), 0 0 18px rgba(255, 211, 25, 0.28);
  z-index: 6;
}

#attract-bottom-dock .coin-cabinet-bar {
  margin: 0 !important;
  padding: 4px 10px;
  background: rgba(13, 18, 38, 0.92);
}

@keyframes insertCoinBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.25; }
}

.attract-cta-box {
  background: rgba(13, 17, 34, 0.94);
  border: 1.5px solid var(--neon-yellow);
  box-shadow: 0 0 18px rgba(255, 211, 25, 0.30);
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.attract-insert-coin {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 1.5px 1.5px 0 var(--neon-pink);
  letter-spacing: 0.1em;
  animation: insertCoinBlink 1.1s infinite;
  line-height: 1.15;
}

.attract-sub {
  font-size: 10.5px;
  color: #e2e8f0;
  margin-top: 2px;
  line-height: 1.15;
}

/* Export/Import Save & Admin Modals */
.save-modal-panel,
.admin-modal-panel {
  background: rgba(10, 12, 26, 0.96);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 32px rgba(45, 226, 230, 0.25);
  border-radius: 6px;
  padding: 16px 20px;
  text-align: left;
  width: min(880px, 96%);
  max-height: 92%;
  overflow-y: auto;
}

.save-modal-panel {
  width: min(620px, 95%);
}

.save-textarea {
  width: 100%;
  height: 112px;
  background: #090d1a;
  color: #e2e8f0;
  border: 1px solid #394473;
  border-radius: 4px;
  padding: 8px;
  font-family: monospace;
  font-size: 11px;
  resize: vertical;
  user-select: text;
}

.save-feedback {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  min-height: 18px;
}

.admin-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.admin-tab-btn {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  padding: 6px 12px;
  background: #141932;
  color: #98a2c7;
  border: 1px solid #394473;
  border-radius: 4px;
  cursor: pointer;
}

.admin-tab-btn.active {
  background: rgba(45, 226, 230, 0.16);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.admin-scroll-body {
  max-height: 295px;
  overflow-y: auto;
  border: 1px solid #262e52;
  border-radius: 4px;
  padding: 8px;
  background: rgba(7, 9, 18, 0.75);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.admin-table th {
  text-align: left;
  color: var(--neon-yellow);
  font-family: var(--font-display);
  font-size: 10px;
  padding: 5px 6px;
  border-bottom: 1px solid #2f3556;
}

.admin-table td {
  padding: 5px 6px;
  border-bottom: 1px solid rgba(47, 53, 86, 0.45);
  color: #f1f5f9;
}

.admin-num-input,
.admin-select-input {
  background: #141932;
  color: #ffd319;
  border: 1px solid #455180;
  border-radius: 3px;
  padding: 3px 6px;
  font-family: var(--font-pixel);
  font-size: 12px;
  font-weight: 700;
  width: 68px;
  user-select: text;
}

.admin-select-input {
  width: auto;
  min-width: 190px;
}

.admin-rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-rule-card {
  background: #12172b;
  border: 1px solid #2e375e;
  border-radius: 4px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.admin-rule-card label {
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-cyan);
}

.admin-rule-row-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-rule-hint {
  font-size: 10.5px;
  color: #94a3b8;
  line-height: 1.25;
}

.admin-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: #f8fafc !important;
  font-size: 12px !important;
}

.admin-toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #38f276;
  cursor: pointer;
}

.admin-auth-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.admin-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-field-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 0.5px;
}

.admin-pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-pw-wrap .score-input,
.admin-text-input,
input[type="password"],
.admin-modal-panel input,
.admin-modal-panel textarea,
.admin-modal-panel select,
.save-modal-panel input[type="password"],
.save-modal-panel .admin-text-input {
  text-transform: none !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

.admin-pw-wrap .score-input,
.admin-text-input {
  background: #141932;
  color: #f8fafc;
  border: 1px solid #455180;
  border-radius: 3px;
  padding: 5px 8px;
  font-family: var(--font-pixel);
  font-size: 13px;
  font-weight: 700;
  width: 100%;
  letter-spacing: 0.03em;
  text-align: left;
}

.admin-eye-btn {
  background: #1a2142;
  border: 1px solid #455180;
  border-radius: 3px;
  color: #e2e8f0;
  cursor: pointer;
  padding: 5px 8px;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.admin-eye-btn:hover {
  border-color: var(--neon-cyan);
  color: #ffffff;
}

.admin-link-btn {
  background: transparent;
  border: none;
  color: #ffd319;
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 0;
  text-decoration: underline;
  align-self: flex-start;
}

.admin-link-btn:hover {
  color: #ffffff;
}

.admin-recovery-banner {
  background: rgba(255, 211, 25, 0.12);
  border: 1px solid #ffd319;
  border-radius: 4px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-code-pill {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 900;
  color: #ffd319;
  background: #0d1226;
  border: 1px dashed #ffd319;
  border-radius: 3px;
  padding: 5px 10px;
  letter-spacing: 1px;
  user-select: all;
}

.admin-cf-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #38f276;
  background: rgba(56, 242, 118, 0.12);
  border: 1px solid rgba(56, 242, 118, 0.45);
  border-radius: 3px;
  padding: 3px 8px;
  margin-top: 4px;
}

.admin-device-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #0f1428;
  border: 1px solid #2e375e;
  border-radius: 3px;
  padding: 6px 8px;
  font-size: 11px;
}

.admin-btn-xs {
  background: #2b1627;
  color: #ff6b9d;
  border: 1px solid #ff2a85;
  border-radius: 3px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.admin-btn-xs:hover {
  background: #ff2a85;
  color: #ffffff;
}

/* v0.18 Roadmap Footer Link & Roadmap Page */
.roadmap-footer-link {
  background: #181c30;
  border: 1px solid rgba(255, 211, 25, 0.55);
  color: var(--neon-yellow) !important;
  padding: 2px 7px;
  font-weight: 700;
  border-radius: 3px;
  letter-spacing: 0.04em;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.roadmap-footer-link:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan) !important;
  box-shadow: 0 0 8px rgba(45, 226, 230, 0.35);
}

html.roadmap-root,
body.roadmap-page {
  height: 100dvh;
  overflow: hidden;
}

body.roadmap-page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
}

@media (max-height: 520px) {
  html.roadmap-root,
  body.roadmap-page {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
    justify-content: flex-start;
  }
}

.roadmap-page input,
.roadmap-page textarea,
.roadmap-page select,
.rm-card-title,
.rm-card-desc {
  user-select: text;
}

.rm-crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.025) 0px,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 2;
}

.rm-shell {
  position: relative;
  z-index: 3;
  width: min(1140px, 100%);
  height: min(92vh, 92dvh);
  max-height: min(92vh, 92dvh);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(10, 12, 26, 0.86);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 0 32px rgba(45, 226, 230, 0.16);
}

.rm-header {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bezel);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  box-shadow: 0 0 24px rgba(45, 226, 230, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.rm-brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-inline-size: 0;
}

.rm-title-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-inline-size: 0;
}

.rm-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(16px, 2.3vw, 22px);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(45, 226, 230, 0.45), 0 2px 0 #050712;
}

.rm-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.rm-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rm-nav-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rm-summary-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  background: #121526;
  border: 2px solid #2b3358;
  border-radius: 8px;
  padding: 14px 16px;
}

.rm-progress-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rm-progress-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}

.rm-progress-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: var(--neon-yellow);
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px #000;
}

.rm-progress-stats {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}

.rm-progress-track-10 {
  display: grid;
  grid-template-columns: repeat(10, minmax(16px, 24px));
  gap: 5px;
  align-items: center;
  background: #090c18;
  border: 1px solid #2e3860;
  border-radius: 4px;
  padding: 6px 8px;
}

.rm-progress-sq {
  display: block;
  height: 14px;
  background: #101528;
  border: 1px solid #2a3356;
  border-radius: 2px;
  image-rendering: pixelated;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.rm-progress-sq.on {
  background: linear-gradient(180deg, #5cff93 0%, #24cf61 100%);
  border-color: #b7ffd0;
  box-shadow: 0 0 8px rgba(56, 242, 118, 0.55);
}

.rm-filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding-top: 8px;
  border-top: 1px solid #262e4d;
}

.rm-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.rm-filter-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-inline-end: 2px;
}

.rm-filter-btn {
  background: #181d34;
  color: #cbd5e1;
  border: 1px solid #35406b;
  border-radius: 4px;
  padding: 5px 10px;
  font-family: var(--font-pixel);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.rm-filter-btn:hover {
  border-color: var(--neon-cyan);
  color: #ffffff;
}

.rm-filter-btn[aria-pressed="true"] {
  background: rgba(45, 226, 230, 0.18);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(45, 226, 230, 0.25);
}

.rm-filter-btn:focus-visible,
.rm-status-btn:focus-visible,
.rm-card-del:focus-visible,
.rm-input:focus-visible,
.rm-select:focus-visible,
.rm-textarea:focus-visible {
  outline: 2px solid var(--neon-yellow);
  outline-offset: 2px;
}

/* Roadmap Actions Panel (Public + Admin) */
.rm-admin-panel,
.rm-actions-panel {
  background: linear-gradient(180deg, rgba(24, 30, 56, 0.96), rgba(14, 17, 34, 0.98));
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 0 20px rgba(5, 217, 232, 0.16);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rm-admin-panel.is-admin,
.rm-actions-panel.is-admin {
  border-color: var(--neon-pink);
  box-shadow: 0 0 20px rgba(255, 42, 133, 0.18);
}

.rm-admin-panel[hidden],
.rm-actions-panel[hidden] {
  display: none;
}

.rm-admin-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rm-admin-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--neon-pink);
  letter-spacing: 0.06em;
}

.rm-add-form {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
  align-items: end;
}

.rm-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-inline-size: 0;
}

.rm-col-title { grid-column: span 5; }
.rm-col-cat { grid-column: span 3; }
.rm-col-diff { grid-column: span 2; }
.rm-col-ver { grid-column: span 2; }
.rm-col-desc { grid-column: span 9; }
.rm-col-submit { grid-column: span 3; }

@media (max-width: 820px) {
  .rm-col-title, .rm-col-desc { grid-column: span 12; }
  .rm-col-cat, .rm-col-diff, .rm-col-ver { grid-column: span 4; }
  .rm-col-submit { grid-column: span 12; }
}

@media (max-width: 540px) {
  .rm-col-cat, .rm-col-diff, .rm-col-ver { grid-column: span 12; }
}

.rm-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 0.05em;
}

.rm-input,
.rm-select,
.rm-textarea {
  width: 100%;
  font-family: var(--font-pixel);
  font-size: max(1rem, 13px);
  color: #f8fafc;
  background: #0b0e1e;
  border: 1px solid #3c4774;
  border-radius: 4px;
  padding: 7px 10px;
  line-height: 1.35;
}

.rm-textarea {
  resize: vertical;
  min-height: 44px;
}

.rm-input:user-invalid,
.rm-textarea:user-invalid {
  border-color: var(--neon-pink);
}

.rm-prompt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(5, 217, 232, 0.25);
}

.rm-actions-panel.is-admin .rm-prompt-toolbar,
.rm-admin-panel.is-admin .rm-prompt-toolbar {
  border-top-color: rgba(255, 42, 133, 0.35);
}

.rm-selection-control-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rm-select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-pixel);
  font-size: 12px;
  font-weight: 800;
  color: var(--neon-cyan);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 4px;
  background: rgba(5, 217, 232, 0.08);
  border: 1px solid rgba(5, 217, 232, 0.28);
  transition: all 0.15s ease-in-out;
  user-select: none;
}

.rm-select-all-label:hover {
  background: rgba(5, 217, 232, 0.18);
  border-color: var(--neon-cyan);
}

.rm-selection-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: #0b0e1e;
  border: 1px solid #3c4774;
  border-radius: 12px;
  padding: 3px 10px;
  letter-spacing: 0.04em;
  transition: all 0.2s ease;
}

.rm-selection-badge.has-selection {
  color: var(--neon-yellow);
  border-color: var(--neon-yellow);
  background: rgba(255, 211, 25, 0.12);
  box-shadow: 0 0 8px rgba(255, 211, 25, 0.2);
}

.rm-admin-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-pixel);
  font-size: 10.5px;
  font-weight: 800;
  color: var(--neon-pink);
  background: rgba(255, 42, 133, 0.12);
  border: 1px solid var(--neon-pink);
  border-radius: 4px;
  padding: 2px 8px;
  letter-spacing: 0.06em;
}

.rm-admin-badge[hidden] {
  display: none !important;
}

.rm-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rm-prompt-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.rm-live-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--neon-green);
  min-height: 18px;
}

.rm-main-pane {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rm-summary-panel {
  flex: 0 0 auto;
}

/* Task Grid & Cards */
.rm-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
  padding-right: 6px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-yellow) rgba(10, 14, 28, 0.7);
}

.rm-shell #controls-bar {
  flex: 0 0 auto;
}

.rm-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(180deg, #161a2e 0%, #101324 100%);
  border: 2px solid #2e375d;
  border-radius: 7px;
  padding: 13px 14px;
  box-shadow: 0 4px 0 #070913, inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.16s ease, transform 0.12s ease;
}

.rm-card:hover {
  border-color: #4b5996;
}

.rm-card.status-in_progress {
  border-color: rgba(255, 211, 25, 0.55);
}

.rm-card.status-done {
  border-color: rgba(56, 242, 118, 0.45);
  background: linear-gradient(180deg, #121c27 0%, #0d141d 100%);
}

.rm-card.is-selected {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 14px rgba(45, 226, 230, 0.25), 0 4px 0 #070913;
}

.rm-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.rm-badges-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.rm-cat-badge {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--neon-cyan);
  background: rgba(45, 226, 230, 0.12);
  border: 1px solid rgba(45, 226, 230, 0.4);
  border-radius: 3px;
  padding: 2px 6px;
}

.rm-diff-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 800;
  border-radius: 4px;
  padding: 2px 7px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.rm-diff-dot {
  display: inline-block;
  font-size: 11px;
  line-height: 1;
  color: currentColor;
  filter: drop-shadow(0 0 4px currentColor);
}

/* Difficoltà: toni freddi/tecnici con pallino (Smeraldo / Ciano / Indaco-Viola) */
.rm-diff-facile {
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.55);
}

.rm-diff-media {
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.55);
}

.rm-diff-alta {
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.62);
}

.rm-ver-badge {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  color: #e2e8f0;
  background: #1c2240;
  border: 1px solid #414e82;
  border-radius: 3px;
  padding: 2px 7px;
  white-space: nowrap;
}

.rm-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
  text-shadow: 0 1px 2px #000;
}

.rm-card-desc {
  margin: 0;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.42;
}

.rm-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rm-select-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--neon-cyan);
  cursor: pointer;
}

.rm-select-chk {
  width: 16px;
  height: 16px;
  accent-color: var(--neon-cyan);
  cursor: pointer;
}

.rm-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
}

.rm-status-pill,
.rm-status-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-pixel);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  border-radius: 4px;
  padding: 4px 9px;
  border: 1px solid transparent;
}

.rm-status-btn {
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.rm-status-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.rm-status-todo {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.45);
}

.rm-status-in_progress {
  color: #ffd319;
  background: rgba(255, 211, 25, 0.16);
  border-color: rgba(255, 211, 25, 0.65);
}

.rm-status-done {
  color: #38f276;
  background: rgba(56, 242, 118, 0.16);
  border-color: rgba(56, 242, 118, 0.65);
}

.rm-card-del {
  background: #231426;
  border: 1px solid rgba(255, 42, 133, 0.55);
  color: #ff7ab2;
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 12px;
  cursor: pointer;
}

.rm-card-del:hover {
  background: var(--neon-pink);
  color: #ffffff;
}

.rm-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 16px;
  background: #111528;
  border: 2px dashed #323c66;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

/* Native Modal Dialog for Quick Admin Login */
dialog.rm-dialog {
  width: min(440px, 92vw);
  background: #14182c;
  color: var(--text);
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 0 32px rgba(45, 226, 230, 0.35);
}

dialog.rm-dialog:modal {
  overscroll-behavior: contain;
}

dialog.rm-dialog::backdrop {
  background: rgba(6, 8, 18, 0.8);
  overflow: hidden;
  overscroll-behavior: contain;
}

.rm-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.rm-dialog-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--neon-cyan);
}

.rm-login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rm-pass-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rm-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* v0.19 Unified Admin Roadmap Tab & Insert Coin UI */
.admin-rm-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-rm-progress-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  background: #10152a;
  border: 1px solid #2b355c;
  border-radius: 5px;
  padding: 8px 10px;
}

.admin-rm-counters {
  font-size: 11px;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 0.04em;
}

.admin-rm-form {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: end;
  background: #10152a;
  border: 1px solid #354173;
  border-radius: 5px;
  padding: 9px 10px;
}

.admin-rm-preview {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #cbd5e1;
  background: rgba(7, 9, 20, 0.72);
  border: 1px dashed #33406b;
  border-radius: 4px;
  padding: 5px 8px;
}

.admin-rm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-rm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-rm-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: #12172c;
  border: 1px solid #2d365e;
  border-radius: 5px;
  padding: 7px 9px;
}

.admin-rm-row.status-done {
  border-color: rgba(56, 242, 118, 0.45);
  background: #101a25;
}

.admin-rm-row.status-in_progress {
  border-color: rgba(255, 211, 25, 0.55);
}

.admin-rm-row-left {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.admin-rm-row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.credits-pill-btn {
  border-color: var(--neon-yellow) !important;
  color: var(--neon-yellow) !important;
  background: rgba(255, 211, 25, 0.12) !important;
  font-family: var(--font-display);
  font-weight: 800;
}

.credits-pill-btn.ready {
  border-color: var(--neon-green) !important;
  color: var(--neon-green) !important;
  background: rgba(56, 242, 118, 0.14) !important;
}

.coin-cabinet-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  margin: 4px 0 10px;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(22, 27, 50, 0.92), rgba(11, 14, 28, 0.96));
  border: 2px solid var(--neon-yellow);
  border-radius: 6px;
  box-shadow: 0 0 14px rgba(255, 211, 25, 0.2);
}

.coin-credits-readout {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px rgba(255, 211, 25, 0.45);
}

.coin-credits-readout.ready {
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(56, 242, 118, 0.45);
}

.coin-credits-readout.flash {
  animation: coinFlash 0.35s ease;
}

@keyframes coinFlash {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.12); filter: brightness(1.6); }
  100% { transform: scale(1); filter: brightness(1); }
}

.insert-coin-btn {
  background: linear-gradient(180deg, #ffd319 0%, #f59e0b 100%);
  color: #0b0e17;
  border: 2px solid #fff3b0;
  border-radius: 5px;
  padding: 6px 12px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 3px 0 #92400e;
}

.insert-coin-btn:hover {
  filter: brightness(1.1);
}

.insert-coin-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #92400e;
}

/* v0.20 / v0.21 Centered Tall (~92vh) Admin View, Livery Shop, Trophy Room & Time Attack */
#ui-overlay.admin-fullscreen-view {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: 14px 24px;
  background: rgba(7, 9, 20, 0.94);
  backdrop-filter: blur(6px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ui-overlay.admin-fullscreen-view .admin-modal-panel {
  width: min(1280px, 98vw);
  max-width: 1280px;
  height: min(92vh, 92dvh);
  max-height: min(92vh, 92dvh);
  min-height: 0;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#ui-overlay.admin-fullscreen-view .admin-header-row,
#ui-overlay.admin-fullscreen-view .admin-tabs,
#ui-overlay.admin-fullscreen-view .save-feedback,
#ui-overlay.admin-fullscreen-view .overlay-actions {
  flex: 0 0 auto;
}

#ui-overlay.admin-fullscreen-view .admin-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-cyan) rgba(10, 14, 28, 0.7);
}

@media (max-height: 520px) {
  #ui-overlay.admin-fullscreen-view {
    overflow-y: auto;
    align-items: flex-start;
  }
  #ui-overlay.admin-fullscreen-view .admin-modal-panel {
    height: auto;
    max-height: none;
  }
}

.admin-rm-form-wide {
  grid-template-columns: 1.8fr 1fr 1fr;
}

.admin-rm-edit-banner {
  background: rgba(255, 211, 25, 0.14);
  border: 1.5px solid var(--neon-yellow);
  border-radius: 5px;
  color: #fef08a;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 10px;
  margin-bottom: 8px;
}

.admin-rm-row.is-editing {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 12px rgba(255, 211, 25, 0.24);
}

.rm-card-edit {
  background: rgba(45, 226, 230, 0.14);
  color: var(--neon-cyan);
  border: 1px solid var(--neon-cyan);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.rm-card-edit:hover {
  background: rgba(45, 226, 230, 0.28);
}

/* Livery Shop Grid inside Garage */
.livery-shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.livery-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #12172c;
  border: 1.5px solid #2d3761;
  border-radius: 5px;
  padding: 6px 8px;
  color: #f8fafc;
  cursor: pointer;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
}

.livery-chip.active {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 10px rgba(255, 211, 25, 0.28);
}

.livery-chip:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.livery-swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}

.livery-chip-name {
  flex: 1;
  min-width: 0;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.15;
  font-size: 11.5px;
  font-weight: 800;
}

/* ==========================================================================
   v0.25 — GARAGE '86 FULL-STAGE ZERO-SCROLL, PIXEL-ART UI & ADMIN RESTYLING
   ========================================================================== */
.ui-inline-px-icon {
  display: inline-block;
  vertical-align: -3px;
  image-rendering: pixelated;
  flex-shrink: 0;
  margin-right: 4px;
}

.arcade-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.roadmap-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.insert-coin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Full-Stage Garage '86 (covers entire cabinet stage including Hall of Fame) */
#stage-layout.garage-fullstage #leaderboard-panel {
  display: none !important;
}

#stage-layout.garage-fullstage #screen-frame {
  width: 100% !important;
  max-width: 100% !important;
  flex: 1 1 100%;
  aspect-ratio: auto;
  height: clamp(560px, calc(94dvh - 80px), 890px);
}

#arcade-cabinet.size-medium #stage-layout.garage-fullstage #screen-frame {
  height: clamp(540px, calc(87dvh - 82px), 780px);
}

#arcade-cabinet.size-full #stage-layout.garage-fullstage #screen-frame {
  height: calc(100dvh - 76px);
}

#ui-overlay.garage-view {
  padding: 0 !important;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, rgba(23, 30, 62, 0.98) 0%, rgba(8, 11, 22, 0.99) 100%);
}

#ui-overlay.garage-view .garage-panel {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 10px 16px 12px;
  border: none;
  border-radius: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow: clip;
  text-align: left;
}

.garage-top-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 12px;
  background: linear-gradient(180deg, rgba(22, 29, 58, 0.96), rgba(11, 15, 31, 0.98));
  border: 2px solid rgba(45, 226, 230, 0.55);
  border-radius: 7px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  flex: 0 0 auto;
}

.garage-top-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  min-width: 0;
  flex: 1 1 auto;
}

.garage-brand-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.garage-title-line {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.garage-main-title {
  font-size: 21px !important;
  margin: 0 !important;
  line-height: 1.1;
  letter-spacing: 0.06em;
}

.garage-sub-pill {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--neon-cyan);
  background: rgba(45, 226, 230, 0.14);
  border: 1px solid rgba(45, 226, 230, 0.48);
  border-radius: 4px;
  padding: 2px 7px;
}

.garage-util-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.garage-util-btn {
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  background: #171e3a;
  color: #cbd5e1;
  border: 1.5px solid #384575;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.garage-util-btn:hover {
  border-color: var(--neon-cyan);
  color: #ffffff;
  background: #202a52;
}

.garage-util-btn.is-danger-util {
  border-color: rgba(244, 63, 94, 0.55);
  color: #fda4af;
  background: rgba(127, 29, 29, 0.28);
}

.garage-util-btn.is-danger-util:hover {
  border-color: #fb7185;
  color: #ffffff;
  background: rgba(190, 18, 60, 0.55);
}

.garage-pilot-inline {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 11px;
  background: rgba(8, 11, 24, 0.78);
  border: 1.5px solid #2e3966;
  border-radius: 6px;
}

.garage-input-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

.garage-input-group label {
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 2px;
}

.required-indicator {
  font-family: var(--font-pixel);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ff3b3b;
  text-shadow: 0 0 6px rgba(255, 59, 59, 0.75);
  margin-left: 3px;
  vertical-align: middle;
}

.garage-input-group .score-input {
  width: 154px;
  padding: 4px 8px;
  font-size: 14px;
  height: 31px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.garage-num-group .score-input {
  width: 68px;
  text-align: center;
  color: var(--neon-yellow);
}

/* ==========================================================================
   VALIDAZIONE NOME PILOTA PRE-GARA (ARCADE VALIDATION & SHAKE)
   ========================================================================== */

@keyframes shake-horizontal {
  0%, 100% {
    transform: translateX(0);
  }
  20%, 60% {
    transform: translateX(-5px);
  }
  40%, 80% {
    transform: translateX(5px);
  }
}

@keyframes pilot-neon-glow {
  0% {
    border-color: #ff3b3b;
    box-shadow: 0 0 8px rgba(255, 59, 59, 0.8), inset 0 0 4px rgba(255, 59, 59, 0.5);
  }
  100% {
    border-color: #ff6b6b;
    box-shadow: 0 0 18px rgba(255, 59, 59, 1), 0 0 24px rgba(255, 59, 59, 0.5), inset 0 0 8px rgba(255, 59, 59, 0.7);
  }
}

.input-required-shake {
  border-color: #ff3b3b !important;
  color: #ffffff !important;
  background: #250b12 !important;
  animation: shake-horizontal 0.42s ease-in-out both, pilot-neon-glow 0.8s ease-in-out infinite alternate !important;
  will-change: transform, box-shadow, border-color;
}

html.mobile-touch-mode .input-required-shake {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

#pilot-name-error,
.pilot-name-error {
  display: block;
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.03em;
  color: #ffffff;
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.95), rgba(153, 27, 27, 0.95));
  border: 1.5px solid #ff3b3b;
  border-radius: 4px;
  padding: 3px 6px;
  margin-top: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 6px rgba(255, 59, 59, 0.8);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.65), 0 0 10px rgba(255, 59, 59, 0.4);
  max-width: 250px;
  word-break: break-word;
  pointer-events: none;
  animation: fadeInPilotError 0.18s ease-out;
}

#pilot-name-error.hidden,
.pilot-name-error.hidden {
  display: none !important;
}

@keyframes fadeInPilotError {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.garage-top-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.garage-wallet-strip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
}

.garage-wallet-strip .wrench-wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  padding: 3px 10px;
}

.garage-start-cta-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
  min-width: 276px;
}

.garage-race-go-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #05130b;
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 52%, #16a34a 100%);
  border: 2.5px solid #dcfce7;
  border-radius: 7px;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  box-shadow:
    0 4px 0 #14532d,
    0 0 22px rgba(56, 242, 118, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: transform 0.1s ease, filter 0.14s ease, box-shadow 0.14s ease;
}

.garage-race-go-btn .cta-sub {
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #052e16;
}

.garage-race-go-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow:
    0 4px 0 #14532d,
    0 0 30px rgba(74, 222, 128, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.garage-race-go-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #14532d, 0 0 18px rgba(56, 242, 118, 0.5);
}

.garage-race-go-btn:disabled,
.garage-race-go-btn.is-locked-credits {
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  color: #cbd5e1;
  border-color: #f59e0b;
  text-shadow: 0 1px 2px #000;
  box-shadow: 0 3px 0 #0f172a, 0 0 14px rgba(245, 158, 11, 0.28);
  cursor: not-allowed;
  opacity: 0.92;
}

.garage-race-go-btn:disabled .cta-sub,
.garage-race-go-btn.is-locked-credits .cta-sub {
  color: #fde047;
}

.garage-credit-warning {
  margin: 0 !important;
  min-height: 15px;
  font-size: 10.5px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.03em;
}

.garage-credit-warning.is-missing {
  color: #fde047;
  text-shadow: 0 1px 2px #000;
}

.garage-credit-warning.is-ready {
  color: #4ade80;
  text-shadow: 0 1px 2px #000;
}

/* Central 2-Column Grid (~62% Telai / ~38% Motori + Livree) — Zero Scroll on Desktop >= 1280px */
.garage-main-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 62fr) minmax(0, 38fr);
  gap: 14px;
  overflow: hidden;
}

.garage-col-left,
.garage-col-right {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.garage-col-left .garage-col-title,
.garage-col-right .garage-col-title {
  margin: 0;
  padding-bottom: 3px;
  font-size: 12px;
  letter-spacing: 0.06em;
  flex: 0 0 auto;
}

.garage-liv-heading {
  margin-top: 4px !important;
}

.garage-chassis-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.garage-chassis-card {
  min-width: 0;
  min-height: 0;
  padding: 6px 9px !important;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(20, 26, 52, 0.95) 0%, rgba(12, 16, 33, 0.98) 100%);
  border: 2px solid #2c3763;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.1s ease;
}

.garage-chassis-card:hover:not(:disabled) {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 14px rgba(45, 226, 230, 0.25);
}

.garage-chassis-card.active {
  border-color: var(--neon-yellow) !important;
  background: linear-gradient(180deg, rgba(35, 43, 82, 0.98) 0%, rgba(18, 24, 48, 0.99) 100%) !important;
  box-shadow: 0 0 16px rgba(255, 211, 25, 0.34), inset 0 0 10px rgba(255, 211, 25, 0.1) !important;
}

.garage-card.is-locked-card:disabled {
  opacity: 0.78;
}

.garage-card.is-locked-card:not(.is-special-phantom):not(.is-panoramic-engine) {
  background: linear-gradient(180deg, rgba(13, 17, 34, 0.96) 0%, rgba(8, 10, 22, 0.98) 100%);
  border-color: #242d4f;
}

/* Special Purple/Gold Frame for PHANTOM-86 */
.garage-chassis-card.is-special-phantom {
  border: 2px solid #c084fc;
  background: linear-gradient(135deg, rgba(46, 16, 101, 0.72) 0%, rgba(20, 22, 46, 0.96) 58%, rgba(66, 32, 6, 0.65) 100%);
  box-shadow:
    0 0 16px rgba(178, 64, 234, 0.42),
    inset 0 0 12px rgba(238, 184, 28, 0.2);
}

.garage-chassis-card.is-special-phantom.active {
  border-color: #facc15 !important;
  box-shadow:
    0 0 22px rgba(250, 204, 21, 0.55),
    0 0 14px rgba(178, 64, 234, 0.55),
    inset 0 0 14px rgba(250, 204, 21, 0.24) !important;
}

.chassis-preview-stage {
  position: relative;
  width: 94px;
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, #17203f 0%, #090d1b 100%);
  border: 1.5px solid rgba(148, 163, 184, 0.28);
  border-radius: 5px;
}

.chassis-preview-stage.is-locked-stage,
.engine-sprite-box.is-locked-stage {
  background: radial-gradient(circle at 50% 50%, #161e36 0%, #070912 100%);
  border-color: rgba(46, 58, 86, 0.85);
}

.preview-lock-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.95));
}

.preview-lock-overlay.is-sm {
  width: 18px;
  height: 18px;
}

.garage-chassis-card.is-special-phantom .chassis-preview-stage {
  border-color: rgba(250, 204, 21, 0.65);
  background: radial-gradient(circle at 50% 50%, #2e1065 0%, #090b16 100%);
}

.car-preview-canvas {
  display: block;
  width: 88px;
  height: 52px;
  aspect-ratio: 88 / 52;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.car-preview-canvas.engine-preview-canvas {
  width: 58px;
  height: 44px;
  aspect-ratio: 64 / 48;
  background: transparent;
  border: none;
}

.phantom-special-ribbon {
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, #9333ea, #eab308);
  color: #ffffff;
  border: 1px solid #fef08a;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000;
}

.garage-chassis-card .garage-card-info {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chassis-title-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.chassis-helmet-img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}

.garage-chassis-card .chassis-title-text {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chassis-badge.is-unlock-cta {
  background: rgba(100, 116, 139, 0.24);
  border: 1px solid #64748b;
  color: #cbd5e1;
}

.chassis-badge.is-unlock-cta.can-buy {
  background: linear-gradient(180deg, rgba(56, 242, 118, 0.3) 0%, rgba(22, 163, 74, 0.28) 100%);
  border-color: #4ade80;
  color: #86efac;
  box-shadow: 0 0 8px rgba(56, 242, 118, 0.25);
}

.chassis-badge.is-unlock-cta.is-locked-insufficient {
  background: rgba(127, 29, 29, 0.35);
  border-color: rgba(248, 113, 113, 0.55);
  color: #fca5a5;
}

.chassis-body-split {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

/* 4 Thick Vertical 10-Tick Columns (VEL, ACC, GRP, COR) */
.stat-v-group {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 2px 5px;
  background: rgba(6, 9, 20, 0.72);
  border: 1px solid rgba(56, 69, 117, 0.6);
  border-radius: 4px;
  flex-shrink: 0;
}

.stat-v-group.is-locked-dimmed {
  opacity: 0.36;
  filter: saturate(0.42);
}

.stat-v-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-v-track {
  display: flex;
  flex-direction: column-reverse;
  gap: 1px;
}

.stat-v-sq {
  width: 8px;
  height: 3px;
  border-radius: 1px;
  background: rgba(51, 65, 85, 0.45);
}

.stat-v-lbl {
  font-family: var(--font-display);
  font-size: 7.5px;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* Live Dynamic Tech Sheet (Unlocked) & Top-Secret Veil (Locked) */
.chassis-tech-box {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.chassis-tech-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.tech-chip {
  font-family: var(--font-pixel);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.1;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(23, 32, 63, 0.9);
  border: 1px solid rgba(99, 102, 241, 0.38);
  color: #e2e8f0;
  white-space: nowrap;
}

.tech-chip.is-hp {
  border-color: rgba(255, 107, 53, 0.55);
  color: #fdba74;
}

.chassis-specialty-tag {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #2de2e6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.garage-chassis-card .chassis-desc {
  font-size: 9.5px;
  line-height: 1.15;
  color: #cbd5e1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chassis-locked-veil {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 3px 6px;
  background: repeating-linear-gradient(
    -45deg,
    rgba(15, 23, 42, 0.85),
    rgba(15, 23, 42, 0.85) 6px,
    rgba(30, 41, 59, 0.72) 6px,
    rgba(30, 41, 59, 0.72) 12px
  );
  border: 1px dashed rgba(100, 116, 139, 0.7);
  border-radius: 4px;
}

.locked-veil-title {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #fde047;
  line-height: 1.2;
}

.locked-veil-sub {
  font-size: 9px;
  line-height: 1.15;
  color: #94a3b8;
}

/* Right Column: 5 Engines (2x2 + Golden Panoramic 5th) + 8 Liveries (2x4) — Zero Scroll */
.garage-engine-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1.18 1 0;
  min-height: 0;
}

.garage-engine-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 6px;
  flex: 2 1 0;
  min-height: 0;
}

.garage-engine-card {
  min-width: 0;
  min-height: 0;
  padding: 5px 8px !important;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(19, 25, 50, 0.95), rgba(11, 15, 30, 0.98));
  border: 2px solid #2c3763;
}

.garage-engine-card.active {
  border-color: var(--neon-cyan) !important;
  box-shadow: 0 0 14px rgba(45, 226, 230, 0.3) !important;
}

.garage-engine-card .garage-card-head strong {
  font-family: var(--font-display);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.garage-engine-card.is-panoramic-engine {
  flex: 0.92 0 auto;
  border: 2px solid #eab308;
  background: linear-gradient(135deg, rgba(66, 32, 6, 0.65) 0%, rgba(22, 24, 48, 0.96) 52%, rgba(88, 28, 135, 0.55) 100%);
  box-shadow: 0 0 14px rgba(234, 179, 8, 0.25), inset 0 0 10px rgba(250, 204, 21, 0.14);
}

.garage-engine-card.is-panoramic-engine.active {
  border-color: #fef08a !important;
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.52), inset 0 0 12px rgba(250, 204, 21, 0.22) !important;
}

.engine-sprite-box {
  position: relative;
  width: 62px;
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, #1a2448 0%, #090d1b 100%);
  border: 1.5px solid rgba(45, 226, 230, 0.35);
  border-radius: 5px;
}

.garage-engine-card.is-panoramic-engine .engine-sprite-box {
  border-color: rgba(250, 204, 21, 0.68);
  background: radial-gradient(circle at 50% 50%, #3b1d0a 0%, #090b16 100%);
}

.engine-gold-ribbon {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 7.5px;
  font-weight: 900;
  padding: 0 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #ca8a04, #facc15);
  color: #090d1a;
  border: 1px solid #fef08a;
  white-space: nowrap;
}

.engine-desc-text {
  font-size: 10px;
  line-height: 1.2;
  color: #cbd5e1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.engine-desc-text.engine-locked-text {
  color: #fde047;
  font-size: 9.5px;
}

#ui-overlay.garage-view .livery-shop-grid {
  flex: 0.92 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

#ui-overlay.garage-view .livery-chip {
  padding: 5px 8px;
  gap: 7px;
  min-height: 0;
  border-radius: 5px;
}

/* Anti-Error Reset Career Confirmation Dialog */
.career-confirm-backdrop {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: rgba(4, 6, 15, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.career-confirm-dialog {
  width: min(460px, 100%);
  background: linear-gradient(180deg, #171c36 0%, #0b0e1e 100%);
  border: 2px solid #f43f5e;
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 24px rgba(244, 63, 94, 0.35);
  text-align: left;
}

.career-confirm-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 18px;
  color: #fda4af;
  letter-spacing: 0.05em;
}

.career-confirm-desc {
  margin: 0 0 10px;
  font-size: 13px;
  color: #e2e8f0;
}

.career-confirm-list {
  margin: 0 0 16px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: #cbd5e1;
}

.career-confirm-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.career-danger-btn {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  padding: 8px 14px;
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  color: #ffffff;
  border: 2px solid #fecaca;
  border-radius: 5px;
  cursor: pointer;
}

.career-danger-btn:hover {
  filter: brightness(1.1);
}

/* Responsive fallback below 1280px or very short screens */
@media (max-width: 1279px), (max-height: 670px) {
  #ui-overlay.garage-view .garage-panel {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .garage-top-header {
    flex-wrap: wrap;
  }
  .garage-main-grid {
    overflow: visible;
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr);
  }
  .garage-chassis-grid,
  .garage-engine-grid-4,
  .garage-engine-wrap,
  #ui-overlay.garage-view .livery-shop-grid {
    grid-template-rows: none;
    flex: 0 0 auto;
  }
}

@media (max-width: 720px) {
  .garage-chassis-grid,
  .garage-engine-grid-4,
  #ui-overlay.garage-view .livery-shop-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Unified Admin Console Restyling (8 Telai, 15 Upgrade, Regole Pista, Roadmap, Sicurezza) */
#ui-overlay.admin-fullscreen-view .admin-modal-panel {
  width: min(1420px, 97dvw);
  max-width: 1420px;
  height: min(93vh, 93dvh);
  max-height: min(93vh, 93dvh);
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.85), 0 0 28px rgba(45, 226, 230, 0.22);
}

.admin-tabs,
#admin-tabs-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  overflow: visible;
  padding-bottom: 2px;
  margin-bottom: 10px;
}

@media (max-width: 900px) {
  .admin-tabs,
  #admin-tabs-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.admin-tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 6px 8px;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(180deg, #171e3b 0%, #10152b 100%);
  color: #a5b4fc;
  border: 1.5px solid #354170;
  border-radius: 6px;
  cursor: pointer;
  text-shadow: 0 1px 2px #000;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.admin-tab-btn:hover {
  border-color: var(--neon-cyan);
  color: #ffffff;
}

.admin-tab-btn[aria-selected="true"],
.admin-tab-btn.active {
  background: linear-gradient(180deg, rgba(45, 226, 230, 0.22) 0%, rgba(18, 30, 58, 0.96) 100%);
  border-color: var(--neon-cyan);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(45, 226, 230, 0.28);
}

.admin-tab-btn[aria-selected="true"]::after,
.admin-tab-btn.active::after {
  content: '';
  position: absolute;
  inset-inline: 8px;
  bottom: 0;
  border-block-end: 3px solid var(--neon-yellow);
}

.admin-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 28px;
  background: rgba(8, 12, 26, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 4px;
  flex-shrink: 0;
}

.admin-tab-px-img,
.admin-tab-car-img {
  display: block;
  image-rendering: pixelated;
}

.admin-scroll-body {
  overscroll-behavior: contain;
  padding: 12px !important;
  background: rgba(8, 11, 22, 0.84) !important;
  border: 1.5px solid #28335c !important;
  border-radius: 6px !important;
}

.admin-section-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 7px;
  background: linear-gradient(90deg, rgba(22, 31, 64, 0.96) 0%, rgba(12, 17, 35, 0.96) 100%);
  border: 1.5px solid rgba(45, 226, 230, 0.5);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.admin-section-banner.theme-purple {
  border-color: rgba(192, 132, 252, 0.58);
}

.admin-banner-title {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 900;
  color: var(--neon-yellow);
  letter-spacing: 0.04em;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 2px 6px rgba(0, 0, 0, 0.9);
}

.admin-banner-sub {
  font-size: 12px;
  color: #cbd5e1;
  margin-top: 2px;
}

.admin-px-badge {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: radial-gradient(circle at 50% 50%, #1d2850 0%, #090d1b 100%);
  border: 2px solid rgba(45, 226, 230, 0.65);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7), 0 0 12px rgba(45, 226, 230, 0.22);
}

.admin-px-badge.theme-gold {
  border-color: rgba(250, 204, 21, 0.75);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7), 0 0 12px rgba(250, 204, 21, 0.25);
}

.admin-px-badge.theme-green {
  border-color: rgba(74, 222, 128, 0.72);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7), 0 0 12px rgba(74, 222, 128, 0.24);
}

.admin-px-badge.theme-purple {
  border-color: rgba(192, 132, 252, 0.75);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7), 0 0 12px rgba(192, 132, 252, 0.26);
}

.admin-px-badge.theme-pink {
  border-color: rgba(255, 42, 133, 0.75);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7), 0 0 12px rgba(255, 42, 133, 0.26);
}

.admin-px-icon,
.admin-px-icon-car {
  display: block;
  image-rendering: pixelated;
}

/* Rich Tables for 8 Telai & 15 Upgrade */
.admin-table-rich th {
  font-size: 11.5px !important;
  padding: 9px 10px !important;
  background: rgba(20, 27, 54, 0.92);
  border-bottom: 2px solid rgba(45, 226, 230, 0.45) !important;
  letter-spacing: 0.05em;
}

.admin-table-rich td {
  padding: 9px 10px !important;
  vertical-align: middle;
  border-bottom: 1px solid rgba(56, 70, 118, 0.5) !important;
}

.admin-table-rich tbody tr:hover {
  background: rgba(30, 41, 82, 0.36);
}

.admin-row-special {
  background: linear-gradient(90deg, rgba(88, 28, 135, 0.22), rgba(113, 63, 18, 0.16));
}

.admin-chassis-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-chassis-preview-box {
  width: 96px;
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, #1a2448 0%, #090d1a 100%);
  border: 2px solid rgba(45, 226, 230, 0.45);
  border-radius: 6px;
}

.admin-chassis-preview-box.is-special {
  border-color: #eab308;
  box-shadow: 0 0 12px rgba(178, 64, 234, 0.45);
}

.admin-chassis-sprite {
  display: block;
  width: 88px;
  height: 52px;
  aspect-ratio: 88 / 52;
  image-rendering: pixelated;
}

.admin-item-meta {
  min-width: 0;
}

.admin-item-title {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.03em;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 2px 5px rgba(0, 0, 0, 0.85);
}

.admin-item-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.32;
  margin-top: 2px;
}

.admin-special-pill,
.admin-tag-chip {
  display: inline-block;
  vertical-align: middle;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 5px;
}

.admin-special-pill {
  background: linear-gradient(90deg, #9333ea, #eab308);
  color: #ffffff;
  border: 1px solid #fef08a;
}

.admin-tag-chip {
  background: rgba(45, 226, 230, 0.14);
  color: #a5f3fc;
  border: 1px solid rgba(45, 226, 230, 0.4);
}

/* Restyled Regole Pista & Sicurezza Cards */
.admin-rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px !important;
}

.admin-rule-card {
  background: linear-gradient(180deg, #151c38 0%, #0d1226 100%) !important;
  border: 2px solid #303d6e !important;
  border-radius: 8px !important;
  padding: 0 !important;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  gap: 0 !important;
}

.admin-rule-card.theme-cyan { border-color: rgba(45, 226, 230, 0.55) !important; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 0 14px rgba(45, 226, 230, 0.12); }
.admin-rule-card.theme-gold { border-color: rgba(250, 204, 21, 0.58) !important; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 0 14px rgba(250, 204, 21, 0.12); }
.admin-rule-card.theme-green { border-color: rgba(74, 222, 128, 0.55) !important; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 0 14px rgba(74, 222, 128, 0.12); }
.admin-rule-card.theme-purple { border-color: rgba(192, 132, 252, 0.58) !important; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 0 14px rgba(192, 132, 252, 0.14); }
.admin-rule-card.theme-pink { border-color: rgba(255, 42, 133, 0.58) !important; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 0 14px rgba(255, 42, 133, 0.14); }

.admin-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: linear-gradient(90deg, rgba(26, 35, 70, 0.95) 0%, rgba(15, 21, 44, 0.95) 100%);
  border-bottom: 1.5px solid rgba(148, 163, 184, 0.22);
}

.admin-card-titles {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.admin-card-title {
  display: block;
  font-family: var(--font-display) !important;
  font-size: 15.5px !important;
  font-weight: 800 !important;
  line-height: 1.2;
  color: #ffffff !important;
  letter-spacing: 0.03em;
  text-shadow:
    -1px -1px 0 #050711,
     1px -1px 0 #050711,
    -1px  1px 0 #050711,
     1px  1px 0 #050711,
     0 2px 6px rgba(0, 0, 0, 0.9);
}

.admin-rule-card .admin-rule-hint {
  font-size: 12px !important;
  color: #cbd5e1 !important;
  line-height: 1.32 !important;
}

.admin-rule-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 14px;
}

.admin-ctrl-pair {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: rgba(9, 13, 28, 0.85);
  border: 1px solid #334173;
  border-radius: 6px;
  cursor: pointer;
}

.admin-ctrl-pair span {
  font-size: 12.5px;
  font-weight: 700;
  color: #e2e8f0;
}

.admin-ctrl-pair.is-accent-gold {
  border-color: rgba(250, 204, 21, 0.5);
}

.admin-ctrl-pair.is-accent-gold span {
  color: #fef08a;
}

.admin-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: rgba(16, 44, 34, 0.55);
  border: 1.5px solid rgba(74, 222, 128, 0.55);
  border-radius: 6px;
  cursor: pointer;
}

.admin-toggle-pill input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #38f276;
  cursor: pointer;
}

.admin-toggle-pill span {
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
}

.admin-num-lg {
  width: 78px !important;
  padding: 6px 9px !important;
  font-size: 14px !important;
  border-radius: 5px !important;
  border: 1.5px solid #4f5f99 !important;
  background: #0c1124 !important;
  text-align: center;
}

.admin-select-lg {
  padding: 6px 10px !important;
  font-size: 13.5px !important;
  border-radius: 5px !important;
  border: 1.5px solid #4f5f99 !important;
  background: #0c1124 !important;
  color: #f8fafc !important;
}

.admin-input-lg {
  padding: 7px 10px !important;
  font-size: 13.5px !important;
  border-radius: 5px !important;
  border: 1.5px solid #4f5f99 !important;
  background: #0c1124 !important;
}

.admin-sec-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 14px;
}

.admin-sec-stack label {
  font-size: 12px !important;
  font-weight: 800 !important;
  color: #a5f3fc !important;
}

@media (max-width: 920px) {
  .admin-rules-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .admin-rule-card[style*="span 2"] {
    grid-column: span 1 !important;
  }
}

/* Trophy Room Modal */
.trophy-modal-panel,
.timeattack-modal-panel {
  background: rgba(10, 12, 26, 0.96);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 32px rgba(45, 226, 230, 0.25);
  border-radius: 6px;
  padding: 18px 20px;
  text-align: left;
  width: min(860px, 95%);
  max-height: 92%;
  overflow-y: auto;
}

.trophy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 8px;
}

.trophy-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  border-radius: 5px;
  border: 1.5px solid #2b355c;
  background: #0f1428;
}

.trophy-card.unlocked {
  border-color: var(--neon-yellow);
  background: linear-gradient(180deg, rgba(255, 211, 25, 0.12), #10162d);
}

.trophy-card.locked {
  opacity: 0.62;
}

.trophy-icon {
  font-size: 22px;
  line-height: 1;
}

.trophy-title {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  color: #ffffff;
}

.trophy-desc {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.3;
}

.trophy-badge {
  align-self: flex-start;
  font-size: 9.5px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 3px;
  background: #1e293b;
  color: #94a3b8;
}

.trophy-badge.on {
  background: var(--neon-yellow);
  color: #090d16;
}

/* Time Attack Track Selector */
.ta-track-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 8px;
}

.ta-track-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #12172c;
  border: 1.5px solid #2f3b69;
  border-radius: 5px;
  color: #f8fafc;
  cursor: pointer;
  text-align: left;
}

.ta-track-card:hover {
  border-color: var(--neon-cyan);
  background: #17203e;
}

.ta-minimap-canvas {
  display: block;
  width: 108px;
  height: 61px;
  aspect-ratio: 16 / 9;
  background: #070a14;
  border: 1px solid #33406b;
  border-radius: 4px;
  flex-shrink: 0;
}

.ta-track-name {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  color: var(--neon-yellow);
}

.ta-track-meta {
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 2px;
}

.ta-track-best {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--neon-cyan);
  margin-top: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--neon-yellow);
  outline-offset: 2px;
}

/* v0.21 Pre-Race Strategy Selector & G.niK Creator Ghost Button */
.ghost-creator-btn {
  border: 2px solid #c084fc;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.28), rgba(255, 42, 133, 0.22));
  color: #f5d0fe;
  text-shadow: 0 1px 2px #000;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.25);
}

.ghost-creator-btn:hover {
  border-color: #f0abfc;
  background: linear-gradient(135deg, rgba(192, 132, 252, 0.4), rgba(255, 42, 133, 0.34));
  box-shadow: 0 0 18px rgba(192, 132, 252, 0.48);
}

.pre-race-panel {
  width: min(680px, 95%);
  background: rgba(11, 15, 31, 0.96);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 28px rgba(45, 226, 230, 0.25);
  border-radius: 6px;
  padding: 14px 18px;
  text-align: left;
}

.pre-race-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.strategy-fieldset {
  border: 1.5px solid #2b3868;
  border-radius: 5px;
  background: #0d1226;
  padding: 8px 10px 10px;
  margin: 0;
}

.strategy-legend {
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 800;
  color: var(--neon-cyan);
  padding: 0 6px;
  letter-spacing: 0.4px;
}

.strategy-radio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.strategy-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: #141b36;
  border: 2px solid #28335e;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.strategy-option:hover {
  border-color: var(--neon-cyan);
}

.strategy-option:has(input:checked) {
  border-color: var(--neon-yellow);
  background: #1d254a;
  box-shadow: 0 0 12px rgba(255, 211, 25, 0.26);
}

.strategy-option input[type="radio"] {
  margin-top: 3px;
  accent-color: #ffd319;
  transform: scale(1.15);
  cursor: pointer;
}

.strategy-opt-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.strategy-opt-title {
  font-size: 12.5px;
  font-weight: 900;
  color: #f8fafc;
}

.strategy-opt-desc {
  font-size: 11px;
  line-height: 1.3;
  color: #cbd5e1;
}

.pilot-name-contrast {
  text-shadow:
    -1px -1px 0 #05070e,
    1px -1px 0 #05070e,
    -1px 1px 0 #05070e,
    1px 1px 0 #05070e,
    0 1px 3px rgba(0, 0, 0, 0.9);
}

/* ==========================================================================
   v0.26 — ADMIN PER-TRACK RULES BAR & 5-ENGINE TUNING CONTROLS
   ========================================================================== */
.admin-track-scope-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(22, 30, 62, 0.96), rgba(11, 16, 34, 0.98));
  border: 2px solid rgba(45, 226, 230, 0.65);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 16px rgba(45, 226, 230, 0.16);
}

.admin-track-scope-bar.is-custom-scope {
  border-color: #ffd319;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 18px rgba(255, 211, 25, 0.24);
}

.admin-track-scope-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  flex: 1 1 460px;
  min-width: 0;
}

.admin-track-scope-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #ffd319;
  white-space: nowrap;
}

.admin-track-scope-select {
  min-width: 280px;
  max-width: 440px;
  flex: 1 1 280px;
  font-weight: 800;
  border-width: 2px;
  border-color: #38bdf8;
  background: #090e20;
  color: #f8fafc;
}

.admin-scope-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.admin-scope-status.is-global {
  color: #67e8f9;
  background: rgba(6, 182, 212, 0.16);
  border: 1px solid rgba(45, 226, 230, 0.5);
}

.admin-scope-status.is-custom {
  color: #fef08a;
  background: rgba(234, 179, 8, 0.22);
  border: 1.5px solid #facc15;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.25);
}

.admin-scope-status.is-inherit {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.admin-track-scope-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-scope-btn {
  padding: 8px 14px !important;
  font-size: 11.5px !important;
  white-space: nowrap;
}

.admin-scope-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.admin-rule-card.is-global-only-card {
  opacity: 0.56;
  filter: saturate(0.65);
}

.admin-ctrl-pair.is-disabled-pair {
  opacity: 0.52;
}

.admin-global-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 9.5px;
  font-weight: 800;
  border-radius: 4px;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #475569;
  vertical-align: middle;
}

/* ==========================================================================
   v0.27 — ADMIN LEADERBOARD & GHOST RESET CARD + ANTI-MISCLICK MODAL
   ========================================================================== */
.admin-hof-mgmt-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 9px 14px;
  margin-bottom: 10px;
  border-radius: 7px;
  background: linear-gradient(90deg, rgba(38, 22, 52, 0.94) 0%, rgba(18, 22, 44, 0.96) 100%);
  border: 1.5px solid rgba(255, 211, 25, 0.6);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.45), 0 0 14px rgba(255, 211, 25, 0.14);
}

.admin-hof-mgmt-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.admin-hof-mgmt-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #ffd319;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
}

.admin-hof-mgmt-stats {
  font-size: 12px;
  color: #cbd5e1;
}

.admin-hof-mgmt-stats strong {
  color: #67e8f9;
}

.admin-hof-mgmt-toast {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #38f276;
  background: rgba(56, 242, 118, 0.14);
  border: 1px solid rgba(56, 242, 118, 0.55);
}

.admin-hof-mgmt-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.admin-hof-wipe-chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: #e2e8f0;
  background: rgba(11, 16, 34, 0.86);
  border: 1px solid #3f4c7a;
  cursor: pointer;
  user-select: none;
}

.admin-hof-wipe-chk input[type="checkbox"] {
  accent-color: #ff2a85;
  cursor: pointer;
}

.admin-danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #fff1f2;
  background: linear-gradient(180deg, #be123c 0%, #881337 100%);
  border: 1.5px solid #fb7185;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5), 0 0 10px rgba(244, 63, 94, 0.25);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s ease, filter 0.14s ease, border-color 0.14s ease;
}

.admin-danger-btn:hover:not(:disabled) {
  filter: brightness(1.14);
  border-color: #ffd319;
  transform: translateY(-1px);
}

.admin-danger-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.admin-danger-btn.is-purple-danger {
  background: linear-gradient(180deg, #7e22ce 0%, #4c1d95 100%);
  border-color: #c084fc;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5), 0 0 10px rgba(192, 132, 252, 0.25);
}

.admin-reset-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 6, 14, 0.82);
  backdrop-filter: blur(4px);
}

.admin-reset-confirm-box {
  width: min(500px, 94vw);
  padding: 20px 22px;
  border-radius: 10px;
  background: linear-gradient(180deg, #161c38 0%, #0b0f22 100%);
  border: 2px solid #fb7185;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9), 0 0 26px rgba(244, 63, 94, 0.35);
  color: #f8fafc;
}

.admin-reset-confirm-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #ffd319;
  margin-bottom: 10px;
}

.admin-reset-confirm-body {
  font-size: 13.5px;
  line-height: 1.5;
  color: #e2e8f0;
  margin-bottom: 18px;
}

.admin-reset-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   v0.28 — ADMIN REGOLE PISTA LIVE MINIMAP PREVIEW & COMPACT GRID
   ========================================================================== */
.admin-track-scope-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  margin-block-end: 12px;
  flex: 0 0 auto;
  border: 1.5px solid var(--border);
  background: rgba(13, 18, 36, 0.75);
  border-radius: 6px;
}

.admin-track-scope-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  flex: 1 1 auto;
  min-inline-size: 0;
}

.admin-track-scope-left {
  flex: 0 1 auto;
  gap: 8px 10px;
}

.admin-track-scope-actions {
  gap: 8px 10px;
}

.admin-track-scope-select {
  height: 34px;
  padding: 5px 10px !important;
  font-size: 13px !important;
}

.admin-scope-btn {
  height: 34px;
  padding: 6px 14px !important;
  font-size: 12px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.admin-scope-micro-tip {
  font-size: 11.5px;
  color: #94a3b8;
  min-inline-size: 0;
}

.admin-track-preview-frame {
  position: relative;
  flex: 0 0 auto;
  inline-size: 224px;
  border-radius: 7px;
  border: 2px solid var(--neon-cyan);
  background: #060914;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7), 0 0 14px rgba(45, 226, 230, 0.25);
  overflow: clip;
}

.admin-track-preview-frame.is-custom-preview {
  border-color: #facc15;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7), 0 0 16px rgba(250, 204, 21, 0.34);
}

.admin-track-preview-frame.is-global-preview {
  border-color: #38bdf8;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7), 0 0 15px rgba(56, 189, 248, 0.28);
}

.admin-track-preview-canvas {
  display: block;
  inline-size: 220px;
  block-size: 124px;
  aspect-ratio: 220 / 124;
  background: #060914;
}

.admin-track-preview-badge {
  position: absolute;
  inset-block-start: 5px;
  inset-inline-start: 6px;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #fef08a;
  background: rgba(7, 11, 24, 0.88);
  border: 1px solid rgba(250, 204, 21, 0.65);
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
  max-inline-size: calc(100% - 12px);
  white-space: nowrap;
  overflow: clip;
  text-overflow: ellipsis;
}

.admin-track-preview-frame.is-global-preview .admin-track-preview-badge {
  color: #67e8f9;
  border-color: rgba(45, 226, 230, 0.68);
}

.admin-track-preview-caption {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  padding: 2px 7px;
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #f8fafc;
  background: linear-gradient(180deg, rgba(6, 9, 20, 0.68) 0%, rgba(6, 9, 20, 0.94) 100%);
  border-block-start: 1px solid rgba(148, 163, 184, 0.24);
  text-align: center;
  white-space: nowrap;
  overflow: clip;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* Uniform Equal-Size Grid for REGOLE PISTA (v0.31 Step 2) */
.admin-rules-grid,
.admin-rules-grid.is-compact-rules {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)) !important;
  grid-auto-rows: 1fr !important;
  gap: 10px 12px !important;
  flex: 1 1 auto;
  width: 100%;
  align-items: stretch;
  align-content: start;
}

.admin-rules-grid .admin-rule-card,
.admin-rules-grid.is-compact-rules .admin-rule-card,
.admin-rules-grid.is-compact-rules .admin-rule-card.span-2-cols {
  grid-column: span 1 !important;
  min-height: 112px !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  padding: 12px 14px !important;
  border-width: 1.5px !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.38);
  box-sizing: border-box !important;
}

.admin-rules-grid .admin-card-head,
.admin-rules-grid.is-compact-rules .admin-card-head {
  padding: 0 0 8px 0 !important;
  gap: 10px !important;
  background: transparent !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22) !important;
  align-items: flex-start !important;
}

.admin-rules-grid .admin-px-badge,
.admin-rules-grid.is-compact-rules .admin-px-badge {
  inline-size: 32px !important;
  block-size: 32px !important;
  border-radius: 5px;
  border-width: 1.5px;
  flex-shrink: 0;
}

.admin-rules-grid .admin-px-icon,
.admin-rules-grid.is-compact-rules .admin-px-icon,
.adm-rule-icon {
  display: inline-block;
  inline-size: 24px !important;
  block-size: 24px !important;
  width: 24px !important;
  height: 24px !important;
  image-rendering: pixelated;
  vertical-align: middle;
  flex-shrink: 0;
}

.adm-rule-icon.is-sm {
  inline-size: 16px !important;
  block-size: 16px !important;
  width: 16px !important;
  height: 16px !important;
}

.admin-rules-grid .admin-card-titles,
.admin-rules-grid.is-compact-rules .admin-card-titles {
  gap: 3px !important;
  min-width: 0;
  flex: 1 1 auto;
}

.admin-rules-grid .admin-card-title,
.admin-rules-grid.is-compact-rules .admin-card-title {
  font-size: 14px !important;
  line-height: 1.25 !important;
  color: #F4F7FF !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  text-shadow:
    -1px -1px 0 #050711,
     1px -1px 0 #050711,
    -1px  1px 0 #050711,
     1px  1px 0 #050711,
     0 2px 6px rgba(0, 0, 0, 0.9) !important;
}

.admin-rules-grid .admin-rule-hint,
.admin-rules-grid.is-compact-rules .admin-rule-hint {
  font-size: 12px !important;
  line-height: 1.25 !important;
  color: #dbe4ff !important;
  display: block !important;
  -webkit-line-clamp: unset !important;
  line-clamp: unset !important;
  overflow: visible !important;
  white-space: normal !important;
}

.admin-rules-grid .admin-rule-controls,
.admin-rules-grid.is-compact-rules .admin-rule-controls {
  margin-top: auto !important;
  width: 100% !important;
  padding: 8px 0 0 0 !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
}

.admin-rules-grid .admin-rule-card.has-3-ctrls .admin-rule-controls,
.admin-rules-grid.is-compact-rules .admin-rule-card.has-3-ctrls .admin-rule-controls {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 5px !important;
}

.admin-rules-grid .admin-rule-card.has-4-ctrls .admin-rule-controls,
.admin-rules-grid.is-compact-rules .admin-rule-card.has-4-ctrls .admin-rule-controls {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 5px !important;
}

.admin-rules-grid .admin-ctrl-pair,
.admin-rules-grid.is-compact-rules .admin-ctrl-pair {
  flex: 1 1 0;
  min-inline-size: 0;
  width: 100%;
  height: 36px !important;
  padding: 0 7px !important;
  gap: 5px !important;
  border-radius: 5px;
  justify-content: space-between;
  box-sizing: border-box;
}

.admin-rules-grid .admin-ctrl-pair span,
.admin-rules-grid.is-compact-rules .admin-ctrl-pair span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #F4F7FF !important;
  white-space: nowrap;
}

.admin-rules-grid .admin-num-lg,
.admin-rules-grid.is-compact-rules .admin-num-lg {
  inline-size: 62px !important;
  width: 62px !important;
  height: 28px !important;
  padding: 2px 5px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}

.admin-rules-grid .admin-rule-card.has-3-ctrls .admin-num-lg,
.admin-rules-grid.is-compact-rules .admin-rule-card.has-3-ctrls .admin-num-lg,
.admin-rules-grid .admin-rule-card.has-4-ctrls .admin-num-lg,
.admin-rules-grid.is-compact-rules .admin-rule-card.has-4-ctrls .admin-num-lg {
  inline-size: 46px !important;
  width: 46px !important;
  height: 28px !important;
  padding: 2px 3px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}

.admin-rules-grid .admin-toggle-pill,
.admin-rules-grid.is-compact-rules .admin-toggle-pill {
  flex: 1 1 0;
  min-inline-size: 0;
  width: 100%;
  height: 36px !important;
  padding: 0 7px !important;
  gap: 5px !important;
  justify-content: center;
  box-sizing: border-box;
}

.admin-rules-grid .admin-toggle-pill input[type="checkbox"],
.admin-rules-grid.is-compact-rules .admin-toggle-pill input[type="checkbox"] {
  inline-size: 16px;
  block-size: 16px;
}

.admin-rules-grid .admin-toggle-pill span,
.admin-rules-grid.is-compact-rules .admin-toggle-pill span {
  font-size: 12px !important;
  font-weight: 800 !important;
  color: #F4F7FF !important;
  white-space: nowrap;
}

.admin-rules-grid .admin-select-lg,
.admin-rules-grid.is-compact-rules .admin-select-lg {
  margin-top: auto;
  width: 100% !important;
  height: 36px !important;
  padding: 4px 10px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  box-sizing: border-box;
}

.admin-rule-controls.is-voice-controls {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 6px !important;
}

.admin-voice-preview-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
}

.admin-voice-preview-btn {
  width: 100%;
  height: 32px !important;
  padding: 0 6px !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.overlay-actions.is-rules-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.overlay-actions.is-rules-footer .primary-btn,
.overlay-actions.is-rules-footer .secondary-btn {
  padding: 6px 14px !important;
  font-size: 11.5px !important;
}

.save-feedback.is-inline-feedback {
  margin: 0 0 0 6px !important;
  min-block-size: 0 !important;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 880px) {
  .admin-track-scope-bar {
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   MOBILE TOUCH & ORIENTATION LOCK (v0.28 - Isolato sotto html.mobile-touch-mode)
   Su Desktop (pointer: fine), questi stili restano inattivi al 100%.
   ========================================================================== */

.mobile-touch-controls,
.mobile-portrait-overlay {
  display: none !important;
}

html.mobile-touch-mode,
html.mobile-touch-mode body {
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #04070d;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Overlay blocco verticale (Portrait Lock) */
html.mobile-touch-mode.mobile-portrait-lock #mobile-portrait-overlay:not(.hidden) {
  display: flex !important;
  position: fixed;
  inset: 0;
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top, 20px))
    max(20px, env(safe-area-inset-right, 20px))
    max(20px, env(safe-area-inset-bottom, 20px))
    max(20px, env(safe-area-inset-left, 20px));
  background: radial-gradient(circle at 50% 35%, #162244 0%, #050811 82%);
  touch-action: none;
}

html.mobile-touch-mode .mobile-portrait-card {
  width: min(88dvw, 340px);
  padding: 24px 18px;
  border: 2px solid #00f0ff;
  border-radius: 12px;
  background: rgba(8, 13, 28, 0.94);
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.25), inset 0 0 18px rgba(255, 42, 133, 0.14);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

html.mobile-touch-mode .mobile-rotate-icon-wrap {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mobRotateHint 2.1s ease-in-out infinite;
}

html.mobile-touch-mode .mobile-rotate-svg {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.5));
}

@keyframes mobRotateHint {
  0%, 20% { transform: rotate(0deg) scale(1); }
  55%, 80% { transform: rotate(-90deg) scale(1.06); }
  100% { transform: rotate(0deg) scale(1); }
}

html.mobile-touch-mode .mobile-portrait-title {
  margin: 0;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(12px, 3.8vw, 15px);
  line-height: 1.5;
  color: #ffd84d;
  text-shadow: 0 0 10px rgba(255, 216, 77, 0.45);
}

html.mobile-touch-mode .mobile-portrait-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #cfe0ff;
}

html.mobile-touch-mode .mobile-portrait-badge {
  padding: 5px 10px;
  border: 1px solid rgba(0, 240, 255, 0.5);
  border-radius: 999px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #00f0ff;
  background: rgba(0, 240, 255, 0.08);
}

/* Modalita Landscape Mobile: nascondi Hall of Fame, legenda tasti PC e banner superfluo */
html.mobile-touch-mode #leaderboard-panel,
html.mobile-touch-mode #controls-bar,
html.mobile-touch-mode .mobile-touch-banner {
  display: none !important;
}

html.mobile-touch-mode body.mobile-racing-active #top-bar,
html.mobile-touch-mode body.garage-mode-active #top-bar {
  display: none !important;
}

html.mobile-touch-mode #top-bar {
  position: fixed;
  top: max(2px, env(safe-area-inset-top, 2px));
  left: 50%;
  transform: translateX(-50%);
  width: min(94dvw, 760px);
  z-index: 65;
  margin: 0;
  padding: 3px 10px;
  border-radius: 8px;
  background: rgba(7, 12, 24, 0.78);
  border: 1px solid rgba(0, 240, 255, 0.35);
  backdrop-filter: blur(4px);
}

html.mobile-touch-mode #top-bar .brand-sub,
html.mobile-touch-mode #top-bar #btn-size,
html.mobile-touch-mode #top-bar #btn-crt {
  display: none !important;
}

html.mobile-touch-mode #top-bar .brand-title {
  font-size: clamp(9px, 2.4dvh, 12px);
}

html.mobile-touch-mode #top-bar .hud-chip {
  font-size: clamp(9px, 2.2dvh, 11px);
  padding: 2px 6px;
}

html.mobile-touch-mode #top-bar .cab-btn {
  min-height: 30px;
  padding: 2px 8px;
  font-size: 10px;
}

/* Scaling 100dvh full-screen cabinet + canvas 16:9 */
html.mobile-touch-mode #arcade-cabinet {
  width: 100dvw !important;
  max-width: 100dvw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #04070d !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

html.mobile-touch-mode #stage-layout {
  width: 100dvw !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

html.mobile-touch-mode #screen-frame {
  position: relative;
  width: 100dvw !important;
  height: 100dvh !important;
  max-width: 100dvw !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

html.mobile-touch-mode #game-canvas {
  width: auto !important;
  height: 100dvh !important;
  max-width: 100dvw !important;
  max-height: 100dvh !important;
  aspect-ratio: 16 / 9;
  display: block;
}

/* Adattamento overlay menu su landscape mobile (zero scroll verticale) */
html.mobile-touch-mode #ui-overlay:not(.garage-view) {
  position: fixed;
  inset: 0;
  width: 100dvw;
  height: 100dvh;
  max-height: 100dvh;
  padding: max(36px, calc(env(safe-area-inset-top, 4px) + 32px))
    max(12px, env(safe-area-inset-right, 12px))
    max(6px, env(safe-area-inset-bottom, 6px))
    max(12px, env(safe-area-inset-left, 12px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, 0.9dvh, 7px);
}

html.mobile-touch-mode #ui-overlay.hidden {
  display: none !important;
}

html.mobile-touch-mode #ui-overlay .overlay-title {
  font-size: clamp(13px, 4.4dvh, 22px);
  margin: 0;
  line-height: 1.2;
}

html.mobile-touch-mode #ui-overlay .overlay-subtitle {
  font-size: clamp(10px, 2.6dvh, 13px);
  margin: 0;
  line-height: 1.25;
}

html.mobile-touch-mode #ui-overlay .overlay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(6px, 1.4vw, 12px);
  margin-top: clamp(2px, 0.8dvh, 6px);
}

html.mobile-touch-mode #ui-overlay .primary-btn,
html.mobile-touch-mode #ui-overlay .secondary-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 6px 14px;
  font-size: clamp(10px, 2.8dvh, 14px);
}

html.mobile-touch-mode #ui-overlay.title-theme .title-hero-card,
html.mobile-touch-mode #ui-overlay.title-theme .title-stage-wrap {
  max-height: calc(100dvh - 46px);
  padding: clamp(6px, 1.5dvh, 12px) clamp(10px, 2vw, 16px);
  gap: clamp(4px, 1dvh, 8px);
}

html.mobile-touch-mode #ui-overlay.title-theme .title-logo-img {
  max-height: clamp(48px, 18dvh, 96px);
  width: auto;
}

/* 3 UPGRADE side-by-side senza scroll */
html.mobile-touch-mode #ui-overlay .draft-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: clamp(6px, 1.4vw, 12px) !important;
  width: min(96dvw, 880px);
  max-height: calc(100dvh - 96px);
  align-items: stretch;
}

html.mobile-touch-mode #ui-overlay .upgrade-card {
  padding: clamp(5px, 1.2dvh, 9px);
  gap: clamp(3px, 0.8dvh, 6px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

html.mobile-touch-mode #ui-overlay .upgrade-frame-box {
  height: clamp(40px, 15dvh, 72px);
}

html.mobile-touch-mode #ui-overlay .upgrade-title {
  font-size: clamp(9px, 2.5dvh, 12px);
  line-height: 1.2;
}

html.mobile-touch-mode #ui-overlay .upgrade-desc {
  font-size: clamp(9px, 2.2dvh, 11px);
  line-height: 1.2;
}

html.mobile-touch-mode #ui-overlay .upgrade-card button {
  min-height: 44px;
  font-size: clamp(9px, 2.4dvh, 12px);
  padding: 4px 8px;
}

/* 3 PISTE side-by-side senza scroll */
html.mobile-touch-mode #ui-overlay .track-choice-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: clamp(6px, 1.4vw, 12px) !important;
  width: min(96dvw, 900px);
  max-height: calc(100dvh - 96px);
  align-items: stretch;
}

html.mobile-touch-mode #ui-overlay .track-choice-card {
  padding: clamp(5px, 1.2dvh, 9px);
  gap: clamp(3px, 0.7dvh, 5px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

html.mobile-touch-mode #ui-overlay .track-choice-minimap {
  width: 100%;
  height: auto;
  max-height: clamp(46px, 19dvh, 94px);
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

html.mobile-touch-mode #ui-overlay .track-choice-name {
  font-size: clamp(9px, 2.4dvh, 12px);
}

html.mobile-touch-mode #ui-overlay .track-choice-meta,
html.mobile-touch-mode #ui-overlay .track-choice-desc {
  font-size: clamp(9px, 2.1dvh, 11px);
  line-height: 1.2;
}

html.mobile-touch-mode #ui-overlay .track-choice-card button {
  min-height: 44px;
  font-size: clamp(9px, 2.4dvh, 12px);
  padding: 4px 8px;
}

/* GARAGE '86 su mobile landscape: 2 colonne + zero scroll + START sempre accessibile */
html.mobile-touch-mode #ui-overlay.garage-view {
  position: fixed;
  inset: 0;
  width: 100dvw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  padding: max(4px, env(safe-area-inset-top, 4px))
    max(10px, env(safe-area-inset-right, 10px))
    max(4px, env(safe-area-inset-bottom, 4px))
    max(10px, env(safe-area-inset-left, 10px)) !important;
  overflow: hidden !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .garage-panel {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  padding: clamp(4px, 1dvh, 8px) clamp(6px, 1.2vw, 12px) !important;
  gap: clamp(3px, 0.8dvh, 6px) !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .garage-header {
  padding: clamp(3px, 0.7dvh, 6px) clamp(6px, 1vw, 10px) !important;
  gap: clamp(4px, 1vw, 8px) !important;
  flex: 0 0 auto;
}

html.mobile-touch-mode #ui-overlay.garage-view .garage-header-title {
  font-size: clamp(10px, 2.8dvh, 14px) !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .garage-start-cta,
html.mobile-touch-mode #ui-overlay.garage-view #btn-race-go {
  min-width: 44px;
  min-height: 44px;
  padding: 4px 12px !important;
  font-size: clamp(10px, 2.7dvh, 14px) !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .garage-main-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr) !important;
  gap: clamp(6px, 1.2vw, 10px) !important;
  flex: 1 1 auto;
  min-height: 0 !important;
  overflow: hidden !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .garage-chassis-col,
html.mobile-touch-mode #ui-overlay.garage-view .garage-engines-col {
  min-height: 0 !important;
  overflow: hidden !important;
  padding: clamp(4px, 0.9dvh, 7px) !important;
  gap: clamp(3px, 0.7dvh, 5px) !important;
  display: flex;
  flex-direction: column;
}

html.mobile-touch-mode #ui-overlay.garage-view .garage-col-title {
  font-size: clamp(9px, 2.2dvh, 11px) !important;
  margin: 0 !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .chassis-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(3px, 0.7dvh, 5px) !important;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .garage-car-card {
  padding: clamp(3px, 0.6dvh, 5px) !important;
  gap: 2px !important;
  min-height: 0 !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .garage-car-preview {
  max-height: clamp(20px, 7dvh, 38px) !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .garage-car-desc,
html.mobile-touch-mode #ui-overlay.garage-view .engine-shop-desc {
  display: none !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .garage-car-name,
html.mobile-touch-mode #ui-overlay.garage-view .engine-shop-name {
  font-size: clamp(8px, 2.1dvh, 10px) !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .engine-shop-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: clamp(3px, 0.7dvh, 5px) !important;
  overflow: hidden !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .engine-shop-card {
  padding: clamp(3px, 0.6dvh, 5px) !important;
  gap: 2px !important;
  min-height: 0 !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .livery-shop-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: clamp(3px, 0.6dvh, 5px) !important;
}

html.mobile-touch-mode #ui-overlay.garage-view .livery-swatch-btn {
  min-height: 30px;
  padding: 2px 4px !important;
  font-size: clamp(8px, 1.9dvh, 10px) !important;
}

/* Controlli Touch Virtuali in Gara / Countdown */
html.mobile-touch-mode:not(.mobile-portrait-lock) #mobile-touch-controls:not(.hidden) {
  display: block !important;
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

html.mobile-touch-mode .mobile-hud-pills {
  position: fixed;
  top: max(6px, env(safe-area-inset-top, 6px));
  right: max(10px, env(safe-area-inset-right, 10px));
  display: flex;
  gap: 8px;
  pointer-events: auto;
  touch-action: none;
}

html.mobile-touch-mode .mob-pill-btn,
html.mobile-touch-mode .mob-hud-pill {
  min-width: 44px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1.5px solid rgba(0, 240, 255, 0.65);
  background: rgba(8, 14, 28, 0.58);
  color: #e6f7ff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  backdrop-filter: blur(3px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

html.mobile-touch-mode .mobile-steer-zone {
  position: fixed;
  left: max(14px, env(safe-area-inset-left, 14px));
  bottom: max(14px, env(safe-area-inset-bottom, 14px));
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

html.mobile-touch-mode .mob-steer-btn,
html.mobile-touch-mode #btn-mob-left,
html.mobile-touch-mode #btn-mob-right {
  min-width: 74px;
  min-height: 74px;
  width: clamp(74px, 19dvh, 88px);
  height: clamp(74px, 19dvh, 88px);
  border-radius: 16px;
  border: 2.5px solid rgba(45, 226, 230, 0.78);
  background: linear-gradient(180deg, rgba(16, 30, 62, 0.82) 0%, rgba(7, 13, 28, 0.88) 100%);
  color: #e6f9ff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55), inset 0 0 12px rgba(45, 226, 230, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: clamp(26px, 6.2dvh, 32px);
  font-weight: 900;
  line-height: 1;
  padding: 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.05s ease, border-color 0.05s ease, background-color 0.05s ease, box-shadow 0.05s ease;
}

html.mobile-touch-mode .mob-steer-btn .mob-steer-arrow {
  pointer-events: none;
  text-shadow: 0 0 10px rgba(45, 226, 230, 0.7);
}

html.mobile-touch-mode .mob-steer-btn.is-pressed,
html.mobile-touch-mode #btn-mob-left.is-pressed,
html.mobile-touch-mode #btn-mob-right.is-pressed {
  transform: scale(0.93);
  border-color: #ffd319;
  color: #ffd319;
  background: linear-gradient(180deg, rgba(45, 226, 230, 0.34) 0%, rgba(18, 38, 76, 0.94) 100%);
  box-shadow: 0 0 22px rgba(255, 211, 25, 0.68), inset 0 0 16px rgba(45, 226, 230, 0.45);
}

html.mobile-touch-mode .mobile-actions-zone {
  position: fixed;
  right: max(14px, env(safe-area-inset-right, 14px));
  bottom: max(14px, env(safe-area-inset-bottom, 14px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
  touch-action: none;
}

html.mobile-touch-mode .mobile-pedals-cluster {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

html.mobile-touch-mode .mobile-pedals-bottom {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

html.mobile-touch-mode .mob-autogas-btn,
html.mobile-touch-mode .mob-autogas-pill {
  min-width: 96px;
  min-height: 38px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(140, 165, 205, 0.6);
  background: rgba(9, 15, 30, 0.68);
  color: #b7c8e6;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  backdrop-filter: blur(3px);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

html.mobile-touch-mode .mob-autogas-btn.is-on,
html.mobile-touch-mode .mob-autogas-pill.is-on {
  border-color: #39ff9e;
  color: #39ff9e;
  background: rgba(12, 42, 28, 0.72);
  box-shadow: 0 0 12px rgba(57, 255, 158, 0.3);
}

html.mobile-touch-mode .mob-action-btn,
html.mobile-touch-mode .mob-pedal-btn {
  min-width: 74px;
  min-height: 58px;
  padding: 6px 11px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(10, 17, 34, 0.68);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  backdrop-filter: blur(3px);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.05s ease, filter 0.05s ease, box-shadow 0.05s ease;
}

html.mobile-touch-mode .mob-action-btn .mob-act-ico,
html.mobile-touch-mode .mob-pedal-btn .mob-pedal-ico {
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}

html.mobile-touch-mode .mob-action-btn .mob-act-lbl,
html.mobile-touch-mode .mob-pedal-btn .mob-pedal-lbl {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.04em;
  pointer-events: none;
}

html.mobile-touch-mode .mob-nitro-btn,
html.mobile-touch-mode .mob-pedal-btn.is-nitro {
  border-color: rgba(255, 128, 40, 0.85);
  background: rgba(48, 18, 8, 0.68);
  color: #ffd89b;
}

html.mobile-touch-mode .mob-brake-btn,
html.mobile-touch-mode .mob-pedal-btn.is-brake {
  border-color: rgba(255, 64, 108, 0.85);
  background: rgba(48, 10, 24, 0.68);
  color: #ffc2d1;
}

html.mobile-touch-mode .mob-gas-btn,
html.mobile-touch-mode .mob-pedal-btn.is-gas {
  min-width: 78px;
  min-height: 64px;
  border-color: rgba(57, 255, 158, 0.85);
  background: rgba(8, 40, 24, 0.68);
  color: #c2ffe0;
}

html.mobile-touch-mode .mob-action-btn.active,
html.mobile-touch-mode .mob-pedal-btn.is-pressed {
  transform: scale(0.93);
  filter: brightness(1.35);
  border-color: #ffd319;
  box-shadow: 0 0 20px rgba(255, 211, 25, 0.58);
}

/* END mobile-touch-mode */

/* v0.29 Roadmap Markdown Bulk Import Modal & Preview Table */
dialog.rm-dialog.rm-import-dialog {
  width: min(980px, 95vw);
  max-height: min(90vh, 90dvh);
  padding: 18px 20px;
  background: linear-gradient(180deg, #15192f 0%, #0d1022 100%);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 36px rgba(45, 226, 230, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

dialog.rm-dialog.rm-import-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

dialog.rm-dialog.rm-import-dialog:modal {
  overscroll-behavior: contain;
}

dialog.rm-dialog.rm-import-dialog::backdrop {
  background: rgba(5, 7, 16, 0.84);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.rm-import-subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  color: #a9b5dc;
}

.rm-import-close-x {
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.2;
  flex-shrink: 0;
}

.rm-import-file-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  background: #0f1428;
  border: 1px solid #2e3966;
  border-radius: 6px;
  padding: 8px 10px;
}

.rm-import-file-name {
  font-size: 12px;
  color: #cbd5e1;
  flex: 1 1 180px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-import-counters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.rm-import-editor-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rm-import-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  min-height: 112px;
  max-height: 200px;
  line-height: 1.42;
}

.rm-import-preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rm-import-preview-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--neon-yellow);
  letter-spacing: 0.06em;
}

.rm-import-table-wrap {
  flex: 1 1 auto;
  min-height: 140px;
  max-height: min(36vh, 330px);
  overflow: auto;
  container-type: inline-size;
  background: #090d1c;
  border: 1px solid #2e3862;
  border-radius: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-cyan) rgba(10, 14, 28, 0.7);
}

.rm-import-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  color: #e2e8f0;
  --label-1: "Usa";
  --label-2: "Stato";
  --label-4: "Categoria";
  --label-5: "Difficoltà";
  --label-6: "Versione";
}

.rm-import-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: #141a35;
}

.rm-import-table th,
.rm-import-table td {
  padding: 7px 9px;
  border-bottom: 1px solid #1f2747;
  text-align: left;
  vertical-align: top;
}

.rm-import-table thead th {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--neon-cyan);
  border-bottom: 2px solid #2d3866;
  white-space: nowrap;
}

.rm-imp-col-chk {
  width: 40px;
  text-align: center !important;
}

.rm-imp-title-cell {
  font-weight: 500;
  min-width: 220px;
}

.rm-imp-title-text {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
}

.rm-imp-desc-text {
  margin-top: 2px;
  font-size: 11.5px;
  color: #b7c3e0;
  line-height: 1.35;
}

.rm-imp-row.is-unchanged {
  opacity: 0.58;
}

.rm-imp-row.is-update {
  background: rgba(255, 211, 25, 0.05);
}

.rm-imp-row.is-new {
  background: rgba(56, 242, 118, 0.04);
}

.rm-imp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.rm-imp-badge.is-new {
  color: #38f276;
  background: rgba(56, 242, 118, 0.14);
  border-color: rgba(56, 242, 118, 0.45);
}

.rm-imp-badge.is-upd {
  color: #ffd319;
  background: rgba(255, 211, 25, 0.14);
  border-color: rgba(255, 211, 25, 0.48);
}

.rm-imp-badge.is-same {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.35);
}

.rm-imp-ver-diff {
  margin-top: 3px;
  font-size: 10.5px;
  color: #ffd319;
  white-space: nowrap;
}

.rm-imp-empty-cell {
  text-align: center !important;
  padding: 22px 12px !important;
  color: #94a3b8;
}

@container (width < 640px) {
  .rm-import-table,
  .rm-import-table thead,
  .rm-import-table tbody,
  .rm-import-table tr,
  .rm-import-table th,
  .rm-import-table td {
    display: block;
  }

  .rm-import-table thead {
    display: none;
  }

  .rm-import-table tbody tr {
    border: 1px solid #2e3866;
    border-radius: 6px;
    margin: 8px;
    padding: 6px 8px;
    background: #10162d;
  }

  .rm-import-table th,
  .rm-import-table td {
    border-bottom: none;
    padding: 4px 2px;
    text-align: left !important;
  }

  .rm-imp-title-cell {
    position: sticky;
    inset-block-start: 0;
    z-index: 1;
    background: #141b36;
    border-radius: 4px;
    padding: 5px 6px !important;
  }

  .rm-import-table td:nth-child(1)::before {
    content: var(--label-1) ": ";
    color: var(--neon-cyan);
    font-weight: 700;
  }

  .rm-import-table td:nth-child(2)::before {
    content: var(--label-2) ": ";
    color: var(--neon-cyan);
    font-weight: 700;
  }

  .rm-import-table td:nth-child(4)::before {
    content: var(--label-4) ": ";
    color: var(--neon-cyan);
    font-weight: 700;
  }

  .rm-import-table td:nth-child(5)::before {
    content: var(--label-5) ": ";
    color: var(--neon-cyan);
    font-weight: 700;
  }

  .rm-import-table td:nth-child(6)::before {
    content: var(--label-6) ": ";
    color: var(--neon-cyan);
    font-weight: 700;
  }
}
/* END rm-import-dialog */

/* ==========================================================================
   v0.30 — PLAY BUTTON READY NEON PULSE & FOOTER COFFEE / GDPR MODALS
   ========================================================================== */
.garage-race-go-btn.btn-play-ready-pulse {
  position: relative;
  overflow: hidden;
  border-color: #38f276;
  box-shadow:
    0 0 14px rgba(56, 242, 118, 0.52),
    0 0 26px rgba(255, 211, 25, 0.3),
    inset 0 0 10px rgba(56, 242, 118, 0.24);
  @media (prefers-reduced-motion: no-preference) {
    animation: playReadyPulse 1.65s ease-in-out infinite;
  }
}

.garage-race-go-btn.btn-play-ready-pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.22) 50%, transparent 80%);
  transform: translateX(-110%);
  pointer-events: none;
  @media (prefers-reduced-motion: no-preference) {
    animation: playReadyShimmer 2.4s ease-in-out infinite;
  }
}

@keyframes playReadyPulse {
  0%, 100% {
    border-color: #38f276;
    box-shadow:
      0 0 14px rgba(56, 242, 118, 0.55),
      0 0 24px rgba(255, 211, 25, 0.25),
      inset 0 0 10px rgba(56, 242, 118, 0.25);
  }
  50% {
    border-color: #ffd319;
    box-shadow:
      0 0 22px rgba(255, 211, 25, 0.72),
      0 0 36px rgba(56, 242, 118, 0.48),
      inset 0 0 14px rgba(255, 211, 25, 0.3);
  }
}

@keyframes playReadyShimmer {
  0%, 55% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(120%);
  }
}

.footer-action-btn,
.footer-meta a.footer-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(15, 22, 48, 0.86);
  color: #e2e8f0;
  border: 1.5px solid rgba(45, 226, 230, 0.45);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.footer-action-btn:hover,
.footer-meta a.footer-action-btn:hover {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  background: rgba(25, 36, 72, 0.95);
}

.footer-action-btn .ui-inline-px-icon {
  image-rendering: pixelated;
}

.crt-policy-dialog:modal {
  margin: auto;
  width: min(560px, 92vw);
  max-height: 86dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, #121833 0%, #090d1e 100%);
  color: #e2e8f0;
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 0 34px rgba(45, 226, 230, 0.28), 0 14px 40px rgba(0, 0, 0, 0.8);
}

.crt-policy-dialog::backdrop {
  background: rgba(3, 5, 14, 0.78);
  overflow: hidden;
  overscroll-behavior: contain;
}

.crt-policy-head {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1.5px solid rgba(45, 226, 230, 0.35);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.crt-policy-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.04em;
}

.crt-policy-body {
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
}

.crt-policy-body p {
  margin: 0 0 10px;
}

.crt-policy-note {
  background: rgba(255, 211, 25, 0.09);
  border: 1.5px solid rgba(255, 211, 25, 0.45);
  border-radius: 6px;
  padding: 10px 12px;
  color: #fef08a;
  font-size: 12.5px;
}

.crt-policy-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ==========================================================================
   v0.31 — ROADMAP 2000 CHARS, 2-COLUMN PUBLIC BOARD & ADMIN SERVER BACKUP UI
   ========================================================================== */
.adm-rm-desc-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.adm-rm-desc-counter {
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--neon-cyan);
  background: rgba(45, 226, 230, 0.12);
  border: 1px solid rgba(45, 226, 230, 0.42);
  border-radius: 4px;
  padding: 1px 7px;
}

.adm-rm-desc-textarea {
  resize: vertical;
  min-height: 84px;
  max-height: 320px;
  line-height: 1.45;
  font-family: inherit;
  padding: 8px 10px !important;
  white-space: pre-wrap;
}

.adm-rm-row-desc {
  font-size: 12.5px;
  color: #cbd5e1;
  line-height: 1.45;
  white-space: pre-line;
  margin-top: 3px;
}

/* Public Roadmap 2-Column CRT Board */
.rm-two-col-board {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.rm-col-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(11, 15, 31, 0.86);
  border: 2px solid #2b355e;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}

#rm-col-done {
  border-color: rgba(26, 182, 76, 0.52);
}

#rm-col-pending {
  border-color: rgba(45, 226, 230, 0.52);
}

.rm-col-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 2px solid #2b355e;
}

.rm-col-head.is-head-done {
  background: linear-gradient(90deg, rgba(26, 182, 76, 0.24) 0%, rgba(16, 26, 37, 0.96) 100%);
  border-bottom-color: rgba(26, 182, 76, 0.58);
}

.rm-col-head.is-head-pending {
  background: linear-gradient(90deg, rgba(255, 211, 25, 0.2) 0%, rgba(45, 226, 230, 0.16) 55%, rgba(16, 22, 43, 0.96) 100%);
  border-bottom-color: rgba(45, 226, 230, 0.58);
}

.rm-col-title-text {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #ffffff;
  text-shadow: 0 1px 3px #000;
}

.rm-col-head.is-head-done .rm-col-title-text {
  color: #4ade80;
}

.rm-col-head.is-head-pending .rm-col-title-text {
  color: var(--neon-yellow);
}

.rm-col-count-badge {
  font-family: var(--font-pixel);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(7, 10, 22, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #f8fafc;
}

.rm-col-cards-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-cyan) rgba(10, 14, 28, 0.7);
}

#rm-col-done .rm-col-cards-list {
  scrollbar-color: #1AB64C rgba(10, 14, 28, 0.7);
}

@media (max-width: 900px) {
  .rm-two-col-board {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .rm-col-panel {
    max-height: none;
    overflow: visible;
  }

  .rm-col-cards-list {
    overflow-y: visible;
  }
}

.rm-card.status-done {
  border-color: rgba(26, 182, 76, 0.45);
  border-left: 4px solid #1AB64C;
  background: linear-gradient(180deg, #111c26 0%, #0c141d 100%);
}

.rm-card.status-in_progress {
  border-color: rgba(255, 211, 25, 0.72);
  border-left: 4px solid #ffd319;
  box-shadow: 0 0 16px rgba(255, 211, 25, 0.24), 0 0 8px rgba(45, 226, 230, 0.16), 0 4px 0 #070913;
}

.rm-card-desc {
  line-height: 1.45;
  white-space: pre-line;
  word-break: break-word;
}

.rm-card-desc.is-done-desc {
  color: #94a3b8;
}

.rm-done-date-badge {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #86efac;
  background: rgba(26, 182, 76, 0.18);
  border: 1px solid rgba(26, 182, 76, 0.58);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}

.rm-work-badge {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fef08a;
  background: rgba(255, 211, 25, 0.18);
  border: 1px solid rgba(255, 211, 25, 0.68);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(255, 211, 25, 0.25);
}

.rm-todo-badge {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}

.rm-desc-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 1px 7px;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  color: var(--neon-cyan);
  background: rgba(45, 226, 230, 0.12);
  border: 1px solid rgba(45, 226, 230, 0.45);
  border-radius: 4px;
  cursor: pointer;
  vertical-align: baseline;
}

.rm-desc-toggle-btn:hover {
  background: rgba(45, 226, 230, 0.24);
  color: #ffffff;
}

/* Admin Top Management Grid (Hall of Fame + Server Backup & Restore) */
.admin-top-mgmt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.admin-top-mgmt-grid .admin-hof-mgmt-card {
  margin-bottom: 0;
}

.admin-hof-mgmt-card.is-backup-card {
  border-color: rgba(45, 226, 230, 0.55);
  background: linear-gradient(180deg, rgba(16, 26, 52, 0.94) 0%, rgba(10, 15, 32, 0.98) 100%);
}

.admin-hof-mgmt-title.is-cyan-title {
  color: var(--neon-cyan);
}

.admin-restore-dialog:modal {
  width: min(520px, 94vw);
  border-color: var(--neon-yellow);
  box-shadow: 0 0 34px rgba(255, 211, 25, 0.28), 0 14px 40px rgba(0, 0, 0, 0.85);
}

.admin-restore-summary-list {
  margin: 10px 0 12px;
  padding: 10px 14px 10px 28px;
  background: rgba(9, 13, 28, 0.86);
  border: 1px solid rgba(45, 226, 230, 0.4);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 12.5px;
  line-height: 1.55;
}

.admin-restore-summary-list strong {
  color: var(--neon-yellow);
}

/* ==========================================================================
   STEP 3 — POST-RACE TELEMETRY CABINET PANEL & 16-BIT PIXEL LAP BAR CHART
   ========================================================================== */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.save-modal-panel.post-race-modal {
  width: min(830px, 97%);
  max-width: 830px;
  padding: 12px 16px;
}

.standings-table.is-compact-stage {
  width: min(810px, 97%);
  gap: 6px;
  margin-bottom: 6px;
}

.standings-table.is-compact-stage .standing-pill {
  padding: 5px 6px;
  font-size: 12.5px;
}

.post-race-telemetry-panel {
  width: min(810px, 97%);
  margin: 4px auto 8px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 9px;
  align-items: stretch;
  background: linear-gradient(180deg, rgba(13, 19, 40, 0.96) 0%, rgba(7, 10, 22, 0.98) 100%);
  border: 2px solid rgba(36, 210, 236, 0.58);
  border-radius: 7px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: left;
}

.telemetry-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  align-items: stretch;
  min-width: 0;
}

.telemetry-kpi-card {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  gap: 3px;
  padding: 7px 5px;
  background: linear-gradient(180deg, #131b36 0%, #0a0f22 100%);
  border: 1.5px solid #2b3868;
  border-radius: 5px;
  min-width: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.telemetry-kpi-card > h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #94a3b8;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telemetry-kpi-card > p.telemetry-kpi-val {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 900;
  line-height: 1.1;
  color: #ffffff;
}

@container (inline-size < 118px) {
  .telemetry-kpi-card > h3 {
    font-size: 8px;
  }
  .telemetry-kpi-card > p.telemetry-kpi-val {
    font-size: 14px;
  }
}

.telemetry-kpi-val.is-peak {
  color: #f0c220;
  text-shadow: 0 0 10px rgba(240, 194, 32, 0.36);
}

.telemetry-kpi-val.is-overtakes {
  color: #24d2ec;
  text-shadow: 0 0 10px rgba(36, 210, 236, 0.36);
}

.telemetry-kpi-val.is-solo-mode {
  font-size: 11.5px !important;
  color: #cbd5e1;
  letter-spacing: 0.04em;
}

.telemetry-kpi-val.is-ahead {
  color: #62e880;
  text-shadow: 0 0 10px rgba(98, 232, 128, 0.42);
}

.telemetry-kpi-val.is-behind {
  color: #ff6b6b;
  text-shadow: 0 0 10px rgba(255, 107, 107, 0.36);
}

.telemetry-kpi-sub {
  display: block;
  font-family: var(--font-pixel);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #cbd5e1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telemetry-kpi-sub.is-ghost-tag {
  color: #f0abfc;
}

.telemetry-chart-figure {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #070b18;
  border: 1.5px solid #24325c;
  border-radius: 5px;
  overflow: hidden;
}

.telemetry-lap-canvas {
  display: block;
  width: 360px;
  max-width: 100%;
  height: 96px;
  aspect-ratio: 360 / 96;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

@media (max-width: 740px) {
  html:not(.mobile-touch-mode) .post-race-telemetry-panel {
    grid-template-columns: 1fr;
  }

  html:not(.mobile-touch-mode) .telemetry-lap-canvas {
    width: 100%;
    max-width: 360px;
    height: auto;
  }
}

html.mobile-touch-mode #ui-overlay .save-modal-panel.post-race-modal {
  width: min(96dvw, 810px);
  max-height: calc(100dvh - 42px);
  padding: clamp(5px, 1.2dvh, 10px) clamp(8px, 1.8vw, 14px);
}

html.mobile-touch-mode #ui-overlay .standings-table {
  width: min(96dvw, 790px);
  gap: 5px;
  margin-bottom: 3px;
}

html.mobile-touch-mode #ui-overlay .standing-pill {
  padding: 3px 5px;
  font-size: clamp(9.5px, 2.3dvh, 12px);
}

html.mobile-touch-mode #ui-overlay .score-saved-banner {
  padding: 3px 8px;
  font-size: clamp(9.5px, 2.2dvh, 12px);
  margin-bottom: 2px;
}

html.mobile-touch-mode #ui-overlay .post-race-telemetry-panel {
  width: min(96dvw, 790px);
  margin: 2px auto 3px;
  padding: 4px 6px;
  grid-template-columns: minmax(0, 1.14fr) minmax(0, 0.86fr);
  gap: 6px;
}

html.mobile-touch-mode #ui-overlay .telemetry-kpi-grid {
  gap: 4px;
}

html.mobile-touch-mode #ui-overlay .telemetry-kpi-card {
  padding: 4px 4px;
  gap: 1px;
}

html.mobile-touch-mode #ui-overlay .telemetry-kpi-card > h3 {
  font-size: clamp(7.5px, 1.9dvh, 9px);
}

html.mobile-touch-mode #ui-overlay .telemetry-kpi-card > p.telemetry-kpi-val {
  font-size: clamp(11px, 3.1dvh, 15px);
  gap: 1px;
}

html.mobile-touch-mode #ui-overlay .telemetry-kpi-sub {
  font-size: clamp(8px, 1.9dvh, 9.5px);
}

html.mobile-touch-mode #ui-overlay .telemetry-lap-canvas {
  height: clamp(50px, 18dvh, 76px);
  width: auto;
  max-width: 100%;
}

/* ==========================================================================
   STEP 3 (v0.31) — PRIORITÀ ROADMAP & SCHEDA ADMIN "PROFILI IA"
   ========================================================================== */

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

.rm-prio-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Priorità: toni caldi/urgenza (🔥 Bug Fix #ff2a55 / Alta #ff6b35 / Media #f59e0b / Bassa #94a3b8) */
.rm-prio-bugfix {
  background: rgba(255, 42, 85, 0.22);
  border: 1.5px solid #ff2a55;
  color: #ffe4e8;
  box-shadow: 0 0 12px rgba(255, 42, 85, 0.42), inset 0 0 6px rgba(255, 42, 85, 0.25);
  text-shadow: 0 0 6px rgba(255, 42, 85, 0.65);
}

.rm-prio-alta {
  background: rgba(255, 107, 53, 0.20);
  border: 1px solid #ff6b35;
  color: #ffd8c7;
  box-shadow: 0 0 8px rgba(255, 107, 53, 0.24);
}

.rm-prio-media {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid #f59e0b;
  color: #fde68a;
}

.rm-prio-bassa {
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid #94a3b8;
  color: #e2e8f0;
}

.admin-rm-form-wide {
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
}

@media (max-width: 900px) {
  .admin-rm-form-wide {
    grid-template-columns: 1fr 1fr;
  }
}

.admin-ai-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-ai-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(15, 21, 44, 0.88);
  border: 1.5px solid rgba(45, 226, 230, 0.38);
  border-radius: 6px;
}

.admin-ai-toolbar-left,
.admin-ai-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-ai-guide-panel {
  background: linear-gradient(180deg, rgba(16, 24, 52, 0.96) 0%, rgba(10, 14, 30, 0.96) 100%);
  border: 1.5px solid #c084fc;
  border-radius: 7px;
  padding: 12px 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.48);
}

.admin-ai-guide-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  align-items: start;
}

@media (max-width: 960px) {
  .admin-ai-guide-grid {
    grid-template-columns: 1fr;
  }
}

.admin-ai-guide-col h4 {
  margin: 0 0 8px 0;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 800;
  color: #ffd319;
  letter-spacing: 0.04em;
}

.admin-ai-guide-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  line-height: 1.35;
  color: #e2e8f0;
}

.admin-ai-guide-list strong {
  color: #2de2e6;
}

.admin-ai-guide-tpl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.admin-ai-guide-pre {
  margin: 0;
  padding: 8px 10px;
  background: #070b18;
  border: 1px solid #334173;
  border-radius: 5px;
  color: #a5f3fc;
  font-family: monospace;
  font-size: 11px;
  line-height: 1.32;
  max-height: 150px;
  overflow: auto;
  white-space: pre-wrap;
}

.admin-ai-editor-form {
  background: linear-gradient(180deg, #151c38 0%, #0d1226 100%);
  border: 1.5px solid rgba(250, 204, 21, 0.52);
  border-radius: 7px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-ai-form-top {
  display: grid;
  grid-template-columns: auto 1.2fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.admin-ai-form-params {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 1020px) {
  .admin-ai-form-top {
    grid-template-columns: 1fr 1fr;
  }
  .admin-ai-form-params {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-ai-profiles-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.admin-ai-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: linear-gradient(90deg, rgba(20, 27, 54, 0.94) 0%, rgba(12, 17, 36, 0.94) 100%);
  border: 1.5px solid #2e3b6b;
  border-radius: 6px;
}

.admin-ai-row.is-disabled-ai {
  opacity: 0.62;
  border-color: rgba(148, 163, 184, 0.3);
}

.admin-ai-row.is-editing {
  border-color: #ffd319;
  box-shadow: 0 0 12px rgba(255, 211, 25, 0.24);
}

.admin-ai-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 320px;
  min-width: 0;
}

.admin-ai-params-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.admin-ai-param-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(9, 13, 28, 0.9);
  border: 1px solid #334173;
  font-size: 11.5px;
  color: #cbd5e1;
}

.admin-ai-param-pill strong {
  color: #ffd319;
  font-weight: 800;
}

.admin-ai-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ==========================================================================
   v0.32 — ADMIN TAB "🔊 AUDIO" (#adm-panel-audio)
   ========================================================================== */
.adm-audio-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.adm-audio-top-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1.5px solid rgba(45, 226, 230, 0.55);
  background: linear-gradient(90deg, rgba(16, 24, 52, 0.96) 0%, rgba(11, 16, 36, 0.96) 100%);
  box-shadow: inset 0 0 14px rgba(45, 226, 230, 0.12);
}

.adm-audio-top-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 340px;
}

.adm-audio-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.adm-audio-main-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 800;
  color: #2de2e6;
  letter-spacing: 0.04em;
}

.adm-voice-playing-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.85);
  color: #94a3b8;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.adm-voice-playing-badge.is-playing {
  border-color: #38f276;
  background: rgba(14, 52, 32, 0.9);
  color: #38f276;
  box-shadow: 0 0 12px rgba(56, 242, 118, 0.45);
}

.adm-voice-playing-badge.is-disabled {
  border-color: rgba(255, 77, 109, 0.65);
  background: rgba(58, 14, 28, 0.88);
  color: #ff8fa3;
}

.adm-audio-voice-toggle-btn {
  padding: 8px 12px !important;
  font-size: 11.5px !important;
  font-weight: 800 !important;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.adm-audio-voice-toggle-btn.is-enabled {
  border-color: #38f276 !important;
  background: rgba(14, 52, 32, 0.9) !important;
  color: #38f276 !important;
  box-shadow: 0 0 10px rgba(56, 242, 118, 0.28);
}

.adm-audio-voice-toggle-btn.is-disabled {
  border-color: #ff4d6d !important;
  background: rgba(58, 14, 28, 0.9) !important;
  color: #ff8fa3 !important;
  box-shadow: 0 0 10px rgba(255, 77, 109, 0.25);
}

.adm-audio-grid.is-voice-disabled .adm-audio-card {
  opacity: 0.72;
  filter: saturate(0.75);
}

.adm-audio-sub {
  margin: 0;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.4;
}

.adm-audio-test-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.adm-audio-test-btn,
.adm-audio-stop-btn {
  padding: 8px 12px !important;
  font-size: 11.5px !important;
  font-weight: 800 !important;
  white-space: nowrap;
}

.adm-audio-test-btn.is-cyan {
  border-color: #2de2e6 !important;
  color: #2de2e6 !important;
}

.adm-audio-test-btn.is-gold {
  border-color: #ffd319 !important;
  color: #ffd319 !important;
}

.adm-audio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.adm-audio-card {
  height: auto !important;
  min-height: 0 !important;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
}

.adm-audio-field-stack,
.adm-audio-sliders-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.adm-audio-Phrase-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.adm-audio-seq-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 7px;
  background: rgba(9, 14, 30, 0.78);
  border: 1px solid rgba(45, 226, 230, 0.36);
}

.adm-audio-seq-block.is-lastround {
  border-color: rgba(255, 211, 25, 0.42);
}

.adm-audio-seq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.adm-audio-seq-title {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #2de2e6;
}

.adm-audio-seq-block.is-lastround .adm-audio-seq-title {
  color: #ffd319;
}

.adm-audio-dual-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

@media (max-width: 520px) {
  .adm-audio-dual-inputs {
    grid-template-columns: 1fr;
  }
}

.adm-audio-lbl {
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
}

.adm-audio-slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(9, 14, 30, 0.72);
  border: 1px solid rgba(71, 92, 148, 0.45);
}

.adm-audio-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #f1f5f9;
}

.adm-audio-val-pill {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  color: #ffd319;
  background: rgba(255, 211, 25, 0.14);
  border: 1px solid rgba(255, 211, 25, 0.48);
  border-radius: 4px;
  padding: 2px 7px;
  min-width: 64px;
  text-align: center;
}

.adm-audio-range {
  width: 100%;
  accent-color: #2de2e6;
  cursor: pointer;
}

.adm-audio-range-sub {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.3;
}

.adm-audio-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* ==========================================================================
   v0.32 — MULTILINGUAL PIXEL-ART FLAG SWITCHER (#lang-switcher)
   & 8 DISTINCT HIGH-CONTRAST ROADMAP CATEGORY PALETTES (.rm-cat-*)
   ========================================================================== */
#lang-switcher,
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border-radius: 5px;
  background: rgba(9, 13, 28, 0.9);
  border: 1px solid rgba(45, 226, 230, 0.42);
  flex-shrink: 0;
}

.lang-flag-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 3px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}

.lang-flag-btn:hover {
  color: #f8fafc;
  background: rgba(45, 226, 230, 0.12);
}

.lang-flag-btn.active-lang {
  color: #ffd319;
  border-color: #ffd319;
  background: rgba(255, 211, 25, 0.16);
  box-shadow: 0 0 8px rgba(255, 211, 25, 0.35);
}

.lang-flag-img {
  width: 16px;
  height: 11px;
  image-rendering: pixelated;
  display: block;
  flex-shrink: 0;
}

html.mobile-touch-mode #lang-switcher {
  padding: 1px 2px;
  gap: 2px;
}

html.mobile-touch-mode .lang-flag-btn {
  padding: 2px 5px;
  font-size: 9px;
}

/* 8 Distinct High-Contrast Roadmap Category Badges & Quick Filter Pills */
.rm-cat-badge.rm-cat-audio,
.rm-cat-filter-pill.rm-cat-audio {
  color: #FF4FD8 !important;
  border-color: #FF4FD8 !important;
  background: rgba(255, 79, 216, 0.16) !important;
}

.rm-cat-badge.rm-cat-grafica,
.rm-cat-filter-pill.rm-cat-grafica {
  color: #00E5FF !important;
  border-color: #00E5FF !important;
  background: rgba(0, 229, 255, 0.16) !important;
}

.rm-cat-badge.rm-cat-gameplay,
.rm-cat-filter-pill.rm-cat-gameplay {
  color: #39FF88 !important;
  border-color: #39FF88 !important;
  background: rgba(57, 255, 136, 0.16) !important;
}

.rm-cat-badge.rm-cat-ui-admin,
.rm-cat-filter-pill.rm-cat-ui-admin {
  color: #FFD13B !important;
  border-color: #FFD13B !important;
  background: rgba(255, 209, 59, 0.16) !important;
}

.rm-cat-badge.rm-cat-online,
.rm-cat-filter-pill.rm-cat-online {
  color: #4D9FFF !important;
  border-color: #4D9FFF !important;
  background: rgba(77, 159, 255, 0.16) !important;
}

.rm-cat-badge.rm-cat-contenuti,
.rm-cat-filter-pill.rm-cat-contenuti {
  color: #FF8A3D !important;
  border-color: #FF8A3D !important;
  background: rgba(255, 138, 61, 0.16) !important;
}

.rm-cat-badge.rm-cat-coding,
.rm-cat-filter-pill.rm-cat-coding {
  color: #C6FF3D !important;
  border-color: #C6FF3D !important;
  background: rgba(198, 255, 61, 0.16) !important;
}

.rm-cat-badge.rm-cat-ia,
.rm-cat-filter-pill.rm-cat-ia {
  color: #B47CFF !important;
  border-color: #B47CFF !important;
  background: rgba(180, 124, 255, 0.16) !important;
}

.rm-cat-badge[data-rm-cat-quick] {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.rm-cat-badge[data-rm-cat-quick]:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 10px currentColor;
}

.rm-cat-quick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.rm-cat-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1.5px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.8);
  color: #cbd5e1;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  opacity: 0.78;
  transition: opacity 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}

.rm-cat-filter-pill:hover,
.rm-cat-filter-pill[aria-pressed="true"] {
  opacity: 1;
}

.rm-cat-filter-pill[aria-pressed="true"] {
  box-shadow: 0 0 10px currentColor;
  transform: translateY(-1px);
}

/* ==========================================================================
   STEP 2 (v0.34) — BACHECA 15 TROFEI, SBLOCCHI ESCLUSIVI & ICONA CASCO PILOTA
   ========================================================================== */
.pilot-helmet-inline {
  display: inline-block;
  width: 16px;
  height: 16px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  vertical-align: -3px;
  margin-right: 3px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}

.telemetry-pilot-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 2px 9px;
  margin-bottom: 4px;
  border-radius: 4px;
  background: rgba(9, 13, 28, 0.86);
  border: 1px solid rgba(45, 226, 230, 0.35);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.chassis-helmet-lock-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.chassis-helmet-img.is-locked-silhouette,
.helmet-chip-img.is-locked-silhouette,
.trophy-board-px-ico.is-locked-silhouette,
.pilot-helmet-inline.is-locked-silhouette {
  filter: brightness(0.14) contrast(1.4) sepia(1) hue-rotate(190deg) saturate(2.5) drop-shadow(0 0 2px #2e3a56);
  opacity: 0.82;
}

.chassis-helmet-mini-lock,
.helmet-chip-lock,
.trophy-mini-lock {
  position: absolute;
  right: -2px;
  bottom: -2px;
  image-rendering: pixelated;
  pointer-events: none;
}

.garage-util-btn.is-trophy-util {
  border-color: rgba(255, 211, 25, 0.65) !important;
  color: #ffd319 !important;
  background: linear-gradient(180deg, rgba(255, 211, 25, 0.16) 0%, rgba(15, 23, 42, 0.92) 100%) !important;
}

.garage-util-btn.is-trophy-util:hover {
  box-shadow: 0 0 10px rgba(255, 211, 25, 0.38);
}

.garage-helmet-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 3px;
}

.helmet-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  min-height: 24px;
  border-radius: 4px;
  border: 1.5px solid #2b355c;
  background: rgba(11, 15, 31, 0.92);
  color: #cbd5e1;
  font-family: var(--font-body);
  font-size: 9.5px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.helmet-chip.active {
  border-color: var(--neon-yellow);
  background: rgba(255, 211, 25, 0.15);
  color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 211, 25, 0.25);
}

.helmet-chip.is-locked-silhouette {
  border-style: dashed;
  border-color: #334155;
  color: #64748b;
}

.helmet-chip:disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

.helmet-chip-art-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.helmet-chip-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.helmet-chip-lbl {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.helmet-chip-badge {
  font-size: 8.5px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 3px;
  background: #1e293b;
  color: #94a3b8;
  flex-shrink: 0;
}

.helmet-chip-badge.is-active {
  background: var(--neon-yellow);
  color: #090d16;
}

.helmet-chip-badge.is-owned {
  background: rgba(56, 242, 118, 0.18);
  color: #38f276;
}

.helmet-chip-badge.is-trophy-req,
.chassis-badge.is-trophy-req {
  background: rgba(240, 171, 252, 0.16);
  color: #f0abfc;
  border: 1px solid rgba(240, 171, 252, 0.45);
}

.livery-chip.is-locked-silhouette {
  border-style: dashed;
}

.livery-swatch.is-locked-swatch {
  position: relative;
  filter: grayscale(0.85) brightness(0.42);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.livery-swatch-lock {
  width: 11px;
  height: 11px;
  image-rendering: pixelated;
}

/* Modal CRT Bacheca 15 Trofei (Griglia 3x5 Ingrandita & Leggibilità Cristallina v0.37) */
#modal-trophy-board.trophy-board-dialog {
  width: min(94vw, 1180px);
  max-width: 1180px;
  max-height: 90dvh;
  padding: 14px 20px;
  border: 2px solid var(--neon-yellow);
  background: linear-gradient(180deg, #0b1024 0%, #070a17 100%);
  box-shadow: 0 0 42px rgba(255, 211, 25, 0.28), inset 0 0 20px rgba(45, 226, 230, 0.10);
  overflow-y: auto;
  overflow-x: hidden;
}

.trophy-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1.5px solid rgba(255, 211, 25, 0.38);
}

.trophy-board-title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  flex: 1;
  min-width: 0;
}

.trophy-board-main-title {
  margin: 0 !important;
  font-size: 20px !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--neon-yellow) !important;
}

.trophy-board-progress-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #e2e8f0;
}

.trophy-progress-lbl strong {
  color: var(--neon-yellow);
}

.trophy-progress-bar-track {
  width: 140px;
  height: 11px;
  border-radius: 6px;
  background: #131b36;
  border: 1px solid #334173;
  overflow: hidden;
}

.trophy-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2de2e6 0%, #38f276 55%, #ffd319 100%);
  transition: width 0.25s ease;
}

.trophy-plat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #334155;
  color: #94a3b8;
}

.trophy-plat-pill.is-on {
  border-color: #a5f3fc;
  color: #a5f3fc;
  background: rgba(34, 211, 238, 0.14);
}

.trophy-board-grid-3x5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.trophy-board-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1.5px solid #263159;
  background: rgba(13, 18, 38, 0.94);
  min-width: 0;
}

.trophy-board-card.is-unlocked {
  border-color: rgba(255, 211, 25, 0.82);
  background: linear-gradient(180deg, rgba(255, 211, 25, 0.14) 0%, rgba(14, 21, 43, 0.96) 100%);
  box-shadow: 0 0 12px rgba(255, 211, 25, 0.15);
}

.trophy-board-card.is-locked {
  opacity: 0.82;
}

.trophy-board-card-top {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.trophy-board-ico-box {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  background: rgba(7, 10, 23, 0.88);
  border: 1px solid #334173;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.trophy-board-px-ico {
  width: 25px;
  height: 25px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.trophy-board-head-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.trophy-board-card-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trophy-board-status {
  align-self: flex-start;
  font-size: 9.5px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 3px;
  background: #1e293b;
  color: #94a3b8;
}

.trophy-board-status.on {
  background: var(--neon-yellow);
  color: #090d16;
}

.trophy-board-card-desc {
  font-size: 13.5px;
  line-height: 1.35;
  color: #e2e8f0;
}

.trophy-board-card-reward {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(7, 11, 24, 0.84);
  border: 1px solid rgba(148, 163, 184, 0.26);
  font-size: 11.5px;
  font-weight: 700;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trophy-board-card-reward.is-earned {
  border-color: rgba(56, 242, 118, 0.56);
  color: #62e880;
  background: rgba(20, 48, 36, 0.52);
}

/* ==========================================================================
   STEP 3 (v0.34) — ADATTAMENTO SMARTPHONE LANDSCAPE & FRECCE DIREZIONALI
   (Isolamento totale sotto html.mobile-touch-mode — Desktop invariato al 100%)
   ========================================================================== */
html.mobile-touch-mode {
  --mob-ui-scale: 1;
}

/* 1. Solo Frecce Direzionali ◀ / ▶ con hit-area generosa >= 68x68px e risposta istantanea */
html.mobile-touch-mode #mobile-steer-zone,
html.mobile-touch-mode .mobile-steer-zone {
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 12px));
  bottom: max(12px, env(safe-area-inset-bottom, 12px));
  display: flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(10px, 2.2vw, 16px);
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

html.mobile-touch-mode #btn-mob-left,
html.mobile-touch-mode #btn-mob-right,
html.mobile-touch-mode .mob-steer-btn {
  min-width: 68px !important;
  min-height: 68px !important;
  width: clamp(68px, 18.5dvh, 86px);
  height: clamp(68px, 18.5dvh, 86px);
  touch-action: none !important;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}

/* 2. Adattamento Universale Menù & Modali su Smartphone Landscape (specialmente height < 420px) */
html.mobile-touch-mode #ui-overlay:not(.garage-view) {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  justify-content: safe center;
  padding-top: max(32px, calc(env(safe-area-inset-top, 4px) + 28px));
  padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
}

html.mobile-touch-mode #ui-overlay .primary-btn,
html.mobile-touch-mode #ui-overlay .secondary-btn,
html.mobile-touch-mode #ui-overlay .insert-coin-btn,
html.mobile-touch-mode #ui-overlay .garage-util-btn,
html.mobile-touch-mode dialog button,
html.mobile-touch-mode .career-confirm-dialog button {
  min-height: 38px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Modale CRT Bacheca 15 Trofei (#modal-trophy-board) su Smartphone */
html.mobile-touch-mode #modal-trophy-board.trophy-board-dialog {
  width: min(96dvw, 880px);
  max-height: 88dvh !important;
  padding: clamp(6px, 1.4dvh, 10px) clamp(8px, 2vw, 14px);
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

html.mobile-touch-mode #modal-trophy-board .trophy-board-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(11, 16, 36, 0.97);
  padding: 4px 0 6px;
  margin-bottom: 6px;
}

html.mobile-touch-mode #modal-trophy-board .trophy-board-grid-3x5 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto;
  gap: 5px;
}

/* Modali CRT Privacy, Buy a Coffee, Ripristino Backup Admin & Import Roadmap/IA */
html.mobile-touch-mode dialog.crt-policy-dialog:modal,
html.mobile-touch-mode dialog.admin-restore-dialog:modal,
html.mobile-touch-mode dialog.rm-dialog.rm-import-dialog:modal {
  width: min(94dvw, 680px);
  max-height: 88dvh !important;
  padding: 10px 14px;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

html.mobile-touch-mode dialog.crt-policy-dialog .crt-policy-head {
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(16, 22, 48, 0.97);
  padding: 4px 0 8px;
  margin-bottom: 8px;
}

html.mobile-touch-mode dialog.crt-policy-dialog .crt-policy-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: rgba(9, 13, 30, 0.96);
  padding-top: 6px;
  margin-top: 8px;
  border-top: 1px solid rgba(45, 226, 230, 0.25);
}

/* Modali interne a #ui-overlay (Console Admin, Salvataggi, Time Attack, Trofei, Nuova Carriera, Officina) */
html.mobile-touch-mode #ui-overlay .admin-modal-panel,
html.mobile-touch-mode #ui-overlay .save-modal-panel,
html.mobile-touch-mode #ui-overlay .trophy-modal-panel,
html.mobile-touch-mode #ui-overlay .timeattack-modal-panel,
html.mobile-touch-mode #ui-overlay .workshop-panel,
html.mobile-touch-mode .career-confirm-dialog {
  max-height: 88dvh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: clamp(6px, 1.5dvh, 12px) clamp(10px, 2vw, 16px) !important;
}

html.mobile-touch-mode #ui-overlay.admin-fullscreen-view {
  padding: max(6px, env(safe-area-inset-top, 6px))
    max(10px, env(safe-area-inset-right, 10px))
    max(6px, env(safe-area-inset-bottom, 6px))
    max(10px, env(safe-area-inset-left, 10px)) !important;
  overflow-y: auto !important;
}

html.mobile-touch-mode #ui-overlay.admin-fullscreen-view .admin-modal-panel {
  width: 100% !important;
  height: auto !important;
  max-height: 88dvh !important;
  overflow-y: auto !important;
}

html.mobile-touch-mode #ui-overlay .admin-header-row {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(11, 15, 32, 0.97);
  padding: 4px 0 6px;
  margin-bottom: 6px;
}

/* Schermi Smartphone Bassi (height < 420px in landscape / .mobile-low-landscape) */
html.mobile-touch-mode.mobile-low-landscape #ui-overlay.garage-view .garage-panel {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  max-height: 96dvh !important;
}

html.mobile-touch-mode.mobile-low-landscape #ui-overlay.garage-view .garage-top-header {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 4px 8px !important;
  gap: 6px !important;
}

html.mobile-touch-mode.mobile-low-landscape #ui-overlay.garage-view .garage-main-grid {
  overflow-y: auto !important;
  max-height: 88dvh !important;
}

html.mobile-touch-mode.mobile-low-landscape #ui-overlay .draft-grid,
html.mobile-touch-mode.mobile-low-landscape #ui-overlay .track-choice-grid {
  max-height: none !important;
}

html.mobile-touch-mode.mobile-low-landscape #ui-overlay .overlay-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: rgba(7, 10, 22, 0.94);
  padding: 4px 8px;
  border-radius: 6px;
}

/* ==========================================================================
   STEP 3 (v0.35) — TASTO INDIETRO SCELTA PISTA, 4° POSTO ELIMINATO,
   BONUS STAGE 60s & BOX REPLAY FOTO-FINISH (#post-race-photofinish-box)
   ========================================================================== */

.post-race-telemetry-row.has-photofinish {
  width: min(868px, 98%);
  margin: 3px auto 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 182px;
  gap: 8px;
  align-items: stretch;
}

.post-race-telemetry-row.has-photofinish .post-race-telemetry-panel {
  width: 100%;
  margin: 0;
  grid-template-columns: minmax(0, 1fr) 248px;
  gap: 7px;
}

.post-race-telemetry-row.has-photofinish .telemetry-lap-canvas {
  width: 248px;
  height: 90px;
}

.post-race-photofinish-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 5px 6px;
  background: linear-gradient(180deg, rgba(16, 20, 44, 0.98) 0%, rgba(7, 10, 22, 0.99) 100%);
  border: 2px solid #ff2a85;
  border-radius: 7px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65), 0 0 12px rgba(255, 42, 133, 0.24);
}

.photofinish-box-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.photofinish-badge {
  color: #ff2a85;
  white-space: nowrap;
}

.photofinish-delta {
  color: #ffd319;
  white-space: nowrap;
}

.photofinish-preview-canvas {
  display: block;
  width: 160px;
  height: 90px;
  aspect-ratio: 160 / 90;
  border: 1px solid rgba(45, 226, 230, 0.65);
  border-radius: 4px;
  background: #050814;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.photofinish-dl-btn {
  width: 100%;
  padding: 4px 6px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  line-height: 1.15;
  border-color: #ffd319 !important;
  color: #ffd319 !important;
  white-space: nowrap;
}

.photofinish-dl-btn:hover {
  background: rgba(255, 211, 25, 0.16) !important;
}

.podium-elimination-banner {
  width: min(810px, 97%);
  margin: 0 auto 5px;
  padding: 5px 12px;
  border: 2px solid #ff1e42;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.78) 0%, rgba(159, 18, 57, 0.72) 50%, rgba(127, 29, 29, 0.78) 100%);
  color: #ffe4e6;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
  text-shadow: 0 0 10px rgba(255, 30, 66, 0.65);
  box-shadow: 0 0 16px rgba(255, 30, 66, 0.32);
}

#btn-track-choice-back {
  border-color: #2de2e6;
  color: #e0f2fe;
  font-weight: 800;
}

#btn-start-heli-survival {
  border-color: #ff2a85;
  color: #ffd319;
  font-weight: 800;
}

html.mobile-touch-mode #ui-overlay .post-race-telemetry-row.has-photofinish {
  width: min(96dvw, 830px);
  margin: 2px auto 3px;
  grid-template-columns: minmax(0, 1fr) 152px;
  gap: 5px;
}

html.mobile-touch-mode #ui-overlay .post-race-telemetry-row.has-photofinish .post-race-telemetry-panel {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  padding: 3px 5px;
}

html.mobile-touch-mode #ui-overlay .post-race-photofinish-box {
  padding: 3px 4px;
  gap: 3px;
}

html.mobile-touch-mode #ui-overlay .photofinish-preview-canvas {
  width: 140px;
  height: 79px;
}

html.mobile-touch-mode #ui-overlay #btn-track-choice-back,
html.mobile-touch-mode #ui-overlay #btn-download-photofinish,
html.mobile-touch-mode #ui-overlay #btn-start-heli-survival {
  min-height: 38px;
  padding: 5px 10px !important;
  touch-action: manipulation;
}

html.mobile-touch-mode #ui-overlay .podium-elimination-banner {
  width: min(96dvw, 790px);
  padding: 3px 8px;
  font-size: clamp(10px, 2.3dvh, 12.5px);
  margin-bottom: 3px;
}

/* ==========================================================================
   STEP 2 (v0.36) — SELETTORE GRAFICO 2X HD / 1X RETRO (#btn-gfx-scale)
   ========================================================================== */
#top-bar .toggles {
  align-items: center;
  gap: 6px;
}

.gfx-scale-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 28px;
  line-height: 1;
  white-space: nowrap;
  border-color: #475569;
  color: #cbd5e1;
  background: #191e33;
  transition: transform 0.08s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.arcade-btn.gfx-scale-btn:hover,
.garage-util-btn.gfx-scale-btn:hover {
  border-color: var(--neon-cyan);
  color: #f8fafc;
  background: #222b4d;
}

.arcade-btn.gfx-scale-btn.active-gfx-hd,
.garage-util-btn.gfx-scale-btn.active-gfx-hd {
  border-color: var(--neon-cyan);
  color: var(--neon-yellow);
  background: linear-gradient(135deg, rgba(45, 226, 230, 0.18) 0%, rgba(255, 211, 25, 0.16) 100%);
  box-shadow:
    0 0 10px rgba(45, 226, 230, 0.34),
    inset 0 0 6px rgba(255, 211, 25, 0.22);
  text-shadow: 0 0 6px rgba(255, 211, 25, 0.45);
}

.arcade-btn.gfx-scale-btn.active-gfx-hd:hover,
.garage-util-btn.gfx-scale-btn.active-gfx-hd:hover {
  border-color: var(--neon-yellow);
  color: #fffbeb;
  background: linear-gradient(135deg, rgba(45, 226, 230, 0.26) 0%, rgba(255, 211, 25, 0.24) 100%);
}

.gfx-scale-btn:focus-visible {
  outline: 2px solid var(--neon-yellow);
  outline-offset: 2px;
}

@media (max-width: 1560px) {
  html:not(.mobile-touch-mode) #top-bar {
    gap: 8px;
  }
  html:not(.mobile-touch-mode) #top-bar .toggles {
    gap: 5px;
    flex-wrap: nowrap;
  }
  html:not(.mobile-touch-mode) #top-bar .arcade-btn {
    font-size: 11.5px;
    padding: 4px 7px;
  }
}

html.mobile-touch-mode #top-bar .toggles {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

html.mobile-touch-mode #top-bar .arcade-btn {
  min-height: 28px;
  padding: 2px 6px;
  font-size: clamp(8.5px, 2dvh, 10px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

html.mobile-touch-mode #top-bar #btn-gfx-scale,
html.mobile-touch-mode #ui-overlay #btn-garage-gfx-scale {
  min-height: 28px;
  padding: 3px 7px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ==========================================================================
   STEP 1 (v0.37) — FLUSSO PRE-GARA (HOME -> GARAGE -> SCELTA MODALITÀ -> UPGRADE),
   AURA LUMINOSA BUY A COFFEE, DOCK DEMO ATTRACT & BACHECA TROFEI MOBILE
   ========================================================================== */

@keyframes coffeeAuraPulse {
  0%, 100% {
    border-color: #ffb703;
    box-shadow:
      0 0 8px rgba(255, 183, 3, 0.55),
      0 0 18px rgba(255, 107, 0, 0.35),
      inset 0 0 8px rgba(255, 183, 3, 0.22);
  }
  50% {
    border-color: #ff6b00;
    box-shadow:
      0 0 14px rgba(255, 183, 3, 0.88),
      0 0 28px rgba(255, 107, 0, 0.58),
      0 0 38px rgba(255, 183, 3, 0.28),
      inset 0 0 12px rgba(255, 183, 3, 0.38);
  }
}

#btn-buy-coffee {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1.5px solid #ffb703 !important;
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.22) 0%, rgba(255, 107, 0, 0.18) 100%) !important;
  color: #fff3b0 !important;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px rgba(255, 183, 3, 0.55);
  animation: coffeeAuraPulse 2.4s ease-in-out infinite;
  transition: transform 0.14s ease, color 0.14s ease, background 0.14s ease;
}

#btn-buy-coffee:hover {
  transform: translateY(-1px) scale(1.03);
  color: #ffffff !important;
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.34) 0%, rgba(255, 107, 0, 0.28) 100%) !important;
}

/* Home Page Pilot Name Box (#home-pilot-box) */
.home-pilot-box {
  width: min(500px, 94%);
  margin: 6px auto 10px;
  padding: 9px 14px;
  border-radius: 7px;
  background: rgba(11, 16, 36, 0.92);
  border: 1.5px solid rgba(45, 226, 230, 0.55);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55), inset 0 0 12px rgba(45, 226, 230, 0.08);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.home-pilot-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.home-pilot-row .garage-pilot-label {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--neon-cyan);
  white-space: nowrap;
}

.home-pilot-row .garage-pilot-input {
  flex: 1 1 180px;
  max-width: 240px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  border-radius: 5px;
  border: 1.5px solid var(--neon-yellow);
  background: #080c1c;
  color: #ffffff;
  text-align: center;
}

/* Intermediate Game Mode Selection Screen (#modal-game-mode-select) */
#modal-game-mode-select.game-mode-select-panel {
  width: min(900px, 97%);
  margin: 0 auto;
  padding: 12px 18px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(12, 17, 38, 0.97) 0%, rgba(7, 10, 23, 0.99) 100%);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.78), 0 0 24px rgba(45, 226, 230, 0.22);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.game-mode-select-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1.5px solid rgba(45, 226, 230, 0.32);
}

.game-mode-select-title-block h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  color: var(--neon-yellow);
  letter-spacing: 0.05em;
}

.game-mode-select-title-block p {
  margin: 3px 0 0;
  font-size: 12px;
  color: #cbd5e1;
}

.game-mode-pilot-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 211, 25, 0.48);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: #f8fafc;
}

.game-mode-select-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.game-mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 11px 14px;
  border-radius: 7px;
  border: 2px solid #2b3968;
  background: linear-gradient(155deg, rgba(18, 25, 54, 0.95) 0%, rgba(10, 14, 30, 0.98) 100%);
  color: #f8fafc;
  text-align: left;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.game-mode-card:hover,
.game-mode-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--neon-yellow);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 16px rgba(255, 211, 25, 0.28);
  outline: none;
}

.game-mode-card.mode-card-champ {
  border-color: rgba(255, 211, 25, 0.72);
  background: linear-gradient(155deg, rgba(255, 211, 25, 0.13) 0%, rgba(12, 18, 38, 0.98) 100%);
}

.game-mode-card.mode-card-ta {
  border-color: rgba(45, 226, 230, 0.68);
  background: linear-gradient(155deg, rgba(45, 226, 230, 0.12) 0%, rgba(12, 18, 38, 0.98) 100%);
}

.game-mode-card.mode-card-ghost {
  border-color: rgba(232, 121, 249, 0.68);
  background: linear-gradient(155deg, rgba(232, 121, 249, 0.13) 0%, rgba(12, 18, 38, 0.98) 100%);
}

.game-mode-card.mode-card-heli {
  border-color: rgba(255, 42, 133, 0.72);
  background: linear-gradient(155deg, rgba(255, 42, 133, 0.14) 0%, rgba(12, 18, 38, 0.98) 100%);
}

.game-mode-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.game-mode-card-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.03em;
}

.game-mode-card.mode-card-champ .game-mode-card-title { color: var(--neon-yellow); }
.game-mode-card.mode-card-ta .game-mode-card-title { color: var(--neon-cyan); }
.game-mode-card.mode-card-ghost .game-mode-card-title { color: #f0abfc; }
.game-mode-card.mode-card-heli .game-mode-card-title { color: #ff5b9e; }

.game-mode-card-desc {
  font-size: 12px;
  line-height: 1.35;
  color: #cbd5e1;
  margin: 0;
}

.game-mode-card-badge {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: rgba(7, 11, 24, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
}

.game-mode-select-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid rgba(45, 226, 230, 0.24);
}

/* Smartphone overrides under html.mobile-touch-mode */
html.mobile-touch-mode #modal-trophy-board.trophy-board-dialog {
  width: min(96dvw, 1180px) !important;
  max-width: 1180px !important;
  max-height: 90dvh !important;
}

html.mobile-touch-mode #modal-trophy-board .trophy-board-card-title {
  font-size: 12.5px;
}

html.mobile-touch-mode #modal-trophy-board .trophy-board-card-desc {
  font-size: 12.5px;
  line-height: 1.32;
}

html.mobile-touch-mode #modal-trophy-board .trophy-board-card-reward {
  font-size: 11px;
}

html.mobile-touch-mode #attract-bottom-dock {
  bottom: max(10px, env(safe-area-inset-bottom, 10px));
  padding: 5px 10px;
  gap: 6px 10px;
}

html.mobile-touch-mode #modal-game-mode-select.game-mode-select-panel {
  width: min(96dvw, 880px);
  max-height: 88dvh;
  overflow-y: auto;
  padding: 8px 12px;
  gap: 7px;
}

html.mobile-touch-mode .game-mode-card {
  padding: 8px 10px;
  min-height: 44px;
  touch-action: manipulation;
}


/* --- Admin Scheda 📖 BOOK ILLUSTRATIVO (#adm-panel-book) --- */
.adm-book-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 2px 10px;
}

.adm-book-hero-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(14, 22, 46, 0.96) 0%, rgba(9, 13, 28, 0.96) 100%);
  border: 1px solid rgba(45, 226, 230, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.38);
}

.adm-book-hero-info {
  flex: 1 1 520px;
  min-width: 260px;
}

.adm-book-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.adm-book-main-title {
  font-family: "Orbitron", sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: #ffd319;
  letter-spacing: 0.04em;
}

.adm-book-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(45, 226, 230, 0.14);
  border: 1px solid rgba(45, 226, 230, 0.45);
  color: #2de2e6;
}

.adm-book-status-pill.is-ready {
  background: rgba(56, 242, 118, 0.16);
  border-color: rgba(56, 242, 118, 0.55);
  color: #38f276;
}

.adm-book-desc {
  margin: 0 0 6px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #cbd5e1;
}

.adm-book-meta-line {
  font-size: 11.5px;
  color: #94a3b8;
}

.adm-book-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.adm-book-btn {
  padding: 10px 14px !important;
  font-size: 12px !important;
  white-space: nowrap;
}

.adm-book-progress-wrap {
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(11, 16, 34, 0.95);
  border: 1px solid rgba(255, 211, 25, 0.5);
}

.adm-book-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #ffd319;
  margin-bottom: 6px;
}

.adm-book-progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #070a16;
  border: 1px solid rgba(45, 226, 230, 0.35);
  overflow: hidden;
}

.adm-book-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2de2e6 0%, #38f276 60%, #ffd319 100%);
  transition: width 0.18s ease;
}

.adm-book-preview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.adm-book-preview-grid.has-items {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.adm-book-empty-state {
  text-align: center;
  padding: 28px 20px;
  border-radius: 10px;
  background: rgba(10, 15, 32, 0.82);
  border: 1px dashed rgba(45, 226, 230, 0.38);
  color: #cbd5e1;
}

.adm-book-empty-ico {
  font-size: 32px;
  margin-bottom: 6px;
}

.adm-book-empty-state h3 {
  margin: 0 0 6px;
  font-family: "Orbitron", sans-serif;
  font-size: 14.5px;
  color: #2de2e6;
}

.adm-book-empty-state p {
  margin: 0 auto;
  max-width: 720px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #94a3b8;
}

.adm-book-shot-card {
  border-radius: 8px;
  overflow: hidden;
  background: rgba(9, 14, 30, 0.94);
  border: 1px solid rgba(45, 226, 230, 0.32);
  display: flex;
  flex-direction: column;
}

.adm-book-shot-thumb-wrap {
  position: relative;
  background: #050711;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  cursor: zoom-in;
}

.adm-book-shot-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #050711;
}

.adm-book-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(3, 6, 15, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  cursor: zoom-out;
}

.adm-book-zoom-overlay.hidden {
  display: none !important;
}

.adm-book-zoom-img {
  width: min(94vw, 1520px);
  height: auto;
  max-height: 84vh;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border: 2px solid #2de2e6;
  border-radius: 8px;
  background: #050711;
  box-shadow: 0 0 36px rgba(45, 226, 230, 0.35);
}

.adm-book-zoom-caption {
  margin-top: 10px;
  color: #ffd319;
  font-family: "Orbitron", sans-serif;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.adm-book-shot-idx {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(6, 9, 20, 0.88);
  border: 1px solid rgba(255, 211, 25, 0.5);
  color: #ffd319;
  font-size: 10px;
  font-weight: 700;
}

.adm-book-shot-meta {
  padding: 8px 10px;
}

.adm-book-shot-meta strong {
  display: block;
  font-size: 12px;
  color: #f8fafc;
  margin-bottom: 2px;
}

.adm-book-shot-meta span {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.35;
}

.book-capture-hud-toast {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 99999;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(7, 11, 24, 0.94);
  border: 2px solid #ffd319;
  color: #ffd319;
  font-family: "Orbitron", sans-serif;
  font-size: 11.5px;
  font-weight: 800;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

/* --- STEP 1 & 2 (v0.41): Replay TV Broadcast '86 (5s), Condivisione Sfida & Onboarding Home --- */
.photofinish-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.photofinish-replay-btn,
.photofinish-share-btn {
  width: 100%;
  padding: 5px 8px !important;
  font-size: 10.5px !important;
  white-space: nowrap;
}

.sprint-replay-dialog {
  width: min(94vw, 980px) !important;
  max-width: 980px !important;
  padding: 14px 16px !important;
  background: linear-gradient(180deg, #0b1024 0%, #060914 100%) !important;
  border: 2px solid #2de2e6 !important;
  border-radius: 10px !important;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.9), 0 0 32px rgba(45, 226, 230, 0.3) !important;
}

.sprint-replay-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(45, 226, 230, 0.35);
}

.sprint-replay-rec-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sprint-replay-rec-pill h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 900;
  color: #ffd319;
  letter-spacing: 0.05em;
}

.sprint-rec-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff1e42;
  box-shadow: 0 0 10px #ff1e42;
  animation: sprintRecBlink 0.85s infinite alternate;
}

@keyframes sprintRecBlink {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.25; transform: scale(0.86); }
}

.sprint-replay-timecode {
  font-family: "Orbitron", monospace;
  font-size: 12px;
  font-weight: 800;
  color: #38f276;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(8, 14, 28, 0.9);
  border: 1px solid rgba(56, 242, 118, 0.45);
}

.sprint-replay-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #04060e;
  border: 2px solid #354170;
  border-radius: 8px;
  overflow: hidden;
}

#sprint-replay-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: contrast(1.06) saturate(1.12);
}

.sprint-replay-vhs-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.22) 3px,
      rgba(0, 0, 0, 0) 4px
    ),
    radial-gradient(circle at 50% 50%, transparent 62%, rgba(2, 4, 12, 0.62) 100%);
  box-shadow: inset 2px 0 6px rgba(255, 30, 66, 0.22), inset -2px 0 6px rgba(45, 226, 230, 0.22);
}

.sprint-replay-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* Onboarding Rapido Primo Avvio & Banner Sfida Condivisa */
.home-pilot-box.is-onboarding-highlight {
  border: 2px solid #ffd319 !important;
  box-shadow: 0 0 18px rgba(255, 211, 25, 0.42), inset 0 0 12px rgba(255, 211, 25, 0.14) !important;
  animation: onboardPulseGlow 1.6s infinite alternate;
}

@keyframes onboardPulseGlow {
  0% { box-shadow: 0 0 12px rgba(255, 211, 25, 0.32); }
  100% { box-shadow: 0 0 24px rgba(56, 242, 118, 0.55); }
}

.onboard-step-tag {
  display: inline-block;
  padding: 2px 8px;
  margin-bottom: 4px;
  border-radius: 4px;
  background: rgba(255, 211, 25, 0.2);
  border: 1px solid #ffd319;
  color: #ffd319;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

#home-onboarding-badge {
  margin: 6px auto 4px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(11, 18, 38, 0.92);
  border: 1px solid rgba(45, 226, 230, 0.55);
  color: #2de2e6;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  max-width: 96%;
}

.home-challenge-banner {
  margin: 6px auto 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 42, 133, 0.22) 0%, rgba(45, 226, 230, 0.2) 100%);
  border: 1.5px solid #ffd319;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.share-toast-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(56, 242, 118, 0.2);
  border: 1px solid #38f276;
  color: #38f276;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
}

/* --- STEP 1 (v0.43): Modalità Sito in Manutenzione (Preavviso 2 Minuti & Blocco Totale) --- */
.maintenance-countdown-banner {
  position: fixed;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99950;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  width: min(96vw, 1080px);
  padding: 8px 16px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.96) 0%, rgba(180, 83, 9, 0.96) 50%, rgba(127, 29, 29, 0.96) 100%);
  border: 2px solid #ffd319;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 12.5px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.8), 0 0 22px rgba(255, 211, 25, 0.45);
  pointer-events: none;
}

.maintenance-countdown-banner.hidden,
.maintenance-lock-overlay.hidden {
  display: none !important;
}

.maint-blink-ico {
  font-size: 16px;
  animation: sprintRecBlink 0.6s infinite alternate;
}

#maint-countdown-clock {
  color: #ffd319;
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.maint-countdown-msg {
  font-family: "Chakra Petch", sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  color: #fef3c7;
}

.maintenance-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 99980;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(5, 8, 18, 0.97) 0px,
      rgba(5, 8, 18, 0.97) 3px,
      rgba(12, 18, 38, 0.98) 4px
    );
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.maintenance-lock-card {
  width: min(94vw, 680px);
  padding: 28px 26px 22px;
  border-radius: 12px;
  background: linear-gradient(180deg, #101730 0%, #080c1a 100%);
  border: 2.5px solid #ffd319;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.92), 0 0 38px rgba(255, 211, 25, 0.28);
  text-align: center;
  overflow: hidden;
  position: relative;
}

.maint-stripes-bar {
  height: 12px;
  margin: -28px -26px 20px;
  background: repeating-linear-gradient(
    -45deg,
    #ffd319 0px,
    #ffd319 14px,
    #0f172a 14px,
    #0f172a 28px
  );
  border-bottom: 2px solid #ffd319;
}

.maint-lock-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  color: #ffd319;
  letter-spacing: 0.04em;
  text-shadow: 0 0 16px rgba(255, 211, 25, 0.38);
}

.maint-lock-msg {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: #f1f5f9;
}

.maint-lock-pulse-pill {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(45, 226, 230, 0.14);
  border: 1px solid rgba(45, 226, 230, 0.5);
  color: #2de2e6;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
}

.maint-admin-btn {
  display: block;
  margin: 0 auto;
  font-size: 11px !important;
  padding: 6px 12px !important;
  opacity: 0.78;
}

.maint-admin-btn:hover {
  opacity: 1;
}

#ui-overlay.admin-fullscreen-view,
#ui-overlay.admin-maint-elevated {
  z-index: 99990 !important;
}

#ui-overlay.admin-maint-elevated {
  position: fixed;
  inset: 0;
}

.admin-maint-card {
  border-color: rgba(255, 211, 25, 0.65) !important;
  background: linear-gradient(135deg, rgba(40, 28, 10, 0.52) 0%, rgba(12, 18, 36, 0.94) 100%) !important;
}

/* ==========================================================================
   RELEASE v0.46 — CORNICI ESTERNE CRT BOMBATE & TUBI NEON DISEGNATI (9-SLICE + FULL STAGE)
   ========================================================================== */

:root {
  --bezel-shell-bg: #070a18;
  --bezel-groove-dark: #050814;
  --bezel-tmolding-cyan: #00f0ff;
  --bezel-tmolding-inner: #d946ef;
  --bezel-tmolding-gold: #ffb703;
}

/* 1. Calcolo Esatto Larghezza Cabinato (`--cabinet-total-width`) & Allineamento 1:1 al Pixel */
#arcade-cabinet.arcade-cabinet-shell {
  --cabinet-gap: 10px;
  --cabinet-hof-w: 318px;
  --cabinet-screen-w: min(1410px, calc(97dvw - 328px), calc((100dvh - 98px) * 16 / 9));
  --cabinet-total-width: calc(var(--cabinet-screen-w) + var(--cabinet-hof-w) + var(--cabinet-gap));
  height: 100dvh;
  max-height: 100dvh;
  padding: 5px 12px;
  gap: 5px;
  justify-content: space-between;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #0c1026 0%, #03040a 80%);
}

#arcade-cabinet.arcade-cabinet-shell.size-medium {
  --cabinet-hof-w: 304px;
  --cabinet-screen-w: min(910px, calc(94dvw - 314px), calc((100dvh - 104px) * 16 / 9));
  --cabinet-total-width: calc(var(--cabinet-screen-w) + var(--cabinet-hof-w) + var(--cabinet-gap));
}

#arcade-cabinet.arcade-cabinet-shell.size-full {
  --cabinet-hof-w: 318px;
  --cabinet-screen-w: min(calc(99dvw - 328px), calc((100dvh - 92px) * 16 / 9));
  --cabinet-total-width: calc(var(--cabinet-screen-w) + var(--cabinet-hof-w) + var(--cabinet-gap));
}

#arcade-cabinet.arcade-cabinet-shell #top-bar,
#arcade-cabinet.arcade-cabinet-shell #stage-layout,
#arcade-cabinet.arcade-cabinet-shell #controls-bar {
  width: var(--cabinet-mapped-width, var(--cabinet-total-width)) !important;
  max-width: var(--cabinet-mapped-width, var(--cabinet-total-width)) !important;
  box-sizing: border-box;
}

#arcade-cabinet.arcade-cabinet-shell #stage-layout {
  flex: 1 1 0;
  min-height: 0;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--cabinet-gap);
}

/* 2. Top Bar & Controls Bar con Asset 9-Slice Disegnato (`frame_topbar_9slice.png`) */
#top-bar.cabinet-marquee-bar.arcade-bezel-frame {
  position: relative;
  flex: 0 0 auto;
  padding: 6px 18px;
  gap: clamp(6px, 0.55dvw, 10px);
  background: transparent !important;
  border-style: solid !important;
  border-width: 11px 26px !important;
  border-image: url('./assets/frame_topbar_9slice.png') 28 64 fill / 11px 26px / 0 stretch !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.85) !important;
}

#top-bar.cabinet-marquee-bar .brand {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.45dvw, 7px);
  min-width: 0;
  flex-shrink: 1;
  font-size: clamp(11px, 0.85dvw, 13.5px);
}

#top-bar.cabinet-marquee-bar .toggles {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(3px, 0.35dvw, 6px);
  min-width: 0;
  flex-shrink: 1;
  flex-wrap: nowrap;
}

#top-bar.cabinet-marquee-bar .arcade-btn {
  padding: clamp(3px, 0.38dvh, 5px) clamp(5px, 0.5dvw, 9px);
  font-size: clamp(9.5px, 0.72dvw, 11.5px);
  white-space: nowrap;
  flex-shrink: 0;
}

#arcade-cabinet.size-medium #top-bar.cabinet-marquee-bar.arcade-bezel-frame {
  padding: 4px 12px;
  border-width: 9px 20px !important;
  border-image-width: 9px 20px !important;
}

#arcade-cabinet.size-medium #top-bar.cabinet-marquee-bar .brand {
  font-size: 10.5px;
  gap: 4px;
}

#arcade-cabinet.size-medium #top-bar.cabinet-marquee-bar .toggles {
  gap: 3px;
}

#arcade-cabinet.size-medium #top-bar.cabinet-marquee-bar .arcade-btn {
  padding: 3px 5px;
  font-size: 9px;
}

@media (max-width: 1480px) {
  #top-bar.cabinet-marquee-bar.arcade-bezel-frame {
    padding: 4px 12px;
    border-width: 9px 20px !important;
    border-image-width: 9px 20px !important;
    gap: 4px;
  }

  #top-bar.cabinet-marquee-bar .brand {
    font-size: 10.5px;
    gap: 4px;
  }

  #top-bar.cabinet-marquee-bar #top-rev-badge {
    display: none;
  }

  #top-bar.cabinet-marquee-bar .toggles {
    gap: 3px;
  }

  #top-bar.cabinet-marquee-bar .arcade-btn {
    padding: 3px 5px;
    font-size: 9px;
  }
}

#controls-bar.cabinet-deck-bar.arcade-bezel-frame {
  position: relative;
  flex: 0 0 auto;
  padding: 3px 18px;
  background: transparent !important;
  border-style: solid !important;
  border-width: 8px 24px !important;
  border-image: url('./assets/frame_topbar_9slice.png') 28 64 fill / 8px 24px / 0 stretch !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.8) !important;
}

/* 3. Monitor Principale di Gioco 16:9 con Cornice CRT Bombata + Triplo Tubo Neon (`frame_cabinet_crt_16x9.png`) */
#screen-frame.crt-bezel-frame.arcade-bezel-frame {
  position: relative;
  align-self: center;
  width: var(--cabinet-screen-w) !important;
  flex: 0 0 var(--cabinet-screen-w) !important;
  max-height: 100%;
  border: none !important;
  outline: none !important;
  border-radius: 16px;
  padding: 2.1% 2.15%;
  background: #040610;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.92), 0 0 26px rgba(88, 28, 135, 0.22);
}

#screen-frame .crt-drawn-bezel-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 16;
  background: url('./assets/frame_cabinet_crt_16x9.png') no-repeat center / 100% 100%;
}

/* Quando è attivo GARAGE '86, usa la cornice sagomata a gradini 45° identica alla foto! */
#stage-layout.garage-fullstage #screen-frame .crt-drawn-bezel-overlay {
  background-image: url('./assets/frame_garage_stage_overlay.png');
}

.crt-glass-sheen {
  position: absolute;
  inset: 2%;
  border-radius: 8px;
  pointer-events: none;
  z-index: 4;
  background:
    radial-gradient(circle at 6% 6%, rgba(255, 255, 255, 0.05) 0%, transparent 16%),
    radial-gradient(circle at 94% 6%, rgba(0, 229, 255, 0.04) 0%, transparent 16%);
}

/* 4. Monitor Laterale Hall of Fame con Cornice CRT Verticale Disegnata (`frame_hiscore_9slice.png`) */
#leaderboard-panel.hiscore-monitor-frame.arcade-bezel-frame {
  position: relative;
  width: var(--cabinet-hof-w) !important;
  flex: 0 0 var(--cabinet-hof-w) !important;
  align-self: center;
  height: calc(var(--cabinet-screen-w) * 9 / 16);
  max-height: 100%;
  overflow: visible;
  padding: 18px 18px 14px;
  background: transparent !important;
  border-style: solid !important;
  border-width: 24px 20px !important;
  border-image: url('./assets/frame_hiscore_9slice.png') 64 48 fill / 24px 20px / 0 stretch !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.88) !important;
}

#leaderboard-panel .frame-recessed-badge {
  top: -21px;
  background: #080c1e;
  border: none !important;
  color: #ffffff;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  padding: 0 8px;
  box-shadow: none;
  text-shadow: 0 0 8px rgba(168, 85, 247, 0.65);
}

/* 5. Tutte le Finestre Modali, Admin, Scelta Modalità, Trofei, Roadmap & Changelog con `frame_monitor_9slice.png` */
.arcade-panel-framed,
.game-mode-select-panel,
.admin-modal-panel,
.save-modal-panel,
.workshop-panel,
.trophy-board-panel,
dialog.crt-policy-dialog {
  position: relative;
  background-color: #080c1e !important;
  border-style: solid !important;
  border-width: 22px !important;
  border-image: url('./assets/frame_monitor_9slice.png') 96 / 24px / 0 stretch !important;
  border-radius: 14px !important;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.9) !important;
}

.frame-recessed-badge {
  position: absolute;
  top: -19px;
  left: 26px;
  transform: none;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffffff;
  background: #080c1e;
  border: none;
  padding: 0 8px;
  z-index: 8;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.45);
}

.title-hero-box {
  border-style: solid !important;
  border-width: 16px !important;
  border-image: url('./assets/frame_monitor_9slice.png') 96 / 18px / 0 stretch !important;
  background-color: rgba(7, 10, 24, 0.92) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.88), 0 0 28px rgba(168, 85, 247, 0.24) !important;
}

.post-race-telemetry-panel,
.post-race-photofinish-box {
  border-style: solid !important;
  border-width: 12px !important;
  border-image: url('./assets/frame_inner_box_9slice.png') 48 fill / 14px / 0 stretch !important;
}

/* 6. Riquadri Interni Doppia Linea Neon (`VETTURA`, `LIVREE`, `CASCHI`, `MOTORI`) con Titolo Bianco nel Taglio Aperto */
.drawn-inner-box {
  position: relative;
  background: transparent !important;
  border-style: solid !important;
  border-width: 14px !important;
  border-image: url('./assets/frame_inner_box_9slice.png') 48 fill / 15px / 0 stretch !important;
}

.frame-gap-title {
  position: absolute;
  top: -11px;
  left: 16px;
  z-index: 6;
  padding: 0 9px;
  background: #060916;
  font-family: var(--font-display);
  font-size: clamp(12px, 1.45dvh, 16px);
  font-weight: 900;
  letter-spacing: 0.09em;
  line-height: 1.1;
  color: #ffffff;
  text-transform: uppercase;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

/* 7. NUOVO "GARAGE '86" CALIBRATO AL MILLIMETRO SULLA CORNICE DISEGNATA `frame_garage_stage_overlay.png` */
#stage-layout.garage-fullstage {
  align-items: stretch !important;
}

#stage-layout.garage-fullstage #screen-frame,
#stage-layout.garage-fullstage #screen-frame.crt-bezel-frame.arcade-bezel-frame {
  width: 100% !important;
  max-width: 100% !important;
  flex: 1 1 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  aspect-ratio: auto !important;
  background: #060916 !important;
}

#ui-overlay.garage-view {
  padding: 0 !important;
  overflow: hidden !important;
  background: radial-gradient(circle at 50% 18%, #0c1229 0%, #050814 78%);
}

#ui-overlay.garage-view #garage-crt-shell {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 100%;
  /* Calibrazione esatta sulle coordinate 1600x900 di frame_garage_stage_overlay.png:
     - Header entro y=144 (16%), Colonne y=168..816 (18.6%..90.6%), Footer sotto la linea neon y=846..886 */
  padding: 1.9% 3.8% 1.3%;
  display: grid;
  grid-template-rows: minmax(0, 15.6%) minmax(0, 1fr) auto;
  gap: clamp(5px, 0.85dvh, 9px);
  overflow: hidden;
  text-align: left;
}

/* Header Garage '86: tasti sinistra sulla spalla, logo GARAGE '86 nell'arco centrale, SCENDI IN PISTA nella nicchia destra */
.garage-crt-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 10px;
  padding: 0 2px;
  background: transparent;
  border: none;
  box-shadow: none;
  z-index: 18;
}

.garage-hdr-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.garage-hdr-btn {
  font-family: var(--font-display);
  font-size: clamp(9.5px, 0.72dvw, 11px);
  font-weight: 800;
  color: #dbeafe;
  background: rgba(12, 18, 40, 0.92);
  border: 1.5px solid rgba(96, 165, 250, 0.65);
  border-radius: 5px;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.garage-hdr-btn:hover {
  border-color: #ffffff;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.45);
}

.garage-hdr-btn.is-gold {
  border-color: rgba(255, 211, 25, 0.78);
  color: #ffd319;
}

.garage-hdr-btn.active-gfx-hd {
  border-color: #34d399;
  color: #34d399;
}

.garage-hdr-btn.is-icon-only {
  padding: 4px 6px;
}

/* Centro Header: Immagine Disegnata `logo_garage86_chrome.png` + Sottotitolo Ciano + Saldo Chiavi Oro */
.garage-hdr-center {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.garage-chrome-logo-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.garage-drawn-logo-img {
  height: clamp(38px, 6.2dvh, 62px);
  width: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 3px 10px rgba(255, 90, 20, 0.35));
}

.garage-sub-edition-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.garage-gnik-sub {
  font-family: var(--font-display);
  font-size: clamp(12px, 1.55dvh, 16px);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #00e5ff;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.65);
}

.garage-wrench-gold-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-size: clamp(13px, 1.65dvh, 18px);
  font-weight: 900;
  color: #ffd319;
  text-shadow: 0 0 10px rgba(255, 211, 25, 0.5);
}

.garage-pilot-sep {
  color: #475569;
  font-weight: 900;
}

.garage-pilot-strip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}

.garage-pilot-lbl {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.05em;
}

.garage-pilot-inp {
  width: 112px !important;
  padding: 1px 6px !important;
  font-size: 11.5px !important;
  height: 21px;
  border-radius: 4px;
  background: rgba(9, 14, 30, 0.92) !important;
  border: 1.5px solid rgba(56, 189, 248, 0.65) !important;
}

.garage-num-inp {
  width: 44px !important;
  padding: 1px 3px !important;
  font-size: 11.5px !important;
  height: 21px;
  border-radius: 4px;
  background: rgba(9, 14, 30, 0.92) !important;
  border: 1.5px solid rgba(56, 189, 248, 0.65) !important;
}

.garage-pilot-strip .pilot-name-error {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  white-space: nowrap;
  background: #2b0918;
  border: 1px solid #ff2a85;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
}

/* Destra Header: Insegna Smeraldo `SCENDI IN PISTA ▶` (`frame_btn_scendi_9slice.png`) */
.garage-hdr-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.garage-neon-go-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: clamp(168px, 15.5dvw, 236px);
  padding: clamp(4px, 0.6dvh, 8px) clamp(12px, 1.2dvw, 18px);
  background: transparent !important;
  border-style: solid !important;
  border-width: 14px !important;
  border-image: url('./assets/frame_btn_scendi_9slice.png') 36 fill / 16px / 0 stretch !important;
  outline: none !important;
  box-shadow: 0 0 22px rgba(16, 245, 160, 0.28) !important;
  color: #5efca1;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.garage-neon-go-btn:hover {
  transform: scale(1.02);
  filter: brightness(1.14);
}

.garage-neon-go-btn .go-btn-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.08;
  font-family: var(--font-display);
  font-size: clamp(12px, 1.55dvh, 17px);
  font-weight: 900;
  letter-spacing: 0.07em;
  color: #6ee7b7;
  text-shadow: 0 0 10px rgba(52, 211, 153, 0.85);
}

.garage-neon-go-btn .go-btn-tri {
  font-size: clamp(16px, 2.1dvh, 24px);
  color: #6ee7b7;
  text-shadow: 0 0 12px rgba(52, 211, 153, 0.9);
}

.garage-hdr-right .garage-credit-warning {
  font-size: clamp(7.5px, 0.58dvw, 9px);
  line-height: 1.1;
  max-width: 248px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.garage-neon-go-btn:hover {
  transform: translateY(-1px) scale(1.015);
  box-shadow: 0 0 26px rgba(0, 229, 255, 0.85), 0 0 18px rgba(56, 242, 118, 0.75);
}

/* Corpo a 2 Colonne Asimmetriche: allineate alla stessa quota superiore sotto le spalle 45° (y >= 166/900) */
.garage-crt-columns {
  display: grid;
  grid-template-columns: 0.96fr 1.14fr;
  gap: clamp(8px, 1dvw, 14px);
  min-height: 0;
  height: 100%;
  padding-top: 1.1%;
  padding-bottom: 1.2%;
}

.garage-crt-col-left {
  display: grid;
  grid-template-rows: minmax(0, 1.68fr) minmax(0, 1fr);
  gap: clamp(7px, 0.9dvh, 11px);
  min-height: 0;
}

.garage-crt-col-right {
  display: grid;
  grid-template-rows: minmax(0, 1.85fr) auto;
  gap: clamp(8px, 1.1dvh, 13px);
  min-height: 0;
}

.garage-framed-box {
  margin: 0;
  min-width: 0;
  min-height: 0;
  padding: clamp(6px, 0.9dvh, 10px) clamp(8px, 0.85dvw, 12px);
  display: flex;
  flex-direction: column;
}

.is-caschi-showroom-box {
  justify-content: space-between;
  gap: clamp(4px, 0.7dvh, 9px);
}

.garage-unified-showroom {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: clamp(3px, 0.6dvh, 7px);
  padding: 2px 6px 0;
}

.garage-showroom-open-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  flex: 1 1 auto;
}

.garage-led-bars-stack.is-photo-style {
  gap: clamp(4px, 0.65dvh, 7px);
  padding: 0 4px;
}

.garage-led-bars-stack.is-photo-style .garage-led-row {
  grid-template-columns: 44px 1fr 40px;
  gap: 8px;
}

.garage-led-bars-stack.is-photo-style .garage-led-lbl {
  font-size: clamp(12px, 1.45dvh, 15px);
  color: #ffffff;
}

.garage-led-bars-stack.is-photo-style .garage-led-track {
  background: transparent;
  border: none;
  padding: 0;
  gap: 3px;
}

.garage-led-bars-stack.is-photo-style .led-seg {
  height: clamp(12px, 1.75dvh, 18px);
  border-radius: 1.5px;
}

/* Colonna Sinistra Superiore: Griglia 4x2 Vettura Verticale (-90°) */
.garage-cars-grid-4x2 {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(5px, 0.65dvw, 8px);
}

.vcar-slot-card {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(3px, 0.5dvh, 6px) 4px;
  border-radius: 7px;
  background: radial-gradient(circle at 50% 42%, #182344 0%, #0a0f20 100%);
  border: 1.5px solid rgba(45, 226, 230, 0.34);
  color: #e2e8f0;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.vcar-slot-card:hover:not(:disabled) {
  border-color: #00e5ff;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.32);
}

.vcar-slot-card.active {
  border-style: solid !important;
  border-width: 8px !important;
  border-image: url('./assets/frame_slot_active_9slice.png') 28 fill / 10px / 0 stretch !important;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.45);
  background: transparent !important;
}

.vcar-slot-card.is-special-phantom {
  border-color: rgba(250, 204, 21, 0.72);
  background: radial-gradient(circle at 50% 42%, rgba(88, 28, 135, 0.42) 0%, #0b0f22 100%);
}

.vcar-slot-card.is-special-phantom.active {
  border-color: #fde047;
  box-shadow:
    0 0 0 2px #c084fc,
    0 0 18px rgba(250, 204, 21, 0.55);
}

.vcar-slot-card:disabled {
  cursor: not-allowed;
  opacity: 0.82;
}

.vcar-canvas-stage {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vcar-canvas {
  height: 100%;
  max-height: 86px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  background: transparent !important;
  border: none !important;
}

.vcar-corner-lock {
  position: absolute;
  right: 3px;
  bottom: 2px;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(185, 28, 28, 0.92);
  border: 1px solid #fca5a5;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.65);
}

.vcar-special-star {
  position: absolute;
  top: 1px;
  right: 4px;
  font-size: 11px;
  color: #fde047;
  text-shadow: 0 0 6px rgba(250, 204, 21, 0.8);
}

.vcar-meta-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding-top: 2px;
}

.vcar-name {
  font-family: var(--font-display);
  font-size: clamp(8.5px, 0.68dvw, 10px);
  font-weight: 800;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vcar-slot-card.active .vcar-name {
  color: #00e5ff;
}

.vcar-slot-card.is-special-phantom .vcar-name {
  color: #fde047;
}

.vcar-lock-tag {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
  color: #fca5a5;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.vcar-lock-tag.can-buy {
  color: #38f276;
}

.vcar-active-dot {
  font-size: 8px;
  color: #38f276;
}

/* Colonna Sinistra Inferiore: LIVREE (4x2 con nome intero leggibile) */
.garage-liveries-grid-4x2 {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(4px, 0.55dvw, 7px);
}

.livery-slot-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 5px;
  border-radius: 6px;
  background: #0e152c;
  border: 1.5px solid rgba(148, 163, 184, 0.3);
  color: #f1f5f9;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.livery-slot-card:hover:not(:disabled) {
  border-color: #00e5ff;
}

.livery-slot-card.active {
  border: 2px solid #00e5ff;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.42), inset 0 0 10px rgba(0, 229, 255, 0.15);
  background: #142244;
}

.livery-slot-card:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.livery-slot-swatch {
  position: relative;
  width: 100%;
  max-width: 58px;
  height: clamp(13px, 1.8dvh, 18px);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
}

.livery-slot-name {
  font-family: var(--font-display);
  font-size: clamp(8px, 0.64dvw, 9.5px);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  color: #f8fafc;
  word-break: break-word;
}

.liv-slot-badge {
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 3px;
}

.liv-slot-badge.is-active {
  background: #00e5ff;
  color: #06101c;
}

.liv-slot-badge.is-owned {
  color: #38f276;
}

.liv-slot-badge.is-price,
.liv-slot-badge.is-trophy {
  color: #ffd319;
}

.liv-slot-badge.can-buy {
  color: #38f276;
}

/* Colonna Destra Superiore: Fila 1x8 CASCHI */
.garage-helmets-row-8 {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
}

.helmet-slot-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: clamp(3px, 0.5dvh, 6px) 3px;
  border-radius: 6px;
  background: #0e152c;
  border: 1.5px solid rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
  cursor: pointer;
}

.helmet-slot-btn:hover:not(:disabled) {
  border-color: #00e5ff;
}

.helmet-slot-btn.active {
  border: 2px solid #00e5ff;
  background: #15254a;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.45);
}

.helmet-slot-btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.helmet-slot-art {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.helmet-slot-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  image-rendering: pixelated;
}

.helmet-slot-img.is-locked-silhouette {
  filter: brightness(0.16) contrast(1.4) drop-shadow(0 0 2px #3b82f6);
}

.helmet-slot-lock {
  position: absolute;
  right: -2px;
  bottom: -2px;
  image-rendering: pixelated;
}

.helmet-slot-lbl {
  font-family: var(--font-display);
  font-size: 7.5px;
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.helmet-slot-tag {
  font-family: var(--font-display);
  font-size: 7.5px;
  font-weight: 900;
}

.helmet-slot-tag.is-active {
  color: #00e5ff;
}

.helmet-slot-tag.is-owned {
  color: #38f276;
}

.helmet-slot-tag.is-cost,
.helmet-slot-tag.is-trophy {
  color: #ffd319;
}

/* Colonna Destra Centrale: SHOWROOM LATERALE PNG + 4 BARRE LED 14 TACCHE BICOLORE */
.is-showroom-box {
  justify-content: center;
}

.garage-showroom-inner {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  gap: 12px;
}

.garage-showroom-stage-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.garage-showroom-car-head {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.showroom-car-title {
  font-family: var(--font-display);
  font-size: clamp(13px, 1.55dvh, 17px);
  font-weight: 900;
  color: #ffd319;
  text-shadow: 0 0 10px rgba(255, 211, 25, 0.35);
}

.showroom-car-spec {
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  color: #00e5ff;
  white-space: nowrap;
}

.garage-showroom-canvas-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(7, 11, 24, 0.95) 0%, rgba(15, 23, 48, 0.92) 100%);
  border: 1.5px solid rgba(192, 132, 252, 0.42);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.8);
}

.showroom-side-canvas {
  width: 100%;
  max-width: min(448px, 100%);
  max-height: min(150px, 18dvh);
  height: auto;
  aspect-ratio: 336 / 108;
  object-fit: contain;
  image-rendering: pixelated;
  background: transparent !important;
  border: none !important;
}

.garage-showroom-car-desc {
  font-size: clamp(10px, 1.15dvh, 11.5px);
  color: #cbd5e1;
  line-height: 1.25;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 4 Barre Orizzontali a 14 Segmenti LED Bicolore (VEL, ACC, GRP, COR) */
.garage-showroom-led-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.garage-led-legend-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 8.5px;
  font-weight: 800;
}

.led-key-dot.is-cyan {
  color: #00e5ff;
}

.led-key-dot.is-coral {
  color: #ff2a55;
}

.garage-led-bars-stack {
  display: flex;
  flex-direction: column;
  gap: clamp(5px, 0.8dvh, 8px);
}

.garage-led-row {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 6px;
}

.garage-led-lbl {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  color: #f8fafc;
  letter-spacing: 0.05em;
}

.garage-led-track {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 3px;
  padding: 3px 4px;
  border-radius: 4px;
  background: #070a14;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.led-seg {
  height: clamp(10px, 1.35dvh, 14px);
  border-radius: 2px;
}

.led-seg.is-base {
  background: #00e5ff;
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.68);
}

.led-seg.is-bonus {
  background: #ff2a55;
  box-shadow: 0 0 7px rgba(255, 42, 85, 0.78);
}

.led-seg.is-off {
  background: #3b121e;
}

.garage-led-val {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  color: #00e5ff;
  text-align: right;
}

.garage-led-val small {
  font-size: 8px;
  color: #64748b;
}

.garage-mounted-eng-pill {
  align-self: flex-end;
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  color: #38f276;
  background: rgba(56, 242, 118, 0.12);
  border: 1px solid rgba(56, 242, 118, 0.5);
  border-radius: 999px;
  padding: 2px 9px;
}

/* Colonna Destra Inferiore: Fila 1x5 MOTORI */
.garage-engines-row-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.eng-slot-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  padding: clamp(4px, 0.6dvh, 7px) 4px;
  border-radius: 7px;
  background: #0e152c;
  border: 1.5px solid rgba(45, 226, 230, 0.32);
  color: #f1f5f9;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.eng-slot-card:hover:not(:disabled) {
  border-color: #38f276;
}

.eng-slot-card.active {
  border-style: solid !important;
  border-width: 7px !important;
  border-image: url('./assets/frame_slot_active_9slice.png') 28 fill / 9px / 0 stretch !important;
  box-shadow: 0 0 14px rgba(56, 242, 118, 0.42);
  background: transparent !important;
}

.eng-slot-card.is-proto-x86 {
  border-color: rgba(250, 204, 21, 0.72);
}

.eng-slot-card.is-proto-x86.active {
  border-color: #fde047;
  box-shadow: 0 0 15px rgba(250, 204, 21, 0.55);
}

.eng-slot-card:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.eng-slot-art {
  position: relative;
  width: 100%;
  height: clamp(32px, 4.4dvh, 44px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.eng-slot-art canvas {
  max-height: 100%;
  width: auto;
  image-rendering: pixelated;
}

.eng-slot-lock {
  position: absolute;
  right: 4px;
  bottom: 0;
  image-rendering: pixelated;
}

.eng-slot-name {
  font-family: var(--font-display);
  font-size: clamp(7.5px, 0.62dvw, 9px);
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
  color: #e2e8f0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eng-slot-price {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
}

.eng-slot-price.is-active {
  color: #38f276;
}

.eng-slot-price.is-owned {
  color: #00e5ff;
}

.eng-slot-price.is-cost {
  color: #ffd319;
}

.eng-slot-price.can-buy {
  color: #38f276;
}

/* Barra Inferiore incassata nella vaschetta sagomata di `frame_garage_stage_overlay.png` */
.garage-crt-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 2px 18px 0;
  background: transparent;
  border: none;
  z-index: 18;
}

.garage-footer-reset-btn {
  justify-self: start;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  color: #fda4af;
  background: rgba(88, 18, 32, 0.55);
  border: 1px solid rgba(255, 42, 133, 0.6);
  border-radius: 4px;
  padding: 2px 9px;
  cursor: pointer;
}

.garage-footer-reset-btn:hover {
  background: rgba(185, 28, 28, 0.72);
  color: #ffffff;
}

.garage-footer-coin-btn {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: clamp(11px, 1.35dvh, 14px);
  font-weight: 900;
  color: #fde047;
  background: transparent;
  border: none;
  padding: 1px 10px;
  cursor: pointer;
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.45);
}

.garage-footer-coin-btn .coin-num-green {
  color: #4ade80;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.75);
}

.garage-footer-coin-btn:hover {
  filter: brightness(1.2);
}

.footer-coin-cta {
  color: #fbbf24;
  font-size: clamp(11px, 1.3dvh, 13.5px);
}

.garage-footer-mode-pill {
  justify-self: end;
  font-family: var(--font-display);
  font-size: clamp(10.5px, 1.25dvh, 13px);
  font-weight: 800;
  color: #22d3ee;
  letter-spacing: 0.07em;
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.45);
}

/* 8. ISOLAMENTO MOBILE LANDSCAPE (`html.mobile-touch-mode`): Cornice Ultra-Sottile 2px */
html.mobile-touch-mode #arcade-cabinet.arcade-cabinet-shell {
  padding: 0 !important;
  gap: 0 !important;
}

html.mobile-touch-mode .crt-drawn-bezel-overlay,
html.mobile-touch-mode .crt-glass-sheen {
  display: none !important;
}

html.mobile-touch-mode #screen-frame.crt-bezel-frame.arcade-bezel-frame {
  padding: 0 !important;
  border: 2px solid rgba(0, 229, 255, 0.78) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

html.mobile-touch-mode #ui-overlay.garage-view {
  overflow-y: auto !important;
}

html.mobile-touch-mode #ui-overlay.garage-view #garage-crt-shell {
  height: auto;
  min-height: 100%;
  padding: 4px 6px;
  gap: 5px;
}

html.mobile-touch-mode .garage-crt-header {
  grid-template-columns: 1fr auto;
  padding: 4px 8px;
}

html.mobile-touch-mode .garage-hdr-left {
  grid-column: 1 / -1;
}

html.mobile-touch-mode .garage-showroom-inner {
  grid-template-columns: 1fr;
}

