/* style.css — 3D Model Racing Glassmorphism Design System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800;900&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    --bg-dark: #0a0c16;
    --card-bg: rgba(18, 22, 38, 0.72);
    --card-border: rgba(255, 255, 255, 0.12);
    --primary-cyan: #00f2fe;
    --accent-gold: #f6d365;
    --accent-red: #ff4757;
    --neon-blue: #4facfe;
    --neon-purple: #7f00ff;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-heading);
    color: var(--text-main);
}

#webgl-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: block;
}

/* UI Overlays */
.ui-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.ui-panel {
    pointer-events: auto;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

/* MENU VIEW */
#menu-view {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 50px 30px;
}

.menu-hero {
    text-align: center;
    margin-top: 40px;
}

.menu-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(0, 242, 254, 0.15);
    border: 1px solid rgba(0, 242, 254, 0.35);
    border-radius: 20px;
    color: var(--primary-cyan);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.menu-title {
    font-size: 64px;
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1.05;
    background: linear-gradient(135deg, #ffffff 30%, #4facfe 70%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 40px rgba(0, 242, 254, 0.35);
}

.menu-subtitle {
    margin-top: 14px;
    font-size: 18px;
    color: var(--text-muted);
    max-width: 580px;
    line-height: 1.5;
}

.menu-actions {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.btn-primary {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 36px;
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    color: #04101e;
    border: none;
    border-radius: 16px;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 8px 24px rgba(0, 242, 254, 0.3);
}

.btn-primary span {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.85;
    margin-top: 4px;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 14px 34px rgba(0, 242, 254, 0.5);
}

.btn-secondary {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 36px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 16px;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-secondary span {
    font-size: 12px;
    color: var(--accent-gold);
    margin-top: 4px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: var(--accent-gold);
    transform: translateY(-3px);
}

.menu-footer {
    display: flex;
    gap: 40px;
    font-size: 14px;
    color: var(--text-muted);
}

/* GARAGE VIEW */
#garage-view {
    display: none;
    justify-content: space-between;
    padding: 30px 40px;
}

.garage-sidebar {
    width: 380px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary-cyan);
    margin-bottom: 10px;
}

/* Dropzone & Import */
.dropzone {
    border: 2px dashed rgba(0, 242, 254, 0.4);
    border-radius: 14px;
    padding: 18px 14px;
    text-align: center;
    background: rgba(0, 242, 254, 0.04);
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropzone:hover {
    background: rgba(0, 242, 254, 0.08);
    border-color: var(--primary-cyan);
}

.dropzone-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.dropzone-label {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.dropzone-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

#model-file-input {
    display: none;
}

#import-status {
    font-size: 12px;
    color: var(--accent-gold);
    font-family: var(--font-mono);
    text-align: center;
    min-height: 16px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 14px;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: #fff;
    margin-top: 2px;
}

.ascend-indicator {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    text-align: center;
    text-transform: uppercase;
}

.ascend-indicator.ready {
    background: rgba(0, 242, 254, 0.15);
    border: 1px solid var(--primary-cyan);
    color: var(--primary-cyan);
}

.ascend-indicator.not-ready {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

/* Customizer controls */
.palette {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.color-swatch {
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: #ffffff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
}

.pattern-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.pattern-btn {
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.pattern-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.pattern-btn.active {
    background: var(--primary-cyan);
    color: #04101e;
    border-color: var(--primary-cyan);
    font-weight: 800;
}

/* Garage Center & Right */
.garage-center-hint {
    align-self: flex-end;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.garage-right-actions {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 14px;
    margin-bottom: 20px;
}

.btn-garage-action {
    pointer-events: auto;
    padding: 16px 32px;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease;
}

.btn-garage-start {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    color: #04101e;
    box-shadow: 0 8px 24px rgba(0, 242, 254, 0.35);
}

.btn-garage-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 242, 254, 0.5);
}

.btn-garage-sub {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
}

.btn-garage-sub:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* RACE HUD */
#race-hud {
    display: none;
}

/* Top Progress Bar */
.hud-top-progress {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 650px;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    overflow: visible;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00f2fe, #f6d365);
    border-radius: 6px;
    transition: width 0.05s linear;
}

.progress-player-pin {
    position: absolute;
    top: -6px;
    left: 0%;
    width: 22px;
    height: 22px;
    background: #00f2fe;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 12px #00f2fe;
    transform: translateX(-50%);
    transition: left 0.05s linear;
}

.hud-dist-badge {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(0, 242, 254, 0.45);
    border-radius: 12px;
    padding: 3px 14px;
    font-family: var(--font-mono, monospace);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #00f2fe;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}

/* Speedometer & Boost in Bottom Left */
.hud-bottom-left {
    position: absolute;
    bottom: 30px;
    left: 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.speedo-card {
    padding: 16px 28px;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.speed-value {
    font-size: 56px;
    font-weight: 900;
    font-family: var(--font-mono);
    line-height: 1;
    background: linear-gradient(180deg, #ffffff 40%, var(--primary-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.speed-unit {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-muted);
}

.boost-card {
    padding: 10px 18px;
    width: 240px;
}

.boost-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--accent-gold);
    margin-bottom: 6px;
}

.boost-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    overflow: hidden;
}

.boost-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff9900, #ffea00);
    box-shadow: 0 0 10px #ff9900;
}

/* Rank & Timer Top Corners */
.hud-top-left {
    position: absolute;
    top: 24px;
    left: 40px;
    padding: 12px 22px;
}

.hud-top-right {
    position: absolute;
    top: 24px;
    right: 40px;
    padding: 12px 22px;
}

.hud-label {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.hud-val {
    font-size: 26px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: #fff;
    margin-top: 2px;
}

/* Minimap Bottom Right */
.hud-bottom-right {
    position: absolute;
    bottom: 30px;
    right: 40px;
    padding: 8px;
    border-radius: 20px;
}

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

/* Ascension Banner */
.hud-badge {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    display: none;
}

.hud-badge.ready {
    background: rgba(0, 242, 254, 0.2);
    border: 2px solid var(--primary-cyan);
    color: var(--primary-cyan);
    box-shadow: 0 0 24px rgba(0, 242, 254, 0.6);
}

.hud-badge.ascended {
    background: linear-gradient(135deg, rgba(246, 211, 101, 0.3), rgba(253, 160, 133, 0.3));
    border: 2px solid var(--accent-gold);
    color: var(--accent-gold);
    box-shadow: 0 0 35px rgba(246, 211, 101, 0.8);
}

.pulse {
    animation: badgePulse 1.2s infinite alternate;
}

@keyframes badgePulse {
    0% { transform: translateX(-50%) scale(1.0); }
    100% { transform: translateX(-50%) scale(1.06); }
}

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: rgba(4, 6, 14, 0.75);
    backdrop-filter: blur(14px);
    display: none;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

.modal-overlay.visible {
    display: flex;
}

.modal-card {
    background: rgba(18, 22, 38, 0.92);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 36px 44px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.upgrade-cards {
    display: flex;
    gap: 16px;
    margin: 24px 0;
}

.upgrade-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.upgrade-card:hover {
    background: rgba(0, 242, 254, 0.08);
    border-color: var(--primary-cyan);
    transform: translateY(-4px);
}

.upgrade-icon {
    font-size: 36px;
}

.upgrade-title {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
}

.upgrade-detail {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    min-height: 48px;
}

.upgrade-btn {
    width: 100%;
    padding: 10px;
    background: var(--primary-cyan);
    color: #04101e;
    border: none;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    margin-top: 6px;
}

/* Finish Modal */
.finish-ascended {
    font-size: 34px;
    font-weight: 900;
    color: var(--accent-gold);
    text-shadow: 0 0 20px rgba(246, 211, 101, 0.6);
}

.finish-normal {
    font-size: 34px;
    font-weight: 900;
    color: #ffffff;
}

.finish-stats {
    margin: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    padding: 16px 20px;
    border-radius: 14px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-muted);
}

.stat-row strong {
    color: #fff;
    font-family: var(--font-mono);
}

.finish-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
}

/* ==========================================================================
   Hardware-Accelerated Compositor Loading Screen (Zero-Stutter GPU Layer)
   ========================================================================== */
#launch-compositor-overlay {
    position: fixed;
    inset: 0;
    z-index: 4500;
    overflow: hidden;
    pointer-events: auto;
    opacity: 1;
    background: #07030e;
}

#launch-compositor-overlay.dissolve-out {
    opacity: 0;
    pointer-events: none;
}

#compositor-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 4540;
}

#compositor-video-loop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 4550;
}

#compositor-bg-loop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

#compositor-vehicle-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4600;
}

#compositor-vehicle-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    will-change: transform;
    animation: compositorVehicleVibe 0.08s ease-in-out infinite alternate;
}

@keyframes compositorVehicleVibe {
    0% { transform: translate3d(0, 0px, 0); }
    100% { transform: translate3d(0, -1px, 0); }
}

#compositor-loading-hud {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -100%);
    z-index: 4700;
    pointer-events: none;
}

.void-loader-box {
    width: 320px;
    background: rgba(10, 15, 26, 0.88);
    border: 1px solid rgba(0, 243, 255, 0.55);
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.28), inset 0 0 15px rgba(189, 0, 255, 0.18);
    border-radius: 8px;
    padding: 10px 14px;
    backdrop-filter: blur(12px);
    font-family: var(--font-mono, monospace);
}

.void-loader-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #00f3ff;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.void-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00f3ff;
    box-shadow: 0 0 8px #00f3ff;
    animation: voidPulse 0.9s infinite alternate;
    display: inline-block;
    margin-right: 6px;
}

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

.void-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
    border: 1px solid rgba(0, 243, 255, 0.2);
}

.void-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00f3ff, #bd00ff);
    box-shadow: 0 0 10px #00f3ff;
    transition: width 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.void-loader-task {
    font-size: 10px;
    color: #94a3b8;
    text-align: center;
    letter-spacing: 0.8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


