:root { --paper:#f4ecd8; --ink:#3c3a2e; --olive:#5b6b3a; --accent:#d9743a; --dim:rgba(40,35,20,.55); }
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body { margin:0; height:100%; background:#1d1b16; color:var(--ink); font-family:"Songti SC","Noto Serif CJK SC","Source Han Serif SC","STSong",serif; touch-action:manipulation; overflow:hidden; }
#stage { position:relative; width:100vw; height:100vh; height:100dvh; margin:0 auto; overflow:hidden; background:#000; }
@media (min-aspect-ratio: 9/16) { #stage { width:calc(100dvh * 9 / 16); } }
.bg { position:absolute; inset:0; background-size:cover; background-position:center top; opacity:0; transition:opacity 1.6s ease; }
.bg.on { opacity:1; }
#vid { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; opacity:0; transition:opacity 1.2s; pointer-events:none; }
#vid.on { opacity:1; }
#vignette { position:absolute; inset:0; pointer-events:none; background:linear-gradient(to bottom, rgba(0,0,0,.25), transparent 30%, transparent 55%, rgba(20,16,8,.75)); }
#topbar { position:absolute; top:calc(10px + env(safe-area-inset-top)); right:12px; z-index:6; }
.screen { padding-top:calc(58px + env(safe-area-inset-top)) !important; }
.sysbtn { width:36px; height:36px; border-radius:50%; background:rgba(244,236,216,.75); color:var(--ink); display:flex; align-items:center; justify-content:center; font-size:18px; cursor:pointer; }
.sysbtn.off { opacity:.45; text-decoration:line-through; }
.hidden { display:none !important; }

.screen { position:absolute; inset:0; display:none; flex-direction:column; align-items:center; padding:calc(24px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom)); z-index:3; opacity:0; transition:opacity .8s; }
.screen.on { display:flex; opacity:1; }
.spacer { flex:1; }

.btn { border:0; border-radius:14px; padding:14px 30px; font-family:inherit; font-size:18px; letter-spacing:.12em; color:var(--paper); background:var(--olive); box-shadow:0 6px 18px rgba(0,0,0,.35); cursor:pointer; transition:transform .12s, opacity .4s; }
.btn:active { transform:scale(.97); }
.btn.main { margin-top:14px; min-width:60%; }
.btn.small { padding:10px 18px; font-size:15px; border-radius:10px; }
.btn[disabled] { opacity:.4; }
.note { color:var(--paper); opacity:.8; font-size:13px; letter-spacing:.08em; text-align:center; margin:12px 0 0; text-shadow:0 1px 4px rgba(0,0,0,.6); }
.note.small { font-size:12px; opacity:.6; }

/* 信纸 */
.paper { width:100%; max-width:420px; margin:auto 0; max-height:calc(100dvh - 90px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); display:flex; flex-direction:column; background:rgba(244,236,216,.94); border-radius:6px; padding:28px 24px 22px; box-shadow:0 10px 40px rgba(0,0,0,.45); position:relative; }
.paper::before { content:""; position:absolute; inset:8px; border:1px solid rgba(91,107,58,.25); border-radius:4px; pointer-events:none; }
.paper-body { font-size:16.5px; line-height:1.85; min-height:200px; white-space:pre-wrap; overflow-y:auto; flex:1 1 auto; -webkit-overflow-scrolling:touch; }
.paper-body p { margin:0 0 12px; opacity:0; transform:translateY(6px); transition:opacity 1.1s, transform 1.1s; }
.paper-body p.on { opacity:1; transform:none; }
.paper-sign { text-align:right; margin-top:10px; font-size:15px; opacity:0; transition:opacity 1s; }
.paper-sign.on { opacity:1; }
.tap-hint { text-align:center; font-size:12px; opacity:.5; margin-top:12px; letter-spacing:.2em; animation:blink 2.2s infinite; }
@keyframes blink { 0%,100%{opacity:.25} 50%{opacity:.7} }
.namebox { display:flex; gap:10px; margin-top:16px; width:100%; max-width:420px; }
.namebox input, #trip-input, #reply-input { flex:1; min-width:0; border:0; border-bottom:1.5px solid var(--olive); background:transparent; font-family:inherit; font-size:18px; padding:8px 4px; color:var(--ink); outline:none; }
#tripbox, #exbox, #reply-input { background:rgba(244,236,216,.92); border-radius:12px; padding:10px 14px; }
#reply-input { width:100%; max-width:420px; margin-top:10px; resize:none; line-height:1.7; border-bottom:0; }

/* 字幕 / 选择 */
.subtitle { color:var(--paper); font-size:17px; line-height:1.7; text-align:center; text-shadow:0 1px 6px rgba(0,0,0,.85); padding:0 6px 20px; min-height:80px; opacity:0; transition:opacity .7s; max-width:420px; }
.subtitle.on { opacity:1; }
.ask { color:var(--paper); font-size:19px; letter-spacing:.06em; text-align:center; text-shadow:0 1px 6px rgba(0,0,0,.8); margin-bottom:6px; }
.quote { color:var(--paper); font-size:22px; text-align:center; text-shadow:0 1px 6px rgba(0,0,0,.8); margin-bottom:22px; }
.opts { width:100%; max-width:420px; display:flex; flex-direction:column; gap:10px; }
.opts.row { flex-direction:row; flex-wrap:wrap; justify-content:center; }
.opt { background:rgba(244,236,216,.93); color:var(--ink); border-radius:12px; padding:14px 16px; font-size:16.5px; line-height:1.5; text-align:center; box-shadow:0 4px 14px rgba(0,0,0,.3); cursor:pointer; transition:transform .12s, background .2s; }
.opt:active { transform:scale(.98); background:#fff; }
.opts.row .opt { padding:8px 14px; font-size:14px; }
.skip { color:var(--paper); opacity:.55; font-size:13px; margin-top:18px; text-decoration:underline; text-underline-offset:4px; cursor:pointer; }
.echo { color:var(--paper); font-size:17.5px; line-height:1.9; text-align:center; text-shadow:0 1px 6px rgba(0,0,0,.85); max-width:400px; padding:0 8px; margin-bottom:12px; }

/* 等待 */
.wait-line { color:var(--paper); font-size:15px; opacity:.8; letter-spacing:.1em; text-shadow:0 1px 6px rgba(0,0,0,.8); }
.wait-event { color:var(--paper); font-size:16.5px; line-height:1.8; text-align:center; text-shadow:0 1px 6px rgba(0,0,0,.85); min-height:60px; margin:14px 0 6px; opacity:0; transition:opacity 1.2s; max-width:380px; }
.wait-event.on { opacity:1; }
.wait-timer { color:var(--paper); opacity:.5; font-size:12px; letter-spacing:.2em; margin-bottom:10px; }

/* 明信片 */
.postcard { width:min(86%, 380px); background:var(--paper); padding:10px 10px 14px; border-radius:4px; box-shadow:0 14px 40px rgba(0,0,0,.5); transform:rotate(-1.2deg); animation:drop 1.1s cubic-bezier(.2,.8,.2,1); }
@keyframes drop { from { opacity:0; transform:translateY(-60px) rotate(4deg); } to { opacity:1; transform:rotate(-1.2deg); } }
.postcard img { width:100%; aspect-ratio:3/4; object-fit:cover; display:block; border-radius:2px; }
.postcard-text { font-size:14.5px; line-height:1.7; padding:10px 4px 0; white-space:pre-wrap; }

/* 图鉴 */
.gal-title { color:var(--paper); font-size:20px; letter-spacing:.3em; margin:6px 0 12px; text-shadow:0 1px 6px rgba(0,0,0,.8); }
.gal-grid { width:100%; max-width:420px; flex:1; overflow-y:auto; display:grid; grid-template-columns:repeat(3,1fr); gap:6px; align-content:start; padding-bottom:10px; }
.gal-grid .cell { aspect-ratio:1; background:rgba(244,236,216,.2); border-radius:4px; overflow:hidden; cursor:pointer; position:relative; }
.gal-grid .cell img { width:100%; height:100%; object-fit:cover; display:block; }
.gal-grid .cell.add { display:flex; align-items:center; justify-content:center; color:var(--paper); font-size:12px; text-align:center; padding:8px; border:1px dashed rgba(244,236,216,.5); line-height:1.5; }
.gal-grid .cell.new::after { content:"新"; position:absolute; top:4px; right:4px; background:var(--accent); color:#fff; font-size:10px; padding:1px 5px; border-radius:6px; }
#lightbox { position:absolute; inset:0; z-index:8; background:rgba(10,8,4,.92); display:flex; flex-direction:column; align-items:center; justify-content:center; padding:24px; }
#lightbox video { width:min(88%,400px); aspect-ratio:3/4; object-fit:cover; border:8px solid var(--paper); border-bottom-width:40px; box-shadow:0 14px 40px rgba(0,0,0,.6); background:#000; }
.gal-grid .cell.vid::before { content:"▶"; position:absolute; left:6px; bottom:4px; color:#fff; font-size:12px; text-shadow:0 1px 3px rgba(0,0,0,.8); z-index:1; }
#lightbox img { width:min(88%,400px); aspect-ratio:3/4; object-fit:cover; border:8px solid var(--paper); border-bottom-width:40px; box-shadow:0 14px 40px rgba(0,0,0,.6); }
#lb-text { color:var(--paper); font-size:15px; line-height:1.8; text-align:center; margin-top:18px; max-width:380px; }

/* 结局卡 */
#card-img { width:min(82%, 360px); aspect-ratio:3/4; border-radius:6px; box-shadow:0 16px 50px rgba(0,0,0,.6); margin:auto 0 0; }

/* 按钮变体 / 面板 / toast */
.btn.ghost { background:rgba(244,236,216,.16); color:var(--paper); border:1px solid rgba(244,236,216,.55); box-shadow:none; }
#btn-resume { margin-top:10px; }
.btnrow2 { display:flex; gap:10px; margin-top:12px; }
#settings { position:absolute; inset:0; z-index:9; background:rgba(10,8,4,.72); display:flex; align-items:center; justify-content:center; padding:24px; }
.panel { width:100%; max-width:340px; background:var(--paper); border-radius:14px; padding:20px 18px; box-shadow:0 14px 40px rgba(0,0,0,.5); }
.panel-title { font-size:18px; letter-spacing:.2em; text-align:center; margin-bottom:14px; }
.panel .row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 0; border-top:1px solid rgba(91,107,58,.18); font-size:16px; }
.panel .row.btnrow .btn { flex:1; }
.panel .btn.ghost { color:var(--ink); border-color:rgba(91,107,58,.5); background:transparent; }
.switch { width:48px; height:28px; border-radius:14px; background:#b9b3a0; position:relative; cursor:pointer; transition:background .25s; }
.switch i { position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:50%; background:#fff; transition:left .25s; }
.switch.on { background:var(--olive); } .switch.on i { left:23px; }
#about { margin-top:10px; font-size:13.5px; line-height:1.75; opacity:.85; white-space:pre-wrap; }
#toast { position:absolute; left:50%; bottom:calc(90px + env(safe-area-inset-bottom)); transform:translateX(-50%) translateY(10px); background:rgba(244,236,216,.95); color:var(--ink); padding:9px 16px; border-radius:20px; font-size:14px; opacity:0; transition:opacity .3s, transform .3s; z-index:10; pointer-events:none; max-width:80%; text-align:center; }
#toast.on { opacity:1; transform:translateX(-50%); }
#lightbox .tap-hint { color:var(--paper); }
.gal-grid { max-height:calc(100dvh - 200px); }

/* 标题页开场四句 */
.intro { color:var(--paper); font-size:15.5px; line-height:2; text-align:center; text-shadow:0 1px 6px rgba(0,0,0,.85); margin-bottom:14px; max-width:360px; }
.intro p { margin:0; opacity:0; transform:translateY(6px); transition:opacity 1.2s, transform 1.2s; }
.intro p.on { opacity:1; transform:none; }

/* 追问 / 影像 / 三叶草 */
#ask-input { width:100%; max-width:420px; margin-top:6px; resize:none; line-height:1.7; border:0; font-family:inherit; font-size:17px; padding:12px 14px; color:var(--ink); outline:none; background:rgba(244,236,216,.92); border-radius:12px; }
.clip-title { color:var(--paper); font-size:16px; letter-spacing:.12em; text-shadow:0 1px 6px rgba(0,0,0,.8); margin-top:6px; }
.clover-hint { color:var(--paper); opacity:.7; font-size:13px; letter-spacing:.06em; text-shadow:0 1px 6px rgba(0,0,0,.8); margin-bottom:8px; }
#clover-layer { position:absolute; inset:0; pointer-events:none; z-index:4; }
.clover-pop { position:absolute; color:#c7e39a; font-size:18px; font-weight:700; text-shadow:0 1px 4px rgba(0,0,0,.7); animation:pop 1s ease-out forwards; }
@keyframes pop { from { opacity:1; transform:translate(-50%,0) scale(1); } to { opacity:0; transform:translate(-50%,-70px) scale(1.3); } }

#exbox { margin-top:12px; }

/* 引导选项 / 邮戳 / 生成中 */
#trip-suggest { margin-bottom:6px; } #trip-suggest .opt { padding:11px 14px; font-size:15px; }
.postcard { position:relative; }
.postmark { position:absolute; top:18px; right:18px; max-width:62%; transform:rotate(6deg); border:2px solid rgba(180,60,40,.75); color:rgba(180,60,40,.85); border-radius:6px; padding:4px 8px; font-size:11px; line-height:1.45; letter-spacing:.04em; background:rgba(244,236,216,.55); pointer-events:none; }
.postmark small { display:block; font-size:10px; opacity:.8; }
.wait-paint { color:#f4ecd8; font-size:14px; letter-spacing:.06em; text-shadow:0 1px 6px rgba(0,0,0,.85); margin-top:8px; opacity:.9; text-align:center; max-width:340px; }

/* 客人 */
#visitor { width:100%; max-width:400px; background:rgba(244,236,216,.94); border-radius:14px; padding:14px 14px 10px; box-shadow:0 10px 30px rgba(0,0,0,.45); margin-bottom:14px; animation:knock .5s ease-out; }
@keyframes knock { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:none; } }
.vis-knock { font-size:15.5px; line-height:1.7; text-align:center; margin-bottom:8px; }
#visitor .opts.row .opt { background:#fff; }
#visbox { margin-top:8px; padding:6px 10px; }
#visitor .skip { color:var(--ink); opacity:.6; margin-top:8px; }

/* 直连拿到的原图带底部水印带:显示时裁掉底部 8% */
.postcard img.raw { object-position:center top; height:auto; aspect-ratio:auto; max-height:none; width:100%; clip-path:inset(0 4% 8% 4%); margin-bottom:-8%; }

/* 开场四句独立一屏:暗底 + 大字 + 逐句淡入 */
#s-intro { background:rgba(12,10,6,.62); }
.intro.big { font-size:16px; line-height:2.3; letter-spacing:0; max-width:96%; text-shadow:0 2px 8px rgba(0,0,0,.9); }
.intro.big p { margin:0 0 6px; }
#intro-hint { color:var(--paper); }

/* 明信片显影:模糊→清晰,像照片冲出来 */
.postcard img.develop { animation:develop 2.4s ease-out both; }
@keyframes develop { 0% { filter:blur(14px) saturate(.4) brightness(1.25); } 60% { filter:blur(3px) saturate(.8) brightness(1.05); } 100% { filter:none; } }

/* 排版:平衡换行(每行均衡)、标点不落行首、中文不拆词 */
.intro p, .subtitle, .ask, .quote, .echo, .wait-event, .wait-paint, .postcard-text, .opt, .note, .vis-knock, .clip-title, .wait-line, .clover-hint, #about-text {
  text-wrap:balance; line-break:strict; overflow-wrap:anywhere; hanging-punctuation:allow-end; }
.intro.big { padding:0 4px; }
.intro.big p { text-align:center; }
.screen { padding-left:20px; padding-right:20px; }

/* 启动幕 */
#splash { position:absolute; inset:0; z-index:20; background:rgba(8,6,3,.55); display:flex; align-items:flex-end; justify-content:center; padding-bottom:calc(120px + env(safe-area-inset-bottom)); transition:opacity 1.2s; cursor:pointer; }
#splash.off { opacity:0; pointer-events:none; }
.splash-hint { color:var(--paper); font-size:15px; letter-spacing:.3em; text-shadow:0 1px 6px rgba(0,0,0,.9); animation:blink 2.2s infinite; }

.paper-body p, .subtitle, .echo, .wait-event, .postcard-text, #lb-text { text-wrap:wrap; }
.paper-body p { text-align:left; }

.paper-title { text-align:center; letter-spacing:.3em; font-size:17px; margin-bottom:12px; }
#card-credits { margin-top:10px; }

/* 深色画面上的输入框一律铺米色底,字用墨色(字条、去哪儿、探索、客人) */
#notebox, #tripbox, #exbox, #visbox { background:rgba(244,236,216,.94); border-radius:12px; padding:10px 14px; box-shadow:0 4px 14px rgba(0,0,0,.3); }
#notebox input, #tripbox input, #exbox input, #visbox input { color:var(--ink); font-size:17px; }
#notebox input::placeholder, #tripbox input::placeholder, #exbox input::placeholder, #visbox input::placeholder, #reply-input::placeholder, #ask-input::placeholder { color:rgba(60,58,46,.45); }

/* 文字块在居中的纵向 flex 里会收缩成内容宽 → 断行按错误的窄宽计算;统一撑满再限最大宽 */
.subtitle, .echo, .wait-event, .wait-paint, .wait-line, .clover-hint, .ask, .quote, .intro, .clip-title, .gal-title, .vis-knock { width:100%; max-width:400px; box-sizing:border-box; }
.wait-paint { max-width:400px; }

.wait-line, .wait-paint, .clover-hint, .clip-title, .gal-title { text-align:center; }

/* 旅途进度 + 状态 + 捎话 */
.journey { width:100%; max-width:400px; display:flex; align-items:center; gap:8px; color:var(--paper); font-size:13px; text-shadow:0 1px 6px rgba(0,0,0,.8); margin:8px 0 4px; }
.j-track { flex:1; position:relative; height:2px; background:rgba(244,236,216,.35); border-radius:1px; }
.j-track::before { content:""; position:absolute; left:0; right:0; top:0; border-top:2px dashed rgba(244,236,216,.25); }
.j-frog { position:absolute; top:-13px; left:0; font-style:normal; font-size:20px; transform:translateX(-50%); transition:left 1.2s ease; filter:drop-shadow(0 1px 3px rgba(0,0,0,.7)); }
.j-dest { max-width:42%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.wait-status { width:100%; max-width:400px; text-align:center; color:#f4ecd8; font-size:14.5px; letter-spacing:.04em; text-shadow:0 1px 6px rgba(0,0,0,.85); min-height:22px; }
#msgbox { margin:10px 0 6px; background:rgba(244,236,216,.94); border-radius:12px; padding:8px 12px; }
#msgbox input { color:var(--ink); font-size:16px; }
#notebox, #tripbox, #exbox, #visbox, #msgbox { width:100%; max-width:400px; }

/* 实时消息流 */
.wait-log { width:100%; max-width:400px; display:flex; flex-direction:column; gap:6px; margin:6px 0 4px; min-height:96px; }
.wait-log .m { display:flex; gap:8px; align-items:flex-start; background:rgba(244,236,216,.92); color:var(--ink); border-radius:12px 12px 12px 3px; padding:8px 12px; font-size:14.5px; line-height:1.6; box-shadow:0 3px 10px rgba(0,0,0,.3); animation:knock .4s ease-out; }
.wait-log .m time { flex:none; font-size:11px; color:rgba(60,58,46,.55); letter-spacing:.05em; padding-top:3px; font-variant-numeric:tabular-nums; }
.wait-log .m.me { background:rgba(91,107,58,.92); color:var(--paper); border-radius:12px 12px 3px 12px; align-self:flex-end; max-width:86%; }
.wait-log .m.me time { color:rgba(244,236,216,.6); }
.wait-line { font-size:13px; opacity:.7; }

/* 实时输入是主角:输入框放大,引导选项缩成两枚小药丸 */
.namebox.big { padding:14px 16px; }
.namebox.big input { font-size:19px; padding:10px 4px; }
#trip-suggest .opt, #ex-opts .opt { padding:8px 14px; font-size:14px; background:rgba(244,236,216,.75); }
#trip-suggest, #ex-opts { margin-top:6px; }
#trip-or { margin-top:14px; }

/* 实时标识:红点呼吸 + 计时文案放大 */
.live-badge { display:flex; align-items:center; gap:8px; color:#fff; font-size:13px; letter-spacing:.22em; background:rgba(180,50,40,.9); padding:5px 12px 5px 10px; border-radius:14px; box-shadow:0 3px 10px rgba(0,0,0,.35); margin-bottom:8px; }
.live-badge i { width:8px; height:8px; border-radius:50%; background:#fff; animation:pulse 1.2s infinite; }
@keyframes pulse { 0%,100%{opacity:1; transform:scale(1);} 50%{opacity:.35; transform:scale(.7);} }
.wait-timer { color:var(--paper); opacity:.95; font-size:14px; letter-spacing:.06em; margin:4px 0 8px; text-shadow:0 1px 6px rgba(0,0,0,.85); font-variant-numeric:tabular-nums; }
.live-tag { position:absolute; left:18px; bottom:calc(100% - 100% ); }
.live-tag { position:static; margin:8px 4px 0; font-size:11.5px; color:rgba(180,50,40,.9); letter-spacing:.08em; display:flex; align-items:center; gap:6px; }
.live-tag::before { content:""; width:6px; height:6px; border-radius:50%; background:rgba(180,50,40,.9); animation:pulse 1.2s infinite; }

/* 布置:即时贴纸 */
#homebox { width:100%; max-width:400px; }
.sticker { position:absolute; left:50%; top:46%; transform:translate(-50%,-50%) scale(.2); background:rgba(244,236,216,.96); color:var(--ink); border:2px dashed rgba(91,107,58,.6); border-radius:14px; padding:10px 16px; font-size:16px; box-shadow:0 8px 24px rgba(0,0,0,.4); z-index:4; animation:stick .6s cubic-bezier(.2,1.4,.4,1) forwards; pointer-events:none; }
@keyframes stick { to { transform:translate(-50%,-50%) rotate(-4deg) scale(1); } }

/* 信纸正文可滑动回看 */
.paper-body { touch-action:pan-y; overscroll-behavior:contain; }
.paper { touch-action:pan-y; }

/* 明信片整体上移,与「收下」拉开距离 */
#s-postcard .spacer, #s-note .spacer { flex:0.45; }
#s-postcard, #s-note { justify-content:flex-start; }
#s-postcard .postcard, #s-note .postcard { margin-bottom:26px; }
#postcard-next, #note-next { margin-top:0; margin-bottom:auto; }

/* 等待屏防溢出:消息区限高自滚,小事件不占固定高,整屏可滚兜底 */
.screen { overflow-y:auto; -webkit-overflow-scrolling:touch; }
.wait-log { max-height:150px; overflow-y:auto; min-height:0; flex:none; }
.wait-event { min-height:0; margin:8px 0 2px; font-size:15px; }
#s-wait .spacer { flex:0.35; }
#s-wait { justify-content:flex-end; }
.clover-hint { font-size:12px; margin-bottom:4px; }

/* 旧日记 */
#diary-btn { margin:4px 0 6px; opacity:.8; }
#diary { position:absolute; inset:0; z-index:7; background:rgba(10,8,4,.7); display:flex; align-items:center; justify-content:center; padding:28px; }
.diary-paper { max-height:60dvh; }
.diary-paper .paper-body { font-size:17px; line-height:2; min-height:0; text-align:center; }

/* 等待屏精简:四层 */
#s-wait .wait-line, #s-wait .wait-event, #s-wait .clover-hint, #s-wait .live-badge { display:none !important; }
.wait-timer { display:flex; align-items:center; justify-content:center; gap:8px; font-size:13.5px; opacity:.9; margin:6px 0 10px; }
.wait-timer::before { content:""; width:7px; height:7px; border-radius:50%; background:#e0523f; animation:pulse 1.2s infinite; }
.wait-log { min-height:60px; }
#diary-btn { margin:2px 0 4px; font-size:12.5px; }

.wait-log { max-height:200px; }
.journey { margin-bottom:10px; }

/* 提示气泡:改到顶部(避开底部按钮),换屏即收 */
#toast { top:calc(64px + env(safe-area-inset-top)); bottom:auto; transform:translateX(-50%) translateY(-10px); max-width:86%; }
#toast.on { transform:translateX(-50%); }

/* 图鉴大图:上一张/返回/下一张 + 左右滑 */
.lb-nav { display:flex; gap:10px; margin-top:16px; }
.lb-nav .btn { min-width:90px; }
#lightbox img, #lightbox video { width:min(84%,380px); }
#lb-text { font-size:14.5px; margin-top:12px; }

/* 明信片下的一行等待提示：影像还在路上，好了会单独播一幕。 */
.clip-pending { margin:10px 4px 0; padding-top:8px; border-top:1px dashed rgba(91,107,58,.35); font-size:12.5px; line-height:1.7; color:rgba(60,58,46,.75); display:flex; align-items:flex-start; gap:6px; }
.clip-pending::before { content:"▶"; font-size:10px; color:rgba(91,107,58,.85); padding-top:3px; animation:pulse 1.6s infinite; }

/* 提示气泡原来用 left:50% 定位，绝对定位元素的可用宽度因此只剩屏幕一半（约 195px），
   再长一点就被迫折行、末行常只剩一两个字。改成左右为 0 加自动外边距居中，可用整屏宽。 */
#toast { left:0; right:0; margin:0 auto; width:fit-content; transform:translateY(-10px); }
#toast.on { transform:none; }

/* 影像一幕的标题原来是浅色字压在亮画面上，看不清：改成深底药丸，任何画面上都读得出来。 */
.clip-title { background:rgba(20,16,8,.72); color:#f4ecd8; padding:8px 18px; border-radius:18px; width:auto !important; max-width:86% !important;
  align-self:center; font-size:15px; letter-spacing:.1em; text-shadow:none; box-shadow:0 4px 14px rgba(0,0,0,.35); display:flex; align-items:center; gap:8px; }
.clip-title::before { content:"▶"; font-size:11px; color:#e0c56a; }
/* 明信片下方"还有一段影像在路上"原来太轻，玩家看不见：给一条浅色带 + 呼吸的红点，字号加大。 */
.clip-pending { margin:12px 2px 0; padding:9px 12px; border-top:0; background:rgba(224,197,106,.16); border:1px solid rgba(180,140,50,.35); border-radius:10px;
  font-size:13.5px; line-height:1.65; color:#5a4a22; display:flex; align-items:flex-start; gap:8px; }
.clip-pending::before { content:""; flex:none; width:8px; height:8px; margin-top:6px; border-radius:50%; background:#e0523f; animation:pulse 1.2s infinite; }

/* 影像来信独立于剧情页面；未观看前不随 toast 消失。 */
#video-notice { position:absolute; z-index:7; top:calc(8px + env(safe-area-inset-top)); left:12px; right:60px; min-height:44px; padding:8px 12px; display:flex; align-items:center; gap:8px; text-align:left; font:inherit; color:var(--ink); background:rgba(244,236,216,.97); border:1px solid rgba(91,107,58,.4); border-radius:16px; box-shadow:0 4px 16px rgba(20,16,8,.24); cursor:pointer; animation:video-letter-in .4s ease-out; }
#video-notice strong, #video-notice small { display:block; }
#video-notice strong { font-size:14px; line-height:20px; font-weight:600; }
#video-notice small { font-size:12px; line-height:16px; color:var(--olive); }
.video-notice-icon { flex:none; width:28px; height:28px; display:grid; place-items:center; border-radius:50%; background:var(--olive); color:var(--paper); font-size:12px; }
#video-notice:active { transform:scale(.98); }
#video-notice:focus-visible, #video-inbox button:focus-visible { outline:2px solid var(--accent); outline-offset:4px; }
@keyframes video-letter-in { from { opacity:0; transform:translateY(-12px); } to { opacity:1; transform:none; } }
#video-inbox { position:absolute; inset:0; z-index:20; padding:calc(16px + env(safe-area-inset-top)) 20px calc(16px + env(safe-area-inset-bottom)); background:rgba(20,18,12,.98); color:var(--paper); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; overflow-y:auto; }
#video-inbox h2 { flex:none; margin:0; font-size:18px; line-height:28px; font-weight:500; }
#video-inbox-player { display:block; width:100%; min-height:0; max-height:calc(100% - 180px); aspect-ratio:3/4; object-fit:contain; background:#000; border:4px solid var(--paper); border-radius:8px; }
#video-inbox-status { flex:none; margin:0; min-height:20px; font-size:13px; line-height:20px; text-align:center; }
#video-inbox button { flex:none; margin:0; min-height:44px; }
@media (prefers-reduced-motion: reduce) { #video-notice { animation:none; } }

/* A persistent locale control sits outside story screens and never advances them. */
/* Cream paper label and olive ink, clear above both bright and dark scenes. */
.language-switch{position:absolute;top:calc(8px + env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));z-index:7;display:flex;gap:4px;border:1px solid #8b9470;border-radius:12px;background:var(--paper);box-shadow:0 4px 12px #30281833}
.language-switch button{display:grid;place-items:center;min-width:52px;min-height:44px;padding:8px 12px;border:0;border-radius:10px;font-family:inherit;font-size:13px;font-weight:600;line-height:20px;letter-spacing:.04em;background:transparent;color:var(--ink);cursor:pointer;transition:background .18s,color .18s,box-shadow .18s}
.language-switch button[aria-pressed=true]{background:var(--olive);color:var(--paper);box-shadow:inset 0 -3px 0 #354422}
.language-switch button:not([aria-pressed=true]):hover{background:#e5dfc9;color:#354422}
.language-switch button:focus-visible{outline:3px solid #a84b22;outline-offset:3px}
@media(prefers-reduced-motion:reduce){.language-switch button{transition:none}}
html[lang=en] .subtitle,html[lang=en] .echo,html[lang=en] .paper-body{word-break:normal;overflow-wrap:break-word;letter-spacing:0}
html[lang=en] .opt{line-height:1.5;white-space:normal}
html[lang=en] .btn{height:auto;min-height:44px;line-height:1.4;white-space:normal}

/* Choosing a language is available before the first audio-unlock gesture.
   Settings and the video inbox keep their normal overlay order afterward. */
#stage:has(#splash:not(.off)) > .language-switch {z-index: 21;}
