/* 幼师宝藏游戏·互动版 — 与游戏图卡同款视觉体系 */
:root {
  --bg: #fffaf0;
  --card: #fffdf7;
  --card-border: #eedaa8;
  --inner-border: #f0dfb8;
  --strip: #f6edda;
  --yellow: #f4b942;
  --green: #74b889;
  --green-deep: #7fc97f;
  --dot-yellow: #f9d76e;
  --dot-green: #a8cf74;
  --text-dark: #49301f;
  --text-brown: #8b6d52;
  --badge-text: #654b37;
  --red: #e8837a;
  --wave: #d99a42;
  --shadow: 0 6px 24px rgba(73, 48, 31, 0.10);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
#app { max-width: 520px; margin: 0 auto; padding: 14px 14px 40px; }

/* ---------- 装饰圆点 ---------- */
.deco-dots { position: fixed; pointer-events: none; z-index: 0; }
.deco-dots.c1 { top: 14px; left: 3%; width: 30px; height: 30px; border-radius: 50%; background: var(--dot-yellow); opacity: .8; }
.deco-dots.c2 { top: 18px; right: 4%; width: 22px; height: 22px; border-radius: 50%; background: var(--dot-green); opacity: .8; }
.deco-dots.c3 { bottom: 24px; left: 5%; width: 18px; height: 18px; border-radius: 50%; background: var(--dot-green); opacity: .7; }
.deco-dots.c4 { bottom: 36px; right: 4%; width: 28px; height: 28px; border-radius: 50%; background: var(--dot-yellow); opacity: .7; }

/* ---------- 顶部头卡 ---------- */
.topbar {
  position: relative; z-index: 1;
  background: var(--card);
  border: 4px solid var(--card-border);
  border-radius: 28px;
  padding: 14px 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}
.topbar h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.topbar .sub { margin-top: 4px; font-size: 13px; color: var(--text-brown); }
.badges { display: flex; gap: 8px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 700; color: #fff;
  background: var(--yellow); border-radius: 999px; padding: 4px 14px;
}
.badge.green { background: var(--green); }
.badge.plain { background: var(--strip); color: var(--badge-text); }

/* ---------- 精灵图格子裁切 ---------- */
.cell {
  background-repeat: no-repeat;
  /* 由 JS 按行内联设置 background-image / position / size */
  background-color: #fff;
  border: 3px solid var(--inner-border);
  border-radius: 20px;
}
.cell.big { width: min(72vw, 300px); aspect-ratio: 4/5; margin: 0 auto; }

/* ---------- 大题卡 ---------- */
.stage {
  position: relative; z-index: 1;
  margin-top: 14px;
  background: var(--card);
  border: 4px solid var(--card-border);
  border-radius: 32px;
  padding: 18px 14px 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.q-head { font-size: 20px; font-weight: 800; }
.q-hint { font-size: 13px; color: var(--text-brown); margin-top: 2px; }

/* ---------- 选项区 ---------- */
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.choice {
  background: var(--card);
  border: 3px solid var(--inner-border);
  border-radius: 22px;
  padding: 10px 6px 8px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-family: inherit;
}
.choice:active { transform: scale(.96); }
.choice .cell { width: 100%; aspect-ratio: 4/5; border-width: 0; border-radius: 16px; }
.choice .name { font-size: 16px; font-weight: 700; color: var(--text-dark); }
.choice.num .numtxt {
  font-size: 44px; font-weight: 800; color: var(--text-dark);
  width: 100%; aspect-ratio: 4/5; display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 16px;
}
.choice.correct { border-color: var(--green-deep); background: #f0f9ef; box-shadow: 0 0 0 4px rgba(127,201,127,.25); }
.choice.correct .name { color: #3e8a52; }
.choice.wrong { border-color: var(--red); animation: shake .4s; background: #fdf1ef; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}
.choice:disabled { cursor: default; }

/* ---------- 音频播放按钮 ---------- */
.playbtn {
  width: min(64vw, 250px); aspect-ratio: 1;
  margin: 12px auto 4px;
  border-radius: 50%;
  border: 6px solid var(--wave);
  background: radial-gradient(circle at 35% 30%, #ffe9c4, #f7cd7e 70%);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-size: 20px; font-weight: 800; color: var(--badge-text);
  transition: transform .12s ease;
}
.playbtn:active { transform: scale(.95); }
.playbtn .icon { font-size: 52px; line-height: 1; }
.playbtn.playing { animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(217,154,66,.45); } 50% { box-shadow: 0 0 0 18px rgba(217,154,66,0); } }
.soundwave { display: flex; gap: 5px; align-items: center; justify-content: center; height: 26px; }
.soundwave i {
  width: 6px; border-radius: 3px; background: var(--wave);
  animation: wave 1s ease-in-out infinite;
}
.soundwave i:nth-child(1) { height: 10px; animation-delay: 0s; }
.soundwave i:nth-child(2) { height: 20px; animation-delay: .15s; }
.soundwave i:nth-child(3) { height: 26px; animation-delay: .3s; }
.soundwave i:nth-child(4) { height: 18px; animation-delay: .45s; }
.soundwave i:nth-child(5) { height: 11px; animation-delay: .6s; }
@keyframes wave { 0%,100% { transform: scaleY(.55); } 50% { transform: scaleY(1.25); } }

/* ---------- 揭晓横幅 ---------- */
.banner {
  margin: 14px auto 0; width: fit-content;
  background: var(--green); color: #fff;
  border-radius: 999px; padding: 10px 28px;
  font-size: 22px; font-weight: 800; letter-spacing: 2px;
  animation: pop .35s cubic-bezier(.34,1.56,.64,1);
}
.banner.yellow { background: var(--yellow); }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- 进度点 ---------- */
.dots { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--strip); border: 2px solid var(--inner-border); }
.dots i.done { background: var(--dot-green); border-color: var(--green); }
.dots i.now { background: var(--dot-yellow); border-color: var(--yellow); transform: scale(1.25); }

/* ---------- 操作按钮 ---------- */
.btnrow { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.btn {
  font-family: inherit; font-size: 17px; font-weight: 800;
  border: none; border-radius: 999px; padding: 12px 30px;
  background: var(--yellow); color: #fff; cursor: pointer;
  box-shadow: var(--shadow); letter-spacing: 1px;
  transition: transform .12s ease, opacity .12s;
}
.btn:active { transform: scale(.95); }
.btn.green { background: var(--green); }
.btn.plain { background: var(--strip); color: var(--badge-text); }
.btn.ghost { background: #fff; color: var(--badge-text); border: 3px solid var(--inner-border); box-shadow: none; }
.btn[hidden] { display: none; }

/* ---------- 记忆翻板（谁躲起来了/缺少了什么） ---------- */
.memgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.memcard {
  background: var(--card); border: 3px solid var(--inner-border); border-radius: 18px;
  padding: 8px 4px 6px; text-align: center;
  transition: transform .3s, opacity .3s;
}
.memcard .cell { width: 100%; aspect-ratio: 4/5; border: 0; border-radius: 12px; }
.memcard .name { font-size: 14px; font-weight: 700; margin-top: 4px; }
.memcard.hidden-card { opacity: 0; transform: rotateY(90deg); pointer-events: none; }
.memcard.mystery { opacity: 1; transform: none; background: var(--strip); display: flex; align-items: center; justify-content: center; font-size: 44px; }
.covermask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(73, 48, 31, .92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: #fff; font-size: 24px; font-weight: 800; letter-spacing: 2px;
  animation: fadein .3s;
}
.covermask .emoji { font-size: 64px; animation: blink 1.2s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 规律序列 ---------- */
.seqrow { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.seqcell {
  width: min(15vw, 74px); aspect-ratio: 4/5;
  background-repeat: no-repeat; background-color: #fff;
  border: 3px solid var(--inner-border); border-radius: 14px;
}
.seqcell.qmark {
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800; color: var(--yellow);
  background: #fff7e2; border-style: dashed; border-color: var(--yellow);
}
.seqrule { margin-top: 10px; font-size: 13px; color: var(--text-brown); }

/* ---------- 接龙抽卡 ---------- */
.drawcard {
  width: min(66vw, 270px); aspect-ratio: 4/5; margin: 14px auto 0;
  position: relative; cursor: pointer;
  transition: transform .4s; transform-style: preserve-3d;
}
.drawcard .face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 24px; border: 4px solid var(--card-border);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--card); box-shadow: var(--shadow); padding: 10px;
}
.drawcard .face .cell { width: 86%; aspect-ratio: 4/5; border: 0; }
.drawcard .face .name { font-size: 22px; font-weight: 800; }
.drawcard .face.back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #ffe9bd, #f7cd7e 80%);
  font-size: 56px;
}
.drawcard.flipped { transform: rotateY(180deg); }
.usedrow { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 12px; min-height: 30px; }
.usedchip {
  font-size: 13px; font-weight: 700; color: var(--badge-text);
  background: var(--strip); border-radius: 999px; padding: 4px 12px;
  border: 2px solid var(--inner-border);
}
.usedchip .cell { display: none; }

/* ---------- 场景文字卡（交通工具第3关） ---------- */
.scenecard {
  background: #fff7e2; border: 3px dashed var(--yellow);
  border-radius: 22px; padding: 18px 16px; margin-top: 14px;
  font-size: 19px; font-weight: 700; line-height: 1.6; color: var(--text-dark);
}

/* ---------- 结算页 ---------- */
.result { text-align: center; padding: 26px 10px 10px; }
.result .stars { font-size: 54px; letter-spacing: 6px; }
.result .score { font-size: 20px; font-weight: 800; margin-top: 8px; }
.result .msg { font-size: 15px; color: var(--text-brown); margin-top: 8px; line-height: 1.6; }
.result .cell.big { margin-top: 14px; }

/* ---------- 目录页 ---------- */
.filters { display: flex; gap: 8px; justify-content: center; margin: 14px 0 4px; flex-wrap: wrap; position: relative; z-index: 1; }
.filters button {
  font-family: inherit; font-size: 14px; font-weight: 700;
  border: 2.5px solid var(--inner-border); background: #fff; color: var(--text-brown);
  border-radius: 999px; padding: 6px 16px; cursor: pointer;
}
.filters button.on { background: var(--yellow); border-color: var(--yellow); color: #fff; }
.gamegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; position: relative; z-index: 1; }
.gamecard {
  background: var(--card); border: 3px solid var(--card-border); border-radius: 22px;
  padding: 10px; cursor: pointer; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: var(--shadow);
}
.gamecard:active { transform: scale(.96); }
.gamecard .thumb {
  height: 96px; border-radius: 14px; border: 2px solid var(--inner-border);
  background-repeat: no-repeat; background-color: #fff;
}
.gamecard .t { font-size: 15px; font-weight: 800; line-height: 1.35; }
.gamecard .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.gamecard .meta span {
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 9px;
  background: var(--strip); color: var(--badge-text); border: 1.5px solid var(--inner-border);
}
.gamecard .meta span.age { background: var(--dot-yellow); border-color: var(--yellow); color: #fff; }
.footnote { text-align: center; font-size: 12px; color: var(--text-brown); margin-top: 18px; position: relative; z-index: 1; line-height: 1.8; }
.footnote a { color: var(--text-brown); }

/* ---------- 通用 ---------- */
.mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; }
.hidden { display: none !important; }
.tip { font-size: 13px; color: var(--text-brown); margin-top: 10px; line-height: 1.7; }

@media (min-width: 700px) {
  .gamegrid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 360px) {
  .choices { gap: 7px; }
  .choice .name { font-size: 14px; }
}
