:root {
  --paper: #f5efe0;
  --paper-deep: #ece2cc;
  --ink: #2b2117;
  --ink-soft: #6b5d4a;
  --accent: #8a5a2b;
  --accent-deep: #6e4114;
  --highlight: #fff3c4;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--paper); color: var(--ink); }
body { font-family: Georgia, "Times New Roman", serif; }

#app { max-width: 680px; margin: 0 auto; padding: 0 0 90px; }
.loading { text-align: center; padding: 40vh 0; color: var(--ink-soft); font-family: system-ui, sans-serif; }

/* ---- 封面 ---- */
.cover { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.cover img { width: min(78vw, 420px); border-radius: 10px; box-shadow: 0 10px 40px #0003; border: 6px solid #fff; }
.cover h1 { font-size: 30px; margin: 26px 0 2px; letter-spacing: .5px; }
.cover .zh { font-size: 17px; color: var(--ink-soft); margin: 4px 0 2px; }
.cover .byline { font-size: 13px; color: var(--ink-soft); font-style: italic; margin-bottom: 30px; }
.cover button { font-family: inherit; font-size: 17px; background: var(--accent); color: #fff; border: 0; border-radius: 30px; padding: 13px 44px; cursor: pointer; box-shadow: 0 4px 14px #8a5a2b55; }
.cover button:active { transform: translateY(1px); }
.cover .resume-hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 12px; font-family: system-ui, sans-serif; }

/* ---- 场景页 ---- */
header.bar { position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--paper) 82%, transparent); padding: 12px 18px 14px; font-family: system-ui, sans-serif; }
.bar .row { display: flex; justify-content: space-between; align-items: baseline; }
.bar .title { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.bar .num { font-size: 12px; color: var(--ink-soft); }
.progress { height: 3px; background: var(--paper-deep); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }

.scene { padding: 4px 22px; }
.scene .illo { width: 100%; border-radius: 12px; box-shadow: 0 6px 24px #0002; border: 5px solid #fff; display: block; }
.illo-fallback { background: var(--paper-deep); border-radius: 12px; padding: 40px 20px; text-align: center; color: var(--ink-soft); font-family: system-ui, sans-serif; font-size: 14px; }
.illo-fallback a { color: var(--accent-deep); }
.scene audio { width: 100%; margin: 14px 0 4px; height: 40px; }
.scene .text p { font-size: 18.5px; line-height: 2.0; margin: 1em 0; text-align: justify; }

.w { cursor: pointer; border-radius: 3px; transition: background .12s; }
.w:active, .w.hit { background: var(--highlight); box-shadow: 0 1.5px 0 var(--accent); }

/* ---- 底部导航 ---- */
nav.foot { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 10px; justify-content: center; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--paper) 40%); font-family: system-ui, sans-serif; }
nav.foot button { font-size: 15px; border: 1.5px solid var(--accent); background: #fff; color: var(--accent-deep); border-radius: 24px; padding: 10px 26px; cursor: pointer; min-width: 130px; }
nav.foot button.primary { background: var(--accent); color: #fff; }
nav.foot button:disabled { opacity: .35; }

/* ---- 完成页 ---- */
.finish { text-align: center; padding: 18vh 24px; }
.finish h2 { font-size: 26px; }
.finish .stat { color: var(--ink-soft); font-size: 15px; margin: 14px 0 30px; line-height: 1.9; font-family: system-ui, sans-serif; }

/* ---- 释义气泡 ---- */
#tip { position: absolute; z-index: 50; background: var(--ink); color: #f8f2e4; border-radius: 10px; padding: 9px 14px; font-family: system-ui, sans-serif; font-size: 15px; max-width: 260px; box-shadow: 0 6px 20px #0005; line-height: 1.5; }
#tip .word { font-family: Georgia, serif; font-style: italic; color: #e8c98d; margin-right: 8px; }
#tip::after { content: ""; position: absolute; top: -6px; left: 22px; border: 6px solid transparent; border-top: 0; border-bottom-color: var(--ink); }
#tip.above::after { top: auto; bottom: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--ink); }

/* ---- 章节结构 ---- */
.act-banner { text-align: center; padding: 22px 0 6px; }
.act-banner .act-no { font-size: 12px; letter-spacing: 4px; color: var(--accent-deep); font-family: system-ui, sans-serif; }
.act-banner .act-title { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: 2px; }
.act-banner::after { content: "❦"; display: block; color: var(--accent); margin-top: 8px; font-size: 15px; }
.watson-notes { background: #fffdf4; border: 1.5px solid #e0d5b8; border-radius: 12px; padding: 14px 18px; margin: 12px 0 18px; font-family: system-ui, sans-serif; font-size: 13.5px; }
.wn-head { font-weight: 700; color: var(--accent-deep); margin-bottom: 8px; }
.wn-col ul { margin: 4px 0 10px; padding-left: 20px; }
.wn-col li { margin: 3px 0; line-height: 1.55; }
.wn-col.unknown b { color: #a0303f; }
.wn-col.unknown li { color: #7a4a52; }
.scene-title { font-size: 13px; color: var(--ink-soft); font-family: system-ui, sans-serif; font-weight: 600; margin: 6px 0 10px; letter-spacing: .5px; }

/* ---- 互动层 ---- */
.hook { background: #fff8e8; border: 1.5px dashed var(--accent); border-radius: 10px; padding: 10px 14px; font-family: system-ui, sans-serif; font-size: 14px; margin-bottom: 14px; color: var(--accent-deep); }
.bar .board-btn { font-size: 12px; color: var(--accent-deep); background: #fff; border: 1px solid var(--accent); border-radius: 14px; padding: 2px 10px; cursor: pointer; }

.sent { border-radius: 4px; transition: background .15s; }
.sent.pick { background: #d0ebff; box-shadow: 0 2px 0 #4dabf7; cursor: pointer; }
.sent.correct { background: #d3f9d8; box-shadow: 0 2px 0 #2b8a3e; }

.quiz { background: #fff; border: 2px solid var(--accent); border-radius: 14px; padding: 16px 18px; margin: 22px 0; font-family: system-ui, sans-serif; box-shadow: 0 4px 16px #8a5a2b22; }
.q-head { font-size: 15.5px; font-weight: 600; line-height: 1.6; }
.q-head.solved { color: #2b8a3e; }
.q-hint { font-size: 13.5px; color: var(--ink-soft); margin: 8px 0; }
.q-explain { font-size: 14px; margin-top: 10px; background: var(--paper); border-radius: 8px; padding: 10px 12px; line-height: 1.7; }
.q-btn { font-family: inherit; font-size: 14.5px; background: var(--accent); color: #fff; border: 0; border-radius: 20px; padding: 9px 22px; cursor: pointer; margin: 10px 8px 0 0; }
.q-btn:disabled { opacity: .4; }
.q-btn.ghost { background: #fff; color: var(--accent-deep); border: 1.5px solid var(--accent); }

/* ---- 线索板 / 复盘 / 家长视图 ---- */
.board { padding: 26px 22px 60px; font-family: system-ui, sans-serif; }
.board h2 { font-size: 20px; }
.muted { color: var(--ink-soft); font-size: 13px; font-weight: 400; }
.clue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.clue-card { background: #fff; border: 1.5px solid var(--paper-deep); border-radius: 10px; padding: 12px; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); cursor: pointer; min-height: 46px; }
.clue-card.lit { border-color: #2b8a3e; color: var(--ink); background: #f4fbf4; }
.hidden-label { font-style: italic; }
.ptable table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 10px; overflow: hidden; }
.ptable th, .ptable td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--paper-deep); }
.ptable th { background: var(--paper-deep); }
.parent-link { margin-top: 26px; font-size: 12.5px; color: var(--ink-soft); text-decoration: underline; cursor: pointer; font-family: system-ui, sans-serif; }
.bind-form { margin-top: 12px; font-family: system-ui, sans-serif; }
.bind-form input { display: block; width: 220px; margin: 6px auto; font: inherit; padding: 9px 12px; border: 1.5px solid var(--paper-deep); border-radius: 10px; text-align: center; }
.bind-err { color: #c92a2a; font-size: 12.5px; min-height: 16px; margin: 4px 0; }

/* ---- 朗读评测 ---- */
.readaloud { background: #fff; border: 2px solid #4a7c59; border-radius: 14px; padding: 16px 18px; margin: 18px 0; font-family: system-ui, sans-serif; box-shadow: 0 4px 16px #4a7c5922; }
.rd-head { font-weight: 700; font-size: 15px; color: #2f5d3c; }
.rd-best { font-size: 12px; background: #d3f9d8; border-radius: 10px; padding: 1px 8px; margin-left: 6px; }
.rd-intro { font-size: 13.5px; color: var(--ink-soft); margin: 8px 0 6px; }
.rd-line { font-family: Georgia, serif; font-size: 18px; line-height: 1.7; margin: 6px 0; }
.rd-line.rd-para { font-size: 16px; line-height: 1.9; }
.rd-speaker { font-size: 13px; color: var(--ink-soft); font-style: italic; margin-left: 10px; }
.rd-result { margin-top: 8px; font-size: 14px; min-height: 20px; }
.rd-score { font-size: 17px; }
.rd-missed { margin: 6px 0; } .rd-missed span { background: #ffe3e3; border-radius: 6px; padding: 1px 8px; margin-right: 5px; font-family: Georgia, serif; }
.rd-warn { color: #b35c00; font-size: 13px; }
.rd-live { color: #c92a2a; animation: pulse 1.2s infinite; }
.rd-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.q-btn.demo { border-color: #4a7c59; color: #2f5d3c; }
button.recording { background: #c92a2a !important; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---- 证书 / toast ---- */
.cert .seal { font-size: 54px; }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #f8f2e4; border-radius: 12px; padding: 11px 18px; font-family: system-ui, sans-serif; font-size: 14px; opacity: 0; transition: all .3s; z-index: 60; pointer-events: none; max-width: 86vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
