/* ===== 基础样式 ===== */
:root {
    --bg-dark: #0d0d14;
    --bg-medium: #1a1a2e;
    --bg-light: #16213e;
    --accent-red: #6b0f1a;
    --accent-gold: #c9a227;
    --accent-green: #0f4c4c;
    --text-light: #e8e8e8;
    --text-dim: #8a8a8a;
    --blood: #8b0000;
    --corruption: #4a0080;
}

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

body {
    font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

/* ===== 开始界面 ===== */
#start-screen {
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
    background-image: 
        radial-gradient(ellipse at 50% 0%, rgba(107, 15, 26, 0.3) 0%, transparent 60%),
        linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
}

.title-container {
    text-align: center;
    margin-bottom: 40px;
}

.game-title {
    font-size: 4rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--text-light) 50%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(201, 162, 39, 0.3);
    letter-spacing: 0.3em;
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

.subtitle {
    font-size: 1.5rem;
    color: var(--accent-red);
    margin-top: 10px;
    font-style: italic;
    letter-spacing: 0.5em;
}

.intro-text {
    max-width: 600px;
    text-align: center;
    margin-bottom: 40px;
    line-height: 1.8;
    color: var(--text-dim);
}

.intro-text p {
    margin-bottom: 15px;
}

/* ===== 按钮样式 ===== */
.btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    border: 2px solid var(--accent-gold);
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn:hover:not(:disabled) {
    background: var(--accent-gold);
    color: var(--bg-dark);
    box-shadow: 0 0 20px rgba(201, 162, 39, 0.5);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--text-dim);
}

.primary-btn {
    background: rgba(201, 162, 39, 0.2);
}

/* ===== 角色选择 ===== */
#character-select {
    background: linear-gradient(180deg, var(--bg-medium) 0%, var(--bg-light) 100%);
}

#character-select h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--accent-gold);
}

.character-grid {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    justify-content: center;
}

.character-card {
    width: 280px;
    padding: 25px;
    border: 2px solid var(--bg-light);
    background: rgba(26, 26, 46, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.character-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(201, 162, 39, 0.2);
}

.character-card.selected {
    border-color: var(--accent-gold);
    background: rgba(201, 162, 39, 0.1);
    box-shadow: 0 0 20px rgba(201, 162, 39, 0.3);
}

.char-portrait {
    width: 120px;
    height: 120px;
    margin: 0 auto 15px;
    border-radius: 50%;
    background: var(--bg-light);
    border: 3px solid var(--accent-gold);
}

.char-portrait.taoist {
    background: linear-gradient(135deg, #2d5a4d 0%, #0f4c4c 100%);
}

.char-portrait.guMaster {
    background: linear-gradient(135deg, #5a2d4d 0%, #4a0f4c 100%);
}

.character-card h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-light);
}

.char-role {
    color: var(--accent-gold);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.char-desc {
    color: var(--text-dim);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

.char-stats {
    display: flex;
    justify-content: space-around;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ===== 战斗界面 ===== */
#battle-screen {
    background: linear-gradient(180deg, var(--bg-medium) 0%, var(--bg-dark) 100%);
    padding: 10px;
}

.battle-container {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.battle-header {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--accent-gold);
}

.floor-info, .turn-info {
    font-size: 1rem;
    color: var(--accent-gold);
}

/* 敌人区域 */
.enemy-area {
    min-height: 180px;
    padding: 20px;
    background: rgba(107, 15, 26, 0.1);
    border: 1px solid rgba(107, 15, 26, 0.3);
}

/* 战斗日志 */
.battle-log {
    height: 120px;
    overflow-y: auto;
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--bg-light);
    font-size: 0.9rem;
}

.log-entry {
    margin-bottom: 5px;
    padding: 3px 0;
}

.log-entry.system {
    color: var(--accent-gold);
    font-style: italic;
}

.log-entry.damage {
    color: var(--blood);
}

.log-entry.heal {
    color: var(--accent-green);
}

.log-entry.corruption {
    color: var(--corruption);
}

/* 玩家区域 */
.player-area {
    min-height: 180px;
    padding: 20px;
    background: rgba(15, 76, 76, 0.1);
    border: 1px solid rgba(15, 76, 76, 0.3);
}

/* 战斗单位 */
.combatants {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.combatant {
    width: 150px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--bg-light);
    text-align: center;
    transition: all 0.3s ease;
}

.combatant.active {
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(201, 162, 39, 0.5);
    animation: pulse 1s ease-in-out infinite;
}

.combatant.target {
    border-color: var(--blood);
    cursor: pointer;
}

.combatant.target:hover {
    background: rgba(139, 0, 0, 0.3);
}

.combatant.dead {
    opacity: 0.4;
    filter: grayscale(100%);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.combatant-name {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text-light);
}

.combatant-hp-bar {
    height: 8px;
    background: var(--bg-dark);
    border: 1px solid var(--text-dim);
    margin-bottom: 5px;
    overflow: hidden;
}

.combatant-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blood) 0%, #cc0000 100%);
    transition: width 0.3s ease;
}

.combatant-hp-text {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.combatant-corruption {
    font-size: 0.75rem;
    color: var(--corruption);
}

/* 行动面板 */
.action-panel {
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--accent-gold);
}

.current-actor {
    font-size: 1.1rem;
    color: var(--accent-gold);
    margin-bottom: 15px;
    text-align: center;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 12px 25px;
    font-size: 1rem;
    border: 1px solid var(--bg-light);
    background: rgba(26, 26, 46, 0.8);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 120px;
}

.action-btn:hover:not(:disabled) {
    border-color: var(--accent-gold);
    background: rgba(201, 162, 39, 0.2);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn.attack { border-left: 3px solid var(--blood); }
.action-btn.skill { border-left: 3px solid var(--accent-gold); }
.action-btn.item { border-left: 3px solid var(--accent-green); }
.action-btn.defend { border-left: 3px solid #4a6fa5; }

/* ===== 结果界面 ===== */
#result-screen {
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
}

.result-container {
    text-align: center;
    max-width: 500px;
}

#result-title {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--accent-gold);
}

#result-title.defeat {
    color: var(--blood);
}

#result-desc {
    font-size: 1.2rem;
    color: var(--text-dim);
    margin-bottom: 30px;
    line-height: 1.6;
}

#result-stats {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
    border: 1px solid var(--bg-light);
}

/* ===== 道化警告模态框 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-medium);
    padding: 30px;
    border: 2px solid var(--corruption);
    max-width: 400px;
    text-align: center;
}

.modal-content h3 {
    color: var(--corruption);
    margin-bottom: 15px;
}

.modal-content p {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 20px;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
        letter-spacing: 0.2em;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .character-grid {
        flex-direction: column;
        align-items: center;
    }
    
    .character-card {
        width: 100%;
        max-width: 300px;
    }
    
    .combatant {
        width: 120px;
        padding: 10px;
    }
    
    .action-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
        min-width: 100px;
    }
}
