/* ===== 全局重置 & 氛围 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    font-family: 'Inter', 'Noto Serif SC', system-ui, -apple-system, 'Segoe UI', serif;
    background: radial-gradient(circle at 20% 30%, #f5ede6, #e3d9cf);
    display: flex;
    flex-direction: column;
}

/* 背景纹理 — 宣纸感 */
.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: linear-gradient(145deg, #f7f0e8 0%, #e6dbd0 100%);
}


@keyframes slowDrift {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.4;
    }
    100% {
        transform: translate(2%, 1.5%) rotate(1.5deg);
        opacity: 0.85;
    }
}

/* ===== 移动端横屏提示 ===== */
.rotate-hint {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    background: rgba(60, 40, 30, 0.88);
    backdrop-filter: blur(8px);
    color: #f5ede4;
    padding: 0.6rem 1.8rem 0.6rem 1.4rem;
    border-radius: 40px;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    align-items: center;
    gap: 1rem;
    border: 1px solid rgba(200, 180, 165, 0.2);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: auto;
}
.rotate-hint.show { display: flex; }
.rotate-hint.hiding {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    pointer-events: none;
}
.hint-close {
    background: transparent;
    border: none;
    color: #d4c0b0;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
    transition: color 0.2s;
}
.hint-close:hover { color: #fff; }

/* ============================================================
                           顶部导航栏
                   ============================================================ */
.top-nav {
    position: relative;
    z-index: 20;
    flex-shrink: 0;
    background: rgba(242, 235, 226, 0.55);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(200, 180, 165, 0.30);
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.04);
    padding: 0.4rem 0.8rem 0.4rem 1.2rem;
    display: flex;
    align-items: stretch;
    gap: 0.6rem;
    min-height: 72px;
    transition: min-height 0.3s ease;
}
.nav-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0.6rem;
    padding-right: 1rem;
    border-right: 1px solid rgba(140, 110, 90, 0.15);
}
.nav-brand h2 {
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 4px;
    font-family: 'Noto Serif SC', serif;
    background: linear-gradient(135deg, #5a3f30, #2f221b);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    white-space: nowrap;
}
.nav-brand .sub {
    font-size: 0.6rem;
    color: #7a6456;
    font-weight: 300;
    letter-spacing: 2px;
    white-space: nowrap;
}
.nav-list-wrap {
    flex: 1;
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: auto;
    scrollbar-width: thin;
    gap: 0.2rem;
    padding: 0.2rem 0;
}
.nav-list-wrap::-webkit-scrollbar { height: 3px; }
.nav-list-wrap::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.02); }
.nav-list-wrap::-webkit-scrollbar-thumb {
    background: rgba(160, 130, 110, 0.25);
    border-radius: 8px;
}
.nav-list {
    display: flex;
    align-items: stretch;
    gap: 0.2rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}
.nav-item { display: flex; align-items: stretch; flex-shrink: 0; }
.nav-btn {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: 'Noto Serif SC', 'STKaiti', 'KaiTi', serif;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    color: #3d3029;
    background: transparent;
    border: none;
    padding: 0.3rem 0.4rem;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s cubic-bezier(0.2, 0.9, 0.4, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    min-height: 48px;
    line-height: 1.6;
    position: relative;
    white-space: nowrap;
}
.nav-btn:hover {
    background: rgba(215, 195, 175, 0.35);
    color: #1f1612;
    font-weight: 500;
}
.nav-btn.active {
    background: rgba(235, 220, 205, 0.60);
    box-shadow: 0 -2px 0 #b87a5a inset;
    font-weight: 600;
    color: #4a2e1f;
}
.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 2px;
    background: #b87a5a;
    border-radius: 2px 2px 0 0;
}
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    align-self: center;
    margin-left: 0.2rem;
}
.nav-toggle span {
    display: block;
    height: 2.5px;
    width: 100%;
    background: #5a4035;
    border-radius: 2px;
    transition: all 0.25s ease;
}
.nav-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.nav-mobile-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(242, 235, 226, 0.96);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(200, 180, 165, 0.30);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    padding: 0.6rem 0.8rem;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 30;
    flex-direction: column;
    gap: 0.2rem;
}
.nav-mobile-dropdown.open { display: flex; }
.nav-mobile-dropdown .nav-btn {
    writing-mode: horizontal-tb;
    font-size: 0.95rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    justify-content: flex-start;
    min-height: 40px;
    border-left: 3px solid transparent;
}
.nav-mobile-dropdown .nav-btn:hover { background: rgba(215, 195, 175, 0.30); }
.nav-mobile-dropdown .nav-btn.active {
    background: rgba(235, 220, 205, 0.50);
    border-left-color: #b87a5a;
    box-shadow: none;
}
.nav-mobile-dropdown .nav-btn.active::after { display: none; }
.nav-footer-top { display: none; }

/* ===== 主内容区 ===== */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem 1.2rem 1.5rem;
    background: radial-gradient(ellipse at 70% 30%, rgba(248, 242, 235, 0.3), transparent 70%);
    transition: margin-top 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.scroll-wrapper {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    scroll-behavior: smooth;
    padding: 0.5rem 0;
}
.scroll-wrapper::-webkit-scrollbar { height: 6px; }
.scroll-wrapper::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.04); border-radius: 8px; }
.scroll-wrapper::-webkit-scrollbar-thumb {
    background: rgba(160, 130, 110, 0.35);
    border-radius: 8px;
}
#dynamicCard { display: flex; align-items: flex-start; width: fit-content; height: fit-content; margin-left: auto; }

/* ===== 竖排卡片容器 ===== */
.scroll-content {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 1.2rem 2rem;
    padding: 1.8rem 2.5rem 2.2rem 2.5rem;
    width: fit-content;
    min-height: 80%;
}

/* ===== 每一竖列（列容器） ===== */
.verse-column {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: 'Noto Serif SC', 'STKaiti', 'KaiTi', serif;
    padding: 0.2rem 0.4rem;
    border-left: 1px solid rgba(180, 150, 130, 0.10);
    border-right: 1px solid rgba(180, 150, 130, 0.10);
    background: rgba(255, 250, 242, 0.15);
    border-radius: 3px;
    transition: all 0.2s ease;
    word-break: keep-all;
    line-height: 1.9;
    letter-spacing: 0.06em;
    flex-shrink: 0;
    min-width: 1.6rem;
    min-height: 3rem;
}
.verse-column:hover {
    background: rgba(230, 210, 190, 0.15);
    border-color: rgba(180, 150, 130, 0.25);
}

/* ----- 每个字符（初始隐藏，动画显现） ----- */
.char-span {
    display: inline-block;
    opacity: 0;
    transform: translateY(-8px);
    animation: charFadeIn 0.4s ease-out forwards;
    /* 延迟由 JS 行内设置 */
}
@keyframes charFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ----- 已显示过的篇目：禁止字符动画，直接可见 ----- */
.no-anim .char-span {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

/* ----- 各类列样式变体 ----- */
.verse-column.type-title {
    font-size: 2.6rem;
    font-weight: 700;
    color: #3d281e;
    letter-spacing: 0.10em;
    border-left: 3px solid #c99474;
    border-right: 3px solid #c99474;
    background: rgba(235, 215, 195, 0.15);
    padding: 0.3rem 0.8rem;
    min-width: 2.8rem;
}
.verse-column.type-author {
    font-size: 1.1rem;
    font-weight: 500;
    color: #7a5f4a;
    letter-spacing: 0.08em;
    border-color: rgba(180, 150, 130, 0.15);
    padding: 0.2rem 0.6rem;
    min-width: 1.8rem;
}
.verse-column.type-author.small {
    font-size: 0.9rem;
    color: #9a7a66;
    border-color: rgba(180, 150, 130, 0.06);
}
.verse-column.type-verse {
    font-size: 1.8rem;
    font-weight: 500;
    color: #2d1f18;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.6rem;
    min-width: 2rem;
}
.verse-column.type-annotation {
    font-size: 0.95rem;
    font-weight: 400;
    color: #8a7060;
    letter-spacing: 0.04em;
    border-color: rgba(180, 150, 130, 0.08);
    background: rgba(240, 230, 218, 0.10);
    padding: 0.2rem 0.5rem;
    min-width: 1.4rem;
}
.verse-column.type-signature {
    font-size: 0.85rem;
    font-weight: 300;
    color: #b0907a;
    letter-spacing: 0.06em;
    border-color: transparent;
    background: transparent;
    padding: 0.2rem 0.4rem;
    min-width: 1.2rem;
}
.verse-column.type-signature:hover { background: transparent !important; border-color: transparent !important; }

/* ===== 分割线（默认隐藏，逐列显现） ===== */
.verse-column.type-divider {
    border-left: 2px solid rgba(180, 150, 130, 0.20);
    border-right: 2px solid rgba(180, 150, 130, 0.20);
    background: transparent;
    min-width: 0.8rem;
    padding: 0 0.1rem;
    pointer-events: none;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
}
.verse-column.type-divider:hover { background: transparent !important; border-color: rgba(180, 150, 130, 0.20) !important; transform: none !important; }
.divider-visible {
    opacity: 1 !important;
}

/* ===== 印章样式及按压动画 ===== */
.verse-column.type-seal {
    border: none !important;
    background: transparent !important;
    padding: 0.2rem 0.3rem;
    min-width: 3.2rem;
    min-height: 3.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.verse-column.type-seal:hover { background: transparent !important; border-color: transparent !important; transform: none !important; }
.verse-column.type-seal img {
    max-width: 2.8rem;
    max-height: 2.8rem;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(160, 80, 50, 0.15));
    transition: filter 0.3s ease;
    transform-origin: center;
    opacity: 0;                          /* 默认隐藏 */
}
/* 按压动画 + 淡入 */
.verse-column.type-seal img.press {
    animation: press 0.5s cubic-bezier(0.2, 0.9, 0.4, 1) forwards;
}
@keyframes press {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 2px 6px rgba(160, 80, 50, 0.15));
        opacity: 0;
    }
    35% {
        transform: scale(0.82);
        filter: drop-shadow(0 0 25px rgba(160, 80, 50, 0.4));
        opacity: 0.8;
    }
    70% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 15px rgba(160, 80, 50, 0.25));
        opacity: 1;
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 2px 6px rgba(160, 80, 50, 0.15));
        opacity: 1;
    }
}
/* 已显示过的篇目：印章直接可见（禁用动画） */
.no-anim .verse-column.type-seal img {
    opacity: 1 !important;
    animation: none !important;
}

/* Hero 专用（兼容） */
.verse-column.type-hero-title {
    font-size: 3.2rem;
    font-weight: 700;
    color: #3d281e;
    letter-spacing: 0.12em;
    border-left: 4px solid #c99474;
    border-right: 4px solid #c99474;
    background: rgba(235, 215, 195, 0.12);
    padding: 0.3rem 1rem;
    min-width: 3.2rem;
}
.verse-column.type-hero-sub {
    font-size: 1.4rem;
    font-weight: 400;
    color: #7a5f4a;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.8rem;
    min-width: 1.8rem;
}
.verse-column.type-hero-body {
    font-size: 1.3rem;
    font-weight: 350;
    color: #4d372b;
    letter-spacing: 0.06em;
    line-height: 2.0;
    padding: 0.2rem 0.7rem;
    min-width: 1.6rem;
    background: rgba(248, 240, 230, 0.08);
}
.verse-column.type-hero-sign {
    font-size: 0.9rem;
    font-weight: 300;
    color: #b0907a;
    letter-spacing: 0.08em;
    border-color: transparent;
    background: transparent;
    padding: 0.2rem 0.5rem;
    min-width: 1.4rem;
}
.verse-column.type-hero-sign:hover { background: transparent !important; border-color: transparent !important; }

/* ============================================================
                           响应式
                   ============================================================ */
@media (max-width: 820px) {
    .top-nav { padding: 0.3rem 0.6rem 0.3rem 0.8rem; min-height: 60px; }
    .nav-brand h2 { font-size: 1rem; }
    .nav-brand .sub { font-size: 0.5rem; }
    .nav-btn { font-size: 0.75rem; min-width: 1.4rem; min-height: 40px; padding: 0.2rem 0.3rem; }
    .scroll-content { gap: 1.2rem 1.8rem; padding: 1.5rem 1.8rem; }
    .verse-column.type-title { font-size: 2.2rem; min-width: 2.2rem; }
    .verse-column.type-verse { font-size: 1.6rem; min-width: 1.6rem; }
    .verse-column.type-seal { min-width: 2.8rem; min-height: 2.8rem; }
    .verse-column.type-seal img { max-width: 2.4rem; max-height: 2.4rem; }
}
@media (max-width: 640px) {
    .rotate-hint {
        display: flex;
        top: 10px;
        font-size: 0.75rem;
        padding: 0.4rem 1.2rem 0.4rem 1rem;
        gap: 0.6rem;
        max-width: 90vw;
        white-space: nowrap;
    }
    .rotate-hint .hint-close { font-size: 0.9rem; }
    .top-nav { padding: 0.3rem 0.6rem; min-height: 52px; flex-wrap: nowrap; }
    .nav-brand { padding-right: 0.6rem; border-right: 1px solid rgba(140, 110, 90, 0.10); }
    .nav-brand h2 { font-size: 0.85rem; letter-spacing: 2px; }
    .nav-brand .sub { display: none; }
    .nav-list-wrap { display: none; }
    .nav-toggle { display: flex; }
    .nav-footer-top { display: none; }
    .nav-mobile-dropdown {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        max-height: 50vh;
        overflow-y: auto;
        display: none;
        background: rgba(242, 235, 226, 0.97);
        backdrop-filter: blur(18px);
        border-bottom: 1px solid rgba(200, 180, 165, 0.30);
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
        padding: 0.6rem 0.8rem;
        z-index: 30;
        flex-direction: column;
        gap: 0.2rem;
    }
    .nav-mobile-dropdown.open { display: flex; }
    .nav-mobile-dropdown .nav-btn {
        writing-mode: horizontal-tb;
        font-size: 0.85rem;
        padding: 0.5rem 0.8rem;
        border-radius: 8px;
        justify-content: flex-start;
        min-height: 36px;
        border-left: 3px solid transparent;
    }
    .nav-mobile-dropdown .nav-btn:hover { background: rgba(215, 195, 175, 0.30); }
    .nav-mobile-dropdown .nav-btn.active {
        background: rgba(235, 220, 205, 0.50);
        border-left-color: #b87a5a;
        box-shadow: none;
    }
    .nav-mobile-dropdown .nav-btn.active::after { display: none; }
    .main-content { padding: 0.4rem 0.6rem 0.6rem 0.6rem; transition: none; }
    .scroll-content { gap: 1rem 1.4rem; padding: 1.2rem 1rem; min-height: 70%; }
    .verse-column { font-size: 1rem; line-height: 1.7; padding: 0.1rem 0.3rem; min-width: 1.2rem; }
    .verse-column.type-title { font-size: 1.8rem; min-width: 1.8rem; padding: 0.2rem 0.5rem; }
    .verse-column.type-verse { font-size: 1.3rem; min-width: 1.4rem; }
    .verse-column.type-author { font-size: 0.9rem; }
    .verse-column.type-annotation { font-size: 0.8rem; }
    .verse-column.type-signature { font-size: 0.7rem; }
    .verse-column.type-seal { min-width: 2.4rem; min-height: 2.4rem; }
    .verse-column.type-seal img { max-width: 2rem; max-height: 2rem; }
    .scroll-wrapper { padding: 0.2rem 0; }
}
@media (max-width: 480px) {
    .top-nav { min-height: 44px; padding: 0.2rem 0.4rem; }
    .nav-brand h2 { font-size: 0.7rem; letter-spacing: 1px; }
    .nav-toggle { width: 22px; height: 16px; }
    .nav-toggle span { height: 2px; }
    .nav-toggle.active span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
    .nav-toggle.active span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
    .verse-column.type-title { font-size: 1.5rem; min-width: 1.5rem; }
    .verse-column.type-verse { font-size: 1.1rem; min-width: 1.2rem; }
    .verse-column.type-annotation { font-size: 0.7rem; }
    .scroll-content { gap: 0.8rem 1.2rem; padding: 0.8rem 0.6rem; }
    .verse-column.type-seal { min-width: 2rem; min-height: 2rem; }
    .verse-column.type-seal img { max-width: 1.8rem; max-height: 1.8rem; }
    .nav-mobile-dropdown .nav-btn { font-size: 0.75rem; padding: 0.4rem 0.6rem; min-height: 32px; }
}