:root {
    --neon-blue: #00f3ff;
    --neon-pink: #ff00ff;
    --neon-green: #39ff14;
    --bg-color: #050510;
}

body {
    margin: 0;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: 'Orbitron', sans-serif;
    color: white;
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    box-shadow: 0 0 20px var(--neon-blue);
    border: 2px solid var(--neon-blue);
    background: radial-gradient(circle at center, #1a1a2e 0%, #000000 100%);
}

/* UI Overlay */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    display: none;
    text-align: center;
    background: rgba(0, 0, 0, 0.85);
    padding: 40px;
    border: 1px solid var(--neon-pink);
    box-shadow: 0 0 15px var(--neon-pink);
    pointer-events: auto;
    z-index: 10;
    min-width: 300px;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: popIn 0.3s ease-out;
}

.cyber-tree {
    margin-bottom: 20px;
    filter: drop-shadow(0 0 5px var(--neon-green));
}

h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue);
    position: relative;
}

p {
    color: var(--neon-green);
    margin-bottom: 30px;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

button {
    background: transparent;
    border: 2px solid var(--neon-pink);
    color: var(--neon-pink);
    padding: 15px 30px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    box-shadow: 0 0 10px var(--neon-pink);
}

button:hover {
    background: rgba(0, 243, 255, 0.2);
    box-shadow: 0 0 15px #00f3ff;
    text-shadow: 2px 2px #ff00ff;
}

.difficulty-selector {
    margin: 30px 0;
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap; /* 移动端适配 */
    z-index: 20; /* 确保层级 */
}

.diff-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
    color: #888;
    padding: 15px 25px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    min-width: 220px; /* 统一宽度，增加点击区域 */
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.diff-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: 0.5s;
}

.diff-btn:hover::before {
    left: 100%;
}

.diff-btn.active {
    border: 2px solid #39ff14;
    color: #39ff14;
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.4), inset 0 0 10px rgba(57, 255, 20, 0.2);
    background: rgba(57, 255, 20, 0.1);
    transform: scale(1.05);
    text-shadow: 0 0 5px #39ff14;
    font-weight: 700;
}

.diff-btn:hover:not(.active) {
    border-color: #00f3ff;
    color: #00f3ff;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
    transform: translateY(-2px);
}

#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 1.5rem;
    text-shadow: 0 0 5px white;
}

/* Lang Btn Removed */

#notification {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
    text-align: center;
    animation: pulse 1s infinite;
    z-index: 20;
    pointer-events: none;
}

.hidden {
    display: none !important;
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 red;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-1 2.5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 blue;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

/* Scanlines */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.2) 50%,
        rgba(0,0,0,0.2)
    );
    background-size: 100% 4px;
    z-index: 999;
    pointer-events: none;
    animation: scanline 10s linear infinite;
}

@keyframes glitch-anim-1 {
    0% { clip: rect(20px, 9999px, 15px, 0); }
    20% { clip: rect(60px, 9999px, 75px, 0); }
    40% { clip: rect(10px, 9999px, 30px, 0); }
    60% { clip: rect(80px, 9999px, 50px, 0); }
    80% { clip: rect(40px, 9999px, 90px, 0); }
    100% { clip: rect(30px, 9999px, 60px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(10px, 9999px, 85px, 0); }
    20% { clip: rect(50px, 9999px, 25px, 0); }
    40% { clip: rect(30px, 9999px, 10px, 0); }
    60% { clip: rect(70px, 9999px, 60px, 0); }
    80% { clip: rect(20px, 9999px, 40px, 0); }
    100% { clip: rect(90px, 9999px, 10px, 0); }
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
    0% { transform: translateX(-50%) scale(1); opacity: 1; }
    50% { transform: translateX(-50%) scale(1.1); opacity: 0.8; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}
