.game-container {
    max-width: 1000px;
    margin: 2rem auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    min-height: 600px;
    position: relative;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

/* 屏幕切换 */
.screen {
    display: none;
    padding: 2rem;
    height: 100%;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 欢迎界面 */
#welcome-screen {
    justify-content: center;
    text-align: center;
}

.game-logo {
    margin-bottom: 3rem;
}

.logo-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

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

.game-modes {
    display: grid;
    gap: 1.5rem;
    width: 100%;
    max-width: 400px;
}

.btn-mode {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: left;
}

.btn-mode:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.btn-mode.primary {
    background: linear-gradient(135deg, #FF9F1C, #FFBF69);
    color: white;
}

.btn-mode.secondary {
    background: linear-gradient(135deg, #2EC4B6, #CBF3F0);
    color: #011627;
}

.btn-mode .icon {
    font-size: 2.5rem;
    margin-right: 1rem;
}

.btn-mode .text {
    font-size: 1.5rem;
    font-weight: bold;
    display: block;
}

.btn-mode .desc {
    font-size: 0.9rem;
    opacity: 0.9;
    display: block;
    margin-top: 0.2rem;
}

.game-stats-preview {
    margin-top: 3rem;
    display: flex;
    gap: 2rem;
}

.stat-badge {
    background: #f0f4f8;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-badge .value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--game-primary);
}

.stat-badge .label {
    font-size: 0.8rem;
    color: #666;
}

/* 游戏界面 */
#game-screen {
    padding: 1rem;
    justify-content: flex-start;
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    background: rgba(255,255,255,0.9);
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 10;
    margin-bottom: 1.5rem;
}

.player-info-detailed {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 400px;
}

.player-status-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.exp-bar-container {
    flex: 1;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.exp-fill {
    height: 100%;
    background: #4cc9f0;
    transition: width 0.3s ease;
}

.level-badge {
    background: var(--game-primary);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9rem;
    white-space: nowrap;
}

.hp-bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hp-bar {
    width: 150px;
    height: 14px;
    background: #eee;
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
}

.hp-fill {
    height: 100%;
    background: linear-gradient(to right, #ff4d4d, #ff8080);
    transition: width 0.3s ease;
}

.hp-text {
    font-size: 0.8rem;
    color: #666;
    font-weight: bold;
}

.player-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--game-dark);
    font-weight: bold;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: #f0f4f8;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}

/* 主游戏区域布局 */
.game-main-area {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    width: 100%;
    flex: 1;
}

/* 左侧 RPG 面板 */
.rpg-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    border: 1px solid #eee;
}

.panel-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: var(--game-dark);
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
}

/* 装备栏 */
.equipped-slots {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.equip-slot {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    background: white;
    border: 2px dashed #ddd;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.equip-slot:hover {
    border-color: var(--game-primary);
    background: #fff9f0;
}

.equip-slot[data-filled="true"] {
    border-style: solid;
    border-color: var(--game-secondary);
    background: #f0fffd;
}

.slot-icon {
    font-size: 1.5rem;
}

.slot-name {
    font-size: 0.9rem;
    font-weight: bold;
    color: #555;
}

/* 背包网格 */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: 12px;
    min-height: 150px;
    align-content: start;
}

.inventory-item {
    width: 50px;
    height: 50px;
    border: 2px solid #eee;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.inventory-item:hover {
    transform: scale(1.1);
    border-color: var(--game-primary);
    z-index: 10;
}

.inventory-item .tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    display: none;
    z-index: 20;
    margin-bottom: 5px;
}

.inventory-item:hover .tooltip {
    display: block;
}

/* 战斗区域调整 */
.battle-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.score-board {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--game-primary);
}

.battle-field {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 200px;
}

.monster-container {
    position: relative;
    text-align: center;
}

.monster {
    font-size: 6rem;
    transition: transform 0.2s;
    cursor: pointer;
}

.monster.hit {
    animation: shake 0.5s;
    filter: brightness(2) sepia(1) hue-rotate(-50deg) saturate(5); /* Red flash */
}

@keyframes shake {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-5px, 5px) rotate(-5deg); }
    50% { transform: translate(5px, -5px) rotate(5deg); }
    75% { transform: translate(-5px, 5px) rotate(-5deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.monster-hp-bar {
    width: 120px;
    height: 10px;
    background: rgba(0,0,0,0.1);
    border-radius: 5px;
    margin: 0 auto 10px;
    overflow: hidden;
}

.monster-hp-fill {
    height: 100%;
    background: #E71D36;
    transition: width 0.3s ease;
}

.damage-text {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    font-weight: bold;
    color: #E71D36;
    opacity: 0;
    pointer-events: none;
    text-shadow: 2px 2px 0 white;
}

.damage-text.show {
    animation: floatUp 0.8s ease-out;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50px) scale(1.5); }
}

.question-area {
    text-align: center;
    margin: 1rem 0 2rem;
    width: 100%;
}

.idiom-display {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.char {
    width: 60px;
    height: 60px;
    background: white;
    border: 3px solid var(--game-secondary);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    color: var(--game-dark);
    box-shadow: 0 4px 0 var(--game-secondary);
}

.char.empty {
    background: #eee;
    border-color: #ccc;
    color: transparent;
    box-shadow: none;
    border-style: dashed;
}

.idiom-pinyin {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 0.5rem;
    height: 1.5em;
}

.idiom-meaning {
    font-size: 1rem;
    color: #888;
    max-width: 90%;
    margin: 0 auto;
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 1rem;
}

.option-btn {
    background: white;
    color: var(--game-dark, #011627); /* Ensure color is set, fallback to dark blue */
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 0 #ddd;
    position: relative;
    top: 0;
}

.option-btn:hover {
    border-color: var(--game-primary);
    color: var(--game-primary);
    transform: translateY(-2px);
}

.option-btn:active {
    top: 4px;
    box-shadow: none;
}

.option-btn.correct {
    background: #2EC4B6;
    border-color: #249d92;
    color: white;
    box-shadow: 0 4px 0 #249d92;
    animation: pulse 0.5s;
}

.option-btn.wrong {
    background: #E71D36;
    border-color: #b8172b;
    color: white;
    box-shadow: 0 4px 0 #b8172b;
    animation: shake 0.5s;
}

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

.game-footer {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.btn-text {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
}

.combo-counter {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--game-primary);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* 结算界面 */
.result-card {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    max-width: 400px;
    width: 90%;
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.result-stats {
    margin: 2rem 0;
    width: 100%;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid #eee;
}

.stat-row:last-child {
    border-bottom: none;
}

.result-actions {
    display: grid;
    gap: 1rem;
}

.btn-primary, .btn-secondary {
    padding: 1rem;
    border-radius: 10px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-primary {
    background: var(--game-primary);
    color: white;
    box-shadow: 0 4px 10px rgba(255, 159, 28, 0.3);
}

.btn-secondary {
    background: #f0f4f8;
    color: #666;
}

.btn-primary:hover, .btn-secondary:hover {
    transform: translateY(-2px);
}

/* 响应式调整 */
@media (max-width: 800px) {
    .game-main-area {
        grid-template-columns: 1fr;
    }
    
    .rpg-panel {
        flex-direction: row;
        gap: 1rem;
        padding: 1rem;
    }
    
    .panel-section {
        flex: 1;
    }
    
    .inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    }
}

@media (max-width: 600px) {
    .game-container {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .rpg-panel {
        flex-direction: column;
    }
    
    .char {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
    
    .monster {
        font-size: 4rem;
    }
}
