/* styles.css */
/* 基础样式 */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f5f5f5;
}

.container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #333;
    color: white;
    padding: 10px 20px;
}

header h1 {
    flex: 1;
    text-align: center;
}

.save-buttons {
    display: flex;
    gap: 10px;
}

.save-buttons button {
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.save-buttons button:hover {
    background-color: #0056b3;
}

.main-content {
    width: 100%;
    display: flex;
    gap: 20px;
    padding: 20px;
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.left-panel,
.right-panel {
    width: 50%;
}

section {
    margin-bottom: 20px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

section h2,
section h3 {
    margin-top: 0;
}

button {
    padding: 10px 20px;
    margin: 5px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

button:hover {
    background-color: #0056b3;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 5px;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* 装备背包样式 */
#backpack-items {
    padding: 10px;
    overflow-y: auto;
    height: 300px;
    position: relative; /* 确保 Tooltip 的定位相对于背包区域 */
}

.backpack-item {
    display: flex;
    align-items: center; /* 垂直居中 */
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    position: relative;
    gap: 10px; /* 添加元素之间的间距 */
}

.equipment-name {
    max-width: fit-content; /* 让装备名称宽度自适应内容 */
    margin-right: 5px; /* 减小装备名称和 SVG 之间的间距 */
    overflow: hidden; /* 防止名称过长导致布局问题 */
    text-overflow: ellipsis; /* 超出部分显示省略号 */
    white-space: nowrap; /* 防止名称换行 */
    flex-shrink: 0; /* 防止装备名称被压缩 */
}

.button-container {
    display: flex;
    gap: 10px; /* 设置按钮之间的间距 */
    flex-shrink: 0; /* 防止按钮被压缩 */
    justify-content: flex-end; /* 按钮靠右对齐 */
    margin-left: auto; /* 让按钮容器靠右，可按需调整 */
}

.backpack-item .power-up-svg {
    margin-left: 2px; /* 调整 SVG 与装备名称之间的间距 */
    vertical-align: middle; /* 垂直居中 SVG */
    position: relative; /* 确保 SVG 相对于装备名称定位 */
    top: -1px; /* 微调 SVG 的垂直位置 */
}

/* 背包装备 Tooltip 样式 */
.backpack-item .tooltip {
    display: none;
    position: fixed; /* 使用 fixed 定位，确保 Tooltip 不会被裁剪 */
    z-index: 10001; /* 确保 Tooltip 的层级高于背包内容 */
    background-color: white;
    border: 1px solid #ccc;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    width: 200px;
    text-align: left;
    top: var(--tooltip-top); /* 动态设置 Tooltip 的 top 位置 */
    left: var(--tooltip-left); /* 动态设置 Tooltip 的 left 位置 */
}

/* 只在装备名称上悬停时显示 Tooltip */
.backpack-item .equipment-name:hover + .tooltip {
    display: block; /* 鼠标悬停时显示 Tooltip */
}

/* 已穿戴装备样式 */
.equipped-item {
    position: relative;
    display: inline-block;
}

.equipped-item .tooltip {
    display: none;
    position: absolute; /* 随网页滚动 */
    z-index: 10000; /* 确保 Tooltip 的层级高于其他元素 */
    background-color: white;
    border: 1px solid #ccc;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    width: 200px;
    text-align: left;
}

.equipped-item:hover .tooltip {
    display: block; /* 鼠标悬停时显示 Tooltip */
}

/* 装备品质颜色 */
/* 凡品 */
.凡品 {
    color: #808080;
    border: 2px solid #808080;
    padding: 2px 5px;
    border-radius: 3px;
    background-color: rgba(128, 128, 128, 0.1);
    font-weight: bold; /* 加粗文字 */
}

/* 灵品 */
.灵品 {
    color: #32CD32;
    border: 2px solid #32CD32;
    padding: 2px 5px;
    border-radius: 3px;
    background-color: rgba(50, 205, 50, 0.1);
    font-weight: bold; /* 加粗文字 */
}

/* 玄品 */
.玄品 {
    color: #00008B;
    border: 2px solid #00008B;
    padding: 2px 5px;
    border-radius: 3px;
    background-color: rgba(0, 0, 139, 0.1);
    font-weight: bold; /* 加粗文字 */
}

/* 地品 */
.地品 {
    color: #800080;
    border: 2px solid #800080;
    padding: 2px 5px;
    border-radius: 3px;
    background-color: rgba(128, 0, 128, 0.1);
    font-weight: bold; /* 加粗文字 */
}

/* 天品 */
.天品 {
    color: #FF8C00;
    border: 2px solid #FF8C00;
    padding: 2px 5px;
    border-radius: 3px;
    background-color: rgba(255, 140, 0, 0.1);
    font-weight: bold; /* 加粗文字 */
}

/* 仙品 */
.仙品 {
    color: #8B0000;
    border: 2px solid #8B0000;
    padding: 2px 5px;
    border-radius: 3px;
    background-color: rgba(139, 0, 0, 0.1);
    box-shadow: 0 0 5px #8B0000, 0 0 10px #8B0000;
    animation: glow-xianpin 2s infinite alternate;
    font-weight: bold; /* 加粗文字 */
}

@keyframes glow-xianpin {
    0% {
        box-shadow: 0 0 5px #8B0000, 0 0 10px #8B0000;
    }
    100% {
        box-shadow: 0 0 10px #8B0000, 0 0 20px #8B0000, 0 0 30px #8B0000;
    }
}

/* 神品 */
.神品 {
    color: #FF1493;
    border: 2px solid #FF1493;
    padding: 2px 5px;
    border-radius: 3px;
    background-color: rgba(255, 105, 180, 0.1);
    box-shadow: 0 0 5px #FF1493, 0 0 10px #FF1493;
    animation: glow-shenpin 2s infinite alternate;
    font-weight: bold; /* 加粗文字 */
}

@keyframes glow-shenpin {
    0% {
        box-shadow: 0 0 5px #FF1493, 0 0 10px #FF1493;
    }
    100% {
        box-shadow: 0 0 10px #FF1493, 0 0 20px #FF1493, 0 0 30px #FF1493;
    }
}

/* 日志区域 */
#log-area {
    margin-top: 20px;
    height: 700px;
    display: flex;
    flex-direction: column;
}

#log-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    .left-panel,
    .right-panel {
        width: 100%;
    }
}

/* 地图选择样式 */
#map-select-list {
    padding: 10px;
    overflow-y: auto;
    height: 300px;
}

.map-item {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.map-item.disabled {
    color: gray;
    cursor: not-allowed;
}

/* 更新日志模态框样式 */
#update-log-list {
    padding: 10px;
    overflow-y: auto;
    height: 300px;
}

.update-log-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.update-log-item:hover {
    background-color: #f5f5f5;
}

#update-log-detail-content {
    padding: 10px;
    overflow-y: auto;
    height: 300px;
}

.gift-icon {
    margin-left: 5px;
    color: gold;
}

.claimed-text {
    color: green;
    margin-left: 5px;
}
/* 在styles.css中添加以下内容 */

    /* 战斗动画样式 */
    .battle-container {
        margin: 20px 0;
        padding: 15px;
        background-color: #f0f0f0;
        border-radius: 8px;
        border: 1px solid #ddd;
    }

    .battle-header {
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
        padding-bottom: 5px;
        border-bottom: 1px solid #ccc;
    }

    .battle-round {
        font-weight: bold;
        color: #333;
    }

    .battle-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 10px 0;
    }

    .combatant {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 120px;
    }

    .combatant-image {
        width: 60px;
        height: 60px;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        margin-bottom: 5px;
        transition: all 0.3s ease;
    }

    .player-image {
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23333"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>');
    }

    .monster-image {
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23d32f2f"><path d="M12 3c-3.87 0-7 3.13-7 7 0 1.93.78 3.68 2.05 4.95l1.41-1.41C7.56 12.63 7 11.38 7 10c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.38-.56 2.63-1.46 3.54l1.41 1.41C18.22 13.68 19 11.93 19 10c0-3.87-3.13-7-7-7zm-5 8c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z"/></svg>');
    }

    .combatant-name {
        font-weight: bold;
        margin-bottom: 5px;
    }

    .combatant-stats {
        font-size: 0.9em;
        color: #666;
        text-align: center;
    }

    .hp-bar-container {
        width: 100%;
        height: 10px;
        background-color: #e0e0e0;
        border-radius: 5px;
        margin: 5px 0;
        overflow: hidden;
    }

    .hp-bar {
        height: 100%;
        background-color: #4CAF50;
        transition: width 0.5s ease;
    }

    .monster-hp-bar {
        background-color: #f44336;
    }

    .battle-action {
        flex-grow: 1;
        text-align: center;
        padding: 0 20px;
    }

    .action-text {
        margin: 10px 0;
        padding: 8px 12px;
        background-color: #fff;
        border-radius: 20px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        display: inline-block;
    }

    .damage-text {
        font-weight: bold;
        color: #d32f2f;
        animation: pop 0.3s ease;
    }

    .attack-animation {
        animation: attack 0.5s ease;
    }

    @keyframes attack {
        0% { transform: translateX(0); }
        50% { transform: translateX(10px); }
        100% { transform: translateX(0); }
    }

    @keyframes pop {
        0% { transform: scale(1); }
        50% { transform: scale(1.3); }
        100% { transform: scale(1); }
    }

    .victory {
        color: #4CAF50;
        font-weight: bold;
        text-align: center;
        margin: 10px 0;
        animation: pulse 1s infinite alternate;
    }

    .defeat {
        color: #f44336;
        font-weight: bold;
        text-align: center;
        margin: 10px 0;
    }

    @keyframes pulse {
        0% { transform: scale(1); }
        100% { transform: scale(1.05); }
    }

    /* 掉落物品样式 */
    .loot-item {
        display: flex;
        align-items: center;
        margin: 5px 0;
        padding: 5px;
        background-color: #fff;
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .loot-icon {
        width: 20px;
        height: 20px;
        margin-right: 8px;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }

    .gold-icon {
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23FFD700"><path d="M12 2L4 12l8 10 8-10-8-10zm0 3.3L17 12l-5 6.7L7 12l5-6.7z"/></svg>');
    }

    .exp-icon {
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%234CAF50"><path d="M12 2L4 12l8 10 8-10-8-10zm0 3.3L17 12l-5 6.7L7 12l5-6.7z"/></svg>');
    }

    .equipment-icon {
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%232196F3"><path d="M12 2L4 12l8 10 8-10-8-10zm0 3.3L17 12l-5 6.7L7 12l5-6.7z"/></svg>');
    }
    /* 在styles.css中修改动画部分 */

    /* 修改动画为独立的类，避免冲突 */
    .player-attack-animation {
        animation: playerAttack 0.5s ease;
    }

    .monster-attack-animation {
        animation: monsterAttack 0.5s ease;
    }

    @keyframes playerAttack {
        0% { transform: translateX(0); }
        50% { transform: translateX(20px); }
        100% { transform: translateX(0); }
    }

    @keyframes monsterAttack {
        0% { transform: translateX(0); }
        50% { transform: translateX(-20px); }
        100% { transform: translateX(0); }
    }

    /* 伤害数字动画 */
    .damage-text {
        font-weight: bold;
        color: #d32f2f;
        display: inline-block; /* 确保动画能正常工作 */
    }

    .damage-animation {
        animation: pop 0.3s ease;
    }

    @keyframes pop {
        0% { transform: scale(1); opacity: 1; }
        50% { transform: scale(1.5); opacity: 0.8; }
        100% { transform: scale(1); opacity: 1; }
    }
    .combatant-image {
    will-change: transform;
}

.hp-bar {
    will-change: width;
}
/* 添加受击闪红效果 */
@keyframes hitFlash {
    0% { filter: brightness(100%); }
    50% { filter: brightness(150%); }
    100% { filter: brightness(100%); }
}

.monster-hitted {
    animation: hitFlash 0.3s ease;
}

.player-hitted {
    animation: hitFlash 0.3s ease;
}
.damage-animation {
    color: red !important;
    font-weight: bold;
    animation: pop 0.3s ease;
}