* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-panel: rgba(14, 16, 20, 0.86);
  --bg-tile: rgba(24, 27, 33, 0.88);
  --border-thin: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.28);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --accent-orange: #f97316;
  --accent-cream: #f3f1ea;
  --danger: #ef4444;
  --ok: #22c55e;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0d11;
  color: var(--text-main);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  user-select: none;
}

#sim-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

.hidden {
  display: none !important;
}

.th-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-thin);
  border-radius: 6px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
}

.ico {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.ico-sm {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.ico-xs {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.orange {
  color: var(--accent-orange);
}

button, select {
  background: rgba(20, 23, 28, 0.88);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.08s ease;
}

button:hover, select:hover {
  background: rgba(36, 40, 48, 0.94);
  border-color: rgba(255, 255, 255, 0.28);
}

button:active {
  transform: translateY(0.5px);
}

button.active {
  background: var(--accent-cream);
  color: #111317;
  border-color: var(--accent-cream);
}

button.primary-orange {
  background: var(--accent-orange);
  color: #0d0f12;
  border-color: #fb923c;
  font-weight: 800;
}

button.danger {
  background: rgba(127, 29, 29, 0.65);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fecaca;
}

.mini-btn {
  padding: 2px 7px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

/* ==================== MINIMAL GTA-STYLE TOP-LEFT FPS ==================== */
#fps-counter {
  position: fixed;
  top: 5px;
  left: 12px;
  z-index: 40;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #4ade80;
  text-shadow: 0 1px 2px #000, 0 0 6px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  line-height: 1.1;
}

#fps-counter.mid { color: #facc15; }
#fps-counter.low { color: #f97316; }

#perf-monitor {
  position: fixed;
  top: 4px;
  left: 84px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px;
  background: rgba(12, 14, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 10px;
  color: #cbd5e1;
  pointer-events: none;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
#perf-monitor #pm-fps { color: #4ade80; font-weight: 700; }
#perf-monitor #pm-calls, #perf-monitor #pm-tris { color: #93c5fd; }

/* ==================== TOP-LEFT RADAR & STATUS ==================== */
#left-hud {
  position: fixed;
  top: 24px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 25;
  max-width: 345px;
}

.tl-top-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.radar-wrap {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  background: rgba(12, 14, 18, 0.92);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  flex-shrink: 0;
  cursor: pointer;
}

#minimap-canvas {
  width: 112px;
  height: 112px;
  display: block;
}

.radar-north {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 800;
  color: #ef4444;
  text-shadow: 0 1px 3px #000;
  pointer-events: none;
}

.tl-pills {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 2px;
}

.th-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border-thin);
  border-radius: 4px;
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.th-pill.muted {
  color: #d1d5db;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
}

.zone-sel-wrap {
  padding: 0;
}
#zone-select {
  border: none;
  background: transparent;
  font-size: 10px;
  padding: 4px 8px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.vehicle-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  width: 210px;
  cursor: pointer;
}

.veh-sil-svg {
  width: 28px;
  height: 44px;
  color: #d1d5db;
  flex-shrink: 0;
}

.veh-card-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: monospace;
  font-size: 11px;
}
.veh-card-sub {
  font-size: 9.5px;
  color: var(--text-muted);
}

.tl-actions {
  display: flex;
  gap: 6px;
}

.th-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border-thin);
  border-radius: 5px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.th-btn.custom-btn:hover,
.th-btn.custom-btn.active {
  border-color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.16);
  color: #fff;
}

.radio-widget {
  width: 282px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.radio-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.radio-brand {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.radio-ico {
  width: 13px;
  height: 13px;
  color: var(--accent-orange);
  flex-shrink: 0;
}

.radio-name {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radio-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border-thin);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  flex-shrink: 0;
}

.radio-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #64748b;
}

.radio-status.live {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
}
.radio-status.live .radio-dot {
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
}

.radio-status.buffering {
  border-color: rgba(249, 115, 22, 0.45);
  background: rgba(249, 115, 22, 0.14);
  color: #fdba74;
}
.radio-status.buffering .radio-dot {
  background: #f97316;
}

.radio-status.error,
.radio-status.blocked {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
}
.radio-status.error .radio-dot,
.radio-status.blocked .radio-dot {
  background: #ef4444;
}

.radio-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.radio-transport {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.radio-btn,
.radio-vol-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid var(--border-thin);
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  cursor: pointer;
}

.radio-btn:hover,
.radio-vol-btn:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.radio-btn.play.active {
  border-color: rgba(249, 115, 22, 0.7);
  background: rgba(249, 115, 22, 0.22);
  color: #fff;
}

.radio-btn-ico {
  width: 11px;
  height: 11px;
}

.radio-select {
  flex: 1;
  min-width: 0;
  height: 22px;
  padding: 2px 5px;
  font-size: 9.5px;
  font-weight: 600;
  border-radius: 4px;
  background: rgba(15, 18, 25, 0.9);
  border: 1px solid var(--border-thin);
  color: #e2e8f0;
}

.radio-vol-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.radio-vol-btn {
  width: 20px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-muted);
}
.radio-vol-btn.muted {
  color: #f87171;
}

.radio-volume {
  width: 44px;
  height: 4px;
  accent-color: var(--accent-orange);
  cursor: pointer;
}

.telem-drawer {
  width: 344px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sub-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.perf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.perf-grid > div {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  padding: 3px 5px;
}
.perf-grid span {
  display: block;
  font-size: 8.5px;
  color: var(--text-muted);
}
.perf-grid strong {
  font-family: monospace;
  font-size: 10.5px;
}

.tel-top-row {
  display: flex;
  gap: 6px;
}
#gg-canvas, #trace-canvas {
  background: rgba(8, 10, 14, 0.9);
  border: 1px solid var(--border-thin);
  border-radius: 4px;
}

.corners-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.corner-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 4px 5px;
  font-size: 8.5px;
  font-family: monospace;
}
.corner-head { display: flex; justify-content: space-between; margin-bottom: 2px; }
.c-name { font-weight: 700; color: var(--accent-orange); }
.c-surf { font-size: 7.5px; color: #d1d5db; }
.c-row { display: flex; justify-content: space-between; line-height: 1.3; }
.c-row span:first-child { color: var(--text-muted); }
.c-susp-bar-bg { height: 3px; background: #1f242d; border-radius: 2px; margin: 2px 0; overflow: hidden; }
.c-susp-bar { height: 100%; background: var(--accent-orange); }
.c-temps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.c-temps span { text-align: center; border-radius: 2px; color: #0b0d11; font-weight: 700; font-size: 8px; }

/* ==================== TOP-RIGHT SQUARE TOOLBAR ==================== */
#top-right-toolbar {
  position: fixed;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 30;
}

.sq-btn {
  width: 50px;
  height: 48px;
  padding: 4px 2px;
  background: var(--bg-panel);
  border: 1px solid var(--border-thin);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.sq-btn svg {
  width: 17px;
  height: 17px;
  color: #e5e7eb;
}

.sq-btn span {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.sq-btn:hover {
  border-color: var(--border-strong);
  background: rgba(28, 32, 40, 0.94);
}

.sq-btn.active {
  border-color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.22);
  color: #fff;
}
.sq-btn.active svg,
.sq-btn.active span {
  color: var(--accent-orange);
}

/* ==================== UPPER-RIGHT STACK (NARROW RIGHT-EDGE COLUMN) ==================== */
#upper-right-stack {
  position: fixed;
  top: 64px;
  right: 12px;
  width: 312px;
  max-width: calc(100vw - 360px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  z-index: 27;
  pointer-events: none;
}
#upper-right-stack > * {
  pointer-events: auto;
}

.right-card {
  width: 100%;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Trailhead Single-Click 2x2 Stability Buttons (Exact Reference Aesthetic) */
.th-toggle-tile {
  background: rgba(16, 18, 23, 0.90);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}

.th-toggle-tile:hover {
  background: rgba(28, 32, 39, 0.96);
  border-color: rgba(255, 255, 255, 0.30);
}

.th-toggle-tile .tt-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #f3f4f6;
}

.th-toggle-tile .tt-state {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #9ca3af;
}

.th-toggle-tile.active {
  background: rgba(20, 23, 29, 0.94);
  border-color: rgba(255, 255, 255, 0.24);
  color: #f3f4f6;
}
.th-toggle-tile.active .tt-state {
  color: #d1d5db;
}

.th-toggle-tile.warn-on {
  background: rgba(249, 115, 22, 0.14);
  border-color: rgba(249, 115, 22, 0.72);
  color: #fff;
}
.th-toggle-tile.warn-on .tt-state {
  color: var(--accent-orange);
}

.th-toggle-tile:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.seg-ico {
  color: var(--text-muted);
  margin: 0 3px 0 4px;
}

.seg-tx {
  flex: 0.78;
}

/* Secondary Panel Launcher Chips */
.secondary-launchers {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}

.panel-chip {
  background: rgba(14, 16, 20, 0.90);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 5px;
  padding: 5px 2px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #cbd5e1;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.42);
}

.panel-chip:hover {
  border-color: rgba(255, 255, 255, 0.30);
  color: #fff;
  background: rgba(26, 30, 37, 0.96);
}

.panel-chip.active {
  background: rgba(249, 115, 22, 0.22);
  border-color: var(--accent-orange);
  color: var(--accent-orange);
}

/* Collapsible Secondary Panel Host (Hidden by default; flows cleanly inside right column) */
.controls-deck {
  width: 100%;
  max-height: calc(100vh - 515px);
  overflow-y: auto;
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.controls-deck.single-mode .deck-tabs {
  display: none;
}

.seg-group button {
  white-space: nowrap;
}

.diff-row-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.diff-lbl {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

@media (max-height: 760px) {
  #cluster-panel {
    transform: scale(0.86);
    transform-origin: bottom right;
  }
  .controls-deck {
    max-height: calc(100vh - 485px);
  }
}

@media (max-width: 820px) {
  #left-hud { transform: scale(0.80); transform-origin: top left; }
  #top-right-toolbar { transform: scale(0.84); transform-origin: top right; }
  #cluster-panel { transform: scale(0.78); transform-origin: bottom right; }
  #upper-right-stack {
    top: 190px;
    right: 10px;
    width: min(300px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 425px);
    overflow-y: auto;
  }
  .controls-deck {
    max-height: 165px;
  }
}

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

.deck-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-thin);
  padding-bottom: 6px;
}

.deck-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.deck-tab {
  padding: 3px 8px;
  font-size: 9.5px;
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.deck-tab.active {
  background: rgba(249, 115, 22, 0.18);
  color: #fff;
  border-color: var(--accent-orange);
}

.deck-head-right {
  display: flex;
  gap: 5px;
}

.deck-panels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

.ctrl-group {
  background: rgba(20, 23, 28, 0.72);
  border: 1px solid var(--border-thin);
  border-radius: 5px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 215px;
}

.ctrl-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.ctrl-tile {
  background: rgba(12, 14, 18, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tile-top {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.tile-top small { color: var(--text-muted); font-weight: 500; }

.tile-btns {
  display: flex;
  gap: 4px;
}
.tile-btns button {
  flex: 1;
  padding: 2px 4px;
  font-size: 9.5px;
}
.tile-btns button.warn-on {
  background: rgba(249, 115, 22, 0.85);
  color: #0b0d11;
  border-color: var(--accent-orange);
}
.tile-btns button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tile-note {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drv-top-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.seg-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(10, 12, 15, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 2px;
  flex: 1;
}

.seg-lbl {
  font-size: 8.5px;
  color: var(--text-muted);
  padding: 0 5px;
  font-weight: 700;
}

.seg-group button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 4px 6px;
  font-size: 10px;
}
.seg-group button.active {
  background: var(--accent-cream);
  color: #111317;
}

.diff-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.diff-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 5px 7px;
  gap: 2px;
}
.diff-btn span { font-size: 8.5px; color: var(--text-muted); }
.diff-btn strong { font-size: 10px; color: #e5e7eb; }
.diff-btn.locked {
  border-color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.18);
}
.diff-btn.locked strong { color: var(--accent-orange); }
.diff-btn:disabled { opacity: 0.38; cursor: not-allowed; }

.drv-action-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.drv-key-btn,
.drv-mode-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 19, 26, 0.85);
  color: #e2e8f0;
  cursor: pointer;
}

.drv-key-btn:hover,
.drv-mode-btn:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.ico-key {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #94a3b8;
}

.drv-key-btn.running {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
}
.drv-key-btn.running .ico-key {
  color: #4ade80;
}
.drv-key-btn.running strong {
  color: #4ade80;
}
.drv-key-btn.stopped {
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(239, 68, 68, 0.12);
}
.drv-key-btn.stopped .ico-key,
.drv-key-btn.stopped strong {
  color: #fca5a5;
}

.dk-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  font-size: 9px;
}
.dk-text span,
.dm-lbl {
  color: var(--text-muted);
  font-size: 8.5px;
}
.dk-text strong,
.drv-mode-btn strong {
  font-size: 10px;
  letter-spacing: 0.05em;
}

.drv-mode-btn.mode-eco {
  border-color: rgba(34, 197, 94, 0.48);
  background: rgba(34, 197, 94, 0.14);
}
.drv-mode-btn.mode-eco strong { color: #4ade80; }

.drv-mode-btn.mode-normal {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.12);
}
.drv-mode-btn.mode-normal strong { color: #38bdf8; }

.drv-mode-btn.mode-sport {
  border-color: rgba(249, 115, 22, 0.65);
  background: rgba(249, 115, 22, 0.18);
}
.drv-mode-btn.mode-sport strong { color: #fb923c; }

.light-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.ctrl-pill {
  font-size: 9.5px;
  padding: 4px 5px;
}
.ctrl-pill.active {
  border-color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.22);
  color: #fff;
}

.ride-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.psi-head {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
}
.psi-rec { color: var(--accent-orange); }

.psi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.psi-box {
  background: rgba(10, 12, 15, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.psi-box span { font-size: 8.5px; color: var(--text-muted); }
.psi-box strong { font-family: monospace; font-size: 13px; color: #f8fafc; }
.psi-box.warn strong { color: var(--accent-orange); }
.psi-btns { display: flex; gap: 3px; width: 100%; }
.psi-btns button { flex: 1; padding: 1px 0; font-size: 11px; }

.offroad-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.off-btn {
  padding: 5px 3px;
  font-size: 9px;
  letter-spacing: 0.03em;
}
.off-btn.active {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  color: #0d0f12;
}

/* ==================== BOTTOM-RIGHT INSTRUMENT CLUSTER ==================== */
#cluster-panel {
  position: fixed;
  bottom: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  z-index: 24;
  pointer-events: auto;
}

.cluster-top-row,
#cluster-panel {
  /* Stack secondary & primary gauges cleanly side-by-side above compact footer */
}

@media (min-width: 600px) {
  #cluster-panel {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-rows: auto auto;
    gap: 8px;
    align-items: end;
  }
  .cluster-secondary { grid-column: 1; grid-row: 1; }
  .cluster-primary { grid-column: 2; grid-row: 1; }
  .cluster-footer { grid-column: 1 / span 2; grid-row: 2; }
}

.cluster-secondary {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 158px;
}

.torque-dial-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto;
  border-radius: 50%;
  background: rgba(10, 12, 16, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.torque-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: monospace;
}
.torque-center #torque-val { font-size: 16px; font-weight: 800; color: #f8fafc; }
.torque-center span { font-size: 8px; color: var(--text-muted); }

.cluster-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cb-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 8.5px;
  font-family: monospace;
  color: var(--text-muted);
}
.cb-row span { width: 22px; }
.cb-track {
  position: relative;
  flex: 1;
  height: 4px;
  background: #1b1f27;
  border-radius: 2px;
  overflow: hidden;
}
.cb-fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0%; }
.cb-fill.thr { background: #22c55e; }
.cb-fill.brk { background: #ef4444; }
.cb-fill.hbk { background: var(--accent-orange); }
.cb-fill.str { background: #e5e7eb; }

.cluster-specs {
  font-family: monospace;
  font-size: 9px;
  color: #cbd5e1;
  line-height: 1.35;
}

.cluster-primary {
  position: relative;
  width: 184px;
  height: 184px;
  border-radius: 50%;
  background: rgba(12, 14, 18, 0.92);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
}

#tach-canvas {
  display: block;
  width: 184px;
  height: 184px;
}

.tach-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
  pointer-events: none;
}

.shift-hint {
  font-size: 9px;
  font-weight: 800;
  color: var(--accent-orange);
  letter-spacing: 0.08em;
  animation: pulseShift 0.65s infinite alternate;
}
@keyframes pulseShift {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

#speed-val {
  font-size: 32px;
  font-weight: 800;
  font-family: monospace;
  color: #f9fafb;
  line-height: 1.0;
}

.speed-unit {
  font-size: 8px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}

.gear-row-inline {
  display: flex;
  align-items: center;
  gap: 4px;
}

.inline-tag {
  font-size: 8.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}
.inline-tag.orange {
  color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.15);
}

.gear-box {
  min-width: 28px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(249, 115, 22, 0.65);
  background: rgba(249, 115, 22, 0.14);
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  text-align: center;
  transition: transform 0.12s ease, background 0.12s ease;
}
.gear-box.flash {
  transform: scale(1.16);
  background: var(--accent-orange);
  color: #0b0d11;
}

.cluster-footer {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 350px;
}

.aid-row {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.aid-badge {
  font-size: 8.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  font-family: monospace;
  border: 1px solid transparent;
}
.aid-badge.off { background: rgba(255,255,255,0.05); color: #6b7280; }
.aid-badge.armed { background: rgba(255,255,255,0.09); color: #e5e7eb; border-color: rgba(255,255,255,0.16); }
.aid-badge.active { background: var(--accent-orange); color: #0b0d11; }
.aid-badge.ind-on { background: #22c55e; color: #04130a; }
.aid-badge.stall { background: #ef4444; color: #fff; }
.aid-badge.warn { background: rgba(249, 115, 22, 0.2); color: #fb923c; border-color: var(--accent-orange); }
.aid-badge.na { background: rgba(255,255,255,0.03); color: #6b7280; }
.aid-badge.clickable { cursor: pointer; }

.manual-strip {
  display: flex;
  align-items: center;
  gap: 4px;
}
.gear-step-btn {
  padding: 3px 8px;
  font-size: 9.5px;
  font-family: monospace;
}
.gear-warn {
  margin-left: auto;
  font-size: 9px;
  font-weight: 800;
  color: #ef4444;
  letter-spacing: 0.04em;
}

.hpattern-gate {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
}
.hpattern-gate button {
  padding: 3px 0;
  font-size: 10px;
  font-family: monospace;
}

/* ==================== OPTIONAL COMPACT TOUCH OVERLAY (PC) ==================== */
#mobile-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  pointer-events: none;
  z-index: 26;
}
#mobile-overlay .mob-top-strip {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: auto;
  margin: 0 auto;
}
#mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
#mobile-overlay.hidden { display: none !important; }

.mob-panel {
  background: rgba(11, 14, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f8fafc;
}

#mobile-overlay button {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  background: rgba(13, 17, 24, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f8fafc;
  border-radius: 10px;
  font-weight: 700;
  transition: transform 0.06s ease, background 0.1s ease, border-color 0.1s ease;
}
#mobile-overlay button.pressed,
#mobile-overlay button:active {
  transform: scale(0.95);
  background: rgba(249, 115, 22, 0.36);
  border-color: #f97316;
}
#mobile-overlay button:disabled {
  opacity: 0.34;
  pointer-events: none;
}

/* Top-Left Fuel & Condition Card (next to minimap) */
.mob-left-info {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: calc(max(10px, env(safe-area-inset-left)) + 74px);
  padding: 5px 9px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mob-fuel-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.mob-ico-xs { width: 12px; height: 12px; color: #f97316; flex-shrink: 0; }
.mob-dot { opacity: 0.45; }
.mob-cond-val {
  font-size: 9.5px;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.72);
  letter-spacing: 0.04em;
}
.mob-road-info {
  position: fixed;
  top: calc(max(8px, env(safe-area-inset-top)) + 70px);
  left: max(10px, env(safe-area-inset-left));
  padding: 5px 9px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 210px;
}
.mob-road-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9.5px;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.78);
  letter-spacing: 0.03em;
}
.mob-road-row strong { color: #f8fafc; }
.mob-road-toll {
  font-size: 9px;
  font-weight: 600;
  color: #fb923c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Top-Centre World & Vehicle Status */
.mob-top-center {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  pointer-events: none;
  white-space: nowrap;
  max-width: 34vw;
  overflow: hidden;
}
.mob-world-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
  flex-shrink: 0;
}
.mob-world-lbl { color: #e2e8f0; }
.mob-sep { opacity: 0.35; }
.mob-veh-name { color: #fb923c; overflow: hidden; text-overflow: ellipsis; }

/* Top-Right Drive Mode, Utility, 2x4 Grid & Radio */
.mob-top-right {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  width: 248px;
  max-width: calc(100vw - 20px);
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: auto;
  z-index: 28;
}
.mob-tr-head {
  display: flex;
  align-items: stretch;
  gap: 5px;
}
.mob-drive-mode {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 9px !important;
  cursor: pointer;
}
.mob-dm-kicker {
  font-size: 8.5px;
  letter-spacing: 0.08em;
  color: rgba(226, 232, 240, 0.6);
}
.mob-dm-val {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.mob-drive-mode.mode-normal { border-color: rgba(56, 189, 248, 0.55) !important; }
.mob-drive-mode.mode-normal .mob-dm-val { color: #38bdf8; }
.mob-drive-mode.mode-eco { border-color: rgba(34, 197, 94, 0.65) !important; background: rgba(20, 83, 45, 0.45) !important; }
.mob-drive-mode.mode-eco .mob-dm-val { color: #4ade80; }
.mob-drive-mode.mode-sport { border-color: rgba(239, 68, 68, 0.78) !important; background: rgba(127, 29, 29, 0.48) !important; }
.mob-drive-mode.mode-sport .mob-dm-val { color: #fb923c; }

.mob-util-row {
  display: flex;
  gap: 4px;
}
.mob-util-btn {
  padding: 5px 7px;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  min-height: 28px;
}
.mob-util-btn.active {
  border-color: rgba(34, 197, 94, 0.7) !important;
  color: #4ade80 !important;
}
.mob-util-menu {
  border-color: rgba(249, 115, 22, 0.6) !important;
  color: #fb923c !important;
}
#mob-fullscreen {
  border-color: rgba(20, 184, 166, 0.6) !important;
  color: #2dd4bf !important;
}
#mob-install {
  border-color: rgba(34, 197, 94, 0.65) !important;
  color: #4ade80 !important;
}

/* 2x4 Vehicle Action Grid */
.mob-action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 5px;
}
.mob-act-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 5px 2px !important;
  min-height: 44px;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}
.mob-act-btn.active {
  background: rgba(249, 115, 22, 0.22) !important;
  border-color: rgba(249, 115, 22, 0.8) !important;
  color: #fff !important;
}
.mob-act-btn.active .mob-act-ico,
.mob-act-btn.active .mob-act-st {
  color: #fb923c;
}
.mob-act-btn.warn-confirm {
  background: rgba(239, 68, 68, 0.32) !important;
  border-color: #ef4444 !important;
}
.mob-act-ico {
  width: 15px;
  height: 15px;
  color: #e2e8f0;
}
.mob-act-lbl {
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(241, 245, 249, 0.88);
  line-height: 1;
}
.mob-act-st {
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(148, 163, 184, 0.85);
  line-height: 1;
}

/* Compact Mobile Radio Strip */
.mob-radio-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
}
.mob-radio-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(148, 163, 184, 0.85);
  flex-shrink: 0;
}
.mob-radio-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.mob-radio-live.live {
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
}
.mob-radio-live.buffering {
  background: rgba(249, 115, 22, 0.22);
  color: #fb923c;
}
.mob-radio-name {
  flex: 1;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #e2e8f0;
}
.mob-radio-btns {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.mob-r-btn {
  width: 24px;
  height: 22px;
  padding: 0 !important;
  font-size: 10px;
  border-radius: 6px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mob-r-btn.active {
  border-color: #f97316 !important;
  color: #fb923c !important;
}

/* Bottom Row: Steering | Instrument Cluster | Pedals */
#mobile-overlay .mob-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  gap: 8px;
  pointer-events: none;
}

/* Bottom-Left Steering Dock */
.mob-steer-dock {
  display: flex;
  align-items: flex-end;
  pointer-events: auto;
}
#mobile-overlay .mob-steer,
#mobile-overlay .mob-pedals {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
}
.mob-steer-btn,
.mob-hbk-btn,
.mob-brake-btn,
.mob-gas-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(11, 14, 20, 0.56) !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px !important;
  color: #f8fafc !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 4px 16px rgba(0, 0, 0, 0.28);
}
.mob-ctrl-ico {
  width: 24px;
  height: 24px;
  color: #e2e8f0;
}
.mob-ctrl-lbl {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: rgba(226, 232, 240, 0.88);
  line-height: 1;
}
.mob-steer-btn {
  width: 82px;
  height: 78px;
}
.mob-steer-btn.pressed .mob-ctrl-ico,
.mob-steer-btn.pressed .mob-ctrl-lbl { color: #fb923c; }

/* Bottom-Centre Instrument Cluster */
.mob-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  pointer-events: auto;
}
.mob-gauge-wrap {
  position: relative;
  width: 96px;
  height: 58px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.mob-rpm-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.mob-speed-block {
  text-align: center;
  z-index: 1;
  padding-bottom: 1px;
}
.mob-speed-val {
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.mob-speed-unit {
  font-size: 8px;
  letter-spacing: 0.08em;
  color: rgba(226, 232, 240, 0.6);
}
.mob-cluster-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 108px;
}
.mob-gear-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.mob-gear-btn {
  width: 24px;
  height: 22px;
  padding: 0 !important;
  font-size: 13px;
  border-radius: 6px !important;
}
.mob-gear-val {
  min-width: 28px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(249, 115, 22, 0.18);
  border: 1px solid rgba(249, 115, 22, 0.55);
  color: #fb923c;
  font-size: 12px;
  font-weight: 800;
}
.mob-telem-line {
  font-size: 9.5px;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.78);
  font-variant-numeric: tabular-nums;
}
.mob-ped-bars {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mob-pbar {
  display: flex;
  align-items: center;
  gap: 5px;
}
.mob-pbar-lbl {
  font-size: 7.5px;
  font-weight: 700;
  width: 20px;
  color: rgba(226, 232, 240, 0.58);
}
.mob-pbar-trk {
  flex: 1;
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.mob-pbar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.05s linear;
}
.mob-pbar-fill.thr { background: #22c55e; }
.mob-pbar-fill.brk { background: #ef4444; }

/* Bottom-Right Pedals — unified glass aesthetic matching 8-button grid */
.mob-hbk-btn {
  width: 62px;
  height: 62px;
  border-bottom: 2px solid rgba(250, 204, 21, 0.7) !important;
}
.mob-hbk-btn .mob-ctrl-ico { width: 20px; height: 20px; color: #fde047; }
.mob-hbk-btn.pressed { background: rgba(250, 204, 21, 0.22) !important; border-color: #fde047 !important; }

.mob-brake-btn {
  width: 74px;
  height: 88px;
  border-bottom: 2px solid rgba(239, 68, 68, 0.78) !important;
}
.mob-brake-btn .mob-ctrl-ico { color: #f87171; }
.mob-brake-btn.pressed { background: rgba(239, 68, 68, 0.26) !important; border-color: #ef4444 !important; }

.mob-gas-btn {
  width: 78px;
  height: 132px;
  border-bottom: 2px solid rgba(249, 115, 22, 0.85) !important;
}
.mob-gas-btn .mob-ctrl-ico { color: #fb923c; }
.mob-gas-btn.pressed { background: rgba(249, 115, 22, 0.28) !important; border-color: #f97316 !important; }

/* Fullscreen: canvas & body fill entire screen */
:fullscreen body, :-webkit-full-screen body { background: #000; }
:fullscreen #sim-canvas, :-webkit-full-screen #sim-canvas {
  width: 100vw !important;
  height: 100vh !important;
}

/* ==================== DEVICE MODE SWITCHER & ROTATE BANNER ==================== */
.device-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  flex-wrap: wrap;
}
.dm-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #94a3b8;
}
.dm-switch {
  display: flex;
  gap: 6px;
}
.dm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  cursor: pointer;
}
.dm-btn.active {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  color: #0b0d11;
}
.mobile-detect-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(249, 115, 22, 0.14);
  border: 1px solid rgba(249, 115, 22, 0.55);
  border-radius: 8px;
  font-size: 12px;
  color: #f8fafc;
}
.mdb-actions {
  display: flex;
  gap: 6px;
}
.mdb-yes {
  background: var(--accent-orange);
  color: #0b0d11;
  border: none;
  padding: 6px 10px;
  border-radius: 5px;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
}
.mdb-no {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 10px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
}
.rotate-suggestion {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 960;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  max-width: calc(100vw - 24px);
  background: rgba(15, 20, 28, 0.92);
  border: 1px solid rgba(249, 115, 22, 0.7);
  border-radius: 8px;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}
.rotate-suggestion button {
  background: transparent;
  border: none;
  color: #fb923c;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
}

/* ==================== COMPLETE WORKSHOP MODAL ==================== */
.workshop-modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 11, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 55;
  padding: 18px;
}

.ws-shell {
  width: min(1140px, 96vw);
  height: min(740px, 92vh);
  background: rgba(15, 17, 21, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.78);
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  gap: 10px;
}

.ws-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ws-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ws-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent-orange);
}
.ws-title h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.ws-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
#ws-saved-select { max-width: 150px; }

.ws-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.ws-preset-btn {
  padding: 4px 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(255, 255, 255, 0.04);
}
.ws-preset-btn.active {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--accent-orange);
  color: #fff;
}

.ws-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-thin);
}
.ws-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 7px 11px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.ws-tab-btn:hover { background: rgba(255,255,255,0.04); color: #fff; }
.ws-tab-btn.active {
  color: #fff;
  border-bottom-color: var(--accent-orange);
}

.ws-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .ws-body { grid-template-columns: 1fr; overflow-y: auto; }
}

.ws-preview-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.ws-canvas-box {
  position: relative;
  border: 1px solid var(--border-thin);
  border-radius: 6px;
  overflow: hidden;
  background: #0d1015;
  height: 245px;
  flex-shrink: 0;
}
#workshop-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
.ws-preview-hint {
  position: absolute;
  bottom: 6px;
  left: 10px;
  font-size: 9px;
  color: var(--text-muted);
  pointer-events: none;
}

.ws-est-card {
  flex: 1;
  background: rgba(11, 13, 17, 0.72);
  border: 1px solid var(--border-thin);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ws-est-head,
.ws-est-row {
  display: grid;
  grid-template-columns: 1.5fr 0.7fr 0.8fr;
  gap: 6px;
  font-family: monospace;
  font-size: 10.5px;
  padding: 3px 0;
}
.ws-est-head {
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-thin);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}
.ws-est-head span:not(:first-child),
.ws-est-row span:not(:first-child) { text-align: right; }

.ws-est-rows { overflow-y: auto; flex: 1; }
.ws-est-row span:first-child { color: var(--text-muted); }
.ws-est-row .est-better { color: #4ade80; font-weight: 700; }
.ws-est-row .est-worse { color: var(--accent-orange); font-weight: 700; }

.ws-measured-row {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-thin);
  font-family: monospace;
  font-size: 9.5px;
  color: #93c5fd;
}

.ws-fields-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.ws-tab-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding-bottom: 6px;
}

.setup-form {
  overflow-y: auto;
  padding-right: 6px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px 16px;
  align-content: start;
}

.setup-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 11px;
}
.setup-row-head { display: flex; justify-content: space-between; align-items: center; }
.setup-val { font-family: monospace; color: var(--accent-orange); font-weight: 700; }
.setup-row input[type="range"] { width: 100%; accent-color: var(--accent-orange); }

.setup-check {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.setup-check input { accent-color: var(--accent-orange); width: 15px; height: 15px; }

.swatch-row {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-top: 2px;
}
.swatch-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  padding: 0;
  border: 2px solid transparent;
}
.swatch-btn.active { border-color: var(--accent-orange); }

/* ==================== MODALS: MENU & MAP ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 11, 0.76);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.modal-card {
  background: rgba(15, 17, 21, 0.96);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.75);
}

.menu-modal { width: 620px; max-width: 94vw; }
.map-modal { width: 810px; max-width: 95vw; }

.menu-brand { font-size: 23px; font-weight: 900; letter-spacing: 0.08em; }
.menu-brand span {
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--accent-orange);
  color: #0b0d11;
  border-radius: 4px;
  font-size: 13px;
}
.menu-brand-sub {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 3px;
}
.menu-sub { margin-top: 4px; font-size: 12px; color: var(--text-muted); }

.menu-tabs {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-thin);
}
.menu-tab { padding: 6px 13px; font-weight: 700; }
.menu-tab.active { background: var(--accent-orange); color: #0b0d11; border-color: var(--accent-orange); }

.menu-body { margin-top: 14px; }
.vehicle-highlight {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(249, 115, 22, 0.45);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vehicle-highlight span { font-size: 11.5px; color: var(--text-muted); }

.menu-actions { display: flex; gap: 10px; margin-top: 16px; }
.primary-btn {
  background: var(--accent-orange);
  border-color: #fb923c;
  color: #0b0d11;
  font-weight: 800;
  padding: 9px 22px;
  font-size: 13px;
}

.veh-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-thin);
  border-radius: 6px;
  padding: 12px;
  font-size: 11.5px;
  line-height: 1.5;
}

.settings-grid { display: flex; flex-direction: column; gap: 9px; font-size: 12px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.settings-grid label { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.kb-head-note { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}
.kb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11px;
}
.kb-btn { font-family: monospace; min-width: 72px; }
.kb-btn.listening { background: var(--accent-orange); color: #0b0d11; }

.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-head h2 { font-size: 14px; letter-spacing: 0.06em; }
#fullmap-canvas { width: 100%; background: #0a0c10; border: 1px solid var(--border-thin); border-radius: 6px; cursor: crosshair; }
.map-legend { margin-top: 10px; font-size: 11.5px; color: var(--text-muted); }
.map-zone-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.pause-banner {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(249, 115, 22, 0.94);
  color: #0b0d11;
  font-weight: 800;
  padding: 8px 20px;
  border-radius: 6px;
  z-index: 50;
  letter-spacing: 0.08em;
}

/* ==================== COMPACT BOTTOM-LEFT JOURNEY & TOLL HUD ==================== */
.journey-hud {
  position: fixed;
  bottom: 14px;
  left: 12px;
  width: 282px;
  padding: 8px 10px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10.5px;
}
.jh-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.jh-title { font-weight: 700; letter-spacing: 0.05em; color: var(--text-muted); font-size: 10px; }
.jh-title strong { color: var(--text-main); }
.jh-wallet-wrap { display: flex; align-items: center; gap: 4px; }
.jh-wallet {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-weight: 800;
  color: #4ade80;
  font-size: 11px;
  padding: 1px 5px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 4px;
}
.jh-chip {
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 800;
  border-radius: 4px;
}
.jh-chip.active {
  background: #059669;
  color: #fff;
  border-color: #34d399;
}
.jh-bar-bg {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}
.jh-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f97316, #22c55e);
  transition: width 0.12s linear;
}
.jh-stats {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  font-family: "JetBrains Mono", Consolas, monospace;
}
.jh-stats strong { color: var(--text-main); }
.jh-toll-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 9.5px;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 4px;
}
.jh-toll-meta strong { color: #e2e8f0; }
.jh-alert {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(249, 115, 22, 0.55);
  border-radius: 5px;
  padding: 5px 7px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.jh-alert.ok { border-color: rgba(34, 197, 94, 0.65); }
.jh-alert.warn { border-color: rgba(239, 68, 68, 0.75); }
.jh-alert-title { font-size: 10px; font-weight: 800; color: #facc15; }
.jh-alert.ok .jh-alert-title { color: #4ade80; }
.jh-alert.warn .jh-alert-title { color: #f87171; }
.jh-alert-sub { font-size: 9.5px; color: #cbd5e1; }
.jh-alert-btns { display: flex; gap: 6px; margin-top: 2px; }
.jh-act-btn { padding: 3px 8px; font-size: 9.5px; font-weight: 800; }
.jh-act-btn.orange { background: var(--accent-orange); color: #0b0d11; border-color: #fb923c; }
.jh-act-btn.green { background: #16a34a; color: #fff; border-color: #4ade80; }

.toll-modal-card { width: 540px; max-width: 94vw; }
.tm-wallet-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-thin);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11.5px;
  margin-bottom: 10px;
}
.tm-topup-btns { display: flex; gap: 5px; }
.tm-section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-orange);
  margin: 8px 0 5px;
}
.tm-rates-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-thin);
  border-radius: 6px;
  padding: 8px;
}
.tm-rates-grid .tm-hdr { color: var(--text-muted); font-size: 10px; font-weight: 700; }
.tm-rates-grid input {
  width: 74px;
  background: rgba(10, 12, 16, 0.9);
  color: var(--text-main);
  border: 1px solid var(--border-thin);
  border-radius: 4px;
  padding: 3px 6px;
  font-family: monospace;
  font-size: 11px;
}
.tm-receipts-list {
  max-height: 155px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10.5px;
}
.tm-rec-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 3px solid #22c55e;
  border-radius: 4px;
  padding: 5px 8px;
  font-family: monospace;
}
.tm-empty { color: var(--text-muted); font-size: 11px; padding: 6px 0; }

/* Driver Seat Adjustment Controls */
.seat-list { display: flex; flex-direction: column; gap: 5px; }
.seat-row { display: flex; flex-direction: column; gap: 2px; }
.seat-head {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--text-muted);
}
.seat-head strong { color: #f8fafc; font-family: monospace; }
.seat-ctrl { display: flex; align-items: center; gap: 4px; }
.seat-ctrl input[type="range"] { flex: 1; accent-color: var(--accent-orange); cursor: pointer; height: 14px; }
.seat-step, .seat-shake-btn {
  padding: 1px 6px;
  font-size: 10px;
  min-width: 24px;
}
.seat-shake-btn.active {
  background: rgba(249, 115, 22, 0.25);
  border-color: var(--accent-orange);
  color: #fff;
}
.seat-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 5px;
  margin-top: 2px;
}

/* Vehicle & Engine Selector Cards */
.veh-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.veh-card.active {
  border-color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.08);
}
.veh-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.veh-card-sub { font-size: 11px; color: #cbd5e1; }
.veh-card-meta { font-size: 10px; color: var(--text-muted); font-family: monospace; }
.veh-eng-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}
.veh-eng-btn {
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
}
.veh-eng-btn.active {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  color: #0b0d11;
}
.ws-engine-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 14px;
  background: rgba(249, 115, 22, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.ws-engine-lbl {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-orange);
  margin-right: 4px;
}
.model-loading-pill {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 950;
  min-width: 260px;
  max-width: 90vw;
  padding: 10px 16px;
  background: rgba(15, 20, 28, 0.92);
  border: 1px solid rgba(249, 115, 22, 0.55);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.model-loading-text {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.03em;
  text-align: center;
  margin-bottom: 6px;
}
.model-loading-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}
.model-loading-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f97316, #fb923c);
  transition: width 0.15s ease-out;
}

/* ==================== MOBILE MODE HUD & RESPONSIVE MENUS ==================== */
body.mobile-mode {
  overflow: hidden;
  touch-action: manipulation;
}
body.mobile-mode #fps-counter {
  top: max(6px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  font-size: 10px;
}
body.mobile-mode #left-hud {
  top: max(24px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  gap: 4px;
  max-width: 195px;
}
body.mobile-mode .radar-wrap {
  width: 64px;
  height: 64px;
}
body.mobile-mode #minimap-canvas {
  width: 64px;
  height: 64px;
}
body.mobile-mode .tl-pills {
  gap: 2px;
}
body.mobile-mode .th-pill {
  padding: 3px 6px;
  font-size: 9px;
}
body.mobile-mode #veh-cam-pill,
body.mobile-mode .zone-sel-wrap,
body.mobile-mode #vehicle-status-card,
body.mobile-mode #telemetry-panel,
body.mobile-mode #journey-hud,
body.mobile-mode #top-right-toolbar,
body.mobile-mode #upper-right-stack,
body.mobile-mode #cluster-panel,
body.mobile-mode #radio-widget,
body.mobile-mode .tl-actions {
  display: none !important;
}
body.mobile-mode #zone-badge {
  display: none;
}
body.mobile-mode #left-hud {
  top: max(8px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
}
body.mobile-mode #model-loading-pill {
  bottom: 128px;
}

/* Portrait phone adjustments (360x800, 390x844, 412x915) */
@media (max-width: 600px) and (orientation: portrait) {
  body.mobile-mode .mob-top-center {
    top: 78px;
    left: max(10px, env(safe-area-inset-left));
    transform: none;
    max-width: calc(100vw - 236px);
    font-size: 9px;
    padding: 4px 7px;
  }
  body.mobile-mode .mob-road-info {
    top: 108px;
    max-width: calc(100vw - 236px);
  }
  body.mobile-mode .mob-world-lbl,
  body.mobile-mode .mob-sep { display: none; }
  body.mobile-mode .mob-left-info {
    left: calc(max(10px, env(safe-area-inset-left)) + 68px);
    padding: 4px 7px;
  }
  body.mobile-mode .mob-top-right {
    width: 212px;
  }
  body.mobile-mode .mob-act-btn {
    min-height: 40px;
  }
  body.mobile-mode .mob-act-lbl { font-size: 7px; }
  body.mobile-mode #mobile-overlay .mob-bottom-row {
    flex-wrap: wrap;
    justify-content: space-between;
    row-gap: 6px;
  }
  body.mobile-mode .mob-cluster {
    order: -1;
    width: 100%;
    justify-content: space-between;
    padding: 5px 10px;
  }
  body.mobile-mode .mob-steer-btn {
    width: 70px;
    height: 68px;
  }
  body.mobile-mode .mob-hbk-btn {
    width: 54px;
    height: 54px;
  }
  body.mobile-mode .mob-brake-btn {
    width: 64px;
    height: 76px;
  }
  body.mobile-mode .mob-gas-btn {
    width: 68px;
    height: 112px;
  }
}

/* Compact landscape phones (e.g. 844x390, 667x375) */
@media (max-height: 440px) and (orientation: landscape) {
  body.mobile-mode .mob-top-center {
    max-width: calc(100vw - 440px);
    font-size: 9px;
    padding: 4px 8px;
  }
  body.mobile-mode .mob-top-right { width: 232px; gap: 3px; }
  body.mobile-mode .mob-action-grid { padding: 4px; gap: 3px; }
  body.mobile-mode .mob-act-btn { min-height: 36px; padding: 3px 2px !important; }
  body.mobile-mode .mob-radio-strip { padding: 3px 7px; }
  body.mobile-mode .mob-steer-btn { width: 74px; height: 70px; }
  body.mobile-mode .mob-hbk-btn { width: 56px; height: 56px; }
  body.mobile-mode .mob-brake-btn { width: 68px; height: 80px; }
  body.mobile-mode .mob-gas-btn { width: 74px; height: 118px; }
  body.mobile-mode .mob-cluster { padding: 5px 10px; gap: 8px; }
  body.mobile-mode .mob-gauge-wrap { width: 84px; height: 50px; }
  body.mobile-mode .mob-speed-val { font-size: 21px; }
}

/* Responsive Modals & Menus for Mobile Screens (both Mobile Mode and small viewports) */
body.mobile-mode .modal-overlay,
body.mobile-mode .workshop-modal {
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
body.mobile-mode .modal-card,
body.mobile-mode .menu-modal,
body.mobile-mode .map-modal,
body.mobile-mode .toll-modal-card,
body.mobile-mode .ws-shell {
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - 16px);
  height: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
}
body.mobile-mode .menu-tabs {
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  gap: 4px;
}
body.mobile-mode .menu-tab {
  white-space: nowrap;
  padding: 7px 10px;
  font-size: 11px;
}
body.mobile-mode .settings-grid,
body.mobile-mode .controls-grid,
body.mobile-mode .ws-body,
body.mobile-mode .tm-rates-grid {
  grid-template-columns: 1fr;
}
body.mobile-mode #fullmap-canvas,
body.mobile-mode #workshop-preview-canvas {
  width: 100%;
  height: auto;
  max-height: 48dvh;
}
body.mobile-mode .menu-actions {
  flex-direction: column;
}
body.mobile-mode .menu-actions button {
  width: 100%;
}

@media (max-width: 900px) {
  .modal-overlay,
  .workshop-modal {
    padding: 8px;
  }
  .modal-card,
  .menu-modal,
  .map-modal,
  .toll-modal-card,
  .ws-shell {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
  }
  .menu-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .menu-tab {
    white-space: nowrap;
  }
  .ws-body {
    grid-template-columns: 1fr;
  }
  #fullmap-canvas {
    width: 100%;
    height: auto;
  }
}
@media (max-width: 640px) {
  .settings-grid,
  .controls-grid,
  .tm-rates-grid {
    grid-template-columns: 1fr;
  }
  .menu-actions {
    flex-direction: column;
  }
  .menu-actions button {
    width: 100%;
  }
}
