/* ═════════════════════════════════════════════════════════════════
   PORSCHE MISSION S — INTERACTIVE 3D SUPERCAR SHOWROOM HUD
   Exact Reference Recreation · Zero-Gap Seamless Video Engine
   ═════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:root {
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: 'Montserrat', sans-serif;
    --font-mono: 'Space Mono', monospace;

    /* Theme Palette matching the reference studio screenshot */
    --color-studio-bg: #e2e4e7;
    --color-hud-dark: #1e2023;
    --color-hud-darker: #131517;
    --color-hud-text: #111315;
    --color-hud-muted: #6e7278;
    --color-hud-card-inactive: rgba(255, 255, 255, 0.42);
    --color-hud-card-border: rgba(255, 255, 255, 0.55);
    --color-hud-card-active: #ffffff;
    --color-porsche-red: #d5001c;
    --color-accent-blue: #0077c8;

    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--color-studio-bg);
    font-family: var(--font-main);
    color: var(--color-hud-text);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

/* ── PRELOADER ──────────────────────────────────────────────── */
.preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #111315;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: opacity 0.6s var(--ease-out-expo), visibility 0.6s;
}

.preloader.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-content {
    text-align: center;
    max-width: 480px;
    padding: 2rem;
}

.preloader-crest {
    margin-bottom: 1.5rem;
    animation: crestPulse 2s infinite ease-in-out;
}

@keyframes crestPulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.06); opacity: 1; }
}

.brand-text {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    margin-bottom: 0.4rem;
}

.brand-text span {
    font-weight: 300;
    color: #a0a6b0;
}

.sub-brand {
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    color: #7b8390;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

.progress-bar-container {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: #ffffff;
    transition: width 0.15s linear;
}

.progress-text {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.loading-label {
    font-size: 0.65rem;
    letter-spacing: 0.25em;
    color: #616874;
}

/* ── ORIENTATION LOCK ────────────────────────────────────────── */
.orientation-lock {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(17, 19, 21, 0.96);
    backdrop-filter: blur(20px);
    color: #ffffff;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

@media (max-width: 900px) and (orientation: portrait) {
    .orientation-lock.active {
        display: flex;
    }
}

.orientation-content h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    letter-spacing: 0.1em;
    margin: 1.2rem 0 0.6rem;
}

.orientation-content p {
    font-size: 0.85rem;
    color: #9ea4af;
    line-height: 1.5;
    max-width: 320px;
    margin: 0 auto 1.5rem;
}

.btn-bypass-orientation {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.4rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

/* ── 3D CAMERA VIEWPORT & VIDEO CONTAINER ───────────────────── */
.camera-viewport {
    position: absolute;
    inset: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: var(--color-studio-bg);
}

.ambient-studio-backdrop {
    position: absolute;
    inset: -5%;
    width: 110%;
    height: 110%;
    background: radial-gradient(circle at 50% 45%, #f6f7f9 0%, #e2e4e7 65%, #c8cbd0 100%);
    pointer-events: none;
    z-index: 1;
}

.camera-rig {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
    transform-style: preserve-3d;
}

.vcamera-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
}

/* Resting still images and video streams — Frame-Accurate Crossfade Driven by GSAP */
.resting-still,
.cinematic-video {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 46%;
    pointer-events: none;
    opacity: 0;
    will-change: opacity, transform;
}

.resting-still.active,
.cinematic-video.active {
    opacity: 1;
    z-index: 3;
}

/* ── CINEMATIC STORYTELLING ENTRANCE OVERLAY & RED BRUSH TEXT (ALLEGATI 1 & 2) ── */
.entrance-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    background: radial-gradient(circle at 50% 50%, rgba(15, 17, 21, 0.48) 0%, rgba(8, 10, 12, 0.78) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s ease;
}

.entrance-overlay.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.entrance-overlay.in-motion-mode {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    pointer-events: none !important;
    justify-content: flex-start !important;
    padding-top: 4.8rem !important;
}

.entrance-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 980px;
    padding: 0 1.8rem;
    position: relative;
    z-index: 2;
}

.brush-title-img {
    width: 100%;
    max-width: 780px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 28px rgba(213, 6, 33, 0.75)) drop-shadow(0 4px 16px rgba(0, 0, 0, 0.85));
    animation: brushPulseGlow 3.2s infinite ease-in-out;
    transform-origin: center center;
}

.brush-title-img.in-motion-img {
    max-width: 680px;
    filter: drop-shadow(0 0 35px rgba(213, 6, 33, 0.9)) drop-shadow(0 6px 20px rgba(0, 0, 0, 0.95));
}

@keyframes brushPulseGlow {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 24px rgba(213, 6, 33, 0.6)) drop-shadow(0 4px 14px rgba(0, 0, 0, 0.8));
    }
    50% {
        transform: scale(1.025);
        filter: drop-shadow(0 0 45px rgba(213, 6, 33, 0.95)) drop-shadow(0 6px 22px rgba(0, 0, 0, 0.95));
    }
}

.entrance-sub {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.35em;
    color: #f0f2f5;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
    margin-top: 2rem;
    margin-bottom: 2.5rem;
    text-transform: uppercase;
}

.btn-launch-showroom {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 1.1rem;
    padding: 1.1rem 3rem;
    background: #D50621;
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    font-family: var(--font-display);
    font-size: 0.98rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    cursor: pointer;
    border-radius: 4px;
    box-shadow: 0 0 35px rgba(213, 6, 33, 0.65), 0 10px 25px rgba(0, 0, 0, 0.6);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background 0.2s ease;
}

.btn-launch-showroom:hover {
    transform: scale(1.06);
    background: #ea0826;
    box-shadow: 0 0 55px rgba(213, 6, 33, 0.95), 0 14px 35px rgba(0, 0, 0, 0.7);
}

.btn-launch-showroom:active {
    transform: scale(0.97);
}

.launch-bracket {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    opacity: 0.85;
}

.motion-telemetry-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1.6rem;
    background: rgba(14, 16, 20, 0.86);
    border: 1px solid rgba(213, 6, 33, 0.75);
    border-radius: 999px;
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    box-shadow: 0 0 25px rgba(213, 6, 33, 0.5);
    margin-top: 1.4rem;
    backdrop-filter: blur(8px);
}

/* ── HEADS-UP DISPLAY (HUD) CONTAINER ────────────────────────── */
.hud-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Allows click-through to stage where empty */
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    grid-template-rows: 90px 1fr 90px;
    grid-template-areas:
        "top top top"
        "left center right"
        "dock dock dock";
    padding: 1.5rem 2.2rem 1.8rem;
}

/* ── 1. TOP HEADER BAR ───────────────────────────────────────── */
.top-bar {
    grid-area: top;
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
    height: 100%;
}

.top-bar-left {
    display: flex;
    align-items: flex-start;
    gap: 1.2rem;
}

/* Back Badge with angled/trapezoid chevron */
.btn-back-badge {
    width: 52px;
    height: 48px;
    background: var(--color-hud-dark);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0 0, 100% 0, 75% 100%, 0% 100%);
    transition: background 0.2s, transform 0.2s;
    outline: none;
}

.btn-back-badge:hover {
    background: #000000;
    transform: translateX(-2px);
}

.header-titles {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.header-main-title {
    font-family: var(--font-main);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-hud-text);
    line-height: 1;
}

.classes-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.classes-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #555960;
    text-transform: uppercase;
}

.classes-tabs {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.class-tab {
    background: none;
    border: none;
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 600;
    color: #7b8089;
    cursor: pointer;
    padding: 0 0.15rem;
    transition: color 0.2s;
}

.class-tab.active {
    font-weight: 800;
    color: var(--color-hud-text);
    position: relative;
}

.classes-line {
    display: inline-block;
    width: 32px;
    height: 2px;
    background: #2b2e33;
    margin: 0 0.1rem;
}

/* Top Right Section */
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1.4rem;
}

/* Currency Pill */
.currency-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--color-hud-dark);
    color: #ffffff;
    padding: 0.38rem 0.6rem 0.38rem 0.85rem;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.cog-icon {
    display: flex;
    align-items: center;
    color: #ffffff;
}

.currency-value {
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.currency-add-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.currency-add-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* Device Status: Cell, WiFi, Battery */
.device-status-cluster {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #3b3f46;
}

.status-cell-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
}

.status-cell-bars .bar {
    width: 3px;
    background: currentColor;
    border-radius: 1px;
}
.status-cell-bars .b1 { height: 4px; }
.status-cell-bars .b2 { height: 7px; }
.status-cell-bars .b3 { height: 10px; }
.status-cell-bars .b4 { height: 14px; }

.status-wifi {
    display: flex;
    align-items: center;
}

.status-battery {
    display: flex;
    align-items: center;
    gap: 1px;
}

.battery-body {
    width: 22px;
    height: 11px;
    border: 1.5px solid currentColor;
    border-radius: 2.5px;
    padding: 1px;
    display: flex;
    align-items: center;
}

.battery-fill {
    height: 100%;
    background: currentColor;
    border-radius: 1px;
}

.battery-nub {
    width: 2px;
    height: 4px;
    background: currentColor;
    border-radius: 0 1px 1px 0;
}

/* Aux Controls: Sound, Speed, Fullscreen */
.top-aux-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.4rem;
}

.btn-top-util {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--color-hud-text);
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background 0.2s, transform 0.15s;
    backdrop-filter: blur(8px);
}

.btn-top-util:hover {
    background: #ffffff;
    transform: translateY(-1px);
}

.speed-mode-pill {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    background: var(--color-hud-dark);
    color: #ffffff;
    border: none;
}

.speed-mode-pill:hover {
    background: #000000;
    color: #ffffff;
}

/* ── 2. LEFT SIDEBAR: CAR CARDS ──────────────────────────────── */
.left-sidebar {
    grid-area: left;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.75rem;
    padding-top: 0.5rem;
    width: 260px;
    z-index: 15;
}

.cars-cards-scroll {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

/* Car Card */
.car-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.55rem 0.75rem;
    background: var(--color-hud-card-inactive);
    border: 1px solid var(--color-hud-card-border);
    backdrop-filter: blur(14px);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.22s var(--ease-out-expo);
}

.car-card:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: translateX(4px);
}

/* Active Highlighted Car Card matching the reference screenshot */
.car-card.active {
    background: var(--color-hud-card-active);
    border-color: #ffffff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transform: translateX(8px);
}

.car-thumb-wrap {
    width: 82px;
    height: 48px;
    background: #d4d7dc;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.car-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 50%;
}

.car-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.car-card-name {
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--color-hud-text);
}

.car-card.active .car-card-name {
    font-weight: 800;
    color: #000000;
}

.car-card-sub {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-hud-muted);
}

/* Add Car Card */
.add-car-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.85rem 0.55rem 1.1rem;
    background: var(--color-hud-card-inactive);
    border: 1px solid var(--color-hud-card-border);
    backdrop-filter: blur(14px);
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.4rem;
    transition: all 0.2s ease;
}

.add-car-card:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}

.add-car-text {
    font-family: var(--font-main);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--color-hud-text);
}

.add-car-plus-box {
    width: 44px;
    height: 38px;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-hud-text);
    transition: background 0.2s;
}

.add-car-card:hover .add-car-plus-box {
    background: #ffffff;
}

/* ── 3. RIGHT PANEL: LEVEL, STATS GAUGE & SKILLS ─────────────── */
.right-panel {
    grid-area: right;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-top: 0.5rem;
    z-index: 15;
}

.right-panel-content {
    display: flex;
    flex-direction: column;
    width: 250px;
}

/* Level Indicator Cluster */
.level-cluster {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.level-big-num {
    font-family: var(--font-main);
    font-size: 4.6rem;
    font-weight: 800;
    line-height: 0.88;
    color: var(--color-hud-text);
    letter-spacing: -0.04em;
}

.level-badge {
    background: var(--color-hud-dark);
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.38em;
    padding: 0.22rem 0.65rem 0.22rem 0.75rem;
    margin-top: 0.25rem;
    border-radius: 2px;
}

/* Car Meta */
.car-header-meta {
    margin-bottom: 1.1rem;
}

.car-destroer-title {
    font-family: var(--font-main);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--color-hud-text);
    line-height: 1.1;
}

.car-class-label {
    font-size: 0.8rem;
    color: #4b4f57;
    margin-top: 0.15rem;
}

.car-class-label strong {
    font-weight: 800;
    color: #000000;
}

/* Stats Telemetry Bars */
.stats-container {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.4rem;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    flex: 1;
}

.stat-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-name {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #3b3f46;
}

.stat-val {
    font-family: var(--font-main);
    font-size: 0.88rem;
    font-weight: 600;
    color: #1a1c20;
}

.stat-track {
    width: 100%;
    height: 3px;
    background: #c3c6cb;
    border-radius: 1px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: #111315;
    border-radius: 1px;
    transition: width 0.6s var(--ease-out-expo);
}

/* Scrollbar Thumb on Right */
.stats-scrollbar-track {
    width: 4px;
    height: 100%;
    background: #c3c6cb;
    border-radius: 2px;
    position: relative;
}

.stats-scrollbar-thumb {
    width: 100%;
    height: 40%;
    background: #1e2023;
    border-radius: 2px;
    position: absolute;
    top: 15%;
}

/* Skills / Upgrades Section */
.skills-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.6rem;
}

.skills-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #4b4f57;
    text-transform: uppercase;
}

.skills-buttons-row {
    display: flex;
    gap: 0.6rem;
}

.skill-btn {
    width: 52px;
    height: 52px;
    background: var(--color-hud-dark);
    border: none;
    color: #ffffff;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.18s;
}

.skill-btn:hover {
    background: #000000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.skill-btn.active {
    background: var(--color-porsche-red);
    box-shadow: 0 0 16px rgba(213, 0, 28, 0.45);
}

/* Tactical Bottom START Button matching reference */
.bottom-action-container {
    width: 100%;
    margin-top: auto;
}

.btn-start {
    position: relative;
    width: 100%;
    height: 54px;
    background: var(--color-hud-dark);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-main);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    border-radius: 2px;
    transition: background 0.2s, transform 0.18s, box-shadow 0.2s;
    outline: none;
}

.btn-start:hover {
    background: #000000;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.btn-start:active {
    transform: translateY(0);
}

/* Tactical 4-corner brackets */
.corner {
    position: absolute;
    width: 8px;
    height: 8px;
    border-color: #ffffff;
    border-style: solid;
    pointer-events: none;
}

.c-tl {
    top: 5px;
    left: 5px;
    border-width: 1.5px 0 0 1.5px;
}

.c-tr {
    top: 5px;
    right: 5px;
    border-width: 1.5px 1.5px 0 0;
}

.c-bl {
    bottom: 5px;
    left: 5px;
    border-width: 0 0 1.5px 1.5px;
}

.c-br {
    bottom: 5px;
    right: 5px;
    border-width: 0 1.5px 1.5px 0;
}

/* ── 4. BOTTOM DOCK (CAMERA ROTATION & ORBIT) ─────────────────── */
.camera-dock {
    grid-area: dock;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    z-index: 15;
}

.dock-inner {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    padding: 0.38rem 0.65rem;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.dock-btn {
    background: none;
    border: none;
    padding: 0.45rem 0.85rem;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-main);
    color: #4b4f56;
    transition: all 0.2s ease;
}

.dock-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #000000;
}

.dock-btn.active {
    background: var(--color-hud-dark);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dock-num {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.dock-name {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

/* Multi-Hop Route Telemetry Pill */
.route-progress-pill {
    position: absolute;
    top: 95px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-hud-dark);
    color: #ffffff;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 25;
}

.route-progress-pill.visible {
    opacity: 1;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background: #00d4ff;
    border-radius: 50%;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1.3); opacity: 1; }
}

.route-progress-fill-bar {
    width: 60px;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.route-progress-fill {
    height: 100%;
    background: #00d4ff;
    width: 0%;
    transition: width 0.2s ease;
}

/* ── MODALS (ADD CAR & UPGRADES) ─────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9990;
    background: rgba(17, 19, 21, 0.65);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-backdrop.open {
    display: flex;
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    background: #ffffff;
    border-radius: 8px;
    padding: 2.2rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    color: var(--color-hud-text);
    animation: modalPop 0.3s var(--ease-out-expo);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close-btn {
    position: absolute;
    top: 1.2rem;
    right: 1.4rem;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: #6a6f79;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #000000;
}

.modal-header {
    margin-bottom: 1.6rem;
}

.modal-pre-title {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: #7b8089;
    text-transform: uppercase;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    color: #111315;
    margin-top: 0.2rem;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.config-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.config-row label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #4b4f57;
}

.modal-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #f1f3f5;
    border: 1px solid #dcdfe3;
    border-radius: 4px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    color: #111315;
    outline: none;
    transition: border-color 0.2s;
}

.modal-input:focus {
    border-color: #111315;
    background: #ffffff;
}

.color-palette {
    display: flex;
    gap: 0.75rem;
}

.color-chip {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s, border-color 0.2s;
}

.color-chip:hover {
    transform: scale(1.12);
}

.color-chip.active {
    border-color: #111315;
    transform: scale(1.15);
}

.spec-select-row {
    display: flex;
    gap: 0.6rem;
}

.pill-chip {
    flex: 1;
    padding: 0.65rem 0.85rem;
    background: #f1f3f5;
    border: 1px solid #dcdfe3;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #3b3f46;
    cursor: pointer;
    transition: all 0.2s;
}

.pill-chip.active {
    background: var(--color-hud-dark);
    color: #ffffff;
    border-color: var(--color-hud-dark);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

.btn-modal-cancel {
    padding: 0.75rem 1.4rem;
    background: none;
    border: 1px solid #dcdfe3;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    color: #555962;
    transition: background 0.2s;
}

.btn-modal-cancel:hover {
    background: #f1f3f5;
}

.btn-modal-confirm {
    padding: 0.75rem 1.5rem;
    background: var(--color-hud-dark);
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    color: #ffffff;
    transition: background 0.2s, transform 0.15s;
}

.btn-modal-confirm:hover {
    background: #000000;
    transform: translateY(-1px);
}

/* ── LAUNCH CONTROL OVERLAY ──────────────────────────────────── */
.launch-overlay {
    position: fixed;
    inset: 0;
    z-index: 9995;
    background: rgba(17, 19, 21, 0.92);
    backdrop-filter: blur(20px);
    display: none;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-align: center;
}

.launch-overlay.active {
    display: flex;
}

.launch-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.launch-tag {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    color: #00d4ff;
}

.launch-title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.launch-timer {
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 700;
    color: #ffffff;
}

.launch-telemetry {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #8b929e;
    letter-spacing: 0.15em;
    margin-top: 1rem;
}

/* ── RESPONSIVE ADAPTATIONS ──────────────────────────────────── */
@media (max-width: 1200px) {
    .hud-container {
        padding: 1.2rem 1.4rem;
        grid-template-columns: 240px 1fr 240px;
    }
    .left-sidebar {
        width: 220px;
    }
    .right-panel-content {
        width: 210px;
    }
    .level-big-num {
        font-size: 3.8rem;
    }
}

@media (max-width: 900px) {
    .hud-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
            "top"
            "dock"
            "dock";
        padding: 0.8rem;
    }
    .left-sidebar, .right-panel {
        display: none; /* Mobile view prioritizes uncluttered cinematic viewport */
    }
    .camera-dock {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
}
