/* ==================== 全局隐藏滚动条 ==================== */
/* 所有元素隐藏滚动条但保留滚动功能 */
* {
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE / Edge Legacy */
}
*::-webkit-scrollbar {
    display: none;                /* Chrome / Safari / Opera */
}

/* ==================== 通用窗口系统 ==================== */

/* 遮罩层（全屏半透明背景） */
.ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    animation: ui-overlay-fade-in 0.25s ease-out forwards;
}

@keyframes ui-overlay-fade-in {
    to { opacity: 1; }
}

/* 窗口容器（基础） */
.ui-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #2a2218 0%, #1a1510 100%);
    border: 1px solid rgba(192, 160, 96, 0.3);
    border-radius: 8px;
    padding: 20px;
    z-index: 1001;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    opacity: 0;
    animation: ui-window-fade-in 0.25s ease-out forwards;
}

@keyframes ui-window-fade-in {
    to { opacity: 1; }
}

/* 窗口头部 */
.ui-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(192, 160, 96, 0.2);
}

/* 窗口标题 */
.ui-window-title {
    color: #c0a060;
    margin: 0;
    font-size: 22px;
    text-align: center;
    width: 100%;
}

/* 窗口内容区 */
.ui-window-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

/* 窗口底部操作区 */
.ui-window-footer {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(192, 160, 96, 0.2);
}

.ui-window-footer--center {
    justify-content: center;
}

.ui-window-footer--right {
    justify-content: flex-end;
}

/* 关闭按钮 */
.ui-close-btn {
    background: none;
    border: none;
    color: #8a7a6a;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    transition: color 0.2s ease;
}

.ui-close-btn:hover {
    color: #c0a060;
}

/* ==================== 通用按钮系统 ==================== */

.ui-btn {
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    font-weight: 500;
    font-family: inherit;
}

.ui-btn--primary {
    background: rgba(192, 160, 96, 0.15);
    border-color: rgba(192, 160, 96, 0.4);
    color: #c0a060;
}

.ui-btn--primary:hover {
    background: rgba(192, 160, 96, 0.25);
    border-color: rgba(192, 160, 96, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(192, 160, 96, 0.2);
}

.ui-btn--danger {
    background: rgba(139, 0, 0, 0.15);
    border-color: rgba(139, 0, 0, 0.4);
    color: #cc6666;
}

.ui-btn--danger:hover {
    background: rgba(139, 0, 0, 0.25);
    border-color: rgba(204, 102, 102, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(204, 102, 102, 0.2);
}

.ui-btn--secondary {
    background: rgba(80, 80, 80, 0.3);
    border-color: rgba(128, 128, 128, 0.4);
    color: #aaa;
}

.ui-btn--secondary:hover {
    background: rgba(100, 100, 100, 0.5);
    border-color: rgba(192, 160, 96, 0.5);
    color: #c0a060;
}

.ui-btn--block {
    display: block;
    width: 100%;
}

/* ==================== 存档槽位系统 ==================== */

.ui-save-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ui-save-slot {
    display: flex;
    align-items: center;
    padding: 15px;
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid rgba(192, 160, 96, 0.15);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease;
    gap: 10px;
}

.ui-save-slot:hover {
    background: rgba(60, 60, 60, 0.8);
    border-color: rgba(192, 160, 96, 0.35);
}

.ui-save-info {
    flex: 1;
}

.ui-save-name {
    color: #d0d0d0;
    font-weight: bold;
}

.ui-save-time {
    color: #808080;
    font-size: 12px;
}

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

/* ==================== 段落系统 ==================== */

.ui-section {
    margin-bottom: 25px;
}

.ui-section-title {
    color: #c0a060;
    font-size: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(192, 160, 96, 0.15);
}

/* ==================== 输入框系统 ==================== */

.ui-input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(192, 160, 96, 0.3);
    border-radius: 4px;
    color: #d0d0d0;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.ui-input:focus {
    outline: none;
    border-color: rgba(192, 160, 96, 0.6);
}

/* ==================== 尺寸修饰符 ==================== */

.ui-window--small {
    width: 350px;
}

.ui-window--medium {
    width: 500px;
}

.ui-window--large {
    width: 600px;
}

.ui-window--full-height {
    height: 70vh;
}

/* ==================== 章节开场/转折过场 ==================== */

.chapter-intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.6s ease;
    cursor: pointer;
}

.chapter-intro-overlay.chapter-intro-visible {
    opacity: 1;
}

.chapter-intro-overlay.chapter-intro-fading-out {
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* 背景图层 */
.chapter-intro-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1.05);
    transition: transform 8s ease-out;
}

.chapter-intro-visible .chapter-intro-bg {
    transform: scale(1.12);
}

/* 暗色遮罩（保证文字可读性） */
.chapter-intro-veil {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.75) 100%);
}

/* 内容区 */
.chapter-intro-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 80%;
    max-width: 700px;
}

/* 章节标题 */
.chapter-intro-title {
    color: #c0a060;
    font-size: 36px;
    font-weight: 600;
    margin: 0 0 30px 0;
    letter-spacing: 4px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}

/* 故事文字 */
.chapter-intro-story {
    color: #d0c8b8;
    font-size: 17px;
    line-height: 2;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}

.chapter-intro-story-line {
    margin: 0 0 8px 0;
}

/* 跳过提示 */
.chapter-intro-skip {
    position: absolute;
    bottom: 40px;
    right: 50px;
    color: #6a5a4a;
    font-size: 13px;
    letter-spacing: 1px;
    animation: chapter-intro-skip-pulse 2s ease-in-out infinite;
}

@keyframes chapter-intro-skip-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.9; }
}

/* NPC 对话窗口 */
.npc-dialog-window {
    width: 480px;
    max-width: 90vw;
}

.npc-dialog-body {
    display: flex;
    gap: 20px;
    padding: 20px;
}

.npc-portrait {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid rgba(192, 160, 96, 0.3);
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.npc-dialog-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.npc-dialog-text {
    font-size: 15px;
    line-height: 1.7;
    color: #d4c4a8;
    min-height: 80px;
    white-space: pre-wrap;
}

.npc-dialog-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.npc-next-btn {
    min-width: 100px;
}

.npc-action-area {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 主城NPC容器 */
.npc-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transform: translate(-50%, -100%);
    transition: transform 0.2s ease;
}

.npc-container:hover {
    transform: translate(-50%, -100%) translateY(-3px);
}

.npc-sprite {
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    transition: filter 0.2s ease;
}

.npc-container:hover .npc-sprite {
    filter: drop-shadow(0 4px 12px rgba(192, 160, 96, 0.5));
}

.npc-container .building-label {
    font-size: 12px;
    color: #c0a060;
    margin-top: 4px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

/* ==================== 任务追踪UI ==================== */
.quest-tracker {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    min-width: 220px;
    max-width: 280px;
    background: linear-gradient(180deg, rgba(42, 34, 24, 0.95), rgba(26, 21, 16, 0.95));
    border: 1px solid rgba(192, 160, 96, 0.3);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    padding: 12px 14px;
    z-index: 100;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.quest-tracker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(192, 160, 96, 0.2);
}

.quest-tracker__title {
    font-size: 14px;
    color: #c0a060;
    font-weight: bold;
    letter-spacing: 1px;
}

.quest-tracker__toggle {
    width: 20px;
    height: 20px;
    background: none;
    border: 1px solid rgba(192, 160, 96, 0.3);
    border-radius: 4px;
    color: #c0a060;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s ease;
}

.quest-tracker__toggle:hover {
    background: rgba(192, 160, 96, 0.15);
}

.quest-tracker__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quest-tracker__item {
    margin-bottom: 10px;
}

.quest-tracker__item:last-child {
    margin-bottom: 0;
}

.quest-tracker__name {
    font-size: 13px;
    color: #e0d0b0;
    margin-bottom: 4px;
}

.quest-tracker__objectives {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quest-tracker__objective {
    font-size: 11px;
    color: #a09070;
    padding: 2px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quest-tracker__objective--done {
    color: #80a060;
    text-decoration: line-through;
}

.quest-tracker__progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(192, 160, 96, 0.15);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.quest-tracker__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c0a060, #e0c080);
    transition: width 0.3s ease;
}

.quest-tracker__reward {
    font-size: 11px;
    color: #80a060;
    margin-top: 4px;
}

.quest-tracker__empty {
    font-size: 12px;
    color: #808080;
    text-align: center;
    padding: 10px 0;
}

.quest-tracker--collapsed .quest-tracker__list,
.quest-tracker--collapsed .quest-tracker__reward {
    display: none;
}

.quest-tracker--collapsed {
    padding-bottom: 12px;
}

/* ==================== 暗影碎片圣坛 ==================== */

.ui-window--shrine {
    width: 960px;
    max-width: 95vw;
    min-height: 680px;
    max-height: 90vh;
}

.ui-window--shrine-lore {
    width: 680px;
    max-width: 90vw;
}

.shrine-subtitle {
    text-align: center;
    font-size: 15px;
    color: #aaa;
    margin-bottom: 18px;
    padding: 14px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.shrine-progress {
    color: #FFD700;
    font-weight: bold;
    font-size: 20px;
}

.shrine-lit {
    color: #90EE90;
    font-weight: bold;
    font-size: 20px;
}

.fragment-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.fragment-card {
    background: linear-gradient(135deg, rgba(42, 34, 24, 0.9) 0%, rgba(26, 21, 16, 0.9) 100%);
    border: 2px solid #333;
    border-radius: 10px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    min-height: 230px;
}

.fragment-card.collected {
    background: linear-gradient(135deg, rgba(50, 40, 60, 0.95) 0%, rgba(30, 25, 35, 0.95) 100%);
}

.fragment-card.collected:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.fragment-card.lit {
    background: linear-gradient(135deg, rgba(60, 50, 80, 0.95) 0%, rgba(40, 30, 50, 0.95) 100%);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.fragment-image-container {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    background: rgba(0, 0, 0, 0.3);
}

.fragment-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fragment-placeholder {
    font-size: 40px;
    color: #555;
    font-weight: bold;
}

.fragment-info {
    text-align: center;
    width: 100%;
}

.fragment-hunter-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 5px;
}

.fragment-hunter {
    font-size: 14px;
    font-weight: bold;
    margin: 0;
    line-height: 1.3;
}

.fragment-level-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    padding: 1px 6px;
    border-radius: 8px;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

.fragment-level-progress {
    margin: 8px 0;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    border: 1px solid rgba(192, 160, 96, 0.1);
}

.fragment-level-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #aaa;
    margin-bottom: 5px;
    line-height: 1.3;
}

.fragment-level-progress-text b {
    color: inherit;
}

.fragment-level-bar {
    width: 100%;
    height: 6px;
    background: rgba(80, 70, 60, 0.6);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.fragment-level-bar-fill {
    height: 100%;
    transition: width 0.4s ease;
    border-radius: 3px;
}

.fragment-level-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: #777;
}

.fragment-level-bar-labels span {
    flex: 1;
    text-align: center;
}

.fragment-buff-name {
    font-size: 13px;
    margin-bottom: 5px;
    font-weight: 500;
}

.fragment-buff-desc {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
    line-height: 1.45;
}

.fragment-light-btn {
    width: 100%;
    font-size: 12px;
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 5px;
}

.fragment-light-btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.fragment-upgrade-btn {
    width: 100%;
    font-size: 12px;
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 6px;
}

.fragment-upgrade-btn:hover {
    opacity: 0.92;
    transform: scale(1.02);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
}

.fragment-lit-badge {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
}

.fragment-upgrade-wait {
    font-size: 11px;
    color: #c0a060;
    margin-bottom: 6px;
    padding: 4px 6px;
    background: rgba(192, 160, 96, 0.08);
    border: 1px solid rgba(192, 160, 96, 0.18);
    border-radius: 4px;
}

.fragment-lore-btn {
    background: transparent;
    border: 1px solid #555;
    color: #aaa;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 5px;
}

.fragment-lore-btn:hover {
    border-color: #c0a060;
    color: #c0a060;
}

.fragment-lock-desc {
    font-size: 11px;
    color: #555;
}

.shrine-buffs-section {
    margin-top: 8px;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.shrine-buffs-section h3 {
    font-size: 15px;
    color: #FFD700;
    margin-bottom: 12px;
    text-align: center;
}

.shrine-buffs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
}

.shrine-buff-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.35);
    border-left: 3px solid;
    border-radius: 4px;
    font-size: 12px;
}

.buff-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.buff-name {
    font-weight: bold;
    min-width: 90px;
    font-size: 13px;
}

.buff-desc {
    color: #aaa;
    flex: 1;
    line-height: 1.4;
}

/* 背景故事弹窗 */
.fragment-lore-content {
    display: flex;
    gap: 20px;
    padding: 10px 5px 20px;
}

.lore-image-container {
    flex-shrink: 0;
    width: 180px;
    height: 180px;
    border: 3px solid;
    border-radius: 12px;
    overflow: hidden;
}

.lore-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lore-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.lore-text h3 {
    margin-bottom: 12px;
    font-size: 18px;
}

.lore-text p {
    font-size: 14px;
    color: #ccc;
    line-height: 1.7;
    margin-bottom: 15px;
    flex: 1;
}

.lore-detail {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: #888;
    margin-top: auto;
}

.lore-detail span {
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 14px;
    border-radius: 5px;
}
