/* 夜晚悬疑 + 青少年读物感。字体只用系统字体栈（离线）。 */
:root {
  --ink: #0b1020; --panel: rgba(13, 18, 38, .93); --panel-line: rgba(255, 255, 255, .14);
  --text: #f6f1e4; --muted: #b4bad2; --gold: #e8b84f; --gold-deep: #b98a22;
  --paper: #fbf6ea; --paper-ink: #2a2438; --good: #2f8f5b; --bad: #b8433a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "Noto Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --dlg-h: 200px;
  /* 刘海/底部横条留边（没有刘海的设备都是 0，电脑端不变）；自测改这四个变量来模拟刘海 */
  --sat: env(safe-area-inset-top, 0px); --sar: env(safe-area-inset-right, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--text); font-family: var(--sans); }
#app { position: fixed; inset: 0; overflow: hidden; overflow: clip; }   /* clip：连 scrollIntoView/focus 这类程序滚动也不许把整页顶歪 */
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

.screen { position: absolute; inset: 0; display: none; }
.screen.active { display: block; }
.bg-layer { position: absolute; inset: 0; background-size: cover; background-position: center; }

/* ---------- 按钮 ---------- */
.btn { min-height: 46px; padding: 0 26px; border-radius: 999px; border: 1px solid transparent; font-size: 16px; font-weight: 600; letter-spacing: .02em; transition: transform .15s, background .2s, box-shadow .2s; }
.btn-primary { background: var(--gold); color: #241a05; box-shadow: 0 6px 20px rgba(232, 184, 79, .3); }
.btn-primary:hover:not(:disabled) { background: #f3c866; transform: translateY(-1px); }
.btn-primary:disabled { background: #5b5a64; color: #b9b8c0; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .3); }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.quiz-card .btn-ghost { border-color: #c9bfa6; color: var(--paper-ink); }
.quiz-card .btn-ghost:hover { background: #efe7d3; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; background: rgba(10, 14, 30, .62); border: 1px solid var(--panel-line); font-size: 14px; backdrop-filter: blur(6px); }
.chip:hover { background: rgba(10, 14, 30, .85); }
.chip-light { background: #efe7d3; color: var(--paper-ink); border-color: #cfc4a8; }
.chip-light:hover { background: #e6dcc2; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 13px; padding: 8px; }

/* ---------- 标题页 ---------- */
.title-bg { background: linear-gradient(180deg, #070b1c 0%, #1a2446 60%, #3a2f56 100%); }
.title-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 35%, rgba(232, 184, 79, .18), transparent 55%), linear-gradient(180deg, rgba(7, 11, 28, .35), rgba(7, 11, 28, .85)); }
.title-wrap { position: relative; z-index: 2; height: 100%; max-width: 760px; margin: 0 auto; padding: 6vh 24px 2vh; display: flex; flex-direction: column; align-items: center; text-align: center; overflow-y: auto; }
.eyebrow { margin: 0 0 8px; color: var(--gold); letter-spacing: .22em; font-size: 12px; text-transform: uppercase; }
.title-wrap h1 { margin: 4px 0 0; font-family: var(--serif); font-size: clamp(40px, 8vw, 76px); font-weight: 700; letter-spacing: .08em; text-shadow: 0 4px 30px rgba(0, 0, 0, .6); }
.subtitle { margin: 6px 0 18px; font-family: var(--serif); font-style: italic; font-size: clamp(18px, 3vw, 26px); color: #f1dfb0; }
.tagline { max-width: 520px; margin: 0 0 24px; color: var(--muted); line-height: 1.75; font-size: 15px; }
.title-actions { margin-bottom: 26px; }
.chapter-list { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 10px; }
.chapter-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 18px; text-align: left; border-radius: 14px; background: rgba(15, 21, 44, .72); border: 1px solid var(--panel-line); min-height: 64px; transition: background .2s, border-color .2s; backdrop-filter: blur(6px); }
.chapter-item:not(:disabled):hover { background: rgba(32, 42, 82, .85); border-color: rgba(232, 184, 79, .55); }
.chapter-item:disabled { opacity: .55; cursor: not-allowed; }
.chapter-no { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(232, 184, 79, .16); color: var(--gold); font-weight: 700; font-family: var(--serif); }
.chapter-meta { flex: 1; min-width: 0; }
.chapter-meta b { display: block; font-family: var(--serif); font-size: 18px; font-weight: 600; }
.chapter-meta span { color: var(--muted); font-size: 13px; }
.chapter-state { flex: none; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chapter-state.passed { color: #8fd8ae; }
.chapter-state svg { width: 16px; height: 16px; }
.title-foot { margin-top: auto; padding-top: 18px; }
.music-credit { margin: 0; padding: 0 0 6px; font-size: 11px; color: var(--muted); opacity: .6; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 380px) { .music-credit { font-size: 10px; } }

/* ---------- 游戏页 ---------- */
.scene-bg { transition: opacity .6s; animation: drift 50s ease-in-out infinite alternate; transform-origin: 50% 40%; }
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.09) translateX(-1%); } }
.scene-shade { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 40%, transparent 45%, rgba(0, 0, 0, .45) 100%), linear-gradient(180deg, rgba(0, 0, 0, .25) 0%, transparent 22%, transparent 55%, rgba(5, 8, 20, .55) 100%); }
.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 12; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.chapter-name { font-family: var(--serif); font-size: 15px; color: #f1e8cf; text-shadow: 0 1px 8px rgba(0, 0, 0, .8); text-align: center; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; gap: 8px; }
.hint { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); z-index: 12; font-size: 13px; padding: 7px 16px; border-radius: 999px; background: rgba(10, 14, 30, .66); color: #e9e2cc; border: 1px solid var(--panel-line); transition: opacity .8s; white-space: nowrap; max-width: 94vw; overflow: hidden; text-overflow: ellipsis; }
.hint.off { opacity: 0; pointer-events: none; }

.sprites { position: absolute; left: 0; right: 0; top: 0; bottom: calc(var(--dlg-h) - 34px); z-index: 5; pointer-events: none; }
.sprite { position: absolute; bottom: 0; max-height: calc(100% - 70px); width: auto; max-width: 34vw; object-fit: contain; opacity: 0; transform: translateY(10px); transition: opacity .35s, transform .35s, filter .35s; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .55)); }
.sprite { -webkit-mask-image: linear-gradient(#000 82%, transparent 100%); mask-image: linear-gradient(#000 82%, transparent 100%); }
.sprite.left { left: 5vw; }
.sprite.right { right: 5vw; }
.sprite.show { opacity: 1; transform: none; }
.sprite.dim { opacity: .92; filter: brightness(.42) saturate(.6) drop-shadow(0 8px 18px rgba(0, 0, 0, .55)); transform: none; }

.dialog { max-height: calc(100vh - 28px); position: absolute; z-index: 10; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(980px, calc(100% - 32px)); min-height: 150px; padding: 30px 28px 24px; border-radius: 20px; background: var(--panel); border: 1px solid var(--panel-line); box-shadow: 0 18px 50px rgba(0, 0, 0, .55); backdrop-filter: blur(10px); }
.speaker { position: absolute; top: -17px; left: 24px; min-width: 80px; padding: 6px 18px; border-radius: 10px; font-weight: 700; font-size: 15px; letter-spacing: .06em; background: var(--gold); color: #241a05; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }
.speaker.THEO { background: #f2b84b; }
.speaker.CRANE { background: #9bbbe0; color: #10223c; }
.speaker.SAM { background: #7ed6c4; color: #08302a; }
.speaker.NARRATION { display: none; }
.dlg-body { max-height: calc(100vh - 140px); overflow-y: auto; font-family: var(--serif); font-size: clamp(18px, 2.2vw, 23px); line-height: 1.7; min-height: 3.4em; padding-right: 88px; padding-bottom: 34px; cursor: pointer; }
.dlg-body.narration { font-style: italic; color: #dcd7e8; }
.dlg-text { white-space: pre-wrap; user-select: text; -webkit-user-select: text; cursor: text; }
.tr-btn { position: absolute; right: 16px; top: 14px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--panel-line); background: rgba(255, 255, 255, .06); font-family: var(--sans); font-size: 14px; }
.tr-btn:hover { background: rgba(232, 184, 79, .25); }
.next-btn { position: absolute; right: 16px; bottom: 10px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(232, 184, 79, .55); background: rgba(232, 184, 79, .14); color: var(--gold); font-size: 14px; font-weight: 600; }
.next-btn:hover { background: rgba(232, 184, 79, .3); }
.dialog.choosing > .dlg-body, .dialog.choosing > .tr-btn, .dialog.choosing > .spk, .dialog.choosing > .next-btn { display: none; }
.choices { display: none; gap: 10px; flex-direction: column; max-height: calc(100vh - 110px); overflow-y: auto; overflow-x: hidden; }
.dialog.choosing .choices { display: flex; }
.choice-hint { margin: 0 0 2px; font-size: 13px; color: var(--muted); }
.choice { position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 52px 10px 16px; text-align: left; border-radius: 14px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(232, 184, 79, .45); font-family: var(--serif); font-size: clamp(17px, 2vw, 21px); line-height: 1.45; cursor: pointer; transition: background .15s, border-color .15s; }
.choice:hover { background: rgba(232, 184, 79, .2); border-color: rgba(243, 200, 102, .95); }
.choice .num { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font: 700 15px var(--sans); background: var(--gold); color: #241a05; border: 0; }
.choice .num:hover { background: #f3c866; }
.choice .ctext { flex: 0 1 auto; user-select: text; -webkit-user-select: text; cursor: text; }
.choice .tr-btn { top: 8px; right: 8px; width: 34px; height: 34px; }
.end-card { position: absolute; z-index: 11; left: 50%; bottom: 50%; transform: translate(-50%, 50%); text-align: center; padding: 26px 34px; border-radius: 20px; background: var(--panel); border: 1px solid var(--panel-line); box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.end-card p { margin: 0 0 14px; font-family: var(--serif); font-size: 22px; }

/* ---------- 回看 ---------- */
.history { position: absolute; z-index: 30; top: 0; right: 0; bottom: 0; width: min(440px, 100%); display: flex; flex-direction: column; background: rgba(11, 16, 34, .97); border-left: 1px solid var(--panel-line); box-shadow: -12px 0 40px rgba(0, 0, 0, .5); }
.history-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--panel-line); }
.history-list { flex: 1; overflow-y: auto; padding: 14px 18px 24px; }
.h-item { margin-bottom: 14px; font-family: var(--serif); font-size: 17px; line-height: 1.6; }
.h-item .h-who { display: block; font: 700 12px var(--sans); letter-spacing: .08em; color: var(--gold); margin-bottom: 2px; }
.h-item.NARRATION .h-text { font-style: italic; color: #cfcbe0; }
.h-text { user-select: text; -webkit-user-select: text; }

/* ---------- 浮层（查词 / 句子讲解） ---------- */
.pop { overflow-y: auto; overscroll-behavior: contain; position: fixed; z-index: 60; width: max-content; max-width: min(360px, calc(100vw - 16px)); padding: 12px 16px 13px; border-radius: 14px; background: var(--paper); color: var(--paper-ink); border: 1px solid #d8cdb0; box-shadow: 0 12px 34px rgba(0, 0, 0, .5); font-family: var(--sans); line-height: 1.55; animation: popin .14s ease-out; }
@keyframes popin { from { opacity: 0; transform: translateY(4px) scale(.97); } }
.pop::after { content: ""; position: absolute; left: var(--ax, 50%); width: 12px; height: 12px; margin-left: -6px; background: var(--paper); border: 1px solid #d8cdb0; transform: rotate(45deg); }
.pop.above::after { bottom: -7px; border-top: 0; border-left: 0; }
.pop.below::after { top: -7px; border-bottom: 0; border-right: 0; }
.pop .p-word { font-family: var(--serif); font-size: 20px; font-weight: 700; color: #3a2a70; }
.pop .p-ipa { margin-left: 8px; font-size: 14px; color: #6b6585; }
.pop .p-pos { display: inline-block; margin: 4px 8px 0 0; padding: 0 7px; border-radius: 6px; background: #eadfbd; font-size: 12px; font-weight: 700; color: #6a4f0b; }
.pop .p-zh { margin-top: 2px; font-size: 16px; font-weight: 600; }
.pop .p-form { margin-top: 4px; font-size: 13px; color: #6b6585; }
.pop .p-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: #8a6a14; margin-top: 8px; }
.pop .p-s-next { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #d8cdb0; }
.pop .p-en { font-family: var(--serif); font-style: italic; font-size: 14px; color: #6b6585; }
.pop .p-sel { font-family: var(--serif); font-style: italic; font-size: 14px; color: #6b6585; padding-bottom: 6px; border-bottom: 1px dashed #d8cdb0; margin-bottom: 6px; }
.pop .p-zhs { font-size: 16px; font-weight: 600; }
.pop .p-note { font-size: 14.5px; margin-top: 2px; }
.pop-sent { max-width: min(420px, calc(100vw - 16px)); }

/* ---------- 测验页 ---------- */
.quiz-bg { background: linear-gradient(180deg, #0c1230, #1b2547 70%, #2a2a50); }
.quiz-scroll { position: absolute; inset: 0; overflow-y: auto; padding: 4vh 16px 6vh; }
.quiz-card { max-width: 820px; margin: 0 auto; padding: 28px 30px 32px; border-radius: 22px; background: var(--paper); color: var(--paper-ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.quiz-card .eyebrow { color: #8a6a14; }
.quiz-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.quiz-head .chip { white-space: nowrap; flex: none; }
.quiz-head h2 { margin: 0; font-family: var(--serif); font-size: 30px; }
.quiz-rule { margin: 4px 0 0; color: #5d5877; font-size: 14px; }
.q { padding: 18px 0; border-top: 1px solid #e2d8bd; }
.q-stem { font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.5; margin: 0 0 10px; }
.q-stem .qn { color: #8a6a14; margin-right: 6px; }
.q-opts { display: grid; gap: 8px; }
.q-opt { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 8px 14px; border-radius: 12px; border: 1.5px solid #d8cdb0; background: #fffdf6; font-family: var(--serif); font-size: 18px; text-align: left; cursor: pointer; transition: background .15s, border-color .15s; }
.q-opt:hover { background: #f6ecd0; }
.q-opt .ltr { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 700 14px var(--sans); background: #eadfbd; color: #6a4f0b; border: 0; cursor: pointer; }
.q-opt.selected { border-color: #3a2a70; background: #ece7fb; }
.q-opt.selected .ltr { background: #3a2a70; color: #fff; }
.q-opt .otext { user-select: text; -webkit-user-select: text; flex: 0 1 auto; cursor: text; }
.q-opt .mark { flex: none; margin-left: auto; font: 700 13px var(--sans); }
.q-tr { position: static; margin-left: 8px; width: 30px; height: 30px; flex: none; color: #3a2a70; border-color: #cfc4a8; vertical-align: middle; }
.q-opt.correct { border-color: var(--good); background: #e4f4ea; }
.q-opt.wrong { border-color: var(--bad); background: #fbe7e4; }
.q-opt.correct .mark { color: var(--good); }
.q-opt.wrong .mark { color: var(--bad); }
.locked .q-opt { cursor: default; }
.q-why { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: #f4ecd6; font-size: 15px; line-height: 1.65; }
.q-why .zh-stem { color: #5d5877; font-size: 14px; }
.quiz-result { margin: 8px 0 4px; padding: 18px 20px; border-radius: 16px; text-align: center; font-size: 17px; }
.quiz-result.pass { background: #e4f4ea; color: #1d5b3a; }
.quiz-result.fail { background: #fbe7e4; color: #7e2b25; }
.quiz-result b { display: block; font-family: var(--serif); font-size: 40px; line-height: 1.2; }
.quiz-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

/* ---------- 转场 ---------- */
.fade { position: absolute; inset: 0; z-index: 90; background: #04060f; opacity: 0; pointer-events: none; transition: opacity .45s ease; }
.fade.on { opacity: 1; pointer-events: all; }

/* ---------- 窄屏 ---------- */
@media (max-width: 720px) {
  .dialog { bottom: 10px; padding: 26px 16px 18px; width: calc(100% - 16px); }
  .speaker { left: 14px; }
  .sprite { max-width: 46vw; }
  .sprite.left { left: 0; } .sprite.right { right: 0; }
  .hint { top: 54px; font-size: 12px; }
  .chapter-name { font-size: 13px; }
  .quiz-card { padding: 20px 16px 24px; }
  .quiz-head { flex-direction: column; }
  .q-stem { font-size: 18px; } .q-opt { font-size: 16px; }
  .title-wrap h1 { letter-spacing: .03em; }
}
@media (prefers-reduced-motion: reduce) {
  .scene-bg { animation: none; }
  * { transition-duration: .01s !important; }
}

/* 点了选项/测验选项的文字：让编号（字母）按钮脉冲一下，提醒「点这里选」 */
@keyframes pulse { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(232, 184, 79, .85); } 40% { transform: scale(1.3); box-shadow: 0 0 0 10px rgba(232, 184, 79, .25); } 100% { transform: scale(1); box-shadow: 0 0 0 16px rgba(232, 184, 79, 0); } }
.pulse { animation: pulse .7s ease-out 1; }

/* ---------- 音乐音量滑条 ---------- */
.vol-range { -webkit-appearance: none; appearance: none; width: 130px; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .28); outline-offset: 6px; cursor: pointer; vertical-align: middle; }
.vol-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--gold); border: 2px solid #241a05; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.vol-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--gold); border: 2px solid #241a05; }
.vol-range:disabled { opacity: .35; cursor: not-allowed; }
.vol-range:disabled::-webkit-slider-thumb { background: #8a8a94; }
.vol-val { display: inline-block; min-width: 3em; text-align: right; font-size: 13px; color: var(--muted); }
.vol-inline { display: inline-flex; align-items: center; gap: 8px; margin: 0 6px; font-size: 13px; color: var(--muted); }
.vol-inline.off, .vol-wrap.off .vol-panel { opacity: .6; }
.title-foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; }
.title-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.vol-wrap { position: relative; display: inline-block; }
.vol-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--panel-line); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); white-space: nowrap; font-size: 13px; color: var(--text); }
.vol-panel .vol-range { width: 120px; }

/* ---------- 生词：浮层按钮 ---------- */
.pop .p-vocab { margin-top: 8px; }
.pop .p-add { min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1.5px solid #3a2a70; background: transparent; color: #3a2a70; font: 700 14px var(--sans); }
.pop .p-add:hover { background: #ece7fb; }
.pop .p-add.on { background: #3a2a70; color: #fff; }

/* ---------- 生词表面板（沿用米白纸面卡片） ---------- */
.btn-sm { min-height: 38px; padding: 0 16px; font-size: 14px; }
.btn-danger { background: var(--bad); color: #fff; }
.vocab { position: absolute; inset: 0; z-index: 40; overflow-y: auto; padding: 4vh 16px 6vh; background: rgba(4, 6, 15, .82); }
.vocab-card { max-width: 760px; margin: 0 auto; padding: 24px 26px 28px; border-radius: 22px; background: var(--paper); color: var(--paper-ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.vocab-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.vocab-head h2 { margin: 0; font-family: var(--serif); font-size: 28px; }
.vocab-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 6px; }
.vocab-card .btn-ghost { border-color: #c9bfa6; color: var(--paper-ink); }
.vocab-card .btn-ghost:hover:not(:disabled) { background: #efe7d3; }
.vocab-card .btn:disabled { opacity: .45; cursor: not-allowed; }
.vocab-ask { font-size: 14px; color: var(--bad); font-weight: 600; }
.v-empty { margin: 26px 4px; color: #5d5877; line-height: 1.8; font-size: 15px; }
.v-item { padding: 14px 0; border-top: 1px solid #e2d8bd; }
.v-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.v-word { font-family: var(--serif); font-size: 22px; font-weight: 700; color: #3a2a70; }
.v-ipa { font-size: 14px; color: #6b6585; }
.v-form { font-size: 12px; color: #8a6a14; }
.v-del { margin-left: auto; min-height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid #d8cdb0; background: #fffdf6; color: #7e2b25; font-size: 13px; }
.v-del:hover { background: #fbe7e4; }
.v-mean { margin-top: 2px; }
.v-pos { display: inline-block; margin-right: 8px; padding: 0 7px; border-radius: 6px; background: #eadfbd; font-size: 12px; font-weight: 700; color: #6a4f0b; }
.v-zh { font-size: 16px; font-weight: 600; }
.v-sent { margin-top: 6px; font-family: var(--serif); font-style: italic; font-size: 16px; line-height: 1.55; }
.v-sent mark { background: #f6df9a; color: inherit; border-radius: 3px; padding: 0 2px; font-style: normal; font-weight: 700; }
.v-sentzh { font-size: 14px; color: #5d5877; }
.v-src { margin-top: 2px; font-size: 12px; color: #8a8499; }

@media (max-width: 720px) {
  .topbar { padding: 10px 8px; gap: 6px; }
  .topbar .chip { padding: 0 9px; font-size: 13px; min-height: 34px; }
  .topbar-right { gap: 5px; }
}
@media (max-width: 520px) { .chapter-name { display: none; } .topbar { justify-content: space-between; } .vocab-card { padding: 18px 14px 22px; } .vol-range { width: 100px; } }

/* ---------- 语音朗读：小喇叭 + 声音面板里的语音开关 ---------- */
.spk { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--panel-line); background: rgba(255, 255, 255, .06); color: var(--gold); display: inline-grid; place-items: center; padding: 0; cursor: pointer; }
.spk svg { width: 20px; height: 20px; }
.spk:hover:not(:disabled) { background: rgba(232, 184, 79, .25); }
.spk:disabled { opacity: .35; cursor: not-allowed; }
.spk[hidden] { display: none; }
.dialog > .spk { position: absolute; right: 60px; top: 14px; }
.h-who .spk-hist { width: 28px; height: 28px; margin-left: 8px; vertical-align: middle; }
.h-who .spk-hist svg { width: 16px; height: 16px; }
.pop .p-spk { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; }
.pop .spk-pop { width: 32px; height: 32px; border: 1.5px solid #3a2a70; background: transparent; color: #3a2a70; }
.pop .spk-pop:hover:not(:disabled) { background: #ece7fb; }
.pop .p-spk-t { font-size: 12px; color: #6b6585; }
.vol-panel { flex-direction: column; align-items: stretch; gap: 10px; }
.vol-panel .vol-row { display: flex; align-items: center; gap: 10px; }
.vol-panel .vol-row > span:first-child { flex: 1; }
.vol-panel .chip:disabled { opacity: .4; cursor: not-allowed; }


/* =====================================================================
   手机适配（触屏）。原则：电脑端（鼠标）的外观和行为不变；尺寸类调整只在 (pointer: coarse) / 窄屏 / 短屏下生效。
   ===================================================================== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
/* 禁掉双击放大（轻点立刻响应），但不禁用户双指缩放 */
* { touch-action: manipulation; }
.vol-range { touch-action: pan-y; }
.safe-probe { position: fixed; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none; padding: var(--sat) var(--sar) var(--sab) var(--sal); }

/* 手机地址栏伸缩：用 dvh，不支持的浏览器保持原来的 vh/inset */
@supports (height: 100dvh) {
  #app { height: 100dvh; bottom: auto; }
}

/* 刘海 / 底部横条 */
.topbar { padding-top: calc(12px + var(--sat)); padding-left: calc(16px + var(--sal)); padding-right: calc(16px + var(--sar)); }
.hint { top: calc(58px + var(--sat)); }
.sprites { bottom: calc(var(--dlg-h) - 34px + var(--sab)); }
.dialog { bottom: calc(20px + var(--sab)); left: calc(50% + (var(--sal) - var(--sar)) / 2); width: min(980px, calc(100% - 32px - var(--sal) - var(--sar))); max-height: calc(100vh - 28px - var(--sat) - var(--sab)); }
.dlg-body { max-height: calc(100vh - 140px - var(--sat) - var(--sab)); }
.choices { max-height: calc(100vh - 110px - var(--sat) - var(--sab)); }
@supports (height: 100dvh) {
  .dialog { max-height: calc(100dvh - 28px - var(--sat) - var(--sab)); }
  .dlg-body { max-height: calc(100dvh - 140px - var(--sat) - var(--sab)); }
  .choices { max-height: calc(100dvh - 110px - var(--sat) - var(--sab)); }
}
.title-wrap { padding-top: calc(6vh + var(--sat)); padding-bottom: calc(2vh + var(--sab)); padding-left: calc(24px + var(--sal)); padding-right: calc(24px + var(--sar)); }
.quiz-scroll, .vocab { padding-top: calc(4vh + var(--sat)); padding-bottom: calc(6vh + var(--sab)); padding-left: calc(16px + var(--sal)); padding-right: calc(16px + var(--sar)); }
.history { padding-top: var(--sat); padding-bottom: var(--sab); padding-right: var(--sar); }
.end-card { max-width: calc(100% - 24px); }

@media (max-width: 720px) {
  .topbar { padding: calc(10px + var(--sat)) calc(8px + var(--sar)) 10px calc(8px + var(--sal)); }
  .dialog { bottom: calc(10px + var(--sab)); width: calc(100% - 16px - var(--sal) - var(--sar)); }
  .hint { top: calc(54px + var(--sat)); }
}

/* 竖屏手机：横版背景图 cover 裁成竖条，--bg-pos 决定留哪一块（默认偏右上，避开被对话框盖住的下半截） */
@media (max-aspect-ratio: 4/5) {
  #app { --bg-pos: 62% 30%; }
  .sprite { max-width: 44vw; }
}

html[data-input="touch"] .h-m { display: none; }
html:not([data-input="touch"]) .h-t { display: none; }

/* 触屏：点击区域 ≥44×44，且彼此不重叠 */
@media (pointer: coarse) {
  .chip, .topbar .chip { min-height: 44px; min-width: 44px; }
  .btn-sm { min-height: 44px; }
  .link-btn { min-height: 44px; padding: 0 12px; }
  .hint { white-space: normal; text-align: center; border-radius: 16px; width: max-content; max-width: calc(100% - 24px); line-height: 1.5; }

  /* 对话框：按钮排在底部一行（喇叭、译、下一句），文字用满整行宽度 */
  .dlg-body { padding-right: 0; padding-bottom: 58px; }
  .dialog > .tr-btn, .tr-btn { width: 44px; height: 44px; }
  .dialog > .tr-btn { top: auto; bottom: 10px; right: 120px; }
  .dialog > .spk { top: auto; bottom: 10px; right: 172px; width: 44px; height: 44px; }
  .next-btn { min-height: 44px; min-width: 100px; right: 12px; bottom: 10px; }

  .choice { padding: 6px 60px 6px 8px; min-height: 56px; }
  .choice .num { width: 44px; height: 44px; font-size: 17px; }
  .choice .tr-btn { top: 6px; right: 6px; width: 44px; height: 44px; }
  .q-opt { padding: 6px 10px 6px 8px; min-height: 56px; }
  .q-opt .ltr { width: 44px; height: 44px; font-size: 16px; }
  .q-tr { width: 44px; height: 44px; margin-left: 4px; }
  .quiz-head .chip { align-self: flex-start; }

  .pop .p-add { min-height: 44px; padding: 0 18px; }
  .pop .spk-pop { width: 44px; height: 44px; }
  .h-who .spk-hist { width: 44px; height: 44px; margin-left: 4px; }
  .v-del { min-height: 44px; min-width: 56px; }

  /* 滑条：命中区 44px 高，细轨道画在里面 */
  .vol-range { height: 44px; background: transparent; width: 150px; }
  .vol-range::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .28); }
  .vol-range::-moz-range-track { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .28); }
  .vol-range::-webkit-slider-thumb { margin-top: -7px; width: 22px; height: 22px; }
  .vol-panel .vol-range { width: 130px; }
  .vol-panel .vol-row { min-height: 44px; }

  /* 悬停样式在触屏上会「粘住」：点完一直亮着，去掉 */
  .choice:hover { background: rgba(255, 255, 255, .07); border-color: rgba(232, 184, 79, .45); }
  .q-opt:hover { background: #fffdf6; }
  .q-opt.selected:hover { background: #ece7fb; }
  .btn-primary:hover:not(:disabled) { background: var(--gold); transform: none; }
  .chip:hover { background: rgba(10, 14, 30, .62); }
  .chip-light:hover { background: #efe7d3; }
}

/* 窄屏：音量面板脱离顶栏按钮，固定在顶栏下方、不会被挤出屏幕左边 */
@media (max-width: 520px) {
  .vol-wrap { position: static; }
  .vol-panel { position: fixed; top: calc(var(--sat) + 60px); right: calc(8px + var(--sar)); left: auto; max-width: calc(100vw - 16px - var(--sal) - var(--sar)); }
  .topbar .chip { padding: 0 7px; }
}
@media (max-width: 380px) { .topbar { gap: 4px; } .topbar-right { gap: 3px; } .topbar .chip { padding: 0 6px; font-size: 12.5px; } }

/* 横屏手机（矮屏）：压缩留白，让对话框、选项、立绘都装得下 */
@media (max-height: 480px) and (orientation: landscape) {
  .dialog { min-height: 0; padding: 24px 18px 12px; }
  .dlg-body { font-size: 17px; line-height: 1.55; min-height: 2.6em; }
  .choice { min-height: 48px; font-size: 16px; }
  .quiz-scroll, .vocab { padding-top: calc(10px + var(--sat)); padding-bottom: calc(14px + var(--sab)); }
  .title-wrap { padding-top: calc(10px + var(--sat)); }
  .title-wrap h1 { font-size: 34px; }
  .tagline { margin-bottom: 14px; }
  .hint { display: none; }
}


/* ---------- 留邮箱（最后一关结算页，仅 http/https） ---------- */
.notify { margin: 22px 0 6px; padding: 18px 20px 14px; border-radius: 16px; background: #f4ecd6; border: 1px solid #e2d8bd; }
.notify h3 { margin: 0 0 4px; font-family: var(--serif); font-size: 21px; }
.notify p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.6; color: #5d5877; }
.notify-form { display: flex; flex-wrap: wrap; gap: 10px; }
.notify-form input { flex: 1 1 200px; min-width: 0; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1.5px solid #cfc4a8; background: #fffdf6; color: var(--paper-ink); font: 16px var(--sans); }   /* 16px：iOS 聚焦时小于 16px 会自动放大整页 */
.notify-form input:focus { outline: 3px solid var(--gold); outline-offset: 1px; border-color: #3a2a70; }
.notify-form .btn { flex: none; }
.notify-msg { margin: 8px 0 0; min-height: 1.5em; font-size: 14px; color: var(--bad); }
.notify-done { margin: 0; font-weight: 600; color: #1d5b3a; font-size: 16px; }
/* 软键盘弹出时底部多留一屏，输入框和按钮才有地方滚上来；首次聚焦后一直保留到离开测验页（中途收回会让按钮在手指下移位） */
.quiz-scroll.kb { padding-bottom: calc(60vh + var(--sab)); }
