/* 汴京·清明上河图：夜里的展柜，长卷平铺在中间；注释用宣纸色的卡片，朱砂点标位置 */
:root {
	--ink: #15110d;
	--ink2: #1f1a14;
	--line: rgba(239, 228, 206, .16);
	--paper: #f1e9d8;
	--paper2: #e6dcc6;
	--txt: #efe5d1;
	--txt2: #b8aa8f;
	--zhu: #b8361f;
	--zhu2: #d2553a;
	--jin: #c9a564;
	--top: 64px;
	--map: 82px;
	--serif: 'Noto Serif SC', 'Songti SC', 'STSong', 'Source Han Serif SC', serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--txt); }
body { font-family: var(--serif); overflow: hidden; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
.qm { position: fixed; inset: 0; display: grid; grid-template-rows: var(--top) 1fr var(--map); grid-template-columns: minmax(0, 1fr); }   /* 列宽不随顶栏里那行长说明撑大：否则窗口窄于约 1110 像素时，右边的缩放钮、「卷首」和顶栏按钮都被挤出屏外 */

/* 顶栏 */
.qm-top { display: flex; align-items: center; gap: 20px; padding: 0 22px; border-bottom: 1px solid var(--line); background: linear-gradient(#1b1611, #15110d); position: relative; z-index: 5; }
.solo .qm-top { padding-right: 200px; }
.qm-ttl { min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 22px; }
.qm-ttl h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: .22em; white-space: nowrap; color: #f5ecda; }
.qm-ttl h1 i { font-style: normal; color: var(--zhu2); margin: 0 .12em; }
.qm-ttl p { margin: 0; font-size: 12.5px; letter-spacing: .14em; color: var(--txt2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qm-acts { display: flex; gap: 8px; flex: none; }
.qm-btn { appearance: none; border: 1px solid rgba(239, 228, 206, .3); background: transparent; color: var(--txt); padding: 7px 16px 7px 18px; font-size: 14px; letter-spacing: .3em; border-radius: 2px; cursor: pointer; transition: background .2s, border-color .2s, color .2s; }
.qm-btn:hover { background: rgba(239, 228, 206, .08); border-color: rgba(239, 228, 206, .55); }
.qm-btn:focus-visible, .qm-stage:focus-visible, .qm-map__bar:focus-visible, .qm-pin:focus-visible, .qm-zoom button:focus-visible { outline: 2px solid var(--jin); outline-offset: 2px; }
.qm-btn--main { background: var(--zhu); border-color: var(--zhu); color: #fbf4e8; }
.qm-btn--main:hover { background: var(--zhu2); border-color: var(--zhu2); }
.qm-btn[disabled] { opacity: .35; cursor: default; }

/* 舞台 */
.qm-stage { position: relative; overflow: hidden; cursor: grab; touch-action: none; outline: none; background: radial-gradient(120% 90% at 50% 50%, #221c15 0%, #17130e 55%, #100d09 100%); }
.qm-stage.is-drag { cursor: grabbing; }
.qm-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.qm-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.qm-tag { position: absolute; left: 0; top: 0; margin: 0; padding: 2px 8px 3px 9px; font-size: 13px; letter-spacing: .3em; color: #fbe9d6; background: rgba(150, 38, 20, .86); border-radius: 1px; pointer-events: none; white-space: nowrap; opacity: 0; transition: opacity .3s; }
.qm-tag.is-on { opacity: 1; }
.qm-pins { position: absolute; inset: 0; pointer-events: none; }
.qm-pin { position: absolute; left: 0; top: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; display: grid; place-items: center; }
.qm-pin::before { content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--zhu); box-shadow: 0 0 0 2px rgba(251, 244, 232, .92), 0 0 0 6px rgba(184, 54, 31, .28), 0 4px 10px rgba(0, 0, 0, .45); transition: transform .2s; }
.qm-pin.is-colo { width: 40px; height: 26px; margin: 0 0 0 -20px; align-items: start; }
.qm-pin.is-colo::before { width: 24px; height: 7px; border-radius: 0 0 2px 2px; background: var(--zhu); box-shadow: 0 0 0 1.5px rgba(251, 244, 232, .9), 0 3px 8px rgba(0, 0, 0, .35); }
.qm-pin.is-colo:hover::before, .qm-pin.is-colo.is-on::before { transform: scaleY(1.6); transform-origin: top; background: var(--zhu2); }
.qm-pin.is-colo.is-on::after { display: none; }
.qm-pin.is-colo span { bottom: auto; top: calc(100% + 2px); }
.qm-pin:hover::before, .qm-pin.is-on::before { transform: scale(1.35); }
.qm-pin.is-on::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 1.5px solid rgba(251, 244, 232, .8); animation: qm-ring 1.8s ease-out infinite; }
@keyframes qm-ring { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.qm-pin[hidden] { display: none; }
.qm-pin { transition: opacity .4s; }
.qm-stage.is-show .qm-pin { opacity: 0; }
.qm-stage.is-show .qm-pin:hover, .qm-stage.is-show .qm-pin:focus-visible { opacity: 1; }
.qm-pin span { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 13px; letter-spacing: .12em; padding: 4px 9px 4px 10px; background: rgba(21, 17, 13, .88); color: #f5ecda; border: 1px solid rgba(239, 228, 206, .25); border-radius: 2px; opacity: 0; pointer-events: none; transition: opacity .15s; }
.qm-pin:hover span, .qm-pin:focus-visible span { opacity: 1; }
.qm-where { position: absolute; left: 18px; top: 14px; margin: 0; padding: 6px 12px 6px 14px; font-size: 13px; letter-spacing: .24em; color: var(--txt); background: rgba(21, 17, 13, .66); border: 1px solid var(--line); border-radius: 2px; pointer-events: none; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.qm-where b { font-weight: 700; color: #fbf4e8; }
.qm-where small { font-size: 12px; color: var(--txt2); letter-spacing: .12em; margin-left: .6em; }
.qm-hint { position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); margin: 0; padding: 9px 18px 9px 16px; font-size: 14px; letter-spacing: .22em; color: #f5ecda; background: rgba(21, 17, 13, .78); border: 1px solid rgba(239, 228, 206, .28); border-radius: 2px; pointer-events: none; transition: opacity .6s; white-space: nowrap; }
.qm-hint.is-gone { opacity: 0; }
.qm-hint__a { display: inline-block; margin-right: .7em; color: var(--zhu2); animation: qm-nudge 1.6s ease-in-out infinite; }
@keyframes qm-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-6px); } }
.qm-zoom { position: absolute; right: 16px; bottom: 16px; display: flex; flex-direction: column; border: 1px solid rgba(239, 228, 206, .28); background: rgba(21, 17, 13, .72); border-radius: 2px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.qm-zoom button { width: 40px; height: 40px; border: 0; background: none; cursor: pointer; font-size: 22px; line-height: 1; display: grid; place-items: center; }
.qm-zoom button + button { border-top: 1px solid var(--line); }
.qm-zoom button:hover { background: rgba(239, 228, 206, .1); }
.qm-zoom svg { width: 16px; height: 16px; }
.qm-ctl { position: absolute; left: 16px; bottom: 16px; display: flex; align-items: center; gap: 10px; z-index: 2; }
.qm-ctl[hidden] { display: none; }
.qm-roll { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 18px 0 5px; border: 1px solid rgba(239, 228, 206, .3); background: rgba(21, 17, 13, .76); color: #f5ecda; border-radius: 999px; font-size: 14px; letter-spacing: .3em; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background .2s, border-color .2s; }
.qm-roll:hover { background: rgba(40, 32, 24, .86); border-color: rgba(239, 228, 206, .55); }
.qm-roll i { width: 32px; height: 32px; border-radius: 50%; background: var(--zhu); display: grid; place-items: center; box-shadow: 0 0 0 3px rgba(184, 54, 31, .25); }
.qm-roll i::before { content: ''; width: 0; height: 0; border-left: 10px solid #fbf4e8; border-top: 6.5px solid transparent; border-bottom: 6.5px solid transparent; margin-left: 3px; }
.qm-roll[aria-pressed="true"] i::before { width: 10px; height: 12px; margin: 0; border: 0; border-left: 3.5px solid #fbf4e8; border-right: 3.5px solid #fbf4e8; box-sizing: border-box; }
.qm-roll[aria-pressed="true"] i { animation: qm-pulse 2s ease-in-out infinite; }
@keyframes qm-pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(184, 54, 31, .25); } 50% { box-shadow: 0 0 0 7px rgba(184, 54, 31, .12); } }
.qm-mode { display: flex; height: 42px; align-items: center; padding: 4px; gap: 2px; background: rgba(21, 17, 13, .76); border: 1px solid rgba(239, 228, 206, .28); border-radius: 999px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.qm-mode button { height: 32px; border: 0; background: none; color: var(--txt2); font-size: 13px; letter-spacing: .2em; padding: 0 12px 0 14px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s; }
.qm-mode button:hover { color: var(--txt); }
.qm-mode button[aria-pressed="true"] { background: var(--zhu); color: #fbf4e8; }
.qm-roll:focus-visible, .qm-mode button:focus-visible { outline: 2px solid var(--jin); outline-offset: 2px; }
.qm-load { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--jin), transparent); background-size: 40% 100%; background-repeat: no-repeat; opacity: 0; transition: opacity .3s; animation: qm-load 1.2s linear infinite; pointer-events: none; }
.qm-load.is-on { opacity: .8; }
@keyframes qm-load { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* 注释卡片 */
.qm-card { position: absolute; right: 18px; top: calc(var(--top) + 18px); bottom: calc(var(--map) + 18px); width: min(380px, 40vw); z-index: 6; display: flex; flex-direction: column; background: var(--paper); color: #2b241b; border-radius: 2px; box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .8), 0 0 0 1px rgba(0, 0, 0, .25); padding: 26px 26px 18px; max-height: calc(100% - var(--top) - var(--map) - 36px); height: max-content; }
.qm-card[hidden] { display: none; }
.qm-card::before { content: ''; position: absolute; inset: 7px; border: 1px solid rgba(43, 36, 27, .14); pointer-events: none; }
.qm-card__x { position: absolute; right: 10px; top: 10px; width: 34px; height: 34px; border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: #6c5f4c; border-radius: 2px; }
.qm-card__x:hover { background: rgba(43, 36, 27, .08); color: #2b241b; }
.qm-card__r { position: absolute; right: 46px; top: 10px; width: 34px; height: 34px; border: 0; background: none; cursor: pointer; color: var(--zhu); border-radius: 2px; display: none; place-items: center; }
.qm-card__r svg { width: 18px; height: 18px; }
.qm-card__r:hover { background: rgba(184, 54, 31, .1); }
.qm-card__r:focus-visible { outline: 2px solid var(--jin); outline-offset: 2px; }
.is-alive .qm-card:not(.is-colo) .qm-card__r { display: grid; }
.qm-card__k { margin: 0 74px 8px 0; font-size: 12.5px; letter-spacing: .2em; color: var(--zhu); display: flex; justify-content: space-between; gap: 12px; }
.qm-card__n { color: #8a7c66; letter-spacing: .1em; font-feature-settings: 'tnum'; }
.qm-card__t { margin: 0 0 14px; font-size: 25px; font-weight: 700; letter-spacing: .14em; line-height: 1.35; outline: none; }
.qm-card__b { overflow-y: auto; min-height: 0; flex: 1 1 auto; margin: 0 -8px 0 0; padding-right: 8px; scrollbar-width: thin; }
.qm-card__d { margin: 0; font-size: 15.5px; line-height: 1.95; letter-spacing: .04em; text-align: justify; }
.qm-card__q { margin: 16px 0 4px; padding: 12px 14px 10px 16px; border-left: 3px solid var(--zhu); background: rgba(184, 54, 31, .06); }
.qm-card__q p { margin: 0; font-size: 15px; line-height: 1.95; letter-spacing: .06em; color: #3c3226; }
.qm-card__q cite { display: block; margin-top: 6px; font-style: normal; font-size: 12.5px; letter-spacing: .1em; color: #7a6c56; }
.qm-card__q cite::before { content: '——'; }
.qm-card__nav { display: flex; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(43, 36, 27, .14); }
.qm-card__nav .qm-btn { flex: 1; color: #2b241b; border-color: rgba(43, 36, 27, .3); letter-spacing: .24em; }
.qm-card__nav .qm-btn:hover { background: rgba(43, 36, 27, .06); }
.qm-card__nav .qm-btn--main { color: #fbf4e8; border-color: var(--zhu); }
.qm-card__nav .qm-btn--main:hover { background: var(--zhu2); }

/* 全卷缩影 */
.qm-map { position: relative; z-index: 4; border-top: 1px solid var(--line); background: #120f0b; padding: 6px 22px 6px; display: flex; flex-direction: column; justify-content: center; }
.qm-map__secs { position: relative; height: 18px; font-size: 12px; letter-spacing: .16em; color: var(--txt2); }
.qm-map__secs span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; cursor: pointer; padding: 0 2px; }
.qm-map__secs span:hover { color: var(--txt); }
.qm-map__secs span.is-on { color: #fbf4e8; }
.qm-map__secs i { position: absolute; top: 3px; bottom: -4px; width: 1px; background: rgba(239, 228, 206, .2); }
.qm-map__bar { position: relative; height: 30px; cursor: pointer; touch-action: none; outline: none; border-radius: 1px; box-shadow: 0 0 0 1px rgba(239, 228, 206, .12); }
.qm-map__bar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; display: block; filter: brightness(.82); pointer-events: none; user-select: none; -webkit-user-select: none; }
.qm-map__ticks { position: absolute; inset: 0; pointer-events: none; }
.qm-map__ticks b { position: absolute; top: -3px; width: 2px; height: 5px; margin-left: -1px; background: var(--zhu2); }
.qm-map__ticks b.is-colo { background: #f1e9d8; opacity: .7; }
.qm-map__win { position: absolute; top: -3px; bottom: -3px; border: 1.5px solid #fbf4e8; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), 0 0 14px rgba(0, 0, 0, .5); background: rgba(251, 244, 232, .08); min-width: 4px; pointer-events: none; }
.qm-map__dir { display: flex; justify-content: space-between; margin: 3px 0 0; font-size: 11px; letter-spacing: .3em; color: rgba(184, 170, 143, .7); }

/* 说明 */
.qm-ov { position: fixed; inset: 0; z-index: 20; background: rgba(8, 6, 4, .66); display: grid; place-items: center; padding: 24px; }
.qm-ov[hidden] { display: none; }
.qm-dlg { position: relative; width: min(680px, 100%); max-height: calc(100vh - 48px); max-height: calc(100svh - 48px); overflow-y: auto; background: var(--paper); color: #2b241b; padding: 34px 38px 30px; border-radius: 2px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9); outline: none; }
.qm-dlg h2 { margin: 0 0 16px; font-size: 24px; letter-spacing: .2em; }
.qm-dlg h3 { margin: 24px 0 8px; font-size: 16px; letter-spacing: .3em; color: var(--zhu); }
.qm-dlg p, .qm-dlg li { font-size: 15px; line-height: 1.95; letter-spacing: .04em; }
.qm-dlg p { margin: 0 0 10px; text-align: justify; }
.qm-dlg ul { margin: 0; padding-left: 1.2em; }
.qm-dlg .qm-src li { font-size: 13.5px; line-height: 1.8; color: #4a3f31; }
.qm-dlg .qm-src a { color: inherit; text-decoration: underline; text-decoration-color: rgba(140, 40, 24, .45); text-underline-offset: 2px; }
.qm-dlg .qm-src a:hover { color: #8c2818; }
.qm-dlg__x { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border: 0; background: none; font-size: 24px; cursor: pointer; color: #6c5f4c; }
.qm-dlg__x:hover { color: #2b241b; }

/* 窄屏 */
@media (max-width: 760px) {
	.qm { --top: 54px; --map: 70px; }
	.qm-top { padding: 0 12px; gap: 10px; }
	.solo .qm-top { padding-right: 12px; }
	.qm-ttl { gap: 0; }
	.qm-ttl h1 { font-size: 18px; letter-spacing: .12em; }
	.qm-ttl p { display: none; }
	.qm-btn { padding: 6px 10px 6px 12px; font-size: 13px; letter-spacing: .16em; }
	.qm-where { left: 10px; top: 10px; font-size: 12px; letter-spacing: .14em; }
	.qm-zoom { right: 10px; bottom: 10px; }
	.qm-ctl { left: 10px; bottom: 10px; gap: 8px; }
	.qm-roll { height: 40px; padding: 0 14px 0 4px; font-size: 13px; letter-spacing: .2em; gap: 8px; }
	.qm-mode { height: 40px; }
	.qm-mode button { padding: 0 9px 0 10px; font-size: 12.5px; letter-spacing: .12em; }
	.qm-zoom button { width: 38px; height: 38px; }
	.qm-hint { font-size: 13px; letter-spacing: .12em; bottom: 62px; }
	.qm-map { padding: 4px 12px; }
	.qm-map__bar { height: 22px; }
	.qm-map__secs { font-size: 11px; letter-spacing: .06em; height: 16px; }
	.qm-card { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(var(--map) + 8px); max-height: 52%; padding: 18px 18px 12px; }
	.qm-card__t { font-size: 20px; margin-bottom: 8px; }
	.qm-card__d { font-size: 14.5px; line-height: 1.85; }
	.qm-card__q p { font-size: 14px; line-height: 1.85; }
	.qm-card__nav { margin-top: 10px; padding-top: 10px; }
	.qm-dlg { padding: 26px 20px 22px; }
}
@media (max-width: 760px) {
	.solo .qm { --top: 92px; }
	.solo .qm-top { flex-wrap: wrap; align-content: center; row-gap: 8px; }
	.solo .qm-ttl { flex-basis: 100%; padding-right: 170px; }
}
@media (prefers-reduced-motion: reduce) {
	.qm-pin.is-on::after, .qm-hint__a, .qm-load, .qm-roll[aria-pressed="true"] i { animation: none; }
}
