/* ===========================================================
   乘法小怪兽 —— 明亮、立体、卡通、童话世界
   =========================================================== */

:root {
  --sky: #7fd4ff;
  --sky2: #cdf1ff;
  --grass: #7ed957;
  --blue: #2196f3;
  --blue-d: #1565c0;
  --red: #ff5252;
  --red-d: #c62828;
  --green: #43c04a;
  --green-d: #2e7d32;
  --yellow: #ffc107;
  --yellow-d: #e08a00;
  --purple: #9c56d6;
  --purple-d: #6a1b9a;
  --grey: #b0bec5;
  --grey-d: #78909c;
  --ink: #2d3a4a;
  --card: #ffffff;
  --radius: 22px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky2) 55%, #eafff0 100%);
  overflow-x: hidden;
  user-select: none;
  /* 平板上别下拉刷新、别橡皮筋回弹 */
  overscroll-behavior: none;
}

/* 平板上去掉双击缩放带来的 300ms 点击延迟 */
button {
  touch-action: manipulation;
}

/* ---------- 背景：天空、太阳、云、山、草地 ---------- */
#sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* 太阳做成柔和光晕，避免和顶部条上的星星金币挤在一起 */
#sky .sun {
  position: absolute;
  top: -70px;
  left: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  font-size: 0;
  background: radial-gradient(circle, rgba(255, 245, 157, .95) 26%, rgba(255, 241, 118, .45) 52%, rgba(255, 241, 118, 0) 72%);
}

#sky .cloud {
  position: absolute;
  width: 140px;
  height: 46px;
  background: #fff;
  border-radius: 40px;
  opacity: .85;
  filter: blur(.2px);
}

#sky .cloud::before,
#sky .cloud::after {
  content: '';
  position: absolute;
  background: #fff;
  border-radius: 50%;
}

#sky .cloud::before {
  width: 62px;
  height: 62px;
  left: 22px;
  top: -28px;
}

#sky .cloud::after {
  width: 44px;
  height: 44px;
  right: 24px;
  top: -18px;
}

#sky .c1 {
  top: 60px;
  left: -160px;
  animation: drift 48s linear infinite;
}

#sky .c2 {
  top: 150px;
  left: -300px;
  transform: scale(.7);
  animation: drift 66s linear infinite;
}

#sky .c3 {
  top: 24px;
  left: -520px;
  transform: scale(1.2);
  animation: drift 86s linear infinite;
}

#sky .hills {
  position: absolute;
  bottom: 60px;
  left: -5%;
  width: 110%;
  height: 180px;
  background:
    radial-gradient(60% 100% at 20% 100%, #8ee06a 0 70%, transparent 71%),
    radial-gradient(50% 100% at 60% 100%, #6fcf58 0 70%, transparent 71%),
    radial-gradient(55% 100% at 90% 100%, #9be87a 0 70%, transparent 71%);
}

#sky .grass {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: linear-gradient(180deg, var(--grass), #57c23a);
}

@keyframes drift {
  to {
    transform: translateX(140vw);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 布局 ---------- */
#app {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  /* 平板刘海屏 / 全屏模式下留出安全区 */
  padding: calc(10px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(60px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
}

.screen {
  animation: screen-in .28s ease;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

.center {
  text-align: center;
}

.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}

.muted {
  color: #78909c;
  font-size: 15px;
}

/* ---------- 顶部条 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.topbar-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .18), 0 0 10px rgba(255, 255, 255, .4);
  letter-spacing: 1px;
}

.icon-btn {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 4px 0 #cfd8dc;
  cursor: pointer;
}

.icon-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #cfd8dc;
}

.icon-btn.ghost {
  visibility: hidden;
}

.stats {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.stat {
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 3px 0 #cfd8dc;
  white-space: nowrap;
}

/* ---------- 按钮 ---------- */
.btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 28px;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  letter-spacing: 1px;
  transition: transform .06s;
  background: var(--blue);
  box-shadow: 0 6px 0 var(--blue-d), 0 10px 18px rgba(0, 0, 0, .16);
}

.btn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--blue-d);
}

.btn-blue {
  background: var(--blue);
  box-shadow: 0 6px 0 var(--blue-d), 0 10px 18px rgba(0, 0, 0, .16);
}

.btn-red {
  background: var(--red);
  box-shadow: 0 6px 0 var(--red-d), 0 10px 18px rgba(0, 0, 0, .16);
}

.btn-green {
  background: var(--green);
  box-shadow: 0 6px 0 var(--green-d), 0 10px 18px rgba(0, 0, 0, .16);
}

.btn-yellow {
  background: var(--yellow);
  color: #6b4a00;
  box-shadow: 0 6px 0 var(--yellow-d), 0 10px 18px rgba(0, 0, 0, .16);
}

.btn-purple {
  background: var(--purple);
  box-shadow: 0 6px 0 var(--purple-d), 0 10px 18px rgba(0, 0, 0, .16);
}

.btn-grey {
  background: var(--grey);
  box-shadow: 0 6px 0 var(--grey-d);
}

.btn.big {
  font-size: 24px;
  padding: 16px 34px;
}

.btn.huge {
  font-size: 30px;
  padding: 20px 48px;
  animation: breathe 1.8s ease-in-out infinite;
}

@keyframes breathe {

  50% {
    transform: scale(1.05);
  }
}

/* ---------- 卡片 / 面板 ---------- */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .08), 0 12px 24px rgba(0, 0, 0, .08);
}

.panel-title {
  font-size: 19px;
  font-weight: 900;
  margin-bottom: 10px;
}

/* ---------- 数字形象小卡 ---------- */
.chip-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.chip-row .plus {
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}

.digit-chip {
  background: #fff;
  border-radius: 18px;
  padding: 8px 10px;
  text-align: center;
  min-width: 62px;
  box-shadow: 0 4px 0 #cfd8dc;
}

.digit-chip.big {
  min-width: 92px;
  padding: 12px;
}

.dc-icon {
  font-size: 28px;
  line-height: 1;
}

.digit-chip.big .dc-icon {
  font-size: 44px;
}

.dc-num {
  font-size: 22px;
  font-weight: 900;
  color: var(--blue-d);
}

.digit-chip.big .dc-num {
  font-size: 30px;
}

.dc-name {
  font-size: 12px;
  color: #78909c;
}

/* ---------- 小怪兽 ---------- */
.monster {
  position: relative;
  width: 130px;
  height: 130px;
  margin: 0 auto;
  animation: idle 1.6s ease-in-out infinite;
}

.monster.big {
  width: 170px;
  height: 170px;
}

@keyframes idle {

  50% {
    transform: translateY(-8px) rotate(-2deg);
  }
}

.monster .body {
  position: absolute;
  left: 12%;
  top: 14%;
  width: 76%;
  height: 74%;
  border-radius: 46% 46% 42% 42%;
  background: var(--mc, #ab47bc);
  box-shadow: inset -8px -10px 0 rgba(0, 0, 0, .12), 0 8px 16px rgba(0, 0, 0, .2);
}

.monster.kind-purple {
  --mc: #a259e0;
}

.monster.kind-green {
  --mc: #4fc46a;
}

.monster.kind-orange {
  --mc: #ffa726;
}

.monster .horn {
  position: absolute;
  top: 2%;
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 26px solid var(--mc, #ab47bc);
  filter: brightness(.9);
}

.monster .horn.l {
  left: 22%;
  transform: rotate(-16deg);
}

.monster .horn.r {
  right: 22%;
  transform: rotate(16deg);
}

.monster .eyes {
  display: flex;
  gap: 14px;
  justify-content: center;
  padding-top: 26%;
}

.monster .eye {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  position: relative;
  box-shadow: inset 0 2px 2px rgba(0, 0, 0, .15);
}

.monster .eye::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #263238;
  left: 6px;
  top: 8px;
  animation: look 3s ease-in-out infinite;
}

@keyframes look {

  40% {
    transform: translateX(4px);
  }

  70% {
    transform: translateX(-3px);
  }
}

.monster .mouth {
  width: 34px;
  height: 16px;
  margin: 8px auto 0;
  background: #4a148c;
  border-radius: 0 0 20px 20px;
  box-shadow: inset 0 -4px 0 rgba(255, 255, 255, .25);
}

.monster .tag {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  font-size: 15px;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 3px 0 #cfd8dc;
  white-space: nowrap;
}

.monster .hold {
  position: absolute;
  font-size: 30px;
  bottom: 24%;
}

.monster .hold.left {
  left: -6px;
  transform: rotate(-18deg);
  animation: wave 1.4s ease-in-out infinite;
}

.monster .hold.right {
  right: -6px;
  transform: rotate(18deg);
  animation: wave 1.4s ease-in-out infinite reverse;
}

@keyframes wave {

  50% {
    transform: rotate(0) translateY(-4px);
  }
}

.monster .feet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 22px;
}

.monster .feet i {
  width: 26px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .25);
}

/* ---------- BOSS ---------- */
.boss {
  position: relative;
  text-align: center;
  animation: idle 2s ease-in-out infinite;
}

.boss .crown {
  font-size: 32px;
  line-height: 1;
}

.boss-body {
  width: 150px;
  height: 130px;
  margin: -6px auto 0;
  border-radius: 46% 46% 38% 38%;
  position: relative;
  box-shadow: inset -10px -12px 0 rgba(0, 0, 0, .15), 0 10px 20px rgba(0, 0, 0, .25);
}

.boss-body .eyes {
  display: flex;
  gap: 18px;
  justify-content: center;
  padding-top: 30px;
}

.boss-body .eye {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  position: relative;
}

.boss-body .eye::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #b71c1c;
  left: 7px;
  top: 9px;
}

.fang-mouth {
  width: 56px;
  height: 20px;
  margin: 10px auto 0;
  background: #3e2723;
  border-radius: 0 0 16px 16px;
  position: relative;
  display: flex;
  justify-content: space-around;
}

.fang-mouth i {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 12px solid #fff;
}

.boss-emoji {
  position: absolute;
  right: -14px;
  bottom: 4px;
  font-size: 34px;
}

.boss-name {
  margin-top: 6px;
  font-weight: 900;
  font-size: 18px;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}

/* ---------- 生命值 ---------- */
.hearts {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.heart {
  font-size: 24px;
  font-style: normal;
  transition: transform .2s;
}

.heart.empty {
  opacity: .55;
  filter: grayscale(1);
}

.heart.breaking {
  animation: heart-break .4s ease;
}

@keyframes heart-break {
  40% {
    transform: scale(1.6) rotate(12deg);
  }

  100% {
    transform: scale(1);
  }
}

/* ---------- 进度条 ---------- */
.progress {
  position: relative;
  height: 18px;
  background: rgba(0, 0, 0, .12);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0;
}

.progress .bar {
  height: 100%;
  background: linear-gradient(90deg, #ffd54f, #ffb300);
  border-radius: 999px;
  transition: width .4s;
}

.progress .ptext {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 18px;
  color: #3e2723;
}

/* ---------- 状态徽标 ---------- */
.status-tag {
  font-size: 14px;
}

/* ===========================================================
   理解阶段：小火车
   =========================================================== */
.learn-head {
  text-align: center;
  margin-bottom: 8px;
}

.big-question {
  font-size: 34px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 0 rgba(0, 0, 0, .2);
}

.learn-head .sub {
  color: #37474f;
  background: rgba(255, 255, 255, .75);
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  margin-top: 8px;
  font-size: 15px;
}

.trains {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}

.cart {
  background: #fff;
  border-radius: 18px;
  padding: 10px;
  min-width: 118px;
  text-align: center;
  box-shadow: 0 5px 0 #cfd8dc;
  cursor: pointer;
  transition: transform .12s;
}

.cart:active {
  transform: translateY(4px);
}

.cart .apples {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  min-height: 44px;
  opacity: .25;
  transition: opacity .3s;
}

.cart.opened .apples {
  opacity: 1;
}

.cart .apple {
  font-size: 18px;
  font-style: normal;
}

.cart-body {
  font-size: 32px;
  line-height: 1.1;
}

.cart-num {
  display: inline-block;
  font-size: 15px;
  font-weight: 900;
  color: var(--blue-d);
  background: #e3f2fd;
  border-radius: 999px;
  padding: 2px 10px;
}

.cart .wheels {
  display: flex;
  justify-content: center;
  gap: 26px;
}

.cart .wheels i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #455a64;
}

.cart.opened {
  box-shadow: 0 5px 0 var(--green-d);
  background: #f1fff0;
}

/* 白底深色文字，保证在浅色草地上也看得清 */
.sum-line {
  text-align: center;
  font-size: 26px;
  font-weight: 900;
  color: var(--ink);
  background: rgba(255, 255, 255, .88);
  border-radius: 999px;
  padding: 8px 18px;
  max-width: 460px;
  margin: 0 auto;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .08);
}

.sum-line b {
  color: var(--red-d);
  font-size: 32px;
}

.formula {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0;
}

.formula .fl {
  background: #fff;
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 4px 0 #cfd8dc;
}

.formula .fl.eq {
  background: transparent;
  box-shadow: none;
  color: #fff;
}

.formula .fl.big {
  font-size: 34px;
  color: var(--red-d);
}

/* ===========================================================
   记忆动画
   =========================================================== */
.anim-stage {
  min-height: 190px;
  background: linear-gradient(180deg, #fff8e1, #ffe0b2);
  border-radius: var(--radius);
  margin: 12px 0;
  padding: 14px;
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, .12);
  overflow: hidden;
}

.anim-stage.mini {
  min-height: 130px;
  padding: 8px;
}

.anim-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 110px;
}

.anim-item {
  position: relative;
  text-align: center;
}

.anim-item .ai-icon {
  font-size: 54px;
  line-height: 1;
}

.anim-stage.mini .ai-icon {
  font-size: 40px;
}

.anim-item .ai-num {
  font-size: 22px;
  font-weight: 900;
  color: var(--purple-d);
}

.anim-item.drop {
  animation: a-drop .5s cubic-bezier(.3, 1.6, .5, 1);
}

.anim-item.pop {
  animation: a-pop .45s cubic-bezier(.2, 1.8, .4, 1);
}

.anim-item.slideIn {
  animation: a-slide .5s ease-out;
}

.anim-item.fly {
  animation: a-fly .6s cubic-bezier(.2, 1.6, .4, 1);
}

.anim-item.floatUp {
  animation: a-float .6s ease-out;
}

.anim-item.chop {
  animation: a-chop .5s ease-out;
}

@keyframes a-drop {
  from {
    transform: translateY(-160px) rotate(-25deg);
    opacity: 0;
  }
}

@keyframes a-pop {
  from {
    transform: scale(0);
  }

  70% {
    transform: scale(1.25);
  }
}

@keyframes a-slide {
  from {
    transform: translateX(-180px) rotate(-15deg);
    opacity: 0;
  }
}

@keyframes a-fly {
  from {
    transform: translateY(60px) scale(.2);
    opacity: 0;
  }
}

@keyframes a-float {
  from {
    transform: translateY(70px);
    opacity: 0;
  }
}

@keyframes a-chop {
  from {
    transform: scale(2.2) rotate(20deg);
    opacity: 0;
  }
}

.anim-caption {
  text-align: center;
  font-size: 19px;
  font-weight: 800;
  color: #5d4037;
  min-height: 26px;
}

.anim-final {
  font-size: 40px;
  font-weight: 900;
  color: var(--red-d);
  text-shadow: 0 3px 0 #fff, 0 6px 14px rgba(0, 0, 0, .2);
  animation: a-pop .5s cubic-bezier(.2, 1.8, .4, 1);
}

.replay-box {
  margin-top: 10px;
}

/* ===========================================================
   答题
   =========================================================== */
.quiz-top {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  flex-wrap: wrap;
}

.pill {
  background: rgba(255, 255, 255, .9);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .1);
}

.pill.combo {
  background: #fff3e0;
  color: #e65100;
}

.enemy {
  text-align: center;
  margin: 4px 0 6px;
}

.taunt {
  display: inline-block;
  background: #fff;
  border-radius: 16px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 4px 0 #cfd8dc;
  position: relative;
}

.taunt::after {
  content: '';
  position: absolute;
  top: -8px;
  left: 24px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 9px solid #fff;
}

.player-hp {
  margin-top: 6px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .2);
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.player-hp .hearts {
  margin: 0;
}

.player-hp .heart {
  font-size: 18px;
}

/* 题目：画面视觉中心 */
.question {
  text-align: center;
  margin: 10px 0 14px;
  font-weight: 900;
  line-height: 1.1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.question .q-num,
.question .q-op,
.question .qmark {
  font-size: 62px;
  color: #fff;
  text-shadow: 0 5px 0 rgba(0, 0, 0, .22), 0 0 18px rgba(255, 255, 255, .5);
}

.question .qmark {
  color: #ffe082;
  animation: breathe 1.4s ease-in-out infinite;
}

.question.koujue .kj {
  font-size: 58px;
  color: #fff;
  text-shadow: 0 5px 0 rgba(0, 0, 0, .22);
  letter-spacing: 6px;
}

.big-question .q-num {
  color: #fff;
}

.big-question .q-ans {
  color: #ffe082;
}

/* ---------- 答题区布局：竖屏上下、横屏（平板）左右 ---------- */
.quiz-body {
  display: grid;
  gap: 6px;
}

.quiz-stage {
  min-width: 0;
}

/* ---------- 数字键盘：孩子自己写答案 ---------- */
.answer-pad {
  width: 100%;
  max-width: 430px;
  margin: 6px auto 0;
}

.kp-display {
  background: #fff;
  border-radius: 22px;
  padding: 8px 16px 6px;
  text-align: center;
  border: 4px solid transparent;
  box-shadow: 0 7px 0 #b0bec5, 0 12px 20px rgba(0, 0, 0, .14);
  transition: border-color .15s, background .15s;
}

.kp-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 62px;
}

.kp-num {
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 2px;
  color: var(--blue-d);
}

.kp-display.empty .kp-num::before {
  content: '？';
  color: #cfd8dc;
}

.kp-caret {
  width: 6px;
  height: 44px;
  border-radius: 3px;
  background: var(--blue);
  animation: kp-blink 1s steps(1) infinite;
}

@keyframes kp-blink {
  50% {
    opacity: 0;
  }
}

.kp-tip {
  min-height: 20px;
  font-size: 15px;
  font-weight: 800;
  color: var(--grey-d);
}

.kp-display.right {
  border-color: var(--green);
  background: #eaf9ea;
  animation: a-pop .35s;
}

.kp-display.right .kp-num {
  color: var(--green-d);
}

.kp-display.wrong {
  border-color: var(--red);
  background: #ffecea;
  animation: shake-x .4s;
}

.kp-display.wrong .kp-num {
  color: var(--red-d);
  text-decoration: line-through;
  text-decoration-thickness: 4px;
}

/* 答错后把正确答案写进输入框 */
.kp-display.shown {
  border-color: var(--green);
  background: #eaf9ea;
  animation: a-pop .35s;
}

.kp-display.shown .kp-num {
  color: var(--green-d);
  text-decoration: none;
}

.kp-display.bump {
  animation: shake-x .3s;
}

.kp-display.right .kp-caret,
.kp-display.wrong .kp-caret,
.kp-display.shown .kp-caret {
  display: none;
}

.kp-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.kp-keys.locked {
  pointer-events: none;
  opacity: .9;
}

.kp-key {
  border: 0;
  min-height: 70px;
  border-radius: 20px;
  background: #fff;
  color: var(--blue-d);
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 7px 0 #b0bec5, 0 10px 16px rgba(0, 0, 0, .12);
  transition: transform .07s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kp-key:active {
  transform: translateY(6px);
  box-shadow: 0 1px 0 #b0bec5;
}

.kp-key.del {
  background: #ffe0b2;
  color: #e65100;
  font-size: 30px;
  box-shadow: 0 7px 0 #dfa14a, 0 10px 16px rgba(0, 0, 0, .12);
}

.kp-key.del:active {
  box-shadow: 0 1px 0 #dfa14a;
}

.kp-key.ok {
  background: var(--green);
  color: #fff;
  box-shadow: 0 7px 0 var(--green-d), 0 10px 16px rgba(0, 0, 0, .12);
}

.kp-key.ok:active {
  box-shadow: 0 1px 0 var(--green-d);
}

.kp-key.ok.off {
  background: #cfd8dc;
  box-shadow: 0 7px 0 #b0bec5;
}

@keyframes shake-x {

  25% {
    transform: translateX(-8px);
  }

  50% {
    transform: translateX(8px);
  }

  75% {
    transform: translateX(-5px);
  }
}

.feedback {
  min-height: 40px;
  text-align: center;
}

.fb {
  display: inline-block;
  background: #fff;
  border-radius: 16px;
  padding: 8px 14px;
  font-weight: 800;
  margin: 4px;
  box-shadow: 0 4px 0 #cfd8dc;
}

.fb.ok {
  background: #e8f5e9;
  color: var(--green-d);
}

.fb.miss {
  background: #fff8e1;
  color: #ef6c00;
}

.fb.monster-say {
  background: #f3e5f5;
  color: var(--purple-d);
}

/* 3 秒挑战倒计时 */
.timer-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff;
  border: 5px solid var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: var(--green-d);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .12);
}

.timer-ring.running {
  animation: tick 1s steps(1) infinite;
}

.timer-ring.over {
  border-color: var(--red);
  color: var(--red-d);
  animation: none;
}

/* 开始写答案就停表（超时的红色保留，别被覆盖） */
.timer-ring.done:not(.over) {
  border-color: var(--blue);
  color: var(--blue-d);
  animation: none;
}

@keyframes tick {
  50% {
    transform: scale(1.12);
  }
}

/* ===========================================================
   结算
   =========================================================== */
.result-card {
  background: #fff;
  border-radius: 26px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 8px 0 rgba(0, 0, 0, .1), 0 16px 30px rgba(0, 0, 0, .16);
}

.result-emoji {
  font-size: 64px;
}

.result-title {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 10px;
}

.result-table {
  width: 100%;
  max-width: 360px;
  margin: 0 auto 14px;
  border-collapse: collapse;
  font-size: 16px;
}

.result-table td {
  padding: 7px 6px;
  border-bottom: 2px dashed #eceff1;
  text-align: left;
  color: #607d8b;
}

.result-table td.v {
  text-align: right;
  font-weight: 900;
  color: var(--ink);
}

.defeated {
  margin: 10px 0;
}

.defeated .dt {
  font-weight: 800;
  margin-bottom: 6px;
}

.defeated .dl {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.dchip {
  background: #ede7f6;
  color: var(--purple-d);
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 800;
  font-size: 14px;
}

/* ===========================================================
   首页
   =========================================================== */
.hero {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, .9);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .08);
}

.knight {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe082, #ffb74d);
  position: relative;
  box-shadow: inset -4px -6px 0 rgba(0, 0, 0, .1);
  animation: idle 2.2s ease-in-out infinite;
}

.knight .k-hat {
  position: absolute;
  top: -16px;
  left: 12px;
  font-size: 26px;
}

.knight .k-face {
  position: absolute;
  left: 14px;
  top: 16px;
  font-size: 34px;
}

.knight .k-sword {
  position: absolute;
  right: -10px;
  bottom: -4px;
  font-size: 26px;
  transform: rotate(20deg);
}

.hero-text {
  flex: 1;
}

.hero-hi {
  font-size: 19px;
  font-weight: 900;
}

.hero-sub {
  font-size: 14px;
  color: #607d8b;
  margin: 2px 0 4px;
}

.headline {
  text-align: center;
  font-size: 27px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 0 rgba(0, 0, 0, .22);
  margin: 18px 0 6px;
}

.monster-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.m-card {
  background: #fff;
  border-radius: 20px;
  padding: 10px;
  width: 168px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 0 #cfd8dc, 0 12px 20px rgba(0, 0, 0, .1);
  transition: transform .1s;
}

.m-card:active {
  transform: translateY(5px);
}

.m-key {
  font-size: 26px;
  font-weight: 900;
  color: var(--purple-d);
}

.m-status {
  font-size: 13px;
  color: #78909c;
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.task-list {
  margin: 16px 0;
  background: rgba(255, 255, 255, .92);
  border-radius: var(--radius);
  padding: 8px 14px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .08);
}

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 2px dashed #eceff1;
  font-weight: 800;
}

.task-row:last-child {
  border-bottom: 0;
}

.task-row .tr-name {
  flex: 1;
}

.task-row .tr-num {
  color: #607d8b;
}

.task-row.done {
  color: var(--green-d);
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.nav-btn {
  border: 0;
  background: #fff;
  border-radius: 18px;
  padding: 12px 6px;
  cursor: pointer;
  box-shadow: 0 5px 0 #cfd8dc;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}

.nav-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #cfd8dc;
}

.nb-icon {
  font-size: 28px;
}

.nb-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

/* ===========================================================
   地图 / 关卡
   =========================================================== */
.island-title {
  text-align: center;
  color: var(--ink);
  font-weight: 900;
  font-size: 18px;
  background: rgba(255, 255, 255, .88);
  border-radius: 999px;
  padding: 8px 16px;
  max-width: 520px;
  margin: 0 auto 12px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .08);
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.area-card {
  background: #fff;
  border-radius: 20px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  border-bottom: 8px solid var(--area, #2196f3);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .12);
  transition: transform .1s;
}

.area-card:active {
  transform: translateY(4px);
}

.area-card.locked {
  filter: grayscale(.85);
  opacity: .8;
}

.area-card.castle {
  background: linear-gradient(180deg, #ede7f6, #fff);
}

.area-emoji {
  font-size: 40px;
}

.area-name {
  font-size: 19px;
  font-weight: 900;
}

.area-sub {
  font-size: 13px;
  color: #78909c;
  margin-bottom: 4px;
}

.area-clear {
  font-size: 13px;
  font-weight: 800;
  color: #ef6c00;
}

.chapter-head {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #fff;
  border-radius: var(--radius);
  padding: 12px;
  border-bottom: 8px solid var(--area, #2196f3);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .12);
}

.ch-emoji {
  font-size: 46px;
}

.ch-name {
  font-size: 22px;
  font-weight: 900;
}

.ch-sub {
  font-size: 14px;
  color: #78909c;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.level-card {
  background: #fff;
  border-radius: 18px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 5px 0 #cfd8dc;
  transition: transform .1s;
}

.level-card:active {
  transform: translateY(4px);
}

.level-card .lv-index {
  font-size: 11px;
  color: #90a4ae;
}

.level-card .lv-q {
  font-size: 25px;
  font-weight: 900;
  color: var(--blue-d);
}

.level-card .lv-stars {
  font-size: 13px;
  letter-spacing: 1px;
}

.level-card .lv-state {
  font-size: 11px;
  color: #78909c;
}

.level-card.s0 {
  background: #eceff1;
}

.level-card.s4 {
  background: #fff8e1;
  box-shadow: 0 5px 0 var(--yellow-d);
}

.boss-card {
  display: flex;
  gap: 14px;
  align-items: center;
  background: linear-gradient(180deg, #fff, #ffebee);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  border-bottom: 8px solid var(--area, #ef5350);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .14);
}

.boss-card.locked {
  filter: grayscale(.8);
}

.boss-card .bc-title {
  font-size: 21px;
  font-weight: 900;
}

.boss-card .bc-sub {
  font-size: 14px;
  color: #78909c;
}

.boss-card .bc-clear {
  font-size: 13px;
  color: #ef6c00;
  font-weight: 800;
}

.boss-card .boss {
  transform: scale(.7);
  transform-origin: center;
  width: 150px;
}

/* 卡片是浅色的，BOSS 名字要用深色 */
.boss-card .boss-name {
  color: var(--ink);
  text-shadow: none;
}

/* ===========================================================
   记忆地图
   =========================================================== */
.legend {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.legend span {
  background: rgba(255, 255, 255, .9);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
}

.mem-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  background: rgba(255, 255, 255, .55);
  padding: 6px;
  border-radius: 16px;
}

.mem-cell {
  aspect-ratio: 1;
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  background: #fff;
  overflow: hidden;
}

.mem-cell.head {
  background: transparent;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .2);
  font-size: 15px;
}

.mem-cell.v {
  cursor: pointer;
  position: relative;
}

.mem-cell.v::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: var(--m, 0%);
  background: linear-gradient(180deg, #a5d6a7, #66bb6a);
  opacity: .55;
}

.mem-cell .mc-p {
  position: relative;
  z-index: 1;
}

.mem-cell .mc-s {
  position: relative;
  z-index: 1;
  font-size: 8px;
  line-height: 1;
}

.mem-cell.v.s0 {
  background: #eceff1;
  color: #b0bec5;
}

.mem-cell.v.s4 {
  background: #fff8e1;
}

.mem-sum {
  text-align: center;
  color: var(--ink);
  font-weight: 800;
  background: rgba(255, 255, 255, .88);
  border-radius: 999px;
  padding: 8px 14px;
  margin: 12px auto;
  max-width: 520px;
  font-size: 15px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .08);
}

.fd-q {
  font-size: 34px;
  font-weight: 900;
  text-align: center;
  color: var(--blue-d);
}

.fd-kj {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  color: var(--red-d);
}

.fd-hint {
  text-align: center;
  background: #fff8e1;
  border-radius: 14px;
  padding: 8px;
  font-size: 14px;
  color: #6d4c41;
  margin: 8px 0;
}

/* ===========================================================
   徽章
   =========================================================== */
.badge-count {
  text-align: center;
  color: var(--ink);
  font-weight: 900;
  background: rgba(255, 255, 255, .88);
  border-radius: 999px;
  padding: 8px 14px;
  max-width: 300px;
  margin: 0 auto 10px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .08);
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.badge-item {
  background: #fff;
  border-radius: 18px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 5px 0 #cfd8dc;
}

.badge-item.locked {
  opacity: .6;
  filter: grayscale(.8);
}

.bi-icon {
  font-size: 34px;
}

.bi-name {
  font-weight: 900;
  font-size: 15px;
}

.bi-desc {
  font-size: 12px;
  color: #78909c;
}

/* ===========================================================
   家长模式
   =========================================================== */
.big-stat {
  font-size: 36px;
  font-weight: 900;
  color: var(--blue-d);
}

.ov-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.ov-box {
  border-radius: 14px;
  padding: 10px 4px;
  text-align: center;
  background: #eceff1;
}

.ov-box.ok {
  background: #e8f5e9;
}

.ov-box.mid {
  background: #fff8e1;
}

.ov-box.bad {
  background: #ffebee;
}

.ov-n {
  font-size: 26px;
  font-weight: 900;
}

.ov-l {
  font-size: 11px;
  color: #607d8b;
}

.fact-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.fchip {
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 900;
  background: #eceff1;
  font-size: 15px;
}

.fchip.ok {
  background: #e8f5e9;
  color: var(--green-d);
}

.fchip.bad {
  background: #ffebee;
  color: var(--red-d);
}

.rep-line {
  margin: 6px 0;
  font-size: 15px;
  color: #455a64;
}

.rep-line b {
  color: var(--ink);
  font-size: 17px;
}

.rep-line b.better {
  color: var(--green-d);
}

.week-bars {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  height: 110px;
  margin: 10px 0;
}

.wb {
  flex: 1;
  text-align: center;
}

.wb-bar {
  height: 74px;
  display: flex;
  align-items: flex-end;
  background: #eceff1;
  border-radius: 8px;
  overflow: hidden;
}

.wb-bar i {
  display: block;
  width: 100%;
  background: linear-gradient(180deg, #4fc3f7, #0288d1);
  border-radius: 8px 8px 0 0;
  min-height: 2px;
}

.wb-label {
  font-size: 10px;
  color: #78909c;
}

.wb-val {
  font-size: 11px;
  font-weight: 800;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 2px dashed #eceff1;
  font-weight: 800;
}

.switch {
  width: 56px;
  height: 30px;
  border-radius: 999px;
  background: #cfd8dc;
  position: relative;
  cursor: pointer;
  transition: background .2s;
}

.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: left .2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
}

.switch.on {
  background: var(--green);
}

.switch.on i {
  left: 29px;
}

/* ===========================================================
   训练场
   =========================================================== */
.mode-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  box-shadow: 0 6px 0 #cfd8dc, 0 12px 20px rgba(0, 0, 0, .1);
  transition: transform .1s;
}

.mode-card:active {
  transform: translateY(5px);
}

.mode-card.m1 {
  border-left: 10px solid var(--red);
}

.mode-card.m2 {
  border-left: 10px solid var(--blue);
}

.mode-card.m3 {
  border-left: 10px solid var(--purple);
}

.mc-icon {
  font-size: 38px;
}

.mc-name {
  font-size: 20px;
  font-weight: 900;
}

.mc-desc {
  font-size: 13px;
  color: #78909c;
}

.mc-go {
  margin-left: auto;
  font-size: 22px;
  color: #b0bec5;
}

.time-bar {
  height: 14px;
  background: rgba(255, 255, 255, .6);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0 10px;
}

.time-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #66bb6a, #ffca28, #ef5350);
  transition: width 1s linear;
}

.rapid-monster {
  min-height: 130px;
}

.rapid-monster .monster {
  width: 108px;
  height: 108px;
}

.match-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.match-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.match-tile {
  border: 0;
  border-radius: 16px;
  padding: 16px 8px;
  font-size: 28px;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  background: #fff;
  color: var(--blue-d);
  box-shadow: 0 5px 0 #b0bec5;
}

.match-tile.a {
  background: #fff8e1;
  color: #e65100;
}

.match-tile.sel {
  outline: 5px solid var(--blue);
  transform: scale(1.03);
}

.match-tile.gone {
  visibility: hidden;
  animation: a-pop .3s reverse;
}

.shake-tile {
  animation: shake-x .4s;
}

.pop-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pop-tile {
  border: 0;
  aspect-ratio: 1;
  border-radius: 16px;
  font-size: 21px;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  background: #fff;
  color: var(--purple-d);
  box-shadow: 0 5px 0 #b0bec5;
}

.pop-tile.a {
  background: #ffe0b2;
  color: #bf360c;
}

.pop-tile.sel {
  outline: 5px solid var(--purple);
}

.pop-tile.gone {
  visibility: hidden;
}

/* ===========================================================
   特效层
   =========================================================== */
#fx-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  overflow: hidden;
}

#fx-layer .modal-mask,
#fx-layer .badge-mask,
#fx-layer .toast {
  pointer-events: auto;
}

.confetti {
  position: absolute;
  top: -20px;
  border-radius: 2px;
  animation: fall linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(720deg);
  }
}

.burst {
  position: absolute;
  animation: burst-out .9s ease-out forwards;
}

@keyframes burst-out {
  to {
    transform: translate(var(--dx), var(--dy)) scale(.3);
    opacity: 0;
  }
}

.float-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .3);
  animation: float-up 1.2s ease-out forwards;
  white-space: nowrap;
}

.float-text.r1 {
  color: #ffd54f;
}

.float-text.r2 {
  color: #a5d6a7;
}

.float-text.r3 {
  color: #90caf9;
}

.float-text.r4 {
  color: #eeeeee;
}

@keyframes float-up {
  to {
    transform: translate(-50%, -140%);
    opacity: 0;
  }
}

.banner {
  position: absolute;
  left: 50%;
  top: 26%;
  transform: translate(-50%, -50%);
  font-size: 46px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 5px 0 #e65100, 0 0 26px rgba(255, 200, 0, .9);
  animation: a-pop .4s cubic-bezier(.2, 1.9, .4, 1);
  white-space: nowrap;
}

.banner.crit {
  color: #fff59d;
  font-size: 54px;
  text-shadow: 0 6px 0 #d84315, 0 0 34px #ff6f00;
}

.banner.out {
  animation: fade-out .5s forwards;
}

@keyframes fade-out {
  to {
    opacity: 0;
    transform: translate(-50%, -90%) scale(1.2);
  }
}

.glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 190, .85), transparent 60%);
  animation: fade-out .8s forwards;
}

.combo-pop {
  position: absolute;
  right: 8%;
  top: 34%;
  font-size: 30px;
  font-weight: 900;
  color: #ff6f00;
  text-shadow: 0 3px 0 #fff;
  animation: combo-in .5s cubic-bezier(.2, 1.9, .4, 1), fade-out .4s .8s forwards;
}

.combo-pop b {
  font-size: 44px;
  color: #e53935;
}

.combo-pop.big {
  font-size: 38px;
}

.combo-pop.big b {
  font-size: 58px;
}

.combo-pop.mega {
  font-size: 46px;
  color: #d500f9;
}

.combo-pop.mega b {
  font-size: 72px;
  color: #ff1744;
}

@keyframes combo-in {
  from {
    transform: scale(0) rotate(-20deg);
  }
}

.reward-pop {
  position: absolute;
  left: 50%;
  top: 62%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  animation: float-in .4s;
}

.reward-pop span {
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 900;
  font-size: 20px;
  box-shadow: 0 5px 0 #cfd8dc;
}

.reward-pop.out {
  animation: fade-out .6s forwards;
}

@keyframes float-in {
  from {
    transform: translate(-50%, 30px);
    opacity: 0;
  }
}

/* 弹窗 */
.modal-mask,
.badge-mask {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 45, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: auto;
}

.modal-card,
.badge-card {
  background: #fff;
  border-radius: 26px;
  padding: 20px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
}

.pop-in {
  animation: pop-in .35s cubic-bezier(.2, 1.7, .4, 1);
}

@keyframes pop-in {
  from {
    transform: scale(.6);
    opacity: 0;
  }
}

.modal-text {
  font-size: 15px;
  color: #455a64;
  line-height: 1.6;
}

.chest-anim {
  font-size: 66px;
  animation: idle 1.2s ease-in-out infinite;
}

.chest-title {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 6px;
}

.chest-item {
  font-size: 20px;
  font-weight: 900;
  margin: 10px 0 16px;
}

.ci-icon {
  font-size: 30px;
  margin-right: 6px;
}

.intro-emoji {
  font-size: 56px;
}

.badge-title {
  font-size: 20px;
  font-weight: 900;
  color: #ef6c00;
}

.badge-icon {
  font-size: 72px;
  animation: idle 1.4s ease-in-out infinite;
}

.badge-name {
  font-size: 24px;
  font-weight: 900;
}

.badge-desc {
  color: #78909c;
  margin-bottom: 14px;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  background: rgba(38, 50, 56, .94);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 800;
  max-width: 86%;
  text-align: center;
  animation: float-in .3s;
}

.toast.out {
  animation: fade-out .5s forwards;
}

/* 震屏 */
.shake {
  animation: sh .5s;
}

.shake-strong {
  animation: sh-strong .55s;
}

@keyframes sh {

  20% {
    transform: translate(-6px, 3px);
  }

  40% {
    transform: translate(5px, -3px);
  }

  60% {
    transform: translate(-4px, 2px);
  }

  80% {
    transform: translate(3px, -1px);
  }
}

@keyframes sh-strong {

  15% {
    transform: translate(-12px, 6px) rotate(-1deg);
  }

  30% {
    transform: translate(11px, -6px) rotate(1deg);
  }

  45% {
    transform: translate(-9px, 4px) rotate(-1deg);
  }

  60% {
    transform: translate(8px, -3px);
  }

  80% {
    transform: translate(-4px, 2px);
  }
}

/* ---------- 小屏适配 ---------- */
@media (max-width: 480px) {
  body {
    font-size: 16px;
  }

  .topbar-title {
    font-size: 19px;
  }

  .stat {
    font-size: 12px;
    padding: 5px 8px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .question .q-num,
  .question .q-op,
  .question .qmark {
    font-size: 50px;
  }

  .question.koujue .kj {
    font-size: 44px;
  }

  .kp-key {
    min-height: 62px;
    font-size: 32px;
    border-radius: 18px;
  }

  .kp-num {
    font-size: 48px;
  }

  .kp-slot {
    min-height: 54px;
  }

  .headline {
    font-size: 22px;
  }

  .m-card {
    width: 46%;
  }

  .nav-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .monster {
    width: 108px;
    height: 108px;
  }

  .pop-tile {
    font-size: 17px;
  }

  .match-tile {
    font-size: 23px;
  }
}

/* ---------- 平板适配 ---------- */

/* 平板横屏：左边怪兽和题目，右边键盘，整局不用滑动屏幕 */
@media (min-width: 760px) and (orientation: landscape) {
  .quiz-body {
    grid-template-columns: minmax(0, 1fr) 330px;
    grid-template-areas:
      "stage pad"
      "fb    pad";
    gap: 8px 24px;
    align-items: start;
  }

  .quiz-stage {
    grid-area: stage;
  }

  .quiz-pad {
    grid-area: pad;
  }

  .quiz-body > .feedback {
    grid-area: fb;
  }

  .quiz-pad .answer-pad {
    max-width: 330px;
    margin-top: 0;
  }

  .question {
    margin: 6px 0 10px;
  }

  .enemy {
    margin-bottom: 4px;
  }
}

/* 屏幕不高时（小平板 / 手机竖屏）把上半部分压紧，让键盘留在一屏里 */
@media (max-height: 900px) and (orientation: portrait) {
  .screen-quiz .monster,
  .screen-rapid .monster {
    width: 104px;
    height: 104px;
  }

  .screen-quiz .question,
  .screen-rapid .question {
    margin: 4px 0 8px;
  }

  .screen-quiz .chip-row,
  .screen-rapid .chip-row {
    margin: 4px 0;
  }

  .screen-quiz .answer-pad,
  .screen-rapid .answer-pad {
    margin-top: 0;
  }

  .kp-keys {
    gap: 8px;
  }
}

/* 手指按的键要够大 */
@media (min-width: 820px) {
  .kp-key {
    min-height: 78px;
    font-size: 40px;
  }

  .kp-key.del {
    font-size: 34px;
  }

  .kp-num {
    font-size: 62px;
  }

  .kp-slot {
    min-height: 68px;
  }
}

/* 平板竖屏：键盘居中、再大一点 */
@media (min-width: 700px) and (orientation: portrait) {
  .answer-pad {
    max-width: 480px;
  }

  .kp-keys {
    gap: 14px;
  }
}
