/* 趣学法 · 多邻国式游戏化法考 · MVP */
:root {
  --green: #58cc02;
  --green-dark: #46a302;
  --green-bg: #d7ffb8;
  --red: #ff4b4b;
  --red-dark: #d33131;
  --red-bg: #ffdfe0;
  --blue: #1cb0f6;
  --blue-dark: #1899d6;
  --blue-bg: #ddf4ff;
  --gold: #ffc800;
  --ink: #3c3c3c;
  --ink-soft: #777;
  --line: #e5e5e5;
  --locked: #c9c9c9;
  --locked-dark: #a9a9a9;
  --bg: #f7f7fb;
  --card: #ffffff;
  --boss: #ce82ff;
  --boss-dark: #a855e0;
  --revive: #ff9600;
  --revive-dark: #e08600;
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

button { font-family: inherit; }

/* ---------- 通用按钮（多邻国式厚底按钮） ---------- */
.btn {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform .05s, box-shadow .05s;
}
.btn:active { transform: translateY(4px); box-shadow: none !important; }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-dark); }
.btn-blue    { background: var(--blue);  color: #fff; box-shadow: 0 4px 0 var(--blue-dark); }
.btn-red     { background: var(--red);   color: #fff; box-shadow: 0 4px 0 var(--red-dark); }
.btn-ghost   { background: var(--card);  color: var(--blue); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.btn[disabled] { background: var(--line); color: #afafaf; box-shadow: 0 4px 0 #d8d8d8; cursor: not-allowed; }

/* ---------- 启动页 ---------- */
.splash {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
}
.splash-logo { font-size: 72px; animation: bounce 1.2s infinite; }
.splash-name { font-size: 34px; font-weight: 900; color: var(--green); letter-spacing: 4px; }
.splash-tag  { font-size: 15px; color: var(--ink-soft); }
.splash-loading { margin-top: 24px; font-size: 13px; color: var(--ink-soft); }
.splash-error { margin-top: 24px; font-size: 14px; color: var(--red); padding: 0 32px; text-align: center; line-height: 1.6; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* ---------- 科目选择页 ---------- */
.subject-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px;
}
.subject-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: transform .05s;
}
.subject-card:active { transform: translateY(2px); border-bottom-width: 2px; }
.subject-emoji {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; flex: none;
  color: #fff;
}
.subject-info { flex: 1; text-align: left; }
.subject-name { font-size: 17px; font-weight: 800; }
.subject-progress { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.subject-arrow { font-size: 22px; color: var(--ink-soft); font-weight: 700; }

.pending-section { padding: 24px 16px 8px; }
.pending-title { font-size: 14px; font-weight: 800; color: var(--ink-soft); margin-bottom: 10px; }
.pending-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.pending-tag {
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
  background: var(--card); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px;
}

.back-btn {
  background: none; border: 0; font-size: 26px;
  color: var(--ink-soft); cursor: pointer; font-weight: 700;
  padding: 0 4px 0 0; line-height: 1;
}

/* ---------- 地图页 ---------- */
.map-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--card);
  border-bottom: 2px solid var(--line);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-name { font-size: 20px; font-weight: 900; color: var(--green); letter-spacing: 2px; }
.brand-tag { font-size: 11px; color: var(--ink-soft); }
.stats { display: flex; gap: 14px; font-weight: 800; font-size: 15px; }
.stat-streak { color: var(--revive); }
.stat-xp { color: var(--gold); }

.draft-banner {
  background: #fff8e1;
  border-bottom: 2px solid #ffe082;
  color: #8d6e00;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 16px;
  text-align: center;
}

.chapter-card {
  margin: 16px;
  background: var(--green);
  color: #fff;
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 4px 0 var(--green-dark);
}
.chapter-kicker { font-size: 12px; opacity: .85; font-weight: 700; letter-spacing: 2px; }
.chapter-title { font-size: 22px; font-weight: 900; margin-top: 2px; }
.chapter-progress { font-size: 13px; margin-top: 6px; opacity: .95; }

.path { display: flex; flex-direction: column; align-items: center; padding: 8px 0 40px; }
.node-wrap { display: flex; flex-direction: column; align-items: center; margin-top: 18px; }
.node {
  width: 78px; height: 78px;
  border-radius: 50%;
  border: 0;
  font-size: 30px;
  cursor: pointer;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: transform .05s;
}
.node:active { transform: translateY(4px); box-shadow: none !important; }
.node-open      { background: var(--green);  box-shadow: 0 6px 0 var(--green-dark); animation: pulse 1.6s infinite; }
.node-done      { background: var(--gold);   box-shadow: 0 6px 0 #d8a800; }
.node-locked    { background: var(--locked); box-shadow: 0 6px 0 var(--locked-dark); cursor: not-allowed; }
.node-boss      { background: var(--boss);   box-shadow: 0 6px 0 var(--boss-dark); }
.node-revive    { background: var(--revive); box-shadow: 0 6px 0 var(--revive-dark); }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.node-label { margin-top: 10px; font-weight: 800; font-size: 14px; text-align: center; max-width: 220px; }
.node-desc  { margin-top: 2px; font-size: 12px; color: var(--ink-soft); text-align: center; max-width: 240px; }
.node-stars { margin-top: 4px; font-size: 14px; letter-spacing: 2px; }
.star-on  { color: var(--gold); }
.star-off { color: #d0d0d0; }

.map-footer {
  padding: 20px 24px 36px;
  font-size: 11px;
  color: #9a9a9a;
  text-align: center;
  line-height: 1.8;
  border-top: 2px solid var(--line);
}

/* ---------- 答题页 ---------- */
.quiz { display: flex; flex-direction: column; min-height: 100vh; }
.quiz-top {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
}
.quiz-close {
  background: none; border: 0; font-size: 22px; color: #b0b0b0;
  cursor: pointer; font-weight: 700; padding: 4px;
}
.progress-track {
  flex: 1; height: 14px; border-radius: 8px; background: var(--line); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 8px; background: var(--green);
  transition: width .3s ease;
}
.quiz-hearts { font-size: 15px; font-weight: 800; color: var(--red); white-space: nowrap; }

.quiz-body { flex: 1; padding: 8px 16px 180px; }
.q-kicker { font-size: 12px; font-weight: 800; color: var(--blue); letter-spacing: 1px; margin-bottom: 8px; }
.q-stem {
  font-size: 18px; font-weight: 700; line-height: 1.6;
  background: var(--card); border: 2px solid var(--line);
  border-radius: 16px; padding: 16px;
  margin-bottom: 16px;
}
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  text-align: left;
  background: var(--card);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 16px;
  line-height: 1.5;
  cursor: pointer;
  display: flex; gap: 10px; align-items: flex-start;
}
.opt-key {
  flex: none;
  width: 26px; height: 26px; border-radius: 8px;
  border: 2px solid var(--line);
  font-size: 13px; font-weight: 800; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
}
.opt.sel { border-color: var(--blue); background: var(--blue-bg); }
.opt.sel .opt-key { border-color: var(--blue); color: var(--blue); }
.opt.correct { border-color: var(--green); background: var(--green-bg); }
.opt.correct .opt-key { border-color: var(--green); color: var(--green-dark); }
.opt.wrong { border-color: var(--red); background: var(--red-bg); animation: shake .3s; }
.opt.wrong .opt-key { border-color: var(--red); color: var(--red); }
.opt[disabled] { cursor: default; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.quiz-actions {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 2px solid var(--line);
}

/* 反馈弹层 */
.sheet {
  position: fixed; bottom: 0; left: 50%; transform: translate(-50%, 105%);
  width: 100%; max-width: 520px;
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  transition: transform .25s ease;
  z-index: 20;
  max-height: 72vh;
  overflow-y: auto;
}
.sheet.show { transform: translate(-50%, 0); }
.sheet-good { background: var(--green-bg); }
.sheet-bad  { background: var(--red-bg); }
.sheet-head { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 900; margin-bottom: 6px; }
.sheet-good .sheet-head { color: var(--green-dark); }
.sheet-bad  .sheet-head { color: var(--red-dark); }
.sheet-answer { font-size: 14px; font-weight: 800; margin-bottom: 8px; }
.sheet-explain { font-size: 14px; line-height: 1.7; color: var(--ink); background: rgba(255,255,255,.66); border-radius: 12px; padding: 12px; }
.sheet-basis { margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.draft-chip {
  display: inline-block; margin-top: 8px;
  font-size: 11px; font-weight: 800; color: #8d6e00;
  background: #fff3cd; border: 1px solid #ffe082;
  padding: 2px 8px; border-radius: 999px;
}
.sheet .btn { margin-top: 14px; }

/* ---------- 结算页 ---------- */
.result {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 24px; gap: 10px;
  position: relative; overflow: hidden;
}
.result-emoji { font-size: 76px; animation: bounce 1.2s infinite; }
.result-title { font-size: 28px; font-weight: 900; }
.result-sub { font-size: 15px; color: var(--ink-soft); line-height: 1.7; }
.result-stars { font-size: 40px; letter-spacing: 6px; margin: 6px 0; }
.chips { display: flex; gap: 10px; justify-content: center; margin: 8px 0 18px; flex-wrap: wrap; }
.chip {
  background: var(--card); border: 2px solid var(--line);
  border-radius: 999px; padding: 8px 16px;
  font-size: 14px; font-weight: 800;
}
.chip-xp { color: var(--gold); }
.chip-acc { color: var(--blue); }
.chip-streak { color: var(--revive); }
.result .btn { max-width: 320px; }
.result .btn + .btn { margin-top: 10px; }

.confetti {
  position: absolute; top: -30px;
  font-size: 22px;
  animation: fall linear forwards;
  pointer-events: none;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: .6; }
}
