/* ================= 基础与主题 ================= */
:root {
  --bg-0: #060913;
  --bg-1: #0b1120;
  --bg-2: #111a30;
  --card: rgba(255, 255, 255, 0.045);
  --card-border: rgba(255, 255, 255, 0.10);
  --text: #e8edf7;
  --text-dim: #9aa7c2;
  --text-faint: #6b7895;
  --accent-1: #22d3ee;   /* 青 */
  --accent-2: #a78bfa;   /* 紫 */
  --accent-3: #34d399;   /* 绿 */
  --warn: #fbbf24;
  --danger: #fb7185;
  --grad: linear-gradient(120deg, #22d3ee 0%, #6366f1 55%, #a78bfa 100%);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(34, 211, 238, 0.16), transparent 60%),
    radial-gradient(1000px 700px at 95% 0%, rgba(167, 139, 250, 0.16), transparent 55%),
    radial-gradient(900px 700px at 50% 110%, rgba(99, 102, 241, 0.14), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ================= 顶栏 ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 22px;
  background: rgba(8, 12, 24, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 30px; filter: drop-shadow(0 0 8px rgba(34,211,238,.6)); }
.brand-text h1 { font-size: 18px; font-weight: 700; letter-spacing: .5px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-text p { font-size: 12px; color: var(--text-dim); }

.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all .18s ease;
}
.nav-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.nav-btn.active {
  color: #06121f;
  font-weight: 700;
  background: var(--grad);
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(99, 102, 241, .45);
}
.nav-btn.done { color: #5eead4; border-color: rgba(52, 211, 153, .45); }

.progress-wrap { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
.progress-bar {
  width: 120px; height: 8px; border-radius: 999px;
  background: rgba(255,255,255,.08); overflow: hidden;
}
.progress-fill { height: 100%; width: 0; border-radius: 999px; background: var(--grad); transition: width .5s ease; }
.progress-text { min-width: 34px; font-variant-numeric: tabular-nums; }

/* ================= 主区域 ================= */
.main { max-width: 1180px; margin: 0 auto; padding: 28px 22px 60px; }

.page { display: none; animation: fadeUp .4s ease; }
.page.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ================= 首页 ================= */
.hero { text-align: center; padding: 30px 10px 10px; }
.hero-badge { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.hero-title {
  font-size: clamp(26px, 5vw, 44px); font-weight: 800; letter-spacing: .5px; margin-bottom: 14px;
  background: linear-gradient(120deg, #eaf6ff, #22d3ee 40%, #a78bfa 80%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { max-width: 720px; margin: 0 auto 22px; color: var(--text-dim); font-size: 16px; }
.hero-sub strong { color: var(--accent-1); }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.section-title { margin: 36px 0 14px; }
.section-title h3 { font-size: 20px; font-weight: 700; }

.concept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.concept-chip {
  border: 1px solid var(--card-border); background: var(--card);
  border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer;
  transition: all .18s ease;
}
.concept-chip:hover { transform: translateY(-3px); border-color: rgba(34,211,238,.5); box-shadow: 0 8px 24px rgba(34,211,238,.18); }
.concept-chip h4 { font-size: 15px; color: var(--accent-1); margin-bottom: 3px; }
.concept-chip p { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.module-card {
  position: relative; border: 1px solid var(--card-border); background: var(--card);
  border-radius: var(--radius); padding: 20px; cursor: pointer; overflow: hidden;
  transition: all .2s ease;
}
.module-card:hover { transform: translateY(-4px); border-color: rgba(167,139,250,.5); box-shadow: var(--shadow); }
.module-num { font-size: 40px; font-weight: 800; opacity: .18; position: absolute; right: 14px; top: 6px; }
.module-card h4 { font-size: 17px; margin-bottom: 8px; color: #dbe7ff; }
.module-card p { font-size: 13px; color: var(--text-dim); }
.module-go { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--accent-2); font-weight: 700; }

.legend-card {
  margin-top: 28px; border: 1px solid var(--card-border); background: var(--card);
  border-radius: var(--radius); padding: 18px 20px;
}
.legend-card h4 { font-size: 15px; margin-bottom: 8px; color: var(--warn); }
.legend-card ul { list-style: none; display: grid; gap: 6px; }
.legend-card li { font-size: 13px; color: var(--text-dim); }

/* ================= 通用卡片 ================= */
.card {
  border: 1px solid var(--card-border); background: var(--card);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px;
  backdrop-filter: blur(6px);
}
.card-head { margin-bottom: 12px; }
.card-head h3 { font-size: 17px; margin-bottom: 4px; }
.card-head h4 { font-size: 15px; }
.card h4 { margin-bottom: 6px; }
.hint { font-size: 13px; color: var(--text-dim); }

.page-head { margin-bottom: 18px; }
.page-head h2 {
  font-size: 24px; font-weight: 800; margin-bottom: 6px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  display: inline-block;
}
.page-head .lead { color: var(--text-dim); font-size: 15px; max-width: 860px; }
.sub-head { margin-top: 26px; }
.sub-head h3 { font-size: 19px; color: var(--text); }

/* ================= 徽章 ================= */
.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  vertical-align: middle; font-weight: 600; margin-left: 6px;
}
.badge-real { background: rgba(52, 211, 153, .16); color: #5eead4; border: 1px solid rgba(52,211,153,.4); }
.badge-sim { background: rgba(251, 191, 36, .14); color: #fcd34d; border: 1px solid rgba(251,191,36,.4); }
.badge-info { background: rgba(34, 211, 238, .14); color: #7dd3fc; border: 1px solid rgba(34,211,238,.4); }

/* ================= 按钮 / 输入 ================= */
.btn {
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: 14px; cursor: pointer; font-weight: 600;
  transition: all .18s ease; color: var(--text);
}
.btn-primary { background: var(--grad); color: #06121f; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(99,102,241,.5); }
.btn-ghost { background: rgba(255,255,255,.05); border-color: var(--card-border); color: var(--text); }
.btn-ghost:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); }
.btn.small { padding: 6px 12px; font-size: 13px; }

.input, .textarea, .select {
  width: 100%; background: rgba(0,0,0,.28); border: 1px solid var(--card-border);
  color: var(--text); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px;
  font-family: inherit; outline: none; transition: border-color .15s ease;
}
.input:focus, .textarea:focus, .select:focus { border-color: rgba(34,211,238,.6); }
.textarea { min-height: 90px; resize: vertical; }
.textarea.small { min-height: 70px; }
.select { width: auto; }
.input.grow { flex: 1; min-width: 220px; }

/* ================= 关卡一：拆字 ================= */
.split-row { display: grid; gap: 12px; }
.split-actions { display: flex; gap: 10px; }
.tok-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 12px 0; font-size: 13px; color: var(--text-dim); }
.tok-legend { display: flex; gap: 10px; align-items: center; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.dot-han { background: #22d3ee; } .dot-word { background: #818cf8; } .dot-num { background: #34d399; } .dot-punct { background: #fbbf24; }
.tok-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; }
.tok-chip {
  padding: 3px 8px; border-radius: 6px; font-size: 14px; border: 1px solid transparent;
  animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tok-chip.han { background: rgba(34,211,238,.14); border-color: rgba(34,211,238,.4); color: #a5f3fc; }
.tok-chip.word { background: rgba(129,140,248,.16); border-color: rgba(129,140,248,.45); color: #c7d2fe; }
.tok-chip.num { background: rgba(52,211,153,.14); border-color: rgba(52,211,153,.4); color: #86efac; }
.tok-chip.punct { background: rgba(251,191,36,.14); border-color: rgba(251,191,36,.4); color: #fde68a; }

.game-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.game-card { margin-bottom: 0; }
.game-card h4 { color: #dbe7ff; }
.game-q { margin: 10px 0; padding: 10px 12px; background: rgba(0,0,0,.24); border-radius: 8px; font-size: 14px; border-left: 3px solid var(--accent-1); }
.game-input-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.game-input-row .input { width: 120px; }
.feedback { margin: 10px 0; font-size: 14px; min-height: 22px; font-weight: 600; }
.feedback.ok { color: #5eead4; } .feedback.no { color: var(--danger); }

.insight { border-left: 3px solid var(--accent-2); }
.insight h4 { color: var(--accent-2); }

/* ================= 关卡二：记忆 ================= */
.win-config { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 10px 0 14px; }
.win-config input[type=range] { flex: 1; min-width: 180px; accent-color: var(--accent-1); }
.win-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.fruits-status { font-size: 13px; color: var(--text-dim); margin-left: auto; }
.current-fruit { margin-top: 12px; font-size: 15px; color: var(--accent-1); min-height: 24px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ctx-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 46px; padding: 8px; border: 1px dashed var(--card-border); border-radius: 10px; }
.ctx-chips.dropped { opacity: .55; }
.fruit-chip { padding: 4px 10px; border-radius: 8px; background: rgba(34,211,238,.12); border: 1px solid rgba(34,211,238,.35); font-size: 14px; }
.fruit-chip.dropped { background: rgba(251,113,133,.1); border-color: rgba(251,113,133,.35); color: #fda4af; }
.empty-hint { color: var(--text-faint); font-size: 13px; align-items: center; display: flex; }

.ask-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.ask-row label { font-size: 14px; color: var(--text-dim); }
.ai-bubble {
  margin-top: 12px; padding: 12px 14px; background: rgba(0,0,0,.26); border-radius: 12px;
  border-left: 3px solid var(--accent-1); font-size: 14px; min-height: 22px;
}

/* ================= 关卡三：沟通 ================= */
.compare .compare-card { margin-bottom: 0; }
.compare-card.bad { border-color: rgba(251,113,133,.25); }
.compare-card.good { border-color: rgba(52,211,153,.3); }
.msg-block { margin-bottom: 10px; }
.msg-role {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-bottom: 4px;
}
.role-user { background: rgba(34,211,238,.16); color: #7dd3fc; border: 1px solid rgba(34,211,238,.4); }
.role-system { background: rgba(167,139,250,.18); color: #c4b5fd; border: 1px solid rgba(167,139,250,.45); }
.msg-body { padding: 10px 12px; background: rgba(0,0,0,.26); border-radius: 8px; font-size: 13px; white-space: pre-wrap; }
.out-label { font-size: 12px; color: var(--text-faint); margin: 10px 0 4px; }
.ai-out {
  padding: 12px 14px; background: rgba(0,0,0,.24); border-radius: 10px; font-size: 14px;
  white-space: pre-wrap; border: 1px solid var(--card-border); min-height: 20px;
}
.role-list { list-style: none; display: grid; gap: 8px; margin-top: 6px; }
.role-list li { font-size: 14px; color: var(--text-dim); }

/* ================= 关卡四 / 结课 ================= */
.pipeline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.pipe-step { padding: 5px 10px; border-radius: 8px; background: rgba(99,102,241,.14); border: 1px solid rgba(99,102,241,.35); font-size: 12px; }
.pipe-arrow { color: var(--text-faint); }
.sources { display: grid; gap: 10px; margin-top: 12px; }
.source-item {
  border: 1px solid var(--card-border); border-radius: 10px; padding: 10px 12px;
  background: rgba(0,0,0,.2); font-size: 13px;
}
.source-item .src-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.source-item .src-title { font-weight: 700; color: var(--accent-1); }
.source-item .src-score { color: var(--warn); font-size: 12px; }
.source-item .src-cat { font-size: 11px; color: var(--text-faint); }
.source-item .src-snippet { color: var(--text-dim); }
.source-item .src-snippet mark { background: rgba(251,191,36,.3); color: #fde68a; border-radius: 3px; padding: 0 2px; }

.no-data {
  padding: 16px; text-align: center; color: var(--text-faint); font-size: 14px;
  border: 1px dashed var(--card-border); border-radius: 10px; margin-top: 8px;
}
.no-data.warn { color: var(--warn); border-color: rgba(251,191,36,.4); }

.kb-form { display: grid; gap: 10px; }
.kb-list { display: grid; gap: 8px; min-height: 40px; }
.kb-item { border: 1px solid var(--card-border); border-radius: 10px; padding: 10px 12px; background: rgba(0,0,0,.2); }
.kb-item .kb-title { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kb-item .kb-cat { font-size: 11px; color: var(--accent-2); }
.kb-item p { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.kb-del { background: rgba(251,113,133,.14); color: #fda4af; border: 1px solid rgba(251,113,133,.4); border-radius: 6px; cursor: pointer; font-size: 12px; padding: 2px 8px; }
.kb-del:hover { background: rgba(251,113,133,.3); }

/* ================= 概念地图 ================= */
.map-layout { display: grid; grid-template-columns: 1fr 320px; gap: 14px; align-items: start; }
.map-card { padding: 10px; }
.map-canvas { position: relative; width: 100%; aspect-ratio: 1000 / 640; }
.map-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-node {
  position: absolute; transform: translate(-50%, -50%); cursor: pointer;
  padding: 8px 12px; border-radius: 12px; text-align: center; line-height: 1.25;
  background: rgba(11,17,32,.92); border: 1.5px solid rgba(34,211,238,.35);
  color: var(--text); font-size: 13px; font-weight: 600; transition: all .18s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.map-node small { display: block; font-size: 10px; color: var(--text-faint); font-weight: 400; }
.map-node:hover { border-color: var(--accent-1); box-shadow: 0 0 20px rgba(34,211,238,.4); }
.map-node.central { border-color: rgba(167,139,250,.6); background: rgba(20,16,40,.94); }
.map-edge { stroke: rgba(148,163,184,.4); stroke-width: 2; fill: none; }
.map-edge-label { font-size: 11px; fill: var(--text-faint); }
.node-detail .related { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.related .rel-chip { padding: 4px 10px; border-radius: 999px; background: rgba(99,102,241,.14); border: 1px solid rgba(99,102,241,.35); font-size: 12px; cursor: pointer; }
.related .rel-chip:hover { background: rgba(99,102,241,.3); }
.arrow-legend { color: var(--accent-1); font-weight: 600; }

/* ================= 页脚 / Toast ================= */
.footer { max-width: 1180px; margin: 0 auto; padding: 24px 22px 40px; text-align: center; color: var(--text-faint); font-size: 13px; border-top: 1px solid var(--card-border); }
.footer-note { margin: 8px 0 12px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: rgba(11,17,32,.95); border: 1px solid var(--card-border); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: all .3s ease; z-index: 99; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ================= 响应式 ================= */
@media (max-width: 860px) {
  .two-col, .map-layout { grid-template-columns: 1fr; }
  .progress-wrap { display: none; }
  .nav { order: 3; }
  .topbar { gap: 8px; }
}
