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

:root {
    --bg-light: #f8fafc;
    --primary: #2563eb;
    --primary-glow: rgba(37, 99, 235, 0.25);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.25);
    --danger: #ef4444;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.82);
    --glass-border: rgba(15, 23, 42, 0.06);
}

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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #f1f5f9;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-dark);
}

/* PC 端居中竖屏包裹容器 */
.game-viewport-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    /* PC端背景：高级淡灰色点阵网格 */
    background: radial-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 0),
                radial-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 0);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    background-color: #e2e8f0;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    /* PC 限制最大宽度，在移动端通过媒体查询还原 */
    max-width: 480px;
    background: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 移动端全屏自适应还原 */
@media (max-width: 500px) {
    #game-container {
        max-width: 100%;
        box-shadow: none;
    }
    .game-viewport-wrapper {
        background: none;
        background-color: #ffffff;
    }
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #f0f9ff; /* 天蓝色路面打底 */
}

/* UI 界面基础样式 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(241, 245, 249, 0.35);
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

/* 奶油质感磨砂玻璃面板 */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 36px 28px;
    width: 88%;
    max-width: 380px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08), 
                inset 0 1px 1px rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* 按钮设计 */
.glow-btn {
    position: relative;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: none;
    color: #ffffff;
    padding: 16px 36px;
    font-size: 17px;
    font-weight: 700;
    border-radius: 16px;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 20px var(--primary-glow);
    letter-spacing: 1px;
}

.glow-btn:active {
    transform: scale(0.97);
    box-shadow: 0 3px 10px var(--primary-glow);
}

.glow-btn.secondary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 6px 20px var(--success-glow);
}

.glow-btn.secondary:active {
    box-shadow: 0 3px 10px var(--success-glow);
}

/* 首页标题 */
.game-title-container {
    margin-bottom: 24px;
}

.game-title {
    font-size: 38px;
    font-weight: 800;
    background: linear-gradient(to right, #1d4ed8, #3b82f6, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 600;
}

.best-score {
    font-size: 14px;
    color: #b45309;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.15);
    padding: 6px 16px;
    border-radius: 999px;
    margin-top: 10px;
    font-weight: 600;
}

/* 引导指南 */
.intro-tutorial {
    width: 100%;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(15, 23, 42, 0.04);
    text-align: left;
}

.tutorial-item {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.tutorial-item::before {
    content: "✦";
    margin-right: 8px;
    color: #3b82f6;
}

/* HUD 抬头显示 */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 5;
}

.hud-group {
    pointer-events: auto;
}

.score-panel {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.hud-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.hud-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
}

.mute-btn {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(10px);
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.mute-btn svg {
    fill: var(--text-dark);
    width: 18px;
    height: 18px;
}

/* 结算页 */
.结算-title {
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.结算-title.victory {
    background: linear-gradient(to right, #059669, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.结算-title.gameover {
    background: linear-gradient(to right, #dc2626, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.结算-stats {
    width: 100%;
    margin-bottom: 16px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-dark);
}

/* 拖拽提示线 */
#drag-indicator {
    position: absolute;
    bottom: 16%;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: rgba(15, 23, 42, 0.06);
    border-radius: 2px;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

#drag-indicator::after {
    content: "";
    display: block;
    width: 30px;
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    animation: dragSwipe 2.2s infinite ease-in-out;
}

@keyframes dragSwipe {
    0% { transform: translateX(-30px); }
    50% { transform: translateX(100px); }
    100% { transform: translateX(-30px); }
}
