/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
}

body {
    background: #1a1a2e;
    color: #fff;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* 画面管理 */
.screen {
    display: none !important;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 1;
}

.screen.active {
    display: flex !important;
    z-index: 10;
}

/* 标题画面 */
#title-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    justify-content: center;
    align-items: center;
    text-align: center;
}

.title-content {
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.title-content h1 {
    font-size: 3.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 0.1em;
}

.title-content h2 {
    font-size: 1.5em;
    margin-bottom: 30px;
    color: #ffd700;
    font-style: italic;
}

.title-character {
    font-size: 5em;
    margin-bottom: 30px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.menu-btn {
    padding: 12px 40px;
    font-size: 1.2em;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 25px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.menu-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: #ffd700;
    transform: scale(1.05);
}

.menu-btn.start {
    background: linear-gradient(45deg, #ffd700, #ff6b6b);
    border-color: transparent;
    font-weight: bold;
}

/* 游戏画面 */
#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* 背景 */
#background {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease;
}

/* 角色立绘 */
#character-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
}

#character-center {
    position: absolute;
    bottom: 0;
    height: 90%;
    width: auto;
    transition: all 0.5s ease;
}

#character-center img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

/* UI层 */
#ui-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 名称框 */
#name-box {
    position: absolute;
    bottom: 180px;
    left: 50px;
    padding: 10px 30px;
    background: linear-gradient(135deg, #ff69b4, #ff1493);
    border-radius: 20px 20px 5px 20px;
    font-size: 1.3em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#name-box.visible {
    opacity: 1;
}

/* 对话框 */
#dialogue-box {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 180px;
    background: rgba(0, 0, 0, 0.75);
    padding: 30px 50px;
    cursor: pointer;
    pointer-events: auto;
    border-top: 3px solid rgba(255,255,255,0.2);
}

#dialogue-text {
    font-size: 1.3em;
    line-height: 1.8;
    max-width: 900px;
    margin: 0 auto;
}

.next-indicator {
    position: absolute;
    bottom: 20px;
    right: 50px;
    font-size: 1.5em;
    animation: bounce 1s ease-in-out infinite;
    color: #ffd700;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* 选择支 */
#choice-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

#choices {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 500px;
}

.choice-btn {
    padding: 15px 30px;
    font-size: 1.1em;
    border: 2px solid #fff;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.choice-btn:hover {
    background: rgba(255,215,0,0.3);
    border-color: #ffd700;
    transform: scale(1.02);
}

/* 系统菜单 */
#system-menu {
    position: absolute;
    top: 60px;
    right: 20px;
    background: rgba(0,0,0,0.85);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
}

#system-menu button {
    padding: 8px 20px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 5px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

#system-menu button:hover {
    background: rgba(255,215,0,0.3);
    border-color: #ffd700;
}

#menu-toggle {
    position: absolute;
    top: 15px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 1.5em;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s ease;
}

#menu-toggle:hover {
    background: rgba(255,215,0,0.5);
}

/* 图片缺失时的降级占位 */
.img-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-width: 220px;
    min-height: 60%;
    font-size: 5em;
    line-height: 1.3;
    color: #ffd700;
    text-align: center;
}

#character-center .img-fallback {
    background: radial-gradient(ellipse at bottom, rgba(255,215,0,0.15), transparent 70%);
}

.cg-item .img-fallback {
    font-size: 2.5em;
    color: #ffd700;
}

/* 隐藏 */
.hidden {
    display: none !important;
}

/* CG画廊 */
#cg-screen {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    flex-direction: column;
    align-items: center;
    padding: 40px;
}

.cg-content {
    text-align: center;
    width: 100%;
    max-width: 1200px;
}

.cg-content h2 {
    font-size: 2.5em;
    margin-bottom: 30px;
    color: #ffd700;
}

#cg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.cg-item {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 10px;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 3em;
}

.cg-item.unlocked {
    background: rgba(255,255,255,0.2);
    border: 2px solid #ffd700;
}

.cg-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

/* 帮助画面 */
#help-screen {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.help-content {
    max-width: 600px;
    text-align: center;
}

.help-content h2 {
    font-size: 2.5em;
    margin-bottom: 30px;
    color: #ffd700;
}

.help-text {
    text-align: left;
    line-height: 2;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.help-text p {
    margin-bottom: 10px;
}

/* 结局画面 */
#ending-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.ending-content h1 {
    font-size: 3em;
    margin-bottom: 20px;
    color: #ffd700;
}

.ending-content p {
    font-size: 1.5em;
    max-width: 600px;
    line-height: 1.8;
    margin-bottom: 40px;
}

/* 打字机动画 */
.typing {
    border-right: 2px solid #ffd700;
    animation: blink 0.75s step-end infinite;
}

@keyframes blink {
    0%, 100% { border-color: transparent; }
    50% { border-color: #ffd700; }
}

/* 响应式 */
@media (max-width: 768px) {
    #dialogue-box {
        padding: 20px 25px;
        height: 150px;
    }
    
    #dialogue-text {
        font-size: 1em;
    }
    
    .title-content h1 {
        font-size: 2.5em;
    }
    
    .title-content h2 {
        font-size: 1.2em;
    }
    
    .title-character {
        font-size: 3em;
    }
    
    .menu-buttons {
        gap: 10px;
    }
    
    .menu-btn {
        padding: 10px 30px;
        font-size: 1em;
        min-width: 160px;
    }
    
    #choices {
        width: 90%;
        max-width: 400px;
    }
    
    .choice-btn {
        padding: 12px 20px;
        font-size: 1em;
    }
    
    #character-center {
        height: 75%;
    }
    
    #name-box {
        bottom: 160px;
        left: 20px;
        padding: 8px 20px;
        font-size: 1.1em;
    }
    
    #system-menu {
        top: 50px;
        right: 10px;
        padding: 10px;
    }
    
    #system-menu button {
        padding: 6px 15px;
        font-size: 0.9em;
    }
    
    #menu-toggle {
        width: 35px;
        height: 35px;
        font-size: 1.2em;
    }
    
    .next-indicator {
        right: 20px;
        bottom: 15px;
    }
}
