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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #05050a;
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, #0e1a2b 0%, #05050a 100%);
    gap: 12px;
}

#gameCanvas {
    display: block;
    background: #0a1420;
    border: 2px solid rgba(80, 200, 120, 0.25);
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(80, 200, 120, 0.18), inset 0 0 30px rgba(0, 0, 0, 0.5);
    touch-action: none;
}

/* HUD */
#hud {
    width: 100%;
    max-width: 480px;
    padding: 0 8px;
}
.hud-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.hud-item {
    flex: 1;
    text-align: center;
    color: #aacca0;
    font-size: 14px;
    letter-spacing: 1px;
    padding: 8px 4px;
    background: rgba(80, 200, 120, 0.08);
    border: 1px solid rgba(80, 200, 120, 0.2);
    border-radius: 8px;
}
.hud-item span {
    color: #aaff66;
    font-weight: bold;
    font-size: 16px;
    margin-left: 4px;
}

/* 覆盖层 */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(5, 10, 18, 0.88);
    backdrop-filter: blur(6px);
    color: #fff;
    z-index: 10;
    text-align: center;
    padding: 20px;
}

.title {
    font-size: 56px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, #aaff66, #4dd2ff, #ffd93d);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 6px;
    animation: glow 2s ease-in-out infinite alternate;
}
.title.small {
    font-size: 40px;
    letter-spacing: 4px;
}
@keyframes glow {
    from { filter: brightness(1); }
    to { filter: brightness(1.35); }
}

.subtitle {
    font-size: 16px;
    color: #8aaa80;
    margin-bottom: 28px;
}

.option-group {
    margin-bottom: 18px;
}
.option-label {
    color: #6a9a60;
    font-size: 13px;
    letter-spacing: 2px;
    margin-bottom: 8px;
}
.option-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.opt-btn {
    padding: 8px 20px;
    font-size: 14px;
    color: #aacca0;
    background: rgba(80, 200, 120, 0.08);
    border: 1px solid rgba(80, 200, 120, 0.25);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
}
.opt-btn:hover {
    background: rgba(80, 200, 120, 0.18);
}
.opt-btn.active {
    color: #06120a;
    background: linear-gradient(135deg, #aaff66, #4caf50);
    border-color: #aaff66;
    box-shadow: 0 0 16px rgba(170, 255, 102, 0.5);
}

.instructions {
    margin: 8px 0 28px;
    color: #88a080;
    font-size: 14px;
    line-height: 2;
}
.key {
    display: inline-block;
    padding: 2px 10px;
    margin: 0 3px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(170, 255, 102, 0.3);
    border-radius: 6px;
    font-family: monospace;
    color: #aaff66;
}
.tip {
    font-size: 13px;
    color: #ffd93d;
    margin-top: 6px;
}

.btn {
    padding: 12px 44px;
    font-size: 18px;
    color: #06120a;
    background: linear-gradient(135deg, #aaff66 0%, #4caf50 100%);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    letter-spacing: 3px;
    font-weight: bold;
    box-shadow: 0 4px 22px rgba(170, 255, 102, 0.45);
    transition: transform 0.15s, box-shadow 0.15s;
    margin: 6px;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(170, 255, 102, 0.65);
}
.btn:active { transform: translateY(0); }
.btn-secondary {
    background: linear-gradient(135deg, #8a8a8a, #555);
    color: #fff;
    box-shadow: 0 4px 22px rgba(120, 120, 120, 0.35);
}

.final-stats {
    font-size: 19px;
    line-height: 2;
    margin-bottom: 22px;
    color: #ccd;
}
.final-stats span {
    color: #aaff66;
    font-weight: bold;
}
.new-record {
    color: #ffd93d;
    font-size: 22px;
    font-weight: bold;
    animation: bounce 0.6s ease infinite alternate;
}
@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-6px); }
}

/* 方向键 (移动端) */
#dpad {
    position: relative;
    width: 180px;
    height: 180px;
    margin-top: 4px;
}
.dpad-btn {
    position: absolute;
    width: 60px;
    height: 60px;
    font-size: 22px;
    color: #aaff66;
    background: rgba(80, 200, 120, 0.12);
    border: 1px solid rgba(170, 255, 102, 0.3);
    border-radius: 12px;
    cursor: pointer;
}
.dpad-btn:active {
    background: rgba(170, 255, 102, 0.35);
}
.dpad-btn.up    { top: 0; left: 60px; }
.dpad-btn.down  { bottom: 0; left: 60px; }
.dpad-btn.left  { top: 60px; left: 0; }
.dpad-btn.right { top: 60px; right: 0; }

.hidden { display: none !important; }

@media (max-width: 600px) {
    .title { font-size: 40px; letter-spacing: 4px; }
    .title.small { font-size: 30px; }
    .opt-btn { padding: 7px 14px; font-size: 13px; }
    .instructions { font-size: 12px; }
}

/* 桌面端隐藏方向键 */
@media (hover: hover) and (pointer: fine) {
    #dpad { display: none !important; }
}
