/* ============================================================
   小芽奇境 · 复刻版  —  设计基础层
   色板取自原作：深林绿 / 奶油纸 / 暖金
   ============================================================ */

:root {
  --ink: #203f34;
  --ink-strong: #143427;
  --ink-soft: #5d7268;
  --ink-faint: #87988f;

  --cream: #fffbee;
  --paper: #fbf7ea;
  --paper-2: #f4f1e4;
  --sage: #eef2df;
  --sage-deep: #dfe6c9;

  --green: #24744c;
  --green-deep: #193e35;
  --green-deeper: #16372e;
  --green-soft: #7fae63;
  --leaf: #a7cf81;

  --gold: #ffc94d;
  --gold-deep: #e0a52c;
  --gold-soft: #ffe6a3;

  --clay: #d8845c;
  --berry: #c2557a;
  --sky: #6fb7d8;

  --line: #e2dcc6;
  --line-soft: #efe9d8;

  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 10px;

  --shadow-sm: 0 2px 6px #1d3b2c14;
  --shadow: 0 10px 26px #1d3b2c1a;
  --shadow-lift: 0 18px 40px #1d3b2c26;

  --font: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;

  --game-safe-left: max(12px, env(safe-area-inset-left));
  --game-safe-right: max(12px, env(safe-area-inset-right));
  --game-safe-top: max(10px, env(safe-area-inset-top));
  --game-safe-bottom: max(10px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper-2);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 800; }

a { color: inherit; text-decoration: none; }

button { font: inherit; color: inherit; }

:where(a, button, input, [tabindex]):focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  background: var(--cream);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 0 0 12px 0;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ---------- 按钮 ---------- */

.btn {
  --btn-bg: #fff;
  --btn-fg: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45em;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }

.btn--primary {
  --btn-bg: var(--green);
  --btn-fg: #fff;
  background-image: linear-gradient(180deg, #2d8a58, #1d6543);
  box-shadow: 0 6px 16px #1d65432e;
}
.btn--gold {
  --btn-bg: var(--gold);
  --btn-fg: #59400c;
  background-image: linear-gradient(180deg, #ffd66b, #f5b731);
}
.btn--ghost {
  background: #ffffffee;
  border-color: #ffffffcc;
  color: var(--ink);
  backdrop-filter: blur(6px);
}
.btn--outline {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
  box-shadow: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--sage);
  color: var(--green);
  letter-spacing: .02em;
}
.pill--en { background: #e4f0fb; color: #1f6591; }
.pill--math { background: #e9f4e2; color: #2f7233; }
.pill--zh { background: #fdeee2; color: #a4582a; }

/* ---------- 通用页头（学习中心 / 工作台 / 课堂 / 商城） ---------- */

.site-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 26px clamp(18px, 4vw, 60px) 10px;
  max-width: 1440px;
  margin: 0 auto;
}

.site-head__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 18px;
  border: 2px solid #dfe7cd;
  border-radius: 999px;
  background: #fdfcf4;
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease;
}
.site-head__back:hover { transform: translateX(-2px); box-shadow: var(--shadow); }

.site-head__titles { display: grid; gap: 2px; }
.site-head__kicker { font-size: 12px; font-weight: 700; letter-spacing: .16em; color: var(--ink-faint); }
.site-head__title {
  font-size: clamp(26px, 3vw, 40px);
  font-weight: 900;
  letter-spacing: .04em;
  color: var(--green-deep);
}

.page-body {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 60px) 64px;
}

.page-lede {
  margin: 6px 0 26px;
  color: #4e6357;
  font-size: clamp(14px, 1.15vw, 17px);
}

/* 成长点徽标（学习中心 / 关卡长廊 / 商城共用） */
.points-badge {
  margin-left: auto;
  display: grid;
  justify-items: end;
  padding: 8px 16px;
  background: #fdfbf2;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.points-badge strong { font-size: 20px; color: #b4791f; line-height: 1.15; }
.points-badge span { font-size: 11px; color: #87988f; font-weight: 700; }

/* 淡青绿渐变底，用于“学习中心 / 工作台”等页 */
.page--sage {
  min-height: 100dvh;
  background:
    radial-gradient(1200px 700px at 78% -10%, #ffffffcc, transparent 62%),
    radial-gradient(900px 600px at 8% 110%, #e3ecd0cc, transparent 60%),
    linear-gradient(160deg, #f2f6e6 0%, #eef3df 46%, #f7f6ea 100%);
}

/* ---------- 卡片 ---------- */

.card {
  background: #fdfbf2;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ---------- 弹层 ---------- */

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #10281f7a;
  backdrop-filter: blur(3px);
  animation: fadeIn .18s ease;
}
.modal-layer[hidden] { display: none; }

.modal {
  width: min(430px, 100%);
  max-height: min(86dvh, 720px);
  overflow: auto;
  background: var(--cream);
  border-radius: var(--radius-lg);
  border: 1px solid #f0e7cb;
  box-shadow: var(--shadow-lift);
  padding: 24px;
  animation: popIn .2s ease;
}
.modal h2 { font-size: 21px; color: var(--green-deep); }
.modal p { color: #55685d; font-size: 14px; }
.modal__close {
  margin-left: auto;
  display: block;
  border: 0;
  background: #f0ecda;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  color: var(--ink-soft);
}
.modal__field { display: grid; gap: 8px; margin: 16px 0; }
.modal__field label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.modal__field input {
  font: inherit;
  font-size: 17px;
  letter-spacing: .08em;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid #e6dfc8;
  background: #fffdf6;
  color: var(--ink);
}
.modal__field input:focus { border-color: var(--green-soft); outline: none; }
.modal__actions { display: flex; gap: 10px; margin-top: 18px; }
.modal__actions .btn { flex: 1; }

.plan-list { display: grid; gap: 10px; margin: 16px 0; }
.plan {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid #eae3cd;
  background: #fffdf6;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.plan[aria-pressed="true"] {
  border-color: var(--green-soft);
  background: #f2f8e9;
  box-shadow: 0 0 0 3px #a7cf8140;
}
.plan strong { font-size: 15px; }
.plan small { display: block; color: var(--ink-soft); font-size: 12px; font-weight: 400; }
.plan em { margin-left: auto; font-style: normal; font-weight: 900; color: var(--gold-deep); font-size: 17px; }

/* ---------- 提示 ---------- */

.toast-layer {
  position: fixed;
  left: 50%;
  bottom: max(26px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 200;
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
}
.toast {
  padding: 10px 20px;
  border-radius: 999px;
  background: #143427f2;
  color: #fff8e2;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow);
  animation: toastIn .22s ease;
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98) } to { opacity: 1; transform: none } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
