/* ./style_player_hub.css */
/* 职责：定义“玩家中心”模态框的专属样式。 */

/* --- 玩家中心弹窗 --- */
#player-hub-modal .modal-content-full {
    background-color: var(--color-panel);
    width: 85vw;
    height: 85vh;
    max-width: 1400px;
    border-radius: 0.75rem;
    border: 2px solid var(--color-border);
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

/* platform-web 覆盖见 style_components.css */

#player-hub-modal .modal-close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--color-panel-light);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    line-height: 2.5rem;
    text-align: center;
    cursor: pointer;
    border: none;
    z-index: 10;
}

#player-hub-modal .hub-layout {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 2rem;
    overflow: hidden;
}

#player-hub-modal #hub-left-panel, #player-hub-modal #hub-right-panel {
    display: flex;
    flex-direction: column;
}

#player-hub-modal #hub-left-panel {
    width: 25%;
    flex-shrink: 0;
    background-color: var(--color-bg);
    border-radius: 0.5rem;
    padding: 0;
    color: var(--color-text-dim);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    position: relative;
    --hub-stats-offset: 0.35rem;
    --hub-slot-icon-size: clamp(2.85rem, 24%, 3.4rem);
    /* 立绘遮罩渐变：色 rgb(15,23,42) = slate-900，见 .hub-left-portrait::after */
    --hub-fade-color: 15, 23, 42;
    --hub-fade-stop-0: 0%;
    --hub-fade-alpha-0: 0.08;
    --hub-fade-stop-1: 38%;
    --hub-fade-alpha-1: 0.35;
    --hub-fade-stop-2: 68%;
    --hub-fade-alpha-2: 0.9;
    --hub-fade-stop-3: 98%;
    --hub-fade-alpha-3: 1;
}

.hub-left-portrait {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}

.hub-left-portrait::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(var(--hub-fade-color), var(--hub-fade-alpha-0)) var(--hub-fade-stop-0),
        rgba(var(--hub-fade-color), var(--hub-fade-alpha-1)) var(--hub-fade-stop-1),
        rgba(var(--hub-fade-color), var(--hub-fade-alpha-2)) var(--hub-fade-stop-2),
        rgba(var(--hub-fade-color), var(--hub-fade-alpha-3)) var(--hub-fade-stop-3)
    );
    z-index: 1;
}

.hub-left-portrait-img {
    position: absolute;
    width: auto;
    height: 114%;
    min-width: 92%;
    max-width: none;
    object-fit: contain;
    will-change: transform;
}

.hub-left-foreground {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: 0.4rem;
    padding: 1rem 1.1rem 1.05rem;
    box-sizing: border-box;
}
#player-hub-modal #hub-right-panel {
    width: 75%;
    min-width: 0;
}

.hub-left-header {
    flex: 0 0 auto;
    width: 100%;
}

.hub-left-portrait-spacer {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.hub-left-meta {
    flex: 0 0 auto;
    width: 100%;
}

.hub-character-stats-block {
    margin-top: var(--hub-stats-offset);
}

.hub-resource-bar {
    display: flex;
    gap: 1rem;
    justify-content: space-around;
    padding: 0.35rem 0.5rem;
    background-color: rgba(0, 0, 0, 0.45);
    border-radius: 0.375rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(2px);
}

.hub-player-gold {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    font-weight: bold;
    color: #FBBF24;
}

.hub-left-bottom {
    flex: 0 0 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.hub-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--color-text-dim);
    text-transform: uppercase;
    margin: 0 0 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--color-border);
}

.char-detail-stats,
.hub-resource-bar {
    backdrop-filter: blur(3px);
}

.hub-character-meta {
    flex: 1;
    min-width: 0;
}

.hub-tabs { display: flex; gap: 0.5rem; border-bottom: 2px solid var(--color-border); flex-shrink: 0; }
.hub-tab { padding: 0.75rem 1.5rem; font-size: 1.25rem; font-weight: bold; background-color: transparent; color: var(--color-text-dim); border: none; border-bottom: 4px solid transparent; cursor: pointer; transition: all 0.2s ease; transform: translateY(2px); }
.hub-tab:hover { color: white; }
.hub-tab.active { color: var(--color-purple); border-bottom-color: var(--color-purple); }

.hub-tab-content { flex-grow: 1; position: relative; min-height: 0; padding-top: 1rem; }
.hub-panel { display: none; height: 100%; overflow-y: auto; }
.hub-panel.active { display: flex; flex-direction: column; gap: 1rem; }

/* 子标签页样式 (可复用) */
.hub-sub-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--color-border);
    flex-shrink: 0;
}
.hub-sub-tab {
    padding: 0.5rem 1.25rem;
    font-size: 1rem;
    font-weight: bold;
    background-color: transparent;
    color: var(--color-text-dim);
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    transform: translateY(2px);
}
.hub-sub-tab:hover {
    color: white;
}
.hub-sub-tab.active {
    color: var(--color-purple);
    border-bottom-color: var(--color-purple);
}
.hub-sub-tab-content {
    flex-grow: 1;
    position: relative;
    min-height: 0;
    padding-top: 1rem;
}

.hub-sub-panel {
    display: none;
    height: 100%;
    overflow-y: auto; 
    padding: 0.5rem;
}

/* --- 【核心Bug修复】 --- */
/* 恢复这条通用规则，以显示嵌套的子面板 (如 技能/故事) */
.hub-sub-panel.active {
    display: block;
}

/* 为 '英雄' 面板的 active 状态设置 grid 布局 (覆盖上面的 display: block) */
.hub-sub-panel.active#char-hero-panel {
    display: grid;
    grid-template-columns: 4fr 3fr;
    gap: 1rem;
    padding: 0; 
    overflow: hidden; 
}
/* 为 '图鉴' 面板的 active 状态设置 block 布局 (与通用规则一致) */
.hub-sub-panel.active#char-bestiary-panel,
.hub-sub-panel.active#char-achievements-panel {
    display: block;
    overflow-y: auto;
    padding: 0.5rem;
}
/* --- 修复结束 --- */


/* --- “英雄”子标签页样式 --- */

.char-selection-grid { 
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem; 
    padding: 0.5rem; 
    height: 100%;
    overflow-y: auto;
    align-content: flex-start;
}
.char-portrait-button { background-color: var(--color-bg); border: 3px solid transparent; border-radius: 0.5rem; cursor: pointer; aspect-ratio: 1/1; overflow: hidden; transition: all 0.2s ease; position: relative; }
.char-portrait-button:not(.locked):hover { border-color: var(--color-purple); transform: scale(1.05); }
.char-portrait-button.locked { cursor: pointer; }
.char-portrait-button.locked:hover { border-color: rgba(167, 139, 250, 0.55); transform: scale(1.03); }
.char-portrait-button.active { border-color: #FBBF24; box-shadow: 0 0 15px #FBBF24; }
.char-portrait-button.is-preview:not(.active) {
    border-color: var(--color-purple);
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.55);
}
.char-portrait-button img { width: 100%; height: 100%; object-fit: cover; transition: filter 0.3s ease; }
.char-portrait-name { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(0,0,0,0.85), transparent); color: white; text-align: center; padding: 1.5rem 0.25rem 0.25rem; font-size: 0.9rem; font-weight: bold; }
.char-role-tag { border-left: 3px solid var(--color-purple); padding-left: 0.5rem; }
.achievements-list { display: flex; flex-direction: column; gap: 0.5rem; }
.achievement-row { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.5rem; border-radius: 0.375rem; background: rgba(0,0,0,0.25); }
.achievement-row.locked { opacity: 0.55; }
.achievement-name { font-weight: 600; font-size: 0.9rem; }
.lottery-total-cost-hint { font-size: 0.8rem; color: #9ca3af; margin-top: 0.5rem; line-height: 1.35; }

.char-portrait-button.locked {
    cursor: pointer;
}
.char-portrait-button.locked img {
    filter: grayscale(100%);
}
.char-portrait-button.locked .char-portrait-name {
    padding-top: 0.75rem;
    background: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
}
.char-unlock-desc {
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--color-text-dim);
    line-height: 1.2;
    padding: 0 5px;
}


.char-detail-name {
    font-size: 1.35rem;
    font-weight: bold;
    color: white;
    margin: 0;
    line-height: 1.15;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}

.char-detail-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: rgba(0, 0, 0, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.4rem;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    backdrop-filter: blur(3px);
    overflow: hidden;
    font-size: clamp(0.72rem, 2.6cqw, 0.82rem);
    container-type: inline-size;
    container-name: hub-stats;
}

.stat-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.28rem 0.4rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-content: center;
}

.stat-item:nth-child(2n) {
    border-right: none;
}

.stat-item:nth-child(n + 3) {
    border-bottom: none;
}

.stat-item-emoji {
    font-size: 1.05em;
    line-height: 1;
    flex-shrink: 0;
}

.stat-item-value {
    font-size: inherit;
    font-weight: bold;
    line-height: 1.2;
    flex-shrink: 0;
}

.stat-item-value.stat-buffed {
    color: var(--color-buff, #4ade80);
}

.stat-item-value.stat-plain {
    color: white;
}

.char-details-panel-left {
    padding: 1rem;
    background: var(--color-panel);
    border-radius: 0.5rem;
    flex-shrink: 0;
    color: var(--color-text-dim);
    display: flex;
    flex-direction: column;
}


.consumables-display-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 1rem;
}

.prep-slots-list {
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
    flex: 0 0 auto;
    width: 100%;
}

.prep-slot {
    background-color: rgba(0, 0, 0, 0.38);
    border-radius: 0.35rem;
    padding: 0.42rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid var(--color-purple);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    backdrop-filter: blur(2px);
}

.prep-slot:hover {
    border-color: rgba(167, 139, 250, 0.45);
}

.prep-slot.active-selection {
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.35);
    border-color: rgba(251, 191, 36, 0.55);
    border-left-color: #FBBF24;
}

.prep-slot-title {
    display: none;
}

.prep-slot-title::after {
    content: none;
}

.prep-slot-head {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.15rem 0.35rem;
    min-width: 0;
    width: 100%;
}

.prep-slot-content {
    flex: 1;
    display: grid;
    grid-template-columns: var(--hub-slot-icon-size) minmax(0, 1fr);
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
    align-items: center;
}

.prep-slot-body {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    min-width: 0;
    justify-content: center;
    min-height: var(--hub-slot-icon-size);
}

.prep-slot-empty .prep-slot-body {
    justify-content: center;
}

.prep-slot-item-icon {
    width: var(--hub-slot-icon-size);
    height: var(--hub-slot-icon-size);
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.prep-slot-item-icon img {
    width: 86%;
    height: 86%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.prep-slot-empty .prep-slot-item-icon {
    background: rgba(0, 0, 0, 0.35);
}

.prep-slot-empty-mark {
    width: 42%;
    height: 42%;
    min-width: 0.9rem;
    min-height: 0.9rem;
    border-radius: 0.15rem;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    opacity: 0.7;
}

.prep-slot-empty .prep-slot-item-name {
    color: var(--color-text-dim);
    font-weight: 600;
}

.prep-slot-item-name {
    font-size: 0.88rem;
    font-weight: bold;
    color: white;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.prep-stat-chips {
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    min-height: 0;
    /* 与左栏角色属性 .char-detail-stats 同级字号 */
    font-size: clamp(0.72rem, 2.6cqw, 0.82rem);
}

.prep-stat-chip {
    font-size: 1em;
    line-height: 1.3;
    padding: 0.18em 0.4em;
    border-radius: 0.22rem;
    background: rgba(74, 222, 128, 0.12);
    color: #86efac;
    border: 1px solid rgba(74, 222, 128, 0.22);
    white-space: nowrap;
    font-weight: 700;
}

.prep-stat-chip--empty {
    background: transparent;
    border-color: transparent;
    color: var(--color-text-dim);
    font-weight: 600;
}

.prep-inventory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 1rem; align-content: flex-start; overflow-y: auto; padding: 0.5rem; background: var(--color-panel); border-radius: 0.5rem; }
.prep-item-details { position: relative; padding: 1rem; background: var(--color-panel); border-radius: 0.5rem; flex-shrink: 0; min-height: 180px; display: flex; flex-direction: column; justify-content: center; }
.prep-item-details .placeholder { text-align: center; color: var(--color-text-dim); }
.prep-details-content { display: flex; gap: 1rem; }
.prep-details-left { flex-shrink: 0; }
.prep-details-right { display: flex; flex-direction: column; }
.prep-details-name { font-size: 1.5rem; font-weight: bold; color: white; margin-bottom: 0.5rem; }
.prep-details-desc { color: var(--color-text-dim); font-size: 0.9rem; margin-bottom: auto; }
.prep-details-equip-btn { background-color: var(--color-purple); color: white; font-weight: bold; padding: 0.75rem; border-radius: 0.375rem; border: none; cursor: pointer; }
.prep-details-equip-btn:disabled { background-color: var(--color-panel-light); cursor: not-allowed; }

.prep-details-sell-btn {
    background-color: #D97706; 
    color: white;
    font-weight: bold;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
}
.prep-details-sell-btn:hover:not(:disabled) {
    background-color: #F59E0B;
}
.prep-details-sell-btn:disabled {
    background-color: var(--color-panel-light);
    cursor: not-allowed;
    opacity: 0.5;
}

.prep-details-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}
.prep-details-actions > button {
    flex-grow: 1;
}

.prep-details-lock-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    background-color: rgba(0,0,0,0.3);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.prep-details-lock-btn:hover {
    background-color: rgba(0,0,0,0.6);
}
.prep-details-lock-btn img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}


.item-slot { aspect-ratio: 1/1; background-color: var(--color-bg); border: 2px solid var(--color-border); border-radius: 0.375rem; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; transition: all 0.2s ease; }
.item-equipped-indicator { position: absolute; top: 2px; left: 4px; font-size: 0.8rem; font-weight: bold; color: #FBBF24; text-shadow: 0 0 5px black; }
.item-slot:hover { border-color: var(--color-purple); transform: scale(1.05); }
.item-slot.selected { border-color: #FBBF24; box-shadow: 0 0 10px #FBBF24; transform: scale(1.05); }
.item-slot img { width: 75%; height: 75%; object-fit: contain; }
.item-quantity { position: absolute; bottom: 0.25rem; right: 0.25rem; background-color: rgba(0,0,0,0.7); color: white; font-size: 0.8rem; font-weight: bold; padding: 0.1rem 0.4rem; border-radius: 99px; }

/* 玩家中心技能显示卡片样式 */
.skill-card {
    background-color: var(--color-bg);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.skill-name {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.skill-name.passive {
    color: var(--color-purple);
}

.skill-name.active {
    color: #4ade80;
}

.skill-card.skill-locked {
    background-color: rgba(0,0,0,0.2);
    border: 1px dashed var(--color-border);
}

.skill-name.locked {
    color: var(--color-text-dim);
}

.skill-locked-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skill-unlock-action {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skill-unlock-cost {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: bold;
}

.skill-unlock-cost img {
    width: 20px;
    height: 20px;
}

.skill-unlock-button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}


.skill-details {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9em;
    color: var(--color-text-dim);
    margin-bottom: 0.75rem;
}

.skill-description,
.char-story-text {
    font-size: 0.875em;
    line-height: 1.625;
}

.char-unlock-hint {
    font-size: 0.875em;
    line-height: 1.45;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 0.4rem;
    padding: 0.55em 0.7em;
    margin: 0 0 0.75rem;
}

.char-details-sub-content {
    min-height: 280px;
}


/* --- “图鉴”子标签页样式 --- */

.bestiary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: 0.5rem;
    height: 100%;
    overflow-y: auto;
    align-content: flex-start;
}

.bestiary-card {
    background-color: var(--color-bg);
    border-radius: 0.5rem;
    border: 1px solid var(--color-border);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bestiary-header {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.bestiary-avatar {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    background-color: var(--color-panel);
    border-radius: 0.25rem;
    padding: 0.25rem;
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bestiary-avatar:hover {
    border-color: var(--color-purple);
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.35);
}

.bestiary-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.bestiary-portrait-modal {
    max-width: min(92vw, 560px);
    padding: 1.25rem;
    text-align: center;
}

.bestiary-portrait-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0.75rem;
    color: white;
}

.bestiary-portrait-frame {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.bestiary-portrait-full {
    display: block;
    max-width: 100%;
    max-height: min(70vh, 720px);
    width: auto;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
    border-radius: 0.25rem;
}

.bestiary-info {
    flex-grow: 1;
}

.bestiary-name {
    font-size: 1.25rem;
    font-weight: bold;
    color: white;
}

.bestiary-hp {
    font-size: 0.9rem;
    color: var(--color-text-dim);
}

.bestiary-best-time {
    color: #ffd700;
    font-weight: bold;
    font-size: 0.8125rem;
    margin-top: 0.15rem;
    padding: 0.1rem 0;
}

.bestiary-body {
    flex-grow: 1;
}

.bestiary-section-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--color-purple);
    margin-bottom: 0.25rem;
}

.bestiary-skills-list {
    font-size: 0.85rem;
    color: var(--color-text-dim);
    list-style-position: outside;
    list-style-type: disc;
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bestiary-attributes {
    font-size: 0.85rem;
    color: var(--color-text-dim);
    border-top: 1px solid var(--color-border);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}