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

/* 引入mplus_hzk_12像素字体 */
@font-face {
    font-family: 'mplus_hzk_12';
    src: url('../mplus_hzk_12/fonts/mplus_hzk_12.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

body {
    font-family: 'mplus_hzk_12', 'JetBrains Mono', 'Courier New', monospace;
    background: #0a0a0f;
    color: #00bfff;
    overflow: hidden;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.hidden {
    display: none !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease, display 0.3s ease;
}

.screen.active {
    display: block;
    opacity: 1;
}

/* 主菜单样式 */
#main-menu {
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%);
    position: relative;
    overflow: hidden;
}

.menu-background {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.matrix-rain {
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 191, 255, 0.03) 2px,
            rgba(0, 191, 255, 0.03) 4px
        );
    animation: matrix-fall 20s linear infinite;
}

@keyframes matrix-fall {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}

.circuit-lines {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(90deg, transparent 49%, rgba(0, 191, 255, 0.1) 50%, transparent 51%),
        linear-gradient(0deg, transparent 49%, rgba(0, 191, 255, 0.1) 50%, transparent 51%);
    background-size: 40px 40px;
    opacity: 0.3;
}

.menu-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
}

.game-title {
    margin-bottom: 60px;
    animation: title-glow 2s ease-in-out infinite alternate;
}

.title-text {
    display: block;
    font-family: 'mplus_hzk_12', 'Orbitron', sans-serif;
    font-size: 4rem;
    font-weight: 900;
    color: #00bfff;
    text-shadow: 
        0 0 10px #00bfff,
        0 0 20px #00bfff,
        0 0 30px #00bfff,
        0 0 40px #0066cc;
    letter-spacing: 0.2em;
    margin-bottom: 10px;
}

.title-sub {
    display: block;
    font-size: 1.2rem;
    color: #4da6ff;
    letter-spacing: 0.1em;
    opacity: 0.8;
}

@keyframes title-glow {
    from { text-shadow: 0 0 10px #00bfff, 0 0 20px #00bfff, 0 0 30px #00bfff; }
    to { text-shadow: 0 0 20px #00bfff, 0 0 30px #00bfff, 0 0 40px #00bfff, 0 0 50px #0066cc; }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pixel-btn {
    position: relative;
    background: transparent;
    border: 2px solid #00bfff;
    color: #00bfff;
    padding: 15px 40px;
    font-family: 'mplus_hzk_12', 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    overflow: hidden;
    min-width: 200px;
}

.pixel-btn:hover {
    background: rgba(0, 191, 255, 0.1);
    box-shadow: 
        0 0 10px rgba(0, 191, 255, 0.5),
        inset 0 0 10px rgba(0, 191, 255, 0.1);
    transform: translateY(-2px);
}

.pixel-btn:active {
    transform: translateY(0);
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 191, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.pixel-btn:hover .btn-glow {
    left: 100%;
}

.danger-btn {
    background: linear-gradient(135deg, #1a0000, #330000);
    border-color: #ff3333;
    color: #ff6666;
}

.danger-btn:hover {
    box-shadow: 0 0 20px rgba(255, 51, 51, 0.5);
}

.terminal-hint {
    position: absolute;
    bottom: 30px;
    font-family: 'mplus_hzk_12', 'JetBrains Mono', monospace;
    color: #4da6ff;
    font-size: 1.2rem;
}

.cursor {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 章节选择界面 */
#chapter-select {
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
    position: relative;
    overflow: hidden;
}

.chapter-background {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.data-stream {
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(0, 191, 255, 0.02) 10px,
            rgba(0, 191, 255, 0.02) 20px
        );
    animation: data-flow 15s linear infinite;
}

@keyframes data-flow {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100vw); }
}

.chapter-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 40px;
}

.chapter-title {
    font-family: 'mplus_hzk_12', 'Orbitron', sans-serif;
    font-size: 2.5rem;
    color: #00bfff;
    margin-bottom: 40px;
    text-align: center;
    text-shadow: 0 0 10px #00bfff;
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1000px;
    width: 100%;
    margin-bottom: 40px;
}

.chapter-card {
    background: rgba(0, 20, 40, 0.8);
    border: 2px solid #00bfff;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chapter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 191, 255, 0.3);
    border-color: #4da6ff;
}

.chapter-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.chapter-card.locked:hover {
    transform: none;
    box-shadow: none;
}

.chapter-icon {
    margin-bottom: 20px;
}

.pixel-art {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    image-rendering: pixelated;
}

.ai-core {
    background: 
        linear-gradient(45deg, #00bfff 25%, transparent 25%),
        linear-gradient(-45deg, #00bfff 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #00bfff 75%),
        linear-gradient(-45deg, transparent 75%, #00bfff 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
    border-radius: 50%;
}

.human-network {
    background: 
        radial-gradient(circle at 25% 25%, #00bfff 2px, transparent 2px),
        radial-gradient(circle at 75% 25%, #00bfff 2px, transparent 2px),
        radial-gradient(circle at 50% 75%, #00bfff 2px, transparent 2px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 0, 5px 10px;
}

.question-mark {
    background: 
        linear-gradient(0deg, #00bfff 2px, transparent 2px),
        linear-gradient(90deg, #00bfff 2px, transparent 2px);
    background-size: 16px 16px;
    background-position: center;
    transform: rotate(45deg);
}

.fusion-symbol {
    background: 
        /* 中心融合点 */
        radial-gradient(circle at center, #ff00ff 4px, transparent 4px),
        /* 人类一侧 - 蓝色 */
        linear-gradient(135deg, #00bfff 8px, transparent 8px),
        /* AI一侧 - 紫色 */
        linear-gradient(45deg, #ff00ff 8px, transparent 8px),
        /* 连接线条 */
        linear-gradient(0deg, rgba(0, 191, 255, 0.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 255, 0.5) 1px, transparent 1px);
    background-size: 32px 32px, 16px 16px, 16px 16px, 8px 8px, 8px 8px;
    background-position: center, 8px 8px, 24px 24px, 0 50%, 50% 0;
    border-radius: 50%;
    animation: fusion-pulse 3s ease-in-out infinite;
}

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

.chapter-card h3 {
    font-family: 'mplus_hzk_12', 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: #00bfff;
    margin-bottom: 10px;
}

.chapter-card p {
    color: #4da6ff;
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.5;
}

.chapter-status {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.chapter-status.unlocked {
    background: rgba(0, 191, 255, 0.2);
    border: 1px solid #00bfff;
    color: #00bfff;
}

.chapter-status.locked {
    background: rgba(100, 100, 100, 0.2);
    border: 1px solid #666;
    color: #666;
}

/* 游戏界面样式 */
#game-screen {
    background: #0a0a0f;
    position: relative;
    overflow: hidden;
}

.game-ui {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
}

.story-box {
    flex: 1;
    background: rgba(0, 20, 40, 0.8);
    border: 2px solid #00bfff;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 20px;
    overflow-y: auto;
    max-height: 70vh;
}

.story-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #e0f2ff;
    margin-bottom: 30px;
}

.story-content p {
    margin-bottom: 15px;
    text-shadow: 0 0 5px rgba(0, 191, 255, 0.3);
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.choice-btn {
    background: rgba(0, 20, 40, 0.6);
    border: 2px solid #00bfff;
    color: #00bfff;
    padding: 15px 20px;
    font-family: 'mplus_hzk_12', 'JetBrains Mono', monospace;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    border-radius: 4px;
}

.choice-btn:hover {
    background: rgba(0, 191, 255, 0.2);
    transform: translateX(5px);
}

.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.control-btn {
    background: rgba(0, 20, 40, 0.8);
    border: 2px solid #00bfff;
    color: #00bfff;
    padding: 10px 20px;
    font-family: 'mplus_hzk_12', 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    font-size: 0.9rem;
}

.control-btn:hover {
    background: rgba(0, 191, 255, 0.2);
}

/* 解谜游戏样式 */
.puzzle-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 600px;
    background: rgba(0, 20, 40, 0.95);
    border: 2px solid #00bfff;
    border-radius: 8px;
    padding: 30px;
    z-index: 1000;
    box-shadow: 0 0 30px rgba(0, 191, 255, 0.5);
    transition: opacity 0.5s ease-in-out !important;
}

.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    display: none !important;
}

.puzzle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #00bfff;
    padding-bottom: 10px;
}

.puzzle-header h3 {
    color: #00bfff;
    font-family: 'mplus_hzk_12', 'Orbitron', sans-serif;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: #00bfff;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #4da6ff;
}

.hidden {
    display: none !important;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 20, 40, 0.3);
}

::-webkit-scrollbar-thumb {
    background: #00bfff;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4da6ff;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .title-text {
        font-size: 2.5rem;
    }
    
    .chapters-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chapter-card {
        padding: 20px;
    }
    
    .story-box {
        padding: 20px;
    }
    
    .puzzle-screen {
        width: 95%;
        padding: 20px;
    }
}

/* 音乐控制按钮样式 */
#music-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 20, 40, 0.8);
    border: 2px solid #00bfff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
}

#music-toggle:hover {
    background: rgba(0, 191, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.5);
    transform: scale(1.1);
}

.music-icon {
    font-size: 24px;
    color: #00bfff;
    transition: all 0.3s ease;
}

#music-toggle.muted .music-icon {
    color: #666;
    opacity: 0.5;
}

#music-toggle.muted {
    border-color: #666;
}