/* ============================================================
   DeepSeek Harness 插件开发 · 学习教程
   styles.css — 渐变背景 / 毛玻璃 / 目录侧栏 / 教程排版 / 响应式
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  --bg-1: #e9edff;
  --bg-2: #f3ecff;
  --bg-3: #fff4f8;

  --ink: #2b2b45;
  --ink-soft: #5a5a7e;
  --ink-faint: #8a8aab;

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-shadow: 0 8px 32px rgba(120, 110, 180, 0.14);
  --glass-shadow-hover: 0 16px 44px rgba(120, 110, 180, 0.22);

  --code-bg: #2b2b45;
  --code-ink: #e6e6f5;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --content-w: 1280px;
  --sidebar-w: 292px;
}

/* 阶段主题色 */
[data-stage="s1"] { --acc: #6b9dfc; --acc-soft: rgba(107, 157, 252, 0.12); }
[data-stage="s2"] { --acc: #9a7bff; --acc-soft: rgba(154, 123, 255, 0.12); }
[data-stage="s3"] { --acc: #ff7fa5; --acc-soft: rgba(255, 127, 165, 0.12); }
[data-stage="s4"] { --acc: #ff9f6b; --acc-soft: rgba(255, 159, 107, 0.14); }

/* ---------- 基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 保证 hidden 属性永远生效（防止被 display 类规则覆盖） */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 45%, var(--bg-3) 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}
.glow-1 { width: 480px; height: 480px; top: -140px; left: -100px; background: radial-gradient(circle, rgba(140,160,255,.55), transparent 70%); }
.glow-2 { width: 420px; height: 420px; top: 32%; right: -140px; background: radial-gradient(circle, rgba(255,150,200,.45), transparent 70%); }
.glow-3 { width: 380px; height: 380px; bottom: -120px; left: 30%; background: radial-gradient(circle, rgba(170,200,255,.45), transparent 70%); }

.page {
  position: relative;
  z-index: 1;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 28px 24px 64px;
}

/* ---------- 通用毛玻璃 ---------- */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(255, 255, 255, 0.9); }
}

/* ---------- 顶部条 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 22px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.brand-icon {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #fff;
  background: linear-gradient(135deg, #6b9dfc, #9a7bff);
  box-shadow: 0 6px 18px rgba(122, 125, 255, 0.35);
  position: relative;
  overflow: hidden;
}
/* logo 图片盖在渐变底上；图片加载失败时底下的鲸鱼图标兜底 */
.brand-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.brand-text strong {
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text small {
  font-size: 13px;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-progress {
  flex: none;
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.top-progress-label {
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.top-progress-label i { color: #57c98b; }
.top-progress-label b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(120, 110, 180, 0.14);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6b9dfc, #9a7bff, #ff7fa5);
  transition: width 0.5s var(--ease);
}

/* ---------- 主体布局 ---------- */
.layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

/* ============ 目录侧栏 ============ */
.sidebar {
  flex: none;
  width: var(--sidebar-w);
  padding: 18px 14px;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 110, 180, 0.3) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(120, 110, 180, 0.3); border-radius: 3px; }

.nav-stage {
  margin-bottom: 18px;
}
.nav-stage:last-child { margin-bottom: 0; }

.nav-stage-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--acc, #6b9dfc);
  padding: 4px 10px 8px;
}
.nav-stage-title i {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: #fff;
  background: var(--acc, #6b9dfc);
}

.nav-lesson {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14.5px;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s var(--ease);
}
.nav-lesson:hover {
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
}
.nav-lesson:active { transform: scale(0.97); }
.nav-lesson:focus-visible {
  outline: 3px solid rgba(123, 140, 255, 0.6);
  outline-offset: -2px;
}

.nav-lesson-no {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-faint);
  width: 34px;
  font-variant-numeric: tabular-nums;
}

.nav-lesson-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-lesson-check {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(120, 110, 180, 0.25);
  display: grid;
  place-items: center;
  font-size: 10px;
  color: transparent;
  transition: all 0.25s;
}
.nav-lesson.done .nav-lesson-check {
  background: #57c98b;
  border-color: #57c98b;
  color: #fff;
}

.nav-lesson.active {
  background: var(--acc-soft, rgba(123, 140, 255, 0.14));
  color: var(--ink);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--acc, #6b9dfc);
}

/* ============ 内容区 ============ */
.content {
  flex: 1;
  min-width: 0;
}

#course-view {
  animation: viewIn 0.35s var(--ease);
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* 课程头部 */
.course-head {
  padding: 8px 8px 20px;
}
.course-crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--acc, #6b9dfc);
  background: var(--acc-soft, rgba(123, 140, 255, 0.14));
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 14px;
}
.course-head h1 {
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.5px;
}
.course-meta {
  margin-top: 10px;
  font-size: 14px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 课程正文卡片 */
.course-body {
  padding: 34px 38px 40px;
}

.course-body h3 {
  font-size: 20px;
  font-weight: 800;
  margin: 34px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.course-body h3::before {
  content: "";
  width: 5px;
  height: 20px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--acc, #6b9dfc), transparent);
}
.course-body h3:first-child { margin-top: 0; }

.course-body p {
  margin: 10px 0;
  color: var(--ink);
}
.course-body b { color: var(--ink); }
.course-body ul,
.course-body ol {
  margin: 12px 0;
  padding-left: 26px;
}
.course-body li { margin: 6px 0; }

/* 目标横幅 */
.lesson-goal {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(120deg, var(--acc-soft, rgba(123,140,255,.12)), rgba(255, 255, 255, 0.4));
  border: 1px solid rgba(255, 255, 255, 0.7);
  margin-bottom: 8px;
}
.lesson-goal > i {
  font-size: 20px;
  color: var(--acc, #6b9dfc);
  margin-top: 4px;
}
.lesson-goal p { margin: 4px 0 0; color: var(--ink-soft); font-size: 15px; }

/* 信息框 */
.box {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin: 18px 0;
}
.box-title {
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.box p { margin: 4px 0; font-size: 15px; color: var(--ink-soft); }
.box ul { margin: 6px 0; }
.box li { font-size: 15px; color: var(--ink-soft); }

.box.metaphor {
  background: rgba(255, 244, 224, 0.55);
  border: 1px solid rgba(240, 169, 74, 0.35);
}
.box.metaphor .box-title { color: #d98a1f; }

.box.note {
  background: rgba(225, 238, 255, 0.55);
  border: 1px solid rgba(107, 157, 252, 0.3);
}
.box.note .box-title { color: #4a7fe0; }

.box.warn {
  background: rgba(255, 233, 236, 0.55);
  border: 1px solid rgba(255, 122, 145, 0.3);
}
.box.warn .box-title { color: #e0557a; }

/* 步骤列表 */
ol.steps {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}
ol.steps li {
  counter-increment: step;
  position: relative;
  padding: 10px 0 10px 44px;
  margin: 0;
}
ol.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--acc, #6b9dfc), color-mix(in srgb, var(--acc, #6b9dfc) 55%, #fff));
  background: var(--acc, #6b9dfc);
  box-shadow: 0 4px 10px rgba(120, 110, 180, 0.25);
}

/* 代码块 */
pre {
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 14px 0;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.65;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 18px rgba(43, 43, 69, 0.18);
}
pre code {
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, "Courier New", monospace;
  color: inherit;
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

code {
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
  background: rgba(120, 110, 180, 0.12);
  border-radius: 6px;
  padding: 2px 7px;
  color: #6a5cd0;
}

/* 表格 */
.table-wrap { overflow-x: auto; margin: 14px 0; }
table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 14.5px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(120, 110, 180, 0.08);
}
thead th {
  background: var(--acc-soft, rgba(123, 140, 255, 0.14));
  color: var(--ink);
  font-weight: 800;
  text-align: left;
  padding: 10px 14px;
  white-space: nowrap;
}
tbody td {
  padding: 10px 14px;
  border-top: 1px solid rgba(120, 110, 180, 0.1);
  background: rgba(255, 255, 255, 0.5);
  vertical-align: top;
}
tbody tr:hover td { background: rgba(255, 255, 255, 0.75); }
tbody td:first-child {
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

/* 小练习 */
.practice {
  padding: 18px 22px;
  border-radius: var(--radius-md);
  margin: 22px 0;
  background: rgba(255, 255, 255, 0.55);
  border: 1.5px dashed rgba(122, 125, 255, 0.45);
}
.practice-title {
  font-weight: 800;
  font-size: 15px;
  color: #6a5cd0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.practice p { color: var(--ink-soft); font-size: 15px; margin: 4px 0; }

/* 本节小结 */
.takeaway {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 26px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(120deg, rgba(87, 201, 139, 0.14), rgba(87, 201, 139, 0.05));
  border: 1px solid rgba(87, 201, 139, 0.35);
}
.takeaway > i { color: #57c98b; font-size: 18px; margin-top: 4px; }
.takeaway p { margin: 4px 0 0; color: var(--ink-soft); font-size: 15px; }

/* 全部学完横幅 */
.course-finish {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 30px;
  padding: 22px 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(120deg, rgba(255, 159, 107, 0.16), rgba(255, 127, 165, 0.1));
  border: 1px solid rgba(255, 159, 107, 0.4);
}
.course-finish > i { font-size: 28px; color: #ff9f6b; }
.course-finish p { margin: 6px 0 0; color: var(--ink-soft); }

/* ---------- 顶栏搜索 ---------- */
.top-search {
  position: relative;
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 9px 16px;
  transition: box-shadow 0.25s, background 0.25s;
}
.top-search:focus-within {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 20px rgba(120, 110, 180, 0.18);
}
.top-search > i { color: var(--ink-faint); font-size: 14px; flex: none; }
.top-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
}
/* 隐藏 Edge/Chrome 搜索框自带的原生 × 清除按钮（我们有自己的） */
.top-search input[type="search"]::-webkit-search-cancel-button,
.top-search input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}
.search-clear {
  flex: none;
  border: none;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.search-clear:hover { background: rgba(120, 110, 180, 0.12); color: var(--ink); }

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  padding: 8px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 340px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.94);
  border-radius: var(--radius-md);
}
.search-item {
  text-align: left;
  border: none;
  background: none;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font: inherit;
}
.search-item:hover { background: rgba(123, 140, 255, 0.1); }
.search-item-title { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.search-item-title b { color: #6a5cd0; }
.search-item-snippet {
  font-size: 13px;
  color: var(--ink-faint);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.search-empty { padding: 14px; color: var(--ink-faint); font-size: 14px; text-align: center; }

mark.hl {
  background: #ffe9a8;
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

/* ---------- 目录顶部工具按钮 ---------- */
.sidebar-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(120, 110, 180, 0.12);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 14px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, color 0.2s, transform 0.15s var(--ease);
}
.sidebar-link i { width: 20px; text-align: center; color: var(--ink-faint); }
.sidebar-link:hover { background: rgba(255, 255, 255, 0.65); color: var(--ink); }
.sidebar-link:active { transform: scale(0.97); }
.sidebar-link.active {
  background: rgba(123, 140, 255, 0.14);
  color: var(--ink);
  box-shadow: inset 3px 0 0 #7b8cff;
}
.sidebar-link.active i { color: #7b8cff; }

/* ---------- 首页（课程总览） ---------- */
.home-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 30px;
  flex-wrap: wrap;
}
.home-hero-left { flex: 1; min-width: 220px; }
.home-hero-label {
  font-size: 14px;
  color: var(--ink-soft);
  display: flex;
  gap: 8px;
  align-items: center;
}
.home-hero-label i { color: #57c98b; }
.home-hero-num { font-size: 40px; font-weight: 800; line-height: 1.25; }
.home-hero-num span { font-size: 15px; color: var(--ink-faint); font-weight: 600; }
.home-hero .progress-track { margin-top: 10px; }

.continue-btn {
  background: linear-gradient(135deg, #6b9dfc, #9a7bff);
  color: #fff;
  border: none;
  box-shadow: 0 8px 24px rgba(122, 125, 255, 0.4);
}
.continue-btn:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 12px 30px rgba(122, 125, 255, 0.5); }

.home-tips { padding: 22px 28px; margin-top: 20px; }
.home-tips h3 {
  font-size: 17px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.home-tips h3 i { color: #f0a94a; }
.home-tips ul { padding-left: 20px; }
.home-tips li { margin: 6px 0; font-size: 15px; color: var(--ink-soft); }
.home-tips b { color: var(--ink); }

.home-stage { margin-top: 20px; padding: 22px 26px; }
.home-stage-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
}
.home-stage-title > i { color: var(--acc, #6b9dfc); }
.home-stage-count {
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.6);
  padding: 3px 12px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.home-stage-desc { font-size: 14px; color: var(--ink-faint); margin: 4px 0 14px 30px; }
.home-course-list { display: flex; flex-direction: column; gap: 8px; }
.home-course {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s var(--ease), box-shadow 0.2s;
}
.home-course:hover {
  background: rgba(255, 255, 255, 0.85);
  transform: translateX(4px);
  box-shadow: 0 4px 14px rgba(120, 110, 180, 0.12);
}
.home-course:active { transform: scale(0.98); }
.home-course:focus-visible { outline: 3px solid rgba(123, 140, 255, 0.6); outline-offset: 2px; }
.home-course-no { font-weight: 800; color: var(--acc, #6b9dfc); width: 36px; flex: none; font-variant-numeric: tabular-nums; }
.home-course-name { flex: 1; min-width: 0; }
.home-course-min { font-size: 13px; color: var(--ink-faint); flex: none; }
.home-course-check {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(120, 110, 180, 0.25);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: transparent;
  transition: all 0.25s;
}
.home-course.done .home-course-check { background: #57c98b; border-color: #57c98b; color: #fff; }
.home-course.done .home-course-name {
  text-decoration: line-through;
  color: var(--ink-faint);
  text-decoration-color: rgba(87, 201, 139, 0.55);
}

/* ---------- 术语表 ---------- */
.glossary-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  margin-bottom: 18px;
}
.glossary-search i { color: var(--ink-faint); font-size: 14px; }
.glossary-search input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.glossary-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease); }
.glossary-card:hover { transform: translateY(-3px); box-shadow: var(--glass-shadow-hover); }
.glossary-term {
  font-weight: 800;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.glossary-en {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-faint);
  background: rgba(120, 110, 180, 0.1);
  padding: 2px 10px;
  border-radius: 999px;
}
.glossary-explain { font-size: 14.5px; color: var(--ink-soft); flex: 1; }
.glossary-src {
  align-self: flex-start;
  border: none;
  background: rgba(120, 110, 180, 0.1);
  color: #6a5cd0;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 8px 14px;
  min-height: 40px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, transform 0.15s var(--ease);
}
.glossary-src:hover { background: rgba(123, 140, 255, 0.2); }
.glossary-src:active { transform: scale(0.96); }
.glossary-empty { text-align: center; color: var(--ink-faint); padding: 48px 0; }

/* ---------- 代码复制按钮 ---------- */
.code-wrap { position: relative; margin: 14px 0; }
.code-wrap > pre { margin: 0; }
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(230, 230, 245, 0.8);
  cursor: pointer;
  font-size: 13.5px;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
}
.code-wrap:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgba(255, 255, 255, 0.24); color: #fff; }
.copy-btn.copied { color: #57c98b; opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }

/* ---------- 预期输出块 ---------- */
.expected {
  margin: -6px 0 18px;
  position: relative;
}
.expected::before {
  content: "预期输出";
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #2f9e63;
  background: rgba(87, 201, 139, 0.18);
  padding: 2px 10px;
  border-radius: 999px;
}
.expected pre {
  background: #22303e;
  color: #bfe6d1;
  border: 1px dashed rgba(87, 201, 139, 0.35);
  box-shadow: none;
  margin: 0;
  padding: 16px 18px;
}
.expected code { color: inherit; background: none; padding: 0; }

/* ---------- 完整文件折叠框 ---------- */
.file-box {
  margin: 12px 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}
.file-box summary {
  cursor: pointer;
  padding: 13px 18px;
  font-weight: 700;
  font-size: 15px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  transition: background 0.2s;
}
.file-box summary::-webkit-details-marker { display: none; }
.file-box summary::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-faint);
  transition: transform 0.3s var(--ease);
}
.file-box[open] summary::after { transform: rotate(180deg); }
.file-box summary:hover { background: rgba(255, 255, 255, 0.7); }
.file-box summary i { color: var(--acc, #6b9dfc); }
.file-box .code-wrap { margin: 0; }
.file-box .code-wrap > pre {
  border-radius: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ---------- 随堂小测 ---------- */
.quiz { margin-top: 22px; padding: 24px 28px; }
.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 17px;
  font-weight: 800;
  flex-wrap: wrap;
}
.quiz-head > i { color: #9a7bff; }
.quiz-score {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(120, 110, 180, 0.1);
  padding: 4px 14px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.quiz-item { margin-top: 20px; }
.quiz-q { font-weight: 700; font-size: 15.5px; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.quiz-option {
  text-align: left;
  padding: 12px 16px;
  min-height: 46px;
  border-radius: 12px;
  border: 1.5px solid rgba(120, 110, 180, 0.2);
  background: rgba(255, 255, 255, 0.6);
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s var(--ease);
}
.quiz-option:hover:not(:disabled) {
  border-color: var(--acc, #6b9dfc);
  background: rgba(255, 255, 255, 0.85);
  transform: translateX(4px);
}
.quiz-option:active:not(:disabled) { transform: scale(0.98); }
.quiz-option:focus-visible { outline: 3px solid rgba(123, 140, 255, 0.6); outline-offset: 2px; }
.quiz-option:disabled { cursor: default; opacity: 0.9; }
.quiz-option.correct {
  background: rgba(87, 201, 139, 0.16);
  border-color: #57c98b;
  color: #237a4d;
  font-weight: 700;
}
.quiz-option.wrong {
  background: rgba(255, 122, 145, 0.14);
  border-color: #ff7a91;
  color: #c23a5e;
}

.quiz-explain {
  margin-top: 10px;
  font-size: 14.5px;
  padding: 10px 14px;
  border-radius: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.quiz-explain.ok { background: rgba(87, 201, 139, 0.12); color: #237a4d; }
.quiz-explain.bad { background: rgba(255, 122, 145, 0.1); color: #c23a5e; }
.quiz-explain i { margin-top: 3px; }

/* ---------- 实战项目：侧栏分组 ---------- */
.nav-sub-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-faint);
  letter-spacing: 1px;
  padding: 8px 10px 4px;
}
.nav-sub-label i { color: var(--acc, #6b9dfc); }
.nav-project .nav-lesson-no { color: var(--acc, #6b9dfc); font-weight: 800; }
.nav-lesson-steps {
  flex: none;
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.nav-project.done .nav-lesson-steps { color: #57c98b; font-weight: 700; }

/* ---------- 实战项目：步骤条 ---------- */
.step-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.step-bar-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-right: 4px;
}
.step-bar-label i { color: var(--acc, #6b9dfc); }

.step-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1.5px solid rgba(120, 110, 180, 0.18);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.step-chip:hover { background: rgba(255, 255, 255, 0.85); transform: translateY(-1px); }
.step-chip:active { transform: scale(0.96); }
.step-chip:focus-visible { outline: 3px solid rgba(123, 140, 255, 0.6); outline-offset: 2px; }
.step-no {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  background: rgba(120, 110, 180, 0.15);
  color: var(--ink-soft);
}
.step-chip.active {
  background: var(--acc-soft, rgba(123, 140, 255, 0.14));
  border-color: var(--acc, #6b9dfc);
  color: var(--ink);
}
.step-chip.active .step-no { background: var(--acc, #6b9dfc); color: #fff; }
.step-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(120, 110, 180, 0.2);
  display: grid;
  place-items: center;
  font-size: 9px;
  color: transparent;
}
.step-chip.done .step-check { background: #57c98b; border-color: #57c98b; color: #fff; }

/* 项目完成横幅 */
.project-done-banner {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  margin-top: 2px;
  border-radius: var(--radius-sm);
  background: linear-gradient(120deg, rgba(87, 201, 139, 0.16), rgba(87, 201, 139, 0.06));
  border: 1px solid rgba(87, 201, 139, 0.4);
  color: #2f9e63;
  font-weight: 700;
  font-size: 14.5px;
}

/* 首页项目行（编号 3.1 / 3.2 / 3.3 与课程序号同风格） */
.home-project .home-course-name b { font-size: 15.5px; }
.home-project-desc {
  display: block;
  font-style: normal;
  font-size: 13px;
  color: var(--ink-faint);
  font-weight: 400;
}

/* ---------- 底部导航 ---------- */
.course-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.nav-btn {
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 13px 22px;
  min-height: 48px;
  min-width: 128px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), color 0.2s, background 0.2s;
}
.nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--glass-shadow-hover);
  color: var(--ink);
}
.nav-btn:active { transform: scale(0.96); }
.nav-btn:focus-visible { outline: 3px solid rgba(123, 140, 255, 0.65); outline-offset: 3px; }
.nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--glass-shadow);
}

.done-btn {
  background: rgba(87, 201, 139, 0.18);
  border: 1px solid rgba(87, 201, 139, 0.5);
  color: #2f9e63;
}
.done-btn:hover { color: #2f9e63; }
.done-btn.marked {
  background: linear-gradient(135deg, #57c98b, #3fb87a);
  border-color: transparent;
  color: #fff;
}
.done-btn.marked:hover { color: #fff; }

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.footer-tip {
  max-width: 660px;
  font-size: 14.5px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 13px 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}
.footer-tip i { color: #f0a94a; }

.reset-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 11px 22px;
  min-height: 46px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), color 0.2s;
}
.reset-btn:hover { transform: translateY(-2px); box-shadow: var(--glass-shadow-hover); color: var(--ink); }
.reset-btn:active { transform: scale(0.96); }
.reset-btn:focus-visible { outline: 3px solid rgba(123, 140, 255, 0.65); outline-offset: 3px; }

.footer-note {
  font-size: 13px;
  color: var(--ink-faint);
}

.footer-stats {
  font-size: 13px;
  color: var(--ink-faint);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 6px 16px;
}
.footer-stats i { color: #9a7bff; }

/* ============================================================
   响应式
   ============================================================ */

/* 平板 */
@media (max-width: 1024px) {
  :root { --sidebar-w: 250px; }
  .course-body { padding: 26px 26px 32px; }
  .top-progress { width: 150px; }
  .brand-text small { display: none; }
}

/* 中等宽度：顶栏空间不够时隐藏进度条（首页仍能看到进度） */
@media (max-width: 760px) {
  .top-progress { display: none; }
}

/* 手机：目录变顶部横向条，内容单列 */
@media (max-width: 600px) {
  .page { padding: 16px 12px 48px; }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }
  .brand-text strong { font-size: 15px; }
  .top-progress { width: 100%; }

  .layout {
    flex-direction: column;
    gap: 14px;
  }

  .sidebar {
    position: sticky;
    top: 8px;
    z-index: 9;
    width: 100%;
    max-height: none;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px;
    border-radius: var(--radius-md);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar::-webkit-scrollbar { display: none; }

  .nav-stage {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 0;
  }
  .nav-stage-title { padding: 2px 8px; font-size: 11.5px; }

  .nav-lesson {
    min-height: 44px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    width: auto;
  }
  .nav-lesson-no { width: auto; margin-right: 2px; }
  .nav-lesson-name { display: none; } /* 手机上只显示序号，省空间 */
  .nav-lesson.active { box-shadow: inset 0 0 0 2px var(--acc, #6b9dfc); }

  .course-head { padding: 8px 4px 16px; }
  .course-head h1 { font-size: 24px; }
  .course-body { padding: 22px 18px 28px; }

  .course-body h3 { font-size: 18px; }

  pre { padding: 14px 14px; font-size: 12.5px; border-radius: var(--radius-sm); }

  table { font-size: 13.5px; }
  thead th, tbody td { padding: 8px 10px; }

  .course-nav { gap: 10px; }
  .nav-btn {
    min-height: 48px;
    padding: 12px 16px;
    font-size: 14px;
    flex: 1;
    min-width: 0;
  }
  .done-btn { order: -1; flex-basis: 100%; }

  /* 顶栏搜索占满一行 */
  .top-search { width: 100%; max-width: none; }

  /* 目录工具按钮变横向胶囊 */
  .sidebar-tools {
    flex: none;
    flex-direction: row;
    gap: 8px;
    margin: 0;
    padding: 0 10px 0 0;
    border: none;
    align-items: center;
  }
  .sidebar-link {
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    padding: 8px 14px;
    min-height: 44px;
    font-size: 13.5px;
    white-space: nowrap;
  }
  .sidebar-link.active { box-shadow: inset 0 0 0 2px #7b8cff; }

  /* 首页 */
  .home-hero { padding: 20px 18px; }
  .home-hero-num { font-size: 32px; }
  .home-tips { padding: 18px 18px; }
  .home-stage { padding: 18px 14px; }
  .home-stage-desc { margin-left: 0; }
  .home-course { gap: 8px; padding: 10px 10px; }
  .home-course-no { width: 30px; font-size: 13px; }
  .home-course-name { font-size: 14px; }
  .home-course-min { display: none; }

  /* 术语表 */
  .glossary-grid { grid-template-columns: 1fr; }
  .glossary-search { padding: 10px 14px; }

  /* 测验 */
  .quiz { padding: 18px 16px; }
  .quiz-option { font-size: 14.5px; }

  /* 预期输出 */
  .expected pre { font-size: 12px; padding: 14px 14px 12px; }
  .expected::before { top: 8px; }

  /* 文件折叠框 */
  .file-box summary { font-size: 14px; padding: 12px 14px; }

  /* 实战项目：步骤条横向滑动 */
  .step-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .step-bar::-webkit-scrollbar { display: none; }
  .step-bar-label { display: none; }
  .step-chip { flex: none; white-space: nowrap; }
  .project-done-banner { flex: none; white-space: normal; }
}

/* 尊重减少动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
