* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --primary: #4f6ef7;
  --primary-dark: #3a55d9;
  --primary-light: #eaf0ff;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2a44;
  --muted: #8792a8;
  --line: #edf0f6;
  --green: #22b573;
  --orange: #ff9f43;
  --red: #ff5c6c;
  --purple: #8b5cf6;
  --shadow: 0 8px 24px rgba(79, 110, 247, 0.08);
}

html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
button, input { font-family: inherit; }
button { cursor: pointer; border: none; outline: none; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; padding-bottom: 88px; position: relative; }

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #eef3ff 0%, #f7f9ff 45%, #fff 100%);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 28px;
  padding: 34px 26px 28px;
  box-shadow: 0 18px 50px rgba(79, 110, 247, 0.14);
}
.auth-logo { text-align: center; font-size: 46px; margin-bottom: 6px; }
.auth-title { text-align: center; font-size: 24px; font-weight: 800; letter-spacing: 0.5px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 24px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: 14px; padding: 4px; margin-bottom: 20px; }
.auth-tab { flex: 1; padding: 10px 0; text-align: center; border-radius: 11px; color: var(--muted); font-weight: 600; font-size: 14px; background: transparent; }
.auth-tab.active { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text); font-weight: 600; margin-bottom: 6px; padding-left: 2px; }
.field input {
  width: 100%; height: 48px; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 0 15px; font-size: 15px; color: var(--text); background: #fbfcff; transition: 0.2s;
}
.field input:focus { border-color: var(--primary); background: #fff; outline: none; }
.primary-btn {
  width: 100%; height: 50px; border-radius: 15px; background: linear-gradient(135deg, #5b78ff, #4f6ef7);
  color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 0.5px; margin-top: 8px;
  box-shadow: 0 8px 18px rgba(79, 110, 247, 0.25); transition: 0.2s;
}
.primary-btn:active { transform: scale(0.98); }
.auth-tip { text-align: center; color: var(--muted); font-size: 12px; margin-top: 16px; line-height: 1.6; }
.error-text { color: var(--red); font-size: 13px; text-align: center; min-height: 20px; margin-top: 4px; }

/* ---------- 顶部 ---------- */
.topbar {
  padding: 22px 20px 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.hello { font-size: 20px; font-weight: 800; }
.hello-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, #7c93ff, #4f6ef7);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(79, 110, 247, 0.25);
}
.logout { background: #fff; color: var(--muted); border-radius: 10px; padding: 6px 10px; font-size: 12px; border: 1px solid var(--line); }

.page { padding: 0 16px 20px; }
.section-title { font-size: 16px; font-weight: 800; margin: 22px 4px 12px; display: flex; align-items: center; justify-content: space-between; }
.section-title .more { font-size: 12px; color: var(--primary); font-weight: 600; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.grade-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.grade-row::-webkit-scrollbar { display: none; }
.grade-chip {
  flex: 0 0 auto; padding: 9px 14px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.grade-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 5px 14px rgba(79,110,247,0.25); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card { text-align: center; padding: 14px 6px; border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.stat-num { font-size: 22px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.task-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.task-card {
  border-radius: 18px; padding: 16px 14px; position: relative; overflow: hidden; min-height: 118px;
  color: #fff; text-align: left; transition: 0.2s;
}
.task-card:active { transform: scale(0.97); }
.task-card .icon { font-size: 28px; }
.task-card .name { font-size: 16px; font-weight: 800; margin-top: 8px; }
.task-card .desc { font-size: 11px; opacity: 0.85; margin-top: 3px; }
.task-card .done { position: absolute; right: 10px; top: 10px; background: rgba(255,255,255,0.25); border-radius: 20px; padding: 3px 8px; font-size: 11px; font-weight: 700; }
.t-cn { background: linear-gradient(135deg, #ff9a6c, #ff7043); }
.t-ma { background: linear-gradient(135deg, #5eb0ff, #3b82f6); }
.t-en { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.t-code { background: linear-gradient(135deg, #34d399, #10b981); }

.week { display: flex; justify-content: space-between; gap: 6px; }
.week-day { flex: 1; text-align: center; }
.week-label { font-size: 11px; color: var(--muted); }
.week-dot {
  width: 36px; height: 36px; margin: 6px auto 0; border-radius: 12px; background: #f0f3fa;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--muted);
}
.week-dot.hit { background: var(--primary-light); color: var(--primary); }
.week-dot.today { outline: 2px solid var(--primary); }

.banner {
  background: linear-gradient(135deg, #1f2a54, #3b4d9c); border-radius: 20px; padding: 18px; color: #fff; position: relative; overflow: hidden;
}
.banner .tag { display: inline-block; background: rgba(255,255,255,0.16); border-radius: 20px; padding: 3px 10px; font-size: 11px; }
.banner h3 { margin: 10px 0 6px; font-size: 18px; }
.banner p { margin: 0; font-size: 12px; opacity: 0.85; line-height: 1.6; }
.banner .go { margin-top: 12px; display: inline-block; background: #fff; color: #2b3a7a; padding: 7px 14px; border-radius: 20px; font-size: 12px; font-weight: 700; }

/* ---------- 答题 ---------- */
.quiz-head { padding: 20px 16px 0; }
.quiz-top { display: flex; align-items: center; justify-content: space-between; }
.back-btn { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px; font-size: 13px; color: var(--text); }
.quiz-meta { font-size: 12px; color: var(--muted); }
.progress-track { height: 8px; background: #e8edf8; border-radius: 10px; margin: 14px 0 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #6d88ff, #4f6ef7); border-radius: 10px; transition: width 0.3s; }
.question-card { margin-top: 14px; padding: 20px 18px; border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.q-tag { display: inline-block; font-size: 11px; color: var(--primary); background: var(--primary-light); border-radius: 20px; padding: 4px 10px; font-weight: 700; }
.q-stem { font-size: 18px; font-weight: 700; line-height: 1.6; margin: 14px 0 18px; }
.code-box { background: #1e2438; color: #d7e4ff; border-radius: 14px; padding: 14px; font-family: Consolas, Menlo, monospace; font-size: 13px; line-height: 1.7; white-space: pre-wrap; margin-bottom: 16px; }
.option {
  width: 100%; text-align: left; border: 1.5px solid var(--line); background: #fbfcff; border-radius: 14px;
  padding: 13px 15px; margin-bottom: 10px; font-size: 15px; color: var(--text); transition: 0.15s; white-space: pre-wrap;
}
.option:hover { border-color: #b9c8ff; }
.option.right { border-color: var(--green); background: #eafaf3; color: #157a52; font-weight: 700; }
.option.wrong { border-color: var(--red); background: #fff0f1; color: #c33b49; font-weight: 700; }
.option.dim { opacity: 0.55; }
.explain { border-radius: 14px; padding: 13px 15px; background: #fff8e8; color: #8a6418; font-size: 13px; line-height: 1.6; margin-top: 12px; }
.next-btn { width: 100%; height: 50px; border-radius: 15px; background: var(--primary); color: #fff; font-size: 16px; font-weight: 700; margin-top: 8px; }
.next-btn:disabled { background: #c9d2ef; cursor: not-allowed; }

.result-card { text-align: center; padding: 34px 20px; border-radius: 24px; background: #fff; box-shadow: var(--shadow); margin-top: 18px; }
.result-stars { font-size: 40px; letter-spacing: 4px; }
.result-score { font-size: 34px; font-weight: 800; color: var(--primary); margin: 8px 0; }
.result-desc { color: var(--muted); font-size: 13px; }
.result-actions { display: flex; gap: 10px; margin-top: 22px; }
.result-actions button { flex: 1; height: 46px; border-radius: 14px; font-size: 14px; font-weight: 700; }
.btn-ghost { background: var(--primary-light); color: var(--primary); }

/* ---------- 进度 ---------- */
.progress-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.progress-bar-row .label { width: 44px; font-size: 13px; font-weight: 600; }
.progress-bar-row .bar { flex: 1; height: 10px; background: #eef1f8; border-radius: 10px; overflow: hidden; }
.progress-bar-row .fill { height: 100%; border-radius: 10px; background: linear-gradient(90deg, #6d88ff, #4f6ef7); }
.progress-bar-row .val { width: 38px; text-align: right; font-size: 12px; color: var(--muted); }
.achievement-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.achievement { text-align: center; padding: 14px 6px; border-radius: 16px; background: #f7f9ff; opacity: 0.45; }
.achievement.unlocked { opacity: 1; background: linear-gradient(160deg, #fff8e8, #fff); }
.achievement .ico { font-size: 26px; }
.achievement .nm { font-size: 12px; font-weight: 700; margin-top: 5px; }
.achievement .ds { font-size: 10px; color: var(--muted); margin-top: 2px; }
.record-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.record-item:last-child { border-bottom: none; }
.record-title { font-size: 14px; font-weight: 600; }
.record-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.record-right { text-align: right; font-size: 13px; font-weight: 700; color: var(--orange); }

/* ---------- 课程 ---------- */
.hero-course { background: linear-gradient(135deg, #4f6ef7, #8b5cf6); color: #fff; border-radius: 22px; padding: 22px 18px; margin-bottom: 16px; }
.hero-course .tag { background: rgba(255,255,255,0.2); border-radius: 20px; padding: 4px 11px; font-size: 11px; }
.hero-course h2 { font-size: 21px; margin: 10px 0 6px; }
.hero-course p { margin: 0; font-size: 12px; opacity: 0.9; line-height: 1.6; }
.highlight { display: flex; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.highlight:last-child { border-bottom: none; }
.hl-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 13px; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 21px; }
.hl-tag { font-size: 10px; color: var(--primary); font-weight: 700; }
.hl-title { font-size: 15px; font-weight: 800; margin: 2px 0 4px; }
.hl-desc { font-size: 12px; color: var(--muted); line-height: 1.6; }
.path-row { display: flex; gap: 6px; margin-top: 12px; }
.path-step { flex: 1; text-align: center; background: var(--primary-light); color: var(--primary); border-radius: 10px; padding: 8px 2px; font-size: 11px; font-weight: 700; }
.interest-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.interest-chip { padding: 8px 12px; border-radius: 12px; background: #f2f5fc; color: var(--muted); font-size: 12px; font-weight: 600; border: 1.5px solid transparent; }
.interest-chip.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.success-box { text-align: center; padding: 20px 10px; color: var(--green); font-weight: 700; }
.success-box .ico { font-size: 40px; display: block; margin-bottom: 8px; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px;
  background: rgba(255,255,255,0.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  display: flex; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); z-index: 20;
}
.tab { flex: 1; text-align: center; color: var(--muted); font-size: 11px; }
.tab .ico { display: block; font-size: 21px; line-height: 1.2; }
.tab.active { color: var(--primary); font-weight: 700; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; top: 24px; transform: translate(-50%, -20px); background: rgba(31,42,68,0.92); color: #fff;
  padding: 10px 18px; border-radius: 20px; font-size: 13px; opacity: 0; pointer-events: none; transition: 0.25s; z-index: 99; max-width: 86%;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 0; }
.version-badge { margin: 2px 0 14px; padding: 8px 14px; background: #eef4ff; color: #4169c9; font-size: 12px; font-weight: 700; border-radius: 12px; text-align: center; letter-spacing: .3px; }

/* ---------- 视频与图片 ---------- */
.video-card { background: #fff; border-radius: 18px; padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.video-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.video-card video { width: 100%; display: block; border-radius: 12px; background: #111827; }
.media-card { padding: 10px; }
.media-card img { width: 100%; display: block; border-radius: 12px; }
.media-caption { text-align: center; font-size: 12px; color: var(--muted); padding: 10px 4px 2px; }

/* ---------- 20 讲大纲 ---------- */
.outline-list { margin-top: 4px; }
.outline-item { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; background: #fff; overflow: hidden; box-shadow: 0 4px 12px rgba(79,110,247,0.05); }
.outline-item summary { padding: 13px 14px; font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.outline-item summary::-webkit-details-marker { display: none; }
.outline-item summary .idx { color: var(--primary); margin-right: 8px; font-size: 12px; }
.outline-item summary .arrow { color: var(--muted); font-size: 12px; transition: transform 0.2s; }
.outline-item[open] summary .arrow { transform: rotate(90deg); }
.outline-body { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.outline-body .know { font-size: 12px; color: var(--muted); line-height: 1.8; padding-top: 10px; }
.outline-body .know b { color: var(--text); }
.outline-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.outline-tag { border-radius: 8px; padding: 3px 8px; font-size: 11px; font-weight: 600; }
.outline-tag.cross { background: #eafaf3; color: #157a52; }
.outline-tag.algo { background: var(--primary-light); color: var(--primary); }

/* ---------- 图形化课程页 ---------- */
.seg { display: flex; gap: 8px; margin: 2px 4px 14px; }
.seg-btn {
  flex: 1; padding: 10px 0; border-radius: 16px; background: #fff; border: 1.5px solid var(--line);
  color: var(--muted); font-weight: 700; font-size: 14px; transition: 0.2s;
}
.seg-btn .s { display: block; font-size: 10px; font-weight: 600; opacity: 0.85; margin-top: 2px; }
.seg-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79, 110, 247, 0.25); }

.unit-head { display: flex; align-items: center; gap: 10px; margin: 20px 4px 10px; }
.unit-key {
  flex: 0 0 36px; height: 36px; border-radius: 12px; background: linear-gradient(135deg, #6d88ff, #4f6ef7);
  color: #fff; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.unit-title { font-size: 15px; font-weight: 800; }
.unit-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.unit-tag { margin-left: auto; font-size: 10px; font-weight: 700; color: var(--primary); background: var(--primary-light); border-radius: 8px; padding: 3px 8px; white-space: nowrap; }

.kind { display: inline-block; font-size: 10px; font-weight: 700; border-radius: 8px; padding: 3px 8px; margin-bottom: 8px; }
.k-anim { background: #fff1e8; color: #c2601f; }
.k-know { background: #eaf0ff; color: #3a55d9; }
.k-proj { background: #f0e9ff; color: #6d3fd1; }
.k-hard { background: #e6f8ef; color: #12805a; }
.k-ai   { background: #e8f6ff; color: #0d6f9e; }

.growth-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.growth-row:last-child { border-bottom: none; }
.growth-unit { font-size: 13px; font-weight: 800; color: var(--primary); }
.growth-skill { font-size: 13px; color: var(--text); margin-top: 4px; font-weight: 600; }
.growth-desc { font-size: 12px; color: var(--muted); line-height: 1.7; margin-top: 4px; }

.callout {
  background: linear-gradient(160deg, #fff8e8, #fff); border-radius: 16px; padding: 14px 16px;
  font-size: 13px; line-height: 1.75; color: #8a6418; margin-top: 12px;
}
.callout b { color: #6b4c10; }

.stat-grid.four { grid-template-columns: repeat(4, 1fr); }
.stat-grid.four .stat-card { padding: 12px 4px; }
.stat-grid.four .stat-num { font-size: 18px; }
.stat-grid.four .stat-label { font-size: 10px; }

.plan-row { display: flex; align-items: stretch; gap: 6px; margin-top: 12px; }
.plan-step { flex: 1; text-align: center; border-radius: 12px; padding: 10px 4px; font-size: 11px; font-weight: 700; line-height: 1.5; }
.plan-step.now { background: linear-gradient(135deg, #6d88ff, #4f6ef7); color: #fff; box-shadow: 0 5px 14px rgba(79,110,247,.28); }
.plan-step.next { background: var(--primary-light); color: var(--primary); }
.plan-step.later { background: #f2f5fc; color: var(--muted); }
.plan-arrow { align-self: center; color: var(--muted); font-size: 12px; }

/* ---------- 题目图片 ---------- */
.q-image {
  position: relative; margin: 0 0 16px; border-radius: 14px; overflow: hidden;
  border: 1.5px solid var(--line); background: #fff; cursor: zoom-in;
}
.q-image img { width: 100%; display: block; }
.q-image .zoom-hint {
  text-align: right; background: #f4f7ff; color: var(--primary);
  font-size: 11px; font-weight: 700; padding: 7px 12px; border-top: 1px solid var(--line);
}
.zoom-mask {
  position: fixed; inset: 0; z-index: 200; background: rgba(10, 14, 26, 0.94);
  display: none; align-items: center; justify-content: center; padding: 12px;
  cursor: zoom-out;
}
.zoom-mask.show { display: flex; }
.zoom-mask img {
  max-width: 100%; max-height: 92vh; border-radius: 10px; background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* ---------- 作品封面 / 作品列表（站点不再内嵌视频） ---------- */
.media-shot { width: 100%; display: block; border-radius: 12px; background: #f2f5fc; }
.work-row { display: flex; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.work-row.last { border-bottom: none; }
.work-ico {
  flex: 0 0 38px; height: 38px; border-radius: 12px; background: var(--primary-light);
  display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.work-name { font-size: 14px; font-weight: 800; }
.work-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.work-desc { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 3px; }
