/* ============ 985 冲刺学习平台 · 全局样式 ============ */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e9f2;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #e8efff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .05);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .16);
  --sidebar-w: 232px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scrollbar-gutter: stable; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
::selection { background: #c7d8ff; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: #0f1b33; border-right: 1px solid #16233d; color: #cbd5e1;
  position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; z-index: 40; overflow: hidden;
  background-image: radial-gradient(circle at 10% 0%, rgba(37, 99, 235, .35), transparent 45%);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 14px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #3b82f6, #2563eb);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; letter-spacing: -.5px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .45);
}
.brand-title { color: #fff; font-weight: 700; font-size: 16px; line-height: 1.2; }
.brand-sub { color: #7f8dab; font-size: 12px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.nav-group { margin-top: 14px; padding: 0 8px 6px; font-size: 11px; color: #64748b; letter-spacing: .08em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: #cbd5e1; cursor: pointer; font-size: 14px; margin-bottom: 2px; border: 0; background: transparent; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(37, 99, 235, .9), rgba(37, 99, 235, .55)); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, .3); }
.nav-icon { width: 20px; text-align: center; font-size: 15px; }
.sidebar-foot { padding: 12px 16px 18px; border-top: 1px solid rgba(255, 255, 255, .06); font-size: 12px; color: #64748b; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-weight: 700; font-size: 17px; }
.topbar-spacer { flex: 1; }
.content { padding: 22px 24px 60px; max-width: 1320px; width: 100%; margin: 0 auto; }

.menu-btn { display: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #2563eb); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 14px;
}
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: #fff; }
.user-chip:hover { border-color: #cbd5e1; }
.dropdown {
  position: absolute; right: 16px; top: 56px; background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); min-width: 180px; padding: 6px; z-index: 50;
}
.dropdown button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.dropdown button:hover { background: var(--surface-2); }
.scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 35; display: none; }

/* ---------- 通用组件 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 16px; }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-left { grid-template-columns: minmax(0,1.1fr) minmax(0,1fr); }
.g-report { grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); }
.g-grading { grid-template-columns: minmax(0,1fr) 340px; }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.mt { margin-top: 16px; }
.mt-sm { margin-top: 8px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.hidden { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border);
  background: #fff; padding: 8px 16px; border-radius: 10px; cursor: pointer; font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: #cbd5e1; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }

.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.textarea { min-height: 90px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap;
}
.tag-blue { background: var(--primary-soft); color: var(--primary-dark); border-color: #d5e2ff; }
.tag-green { background: #e8f8f0; color: #047857; border-color: #c7f0da; }
.tag-amber { background: #fff7e6; color: #b45309; border-color: #ffe3aa; }
.tag-red { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.tag-gray { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }

.badge-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.progress { height: 8px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, #2563eb); border-radius: 99px; transition: width .5s; }
.progress.green > i { background: linear-gradient(90deg, #34d399, #10b981); }
.progress.amber > i { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.progress.red > i { background: linear-gradient(90deg, #f87171, #ef4444); }

.stat { padding: 18px 20px; }
.stat-label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.stat-value small { font-size: 14px; font-weight: 600; color: var(--text-3); margin-left: 2px; crossed: true; }
.stat-foot { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.subject-icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; flex: 0 0 auto;
}
.subj-card { display: flex; gap: 14px; padding: 18px; align-items: center; transition: transform .15s, box-shadow .15s; cursor: pointer; }
.subj-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.empty { padding: 36px 16px; text-align: center; color: var(--text-3); }
.empty-icon { font-size: 34px; margin-bottom: 8px; opacity: .8; }

.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f6f8fb 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.spinner { width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.spinner.dark { border-color: #cbd5e1; border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 提示 ---------- */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 16px; border-radius: 10px; background: #0f172a; color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; animation: drop .2s ease-out; }
.toast.error { background: #b91c1c; }
.toast.success { background: #047857; }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- 认证页 ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.auth-hero {
  background: radial-gradient(circle at 20% 20%, #1e3a8a 0%, #0f1b33 60%);
  color: #e2e8f0; padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-hero::after {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -180px; bottom: -220px;
  background: radial-gradient(circle, rgba(59, 130, 246, .45), transparent 65%);
}
.hero-title { font-size: 34px; font-weight: 800; color: #fff; line-height: 1.25; letter-spacing: -.01em; margin-top: 28px; }
.hero-lead { color: #93a4c3; margin-top: 14px; font-size: 15px; max-width: 460px; }
.hero-features { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 32px; position: relative; z-index: 1; }
.hero-feature { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); border-radius: 12px; padding: 14px; }
.hero-feature b { color: #fff; display: block; margin-bottom: 2px; font-size: 14px; }
.hero-feature span { font-size: 12px; color: #94a3b8; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; margin: 20px 0; }
.tabs button { flex: 1; border: 0; padding: 8px; border-radius: 9px; background: transparent; cursor: pointer; color: var(--text-2); font-weight: 600; }
.tabs button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl th { font-size: 12px; color: var(--text-3); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.tbl tr:hover td { background: #fafbff; }

/* ---------- 题目 ---------- */
.question { padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; margin-bottom: 14px; }
.question.correct { border-color: #a7f3d0; background: #f6fefa; }
.question.wrong { border-color: #fecaca; background: #fffafa; }
.q-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 12px; }
.q-no { font-weight: 800; color: var(--primary); min-width: 48px; }
.q-stem { white-space: pre-wrap; }
.options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.option {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: #fff;
}
.option:hover { border-color: #bfd3ff; background: #f8faff; }
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.option.correct-key { border-color: var(--success); background: #ecfdf5; }
.option.wrong-key { border-color: var(--danger); background: #fef2f2; }
.option-letter { font-weight: 700; color: var(--text-2); }
.mcq-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mcq-grid .option { flex: 1 1 200px; }

/* ---------- 判卷 ---------- */
.dropzone {
  border: 2px dashed #c7d2e5; border-radius: var(--radius); padding: 28px; text-align: center; cursor: pointer; background: #fbfcff; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumb { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(15, 23, 42, .7); color: #fff; cursor: pointer; font-size: 12px; line-height: 1; }
.grade-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; background: #fff; }
.grade-item.wrong { border-left: 4px solid var(--danger); }
.grade-item.right { border-left: 4px solid var(--success); }
.grade-item.review { border-left: 4px solid var(--warning); }
.ai-tip { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 10px 14px; border-radius: 10px; font-size: 13px; }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.answer-box { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; white-space: pre-wrap; }
.answer-box b { display: block; font-size: 12px; color: var(--text-3); font-weight: 600; margin-bottom: 2px; }

/* ---------- 单词卡 ---------- */
.flashcard {
  border-radius: 22px; padding: 42px 28px; background: linear-gradient(160deg, #ffffff, #f3f7ff); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); text-align: center; cursor: pointer; min-height: 260px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; user-select: none;
}
.flashcard .word { font-size: 40px; font-weight: 800; letter-spacing: -.01em; }
.flashcard .phonetic { color: var(--text-3); font-family: ui-monospace, Menlo, monospace; }
.flashcard .meaning { font-size: 20px; font-weight: 600; color: var(--primary-dark); }
.flashcard .example { color: var(--text-2); font-size: 14px; max-width: 520px; }
.flip-hint { color: var(--text-3); font-size: 12px; }
.rate-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.rate-btn { padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-weight: 600; }
.rate-btn:hover { border-color: var(--primary); color: var(--primary); }
.rate-btn small { display: block; font-weight: 400; color: var(--text-3); font-size: 11px; }

/* ---------- 图表 ---------- */
.chart-box { width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 52px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.hbar .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 4px; background: #eef2f7; }
.heat i.l1 { background: #c7d8ff; }
.heat i.l2 { background: #93b4ff; }
.heat i.l3 { background: #5b8def; }
.heat i.l4 { background: #2563eb; }

/* ---------- 计划时间线 ---------- */
.phase { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px dashed var(--border); }
.phase:last-child { border-bottom: 0; }
.phase-idx { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: -19px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--primary); }
.tl-item.done::before { background: var(--success); border-color: var(--success); }

/* ---------- 任务 ---------- */
.task { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: 0; }
.task.done .task-title { text-decoration: line-through; color: var(--text-3); }
.task-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cbd5e1; display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; background: #fff; color: transparent; font-size: 12px; padding: 0; }
.task-check.on { background: var(--success); border-color: var(--success); color: #fff; }
.task-title { font-weight: 600; }
.task-body { flex: 1; min-width: 0; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 720px; max-height: 88vh; display: flex; flex-direction: column; animation: pop .18s ease-out; }
.modal.wide { max-width: 980px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- 移动端 ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; width: 260px; flex-basis: 260px; }
  .sidebar.open { transform: none; }
  .sidebar.open + .main { }
  .scrim.show { display: block; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px 14px 80px; }
  .topbar { padding: 0 14px; }
  .g2, .g3, .g4, .g-left, .g-report, .g-grading { grid-template-columns: 1fr; }
  .topbar-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar-foot { display: none; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .flashcard .word { font-size: 32px; }
  .rate-row { grid-template-columns: repeat(2, 1fr); }
  .answer-grid { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 92px 1fr 44px; }
  .task { padding: 10px 12px; gap: 8px; }
  .task .btn { display: none; }
  .card-pad { padding: 14px; }
  .content { padding: 12px 10px 70px; }
  .hero-title { font-size: 26px; }
  .modal { max-height: 92vh; }
}
@media (max-width: 480px) {
  .stat-value { font-size: 22px; }
  .hide-xs { display: none !important; }
  .topbar-title { font-size: 15px; }
}
