/* ============================================================
   视觉小说 · 放映厅 UI  v2（桌面 / 手机双端重写）
   深房（近黑）+ Level 0 墙纸黄 + 荧光灯白
   胶片元素：齿孔、片门内阴影、帧号计数、颗粒
   —— 布局原则：一套结构，两个断点；手机端不做舞台旋转
   ============================================================ */
[hidden] { display: none !important; }

:root {
    --room: #0e0e09;
    --room-2: #16160f;
    --wall: #cfc57a;
    --wall-lit: #e6dc9b;
    --lamp: #f3f0de;
    --ink: #171608;
    --rust: #b06a35;
    --sage: #9dc0a6;
    --dim: #8b8670;
    --line: rgba(207, 197, 122, .26);
    --serif: "Songti SC", "STSong", "SimSun", "Source Han Serif SC", "Noto Serif CJK SC", serif;
    --mono: "Consolas", "DejaVu Sans Mono", "SFMono-Regular", "Courier New", monospace;
    --sans: "PingFang SC", "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-l: env(safe-area-inset-left, 0px);
    --safe-r: env(safe-area-inset-right, 0px);
    --ease: cubic-bezier(.33, .02, .28, 1);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--room);
    color: var(--lamp);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    /* 触屏不选中文字、不出现按住高亮、不弹长按菜单 */
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
}
body { font-family: var(--sans); }
::selection { background: rgba(207, 197, 122, .35); color: var(--lamp); }

/* ============================================================
   选片 · 章节选择
   ============================================================ */
#picker {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding:
        calc(48px + var(--safe-t))
        calc(24px + var(--safe-r))
        calc(44px + var(--safe-b))
        calc(24px + var(--safe-l));
    overflow-x: hidden;
    background:
        radial-gradient(120% 70% at 50% -12%, rgba(207, 197, 122, .17), transparent 62%),
        radial-gradient(80% 46% at 84% 108%, rgba(176, 106, 53, .12), transparent 70%),
        var(--room);
}
/* 放映灯下的浮动颗粒 */
#picker::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .055;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}
/* 地面反光 */
#picker::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 30vh;
    pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(207, 197, 122, .05));
}

.pk-head {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
}
.pk-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font: 10.5px/1 var(--mono);
    letter-spacing: .38em;
    color: var(--dim);
}
.pk-label::before {
    content: "";
    width: 26px;
    height: 1px;
    background: var(--line);
}
.pk-name {
    margin: 12px 0 0;
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(34px, 5.4vw, 68px);
    line-height: 1.06;
    letter-spacing: .1em;
    color: var(--lamp);
    text-shadow: 0 1px 0 rgba(0, 0, 0, .5);
}
.pk-lede {
    margin: 14px 0 0;
    max-width: 42em;
    font-size: 13.5px;
    line-height: 1.95;
    letter-spacing: .04em;
    color: #b7b29b;
}
.pk-lede b { color: var(--wall-lit); font-weight: 600; }

/* —— 片盒列表 —— */
.pk-list {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
    gap: 20px;
}

.vn-item {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0 0 14px;
    border: 1px solid rgba(207, 197, 122, .17);
    border-radius: 3px;
    background: linear-gradient(180deg, rgba(207, 197, 122, .045), rgba(10, 10, 6, .18));
    cursor: pointer;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .22s ease, background .22s ease, transform .22s ease;
}
.vn-item:hover, .vn-item:focus-visible {
    border-color: rgba(207, 197, 122, .5);
    background: linear-gradient(180deg, rgba(207, 197, 122, .1), rgba(10, 10, 6, .22));
    transform: translateY(-2px);
    outline: none;
}

/* 剧照 = 片门 */
.vn-shot {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #0a0a06;
}
.vn-shot img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(.86) contrast(1.04) brightness(.94);
    transition: filter .4s ease, transform .5s ease;
}
.vn-item:hover .vn-shot img { filter: saturate(1) contrast(1.06) brightness(1.04); transform: scale(1.03); }
/* 片门四角压暗 + 扫描线 */
.vn-shot::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(23, 22, 8, .8), inset 0 0 34px rgba(0, 0, 0, .5);
    background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, .14) 0 1px, transparent 1px 3px);
    opacity: .5;
}

.vn-body {
    position: relative;
    z-index: 2;
    padding: 13px 15px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.vn-no {
    font: 10px/1 var(--mono);
    letter-spacing: .3em;
    color: var(--wall);
}
.vn-title {
    margin: 0;
    font-family: var(--serif);
    font-weight: 700;
    font-size: 19px;
    letter-spacing: .05em;
    line-height: 1.45;
    color: var(--lamp);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.vn-meta {
    margin: 0;
    font: 11px/1.7 var(--mono);
    letter-spacing: .05em;
    color: var(--dim);
}
.vn-stats {
    margin: 0;
    font-size: 11.5px;
    letter-spacing: .06em;
    color: #9d987f;
}
.vn-go {
    margin: 12px 15px 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    border: 1px solid rgba(207, 197, 122, .34);
    border-radius: 2px;
    font: 10.5px/1 var(--mono);
    letter-spacing: .22em;
    color: var(--wall-lit);
    opacity: 1;
    transition: background .22s ease, border-color .22s ease;
}
.vn-item:hover .vn-go { background: rgba(207, 197, 122, .12); border-color: var(--wall); }
.vn-go svg { width: 16px; height: 16px; display: block; }

.pk-note {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    font-size: 11.5px;
    line-height: 1.9;
    letter-spacing: .04em;
    color: #857f68;
}

/* ============================================================
   装片 · 载入
   ============================================================ */
#dlScreen {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(24px + var(--safe-t)) 22px calc(24px + var(--safe-b));
    background: var(--room);
    font-family: var(--mono);
    transition: opacity .5s ease;
}
#dlScreen.out { opacity: 0; pointer-events: none; }
.dl-box { width: min(520px, 86vw); }
.dl-kicker {
    font-size: 10px;
    letter-spacing: .44em;
    color: var(--dim);
}
.dl-title {
    margin: 12px 0 0;
    font-family: var(--serif);
    font-size: 22px;
    letter-spacing: .1em;
    color: var(--lamp);
    font-weight: 700;
}
.dl-bar {
    position: relative;
    height: 3px;
    margin: 26px 0 0;
    background: rgba(207, 197, 122, .16);
}
.dl-bar i {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--wall);
    transition: width .28s ease;
}
.dl-bar::after {
    content: "";
    position: absolute;
    left: 0; right: 0; top: -7px;
    height: 5px;
    background: repeating-linear-gradient(90deg,
        rgba(243, 240, 222, .18) 0 5px, transparent 5px 14px);
}
.dl-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 14px 0 0;
    font-size: 11px;
    letter-spacing: .08em;
    color: #a8a28a;
}
.dl-meta span:first-child { color: var(--wall-lit); }
.dl-note {
    margin: 18px 0 0;
    min-height: 1.6em;
    font-size: 11px;
    line-height: 1.7;
    letter-spacing: .06em;
    color: #7e7a65;
    word-break: break-all;
}

/* ============================================================
   放映 · 剧情舞台
   ============================================================ */
#storyMode {
    position: fixed;
    inset: 0;
    z-index: 900;
    overflow: hidden;
    background: #080803;
    font-family: var(--sans);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    cursor: pointer;
}
.bg-layer { position: absolute; inset: 0; background: #080803; }
.bg-layer img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .9s ease;
    filter: saturate(.94) contrast(1.02) brightness(.92);
}
.bg-layer img.show { opacity: 1; }
.bg-fall { position: absolute; inset: 0; opacity: 0; transition: opacity .9s ease; }
.bg-fall.show { opacity: 1; }
/* 上下压边（放映画框） + 暗角 */
.bg-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(6, 6, 3, .34) 0, transparent 17%),
        linear-gradient(0deg, rgba(6, 6, 3, .92) 0, rgba(6, 6, 3, .34) 18%, transparent 40%),
        radial-gradient(ellipse at 50% 46%, transparent 42%, rgba(0, 0, 0, .46) 100%);
}
.bg-noise {
    position: absolute;
    inset: 0;
    opacity: .05;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.img-hint {
    position: absolute;
    right: calc(14px + var(--safe-r));
    bottom: 18vh;
    z-index: 3;
    display: none;
    padding: 5px 9px;
    border: 1px solid rgba(207, 197, 122, .32);
    background: rgba(10, 10, 6, .8);
    font: 10.5px/1.5 var(--mono);
    letter-spacing: .08em;
    color: #a9a389;
    max-width: 46vw;
    word-break: break-all;
}

/* —— 顶栏：放映开始后才可唤出，鼠标移到顶部 / 触摸顶部出现，2.6s 自动隐去 —— */
.story-topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(10px + var(--safe-t)) calc(14px + var(--safe-r)) 10px calc(14px + var(--safe-l));
    background: linear-gradient(180deg, rgba(6, 6, 3, .78), rgba(6, 6, 3, .38) 72%, transparent);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity .28s var(--ease), transform .28s var(--ease);
}
.story-topbar.show,
.story-topbar:focus-within { opacity: 1; transform: none; pointer-events: auto; }
.story-tag {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: 10.5px/1 var(--mono);
    letter-spacing: .22em;
    color: #d6d0a4;
}
.story-progress {
    flex: 0 0 auto;
    font: 10.5px/1 var(--mono);
    letter-spacing: .12em;
    color: #8c866e;
    padding-left: 10px;
    border-left: 1px solid rgba(207, 197, 122, .2);
}
.story-topbtns {
    margin-left: auto;
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}
.story-topbtns button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 11px;
    min-height: 34px;
    background: rgba(10, 10, 6, .55);
    border: 1px solid rgba(207, 197, 122, .3);
    border-radius: 2px;
    color: #e3ddc2;
    font: 10px/1 var(--mono);
    letter-spacing: .16em;
    cursor: pointer;
    transition: color .18s, border-color .18s, background .18s;
}
.story-topbtns button:hover,
.story-topbtns button:focus-visible {
    color: var(--wall-lit);
    border-color: var(--wall);
    background: rgba(207, 197, 122, .12);
    outline: none;
}
.story-topbtns svg { width: 13px; height: 13px; display: block; opacity: .9 }
/* 横竖屏按键：处于强制横屏时点亮，一眼能看出当前状态 */
.story-topbtns button[aria-pressed="true"] {
    color: #0b0b06;
    background: rgba(207, 197, 122, .9);
    border-color: rgba(207, 197, 122, .95);
}
.story-topbtns button[aria-pressed="true"] svg { opacity: 1; }

/* —— 帧进度（顶部极细线 + 末端亮点） —— */
.progress-line {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    z-index: 7;
    background: rgba(243, 240, 222, .07);
}
.progress-line i {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(207, 197, 122, .5), var(--wall));
    box-shadow: 0 0 8px rgba(207, 197, 122, .5);
    transition: width .4s ease;
}

/* —— 片名卡 —— */
.title-card {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(28px + var(--safe-t)) calc(24px + var(--safe-r)) calc(28px + var(--safe-b)) calc(24px + var(--safe-l));
    background: radial-gradient(circle at 50% 46%, rgba(207, 197, 122, .1), transparent 48%), rgba(6, 6, 3, .82);
}
.tc-inner { width: min(700px, 84vw); text-align: left; }
.tc-kicker {
    font: 10.5px/1 var(--mono);
    letter-spacing: .46em;
    color: #6f6a55;
}
.tc-title {
    margin: 18px 0 0;
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(26px, 4.6vw, 44px);
    line-height: 1.3;
    letter-spacing: .1em;
    color: var(--lamp);
}
.tc-date {
    margin: 16px 0 0;
    font: 11px/1 var(--mono);
    letter-spacing: .24em;
    color: var(--wall);
}
.tc-sub {
    margin: 26px 0 0;
    font: 11px/1.8 var(--mono);
    letter-spacing: .18em;
    color: #a79f86;
}

/* —— 字幕 —— */
.dialogue {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 5;
    padding:
        64px calc(20px + var(--safe-r))
        calc(26px + var(--safe-b)) calc(20px + var(--safe-l));
    overscroll-behavior: contain;
}
.dialogue::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(6, 6, 3, 0), rgba(6, 6, 3, .72) 38%, rgba(6, 6, 3, .95));
}
.dial-text {
    position: relative;
    max-width: min(940px, 88vw);
    margin: 0 auto;
    padding-left: 16px;
    border-left: 1px solid rgba(207, 197, 122, .42);
    font-size: clamp(16px, 1.4vw, 20px);
    line-height: 2.02;
    letter-spacing: .035em;
    color: #f5f2e2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
    word-break: break-word;
}
.dial-ind {
    position: absolute;
    right: max(18px, calc((100vw - min(940px, 88vw)) / 2));
    bottom: calc(10px + var(--safe-b));
    font-size: 11px;
    color: var(--wall);
    opacity: 1;
    transition: opacity .2s;
    animation: indBlink 1.5s ease-in-out infinite;
}
@keyframes indBlink { 0%, 100% { transform: translateY(0); opacity: .85 } 50% { transform: translateY(2px); opacity: .35 } }

/* —— 层级标注 —— */
.center-line {
    position: absolute;
    left: 0; right: 0;
    top: 46%;
    transform: translateY(-50%);
    z-index: 5;
    text-align: center;
    font-family: var(--mono);
    font-size: clamp(13px, 1.5vw, 17px);
    letter-spacing: .2em;
    line-height: 1.9;
    padding: 0 calc(20px + var(--safe-l));
    text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
}
.center-line.mark-level { color: var(--wall-lit); }
.center-line.mark-diff  { color: var(--rust); }
.center-line.mark-tags  { color: var(--sage); }

/* —— 结束卡 —— */
.end-card {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding:
        calc(30px + var(--safe-t)) calc(22px + var(--safe-r))
        calc(30px + var(--safe-b)) calc(22px + var(--safe-l));
    overflow-y: auto;
    background: radial-gradient(circle at 50% 42%, rgba(207, 197, 122, .07), transparent 52%), rgba(6, 6, 3, .93);
}
.end-title {
    font-family: var(--serif);
    font-size: clamp(22px, 3.2vw, 30px);
    letter-spacing: .3em;
    color: var(--lamp);
}
.end-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: min(520px, 90vw);
}
.end-btn {
    flex: 1 1 140px;
    padding: 12px 20px;
    min-height: 46px;
    background: transparent;
    border: 1px solid rgba(207, 197, 122, .45);
    border-radius: 2px;
    color: var(--wall-lit);
    font: 11.5px/1 var(--mono);
    letter-spacing: .2em;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}
.end-btn:hover, .end-btn:focus-visible {
    background: rgba(207, 197, 122, .12);
    border-color: var(--wall);
    color: #fffbe4;
    outline: none;
}
.end-btn.primary {
    background: var(--wall);
    border-color: var(--wall);
    color: var(--ink);
}
.end-btn.primary:hover { background: var(--wall-lit); border-color: var(--wall-lit); }
.end-copy {
    max-width: min(620px, 88vw);
    text-align: center;
    font-size: 11px;
    line-height: 1.95;
    letter-spacing: .04em;
    color: #7a7460;
}

/* —— 历史抽屉 —— */
.history-panel {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    z-index: 9;
    width: min(430px, 88vw);
    display: flex;
    flex-direction: column;
    background: rgba(10, 10, 6, .97);
    border-left: 1px solid rgba(207, 197, 122, .32);
    transform: translateX(102%);
    transition: transform .32s var(--ease);
}
.history-panel.open { transform: none; }
.history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(14px + var(--safe-t)) 16px 14px;
    border-bottom: 1px solid rgba(207, 197, 122, .22);
    font: 10.5px/1 var(--mono);
    letter-spacing: .3em;
    color: var(--wall);
}
.history-head button {
    padding: 8px 12px;
    min-height: 36px;
    background: transparent;
    border: 1px solid rgba(207, 197, 122, .3);
    border-radius: 2px;
    color: #ded8bd;
    font: 10px/1 var(--mono);
    letter-spacing: .16em;
    cursor: pointer;
}
.history-head button:hover { border-color: var(--wall); color: var(--wall-lit); }
.history-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px 0 calc(20px + var(--safe-b));
    -webkit-overflow-scrolling: touch;
}
.hist-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(207, 197, 122, .1);
    cursor: pointer;
    transition: background .18s;
}
.hist-item:hover, .hist-item:active { background: rgba(207, 197, 122, .07); }
.hist-text {
    font-size: 12.5px;
    line-height: 1.95;
    letter-spacing: .03em;
    color: #d9d4bb;
}

/* —— 沉浸模式：不要框，整幅画面无遮挡，文字纯漂浮 —— */
#storyMode.immersive .story-topbar,
#storyMode.immersive .progress-line { opacity: 0 !important; pointer-events: none !important; }
#storyMode.immersive .dialogue {
    left: 0; right: 0; bottom: 0;
    width: auto;
    max-width: none;
    padding: 0 7vw calc(34px + var(--safe-b)) 7vw;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
#storyMode.immersive .dialogue::before,
#storyMode.immersive .dialogue::after { display: none; }
#storyMode.immersive .dial-text {
    max-width: min(880px, 84vw);
    padding-left: 0;
    border-left: 0;
    text-align: center;
    text-wrap: balance;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, .95),
        0 3px 12px rgba(0, 0, 0, .9),
        0 0 30px rgba(0, 0, 0, .75);
}
#storyMode.immersive .dial-ind { right: 50%; bottom: calc(10px + var(--safe-b)); transform: translateX(50%); }
.immerse-float {
    position: absolute;
    right: calc(14px + var(--safe-r));
    bottom: calc(14px + var(--safe-b));
    z-index: 10;
    padding: 10px 14px;
    min-height: 42px;
    background: rgba(10, 10, 6, .62);
    border: 1px solid rgba(207, 197, 122, .3);
    border-radius: 2px;
    color: #cfc9a2;
    font: 10px/1 var(--mono);
    letter-spacing: .16em;
    cursor: pointer;
}

/* ============================================================
   平板 / 窄桌面：两列片盒，字幕收紧
   ============================================================ */
@media (max-width: 1024px) {
    .pk-list { grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 16px; }
}

/* ============================================================
   手机竖屏：单列横向卡片，字幕贴底玻璃面板，顶栏图标化
   ============================================================ */
@media (max-width: 700px) {
    /* —— 选片 —— */
    #picker { gap: 20px; padding: calc(30px + var(--safe-t)) 18px calc(36px + var(--safe-b)); }
    .pk-name { font-size: clamp(28px, 8vw, 38px); letter-spacing: .08em; }
    .pk-lede { font-size: 13px; line-height: 1.85; margin-top: 12px; }
    .pk-list { grid-template-columns: 1fr; gap: 12px; }
    .vn-item {
        flex-direction: row;
        align-items: center;
        gap: 0;
        padding: 0;
        border-radius: 4px;
        overflow: hidden;
    }
    .vn-item:active { transform: scale(.995); }
    .vn-shot {
        flex: 0 0 100px;
        width: 100px;
        height: auto;
        aspect-ratio: 16 / 9;
        align-self: center;
        margin: 0 0 0 10px;
        border-radius: 3px;
    }
    .vn-shot img { transform: none !important; }
    .vn-body { flex: 1 1 auto; min-width: 0; padding: 11px 8px 11px 12px; gap: 4px; }
    .vn-no { font-size: 9px; letter-spacing: .22em; }
    .vn-title { font-size: 15.5px; line-height: 1.35; letter-spacing: .02em; -webkit-line-clamp: 2; }
    .vn-meta { font-size: 10.5px; }
    .vn-stats { font-size: 10.5px; }
    .vn-go {
        flex: 0 0 24px;
        width: 24px; min-width: 24px;
        min-height: 24px;
        margin: 0 10px 0 0;
        border: 0;
        background: transparent;
        color: var(--wall);
        opacity: .8;
    }
    .vn-go span { display: none; }
    .vn-go svg { width: 22px; height: 22px; }
    .vn-item:hover .vn-go { background: transparent; }
    .pk-note { font-size: 11px; line-height: 1.8; }

    /* —— 装片 —— */
    #dlScreen { padding: 24px 18px calc(24px + var(--safe-b)); }
    .dl-box { width: 100%; max-width: 440px; }
    .dl-title { font-size: 20px; }
    .dl-meta { font-size: 10.5px; }

    /* —— 放映：竖屏不旋转，整幅铺满 —— */
    .story-topbar {
        gap: 8px;
        padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) 8px calc(10px + var(--safe-l));
        background: linear-gradient(180deg, rgba(6, 6, 3, .88), rgba(6, 6, 3, .5) 70%, transparent);
    }
    .story-tag { font-size: 9.5px; letter-spacing: .14em; }
    .story-progress { font-size: 9.5px; letter-spacing: .06em; padding-left: 8px; }
    .story-topbtns { gap: 6px; }
    .story-topbtns button {
        width: 42px; height: 42px;
        padding: 0;
        border-radius: 4px;
    }
    .story-topbtns button span { display: none; }
    .story-topbtns svg { width: 16px; height: 16px; }

    .title-card { align-items: flex-end; padding-bottom: calc(56px + var(--safe-b)); }
    .tc-inner { width: 100%; max-width: 100%; }
    .tc-kicker { font-size: 9.5px; letter-spacing: .3em; }
    .tc-title { margin-top: 12px; font-size: clamp(24px, 7.6vw, 34px); letter-spacing: .06em; line-height: 1.32; }
    .tc-date { font-size: 10.5px; letter-spacing: .16em; }
    .tc-sub { margin-top: 18px; font-size: 11px; }

    .dialogue {
        padding: 26px calc(14px + var(--safe-r)) calc(18px + var(--safe-b)) calc(14px + var(--safe-l));
        background: linear-gradient(180deg, rgba(8, 8, 4, .72), rgba(8, 8, 4, .94) 34%, rgba(8, 8, 4, .97));
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        border-top: 1px solid rgba(207, 197, 122, .18);
        overflow-y: auto;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }
    .dialogue::before { display: none; }
    .dial-text {
        max-width: 100%;
        padding-left: 12px;
        border-left-width: 2px;
        font-size: 15px;
        line-height: 1.8;
        letter-spacing: .03em;
    }
    .dial-ind { right: calc(12px + var(--safe-r)); bottom: calc(8px + var(--safe-b)); }

    .center-line { font-size: 14px; letter-spacing: .14em; }
    .img-hint { max-width: 62vw; }

    .end-card { gap: 18px; }
    .end-actions { width: 100%; flex-direction: column; gap: 10px; }
    .end-btn { flex: 0 0 auto; width: 100%; font-size: 12px; }
    .end-copy { font-size: 10.5px; }

    /* 历史 = 底部抽屉 */
    .history-panel {
        top: auto; left: 0; right: 0; bottom: 0;
        width: 100%;
        height: 78dvh;
        border-left: 0;
        border-top: 1px solid rgba(207, 197, 122, .32);
        border-radius: 14px 14px 0 0;
        transform: translateY(102%);
        box-shadow: 0 -18px 40px rgba(0, 0, 0, .55);
    }
    .history-panel::before {
        content: "";
        position: absolute;
        top: 8px; left: 50%;
        width: 38px; height: 4px;
        margin-left: -19px;
        border-radius: 2px;
        background: rgba(243, 240, 222, .28);
    }
    .history-head { padding: 22px 16px 12px; font-size: 10px; }
    .hist-text { font-size: 14px; line-height: 1.9; }
    .hist-item { padding: 13px 16px; }
    /* 沉浸按钮挪到右上，绝不压字 */
    .immerse-float {
        top: calc(10px + var(--safe-t));
        right: calc(10px + var(--safe-r));
        bottom: auto;
        min-height: 40px;
        padding: 9px 12px;
        background: rgba(10, 10, 6, .78);
    }
}

/* ============================================================
   手机竖屏：只有「放映舞台」强制横屏（选片页保持竖屏不动）
   章节进入即旋转 90°，全部章节统一；真机另走全屏 + 方向锁定
   ============================================================ */
@media (orientation: portrait) and (max-width: 900px) {
    #storyMode.force-rotate {
        top: 0; left: 100vw;
        right: auto; bottom: auto;
        width: 100vh;
        height: 100vw;
        transform: rotate(90deg);
        transform-origin: 0 0;
        display: block;
        background: #080803;
    }

    /* 画面恢复满幅：铺满整块横屏画布 */
    #storyMode.force-rotate .bg-layer {
        position: absolute;
        inset: 0;
        width: auto;
        aspect-ratio: auto;
        border-bottom: 0;
    }
    #storyMode.force-rotate .bg-vignette { display: block; }

    /* 字幕压到底部半屏，横向留白更宽，字比竖屏时小一号 */
    #storyMode.force-rotate .dialogue {
        position: absolute;
        left: 0; right: 0; bottom: 0;
        top: auto;
        flex: none;
        max-height: 52%;
        padding: 40px calc(46px + var(--safe-r)) 18px calc(46px + var(--safe-l));
        background: linear-gradient(180deg, rgba(6, 6, 3, 0), rgba(6, 6, 3, .84) 30%, rgba(6, 6, 3, .97));
        border-top: 0;
        overflow-y: auto;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        display: block;
    }
    #storyMode.force-rotate .dialogue::before { display: none; }
    #storyMode.force-rotate .dialogue::after { display: none; }
    #storyMode.force-rotate .dial-text {
        font-size: 14px;
        line-height: 1.72;
        letter-spacing: .03em;
        max-width: 760px;      /* 旋转后舞台宽 100vh，不能再拿 vw 量宽 */
        width: 100%;
        margin: 0 auto;
        padding-left: 12px;
        border-left-width: 1px;
    }
    #storyMode.force-rotate .dial-ind { right: calc(16px + var(--safe-r)); bottom: 8px; }

    /* 片名卡回到整屏居中 */
    #storyMode.force-rotate .title-card {
        top: 0; bottom: 0; left: 0; right: 0;
        align-items: center;
        justify-content: flex-start;
        padding: 24px calc(46px + var(--safe-r)) 24px calc(46px + var(--safe-l));
        background: radial-gradient(circle at 50% 46%, rgba(207, 197, 122, .1), transparent 48%), rgba(6, 6, 3, .82);
    }
    #storyMode.force-rotate .tc-inner { width: min(700px, 84%); max-width: 84%; }
    #storyMode.force-rotate .tc-title { font-size: clamp(22px, 5.6vh, 34px); }
    #storyMode.force-rotate .tc-sub { margin-top: 16px; }

    #storyMode.force-rotate .center-line { top: 42%; font-size: 13px; }
    #storyMode.force-rotate .img-hint { bottom: 46%; }

    /* 顶栏按钮压扁，别在横屏里占两行 */
    #storyMode.force-rotate .story-topbar {
        padding: 8px calc(16px + var(--safe-r)) 8px calc(16px + var(--safe-l));
    }
    #storyMode.force-rotate .story-topbtns button { min-height: 34px; padding: 7px 11px; }

    /* 历史抽屉回到右侧竖条 */
    #storyMode.force-rotate .history-panel {
        top: 0; bottom: 0; right: 0; left: auto;
        height: auto;
        width: min(420px, 62%);
        border-left: 1px solid rgba(207, 197, 122, .32);
        border-top: 0;
        border-radius: 0;
        transform: translateX(102%);
    }
    #storyMode.force-rotate .history-panel.open { transform: none; }
    #storyMode.force-rotate .history-panel::before { display: none; }

    /* 横屏沉浸：同样不要框，图片铺满，文字压底漂浮 */
    #storyMode.force-rotate.immersive .dialogue {
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        width: auto;
        max-height: none;
        padding: 0 6% 22px;
        transform: none;
        background: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    #storyMode.force-rotate.immersive .dialogue::before,
    #storyMode.force-rotate.immersive .dialogue::after { display: none; }
    #storyMode.force-rotate.immersive .dial-text {
        font-size: 13.5px;
        max-width: min(720px, 86%);
        padding-left: 0;
        border-left: 0;
        text-align: center;
    }
    #storyMode.force-rotate.immersive .dial-ind { right: 50%; bottom: 8px; transform: translateX(50%); }
}

/* ============================================================
   手机横屏（矮屏）：画面满幅，字幕压到下半屏并留出安全边
   ============================================================ */
@media (max-height: 540px) and (orientation: landscape) {
    .story-topbar { padding: calc(6px + var(--safe-t)) calc(12px + var(--safe-r)) 6px calc(12px + var(--safe-l)); }
    .story-topbtns button { min-height: 36px; width: auto; height: auto; padding: 6px 10px; }
    .story-topbtns button span { display: inline; }
    .story-tag { font-size: 9.5px; }
    .story-progress { font-size: 9.5px; }
    .dialogue {
        max-height: 54%;
        padding: 26px calc(18px + var(--safe-r)) calc(14px + var(--safe-b)) calc(18px + var(--safe-l));
        overflow-y: auto;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
        background: linear-gradient(180deg, rgba(6, 6, 3, 0), rgba(6, 6, 3, .82) 26%, rgba(6, 6, 3, .96));
    }
    .dialogue::before { display: none; }
    .dial-text { font-size: 13.5px; line-height: 1.68; max-width: min(820px, 92vw); margin: 0 auto; }
    .dial-ind { right: calc(16px + var(--safe-r)); }
    .center-line { top: 34%; font-size: 13px; }
    .img-hint { bottom: 58%; }
    .end-card { gap: 12px; padding: calc(16px + var(--safe-t)) 18px calc(16px + var(--safe-b)); }
    .end-card .end-copy { display: none; }
    .end-btn { min-height: 40px; }
    .history-panel { width: min(420px, 72vw); height: auto; top: 0; bottom: 0; border-radius: 0; border-top: 0; border-left: 1px solid rgba(207, 197, 122, .32); transform: translateX(102%); }
    .history-panel::before { display: none; }
    .immerse-float {
        top: calc(8px + var(--safe-t));
        right: calc(10px + var(--safe-r));
        bottom: auto;
        min-height: 36px;
        padding: 6px 10px;
    }
}

/* ============================================================
   超窄屏（≤360）：卡片再压一档
   ============================================================ */
@media (max-width: 380px) {
    .vn-shot { flex-basis: 96px; width: 96px; }
    .vn-title { font-size: 15px; }
    .pk-name { font-size: 26px; }
    .dial-text { font-size: 14px; }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    .vn-item, .vn-shot img, .dialogue, .history-panel, .story-topbar { transition-duration: .01ms !important; }
    .dial-ind { animation: none; }
}
