/* KeepWords PC 绘本界面：数据和事件由 app.js 管理。 */
:root {
  --scene-ink: #10452e;
  --scene-muted: #63776b;
  --scene-cream: #fcf8ef;
  --scene-purple: #7955b5;
  --scene-orange: #ec8525;
  --scene-border: #e2edda;
  --scene-shadow: 0 8px 20px rgba(80, 83, 55, .11);
}

body.scene-mode { background: var(--scene-cream); color: var(--scene-ink); }
body.scene-mode .app-header { height: 82px; background: #fffdf8; border: 0; }
body.scene-mode .header-inner { max-width: 1680px; padding: 0 clamp(28px, 6vw, 140px); }
body.scene-mode .logo { color: #0b4b2d; font-size: 26px; font-weight: 900; letter-spacing: -.5px; gap: 12px; }
body.scene-mode .logo-mark { width: 44px; height: 44px; border-radius: 11px; font-size: 25px; }
body.scene-mode .logo:disabled { opacity: 1; cursor: default; }
body.scene-mode .tagline { display: none; }
body.scene-mode .user-btn { background: #f2f3e8; border-radius: 999px; padding: 5px 16px 5px 5px; font-weight: 700; }
body.scene-mode .user-dot { width: 42px; height: 42px; background: #e0efda; color: #0b4b2d; }
body.scene-mode .header-actions .icon-btn { width: 44px; height: 44px; border-radius: 50%; background: #e0efda; color: #0b4b2d; }
body.scene-mode .wrap { max-width: none; width: 100%; padding: 0; }

.illustrated-scene {
  position: relative; isolation: isolate; overflow: hidden; width: 100%;
  min-height: calc(100vh - 82px);
  background: radial-gradient(ellipse at 52% 10%, #fffdf8 0, #fbf5e7 60%, #f4efd9 100%);
}
.scene-decoration { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.scene-decoration img { position: absolute; display: block; }
.scene-window { left: -3.9vw; top: 3.4vh; width: clamp(150px, 12.5vw, 280px); }
.scene-leaves { left: -3.9vw; top: -8vh; width: clamp(250px, 23vw, 520px); }
.scene-desk {
  position: absolute; left: 0; right: 0; bottom: 0; height: clamp(90px, 11vh, 180px);
  border-top: 3px solid #eaa06b; background: #f3a66d url('/assets/home/wood-desktop.webp') center / cover no-repeat;
}
.scene-plant { bottom: 2vh; width: clamp(180px, 15vw, 310px); }
.scene-plant-left { left: -4vw; }
.scene-plant-right { right: -4vw; transform: scaleX(-1); }
.scene-books { left: 14%; bottom: 1.4vh; width: clamp(120px, 10vw, 210px); }
.scene-open-book { right: 12%; bottom: 1vh; width: clamp(180px, 15vw, 300px); }
.scene-cup { right: 8%; bottom: 1.4vh; width: clamp(80px, 6.5vw, 145px); }
.scene-content {
  position: relative; z-index: 1; width: min(1220px, calc(100% - 220px)); min-height: calc(100vh - 82px);
  margin: 0 auto; padding: 28px 0 clamp(130px, 15vh, 190px);
}

.page-hero { position: relative; min-height: 150px; margin-bottom: 18px; display: flex; align-items: center; }
.page-hero-copy { position: relative; z-index: 2; max-width: calc(100% - 280px); }
.page-title { margin: 0; color: #073f27; font-size: clamp(34px, 3.2vw, 48px); font-weight: 900; line-height: 1.22; letter-spacing: -.035em; }
.page-subtitle { margin: 13px 0 0; color: #607568; font-size: 16px; line-height: 1.55; }
.title-stroke { display: block; width: 180px; height: 8px; margin: 8px 0 0 55px; border-top: 6px solid #ffab4c; border-radius: 50%; transform: rotate(-3deg); }
.page-hero-art { position: absolute; z-index: 1; top: 0; right: 38px; width: 250px; height: 150px; pointer-events: none; }
.page-hero-art img { position: absolute; display: block; object-fit: contain; }
.hero-book-base { width: 250px; height: 125px; left: 0; bottom: -12px; }
.hero-book-mascot { width: 180px; height: 125px; left: 38px; top: 0; }
.scene-eyebrow { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: 999px; background: #e8f3d5; color: #296b3b; font-size: 14px; font-weight: 800; }
.scene-eyebrow img { width: 25px; height: 25px; }
.purple-label { background: #dfd1f5; color: #654196; }
body.scene-mode .back { display: inline-flex; align-items: center; min-height: 40px; margin: 0 0 12px; padding: 0 15px; border: 0; border-radius: 999px; background: #edf5e2; color: #35634a; font-size: 14px; font-weight: 700; }
body.scene-mode .card { background: #fffefa; border: 4px solid #fff; border-radius: 26px; box-shadow: var(--scene-shadow); }
body.scene-mode .btn { min-height: 52px; border: 0; border-radius: 15px; padding: 0 24px; background: #15905c; color: #fff; font-size: 16px; font-weight: 800; box-shadow: 0 3px 0 #087649; }
body.scene-mode .btn.secondary { background: #f5f9ef; color: #286344; box-shadow: inset 0 0 0 1px #c7dec5; }
body.scene-mode button:focus-visible, body.scene-mode input:focus-visible { outline: 3px solid #d38423; outline-offset: 3px; }
body.scene-mode .progress { overflow: hidden; height: 12px; margin: 0; border-radius: 999px; background: #e5ebdf; }
body.scene-mode .progress > span { display: block; height: 100%; border-radius: inherit; background: #1a995e; }
body.scene-mode .helper, body.scene-mode .sub { color: var(--scene-muted); }

/* 学习卡：揭示前后保留同一张词卡，按钮绑定真实评分。 */
.study-progress { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; padding: 12px 16px 12px 22px; margin-bottom: 18px; border: 4px solid #fff; border-radius: 20px; background: #fffdf8; box-shadow: var(--scene-shadow); }
.study-progress-label { color: #315e46; font-size: 15px; font-weight: 700; white-space: nowrap; }
.study-progress-label strong { margin-left: 8px; color: #128855; font-size: 20px; }
body.scene-mode .study-progress .back { margin: 0; }
body.scene-mode .word-card { position: relative; min-height: 450px; padding: 34px 48px 38px; text-align: center; }
.study-chip { position: absolute; top: 23px; left: 26px; display: inline-flex; padding: 7px 15px; border-radius: 999px; background: #e5f4db; color: #2b794a; font-size: 14px; font-weight: 800; }
.study-chip.review { background: #eaf2fc; color: #386fa0; }
body.scene-mode .word-card .word { margin: 20px 0 8px; color: #0b4c31; font-family: inherit; font-size: clamp(45px, 5vw, 62px); font-weight: 850; line-height: 1.15; }
body.scene-mode .phonetic { margin: 0; color: #71817a; font-size: 17px; }
.study-illustration { display: block; width: 240px; height: 135px; margin: 10px auto 0; object-fit: contain; pointer-events: none; }
body.scene-mode .word-card .prompt { margin: 8px 0 18px; color: #62776a; font-size: 16px; }
body.scene-mode .reveal-btn { min-width: 300px; }
body.scene-mode .word-card.is-revealed { min-height: 450px; }
.word-card.is-revealed .study-illustration { position: absolute; top: 8px; right: 18px; width: 120px; height: 84px; margin: 0; }
body.scene-mode .word-card .meaning { margin: 24px 0 16px; color: #164c32; font-size: 30px; font-weight: 800; }
body.scene-mode .word-card .example { max-width: 700px; margin: 0 auto; padding: 13px 18px; border-radius: 16px; background: #f3f8ec; line-height: 1.6; }
body.scene-mode .word-card .example small { display: block; color: #718276; }
body.scene-mode .rating-title { margin: 22px 0 12px; color: #62776a; }
body.scene-mode .rating-row { max-width: 700px; margin: 0 auto; }
body.scene-mode .rating { min-height: 54px; border-radius: 14px; font-size: 16px; }
body.scene-mode .rating.no { background: #ffebe7; color: #a54335; }
body.scene-mode .rating.maybe { background: #fff0cb; color: #7a5a0b; }
body.scene-mode .rating.yes { background: #168e5b; color: #fff; }

/* 闯关：真正的通过、当前、锁定状态来自服务端。 */
body.scene-mode .level-hero { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 218px; padding: 25px 35px; overflow: hidden; border: 4px solid #fff; border-radius: 28px; background: linear-gradient(120deg, #f1eaff, #e6dcfa); box-shadow: var(--scene-shadow); }
.level-hero-copy { position: relative; z-index: 2; flex: 1; }
.level-hero-copy h2 { margin: 13px 0 8px; color: #493174; font-size: 29px; }
.level-hero-copy p { margin: 0 0 18px; color: #655d79; line-height: 1.6; }
body.scene-mode .level-hero-copy .btn { min-width: 190px; background: #805cbc; box-shadow: 0 3px 0 #68479f; }
.level-illustration { flex: 0 1 37%; width: 37%; max-height: 185px; object-fit: contain; pointer-events: none; }
body.scene-mode .section-heading { display: flex; align-items: center; gap: 14px; margin: 28px 0 15px; color: #164a30; font-size: 21px; }
body.scene-mode .section-heading .helper { font-size: 14px; font-weight: 600; }
body.scene-mode .level-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
body.scene-mode .level { display: flex; flex-direction: column; align-items: center; min-height: 176px; padding: 16px 12px; border: 3px solid #e4eedc; border-radius: 20px; background: #f7fbf2; box-shadow: 0 5px 15px rgba(88, 89, 59, .08); text-align: center; color: #184d31; }
body.scene-mode .level.current { border-color: #ae8adc; background: #f0e8fc; color: #503175; }
body.scene-mode .level.done { border-color: #c9e6bb; background: #eef8e8; }
body.scene-mode .level.locked { opacity: 1; border-color: #e2e4df; background: #f0f1ed; color: #69796d; }
body.scene-mode .level:not(:disabled):hover { transform: translateY(-2px); }
.level-state { align-self: stretch; padding: 5px 6px; border-radius: 999px; background: #e4f3df; color: #3d8050; font-size: 12px; font-weight: 800; }
.level.current .level-state { background: #d9c4f2; color: #654196; }
.level.locked .level-state { background: #e4e6e1; color: #6f7d73; }
.level-number { margin-top: 16px; font-size: 14px; font-weight: 700; }
body.scene-mode .level b { margin-top: 6px; font-size: 18px; line-height: 1.35; }
body.scene-mode .level small { margin-top: auto; padding-top: 10px; color: #697d6f; font-size: 13px; }

/* 大厅和房间：按钮、人数与状态均使用实际业务数据。 */
body.scene-mode .lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
body.scene-mode .lobby-panel { position: relative; display: flex; flex-direction: column; align-items: center; min-height: 350px; padding: 22px 30px 26px; overflow: hidden; border: 4px solid #fff; border-radius: 28px; box-shadow: var(--scene-shadow); text-align: center; }
body.scene-mode .lobby-panel.room { background: linear-gradient(135deg, #f4edff, #e9ddf9); }
body.scene-mode .lobby-panel.solo { background: linear-gradient(135deg, #fff3e5, #ffebd0); }
.lobby-illustration { width: 230px; height: 125px; object-fit: contain; pointer-events: none; }
body.scene-mode .lobby-panel h2 { margin: 8px 0 7px; font-size: 24px; color: #4c327a; }
body.scene-mode .lobby-panel.solo h2 { color: #7b451a; }
body.scene-mode .lobby-panel p { margin: 0; color: #5c6d61; font-size: 15px; line-height: 1.55; }
body.scene-mode .lobby-rules { margin: 10px 0 0; color: #776c7e; font-size: 14px; font-weight: 700; }
body.scene-mode .lobby-panel .action-row { display: flex; justify-content: center; width: 100%; gap: 12px; margin: auto 0 0; padding-top: 18px; }
body.scene-mode .lobby-panel .action-row .btn { min-width: 0; flex: 1; max-width: 210px; }
body.scene-mode .lobby-panel.room .btn:not(.secondary) { background: #805cbc; box-shadow: 0 3px 0 #68479f; }
body.scene-mode .lobby-panel.solo .btn { background: #ee8a2b; box-shadow: 0 3px 0 #d56c18; }
body.scene-mode .rank-entry { display: flex; align-items: center; gap: 18px; width: 100%; margin-top: 18px; padding: 18px 22px; border: 4px solid #fff; background: #f8fbed; text-align: left; }
body.scene-mode .rank-entry .entry-icon { flex: none; }
body.scene-mode .rank-entry small { display: block; margin-top: 5px; color: #6f8174; }
body.scene-mode .rank-entry .more { margin-left: auto; color: #13835a; font-weight: 700; }

body.scene-mode .room-card { padding: 24px 28px 28px; }
body.scene-mode .room-banner { display: flex; align-items: center; gap: 24px; padding: 18px 22px; border-radius: 20px; background: #f1eafa; }
.room-code-label { display: flex; align-items: center; gap: 18px; }
.room-code-label small { color: #625074; font-size: 16px; font-weight: 800; }
body.scene-mode .room-code { padding: 6px 16px; border-radius: 14px; background: #e2f1d4; color: #154a2d; font-size: 38px; line-height: 1.1; font-weight: 900; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
body.scene-mode .room-banner .btn { margin-left: auto; flex: none; }
body.scene-mode .people-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 14px; }
body.scene-mode .person { display: flex; flex-direction: column; align-items: center; min-height: 145px; gap: 10px; padding: 18px 10px; border: 0; border-radius: 18px; background: #f5f9ee; text-align: center; }
body.scene-mode .person b, body.scene-mode .person small { display: block; }
body.scene-mode .person small { margin-top: 5px; color: #738579; }
body.scene-mode .person .avatar { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #d8efc8; color: #337149; font-size: 24px; font-weight: 800; }
body.scene-mode .person .avatar.purple { background: #e7daf7; color: #7752ab; }
body.scene-mode .person .avatar.blue { background: #dceef3; color: #3f7890; }
.room-actions { margin-top: 22px; }
.room-actions .btn { width: 100%; }
.room-note { margin: 12px 0 0; }

/* 答题：不遮挡计时、题干、选项和反馈。 */
body.scene-mode .quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; border: 4px solid #fff; border-radius: 18px; background: #fffdf7; box-shadow: var(--scene-shadow); }
body.scene-mode .quiz-top .back { margin: 0; }
body.scene-mode .time { padding: 8px 14px; border-radius: 999px; background: #fff0d7; color: #a85b11; font-size: 15px; font-weight: 800; white-space: nowrap; }
body.scene-mode .time b { margin-left: 4px; font-size: 20px; font-variant-numeric: tabular-nums; }
body.scene-mode .time.warning { background: #ffe9e3; color: #a33227; }
body.scene-mode .time b.warning { color: #a33227; }
body.scene-mode .slim-progress { margin: 14px 4px 20px; }
body.scene-mode .quiz-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; }
body.scene-mode .quiz-card { min-height: 420px; padding: 26px 32px 22px; }
body.scene-mode .quiz-card .word { margin: 32px 0 10px; color: #0b4c31; font-family: inherit; font-weight: 850; }
body.scene-mode .quiz-card .question { margin: 0 0 26px; color: #657a6d; }
body.scene-mode .choices { gap: 14px; }
body.scene-mode .choice { min-height: 70px; border: 2px solid #d9ebd2; border-radius: 16px; background: #f8fbf4; }
body.scene-mode .choice.correct { border-color: #52ac67; background: #e4f6dd; }
body.scene-mode .choice.wrong { border-color: #dc7f71; background: #ffebe5; }
body.scene-mode .choice:disabled { opacity: 1; }
.answer-feedback { min-height: 22px; margin: 14px 0 0; color: #4d7f53; font-size: 14px; text-align: center; }
body.scene-mode .score-card { align-self: start; padding: 24px; background: #fffaf0; }
.score-illustration { display: block; width: 130px; height: 100px; margin: -8px auto 10px; object-fit: contain; pointer-events: none; }
body.scene-mode .score-card strong { color: #0d6944; }
body.scene-mode .score-card small { color: #6b7e70; }

/* 学习、闯关、个人赛和房间赛结算。 */
body.scene-mode .summary-card { max-width: 920px; min-height: 0; margin: 0 auto; padding: 26px 38px 34px; text-align: center; }
.result-illustration { display: block; width: 180px; height: 125px; margin: 0 auto; object-fit: contain; pointer-events: none; }
body.scene-mode .summary-card h1, body.scene-mode .summary-card h2 { margin: 8px 0; color: #12472f; font-size: 26px; }
body.scene-mode .summary-card .sub { margin-bottom: 12px; }
body.scene-mode .summary-card .metrics { justify-content: center; margin: 26px 0; }
body.scene-mode .summary-actions { gap: 12px; }
body.scene-mode .result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
body.scene-mode .score-summary, body.scene-mode .board { position: relative; padding: 24px; }
.score-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 154px; padding: 20px 24px; border-radius: 20px; background: #f0e9fb; }
.score-banner span { color: #65448e; font-size: 15px; font-weight: 800; }
.score-banner strong { display: block; margin: 6px 0; color: #124a31; font-size: 48px; line-height: 1; }
.score-banner strong small { font-size: 17px; }
.score-banner p { margin: 8px 0 0; color: #4f725c; font-size: 14px; font-weight: 700; }
.summary-illustration { width: 145px; height: 115px; object-fit: contain; pointer-events: none; }
body.scene-mode .score-summary .metrics { gap: 28px; margin: 27px 0; }
body.scene-mode .score-summary .metric strong { font-size: 24px; }
body.scene-mode .score-summary .action-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 0; }
body.scene-mode .score-summary .action-row .btn { flex: 1; min-width: 150px; }
body.scene-mode .rank-title { margin: 0 0 18px; color: #4d3677; font-size: 21px; }
body.scene-mode .rank-row { min-height: 54px; border-bottom: 1px solid #edf1e9; border-radius: 12px; }
body.scene-mode .rank-row.me { background: #eef7e2; }
body.scene-mode .rank-row .num { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #f0f3e9; }
body.scene-mode .rank-row:first-of-type .num { background: #fff0c6; color: #ad6e0d; }
.board-page { min-height: 320px; }
.board-illustration { float: right; width: 105px; height: 80px; margin: -8px 0 0 8px; object-fit: contain; pointer-events: none; }

/* 登录与设置，保持原来的输入、回跳和保存逻辑。 */
body[data-page="login"] .form-card { max-width: 660px; margin: 0 auto; padding: 28px 38px 34px; }
body[data-page="login"] .form-card h2 { margin: 14px 0 20px; color: #174a31; font-size: 24px; }
body[data-page="login"] .field { margin: 16px 0; }
body[data-page="login"] .field input { border: 2px solid #d9e8d3; background: #fff; }
body[data-page="login"] .notice { margin-top: 20px; }
.modal-scrim { background: rgba(37, 50, 32, .46); }
.modal { border: 5px solid #fff; border-radius: 26px; background: #fffdf7; box-shadow: 0 24px 64px rgba(48, 59, 35, .22); }
.modal-header h2 { display: flex; align-items: center; gap: 10px; color: #164a30; }
.modal-header h2 img { width: 34px; height: 34px; padding: 6px; border-radius: 50%; background: #e5f2d8; }
.segments button.selected { border-color: #168e5b; background: #e8f6de; color: #126c43; }
.book, .notice { background: #f1f7e9; }

@media (max-width: 1200px) {
  .scene-content { width: calc(100% - 120px); }
  .scene-window, .scene-leaves { opacity: .65; }
}
@media (max-height: 800px) {
  .scene-content { padding-top: 18px; }
  .page-hero { min-height: 118px; margin-bottom: 12px; }
  .page-hero-art { transform: scale(.82); transform-origin: right center; }
  .study-illustration { height: 105px; }
  body.scene-mode .word-card { min-height: 405px; }
  body.scene-mode .quiz-card { min-height: 370px; }
  body.scene-mode .quiz-card .word { margin-top: 20px; }
  body.scene-mode .choice { min-height: 62px; }
}
@media (prefers-reduced-motion: no-preference) {
  body.scene-mode .level { transition: transform .16s ease; }
}

