:root {
    --bg-dark: #0d1117;
    --panel-bg: #131922;
    --card-bg: #1a222e;
    --card-hover: #222c3c;
    --border: rgba(255, 255, 255, 0.09);
    --border-active: #3b82f6;
    --accent: #3b82f6;
    --accent-soft: rgba(59, 130, 246, 0.16);
    --text-main: #f0f4f8;
    --text-muted: #8b9bb0;
    --danger: #ef4444;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.studio-shell {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Boot Screen */
.boot-screen {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: radial-gradient(circle at 50% 40%, #1a2433 0%, #0d1117 70%);
}
.boot-badge {
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    color: var(--accent);
    font-weight: 700;
}
.boot-title {
    margin: 0;
    font-size: 2.2rem;
    letter-spacing: 0.14em;
    font-weight: 800;
}
.boot-sub {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.boot-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,0.12);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Main Split Layout */
.configurator-layout {
    display: grid;
    grid-template-columns: 1fr 390px;
    width: 100%;
    height: 100%;
}
.configurator-layout.driving-mode {
    grid-template-columns: 1fr;
}
.configurator-layout.driving-mode .controls-pane {
    display: none;
}
.configurator-layout.driving-mode .viewport-canvas {
    cursor: grab;
}
.configurator-layout.driving-mode .viewport-canvas canvas.orbit-dragging {
    cursor: grabbing;
}

/* 3D Viewport */
.viewport-pane {
    position: relative;
    width: 100%;
    height: 100%;
    background: #0f141c;
    overflow: hidden;
}
.viewport-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
    touch-action: none;
}
.viewport-canvas:active {
    cursor: grabbing;
}

.viewport-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(13, 17, 23, 0.78);
    backdrop-filter: blur(6px);
    z-index: 20;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.status-toast {
    position: absolute;
    top: 4.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(19, 25, 34, 0.92);
    border: 1px solid var(--border-active);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.82rem;
    z-index: 25;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.driving-mode .status-toast {
    top: 5.75rem;
}

.viewport-header {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}
.brand-cluster, .header-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    pointer-events: auto;
}
.brand-mark {
    font-weight: 800;
    letter-spacing: 0.14em;
    font-size: 0.95rem;
    padding: 0.42rem 0.78rem;
    border-radius: 8px;
    background: rgba(19, 25, 34, 0.85);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}
.gen-pill {
    font-size: 0.76rem;
    color: var(--text-muted);
    padding: 0.42rem 0.72rem;
    border-radius: 8px;
    background: rgba(19, 25, 34, 0.78);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.pill-btn {
    background: rgba(19, 25, 34, 0.85);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.42rem 0.78rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: border-color 0.15s, background 0.15s;
}
.pill-btn:hover {
    border-color: var(--accent);
    background: rgba(30, 40, 55, 0.95);
}
.pill-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.spin-cta-btn {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    border-color: rgba(147, 197, 253, 0.45);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}
.spin-cta-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    border-color: #93c5fd;
    transform: translateY(-1px);
}
.exit-drive-btn {
    background: rgba(127, 29, 29, 0.85);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fee2e2;
}
.exit-drive-btn:hover {
    background: rgba(153, 27, 27, 0.96);
    border-color: #f87171;
}
.follow-road-btn.active {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border-color: #6ee7b7;
    color: #ffffff;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.45);
}
.follow-road-btn.active:hover {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    border-color: #a7f3d0;
}
.report-issue-btn {
    background: rgba(120, 53, 15, 0.82);
    border-color: rgba(251, 191, 36, 0.45);
    color: #fef3c7;
}
.report-issue-btn:hover {
    background: rgba(146, 64, 14, 0.95);
    border-color: #fbbf24;
}
.gps-pill {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.74rem;
    color: #bae6fd;
    border-color: rgba(56, 189, 248, 0.35);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.gps-pill:hover {
    border-color: #38bdf8;
    background: rgba(20, 34, 52, 0.95);
}

/* Report Map Issue Modal */
.issue-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 11, 18, 0.62);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    padding: 1rem;
}
.issue-modal-card {
    width: 100%;
    max-width: 440px;
    background: rgba(19, 25, 34, 0.96);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.issue-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.issue-modal-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: #fef3c7;
}
.issue-close-x {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
}
.issue-close-x:hover {
    color: #fff;
}
.issue-gps-summary {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    padding: 0.55rem 0.75rem;
    border-radius: 9px;
    background: rgba(13, 17, 23, 0.72);
    border: 1px solid var(--border);
    font-size: 0.82rem;
}
.issue-gps-coords {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    color: #7dd3fc;
}
.issue-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.issue-label {
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.issue-textarea {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.82rem;
    resize: vertical;
}
.issue-textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.issue-hint {
    margin: 0;
    font-size: 0.73rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.issue-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Revamped Single-Row Automotive Drive HUD */
.drive-hud-top {
    position: absolute;
    top: 0.9rem;
    left: 0.9rem;
    right: 0.9rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    pointer-events: none;
    z-index: 15;
    flex-wrap: wrap;
}

/* Left: Unified Sat-Nav + Telemetry Capsule */
.drive-nav-capsule {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    background: rgba(13, 20, 30, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.32);
    overflow: hidden;
    min-width: 295px;
    max-width: 420px;
}
.nav-row-primary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.65rem 0.45rem 0.75rem;
}
.nav-street-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.drive-pin {
    font-size: 0.95rem;
    flex-shrink: 0;
}
.drive-street-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}
.drive-street-name {
    font-size: 0.86rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.drive-city-sub {
    font-size: 0.69rem;
    color: #9fb3c8;
    white-space: nowrap;
}
.nav-quick-btns {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding-left: 0.55rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
.nav-mini-btn {
    background: rgba(255, 255, 255, 0.06);
    color: #e2ecf8;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 7px;
    padding: 0.3rem 0.52rem;
    font-size: 0.73rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.14s;
    white-space: nowrap;
}
.nav-mini-btn:hover {
    background: rgba(59, 130, 246, 0.24);
    border-color: rgba(96, 165, 250, 0.6);
    color: #fff;
}
.nav-teleport-btn {
    background: rgba(37, 99, 235, 0.25);
    border-color: rgba(96, 165, 250, 0.42);
    color: #dbeafe;
}

.nav-row-telemetry {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.32rem 0.75rem 0.38rem;
    background: rgba(7, 12, 20, 0.48);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.72rem;
    color: #cbd5e1;
    flex-wrap: wrap;
}
.tel-item {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    font-weight: 600;
}
.tel-sep {
    color: rgba(148, 163, 184, 0.45);
}
.tel-gps-btn {
    background: transparent;
    border: none;
    padding: 0.08rem 0.32rem;
    border-radius: 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.71rem;
    font-weight: 600;
    color: #7dd3fc;
    cursor: pointer;
    transition: background 0.14s, color 0.14s;
}
.tel-gps-btn:hover {
    background: rgba(56, 189, 248, 0.18);
    color: #e0f2fe;
}
.tel-osm {
    color: #93c5fd;
}

/* Right: Compact Segmented Drive Controls Capsule */
.drive-controls-capsule {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    padding: 0.3rem;
    border-radius: 11px;
    background: rgba(13, 20, 30, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.32);
}
.ctrl-btn {
    background: rgba(255, 255, 255, 0.04);
    color: #e2ecf8;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.38rem 0.65rem;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.14s;
}
.ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.11);
    color: #ffffff;
}
.ctrl-btn.follow-ctrl.active {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border-color: rgba(110, 231, 183, 0.7);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.4);
}
.ctrl-btn.mp-ctrl {
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
}
.ctrl-btn.mp-ctrl.connected {
    color: #d1fae5;
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(52, 211, 153, 0.32);
}
.mp-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 7px #34d399;
}
.mp-modal-card {
    border-color: rgba(52, 211, 153, 0.4);
}
.mp-title {
    color: #d1fae5;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.mp-status-badge {
    font-size: 0.69rem;
    font-weight: 700;
    padding: 0.14rem 0.5rem;
    border-radius: 999px;
}
.mp-status-badge.online {
    background: rgba(16, 185, 129, 0.22);
    color: #6ee7b7;
}
.mp-status-badge.offline {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
}
.mp-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}
.mp-profile-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.mp-peers-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 220px;
    overflow-y: auto;
}
.mp-peer-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    border-radius: 9px;
    background: var(--card-bg);
    border: 1px solid var(--border);
}
.mp-peer-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.mp-peer-name {
    font-size: 0.83rem;
    font-weight: 700;
    color: #f8fafc;
}
.mp-peer-meta {
    font-size: 0.71rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ctrl-btn.report-ctrl {
    color: #fde68a;
}
.ctrl-btn.report-ctrl:hover {
    background: rgba(180, 83, 9, 0.42);
    border-color: rgba(251, 191, 36, 0.45);
}
.ctrl-btn.exit-ctrl {
    background: rgba(127, 29, 29, 0.55);
    color: #fecaca;
}
.ctrl-btn.exit-ctrl:hover {
    background: rgba(153, 27, 27, 0.9);
    border-color: rgba(248, 113, 113, 0.55);
    color: #fff;
}

/* Teleport Modal Styles */
.teleport-modal-card {
    border-color: rgba(96, 165, 250, 0.4);
}
.teleport-title {
    color: #dbeafe;
}
.teleport-search-row {
    display: flex;
    gap: 0.45rem;
}
.teleport-error {
    font-size: 0.78rem;
    color: #fca5a5;
    background: rgba(127, 29, 29, 0.35);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 8px;
    padding: 0.45rem 0.65rem;
}
.teleport-results {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 210px;
    overflow-y: auto;
}
.teleport-result-item {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    text-align: left;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 0.52rem 0.7rem;
    cursor: pointer;
    transition: all 0.14s;
}
.teleport-result-item:hover {
    background: var(--card-hover);
    border-color: var(--accent);
}
.teleport-res-name {
    font-size: 0.83rem;
    font-weight: 700;
    color: #f8fafc;
}
.teleport-res-sub {
    font-size: 0.71rem;
    color: var(--text-muted);
    line-height: 1.3;
}
.drive-slope {
    font-size: 0.69rem;
    padding: 0.06rem 0.35rem;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}
.drive-slope.uphill {
    background: rgba(245, 158, 11, 0.22);
    color: #fcd34d;
}
.drive-slope.downhill {
    background: rgba(56, 189, 248, 0.22);
    color: #7dd3fc;
}
.osm-pill {
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.35);
}
.stream-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
    animation: pulseStream 1.1s ease-in-out infinite;
}
@keyframes pulseStream {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.75); }
}

.drive-hud-bottom {
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    pointer-events: none;
    z-index: 15;
}
.drive-speedo-card {
    pointer-events: auto;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    background: rgba(13, 20, 30, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.13);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.32);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.speedo-main {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
}
.speedo-num {
    font-size: 2.35rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: #ffffff;
    min-width: 2.1ch;
    text-align: right;
}
.speedo-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.speedo-unit {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #94a3b8;
}
.gear-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 20px;
    border-radius: 5px;
    background: var(--accent);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 800;
}
.drive-surface-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.surface-tag {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.14rem 0.48rem;
    border-radius: 999px;
}
.surface-tag.road {
    background: rgba(59, 130, 246, 0.22);
    color: #93c5fd;
}
.surface-tag.bridge {
    background: rgba(234, 179, 8, 0.24);
    color: #fde047;
}
.surface-tag.tunnel {
    background: rgba(168, 85, 247, 0.24);
    color: #d8b4fe;
}
.surface-tag.offroad {
    background: rgba(34, 197, 94, 0.22);
    color: #86efac;
}
.surface-tag.autosteer-on {
    background: rgba(16, 185, 129, 0.28);
    color: #6ee7b7;
    border: 1px solid rgba(52, 211, 153, 0.45);
}
.surface-tag.autosteer-wait {
    background: rgba(245, 158, 11, 0.22);
    color: #fcd34d;
}
.drive-keys-hint {
    font-size: 0.72rem;
    color: #9fb3c8;
}

.drive-right-cluster {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    pointer-events: auto;
}
.drive-touch-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.45rem;
    border-radius: 12px;
    background: rgba(13, 20, 30, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    user-select: none;
    touch-action: none;
}
.touch-row {
    display: flex;
    gap: 0.3rem;
}
.touch-btn {
    width: 40px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(30, 41, 59, 0.85);
    color: #f8fafc;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    touch-action: none;
}
.touch-btn:active {
    background: var(--accent);
    border-color: #93c5fd;
}

.minimap-wrap {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.36);
    background: rgba(15, 23, 34, 0.9);
    line-height: 0;
}
.drive-minimap {
    display: block;
    width: 156px;
    height: 156px;
}
.minimap-caption {
    position: absolute;
    left: 6px;
    bottom: 5px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(226, 236, 248, 0.78);
    line-height: 1;
    pointer-events: none;
}

/* Bottom Floating Camera & Lighting Dock */
.viewport-dock {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.5rem 0.75rem;
    background: rgba(19, 25, 34, 0.86);
    border: 1px solid var(--border);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    max-width: calc(100% - 2rem);
    z-index: 10;
}
.camera-presets, .light-controls {
    display: flex;
    align-items: center;
    gap: 0.32rem;
    flex-wrap: wrap;
}
.light-controls {
    padding-left: 0.6rem;
    border-left: 1px solid var(--border);
}
.cam-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 0.34rem 0.62rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.cam-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.06);
}
.cam-btn.active {
    color: #fff;
    background: var(--accent-soft);
    border-color: var(--accent);
}
.light-slider-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.74rem;
    color: var(--text-muted);
}
.light-slider-wrap input[type="range"] {
    width: 82px;
    accent-color: var(--accent);
}

/* Right Controls Pane */
.controls-pane {
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border-left: 1px solid var(--border);
    height: 100%;
    overflow: hidden;
}

.panel-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: rgba(13, 17, 23, 0.45);
}
.tab-btn {
    flex: 1 1 calc(25% - 0.35rem);
    min-width: 70px;
    background: var(--card-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.44rem 0.28rem;
    font-size: 0.71rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.tab-btn.engine-tab-btn {
    border-color: rgba(245, 158, 11, 0.32);
}
.tab-btn:hover {
    color: var(--text-main);
    background: var(--card-hover);
}
.tab-btn.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.section-block {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.section-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-main);
}
.section-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.value-badge {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
}

/* Paint Swatches */
.swatch-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
}
.swatch-card {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.6rem;
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
}
.swatch-card:hover {
    background: var(--card-hover);
}
.swatch-card.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.swatch-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.25);
}
.metallic-dot {
    box-shadow: inset -4px -4px 8px rgba(0,0,0,0.45), inset 4px 4px 7px rgba(255,255,255,0.38);
}
.matte-dot {
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25);
}
.swatch-name {
    font-size: 0.76rem;
    font-weight: 500;
    line-height: 1.2;
}

.custom-color-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.color-picker {
    width: 40px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    cursor: pointer;
    padding: 2px;
}

/* Lift Slider */
.lift-slider {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Chips & Option Cards */
.chip-row, .rim-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--card-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0.38rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.chip-btn:hover {
    color: var(--text-main);
    background: var(--card-hover);
}
.chip-btn.selected {
    color: #fff;
    border-color: var(--accent);
    background: var(--accent-soft);
}
.chip-btn.danger:hover {
    border-color: var(--danger);
    color: #fecaca;
}
.mini-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.3);
}

.option-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.option-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.7rem 0.8rem;
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
}
.option-card:hover {
    background: var(--card-hover);
}
.option-card.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.option-card.disabled-gen {
    opacity: 0.65;
}
.option-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}
.option-name {
    font-size: 0.84rem;
    font-weight: 700;
}
.option-brand {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.option-meta {
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}
.option-desc {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.gen-status {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.16rem 0.45rem;
    border-radius: 999px;
}
.gen-status.ready {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
}
.gen-status.soon {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
}

/* Garage */
.save-form {
    display: flex;
    gap: 0.45rem;
}
.text-input {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    color: var(--text-main);
    font-size: 0.84rem;
}
.text-input:focus {
    outline: none;
    border-color: var(--accent);
}
.primary-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}
.primary-btn:hover {
    filter: brightness(1.1);
}
.empty-garage {
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px dashed var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}
.garage-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.garage-card.selected {
    border-color: var(--accent);
}
.garage-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.garage-info {
    min-width: 0;
}
.garage-actions {
    display: flex;
    gap: 0.4rem;
}

/* Studio Engine & Dyno Spec Card */
.dyno-card {
    background: linear-gradient(155deg, rgba(22, 30, 44, 0.96) 0%, rgba(15, 21, 31, 0.96) 100%);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    padding: 0.85rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.dyno-card.turbo-mode {
    border-color: rgba(245, 158, 11, 0.42);
    background: linear-gradient(155deg, rgba(38, 27, 16, 0.92) 0%, rgba(17, 22, 32, 0.96) 100%);
}
.dyno-card.ev-mode {
    border-color: rgba(56, 189, 248, 0.45);
    background: linear-gradient(155deg, rgba(12, 34, 48, 0.94) 0%, rgba(15, 22, 34, 0.96) 100%);
}
.dyno-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}
.dyno-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #f8fafc;
    line-height: 1.25;
}
.dyno-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.14rem;
}
.dyno-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
}
.dyno-stat {
    background: rgba(11, 16, 24, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.45rem 0.58rem;
    display: flex;
    flex-direction: column;
    gap: 0.06rem;
}
.dyno-stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
    font-weight: 700;
}
.dyno-stat-val {
    font-size: 1.08rem;
    font-weight: 800;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}
.dyno-stat-val small {
    font-size: 0.72rem;
    font-weight: 600;
    color: #cbd5e1;
}
.dyno-stat-sub {
    font-size: 0.69rem;
    color: #7dd3fc;
}
.dyno-bars {
    display: flex;
    flex-direction: column;
    gap: 0.36rem;
}
.dyno-bar-row {
    display: grid;
    grid-template-columns: 76px 1fr;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: #cbd5e1;
    font-weight: 600;
}
.dyno-bar-track {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}
.dyno-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.25s ease;
}
.dyno-bar-fill.accel {
    background: linear-gradient(90deg, #38bdf8 0%, #34d399 100%);
}
.dyno-bar-fill.speed {
    background: linear-gradient(90deg, #f59e0b 0%, #fb7185 100%);
}
.dyno-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #94a3b8;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.45rem;
}
.ev-option-card {
    border-color: rgba(56, 189, 248, 0.28);
}
.ev-option-card.selected {
    border-color: #38bdf8;
    background: rgba(14, 165, 233, 0.16);
}

/* Drive Mode Speedo + RPM / Boost / EV Power Bar */
.speedo-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.tach-cluster {
    flex: 1;
    min-width: 170px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.tach-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.engine-hud-pill {
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 0.16rem 0.46rem;
    border-radius: 999px;
    white-space: nowrap;
}
.engine-hud-pill.na {
    background: rgba(148, 163, 184, 0.22);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.35);
}
.engine-hud-pill.turbo {
    background: rgba(245, 158, 11, 0.22);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.45);
}
.engine-hud-pill.ev {
    background: rgba(14, 165, 233, 0.24);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.48);
}
.tach-readout {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    font-weight: 700;
    color: #cbd5e1;
    font-variant-numeric: tabular-nums;
}
.tach-bar-track {
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}
.tach-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.08s linear;
}
.tach-bar-fill.na {
    background: linear-gradient(90deg, #60a5fa 0%, #34d399 100%);
}
.tach-bar-fill.turbo {
    background: linear-gradient(90deg, #fbbf24 0%, #f97316 100%);
}
.tach-bar-fill.redline {
    background: linear-gradient(90deg, #f97316 0%, #ef4444 100%);
}
.tach-bar-fill.ev {
    background: linear-gradient(90deg, #38bdf8 0%, #818cf8 100%);
}
.tach-bar-fill.regen {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}
.gear-badge.ev-gear {
    width: auto;
    padding: 0 0.32rem;
    background: #0284c7;
}
.ctrl-btn.audio-ctrl.muted {
    color: #fca5a5;
    opacity: 0.85;
}
.minimap-wrap.pov-hidden {
    display: none;
}
.surface-tag.brake-tag {
    background: rgba(220, 38, 38, 0.25);
    border-color: rgba(248, 113, 113, 0.55);
    color: #fecaca;
}
.surface-tag.abs-tag {
    background: rgba(245, 158, 11, 0.28);
    border-color: rgba(251, 191, 36, 0.72);
    color: #fde68a;
    animation: absPulse 0.22s infinite alternate;
}
@keyframes absPulse {
    from { opacity: 0.72; }
    to   { opacity: 1.0; }
}

#blazor-error-ui {
    background: #3b1318;
    color: #fecaca;
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.6rem 1.2rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.9rem;
    top: 0.55rem;
}

/* Mobile / Tablet Responsive */
@media (max-width: 900px) {
    .configurator-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 50vh 50vh;
        grid-template-rows: 50dvh 50dvh;
    }
    .configurator-layout.driving-mode {
        grid-template-rows: 1fr;
    }
    .drive-keys-hint {
        display: none;
    }
    .drive-minimap {
        width: 108px;
        height: 108px;
    }
    .controls-pane {
        border-left: none;
        border-top: 1px solid var(--border);
    }
    .gen-pill {
        display: none;
    }
    .light-controls {
        border-left: none;
        padding-left: 0;
    }
}

@media (max-width: 600px) {
    .viewport-header {
        top: 0.55rem;
        left: 0.55rem;
        right: 0.55rem;
    }
    .brand-mark {
        font-size: 0.72rem;
    }
    .pill-btn {
        padding: 0.34rem 0.55rem;
        font-size: 0.72rem;
    }
    .viewport-dock {
        bottom: 0.45rem;
        padding: 0.3rem 0.45rem;
        gap: 0.3rem;
        max-width: calc(100% - 0.8rem);
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
    }
    .camera-presets, .light-controls {
        flex-wrap: nowrap;
        flex-shrink: 0;
    }
    .cam-btn {
        padding: 0.25rem 0.44rem;
        font-size: 0.68rem;
        white-space: nowrap;
    }
    .drive-hud-top {
        top: 0.5rem;
        left: 0.5rem;
        right: 0.5rem;
        gap: 0.4rem;
    }
    .drive-nav-capsule {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }
    .drive-controls-capsule {
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0.22rem;
        padding: 0.24rem;
    }
    .drive-controls-capsule .ctrl-btn {
        padding: 0.28rem 0.42rem;
        font-size: 0.69rem;
    }
    .drive-hud-bottom {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.55rem;
        gap: 0.45rem;
    }
    .drive-right-cluster {
        flex-direction: column-reverse;
        align-items: flex-end;
        gap: 0.45rem;
    }
    .drive-minimap {
        width: 92px;
        height: 92px;
    }
    .drive-speedo-card {
        padding: 0.48rem 0.65rem;
    }
    .speedo-num {
        font-size: 1.7rem;
    }
    .tach-cluster {
        min-width: 108px;
    }
    .touch-btn {
        width: 44px;
        height: 40px;
    }
}
