@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --panel: rgba(8, 10, 16, 0.72);
    --line: rgba(255, 255, 255, 0.12);
    --cyan: #00d4ff;
    --pink: #ff6b9d;
    --text: #f4f7fb;
    --muted: rgba(244, 247, 251, 0.62);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #05070c;
    color: var(--text);
    font-family: 'Poppins', sans-serif;
}

#stage {
    position: fixed;
    inset: 0;
}

#stage canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#loading {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #141824 0%, #05070c 70%);
    transition: opacity 0.6s ease;
}

#loading.hide {
    opacity: 0;
    pointer-events: none;
}

.loader-car {
    width: 84px;
    height: 36px;
    border-radius: 18px 22px 8px 8px;
    background: linear-gradient(90deg, var(--cyan), var(--pink));
    position: relative;
    margin-bottom: 22px;
    animation: bounce 1.2s ease-in-out infinite;
    box-shadow: 0 12px 30px rgba(0, 212, 255, 0.25);
}

.loader-car::before,
.loader-car::after {
    content: '';
    position: absolute;
    bottom: -8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #111;
    border: 2px solid #ddd;
}

.loader-car::before { left: 12px; }
.loader-car::after { right: 12px; }

@keyframes bounce {
    50% { transform: translateY(-6px); }
}

.loading-text {
    letter-spacing: 0.28em;
    text-transform: uppercase;
    font-size: 0.78rem;
    color: var(--muted);
}

#topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 22px 26px;
    pointer-events: none;
}

.brand, .top-actions {
    pointer-events: auto;
}

.brand-kicker {
    font-size: 0.68rem;
    letter-spacing: 0.34em;
    color: var(--cyan);
    text-transform: uppercase;
}

.brand h1 {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.15;
    margin-top: 4px;
}

.brand p {
    color: var(--muted);
    font-size: 0.82rem;
    margin-top: 4px;
}

.top-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.ghost {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    border-radius: 999px;
    padding: 8px 12px;
    font: inherit;
    font-size: 0.75rem;
    text-decoration: none;
    cursor: pointer;
    backdrop-filter: blur(12px);
    white-space: nowrap;
}

.ghost:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

#panel {
    position: fixed;
    left: 22px;
    top: 118px;
    bottom: 78px;
    width: min(320px, calc(100vw - 32px));
    z-index: 10;
    overflow: auto;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel);
    backdrop-filter: blur(16px);
}

#panel h2 {
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    color: var(--muted);
    margin: 14px 0 10px;
}

#panel h2:first-child {
    margin-top: 0;
}

.model-list {
    display: grid;
    gap: 8px;
}

.model-btn {
    appearance: none;
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    cursor: pointer;
}

.model-btn small {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
}

.model-btn.active,
.model-btn:hover {
    border-color: var(--cyan);
    background: rgba(0, 212, 255, 0.1);
}

.swatches, .rim-styles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

.swatch.active {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

.rim-btn {
    appearance: none;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    border-radius: 999px;
    padding: 6px 10px;
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}

.rim-btn.active,
.rim-btn:hover {
    border-color: var(--pink);
    color: var(--pink);
}

.segment {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.segment button {
    appearance: none;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    border-radius: 10px;
    padding: 8px;
    font: inherit;
    cursor: pointer;
}

.segment button.active {
    background: rgba(0, 212, 255, 0.16);
    border-color: var(--cyan);
}

#hint, #stats {
    position: fixed;
    z-index: 10;
    color: var(--muted);
    font-size: 0.78rem;
}

#hint {
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 16px;
    backdrop-filter: blur(12px);
    white-space: nowrap;
}

#stats {
    right: 22px;
    bottom: 24px;
    font-variant-numeric: tabular-nums;
}

#model-loading {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    display: none;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--panel);
    border: 1px solid var(--line);
    backdrop-filter: blur(12px);
    font-size: 0.82rem;
}

#model-loading.show {
    display: block;
}

#asset-credit {
    position: fixed;
    left: 22px;
    bottom: 24px;
    z-index: 10;
    max-width: min(420px, calc(100vw - 160px));
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.4;
}

#asset-credit a {
    color: var(--muted);
}

@media (max-width: 820px) {
    #panel {
        top: auto;
        left: 10px;
        right: 10px;
        bottom: 62px;
        width: auto;
        max-height: 38vh;
    }

    #hint,
    #asset-credit {
        display: none;
    }

    .brand h1 {
        font-size: 1.05rem;
    }
}
