/* ========== 全局重置 & 字体 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #1a2a1f;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

/* ========== 游戏容器（模拟手机屏幕） ========== */
#app-container {
    position: relative;
    width: 100%;
    max-width: 450px;
    height: 100vh;
    max-height: 800px;
    background: linear-gradient(145deg, #2d4a2a, #1e3a1c);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    overflow: hidden;
    margin: 0 auto;
}

/* ========== 画布 ========== */
#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #3b5e3a;
}

/* ========== UI覆盖层 ========== */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#ui-overlay > * {
    pointer-events: auto;
}

/* ========== 顶部状态栏 ========== */
#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.top-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 32px;
    height: 32px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: #f5e6c8;
    letter-spacing: 1px;
}

.top-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-item {
    font-size: 14px;
    font-weight: 600;
    color: #f5e6c8;
    background: rgba(255,255,255,0.12);
    padding: 4px 10px;
    border-radius: 20px;
}

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

.icon-btn:active {
    background: rgba(255,255,255,0.3);
    transform: scale(0.9);
}

/* ========== 屏幕覆盖层（开始/结束/暂停） ========== */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    z-index: 10;
    transition: opacity 0.3s;
}

.screen.hidden {
    display: none;
    opacity: 0;
}

.start-content,
.gameover-content,
.pause-content {
    text-align: center;
    padding: 32px 24px;
    background: linear-gradient(145deg, #2d4a2a, #1e3a1c);
    border-radius: 24px;
    border: 2px solid rgba(245,230,200,0.2);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    max-width: 320px;
    width: 90%;
}

.hero-logo {
    width: 160px;
    margin-bottom: 12px;
}

.slogan {
    font-size: 16px;
    color: #c4b998;
    margin-bottom: 24px;
    font-weight: 500;
    letter-spacing: 2px;
}

h2 {
    font-size: 28px;
    font-weight: 700;
    color: #f5e6c8;
    margin-bottom: 16px;
}

.final-score {
    font-size: 20px;
    color: #f5e6c8;
    margin-bottom: 8px;
}

.high-score {
    font-size: 14px;
    color: #c4b998;
    margin-bottom: 24px;
}

/* ========== 按钮 ========== */
.btn-primary {
    display: block;
    width: 100%;
    padding: 14px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e3a1c;
    background: linear-gradient(135deg, #f5d742, #e6b800);
    border: none;
    border-radius: 40px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(245,215,66,0.3);
    margin-bottom: 12px;
}

.btn-primary:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(245,215,66,0.2);
}

.btn-secondary {
    display: block;
    width: 100%;
    padding: 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #f5e6c8;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(245,230,200,0.3);
    border-radius: 40px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.btn-secondary:active {
    background: rgba(255,255,255,0.2);
    transform: scale(0.96);
}

/* ========== HUD提示 ========== */
#hud {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    pointer-events: none;
    padding: 0 12px;
}

.hud-item {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #e0d5b8;
    white-space: nowrap;
}

/* ========== 底部工具栏 ========== */
#toolbar {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255,255,255,0.08);
}

.tool-btn {
    flex: 1;
    padding: 10px 0;
    font-size: 15px;
    font-weight: 600;
    color: #c4b998;
    background: rgba(255,255,255,0.08);
    border: 1px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s, border-color 0.2s;
}

.tool-btn:active {
    transform: scale(0.95);
}

.tool-btn.active {
    background: rgba(245,215,66,0.25);
    color: #f5d742;
    border-color: rgba(245,215,66,0.5);
}

/* ========== 响应式微调 ========== */
@media (max-width: 480px) {
    #app-container {
        max-height: 100vh;
        border-radius: 0;
    }
    .slogan {
        font-size: 14px;
    }
    .btn-primary {
        font-size: 16px;
        padding: 12px 0;
    }
    .hero-logo {
        width: 130px;
    }
}

/* ========== 品牌色板（CSS变量备用） ========== */
:root {
    --primary: #f5d742;
    --primary-dark: #e6b800;
    --secondary-dark: #2d4a2a;
    --secondary-light: #3b5e3a;
    --bg-dark: #1a2a1f;
    --text-light: #f5e6c8;
    --text-muted: #c4b998;
    --neutral-border: #4a6b47;
}