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

body {
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

.screen {
    display: none;
    min-height: 100vh;
    position: relative;
}

.screen.active {
    display: block;
}

/* 按钮样式 */
.menu-btn, .action-btn, .combat-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 6px;
    min-width: 120px;
}

.menu-btn.primary, .combat-btn.primary {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
}

.menu-btn.primary:hover, .combat-btn.primary:hover {
    background: linear-gradient(45deg, #45a049, #3d8b40);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.menu-btn.secondary, .combat-btn.secondary {
    background: linear-gradient(45deg, #607D8B, #546E7A);
    color: white;
}

.menu-btn.secondary:hover, .combat-btn.secondary:hover {
    background: linear-gradient(45deg, #546E7A, #455A64);
    transform: translateY(-2px);
}

.combat-btn.danger {
    background: linear-gradient(45deg, #f44336, #d32f2f);
    color: white;
}

.combat-btn.danger:hover {
    background: linear-gradient(45deg, #d32f2f, #b71c1c);
    transform: translateY(-2px);
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 14px;
    padding: 8px 16px;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* 主菜单样式 */
#main-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.menu-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 60px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.game-title h1 {
    font-size: 4rem;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-title h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #E8EAF6;
}

.subtitle {
    font-size: 1.2rem;
    color: #B39DDB;
    margin-bottom: 40px;
}

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

/* 角色创建样式 */
#character-creation {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.creation-container {
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    min-width: 400px;
}

.form-group {
    margin-bottom: 30px;
}

.form-group label {
    display: block;
    font-size: 18px;
    margin-bottom: 10px;
    color: #E3F2FD;
}

.form-group input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.character-preview {
    margin: 30px 0;
}

.character-avatar {
    width: 120px;
    height: 120px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 50%;
    margin: 0 auto 20px;
    border: 4px solid rgba(255, 255, 255, 0.3);
}

.character-desc {
    color: #B3E5FC;
    font-style: italic;
    font-size: 14px;
}

/* 游戏主界面样式 */
#game-main {
    padding: 20px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-name {
    font-size: 24px;
    font-weight: bold;
    color: #FFD700;
}

.player-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.health-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.health-text {
    min-width: 140px;
    font-size: 14px;
}

.health-bar-fill {
    width: 200px;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.health-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.3s ease;
}

.level-exp {
    font-size: 14px;
    color: #B0BEC5;
}

.game-actions {
    display: flex;
    gap: 10px;
}

.enemy-selection {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 12px;
}

.enemy-selection h3 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
    color: #FFD700;
}

.enemy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.enemy-card {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.enemy-card:hover {
    border-color: #FFD700;
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
}

.enemy-card h4 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #FFD700;
}

.enemy-card .enemy-desc {
    font-size: 14px;
    color: #B0BEC5;
    margin-bottom: 15px;
    line-height: 1.4;
}

.enemy-stats {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #78909C;
}

.enemy-difficulty {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

.difficulty-beginner { background: #4CAF50; color: white; }
.difficulty-intermediate { background: #FF9800; color: white; }
.difficulty-expert { background: #f44336; color: white; }

/* 战斗界面样式 */
#combat-screen {
    padding: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.combat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.combatant {
    flex: 1;
    text-align: center;
}

.combatant h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #FFD700;
}

.health-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.health-display .health-bar {
    width: 150px;
}

.combat-center {
    flex: 1;
    text-align: center;
    padding: 0 30px;
}

.round-info {
    font-size: 24px;
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 10px;
}

.combat-phase {
    font-size: 16px;
    color: #B0BEC5;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.combat-content {
    display: grid;
    gap: 20px;
    grid-template-rows: auto auto 1fr auto;
}

.poem-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.player-poem, .enemy-poem {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.player-poem h4, .enemy-poem h4 {
    color: #FFD700;
    margin-bottom: 15px;
    font-size: 18px;
}

.poem-text {
    font-size: 24px;
    font-weight: bold;
    color: #E3F2FD;
    margin-bottom: 15px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    letter-spacing: 2px;
}

.poem-result {
    font-size: 14px;
    color: #B0BEC5;
}

.word-selection {
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 12px;
}

.word-selection h4 {
    color: #FFD700;
    margin-bottom: 20px;
    text-align: center;
    font-size: 18px;
}

.selected-words {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-count {
    color: #FFD700;
    font-weight: bold;
    font-size: 16px;
}

.selected-word {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selected-word:hover {
    background: linear-gradient(45deg, #45a049, #3d8b40);
    transform: scale(1.05);
}

.word-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
}

.word-card {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
}

.word-card:hover {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.1);
    transform: translateY(-3px);
}

.word-card.selected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
}

.word-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.word-text {
    font-size: 18px;
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 8px;
}

.word-info {
    font-size: 10px;
    color: #B0BEC5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.word-damage {
    font-weight: bold;
    color: #ff6b6b;
}

.word-rarity {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 8px;
    font-weight: bold;
}

.rarity-common { background: #78909C; color: white; }
.rarity-uncommon { background: #4CAF50; color: white; }
.rarity-rare { background: #2196F3; color: white; }
.rarity-epic { background: #9C27B0; color: white; }

.combat-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

/* 战斗结果样式 */
#battle-result {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.result-container {
    background: rgba(255, 255, 255, 0.1);
    padding: 50px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    max-width: 500px;
}

.result-header {
    margin-bottom: 30px;
}

.result-header h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.result-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.result-icon.victory {
    background: linear-gradient(45deg, #4CAF50, #45a049);
}

.result-icon.defeat {
    background: linear-gradient(45deg, #f44336, #d32f2f);
}

.result-icon.draw {
    background: linear-gradient(45deg, #FF9800, #F57C00);
}

.result-details {
    margin-bottom: 30px;
}

.result-text {
    font-size: 18px;
    color: #E3F2FD;
    margin-bottom: 20px;
    line-height: 1.6;
}

.reward-info {
    font-size: 16px;
    color: #FFD700;
    font-weight: bold;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* 游戏说明样式 */
#instructions {
    padding: 20px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    overflow-y: auto;
}

.instructions-container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.instructions-container h2 {
    text-align: center;
    font-size: 2.5rem;
    color: #FFD700;
    margin-bottom: 30px;
}

.instructions-content h3 {
    color: #4CAF50;
    font-size: 1.5rem;
    margin: 25px 0 15px 0;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 5px;
}

.instructions-content p {
    color: #E3F2FD;
    line-height: 1.6;
    margin-bottom: 15px;
}

.instructions-content ul {
    color: #B0BEC5;
    margin-left: 30px;
    margin-bottom: 20px;
}

.instructions-content li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.instructions-content strong {
    color: #FFD700;
}

/* 加载和提示框样式 */
.loading-overlay {
    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;
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-left: 4px solid #FFD700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.message-box {
    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: 1001;
}

.message-box.hidden {
    display: none;
}

.message-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    max-width: 400px;
}

.message-content p {
    font-size: 16px;
    color: #E3F2FD;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 20px;
    }
    
    .poem-display {
        grid-template-columns: 1fr;
    }
    
    .word-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .combat-header {
        flex-direction: column;
        gap: 20px;
    }
    
    .combat-center {
        padding: 0;
    }
    
    .enemy-grid {
        grid-template-columns: 1fr;
    }
    
    .menu-container {
        padding: 40px 20px;
    }
    
    .game-title h1 {
        font-size: 2.5rem;
    }
}

/* === 经验条样式 === */
.exp-bar-container {
    position: relative;
    width: 200px;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 4px;
    border: 1px solid rgba(255, 215, 0, 0.4);
}

.exp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ff8c00);
    border-radius: 10px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.exp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

/* === 升级通知样式 === */
.level-up-box {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.level-up-box.hidden {
    display: none;
}

.level-up-content {
    background: linear-gradient(135deg, #2c1810, #5c3a1e);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 40px 60px;
    text-align: center;
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.5);
    animation: levelUpPop 0.5s ease;
}

@keyframes levelUpPop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.level-up-icon {
    font-size: 80px;
    color: #ffd700;
    margin-bottom: 20px;
    animation: starGlow 1.5s ease infinite;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

@keyframes starGlow {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
}

.level-up-content h2 {
    color: #ffd700;
    font-size: 1.8rem;
    margin-bottom: 16px;
    font-family: 'KaiTi', '楷体', serif;
}

.level-up-content p {
    color: #f4e4bc;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 24px;
}

.level-up-content strong {
    color: #ffd700;
    font-size: 1.3rem;
}