/* main.css — 全局样式、主题变量、布局 */
:root {
  --theme: #FF8C42;
  --theme-light: #FFF3E8;
  --theme-dark: #cc6a25;
  --ok: #2ecc71;
  --bad: #e74c3c;
  --ink: #2d3436;
  --muted: #8a8f99;
  --card: #ffffff;
  --bg1: #fff8f1;
  --bg2: #ffe9d6;
  --radius: 20px;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--theme-light) 60%, #ffffff);
  min-height: 100vh;
  font-size: 20px;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: var(--theme);
  color: #fff;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 10;
}
.topbar .left, .topbar .right { display: flex; align-items: center; gap: 10px; }
.topbar .title { font-size: 22px; font-weight: 700; }
.topbar .mascot { font-size: 30px; }
.icon-btn {
  background: rgba(255,255,255,.25); border: 0; color: #fff;
  width: 48px; height: 48px; border-radius: 14px; font-size: 24px; cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.4); }
.stars-pill {
  background: rgba(255,255,255,.25); border-radius: 999px;
  padding: 6px 14px; font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 6px;
}

/* ---------- 通用大按钮 ---------- */
.big-btn {
  min-height: 64px; padding: 12px 22px;
  border: 0; border-radius: 20px;
  background: #fff; color: var(--ink);
  font-size: 24px; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .12s ease, background .12s ease;
}
.big-btn:active { transform: scale(.96); }
.big-btn.primary { background: var(--theme); color: #fff; }
.big-btn.primary:hover { background: var(--theme-dark); }
.big-btn.ghost { background: var(--theme-light); color: var(--theme-dark); }
.big-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 主页 ---------- */
.home-wrap { max-width: 960px; margin: 0 auto; padding: 20px 16px 60px; }
.home-hero { text-align: center; margin: 10px 0 22px; }
.home-hero h1 { font-size: 34px; margin: 6px 0; }
.home-hero .sub { color: var(--muted); font-size: 18px; }

.stat-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 14px 0; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 12px 18px;
  box-shadow: var(--shadow); min-width: 110px; text-align: center;
}
.stat-card .num { font-size: 30px; font-weight: 800; color: var(--theme-dark); }
.stat-card .lbl { font-size: 15px; color: var(--muted); }

.daily-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(120deg, var(--theme), var(--theme-dark));
  color: #fff; border-radius: var(--radius); padding: 16px 20px; margin: 16px 0;
  box-shadow: var(--shadow);
}
.daily-banner .t { font-size: 22px; font-weight: 700; }
.daily-banner .d { font-size: 16px; opacity: .9; }
.daily-banner button { background: #fff; color: var(--theme-dark); border: 0; border-radius: 16px;
  padding: 12px 20px; font-size: 20px; font-weight: 700; cursor: pointer; }

.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 14px; }
.unit-card {
  background: #fff; border-radius: var(--radius); padding: 18px 12px;
  text-align: center; cursor: pointer; box-shadow: var(--shadow);
  border: 4px solid transparent; transition: transform .12s ease;
  position: relative;
}
.unit-card:hover { transform: translateY(-3px); }
.unit-card .m { font-size: 56px; }
.unit-card .n { font-size: 20px; font-weight: 700; margin-top: 6px; }
.unit-card .zn { font-size: 15px; color: var(--muted); }
.unit-card .bar { height: 8px; background: #eee; border-radius: 4px; margin-top: 10px; overflow: hidden; }
.unit-card .bar > i { display: block; height: 100%; background: var(--uc, var(--theme)); }
.unit-card .locked { position: absolute; top: 8px; right: 10px; font-size: 16px; }

.sticker-wall { margin-top: 24px; }
.sticker-wall h2 { font-size: 22px; }
.sticker-row { display: flex; flex-wrap: wrap; gap: 10px; }
.sticker {
  width: 64px; height: 64px; border-radius: 16px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; box-shadow: var(--shadow);
}
.sticker.empty { opacity: .35; filter: grayscale(1); }

/* ---------- 单元页 ---------- */
.stage-tabs {
  display: flex; gap: 10px; padding: 14px 16px; overflow-x: auto;
  background: #fff; box-shadow: var(--shadow);
}
.stage-tab {
  flex: 1; min-width: 80px; padding: 12px 8px; border-radius: 16px;
  background: var(--theme-light); color: var(--theme-dark);
  border: 3px solid transparent; font-size: 20px; font-weight: 700; cursor: pointer;
  text-align: center;
}
.stage-tab.active { background: var(--theme); color: #fff; border-color: #fff; }
.stage-tab .done { display: block; font-size: 14px; }

.game-area { max-width: 900px; margin: 0 auto; padding: 20px 16px 120px; min-height: 55vh; }

.subtabs { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.subtab {
  padding: 10px 22px; border-radius: 999px; background: #fff;
  border: 3px solid var(--theme-light); font-size: 19px; font-weight: 700; cursor: pointer; color: var(--ink);
}
.subtab.active { background: var(--theme); color: #fff; }

/* 底部阶段进度 */
.stage-progress {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 14px rgba(0,0,0,.06);
  display: flex; align-items: center; gap: 12px; z-index: 9;
}
.stage-progress .track { flex: 1; height: 12px; background: #eee; border-radius: 6px; overflow: hidden; }
.stage-progress .track > i { display: block; height: 100%; background: var(--theme); width: 0; transition: width .3s; }
.stage-progress .lbl { font-size: 16px; color: var(--muted); white-space: nowrap; }

/* ---------- 反馈动效 ---------- */
.highlight {
  background: #fff36b !important;
  transform: scale(1.12);
  transition: all .15s ease;
  border-radius: 8px;
}
.good { animation: bounceGood .55s ease; }
@keyframes bounceGood {
  0% { transform: scale(1); } 40% { transform: scale(1.18); background: #d4f7df; }
  100% { transform: scale(1); }
}
.shake { animation: shakeX .4s ease; }
@keyframes shakeX {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}
.bad { background: #ffd6d2 !important; }

/* 吉祥物浮层 */
#mascot-overlay {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%,-50%) scale(0);
  font-size: 120px; pointer-events: none; z-index: 99; transition: transform .3s ease;
}
#mascot-overlay.show { transform: translate(-50%,-50%) scale(1); animation: hop .9s ease; }
@keyframes hop {
  0%,100% { transform: translate(-50%,-50%) scale(1) translateY(0); }
  50% { transform: translate(-50%,-58%) scale(1.15) translateY(-20px); }
}

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: #fff; border-radius: 24px; padding: 26px 22px; max-width: 420px; width: 100%;
  text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.modal-box h2 { margin: 0 0 10px; }
.modal-box p { color: #555; }
.modal-row { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }

/* 通用标题 */
.game-title { font-size: 26px; font-weight: 800; text-align: center; margin: 6px 0 16px; }
.hint { text-align: center; color: var(--muted); font-size: 18px; margin-bottom: 10px; }

@media (max-width: 480px) {
  .unit-grid { grid-template-columns: repeat(2, 1fr); }
  .big-btn { font-size: 22px; }
}

/* ===== 册级 Tab ===== */
.book-tabs { display: flex; gap: 12px; margin: 16px 0 4px; }
.book-tab {
  flex: 1; padding: 14px 10px; border-radius: 20px;
  background: #fff; border: 4px solid transparent;
  font-size: 24px; font-weight: 800; color: var(--ink); cursor: pointer;
  box-shadow: var(--shadow);
}
.book-tab .book-en { display: block; font-size: 14px; color: var(--muted); font-weight: 500; }
.book-tab.active { background: var(--theme); color: #fff; border-color: #fff; }
.book-tab.active .book-en { color: rgba(255,255,255,.85); }

.unit-card .book-tag {
  position: absolute; top: 6px; left: 10px;
  background: var(--theme-light); color: var(--theme-dark);
  font-size: 13px; padding: 2px 8px; border-radius: 999px; font-weight: 700;
}

/* ===== 对话练习入口卡片 ===== */
.dialogue-entry {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(120deg, #E84393, #fd79a8);
  color: #fff; border-radius: 24px; padding: 18px 20px; margin: 14px 0;
  box-shadow: var(--shadow); cursor: pointer;
}
.dialogue-entry .de-emoji { font-size: 56px; }
.dialogue-entry .de-title { font-size: 26px; font-weight: 800; }
.dialogue-entry .de-sub { font-size: 15px; opacity: .9; }
.dialogue-entry .de-arrow { margin-left: auto; font-size: 34px; }

/* ===== 对话列表 ===== */
.dialogue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 14px; }
.dialogue-card {
  background: #fff; border-radius: 20px; padding: 18px 12px; text-align: center;
  box-shadow: var(--shadow); cursor: pointer; border: 4px solid transparent;
}
.dialogue-card:hover { transform: translateY(-3px); }
.dialogue-card .dc-scene { font-size: 56px; }
.dialogue-card .dc-title { font-size: 20px; font-weight: 800; margin-top: 6px; }
.dialogue-card .dc-en { font-size: 14px; color: var(--muted); }
.dialogue-card .dc-meta { font-size: 13px; color: #999; margin-top: 6px; }
