/* ==========================================================================
   九九星球 · 乘法口诀
   设计基调：奶油底色 + 星球糖果色，圆润大按钮，适合 iPad / 手机触摸
   ========================================================================== */

:root {
  --cream: #fff8ec;
  --paper: #ffffff;
  --ink: #25314a;
  --ink-soft: #5f6d8c;
  --ink-faint: #97a2b8;
  --line: rgba(37, 49, 74, 0.08);
  --line-strong: rgba(37, 49, 74, 0.14);

  --coral: #ff7a59;
  --coral-deep: #ea5a3d;
  --yellow: #ffc940;
  --mint: #37d6a4;
  --mint-deep: #1eb385;
  --sky: #5aa9ff;
  --violet: #9b8cff;
  --pink: #ff9ec4;

  --shadow-sm: 0 4px 16px rgba(37, 49, 74, 0.07);
  --shadow-md: 0 14px 38px rgba(37, 49, 74, 0.12);
  --shadow-lg: 0 24px 60px rgba(37, 49, 74, 0.16);

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

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --level-1: #ff9e7a;
  --level-2: #ffc940;
  --level-3: #37d6a4;
  --level-4: #5aa9ff;
  --level-5: #9b8cff;
  --level-6: #ff9ec4;
  --level-7: #4ec9e8;
  --level-8: #ffa94d;
  --level-9: #7bd16e;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 8% -12%, #ffe9d6 0%, rgba(255, 233, 214, 0) 62%),
    radial-gradient(900px 520px at 105% -8%, #e4f1ff 0%, rgba(228, 241, 255, 0) 58%),
    radial-gradient(900px 640px at 50% 118%, #e4fbf2 0%, rgba(228, 251, 242, 0) 60%),
    var(--cream);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(255, 197, 120, 0.55) 1.3px, transparent 1.4px),
    radial-gradient(rgba(150, 195, 255, 0.5) 1.1px, transparent 1.3px);
  background-size: 140px 140px, 200px 200px;
  background-position: 10px 20px, 70px 90px;
  opacity: 0.45;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3,
b,
strong {
  font-weight: 800;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
  -webkit-user-select: none;
  user-select: none;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(90, 169, 255, 0.7);
  outline-offset: 3px;
}

.app {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 max(16px, var(--safe-l)) calc(30px + var(--safe-b)) max(16px, var(--safe-r));
  position: relative;
}

.muted {
  color: var(--ink-faint);
  font-size: 13px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -16px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: rgba(255, 248, 236, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.topbar-titles {
  flex: 1;
  min-width: 0;
}

.topbar-titles h1 {
  font-size: 20px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-titles p {
  font-size: 12px;
  color: var(--ink-soft);
}

.icon-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transition: transform 0.14s ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn--ghost {
  background: transparent;
  box-shadow: none;
}

.icon-btn--soft {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #eef2f8;
  box-shadow: none;
  color: var(--ink-soft);
  font-size: 15px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-soft);
  white-space: nowrap;
}

.pill b {
  color: var(--ink);
  font-size: 16px;
}

.pill--star {
  background: #fff7e0;
}

.pill--streak {
  background: #fff0e9;
}

/* ---------- 首页 ---------- */
.home-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(16px + var(--safe-t)) 2px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  filter: drop-shadow(0 6px 12px rgba(120, 130, 255, 0.3));
}

.brand-text h1 {
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.brand-text p {
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.18em;
}

.header-pills {
  display: flex;
  gap: 8px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 14px;
  padding: 18px 18px 18px 12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #fff1c9 0%, #ffe3d3 48%, #e6f2ff 100%);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  isolation: isolate;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.85) 1.5px, transparent 1.6px);
  background-size: 46px 46px;
  opacity: 0.7;
  z-index: -1;
}

.hero-mascot {
  display: grid;
  place-items: center;
}

.mascot {
  width: 100%;
  max-width: 130px;
  height: auto;
  animation: mascot-float 4.2s ease-in-out infinite;
  filter: drop-shadow(0 12px 18px rgba(46, 199, 155, 0.28));
}

.mascot-eyes {
  transform-origin: 70px 73px;
  animation: mascot-blink 5.2s infinite;
}

.hero-bubble {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 20px 20px 20px 8px;
  padding: 15px 16px;
  box-shadow: 0 8px 24px rgba(37, 49, 74, 0.09);
}

.hero-bubble p {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.6;
  color: #37445f;
}

.hero-name {
  position: absolute;
  right: 14px;
  bottom: -10px;
  background: var(--mint);
  color: #0c4d3a;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  box-shadow: 0 4px 8px rgba(55, 214, 164, 0.35);
}

.hero-planet {
  position: absolute;
  border-radius: 50%;
  opacity: 0.55;
}

.hero-planet--1 {
  width: 46px;
  height: 46px;
  right: -10px;
  top: -12px;
  background: radial-gradient(circle at 32% 28%, #ffd86b, #ff9e7a);
}

.hero-planet--2 {
  width: 22px;
  height: 22px;
  left: 6px;
  bottom: 10px;
  background: radial-gradient(circle at 32% 28%, #a8d8ff, #5aa9ff);
}

/* ---------- 卡片 / 按钮 ---------- */
.card {
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 18px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #ff9a6b, #ff6f52);
  box-shadow: 0 10px 24px rgba(255, 111, 82, 0.32);
}

.btn-primary:hover {
  filter: brightness(1.03);
}

.btn-ghost {
  background: var(--paper);
  border: 1.5px solid var(--line-strong);
  color: var(--ink);
}

.btn-danger {
  background: linear-gradient(135deg, #ff8a7a, #f2544b);
  color: #fff;
  box-shadow: 0 10px 22px rgba(242, 84, 75, 0.28);
}

.btn-danger-ghost {
  color: #d94c4c;
  background: #fff2f1;
  border: 1.5px solid rgba(217, 76, 76, 0.18);
}

.btn-sm {
  min-height: 42px;
  padding: 0 14px;
  font-size: 14px;
  border-radius: 14px;
  gap: 4px;
  white-space: nowrap;
}

.btn-block {
  width: 100%;
}

/* ---------- 今日目标 ---------- */
.plan {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "ring text"
    "cta cta";
  align-items: center;
  gap: 12px 14px;
  margin-top: 14px;
  background: linear-gradient(160deg, #ffffff 0%, #fbfdff 100%);
}

.plan-ring {
  grid-area: ring;
  position: relative;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: conic-gradient(var(--mint) calc(var(--p) * 1%), #edf2f2 0);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.plan-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #fff;
}

.ring-inner {
  position: relative;
  text-align: center;
  line-height: 1;
}

.ring-inner b {
  display: block;
  font-size: 24px;
  font-weight: 900;
}

.ring-inner span {
  font-size: 10px;
  color: var(--ink-faint);
  font-weight: 700;
}

.plan-text {
  grid-area: text;
}

.plan-text h2 {
  font-size: 17px;
  margin-bottom: 2px;
}

.plan-text p {
  font-size: 13px;
  color: var(--ink-soft);
}

.plan-cta {
  grid-area: cta;
  width: 100%;
}

/* ---------- 安装提示 ---------- */
.install-tip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #eef6ff;
  border: 1px dashed rgba(90, 169, 255, 0.5);
  font-size: 13px;
  color: #35547a;
  line-height: 1.45;
}

.install-tip-icon {
  font-size: 22px;
}

.install-tip p {
  flex: 1;
}

.install-tip-close {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  color: var(--sky);
  padding: 6px 8px;
  border-radius: 8px;
  background: #fff;
}

/* ---------- 功能入口 ---------- */
.modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px;
  border-radius: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.mode-card:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-md);
}

.mode-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-size: 23px;
}

.mode-icon--coral {
  background: #ffefe9;
}

.mode-icon--violet {
  background: #f0edff;
}

.mode-icon--sky {
  background: #e9f3ff;
}

.mode-icon--yellow {
  background: #fff6d9;
}

.mode-icon--mint {
  background: #e3faf2;
}

.mode-icon--pink {
  background: #ffeff6;
}

.mode-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mode-title {
  font-size: 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mode-badge {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: var(--coral);
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.5;
}

.mode-desc {
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.45;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.stickers-card {
  margin-top: 14px;
}

.stickers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stickers-head h2 {
  font-size: 15px;
}

.sticker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sticker {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 24px;
  border-radius: 14px;
  background: #fff8e8;
  border: 1px solid rgba(255, 201, 64, 0.35);
}

.sticker--locked {
  background: #f3f5f9;
  border-color: var(--line);
  color: #c2c9d6;
  font-size: 18px;
  font-weight: 800;
}

.home-footer {
  margin-top: 22px;
  text-align: center;
}

.home-footer p {
  font-size: 11px;
  color: var(--ink-faint);
}

/* ---------- 通用页面 ---------- */
.page-lead {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.65;
  margin: 4px 2px 16px;
}

.page-lead b {
  color: var(--ink);
}

.tip-card {
  margin-top: 16px;
  background: #f4fbf7;
  border-color: rgba(55, 214, 164, 0.22);
}

.tip-card h2 {
  font-size: 15px;
  margin-bottom: 6px;
}

.tip-card p {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* ---------- 关卡列表 ---------- */
.level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.level-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px 12px;
  border-radius: 20px;
  background: linear-gradient(165deg, #fff 0%, var(--s) 100%);
  border: 1px solid color-mix(in srgb, var(--c) 26%, transparent);
  box-shadow: var(--shadow-sm);
  text-align: left;
  overflow: hidden;
  transition: transform 0.14s ease;
}

.level-card:active {
  transform: scale(0.96);
}

.level-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.level-number {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--c);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 45%, transparent);
}

.level-stars {
  font-size: 10px;
  color: #d9d2c0;
}

.star-row {
  display: inline-flex;
  gap: 1px;
  font-size: 12px;
  letter-spacing: 0;
}

.star-row span {
  color: #e3dfd4;
}

.star-row span.on {
  color: var(--yellow);
  text-shadow: 0 1px 2px rgba(240, 170, 0, 0.35);
}

.level-name {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 2px;
}

.level-progress {
  font-size: 11px;
  color: var(--ink-soft);
}

.level-progressbar {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  overflow: hidden;
  margin-top: 4px;
}

.level-progressbar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--c);
  transition: width 0.4s ease;
}

.level-card.is-done::after {
  content: "✓";
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--c);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

/* ---------- 关卡详情 ---------- */
.level-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff, var(--s));
  border: 1px solid color-mix(in srgb, var(--c) 25%, transparent);
  box-shadow: var(--shadow-sm);
}

.level-hero-badge {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--c);
  color: #fff;
  font-size: 27px;
  font-weight: 900;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--c) 42%, transparent);
}

.level-hero-text {
  flex: 1;
  min-width: 0;
}

.level-hero-text h2 {
  font-size: 19px;
}

.level-hero-text p {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.fact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.fact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.14s ease, background 0.2s ease;
}

.fact-row:active {
  transform: scale(0.985);
}

.fact-row.is-playing {
  background: #fff7e4;
  border-color: rgba(255, 201, 64, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 201, 64, 0.18);
}

.fact-mastery {
  flex: 0 0 auto;
}

.mastery {
  display: inline-flex;
  gap: 2px;
}

.mastery span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e6eaf1;
}

.mastery span.on {
  background: var(--mint);
}

.fact-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.fact-chant {
  font-size: 24px;
  letter-spacing: 0.04em;
  font-weight: 900;
}

.fact-eq {
  font-size: 13px;
  color: var(--ink-faint);
  font-weight: 700;
}

.fact-speaker {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #fff4e6;
  display: grid;
  place-items: center;
  font-size: 16px;
}

.sticky-cta {
  position: sticky;
  bottom: calc(10px + var(--safe-b));
  margin-top: 18px;
  padding: 10px;
  border-radius: 22px;
  background: rgba(255, 248, 236, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* ---------- 背口诀 ---------- */
.chant-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.control-group--row {
  gap: 10px;
}

.control-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: #f1f4f8;
}

.segmented button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
  transition: background 0.16s ease, color 0.16s ease;
}

.segmented button.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 10px rgba(37, 49, 74, 0.1);
}

.segmented--tabs {
  margin-bottom: 14px;
}

.segmented--tabs button {
  flex: 1;
  min-height: 44px;
  font-size: 15px;
}

.segmented--sm button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
}

.switch {
  position: relative;
  width: 52px;
  height: 31px;
  border-radius: 999px;
  background: #e3e8f0;
  transition: background 0.2s ease;
  flex: 0 0 auto;
}

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

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(37, 49, 74, 0.2);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.switch.is-on .switch-thumb {
  transform: translateX(21px);
}

.chant-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chant-level {
  background: var(--paper);
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}

.chant-level-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.chant-level-badge {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--c) 16%, white);
  color: var(--c);
  font-size: 15px;
  font-weight: 900;
}

.chant-level-head h2 {
  font-size: 15px;
  flex: 1;
}

.chant-level-count {
  font-size: 12px;
  color: var(--ink-faint);
}

.chant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fact-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 7px 11px;
  min-width: 74px;
  border-radius: 13px;
  background: #f7f9fc;
  border: 1.5px solid transparent;
  transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease;
}

.fact-chip:active {
  transform: scale(0.95);
}

.fact-chip.is-playing {
  background: #fff4d8;
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255, 201, 64, 0.18);
}

.fact-chip.is-mastered {
  background: #ecfaf4;
}

.fact-chip-text {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.fact-chip-eq {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-faint);
}

/* ---------- 答题 ---------- */
.quiz-wrap {
  max-width: 640px;
  margin: 0 auto;
}

.quiz-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 16px;
}

.bar {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: #edf1f5;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint), var(--sky));
  transition: width 0.35s ease;
}

.q-count {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  white-space: nowrap;
}

.quiz-stage {
  position: relative;
}

.quiz-buddy {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 22px auto 0;
  opacity: 0.85;
}

.quiz-buddy .mascot {
  width: 62px;
  max-width: 62px;
  animation: mascot-float 4.6s ease-in-out infinite;
  filter: none;
}

.quiz-buddy span {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-faint);
}

.q-card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  padding: 20px 18px 18px;
  animation: card-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.q-card.is-retry {
  border-color: rgba(255, 201, 64, 0.6);
}

.q-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.q-kicker {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

.q-retry {
  font-size: 11px;
  font-weight: 800;
  color: #b07a00;
  background: #fff4d8;
  padding: 2px 8px;
  border-radius: 999px;
}

.q-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.18em;
  font-size: clamp(46px, 12.5vw, 70px);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.15;
  padding: 10px 0 22px;
  font-variant-numeric: tabular-nums;
}

.q-op {
  color: var(--ink-faint);
  font-size: 0.72em;
}

.q-slot {
  display: inline-grid;
  place-items: center;
  min-width: 1.35em;
  height: 1.15em;
  padding: 0 0.12em;
  border-radius: 0.18em;
  background: #eef6ff;
  color: var(--sky);
  border: 3px solid rgba(90, 169, 255, 0.35);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.q-slot.has-typed {
  color: var(--ink);
  background: #fff;
}

.q-slot.is-correct {
  background: var(--mint);
  border-color: var(--mint);
  color: #fff;
}

.q-slot.is-reveal {
  background: #ffe9e6;
  border-color: #ffb4ab;
  color: #d94c4c;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice {
  min-height: 76px;
  border-radius: 20px;
  background: #f5f9ff;
  border: 1.5px solid rgba(90, 169, 255, 0.18);
  font-size: 30px;
  font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: transform 0.12s ease, background 0.16s ease, color 0.16s ease;
}

.choice:active {
  transform: scale(0.96);
}

.choice.correct {
  background: var(--mint);
  border-color: var(--mint);
  color: #fff;
  box-shadow: 0 8px 18px rgba(55, 214, 164, 0.35);
}

.choice.wrong {
  background: #ffe6e3;
  border-color: #ffb4ab;
  color: #d94c4c;
}

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

.key {
  min-height: 60px;
  border-radius: 18px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  box-shadow: 0 3px 10px rgba(37, 49, 74, 0.06);
  font-size: 25px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  transition: transform 0.12s ease, background 0.16s ease;
}

.key:active {
  transform: scale(0.95);
  background: #f3f7ff;
}

.key--soft {
  color: var(--ink-soft);
  font-size: 21px;
}

.key--confirm {
  background: linear-gradient(135deg, #4fe3b3, #23bf8c);
  border-color: transparent;
  color: #fff;
  font-size: 17px;
  box-shadow: 0 8px 18px rgba(35, 191, 140, 0.3);
}

.q-tools {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 16px;
}

.link-btn {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
  padding: 8px 10px;
  border-radius: 10px;
}

.link-btn:active {
  background: #f2f5f9;
}

.q-hint {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: #f7fbff;
  border: 1px dashed rgba(90, 169, 255, 0.4);
  animation: fade-up 0.22s ease both;
}

.q-hint .sheet-caption {
  margin-top: 8px;
}

.teach-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
  background: #fffaf0;
  border: 1.5px dashed #ffd79a;
  animation: fade-up 0.24s ease both;
}

.teach-kicker {
  font-size: 11px;
  font-weight: 800;
  color: #b07a00;
  letter-spacing: 0.08em;
  text-align: center;
}

.teach-chant {
  font-size: 30px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.06em;
  margin: 4px 0;
}

.teach-eq {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.teach-panel .array {
  margin: 8px auto 12px;
}

.star-burst {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
  font-weight: 900;
  color: #e6a100;
  pointer-events: none;
  animation: star-fly 0.85s ease-out forwards;
}

/* ---------- 60 秒挑战 ---------- */
.sprint-top {
  max-width: 640px;
  margin: 0 auto 14px;
}

.sprint-timebar {
  height: 14px;
  border-radius: 999px;
  background: #edf1f5;
  overflow: hidden;
}

.sprint-timebar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint), var(--sky), var(--violet));
  transition: width 0.12s linear;
}

.sprint-timebar i.is-hurry {
  background: linear-gradient(90deg, #ffb020, #f2544b);
  animation: hurry-pulse 0.8s ease-in-out infinite;
}

.sprint-meta {
  display: flex;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-top: 8px;
}

.sprint-meta span {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
  margin-right: 2px;
}

.q-card--sprint {
  padding-top: 16px;
}

.sprint-score-big {
  text-align: center;
  margin: 8px 0 4px;
  color: var(--coral-deep);
}

.sprint-score-big b {
  font-size: 74px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sprint-score-big span {
  font-size: 20px;
  font-weight: 800;
  margin-left: 4px;
}

/* ---------- 点阵图 ---------- */
.array {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: max(3px, 1.1vw);
  width: min(100%, calc(var(--cols) * 36px));
  margin: 0 auto;
}

.array i {
  display: block;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #ffd86b, #ffa14a 78%);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
  animation: dot-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.array i.row-1 {
  background: radial-gradient(circle at 34% 28%, #8cf0cd, #2ec79b 78%);
}

.array--small {
  width: min(100%, calc(var(--cols) * 26px));
  gap: 3px;
}

/* ---------- 口诀表 ---------- */
.mt-wrap {
  padding: 12px 10px 14px;
}

.mt {
  display: grid;
  grid-template-columns: minmax(26px, 1.1fr) repeat(9, minmax(28px, 1fr));
  gap: 4px;
  width: 100%;
}

.mt-corner,
.mt-head {
  display: grid;
  place-items: center;
  font-size: clamp(10px, 2.6vw, 14px);
  font-weight: 900;
  color: #fff;
  background: #7f8ca6;
  border-radius: 8px;
  aspect-ratio: 1;
}

.mt-corner {
  background: #5b6880;
  color: #fff;
  font-size: 11px;
}

.mt-head--row {
  background: #8b98b1;
}

.mt-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: clamp(10px, 2.7vw, 15px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: #f2f5f9;
  color: #a2adc0;
  border: 1.5px solid transparent;
  transition: transform 0.12s ease;
}

.mt-cell:active {
  transform: scale(0.92);
}

.mt-cell--1 {
  background: #f0f7ff;
  color: #4d86c4;
  border-color: rgba(90, 169, 255, 0.25);
}

.mt-cell--2 {
  background: #e7f2ff;
  color: #2f6fb8;
  border-color: rgba(90, 169, 255, 0.35);
}

.mt-cell--3 {
  background: #fff3d4;
  color: #a97400;
  border-color: rgba(255, 201, 64, 0.5);
}

.mt-cell--4 {
  background: linear-gradient(145deg, #5ce3b7, #25c08d);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(37, 192, 141, 0.28);
}

.mt-cell.is-diag {
  outline: 2px solid rgba(155, 140, 255, 0.55);
  outline-offset: -2px;
}

.mt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--ink-soft);
}

.mt-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lg {
  width: 11px;
  height: 11px;
  border-radius: 4px;
  display: inline-block;
}

.lg--0 {
  background: #eef1f6;
}

.lg--1 {
  background: #e7f2ff;
  border: 1px solid rgba(90, 169, 255, 0.4);
}

.lg--3 {
  background: #fff3d4;
  border: 1px solid rgba(255, 201, 64, 0.6);
}

.lg--4 {
  background: linear-gradient(145deg, #5ce3b7, #25c08d);
}

.mt-hint {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 10px;
  line-height: 1.55;
}

.chart-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f2fdf9, #fff);
}

.chart-progress b {
  display: block;
  font-size: 15px;
}

.chart-progress span {
  font-size: 12px;
  color: var(--ink-soft);
}

.chart-progress-icon {
  font-size: 26px;
}

/* ---------- 结果页 ---------- */
.result-wrap {
  max-width: 560px;
  margin: 6px auto 0;
  text-align: center;
}

.result-mascot {
  width: 150px;
  margin: 0 auto -6px;
}

.result-mascot .mascot {
  animation: mascot-cheer 1.4s ease-in-out infinite;
}

.result-title {
  font-size: 25px;
  letter-spacing: 0.01em;
}

.result-level-stars {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: var(--ink-soft);
}

.result-level-stars .star-row {
  font-size: 30px;
}

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

.result-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-stat b {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.result-stat span {
  font-size: 11px;
  color: var(--ink-faint);
  font-weight: 700;
}

.result-rewards {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.reward-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  background: #fff7e0;
  border: 1px solid rgba(255, 201, 64, 0.4);
  font-size: 16px;
  font-weight: 900;
  color: #a97400;
}

.reward-pill em {
  font-style: normal;
  font-size: 11px;
  color: #b08928;
}

.reward-sticker {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 18px;
  background: #fff3f8;
  border: 1px solid rgba(255, 158, 196, 0.4);
  text-align: left;
}

.sticker-big {
  font-size: 34px;
}

.reward-sticker b {
  display: block;
  font-size: 13px;
}

.reward-sticker div span {
  font-size: 11px;
  color: var(--ink-soft);
}

.reward-sticker .sticker-big {
  font-size: 34px;
  line-height: 1;
}

.reward-streak {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
}

.result-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-actions-row {
  display: flex;
  gap: 10px;
}

.result-actions-row .btn {
  flex: 1;
}

/* ---------- 家长看板 ---------- */
.parent-intro {
  background: linear-gradient(135deg, #f0f7ff, #fff);
  margin-bottom: 12px;
}

.parent-intro h2 {
  font-size: 16px;
  margin-bottom: 6px;
}

.parent-intro p {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.65;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-card b {
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat-card b em {
  font-style: normal;
  font-size: 13px;
  color: var(--ink-faint);
  font-weight: 800;
}

.stat-card span {
  font-size: 12px;
  color: var(--ink-soft);
}

.card + .card {
  margin-top: 12px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-head h2 {
  font-size: 16px;
}

.heat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.heat-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.heat-legend i {
  width: 11px;
  height: 11px;
  border-radius: 4px;
}

.hb-0 {
  background: #eef1f6;
}

.hb-1 {
  background: #dfeeff;
}

.hb-2 {
  background: #cfe5ff;
}

.hb-3 {
  background: #ffe9b8;
}

.hb-4 {
  background: #9aedd3;
}

.hb-5 {
  background: #4dd8ac;
}

.heat-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.heat-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.heat-level {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--c) 16%, white);
  color: var(--c);
  font-size: 13px;
  font-weight: 900;
}

.heat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.heat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 8px;
  border-radius: 10px;
  min-width: 62px;
}

.heat-chip b {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.heat-chip i {
  display: block;
}

.heat-chip .mastery span {
  background: rgba(255, 255, 255, 0.6);
}

.heat-chip .mastery span.on {
  background: rgba(255, 255, 255, 0.95);
}

.day-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
}

.day-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  height: 100%;
}

.day-val {
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-soft);
}

.day-bar {
  width: 100%;
  max-width: 30px;
  min-height: 4px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--sky), var(--violet));
  transition: height 0.4s ease;
}

.day-label {
  font-size: 9px;
  color: var(--ink-faint);
  font-weight: 700;
  white-space: nowrap;
}

.settings-card .setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.settings-card .setting-row:first-of-type {
  border-top: 0;
  padding-top: 2px;
}

.setting-row--stack {
  flex-direction: column;
  align-items: stretch !important;
  gap: 8px !important;
}

.setting-text {
  flex: 1;
  min-width: 0;
}

.setting-text b {
  display: block;
  font-size: 14px;
}

.setting-text span {
  display: block;
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.45;
  margin-top: 1px;
}

.settings-card .btn-danger-ghost {
  margin-top: 14px;
  min-height: 46px;
  font-size: 14px;
}

.method-card h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

.method-card ol {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.65;
}

.method-card li {
  margin-bottom: 6px;
}

.method-card li b {
  color: var(--ink);
}

.method-card .muted {
  margin-top: 8px;
  line-height: 1.55;
}

/* ---------- 底部抽屉 ---------- */
.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 32, 50, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.sheet {
  position: relative;
  width: min(560px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--paper);
  border-radius: 28px 28px 0 0;
  padding: 24px 20px calc(24px + var(--safe-b));
  box-shadow: var(--shadow-lg);
  transform: translateY(102%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet-layer.open .sheet {
  transform: none;
}

.sheet-layer.open .sheet-backdrop {
  opacity: 1;
}

.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #f2f5f9;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 800;
}

.sheet-kicker {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-align: center;
}

.sheet-chant {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  margin: 4px 0 0;
}

.sheet-eq {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 2px 0 16px;
}

.sheet-array {
  padding: 8px 0;
}

.sheet-caption {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 10px;
}

.sheet-add {
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--sky);
  letter-spacing: 0.06em;
  margin: 10px 0 18px;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.sheet-actions .btn {
  flex: 1;
}

.sheet-mastery {
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 12px;
}

.sheet-title {
  font-size: 20px;
  margin-bottom: 8px;
  padding-right: 30px;
}

.sheet-text {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* ---------- toast / 彩带 / 动效 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-b));
  transform: translate(-50%, 12px);
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(37, 49, 74, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-icon {
  font-size: 16px;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 140;
  pointer-events: none;
  overflow: hidden;
}

.confetti-layer i {
  position: absolute;
  top: -20px;
  display: block;
  animation: confetti-fall linear forwards;
}

.error-card {
  margin-top: 30px;
  text-align: center;
}

.error-card h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

.error-card p {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

/* 让知识卡片在 iPad 上更舒展 */
.mini-fact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px;
  border-radius: 14px;
  background: #f8fafc;
}

.mini-array {
  width: 100%;
}

.mini-fact b {
  font-size: 16px;
}

.mini-fact span {
  font-size: 11px;
  color: var(--ink-faint);
}

.level-badge {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--c);
  color: #fff;
  font-weight: 900;
}

/* ---------- 键盘动画关键帧 ---------- */
@keyframes mascot-float {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-7px) rotate(1.5deg);
  }
}

@keyframes mascot-blink {
  0%,
  92%,
  100% {
    transform: scaleY(1);
  }
  94%,
  96% {
    transform: scaleY(0.08);
  }
}

@keyframes mascot-cheer {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  40% {
    transform: translateY(-8px) scale(1.04) rotate(2deg);
  }
  70% {
    transform: translateY(-2px) scale(1.01) rotate(-1deg);
  }
}

@keyframes dot-in {
  from {
    transform: scale(0.2);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes card-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes fade-up {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes star-fly {
  0% {
    transform: translate(-50%, 0) scale(0.6);
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -80px) scale(1.25);
    opacity: 0;
  }
}

@keyframes confetti-fall {
  0% {
    transform: translate(0, -10px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), 105vh) rotate(var(--rot));
    opacity: 0.9;
  }
}

@keyframes hurry-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

/* ---------- 响应式 ---------- */
@media (min-width: 700px) {
  .app {
    padding-left: max(24px, var(--safe-l));
    padding-right: max(24px, var(--safe-r));
  }

  .topbar {
    margin: 0 -24px;
    padding-left: 24px;
    padding-right: 24px;
  }

  .hero {
    grid-template-columns: 130px 1fr;
    padding: 22px 24px 22px 16px;
  }

  .hero-bubble p {
    font-size: 17px;
  }

  .mascot {
    max-width: 148px;
  }

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

  .level-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .level-card {
    padding: 16px 14px 14px;
  }

  .level-number {
    width: 42px;
    height: 42px;
    font-size: 22px;
  }

  .fact-chant {
    font-size: 27px;
  }

  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .q-card {
    padding: 26px 26px 22px;
  }

  .choice {
    min-height: 88px;
    font-size: 34px;
  }

  .key {
    min-height: 68px;
  }

  .result-title {
    font-size: 30px;
  }

  .sheet {
    border-radius: 28px;
    margin-bottom: 4vh;
  }

  .sheet-layer {
    align-items: center;
    padding: 24px;
  }

  .sheet {
    max-height: 84dvh;
  }

  .plan {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "ring text cta";
    gap: 16px;
    padding: 18px 20px;
  }

  .plan-cta {
    width: auto;
    min-width: 180px;
  }
}

@media (min-width: 1000px) {
  .app {
    max-width: 1000px;
  }

  .mode-card {
    padding: 18px;
  }

  .mode-icon {
    width: 52px;
    height: 52px;
    font-size: 26px;
  }

  .mode-title {
    font-size: 17px;
  }

  .mode-desc {
    font-size: 12.5px;
  }

  .q-prompt {
    padding: 16px 0 26px;
  }
}

@media (max-width: 370px) {
  .header-pills .pill {
    padding: 0 9px;
    font-size: 13px;
  }

  .brand-text h1 {
    font-size: 20px;
  }

  .mode-card {
    padding: 11px;
    gap: 9px;
  }

  .mode-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .mode-title {
    font-size: 14px;
  }

  .mode-desc {
    font-size: 10.5px;
  }

  .level-grid {
    gap: 9px;
  }

  .fact-chant {
    font-size: 21px;
  }

  .choice {
    min-height: 66px;
    font-size: 26px;
  }

  .key {
    min-height: 54px;
  }

  .q-prompt {
    font-size: 42px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .topbar {
    position: static;
  }

  .quiz-buddy {
    display: none;
  }

  .q-prompt {
    font-size: 40px;
    padding: 4px 0 12px;
  }

  .q-card {
    padding: 14px;
  }

  .choice {
    min-height: 56px;
    font-size: 24px;
  }

  .key {
    min-height: 46px;
    font-size: 20px;
  }

  .hero {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .mascot {
    animation: none;
  }
}
