:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-soft: #eef2ff;
  --accent: #f59e0b;
  --accent-soft: #fef3c7;
  --ok: #10b981;
  --ok-soft: #d1fae5;
  --err: #ef4444;
  --err-soft: #fee2e2;
  --bg: #f5f6fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --shadow: 0 10px 30px rgba(30, 41, 59, .08);
  --radius: 16px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  height: 62px; display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { font-size: 24px; }
.brand-name { font-size: 19px; font-weight: 800; color: var(--primary-dark); }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav a {
  padding: 7px 13px; border-radius: 10px; font-size: 14px; color: var(--text);
  font-weight: 500; white-space: nowrap;
}
.nav a:hover { background: var(--primary-soft); text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.guest-tag {
  font-size: 12px; color: var(--accent); background: var(--accent-soft);
  padding: 3px 10px; border-radius: 999px; font-weight: 600;
}

.guest-banner {
  background: linear-gradient(90deg, #fffbeb, #fef3c7);
  border-bottom: 1px solid #fde68a;
  padding: 9px 20px; font-size: 13px; color: #92400e;
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; font-family: inherit; font-size: 15px; font-weight: 600;
  border-radius: 12px; padding: 10px 22px; transition: transform .12s, box-shadow .12s, opacity .12s;
  background: var(--primary); color: #fff;
}
.btn:hover { opacity: .92; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(79, 70, 229, .25); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--primary), #7c3aed); }
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-light { background: #fff; color: var(--primary-dark); }
.btn-ok { background: var(--ok); }
.btn-ok:hover { box-shadow: 0 8px 20px rgba(16, 185, 129, .25); }
.btn-warn { background: var(--accent); }
.btn-warn:hover { box-shadow: 0 8px 20px rgba(245, 158, 11, .3); }
.btn-danger { background: var(--err); }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 13px 32px; font-size: 16px; border-radius: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Layout ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 30px 20px 60px; }
.page-narrow { max-width: 760px; }
.page-title { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--muted); margin-bottom: 24px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; border: 1px solid rgba(226, 232, 240, .6);
}
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.section-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.section-title .tag { font-size: 12px; font-weight: 600; margin-left: 8px; padding: 2px 9px; border-radius: 999px; vertical-align: 2px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.center { text-align: center; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 64px 20px 56px;
  text-align: center;
}
.hero-inner { max-width: 720px; margin: 0 auto; }
.hero-eyebrow {
  font-size: 13px; letter-spacing: 3px; color: var(--muted);
  margin-bottom: 14px;
}
.hero h1 { font-size: 40px; font-weight: 800; line-height: 1.3; margin-bottom: 16px; color: var(--text); }
.hero h1 .grad {
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: 16px; color: var(--muted); max-width: 560px; margin: 0 auto 30px; line-height: 1.9; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-progress {
  max-width: 420px; margin: 30px auto 0;
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 12px;
  font-size: 13px; color: var(--muted);
}
.hero-progress b { color: var(--primary-dark); }

/* ---------- Home sections ---------- */
.home-section { max-width: 1100px; margin: 0 auto; padding: 46px 20px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h2 { font-size: 20px; font-weight: 700; margin: 0; }
.link-more { font-size: 13px; color: var(--muted); }
.link-more:hover { color: var(--primary); text-decoration: none; }

.feature-card { text-align: left; }
.feature-card .ico {
  width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center;
  justify-content: center; font-size: 24px; margin-bottom: 14px;
}
.feature-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.feature-card p { font-size: 14px; color: var(--muted); }

.unit-card {
  display: flex; flex-direction: column; gap: 8px; cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.unit-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(30, 41, 59, .13); }
.unit-card h3 { font-size: 15px; font-weight: 700; }
.unit-card p { font-size: 13px; color: var(--muted); flex: 1; }
.unit-card .u-meta { font-size: 12px; color: var(--primary); font-weight: 600; }

/* ---------- About ---------- */
.about-block { margin-bottom: 16px; }
.about-block h2 {
  font-size: 17px; font-weight: 700; margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.about-block h3 { font-size: 15px; font-weight: 700; margin: 16px 0 6px; }
.about-block p { font-size: 14px; color: #475569; line-height: 1.9; }
.about-block ul { margin: 8px 0 0 18px; }
.about-block li { font-size: 14px; color: #475569; margin-bottom: 4px; }

.how-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.how-step { background: var(--card); border-radius: 14px; padding: 16px 10px; text-align: center; box-shadow: var(--shadow); }
.how-step .n {
  width: 30px; height: 30px; margin: 0 auto 8px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.how-step b { display: block; font-size: 14px; margin-bottom: 3px; }
.how-step span { font-size: 12px; color: var(--muted); }

/* ---------- Cards / pills ---------- */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.pill-ok { background: var(--ok-soft); color: #047857; }
.pill-warn { background: var(--accent-soft); color: #b45309; }
.pill-err { background: var(--err-soft); color: #b91c1c; }
.pill-info { background: var(--primary-soft); color: var(--primary-dark); }
.pill-muted { background: #f1f5f9; color: var(--muted); }
.pill-premium { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #78350f; }

.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.sd-new { background: #cbd5e1; }
.sd-learning { background: var(--accent); }
.sd-mastered { background: var(--ok); }
.sd-review { background: var(--err); }

.progress-track { background: #e2e8f0; border-radius: 999px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #7c3aed); transition: width .4s; }

/* ---------- Knowledge map ---------- */
.map-wrap { overflow-x: auto; padding-bottom: 12px; }
.map-col { background: var(--card); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); min-width: 230px; }
.map-col h4 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.kp-node {
  display: block; width: 100%; text-align: left; border: 1.5px solid var(--line);
  background: #fff; border-radius: 10px; padding: 8px 10px; margin-bottom: 8px;
  font-size: 13px; cursor: pointer; transition: border-color .12s, transform .12s; font-family: inherit;
}
.kp-node:hover { border-color: var(--primary); transform: translateX(2px); }
.kp-node .kp-title { font-weight: 600; color: var(--text); }
.kp-node .kp-meta { font-size: 11px; color: var(--muted); margin-top: 2px; display: flex; justify-content: space-between; }
.kp-node.b-new { border-left: 4px solid #cbd5e1; }
.kp-node.b-learning { border-left: 4px solid var(--accent); }
.kp-node.b-mastered { border-left: 4px solid var(--ok); }
.kp-node.b-review { border-left: 4px solid var(--err); }
.map-legend { display: flex; gap: 16px; justify-content: center; font-size: 12px; color: var(--muted); margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- Quiz ---------- */
.quiz-card { max-width: 720px; margin: 0 auto; }
.quiz-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.quiz-progress .progress-track { flex: 1; }
.quiz-progress .idx { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.quiz-q { font-size: 17px; font-weight: 600; margin-bottom: 18px; }
.quiz-q .q-tag { font-size: 12px; font-weight: 600; color: var(--primary); background: var(--primary-soft); padding: 2px 10px; border-radius: 999px; margin-right: 8px; vertical-align: 2px; }
.opt-list { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 16px;
  font-size: 15px; cursor: pointer; font-family: inherit; transition: border-color .12s, background .12s;
}
.opt:hover { border-color: var(--primary); background: var(--primary-soft); }
.opt .key {
  width: 26px; height: 26px; border-radius: 8px; background: #f1f5f9; color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.correct .key { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--err); background: var(--err-soft); }
.opt.wrong .key { background: var(--err); color: #fff; }
.opt[disabled] { cursor: default; }
.opt[disabled]:hover { border-color: var(--line); background: #fff; }
.opt[disabled].correct:hover { border-color: var(--ok); background: var(--ok-soft); }
.opt[disabled].wrong:hover { border-color: var(--err); background: var(--err-soft); }

.quiz-input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 14px; font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
.quiz-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.quiz-textarea { min-height: 110px; resize: vertical; line-height: 1.7; }
.fill-area, .solve-area { margin-top: 4px; }
.errata-form { margin-top: 12px; padding: 12px 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; }

.unit-test-row {
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.feedback {
  margin-top: 16px; border-radius: 12px; padding: 14px 16px; font-size: 14px;
  display: flex; gap: 10px; align-items: flex-start;
}
.feedback.ok { background: var(--ok-soft); color: #065f46; }
.feedback.bad { background: var(--err-soft); color: #991b1b; }
.feedback b { white-space: nowrap; }

/* ---------- Plan timeline ---------- */
.day-card { border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; }
.day-card + .day-card { margin-top: 14px; }
.day-head {
  padding: 14px 18px; display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, var(--primary-soft), #faf5ff); cursor: pointer; gap: 10px; flex-wrap: wrap;
}
.day-head h4 { font-size: 15px; font-weight: 700; }
.day-head .day-goal { font-size: 12px; color: var(--muted); }
.day-body { padding: 8px 18px 16px; }
.block-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 4px;
  border-bottom: 1px dashed var(--line); font-size: 14px;
}
.block-row:last-child { border-bottom: none; }
.block-time {
  min-width: 76px; font-weight: 700; color: var(--primary-dark); font-size: 13px;
  background: var(--primary-soft); border-radius: 8px; padding: 3px 8px; text-align: center;
}
.block-row .b-ico { font-size: 18px; }
.block-row .b-label { flex: 1; }
.block-row .b-min { color: var(--muted); font-size: 12px; white-space: nowrap; }
.block-row.break-row { background: #fafafa; border-radius: 8px; margin: 2px 0; }
.tag-learn { color: var(--primary); font-weight: 600; }
.tag-review { color: #b45309; font-weight: 600; }
.tag-test { color: #047857; font-weight: 600; }
.tag-move { color: #db2777; font-weight: 600; }

/* ---------- Learn page ---------- */
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumb a { color: var(--muted); }
.learn-goal {
  background: linear-gradient(135deg, var(--primary), #7c3aed); color: #fff;
  border-radius: 14px; padding: 16px 20px; margin-bottom: 16px; font-size: 14px;
}
.learn-goal b { display: block; font-size: 12px; opacity: .85; margin-bottom: 4px; letter-spacing: 1px; }

.premium-card {
  border: 1px solid #fde68a;
  background: linear-gradient(180deg, #fffbeb, #fff);
}
.learn-section { margin-bottom: 20px; }
.learn-section h3 { font-size: 17px; font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.learn-section h3 .num {
  width: 26px; height: 26px; border-radius: 8px; background: var(--primary-soft); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0;
}
.learn-section p { font-size: 15px; margin-bottom: 8px; }
.example-box {
  background: var(--primary-soft); border-left: 4px solid var(--primary);
  border-radius: 10px; padding: 14px 18px; margin-top: 10px;
}
.example-box b { color: var(--primary-dark); }
.example-box ol { margin: 8px 0 0 20px; font-size: 14px; }
.mistake-card {
  background: var(--err-soft); border-left: 4px solid var(--err);
  border-radius: 10px; padding: 12px 16px; margin-top: 10px; font-size: 14px;
}
.mistake-card b { color: #b91c1c; }
.tip-box {
  background: var(--accent-soft); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 12px 16px; margin-top: 10px; font-size: 14px;
}
.formula {
  display: inline-block; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 1px 9px; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 14px; margin: 0 2px;
}

/* ---------- Dashboard ---------- */
.stat-card { text-align: center; padding: 20px 14px; }
.stat-card .v { font-size: 30px; font-weight: 900; color: var(--primary-dark); }
.stat-card .l { font-size: 13px; color: var(--muted); margin-top: 2px; }
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 140px; padding: 0 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar {
  width: 70%; max-width: 44px; border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #7c3aed, var(--primary)); min-height: 4px; position: relative;
}
.bar-col .b-day { font-size: 11px; color: var(--muted); }
.bar-col .b-val { font-size: 11px; font-weight: 700; color: var(--primary-dark); }
.review-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px;
  border-bottom: 1px dashed var(--line); font-size: 14px;
}
.review-item:last-child { border-bottom: none; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field input, .field select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.range-wrap { display: flex; align-items: center; gap: 12px; }
.range-wrap input[type=range] { flex: 1; accent-color: var(--primary); }

/* ---------- Login ---------- */
.auth-card { max-width: 440px; margin: 30px auto; }
.auth-tabs { display: flex; gap: 6px; background: #f1f5f9; border-radius: 12px; padding: 4px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; border: none; background: transparent; padding: 8px; border-radius: 9px;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; color: var(--muted);
}
.auth-tab.active { background: #fff; color: var(--primary); box-shadow: 0 2px 6px rgba(30,41,59,.1); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--text); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: toastIn .25s ease;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Result screens ---------- */
.result-hero { text-align: center; padding: 34px 20px; }
.result-hero .big { font-size: 58px; }
.result-hero h2 { font-size: 26px; font-weight: 900; margin: 8px 0 4px; }
.result-hero .score { font-size: 15px; color: var(--muted); }
.score-ring {
  width: 120px; height: 120px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 900; color: #fff;
  background: conic-gradient(var(--ok) var(--p), #e2e8f0 0);
}
.score-ring::before { content: ""; }
.score-ring span { background: var(--card); width: 92px; height: 92px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text); }

/* ---------- Table ---------- */
.mini-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini-table th, .mini-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.mini-table th { color: var(--muted); font-weight: 600; font-size: 13px; }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center; padding: 30px 20px; color: var(--muted); font-size: 13px;
  border-top: 1px solid var(--line); margin-top: 40px;
}
.site-footer .footer-note { font-size: 12px; margin-top: 4px; opacity: .8; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .how-row { grid-template-columns: repeat(3, 1fr); }
  .nav { overflow-x: auto; justify-content: flex-start; }
  .brand-sub { display: none; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .how-row { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 32px; }
  .hero-stats { gap: 22px; }
  .topbar-inner { gap: 12px; padding: 0 12px; }
  .nav a { padding: 6px 9px; font-size: 13px; }
  .page { padding: 20px 14px 50px; }
}
