/* ================= 基础:Q 版暖色纸面风 ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f7ecd9;
  --paper: #fffaef;
  --ink: #6b4a32;
  --muted: #a5876a;
  --line: #eaddc0;
  --line-strong: #d9b98c;
  --coral: #ff9a76;
  --coral-deep: #ef7d53;
  --butter: #ffd166;
  --gold: #e8a84c;
  --gold-deep: #c9852f;
  --mint: #9edcb5;
  --sky: #8ecae6;
  --male: #5fb7dd;
  --female: #ff8fab;
  --shadow: 0 10px 28px rgba(160, 110, 55, .16);
  --sticker: 0 4px 0 rgba(190, 150, 90, .28);
  --cute: "Songti SC", "SimSun", "宋体", serif;
  --serif: "Songti SC", "SimSun", "宋体", serif;
  --sans: "Songti SC", "SimSun", "宋体", serif;
}
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; touch-action: manipulation; }
.hidden { display: none !important; }

.page { position: fixed; inset: 0; opacity: 0; pointer-events: none; z-index: 1; }
.page.active { opacity: 1; pointer-events: auto; z-index: 2; }
.page > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ================= 启动遮罩 ================= */
#boot-loader { position: fixed; inset: 0; z-index: 100; background: radial-gradient(ellipse at 50% 40%, #fff6e2 0%, #f3e3c3 75%); display: flex; align-items: center; justify-content: center; transition: opacity .6s; }
#boot-loader.done { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; position: relative; }
.boot-ring { width: 132px; height: 132px; margin: 0 auto 26px; border-radius: 50%; border: 4px dashed rgba(239, 125, 83, .45); border-top-color: var(--coral-deep); animation: spin 2.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot-title { font-family: var(--cute); font-size: 44px; letter-spacing: 14px; color: var(--coral-deep); text-indent: 14px; }
.boot-sub { margin-top: 10px; color: var(--muted); font-size: 14px; letter-spacing: 3px; font-family: var(--cute); }

#page-veil { position: fixed; inset: 0; z-index: 60; background: radial-gradient(ellipse at center, #fff3da 0%, #f0dfbe 80%); opacity: 0; pointer-events: none; }

/* ================= 首页:中国版图人物热点 ================= */
#home-section { background: var(--bg); }

/* 顶栏浮在版图上,下方渐隐过渡到地图 */
#home-header { position: absolute; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) 14px calc(20px + env(safe-area-inset-left)); gap: 20px; background: linear-gradient(rgba(247, 236, 217, .92), rgba(247, 236, 217, .4) 70%, transparent); }

/* 「人物长廊」二级页入口 */
#btn-gallery { display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 10px 18px; background: var(--paper); border: 2.5px solid var(--line-strong); border-radius: 999px; font-family: var(--cute); font-size: 13.5px; letter-spacing: 1px; color: var(--ink); text-decoration: none; box-shadow: var(--sticker); transition: .2s; }
#btn-gallery:hover { border-color: var(--coral); color: var(--coral-deep); transform: translateY(-2px); }

/* 右上图例与操作提示 */
#home-hint { position: absolute; top: calc(86px + env(safe-area-inset-top)); right: calc(20px + env(safe-area-inset-right)); z-index: 6; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; pointer-events: none; }
#home-hint .lg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); background: rgba(255, 250, 239, .85); border: 1.5px solid var(--line); border-radius: 999px; padding: 3px 11px; }
#home-hint .lg.dim { font-size: 10.5px; letter-spacing: .5px; }
#home-hint .dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 1px 3px rgba(160, 110, 55, .3); }
#home-hint .dot.m { background: var(--male); }
#home-hint .dot.f { background: var(--female); }

/* 悬停热点提示(跟随光标) */
#home-tip { position: fixed; z-index: 40; transform: translate(-50%, -100%); display: flex; align-items: baseline; gap: 8px; pointer-events: none; padding: 5px 12px; background: var(--paper); border: 2px solid var(--coral); border-radius: 12px; font-family: var(--cute); font-size: 13px; white-space: nowrap; box-shadow: var(--sticker); }
#home-tip b { color: var(--coral-deep); font-weight: 400; }
#home-tip span { font-size: 10.5px; color: var(--muted); }

/* 点击热点弹出的人物卡(左下角) */
#person-card { position: absolute; left: calc(20px + env(safe-area-inset-left)); bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 20; display: flex; gap: 14px; width: 400px; padding: 16px 18px; background: var(--paper); border: 3px solid var(--line-strong); border-radius: 24px; box-shadow: var(--sticker), var(--shadow); }
#person-card.hidden { display: none; }
#pc-close { position: absolute; top: 10px; right: 12px; width: 28px; height: 28px; border-radius: 50%; background: #f6e8cf; color: var(--muted); font-size: 13px; }
#pc-close:hover { background: var(--coral); color: #fff; }
.pc-stage { flex: none; align-self: center; }
.pc-stage canvas { display: block; width: 104px; height: 136px; }
.pc-body { min-width: 0; display: flex; flex-direction: column; }
.pc-name-row { display: flex; align-items: center; gap: 8px; }
.pc-name-row b { font-family: var(--cute); font-size: 22px; font-weight: 400; letter-spacing: 2px; }
#pc-alias { font-size: 11.5px; color: var(--coral-deep); margin-top: 3px; }
#pc-years { font-size: 11px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
#pc-bio { margin-top: 8px; font-size: 11.5px; line-height: 1.7; color: #8a6a4d; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
#pc-go { margin-top: 10px; align-self: flex-start; display: inline-flex; align-items: center; padding: 7px 16px; border-radius: 999px; background: linear-gradient(140deg, #ffc178, var(--coral-deep)); color: #fff; font-family: var(--cute); font-size: 12.5px; letter-spacing: 1px; box-shadow: 0 3px 0 rgba(200, 100, 55, .4); transition: transform .15s; }
#pc-go:hover { transform: translateY(-2px); }

/* 底部朝代时间轴:播放即按朝代在版图上显隐人物 */
#home-timeline { position: absolute; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 calc(20px + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left)); pointer-events: none; }
#dyn-caption { font-family: var(--cute); font-size: 13px; letter-spacing: 1px; color: var(--ink); background: rgba(255, 250, 239, .92); border: 2px solid var(--line-strong); border-radius: 999px; padding: 5px 16px; box-shadow: var(--sticker); }
.tl-bar { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 100%; }
#btn-dyn-play { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(150deg, #ffc178, var(--coral-deep)); color: #fff; box-shadow: 0 4px 0 rgba(200, 100, 55, .45); transition: transform .15s; }
#btn-dyn-play:hover { transform: scale(1.07); }
#dyn-track { position: relative; display: flex; gap: 4px; max-width: 100%; overflow-x: auto; scrollbar-width: none; background: var(--paper); border: 2.5px solid var(--line-strong); border-radius: 999px; padding: 5px 8px; box-shadow: var(--sticker); }
#dyn-track::-webkit-scrollbar { display: none; }
#dyn-track button { flex: none; display: inline-flex; align-items: baseline; gap: 4px; padding: 6px 13px; border-radius: 999px; font-family: var(--cute); font-size: 13px; letter-spacing: 1px; color: var(--muted); transition: .2s; }
#dyn-track button i { font-style: normal; font-size: 9.5px; color: #c3a887; }
#dyn-track button:hover { color: var(--coral-deep); }
#dyn-track button.on { background: var(--coral); color: #fff; box-shadow: 0 2px 0 rgba(200, 100, 55, .4); }
#dyn-track button.on i { color: rgba(255, 255, 255, .85); }
/* 播放进度:当前朝代驻留进度线(scaleX 驱动) */
#dyn-play-fill { position: absolute; left: 12px; right: 12px; bottom: 3px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--coral), var(--butter)); transform: scaleX(0); transform-origin: left; pointer-events: none; }

/* ================= 二级页:人物长廊 ================= */
#gallery-section { display: flex; flex-direction: column; background: var(--bg); }

#gallery-header { position: relative; z-index: 10; flex: none; display: flex; align-items: center; gap: 18px; padding: calc(12px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) 10px calc(20px + env(safe-area-inset-left)); }
#btn-gallery-back { display: inline-flex; align-items: center; flex: none; padding: 9px 17px; background: var(--paper); border: 2.5px solid var(--line-strong); border-radius: 999px; font-size: 13.5px; font-family: var(--cute); color: var(--ink); box-shadow: var(--sticker); transition: .2s; }
#btn-gallery-back:hover { border-color: var(--coral); color: var(--coral-deep); transform: translateY(-2px); }
.gh-crumb h2 { font-family: var(--cute); font-size: 22px; font-weight: 400; letter-spacing: 6px; color: var(--ink); }

/* 右下角朝代大字水印:随滚动换朝,JS 控制 opacity 淡入淡出 */
#dyn-watermark {
  position: absolute; right: 1vw; bottom: -4vh; z-index: 0; pointer-events: none; user-select: none;
  font-family: var(--serif); font-weight: 900; font-size: min(52vh, 44vw); line-height: 1;
  color: rgba(107, 74, 50, .05);
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 50px; height: 50px; display: grid; place-items: center; font-family: var(--cute); font-size: 26px; color: #fff; background: linear-gradient(160deg, #ffb48f, var(--coral-deep)); border-radius: 16px; box-shadow: var(--sticker), 0 8px 20px rgba(239, 125, 83, .35); transform: rotate(-4deg); }
.brand-text h1 { font-family: var(--cute); font-size: 23px; font-weight: 400; letter-spacing: 2px; color: var(--ink); }
.brand-text p { font-size: 12px; color: var(--muted); letter-spacing: 1px; margin-top: 3px; }

#search-box { position: relative; display: flex; align-items: center; gap: 9px; width: 340px; padding: 11px 16px; background: var(--paper); border: 2.5px solid var(--line-strong); border-radius: 999px; color: var(--muted); box-shadow: var(--sticker); transition: border-color .25s, transform .2s; }
#search-box:focus-within { border-color: var(--coral); transform: translateY(-1px); }
#search-input { flex: 1; background: none; border: none; outline: none; color: var(--ink); font-size: 14px; }
#search-input::placeholder { color: #c3a887; }
#search-results { position: absolute; top: calc(100% + 10px); left: 0; right: 0; background: var(--paper); border: 2.5px solid var(--line-strong); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); z-index: 30; }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 11px 15px; cursor: pointer; border-bottom: 1.5px dashed var(--line); }
.sr-item:last-child { border-bottom: none; }
.sr-item:hover, .sr-item.sel { background: #ffeeda; }
.sr-item .sr-g { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; flex: none; color: #fff; }
.sr-g.m { background: var(--male); }
.sr-g.f { background: var(--female); }
.sr-name { font-size: 15px; font-family: var(--cute); }
.sr-sub { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.sr-loading { padding: 12px 15px; color: var(--muted); font-size: 12.5px; }

/* 长卷滚动容器 */
#gallery-scroll { flex: 1; min-height: 0; overflow-y: auto; position: relative; z-index: 1; scrollbar-width: thin; scrollbar-color: rgba(217, 185, 140, .7) transparent; overscroll-behavior: contain; }
#gallery-scroll::-webkit-scrollbar { width: 8px; }
#gallery-scroll::-webkit-scrollbar-thumb { background: rgba(217, 185, 140, .7); border-radius: 4px; }

/* 卷首(标题常驻于 #gallery-header,此处为副题与统计) */
#gallery-hero { padding: 12px calc(24px + env(safe-area-inset-right)) 4px calc(24px + env(safe-area-inset-left)); }
#gallery-hero .gh-sub { color: var(--muted); font-size: 13px; letter-spacing: 1.5px; }
.gh-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.gh-stats span { display: inline-flex; align-items: baseline; gap: 5px; background: var(--paper); border: 2px solid var(--line-strong); border-radius: 999px; padding: 4px 14px; font-size: 11.5px; color: var(--muted); font-family: var(--cute); box-shadow: var(--sticker); }
.gh-stats b { color: var(--coral-deep); font-size: 15px; font-weight: 400; }

/* 朝代导航:吸顶,底部一条「时间河」进度线 */
#dyn-nav { position: sticky; top: 0; z-index: 8; display: flex; align-items: center; gap: 12px; padding: 10px calc(20px + env(safe-area-inset-right)) 15px calc(20px + env(safe-area-inset-left)); background: linear-gradient(rgba(247, 236, 217, .97) 78%, rgba(247, 236, 217, 0)); }
#dyn-links { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
#dyn-links::-webkit-scrollbar { display: none; }
.dyn-link { flex: none; display: inline-flex; align-items: baseline; gap: 5px; padding: 6px 14px; border-radius: 999px; border: 2px solid transparent; font-family: var(--cute); font-size: 14px; letter-spacing: 1px; color: var(--muted); transition: .2s; }
.dyn-link i { font-style: normal; font-size: 10px; color: #c3a887; }
.dyn-link:hover { color: var(--coral-deep); }
.dyn-link.on { background: var(--paper); border-color: var(--line-strong); color: var(--coral-deep); box-shadow: var(--sticker); }
.dyn-link.on i { color: var(--gold-deep); }
.dyn-link.dim { opacity: .35; pointer-events: none; }
.gender-filter { margin-left: auto; flex: none; display: flex; gap: 4px; background: var(--paper); border: 2px solid var(--line-strong); border-radius: 999px; padding: 3px; box-shadow: var(--sticker); }
.gender-filter button { padding: 4px 15px; border-radius: 999px; font-size: 12px; color: var(--muted); font-family: var(--cute); }
.gender-filter button.on { background: var(--coral); color: #fff; }
#dyn-river { position: absolute; left: calc(20px + env(safe-area-inset-left)); right: calc(20px + env(safe-area-inset-right)); bottom: 6px; height: 3px; background: #ead9bd; border-radius: 2px; }
#dyn-river-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--coral), var(--butter)); border-radius: 2px; transition: width .12s linear; }

/* 朝代分区 */
.dyn-sec { padding: 30px calc(24px + env(safe-area-inset-right)) 10px calc(24px + env(safe-area-inset-left)); }
.dyn-head { display: flex; align-items: center; gap: 14px; margin-bottom: 17px; }
.dyn-seal { flex: none; width: 52px; height: 52px; display: grid; place-items: center; font-family: var(--serif); font-weight: 900; font-size: 27px; color: #fff; background: linear-gradient(155deg, #ff8f6b, #df5f37); border-radius: 13px; transform: rotate(-4deg); box-shadow: var(--sticker), 0 7px 15px rgba(223, 95, 55, .32); }
.dyn-info h3 { font-family: var(--cute); font-size: 22px; font-weight: 400; letter-spacing: 5px; }
.dyn-info p { font-size: 11.5px; color: var(--muted); margin-top: 4px; letter-spacing: 1px; font-variant-numeric: tabular-nums; }

/* 人物卡:整卡为链接,贴纸风;入场由 IntersectionObserver 加 .in,逐卡 --d 交错 */
.p-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.p-card { display: flex; gap: 13px; padding: 15px 16px; background: var(--paper); border: 2.5px solid var(--line-strong); border-radius: 22px; box-shadow: var(--sticker); color: inherit; text-decoration: none; opacity: 0; transform: translateY(20px) scale(.95) rotate(1.2deg); transition: opacity .5s var(--d, 0ms), transform .5s var(--d, 0ms) cubic-bezier(.2, .9, .3, 1.25), border-color .25s, box-shadow .25s; }
.p-card.in { opacity: 1; transform: none; }
.p-card.in:hover { transform: translateY(-5px) rotate(-.6deg); border-color: var(--coral); box-shadow: var(--sticker), 0 16px 32px rgba(160, 110, 55, .22); }
.p-card.hide, .dyn-sec.hide { display: none; }

.p-stage { position: relative; flex: none; align-self: center; }
.p-stage canvas { display: block; width: 104px; height: 136px; }
.p-go { position: absolute; left: 50%; bottom: -5px; transform: translate(-50%, 8px); opacity: 0; transition: .22s; background: linear-gradient(140deg, #ffc178, var(--coral-deep)); color: #fff; font-family: var(--cute); font-size: 11px; letter-spacing: 1px; padding: 4px 12px; border-radius: 999px; white-space: nowrap; box-shadow: 0 3px 0 rgba(200, 100, 55, .4); pointer-events: none; }
.p-card:hover .p-go { opacity: 1; transform: translate(-50%, 0); }

.p-body { min-width: 0; display: flex; flex-direction: column; }
.p-name-row { display: flex; align-items: center; gap: 8px; }
.p-name-row b { font-family: var(--cute); font-size: 20px; font-weight: 400; letter-spacing: 2px; }
.p-g { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-style: normal; color: #fff; flex: none; }
.p-g.m { background: var(--male); }
.p-g.f { background: var(--female); }
.p-alias { font-size: 11.5px; color: var(--coral-deep); margin-top: 3px; }
.p-years { font-size: 11px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.p-tag { margin-top: 8px; font-size: 12.5px; font-family: var(--cute); color: #8a6a4d; letter-spacing: .5px; }
.p-works { margin-top: auto; padding-top: 9px; display: flex; flex-wrap: wrap; gap: 5px; }
.p-works span { font-size: 10.5px; padding: 2px 9px; border-radius: 999px; background: rgba(255, 209, 102, .25); border: 1.5px solid rgba(232, 168, 76, .5); color: #7a5a1e; }
.p-works .p-feat { background: rgba(158, 220, 181, .25); border-color: rgba(110, 190, 140, .55); color: #47855e; }

#gallery-foot { padding: 34px 20px calc(30px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 11.5px; letter-spacing: 1px; }

/* ================= 轨迹页 ================= */
#map-tint { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: rgba(255, 238, 205, .16); }
#label-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
#label-layer :where(.stop-label) { pointer-events: auto; }

#journey-header { position: absolute; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 22px; padding: calc(10px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) 10px calc(20px + env(safe-area-inset-left)); background: linear-gradient(rgba(247, 236, 217, .94), rgba(247, 236, 217, .3) 80%, transparent); }
#btn-back { display: flex; align-items: center; padding: 9px 17px; background: var(--paper); border: 2.5px solid var(--line-strong); border-radius: 999px; font-size: 13.5px; color: var(--ink); font-family: var(--cute); box-shadow: var(--sticker); transition: .2s; }
#btn-back:hover { border-color: var(--coral); color: var(--coral-deep); transform: translateY(-2px); }
.j-title { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.j-title h2 { font-family: var(--cute); font-size: 26px; font-weight: 400; letter-spacing: 2px; white-space: nowrap; }
.j-meta { color: var(--coral-deep); font-size: 12.5px; letter-spacing: 1px; white-space: nowrap; font-family: var(--cute); }
.j-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.source-badge { font-size: 11.5px; padding: 6px 13px; border-radius: 999px; background: rgba(95, 183, 221, .16); border: 2px solid rgba(95, 183, 221, .5); color: #3d8fb3; letter-spacing: 1px; white-space: nowrap; font-family: var(--cute); }
.source-badge.cbdb { background: rgba(232, 168, 76, .14); border-color: rgba(232, 168, 76, .55); color: var(--gold-deep); }
.toggle { padding: 8px 15px; font-size: 12.5px; border-radius: 999px; background: var(--paper); border: 2.5px solid var(--line-strong); color: var(--muted); transition: .2s; white-space: nowrap; font-family: var(--cute); box-shadow: var(--sticker); }
.toggle.on { color: #fff; background: var(--mint); border-color: #6fbf8b; }

/* 信息面板 */
#info-panel { position: absolute; top: 72px; right: 20px; bottom: 92px; width: 316px; z-index: 10; background: var(--paper); border: 3px solid var(--line-strong); border-radius: 24px; padding: 20px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--sticker), var(--shadow); }
#panel-toggle, #panel-close { display: none; }
.info-portrait-row { display: flex; gap: 15px; align-items: flex-start; }
#j-portrait { width: 102px; height: 136px; flex: none; background: radial-gradient(ellipse at 50% 68%, #ffe9cd, #fdf3df 75%); border: 2.5px solid var(--line-strong); border-radius: 18px; box-shadow: inset 0 0 0 3px #fff; }
.info-basic { padding-top: 4px; min-width: 0; }
.j-alias { font-size: 12.5px; color: var(--coral-deep); letter-spacing: 1px; }
.j-years { font-family: var(--cute); font-size: 17px; margin-top: 6px; }
.j-route-stat { font-size: 11.5px; color: var(--muted); margin-top: 9px; line-height: 1.7; }
#j-bio { margin: 10px 0; font-size: 12px; line-height: 1.8; color: #8a6a4d; flex: none; }

/* 面板标签页:生平 / 作品 / 社会关系 */
#panel-tabs { border-top: 2px dashed var(--line-strong); padding-top: 12px; display: flex; gap: 4px; flex: none; }
#panel-tabs button { flex: 1; padding: 7px 2px; border-radius: 999px; font-size: 12px; color: var(--muted); font-family: var(--cute); letter-spacing: 1px; transition: .2s; white-space: nowrap; }
#panel-tabs button:hover { color: var(--coral-deep); }
#panel-tabs button.on { background: #fff; color: var(--coral-deep); box-shadow: var(--sticker); border: 1.5px solid var(--line-strong); padding: 5.5px 2px; }
#panel-tabs button span { color: var(--gold-deep); font-size: 10.5px; margin-left: 2px; }
.tab-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll-list { flex: 1; overflow-y: auto; margin: 0 -8px; padding: 0 8px 8px; scrollbar-width: thin; scrollbar-color: rgba(217, 185, 140, .6) transparent; }
.scroll-list::-webkit-scrollbar { width: 5px; }
.scroll-list::-webkit-scrollbar-thumb { background: rgba(217, 185, 140, .6); border-radius: 3px; }
.panel-note { font-size: 11.5px; color: var(--muted); padding: 10px 4px; line-height: 1.7; }
.subhead { font-size: 11px; letter-spacing: 2px; color: var(--muted); font-family: var(--cute); padding: 7px 2px 5px; flex: none; }

/* 作品列表 */
.wk { display: flex; gap: 9px; align-items: baseline; padding: 7px 10px; border-radius: 12px; }
.wk:hover { background: #fff2dc; }
.wk-year { flex: none; width: 36px; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wk-name { font-size: 13px; font-family: var(--cute); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-role { flex: none; font-size: 10px; color: #7a5a1e; background: rgba(255, 209, 102, .32); border-radius: 999px; padding: 2px 8px; }

/* 社会关系 */
#assoc-top { flex: 0 1 auto; min-height: 56px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(217, 185, 140, .6) transparent; }
#assoc-top::-webkit-scrollbar { width: 5px; }
#assoc-top::-webkit-scrollbar-thumb { background: rgba(217, 185, 140, .6); border-radius: 3px; }
#status-row { display: flex; flex-wrap: nowrap; gap: 5px; padding-top: 2px; flex: none; overflow-x: auto; scrollbar-width: none; }
#status-row::-webkit-scrollbar { display: none; }
#status-row .status-chip { flex: none; }
.status-chip { font-size: 11px; padding: 3px 10px; border-radius: 999px; background: rgba(158, 220, 181, .28); border: 1.5px solid rgba(110, 190, 140, .55); color: #47855e; }
#kin-row { display: flex; flex-wrap: nowrap; gap: 5px; flex: none; overflow-x: auto; scrollbar-width: none; }
#kin-row::-webkit-scrollbar { display: none; }
#kin-row .kin-chip { flex: none; }
.kin-chip { font-size: 11.5px; padding: 3px 10px; border-radius: 999px; background: rgba(255, 154, 118, .13); border: 1.5px solid rgba(239, 125, 83, .42); color: var(--coral-deep); }
button.kin-more { color: var(--muted); background: var(--paper); border-color: var(--line-strong); transition: .2s; }
button.kin-more:hover { color: var(--coral-deep); border-color: var(--coral); }
.kin-chip b { font-weight: 400; opacity: .75; margin-right: 3px; }
#assoc-filter { display: flex; flex-wrap: nowrap; gap: 4px; flex: none; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
#assoc-filter::-webkit-scrollbar { display: none; }
#assoc-filter button { flex: none; }
#assoc-list { min-height: 76px; }
/* 分类 chips 兼作图谱图例(彩色圆点 = 节点色),面板与放大弹层共用 */
#assoc-filter button, #rel-modal-legend button { font-size: 10.5px; padding: 3px 9px; border-radius: 999px; border: 1.5px solid var(--line-strong); color: var(--muted); background: var(--paper); transition: .2s; display: inline-flex; align-items: center; }
#assoc-filter button:hover, #rel-modal-legend button:hover { border-color: var(--coral); color: var(--coral-deep); }
#assoc-filter button.on, #rel-modal-legend button.on { background: #fff; border-color: var(--coral); color: var(--coral-deep); box-shadow: var(--sticker); }
.ac-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; flex: none; }
.ac-dot-all { background: transparent; border: 2px solid var(--muted); width: 6px; height: 6px; }

/* 图谱 / 列表 切换与放大 */
#assoc-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 0 5px; flex: none; }
#rel-modes { display: flex; gap: 3px; background: var(--paper); border: 2px solid var(--line-strong); border-radius: 999px; padding: 3px; box-shadow: var(--sticker); }
#rel-modes button { padding: 3px 13px; border-radius: 999px; font-size: 11.5px; font-family: var(--cute); color: var(--muted); transition: .2s; }
#rel-modes button.on { background: var(--coral); color: #fff; box-shadow: 0 2px 0 rgba(200, 100, 55, .4); }
#btn-rel-expand { padding: 4px 12px; border-radius: 999px; border: 2px solid var(--line-strong); background: var(--paper); color: var(--muted); font-size: 11.5px; font-family: var(--cute); box-shadow: var(--sticker); transition: .2s; white-space: nowrap; }
#btn-rel-expand:hover { color: var(--coral-deep); border-color: var(--coral); transform: translateY(-1px); }

/* 关系图谱(中心辐射) */
#rel-graph-wrap { flex: 1; min-height: 140px; display: flex; flex-direction: column; position: relative; }
#rel-graph { flex: 1; position: relative; min-height: 0; }
#rel-graph svg { display: block; }
.rg-node { cursor: pointer; }
.rg-node.dim { opacity: .12; pointer-events: none; }
.rg-node, .rg-node text { transition: opacity .25s; }
.rg-label { font-family: var(--cute); user-select: none; }
.rel-tip { position: absolute; z-index: 6; pointer-events: none; transform: translate(-50%, calc(-100% - 10px)); max-width: 220px; padding: 5px 11px; background: var(--paper); border: 2px solid var(--coral); border-radius: 12px; font-size: 11.5px; font-family: var(--cute); color: var(--ink); white-space: nowrap; box-shadow: var(--sticker); }
.rel-tip .rt-rel { margin-left: 6px; font-size: 10.5px; color: var(--muted); }
/* 选中详情:悬浮在图谱底部,不占纵向空间 */
#rel-detail { position: absolute; left: 0; right: 0; bottom: 3px; display: flex; justify-content: center; pointer-events: none; z-index: 5; }
#rel-detail:not(.hidden) span { pointer-events: auto; display: inline-flex; align-items: center; max-width: 96%; padding: 3px 12px; border-radius: 999px; background: rgba(255, 250, 239, .95); border: 1.5px solid var(--line-strong); font-size: 11px; color: var(--ink); line-height: 1.5; box-shadow: var(--sticker); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rel-detail b { color: var(--coral-deep); font-weight: 400; }

/* 关系图谱放大弹层 */
#rel-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(107, 74, 50, .42); backdrop-filter: blur(3px); }
#rel-modal-card { position: relative; width: min(880px, 96vw); max-height: 92vh; background: var(--paper); border: 3px solid var(--line-strong); border-radius: 26px; box-shadow: var(--sticker), var(--shadow); padding: 20px 26px 16px; display: flex; flex-direction: column; }
#rel-modal-close { position: absolute; top: 12px; right: 14px; width: 30px; height: 30px; border-radius: 50%; background: #f6e8cf; color: var(--muted); font-size: 14px; z-index: 2; }
#rel-modal-close:hover { background: var(--coral); color: #fff; }
.rm-head { flex: none; }
.rm-head h3 { display: inline; font-family: var(--cute); font-size: 22px; font-weight: 400; letter-spacing: 2px; }
.rm-head span { margin-left: 10px; font-size: 12px; color: var(--muted); }
#rel-modal-graph { flex: 1; min-height: 300px; position: relative; margin-top: 8px; }
#rel-modal-graph svg { display: block; }
#rel-modal-legend { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; flex: none; }
.rm-hint { margin-top: 7px; font-size: 11px; color: var(--muted); text-align: center; flex: none; }

.as { display: flex; gap: 9px; align-items: baseline; padding: 6px 10px; border-radius: 12px; }
.as:hover { background: #fff2dc; }
.as-rel { flex: none; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; color: #8a6a4d; background: rgba(107, 74, 50, .07); border-radius: 999px; padding: 2px 8px; display: inline-flex; align-items: center; }
.as-name { font-size: 13px; font-family: var(--cute); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-year { margin-left: auto; flex: none; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.ev-title { font-size: 12px; letter-spacing: 2.5px; color: var(--muted); padding: 10px 0 8px; border-top: 2px dashed var(--line-strong); flex: none; font-family: var(--cute); }
.ev-title span { color: var(--coral-deep); }
#event-list { flex: 1; overflow-y: auto; margin: 0 -8px; padding: 0 8px 8px; scrollbar-width: thin; scrollbar-color: rgba(217, 185, 140, .6) transparent; }
#event-list::-webkit-scrollbar { width: 5px; }
#event-list::-webkit-scrollbar-thumb { background: rgba(217, 185, 140, .6); border-radius: 3px; }
.ev { position: relative; display: flex; gap: 11px; padding: 9px 10px; border-radius: 14px; cursor: pointer; transition: background .25s; }
.ev::before { content: ""; position: absolute; left: 26px; top: 36px; bottom: -9px; width: 2px; background: repeating-linear-gradient(var(--line-strong) 0 4px, transparent 4px 8px); }
.ev:last-child::before { display: none; }
.ev .ev-dot { flex: none; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: var(--paper); border: 3px solid var(--line-strong); z-index: 1; transition: .25s; }
.ev .ev-body { min-width: 0; }
.ev .ev-line1 { display: flex; gap: 9px; align-items: baseline; }
.ev .ev-year { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ev .ev-place { font-family: var(--cute); font-size: 15px; font-weight: 400; }
.ev p { font-size: 11.5px; line-height: 1.7; color: #97775a; margin-top: 3px; }
/* 站点出处与存疑标注 */
.ev .ev-src { display: block; font-size: 10.5px; color: #ab8f6d; margin-top: 3px; line-height: 1.5; }
.ev-chron { font-size: 11px; color: var(--muted); line-height: 1.6; padding: 2px 10px 8px; }
.ev:hover { background: #fff2dc; }
.ev.cur { background: #ffe9d2; }
.ev.cur .ev-dot { background: var(--coral); border-color: var(--coral-deep); box-shadow: 0 0 0 4px rgba(255, 154, 118, .3); }
.ev.cur .ev-place { color: var(--coral-deep); }
.ev.past .ev-dot { border-color: var(--coral); }
/* CBDB 未上图记录:不可点的静态条目 + 分隔说明 */
.ev-static { cursor: default; }
.ev-static:hover { background: transparent; }
.ev-static .ev-dot { border-style: dashed; opacity: .75; }
.ev-static .ev-place { color: #a08360; }
.ev-extra-note { font-size: 11px; color: var(--muted); line-height: 1.6; padding: 10px 10px 2px; margin-top: 6px; border-top: 2px dashed var(--line-strong); }

/* 地图 CSS2D 标签 */
.stop-label { text-align: center; font-family: var(--cute); transform: translateY(6px); transition: opacity .3s; }
.stop-label .sl-year { display: inline-block; font-size: 11px; color: #fff; background: var(--coral); border-radius: 999px; padding: 2px 9px; font-weight: 400; letter-spacing: .5px; box-shadow: 0 2px 0 rgba(200, 100, 55, .4); }
.stop-label .sl-name { display: block; font-size: 15px; margin-top: 4px; color: var(--ink); text-shadow: 0 0 5px #fff, 0 0 8px #fff, 1px 1px 0 #fff, -1px 1px 0 #fff, 1px -1px 0 #fff, -1px -1px 0 #fff; }
.stop-label.dim { opacity: .35; }
.stop-label.cur .sl-name { color: var(--coral-deep); }
.stop-label.cur .sl-year { background: var(--coral-deep); }
.stop-label.next .sl-year { background: var(--male); box-shadow: 0 2px 0 rgba(60, 140, 175, .4); }
.person-bubble {
  white-space: nowrap; font-size: 13px; color: var(--ink); font-family: var(--cute);
  background: var(--paper); border: 2.5px solid var(--coral);
  border-radius: 999px; padding: 6px 15px; box-shadow: var(--sticker);
}
.person-bubble b { color: var(--coral-deep); }

/* 主要地名常屏标签:缩小视角叠加在瓦片上,字号不随地图缩放(缩小后仍可辨认);非交互 */
.city-label {
  font-family: var(--cute); font-size: 12px; letter-spacing: .5px; white-space: nowrap;
  color: #8a6c4e;
  text-shadow: 0 0 4px #fdf6ea, 0 0 4px #fdf6ea, 1px 1px 0 #fdf6ea, -1px 1px 0 #fdf6ea, 1px -1px 0 #fdf6ea, -1px -1px 0 #fdf6ea;
}
.city-label.major { font-size: 14px; color: #5f4126; }

/* 底部时间轴 */
#journey-footer { position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 14px calc(20px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left)); background: linear-gradient(transparent, rgba(247, 236, 217, .96) 42%); }
#btn-play { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(150deg, #ffc178, var(--coral-deep)); color: #fff; box-shadow: 0 4px 0 rgba(200, 100, 55, .45); flex: none; transition: transform .15s; }
#btn-play:hover { transform: scale(1.08); }
#btn-replay { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); border: 2.5px solid var(--line-strong); color: var(--muted); flex: none; box-shadow: var(--sticker); }
#btn-replay:hover { color: var(--coral-deep); border-color: var(--coral); }
.speed-group { display: flex; gap: 3px; background: var(--paper); border: 2px solid var(--line-strong); border-radius: 999px; padding: 3px; flex: none; box-shadow: var(--sticker); }
.speed-group button { padding: 5px 12px; border-radius: 999px; font-size: 11.5px; color: var(--muted); font-family: var(--cute); }
.speed-group button.on { background: var(--butter); color: #7a5a1e; }

#tl-track { position: relative; flex: 1; height: 34px; }
#tl-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 5px; margin-top: -2.5px; background: #eeddc0; border-radius: 3px; }
#tl-progress { position: absolute; left: 0; top: 50%; height: 5px; margin-top: -2.5px; width: 0; background: linear-gradient(90deg, var(--coral), var(--butter)); border-radius: 3px; }
#tl-ticks { position: absolute; inset: 0; }
.tl-tick { position: absolute; top: 50%; width: 3px; height: 13px; margin-top: -6.5px; background: #d9b98c; border-radius: 2px; transform: translateX(-1.5px); }
.tl-tick.pass { background: var(--coral-deep); }
#tl-year { position: absolute; left: 0; top: -22px; transform: translateX(-50%); font-size: 15px; font-family: var(--cute); color: var(--coral-deep); white-space: nowrap; text-shadow: 0 0 6px #fff; }
#tl-range { position: absolute; inset: -6px 0; width: 100%; opacity: 0; cursor: pointer; margin: 0; }
#tl-range::-webkit-slider-thumb { width: 16px; height: 16px; }
.j-dist { font-size: 12.5px; color: var(--muted); white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.j-dist b { color: var(--coral-deep); font-weight: 600; }

/* ================= 提示条 ================= */
#toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 200; padding: 12px 24px; background: var(--paper); border: 2.5px solid var(--coral); color: var(--ink); border-radius: 999px; font-size: 13.5px; box-shadow: var(--sticker), var(--shadow); font-family: var(--cute); }

/* ================= 响应式:桌面 / 平板 / 手机 ================= */

/* 小桌面与大平板横屏 ≤1280px */
@media (max-width: 1280px) {
  #search-box { width: 280px; }
  #info-panel { width: 296px; right: 16px; }
}

/* 平板 ≤1024px */
@media (max-width: 1024px) {
  #home-header { gap: 14px; }
  #search-box { width: 250px; padding: 9px 14px; }
  .brand-mark { width: 44px; height: 44px; font-size: 23px; }
  .brand-text h1 { font-size: 20px; }
  .brand-text p { display: none; }
  #btn-gallery { padding: 8px 14px; font-size: 12.5px; }
  #home-hint { top: calc(78px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); }
  #person-card { width: 360px; left: calc(16px + env(safe-area-inset-left)); }
  #btn-dyn-play { width: 42px; height: 42px; }
  .p-grid { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
  #info-panel { top: 66px; bottom: 88px; padding: 16px; }
  #journey-footer { gap: 10px; }
}

/* ≤900px:信息面板改为底部抽屉(默认收起,由「详情」按钮唤出),
   停靠在时间轴上方(--footer-h 由 JS 按footer实际高度写入,窄屏换行也不遮挡) */
@media (max-width: 900px) {
  #info-panel {
    top: auto; left: 0; right: 0; bottom: calc(var(--footer-h, 96px) + 8px + env(safe-area-inset-bottom));
    width: auto; max-height: 56vh;
    border-radius: 22px 22px 0 0; border-width: 3px 0 0;
    padding: 10px 18px 14px;
    transform: translateY(200vh);   /* 回退:不支持 env()/var 时也保证完全隐藏 */
    transform: translateY(calc(100% + var(--footer-h, 96px) + 8px + env(safe-area-inset-bottom)));
    transition: transform .42s cubic-bezier(.25, .9, .3, 1), bottom .3s ease;
    z-index: 40; box-shadow: 0 -12px 34px rgba(160, 110, 55, .28);
  }
  #info-panel.open { transform: translateY(0); }
  /* 顶部把手:点按收起 */
  #panel-handle { display: block; width: 64px; height: 6px; margin: 2px auto 10px; border-radius: 3px; background: var(--line-strong); cursor: pointer; }
  /* 抽屉空间有限:立绘不显示(移动端详情以生平列表为主),生卒/里程信息整行排布 */
  #j-portrait { display: none; }
  .info-portrait-row { gap: 0; }
  /* 简介超长时截断,点按展开/收起 */
  #j-bio { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 10px 0; cursor: pointer; }
  #j-bio.open { display: block; overflow: visible; }
  #panel-toggle {
    display: flex; align-items: center; gap: 6px; position: absolute;
    right: calc(14px + env(safe-area-inset-right)); bottom: calc(var(--footer-h, 96px) + 20px + env(safe-area-inset-bottom)); z-index: 25;
    padding: 10px 16px; border-radius: 999px; font-family: var(--cute); font-size: 13px; letter-spacing: 1px;
    background: var(--paper); border: 2.5px solid var(--line-strong); color: var(--ink);
    box-shadow: var(--sticker); transition: transform .2s, border-color .2s, color .2s;
  }
  #panel-toggle:hover { border-color: var(--coral); color: var(--coral-deep); transform: translateY(-2px); }
  #panel-close {
    display: grid; place-items: center; position: absolute; top: 10px; right: 14px;
    width: 32px; height: 32px; border-radius: 50%; background: #f6e8cf; color: var(--muted); font-size: 14px;
  }
  #panel-close:hover { background: var(--coral); color: #fff; }
  /* 抽屉高度有限:关系页整体可滚动,图谱定高完整绘制 */
  #tab-assoc { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
  #tab-assoc::-webkit-scrollbar { display: none; }
  #rel-graph-wrap { flex: none; height: 200px; min-height: 200px; }
}

/* 手机 ≤640px */
@media (max-width: 640px) {
  .boot-ring { width: 104px; height: 104px; margin-bottom: 20px; }
  .boot-title { font-size: 34px; letter-spacing: 10px; text-indent: 10px; }
  .boot-sub { font-size: 12.5px; }

  /* 首页头部:品牌+长廊入口一行,搜索整行 */
  #home-header { flex-wrap: wrap; row-gap: 10px; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 10px calc(14px + env(safe-area-inset-left)); }
  #search-box { order: 3; flex: 1 1 100%; width: auto; padding: 10px 14px; }
  #btn-gallery { order: 2; margin-left: auto; padding: 7px 12px; font-size: 12px; }
  #search-input { font-size: 16px; }   /* ≥16px,避免 iOS 聚焦时页面自动放大 */
  #search-results { max-height: 52vh; overflow-y: auto; }
  .brand-mark { width: 42px; height: 42px; font-size: 21px; border-radius: 13px; }
  .brand-text h1 { font-size: 17px; letter-spacing: 1px; }

  /* 首页时间轴与人物卡:紧凑排布,人物卡停靠在时间轴上方(--home-bar-h 由 JS 写入) */
  #home-hint { display: none; }
  #home-timeline { gap: 6px; padding: 0 calc(10px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left)); }
  #dyn-caption { font-size: 11.5px; padding: 4px 13px; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #btn-dyn-play { width: 40px; height: 40px; }
  #dyn-track { gap: 3px; padding: 4px 6px; }
  #dyn-track button { font-size: 12px; padding: 5px 10px; }
  #person-card { left: calc(10px + env(safe-area-inset-left)); right: calc(10px + env(safe-area-inset-right)); width: auto; bottom: calc(var(--home-bar-h, 62px) + env(safe-area-inset-bottom) + 12px); padding: 13px 15px; border-radius: 20px; }
  .pc-stage canvas { width: 88px; height: 115px; }
  .pc-name-row b { font-size: 19px; }

  /* 人物长廊:单列卡片,导航紧凑 */
  #gallery-header { gap: 12px; padding: calc(10px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 8px calc(14px + env(safe-area-inset-left)); }
  #btn-gallery-back { padding: 7px 12px; font-size: 12.5px; }
  .gh-crumb h2 { font-size: 17px; letter-spacing: 3px; }
  #gallery-hero { padding: 8px calc(14px + env(safe-area-inset-right)) 2px calc(14px + env(safe-area-inset-left)); }
  #gallery-hero .gh-sub { font-size: 12px; letter-spacing: .5px; }
  .gh-stats { margin-top: 10px; gap: 6px; }
  .gh-stats span { padding: 3px 11px; font-size: 10.5px; }
  .gh-stats b { font-size: 13px; }
  #dyn-nav { padding: 7px calc(12px + env(safe-area-inset-right)) 13px calc(12px + env(safe-area-inset-left)); gap: 8px; }
  .dyn-link { font-size: 13px; padding: 5px 11px; }
  .gender-filter button { padding: 4px 11px; font-size: 11.5px; }
  #dyn-river { left: calc(12px + env(safe-area-inset-left)); right: calc(12px + env(safe-area-inset-right)); }
  .dyn-sec { padding: 22px calc(12px + env(safe-area-inset-right)) 6px calc(12px + env(safe-area-inset-left)); }
  .dyn-head { margin-bottom: 13px; gap: 11px; }
  .dyn-seal { width: 44px; height: 44px; font-size: 22px; border-radius: 11px; }
  .dyn-info h3 { font-size: 18px; letter-spacing: 3px; }
  .p-grid { grid-template-columns: 1fr; gap: 10px; }
  .p-card { padding: 13px 14px; border-radius: 19px; }
  .p-stage canvas { width: 92px; height: 120px; }
  #dyn-watermark { font-size: 72vw; bottom: -2vh; }
  #gallery-foot { font-size: 10.5px; padding: 26px 14px calc(24px + env(safe-area-inset-bottom)); }

  /* 轨迹页头部 */
  #journey-header { flex-wrap: wrap; row-gap: 5px; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) 8px calc(10px + env(safe-area-inset-left)); }
  #btn-back { padding: 7px 12px; font-size: 12.5px; }
  .j-title { flex: 1 1 auto; gap: 8px; }
  .j-title h2 { font-size: 19px; letter-spacing: 1px; }
  .j-meta { font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
  .source-badge { display: none; }
  .toggle { padding: 6px 11px; font-size: 11.5px; }
  #panel-toggle { right: calc(10px + env(safe-area-inset-right)); padding: 8px 13px; font-size: 12.5px; }
  #info-panel { max-height: 60vh; }
  .j-dur { display: none; }   /* 「时间线 Ns」为桌面调试信息,手机上隐藏 */

  /* 底部播放器:控制键+里程一行,时间轴独占一行(里程位数变化可能使 footer 增高,
     抽屉停靠位置经 --footer-h 由 JS 实时跟随) */
  #journey-footer { flex-wrap: wrap; gap: 4px 10px; padding: 8px calc(12px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); }
  #btn-play { width: 42px; height: 42px; }
  #btn-replay { width: 32px; height: 32px; }
  .speed-group button { padding: 4px 9px; font-size: 10.5px; }
  #j-dist { margin-left: auto; font-size: 11px; }
  #tl-track { order: 9; flex-basis: 100%; height: 28px; }
  /* 年份药丸骑在时间轴上(替代悬浮于轴上方),避免与上一行右对齐的里程文字碰撞 */
  #tl-year { font-size: 12px; top: 50%; transform: translate(-50%, -50%); background: rgba(255, 252, 244, .95); border-radius: 999px; padding: 1px 7px; box-shadow: 0 1px 4px rgba(160, 110, 55, .28); text-shadow: none; }

  /* 面板内容:加大触控目标 */
  #panel-tabs button { font-size: 13px; padding: 9px 2px; }
  #panel-tabs button.on { padding: 7.5px 2px; }
  .ev { padding: 11px 10px; }
  .ev p { font-size: 12.5px; }
  .wk { padding: 9px 10px; }
  .as { padding: 8px 10px; }
  #assoc-filter button, #rel-modal-legend button { font-size: 12px; padding: 6px 12px; }
  #rel-modes button { font-size: 12.5px; padding: 6px 14px; }
  #btn-rel-expand { font-size: 12.5px; padding: 6px 12px; }
  .status-chip, .kin-chip { font-size: 12px; padding: 5px 12px; }
  .scroll-list, #event-list, #assoc-top { overscroll-behavior: contain; }

  /* 关系图谱放大弹层:小屏紧凑化 */
  #rel-modal { padding: 12px; }
  #rel-modal-card { padding: 16px 16px 12px; border-radius: 20px; }
  #rel-modal-graph { min-height: 46vh; }
  .rm-head h3 { font-size: 18px; }
  .rm-hint { font-size: 10.5px; }

  #toast { bottom: 180px; max-width: 86vw; text-align: center; }
}

/* 超窄屏 ≤360px */
@media (max-width: 360px) {
  .brand-text h1 { font-size: 15px; }
  #btn-back { padding: 6px 10px; font-size: 11.5px; }
  .j-title h2 { font-size: 17px; }
  .p-stage canvas { width: 82px; height: 107px; }
  .speed-group { gap: 2px; }
  .speed-group button { padding: 4px 7px; font-size: 10px; }
  #j-dist { font-size: 10px; }
}
