/* 粤语村 · 像素风样式（我的世界气质：石块、木板、草方块、金块） */
:root {
  --u: clamp(9px, 4.2vw, 17px);
  --bg-0: #0b1220;
  --bg-1: #131d2c;
  --panel: #343b46;
  --panel-2: #2a303a;
  --ink: #f6edd8;
  --muted: #b7b0a0;
  --line: #0a0d13;
  --line-soft: #1d232d;
  --grass: #6aa84f;
  --grass-d: #4b7d36;
  --dirt: #8a5a30;
  --dirt-d: #5f3c1e;
  --plank: #c08a4e;
  --plank-d: #8a5c2e;
  --roof: #b5503f;
  --roof-d: #7d3226;
  --gold: #f2c14e;
  --diamond: #66e0cf;
  --ok: #6fbf4f;
  --ok-d: #3f8a2c;
  --bad: #b5564a;
  --bad-d: #7d3226;
  --shadow-btn: 0 4px 0 #05070a;
}

* { box-sizing: border-box; }

/* hidden 属性要压过 .speak-panel 的 display:flex 等作者样式 */
[hidden] { display: none !important; }

html, body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1.6px 1.6px at 18% 18%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1.4px 1.4px at 72% 12%, rgba(255,255,255,.4), transparent 60%),
    radial-gradient(1.6px 1.6px at 42% 34%, rgba(255,255,255,.3), transparent 60%),
    radial-gradient(1.2px 1.2px at 88% 42%, rgba(255,255,255,.35), transparent 60%),
    linear-gradient(180deg, #0a101b 0%, #121c2b 55%, #16243a 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button, input, label { font-family: inherit; }

.app {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.view { display: none; flex-direction: column; gap: 12px; flex: 1; }
.view.active { display: flex; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-cube {
  width: 22px;
  height: 22px;
  flex: none;
  background:
    linear-gradient(180deg, #7dbb58 0 32%, #8a5a30 32% 100%);
  box-shadow:
    inset 0 0 0 2px #0b0e14,
    inset 2px 2px 0 rgba(255,255,255,.25),
    inset -2px -2px 0 rgba(0,0,0,.35);
}

.brand-name {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 rgba(0,0,0,.6);
  white-space: nowrap;
}

.topbar-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  color: var(--ink);
  background: linear-gradient(#7d8794, #5f6874);
  border: 3px solid var(--line);
  border-radius: 4px;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.22), inset -2px -2px 0 rgba(0,0,0,.32), var(--shadow-btn);
  cursor: pointer;
}
.icon-btn:active { transform: translateY(3px); box-shadow: inset 2px 2px 0 rgba(255,255,255,.16), 0 1px 0 #05070a; }
.icon-btn.is-fs { background: linear-gradient(#f3ce6d, #c9971f); color: #2b1c00; }

.fs-btn { position: relative; }
.fs-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: square;
  stroke-linejoin: miter;
}
.fs-btn .fs-exit { display: none; }
.fs-btn.is-fs .fs-enter { display: none; }
.fs-btn.is-fs .fs-exit { display: block; }

/* ---------- 面板 ---------- */
.panel {
  position: relative;
  background: linear-gradient(180deg, #3a414c, #2b313b);
  border: 3px solid var(--line);
  border-radius: 5px;
  box-shadow:
    inset 3px 3px 0 rgba(255,255,255,.10),
    inset -3px -3px 0 rgba(0,0,0,.34),
    0 4px 0 #05070a;
  padding: 14px;
}

/* ---------- 村庄场景 ---------- */
.scene {
  padding: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #0c1526 0%, #14233a 52%, #1b3049 100%);
}

.scene .moon {
  position: absolute;
  top: 14px;
  right: 20px;
  width: 26px;
  height: 26px;
  background: #f6edd8;
  box-shadow: 0 0 22px rgba(246,237,216,.55), inset -6px -4px 0 rgba(0,0,0,.08);
  z-index: 0;
}

.scene .stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(2px 2px at 14% 26%, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(2px 2px at 34% 14%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(2px 2px at 56% 30%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(2px 2px at 78% 20%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(2px 2px at 88% 62%, rgba(255,255,255,.35), transparent 60%),
    radial-gradient(2px 2px at 24% 58%, rgba(255,255,255,.3), transparent 60%);
  background-size: 100% 100%;
}

.house-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 14px 8px 0;
  min-height: calc(var(--u) * 15 + 14px);
}

.house {
  display: grid;
  grid-template-columns: repeat(16, var(--u));
  grid-auto-rows: var(--u);
}

.cell {
  width: var(--u);
  height: var(--u);
  position: relative;
  line-height: 0;
  font-size: 0;
  transition: opacity .12s;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.16);
}

.cell.off {
  opacity: .12;
  filter: grayscale(1) brightness(1.4);
}
.cell.pop { animation: cellPop .32s cubic-bezier(.2,1.4,.4,1); }

@keyframes cellPop {
  0% { transform: scale(.25); opacity: .25; }
  65% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

.cell.d {
  background-color: #8a5a30;
  background-image:
    linear-gradient(135deg, rgba(255,255,255,.10) 0 2px, transparent 2px),
    linear-gradient(45deg, rgba(0,0,0,.16) 0 2px, transparent 2px);
  background-size: 7px 7px;
}

.cell.p {
  background-color: var(--plank);
  background-image:
    linear-gradient(90deg, rgba(0,0,0,.16) 0 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,.14), transparent 40%);
  background-size: 7px 100%, 100% 100%;
}

.cell.r {
  background-color: var(--roof);
  background-image:
    linear-gradient(180deg, rgba(255,255,255,.16) 0 2px, transparent 2px),
    linear-gradient(90deg, rgba(0,0,0,.18) 0 1px, transparent 1px);
  background-size: 100% 6px, 8px 100%;
}

.cell.g {
  background: #9fdcff;
  box-shadow: inset 0 0 0 1px #4d86a6, inset 0 0 0 3px rgba(255,255,255,.35);
}
.cell.g::after {
  content: "";
  position: absolute;
  inset: 22% 40% 22% 40%;
  background: rgba(77,134,166,.55);
}

.cell.o {
  background: #6b4423;
  box-shadow: inset 0 0 0 2px #3c2412;
}
.cell.o::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  right: 22%;
  top: 46%;
  background: var(--gold);
}

.cell.f { background: var(--gold); box-shadow: inset 0 0 0 1px #9c7413, inset 2px 2px 0 rgba(255,255,255,.5); }

.cell.w {
  background: transparent;
}
.cell.w::after {
  content: "";
  position: absolute;
  left: 42%;
  top: 0;
  width: 16%;
  height: 100%;
  background: #8a5c2e;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}

.ground {
  height: calc(var(--u) * 1.6);
  background:
    repeating-linear-gradient(90deg, var(--grass) 0 8px, #74b356 8px 16px);
  border-top: 3px solid var(--grass-d);
  box-shadow: inset 0 4px 0 rgba(255,255,255,.12);
}

.scene-caption {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px 10px;
  background: #182838;
  border-top: 3px solid #0b1220;
  font-weight: 800;
  letter-spacing: .5px;
}
.scene-sub { font-size: 12px; font-weight: 500; color: #9fb4c9; letter-spacing: 0; }

/* ---------- 今日任务 ---------- */
.daily-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.daily-head h1 { margin: 0; font-size: 21px; letter-spacing: 1px; }

.badge {
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
  color: #2b1c00;
  background: var(--gold);
  border: 2px solid var(--line);
  border-radius: 3px;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.5);
}

.daily-desc {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

/* ---------- 按钮 ---------- */
.mc-btn {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .5px;
  text-align: center;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0,0,0,.45);
  background: linear-gradient(#7d8794, #5f6874);
  border: 3px solid var(--line);
  border-radius: 4px;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.22), inset -2px -2px 0 rgba(0,0,0,.3), var(--shadow-btn);
  cursor: pointer;
  transition: filter .12s;
}
.mc-btn:last-child { margin-bottom: 0; }
.mc-btn:active { transform: translateY(3px); box-shadow: inset 2px 2px 0 rgba(255,255,255,.18), 0 1px 0 #05070a; }
.mc-btn.primary { background: linear-gradient(#7cc35a, #4f9134); }
.mc-btn.gold { background: linear-gradient(#f3ce6d, #c9971f); color: #332200; text-shadow: 1px 1px 0 rgba(255,255,255,.35); }
.mc-btn.danger { background: linear-gradient(#c96a5c, #93382c); }
.mc-btn.big { padding: 16px; font-size: 18px; }
.mc-btn.ghost { background: linear-gradient(#46505e, #343b46); }

/* ---------- 物品栏 ---------- */
.hotbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.slot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 9px;
  background: #1b2028;
  border: 3px solid var(--line);
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px #333b47;
}
.slot-icon { font-size: 20px; line-height: 1; flex: none; }
.slot-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.slot-body b { font-size: 17px; font-weight: 900; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.slot-body small { font-size: 10px; color: var(--muted); white-space: nowrap; }

.foot-tip {
  margin: 2px 0 0;
  text-align: center;
  font-size: 12px;
  color: #8e9aab;
}

/* ---------- 答题 ---------- */
.quiz-top { gap: 10px; }
.progress {
  flex: 1;
  height: 14px;
  background: #1b2028;
  border: 2px solid var(--line);
  box-shadow: inset 0 0 0 2px #333b47;
  overflow: hidden;
}
.progress i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #7cc35a, #4f9134);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.25);
  transition: width .25s ease;
}
.q-count {
  font: 800 14px ui-monospace, "SFMono-Regular", Consolas, monospace;
  color: var(--muted);
  white-space: nowrap;
}

.quiz-panel { display: flex; flex-direction: column; flex: 1; }

.session-blocks {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 12px;
}
.sblock {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  background: #1b2028;
  box-shadow: inset 0 0 0 2px #333b47;
  border-radius: 2px;
}
.sblock.on {
  background: linear-gradient(180deg, #7dbb58 0 32%, #8a5a30 32% 100%);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.3), inset -2px -2px 0 rgba(0,0,0,.35);
  animation: cellPop .3s ease-out;
}

.quiz-foot {
  margin-top: auto;
  padding: 4px 0 2px;
  text-align: center;
  font-size: 12px;
  color: #8e9aab;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.q-kind {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #d7e3f0;
  background: #1d2b3c;
  border: 2px solid #0a1220;
  padding: 3px 8px;
  border-radius: 3px;
}

.q-prompt {
  min-height: 118px;
  padding: 10px 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}
.q-prompt .big-emoji { font-size: 58px; line-height: 1; filter: drop-shadow(0 4px 0 rgba(0,0,0,.25)); }
.q-prompt .big-zh { font-size: 36px; font-weight: 900; letter-spacing: 2px; }
.q-prompt .ask { font-size: 14px; color: var(--muted); }
.q-prompt .hint-word { font-size: 13px; color: #8e9aab; }

/* 喇叭按钮 */
.speaker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  font-size: 24px;
  line-height: 1;
  color: var(--ink);
  background: linear-gradient(#4a5563, #343c48);
  border: 3px solid var(--line);
  border-radius: 4px;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.18), inset -2px -2px 0 rgba(0,0,0,.3), var(--shadow-btn);
  cursor: pointer;
}
.speaker span { font-size: 13px; font-weight: 800; letter-spacing: .5px; color: #c8d4e2; }
.speaker:active { transform: translateY(3px); box-shadow: inset 2px 2px 0 rgba(255,255,255,.14), 0 1px 0 #05070a; }
.speaker.big { min-width: 210px; justify-content: center; }
.speaker.playing { animation: speakerPulse .6s ease-in-out infinite alternate; }
@keyframes speakerPulse { from { filter: brightness(1); } to { filter: brightness(1.35); } }

/* 选项 */
.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.option {
  position: relative;
  min-height: 76px;
  padding: 9px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
  color: var(--ink);
  background: linear-gradient(#3d4450, #2b313b);
  border: 3px solid var(--line);
  border-radius: 4px;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.13), inset -2px -2px 0 rgba(0,0,0,.38), var(--shadow-btn);
  cursor: pointer;
  transition: filter .12s, transform .06s;
}
.option:not(:disabled):active { transform: translateY(3px); box-shadow: inset 2px 2px 0 rgba(255,255,255,.1), 0 1px 0 #05070a; }
.option .opt-emoji { font-size: 26px; line-height: 1; }
.option .opt-word { font-size: 20px; font-weight: 900; letter-spacing: 1px; line-height: 1.25; }
.option .opt-sub { font-size: 11px; color: var(--muted); line-height: 1.2; }
.option.text-only { min-height: 66px; }
.option.text-only .opt-word { font-size: 17px; }
.option.correct {
  background: linear-gradient(#7cc35a, #3f8a2c);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.28), inset -2px -2px 0 rgba(0,0,0,.3), var(--shadow-btn);
  animation: optPop .28s ease-out;
}
.option.wrong {
  background: linear-gradient(#c96a5c, #7d3226);
  animation: shake .32s ease-in-out;
}
.option.dim { filter: grayscale(.6) brightness(.72); }
.option:disabled { cursor: default; }

@keyframes optPop { 0% { transform: scale(.96); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* 反馈 */
.feedback {
  min-height: 84px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
}
.feedback .fb-title { font-size: 19px; font-weight: 900; letter-spacing: .5px; }
.feedback .fb-title.ok { color: #9be07a; }
.feedback .fb-title.bad { color: #ff9c8d; }
.feedback .fb-jp { font: 700 13px ui-monospace, "SFMono-Regular", Consolas, monospace; color: var(--diamond); letter-spacing: .5px; }
.feedback .fb-zh { font-size: 14px; color: #d9d2c2; line-height: 1.5; }
.feedback .fb-note { font-size: 12px; color: #9aa6b5; line-height: 1.5; }
.feedback .fb-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.feedback .mc-btn { width: auto; min-width: 120px; padding: 9px 20px; font-size: 15px; margin-top: 0; }
.link-btn {
  margin-top: 2px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--diamond);
  background: #1d2937;
  border: 2px solid var(--line);
  box-shadow: 0 2px 0 #05070a;
  border-radius: 3px;
  cursor: pointer;
}
.scene-hint {
  font-size: 13px;
  color: #d9d2c2;
  line-height: 1.45;
  padding: 6px 10px;
  background: #1a2a1c;
  border: 2px solid #3c5a35;
  border-radius: 3px;
}

/* 童谣 */
.rhyme {
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  background: #1a2a1c;
  border: 3px solid var(--line);
  box-shadow: inset 0 0 0 2px #3c5a35;
  border-radius: 4px;
}
.rhyme-title {
  text-align: center;
  color: var(--gold);
  font-weight: 900;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-size: 16px;
}
.rhyme-line { font-size: 18px; line-height: 1.9; letter-spacing: 1px; }
.rhyme-lines { margin-top: 6px; }
.rhyme-line.blank-line { color: #fff; }
.blank {
  display: inline-block;
  min-width: 1.4em;
  border-bottom: 3px solid var(--gold);
  color: var(--gold);
  text-align: center;
  line-height: 1.2;
}

/* ---------- 结算 ---------- */
.result { text-align: center; padding: 22px 16px; }
.result-cube {
  width: 58px;
  height: 58px;
  margin: 0 auto 6px;
  background:
    linear-gradient(180deg, #7dbb58 0 32%, #8a5a30 32% 100%);
  box-shadow: inset 0 0 0 3px #0b0e14, inset 3px 3px 0 rgba(255,255,255,.28), inset -3px -3px 0 rgba(0,0,0,.35), 0 6px 0 #05070a;
  animation: cubeBob 1.6s ease-in-out infinite alternate;
}
@keyframes cubeBob { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-6px) rotate(2deg); } }
.result h2 { margin: 8px 0 4px; font-size: 26px; letter-spacing: 2px; }
.result-sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.result-wrong { text-align: left; margin-bottom: 14px; }
.result-wrong h3 { font-size: 14px; color: var(--gold); margin: 0 0 8px; letter-spacing: .5px; }
.wrong-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  max-width: 100%;
  margin: 0 6px 6px 0;
  padding: 5px 9px;
  background: #1b2028;
  border: 2px solid #0b0e14;
  box-shadow: inset 0 0 0 2px #333b47;
  font-size: 14px;
}
.wrong-chip b { font-size: 15px; }
.wrong-chip small { color: var(--muted); font-size: 11px; }

/* ---------- 声调 ---------- */
.tone-panel { display: flex; flex-direction: column; gap: 12px; text-align: center; }
.tone-intro { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.6; }
.tone-panel .speaker { align-self: center; flex-direction: column; gap: 6px; font-size: 30px; }
.tone-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tone-card {
  padding: 10px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--ink);
  background: linear-gradient(#3d4450, #2b313b);
  border: 3px solid var(--line);
  border-radius: 4px;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.13), inset -2px -2px 0 rgba(0,0,0,.38), var(--shadow-btn);
  cursor: pointer;
}
.tone-card:active { transform: translateY(3px); box-shadow: inset 2px 2px 0 rgba(255,255,255,.1), 0 1px 0 #05070a; }
.tone-card .tone-char { font-size: 27px; font-weight: 900; line-height: 1.1; }
.tone-card .tone-num { font-size: 11px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.tone-card .tone-arrow { font-size: 13px; color: var(--diamond); letter-spacing: 1px; }
.tone-card.correct { background: linear-gradient(#7cc35a, #3f8a2c); }
.tone-card.wrong { background: linear-gradient(#c96a5c, #7d3226); }
.tone-score { font-size: 13px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.tone-panel .feedback { align-items: center; text-align: center; min-height: 60px; }
.tone-panel .feedback .mc-btn { align-self: center; }

/* ---------- 家长页 ---------- */
.parent-panel { display: flex; flex-direction: column; gap: 10px; }
.parent-panel h2 {
  margin: 8px 0 0;
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--gold);
}
.parent-panel h2:first-child { margin-top: 0; }
.parent-note { margin: 0; font-size: 12px; line-height: 1.6; color: #9aa6b5; }
.parent-note a { color: var(--gold); text-decoration: underline; word-break: break-all; }

.parent-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat-card {
  padding: 8px 10px;
  background: #1b2028;
  border: 2px solid var(--line);
  box-shadow: inset 0 0 0 2px #333b47;
}
.stat-card b { display: block; font-size: 20px; font-family: ui-monospace, Consolas, monospace; }
.stat-card small { font-size: 11px; color: var(--muted); }

.pack-list { display: flex; flex-direction: column; gap: 6px; }
.pack-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #1b2028;
  border: 2px solid var(--line);
  box-shadow: inset 0 0 0 2px #333b47;
  font-size: 14px;
  cursor: pointer;
}
.pack-row input { width: 20px; height: 20px; accent-color: #6fbf4f; flex: none; }
.pack-row .pack-meta { margin-left: auto; font-size: 11px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: #1b2028;
  border: 2px solid var(--line);
  box-shadow: inset 0 0 0 2px #333b47;
  font-size: 14px;
  cursor: pointer;
}
.switch-row input { width: 20px; height: 20px; accent-color: #6fbf4f; flex: none; }

.speak-log { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.speak-log-row {
  padding: 8px 10px;
  background: #1b2028;
  border: 2px solid var(--line);
  box-shadow: inset 0 0 0 2px #333b47;
  font-size: 13px;
  line-height: 1.5;
}
.speak-log-row .sl-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.speak-log-row .sl-head b { font-size: 13px; letter-spacing: 1px; }
.speak-log-row .sl-head b.ok { color: #9be07a; }
.speak-log-row .sl-head b.bad { color: #ff9c8d; }
.speak-log-row .sl-target { font-size: 15px; font-weight: 800; }
.speak-log-row .sl-time { margin-left: auto; color: #7f8b9a; font-size: 11px; }
.speak-log-row .sl-body { color: #b9c2ce; font-size: 12px; }
.speak-log-row audio { width: 100%; height: 32px; margin-top: 6px; }

.wrong-list { display: flex; flex-direction: column; gap: 6px; }.wrong-empty { font-size: 13px; color: var(--muted); padding: 6px 0; }
.wrong-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #1b2028;
  border: 2px solid var(--line);
  box-shadow: inset 0 0 0 2px #333b47;
  font-size: 14px;
}
.wrong-item .wi-main { min-width: 0; }
.wrong-item .wi-main b { font-size: 15px; }
.wrong-item .wi-main small { display: block; font-size: 11px; color: var(--muted); line-height: 1.4; }
.wrong-item .wi-count {
  white-space: nowrap;
  flex: none;
  font: 800 12px ui-monospace, Consolas, monospace;
  color: #ffd479;
  background: #3a2c12;
  border: 2px solid #0b0e14;
  padding: 2px 7px;
}
.wrong-item .mc-btn { white-space: nowrap; }

.note-list { display: flex; flex-direction: column; gap: 6px; }
.note-item { font-size: 12px; line-height: 1.55; color: #c4cdd9; }
.note-item b { color: var(--ink); }
.note-item span { color: var(--muted); }

/* ---------- 跟我讲 ---------- */
.speak-panel { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.speak-tip { margin: 0; text-align: center; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.speak-card {
  padding: 14px 10px;
  text-align: center;
  background: #1a2a1c;
  border: 3px solid var(--line);
  box-shadow: inset 0 0 0 2px #3c5a35;
  border-radius: 4px;
}
.speak-emoji { font-size: 38px; line-height: 1.1; }
.speak-text {
  margin-top: 4px;
  font-size: clamp(24px, 7.2vw, 34px);
  font-weight: 900;
  line-height: 1.4;
  letter-spacing: 2px;
  word-break: break-word;
}
.speak-jp {
  margin-top: 2px;
  font: 700 13px ui-monospace, "SFMono-Regular", Consolas, monospace;
  color: var(--diamond);
  letter-spacing: .5px;
}
.speak-zh { margin-top: 3px; font-size: 13px; line-height: 1.5; color: #c4cdd9; }
.speak-controls { display: flex; align-items: stretch; gap: 10px; }
.speak-controls .speaker {
  flex: none;
  flex-direction: column;
  gap: 4px;
  padding: 10px 16px;
  font-size: 24px;
}
.speak-controls .speaker span { font-size: 12px; }
.record-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding: 12px 10px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .5px;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0,0,0,.4);
  background: linear-gradient(#d9715f, #96372a);
  border: 3px solid var(--line);
  border-radius: 4px;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.22), inset -2px -2px 0 rgba(0,0,0,.3), var(--shadow-btn);
  cursor: pointer;
}
.record-btn:active { transform: translateY(3px); box-shadow: inset 2px 2px 0 rgba(255,255,255,.16), 0 1px 0 #05070a; }
.record-btn:disabled { filter: grayscale(.45) brightness(.82); cursor: default; }
.record-btn .rec-ico { font-size: 24px; line-height: 1; }
.record-btn.recording {
  background: linear-gradient(#e8695a, #a52f22);
  animation: recPulse 1s ease-in-out infinite;
}
@keyframes recPulse { 50% { filter: brightness(1.38); } }
.speak-timer {
  text-align: center;
  font: 800 13px ui-monospace, "SFMono-Regular", Consolas, monospace;
  color: #ffd479;
}
.speak-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.speak-tools:empty { display: none; }
.speak-tools .mc-btn { width: auto; margin: 0; padding: 9px 14px; font-size: 14px; }
.speak-feedback { min-height: 0; margin-top: 0; }
.speak-feedback:empty { display: none; }
.speak-feedback .mc-btn { width: auto; min-width: 0; padding: 9px 14px; font-size: 14px; margin-top: 0; }
.fb-heard {
  font-size: 12.5px;
  line-height: 1.5;
  color: #d9d2c2;
  padding: 5px 8px;
  background: #1b2028;
  border: 2px solid #333b47;
  border-radius: 3px;
}
.fb-homo { display: block; font-size: 10.5px; color: #8fa1b5; margin-top: 2px; letter-spacing: .2px; }
.fb-live { min-height: 1.4em; font-size: 15px; font-weight: 700; color: var(--diamond); }
.fb-score { font-size: 11px; color: #7f8b9a; letter-spacing: .3px; }
.speak-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
}
.speak-dots .sblock.cur { border-color: var(--gold); box-shadow: inset 0 0 0 2px #3a2c12, 0 0 0 2px rgba(242,193,78,.35); }
.speak-dots .sblock.tried { background: #3a2c12; box-shadow: inset 0 0 0 2px #5a4520; }
.speak-summary { text-align: center; padding: 22px 16px; }
.speak-summary h2 { margin: 8px 0 4px; font-size: 26px; letter-spacing: 2px; }
.speak-summary .result-sub { margin-bottom: 10px; }
.speak-sum-stars { margin-bottom: 16px; font-size: 21px; letter-spacing: 1px; color: var(--gold); line-height: 1.5; word-break: break-all; }

/* ---------- 宽屏 ---------- */
@media (min-width: 700px) {
  :root { --u: clamp(12px, 2.2vw, 18px); }
  .app { width: min(100%, 720px); }
  #view-home.active {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-areas:
      "bar bar"
      "scene daily"
      "hot hot"
      "tip tip";
    align-content: start;
  }
  #view-home .topbar { grid-area: bar; }
  #view-home .scene { grid-area: scene; }
  #view-home .daily { grid-area: daily; align-self: start; }
  #view-home .hotbar { grid-area: hot; }
  #view-home .foot-tip { grid-area: tip; }
  .q-prompt { min-height: 140px; }
  .option { min-height: 84px; }
}

/* ---------- 宽屏横放（手机横屏 / 矮窗口）：把物品栏收进右栏，整屏不滚动 ---------- */
@media (min-width: 700px) and (max-height: 560px) {
  :root { --u: clamp(8px, 4.1vh, 15px); }
  .app { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  #view-home.active {
    gap: 8px;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-areas:
      "bar bar"
      "scene daily"
      "scene hot"
      "tip tip";
  }
  .scene .moon { top: 8px; right: 12px; width: 18px; height: 18px; }
  .house-wrap { min-height: 0; padding: 8px 6px 0; }
  .scene-caption { padding: 6px 10px 7px; font-size: 14px; }
  .scene-sub { font-size: 11px; }
  .ground { height: 16px; }
  .daily { padding: 10px 12px; }
  .daily-head h1 { font-size: 18px; }
  .daily-desc { margin-bottom: 8px; font-size: 12px; }
  .mc-btn { padding: 10px 14px; font-size: 15px; margin-bottom: 8px; }
  .hotbar { align-self: start; }
  .slot { padding: 6px 8px; }
  .slot-body b { font-size: 15px; }
  .foot-tip { display: none; }

  /* 答题页横放：题目在左、选项在右，不滚动 */
  body[data-view="quiz"] .app { height: 100dvh; min-height: 0; }
  #view-quiz { gap: 8px; min-height: 0; }
  .quiz-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "kind kind"
      "prompt options"
      "feedback options"
      "blocks blocks";
    gap: 6px 12px;
    padding: 10px 12px;
    align-content: start;
    min-height: 0;
  }
  .q-kind { grid-area: kind; }
  .q-prompt { grid-area: prompt; min-height: 0; padding: 0; gap: 5px; overflow-y: auto; }
  .q-prompt .speaker { padding: 8px 14px; font-size: 20px; border-width: 2px; }
  .q-prompt .speaker.big { min-width: 0; }
  .q-prompt .speaker span { font-size: 12px; }
  .q-prompt .big-emoji { font-size: 40px; }
  .q-prompt .big-zh { font-size: 22px; letter-spacing: 1px; }
  .q-prompt .ask { font-size: 12px; }
  .q-prompt .rhyme { padding: 0; background: none; border: 0; box-shadow: none; }
  .q-prompt .rhyme-title { font-size: 14px; margin-bottom: 2px; }
  .q-prompt .rhyme-line { font-size: 13px; line-height: 1.55; }
  /* 答题后把歌词收起，给反馈区留出高度 */
  body[data-answered="1"] .q-prompt .rhyme-lines { display: none; }
  .options { grid-area: options; margin: 0; gap: 8px; align-content: start; }
  .option { min-height: 54px; padding: 6px; }
  .option .opt-word { font-size: 17px; }
  .option .opt-emoji { font-size: 20px; }
  .option.text-only { min-height: 54px; }
  .option.text-only .opt-word { font-size: 15px; }
  .feedback { grid-area: feedback; min-height: 0; margin: 0; overflow-y: auto; gap: 3px; }
  .feedback .fb-actions { position: sticky; bottom: 0; background: var(--panel); padding: 3px 0 1px; box-shadow: 0 -6px 8px rgba(0,0,0,.22); }
  .feedback .fb-title { font-size: 15px; }
  .feedback .fb-jp { font-size: 11px; line-height: 1.25; }
  .feedback .fb-zh { font-size: 12px; line-height: 1.3; }
  .feedback .fb-note { font-size: 11px; line-height: 1.3; }
  .feedback .mc-btn { padding: 6px 14px; font-size: 13px; margin-top: 2px; }
  .session-blocks { grid-area: blocks; margin: 0; padding: 0; }
  .sblock { width: 18px; height: 18px; }

  /* 跟读页横放：示范卡在左，录音和反馈在右 */
  body[data-view="speak"] .app { height: 100dvh; min-height: 0; }
  #view-speak { gap: 8px; min-height: 0; }
  .speak-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "tip tip"
      "card controls"
      "card timer"
      "card tools"
      "feedback feedback"
      "dots dots";
    gap: 6px 12px;
    padding: 10px 12px;
    align-content: start;
    min-height: 0;
  }
  .speak-tip { grid-area: tip; font-size: 11px; }
  .speak-card { grid-area: card; align-self: start; padding: 8px 6px; }
  .speak-emoji { font-size: 26px; }
  .speak-text { font-size: 21px; line-height: 1.35; letter-spacing: 1px; }
  .speak-jp { font-size: 11px; }
  .speak-zh { font-size: 11px; }
  .speak-controls { grid-area: controls; align-self: start; gap: 8px; }
  .speak-controls .speaker { padding: 6px 10px; font-size: 18px; border-width: 2px; }
  .speak-controls .speaker span { font-size: 11px; }
  .record-btn { padding: 8px 6px; font-size: 13px; border-width: 2px; }
  .record-btn .rec-ico { font-size: 19px; }
  .speak-timer { grid-area: timer; font-size: 11px; }
  .speak-tools { grid-area: tools; }
  .speak-tools .mc-btn { padding: 6px 10px; font-size: 12px; }
  .speak-feedback { grid-area: feedback; overflow-y: auto; gap: 3px; }
  .speak-feedback .fb-title { font-size: 15px; }
  .speak-feedback .fb-note { font-size: 11px; line-height: 1.35; }
  .speak-feedback .mc-btn { padding: 6px 12px; font-size: 12px; }
  .speak-dots { grid-area: dots; margin: 0; padding: 0; }
}

/* ---------- 矮屏 ---------- */
@media (max-height: 620px) {
  .q-prompt { min-height: 84px; }
  .q-prompt .big-emoji { font-size: 42px; }
  .q-prompt .big-zh { font-size: 28px; }
  .option { min-height: 62px; }
  .feedback { min-height: 64px; }
  .house-wrap { padding-top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
