/* 知径 · FSRS 学习系统 */

/* ---------- 设计令牌 ---------- */
:root {
  color-scheme: light;
  --page: #f7f6f2;
  --surface: #fcfcfb;
  --surface-2: #f1f0ea;
  --surface-3: #e8e6de;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #706e68;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: #cfcdc4;
  --control: #8a8880;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-track: #cde2fb;
  --accent-wash: #eef5fe;
  --good: #0ca30c;
  --good-ink: #006300;
  --good-wash: #eaf7ea;
  --warning: #fab219;
  --warning-ink: #7a5200;
  --warning-wash: #fff7e2;
  --critical: #d03b3b;
  --critical-ink: #a02626;
  --critical-wash: #fdeeee;
  --button: #2572cf;
  --button-hover: #1c5cab;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 10px 30px rgba(11, 11, 11, 0.04);
  --radius: 16px;
  --radius-sm: 10px;
  --max: 1440px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* 移动端页面底部留白：让最后内容能滚到 iOS Safari 底部工具栏上方 */
  --page-bottom-space: calc(96px + var(--safe-bottom));
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232322;
    --surface-3: #2c2c2a;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #898781;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: #4a4a46;
    --control: #6f6d67;
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --accent-track: rgba(57, 135, 229, 0.28);
    --accent-wash: rgba(57, 135, 229, 0.12);
    --good: #0ca30c;
    --good-ink: #2fbf2f;
    --good-wash: rgba(12, 163, 12, 0.16);
    --warning: #fab219;
    --warning-ink: #fab219;
    --warning-wash: rgba(250, 178, 25, 0.14);
    --critical: #d03b3b;
    --critical-ink: #e66767;
    --critical-wash: rgba(208, 59, 59, 0.16);
    --button: #2572cf;
    --button-hover: #1c5cab;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 34px rgba(0, 0, 0, 0.30);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232322;
  --surface-3: #2c2c2a;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #898781;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: #4a4a46;
  --control: #6f6d67;
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --accent-track: rgba(57, 135, 229, 0.28);
  --accent-wash: rgba(57, 135, 229, 0.12);
  --good: #0ca30c;
  --good-ink: #2fbf2f;
  --good-wash: rgba(12, 163, 12, 0.16);
  --warning: #fab219;
  --warning-ink: #fab219;
  --warning-wash: rgba(250, 178, 25, 0.14);
  --critical: #d03b3b;
  --critical-ink: #e66767;
  --critical-wash: rgba(208, 59, 59, 0.16);
  --button: #2572cf;
  --button-hover: #1c5cab;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 34px rgba(0, 0, 0, 0.30);
}

:root[data-theme="light"] {
  color-scheme: light;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--page);
  background-image: radial-gradient(1100px 560px at 90% -12%, var(--accent-wash), transparent 62%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  flex: none;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

::selection {
  background: var(--accent-track);
  color: var(--text);
}

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

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -56px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--button);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 56px;
  padding: 0 clamp(12px, 3vw, 24px);
  border-bottom: 1px solid var(--border);
  background: var(--page);
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

button.menu-btn {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-right: 8px;
  flex: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--button);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.12;
}

.brand-text strong {
  font-size: 14.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-text span {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.topnav a {
  padding: 6px 11px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .topnav {
    display: none;
  }
}

.topnav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.topnav a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.topbar-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.topbar-cta:hover {
  background: var(--accent-track);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- 撤销 / 前进 ---------- */
.history-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: none;
}

.history-tools .icon-btn {
  width: 32px;
  height: 32px;
}

.history-tools .icon-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.history-tools .icon-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.history-tools .icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.history-tools .icon-btn svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 520px) {
  .topbar .level-chip {
    display: none;
  }

  .history-tools .icon-btn {
    width: 28px;
    height: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .history-tools .icon-btn {
    transition: none;
  }

  .history-tools .icon-btn:active:not(:disabled) {
    transform: none;
  }
}

.level-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #6c5ce7);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(42, 120, 214, 0.28);
  flex: none;
}

.level-chip:hover {
  filter: brightness(1.06);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  line-height: 1;
  flex: none;
  -webkit-appearance: none;
  appearance: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.icon-btn svg {
  display: block;
  width: 17px;
  height: 17px;
  flex: none;
}

.icon-btn > span {
  display: block;
  line-height: 1;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.badge.is-zero {
  background: var(--surface-3);
  color: var(--muted);
}

.user-menu {
  position: relative;
}

.user-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px 0 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
}

.user-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.user-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.user-caret svg {
  display: block;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
}

.user-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  width: 190px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.user-pop p {
  margin: 4px 8px 8px;
  color: var(--muted);
  font-size: 11.5px;
}

.user-pop p strong {
  color: var(--text-2);
  font-weight: 600;
}

.user-pop a,
.user-pop button {
  display: block;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
}

.user-pop a:hover,
.user-pop button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.user-pop #logout-btn {
  color: var(--critical-ink);
}

/* ---------- 布局 ---------- */
.shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  max-width: var(--max);
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  overflow-y: auto;
  padding: 16px 12px calc(40px + var(--safe-bottom));
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-close {
  display: none;
}

.side-nav {
  display: grid;
  gap: 2px;
  margin-bottom: 18px;
}

.side-nav-label {
  margin: 12px 10px 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.side-nav-label:first-child {
  margin-top: 0;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
}

.side-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.side-nav a[aria-current="page"] {
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-weight: 600;
}

.side-nav a > span[aria-hidden] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.side-nav .badge {
  margin-left: auto;
}

.tree-wrap {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.tree-loading {
  padding: 10px;
  color: var(--muted);
  font-size: 12.5px;
}

.tree-course {
  margin-bottom: 10px;
}

.tree-course-head {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
}

.tree-course-head:hover {
  background: var(--surface-2);
}

.tree-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 12px;
  color: var(--muted);
  line-height: 1;
  transition: transform 0.15s ease;
}

.tree-caret svg {
  display: block;
}

.tree-course.is-collapsed .tree-caret {
  transform: rotate(-90deg);
}

.tree-emoji {
  font-size: 13px;
}

.tree-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-children {
  margin-left: 17px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.tree-course.is-collapsed .tree-children {
  display: none;
}

.tree-chapter {
  margin: 7px 0 4px;
}

.tree-chapter-title {
  padding: 3px 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tree-lesson {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.45;
}

.tree-lesson:hover {
  background: var(--surface-2);
  color: var(--text);
}

.tree-lesson.is-active {
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-weight: 600;
}

.tree-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
}

.tree-lesson.is-read .tree-dot {
  background: var(--good);
}

.tree-lesson.is-active .tree-dot {
  background: var(--accent);
}

.tree-lesson span.tree-lesson-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-count {
  flex: none;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
}

.tree-count.is-new {
  background: var(--surface-2);
  color: var(--muted);
}

.main {
  min-width: 0;
  padding: clamp(20px, 3.5vw, 40px) clamp(16px, 4vw, 40px) calc(64px + var(--safe-bottom));
  outline: none;
}

.main > * {
  animation: rise 0.3s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.sidebar-backdrop {
  display: none;
}

/* ---------- 通用 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
}

.page-head {
  margin-bottom: clamp(20px, 3vw, 30px);
}

.page-head h1 {
  margin: 0 0 9px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 750;
  line-height: 1.12;
}

.page-head .lede {
  max-width: 66ch;
  margin: 0;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.7;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: none;
}

.btn-primary {
  background: var(--button);
  color: #fff;
}

.btn-primary:hover {
  background: var(--button-hover);
}

.btn-ghost {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.btn-quiet {
  border-color: var(--border);
  background: transparent;
  color: var(--text-2);
  font-weight: 500;
}

.btn-quiet:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-danger {
  background: var(--critical-wash);
  color: var(--critical-ink);
}

.btn-danger:hover {
  border-color: var(--critical);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.icon-text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.icon-text-btn svg {
  display: block;
  width: 14px;
  height: 14px;
  flex: none;
}

.icon-text-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-text-btn.is-danger:hover {
  background: var(--critical-wash);
  color: var(--critical-ink);
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > label {
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.field textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

.field .hint {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.form-error {
  margin: 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--critical-wash);
  color: var(--critical-ink);
  font-size: 12.5px;
}

/* ---------- 首页 ---------- */
.dash-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: clamp(18px, 3vw, 30px);
  align-items: stretch;
  margin-bottom: clamp(22px, 3.5vw, 34px);
}

.dash-hero-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(20px, 3.5vw, 32px);
  border-radius: var(--radius);
  background: linear-gradient(150deg, var(--surface) 35%, var(--accent-wash));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.dash-count {
  margin: 0 0 4px;
  font-size: clamp(46px, 7vw, 72px);
  font-weight: 750;
  letter-spacing: -0.055em;
  line-height: 1;
}

.dash-count small {
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
}

.dash-sub {
  margin: 8px 0 20px;
  color: var(--text-2);
  font-size: 14px;
}

.dash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.dash-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(18px, 3vw, 26px);
}

.dash-side-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--text-2);
  font-size: 12.5px;
}

.dash-side-head strong {
  color: var(--text);
  font-size: 28px;
  letter-spacing: -0.04em;
  line-height: 1;
}

.meter {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--accent-track);
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.dash-side-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11.5px;
}

/* ---------- 游戏化：等级 / 经验 / 每日目标 ---------- */
.game-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(14px, 2.5vw, 24px);
  align-items: center;
  padding: 18px clamp(16px, 2.5vw, 24px);
  margin-bottom: 18px;
}

.level-badge {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--accent), #6c5ce7);
  color: #fff;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(42, 120, 214, 0.28);
  flex: none;
}

.level-badge span {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
}

.level-badge strong {
  font-size: 24px;
  letter-spacing: -0.04em;
}

.game-main,
.goal-block {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.game-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-2);
  font-size: 12.5px;
}

.game-line strong {
  color: var(--text);
  font-size: 15px;
}

.game-line span {
  color: var(--muted);
  font-size: 11.5px;
}

.xp-meter,
.goal-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.xp-meter > span,
.goal-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #6c5ce7);
  transition: width 0.5s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.goal-meter > span {
  background: linear-gradient(90deg, var(--good), var(--warning));
}

.game-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.streak-block {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 64px;
  padding-left: 18px;
  border-left: 1px dashed var(--border);
}

.streak-block strong {
  color: var(--warning-ink);
  font-size: 20px;
}

.streak-block span {
  color: var(--muted);
  font-size: 10.5px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: clamp(22px, 3.5vw, 34px);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}

.stat-label {
  color: var(--muted);
  font-size: 11.5px;
}

.stat-value {
  color: var(--text);
  font-size: clamp(21px, 2.6vw, 28px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.stat-value small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.section {
  margin-top: clamp(20px, 3vw, 30px);
  margin-bottom: clamp(22px, 3.5vw, 34px);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(18px, 2.4vw, 23px);
}

.section-head .muted {
  font-size: 12px;
}

.section-note {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.dash-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: clamp(16px, 3vw, 26px);
  align-items: start;
}

.forecast-card {
  padding: clamp(16px, 2.6vw, 22px);
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 152px;
  padding: 10px 2px 0;
}

.chart-col {
  display: flex;
  flex: 1;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.chart-bar {
  width: 100%;
  max-width: 26px;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
  transition: opacity 0.15s ease;
}

.chart-bar:hover {
  opacity: 0.72;
}

.chart-bar.is-zero {
  background: var(--accent-track);
}

.chart-label {
  width: 100%;
  min-height: 13px;
  color: var(--muted);
  font-size: 9.5px;
  text-align: center;
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11.5px;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 3px;
  background: var(--accent);
}

.quick-list {
  display: grid;
  gap: 6px;
}

.quick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.quick-row:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.quick-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}

.quick-row.is-read .quick-dot {
  background: var(--good);
}

.quick-copy {
  flex: 1;
  min-width: 0;
}

.quick-copy strong {
  display: block;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-copy span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.quick-meta {
  flex: none;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.quick-meta strong {
  display: block;
  color: var(--accent-ink);
  font-size: 12px;
}

/* ---------- 复习 ---------- */
.review-page {
  max-width: 820px;
  margin: 0 auto;
}

.review-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 12.5px;
}

.review-top strong {
  color: var(--text);
  font-size: 14px;
}

.review-combo {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.review-combo.is-hot {
  background: var(--warning-wash);
  color: var(--warning-ink);
  animation: combo-pop 0.35s ease;
}

@keyframes combo-pop {
  0% { transform: scale(0.9); }
  55% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.review-goal {
  height: 6px;
  margin: -4px 0 16px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.review-goal > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #6c5ce7);
  transition: width 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.review-goal.is-done > span {
  background: linear-gradient(90deg, var(--good), var(--warning));
}

.review-session {
  margin: 10px 0 0;
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 700;
}

.review-card {
  padding: clamp(24px, 5vw, 46px);
}

.review-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 600;
}

.review-kind.is-new {
  background: var(--good-wash);
  color: var(--good-ink);
}

.review-context {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
}

.review-question {
  margin: 0 0 24px;
  color: var(--text);
  font-size: clamp(20px, 3vw, 27px);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.5;
  white-space: pre-wrap;
}

.review-label {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.review-answer + .grade-grid {
  margin-top: 24px;
}

.review-answer {
  margin: 0 0 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.review-answer strong {
  color: var(--text);
}

.review-reveal {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.review-reveal .btn {
  min-width: 180px;
}

.grade-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.grade-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 11px 6px 9px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-2);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.grade-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.grade-btn b {
  font-size: 18px;
  line-height: 1;
}

.grade-btn span {
  font-size: 11px;
}

.grade-btn .grade-interval {
  color: var(--muted);
  font-size: 9.5px;
}

.grade-btn.is-bad .grade-interval,
.grade-btn.is-hard .grade-interval,
.grade-btn.is-good .grade-interval,
.grade-btn.is-easy .grade-interval {
  color: inherit;
  opacity: 0.72;
}

.grade-btn.is-bad {
  background: var(--critical-wash);
  color: var(--critical-ink);
  border-color: transparent;
}

.grade-btn.is-hard {
  background: var(--warning-wash);
  color: var(--warning-ink);
  border-color: transparent;
}

.grade-btn.is-good {
  background: var(--good-wash);
  color: var(--good-ink);
  border-color: transparent;
}

.grade-btn.is-easy {
  background: var(--accent-wash);
  color: var(--accent-ink);
  border-color: transparent;
}

.review-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
}

.review-empty {
  padding: clamp(30px, 6vw, 56px);
  text-align: center;
}

.review-empty .big {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.review-empty p {
  max-width: 52ch;
  margin: 0 auto 18px;
  color: var(--text-2);
}

.review-empty .actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

/* ---------- 游戏化反馈动画 ---------- */
.xp-float {
  position: fixed;
  top: 76px;
  left: 50%;
  z-index: 240;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  animation: xp-rise 1.15s ease-out forwards;
}

.xp-float strong {
  padding: 6px 13px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #6c5ce7);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 8px 22px rgba(42, 120, 214, 0.35);
}

.xp-float span {
  color: var(--warning-ink);
  font-size: 11px;
  font-weight: 700;
}

.xp-float.is-combo strong {
  background: linear-gradient(135deg, #f08a24, #e5484d);
}

@keyframes xp-rise {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.9); }
  25% { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -36px) scale(1); }
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 240;
  overflow: hidden;
  pointer-events: none;
}

.confetti i {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  animation: confetti-fall 1.4s ease-out forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(105vh) rotate(540deg);
    opacity: 0.2;
  }
}

/* ---------- 课时 / 内容 ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumb a:hover {
  color: var(--text);
}

.lesson-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: clamp(18px, 3vw, 26px);
}

.lesson-header h1 {
  margin: 0 0 7px;
  font-size: clamp(27px, 4vw, 38px);
  font-weight: 750;
  line-height: 1.15;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.lesson-note {
  max-width: 62ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: none;
}

.lesson-panel {
  padding: clamp(20px, 3.5vw, 34px);
}

.lesson-content {
  max-width: 72ch;
  color: var(--text-2);
  font-size: 15.5px;
  line-height: 1.8;
}

.lesson-content > :first-child {
  margin-top: 0;
}

.lesson-content h2 {
  margin: 32px 0 10px;
  color: var(--text);
  font-size: clamp(19px, 2.2vw, 23px);
  line-height: 1.35;
}

.lesson-content h3 {
  margin: 24px 0 8px;
  color: var(--text);
  font-size: 16.5px;
}

.lesson-content p {
  margin: 0 0 14px;
}

.lesson-content ul,
.lesson-content ol {
  margin: 0 0 16px;
  padding-left: 1.4em;
}

.lesson-content li {
  margin: 6px 0;
}

.lesson-content li::marker {
  color: var(--muted);
}

.lesson-content strong {
  color: var(--text);
  font-weight: 650;
}

.lesson-content code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.88em;
}

.lesson-content hr {
  margin: 26px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.callout {
  margin: 0 0 18px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
}

.callout.is-tip {
  border-color: transparent;
  background: var(--accent-wash);
}

.callout.is-warn {
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
  background: var(--warning-wash);
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 4px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
}

.callout-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 700;
}

.callout.is-tip .callout-mark {
  color: var(--accent-ink);
}

.callout.is-warn .callout-mark {
  background: var(--warning);
  color: #0b0b0b;
}

.callout p:last-child {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
}

.code-block {
  margin: 0 0 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
}

.code-block figcaption {
  padding: 7px 13px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.7;
}

.code-block code {
  padding: 0;
  background: none;
  font-size: inherit;
}

blockquote {
  margin: 0 0 18px;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--accent);
  color: var(--text-2);
}

blockquote cite {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.table-wrap {
  margin: 0 0 18px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 11px;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.55;
}

.table-wrap th,
.table-wrap td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table-wrap th {
  background: var(--surface-2);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
}

.table-wrap tr:last-child td {
  border-bottom: 0;
}

.lesson-read-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.card-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.card-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}

.card-main {
  flex: 1;
  min-width: 0;
}

.card-question {
  margin: 0 0 3px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  white-space: pre-wrap;
}

.card-answer {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.card-side {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
}

.card-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.card-status.is-new {
  background: var(--good-wash);
  color: var(--good-ink);
}

.card-status.is-due {
  background: var(--warning-wash);
  color: var(--warning-ink);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
}

.empty-state {
  padding: clamp(28px, 5vw, 46px);
  text-align: center;
}

.empty-state h2,
.empty-state h1 {
  margin: 0 0 8px;
  font-size: clamp(21px, 3vw, 27px);
}

.empty-state p {
  max-width: 54ch;
  margin: 0 auto 16px;
  color: var(--text-2);
  font-size: 14px;
}

/* ---------- 知识树页 ---------- */
.tree-page {
  display: grid;
  gap: 16px;
}

.tree-page-course {
  padding: clamp(18px, 3vw, 26px);
}

.tree-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.tree-page-head h2 {
  margin: 0 0 4px;
  font-size: 19px;
}

.tree-page-head p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}

.tree-page-chapter {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.tree-page-chapter h3 {
  margin: 0 0 8px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.tree-page-lesson {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 13.5px;
}

.tree-page-lesson:hover {
  background: var(--surface-2);
  color: var(--text);
}

.tree-page-lesson .grow {
  flex: 1;
  min-width: 0;
}

.tree-page-lesson .grow strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-page-lesson .grow span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: 10.5px;
  white-space: nowrap;
}

.pill.is-good {
  background: var(--good-wash);
  color: var(--good-ink);
}

.pill.is-warn {
  background: var(--warning-wash);
  color: var(--warning-ink);
}

/* ---------- 内容管理 ---------- */
.manage-list {
  display: grid;
  gap: 14px;
}

.manage-course {
  padding: clamp(16px, 3vw, 24px);
}

.manage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.manage-head h2 {
  margin: 0 0 3px;
  font-size: 18px;
}

.manage-head p {
  margin: 0;
  color: var(--text-2);
  font-size: 12.5px;
}

.manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.manage-chapter {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.manage-chapter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.manage-chapter-head h3 {
  margin: 0;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.manage-lesson {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 8px;
}

.manage-lesson:hover {
  background: var(--surface-2);
}

.manage-lesson .grow {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-lesson .muted {
  font-size: 11px;
}

.manage-lesson-actions {
  display: flex;
  flex: none;
  gap: 3px;
}

/* ---------- 统计 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.game-panel {
  padding: clamp(16px, 2.6vw, 22px);
  margin-bottom: 16px;
}

.game-panel-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.game-panel-copy {
  flex: 1;
  min-width: 0;
}

.game-panel-copy h2 {
  margin: 0 0 2px;
  font-size: 18px;
}

.game-panel-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.game-panel-goal {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}

.game-panel-goal strong {
  color: var(--text);
  font-size: 16px;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.achievement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.achievement.is-locked {
  opacity: 0.48;
  filter: grayscale(0.7);
}

.achievement.is-unlocked {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--accent-wash);
}

.achievement-icon {
  font-size: 22px;
  line-height: 1;
}

.achievement strong {
  display: block;
  font-size: 12.5px;
}

.achievement p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.achievement small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.chart-card {
  padding: clamp(16px, 2.6vw, 22px);
}

.chart-card h2 {
  margin: 0 0 3px;
  font-size: 16px;
}

.chart-card .chart-sub {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11.5px;
}

.chart-card .chart-bars {
  height: 170px;
}

.chart-card .chart-col {
  min-width: 0;
}

.grade-bars {
  height: 130px;
}

.grade-bars .chart-col {
  max-width: 64px;
}

.table-view {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.table-view summary {
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
}

.table-view table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 12px;
}

.table-view th,
.table-view td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.table-view th {
  color: var(--text-2);
  font-weight: 600;
}

.range-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
}

.range-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  flex: none;
  white-space: nowrap;
}

.range-tabs button.is-active {
  border-color: transparent;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ---------- 设置 ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
}

.settings-card {
  padding: clamp(18px, 3vw, 26px);
}

.settings-card h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.settings-card .settings-sub {
  margin: 0 0 16px;
  color: var(--text-2);
  font-size: 12.5px;
}

.settings-card .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.account-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13px;
}

.account-line strong {
  color: var(--text);
}

.danger-zone {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--critical) 28%, var(--border));
}

.danger-zone h2 {
  color: var(--critical-ink);
}

/* ---------- 弹窗 / 提示 ---------- */
#modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 11, 11, 0.48);
}

#modal-root[hidden] {
  display: none !important;
}

.modal {
  width: min(100%, 560px);
  max-height: min(86vh, 760px);
  max-height: min(86dvh, 760px);
  overflow-y: auto;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.modal.is-wide {
  width: min(100%, 780px);
  padding-bottom: 0;
}

.modal.is-wide .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin: 18px calc(-1 * clamp(20px, 3vw, 28px)) 0;
  padding: 12px clamp(20px, 3vw, 28px) clamp(12px, 2vw, 18px);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0;
  font-size: 19px;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  line-height: 0;
  flex: none;
  -webkit-appearance: none;
  appearance: none;
}

.modal-close svg {
  display: block;
  width: 16px;
  height: 16px;
  margin: 0;
}

.modal-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.draft-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  padding: 9px 12px;
  border: 1px solid var(--accent-track);
  border-radius: 9px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: 12.5px;
  line-height: 1.5;
}

.draft-banner .icon-text-btn {
  padding: 2px 6px;
  color: inherit;
  text-decoration: underline;
}

.draft-banner .icon-text-btn:hover {
  background: transparent;
  color: var(--accent-ink);
  opacity: 0.78;
}

.draft-dialog-root {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 11, 11, 0.48);
}

.draft-dialog {
  width: min(100%, 440px);
}

.draft-dialog h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.draft-dialog p {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
}

.draft-dialog .modal-actions {
  margin-top: 20px;
}

.reward-modal .modal-head {
  margin-bottom: 8px;
}

.reward-xp {
  margin: 0 0 16px;
  color: var(--accent-ink);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-align: center;
}

.reward-items {
  display: grid;
  gap: 10px;
}

.reward-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
}

.reward-icon {
  font-size: 24px;
  line-height: 1;
}

.reward-item strong {
  display: block;
  font-size: 14px;
}

.reward-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 120;
  display: grid;
  gap: 8px;
  max-width: min(360px, calc(100vw - 36px));
}

.toast {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.5;
  animation: toast-in 0.2s ease both;
}

.toast.is-good {
  border-color: color-mix(in srgb, var(--good) 30%, var(--border));
  background: var(--good-wash);
  color: var(--good-ink);
}

.toast.is-bad {
  border-color: color-mix(in srgb, var(--critical) 30%, var(--border));
  background: var(--critical-wash);
  color: var(--critical-ink);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 悬停提示 ---------- */
.hover-tip {
  --tip-bg: var(--text);
  --tip-ink: var(--surface);
  position: fixed;
  z-index: 150;
  top: 0;
  left: 0;
  width: max-content;
  max-width: min(300px, calc(100vw - 20px));
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--tip-bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  color: var(--tip-ink);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.55;
  text-wrap: pretty;
  overflow-wrap: break-word;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.hover-tip[data-placement="top"] {
  transform: translateY(-3px);
}

.hover-tip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.hover-tip::after {
  content: "";
  position: absolute;
  left: var(--arrow-x, 50%);
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
}

.hover-tip[data-placement="bottom"]::after {
  top: -6px;
  border-bottom: 6px solid var(--tip-bg);
}

.hover-tip[data-placement="top"]::after {
  bottom: -6px;
  border-top: 6px solid var(--tip-bg);
}

.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40vh;
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent-track);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-state {
  max-width: 560px;
  margin: 10vh auto;
  padding: 28px;
  text-align: center;
}

.error-state h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.error-state p {
  margin: 0 0 16px;
  color: var(--text-2);
  font-size: 13.5px;
}

/* ---------- 帮助 ---------- */
.help-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.help-toc {
  position: sticky;
  top: 72px;
  padding: 14px;
}

.help-toc-title {
  margin: 0 0 8px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.help-toc-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 9px;
  color: var(--text-2);
  line-height: 1.4;
}

.help-toc-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

span.help-toc-link {
  padding: 7px 10px;
  font-size: 13px;
  cursor: default;
}

span.help-toc-link:hover {
  background: transparent;
  color: var(--text-2);
}

.help-toc-link.is-active,
.help-toc-link[aria-current="page"] {
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.help-toc-link strong {
  display: block;
  font-size: 13px;
}

.help-toc-link small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.help-toc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 18px;
  font-size: 16px;
  line-height: 1;
}

.help-article {
  padding: clamp(20px, 3vw, 30px);
}

.help-article-head h2 {
  margin: 0 0 9px;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.2;
}

.help-lede {
  max-width: 66ch;
  margin: 0;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.7;
}

.help-steps {
  display: grid;
  gap: 12px;
  margin: 20px 0 8px;
  padding: 0;
  list-style: none;
  counter-reset: help-step;
}

.help-steps li {
  position: relative;
  padding: 16px 18px 16px 52px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  counter-increment: help-step;
}

.help-steps li::before {
  content: counter(help-step);
  position: absolute;
  top: 15px;
  left: 16px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.help-steps strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14.5px;
}

.help-steps p {
  margin: 0;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.7;
}

.help-group {
  margin-top: 26px;
}

.help-group h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.help-group h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.help-shortcut-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.help-shortcut {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
}

.help-shortcut:nth-child(even) {
  background: var(--surface-2);
}

.help-shortcut + .help-shortcut {
  border-top: 1px solid var(--border);
}

.help-keys {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 1px;
}

.help-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.help-key-sep {
  color: var(--muted);
  font-size: 11px;
}

.help-shortcut-copy strong {
  display: block;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
}

.help-shortcut-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.help-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.help-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .help-layout {
    grid-template-columns: 1fr;
  }

  .help-toc {
    position: static;
  }

  .help-shortcut {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ---------- 课时内容编辑器 ---------- */
.block-editor {
  display: grid;
  gap: 10px;
}

.block-editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.block-editor-title {
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
}

.block-editor-hint {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.block-editor-hint code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 11px;
}

.block-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--surface-2);
}

.block-type-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.block-type-btn:hover {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.block-type-btn span {
  color: var(--muted);
  font-size: 12px;
}

.block-type-btn:hover span {
  color: inherit;
}

.block-empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.block-list {
  display: grid;
  gap: 10px;
}

.block-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}

.block-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.block-card-type {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
}

.block-card-actions {
  display: flex;
  gap: 2px;
}

.block-card-actions .icon-text-btn {
  padding: 3px 7px;
  font-size: 12px;
}

.block-card-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.block-input,
.block-textarea,
.block-card select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.block-input:focus,
.block-textarea:focus,
.block-card select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.block-textarea {
  min-height: 70px;
  resize: vertical;
  line-height: 1.6;
}

.block-code-textarea {
  min-height: 120px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.block-grid {
  display: grid;
  grid-template-columns: minmax(110px, 160px) minmax(0, 1fr);
  gap: 8px;
}

.block-mini {
  display: grid;
  gap: 4px;
}

.block-mini > span {
  color: var(--muted);
  font-size: 11.5px;
}

.block-list-editor {
  display: grid;
  gap: 6px;
}

.block-list-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.block-list-marker {
  flex: none;
  width: 22px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.block-row-remove {
  flex: none;
}

.block-sub-add {
  justify-self: start;
  padding: 5px 9px;
  border: 1px dashed var(--border-strong);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.block-sub-add:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.block-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.block-table-editor {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
}

.block-table-editor th,
.block-table-editor td {
  padding: 5px;
  border: 1px solid var(--border);
  vertical-align: top;
}

.block-table-editor th {
  background: var(--surface-2);
}

.block-table-editor th .icon-text-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  margin: 3px 0 0 auto;
  padding: 1px 5px;
}

.block-table-editor .block-input {
  padding: 6px 8px;
  font-size: 12.5px;
}

.block-table-add {
  width: 1%;
  white-space: nowrap;
  text-align: center;
}

.block-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.icon-text-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (max-width: 620px) {
  .block-grid {
    grid-template-columns: 1fr;
  }

  .block-table-editor {
    min-width: 300px;
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  button.menu-btn {
    display: inline-flex;
  }

  .shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 90;
    width: min(310px, 88vw);
    height: 100vh;
    height: 100dvh;
    padding-top: 18px;
    border-right: 1px solid var(--border);
    background: var(--surface);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
  }

  .sidebar.is-open {
    transform: none;
  }

  .sidebar-close {
    display: inline-flex;
  }

  .sidebar-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: block;
    background: rgba(11, 11, 11, 0.42);
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .main {
    padding-top: 22px;
    padding-bottom: var(--page-bottom-space);
  }

  .dash-hero {
    grid-template-columns: 1fr;
  }

  .dash-side {
    min-height: 150px;
  }

  .lesson-header {
    flex-direction: column;
  }

  .settings-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topnav {
    display: none;
  }

  .brand-text span {
    display: none;
  }

  .topbar {
    gap: 9px;
  }

  .user-btn #user-name,
  .user-btn .user-caret {
    display: none;
  }

  .user-btn {
    padding: 0 4px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grade-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-card {
    padding: 20px 16px 24px;
  }

  .chart-card .chart-bars {
    /* 标签是 nowrap 且居中，最左/最右会超出柱子的盒子；给两侧留出半个标签的宽度，
       否则最后一天会被裁成「11」这种半截日期。 */
    overflow: visible;
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (max-width: 520px) {
  .brand-text {
    display: none;
  }

  .topbar-cta {
    font-size: 12px;
    padding: 6px 10px;
  }

  .dash-hero-main {
    padding: 18px;
  }

  .lesson-panel {
    padding: 16px;
  }

  .manage-head,
  .tree-page-head {
    flex-direction: column;
  }

  .manage-actions {
    justify-content: flex-start;
  }

  .card-row {
    flex-direction: column;
  }

  .card-side {
    align-self: flex-start;
  }

  .chart-label {
    font-size: 8.5px;
  }

  .toast-root {
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
  }
}

@media (max-width: 900px) {
  .game-strip {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  }

  .streak-block {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding-top: 10px;
    padding-left: 0;
    border-top: 1px dashed var(--border);
    border-left: 0;
  }

  .achievement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .game-strip {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .goal-block,
  .streak-block {
    grid-column: 1 / -1;
  }

  .achievement-grid {
    grid-template-columns: 1fr;
  }

  .game-panel-head {
    flex-wrap: wrap;
  }

  .game-panel-goal {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    width: 100%;
  }

  .review-top {
    font-size: 11.5px;
  }

  .reward-xp {
    font-size: 28px;
  }
}

@media (max-width: 380px) {
  .level-chip {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 需求池 ---------- */
.backlog-quick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.backlog-quick input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.backlog-quick input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.backlog-quick select,
.backlog-status select {
  padding: 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.backlog-tabs button span {
  margin-left: 3px;
  color: var(--muted);
  font-size: 11px;
}

.backlog-tabs button.is-active span {
  color: var(--accent-ink);
}

.backlog-list {
  display: grid;
  gap: 12px;
}

.backlog-item {
  padding: 16px 18px;
  border-left: 4px solid var(--accent);
}

.backlog-item.is-idea {
  border-left-color: var(--accent);
}

.backlog-item.is-planned {
  border-left-color: var(--warning);
}

.backlog-item.is-doing {
  border-left-color: var(--button);
}

.backlog-item.is-done {
  border-left-color: var(--good);
}

.backlog-item.is-paused {
  border-left-color: var(--control);
}

.backlog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.backlog-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

.backlog-item.is-done .backlog-head h3 {
  color: var(--muted);
  text-decoration: line-through;
}

.backlog-priority {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  white-space: nowrap;
}

.backlog-priority.is-high {
  background: var(--critical-wash);
  color: var(--critical-ink);
}

.backlog-priority.is-medium {
  background: var(--warning-wash);
  color: var(--warning-ink);
}

.backlog-priority.is-low {
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.backlog-detail {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.backlog-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.backlog-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.backlog-status select {
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
}

.backlog-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

@media (max-width: 620px) {
  .backlog-quick {
    flex-wrap: wrap;
  }

  .backlog-quick input {
    flex-basis: 100%;
  }

  .backlog-quick select {
    flex: 1;
  }

  .backlog-actions {
    width: 100%;
    margin-left: 0;
  }
}

/* ---------- 移动端输入框字号 ---------- */
/* 移动浏览器对字号小于 16px 的输入框聚焦时会自动放大页面，失焦后不回缩；
   统一提到 16px，从根上避免编辑时界面被放大。 */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  .field input,
  .field textarea,
  .field select,
  .block-input,
  .block-textarea,
  .block-card select,
  .backlog-quick input,
  .backlog-quick select,
  .backlog-status select {
    font-size: 16px;
  }
}

/* ---------- 2026-11-11 参与机制重设计：抽卡 / 战胜遗忘 / 饥饿 / 毕业 ---------- */

/* 复习抽卡 */
.review-gacha {
  max-width: 760px;
}

.review-top-min {
  justify-content: space-between;
}

.review-mode {
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.review-deck {
  display: inline-flex;
  align-items: center;
  min-width: 52px;
}

.review-deck i {
  width: 18px;
  height: 26px;
  margin-left: -7px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 4px;
  background: linear-gradient(160deg, var(--accent), #6c5ce7);
  box-shadow: 0 4px 10px rgba(42, 120, 214, 0.26);
}

.review-deck i:first-child {
  margin-left: 0;
  transform: rotate(-7deg);
}

.review-deck i:nth-child(2) {
  transform: translateY(-2px) rotate(2deg);
}

.review-deck i:nth-child(3) {
  transform: rotate(8deg);
}

.review-exit {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.review-exit:hover {
  color: var(--text);
}

.review-card.is-dealing {
  animation: deal-in 0.4s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.review-card.is-revealed .review-answer {
  animation: answer-in 0.3s ease;
}

.review-card.is-revealed .grade-grid {
  animation: answer-in 0.34s ease 0.04s both;
}

@keyframes deal-in {
  from { opacity: 0; transform: translateY(18px) rotate(1.4deg) scale(0.975); }
  to { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}

@keyframes answer-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.review-footnote {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.graduation-card.is-graduated {
  background: linear-gradient(150deg, var(--surface) 35%, var(--good-wash));
}

.graduation-card.is-rest {
  background: linear-gradient(150deg, var(--surface) 35%, var(--warning-wash));
}

/* 战胜遗忘的反馈 */
.win-float {
  position: fixed;
  top: 76px;
  left: 50%;
  z-index: 240;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  max-width: min(92vw, 420px);
  pointer-events: none;
  text-align: center;
  animation: xp-rise 1.9s ease-out forwards;
}

.win-float strong {
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--good), #2a78d6);
  color: #fff;
  font-size: 15px;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 22px rgba(42, 120, 214, 0.3);
}

.win-float b {
  color: var(--warning-ink);
  font-size: 18px;
}

.win-float span {
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.4;
}

.win-float .win-odds {
  color: var(--muted);
}

.win-float .win-encoding {
  color: var(--good-ink);
  font-weight: 700;
}

.win-float.is-jackpot strong {
  background: linear-gradient(135deg, #f0a30a, #e5484d);
  box-shadow: 0 10px 26px rgba(229, 72, 77, 0.34);
}

.win-float.is-encoding strong {
  background: linear-gradient(135deg, var(--good), #2a78d6);
}

/* 首页：想学清单 / 最近胜利 */
.hunger-card {
  margin-bottom: 18px;
}

.hunger-list {
  display: grid;
  gap: 6px;
}

.hunger-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.hunger-row:hover {
  background: var(--surface-3);
  transform: translateY(-1px);
}

.hunger-row.is-locked {
  opacity: 0.68;
}

.hunger-row.is-locked:hover {
  opacity: 0.9;
}

.hunger-row .grow {
  flex: 1;
  min-width: 0;
}

.hunger-row .grow strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hunger-row .grow span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.hunger-lock {
  width: 26px;
  font-size: 16px;
  text-align: center;
}

.hunger-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.hunger-row:not(.is-locked) .hunger-badge {
  background: var(--good-wash);
  color: var(--good-ink);
}

.wins-card,
.wins-panel {
  margin-bottom: 18px;
  padding: clamp(16px, 2.5vw, 24px);
}

.wins-panel .wins-head,
.wins-panel .win-shelf {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

.wins-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.wins-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.wins-sub {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.wins-range {
  flex: none;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--warning-wash);
  color: var(--warning-ink);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.win-shelf {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.win-shelf.is-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.win-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 18px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(155deg, var(--surface) 42%, var(--tile-wash, var(--surface-2)));
  overflow: hidden;
  text-align: center;
}

.win-tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--tile-accent, var(--accent));
  opacity: 0.9;
}

.win-tile.is-forget {
  --tile-accent: var(--warning);
  --tile-wash: var(--warning-wash);
}

.win-tile.is-long {
  --tile-accent: var(--good);
  --tile-wash: var(--good-wash);
}

.win-tile.is-encoding {
  --tile-accent: #6c5ce7;
  --tile-wash: rgba(108, 92, 231, 0.13);
}

.win-tile.is-app {
  --tile-accent: var(--accent);
  --tile-wash: var(--accent-wash);
}

.win-tile.is-zero .win-main strong {
  color: var(--muted);
}

.win-tile.is-zero .win-icon {
  opacity: 0.6;
}

.win-tile.is-zero::before {
  opacity: 0.45;
}

.win-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(11, 11, 11, 0.04);
  font-size: 16px;
  line-height: 1;
}

.win-main {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
}

.win-main strong {
  color: var(--text);
  font-size: 32px;
  font-weight: 750;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.win-main span {
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.4;
  text-align: center;
}

.win-delta {
  align-self: center;
  margin-top: auto;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.win-shelf.is-compact .win-tile {
  padding: 14px 10px;
}

.win-shelf.is-compact .win-icon {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

.win-shelf.is-compact .win-main strong {
  font-size: 26px;
}

.win-shelf.is-compact .win-delta {
  font-size: 9.5px;
}

/* 知识地图：生长 / 雾区 */
.tree-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 11.5px;
}

.continue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px clamp(16px, 3vw, 24px);
  background: linear-gradient(150deg, var(--surface) 40%, var(--accent-wash));
}

.continue-main {
  min-width: 0;
}

.continue-main .eyebrow {
  margin-bottom: 5px;
}

.continue-main h2 {
  margin: 0 0 4px;
  font-size: clamp(19px, 2.5vw, 23px);
  line-height: 1.25;
}

.continue-main p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

@media (max-width: 620px) {
  .continue-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

.tree-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--surface-3);
}

.legend-dot.is-frontier {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.legend-dot.is-fog {
  background: var(--border-strong);
}

.legend-dot.is-stable {
  background: var(--good);
}

.tree-page-lesson.is-frontier {
  box-shadow: inset 2px 0 0 var(--accent);
  background: var(--accent-wash);
}

.tree-page-lesson.is-fogged {
  opacity: 0.56;
}

.tree-page-lesson.is-fogged:hover {
  opacity: 0.9;
}

.tree-statuses {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.pill.is-fog {
  background: var(--surface-3);
  color: var(--muted);
}

.tree-mastery-line {
  display: flex !important;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
}

.tree-mastery-bar {
  display: block;
  flex: 1 1 auto;
  width: auto;
  min-width: 36px;
  max-width: 150px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.tree-mastery-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--good));
}

.tree-mastery-line small {
  color: var(--muted);
  font-size: 9.5px;
  white-space: nowrap;
}

.tree-lesson .tree-mastery {
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 999px;
  background: conic-gradient(var(--good) var(--m), var(--surface-3) 0);
  opacity: 0.9;
}

.tree-lesson.is-fogged {
  opacity: 0.52;
}

.tree-lesson.is-frontier .tree-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

/* 应用关卡 */
.application-card {
  margin-top: 18px;
  padding: clamp(18px, 3vw, 26px);
}

.application-meta {
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 11.5px;
}

.application-prompt {
  margin: 0 0 12px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.65;
}

.application-form {
  display: grid;
  gap: 10px;
}

.application-form textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}

.application-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.application-ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-rating {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.app-rating input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.app-rating span {
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.app-rating input:checked + span {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.app-rating input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.application-history {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.app-history-item {
  display: inline-block;
  margin: 3px 8px 0 0;
  color: var(--text-2);
  font-size: 11px;
}

/* 编码工坊 */
.encode-lab {
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
}

.encode-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.encode-head strong {
  font-size: 13.5px;
}

.encode-tips {
  margin: 8px 0;
  padding-left: 18px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}

.encode-idea {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.55;
}

.encode-idea.is-fresh {
  animation: idea-pop 0.35s ease;
}

@keyframes idea-pop {
  0% { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* 设置：节奏 */
.toggle-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}

.toggle-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* 帮助：机制说明 */
.help-section {
  margin-top: clamp(26px, 4vw, 40px);
  padding-top: clamp(20px, 3vw, 28px);
  border-top: 1px solid var(--border);
}

.help-section h2 {
  margin: 0 0 8px;
  font-size: clamp(20px, 3vw, 26px);
  letter-spacing: -0.02em;
}

.help-mechanics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.help-mechanics > div {
  padding: 13px 14px;
  border-radius: 11px;
  background: var(--surface-2);
}

.help-mechanics strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.help-mechanics p {
  margin: 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 760px) {
  .win-shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wins-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .win-main strong {
    font-size: 28px;
  }

  .help-mechanics {
    grid-template-columns: 1fr;
  }

  .tree-statuses {
    justify-content: flex-start;
  }

  .tree-page-lesson {
    align-items: flex-start;
  }

  .review-deck {
    min-width: 44px;
  }

  .win-float {
    top: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .review-card.is-dealing,
  .review-card.is-revealed .review-answer,
  .review-card.is-revealed .grade-grid,
  .win-float,
  .encode-idea.is-fresh {
    animation: none;
  }
}

/* 复习卡片/答案是程序化聚焦的容器，不显示焦点蓝框（键盘评分按钮仍保留焦点样式）。 */
.review-card:focus,
.review-card:focus-visible,
.review-answer:focus,
.review-answer:focus-visible {
  outline: none;
}

/* 面包屑跳转到知识树的课程/章节锚点 */
.tree-page-course,
.tree-page-chapter {
  scroll-margin-top: 90px;
}

.tree-page-course.is-target {
  box-shadow: 0 0 0 2px var(--accent), var(--shadow);
}

.tree-page-chapter.is-target {
  box-shadow: -3px 0 0 var(--accent);
}

.tree-page-chapter.is-target h3 {
  color: var(--accent-ink);
}

/* ============================================================
   2026-11-18 直观化改版：一套导航 + 首页单一行动 + 步骤提示
   ============================================================ */

/* ---------- 底部标签栏（仅手机/窄屏） ---------- */
.tabbar {
  display: none;
}

@media (max-width: 900px) {
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 6px calc(6px + var(--safe-bottom));
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .tabbar a,
  .tabbar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0 4px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
  }

  .tabbar a[aria-current="page"] {
    background: var(--accent-wash);
    color: var(--accent-ink);
  }

  .tab-ico {
    position: relative;
    display: inline-flex;
  }

  .tabbar .badge {
    position: absolute;
    top: -5px;
    left: 11px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
  }

  .tabbar .badge[hidden] {
    display: none;
  }

  .topbar-cta {
    display: none;
  }

  /* 抽屉展开时底部标签栏让位，避免遮住菜单底部 */
  body.sidebar-open .tabbar {
    display: none;
  }
}

/* ---------- 首页：今天该做什么 ---------- */
.today-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr);
  gap: clamp(20px, 4vw, 44px);
  align-items: center;
  padding: clamp(22px, 4vw, 40px);
  margin-bottom: 22px;
  border-left: 4px solid var(--accent);
}

.today-hero.is-done {
  border-left-color: var(--good);
}

.today-hero.is-rest {
  border-left-color: var(--warning);
}

.today-eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.today-title {
  margin: 0 0 10px;
  font-size: clamp(27px, 4.2vw, 40px);
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.today-sub {
  max-width: 52ch;
  margin: 0 0 20px;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.65;
}

.today-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-lg {
  padding: 13px 22px;
  font-size: 15px;
}

.today-progress {
  padding: 5px 0;
}

.today-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  color: var(--text-2);
  font-size: 13px;
}

.today-progress-head strong {
  color: var(--text);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.today-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

/* 首页底部三个数字 */
.today-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.fact {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
}

.fact:hover {
  border-color: var(--border-strong);
}

.fact strong {
  color: var(--text);
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fact span {
  flex-basis: 100%;
  order: -1;
}

.hunger-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.hunger-card {
  margin-bottom: 22px;
  padding: clamp(16px, 2.5vw, 24px);
}

.tree-label {
  margin-top: 0;
}

/* ---------- 复习：进度条 ---------- */
.review-progress-text {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.review-bar {
  height: 4px;
  margin: 2px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.review-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}

/* 完成页里的升级 / 成就 */
.review-finish-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 4px;
}

.review-finish-badges span {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 600;
}

/* ---------- 课时：三步指示 ---------- */
.lesson-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.lesson-steps li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.lesson-steps li span {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
}

.lesson-steps li.is-current {
  color: var(--text);
  font-weight: 600;
}

.lesson-steps li.is-current span {
  background: var(--accent);
  color: #fff;
}

.lesson-steps li.is-done {
  color: var(--text-2);
}

.lesson-steps li.is-done span {
  background: var(--good-wash);
  color: var(--good-ink);
}

@media (max-width: 760px) {
  .today-hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .today-actions .btn {
    flex: 1 1 auto;
  }

  .today-facts {
    grid-template-columns: 1fr;
  }
}

/* 帮助页目录跳转 */
a.help-toc-link {
  font-size: 13px;
}

.help-section[id],
.help-article-head[id] {
  scroll-margin-top: 80px;
}

/* 设置页：手动上限仅在关闭自动模式时显示 */
.field[hidden] {
  display: none;
}

/* 手机底部标签栏上方留出 Toast，避免提示被挡 */
@media (max-width: 900px) {
  .toast-root {
    bottom: calc(78px + var(--safe-bottom));
  }
}

/* ---------- 收集箱 ---------- */
.capture-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.capture-btn:hover {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.capture-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  .capture-btn {
    width: 32px;
    height: 32px;
    padding: 0;
  }

  .capture-label {
    display: none;
  }
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
}

.inbox-hint {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin: 14px 0 18px;
  border-left: 4px solid var(--accent);
  color: var(--text);
  text-decoration: none;
}

.inbox-hint:hover {
  background: var(--surface-2);
}

.inbox-hint .grow {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.inbox-hint strong {
  font-size: 14px;
}

.inbox-hint .grow span {
  color: var(--muted);
  font-size: 12.5px;
}

.inbox-hint-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.inbox-hint-go {
  flex: none;
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 600;
}

.inbox-quick {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.inbox-quick textarea {
  width: 100%;
  min-height: 84px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}

.inbox-quick textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.inbox-quick-foot {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inbox-quick-foot input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.inbox-quick .hint {
  margin: 0;
}

.inbox-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.inbox-search input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.inbox-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.inbox-tag-filter {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12.5px;
}

.inbox-tabs {
  flex-wrap: wrap;
}

.inbox-tabs button span {
  margin-left: 3px;
  color: var(--muted);
  font-size: 11px;
}

.inbox-tabs button.is-active span {
  color: var(--accent-ink);
}

.inbox-list {
  display: grid;
  gap: 12px;
}

.inbox-item {
  padding: 16px 18px;
  border-left: 4px solid var(--accent);
}

.inbox-item.is-done {
  border-left-color: var(--good);
}

.inbox-item.is-archived {
  border-left-color: var(--control, var(--border-strong));
  opacity: 0.82;
}

.inbox-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.inbox-head h3 {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.45;
  word-break: break-word;
}

.inbox-time {
  flex: none;
  font-size: 12px;
}

.inbox-body {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.inbox-body.is-clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.inbox-expand {
  margin-top: 4px;
  padding: 0;
}

.inbox-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.inbox-tag-btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
}

.inbox-tag-btn:hover {
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.inbox-source {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent-ink);
  font-size: 12.5px;
}

.inbox-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.inbox-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.inbox-actions .icon-text-btn {
  font-size: 12.5px;
}

.inbox-result {
  color: var(--good);
  font-size: 12.5px;
  text-decoration: none;
}

a.inbox-result:hover {
  text-decoration: underline;
}

@media (max-width: 620px) {
  .inbox-quick-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .inbox-foot {
    flex-direction: column;
    align-items: flex-start;
  }

  .inbox-actions .btn {
    flex: 1 1 130px;
  }

  .inbox-actions .icon-text-btn {
    flex: 1 1 56px;
  }
}

/* ---------- 统一留白：输入框、下拉框与列表行不要贴边 ---------- */
/* 原生 select 的箭头几乎贴着右边框；改成自绘箭头，并给右侧留出空间。
   深色 / 浅色都用同一个中性灰，两种主题下都清楚。 */
.field select,
.block-card select,
.backlog-quick select,
.backlog-status select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%238b919b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
}

.field input,
.field textarea {
  padding: 12px 14px;
}

.field select {
  padding: 12px 38px 12px 14px;
  background-position: right 13px center;
}

.field textarea {
  line-height: 1.7;
}

.block-input,
.block-textarea {
  padding: 9px 11px;
}

.block-card select {
  padding: 9px 30px 9px 11px;
  background-position: right 9px center;
}

.backlog-quick input {
  padding: 11px 13px;
}

.backlog-quick select {
  padding: 11px 34px 11px 13px;
  background-position: right 11px center;
}

.backlog-status select {
  padding: 5px 26px 5px 10px;
  background-position: right 8px center;
}

.application-form textarea {
  padding: 13px 15px;
}

.inbox-quick textarea {
  padding: 13px 15px;
}

.inbox-quick-foot input,
.inbox-search input {
  padding: 10px 13px;
}

/* 列表与侧栏行：文字离容器边缘再松一点 */
.side-nav a {
  padding: 9px 12px;
}

.tree-course-head {
  padding: 7px 9px;
}

.tree-chapter-title {
  padding: 4px 9px;
}

.tree-lesson {
  padding: 6px 9px;
}

.tree-page-lesson {
  padding: 10px 12px;
}

.manage-lesson {
  padding: 9px 11px;
}

/* 保存内容后滚动回刚编辑的那一项时，顶部留出顶栏的高度 */
[data-course-id],
[data-chapter-id],
[data-lesson-id] {
  scroll-margin-top: 88px;
}

/* ---------- AI 生成复习卡片 ---------- */
.ai-dialog-lead {
  margin: -4px 0 14px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
}

.ai-dialog-body {
  min-height: 120px;
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 36px 16px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.6;
}

.ai-error {
  padding: 18px;
  border: 1px solid var(--critical);
  border-radius: var(--radius-sm);
  background: var(--critical-wash);
  color: var(--text);
}

.ai-error strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.ai-error p {
  margin: 0 0 12px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
}

.ai-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.ai-select-all {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.ai-summary .muted {
  font-size: 12px;
}

.ai-card-list {
  display: grid;
  gap: 9px;
}

.ai-card-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ai-card-option:hover {
  border-color: var(--border-strong);
}

.ai-card-option:has(input:checked) {
  border-color: var(--accent-track);
  background: var(--accent-wash);
}

.ai-card-option > input {
  margin-top: 2px;
  flex: none;
}

.ai-card-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.ai-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-type {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ai-card-option:has(input:checked) .ai-type {
  background: var(--accent-track);
  color: var(--accent-ink);
}

.ai-q {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.ai-a {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.ai-card-body .tag-list {
  margin-top: 1px;
}

@media (max-width: 620px) {
  .ai-dialog-lead {
    margin-top: -8px;
  }

  .modal.is-wide .modal-actions {
    position: sticky;
  }

  .ai-card-option {
    padding: 11px;
  }
}

/* ---------- ICP 备案 ---------- */
.side-icp {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}
.side-icp a { color: inherit; text-decoration: none; }
.side-icp a:hover { text-decoration: underline; }

/* ---------- 移动端细节修复（2026-11-20） ---------- */
/* 内容管理：课时标题独占一行，操作按钮换到下一行，避免「知...」被截断。 */
@media (max-width: 760px) {
  .manage-lesson {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .manage-lesson .grow {
    flex: 1 1 100%;
    overflow: visible;
    white-space: normal;
  }

  .manage-lesson-actions {
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 2px;
  }

  .manage-lesson .muted {
    margin-right: auto;
  }

  /* 课程目录：状态标签单独占一行，掌握度进度条不再被挤成竖排文字。 */
  .tree-page-lesson {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .tree-statuses {
    flex: 1 1 100%;
    justify-content: flex-start;
    padding-left: 22px;
  }
}

@media (max-width: 620px) {
  .manage-chapter-head {
    flex-wrap: wrap;
  }

  /* 课时页：主操作占满一行，其余操作两两换行。 */
  .lesson-actions {
    width: 100%;
  }

  .lesson-actions > .btn-primary {
    flex: 1 1 100%;
  }
}
