/* ========== 新中式雅致 · 蜀汉足迹地图 ========== */
/* 字体体系：思源宋体(标题) + 思源黑体(正文) + Inter(数字) */
/* 本地托管字体：思源宋体 + 思源黑体 + Inter */
@import url('fonts.css');

:root {
    color-scheme: dark;
    /* 蜀汉主题色彩体系 */
    --shu-red: #8B2500;          /* 蜀锦红 - 深朱砂 */
    --shu-red-light: #A52A2A;    /* 浅朱砂 */
    --shu-gold: #B8860B;         /* 青铜金 - 暗金色 */
    --shu-gold-light: #DAA520;   /* 亮金 */
    --shu-bamboo: #4A7C59;       /* 竹青 - 蜀地象征 */
    --shu-ink: #1A1A2E;          /* 墨夜 */
    --shu-paper: #F8F5F0;        /* 宣纸白 */
    --shu-paper-dark: #E8E0D5;   /* 深宣纸 */
    --shu-stone: #6B6B7B;        /* 青石 */
    --shu-line: rgba(184, 134, 11, 0.15);  /* 金线 */
    
    /* 字体栈 */
    --font-serif: 'Noto Serif SC', 'STSong', 'SimSun', Georgia, serif;
    --font-sans: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    --font-display: 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    min-height: 100%;
    background: var(--shu-ink);
    color: var(--shu-paper);
    font-family: var(--font-sans);
    font-weight: 400;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, select, input {
    font-family: inherit;
    font-size: inherit;
}

/* ========== 背景装饰 - 水墨晕染效果 ========== */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: 
        radial-gradient(ellipse at 20% 30%, rgba(139, 37, 0, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(184, 134, 11, 0.06) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 70%, rgba(74, 124, 89, 0.05) 0%, transparent 55%);
    z-index: 0;
}

/* ========== 主布局 ========== */
.shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(420px, 1.1fr);
    height: 100vh;
    overflow: hidden;
    background: var(--shu-ink);
}

/* ========== 地图区域 ========== */
.map-stage {
    position: relative;
    overflow: hidden;
    border-right: 1px solid var(--shu-line);
    background: linear-gradient(160deg, #12121f 0%, #0e0e1a 50%, #0a0a14 100%);
}

/* 回纹装饰边框 */
.map-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: 
        linear-gradient(rgba(184, 134, 11, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(184, 134, 11, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black 0%, transparent 85%);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 85%);
}

/* ========== 顶部标题区 ========== */
header{position:absolute;top:0;left:0;right:0;z-index:4;padding:32px 38px;display:flex;justify-content:space-between;gap:20px;align-items:flex-start;background:linear-gradient(to bottom,rgba(3,9,19,.92),transparent)}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.eyebrow {
    color: var(--shu-gold);
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    opacity: 0.9;
}

.title {
    margin: 4px 0 2px;
    font-family: var(--font-serif);
    font-size: clamp(32px, 3.5vw, 60px);
    font-weight: 900;
    letter-spacing: 0.08em;
    color: var(--shu-paper);
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

.subtitle {
    margin: 0;
    color: rgba(248, 245, 240, 0.7);
    font-family: var(--font-serif);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1.5;
}

/* ========== 地图工具栏 ========== */
.map-tools {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.map-tools .map-status {
    white-space: nowrap;
    border: 1px solid rgba(184, 134, 11, 0.25);
    background: rgba(26, 26, 46, 0.85);
    color: var(--shu-gold-light);
    border-radius: 6px;
    padding: 8px 14px;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.theme-switch {
    display: flex;
    padding: 4px;
    border: 1px solid rgba(184, 134, 11, 0.2);
    border-radius: 8px;
    background: rgba(26, 26, 46, 0.9);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    margin-top: 30px;
}

.theme-button {
    min-width: 56px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: rgba(248, 245, 240, 0.6);
    padding: 8px 14px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-button:hover {
    color: var(--shu-paper);
    background: rgba(184, 134, 11, 0.1);
}

.theme-button.active {
    background: var(--shu-red);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(139, 37, 0, 0.4);
}

/* ========== 统计信息 ========== */
.stats {
    position: absolute;
    left: 32px;
    top: 165px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat {
    min-width: 82px;
    padding: 10px 14px;
    border: 1px solid rgba(184, 134, 11, 0.15);
    border-radius: 8px;
    background: rgba(26, 26, 46, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.25s ease;
}

.stat:hover {
    border-color: rgba(184, 134, 11, 0.3);
    transform: translateY(-1px);
}

.stat strong {
    display: block;
    color: var(--shu-gold-light);
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat span {
    font-family: var(--font-sans);
    font-size: 9px;
    color: rgba(248, 245, 240, 0.5);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ========== 地图容器 ========== */
#bmapMap {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #0e0e1a;
    transition: background 0.3s ease;
}

.map-stage[data-map-theme="light"] #bmapMap {
    background: var(--shu-paper-dark);
}

#bmapMap .BMap_mask {
    background: inherit;
}

/* ========== 加载遮罩 ========== */
.map-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 20, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
}

.map-stage[data-map-theme="light"] .map-loading-overlay {
    background: rgba(232, 224, 213, 0.88);
}

.map-loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.map-loading-overlay .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(184, 134, 11, 0.15);
    border-top-color: var(--shu-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.map-stage[data-map-theme="light"] .map-loading-overlay .spinner {
    border-color: rgba(139, 37, 0, 0.15);
    border-top-color: var(--shu-red);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== 地图暗角效果 ========== */
.map-vignette {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    box-shadow: inset 0 0 120px 40px rgba(5, 5, 15, 0.75);
    background: linear-gradient(to bottom, rgba(5, 5, 15, 0.55) 0%, transparent 30%, transparent 70%, rgba(5, 5, 15, 0.5) 100%);
    transition: background 0.25s, box-shadow 0.25s;
}

/* ========== 状态提示 ========== */
.map-status {
    position: absolute;
    top: 16px;
    right: 32px;
    z-index: 5;
    max-width: 440px;
    padding: 10px 14px;
    border: 1px solid rgba(184, 134, 11, 0.2);
    border-radius: 8px;
    background: rgba(26, 26, 46, 0.9);
    color: var(--shu-gold-light);
    font-family: var(--font-sans);
    font-size: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.map-status.error {
    border-color: rgba(165, 42, 42, 0.5);
    color: #ff8a80;
}

/* ========== 地图标记点 - 印章风格 ========== */
.life-marker {
    position: relative;
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--shu-gold-light);
    border-radius: 50%;
    background: var(--shu-red);
    box-shadow: 
        0 0 0 6px rgba(139, 37, 0, 0.15),
        0 0 20px rgba(139, 37, 0, 0.6);
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
                background 0.25s, 
                box-shadow 0.25s;
}

.life-marker::before {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
}

.life-marker:hover,
.life-marker.active {
    transform: scale(1.4);
    background: var(--shu-gold);
    border-color: #fff;
    box-shadow: 
        0 0 0 8px rgba(184, 134, 11, 0.2),
        0 0 24px rgba(184, 134, 11, 0.8);
}

.life-marker.muted {
    opacity: 0.25;
}

/* ========== 信息弹窗 ========== */
.bmap-info-content {
    max-width: min(380px, 84vw);
    white-space: normal !important;
}

.life-info-content {
    width: min(340px, 72vw);
    max-height: 260px;
    overflow-x: hidden;
    overflow-y: auto;
    overflow-wrap: anywhere;
    white-space: normal;
    color: #1a1a2e;
    padding-right: 6px;
    font-family: var(--font-sans);
}

.life-info-content strong {
    display: block;
    margin-bottom: 6px;
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 700;
    color: var(--shu-ink);
}

.life-info-content > span {
    color: var(--shu-red);
    font-weight: 600;
    font-family: var(--font-display);
}

.life-info-content p {
    margin: 8px 0 0;
    line-height: 1.65;
    color: #4a4a5a;
    font-size: 12px;
}

.info-story-hook {
    display: inline-flex;
    margin: 0 0 10px;
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(184, 134, 11, 0.12);
    color: var(--shu-gold);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
}

/* ========== 播放控制面板 ========== */
.play-panel {
    position: absolute;
    left: 50%;
    right: auto;
    bottom: 28px;
    transform: translateX(-50%);
    width: min(600px, calc(100% - 56px));
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(184, 134, 11, 0.2);
    background: rgba(26, 26, 46, 0.92);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 5;
}

.play-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.play {
    border: 0;
    border-radius: 8px;
    background: var(--shu-red);
    color: #fff;
    font-family: var(--font-sans);
    font-weight: 600;
    padding: 10px 18px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 40px;
    letter-spacing: 0.02em;
}

.play:hover {
    background: var(--shu-red-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 37, 0, 0.4);
}

.reset {
    min-height: 40px;
    border: 1px solid rgba(184, 134, 11, 0.5);
    border-radius: 8px;
    background: rgba(184, 134, 11, 0.7);
    color: rgba(248, 245, 240, 0.75);
    padding: 9px 14px;
    font-family: var(--font-sans);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.reset:hover {
    background: rgba(184, 134, 11, 0.1);
    border-color: rgba(184, 134, 11, 0.4);
    color: #1A1A2E;
}

.speed {
    border-radius: 8px;
    border: 1px solid rgba(184, 134, 11, 0.2);
    background: rgba(26, 26, 46, 0.8);
    color: var(--shu-paper);
    padding: 8px 10px;
    font-family: var(--font-display);
}

.now-year {
    min-width: 60px;
    text-align: center;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--shu-gold-light);
    letter-spacing: -0.02em;
}

/* ========== 进度条 ========== */
.progress-line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

.route-progress {
    height: 4px;
    overflow: hidden;
    background: rgba(184, 134, 11, 0.12);
    border-radius: 4px;
}

.route-progress i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--shu-red), var(--shu-gold));
    border-radius: 4px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-line span {
    color: rgba(248, 245, 240, 0.5);
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* ========== 右侧面板 ========== */
aside {
    height: 100vh;
    overflow: auto;
    background: #161625;
    color: var(--shu-paper);
    scrollbar-width: thin;
    scrollbar-color: rgba(184, 134, 11, 0.3) transparent;
    transition: background 0.3s, color 0.3s;
}

aside::-webkit-scrollbar {
    width: 6px;
}

aside::-webkit-scrollbar-track {
    background: transparent;
}

aside::-webkit-scrollbar-thumb {
    background: rgba(184, 134, 11, 0.3);
    border-radius: 3px;
}

aside::-webkit-scrollbar-thumb:hover {
    background: rgba(184, 134, 11, 0.5);
}

.side-head {
    position: sticky;
    top: 0;
    z-index: 6;
    padding: 28px 28px 20px;
    background: linear-gradient(to bottom, #181828 80%, rgba(24, 24, 40, 0.95));
    border-bottom: 1px solid rgba(184, 134, 11, 0.15);
}

.side-kicker {
    margin-bottom: 10px;
    color: var(--shu-gold);
    font-family: var(--font-sans);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

.side-head h2 {
    margin: 0 0 10px;
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
    color: var(--shu-paper);
    letter-spacing: 0.04em;
}

.summary {
    margin: 0 0 16px;
    color: rgba(248, 245, 240, 0.65);
    font-family: var(--font-sans);
    font-size: 12px;
    line-height: 1.8;
    font-weight: 300;
}

.filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(184, 134, 11, 0.3) transparent;
    -webkit-overflow-scrolling: touch;
}

.filters::-webkit-scrollbar {
    height: 4px;
}

.filters::-webkit-scrollbar-track {
    background: transparent;
}

.filters::-webkit-scrollbar-thumb {
    background: rgba(184, 134, 11, 0.3);
    border-radius: 2px;
}

.filters::-webkit-scrollbar-thumb:hover {
    background: rgba(184, 134, 11, 0.5);
}

.filter {
    white-space: nowrap;
    border-radius: 6px;
    border: 1px solid rgba(184, 134, 11, 0.15);
    background: transparent;
    color: rgba(248, 245, 240, 0.6);
    padding: 7px 12px;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.filter:hover {
    border-color: rgba(184, 134, 11, 0.3);
    color: var(--shu-paper);
}

.filter.active {
    border-color: var(--shu-red);
    background: var(--shu-red);
    color: #fff;
    font-weight: 600;
}

/* ========== 时间线区域 ========== */
.timeline {
    padding: 20px 24px 64px;
}

/* ========== 人物画廊 ========== */
.module-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.module-heading small {
    display: block;
    color: var(--shu-gold);
    font-family: var(--font-sans);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.module-heading h3 {
    margin: 4px 0 0;
    font-family: var(--font-serif);
    font-size: 19px;
    font-weight: 700;
    color: var(--shu-paper);
}

.portrait-gallery {
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid rgba(184, 134, 11, 0.15);
    border-radius: 12px;
    background: #1c1c30;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.gallery-actions {
    display: flex;
    gap: 6px;
}

.gallery-button {
    width: 34px;
    height: 30px;
    border: 1px solid rgba(184, 134, 11, 0.2);
    border-radius: 6px;
    background: transparent;
    color: rgba(248, 245, 240, 0.7);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-button:hover {
    border-color: var(--shu-gold);
    background: rgba(184, 134, 11, 0.1);
    color: var(--shu-gold-light);
}

.portrait-viewport {
    overflow: hidden;
    border-radius: 8px;
}

.portrait-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
    touch-action: pan-x;
}

.portrait-track::-webkit-scrollbar {
    display: none;
}

.gallery-slide {
    flex: 0 0 100%;
    min-width: 100%;
    aspect-ratio: 4/3;
    scroll-snap-align: start;
}

.gallery-slide > figure {
    width: 100%;
    height: 100%;
}

.portrait-card {
    margin: 0;
    min-width: 0;
    min-height: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    position: relative;
}

.portrait-card img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
}

.portrait-card figcaption {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 10px;
    z-index: 2;
    display: flex;
    align-items: end;
    justify-content: space-between;
    padding: 24px 12px 10px;
    background: linear-gradient(transparent, rgba(26, 26, 46, 0.85));
    color: var(--shu-paper);
}

.portrait-card figcaption strong {
    font-family: var(--font-serif);
    font-size: 21px;
    font-weight: 700;
}

.portrait-card figcaption span {
    font-family: var(--font-sans);
    font-size: 9px;
    color: rgba(248, 245, 240, 0.7);
    font-weight: 400;
}

.gallery-index {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    color: rgba(248, 245, 240, 0.5);
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 500;
}

.gallery-index i {
    width: 36px;
    height: 2px;
    background: var(--shu-red);
    border-radius: 1px;
}

/* ========== 故事幻灯片 ========== */
.story-slide {
    position: relative;
    margin: 0;
    overflow: hidden;
    background: #12121f;
    border-radius: 8px;
}

.story-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-slide figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 40px 14px 12px;
    background: linear-gradient(transparent, rgba(18, 18, 31, 0.92));
    color: var(--shu-paper);
    font-family: var(--font-sans);
    font-size: 10px;
    line-height: 1.5;
    font-weight: 400;
}

/* ========== 时间线卡片 - 卷轴风格 ========== */
.timeline-card {
    position: relative;
    margin: 0 0 16px;
    padding: 20px 20px 18px 26px;
    border: 1px solid rgba(184, 134, 11, 0.12);
    border-radius: 10px;
    background: #1a1a2e;
    cursor: pointer;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), 
                border-color 0.28s, 
                opacity 0.28s, 
                background 0.3s, 
                color 0.3s,
                box-shadow 0.28s;
}

/* 卷轴左侧装饰线 */
.timeline-card::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 18px;
    bottom: 18px;
    width: 3px;
    background: rgba(184, 134, 11, 0.2);
    border-radius: 2px;
    transition: background 0.28s, box-shadow 0.28s;
}

.timeline-card:hover {
    transform: translateX(-4px);
    border-color: rgba(184, 134, 11, 0.35);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.timeline-card.active {
    border-color: var(--shu-red);
    background: #1e1e35;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.25);
}

.timeline-card.active::before {
    background: var(--shu-red);
    box-shadow: 0 0 14px rgba(139, 37, 0, 0.5);
}

.timeline-card.hidden {
    display: none;
}

.timeline-card.has-visual::after {
    content: "故事图";
    position: absolute;
    right: 18px;
    bottom: 16px;
    color: var(--shu-gold);
    font-family: var(--font-sans);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    opacity: 0.7;
}

.card-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.year {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--shu-gold-light);
    letter-spacing: -0.02em;
}

.confidence {
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 20px;
    background: rgba(74, 124, 89, 0.1);
    color: #7ec8a0;
}

.confidence.inferred {
    background: rgba(184, 134, 11, 0.1);
    color: var(--shu-gold-light);
}

.confidence.disputed {
    background: rgba(165, 42, 42, 0.12);
    color: #e57373;
}

.place {
    margin: 10px 0 3px;
    color: var(--shu-red-light);
    font-family: var(--font-serif);
    font-size: 14px;
    font-weight: 600;
}

.place span {
    margin-left: 8px;
    color: rgba(248, 245, 240, 0.45);
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 400;
}

.story-hook {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 2px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(184, 134, 11, 0.25);
    background: rgba(184, 134, 11, 0.08);
    color: var(--shu-gold-light);
    font-family: var(--font-sans);
}

.story-hook span {
    font-weight: 600;
}

.story-hook small {
    color: rgba(184, 134, 11, 0.7);
    font-weight: 400;
}

.timeline-card h3 {
    margin: 8px 0 8px;
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 600;
    color: var(--shu-paper);
    line-height: 1.4;
}

.timeline-card p {
    margin: 0;
    color: rgba(248, 245, 240, 0.7);
    line-height: 1.75;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 300;
}

.timeline-card details {
    margin-top: 14px;
    font-family: var(--font-sans);
    font-size: 11px;
    color: rgba(248, 245, 240, 0.5);
}

.timeline-card summary {
    cursor: pointer;
    color: rgba(248, 245, 240, 0.65);
    font-weight: 500;
}

.sources {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.sources a,
.sources span,
.bmap-link {
    color: #64b5f6;
    text-decoration: none;
    font-family: var(--font-sans);
}

.sources a:hover,
.bmap-link:hover {
    text-decoration: underline;
    color: #90caf9;
}

.bmap-link {
    display: inline-block;
    margin-top: 14px;
    font-size: 11px;
    font-weight: 500;
}

/* ========== 页脚 ========== */
.footnote {
    padding: 0 28px 40px;
    color: rgba(248, 245, 240, 0.4);
    font-family: var(--font-sans);
    font-size: 11px;
    line-height: 1.7;
    font-weight: 300;
    margin-top: -50px;
}

/* ========== 浅色主题 ========== */
.map-stage[data-map-theme="light"] header {
    background: linear-gradient(to bottom, rgba(248, 245, 240, 0.96) 0%, rgba(248, 245, 240, 0.75) 55%, transparent 100%);
}

.map-stage[data-map-theme="light"] .eyebrow {
    color: var(--shu-gold);
}

.map-stage[data-map-theme="light"] .title {
    color: var(--shu-ink);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.map-stage[data-map-theme="light"] .subtitle {
    color: rgba(26, 26, 46, 0.65);
}

.map-stage[data-map-theme="light"] .map-tools .map-status {
    border-color: rgba(139, 37, 0, 0.2);
    background: rgba(248, 245, 240, 0.92);
    color: var(--shu-red);
}

.map-stage[data-map-theme="light"] .theme-switch {
    border-color: rgba(26, 26, 46, 0.12);
    background: rgba(248, 245, 240, 0.95);
}

.map-stage[data-map-theme="light"] .theme-button {
    color: rgba(26, 26, 46, 0.6);
}

.map-stage[data-map-theme="light"] .theme-button:hover {
    color: var(--shu-ink);
    background: rgba(139, 37, 0, 0.08);
}

.map-stage[data-map-theme="light"] .theme-button.active {
    color: #fff;
}

.map-stage[data-map-theme="light"] .map-vignette {
    box-shadow: inset 0 0 80px 20px rgba(26, 26, 46, 0.08);
    background: linear-gradient(to bottom, rgba(248, 245, 240, 0.3) 0%, transparent 25%, transparent 75%, rgba(232, 224, 213, 0.4) 100%);
}

.map-stage[data-map-theme="light"] .map-status {
    border-color: rgba(139, 37, 0, 0.18);
    background: rgba(248, 245, 240, 0.92);
    color: var(--shu-red);
}

.map-stage[data-map-theme="light"] .stat,
.map-stage[data-map-theme="light"] .play-panel {
    border-color: rgba(26, 26, 46, 0.1);
    background: rgba(248, 245, 240, 0.92);
    color: var(--shu-ink);
}

.map-stage[data-map-theme="light"] .stat span {
    color: rgba(26, 26, 46, 0.5);
}

.map-stage[data-map-theme="light"] .speed {
    border-color: rgba(26, 26, 46, 0.12);
    background: #fff;
    color: var(--shu-ink);
}

.shell[data-theme="light"] aside {
    background: var(--shu-paper);
    color: var(--shu-ink);
    scrollbar-color: rgba(139, 37, 0, 0.25) transparent;
}

.shell[data-theme="light"] .side-head {
    background: linear-gradient(to bottom, #f5f0e8 80%, rgba(245, 240, 232, 0.96));
    border-color: rgba(139, 37, 0, 0.12);
}

.shell[data-theme="light"] .side-head h2 {
    color: var(--shu-ink);
}

.shell[data-theme="light"] .summary {
    color: rgba(26, 26, 46, 0.6);
}

.shell[data-theme="light"] .portrait-gallery {
    border-color: rgba(139, 37, 0, 0.12);
    background: #faf7f2;
    box-shadow: 0 14px 32px rgba(26, 26, 46, 0.06);
}

.shell[data-theme="light"] .module-heading h3,
.shell[data-theme="light"] .timeline-heading {
    color: var(--shu-ink);
}

.shell[data-theme="light"] .gallery-button {
    border-color: rgba(139, 37, 0, 0.15);
    color: rgba(26, 26, 46, 0.6);
}

.shell[data-theme="light"] .gallery-button:hover {
    border-color: var(--shu-red);
    color: var(--shu-red);
    background: rgba(139, 37, 0, 0.06);
}

.shell[data-theme="light"] .story-slide {
    background: #ede8df;
}

.shell[data-theme="light"] .timeline-card {
    border-color: rgba(139, 37, 0, 0.06);
    background: #faf7f2;
    color: var(--shu-ink);
    box-shadow: 0 4px 16px rgba(26, 26, 46, 0.03);
}

.shell[data-theme="light"] .timeline-card:hover {
    border-color: rgba(139, 37, 0, 0.15);
    box-shadow: 0 6px 20px rgba(26, 26, 46, 0.06);
}

.shell[data-theme="light"] .timeline-card.active {
    border-color: var(--shu-red);
    background: #fff;
    box-shadow: 0 10px 28px rgba(139, 37, 0, 0.08);
}

.shell[data-theme="light"] .timeline-card.active::before {
    background: var(--shu-red);
}

.shell[data-theme="light"] .timeline-card p {
    color: rgba(26, 26, 46, 0.65);
}

.shell[data-theme="light"] .filter {
    border-color: rgba(139, 37, 0, 0.12);
    color: rgba(26, 26, 46, 0.6);
}

.shell[data-theme="light"] .filter:hover {
    border-color: rgba(139, 37, 0, 0.25);
    color: var(--shu-ink);
}

.shell[data-theme="light"] .filter.active {
    border-color: var(--shu-red);
    background: var(--shu-red);
    color: #fff;
}

.shell[data-theme="light"] .year {
    color: var(--shu-gold);
}

.shell[data-theme="light"] .confidence {
    background: rgba(74, 124, 89, 0.1);
    color: var(--shu-bamboo);
}

.shell[data-theme="light"] .confidence.inferred {
    background: rgba(184, 134, 11, 0.1);
    color: var(--shu-gold);
}

.shell[data-theme="light"] .place span {
    color: rgba(26, 26, 46, 0.45);
}

.shell[data-theme="light"] .story-hook {
    border-color: rgba(184, 134, 11, 0.25);
    background: rgba(184, 134, 11, 0.08);
    color: var(--shu-gold);
}

.shell[data-theme="light"] .story-hook small {
    color: rgba(184, 134, 11, 0.7);
}

.shell[data-theme="light"] .timeline-card details,
.shell[data-theme="light"] .timeline-card summary {
    color: rgba(26, 26, 46, 0.5);
}

.shell[data-theme="light"] .sources a,
.shell[data-theme="light"] .bmap-link {
    color: #1565c0;
}

.shell[data-theme="light"] .sources a:hover,
.shell[data-theme="light"] .bmap-link:hover {
    color: #1976d2;
}

.shell[data-theme="light"] .footnote {
    color: rgba(26, 26, 46, 0.4);
}

/* ========== 响应式设计 ========== */
@media (max-width: 1024px) {
    .shell {
        grid-template-columns: 1fr;
        grid-template-rows: 55vh minmax(0, 1fr);
    }
    
    .map-stage {
        border-right: 0;
        border-bottom: 1px solid var(--shu-line);
    }

    /* 关键：单列下aside不再固定100vh，否则grid行只有45vh，底部内容被裁、永远滚不到 */
    aside {
        height: 100%;
        min-height: 0;
    }
    
    header {
        padding: 20px 24px;
    }
    
    .stats {
        left: 24px;
        top: 140px;
    }

    .map-status {
        max-width: 40vw;
        font-size: 10px;
        padding: 8px 10px;
    }
    
    .play-panel {
        width: min(520px, calc(100% - 40px));
        bottom: 20px;
    }
}

@media (max-width: 640px) {
    .shell {
        grid-template-rows: 52vh minmax(0, 1fr);
    }
    
    header {
        padding: 14px 16px;
        gap: 10px;
    }
    
    .title {
        font-size: clamp(24px, 7vw, 34px);
    }

    .subtitle {
        font-size: 11px;
    }

    /* 顶部状态条让位给标题，仅保留小圆点式提示宽度 */
    .map-status {
        max-width: 34vw;
        font-size: 9px;
        padding: 6px 8px;
        white-space: normal;
        line-height: 1.4;
    }

    .theme-switch {
        margin-top: 0;
    }

    .theme-button {
        min-width: 44px;
        padding: 7px 10px;
    }
    
    .stats {
        left: 14px;
        top: 118px;
        flex-direction: row;
        gap: 6px;
    }
    
    .stat {
        min-width: 64px;
        padding: 7px 9px;
    }

    .stat strong {
        font-size: 15px;
    }

    /* 触摸目标放大：标记点 20px → 28px */
    .life-marker {
        width: 28px;
        height: 28px;
        border-width: 3px;
    }

    .life-marker::before {
        inset: 4px;
    }
    
    .play-panel {
        width: calc(100% - 24px);
        padding: 11px 12px;
        bottom: 14px;
    }
    
    .play-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .play, .reset {
        min-height: 38px;
        padding: 9px 14px;
    }

    .now-year {
        font-size: 15px;
        min-width: 0;
        margin-left: auto;
    }

    .timeline {
        padding: 18px 16px 56px;
    }

    .side-head {
        padding: 22px 18px 16px;
    }

    .footnote {
        padding: 0 18px 32px;
    }
}

/* 横屏矮高度（手机横屏 / 小窗口）：隐藏统计块，地图舞台让给播放面板 */
@media (max-height: 480px) and (max-width: 1024px) {
    .shell {
        grid-template-rows: 100vh;
    }

    .stats {
        display: none;
    }

    .play-panel {
        bottom: 10px;
        padding: 8px 12px;
    }

    .progress-line {
        margin-top: 8px;
    }

    header {
        padding: 10px 18px;
    }

    .subtitle {
        display: none;
    }
}
/* ============================================================
   v1.6 工具组 / 情感强度 / Toast / 打印
   ============================================================ */

/* ---- 工具按钮组 ---- */
.tool-group {
    display: flex;
    gap: 6px;
    padding: 4px;
    border: 1px solid rgba(184, 134, 11, 0.2);
    border-radius: 8px;
    background: rgba(26, 26, 46, 0.9);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.tool-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: rgba(248, 245, 240, 0.62);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-button:hover {
    color: var(--shu-paper);
    background: rgba(184, 134, 11, 0.14);
}

.tool-button.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(139, 37, 0, 0.9), rgba(184, 134, 11, 0.85));
    box-shadow: 0 0 12px rgba(218, 165, 32, 0.35);
}

.tool-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ---- 时间线：情感强度条 ---- */
.intensity-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 10px 0 2px;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid rgba(184, 134, 11, 0.14);
    background: rgba(184, 134, 11, 0.05);
}

.intensity-bar .intensity-label {
    font-size: 10px;
    letter-spacing: 0.14em;
    color: rgba(248, 245, 240, 0.42);
    margin-right: 2px;
}

.intensity-bar i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(248, 245, 240, 0.12);
    transition: background 0.25s, box-shadow 0.25s, transform 0.25s;
}

.intensity-bar i.on {
    background: var(--shu-gold-light);
    box-shadow: 0 0 6px rgba(218, 165, 32, 0.55);
}

.intensity-bar em {
    margin-left: auto;
    font-style: normal;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: rgba(248, 245, 240, 0.5);
}

/* 强度越高，卡片左侧色带越亮 */
.timeline-card {
    position: relative;
}
.timeline-card::before {
    content: "";
    position: absolute;
    left: 0; top: 12px; bottom: 12px;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: rgba(184, 134, 11, 0.25);
}
.timeline-card.intensity-lvl-4::before { background: rgba(218, 165, 32, 0.7); }
.timeline-card.intensity-lvl-5::before {
    background: linear-gradient(180deg, #ff7a4d, var(--shu-red));
    box-shadow: 0 0 10px rgba(255, 90, 72, 0.5);
}
.timeline-card.intensity-lvl-5.intensity-bar i.on {
    background: #ff7a4d;
    box-shadow: 0 0 7px rgba(255, 122, 77, 0.7);
}

/* ---- 地图标记：按情感强度发光 ---- */
.life-marker.intensity-1 { box-shadow: 0 0 0 2px rgba(10, 13, 26, 0.8); }
.life-marker.intensity-2 { box-shadow: 0 0 4px rgba(218, 165, 32, 0.3); }
.life-marker.intensity-3 { box-shadow: 0 0 7px rgba(218, 165, 32, 0.45); }
.life-marker.intensity-4 {
    width: 22px; height: 22px;
    box-shadow: 0 0 10px rgba(255, 160, 60, 0.6);
}
.life-marker.intensity-5 {
    width: 24px; height: 24px;
    box-shadow: 0 0 14px rgba(255, 90, 72, 0.8), 0 0 26px rgba(255, 90, 72, 0.35);
    animation: marker-pulse 1.8s ease-in-out infinite;
}
@keyframes marker-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(255, 90, 72, 0.75), 0 0 22px rgba(255, 90, 72, 0.3); }
    50%      { box-shadow: 0 0 18px rgba(255, 90, 72, 0.95), 0 0 34px rgba(255, 90, 72, 0.5); }
}

/* ---- Toast ---- */
.app-toast {
    position: fixed;
    left: 50%;
    bottom: 84px;
    transform: translate(-50%, 16px);
    z-index: 9999;
    max-width: min(86vw, 420px);
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid rgba(218, 165, 32, 0.35);
    background: rgba(18, 18, 34, 0.94);
    color: var(--shu-paper);
    font-family: var(--font-sans);
    font-size: 12.5px;
    letter-spacing: 0.02em;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s, transform 0.28s;
}
.app-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---- 浅色主题适配 ---- */
.map-stage[data-map-theme="light"] .tool-group,
.map-stage[data-map-theme="light"] .app-toast {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(139, 37, 0, 0.18);
    color: #3a2e22;
}
.map-stage[data-map-theme="light"] .tool-button { color: #6b5a44; }
.map-stage[data-map-theme="light"] .tool-button:hover { background: rgba(139, 37, 0, 0.08); }
.map-stage[data-map-theme="light"] .intensity-bar {
    background: rgba(139, 37, 0, 0.04);
    border-color: rgba(139, 37, 0, 0.12);
}
.map-stage[data-map-theme="light"] .intensity-bar .intensity-label,
.map-stage[data-map-theme="light"] .intensity-bar em { color: #9a8870; }
.map-stage[data-map-theme="light"] .intensity-bar i { background: rgba(58, 46, 34, 0.12); }

/* ---- 打印（导出PDF兜底） ---- */
@media print {
    body { background: #fff !important; }
    .map-stage, .map-tools, .map-rail, .play-panel, .stats, .theme-switch,
    .loading-overlay, .app-toast { display: none !important; }
    .shell { display: block !important; height: auto !important; }
    aside {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
}

/* ============================================================
   v1.6.1 地图右侧纵向悬浮工具栏
   ============================================================ */
.map-rail {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 6px;
    border: 1px solid rgba(184, 134, 11, 0.22);
    border-radius: 14px;
    background: rgba(18, 18, 34, 0.78);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.rail-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: rgba(248, 245, 240, 0.66);
    font-size: 17px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.rail-button:hover {
    color: var(--shu-paper);
    background: rgba(184, 134, 11, 0.16);
    transform: translateX(-2px);
}

.rail-button.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(139, 37, 0, 0.92), rgba(184, 134, 11, 0.85));
    box-shadow: 0 0 14px rgba(218, 165, 32, 0.4);
}

.rail-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* 浅色主题 */
.map-stage[data-map-theme="light"] .map-rail {
    background: rgba(255, 255, 255, 0.86);
    border-color: rgba(139, 37, 0, 0.18);
    box-shadow: 0 10px 30px rgba(30, 24, 18, 0.18);
}
.map-stage[data-map-theme="light"] .rail-button { color: #6b5a44; }
.map-stage[data-map-theme="light"] .rail-button:hover { background: rgba(139, 37, 0, 0.08); }

/* 窄屏：右移防遮挡，缩小尺寸 */
@media (max-width: 640px) {
    .map-rail {
        right: 10px;
        gap: 6px;
        padding: 6px 4px;
        border-radius: 12px;
    }
    .rail-button {
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 15px;
        border-radius: 9px;
    }
}

/* 横屏矮窗：避免与播放面板打架 */
@media (max-height: 480px) and (max-width: 1024px) {
    .map-rail {
        top: auto;
        bottom: 64px;
        transform: none;
        flex-direction: row;
    }
}

/* ============================================================
   v1.7 通用弹窗 / JSON 编辑器
   ============================================================ */
.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
    background: rgba(5, 8, 18, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: modal-fade 0.22s ease;
}
/* hidden 属性必须优先生效，否则进页面弹窗直接显示 */
.modal-mask[hidden] { display: none; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
    display: flex;
    flex-direction: column;
    width: min(860px, 94vw);
    max-height: 90vh;
    border: 1px solid rgba(218, 165, 32, 0.28);
    border-radius: 14px;
    background: #141423;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(79, 208, 232, 0.06);
    overflow: hidden;
    animation: modal-pop 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
/* 同层多个弹窗，只显示当前打开的一个 */
.modal:not(.show) { display: none; }
@keyframes modal-pop {
    from { opacity: 0; transform: translateY(14px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}

.modal-doc { width: min(900px, 94vw); }

.modal-head {
    position: static;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(218, 165, 32, 0.16);
    background: linear-gradient(135deg, rgba(139, 37, 0, 0.16), transparent 70%);
}
.modal-head h2 {
    margin: 0;
    color: var(--shu-paper);
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.modal-head p {
    margin: 4px 0 0;
    font-size: 12px;
    color: rgba(248, 245, 240, 0.48);
}
.modal-head a { color: var(--shu-gold-light); }

.modal-close {
    flex: none;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(248, 245, 240, 0.55);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}
.modal-close:hover {
    background: rgba(218, 165, 32, 0.14);
    color: var(--shu-paper);
}

.modal-body {
    padding: 18px 22px 20px;
    overflow: auto;
}

/* ---- 结构速查 ---- */
.schema-hint {
    margin-bottom: 12px;
    border: 1px solid rgba(218, 165, 32, 0.14);
    border-radius: 8px;
    background: rgba(10, 13, 26, 0.5);
}
.schema-hint summary {
    padding: 9px 12px;
    font-size: 12px;
    letter-spacing: 0.08em;
    color: rgba(248, 245, 240, 0.7);
    cursor: pointer;
    user-select: none;
}
.schema-hint pre {
    margin: 0;
    padding: 10px 14px 12px;
    border-top: 1px solid rgba(218, 165, 32, 0.1);
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.7;
    color: #8fd8e8;
    overflow-x: auto;
}

/* ---- JSON 工具条 ---- */
.json-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.mini-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border: 1px solid rgba(218, 165, 32, 0.25);
    border-radius: 7px;
    background: rgba(218, 165, 32, 0.08);
    color: rgba(248, 245, 240, 0.82);
    font-family: var(--font-sans);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.mini-btn:hover {
    background: rgba(218, 165, 32, 0.18);
    border-color: rgba(218, 165, 32, 0.45);
}
.json-state {
    margin-left: auto;
    font-size: 12px;
    color: rgba(248, 245, 240, 0.45);
}
.json-state.ok { color: #5fd68a; }
.json-state.err { color: #ff7a6b; }

/* ---- JSON 编辑区 ---- */
.json-editor {
    display: block;
    width: 100%;
    height: min(46vh, 520px);
    padding: 14px 16px;
    border: 1px solid rgba(79, 208, 232, 0.18);
    border-radius: 10px;
    background: #0b0f1c;
    color: #c9d8e8;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12.5px;
    line-height: 1.7;
    tab-size: 2;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.json-editor:focus {
    border-color: rgba(79, 208, 232, 0.5);
    box-shadow: 0 0 0 3px rgba(79, 208, 232, 0.1);
}
.json-tip {
    margin-top: 10px;
    font-size: 11.5px;
    line-height: 1.7;
    color: rgba(248, 245, 240, 0.42);
}
.json-tip code {
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(79, 208, 232, 0.12);
    color: #8fd8e8;
}

/* ---- 文档弹窗 iframe ---- */
.modal-doc .modal-body { padding: 0; }
.modal-doc iframe {
    display: block;
    width: 100%;
    height: min(78vh, 720px);
    border: 0;
    background: #141423;
}

/* ---- 窄屏 ---- */
@media (max-width: 640px) {
    .modal-mask { padding: 2vh 2vw; }
    .modal { max-height: 94vh; border-radius: 12px; }
    .modal-head { padding: 14px 16px; }
    .modal-body { padding: 14px 14px 16px; }
    .json-state { margin-left: 0; flex-basis: 100%; }
    .mini-btn { flex: 1; justify-content: center; }
}

/* ============================================================
   v1.8 表单式数据编辑器
   ============================================================ */
.modal-form { width: min(940px, 95vw); }

.modal-head-actions { display: flex; align-items: center; gap: 10px; flex: none; }

/* 视图切换 */
.view-toggle {
    display: flex;
    padding: 3px;
    border: 1px solid rgba(218, 165, 32, 0.22);
    border-radius: 8px;
    background: rgba(10, 13, 26, 0.6);
}
.vt-btn {
    border: 0;
    padding: 5px 14px;
    border-radius: 6px;
    background: transparent;
    color: rgba(248, 245, 240, 0.55);
    font-family: var(--font-sans);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.vt-btn.active {
    background: linear-gradient(135deg, rgba(139, 37, 0, 0.85), rgba(184, 134, 11, 0.8));
    color: #fff;
}

/* 分区 */
.form-section {
    margin-bottom: 22px;
    padding: 16px 18px;
    border: 1px solid rgba(218, 165, 32, 0.14);
    border-radius: 11px;
    background: rgba(10, 13, 26, 0.35);
}
.form-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.form-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 13px;
    font-family: var(--font-serif);
    font-size: 14.5px;
    color: var(--gold-light);
}
.form-section-head .form-section-title { margin-bottom: 0; }
.form-section-title i { font-size: 16px; }
.form-section-title em { font-style: normal; color: var(--cyan); }

/* 栅格表单 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 11px 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field > span {
    font-size: 11px;
    letter-spacing: 0.05em;
    color: rgba(248, 245, 240, 0.5);
}
.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid rgba(79, 208, 232, 0.16);
    border-radius: 7px;
    background: #0c101d;
    color: #d4e0ee;
    font-family: var(--font-sans);
    font-size: 12.5px;
    line-height: 1.55;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { resize: vertical; font-family: inherit; }
.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: rgba(79, 208, 232, 0.5);
    box-shadow: 0 0 0 3px rgba(79, 208, 232, 0.09);
}
.field select { cursor: pointer; }

/* 事件卡片列表 */
.event-forms { display: flex; flex-direction: column; gap: 8px; }
.event-card {
    border: 1px solid rgba(218, 165, 32, 0.14);
    border-radius: 9px;
    background: rgba(12, 16, 29, 0.6);
    overflow: hidden;
}
.event-card[open] { border-color: rgba(218, 165, 32, 0.32); background: rgba(12, 16, 29, 0.9); }
.event-card > summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    list-style: none;
}
.event-card > summary::-webkit-details-marker { display: none; }
.event-card > summary::before {
    content: "?";
    color: var(--gold);
    font-size: 15px;
    transition: transform 0.2s;
}
.event-card[open] > summary::before { transform: rotate(90deg); }
.ev-index {
    flex: none;
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(218, 165, 32, 0.14);
    color: var(--gold-light);
    font-size: 11.5px;
    font-weight: 700;
}
.ev-summary-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: rgba(248, 245, 240, 0.78);
}
.ev-intensity {
    flex: none;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 10.5px;
    border: 1px solid rgba(218, 165, 32, 0.25);
    color: var(--ink-2);
}
.ev-intensity.s1, .ev-intensity.s2 { color: #b8c4d4; }
.ev-intensity.s3 { color: var(--gold-light); border-color: rgba(218, 165, 32, 0.4); }
.ev-intensity.s4 { color: #ffb066; border-color: rgba(255, 160, 60, 0.45); }
.ev-intensity.s5 { color: #ff8a78; border-color: rgba(255, 90, 72, 0.5); }

.event-card-body { padding: 13px 15px 14px; border-top: 1px solid rgba(218, 165, 32, 0.1); }
.event-card-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }
.mini-btn.tiny { padding: 5px 10px; font-size: 11.5px; }
.mini-btn.danger { color: #ff9a8c; border-color: rgba(255, 90, 72, 0.3); }
.mini-btn.danger:hover { background: rgba(255, 90, 72, 0.14); border-color: rgba(255, 90, 72, 0.5); }
.mini-btn.primary {
    background: linear-gradient(135deg, rgba(139, 37, 0, 0.75), rgba(184, 134, 11, 0.7));
    border-color: rgba(218, 165, 32, 0.4);
    color: #fff;
}

/* 底部操作条 */
.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 8px;
}
.form-actions .json-state { margin-left: auto; }

/* 窄屏：表单单列 */
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-section { padding: 13px 12px; }
    .event-card > summary { padding: 9px 10px; gap: 7px; }
    .ev-intensity { display: none; }
    .form-actions .json-state { margin-left: 0; flex-basis: 100%; }
}

/* ========== v2.0 地图角标：历史疆域声明 ========== */
.map-disclaimer {
    position: absolute;
    left: 32px;
    bottom: 26px;
    z-index: 5;
    padding: 6px 12px;
    font-size: 12px;
    letter-spacing: .08em;
    color: rgba(248, 245, 240, .6);
    background: rgba(10, 13, 26, .55);
    border: 1px solid rgba(184, 134, 11, .28);
    border-radius: 4px;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    pointer-events: none;
}
@media (max-width: 900px) {
    .map-disclaimer { display: none; }
}

/* ========== v2.0 事件搜索 ========== */
.event-search {
    position: relative;
    margin-top: 12px;
    display: flex;
    align-items: center;
}
.event-search > .layui-icon-search {
    position: absolute;
    left: 11px;
    font-size: 14px;
    color: rgba(184, 134, 11, .7);
    pointer-events: none;
}
.event-search input {
    width: 100%;
    height: 36px;
    padding: 0 34px 0 33px;
    font-size: 13px;
    color: var(--shu-paper, #F8F5F0);
    background: rgba(10, 13, 26, .55);
    border: 1px solid rgba(184, 134, 11, .35);
    border-radius: 4px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.event-search input::placeholder { color: rgba(248, 245, 240, .4); }
.event-search input:focus {
    border-color: rgba(64, 180, 229, .75);
    box-shadow: 0 0 0 2px rgba(64, 180, 229, .15);
}
.event-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-clear {
    position: absolute;
    right: 8px;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    font-size: 13px;
    color: rgba(248, 245, 240, .55);
    background: none;
    border: none;
    cursor: pointer;
}
.search-clear:hover { color: rgba(248, 245, 240, .9); }
.search-counter {
    margin-top: 7px;
    font-size: 12px;
    letter-spacing: .04em;
    color: rgba(64, 180, 229, .85);
}
.search-counter:empty { display: none; }
.timeline-card.search-hidden { display: none; }
