/* ===================== 历史单线 — 神迹工具箱 ===================== */

.history-line-portal {
    border: 1px solid rgba(120, 200, 255, 0.34);
    background:
        linear-gradient(135deg, rgba(40, 90, 140, 0.18), rgba(20, 40, 70, 0.14)),
        rgba(255, 255, 255, 0.04);
}

.history-line-portal:hover {
    border-color: rgba(160, 220, 255, 0.62);
    box-shadow: 0 0 24px rgba(80, 160, 220, 0.22);
}

.history-line-portal .library-portal-glow {
    background: radial-gradient(circle, rgba(100, 180, 255, 0.18), transparent 60%);
}

.history-line-portal .library-portal-icon {
    background: rgba(50, 110, 170, 0.28);
    color: #c8e8ff;
    box-shadow: 0 0 16px rgba(90, 170, 255, 0.28);
}

.history-line-portal .library-portal-title {
    color: #e8f4ff;
}

body.history-lines-mode #particle-bg,
body.history-line-intro-mode #particle-bg,
body.history-line-play-mode #particle-bg {
    background:
        radial-gradient(ellipse at 22% 18%, rgba(40, 90, 140, 0.22), transparent 48%),
        radial-gradient(ellipse at 78% 82%, rgba(20, 50, 90, 0.18), transparent 44%),
        #000;
}

.history-lines-view:not(.active),
.history-line-intro-view:not(.active),
.history-line-play-view:not(.active) {
    display: none !important;
}

.history-lines-view.active {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

/* —— Intro —— */
.history-line-intro-view.active {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.hl-intro-shell {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px 20px 28px;
    box-sizing: border-box;
}

.hl-intro-topbar {
    position: absolute;
    top: 18px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    z-index: 2;
}

.hl-intro-kicker {
    margin: 0;
    font-family: "Cormorant Garamond", "Noto Serif SC", Georgia, serif;
    font-size: 0.78rem;
    letter-spacing: 0.28em;
    text-indent: 0.28em;
    color: rgba(180, 210, 235, 0.55);
}

.hl-intro-stage-narration,
.hl-intro-stage-mission {
    position: relative;
    z-index: 1;
}

.hl-intro-stage-narration.is-hidden,
.hl-intro-stage-mission.is-hidden {
    display: none !important;
}

.hl-intro-dock {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 22px 22px 18px;
    border: 1px solid rgba(180, 210, 240, 0.22);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(12, 20, 32, 0.72), rgba(6, 10, 18, 0.88)),
        rgba(0, 0, 0, 0.55);
    box-shadow:
        0 0 40px rgba(40, 100, 160, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    animation: hl-dock-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes hl-dock-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

.hl-intro-letter {
    margin: 0 0 16px;
    white-space: pre-wrap;
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    font-size: 0.95rem;
    line-height: 1.85;
    color: rgba(230, 236, 245, 0.92);
}

.hl-intro-narration {
    margin: 0;
    white-space: pre-wrap;
    font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
    font-size: 0.92rem;
    line-height: 1.8;
    color: rgba(190, 205, 220, 0.78);
}

.hl-intro-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
    gap: 10px;
}

.hl-intro-mission-card {
    width: min(560px, 100%);
    margin: auto;
    padding: 28px 26px 22px;
    border: 1px solid rgba(120, 190, 255, 0.35);
    border-radius: 18px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(60, 120, 190, 0.18), transparent 55%),
        rgba(8, 14, 24, 0.92);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    animation: hl-dock-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hl-intro-mission-label {
    margin: 0 0 12px;
    font-size: 0.75rem;
    letter-spacing: 0.32em;
    text-indent: 0.32em;
    color: rgba(150, 200, 240, 0.7);
    text-transform: uppercase;
}

.hl-intro-mission-title {
    margin: 0 0 16px;
    font-family: "Noto Serif SC", "Songti SC", serif;
    font-size: 1.35rem;
    letter-spacing: 0.12em;
    color: #eaf4ff;
}

.hl-intro-mission-text {
    margin: 0;
    white-space: pre-wrap;
    font-size: 0.95rem;
    line-height: 1.85;
    color: rgba(220, 230, 240, 0.9);
}

.hl-intro-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 72px 16px 24px;
}

/* —— Play —— */
.history-line-play-view.active {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: flex !important;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    background: #000;
}

/* 游玩时隐藏会盖住 iframe 的全局浮层（与小游戏一致） */
body.history-line-play-mode .bgm-toggle,
body.history-line-play-mode .site-version-badge {
    display: none !important;
}

.hl-play-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(120, 180, 230, 0.18);
    background: rgba(4, 8, 14, 0.92);
}

.hl-play-kicker {
    margin: 0 0 2px;
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-indent: 0.28em;
    color: rgba(150, 190, 230, 0.6);
}

.hl-play-title {
    margin: 0;
    font-family: "Noto Serif SC", "Songti SC", serif;
    font-size: 1.15rem;
    letter-spacing: 0.14em;
    color: #e8f2ff;
}

.hl-play-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.hl-play-frame-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}

.hl-play-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
    display: block;
}

/* 手机游玩：压缩顶栏 */
@media (max-width: 900px) and (hover: none), (pointer: coarse) {
    .history-line-play-view.active.is-mobile-play .hl-play-header {
        padding: 6px 10px;
        gap: 6px;
    }

    .history-line-play-view.active.is-mobile-play .hl-play-kicker {
        display: none;
    }

    .history-line-play-view.active.is-mobile-play .hl-play-title {
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 42vw;
    }

    .history-line-play-view.active.is-mobile-play .hl-play-header .action-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .history-line-play-view.active.is-mobile-play .hl-play-frame-wrap,
    .history-line-play-view.active.is-mobile-play .hl-play-frame {
        flex: 1 1 auto;
        min-height: 0;
        height: 100%;
    }
}

/* —— Story modal —— */
.hl-story-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: grid;
    place-items: center;
    padding: 20px;
}

.hl-story-modal.hidden {
    display: none !important;
}

.hl-story-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    border: 0;
    cursor: pointer;
}

.hl-story-panel {
    position: relative;
    z-index: 1;
    width: min(640px, 100%);
    max-height: min(78vh, 720px);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(140, 190, 240, 0.3);
    border-radius: 16px;
    background: rgba(8, 14, 22, 0.96);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.hl-story-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(120, 170, 220, 0.16);
}

.hl-story-head h3 {
    margin: 0;
    font-family: "Noto Serif SC", serif;
    font-size: 1.05rem;
    letter-spacing: 0.16em;
    color: #eaf3ff;
}

.hl-story-tabs {
    display: flex;
    gap: 6px;
    padding: 10px 14px 0;
    flex-wrap: wrap;
}

.hl-story-tab {
    appearance: none;
    border: 1px solid rgba(120, 180, 230, 0.22);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(190, 210, 230, 0.75);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
}

.hl-story-tab.is-active {
    border-color: rgba(150, 210, 255, 0.55);
    background: rgba(60, 120, 180, 0.22);
    color: #e8f4ff;
}

.hl-story-body {
    flex: 1 1 auto;
    overflow: auto;
    margin: 0;
    padding: 14px 18px 20px;
    white-space: pre-wrap;
    font-family: "Noto Serif SC", "Songti SC", serif;
    font-size: 0.92rem;
    line-height: 1.85;
    color: rgba(220, 230, 240, 0.92);
}

@media (max-width: 720px) {
    .hl-intro-dock {
        padding: 18px 16px 14px;
    }

    .hl-play-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .hl-play-actions {
        width: 100%;
    }

    .hl-play-actions .action-btn {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hl-intro-dock,
    .hl-intro-mission-card {
        animation: none;
    }
}
