/* 基础重置与变量 */
:root {
    --primary-color: #00d4ff;
    --primary-glow: rgba(0, 212, 255, 0.3);
    --secondary-color: #ff6b35;
    --bg-dark: #0a0a0f;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* 背景效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(0, 212, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(255, 107, 53, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(100, 100, 150, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* 主容器 - 全屏 */
.container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

/* 查看器容器 - 全屏 */
.viewer-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 查看器 - 全屏 */
.viewer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#carCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* 加载画面 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    padding: 20px;
}

.loading-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
    color: var(--primary-color);
}

.car-icon {
    width: 100%;
    height: 100%;
    animation: float 2s ease-in-out infinite;
}

.car-body {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawLine 2s ease forwards;
}

.car-window {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawLine 1.5s ease 0.5s forwards;
}

.wheel {
    stroke-dasharray: 63;
    stroke-dashoffset: 63;
    animation: drawLine 1s ease 1s forwards;
}

.wheel-front {
    transform-origin: 28px 70px;
    animation: drawLine 1s ease 1s forwards, spin-wheel 3s linear 2s infinite;
}

.wheel-rear {
    transform-origin: 72px 70px;
    animation: drawLine 1s ease 1.1s forwards, spin-wheel 3s linear 2s infinite;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes spin-wheel {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading-title {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 30px;
    opacity: 0;
    animation: fadeIn 0.5s ease 0.8s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 0 auto 15px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.loading-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    opacity: 0;
    animation: fadeIn 0.5s ease 1s forwards;
}

/* 底部操作提示 */
.hint-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(10, 10, 15, 0.9), transparent);
    z-index: 10;
    opacity: 0;
    animation: hintFadeIn 0.5s ease 2s forwards;
}

@keyframes hintFadeIn {
    to {
        opacity: 1;
    }
}

.hint-icon {
    font-size: 1.2rem;
    color: var(--primary-color);
    animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
    0%, 100% {
        transform: translateX(0);
        opacity: 0.6;
    }
    50% {
        transform: translateX(5px);
        opacity: 1;
    }
}

.hint-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

/* 暗黑模式增强 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-dark: #050508;
    }
}