/* ============================================================
   咕咕学堂 · AI 可视化数学（K12）—— 绘本风设计系统 v2
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --paper: #FBF3E2;
  --paper-2: #FFF9EC;
  --card: #FFFFFF;
  --ink: #40312A;
  --ink-soft: #7A6A5C;
  --ink-faint: #7D6D5B;
  --coral: #F26D3D;
  --coral-deep: #B33E18;
  --coral-soft: #FDE3D3;
  --butter: #F6B73C;
  --butter-soft: #FCE9BC;
  --sage: #7FAE6E;
  --sage-deep: #3E6634;
  --sage-soft: #E7F1DE;
  --sky: #6FB3DC;
  --sky-deep: #2A6794;
  --sky-soft: #DFF0FA;
  --pink: #E86A7A;
  --pink-soft: #FBE0E4;
  --grass: #9CCB7F;
  --success: #28714E;
  --danger: #B93A3A;
  --radius-lg: 32px;
  --radius-md: 20px;
  --radius-sm: 12px;
  --shadow-soft: 0 14px 34px rgba(84, 62, 40, .18);
  --shadow-card: 0 8px 22px rgba(84, 62, 40, .12);
  --shadow-btn: 0 6px 0 rgba(84, 62, 40, .18);
  --font: "ZCOOL KuaiLe", "YouYuan", "幼圆", "Microsoft YaHei", "PingFang SC", sans-serif;
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1); /* impeccable-disable-line bounce-easing -- 儿童产品刻意的弹跳风格 */
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
#app { height: 100vh; height: 100dvh; }
.screen { position: fixed; inset: 0; }
.screen[hidden] { display: none !important; }

/* ---------- 通用 ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 46px; height: 46px; display: grid; place-items: center; }
.brand-logo svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 3px rgba(84,62,40,.15)); }
.brand-text { font-size: 26px; line-height: 1; letter-spacing: .5px; }
.brand-sub { font-size: 14px; color: var(--ink-soft); margin-top: 4px; display: block; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 8px 16px;
  font-size: 15px; white-space: nowrap;
}
.chip-demo { background: var(--pink-soft); color: var(--coral-deep); border: 2px dashed var(--pink); }
.chip-ai { background: var(--sky-soft); color: var(--sky-deep); border: 2px solid var(--sky); }
.chip-step { background: var(--card); color: var(--ink-soft); border: 2px solid #EAD9BE; font-variant-numeric: tabular-nums; }
.chip-star { background: var(--butter-soft); color: #A97612; border: 2px solid var(--butter); font-variant-numeric: tabular-nums; }

.btn {
  border: none; cursor: pointer;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 18px; line-height: 1;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease), opacity .16s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(2px); }
.btn:focus-visible { outline: 4px solid var(--sky); outline-offset: 3px; }
.btn-primary {
  background: var(--coral); color: #fff;
  padding: 16px 34px;
  box-shadow: var(--shadow-btn);
  border: 3px solid var(--coral-deep);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 9px 0 rgba(84,62,40,.18); }
.btn-ghost {
  background: rgba(255,255,255,.75); color: var(--ink);
  padding: 12px 20px;
  border: 3px solid #E7D5B8;
  box-shadow: 0 3px 0 rgba(84,62,40,.12);
}
.btn-ghost:hover { background: #fff; transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }
.btn-sm { padding: 10px 18px; font-size: 16px; }

.iconbtn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid #E7D5B8; background: rgba(255,255,255,.8);
  font-size: 19px; cursor: pointer; display: grid; place-items: center;
  transition: transform .15s var(--ease), background .15s;
}
.iconbtn:hover { transform: translateY(-1px); background: #fff; }
.iconbtn:focus-visible { outline: 4px solid var(--sky); outline-offset: 2px; }

/* ============================================================
   课程大厅
   ============================================================ */
.hall {
  display: flex; flex-direction: column;
  background:
    radial-gradient(circle at 15% 10%, rgba(246,183,60,.16), transparent 32%),
    radial-gradient(circle at 88% 14%, rgba(111,179,220,.15), transparent 30%),
    radial-gradient(circle at 60% 96%, rgba(159,203,127,.13), transparent 34%),
    var(--paper);
}
.hall::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(120,95,70,.08) 1.4px, transparent 1.4px);
  background-size: 26px 26px; opacity: .5;
}
.hall-sky { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hall-sky .sun { position: absolute; width: 96px; height: 96px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #FFE9A8, var(--butter) 62%, #EEA93C); top: 26px; right: 4%; box-shadow: 0 0 0 12px rgba(246,183,60,.16); animation: sunFloat 7s ease-in-out infinite; }
.hall-sky .cloud { position: absolute; width: 150px; height: 44px; border-radius: 999px; background: rgba(255,255,255,.92); }
.hall-sky .cloud::before, .hall-sky .cloud::after { content: ""; position: absolute; border-radius: 50%; background: inherit; }
.hall-sky .cloud::before { width: 56px; height: 56px; top: -26px; left: 26px; }
.hall-sky .cloud::after { width: 72px; height: 72px; top: -34px; right: 26px; }
.hall-sky .cloud-1 { top: 44px; left: 6%; animation: drift 34s linear infinite; }
.hall-sky .cloud-2 { top: 150px; left: 40%; transform: scale(.7); animation: drift 48s linear infinite; }

.hall-top {
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 40px 6px;
}
.hall-stats { display: flex; align-items: center; gap: 10px; }

.hall-body {
  position: relative; z-index: 2;
  flex: 1; max-width: 1500px; width: 100%; margin: 0 auto;
  padding: 14px 40px 8px;
  display: flex; flex-direction: column; gap: 16px; min-height: 0;
}
.hall-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.hall-hero-copy { animation: fadeUp .6s var(--ease) both; }
.home-eyebrow {
  display: inline-block; font-size: 15px; color: var(--coral-deep);
  background: var(--coral-soft); padding: 5px 14px; border-radius: 999px;
  margin-bottom: 10px; border: 2px dashed var(--coral);
}
.hall-title { font-size: clamp(30px, 3.2vw, 46px); line-height: 1.2; letter-spacing: .5px; font-weight: 400; }
.hall-title .hl { color: var(--coral); position: relative; }
.hall-title .hl::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 11px; background: var(--butter); opacity: .55; z-index: -1; border-radius: 6px; }

.hall-search {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 3px solid #E7D5B8; border-radius: 999px;
  padding: 10px 18px; min-width: 320px; color: var(--ink-faint);
  box-shadow: var(--shadow-card); animation: fadeUp .6s var(--ease) .06s both;
}
.hall-search input {
  border: none; outline: none; font-family: inherit; font-size: 16px;
  width: 100%; background: transparent; color: var(--ink);
}
.hall-search input::placeholder { color: var(--ink-faint); }

.hall-filter { display: flex; flex-direction: column; gap: 10px; }
.grade-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.grade-tabs .tab {
  border: 3px solid #E7D5B8; background: rgba(255,255,255,.8); color: var(--ink-soft);
  border-radius: 999px; padding: 9px 20px; font-size: 16px; cursor: pointer;
  font-family: inherit; transition: all .15s var(--ease);
}
.grade-tabs .tab:hover { transform: translateY(-1px); }
.grade-tabs .tab.active { background: var(--coral); border-color: var(--coral-deep); color: #fff; box-shadow: var(--shadow-btn); }
.domain-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.domain-chips .dchip {
  border: 2px solid #E7D5B8; background: #fff; color: var(--ink-soft);
  border-radius: 999px; padding: 6px 14px; font-size: 14px; cursor: pointer;
  font-family: inherit; transition: all .15s var(--ease);
}
.domain-chips .dchip:hover { transform: translateY(-1px); }
.domain-chips .dchip.active { border-color: var(--ink); color: var(--ink); background: var(--butter-soft); }

.hall-grid {
  flex: 1; overflow-y: auto; min-height: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px; padding: 4px 4px 14px;
  scrollbar-width: thin;
}

/* 课程卡 */
.lesson-card {
  background: var(--card); border-radius: 24px; overflow: hidden;
  border: 3px solid #F0E0C0; box-shadow: var(--shadow-card);
  cursor: pointer; transition: transform .18s var(--ease), box-shadow .18s var(--ease);
  display: flex; flex-direction: column; animation: fadeUp .5s var(--ease) both;
}
.lesson-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-soft); }
.lesson-card:focus-visible { outline: 4px solid var(--sky); outline-offset: 3px; }
.card-cover {
  position: relative; height: 138px; overflow: hidden;
  display: grid; place-items: center; font-size: 58px;
}
.card-cover::after { content: ""; position: absolute; inset: 0; background: radial-gradient(rgba(255,255,255,.35), transparent 70%); }
.card-cover .emoji { position: relative; z-index: 2; animation: float 4s ease-in-out infinite; }
.card-cover .grade-pill {
  position: absolute; top: 10px; left: 12px; z-index: 3;
  background: rgba(255,255,255,.92); border: 2px solid rgba(64,49,42,.25);
  color: var(--ink); font-size: 13px; padding: 4px 12px; border-radius: 999px;
}
.card-cover .soon-pill {
  position: absolute; top: 10px; right: 12px; z-index: 3;
  background: var(--pink); color: #fff; font-size: 13px; padding: 4px 12px; border-radius: 999px;
}
.card-body { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 21px; letter-spacing: .5px; }
.card-sub { font-size: 14px; color: var(--ink-soft); line-height: 1.5; min-height: 40px; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.card-tags span {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--sky-soft); color: var(--sky-deep); border: 1.5px solid var(--sky);
}
.card-tags span.dm-number { background: var(--coral-soft); color: var(--coral-deep); border-color: var(--coral); }
.card-tags span.dm-geometry { background: var(--sky-soft); color: var(--sky-deep); border-color: var(--sky); }
.card-tags span.dm-stats { background: var(--pink-soft); color: var(--coral-deep); border-color: var(--pink); }
.card-tags span.dm-practice { background: var(--sage-soft); color: var(--sage-deep); border-color: var(--sage); }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.card-progress { font-size: 13px; color: var(--ink-faint); }
.card-progress.done { color: var(--success); }
.card-go {
  font-size: 14px; color: #fff; background: var(--coral);
  border: 2px solid var(--coral-deep); border-radius: 999px;
  padding: 6px 16px; text-decoration: none;
}
.card-go.locked { background: #D8CBB4; border-color: #C3B49A; color: #8A7C68; }
.empty-note {
  grid-column: 1 / -1; text-align: center; color: var(--ink-faint);
  font-size: 17px; padding: 40px 0;
}
.hall-foot {
  position: relative; z-index: 3; text-align: center;
  padding: 10px; font-size: 13px; color: var(--ink-faint); letter-spacing: .5px;
}

/* 领域封面配色 */
.cv-number { background: linear-gradient(160deg, #FCE3D3, #FAD6BF 45%, #F6C9A8); }
.cv-geometry { background: linear-gradient(160deg, #DFF0FA, #CFE6F5 45%, #BCDBEF); }
.cv-stats { background: linear-gradient(160deg, #FBE0E4, #F8D2DA 45%, #F3C2CC); }
.cv-practice { background: linear-gradient(160deg, #E7F1DE, #D8EACB 45%, #C7DFB4); }
/* ============================================================
   课程播放器
   ============================================================ */
.lesson {
  display: grid; grid-template-rows: auto 1fr auto;
  background: radial-gradient(circle at 10% 8%, rgba(246,183,60,.14), transparent 30%), var(--paper);
}
.lesson::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(120,95,70,.07) 1.4px, transparent 1.4px);
  background-size: 26px 26px; opacity: .5;
}
.topbar {
  position: relative; z-index: 5;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px;
  padding: 12px 26px;
}
.brand-sm .brand-logo { width: 40px; height: 40px; }
.brand-sm .brand-text { font-size: 22px; }
.breadcrumb {
  font-size: 15px; color: var(--ink-soft); background: var(--butter-soft);
  padding: 6px 14px; border-radius: 999px; border: 2px solid #EFD393;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

.progress-wrap { display: flex; flex-direction: column; gap: 7px; min-width: 220px; max-width: 460px; width: 100%; }
.progress-track { height: 9px; background: #EFE0C3; border-radius: 999px; overflow: hidden; border: 1px solid #E4D0AC; }
.progress-fill { height: 100%; width: 100%; border-radius: 999px; background: var(--coral); transform: scaleX(0); transform-origin: left center; transition: transform .5s var(--ease); } /* impeccable-disable-line layout-transition -- 进度条用 transform 过渡 */
.step-dots { display: flex; justify-content: center; gap: 5px; }
.step-dots .dot { width: 8px; height: 8px; border-radius: 50%; background: #E8D9BC; transition: all .3s var(--ease); }
.step-dots .dot.done { background: var(--sage); }
.step-dots .dot.current { background: var(--coral); transform: scale(1.45); box-shadow: 0 0 0 3px rgba(242,109,61,.2); }

.stage {
  position: relative; z-index: 2;
  margin: 6px 26px 10px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 3px solid #F0E0C0;
  box-shadow: var(--shadow-soft);
  min-height: 0;
}
.stage-sky { position: absolute; inset: 0; overflow: hidden; }
.stage-sky { background: linear-gradient(180deg, #A8D8F0 0%, #CBE9F7 46%, #E6F6E8 66%, #D6E9C0 82%, #B9D99B 100%); }
.stage-sky .sun { width: 96px; height: 96px; top: 26px; right: 4%; animation: none; }
.stage-sky .cloud-1 { top: 40px; left: 6%; }
.stage-sky .cloud-2 { top: 120px; left: 30%; transform: scale(.6); }
.hill { position: absolute; border-radius: 50%; background: #C8E2AE; }
.hill-1 { width: 60%; height: 46%; left: -8%; bottom: -14%; }
.hill-2 { width: 52%; height: 40%; right: -6%; bottom: -12%; background: #D2E8B8; }
.grass {
  position: absolute; left: 0; right: 0; bottom: 0; height: 16%;
  background: repeating-linear-gradient(90deg, transparent 0 34px, rgba(255,255,255,.5) 34px 40px), var(--grass);
  border-radius: 46% 46% 0 0 / 34% 34% 0 0;
}
.fence {
  position: absolute; left: 0; right: 0; bottom: 13%; height: 44px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.95) 0 18px, transparent 18px 46px),
    repeating-linear-gradient(180deg, transparent 0 12px, rgba(255,255,255,.95) 12px 18px),
    rgba(122,101,70,.55);
  opacity: .85;
}

.stage-content { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; padding: 24px 28px 132px; }
.step-badge {
  position: absolute; top: 18px; left: 22px; z-index: 4;
  background: rgba(255,255,255,.94); border: 3px solid #EFD9B2;
  color: var(--coral-deep); border-radius: 999px;
  padding: 8px 18px; font-size: 16px; letter-spacing: .5px;
  box-shadow: 0 4px 12px rgba(84,62,40,.12);
  animation: fadeUp .5s var(--ease) both;
}

.narrator {
  position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 4;
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,.97);
  border: 3px solid #F0E0C0; border-radius: 20px;
  padding: 10px 18px; box-shadow: var(--shadow-card);
  animation: fadeUp .45s var(--ease) both;
}
.narrator-avatar {
  width: 56px; height: 56px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 32% 28%, #FFE9A8, #F6B73C 68%, #E89E2E);
  border: 3px solid #fff; box-shadow: var(--shadow-card);
  display: grid; place-items: center; font-size: 28px;
  animation: float 3.6s ease-in-out infinite;
}
.narrator-bubble { position: relative; flex: 1; font-size: clamp(16px, 1.35vw, 21px); line-height: 1.6; }
.narrator-name {
  position: absolute; top: -6px; left: 0; font-size: 12px; color: var(--ink-soft);
  background: var(--butter-soft); padding: 2px 10px; border-radius: 999px;
  border: 2px solid #EFD393; white-space: nowrap;
}

/* ---------- 舞台内容组件 ---------- */
.hero-card, .problem-card, .eq-card, .quiz-card, .result-card, .chat-card, .board {
  background: rgba(255,255,255,.96);
  border: 3px solid #F0E0C0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  animation: fadeUp .5s var(--ease) both;
}
.problem-card { padding: 22px 30px; text-align: center; max-width: 760px; }
.problem-title { font-size: clamp(24px, 2.4vw, 34px); letter-spacing: 1px; }
.problem-sub { color: var(--ink-soft); font-size: 17px; margin-top: 6px; line-height: 1.6; }

.fact-row { display: flex; gap: 14px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.fact {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--sky-soft); border: 3px solid var(--sky);
  color: var(--sky-deep); border-radius: 999px; padding: 10px 20px;
  font-size: clamp(18px, 1.7vw, 24px);
}
.fact.coral { background: var(--coral-soft); border-color: var(--coral); color: var(--coral-deep); }
.fact.sage { background: var(--sage-soft); border-color: var(--sage); color: var(--sage-deep); }
.fact .num { font-size: 1.3em; }

.story-scene { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.story-figure { display: flex; align-items: flex-end; gap: 46px; flex-wrap: wrap; justify-content: center; }
.story-figure .fig { display: flex; flex-direction: column; align-items: center; gap: 4px; animation: fadeUp .6s var(--ease) both; }
.story-figure .fig svg { width: 130px; height: auto; filter: drop-shadow(0 6px 4px rgba(84,62,40,.16)); animation: float 3.4s ease-in-out infinite; }
.story-figure .fig span { font-size: 17px; color: var(--ink-soft); }
.story-oldman { font-size: 92px; line-height: 1; animation: float 3.8s ease-in-out infinite; filter: drop-shadow(0 6px 4px rgba(84,62,40,.16)); }

.board { padding: 18px 22px; text-align: center; max-width: 880px; width: 100%; }
.board > svg { width: 100%; max-width: 800px; height: auto; display: block; margin: 0 auto; }
.board-caption { margin-top: 12px; font-size: clamp(17px, 1.5vw, 23px); color: var(--ink-soft); line-height: 1.6; }
.board-caption b { color: var(--coral-deep); }
.board-total {
  display: inline-block; margin-top: 10px; font-size: 18px; color: var(--coral-deep);
  background: var(--coral-soft); padding: 6px 16px; border-radius: 999px;
  border: 2px solid var(--coral);
}

.eq-card { padding: 26px 36px; min-width: 320px; max-width: 660px; }
.eq-title { font-size: clamp(20px, 1.8vw, 26px); margin-bottom: 14px; color: var(--coral-deep); }
.eq-line {
  font-size: clamp(20px, 1.9vw, 29px); line-height: 1.65; letter-spacing: .5px;
  opacity: 0; animation: fadeUp .5s var(--ease) forwards;
  font-variant-numeric: tabular-nums;
}
.eq-line b { color: var(--coral); }
.eq-line .tick { color: var(--success); }
.eq-note { font-size: 15px; color: var(--ink-faint); margin-top: 10px; }

.song-card { padding: 24px 30px; text-align: center; max-width: 780px; }
.song-card .song-title { font-size: clamp(22px, 2.2vw, 32px); margin-bottom: 12px; color: var(--coral-deep); }
.song-lines { font-size: clamp(19px, 1.9vw, 28px); line-height: 2.1; letter-spacing: 1px; }
.song-lines span { display: inline-block; margin: 0 2px; animation: pop .4s var(--ease-pop) backwards; }

.quiz-card { padding: 24px 32px; max-width: 780px; width: 100%; text-align: center; }
.quiz-head { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; }
.quiz-badge { background: var(--butter); color: var(--ink); border: 2px solid #E3A429; font-size: 15px; padding: 5px 14px; border-radius: 999px; }
.quiz-q { font-size: clamp(20px, 1.9vw, 29px); line-height: 1.6; margin-bottom: 16px; }
.quiz-q .num { color: var(--coral); }
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.option {
  border: 3px solid #E6D5B8; background: #FFFDF7; border-radius: 18px;
  padding: 15px 10px; font-size: clamp(17px, 1.6vw, 23px); cursor: pointer;
  transition: transform .15s var(--ease), border-color .15s, background .15s;
  font-family: inherit;
}
.option:hover { transform: translateY(-2px); border-color: var(--coral); }
.option:focus-visible { outline: 4px solid var(--sky); outline-offset: 2px; }
.option.correct { border-color: var(--success); background: var(--sage-soft); color: var(--success); animation: pop .4s var(--ease-pop); }
.option.wrong { border-color: var(--danger); background: var(--pink-soft); color: var(--danger); animation: shake .4s; }
.option:disabled { cursor: default; }
.feedback { margin-top: 14px; font-size: 18px; line-height: 1.6; min-height: 28px; border-radius: 999px; padding: 9px 18px; display: inline-block; }
.feedback.good { background: var(--sage-soft); color: var(--success); border: 2px solid var(--success); }
.feedback.try { background: var(--butter-soft); color: #A97612; border: 2px solid var(--butter); }

.result-card { text-align: center; padding: 30px 44px; max-width: 680px; }
.result-title { font-size: clamp(26px, 2.8vw, 42px); letter-spacing: 1px; }
.result-title .num { color: var(--coral); }
.result-sub { margin-top: 10px; font-size: 18px; color: var(--ink-soft); line-height: 1.7; }
.result-stars { font-size: 40px; margin-top: 6px; letter-spacing: 6px; animation: pop .5s var(--ease-pop) both; }

.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.method-card { background: #FFFDF7; border: 3px solid #E6D5B8; border-radius: 18px; padding: 14px 16px; text-align: left; }
.method-card h3 { font-size: 19px; margin-bottom: 5px; font-weight: 400; }
.method-card.c1 h3 { color: var(--coral-deep); }
.method-card.c2 h3 { color: var(--sky-deep); }
.method-card p { color: var(--ink-soft); font-size: 14px; line-height: 1.7; }

.chat-card { width: min(720px, 92%); max-height: 88%; display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 13px 20px; border-bottom: 2px solid #F0E0C0; }
.chat-head .mini-owl { width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #FFE9A8, #F6B73C 68%, #E89E2E); display: grid; place-items: center; font-size: 20px; border: 2px solid #fff; box-shadow: var(--shadow-card); }
.chat-head b { font-size: 19px; font-weight: 400; }
.chat-head small { color: var(--ink-faint); font-size: 13px; }
.chat-body { flex: 1; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 11px; background: #FFFDF7; }
.msg { max-width: 84%; padding: 11px 15px; border-radius: 16px; font-size: 16px; line-height: 1.65; animation: fadeUp .35s var(--ease) both; }
.msg.ai { align-self: flex-start; background: #fff; border: 2px solid #F0E0C0; border-bottom-left-radius: 4px; }
.msg.user { align-self: flex-end; background: var(--coral); color: #fff; border-bottom-right-radius: 4px; }
.msg .cursor { display: inline-block; width: 8px; height: 17px; background: var(--coral); vertical-align: -3px; margin-left: 2px; animation: blink 1s steps(1) infinite; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 11px 15px; border-top: 2px solid #F0E0C0; }
.chat-suggest button { border: 2px solid var(--sky); background: var(--sky-soft); color: var(--sky-deep); border-radius: 999px; padding: 6px 13px; font-size: 13px; cursor: pointer; font-family: inherit; transition: transform .15s var(--ease); }
.chat-suggest button:hover { transform: translateY(-2px); }
.chat-input-row { display: flex; gap: 10px; padding: 11px 15px; border-top: 2px solid #F0E0C0; }
.chat-input-row input { flex: 1; border: 3px solid #E6D5B8; border-radius: 999px; padding: 11px 17px; font-size: 15px; font-family: inherit; outline: none; background: #fff; }
.chat-input-row input:focus { border-color: var(--sky); }
.chat-input-row .btn { padding: 11px 22px; font-size: 15px; }

.summary-wrap { display: flex; gap: 18px; align-items: stretch; width: 100%; max-width: 1240px; }
.summary-left { flex: 1.05; display: flex; }
.summary-left .result-card { width: 100%; }
.summary-wrap .chat-card { flex: 1; width: auto; max-width: none; max-height: none; height: 100%; }
.summary-wrap .chat-body { max-height: 300px; }

.confetti { position: absolute; top: -20px; z-index: 6; pointer-events: none; animation: confettiFall linear forwards; }
.head-node { opacity: 0; animation: headIn .5s var(--ease) forwards; transform-origin: center; }
.leg { transform-origin: 50% 0%; animation: legGrow .28s var(--ease) backwards; }
.ear { transform-origin: 50% 0%; animation: earGrow .34s var(--ease) backwards; }
.sparkle { transform-origin: center; animation: sparkle 1.2s ease-in-out infinite; }
.pulse-hint { animation: pulseHint .55s ease; }
/* ============================================================
   弹窗 / Toast
   ============================================================ */
.modal-backdrop[hidden] { display: none !important; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(64,49,42,.45); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
  animation: fadeIn .25s var(--ease) both;
}
.modal {
  background: var(--paper-2); border-radius: 28px; overflow: hidden;
  width: min(620px, 94vw); max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-soft); border: 4px solid #F0E0C0;
  animation: pop .35s var(--ease-pop) both; position: relative;
}
.modal-wide { width: min(980px, 96vw); }
.modal-close {
  position: sticky; top: 12px; margin-left: calc(100% - 52px); z-index: 5;
  width: 40px; height: 40px; border-radius: 50%; border: 3px solid #E7D5B8;
  background: #fff; font-size: 16px; cursor: pointer; display: grid; place-items: center;
}
.modal-cover { height: 150px; display: grid; place-items: center; font-size: 64px; }
.modal-body { padding: 0 30px 30px; }
.modal-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.modal-meta .tag { font-size: 13px; padding: 4px 12px; border-radius: 999px; background: var(--sky-soft); color: var(--sky-deep); border: 1.5px solid var(--sky); }
.modal-title { font-size: 30px; letter-spacing: .5px; margin-top: 12px; font-weight: 400; }
.modal-sub { color: var(--ink-soft); font-size: 16px; line-height: 1.7; margin-top: 8px; }
.modal-h3 { font-size: 18px; margin-top: 20px; font-weight: 400; color: var(--ink); }
.modal-obj { color: var(--ink-soft); font-size: 15px; line-height: 1.8; margin-top: 8px; background: #fff; border: 3px dashed #E7D5B8; border-radius: 14px; padding: 12px 16px; }
.modal-points { list-style: none; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.modal-points li {
  background: #fff; border: 3px solid #E7D5B8; border-radius: 14px;
  padding: 10px 14px; font-size: 15px; color: var(--ink-soft); line-height: 1.6;
}
.modal-points li b { color: var(--coral-deep); }
.modal .btn-start { margin-top: 22px; width: 100%; font-size: 20px; }

.catalog-quick { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; max-height: 60vh; overflow-y: auto; }
.cq-item {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 3px solid #E7D5B8; border-radius: 16px;
  padding: 12px 16px; cursor: pointer; transition: transform .15s var(--ease), border-color .15s;
}
.cq-item:hover { transform: translateY(-2px); border-color: var(--coral); }
.cq-item .cq-emoji { font-size: 26px; }
.cq-item .cq-main { flex: 1; min-width: 0; }
.cq-item .cq-title { font-size: 17px; }
.cq-item .cq-meta { font-size: 13px; color: var(--ink-faint); }
.cq-item .cq-state { font-size: 13px; padding: 4px 12px; border-radius: 999px; }
.cq-item .cq-state.done { background: var(--sage-soft); color: var(--success); }
.cq-item .cq-state.doing { background: var(--butter-soft); color: #A97612; }
.cq-item .cq-state.locked { background: #EFE6D6; color: var(--ink-faint); }
.cq-item.active { border-color: var(--coral); background: var(--coral-soft); }

.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--ink); color: #fff; border-radius: 999px;
  padding: 10px 22px; font-size: 15px; box-shadow: var(--shadow-soft);
  animation: toastIn .3s var(--ease) both;
}

/* ============================================================
   动画
   ============================================================ */
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes drift { from { transform: translateX(-12vw); } to { transform: translateX(112vw); } }
@keyframes sunFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes confettiFall { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(46vh) rotate(560deg); opacity: .2; } }
@keyframes legGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes earGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes sparkle { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0deg); } 50% { opacity: 1; transform: scale(1.1) rotate(20deg); } }
@keyframes headIn { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: scale(1); } }
@keyframes pulseHint { 0%,100% { transform: scale(1); opacity: .7; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1180px) {
  .narrator { gap: 10px; padding: 8px 14px; }
  .narrator-avatar { width: 46px; height: 46px; font-size: 22px; }
  .summary-wrap { flex-direction: column; }
  .summary-wrap .chat-card { height: auto; }
  .hall-body { padding: 10px 24px; }
  .hall-top { padding: 18px 24px 4px; }
  .story-figure { gap: 28px; }
  .story-figure .fig svg { width: 100px; }
  .story-oldman { font-size: 70px; }
}

@media (max-width: 860px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; min-height: 100dvh; }
  .screen { position: absolute; }
  .hall-body { gap: 12px; }
  .hall-search { min-width: 0; width: 100%; }
  .hall-hero { align-items: stretch; }
  .lesson { min-height: 100vh; min-height: 100dvh; }
  .topbar { grid-template-columns: 1fr auto; row-gap: 8px; }
  .progress-wrap { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .breadcrumb { display: none; }
  .chip-ai { display: none; }
  .btn-catalog { padding: 10px 14px; font-size: 14px; }
  .stage { margin: 6px 12px 8px; }
  .narrator { left: 10px; right: 10px; bottom: 10px; }
  .narrator-bubble { font-size: 14px; }
  .narrator-avatar { width: 44px; height: 44px; font-size: 20px; }
  .control-hint { display: none; }
  .options { grid-template-columns: 1fr; }
  .chat-card { width: 96%; }
  .hall-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .modal-body { padding: 0 20px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
/* ============================================================
   v3 优化（评审修复批次）
   ============================================================ */
:root {
  --coral-strong: #C74018;   /* 小字白字按钮底，5.03:1 */
  --butter-deep: #7A580E;    /* 黄油底深字，5.42:1 */
  --locked-text: #5A4A3E;    /* 锁定态文字 */
}

/* 对比度：主按钮/高亮/状态 */
.btn-primary { background: var(--coral-strong); border-color: #A83815; font-weight: 700; }
.btn-primary:hover { background: #D9471D; }
.grade-tabs .tab.active { background: var(--coral-strong); border-color: #A83815; }
.card-go { background: var(--coral-strong); border-color: #A83815; }
.card-go.locked { background: #EFE6D6; border-color: #D8CBB4; color: var(--locked-text); }
.msg.user { background: var(--coral-strong); }
.chip-star { color: var(--butter-deep); }
.feedback.try { color: var(--butter-deep); }
.cq-state.doing { color: var(--butter-deep); }
.hall-title .hl { color: var(--coral-deep); }
.result-title .num { color: var(--coral-deep); }
.eq-line b { color: var(--coral-deep); }
.quiz-q .num { color: var(--coral-deep); }
.hall-search input::placeholder { color: var(--ink-soft); }
.breadcrumb { color: var(--ink); }
.narrator-name { color: var(--ink); }
.card-progress.done { color: var(--success); }

/* 大厅卡片：无头/隔离渲染下防止高度坍缩 */
.hall-grid { grid-auto-rows: max-content; }
.lesson-card { min-height: 300px; }

/* 解说气泡行宽 */
.narrator-bubble { max-width: min(64ch, 700px); }
.narrator { gap: 14px; }

/* 搜索框与输入焦点指示 */
.hall-search:focus-within { outline: 4px solid var(--sky); outline-offset: 2px; border-color: var(--sky); }
.chat-input-row input:focus { outline: 4px solid var(--sky); outline-offset: 1px; }

/* 触屏目标 ≥44px */
.grade-tabs .tab { min-height: 44px; }
.domain-chips .dchip { min-height: 44px; }
.chat-suggest button { min-height: 44px; }
.modal-close { width: 44px; height: 44px; }
.btn-sm { min-height: 44px; }

/* 进度条用 transform 代替 width 过渡 */
.progress-fill { transform-origin: left center; transition: transform .5s var(--ease); }

/* eq 卡窄屏不贴边 */
.eq-card { min-width: min(320px, 100%); }

/* 小字号微调（儿童可读性） */
.card-tags span { font-size: 13px; }
.narrator-name { font-size: 13px; }
.cq-meta, .card-progress, .hall-foot { font-size: 14px; }

/* 高亮词不断行 */
.hall-title .hl { white-space: nowrap; }

/* 弹窗焦点管理辅助 */
.modal:focus { outline: none; }

/* 移动端：播放器改为内容驱动滚动，避免舞台裁切 */
@media (max-width: 860px) {
  .lesson { height: auto; }
  .stage { height: auto; overflow: visible; margin: 6px 12px 10px; }
  .stage-content { position: static; padding: 18px 12px 0; min-height: 0; flex-direction: column; align-items: center; }
  .narrator { width: 100%; max-width: none; }
  .step-badge { position: static; margin: 0 0 12px; width: fit-content; }
  .narrator { position: static; margin-top: 14px; }
  .narrator-bubble { max-width: none; }
  .summary-wrap { align-items: stretch; }
  .summary-wrap .chat-card { height: 560px; }
  .chat-card { width: 100%; }
  /* 筛选区单行横滑，节省垂直空间 */
  .grade-tabs, .domain-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; scrollbar-width: none; }
  .grade-tabs::-webkit-scrollbar, .domain-chips::-webkit-scrollbar { display: none; }
  .grade-tabs .tab, .domain-chips .dchip { flex: none; }
  .hall-body { gap: 10px; }
  /* 图形卡移动端两列 */
  .shape-row > div { flex: 1 1 42%; min-width: 0; }
}
/* ============================================================
   v3.1 移动端修复（真 390 视口实测）
   ============================================================ */
@media (max-width: 860px) {
  .screen.lesson { position: relative; inset: auto; }
  .lesson, .hall { overflow-x: hidden; }
  .lesson { grid-template-rows: auto auto auto; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .progress-wrap { min-width: 0; }
  .step-dots { flex-wrap: wrap; row-gap: 4px; }
  .chip-step { display: none; }
  .stage { height: auto; overflow: hidden; margin: 6px 12px 10px; }
  .stage-content { position: static; padding: 18px 12px 0; min-height: 0; flex-direction: column; align-items: center; }
  .narrator { width: 100%; max-width: none; }
  .step-badge { position: static; margin: 0 0 12px; width: fit-content; }
  .narrator { position: static; margin-top: 14px; }
  .narrator-bubble { max-width: none; }
  .narrator-name { position: static; display: block; margin-bottom: 2px; }
  .summary-wrap { align-items: stretch; }
  .summary-wrap .chat-card { height: 560px; }
  .chat-card { width: 100%; }
  .grade-tabs, .domain-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; scrollbar-width: none; }
  .grade-tabs::-webkit-scrollbar, .domain-chips::-webkit-scrollbar { display: none; }
  .grade-tabs .tab, .domain-chips .dchip { flex: none; }
  .hall-body { gap: 10px; }
  .board { width: 100%; max-width: none; }
  .shape-row > div, .print-row > div { flex: 1 1 calc(50% - 10px); min-width: 0 !important; }
  .shape-row svg, .print-row svg { width: 96px !important; height: 96px !important; }
}