/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #0a0a0a;
    color: #33ff33;
    font-family: 'Courier New', 'Consolas', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

/* ===== 主页跳转链接 ===== */
.home-link {
    position: fixed;
    top: 15px;
    left: 15px;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 0.85rem;
    color: #33ff33;
    background: #111;
    border: 2px solid #33ff33;
    border-radius: 4px;
    padding: 6px 14px;
    text-decoration: none;
    box-shadow: 0 0 10px rgba(51, 255, 51, 0.3);
    transition: all 0.2s ease;
    z-index: 10000;
}

.home-link:hover {
    background: #33ff33;
    color: #0a0a0a;
    box-shadow: 0 0 20px rgba(51, 255, 51, 0.7);
    transform: translateY(-1px);
}

/* ===== CRT 扫描线效果 ===== */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 9999;
}

/* ===== 主容器 ===== */
.container {
    text-align: center;
    padding: 20px;
}

/* ===== 标题 ===== */
.title {
    font-size: 2.5rem;
    font-weight: bold;
    color: #33ff33;
    text-shadow: 0 0 10px #33ff33, 0 0 20px #33ff33, 0 0 40px #00ff00;
    margin-bottom: 15px;
    letter-spacing: 4px;
    animation: flicker 3s infinite alternate;
}

@keyframes flicker {
    0%, 95%, 100% { opacity: 1; }
    96% { opacity: 0.8; }
    97% { opacity: 1; }
    98% { opacity: 0.7; }
}

/* ===== 分数板 ===== */
.score-board {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 15px;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #111;
    border: 2px solid #33ff33;
    padding: 8px 20px;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(51, 255, 51, 0.3), inset 0 0 10px rgba(51, 255, 51, 0.05);
}

.score-item .label {
    font-size: 0.8rem;
    color: #66ff66;
    margin-bottom: 4px;
}

.score-item .value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #33ff33;
    text-shadow: 0 0 8px #33ff33;
}

/* ===== 游戏画布 ===== */
#gameCanvas {
    border: 3px solid #33ff33;
    border-radius: 4px;
    background-color: #0d1a0d;
    box-shadow: 0 0 20px rgba(51, 255, 51, 0.4), inset 0 0 30px rgba(0, 0, 0, 0.5);
    display: block;
    margin: 0 auto;
}

/* ===== 控制提示 ===== */
.controls {
    margin: 15px 0;
}

.hint {
    font-size: 0.85rem;
    color: #66ff66;
    margin-bottom: 6px;
}

.key {
    display: inline-block;
    background: #1a1a1a;
    border: 1px solid #33ff33;
    border-radius: 3px;
    padding: 2px 8px;
    margin: 0 2px;
    font-size: 0.8rem;
    color: #33ff33;
    box-shadow: 0 0 5px rgba(51, 255, 51, 0.3);
}

/* ===== 按钮 ===== */
.btn {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: #0a0a0a;
    background: linear-gradient(180deg, #66ff66, #33ff33);
    border: none;
    padding: 12px 40px;
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: 2px;
    box-shadow: 0 0 15px rgba(51, 255, 51, 0.5), 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    margin-top: 10px;
}

.btn:hover {
    background: linear-gradient(180deg, #99ff99, #66ff66);
    box-shadow: 0 0 25px rgba(51, 255, 51, 0.7), 0 4px 12px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 0 10px rgba(51, 255, 51, 0.4);
}

/* ===== 移动端虚拟方向键 ===== */
.mobile-controls {
    display: none;
    margin-top: 15px;
    user-select: none;
}

.dpad {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(3, 60px);
    gap: 4px;
    justify-content: center;
}

.dpad-btn {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    color: #33ff33;
    background: #111;
    border: 2px solid #33ff33;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px rgba(51, 255, 51, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active {
    background: #33ff33;
    color: #0a0a0a;
}

/* ===== 冲刺指示器 ===== */
.sprint-indicator {
    display: none;
    font-size: 0.75rem;
    color: #ffcc33;
    margin-top: 4px;
}

.sprint-indicator.visible {
    display: block;
    animation: pulse 0.3s infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

.dpad-btn.empty {
    border: none;
    box-shadow: none;
    background: transparent;
}

@media (max-width: 500px) {
    .title {
        font-size: 1.6rem;
    }
    #gameCanvas {
        width: 320px;
        height: 320px;
    }
    .mobile-controls {
        display: block;
    }
}
