* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(45deg, #1a1a1a, #2d2d2d);
    font-family: 'Microsoft YaHei', 'SimHei', 'PingFang SC', sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
    /* 为外侧UI元素留出空间 */
}

#gameContainer {
    position: relative;
    width: 800px;
    height: 600px;
    border: 2px solid rgba(57, 255, 20, 0.5);
    border-radius: 8px;
    background: #000;
    overflow: visible;
    /* 允许子元素超出容器 */
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
    backdrop-filter: blur(5px);
}

/* 移除伪元素的发光效果 */
#gameContainer::before {
    display: none;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    background: repeating-conic-gradient(from 0deg at 0 0,
            #1e1e1e 0deg 90deg,
            #141414 90deg 180deg);
    background-size: 20px 20px;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 10;
}

.hidden {
    display: none !important;
}

.overlay {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

/* 标题样式 */
.title {
    font-size: 60px;
    font-weight: bold;
    margin-bottom: 40px;
    text-shadow: 4px 4px 8px rgba(72, 61, 139, 0.8);
    color: #39ff14;
}

.title.white {
    color: white;
}

.pulsing {
    animation: pulse 2s ease-in-out infinite;
}

.flashing {
    animation: flash 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes flash {

    0%,
    100% {
        color: #ff0000;
    }

    50% {
        color: #ffa500;
    }
}

/* 按钮样式 */
.buttons {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.game-button {
    width: 220px;
    height: 70px;
    border: none;
    border-radius: 10px;
    font-size: 28px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.game-button.purple {
    background: linear-gradient(135deg, #800080, #9932cc);
}

.game-button.dark-purple {
    background: linear-gradient(135deg, #483d8b, #6a5acd);
}

.game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(57, 255, 20, 0.3);
    border: 2px solid #00ffff;
}

.game-button:active {
    transform: translateY(0);
}

/* 说明文字 */
.instructions {
    text-align: center;
    margin-bottom: 20px;
}

.instructions p {
    margin: 5px 0;
    font-size: 24px;
    font-weight: bold;
}

.light-blue {
    color: #6495ed;
}

.light-green {
    color: #90ee90;
}

.yellow {
    color: #ffff00;
}

.audio-tip {
    color: #ffa500;
    font-size: 20px;
    margin-top: 10px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 5px #ffa500;
    }

    to {
        text-shadow: 0 0 20px #ffa500, 0 0 30px #ffa500;
    }
}

.version {
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: #666;
    font-size: 24px;
    font-weight: bold;
}

/* 游戏时间计时器 - 移到游戏画面外右侧 */
.timer-container {
    position: absolute;
    top: 0;
    left: 820px;
    /* 移到游戏画面外右侧 */
    background: rgba(0, 0, 0, 0.8);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 24px;
    font-weight: bold;
    color: #ffff00;
    border: 2px solid rgba(255, 255, 0, 0.5);
    z-index: 25;
    box-shadow: 0 0 15px rgba(255, 255, 0, 0.3);
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
    font-family: 'Courier New', monospace;
    min-width: 120px;
    text-align: center;
}

/* 游戏信息面板 - 移到游戏画面外左侧 */
#gameInfo {
    position: absolute;
    top: 0;
    left: -250px;
    /* 移到游戏画面外左侧 */
    z-index: 20;
    width: 220px;
    /* 设置固定宽度 */
}

.info-panel {
    background: rgba(0, 0, 0, 0.9);
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    color: #39ff14;
    border: 2px solid rgba(57, 255, 20, 0.5);
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
    backdrop-filter: blur(5px);
}

/* 控制说明 */
#controls {
    position: absolute;
    bottom: 0;
    left: 820px;
    /* 移到游戏画面外右侧，与计时器对齐 */
    z-index: 20;
    width: 250px;
    /* 设置固定宽度 */
}

.control-panel {
    background: rgba(0, 0, 0, 0.9);
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 14px;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
}

/* 暂停和游戏结束文字 */
.continue-text,
.restart-text {
    font-size: 36px;
    color: #ffff00;
    font-weight: bold;
}

.final-score {
    font-size: 36px;
    color: #ffff00;
    font-weight: bold;
    margin-top: 20px;
}

/* 通知 */
.notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 40px;
    border-radius: 10px;
    font-size: 24px;
    font-weight: bold;
    z-index: 100;
    border: 2px solid #39ff14;
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }

    20%,
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 粒子效果 */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;
}

/* 星星背景 */
.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    animation: twinkle 2s ease-in-out infinite;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    body {
        padding: 20px;
    }

    /* 在小屏幕上将UI元素移回游戏画面内 */
    #gameInfo {
        left: 10px;
        top: 10px;
        width: auto;
    }

    .timer-container {
        left: auto;
        right: 10px;
        top: 10px;
        font-size: 20px;
        padding: 10px 15px;
        min-width: 100px;
    }

    #controls {
        left: auto;
        right: 10px;
        bottom: 10px;
        width: auto;
    }
}

@media (max-width: 850px) {
    #gameContainer {
        width: 100vw;
        height: 100vh;
        border: none;
        border-radius: 0;
    }

    #gameCanvas {
        width: 100%;
        height: 100%;
    }

    .timer-container {
        font-size: 18px;
        padding: 8px 12px;
        top: 5px;
        right: 5px;
        min-width: 90px;
    }

    #gameInfo {
        left: 5px;
        top: 5px;
    }

    #controls {
        right: 5px;
        bottom: 5px;
    }

    .title {
        font-size: 40px;
    }

    .game-button {
        width: 180px;
        height: 60px;
        font-size: 24px;
    }

    .instructions p {
        font-size: 18px;
    }
}