/* ===================== 全局通用样式 (所有页面共享) ===================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 粒子背景 (所有页面共享) */
#particle-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background:
        radial-gradient(ellipse at 22% 18%, rgba(70, 80, 130, 0.24), transparent 48%),
        radial-gradient(ellipse at 78% 82%, rgba(50, 35, 90, 0.2), transparent 44%),
        radial-gradient(ellipse at 50% 55%, rgba(40, 40, 70, 0.1), transparent 55%),
        #000;
    z-index: -1;
}

#particle-bg canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 标题样式 (所有页面共享) */
.title {
    color: #fff;
    font-size: 48px;
    margin-bottom: 30px;
    letter-spacing: 2px;
    text-shadow: 0 0 10px #fff, 0 0 20px #fff;
}

/* 视图切换 */
.view {
    display: none !important;
}

.view.active {
    display: block !important;
}

#home-view.active {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    width: 100%;
}

.chronicle-view:not(.active),
.rules-view:not(.active),
.stories-view:not(.active) {
    display: none !important;
}

.lore-view:not(.active) {
    display: none !important;
}

.tools-view:not(.active),
.origin-view:not(.active),
.dice-view:not(.active),
.battlemap-view:not(.active),
.charsheet-view:not(.active),
.industry-view:not(.active) {
    display: none !important;
}

.chronicle-view.active {
    display: flex !important;
    flex-direction: column;
    position: relative;
    z-index: 20;
    background: transparent;
}

/* 右上角登录栏 */
.site-version-badge {
    position: fixed;
    left: 16px;
    top: 16px;
    z-index: 140;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.82);
    font-size: 11px;
    letter-spacing: 0.3px;
    cursor: default;
    user-select: none;
    max-width: min(92vw, 360px);
    line-height: 1.35;
}

.site-version-badge-tip {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(12, 12, 18, 0.96);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    color: rgba(240, 240, 245, 0.92);
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-line;
    pointer-events: none;
}

.site-version-badge:hover .site-version-badge-tip,
.site-version-badge:focus-visible .site-version-badge-tip {
    display: block;
}

.site-version-badge--behind {
    border-color: rgba(255, 200, 80, 0.45);
    color: #ffd89a;
}

.auth-bar {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 150;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 8px;
    max-width: calc(100vw - 32px);
    pointer-events: none;
}

.auth-guest,
.auth-user {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    max-width: min(480px, calc(100vw - 32px));
    padding: 4px 6px;
    border-radius: 22px;
    background: rgba(0, 0, 0, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    pointer-events: auto;
}

.auth-user.hidden,
.auth-guest.hidden {
    display: none;
}

.content-edit-toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.82);
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    backdrop-filter: blur(8px);
    flex-shrink: 0;
}

.content-edit-toggle-wrap.hidden {
    display: none;
}

.content-edit-toggle-wrap:has(.content-edit-toggle-input:checked) {
    border-color: rgba(158, 197, 255, 0.55);
    background: rgba(80, 120, 200, 0.22);
    color: #e8f0ff;
}

.content-edit-toggle-input {
    margin: 0;
    accent-color: #9ec5ff;
    cursor: pointer;
}

.content-edit-toggle-label {
    white-space: nowrap;
}

.auth-btn {
    padding: 8px 16px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    flex-shrink: 0;
    white-space: nowrap;
}

.auth-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.25);
}

.auth-username {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    max-width: 168px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.auth-username:hover {
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

.auth-gated.hidden {
    display: none !important;
}

.book-admin-only.hidden {
    display: none !important;
}

.action-bar.hidden {
    display: none;
}

/* ===================== 主页面专属样式 (.index-page) ===================== */
.index-page {
    font-family: "Microsoft YaHei", sans-serif;
    overflow: hidden;
}

.index-page .home-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: min(700px, 92vw);
    max-height: 90vh;
    overflow: visible;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

body:has(#auth-user:not(.hidden)) .index-page .home-content {
    top: calc(50% + 24px);
    max-height: calc(90vh - 48px);
    padding-top: 44px;
}

body:has(#content-edit-toggle-wrap:not(.hidden)) .index-page .home-content {
    top: calc(50% + 32px);
    max-height: calc(90vh - 56px);
    padding-top: 52px;
}

.home-center {
    flex-shrink: 0;
    width: 100%;
    overflow: visible;
    overflow-y: auto;
    max-height: calc(90vh - 40px);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.home-center .title {
    margin-bottom: 30px;
}

.home-scroll {
    position: relative;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    max-height: min(52vh, 480px);
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 12px;
    padding: 20px 8px 24px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 28px,
        #000 calc(100% - 28px),
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 28px,
        #000 calc(100% - 28px),
        transparent 100%
    );
}

.home-scroll.hidden {
    display: none;
}

.home-content.is-searching .home-scroll {
    overflow-x: hidden;
    padding-left: 8px;
    padding-right: 8px;
}

.entry-list--arknights {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    padding: 8px 0;
}

.entry-card--arknights {
    position: relative;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 18px 0 20px;
    margin: 0;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    overflow: hidden;
    outline: none;
    transition: border-color 0.25s ease;
}

.entry-card--arknights:last-child {
    border-bottom: none;
}

.entry-card-aside {
    position: relative;
    width: 96px;
    flex-shrink: 0;
}

.entry-card--arknights::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, transparent, rgba(0, 210, 220, 0.35), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.entry-card--arknights:hover::before,
.entry-card--arknights:focus-visible::before {
    opacity: 1;
}

.entry-card-watermark {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    max-width: min(48%, 280px);
    font-size: clamp(36px, 7vw, 64px);
    font-weight: 900;
    letter-spacing: 0.12em;
    line-height: 1;
    color: rgba(0, 195, 210, 0.07);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    opacity: 0;
    z-index: 0;
    user-select: none;
    transition: opacity 0.35s ease, color 0.35s ease;
}

.entry-card--arknights:hover .entry-card-watermark,
.entry-card--arknights:focus-visible .entry-card-watermark {
    opacity: 1;
    color: rgba(0, 210, 225, 0.14);
}

.entry-card-float-media {
    position: relative;
    left: auto;
    top: auto;
    width: 88px;
    height: 88px;
    margin: 0 auto;
    transform: scale(1);
    opacity: 1;
    pointer-events: none;
    z-index: 4;
    border: none;
    background: transparent;
    box-shadow: none;
    transition: transform 0.28s ease;
}

.entry-card-float-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: transparent;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.42));
}

.entry-card-float-media--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 200, 215, 0.22);
    background:
        linear-gradient(145deg, rgba(0, 180, 200, 0.18), rgba(8, 12, 20, 0.95)),
        rgba(8, 12, 18, 0.95);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.entry-card-float-media--placeholder span {
    font-size: 32px;
    font-weight: 800;
    color: rgba(180, 235, 245, 0.75);
    text-shadow: 0 0 16px rgba(0, 200, 220, 0.4);
}

.entry-card--arknights:hover .entry-card-float-media,
.entry-card--arknights:focus-visible .entry-card-float-media {
    transform: scale(1.04);
}

.entry-card--arknights:hover .entry-card-float-media img,
.entry-card--arknights:focus-visible .entry-card-float-media img {
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5));
}

.entry-card-cursor-preview {
    position: fixed;
    left: 0;
    top: 0;
    width: 168px;
    height: 168px;
    z-index: 10050;
    pointer-events: none;
    border: none;
    background: transparent;
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%);
    transition: opacity 0.16s ease, visibility 0.16s ease;
}

.entry-card-cursor-preview.is-visible {
    opacity: 1;
    visibility: visible;
}

.entry-card-cursor-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: transparent;
    filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.48));
}

.entry-card-cursor-preview--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 200, 215, 0.22);
    background:
        linear-gradient(145deg, rgba(0, 180, 200, 0.18), rgba(8, 12, 20, 0.95)),
        rgba(8, 12, 18, 0.96);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.entry-card-cursor-preview--placeholder span {
    font-size: 48px;
    font-weight: 800;
    color: rgba(180, 235, 245, 0.75);
    text-shadow: 0 0 16px rgba(0, 200, 220, 0.4);
}

body.entry-cursor-hidden,
body.entry-cursor-hidden * {
    cursor: none !important;
}

@media (hover: none) {
    .entry-card-cursor-preview {
        display: none !important;
    }
}

.entry-card-body {
    position: relative;
    z-index: 2;
    min-width: 0;
}

.entry-card-title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}

.entry-card--arknights .entry-card-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.42);
    transition: color 0.25s ease, text-shadow 0.25s ease, transform 0.25s ease;
}

.entry-card--arknights:hover .entry-card-title,
.entry-card--arknights:focus-visible .entry-card-title {
    color: #fff;
    text-shadow: 0 0 28px rgba(255, 255, 255, 0.28), 0 2px 12px rgba(0, 0, 0, 0.45);
    transform: translateX(6px);
}

.entry-card--arknights .entry-card-preview {
    margin: 0;
    color: rgba(255, 255, 255, 0.38);
    font-size: 13px;
    line-height: 1.65;
    transition: color 0.25s ease;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    word-break: break-word;
}

.entry-card--arknights:hover .entry-card-preview,
.entry-card--arknights:focus-visible .entry-card-preview {
    color: rgba(255, 255, 255, 0.58);
}

.entry-card--arknights .entry-card-tags {
    margin-top: 10px;
}

.entry-card--arknights .tag {
    border-radius: 0;
    clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: none;
}

.home-scroll .entry-list {
    padding: 0;
}

.home-scroll .entry-card--arknights {
    padding: 22px 0 24px;
    background: transparent;
    box-shadow: none;
}

.home-scroll .entry-card--arknights:hover,
.home-scroll .entry-card--arknights:focus-visible {
    background: linear-gradient(90deg, rgba(0, 200, 215, 0.06), transparent 55%);
    box-shadow: none;
    transform: none;
}

@media (max-width: 560px) {
    .entry-card--arknights {
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 10px;
    }

    .entry-card-aside {
        width: 72px;
    }

    .entry-card-float-media {
        width: 64px;
        height: 64px;
    }

    .entry-card-watermark {
        font-size: 28px;
        max-width: 45%;
    }

    .entry-card--arknights .entry-card-title {
        font-size: 17px;
    }
}

.search-empty {
    margin: 0;
    padding: 28px 12px;
    text-align: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.06em;
}

.home-scroll::-webkit-scrollbar {
    width: 4px;
}

.home-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 4px;
}

.home-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

.home-content.is-searching {
    justify-content: flex-start;
    padding-top: 6vh;
    max-height: 92vh;
    width: min(820px, 94vw);
}

.home-content.is-searching .home-center .title {
    margin-bottom: 20px;
}

.home-content.is-searching .library-portals {
    display: none;
}

.home-content.is-searching .action-bar:not(.hidden) {
    margin-top: 12px;
}

.entry-list.hidden {
    display: none;
}

/* 词条列表 */
.entry-list {
    text-align: left;
}

.recent-time {
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
    margin-top: 6px;
}

/* 主页面搜索栏 */
.search-wrap {
    position: relative;
    width: min(500px, 100%);
    margin: 0 auto 20px;
    overflow: visible;
    z-index: 40;
}

.index-page .search-box {
    display: flex;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    height: 50px;
    gap: 10px;
}

.search-field {
    position: relative;
    flex: 1;
    min-width: 0;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.55);
    display: flex;
    pointer-events: none;
}

.index-page .search-input {
    width: 100%;
    height: 100%;
    padding: 0 15px 0 42px;
    border: 2px solid #fff;
    border-radius: 25px;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.browse-history-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: rgba(18, 18, 22, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    z-index: 100;
    overflow: hidden;
    text-align: left;
}

.browse-history-dropdown.hidden {
    display: none;
}

.browse-history-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
}

.browse-history-list::-webkit-scrollbar {
    width: 5px;
}

.browse-history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 3px;
}

.browse-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.browse-history-item:last-child {
    margin-bottom: 0;
}

.browse-history-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.08);
}

.browse-history-icon {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.45);
    display: flex;
}

.browse-history-text {
    flex: 1;
    min-width: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.browse-history-delete {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.35);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.45;
}

.browse-history-item:hover .browse-history-delete {
    opacity: 1;
}

.browse-history-delete:hover {
    border-color: rgba(255, 107, 107, 0.45);
    background: rgba(255, 107, 107, 0.12);
    color: #ff8a80;
}

.browse-history-footer {
    padding: 8px 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.browse-history-footer.hidden {
    display: none;
}

.browse-history-clear-all {
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.52);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.browse-history-clear-all:hover {
    background: rgba(255, 107, 107, 0.1);
    color: #ff8a80;
}

.index-page .search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.index-page .search-input:focus {
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px #fff;
}

.index-page .search-btn {
    flex-shrink: 0;
    width: auto;
    min-width: 72px;
    height: 100%;
    padding: 0 18px;
    border: none;
    border-radius: 25px;
    background-color: #fff;
    color: #000;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.index-page .search-btn:hover {
    background-color: #f0f0f0;
    box-shadow: 0 0 10px #fff;
}

/* 操作按钮栏 */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 0;
}

.action-btn {
    padding: 10px 20px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 25px;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.action-btn.primary {
    background-color: #fff;
    color: #000;
    border-color: #fff;
    font-weight: bold;
}

.action-btn.primary:hover {
    background-color: #f0f0f0;
    box-shadow: 0 0 10px #fff;
}

.action-btn.danger {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.action-btn.danger:hover {
    background-color: rgba(255, 107, 107, 0.15);
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

/* 工具页：登录后为顶部留空，避免右上角登录栏遮挡标题 */
body:has(#auth-user:not(.hidden)) .dice-scroll,
body:has(#auth-user:not(.hidden)) .origin-scroll,
body:has(#auth-user:not(.hidden)) .industry-scroll,
body:has(#auth-user:not(.hidden)) .charsheet-scroll {
    padding-top: 56px;
}

body:has(#auth-user:not(.hidden)) .battlemap-topbar {
    padding-top: 52px;
    padding-right: clamp(12px, 28vw, 260px);
    flex-wrap: wrap;
    gap: 12px;
}

.entry-list-empty {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 30px 0;
    font-size: 15px;
}

.entry-card:not(.entry-card--arknights) {
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
}

.entry-card:not(.entry-card--arknights):hover {
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.entry-card-header .entry-card-title {
    margin-bottom: 0;
}

.entry-card-title {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 6px;
}

.entry-card-preview {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.entry-card-tags {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
    transition: box-shadow 0.2s ease;
}

.tag-meta {
    background-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.75);
    border-color: rgba(255, 255, 255, 0.25);
}

.tag-forge-accessory {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.22), rgba(255, 152, 0, 0.12));
    color: #ffd54f;
    border-color: rgba(255, 193, 7, 0.45);
    text-shadow: 0 0 8px rgba(255, 193, 7, 0.35);
}

.tag-forge-melee {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.22), rgba(183, 28, 28, 0.12));
    color: #ff8a80;
    border-color: rgba(244, 67, 54, 0.45);
    text-shadow: 0 0 8px rgba(244, 67, 54, 0.35);
}

.tag-forge-ranged {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.22), rgba(46, 125, 50, 0.12));
    color: #a5d6a7;
    border-color: rgba(76, 175, 80, 0.45);
    text-shadow: 0 0 8px rgba(76, 175, 80, 0.35);
}

.tag-forge-staff {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.22), rgba(106, 27, 154, 0.12));
    color: #ce93d8;
    border-color: rgba(156, 39, 176, 0.45);
    text-shadow: 0 0 8px rgba(156, 39, 176, 0.35);
}

.tag-forge-armor {
    background: linear-gradient(135deg, rgba(96, 125, 139, 0.28), rgba(69, 90, 100, 0.14));
    color: #b0bec5;
    border-color: rgba(144, 164, 174, 0.5);
    text-shadow: 0 0 8px rgba(176, 190, 197, 0.35);
}

.tag-magic {
    background: linear-gradient(135deg, rgba(3, 169, 244, 0.22), rgba(0, 188, 212, 0.12));
    color: #4dd0e1;
    border-color: rgba(3, 169, 244, 0.45);
    text-shadow: 0 0 10px rgba(3, 169, 244, 0.4);
}

.tag-edible {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.2), rgba(255, 87, 34, 0.12));
    color: #ffcc80;
    border-color: rgba(255, 152, 0, 0.4);
}

.tag-survival {
    background: linear-gradient(135deg, rgba(102, 187, 106, 0.22), rgba(56, 142, 60, 0.12));
    color: #81c784;
    border-color: rgba(102, 187, 106, 0.45);
    text-shadow: 0 0 8px rgba(102, 187, 106, 0.3);
}

.tag-nosale {
    background: linear-gradient(135deg, rgba(239, 83, 80, 0.18), rgba(198, 40, 40, 0.1));
    color: #ef9a9a;
    border-color: rgba(239, 83, 80, 0.4);
    border-style: dashed;
}

.tag-custom {
    background-color: rgba(79, 195, 247, 0.2);
    color: #4fc3f7;
    border-color: rgba(79, 195, 247, 0.4);
}

.entry-card-tags .tag:hover,
.entry-meta .tag:hover {
    box-shadow: 0 0 12px currentColor;
}

/* ===================== 子页面专属样式 (.result-page) ===================== */
.result-page {
    font-family: "Microsoft YaHei", sans-serif;
    overflow: hidden;
}

.result-page .scroll-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0 100px;
    scrollbar-width: thin;
    scrollbar-color: #fff rgba(0, 0, 0, 0.3);
}

.result-page .scroll-container::-webkit-scrollbar {
    width: 8px;
}

.result-page .scroll-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.result-page .scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
}

.result-page .scroll-container::-webkit-scrollbar-thumb:hover {
    background: #fff;
}

.result-page .content {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    padding: 0 20px;
}

.result-page .result-content {
    color: #fff;
    font-size: 18px;
    line-height: 1.8;
    text-align: left;
    padding: 20px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    word-break: break-word;
}

.result-page .result-content .entry-text {
    white-space: pre-wrap;
}

.entry-images {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    background: transparent;
}

.entry-image {
    max-width: 100%;
    max-height: 420px;
    border-radius: 0;
    border: none;
    box-shadow: none;
    object-fit: contain;
    background: transparent;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.38));
    transition: opacity 0.25s ease;
}

.entry-image.wiki-alpha-processing {
    opacity: 0.88;
}

.entry-card-float-media img.wiki-alpha-done,
.entry-card-cursor-preview img.wiki-alpha-done,
.forging-material-image.wiki-alpha-done,
.forging-catalog-thumb.wiki-alpha-done {
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.38));
}

.entry-card-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-right: 12px;
    flex-shrink: 0;
}

.entry-card-header {
    display: flex;
    align-items: center;
}

.image-upload-area {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.image-upload-hint {
    color: rgba(255, 255, 255, 0.45);
    font-size: 13px;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.image-preview-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    aspect-ratio: 1;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #ff6b6b;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-remove:hover {
    background: rgba(255, 107, 107, 0.8);
    color: #fff;
}

.entry-meta {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    margin: -20px 0 20px;
    text-align: center;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 30px;
}

/* 编辑表单 */
.edit-form {
    text-align: left;
    max-width: 700px;
    margin: 0 auto;
}

.form-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 8px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-input:focus,
.form-textarea:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: #fff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

.form-textarea {
    min-height: 300px;
    resize: vertical;
    line-height: 1.6;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
}

/* 确认弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal.hidden {
    display: none;
}

.modal-box {
    background-color: rgba(20, 20, 20, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 30px 40px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

.modal-box-form {
    text-align: left;
    width: min(400px, 92vw);
}

.modal-box-wide {
    text-align: left;
    width: min(560px, 94vw);
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-title {
    color: #fff;
    font-size: 22px;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form-inline {
    gap: 10px;
}

.add-user-form {
    gap: 0;
}

.add-user-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.add-user-fields .form-input {
    margin-bottom: 0;
}

.add-user-fields #new-user-role-picker {
    grid-column: 1 / -1;
}

.add-user-actions {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    justify-content: center;
}

.add-user-actions .action-btn {
    min-width: 160px;
}

.account-modal-footer {
    display: flex;
    justify-content: center;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.account-modal-footer .action-btn {
    min-width: 120px;
}

.login-hint {
    color: rgba(255, 255, 255, 0.45);
    font-size: 12px;
    margin: 4px 0 8px;
}

.users-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    margin: 20px 0 12px;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-row {
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.user-row-admin {
    border-color: rgba(255, 255, 255, 0.25);
}

.user-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.user-name {
    color: #fff;
    font-size: 15px;
    font-weight: bold;
}

.user-badge {
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
}

.user-desc {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    margin: 0;
}

.user-row-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.user-row-actions .action-btn {
    padding: 6px 14px;
    font-size: 12px;
}

.user-badge-supreme {
    background: rgba(255, 215, 120, 0.2);
    color: #ffe082;
}

.users-intro {
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    line-height: 1.5;
    margin: -8px 0 16px;
}

.user-role-select {
    min-width: 120px;
    padding: 6px 10px;
    font-size: 13px;
}

/* 自定义权限选择器 */
.role-picker {
    position: relative;
    min-width: 180px;
    flex: 1;
}

.role-picker-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.role-picker-trigger:hover,
.role-picker.open .role-picker-trigger {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.08);
}

.role-picker-arrow {
    color: rgba(255, 255, 255, 0.55);
    display: flex;
    transition: transform 0.2s ease;
}

.role-picker.open .role-picker-arrow {
    transform: rotate(180deg);
}

.role-picker-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 240px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    background: rgba(16, 16, 20, 0.96);
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.role-picker.open .role-picker-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.role-picker-option {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #fff;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.role-picker-option:hover,
.role-picker-option.selected {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.role-picker-desc {
    color: rgba(255, 255, 255, 0.45);
    font-size: 12px;
    line-height: 1.4;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.role-badge-supreme {
    color: #ffe082;
    background: rgba(255, 193, 7, 0.12);
    border-color: rgba(255, 193, 7, 0.35);
    box-shadow: 0 0 12px rgba(255, 193, 7, 0.12);
}

.role-badge-deity {
    color: #80deea;
    background: rgba(0, 188, 212, 0.12);
    border-color: rgba(0, 188, 212, 0.35);
    box-shadow: 0 0 12px rgba(0, 188, 212, 0.1);
}

.role-badge-viewer {
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

#new-user-role-picker {
    flex: 1 1 180px;
    min-width: 180px;
}

#new-user-role-picker .role-picker {
    width: 100%;
}

.user-admin-controls-role {
    align-items: stretch;
}

.user-row,
.user-admin-block,
.user-admin-controls-role {
    overflow: visible;
}

.users-add-section {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.account-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.account-tabs.hidden {
    display: none;
}

.account-tab {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.account-tab.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    font-weight: bold;
}

.account-panel.hidden {
    display: none;
}

.account-panel.active {
    display: block;
}

.users-empty {
    padding: 24px 16px;
    text-align: center;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.users-empty-hint {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.5;
}

.user-admin-block {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-admin-block .form-label {
    margin-bottom: 8px;
    font-size: 13px;
}

.user-admin-danger {
    border-top-color: rgba(255, 107, 107, 0.2);
}

.user-row .user-badge {
    display: inline-block;
    margin-top: 6px;
    width: fit-content;
}

.account-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
}

.account-section:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.user-account {
    color: rgba(255, 255, 255, 0.45);
    font-size: 12px;
}

.user-admin-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 10px 0;
}

.user-admin-controls .form-input,
.user-admin-controls .action-btn {
    padding: 6px 12px;
    font-size: 12px;
}

.user-new-password {
    min-width: 120px;
}

.modal-text {
    color: #fff;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* 提示消息 */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 28px;
    border-radius: 25px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    font-size: 14px;
    z-index: 200;
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ===================== 响应式适配 ===================== */
@media (max-width: 550px) {
    .auth-bar {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .auth-guest,
    .auth-user {
        width: 100%;
        max-width: none;
        justify-content: flex-end;
    }

    .auth-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .auth-username {
        max-width: 120px;
    }

    body:has(#auth-user:not(.hidden)) .index-page .home-content {
        top: calc(50% + 40px);
        padding-top: 64px;
        width: min(700px, 96vw);
    }

    .search-wrap {
        width: 100%;
    }

    .index-page .search-box {
        width: 100%;
    }

    .index-page .title,
    .result-page .title {
        font-size: 36px;
    }

    .result-page .result-content {
        font-size: 16px;
        padding: 14px;
    }

    .result-page .scroll-container {
        padding: 10px 0 80px;
    }

    .action-bar {
        flex-direction: column;
        align-items: center;
    }

    .action-btn {
        width: 80%;
    }

    .add-user-fields {
        grid-template-columns: 1fr;
    }

    .add-user-actions .action-btn,
    .account-modal-footer .action-btn {
        width: 100%;
        max-width: 280px;
    }
}

/* ===================== 典籍入口 ===================== */
.library-portals {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 520px;
    margin: 28px auto 0;
}

.library-portal {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 20px;
    border-radius: 18px;
    color: #fff;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    backdrop-filter: blur(10px);
}

.library-portal:hover {
    transform: translateY(-2px);
}

.library-portal-glow {
    position: absolute;
    inset: -40%;
    pointer-events: none;
}

.library-portal-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 22px;
}

.library-portal-label {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.library-portal-title {
    font-size: 18px;
    letter-spacing: 3px;
}

.library-portal-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.62);
    letter-spacing: 1px;
}

.library-portal-arrow {
    flex-shrink: 0;
    font-size: 18px;
}

.chronicle-portal {
    border: 1px solid rgba(212, 175, 95, 0.45);
    background:
        linear-gradient(135deg, rgba(212, 175, 95, 0.14), rgba(120, 80, 20, 0.08)),
        rgba(255, 255, 255, 0.04);
}

.chronicle-portal:hover {
    border-color: rgba(255, 215, 130, 0.75);
    box-shadow: 0 0 28px rgba(212, 175, 95, 0.25), inset 0 0 24px rgba(212, 175, 95, 0.08);
}

.chronicle-portal .library-portal-glow {
    background: radial-gradient(circle, rgba(255, 210, 120, 0.18), transparent 60%);
}

.chronicle-portal .library-portal-icon {
    background: rgba(212, 175, 95, 0.18);
    color: #ffd98a;
    box-shadow: 0 0 16px rgba(212, 175, 95, 0.35);
}

.chronicle-portal .library-portal-title {
    color: #ffe8b8;
    text-shadow: 0 0 12px rgba(255, 215, 130, 0.35);
}

.chronicle-portal .library-portal-arrow {
    color: rgba(255, 215, 130, 0.85);
}

.rules-portal {
    border: 1px solid rgba(96, 196, 255, 0.42);
    background:
        linear-gradient(135deg, rgba(64, 164, 255, 0.14), rgba(20, 60, 120, 0.08)),
        rgba(255, 255, 255, 0.04);
}

.rules-portal:hover {
    border-color: rgba(130, 210, 255, 0.75);
    box-shadow: 0 0 28px rgba(64, 164, 255, 0.22), inset 0 0 24px rgba(64, 164, 255, 0.08);
}

.rules-portal .library-portal-glow {
    background: radial-gradient(circle, rgba(120, 200, 255, 0.16), transparent 60%);
}

.rules-portal .library-portal-icon {
    background: rgba(64, 164, 255, 0.18);
    color: #9fdcff;
    box-shadow: 0 0 16px rgba(64, 164, 255, 0.35);
}

.rules-portal .library-portal-title {
    color: #d8f0ff;
    text-shadow: 0 0 12px rgba(130, 210, 255, 0.35);
}

.rules-portal .library-portal-arrow {
    color: rgba(159, 220, 255, 0.85);
}

.stories-portal {
    border: 1px solid rgba(220, 140, 170, 0.42);
    background:
        linear-gradient(135deg, rgba(200, 110, 150, 0.14), rgba(90, 30, 70, 0.08)),
        rgba(255, 255, 255, 0.04);
}

.stories-portal:hover {
    border-color: rgba(255, 180, 210, 0.75);
    box-shadow: 0 0 28px rgba(220, 120, 170, 0.22), inset 0 0 24px rgba(220, 120, 170, 0.08);
}

.stories-portal .library-portal-glow {
    background: radial-gradient(circle, rgba(255, 160, 200, 0.16), transparent 60%);
}

.stories-portal .library-portal-icon {
    background: rgba(220, 120, 170, 0.18);
    color: #ffc8e0;
    box-shadow: 0 0 16px rgba(220, 120, 170, 0.35);
}

.stories-portal .library-portal-title {
    color: #ffe0f0;
    text-shadow: 0 0 12px rgba(255, 180, 210, 0.35);
}

.stories-portal .library-portal-arrow {
    color: rgba(255, 190, 220, 0.85);
}

.lore-portal {
    border: 1px solid rgba(90, 190, 150, 0.42);
    background:
        linear-gradient(135deg, rgba(60, 160, 120, 0.14), rgba(20, 70, 50, 0.08)),
        rgba(255, 255, 255, 0.04);
}

.lore-portal:hover {
    border-color: rgba(130, 230, 180, 0.75);
    box-shadow: 0 0 28px rgba(60, 180, 130, 0.22), inset 0 0 24px rgba(60, 180, 130, 0.08);
}

.lore-portal .library-portal-glow {
    background: radial-gradient(circle, rgba(120, 220, 170, 0.16), transparent 60%);
}

.lore-portal .library-portal-icon {
    background: rgba(60, 180, 130, 0.18);
    color: #b8f0d8;
    box-shadow: 0 0 16px rgba(60, 180, 130, 0.35);
}

.lore-portal .library-portal-title {
    color: #d8ffee;
    text-shadow: 0 0 12px rgba(120, 220, 170, 0.35);
}

.lore-portal .library-portal-arrow {
    color: rgba(160, 240, 200, 0.85);
}

.notes-portal {
    border: 1px solid rgba(160, 140, 220, 0.38);
    background:
        linear-gradient(135deg, rgba(100, 80, 180, 0.14), rgba(50, 40, 100, 0.1)),
        rgba(255, 255, 255, 0.04);
}

.notes-portal:hover {
    border-color: rgba(190, 170, 255, 0.65);
    box-shadow: 0 0 28px rgba(120, 100, 220, 0.22);
}

.notes-portal .library-portal-glow {
    background: radial-gradient(circle, rgba(150, 130, 255, 0.16), transparent 60%);
}

.notes-portal .library-portal-icon {
    background: rgba(100, 80, 200, 0.22);
    color: #d8ccff;
    box-shadow: 0 0 16px rgba(120, 100, 220, 0.28);
}

.notes-portal .library-portal-title {
    color: #ece4ff;
}

.expansion-portal {
    border: 1px solid rgba(220, 160, 100, 0.38);
    background:
        linear-gradient(135deg, rgba(180, 100, 40, 0.14), rgba(80, 50, 20, 0.1)),
        rgba(255, 255, 255, 0.04);
}

.expansion-portal:hover {
    border-color: rgba(255, 190, 120, 0.65);
    box-shadow: 0 0 28px rgba(220, 140, 60, 0.22);
}

.expansion-portal .library-portal-glow {
    background: radial-gradient(circle, rgba(255, 160, 80, 0.16), transparent 60%);
}

.expansion-portal .library-portal-icon {
    background: rgba(200, 120, 40, 0.22);
    color: #ffe4c8;
    box-shadow: 0 0 16px rgba(220, 140, 60, 0.28);
}

.expansion-portal .library-portal-title {
    color: #fff0e0;
}

.races-portal {
    border: 1px solid rgba(140, 180, 220, 0.38);
    background:
        linear-gradient(135deg, rgba(60, 100, 160, 0.14), rgba(30, 50, 90, 0.1)),
        rgba(255, 255, 255, 0.04);
}

.races-portal:hover {
    border-color: rgba(160, 210, 255, 0.65);
    box-shadow: 0 0 28px rgba(100, 160, 220, 0.22);
}

.races-portal .library-portal-glow {
    background: radial-gradient(circle, rgba(120, 180, 255, 0.16), transparent 60%);
}

.races-portal .library-portal-icon {
    background: rgba(80, 130, 200, 0.22);
    color: #d8ecff;
    box-shadow: 0 0 16px rgba(100, 160, 220, 0.28);
}

.races-portal .library-portal-title {
    color: #e8f4ff;
}

/* ===================== 编年史视图 ===================== */
body.chronicle-mode #particle-bg {
    background:
        radial-gradient(ellipse at 20% 10%, rgba(80, 50, 10, 0.35), transparent 45%),
        radial-gradient(ellipse at 80% 90%, rgba(40, 20, 80, 0.25), transparent 40%),
        #000;
}

.chronicle-view {
    height: 100vh;
    overflow: hidden;
    padding: 0;
}

.chronicle-scroll {
    flex: 1;
    min-height: 0;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 72px 20px 40px;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 95, 0.55) rgba(0, 0, 0, 0.25);
}

.chronicle-scroll::-webkit-scrollbar {
    width: 8px;
}

.chronicle-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.25);
}

.chronicle-scroll::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 95, 0.45);
    border-radius: 4px;
}

.chronicle-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 130, 0.65);
}

.chronicle-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
    max-width: 1280px;
    margin: 0 auto;
    align-items: start;
}

.chronicle-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: calc(100vh - 220px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(212, 175, 95, 0.28);
    border-radius: 20px;
    background: rgba(8, 8, 12, 0.72);
    backdrop-filter: blur(14px);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.45);
}

.chronicle-sidebar-head {
    padding: 22px 18px 16px;
    border-bottom: 1px solid rgba(212, 175, 95, 0.18);
    background: linear-gradient(180deg, rgba(212, 175, 95, 0.1), transparent);
}

.chronicle-sidebar-kicker {
    font-size: 11px;
    letter-spacing: 4px;
    color: rgba(255, 215, 130, 0.7);
    margin-bottom: 8px;
}

.chronicle-sidebar-title {
    font-size: 24px;
    color: #ffe8b8;
    letter-spacing: 4px;
    text-shadow: 0 0 14px rgba(255, 215, 130, 0.25);
    margin-bottom: 8px;
}

.chronicle-sidebar-sub {
    font-size: 12px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.55);
}

/* 典籍侧栏搜索 */
.book-sidebar-search {
    position: relative;
    padding: 12px 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.chronicle-search {
    border-bottom-color: rgba(212, 175, 95, 0.16);
}

.rules-search {
    border-bottom-color: rgba(96, 196, 255, 0.16);
}

.book-sidebar-search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.book-sidebar-search-icon {
    position: absolute;
    left: 12px;
    color: rgba(255, 255, 255, 0.45);
    pointer-events: none;
    display: flex;
}

.book-sidebar-search-input {
    width: 100%;
    padding: 10px 34px 10px 36px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chronicle-search .book-sidebar-search-input:focus {
    border-color: rgba(212, 175, 95, 0.55);
    box-shadow: 0 0 0 2px rgba(212, 175, 95, 0.12);
}

.rules-search .book-sidebar-search-input:focus {
    border-color: rgba(96, 196, 255, 0.55);
    box-shadow: 0 0 0 2px rgba(64, 164, 255, 0.12);
}

.book-sidebar-search-input::placeholder {
    color: rgba(255, 255, 255, 0.38);
}

.book-sidebar-search-clear {
    position: absolute;
    right: 8px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}

.book-sidebar-search-clear.hidden {
    display: none;
}

.book-search-results {
    margin-top: 8px;
    max-height: 220px;
    overflow-y: auto;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    scrollbar-width: thin;
}

.book-search-results.hidden {
    display: none;
}

.book-search-list {
    list-style: none;
    margin: 0;
    padding: 4px;
}

.book-search-hit {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease;
}

.chronicle-search .book-search-hit:hover {
    background: rgba(212, 175, 95, 0.12);
}

.rules-search .book-search-hit:hover {
    background: rgba(64, 164, 255, 0.12);
}

.book-search-hit-group {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 1px;
}

.book-search-hit-title {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

.book-search-empty {
    padding: 10px 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
}

/* 典籍正文内链 */
.wiki-book-link {
    display: inline;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    font: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.wiki-book-link-rules {
    color: #9fdcff;
}

.wiki-book-link-rules:hover {
    color: #d8f0ff;
    text-shadow: 0 0 10px rgba(120, 200, 255, 0.35);
}

.wiki-book-link-chronicle {
    color: #e8c88a;
}

.wiki-book-link-chronicle:hover {
    color: #ffecc8;
    text-shadow: 0 0 10px rgba(255, 200, 90, 0.35);
}

.wiki-book-link-races,
.wiki-book-link-lore,
.wiki-book-link-notes,
.wiki-book-link-expansion,
.wiki-book-link-stories {
    color: #c8e8d8;
}

.wiki-book-link-races:hover,
.wiki-book-link-lore:hover,
.wiki-book-link-notes:hover,
.wiki-book-link-expansion:hover,
.wiki-book-link-stories:hover {
    color: #e8fff0;
    text-shadow: 0 0 10px rgba(140, 220, 180, 0.3);
}

.wiki-book-link-wiki {
    color: #e8d8ff;
}

.wiki-book-link-wiki:hover {
    color: #f5ecff;
    text-shadow: 0 0 10px rgba(180, 140, 255, 0.35);
}

/* 典籍正文搜索高亮 — 金边铭刻 / 晶纹描边 */
.book-highlight {
    position: relative;
    display: inline;
    padding: 0 6px;
    margin: 0 1px;
    font-weight: inherit;
    font-style: inherit;
    border-radius: 2px;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.book-highlight-chronicle {
    color: #ffecc8;
    background:
        linear-gradient(90deg, rgba(255, 215, 130, 0.85) 0, rgba(255, 215, 130, 0.85) 1.5px, transparent 1.5px) 0 50% / 2px 72% no-repeat,
        linear-gradient(270deg, rgba(255, 215, 130, 0.85) 0, rgba(255, 215, 130, 0.85) 1.5px, transparent 1.5px) 100% 50% / 2px 72% no-repeat,
        linear-gradient(180deg, transparent calc(100% - 1.5px), rgba(212, 175, 95, 0.75) calc(100% - 1.5px)),
        rgba(212, 175, 95, 0.07);
    border: 1px solid rgba(255, 215, 130, 0.22);
    box-shadow:
        0 0 14px rgba(255, 200, 80, 0.12),
        inset 0 1px 0 rgba(255, 235, 200, 0.12);
    text-shadow:
        0 0 10px rgba(255, 200, 90, 0.35),
        0 0 2px rgba(255, 220, 140, 0.5);
}

.book-highlight-rules {
    color: #d8f0ff;
    background:
        linear-gradient(90deg, rgba(130, 210, 255, 0.8) 0, rgba(130, 210, 255, 0.8) 1.5px, transparent 1.5px) 0 50% / 2px 72% no-repeat,
        linear-gradient(270deg, rgba(130, 210, 255, 0.8) 0, rgba(130, 210, 255, 0.8) 1.5px, transparent 1.5px) 100% 50% / 2px 72% no-repeat,
        linear-gradient(180deg, transparent calc(100% - 1.5px), rgba(64, 164, 255, 0.7) calc(100% - 1.5px)),
        rgba(64, 164, 255, 0.06);
    border: 1px solid rgba(130, 210, 255, 0.2);
    box-shadow:
        0 0 14px rgba(80, 180, 255, 0.1),
        inset 0 1px 0 rgba(200, 235, 255, 0.1);
    text-shadow:
        0 0 10px rgba(120, 200, 255, 0.32),
        0 0 2px rgba(160, 220, 255, 0.45);
}

.chronicle-classical .book-highlight-chronicle {
    color: #fff0d0;
    font-family: inherit;
    background:
        linear-gradient(90deg, rgba(255, 200, 100, 0.9) 0, rgba(255, 200, 100, 0.9) 2px, transparent 2px) 0 50% / 3px 68% no-repeat,
        linear-gradient(270deg, rgba(255, 200, 100, 0.9) 0, rgba(255, 200, 100, 0.9) 2px, transparent 2px) 100% 50% / 3px 68% no-repeat,
        linear-gradient(180deg, transparent calc(100% - 2px), rgba(200, 150, 60, 0.65) calc(100% - 2px)),
        rgba(212, 175, 95, 0.09);
    border-color: rgba(255, 200, 100, 0.28);
    text-shadow:
        0 0 12px rgba(255, 190, 80, 0.4),
        0 0 3px rgba(255, 210, 120, 0.55);
}

.chronicle-source .book-highlight-chronicle {
    border: none;
    background:
        linear-gradient(180deg, transparent calc(100% - 1px), rgba(212, 175, 95, 0.6) calc(100% - 1px)),
        transparent;
    box-shadow: none;
    color: #ffd98a;
    letter-spacing: 0.12em;
}

.rules-warning .book-highlight-rules {
    color: #ffe0e0;
    background:
        linear-gradient(90deg, rgba(255, 140, 140, 0.75) 0, rgba(255, 140, 140, 0.75) 1.5px, transparent 1.5px) 0 50% / 2px 72% no-repeat,
        linear-gradient(270deg, rgba(255, 140, 140, 0.75) 0, rgba(255, 140, 140, 0.75) 1.5px, transparent 1.5px) 100% 50% / 2px 72% no-repeat,
        linear-gradient(180deg, transparent calc(100% - 1.5px), rgba(255, 100, 100, 0.55) calc(100% - 1.5px)),
        rgba(255, 80, 80, 0.06);
    border-color: rgba(255, 140, 140, 0.22);
    text-shadow: 0 0 8px rgba(255, 120, 120, 0.35);
}

.rules-note .book-highlight-rules,
.rules-h4 .book-highlight-rules,
.rules-h5 .book-highlight-rules {
    color: #e8f6ff;
}

.chronicle-nav-filter-hint,
.rules-nav-filter-hint {
    padding: 0 12px 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.42);
    flex-shrink: 0;
}

.chronicle-event-link.is-search-match,
.rules-section-link.is-search-match {
    box-shadow: inset 2px 0 0 currentColor;
}

.chronicle-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 95, 0.5) transparent;
}

.chronicle-era {
    margin-bottom: 14px;
}

.chronicle-era-name {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 12px;
    background: rgba(212, 175, 95, 0.08);
    color: #ffd98a;
    font-size: 14px;
    letter-spacing: 2px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease;
}

.chronicle-era-name:hover,
.chronicle-era-name.active {
    background: rgba(212, 175, 95, 0.18);
}

.chronicle-era-name:disabled {
    opacity: 0.92;
    cursor: default;
}

.chronicle-event-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0 0 0 8px;
    border-left: 1px solid rgba(212, 175, 95, 0.16);
}

.chronicle-event-list.hidden {
    display: none;
}

.chronicle-event-link {
    display: block;
    width: 100%;
    padding: 8px 10px 8px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.2s ease, background 0.2s ease;
}

.chronicle-event-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.chronicle-event-link.active {
    color: #ffe8b8;
    background: rgba(212, 175, 95, 0.12);
    box-shadow: inset 2px 0 0 #d4af5f;
}

.chronicle-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chronicle-intro,
.chronicle-article {
    flex: 1;
    border: 1px solid rgba(212, 175, 95, 0.22);
    border-radius: 22px;
    background: rgba(8, 8, 12, 0.62);
    backdrop-filter: blur(12px);
    padding: 28px 32px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
}

.chronicle-intro.hidden,
.chronicle-article.hidden {
    display: none;
}

.chronicle-intro-title {
    font-size: 42px;
    color: #ffe8b8;
    letter-spacing: 6px;
    text-shadow: 0 0 18px rgba(255, 215, 130, 0.3);
    margin-bottom: 12px;
}

.chronicle-intro-sub {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.62);
    margin-bottom: 28px;
    letter-spacing: 2px;
}

.chronicle-era-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.chronicle-era-card {
    padding: 18px 16px;
    border: 1px solid rgba(212, 175, 95, 0.24);
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(212, 175, 95, 0.1), rgba(255, 255, 255, 0.02));
    color: inherit;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.chronicle-era-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 215, 130, 0.55);
}

.chronicle-era-card-name {
    display: block;
    font-size: 20px;
    color: #ffd98a;
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.chronicle-era-card-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

.chronicle-event-head {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(212, 175, 95, 0.18);
}

.chronicle-event-era {
    display: inline-block;
    padding: 4px 10px;
    margin-bottom: 12px;
    border-radius: 999px;
    background: rgba(212, 175, 95, 0.12);
    color: #ffd98a;
    font-size: 12px;
    letter-spacing: 2px;
}

.chronicle-event-when {
    font-size: 14px;
    color: rgba(255, 215, 130, 0.8);
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.chronicle-event-title {
    font-size: 34px;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 0 16px rgba(255, 255, 255, 0.18);
    line-height: 1.35;
}

.chronicle-blocks {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.chronicle-classical {
    position: relative;
    padding: 20px 22px 20px 28px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(212, 175, 95, 0.08), rgba(255, 255, 255, 0.02));
    color: rgba(255, 236, 200, 0.92);
    font-family: "SimSun", "Songti SC", "Noto Serif SC", serif;
    font-size: 17px;
    line-height: 2;
    letter-spacing: 1px;
}

.chronicle-classical::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffd98a, rgba(212, 175, 95, 0.2));
    box-shadow: 0 0 12px rgba(255, 215, 130, 0.45);
}

.chronicle-source {
    align-self: flex-end;
    padding: 6px 14px;
    color: rgba(255, 215, 130, 0.75);
    font-size: 13px;
    letter-spacing: 3px;
    font-family: "SimSun", "Songti SC", serif;
}

.chronicle-modern {
    color: rgba(255, 255, 255, 0.88);
    font-size: 16px;
    line-height: 1.95;
    letter-spacing: 0.3px;
}

.chronicle-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

.chronicle-nav-btn.hidden {
    display: none;
}

@media (max-width: 900px) {
    .chronicle-shell {
        grid-template-columns: 1fr;
    }

    .chronicle-sidebar {
        position: relative;
        top: 0;
        max-height: 42vh;
    }

    .chronicle-intro,
    .chronicle-article {
        padding: 20px 18px;
    }

    .chronicle-intro-title,
    .chronicle-event-title {
        font-size: 28px;
    }
}

/* ===================== 编年史时间线 ===================== */
.chronicle-timeline {
    flex-shrink: 0;
    padding: 14px 24px 18px;
    border-top: 1px solid rgba(212, 175, 95, 0.22);
    background:
        linear-gradient(180deg, rgba(10, 8, 6, 0.96), rgba(4, 3, 2, 0.99));
    box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.5);
}

.chronicle-timeline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.chronicle-timeline-label {
    font-size: 11px;
    letter-spacing: 4px;
    color: rgba(255, 215, 130, 0.72);
}

.chronicle-timeline-current {
    font-size: 12px;
    color: rgba(255, 236, 200, 0.72);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 62%;
}

.chronicle-timeline-rail {
    position: relative;
    height: 54px;
    margin: 0 8px;
    cursor: pointer;
    touch-action: none;
}

.chronicle-timeline-bands {
    position: absolute;
    inset: 18px 0 16px;
    border-radius: 999px;
    overflow: hidden;
}

.chronicle-timeline-era {
    position: absolute;
    top: 0;
    bottom: 0;
    opacity: 0.7;
}

.chronicle-timeline-era-星海纪 { background: linear-gradient(90deg, rgba(70, 50, 140, 0.35), rgba(50, 40, 100, 0.2)); }
.chronicle-timeline-era-万族纪 { background: linear-gradient(90deg, rgba(160, 100, 30, 0.32), rgba(120, 80, 25, 0.18)); }
.chronicle-timeline-era-巨龙纪 { background: linear-gradient(90deg, rgba(180, 70, 50, 0.32), rgba(130, 50, 35, 0.18)); }
.chronicle-timeline-era-诸神纪 { background: linear-gradient(90deg, rgba(220, 170, 60, 0.34), rgba(170, 120, 40, 0.2)); }
.chronicle-timeline-era-荒古纪 { background: linear-gradient(90deg, rgba(100, 70, 160, 0.32), rgba(70, 50, 110, 0.18)); }
.chronicle-timeline-era-新生纪 { background: linear-gradient(90deg, rgba(70, 150, 190, 0.32), rgba(50, 100, 130, 0.18)); }

.chronicle-timeline-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(212, 175, 95, 0.12), rgba(255, 220, 140, 0.45), rgba(212, 175, 95, 0.12));
    box-shadow: 0 0 14px rgba(255, 200, 80, 0.18);
}

.chronicle-timeline-progress {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 3px;
    width: 0;
    border-radius: 999px 0 0 999px;
    background: linear-gradient(90deg, rgba(255, 210, 120, 0.25), rgba(255, 220, 150, 0.85));
    box-shadow: 0 0 16px rgba(255, 200, 90, 0.35);
    pointer-events: none;
    transition: width 0.25s ease;
}

.chronicle-timeline-rail.is-scrubbing .chronicle-timeline-progress {
    transition: none;
}

.chronicle-timeline-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    transform: translateX(-50%);
    padding: 4px 10px;
    border: 1px solid rgba(212, 175, 95, 0.38);
    border-radius: 6px;
    background: rgba(14, 12, 10, 0.94);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 5;
    white-space: nowrap;
}

.chronicle-timeline-tooltip-year {
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 230, 185, 0.92);
    letter-spacing: 0.5px;
}

.chronicle-timeline-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: grab;
    padding: 0;
    z-index: 3;
    transition: left 0.28s ease;
}

.chronicle-timeline-rail.is-scrubbing .chronicle-timeline-thumb {
    transition: none;
    cursor: grabbing;
}

.chronicle-timeline-thumb-glow {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 210, 100, 0.45), transparent 68%);
    animation: chronicle-thumb-pulse 2.8s ease-in-out infinite;
}

.chronicle-timeline-rail.is-scrubbing .chronicle-timeline-thumb-glow {
    animation: none;
    background: radial-gradient(circle, rgba(255, 220, 130, 0.65), transparent 70%);
}

.chronicle-timeline-thumb-core {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255, 230, 170, 0.85);
    background: radial-gradient(circle at 35% 30%, #fff5d6, #d4a030 58%, #8a6020);
    color: #fff8e8;
    font-size: 14px;
    box-shadow:
        0 0 18px rgba(255, 210, 100, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

@keyframes chronicle-thumb-pulse {
    0%, 100% { opacity: 0.65; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}

.chronicle-timeline-era-tags {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding: 0 8px;
}

.chronicle-timeline-era-tag {
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.34);
    white-space: nowrap;
}

.chronicle-timeline-era-tag.is-active {
    color: rgba(255, 220, 140, 0.82);
}

@media (max-width: 900px) {
    .chronicle-timeline {
        padding: 12px 14px 14px;
    }

    .chronicle-timeline-era-tags {
        display: none;
    }
}

/* ===================== 规则书视图 ===================== */
body.rules-mode #particle-bg {
    background:
        radial-gradient(ellipse at 15% 15%, rgba(20, 80, 140, 0.35), transparent 45%),
        radial-gradient(ellipse at 85% 85%, rgba(40, 20, 100, 0.22), transparent 40%),
        #000;
}

.rules-view.active {
    display: flex !important;
    flex-direction: column;
    position: relative;
    z-index: 20;
    background: transparent;
}

.rules-view {
    height: 100vh;
    overflow: hidden;
    padding: 0;
}

.rules-scroll {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 72px 20px 40px;
    scrollbar-width: thin;
    scrollbar-color: rgba(96, 196, 255, 0.55) rgba(0, 0, 0, 0.25);
}

.rules-scroll::-webkit-scrollbar {
    width: 8px;
}

.rules-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.25);
}

.rules-scroll::-webkit-scrollbar-thumb {
    background: rgba(96, 196, 255, 0.45);
    border-radius: 4px;
}

.rules-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(159, 220, 255, 0.65);
}

.rules-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 24px;
    max-width: 1280px;
    margin: 0 auto;
    align-items: start;
}

.rules-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: calc(100vh - 96px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(96, 196, 255, 0.28);
    border-radius: 20px;
    background: rgba(6, 10, 18, 0.78);
    backdrop-filter: blur(14px);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.45);
}

.rules-sidebar-head {
    padding: 22px 18px 16px;
    border-bottom: 1px solid rgba(96, 196, 255, 0.18);
    background: linear-gradient(180deg, rgba(64, 164, 255, 0.1), transparent);
}

.rules-sidebar-kicker {
    font-size: 11px;
    letter-spacing: 4px;
    color: rgba(159, 220, 255, 0.75);
    margin-bottom: 8px;
}

.rules-sidebar-title {
    font-size: 24px;
    color: #d8f0ff;
    letter-spacing: 4px;
    text-shadow: 0 0 14px rgba(130, 210, 255, 0.25);
    margin-bottom: 8px;
}

.rules-sidebar-sub {
    font-size: 12px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.55);
}

.rules-nav-filter-hint {
    color: rgba(255, 255, 255, 0.42);
}

.rules-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(96, 196, 255, 0.5) transparent;
}

.rules-part {
    margin-bottom: 14px;
}

.rules-part-name {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 12px;
    background: rgba(64, 164, 255, 0.08);
    color: #9fdcff;
    font-size: 14px;
    letter-spacing: 2px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease;
}

.rules-part-name:hover,
.rules-part-name.active {
    background: rgba(64, 164, 255, 0.18);
}

.rules-part-name:disabled {
    opacity: 0.92;
    cursor: default;
}

.rules-section-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0 0 0 8px;
    border-left: 1px solid rgba(96, 196, 255, 0.16);
}

.rules-section-list.hidden {
    display: none;
}

.rules-section-link {
    display: block;
    width: 100%;
    padding: 8px 10px 8px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.2s ease, background 0.2s ease;
}

.rules-section-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.rules-section-link.active {
    color: #d8f0ff;
    background: rgba(64, 164, 255, 0.12);
    box-shadow: inset 2px 0 0 #40a4ff;
}

.rules-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.rules-intro,
.rules-article {
    flex: 1;
    border: 1px solid rgba(96, 196, 255, 0.22);
    border-radius: 22px;
    background: rgba(6, 10, 18, 0.62);
    backdrop-filter: blur(12px);
    padding: 28px 32px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
}

.rules-intro.hidden,
.rules-article.hidden {
    display: none;
}

.rules-intro-title {
    font-size: 42px;
    color: #d8f0ff;
    letter-spacing: 6px;
    text-shadow: 0 0 18px rgba(130, 210, 255, 0.3);
    margin-bottom: 12px;
}

.rules-intro-sub,
.rules-intro-author {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.62);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.rules-part-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.rules-part-card {
    padding: 18px 16px;
    border: 1px solid rgba(96, 196, 255, 0.24);
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(64, 164, 255, 0.1), rgba(255, 255, 255, 0.02));
    color: inherit;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.rules-part-card:hover {
    transform: translateY(-2px);
    border-color: rgba(130, 210, 255, 0.55);
}

.rules-part-card-name {
    display: block;
    font-size: 20px;
    color: #9fdcff;
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.rules-part-card-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

.rules-section-head {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(96, 196, 255, 0.18);
}

.rules-section-part {
    display: inline-block;
    padding: 4px 10px;
    margin-bottom: 12px;
    border-radius: 999px;
    background: rgba(64, 164, 255, 0.12);
    color: #9fdcff;
    font-size: 12px;
    letter-spacing: 2px;
}

.rules-section-title {
    font-size: 34px;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 0 16px rgba(255, 255, 255, 0.18);
    line-height: 1.35;
}

.rules-blocks {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rules-p {
    color: rgba(255, 255, 255, 0.88);
    font-size: 16px;
    line-height: 1.95;
}

.rules-figure {
    margin: 18px 0;
    text-align: center;
}

.rules-image {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid rgba(96, 196, 255, 0.22);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.35);
}

.rules-h4 {
    color: #bfe6ff;
    font-size: 22px;
    letter-spacing: 1px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(96, 196, 255, 0.18);
}

.rules-h5 {
    color: #9fdcff;
    font-size: 18px;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.rules-note {
    color: rgba(191, 230, 255, 0.78);
    font-size: 14px;
    line-height: 1.8;
    text-align: center;
    font-style: italic;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(64, 164, 255, 0.08);
}

.rules-warning {
    color: #ffb4b4;
    font-size: 16px;
    line-height: 1.85;
    padding: 12px 16px;
    border-radius: 12px;
    border-left: 3px solid #ff6666;
    background: rgba(255, 80, 80, 0.08);
}

.rules-changelog {
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
    line-height: 1.8;
    padding-left: 12px;
    border-left: 2px solid rgba(96, 196, 255, 0.25);
}

/* docx 颜色标记（红=强调，蓝=反应轮/高阶法术，绿=火言术，紫=史诗，金=至臻） */
.book-mark,
.rules-mark {
    border-radius: 3px;
}

.book-mark-emphasis,
.rules-mark-emphasis {
    color: #ff8a8a;
    font-weight: 600;
}

.book-mark-alert,
.rules-mark-alert {
    color: #ff9f9f;
    font-weight: 600;
}

.book-mark-reaction,
.rules-mark-reaction {
    color: #6ec8ff;
    font-weight: 700;
    text-shadow: 0 0 14px rgba(94, 184, 255, 0.38);
}

.book-mark-green {
    color: #6ddf8a;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(80, 200, 120, 0.25);
}

.book-mark-accent {
    color: #5ec8d8;
    font-weight: 600;
}

.book-mark-epic,
.rules-mark-epic {
    color: #d4b0ff;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(180, 120, 255, 0.28);
}

.book-mark-legend,
.rules-mark-legend {
    color: #ffe566;
    background: rgba(0, 0, 0, 0.62);
    padding: 0 5px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.book-mark-muted,
.rules-mark-muted {
    color: rgba(255, 255, 255, 0.42);
}

.book-mark-link,
.rules-mark-link {
    color: #8ec8f0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.rules-warning .book-mark-emphasis,
.rules-warning .rules-mark-emphasis,
.rules-warning .book-mark-alert,
.rules-warning .rules-mark-alert {
    color: #ffd4d4;
}

.rules-warning .book-mark-reaction,
.rules-warning .rules-mark-reaction {
    color: #9edcff;
}

.rules-note .book-mark-reaction,
.rules-note .rules-mark-reaction {
    color: #8ed0ff;
}

.entry-text .entry-line {
    margin: 0 0 0.65em;
    color: rgba(255, 255, 255, 0.88);
    font-size: 16px;
    line-height: 1.9;
    white-space: pre-wrap;
}

.rules-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

.rules-nav-btn.hidden {
    display: none;
}

@media (max-width: 900px) {
    .rules-shell {
        grid-template-columns: 1fr;
    }

    .rules-sidebar {
        position: relative;
        top: 0;
        max-height: 42vh;
    }

    .rules-intro,
    .rules-article {
        padding: 20px 18px;
    }

    .rules-intro-title,
    .rules-section-title {
        font-size: 28px;
    }
}

/* ===================== 人物故事视图 ===================== */
body.stories-mode #particle-bg {
    background:
        radial-gradient(ellipse at 15% 20%, rgba(120, 40, 80, 0.32), transparent 45%),
        radial-gradient(ellipse at 85% 80%, rgba(80, 30, 60, 0.28), transparent 40%),
        #000;
}

.stories-view.active {
    display: flex !important;
    flex-direction: column;
    position: relative;
    z-index: 20;
    background: transparent;
}

.stories-view {
    height: 100vh;
    overflow: hidden;
    padding: 0;
}

.stories-scroll {
    flex: 1;
    min-height: 0;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 72px 20px 40px;
    scrollbar-width: thin;
    scrollbar-color: rgba(220, 140, 170, 0.55) rgba(0, 0, 0, 0.25);
}

.stories-scroll::-webkit-scrollbar {
    width: 8px;
}

.stories-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.25);
}

.stories-scroll::-webkit-scrollbar-thumb {
    background: rgba(220, 140, 170, 0.45);
    border-radius: 4px;
}

.stories-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 180, 210, 0.65);
}

.stories-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
    max-width: 1280px;
    margin: 0 auto;
    align-items: start;
}

.stories-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: calc(100vh - 120px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(220, 140, 170, 0.28);
    border-radius: 20px;
    background: rgba(10, 6, 10, 0.72);
    backdrop-filter: blur(14px);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.45);
}

.stories-sidebar-head {
    padding: 22px 18px 16px;
    border-bottom: 1px solid rgba(220, 140, 170, 0.18);
    background: linear-gradient(180deg, rgba(220, 140, 170, 0.1), transparent);
}

.stories-sidebar-kicker {
    font-size: 11px;
    letter-spacing: 4px;
    color: rgba(255, 190, 220, 0.7);
    margin-bottom: 8px;
}

.stories-sidebar-title {
    font-size: 22px;
    color: #ffe8f4;
    letter-spacing: 3px;
    margin-bottom: 6px;
}

.stories-sidebar-sub {
    font-size: 12px;
    color: rgba(255, 220, 235, 0.58);
    line-height: 1.5;
}

.stories-search .book-sidebar-search-input:focus {
    border-color: rgba(255, 180, 210, 0.55);
    box-shadow: 0 0 0 2px rgba(220, 140, 170, 0.18);
}

.stories-search .book-search-hit:hover {
    background: rgba(220, 140, 170, 0.12);
}

.book-highlight-stories {
    background: transparent;
    color: inherit;
    box-shadow:
        inset 0 -2px 0 rgba(255, 180, 210, 0.75),
        0 0 10px rgba(220, 140, 170, 0.25);
    border-radius: 2px;
}

.stories-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 10px 16px;
}

.stories-character {
    margin-bottom: 8px;
}

.stories-character-name {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(255, 220, 235, 0.88);
    font-size: 14px;
    letter-spacing: 2px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.stories-character-name:hover,
.stories-character-name.active {
    background: rgba(220, 140, 170, 0.14);
    color: #ffe0f0;
}

.stories-character-name:disabled {
    opacity: 0.85;
    cursor: default;
}

.stories-story-list {
    list-style: none;
    padding: 0 0 4px 8px;
    margin: 0;
}

.stories-story-list.hidden {
    display: none;
}

.stories-story-link {
    width: 100%;
    padding: 8px 12px 8px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 220, 235, 0.68);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.stories-story-link:hover {
    background: rgba(220, 140, 170, 0.1);
    color: rgba(255, 230, 240, 0.92);
}

.stories-story-link.active {
    background: rgba(220, 140, 170, 0.18);
    color: #ffe8f4;
    border-left: 2px solid rgba(255, 180, 210, 0.75);
}

.stories-story-link.is-search-match {
    color: rgba(255, 210, 230, 0.95);
}

.stories-nav-filter-hint {
    font-size: 11px;
    color: rgba(255, 200, 220, 0.55);
    padding: 0 12px 10px;
    letter-spacing: 1px;
}

.stories-main {
    min-width: 0;
}

.stories-intro,
.stories-article {
    padding: 28px 32px;
    border: 1px solid rgba(220, 140, 170, 0.22);
    border-radius: 22px;
    background: rgba(8, 6, 10, 0.55);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
}

.stories-intro.hidden,
.stories-article.hidden {
    display: none;
}

.stories-intro-title {
    font-size: 36px;
    color: #ffe8f4;
    letter-spacing: 4px;
    margin-bottom: 12px;
    text-shadow: 0 0 18px rgba(255, 180, 210, 0.25);
}

.stories-intro-sub {
    font-size: 14px;
    color: rgba(255, 210, 230, 0.68);
    margin-bottom: 28px;
    letter-spacing: 2px;
}

.stories-character-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.stories-character-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 16px;
    border: 1px solid rgba(220, 140, 170, 0.28);
    border-radius: 16px;
    background: rgba(220, 140, 170, 0.06);
    color: #fff;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.stories-character-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 180, 210, 0.55);
    box-shadow: 0 8px 24px rgba(220, 120, 170, 0.18);
}

.stories-character-card-name {
    font-size: 18px;
    letter-spacing: 3px;
    color: #ffe0f0;
}

.stories-character-card-count {
    font-size: 12px;
    color: rgba(255, 210, 230, 0.58);
}

.stories-story-head {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(220, 140, 170, 0.2);
}

.stories-story-character {
    display: inline-block;
    font-size: 12px;
    letter-spacing: 3px;
    color: rgba(255, 190, 220, 0.82);
    margin-bottom: 10px;
}

.stories-story-subtitle {
    font-size: 14px;
    color: rgba(255, 210, 230, 0.62);
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.stories-story-title {
    font-size: 34px;
    color: #ffe8f4;
    letter-spacing: 3px;
    line-height: 1.35;
    text-shadow: 0 0 16px rgba(255, 180, 210, 0.2);
}

.stories-blocks {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stories-p {
    color: rgba(255, 245, 250, 0.88);
    font-size: 16px;
    line-height: 1.95;
    text-indent: 2em;
}

.stories-scene {
    color: rgba(255, 200, 220, 0.78);
    font-size: 14px;
    letter-spacing: 2px;
    text-align: center;
    text-indent: 0;
    padding: 8px 0;
}

.stories-subtitle {
    color: rgba(255, 190, 220, 0.72);
    font-size: 14px;
    letter-spacing: 3px;
    text-align: center;
    text-indent: 0;
    font-style: italic;
}

.stories-monologue {
    color: rgba(255, 220, 235, 0.72);
    font-size: 15px;
    line-height: 1.8;
    text-indent: 0;
    padding: 10px 16px;
    border-left: 2px solid rgba(220, 140, 170, 0.45);
    background: rgba(220, 140, 170, 0.06);
    border-radius: 0 8px 8px 0;
}

.stories-diary {
    color: rgba(255, 200, 220, 0.9);
    font-size: 15px;
    letter-spacing: 1px;
    text-indent: 0;
    margin-top: 8px;
    font-weight: 600;
}

.stories-divider {
    text-align: center;
    color: rgba(220, 140, 170, 0.45);
    letter-spacing: 6px;
    text-indent: 0;
    padding: 8px 0;
}

.stories-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

.stories-nav-btn.hidden {
    display: none;
}

@media (max-width: 900px) {
    .stories-shell {
        grid-template-columns: 1fr;
    }

    .stories-sidebar {
        position: relative;
        top: 0;
        max-height: 42vh;
    }

    .stories-intro,
    .stories-article {
        padding: 20px 18px;
    }

    .stories-intro-title,
    .stories-story-title {
        font-size: 28px;
    }
}

/* ===================== 各洲杂记视图 ===================== */
body.notes-mode #particle-bg {
    background:
        radial-gradient(ellipse at 20% 16%, rgba(90, 70, 160, 0.3), transparent 46%),
        radial-gradient(ellipse at 78% 84%, rgba(50, 80, 120, 0.24), transparent 42%),
        #000;
}

body.expansion-mode #particle-bg {
    background:
        radial-gradient(ellipse at 22% 14%, rgba(160, 90, 40, 0.32), transparent 46%),
        radial-gradient(ellipse at 76% 86%, rgba(100, 50, 20, 0.26), transparent 42%),
        #000;
}

body.races-mode #particle-bg {
    background:
        radial-gradient(ellipse at 24% 16%, rgba(70, 110, 180, 0.32), transparent 46%),
        radial-gradient(ellipse at 74% 84%, rgba(40, 70, 120, 0.26), transparent 42%),
        #000;
}

/* ===================== 洲陆设定视图 ===================== */
body.lore-mode #particle-bg {
    background:
        radial-gradient(ellipse at 18% 18%, rgba(30, 100, 70, 0.32), transparent 45%),
        radial-gradient(ellipse at 82% 82%, rgba(20, 60, 90, 0.25), transparent 40%),
        #000;
}

.lore-view.active {
    display: flex !important;
    flex-direction: column;
    position: relative;
    z-index: 20;
    background: transparent;
}

.lore-view {
    height: 100vh;
    overflow: hidden;
    padding: 0;
}

.lore-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 72px 20px 40px;
    scrollbar-width: thin;
    scrollbar-color: rgba(90, 190, 150, 0.55) rgba(0, 0, 0, 0.25);
}

.lore-scroll::-webkit-scrollbar { width: 8px; }
.lore-scroll::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.25); }
.lore-scroll::-webkit-scrollbar-thumb { background: rgba(90, 190, 150, 0.45); border-radius: 4px; }

.lore-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
    max-width: 1280px;
    margin: 0 auto;
    align-items: start;
}

.lore-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: calc(100vh - 120px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(90, 190, 150, 0.28);
    border-radius: 20px;
    background: rgba(6, 12, 10, 0.72);
    backdrop-filter: blur(14px);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.45);
}

.lore-sidebar-head {
    padding: 22px 18px 16px;
    border-bottom: 1px solid rgba(90, 190, 150, 0.18);
    background: linear-gradient(180deg, rgba(90, 190, 150, 0.1), transparent);
}

.lore-sidebar-kicker {
    font-size: 11px;
    letter-spacing: 4px;
    color: rgba(160, 240, 200, 0.7);
    margin-bottom: 8px;
}

.lore-sidebar-title {
    font-size: 22px;
    color: #e8fff4;
    letter-spacing: 3px;
    margin-bottom: 6px;
}

.lore-sidebar-sub {
    font-size: 12px;
    color: rgba(200, 240, 220, 0.58);
    line-height: 1.5;
}

.lore-search .book-sidebar-search-input:focus {
    border-color: rgba(130, 230, 180, 0.55);
    box-shadow: 0 0 0 2px rgba(90, 190, 150, 0.18);
}

.lore-search .book-search-hit:hover {
    background: rgba(90, 190, 150, 0.12);
}

.book-highlight-lore {
    background: transparent;
    color: inherit;
    box-shadow:
        inset 0 -2px 0 rgba(130, 230, 180, 0.75),
        0 0 10px rgba(90, 190, 150, 0.25);
    border-radius: 2px;
}

.lore-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 10px 16px;
}

.lore-entry { margin-bottom: 8px; }

.lore-entry-name {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(220, 255, 240, 0.88);
    font-size: 14px;
    letter-spacing: 2px;
    text-align: left;
    cursor: pointer;
}

.lore-entry-name:hover,
.lore-entry-name.active {
    background: rgba(90, 190, 150, 0.14);
    color: #e8fff4;
}

.lore-entry-name:disabled { opacity: 0.85; cursor: default; }

.lore-section-list {
    list-style: none;
    padding: 0 0 4px 8px;
    margin: 0;
}

.lore-section-list.hidden { display: none; }

.lore-section-link {
    width: 100%;
    padding: 8px 12px 8px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(210, 245, 230, 0.68);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.lore-section-link:hover {
    background: rgba(90, 190, 150, 0.1);
    color: rgba(230, 255, 245, 0.92);
}

.lore-section-link.active {
    background: rgba(90, 190, 150, 0.18);
    color: #e8fff4;
    border-left: 2px solid rgba(130, 230, 180, 0.75);
}

.lore-section-link.is-search-match { color: rgba(210, 255, 235, 0.95); }

.lore-nav-filter-hint {
    font-size: 11px;
    color: rgba(160, 220, 190, 0.55);
    padding: 0 12px 10px;
}

.lore-main { min-width: 0; }

.lore-intro,
.lore-article {
    padding: 28px 32px;
    border: 1px solid rgba(90, 190, 150, 0.22);
    border-radius: 22px;
    background: rgba(6, 10, 8, 0.55);
    backdrop-filter: blur(10px);
}

.lore-intro.hidden,
.lore-article.hidden { display: none; }

.lore-intro-title {
    font-size: 36px;
    color: #e8fff4;
    letter-spacing: 4px;
    margin-bottom: 12px;
}

.lore-intro-sub {
    font-size: 14px;
    color: rgba(200, 240, 220, 0.68);
    margin-bottom: 28px;
    letter-spacing: 2px;
}

.lore-entry-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.lore-entry-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 16px;
    border: 1px solid rgba(90, 190, 150, 0.28);
    border-radius: 16px;
    background: rgba(90, 190, 150, 0.06);
    color: #fff;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.lore-entry-card:hover {
    transform: translateY(-2px);
    border-color: rgba(130, 230, 180, 0.55);
    box-shadow: 0 8px 24px rgba(60, 180, 130, 0.18);
}

.lore-entry-card-name {
    font-size: 18px;
    letter-spacing: 3px;
    color: #d8ffee;
}

.lore-entry-card-tag,
.lore-entry-card-count {
    font-size: 12px;
    color: rgba(200, 240, 220, 0.58);
}

.lore-section-head {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(90, 190, 150, 0.2);
}

.lore-section-entry {
    display: inline-block;
    font-size: 12px;
    letter-spacing: 3px;
    color: rgba(160, 240, 200, 0.82);
    margin-bottom: 10px;
}

.lore-section-tag {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(90, 190, 150, 0.35);
    font-size: 11px;
    color: rgba(200, 240, 220, 0.72);
}

.lore-section-title {
    font-size: 34px;
    color: #e8fff4;
    letter-spacing: 3px;
    line-height: 1.35;
}

.lore-blocks {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.lore-p,
.lore-modern {
    color: rgba(240, 255, 248, 0.88);
    font-size: 16px;
    line-height: 1.95;
    text-indent: 2em;
}

.lore-classical {
    color: rgba(220, 255, 240, 0.82);
    font-size: 17px;
    line-height: 2;
    text-indent: 2em;
    padding: 16px 18px;
    border-left: 3px solid rgba(130, 230, 180, 0.55);
    background: rgba(90, 190, 150, 0.06);
    border-radius: 0 12px 12px 0;
}

.lore-source {
    color: rgba(160, 220, 190, 0.72);
    font-size: 13px;
    text-align: right;
    text-indent: 0;
    letter-spacing: 1px;
}

.lore-figure {
    margin: 18px 0;
    text-align: center;
}

.lore-image {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid rgba(130, 230, 180, 0.25);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.35);
}

.lore-meta {
    color: rgba(160, 240, 200, 0.78);
    font-size: 14px;
    letter-spacing: 1px;
    text-indent: 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(90, 190, 150, 0.08);
}

.lore-h5 {
    color: rgba(180, 240, 210, 0.85);
    font-size: 15px;
    letter-spacing: 1px;
    text-indent: 0;
    margin-top: 10px;
    margin-bottom: 4px;
}

.lore-li {
    color: rgba(235, 255, 245, 0.86);
    font-size: 15px;
    line-height: 1.85;
    text-indent: 0;
    padding-left: 0.6em;
    margin-left: 0.4em;
    border-left: 2px solid rgba(90, 190, 150, 0.22);
}

.lore-h4 {
    color: rgba(200, 255, 230, 0.92);
    font-size: 17px;
    letter-spacing: 2px;
    text-indent: 0;
    margin-top: 16px;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(90, 190, 150, 0.18);
}

.lore-h4:first-child,
.lore-h5:first-child {
    margin-top: 0;
}

.lore-empty {
    color: rgba(180, 220, 200, 0.62);
    font-size: 14px;
    line-height: 1.8;
    text-indent: 0;
    padding: 16px 18px;
    border: 1px dashed rgba(90, 190, 150, 0.28);
    border-radius: 12px;
    background: rgba(90, 190, 150, 0.05);
}

.lore-empty code {
    font-size: 12px;
    color: rgba(200, 240, 220, 0.85);
}

.lore-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.lore-nav-btn.hidden { display: none; }

/* ===================== 典籍管理（主神 / 诸天神明） ===================== */
.book-admin-bar {
    display: flex;
    gap: 8px;
    padding: 8px 12px 10px;
    border-bottom: 1px solid rgba(120, 200, 160, 0.12);
}

.book-admin-btn {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid rgba(120, 200, 160, 0.25);
    border-radius: 6px;
    background: rgba(40, 80, 60, 0.35);
    color: rgba(200, 240, 220, 0.9);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.book-admin-btn:hover {
    background: rgba(60, 120, 90, 0.45);
    border-color: rgba(120, 220, 170, 0.45);
}

.book-nav-group-row,
.book-nav-row {
    display: flex;
    align-items: stretch;
    gap: 4px;
}

.book-nav-group-row > .chronicle-era-name,
.book-nav-group-row > .rules-part-name,
.book-nav-group-row > .stories-character-name,
.book-nav-group-row > .lore-entry-name,
.book-nav-row > .chronicle-event-link,
.book-nav-row > .rules-section-link,
.book-nav-row > .stories-story-link,
.book-nav-row > .lore-section-link {
    flex: 1;
    min-width: 0;
}

.book-nav-delete {
    flex-shrink: 0;
    width: 26px;
    min-width: 26px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: rgba(255, 120, 120, 0.55);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.book-nav-group-row:hover .book-nav-delete,
.book-nav-row:hover .book-nav-delete {
    opacity: 1;
}

.book-nav-delete:hover {
    background: rgba(180, 60, 60, 0.25);
    color: rgba(255, 140, 140, 0.95);
}

.book-edit-body {
    min-height: 240px;
    font-family: inherit;
    line-height: 1.6;
}

.book-edit-hint {
    margin: 0;
    font-size: 12px;
    color: rgba(180, 200, 190, 0.65);
    line-height: 1.5;
}

.chronicle-footer .book-admin-only,
.rules-footer .book-admin-only,
.stories-footer .book-admin-only,
.lore-footer .book-admin-only {
    margin-right: auto;
}

@media (max-width: 900px) {
    .lore-shell { grid-template-columns: 1fr; }
    .lore-sidebar { max-height: 42vh; }
    .lore-intro, .lore-article { padding: 20px 18px; }
    .lore-intro-title, .lore-section-title { font-size: 28px; }
}
