/* 数苗 · 样式
   设计基线：1024×768 横屏（火火兔 I6 Plus）
   学龄前原则：大热区（≥80px）、高对比、圆角、无小字 */

:root {
  --green: #7BC96F;
  --green-dark: #5BA84F;
  --yellow: #FFD93D;
  --orange: #FF9F45;
  --blue: #4A9DEC;
  --pink: #FF8FA3;
  --purple: #B783E8;
  --cream: #FFF8E7;
  --ink: #4A3B2A;
  --ink-light: #8B7355;
  --shadow: 0 4px 0 rgba(0,0,0,.12);
  --radius: 24px;
}

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

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #2D3E2A;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color: var(--ink);
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}

#app { position: relative; width: 100%; height: 100%; }

/* ---------- 屏幕切换 ---------- */
.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  background: linear-gradient(180deg, #E8F5E0 0%, #D4EBC8 100%);
}
.screen.active { display: flex; }

/* ---------- 加载页 ---------- */
#loading { align-items: center; justify-content: center; gap: 16px; }
#loading .logo { font-size: 96px; animation: bob 1.4s ease-in-out infinite; }
#loading .title { font-size: 44px; font-weight: 800; color: var(--green-dark); letter-spacing: 8px; }
#loading .subtitle { font-size: 20px; color: var(--ink-light); }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-12px) } }

/* ---------- 首页 ---------- */
.home-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(6px);
}
.home-title { font-size: 30px; font-weight: 800; color: var(--green-dark); }
.home-stats { font-size: 24px; font-weight: 700; color: var(--orange); }

.level-map {
  flex: 1; overflow-y: auto;
  display: flex; flex-wrap: wrap; align-content: flex-start;
  gap: 20px; padding: 28px 32px;
}

.level-card {
  width: 200px; min-height: 190px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 18px;
  cursor: pointer;
  transition: transform .12s ease;
  position: relative;
}
.level-card:active { transform: scale(.96); }
.level-card .idx {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800;
  box-shadow: 0 3px 0 var(--green-dark);
}
.level-card .name { font-size: 19px; font-weight: 700; text-align: center; line-height: 1.3; }
.level-card .stars-mini { font-size: 22px; letter-spacing: 2px; height: 26px; }

.level-card.locked { background: #E8E8E8; opacity: .65; cursor: not-allowed; }
.level-card.locked .idx { background: #BDBDBD; box-shadow: 0 3px 0 #9E9E9E; }
.level-card.locked .name { color: #9E9E9E; }
.level-card .lock { position: absolute; top: 12px; right: 14px; font-size: 22px; }

.home-footer { padding: 12px 32px 20px; min-height: 60px; }

/* ---------- 游戏页 ---------- */
.game-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; gap: 16px;
  background: rgba(255,255,255,.5);
}
.level-name { font-size: 20px; font-weight: 700; color: var(--ink-light); min-width: 140px; text-align: right; }

.btn-icon {
  width: 56px; height: 56px; border-radius: 50%;
  border: none; background: #fff; color: var(--ink-light);
  font-size: 26px; cursor: pointer; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.btn-icon.small { width: 48px; height: 48px; font-size: 22px; }
.btn-icon:active { transform: scale(.94); }

.pips { display: flex; gap: 10px; }
.pip {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: inset 0 0 0 3px #CFE3C6;
}
.pip.done { background: var(--green); box-shadow: inset 0 0 0 3px var(--green); }
.pip.now  { background: var(--yellow); box-shadow: inset 0 0 0 3px var(--orange); }

.prompt-bar {
  display: flex; align-items: center; gap: 14px;
  margin: 10px 24px 0; padding: 14px 22px;
  background: rgba(255,255,255,.9);
  border-radius: 20px; box-shadow: var(--shadow);
}
#prompt-icon { font-size: 36px; }
#prompt-text { flex: 1; font-size: 27px; font-weight: 700; line-height: 1.3; }

/* 题面舞台 */
.stage {
  flex: 1; position: relative;
  display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
  gap: 14px; padding: 16px 30px;
}

.obj {
  width: 92px; height: 92px;
  display: flex; align-items: center; justify-content: center;
  font-size: 62px;
  cursor: pointer;
  transition: transform .1s ease;
  position: relative;
}
.obj:active { transform: scale(.9); }
.obj.tapped { opacity: .45; }
.obj .count-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: 15px; background: var(--orange); color: #fff;
  font-size: 17px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 0 rgba(0,0,0,.15);
}

/* 篮子（count-give 用） */
.basket {
  width: 240px; height: 170px; margin: 0 auto;
  border-radius: 0 0 30px 30px;
  background: repeating-linear-gradient(90deg, #D9A05B 0 14px, #C88F4A 14px 28px);
  box-shadow: inset 0 -8px 0 rgba(0,0,0,.15), var(--shadow);
  display: flex; flex-wrap: wrap; align-content: flex-end; justify-content: center;
  gap: 6px; padding: 10px;
  font-size: 40px;
}
.basket-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.basket-hint { font-size: 22px; font-weight: 700; color: var(--ink-light); }

/* 选项区 */
.options {
  display: flex; justify-content: center; gap: 26px;
  padding: 8px 24px 26px; min-height: 130px;
  flex-wrap: wrap; align-items: center;
}

.opt-btn {
  min-width: 140px; height: 112px; padding: 0 30px;
  border: none; border-radius: var(--radius);
  background: #fff; color: var(--ink);
  font-size: 56px; font-weight: 800;
  cursor: pointer; box-shadow: var(--shadow);
  transition: transform .1s ease;
  display: flex; align-items: center; justify-content: center;
}
.opt-btn:active { transform: scale(.95); }
.opt-btn.correct { background: var(--green); color: #fff; animation: pop .3s ease; }
.opt-btn.wrong   { background: var(--pink);  color: #fff; animation: shake .3s ease; }
@keyframes pop { 0% { transform: scale(1) } 50% { transform: scale(1.14) } 100% { transform: scale(1) } }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-10px)} 75%{transform:translateX(10px)} }

/* 反馈浮层 */
.feedback {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  pointer-events: none; font-size: 130px;
  text-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.feedback.show { display: flex; animation: fb 1s ease forwards; }
@keyframes fb {
  0%   { opacity: 0; transform: scale(.4) }
  30%  { opacity: 1; transform: scale(1.1) }
  70%  { opacity: 1; transform: scale(1) }
  100% { opacity: 0; transform: scale(1.2) }
}

/* ---------- 结算 ---------- */
#result { align-items: center; justify-content: center; }
.result-card {
  background: #fff; border-radius: 36px; padding: 44px 56px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  min-width: 520px;
}
.stars { font-size: 76px; letter-spacing: 10px; height: 92px; }
.stars span { display: inline-block; animation: starIn .4s ease backwards; }
.stars span:nth-child(1) { animation-delay: .1s }
.stars span:nth-child(2) { animation-delay: .3s }
.stars span:nth-child(3) { animation-delay: .5s }
@keyframes starIn { from { opacity:0; transform: scale(0) rotate(-90deg) } to { opacity:1; transform: scale(1) rotate(0) } }
.stars .dim { opacity: .22; filter: grayscale(1); }
.result-text { font-size: 28px; font-weight: 700; color: var(--ink-light); }
.sticker-badge {
  background: var(--yellow); color: #8A6D00;
  padding: 10px 24px; border-radius: 999px;
  font-size: 22px; font-weight: 800;
  animation: pop .5s ease;
}
.result-actions { display: flex; gap: 20px; margin-top: 8px; }

/* ---------- 按钮 ---------- */
.btn-primary, .btn-secondary, .btn-mini {
  border: none; cursor: pointer; font-weight: 800;
  border-radius: 999px; transition: transform .1s ease;
  font-family: inherit;
}
.btn-primary {
  padding: 18px 44px; font-size: 26px;
  background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-dark);
}
.btn-secondary {
  padding: 18px 44px; font-size: 26px;
  background: #fff; color: var(--ink-light); box-shadow: var(--shadow);
}
.btn-mini { padding: 10px 22px; font-size: 20px; background: #fff; box-shadow: var(--shadow); }
.btn-primary:active, .btn-secondary:active, .btn-mini:active { transform: scale(.95); }

/* ---------- 休息页 ---------- */
#rest { align-items: center; justify-content: center; background: linear-gradient(180deg,#FFE9C7,#FFD9A0); }
.rest-card {
  background: #fff; border-radius: 36px; padding: 48px 64px;
  display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center;
}
.rest-face { font-size: 90px; }
.rest-title { font-size: 34px; font-weight: 800; color: var(--orange); }
.rest-text { font-size: 22px; color: var(--ink-light); max-width: 460px; line-height: 1.5; }

/* ---------- 竖屏/小屏兜底 ---------- */
@media (orientation: portrait) {
  #app::after {
    content: "请把学习机横过来玩哦 🙃";
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: #2D3E2A; color: #fff; font-size: 26px; z-index: 999;
  }
}
