:root {
    --bg-dark: #0a0a0c;
    --bg-panel: #141418;
    --accent-gold: #d4af37;
    --accent-crimson: #8b0000;
    --accent-blue: #1e3a8a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-dim: rgba(255, 255, 255, 0.1);
    --border-bright: rgba(212, 175, 55, 0.3);
    --font-main: 'Noto Serif SC', serif;
    --font-title: 'Long Cang', cursive;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#game-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
    background-image: url('assets/bg.jpg');
    background-size: cover;
    background-position: center;
}

.background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(10, 10, 12, 0.7) 0%, rgba(10, 10, 12, 0.95) 100%);
    z-index: 0;
}


aside,
main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

/* Left Panel */
#left-panel {
    width: 320px;
    background-color: rgba(20, 20, 24, 0.85);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-dim);
}

.panel-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border-dim);
}

.avatar-container {
    position: relative;
    width: 64px;
    height: 64px;
}

.avatar-frame {
    position: absolute;
    inset: -6px;
    border: 2px solid var(--accent-gold);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
    z-index: 1;
    pointer-events: none;
}

.avatar-frame::after {
    content: "";
    position: absolute;
    inset: 2px;
    border: 1px solid var(--accent-gold);
    border-radius: 6px;
    opacity: 0.6;
}

.avatar {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    object-fit: cover;
    background: #222;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.avatar:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

.player-basics h2 {
    font-family: var(--font-title);
    font-size: 24px;
    color: var(--accent-gold);
}

.level-badge {
    font-size: 12px;
    background: var(--accent-crimson);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.stats-section {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.progress-bar-container {
    width: 100%;
    height: 18px;
    background: #222;
    border-radius: 9px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-bar {
    height: 100%;
    transition: width 0.3s ease;
}

.hp .progress-bar {
    background: linear-gradient(90deg, #8b0000, #ff4d4d);
}

.qi .progress-bar {
    background: linear-gradient(90deg, #1e3a8a, #3b82f6);
}

.exp .progress-bar {
    background: linear-gradient(90deg, #d4af37, #fde047);
}

.bar-text {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    z-index: 10;
}

.detailed-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 5px;
    padding-top: 10px;
    border-top: 1px solid var(--border-dim);
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-label {
    font-size: 12px;
    color: var(--text-secondary);
}

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

.icon-btn-gold {
    background: transparent;
    border: none;
    color: var(--accent-gold);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    opacity: 0.7;
    padding: 5px;
}

.icon-btn-gold:hover {
    opacity: 1;
    text-shadow: 0 0 10px var(--accent-gold);
    transform: rotate(45deg);
}

/* --- Settings Modal Styles --- */
#settings-modal {
    background: transparent; /* 移除背景变暗，实现悬浮感 */
    backdrop-filter: none;
}

.modal-content {
    background: rgba(20, 20, 24, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid var(--accent-gold);
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9), 0 0 20px rgba(212, 175, 55, 0.1);
    position: relative;
    animation: modalSlideUp 0.3s ease-out;
}

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


.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 15px;
}

.modal-title {
    font-family: var(--font-title);
    color: var(--accent-gold);
    font-size: 28px;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
}

.close-btn:hover {
    color: var(--accent-crimson);
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group-title {
    font-size: 16px;
    color: var(--accent-gold);
    margin-bottom: 15px;
    font-family: var(--font-main);
}

.setting-row {
    margin-bottom: 20px;
}

.setting-row label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.setting-row input[type="range"] {
    width: 100%;
    accent-color: var(--accent-gold);
    cursor: pointer;
}


.combat-settings.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.setting-row {
    margin-top: 8px;
    margin-bottom: 8px;
}

.setting-row label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.setting-row input[type="range"] {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent-gold);
    border-radius: 50%;
}

.inventory-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-dim);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--accent-gold);
    border-bottom: 2px solid var(--accent-gold);
    background: rgba(212, 175, 55, 0.05);
}

.inventory-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: min-content; /* 让行高跟随内容高度 */
    gap: 12px;
}

/* 自定义滚动条 */
.inventory-content::-webkit-scrollbar {
    width: 4px;
}

.inventory-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.inventory-content::-webkit-scrollbar-thumb {
    background: var(--border-dim);
    border-radius: 2px;
}

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

.item-slot {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    aspect-ratio: 1 / 1; /* 保持正方形 */
}

.item-slot::after {
    content: "";
    position: absolute;
    inset: 4px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.3s;
    filter: grayscale(1) brightness(1.2);
}

/* 根据类型显示背景图 */
.item-slot.consumable::after { background-image: url('assets/type_consumable.jpg'); opacity: 0.25; }
.item-slot.manual::after { background-image: url('assets/type_manual.jpg'); opacity: 0.25; }
.item-slot.weapon::after { background-image: url('assets/slot_weapon.jpg'); }
.item-slot.head::after { background-image: url('assets/slot_head.jpg'); }
.item-slot.body::after { background-image: url('assets/slot_body.jpg'); }
.item-slot.hand::after { background-image: url('assets/slot_hand.jpg'); }
.item-slot.feet::after { background-image: url('assets/slot_feet.jpg'); }
.item-slot.accessory::after { background-image: url('assets/slot_accessory.jpg'); }

/* 空位显示装饰纹样 */
.item-slot.empty::after {
    background-image: url('assets/slot_empty.jpg');
    opacity: 0.08;
    inset: 0;
    background-size: 80%;
}

.item-slot:hover {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.08);
}

.item-slot:hover::after {
    opacity: 0.4;
}

/* 品质颜色 */
.common {
    color: #e0e0e0;
}

.uncommon {
    color: #4ade80;
}

/* 绿色 */
.rare {
    color: #60a5fa;
}

/* 蓝色 */
.epic {
    color: #a855f7;
}

/* 紫色 */
.legendary {
    color: #f97316;
}

/* 橙色 */

.item-slot.common {
    border-color: #e0e0e0;
}

.item-slot.uncommon {
    border-color: #4ade80;
    box-shadow: inset 0 0 5px rgba(74, 222, 128, 0.3);
}

.item-slot.rare {
    border-color: #60a5fa;
    box-shadow: inset 0 0 8px rgba(96, 165, 250, 0.4);
}

.item-slot.epic {
    border-color: #a855f7;
    box-shadow: inset 0 0 10px rgba(168, 85, 247, 0.5);
}

.item-slot.legendary {
    border-color: #f97316;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.4), inset 0 0 15px rgba(249, 115, 22, 0.6);
    animation: legendary-pulse 2s infinite alternate;
}

/* 物品标签继承颜色 */
.item-slot.common .item-name-tag {
    color: #e0e0e0;
}

.item-slot.uncommon .item-name-tag {
    color: #4ade80;
}

.item-slot.rare .item-name-tag {
    color: #60a5fa;
}

.item-slot.epic .item-name-tag {
    color: #a855f7;
}

.item-slot.legendary .item-name-tag {
    color: #f97316;
    text-shadow: 0 0 5px rgba(249, 115, 22, 0.5);
}

@keyframes legendary-pulse {
    from {
        border-color: #f97316;
        box-shadow: 0 0 5px rgba(249, 115, 22, 0.3), inset 0 0 10px rgba(249, 115, 22, 0.4);
    }

    to {
        border-color: #ffedd5;
        box-shadow: 0 0 15px rgba(249, 115, 22, 0.6), inset 0 0 20px rgba(249, 115, 22, 0.8);
    }
}

.item-name-tag {
    font-size: 11px;
    text-align: center;
    pointer-events: none;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    line-height: normal;
}

.equip-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 10px;
}

.equip-slot {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    aspect-ratio: 1 / 1; /* 保持正方形 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.equip-slot::before {
    content: "";
    position: absolute;
    inset: 0;
    background-size: 50% 50%;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.25;
    filter: grayscale(1) brightness(1.5);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    z-index: 0;
}

.equip-slot[data-slot="weapon"]::before { background-image: url('assets/slot_weapon.jpg'); }
.equip-slot[data-slot="head"]::before { background-image: url('assets/slot_head.jpg'); }
.equip-slot[data-slot="body"]::before { background-image: url('assets/slot_body.jpg'); }
.equip-slot[data-slot="hand"]::before { background-image: url('assets/slot_hand.jpg'); }
.equip-slot[data-slot="feet"]::before { background-image: url('assets/slot_feet.jpg'); }
.equip-slot[data-slot="accessory"]::before { background-image: url('assets/slot_accessory.jpg'); }

.equip-slot:hover {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.05);
    box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.1), 0 0 10px rgba(0, 0, 0, 0.5);
}

.equip-slot:hover::before {
    opacity: 0.4;
    transform: scale(1.1);
}

/* 当有装备时，背景图标变淡 */
.equip-slot.occupied::before {
    opacity: 0.08;
}

.equip-slot span {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-main);
}

.equip-slot div {
    font-size: 13px;
    font-weight: bold;
    z-index: 1;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    font-family: var(--font-main);
}

.skill-entry {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-dim);
    margin-bottom: 8px;
    padding: 10px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skill-info h4 {
    color: var(--accent-gold);
    font-size: 14px;
    margin-bottom: 2px;
}

.skill-info p {
    font-size: 11px;
    color: var(--text-secondary);
}

.skill-action {
    display: flex;
    align-items: center;
    gap: 10px;
}

.skill-level {
    font-size: 12px;
    color: var(--accent-gold);
}

.item-count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 10px;
    color: var(--accent-gold);
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
    pointer-events: none;
}

.panel-footer {
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--border-dim);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.currency {
    color: var(--accent-gold);
    font-weight: bold;
}

/* Main Panel */
#main-panel {
    flex: 1;
    background-color: rgba(10, 10, 12, 0.4);
    display: flex;
    flex-direction: column;
}

.main-header {
    height: 60px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(20, 20, 24, 0.8);
    border-bottom: 1px solid var(--border-dim);
}

.location-info {
    font-size: 18px;
    font-family: var(--font-title);
    color: var(--accent-gold);
}

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

.action-btn {
    background: transparent;
    border: 1px solid var(--border-dim);
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.action-btn.active {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.1);
}

.action-btn.locked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
}

#content-display {
    flex: 1;
    padding: 30px;
    position: relative;
    overflow-y: auto;
}

.view {
    display: none;
    height: 100%;
}

.view.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Map Grid */
.map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.map-node {
    position: relative;
    background: rgba(30, 30, 40, 0.7);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.map-node:hover {
    border-color: var(--accent-gold);
    transform: scale(1.05);
    background: rgba(40, 40, 50, 0.8);
}

.map-node.locked {
    filter: grayscale(1);
    opacity: 0.6;
    cursor: not-allowed !important;
    border-color: #444;
}

.map-node.locked:hover {
    transform: none;
    background: rgba(30, 30, 40, 0.7);
    box-shadow: none;
}

/* 正在战斗的节点标识 */
.map-node.active-battle {
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

.map-node.active-battle::after {
    content: "战";
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-crimson);
    color: white;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    font-family: var(--font-title);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    animation: battlePulse 1.5s infinite;
    z-index: 2;
}

@keyframes battlePulse {
    0% { transform: scale(1); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); }
    50% { transform: scale(1.1); box-shadow: 0 0 10px var(--accent-crimson); }
    100% { transform: scale(1); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); }
}

.node-name {
    font-family: var(--font-title);
    font-size: 20px;
    margin-bottom: 8px;
}

.node-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Battle View */
.battle-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.enemy-info {
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.enemy-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--accent-crimson);
    font-family: var(--font-main);
    font-weight: bold;
}

.enemy-info .progress-bar-container.small {
    height: 12px;
}

.battle-log {
    height: 300px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-dim);
    padding: 15px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    border-radius: 4px;
}

.log-entry.player {
    color: #4ade80;
}

.log-entry.enemy {
    color: #f87171;
}

.log-entry.info {
    color: #facc15;
}

/* Right Panel */
#right-panel {
    width: 300px;
    background-color: rgba(20, 20, 24, 0.85);
    backdrop-filter: blur(10px);
    border-left: 1px solid var(--border-dim);
}

.log-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-dim);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-header h3 {
    font-family: var(--font-title);
    font-size: 22px;
    color: var(--accent-gold);
    letter-spacing: 2px;
}

.icon-btn-text {
    background: transparent;
    border: 1px solid var(--border-dim);
    color: var(--text-secondary);
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn-text:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.1);
}

.scroll-log {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

.chat-input-container {
    padding: 15px;
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-dim);
}

#chat-input {
    flex: 1;
    background: #111;
    border: 1px solid var(--border-dim);
    color: white;
    padding: 8px;
    border-radius: 4px;
}

#btn-send {
    background: var(--accent-gold);
    color: black;
    border: none;
    padding: 0 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.battle-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spacer {
    flex: 1;
}

/* Buttons */
.primary-btn,
.secondary-btn {
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    transition: all 0.3s;
}

.primary-btn {
    background: var(--accent-gold);
    color: black;
    border: none;
}

.primary-btn:hover {
    background: #fde047;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-dim);
    color: var(--text-secondary);
}

.secondary-btn:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.1);
}

.secondary-btn.mini {
    padding: 0 15px;
    font-size: 13px;
    font-weight: normal;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.item-level {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 215, 0, 0.9);
    color: #000;
    font-size: 10px;
    padding: 0 4px;
    border-radius: 3px;
    font-weight: bold;
    pointer-events: none;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    z-index: 2;
}

/* 自定义悬浮提示框样式 */
.custom-tooltip {
    position: fixed;
    pointer-events: none;
    background: rgba(15, 15, 20, 0.98);
    color: #eee;
    padding: 14px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    z-index: 10000;
    display: none;
    box-shadow: 0 15px 40px rgba(0,0,0,0.8), inset 0 0 10px rgba(255, 215, 0, 0.05);
    max-width: 320px;
    white-space: pre-wrap;
    backdrop-filter: blur(8px);
}

.custom-tooltip hr {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

/* 出售模式样式 */
.sell-btn {
    width: 24px;
    height: 24px;
    background: transparent;
    border: 1px solid #4ade80;
    color: #4ade80;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sell-btn:hover {
    background: rgba(74, 222, 128, 0.1);
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.2);
}

.sell-btn.active {
    background: #4ade80;
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.4);
}

.item-slot.selected {
    border-color: #f87171 !important;
    box-shadow: inset 0 0 15px rgba(248, 113, 113, 0.3) !important;
}

.item-slot.selected::after {
    content: "✓";
    position: absolute;
    top: 2px;
    left: 4px;
    color: #f87171;
    font-size: 10px;
    font-weight: bold;
}

.selling-mode .item-slot:not(.selected) {
    opacity: 0.8;
}

/* --- Welcome Screen (Character Creation) --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-dark);
    background-image: url('assets/bg.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease, transform 1s ease;
}

.overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.4) 0%, rgba(10, 10, 12, 0.95) 100%);
}

.welcome-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 500px;
    width: 90%;
    padding: 40px;
    background: rgba(20, 20, 24, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    animation: welcomeFadeIn 1.5s ease-out;
}

@keyframes welcomeFadeIn {
    from { opacity: 0; transform: scale(0.95); filter: blur(10px); }
    to { opacity: 1; transform: scale(1); filter: blur(0); }
}

.welcome-title {
    font-family: var(--font-title);
    font-size: 80px;
    font-weight: 400;
    color: var(--accent-gold);
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
    letter-spacing: 12px;
}

.welcome-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 40px;
}

.creation-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.avatar-pick-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.avatar.large {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    border: 2px solid var(--accent-gold);
    object-fit: cover;
    background: #222;
}

.avatar-frame.large {
    inset: -8px;
    border: 3px solid var(--accent-gold);
    border-radius: 12px;
    position: absolute;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.avatar-frame.large::after {
    content: "";
    position: absolute;
    inset: 3px;
    border: 1px solid var(--accent-gold);
    border-radius: 9px;
    opacity: 0.6;
}

.mini-ink-btn {
    position: absolute;
    bottom: -10px;
    right: -10px;
    background: var(--accent-gold);
    color: var(--bg-dark);
    border: none;
    padding: 4px 10px;
    font-family: var(--font-title);
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    z-index: 5;
}

.input-group {
    width: 100%;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 14px;
    color: var(--accent-gold);
    margin-bottom: 8px;
    font-family: var(--font-title);
}

.input-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-dim);
    padding: 12px;
    color: white;
    font-size: 18px;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: var(--accent-gold);
}

.ink-button {
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    color: #000;
    border: none;
    padding: 12px 40px;
    font-family: var(--font-title);
    font-size: 20px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.ink-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
    filter: brightness(1.1);
}

/* --- Save Card Styles --- */
.save-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.save-card:hover {
    background: rgba(212, 175, 55, 0.05);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

.save-avatar-container {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    border: 1px solid var(--accent-gold);
    overflow: hidden;
}

.save-avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.save-info {
    flex: 1;
    text-align: left;
}

.save-info h3 {
    font-family: var(--font-title);
    color: var(--accent-gold);
    font-size: 20px;
}

.save-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

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

.ink-button.mini {
    padding: 6px 15px;
    font-size: 14px;
}

.danger-ink-btn {
    background: rgba(139, 0, 0, 0.2);
    border: 1px solid var(--accent-crimson);
    color: var(--accent-crimson);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-title);
    transition: all 0.3s;
}

.danger-ink-btn:hover {
    background: var(--accent-crimson);
    color: white;
}

.divider {
    position: relative;
    text-align: center;
    margin: 20px 0;
}

.divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-dim);
    z-index: 0;
}

.divider span {
    background: #141418;
    padding: 0 15px;
    color: var(--text-secondary);
    font-size: 14px;
    font-family: var(--font-title);
    position: relative;
    z-index: 1;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1);
}

/* --- Custom Game Dialog --- */
#game-dialog-overlay {
    background: transparent; /* 完全透明，实现纯悬浮感 */
    background-image: none;
    backdrop-filter: none;
    z-index: 2000;
}

.game-dialog {
    background: rgba(20, 20, 24, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid var(--accent-gold);
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 1), 0 0 20px rgba(212, 175, 55, 0.1);
    position: relative;
    animation: dialogPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@keyframes dialogPop {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.dialog-header {
    text-align: center;
}

.dialog-title {
    font-family: var(--font-title);
    color: var(--accent-gold);
    font-size: 32px;
    letter-spacing: 2px;
}

.dialog-body {
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
    text-align: center;
    margin: 10px 0;
}

.dialog-input-container {
    margin: 10px 0;
}

.dialog-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-bright);
    border-radius: 6px;
    padding: 12px 15px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
}

.dialog-input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.dialog-footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.dialog-footer button {
    min-width: 100px;
    padding: 10px 20px;
    font-size: 16px;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-dim);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.primary-btn {
    background: var(--accent-gold);
    border: 1px solid var(--accent-gold);
    color: #000;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.primary-btn:hover {
    background: #fde047;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
    transform: translateY(-2px);
}

.dialog-input-container.hidden {
    display: none;
}

/* --- 移动端适配 --- */
.mobile-only {
    display: none;
}

@media screen and (max-width: 1024px) {
    #left-panel {
        width: 260px;
    }
    #right-panel {
        width: 240px;
    }
}

@media screen and (max-width: 768px) {
    body {
        overflow: auto; /* 允许纵向滚动或通过导航切换 */
    }

    #game-container {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }

    aside, main {
        width: 100% !important;
        height: calc(100vh - 60px) !important; /* 减去底部导航高度 */
        position: absolute;
        top: 0;
        left: 0;
        transition: transform 0.3s ease;
    }

    /* 默认隐藏侧边栏 */
    #left-panel, #right-panel {
        display: flex; /* 虽然是 flex，但我们通过 transform 或 display 控制显隐 */
        z-index: 10;
    }

    /* 初始状态：只显示主面板 */
    #left-panel { transform: translateX(-100%); }
    #right-panel { transform: translateX(100%); }
    #main-panel { transform: translateX(0); z-index: 5; }

    /* 激活状态 */
    .mobile-active#left-panel { transform: translateX(0); z-index: 20; }
    .mobile-active#main-panel { transform: translateX(0); z-index: 20; }
    .mobile-active#right-panel { transform: translateX(0); z-index: 20; }

    #left-panel, #right-panel, #main-panel {
        border: none;
        background-color: rgba(20, 20, 24, 0.95);
    }

    /* 底部导航样式 */
    .mobile-only {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: rgba(15, 15, 18, 0.98);
        border-top: 1px solid var(--accent-gold);
        backdrop-filter: blur(10px);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
    }

    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        background: none;
        border: none;
        color: var(--text-secondary);
        padding: 5px;
        flex: 1;
        cursor: pointer;
        transition: all 0.3s;
    }

    .nav-item.active {
        color: var(--accent-gold);
    }

    .nav-icon {
        font-size: 20px;
        margin-bottom: 2px;
    }

    .nav-text {
        font-size: 11px;
    }

    /* 调整内部组件间距 */
    .inventory-content {
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: min-content !important; /* 确保行高跟随格子高度，防止重叠 */
    }

    .item-slot, .equip-slot {
        height: auto !important;
        aspect-ratio: 1 / 1;
    }

    .item-name-tag {
        line-height: normal;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }

    .map-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        padding: 10px;
    }

    .welcome-content {
        width: 95%;
        padding: 20px;
    }

    .welcome-title {
        font-size: 48px;
    }

    /* 弹窗适配 */
    .game-dialog {
        width: 95%;
        padding: 20px;
    }
}

@media screen and (max-width: 480px) {
    .panel-header {
        padding: 15px;
    }
}