/* ============================================================
   趣学园 · FunLearn Park — 工具页 / 设置页共享样式
   ============================================================ */

.tool-page { min-height: 100vh; display: flex; flex-direction: column; }
.tool-main { flex: 1; padding: var(--sp-6) 0 var(--sp-12); }

/* 工具页头部（标题区） */
.tool-hero { text-align: center; margin-bottom: var(--sp-8); }
.tool-hero .ic-row { font-size: 3rem; margin-bottom: var(--sp-2); animation: bobble 5s ease-in-out infinite; display: inline-block; }
.tool-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: var(--sp-2); }
.tool-hero .sub { color: var(--text-soft); max-width: 560px; margin: 0 auto; }

/* 返回链接 */
.back-link {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 600;
  color: var(--text-soft); padding: 6px 14px; border-radius: var(--radius-full);
  background: var(--surface); border: 2px solid var(--border); transition: all var(--dur-fast) var(--ease-spring);
}
.back-link:hover { color: var(--brand-600); transform: translateX(-3px); border-color: var(--brand-300); }

/* —— 工具页导航右侧：设置+主题 —— */
.nav .nav-actions { display: flex; align-items: center; gap: var(--sp-2); }

/* ============================================================
   设置页通用
   ============================================================ */
.settings-wrap { max-width: 820px; margin: 0 auto; }
.settings-head { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-7); flex-wrap: wrap; }
.settings-head h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
.settings-head .ic { font-size: 2.4rem; }

.setting-card {
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-6); margin-bottom: var(--sp-5); box-shadow: var(--shadow-sm);
  animation: popIn var(--dur-slow) var(--ease-spring) both;
}
.setting-card h2 { font-size: 1.25rem; display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.setting-card h2 .em { font-size: 1.4rem; }

/* pill 标签 */
.pill-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: var(--radius-full); font-weight: 700; font-size: 0.85rem;
  background: var(--brand-50); color: var(--brand-700); border: 2px solid transparent;
  animation: popIn var(--dur-base) var(--ease-spring);
}
[data-theme="dark"] .pill { background: var(--surface-2); color: var(--brand-200); }
.pill .x { cursor: pointer; opacity: 0.6; font-weight: 800; }
.pill .x:hover { opacity: 1; color: var(--danger); }
.pill.yellow { background: var(--accent-yellow-soft); color: #6a5500; }
.pill.pink { background: var(--accent-pink-soft); color: #8a1f47; }
.pill.green { background: var(--accent-green-soft); color: #1f5a2a; }

/* 添加输入行 */
.add-row { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.add-row .input { flex: 1; }

/* 底部常驻保存状态条 */
.save-bar {
  position: sticky; bottom: var(--sp-4); margin: var(--sp-6) auto 0; max-width: 820px;
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  background: var(--success); color: #fff; font-weight: 700; padding: 10px 20px;
  border-radius: var(--radius-full); box-shadow: var(--shadow-soft);
}
.save-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:0.5;transform:scale(0.8);} 50%{opacity:1;transform:scale(1.2);} }

/* 字数统计 */
.char-count { font-size: 0.8rem; color: var(--text-faint); text-align: right; margin-top: 4px; font-family: var(--font-mono); }

/* 设置区操作按钮组 */
.btn-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }

/* 摘要卡（未配置引导） */
.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.summary-card {
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-5); text-align: center; box-shadow: var(--shadow-sm);
}
.summary-card .num { font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; color: var(--brand-500); }
.summary-card .lbl { color: var(--text-soft); font-size: 0.9rem; }

.empty-guide {
  text-align: center; background: var(--surface); border: 3px dashed var(--border-strong);
  border-radius: var(--radius-xl); padding: var(--sp-10) var(--sp-6); margin-bottom: var(--sp-6);
}
.empty-guide .em { font-size: 3.4rem; margin-bottom: var(--sp-3); display: inline-block; animation: bobble 4s ease-in-out infinite; }
.empty-guide h3 { font-size: 1.4rem; margin-bottom: var(--sp-2); }
.empty-guide p { color: var(--text-soft); margin-bottom: var(--sp-5); }

/* ============================================================
   刮刮乐专属
   ============================================================ */
.scratch-stage { display: flex; flex-direction: column; align-items: center; gap: var(--sp-5); }
.scratch-frame {
  position: relative; width: min(440px, 90vw); aspect-ratio: 4/3;
  border-radius: var(--radius-xl); overflow: hidden; border: 4px solid var(--border-strong);
  box-shadow: var(--shadow-sticker); background: var(--surface);
}
.scratch-prize {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2); padding: var(--sp-5); text-align: center;
  background: linear-gradient(160deg, var(--accent-yellow-soft), var(--accent-pink-soft));
}
.scratch-prize .em { font-size: 3.4rem; }
.scratch-prize .who { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.6rem, 5vw, 2.4rem); color: var(--text); }
.scratch-prize .what { font-size: 1.1rem; font-weight: 700; color: var(--accent-pink); }
.scratch-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.scratch-canvas:active { cursor: grabbing; }
.scratch-hint { color: var(--text-soft); font-weight: 700; display: flex; align-items: center; gap: 6px; }

/* 中奖弹窗 */
.win-mask { position: fixed; inset: 0; z-index: 250; display: none; align-items: center; justify-content: center; background: rgba(20,18,58,0.6); backdrop-filter: blur(6px); }
.win-mask.open { display: flex; animation: fadeIn var(--dur-base) var(--ease-out); }
.win-card {
  text-align: center; background: linear-gradient(160deg, #fff5fa, #fff9ee); border: 4px solid var(--accent-pink);
  border-radius: var(--radius-xl); padding: var(--sp-8) var(--sp-8); max-width: 440px;
  box-shadow: var(--shadow-pop); animation: popIn var(--dur-base) var(--ease-spring);
}
.win-card .em { font-size: 4rem; animation: bobble 2s ease-in-out infinite; }
.win-card .crown { font-family: var(--font-display); font-size: 1.2rem; color: var(--accent-pink); font-weight: 700; }
.win-card .who { font-family: var(--font-display); font-size: clamp(2rem, 6vw, 3rem); font-weight: 700; margin: var(--sp-2) 0; background: linear-gradient(120deg, var(--accent-pink), var(--brand-500)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.win-card .what { font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: var(--sp-5); }
.win-card .actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }

/* 撒花画布 */
.confetti-canvas { position: fixed; inset: 0; z-index: 260; pointer-events: none; }

/* ============================================================
   声音魔法树专属（固定深色）
   ============================================================ */
.tree-page { background: #0c0b2e; color: #f4f1ff; }
.tree-page .nav { background: rgba(12,11,46,0.7); border-bottom-color: rgba(255,255,255,0.08); }
.tree-page .logo, .tree-page .back-link, .tree-page .icon-btn { color: #f4f1ff; }
.tree-page .icon-btn { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); }
.tree-page .back-link { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); }

.aurora-bg { position: fixed; inset: 0; z-index: -2; background: #0c0b2e; overflow: hidden; }
.aurora-bg::before, .aurora-bg::after {
  content: ""; position: absolute; inset: -20%;
  background:
    radial-gradient(40% 50% at 20% 30%, rgba(59,176,255,0.35), transparent 60%),
    radial-gradient(35% 45% at 80% 20%, rgba(255,107,157,0.30), transparent 60%),
    radial-gradient(40% 50% at 70% 80%, rgba(91,214,108,0.28), transparent 60%),
    radial-gradient(30% 40% at 25% 75%, rgba(255,210,63,0.25), transparent 60%);
  filter: blur(30px); animation: aurora 22s ease-in-out infinite alternate;
}
.aurora-bg::after { animation-duration: 30s; animation-direction: alternate-reverse; opacity: 0.7; }
@keyframes aurora { 0%{transform:translate(0,0) scale(1);} 50%{transform:translate(4%,-3%) scale(1.1);} 100%{transform:translate(-3%,4%) scale(0.95);} }

.stars-layer { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.star { position: absolute; background: #fff; border-radius: 50%; animation: twinkle var(--tw-dur, 3s) ease-in-out infinite; }
@keyframes twinkle { 0%,100%{opacity:0.2; transform:scale(0.7);} 50%{opacity:1; transform:scale(1.2);} }

.tree-layout { display: grid; grid-template-columns: 1fr 260px; gap: var(--sp-5); align-items: start; max-width: 1200px; margin: 0 auto; padding: var(--sp-5); }
.tree-center { display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); }

.reading-banner {
  width: 100%; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg); padding: var(--sp-4) var(--sp-5); text-align: center; color: #f4f1ff;
  backdrop-filter: blur(8px);
}
.reading-banner .lbl { font-size: 0.78rem; opacity: 0.7; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 4px; }
.reading-banner .txt { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }

.tree-svg-wrap { display: grid; place-items: center; width: 100%; min-height: 380px; }
.tree-svg { width: min(360px, 70vw); height: auto; transform-origin: center bottom; transition: transform 0.18s var(--ease-out); }

.badge {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-md);
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: #9b94b8;
  transition: all var(--dur-base) var(--ease-spring);
}
.badge .em { font-size: 1.3rem; filter: grayscale(1); opacity: 0.4; transition: all var(--dur-base); }
.badge.lit { background: linear-gradient(135deg, rgba(255,210,63,0.25), rgba(255,107,157,0.2)); border-color: var(--accent-yellow); color: #fff; }
.badge.lit .em { filter: none; opacity: 1; animation: badgePop 0.5s var(--ease-spring); }
@keyframes badgePop { 0%{transform:scale(0.5) rotate(-20deg);} 60%{transform:scale(1.3) rotate(10deg);} 100%{transform:scale(1) rotate(0);} }

/* 右侧仪表 */
.meter-col { display: flex; flex-direction: column; gap: var(--sp-4); position: sticky; top: 84px; }
.meter-card { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: var(--radius-lg); padding: var(--sp-5); backdrop-filter: blur(8px); }
.meter-card .lbl { font-size: 0.78rem; opacity: 0.7; letter-spacing: 0.1em; text-transform: uppercase; }
.db-number { font-family: var(--font-mono); font-size: 3rem; font-weight: 700; color: #5BD66C; line-height: 1; margin: 6px 0; transition: color var(--dur-fast); }
.db-number.hot { color: #FF6B9D; }
.db-bar { height: 12px; border-radius: var(--radius-full); background: rgba(255,255,255,0.1); overflow: hidden; }
.db-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #5BD66C, #FFD23F); border-radius: var(--radius-full); transition: width 0.1s linear, background var(--dur-fast); }
.db-bar-fill.hot { background: linear-gradient(90deg, #FF8A5B, #FF5A5F); }
.db-target { font-size: 0.8rem; opacity: 0.7; margin-top: 6px; }

/* 诊断行 */
.diag { font-size: 0.78rem; opacity: 0.65; font-family: var(--font-mono); line-height: 1.5; }

/* 柱状图 */
.bars-chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: var(--sp-3); background: rgba(255,255,255,0.04); border-radius: var(--radius-md); flex-wrap: nowrap; overflow-x: auto; }
.bars-chart .bar { flex: 1; min-width: 4px; border-radius: 4px 4px 0 0; transition: height var(--dur-base) var(--ease-out); }

/* 抽奖轮播 */
.lottery-btn { font-size: 1.3rem; padding: 16px 36px; margin-top: var(--sp-4); animation: popIn var(--dur-base) var(--ease-spring); }
.lottery-display { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--accent-yellow); min-height: 1.6em; text-align: center; }

/* ============================================================
   朗读闯关专属
   ============================================================ */
.reading-stage { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--sp-6); }
.passage-card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-6); box-shadow: var(--shadow-sm); }
.passage-card .lbl { font-family: var(--font-display); font-weight: 600; font-size: 0.82rem; color: var(--brand-500); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: var(--sp-2); }
.passage-card .txt { font-size: 1.08rem; line-height: 2; white-space: pre-wrap; }

.record-area { text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); }
.countdown-ring { position: relative; width: 160px; height: 160px; }
.countdown-ring svg { transform: rotate(-90deg); }
.countdown-ring .track { stroke: var(--border); fill: none; }
.countdown-ring .prog { stroke: var(--brand-500); fill: none; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.countdown-ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; }
.countdown-ring.recording .prog { stroke: var(--accent-pink); }

.transcript-box { background: var(--surface-2); border: 2px dashed var(--border-strong); border-radius: var(--radius-md); padding: var(--sp-4); min-height: 80px; text-align: left; color: var(--text-soft); font-size: 0.95rem; line-height: 1.7; }
.transcript-box .lbl { font-size: 0.75rem; color: var(--text-faint); margin-bottom: 6px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

/* 评分结果 */
.score-result { display: none; }
.score-result.show { display: block; animation: popIn var(--dur-slow) var(--ease-spring); }
.overall-ring { display: flex; align-items: center; gap: var(--sp-5); margin-bottom: var(--sp-6); flex-wrap: wrap; justify-content: center; }
.overall-ring .ring { position: relative; width: 130px; height: 130px; }
.overall-ring .ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; color: var(--brand-500); }
.overall-ring .info h3 { font-size: 1.4rem; margin-bottom: 4px; }
.overall-ring .info p { color: var(--text-soft); }

.score-bars { display: flex; flex-direction: column; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.score-bar-item .top { display: flex; justify-content: space-between; margin-bottom: 6px; font-weight: 700; }
.score-bar-item .top .name { display: flex; align-items: center; gap: 6px; }
.score-bar-item .track { height: 14px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; }
.score-bar-item .fill { height: 100%; width: 0; border-radius: var(--radius-full); transition: width 0.9s var(--ease-spring); }

.suggestion-card { background: linear-gradient(160deg, var(--brand-50), var(--surface)); border: 2px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); }
[data-theme="dark"] .suggestion-card { background: linear-gradient(160deg, var(--surface-2), var(--surface)); }
.suggestion-card .lbl { font-family: var(--font-display); font-weight: 600; margin-bottom: var(--sp-2); display: flex; align-items: center; gap: 6px; }
.suggestion-card .txt { line-height: 1.8; color: var(--text-soft); white-space: pre-wrap; }

.loading-dots { display: inline-flex; gap: 4px; }
.loading-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-500); animation: bounce 1s ease-in-out infinite; }
.loading-dots span:nth-child(2){animation-delay:0.15s;} .loading-dots span:nth-child(3){animation-delay:0.3s;}
@keyframes bounce { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-8px);} }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1024px) {
  .tree-layout { grid-template-columns: 1fr 220px; }
}
@media (max-width: 768px) {
  .tree-layout { grid-template-columns: 1fr; }
  .meter-col { position: static; }
  .summary-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   智学星球 · 新增工具共享组件（统一风格基础）
   学科色标 / 工具布局 / 表单 / 结果面板 / 雷达图 /
   聊天气泡 / 竞答卡 / 解题步骤 / 记忆卡翻转 / 即将上线
   ============================================================ */

/* —— 学科色系 —— */
.subj-chinese  { --sc: var(--accent-pink);    --sc-soft: var(--accent-pink-soft); }
.subj-math     { --sc: #3B82F6;               --sc-soft: rgba(59,130,246,.14); }
.subj-english  { --sc: var(--accent-green);   --sc-soft: var(--accent-green-soft); }
.subj-geo      { --sc: #F97316;               --sc-soft: rgba(249,115,22,.14); }
.subj-physics  { --sc: #8B5CF6;               --sc-soft: rgba(139,92,246,.14); }
.subj-chem     { --sc: #06B6D4;               --sc-soft: rgba(6,182,212,.14); }
.subj-bio      { --sc: #65A30D;               --sc-soft: rgba(101,163,13,.14); }
.subj-cross    { --sc: var(--accent-yellow);  --sc-soft: var(--accent-yellow-soft); }

.subject-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-family: var(--font-display); font-weight: 700; font-size: 0.78rem;
  background: var(--sc-soft, var(--brand-50)); color: var(--sc, var(--brand-700));
}

/* —— 工具页通用两栏布局 —— */
.tool-cols { display: grid; grid-template-columns: 1fr 340px; gap: var(--sp-5); max-width: 1200px; margin: 0 auto; padding: 0 var(--sp-5); }
.tool-cols .col-main { min-width: 0; }
.tool-cols .col-side { position: sticky; top: 84px; align-self: start; }
@media (max-width: 900px) { .tool-cols { grid-template-columns: 1fr; } .tool-cols .col-side { position: static; } }

/* —— 通用面板卡 —— */
.panel {
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-5); margin-bottom: var(--sp-4); box-shadow: var(--shadow-sm);
  animation: popIn var(--dur-slow) var(--ease-spring) both;
}
.panel h3 { font-size: 1.15rem; display: flex; align-items: center; gap: 8px; margin-bottom: var(--sp-3); }
.panel h3 .em { font-size: 1.3rem; }

/* —— 表单控件（复用 .input/.textarea，补充选择器行） —— */
.selector-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.selector-row .label-inline { font-size: 0.85rem; color: var(--text-soft); align-self: center; margin-right: 4px; }
.chip-select {
  padding: 6px 14px; border-radius: var(--radius-full); border: 2px solid var(--border);
  background: var(--surface); font-family: var(--font-display); font-weight: 600; font-size: 0.88rem;
  cursor: pointer; transition: all var(--dur-fast) var(--ease-spring);
}
.chip-select:hover { border-color: var(--brand-300); transform: translateY(-1px); }
.chip-select.active { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }

/* —— 结果得分环 —— */
.score-ring-wrap { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; }
.score-ring { position: relative; width: 120px; height: 120px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .ring-bg { fill: none; stroke: var(--border-strong); stroke-width: 10; }
.score-ring .ring-fg { fill: none; stroke: var(--accent-yellow); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.8s var(--ease-out); }
.score-ring .ring-num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; color: var(--brand-600); }

/* —— 雷达图（作文 6 维度） —— */
.radar-wrap { display: flex; justify-content: center; }
.radar-svg .axis { stroke: var(--border); stroke-width: 1; }
.radar-svg .grid { fill: none; stroke: var(--border); stroke-width: 1; opacity: 0.6; }
.radar-svg .label { font-size: 11px; fill: var(--text-soft); font-family: var(--font-display); font-weight: 600; }
.radar-svg .data-area { fill: var(--accent-pink); fill-opacity: 0.25; stroke: var(--accent-pink); stroke-width: 2; }
.radar-svg .data-dot { fill: var(--accent-pink); }

/* —— 维度评分条 —— */
.dim-bars { display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; min-width: 200px; }
.dim-bar-row { display: flex; align-items: center; gap: var(--sp-2); }
.dim-bar-row .nm { width: 56px; font-size: 0.85rem; font-weight: 600; color: var(--text-soft); }
.dim-bar-row .track { flex: 1; height: 10px; background: var(--surface-2); border-radius: var(--radius-full); overflow: hidden; }
.dim-bar-row .fill { height: 100%; border-radius: var(--radius-full); background: linear-gradient(90deg, var(--accent-yellow), var(--accent-pink)); transition: width 0.8s var(--ease-out); }
.dim-bar-row .vl { width: 32px; text-align: right; font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700; color: var(--brand-600); }

/* —— 逐句标注 —— */
.sentence-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.sentence { padding: 8px 12px; border-radius: var(--radius-md); border-left: 4px solid var(--border); background: var(--surface-2); font-size: 0.95rem; line-height: 1.7; }
.sentence.good { border-left-color: var(--accent-green); background: var(--accent-green-soft); }
.sentence.bad  { border-left-color: var(--danger); background: rgba(239,68,68,.08); }
.sentence .tag { display: inline-block; margin-right: 6px; font-size: 0.72rem; font-weight: 800; padding: 1px 7px; border-radius: var(--radius-full); vertical-align: middle; }
.sentence.good .tag { background: var(--accent-green); color: #fff; }
.sentence.bad .tag  { background: var(--danger); color: #fff; }

/* —— 聊天气泡（AI 导师） —— */
.chat-window { display: flex; flex-direction: column; gap: var(--sp-3); max-height: 60vh; overflow-y: auto; padding: var(--sp-2); }
.chat-bubble { max-width: 82%; padding: 10px 14px; border-radius: var(--radius-lg); line-height: 1.7; font-size: 0.95rem; white-space: pre-wrap; word-break: break-word; animation: popIn var(--dur-base) var(--ease-spring); }
.chat-bubble.user { align-self: flex-end; background: var(--brand-500); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble.ai { align-self: flex-start; background: var(--surface); border: 2px solid var(--border); border-bottom-left-radius: 4px; }
.chat-bubble.ai .who { display: block; font-family: var(--font-display); font-weight: 700; font-size: 0.78rem; color: var(--brand-600); margin-bottom: 2px; }
.chat-bubble.system { align-self: center; background: transparent; border: 1px dashed var(--border-strong); color: var(--text-soft); font-size: 0.85rem; }
.chat-cursor::after { content: '▋'; animation: blink 1s steps(2) infinite; color: var(--brand-500); }
@keyframes blink { 50% { opacity: 0; } }
.chat-input-row { display: flex; gap: var(--sp-2); align-items: flex-end; }
.chat-input-row .textarea { flex: 1; min-height: 48px; max-height: 140px; resize: none; }

/* —— 竞答卡 —— */
.quiz-progress { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.quiz-progress .bar { flex: 1; height: 10px; background: var(--surface-2); border-radius: var(--radius-full); overflow: hidden; }
.quiz-progress .bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-yellow), var(--accent-pink)); transition: width 0.4s var(--ease-out); }
.quiz-progress .timer { font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem; color: var(--accent-pink); min-width: 48px; text-align: right; }
.quiz-question { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; line-height: 1.6; margin-bottom: var(--sp-4); }
.quiz-options { display: flex; flex-direction: column; gap: var(--sp-2); }
.quiz-opt {
  display: flex; align-items: center; gap: var(--sp-3); padding: 12px 16px;
  border: 2px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
  cursor: pointer; transition: all var(--dur-fast) var(--ease-spring); font-size: 1rem;
}
.quiz-opt:hover { border-color: var(--brand-300); transform: translateX(4px); }
.quiz-opt .key { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: var(--brand-600); flex-shrink: 0; }
.quiz-opt.correct { border-color: var(--accent-green); background: var(--accent-green-soft); }
.quiz-opt.correct .key { background: var(--accent-green); color: #fff; }
.quiz-opt.wrong { border-color: var(--danger); background: rgba(239,68,68,.1); }
.quiz-opt.wrong .key { background: var(--danger); color: #fff; }
.quiz-opt.disabled { pointer-events: none; }

/* —— 解题步骤卡 —— */
.step-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.step-card { border: 2px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.step-card .step-head { display: flex; align-items: center; gap: var(--sp-2); padding: 10px 14px; background: var(--surface-2); cursor: pointer; font-weight: 600; }
.step-card .step-head .step-no { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-500); color: #fff; display: grid; place-items: center; font-size: 0.85rem; font-family: var(--font-display); }
.step-card .step-head .why-toggle { margin-left: auto; font-size: 0.82rem; color: var(--brand-600); }
.step-card .step-body { padding: var(--sp-3) var(--sp-4); line-height: 1.8; white-space: pre-wrap; }
.step-card .step-why { padding: var(--sp-3) var(--sp-4); border-top: 2px dashed var(--border); background: var(--accent-yellow-soft); color: #6a5500; font-size: 0.9rem; line-height: 1.7; display: none; }
.step-card .step-why.open { display: block; }

/* —— 记忆卡翻转 —— */
.flashcard-stage { display: grid; place-items: center; min-height: 280px; perspective: 1200px; }
.flashcard {
  width: min(440px, 90vw); aspect-ratio: 5/3; position: relative; cursor: pointer;
  transform-style: preserve-3d; transition: transform 0.6s var(--ease-spring);
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--radius-xl); border: 4px solid var(--border-strong); box-shadow: var(--shadow-sticker); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--sp-5); text-align: center; }
.flashcard .face.front { background: linear-gradient(135deg, var(--brand-50), var(--accent-yellow-soft)); }
.flashcard .face.back { background: linear-gradient(135deg, var(--accent-pink-soft), var(--accent-green-soft)); transform: rotateY(180deg); }
.flashcard .face .label { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-soft); margin-bottom: 8px; }
.flashcard .face .content { font-family: var(--font-display); font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 700; line-height: 1.4; }

/* —— 即将上线徽标 —— */
.coming-soon-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: var(--radius-full); font-size: 0.72rem; font-weight: 800;
  background: var(--surface-2); color: var(--text-soft); border: 1px dashed var(--border-strong);
}
.tool-card.locked { opacity: 0.62; cursor: not-allowed; }
.tool-card.locked:hover { transform: none; }

/* —— 工具大厅学科分组 —— */
.hall-section { margin-bottom: var(--sp-8); }
.hall-section .hall-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.hall-section .hall-head .ic { font-size: 1.8rem; }
.hall-section .hall-head h3 { font-family: var(--font-display); font-size: 1.4rem; }
.hall-section .hall-head .cnt { color: var(--text-soft); font-size: 0.85rem; }
.hall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-4); }

/* —— 空引导（未配置 AI） —— */
.need-ai-guide { text-align: center; padding: var(--sp-8) var(--sp-4); }
.need-ai-guide .em { font-size: 2.6rem; display: inline-block; animation: bobble 4s ease-in-out infinite; }

@media (max-width: 768px) {
  .hall-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
