/* ============================================================
   知学工作台 Pro · 设计系统
   浅色：暖白 + 深绿；深色：墨绿夜色。系统字体、无外部字体依赖。
   ============================================================ */

:root {
  --bg: #f4f6f2;
  --bg-soft: #eef1ea;
  --surface: #ffffff;
  --surface-2: #fbfcf9;
  --ink: #16251e;
  --ink-2: #33463d;
  --muted: #62756d;
  --faint: #93a49c;
  --line: rgba(22, 37, 30, 0.1);
  --line-strong: rgba(22, 37, 30, 0.18);
  --primary: #1e6a52;
  --primary-strong: #185843;
  --primary-soft: rgba(30, 106, 82, 0.1);
  --primary-softer: rgba(30, 106, 82, 0.06);
  --accent: #b97c22;
  --accent-soft: rgba(185, 124, 34, 0.12);
  --danger: #b23f35;
  --danger-soft: rgba(178, 63, 53, 0.1);
  --ok: #2c7d5c;
  --shadow-sm: 0 1px 2px rgba(22, 37, 30, 0.05);
  --shadow-md: 0 8px 24px -12px rgba(22, 37, 30, 0.18);
  --shadow-lg: 0 24px 60px -24px rgba(22, 37, 30, 0.28);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --sidebar-w: 252px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC",
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  --bg: #0e1512;
  --bg-soft: #121a16;
  --surface: #16201b;
  --surface-2: #131c17;
  --ink: #e9f1ec;
  --ink-2: #c6d6cd;
  --muted: #93a79d;
  --faint: #6c7f75;
  --line: rgba(233, 241, 236, 0.1);
  --line-strong: rgba(233, 241, 236, 0.2);
  --primary: #5cb493;
  --primary-strong: #74c6a6;
  --primary-soft: rgba(92, 180, 147, 0.14);
  --primary-softer: rgba(92, 180, 147, 0.07);
  --accent: #d3a356;
  --accent-soft: rgba(211, 163, 86, 0.14);
  --danger: #e08076;
  --danger-soft: rgba(224, 128, 118, 0.14);
  --ok: #6cc39b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 28px -14px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1000px 520px at 8% -10%, var(--primary-softer), transparent 60%),
    radial-gradient(900px 480px at 108% 6%, var(--accent-soft), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

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

::selection { background: var(--primary-soft); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------ Shell 布局 */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  color: #f2efe6; font-size: 20px;
  background: linear-gradient(150deg, var(--primary-strong), var(--primary));
  box-shadow: var(--shadow-md);
}
.brand-text { display: flex; flex-direction: column; font-weight: 700; font-size: 17px; letter-spacing: 0.02em; }
.brand-sub { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0.08em; margin-top: 1px; }

.nav-label {
  font-size: 11px; letter-spacing: 0.16em; color: var(--faint);
  padding: 0 10px; text-transform: uppercase;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 11px;
  color: var(--ink-2); font-weight: 500;
  transition: background 0.16s ease, color 0.16s ease;
}
.nav a .icon { font-size: 17px; color: var(--muted); transition: color 0.16s ease; }
.nav a:hover { background: var(--bg-soft); color: var(--ink); }
.nav a.active { background: var(--primary-soft); color: var(--primary-strong); }
.nav a.active .icon { color: var(--primary); }

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--primary-softer), transparent 70%), var(--bg-soft);
  border: 1px solid var(--line);
}
.sidebar-note .note-icon {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}
.sidebar-note p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.7; }

.sidebar-foot {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted); padding: 0 6px;
}
.sidebar-foot .ver { margin-left: auto; font-size: 10px; letter-spacing: 0.14em; color: var(--faint); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(44, 125, 92, 0.14); }

.main-shell {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-start, .topbar-end { display: flex; align-items: center; gap: 12px; }
.crumb { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.crumb strong { color: var(--ink); font-weight: 600; }
.crumb .sep { color: var(--faint); }
.date { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.account-btn {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 5px 14px 5px 5px;
  color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.account-btn:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-size: 15px;
}

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 30px 28px 48px; outline: none; }

.page-footer {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 18px 28px 26px; max-width: 1180px; margin: 0 auto; width: 100%;
  font-size: 12px; color: var(--faint);
}

/* ------------------------------------------------ 基础控件 */

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 17px;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 11px;
  padding: 10px 18px; font: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: transform 0.12s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(160deg, var(--primary-strong), var(--primary)); color: #f7faf8; box-shadow: var(--shadow-md); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 26px -12px rgba(24, 88, 67, 0.5); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-strong); }
.btn-soft { background: var(--primary-soft); color: var(--primary-strong); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }

input, select, textarea {
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 13px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

/* ------------------------------------------------ 欢迎 / 登录 */

.welcome {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 28px;
  align-items: stretch; margin-bottom: 26px;
}
.welcome-copy {
  position: relative; overflow: hidden;
  padding: 38px 36px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(600px 320px at 88% 0%, rgba(255, 255, 255, 0.16), transparent 60%),
    linear-gradient(150deg, #1c5140 0%, #1e6a52 48%, #2f7f63 100%);
  color: #eef5f1;
  box-shadow: var(--shadow-lg);
}
html[data-theme="dark"] .welcome-copy {
  background: radial-gradient(600px 320px at 88% 0%, rgba(92, 180, 147, 0.22), transparent 60%),
    linear-gradient(150deg, #143027 0%, #17452f 55%, #1d5540 100%);
}
.welcome-copy::after {
  content: ""; position: absolute; inset: auto -60px -110px auto;
  width: 300px; height: 300px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 40px rgba(255, 255, 255, 0.04), 0 0 0 80px rgba(255, 255, 255, 0.03);
  pointer-events: none;
}
.kicker { display: inline-flex; align-items: center; gap: 9px; font-size: 12px; letter-spacing: 0.18em; opacity: 0.9; }
.kicker .line { width: 28px; height: 1px; background: currentColor; opacity: 0.7; }
.welcome-copy h1 { margin: 18px 0 12px; font-size: clamp(26px, 3.2vw, 34px); line-height: 1.25; font-weight: 700; letter-spacing: 0.01em; }
.welcome-copy h1 span { color: #f3e2b8; }
.welcome-copy p { margin: 0; max-width: 34em; font-size: 13.5px; line-height: 1.9; opacity: 0.88; }
.welcome-foot {
  display: flex; align-items: center; gap: 10px; margin-top: 30px;
  font-size: 13px; opacity: 0.92;
}
.welcome-foot .icon:last-child { margin-left: auto; opacity: 0.8; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  padding: 26px;
}
.panel-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.panel-head .badge-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-size: 19px;
}
.panel-head h2 { margin: 2px 0 2px; font-size: 16px; }
.panel-head p { margin: 0; font-size: 12.5px; color: var(--muted); }
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-field .hint { font-size: 11.5px; color: var(--faint); }
.password-wrap { position: relative; }
.password-wrap input { width: 100%; padding-right: 42px; }
.password-wrap .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; }
.form-error { min-height: 20px; margin: 2px 0 8px; font-size: 12.5px; color: var(--danger); }
#captcha-slot { display: flex; justify-content: center; min-height: 0; }
#captcha-slot:not(:empty) { margin-bottom: 12px; }
.auth-summary {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  border-radius: var(--radius); background: var(--ok-soft, var(--primary-softer));
  border: 1px dashed var(--line-strong); margin-bottom: 14px;
}
.auth-summary .ok-badge { color: var(--ok); font-size: 20px; }
.auth-summary b { display: block; font-size: 13px; }
.auth-summary span.sub { font-size: 12px; color: var(--muted); }
.footnote { display: flex; align-items: center; gap: 7px; margin-top: 14px; font-size: 11.5px; color: var(--faint); }

/* ------------------------------------------------ 概览指标 */

.overview {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin-bottom: 26px;
}
.stat {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 13px; flex: none;
  display: grid; place-items: center; font-size: 20px;
  background: var(--primary-softer); color: var(--primary);
}
.stat:nth-child(2) .stat-icon { background: var(--ok-soft, rgba(44, 125, 92, 0.1)); color: var(--ok); }
.stat:nth-child(3) .stat-icon { background: var(--accent-soft); color: var(--accent); }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { display: flex; align-items: baseline; gap: 4px; margin-top: 2px; }
.stat-value strong { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.stat-value span { font-size: 12px; color: var(--muted); }
.stat-note { font-size: 11px; color: var(--faint); margin-top: 2px; }

/* ------------------------------------------------ 区块标题 / 工具栏 */

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-title { display: flex; align-items: center; gap: 10px; }
.section-title h2 { margin: 0; font-size: 19px; letter-spacing: 0.01em; }
.count-badge {
  font-size: 11px; font-weight: 600; color: var(--primary-strong);
  background: var(--primary-soft); border-radius: 999px; padding: 2px 9px;
}
.section-desc { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-soft); border-radius: 999px; border: 1px solid var(--line); }
.tabs button {
  border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--muted); padding: 7px 16px; border-radius: 999px; cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: var(--surface); color: var(--primary-strong); box-shadow: var(--shadow-sm); }
.search {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; min-width: 230px; color: var(--faint);
}
.search input { border: 0; padding: 0; background: transparent; width: 100%; font-size: 12.5px; }
.search input:focus { box-shadow: none; }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ------------------------------------------------ 课程卡片 */

.grid-courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.course-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }

.course-cover {
  position: relative; padding: 18px 18px 16px;
  display: flex; align-items: center; gap: 12px;
  color: #f4f8f6;
  background: linear-gradient(135deg, #1d5342, #2b7a5e);
}
.course-cover[data-tone="1"] { background: linear-gradient(135deg, #3b3f58, #5a5f7d); }
.course-cover[data-tone="2"] { background: linear-gradient(135deg, #6b4a1f, #9b7434); }
.course-cover[data-tone="3"] { background: linear-gradient(135deg, #23474f, #3d6b74); }
.course-cover .cover-icon {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 21px;
  background: rgba(255, 255, 255, 0.16);
}
.cover-meta { min-width: 0; }
.cover-type { font-size: 11px; letter-spacing: 0.14em; opacity: 0.85; }
.cover-school { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.smart-badge {
  position: absolute; top: 14px; right: 14px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(255, 232, 190, 0.92); color: #7a5314;
}

.course-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 14px; gap: 8px; }
.course-body h3 { margin: 0; font-size: 15px; line-height: 1.45; }
.course-teacher { margin: 0; font-size: 12.5px; color: var(--muted); }

.progress-row { margin-top: 4px; }
.progress-label { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.progress-label strong { color: var(--ink-2); font-size: 12px; }
.progress-track { height: 6px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-fill.done { background: linear-gradient(90deg, #4ba97f, #2c7d5c); }

.course-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.course-actions a, .course-actions button {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12px; font-weight: 600;
  padding: 6px 11px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}
.course-actions a:hover, .course-actions button:hover { border-color: var(--primary); color: var(--primary-strong); background: var(--primary-softer); }
.course-actions .enter { margin-left: auto; border-color: transparent; background: var(--primary-soft); color: var(--primary-strong); }
.course-actions .enter:hover { background: var(--primary); color: #fff; }

/* ------------------------------------------------ 作业 */

.list-homework { display: flex; flex-direction: column; gap: 10px; }
.homework-card {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.homework-card .hw-icon {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-size: 18px;
  background: var(--primary-softer); color: var(--primary);
}
.homework-card h3 { margin: 0 0 2px; font-size: 14px; }
.homework-card p { margin: 0; font-size: 12px; color: var(--muted); }
.homework-deadline { margin-left: auto; text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.homework-deadline b { display: block; font-size: 13px; color: var(--ink-2); }
.homework-deadline.overdue b { color: var(--danger); }
.homework-deadline .chip {
  display: inline-block; margin-top: 2px; font-size: 10.5px; font-weight: 600;
  padding: 1px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-strong);
}
.homework-deadline.overdue .chip { background: var(--danger-soft); color: var(--danger); }

/* ------------------------------------------------ 空状态 / 骨架屏 / 状态 */

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 64px 24px; gap: 6px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.empty-icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  font-size: 26px; color: var(--primary); background: var(--primary-softer);
  margin-bottom: 8px;
}
.empty h3 { margin: 0; font-size: 16px; }
.empty p { margin: 0; font-size: 12.5px; color: var(--muted); }
.empty .btn { margin-top: 12px; }

.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.skeleton-card {
  height: 208px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  position: relative; overflow: hidden;
}
.skeleton-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, var(--bg-soft) 50%, transparent 70%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.status-msg {
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 12.5px;
  background: var(--primary-softer); color: var(--ink-2);
  border: 1px solid var(--line); margin-bottom: 14px;
}
.status-msg[data-tone="e"] { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.status-msg[data-tone="s"] { background: rgba(44, 125, 92, 0.08); color: var(--ok); border-color: transparent; }

/* ------------------------------------------------ 详情通用 */

.detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.detail-head h2 { margin: 0; font-size: 18px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 12px; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.card-title .icon { color: var(--primary); }

.chapter { padding: 14px 16px; }
.chapter h3 { margin: 0 0 10px; font-size: 14px; }
.lesson { padding: 9px 0; border-top: 1px solid var(--line); }
.lesson:first-of-type { border-top: 0; }
.lesson-row { display: flex; align-items: center; gap: 10px; }
.lesson-name { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); }
.lesson-name small { color: var(--faint); font-size: 11px; margin-left: 6px; }
.lesson.watched .lesson-name { color: var(--ok); }
.lesson-tag {
  font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: rgba(44, 125, 92, 0.1); color: var(--ok); white-space: nowrap;
}
.lesson-tag.pending { background: var(--bg-soft); color: var(--faint); font-weight: 600; }
.video-row { display: flex; align-items: center; gap: 10px; padding: 6px 0 6px 18px; }
.video-row .lesson-name { color: var(--muted); font-size: 12.5px; }
.video-row .btn { padding: 4px 10px; font-size: 11.5px; border-radius: 8px; }

/* 问答 */
.qa-list { display: flex; flex-direction: column; gap: 10px; }
.qa-item {
  display: flex; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.qa-item:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.qa-rank {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--primary-softer); color: var(--primary);
}
.qa-content { flex: 1; min-width: 0; }
.qa-content h3 { margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.qa-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--faint); }
.qa-meta b { color: var(--muted); font-weight: 600; }
.answer-item { padding: 12px 0; border-top: 1px solid var(--line); }
.answer-item:first-child { border-top: 0; }
.answer-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.answer-body { font-size: 13px; color: var(--ink-2); }
.avatar-sm { width: 22px; height: 22px; border-radius: 50%; background: var(--primary-soft); display: grid; place-items: center; color: var(--primary); font-size: 12px; }

/* 成绩 */
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.score-cell {
  text-align: center; padding: 14px 10px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line);
}
.score-cell strong { display: block; font-size: 22px; font-weight: 700; }
.score-cell span { font-size: 11.5px; color: var(--muted); }
.score-cell.total strong { color: var(--primary); }
.score-cell .up { color: var(--ok); }
.tab-panels { margin-top: 12px; }
.hidden { display: none !important; }

/* 知识点 */
.kb-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.kb-stat { text-align: center; padding: 12px 8px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.kb-stat b { display: block; font-size: 20px; }
.kb-stat span { font-size: 11px; color: var(--muted); }
.kb-theme { margin-bottom: 12px; }
.kb-node { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.kb-node:first-child { border-top: 0; }
.kb-node .name { flex: 1; font-size: 13px; color: var(--ink-2); min-width: 0; }
.kb-node .rate { font-size: 12px; font-weight: 700; }
.kb-node .rate.low { color: var(--danger); }
.kb-node .rate.mid { color: var(--accent); }
.kb-node .rate.high { color: var(--ok); }
.kb-node .rate.none { color: var(--faint); }
.bar { height: 5px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; flex: 0 0 90px; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--primary); }

/* ------------------------------------------------ 弹窗 */

.modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(10, 18, 14, 0.5);
  backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.18s ease;
}
.modal[hidden] { display: none; }
.modal.open { opacity: 1; }
.modal-card {
  width: min(560px, 100%); max-height: min(86vh, 760px);
  overflow: auto; padding: 24px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.985); opacity: 0;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}
.modal.open .modal-card { transform: none; opacity: 1; }
.modal-card.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-close { margin-left: auto; }

/* 进度条（任务弹窗） */
.task-progress { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.task-progress .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.task-progress .row b { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.progress-track.lg { height: 9px; }
.task-log {
  margin-top: 12px; max-height: 200px; overflow: auto;
  border-radius: var(--radius-sm); background: var(--bg-soft);
  padding: 10px 12px; font-family: var(--mono); font-size: 11.5px; line-height: 1.8;
  color: var(--muted);
}
.task-log div { padding: 1px 0; white-space: pre-wrap; word-break: break-all; }
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 13px; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger); font-size: 12.5px;
  border: 1px solid rgba(178, 63, 53, 0.16);
}
.alert .icon { font-size: 16px; margin-top: 1px; }

/* ------------------------------------------------ Toast */

.toasts {
  position: fixed; z-index: 100; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 11px 15px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); font-size: 12.5px;
  color: var(--ink-2); pointer-events: auto;
  animation: toast-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.ok .icon { color: var(--ok); }
.toast.err .icon { color: var(--danger); }
.toast.info .icon { color: var(--primary); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------ 响应式 */

.only-mobile { display: none; }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-102%); transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .main-shell { margin-left: 0; }
  .nav-backdrop {
    position: fixed; inset: 0; z-index: 35; background: rgba(10, 18, 14, 0.4);
    backdrop-filter: blur(2px);
  }
  .welcome { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .mobile-only { display: inline-grid; }
  main { padding: 20px 16px 40px; }
  .topbar { padding: 12px 16px; }
  .date { display: none; }
  .overview { grid-template-columns: 1fr; }
  .stat { padding: 14px 16px; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .toolbar { gap: 10px; }
  .search { margin-left: 0; width: 100%; min-width: 0; }
  .kb-stats { grid-template-columns: repeat(2, 1fr); }
  .welcome-copy { padding: 26px 22px; }
  .panel { padding: 20px; }
  .course-actions .enter { margin-left: 0; }
  .page-footer { padding: 14px 16px 22px; }
  .modal-card { padding: 18px; }
  .qa-meta { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* 主题图标切换 */
html[data-theme="light"] .theme-dark, html[data-theme="dark"] .theme-light { display: none; }
