/* SciLadder · 科阶 — DeepSeek 视觉语言前端（vanilla CSS，零构建） */

/* ---------- 自托管 DM Sans（latin 子集；中文自动回退苹方/思源） ---------- */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/vendor/fonts/dm-sans/dm-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/vendor/fonts/dm-sans/dm-sans-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/vendor/fonts/dm-sans/dm-sans-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/vendor/fonts/dm-sans/dm-sans-latin-700-normal.woff2") format("woff2");
}

/* 一、设计 token */
:root {
  /* ---- 背景 / 文字 ---- */
  --ds-bg-page: #f9f8f8;
  --ds-bg-sunken: #f3f4f6;
  --ds-heading: #152443;
  --ds-ink: #1e232c;
  --ds-ink-soft: #4b5563;
  --ds-muted: #5f6b7a;
  --ds-faint: #6b7280;

  /* ---- 品牌 ---- */
  --ds-brand: #4d6bfe;
  --ds-brand-medium: #4176e6;
  --ds-brand-deep: #3a65c2;
  --ds-brand-soft: rgba(77, 107, 254, 0.10);
  --ds-brand-soft-2: rgba(77, 107, 254, 0.16);
  --ds-brand-ink: #3a65c2;      /* 浅底上的品牌文字（对比度 4.95:1） */
  --ds-brand-btn: #4a66f6;      /* 实心按钮底色（白字 4.6:1，AA） */
  --ds-brand-btn-hover: #3c5ce8;

  /* ---- 语义色 ---- */
  --ds-success: #059669;
  --ds-success-soft: rgba(5, 150, 105, 0.10);
  --ds-success-border: rgba(5, 150, 105, 0.24);
  --ds-warning: #d97706;
  --ds-warning-soft: rgba(217, 119, 6, 0.12);
  --ds-warning-border: rgba(217, 119, 6, 0.24);
  --ds-danger: #e11d48;
  --ds-danger-soft: rgba(225, 29, 72, 0.10);
  --ds-danger-border: rgba(225, 29, 72, 0.24);
  --ds-violet: #7c3aed;
  --ds-success-ink: #047857;
  --ds-warning-ink: #b45309;
  --ds-danger-ink: #be123c;

  /* ---- 边框 ---- */
  --ds-border-subtle: rgba(0, 0, 0, 0.06);
  --ds-border: rgba(0, 0, 0, 0.10);
  --ds-border-strong: rgba(0, 0, 0, 0.20);
  --ds-border-glass: rgba(255, 255, 255, 0.55);

  /* ---- 玻璃 ---- */
  --ds-blur: 12px;

  /* ---- 字体 ---- */
  --ds-font: "DM Sans", system-ui, -apple-system, "Segoe UI", "Noto Sans SC",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --ds-font-mono: "Fragment Mono", "Roboto Mono", ui-monospace, "Cascadia Code", Consolas,
    "Liberation Mono", monospace;

  /* ---- 圆角 ---- */
  --ds-r-sm: 8px;
  --ds-r-input: 10px;
  --ds-r-control: 12px;
  --ds-r-panel: 16px;
  --ds-r-card: 24px;
  --ds-r-pill: 100px;

  /* ---- 阴影 ---- */
  --ds-shadow-card: 0 0 0 1px #f1f5f9, 0 2px 4px rgba(0, 0, 0, 0.05),
    0 12px 24px rgba(0, 0, 0, 0.05);
  --ds-shadow-e2: 0 24px 64px rgba(21, 36, 67, 0.16);
  --ds-shadow-float: 0 0 1px rgba(0, 0, 0, 0.2), 0 0 4px rgba(0, 0, 0, 0.02),
    0 12px 32px rgba(0, 0, 0, 0.08);

  /* ---- 动效 ---- */
  --ds-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ds-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ds-ease-std: cubic-bezier(0.4, 0, 0.2, 1);
  --ds-ring: 0 0 0 2px rgba(77, 107, 254, 0.35);
  --ds-ring-offset: 0 0 0 2px #f9f8f8, 0 0 0 4px rgba(77, 107, 254, 0.35);

  /* ---- 布局 ---- */
  --col: 1200px;
  --col-session: 960px;
  --grid-size: 112px;

  /* ---- 网格：十字留白 + 中心点（DeepSeek 原站写法） ---- */
  --ds-grid-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='112'%20height='112'%20viewBox='0%200%20112%20112'%3E%3Cpath%20d='M0%2056H46M66%2056H112M56%200V46M56%2066V112'%20stroke='%23152443'%20stroke-opacity='.05'%20stroke-width='1'%20fill='none'/%3E%3Ccircle%20cx='56'%20cy='56'%20r='1.5'%20fill='%23152443'%20fill-opacity='.05'/%3E%3C/svg%3E");
  --ds-grid-mask: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.95) 0%,
    rgba(0, 0, 0, 0.72) 45%,
    rgba(0, 0, 0, 0.18) 78%,
    transparent 100%
  );
}

@media (max-width: 640px) {
  :root {
    --grid-size: 56px;
    --ds-grid-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='56'%20height='56'%20viewBox='0%200%2056%2056'%3E%3Cpath%20d='M0%2028H23M33%2028H56M28%200V23M28%2033V56'%20stroke='%23152443'%20stroke-opacity='.05'%20stroke-width='1'%20fill='none'/%3E%3Ccircle%20cx='28'%20cy='28'%20r='1'%20fill='%23152443'%20fill-opacity='.05'/%3E%3C/svg%3E");
  }
}

/* 二、基础重置 */
* { box-sizing: border-box; }

html { text-size-adjust: 100%; }

html,
body {
  margin: 0;
  padding: 0;
  max-width: 100%;
}

/* 用 clip 而不是 hidden：hidden 会让 body 变成滚动容器，破坏 sticky 导航 */
body { overflow-x: clip; }

body {
  background: var(--ds-bg-page);
  color: var(--ds-ink);
  font-family: var(--ds-font);
  font-size: 14px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

img,
svg,
video { max-width: 100%; }
iframe { border: 0; }

a { color: var(--ds-brand-deep); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: none; }

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

button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }

h1, h2, h3, h4 { color: var(--ds-heading); font-weight: 600; }

:focus-visible { outline: none; box-shadow: var(--ds-ring-offset); border-radius: 6px; }

::selection { background: var(--ds-brand); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.24); }
::-webkit-scrollbar-track { background: transparent; }

/* 三、背景层：暖白基底 + 顶部蓝雾 + 渐变流体 + 固定网格 */
.ds-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
  background: var(--ds-bg-page);
}

/* 顶部"天空"蓝雾（原站 hero 渐变） */
.ds-wash {
  position: absolute;
  inset: 0 0 auto 0;
  height: 460px;
  background:
    radial-gradient(900px 320px at 62% -80px, rgba(77, 107, 254, 0.10), transparent 70%),
    linear-gradient(rgba(156, 193, 231, 0.30) 0%, rgba(250, 250, 250, 0) 100%);
}

/* 渐变流体：大半径模糊色块，缓慢漂移 */
.ds-fluid { position: absolute; inset: 0; overflow: hidden; contain: strict; }

.ds-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.26;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  animation: ds-float 26s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}

.ds-blob-a {
  width: 48vw;
  height: 48vw;
  top: -20vw;
  left: -12vw;
  background:
    radial-gradient(circle at 32% 32%, #4d6bfe 0%, rgba(77, 107, 254, 0) 70%),
    radial-gradient(circle at 68% 64%, #7c9cff 0%, rgba(124, 156, 255, 0) 72%);
  --dx: 4%;
  --dy: -3%;
}

.ds-blob-b {
  width: 40vw;
  height: 40vw;
  top: 4vh;
  right: -14vw;
  opacity: 0.22;
  background:
    radial-gradient(circle at 40% 40%, #7c9cff 0%, rgba(124, 156, 255, 0) 70%),
    radial-gradient(circle at 60% 70%, #c7d4ff 0%, rgba(199, 212, 255, 0) 72%);
  --dx: -3%;
  --dy: 4%;
  animation-duration: 32s;
  animation-direction: alternate-reverse;
}

.ds-blob-c {
  width: 34vw;
  height: 34vw;
  bottom: -18vw;
  left: 16vw;
  opacity: 0.20;
  background:
    radial-gradient(circle at 46% 46%, #c7d4ff 0%, rgba(199, 212, 255, 0) 70%),
    radial-gradient(circle at 30% 70%, #9cc1e7 0%, rgba(156, 193, 231, 0) 72%);
  --dx: 5%;
  --dy: -4%;
  animation-duration: 36s;
}

.ds-blob-d {
  width: 26vw;
  height: 26vw;
  top: -10vw;
  left: 42vw;
  opacity: 0.14;
  background: radial-gradient(circle at 50% 50%, #9cc1e7 0%, rgba(156, 193, 231, 0) 70%);
  --dx: -4%;
  --dy: 3%;
  animation-duration: 30s;
}

@keyframes ds-float {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(var(--dx, 4%), var(--dy, -3%), 0) scale(1.08); }
  100% { transform: translate3d(calc(var(--dx, 4%) * -0.6), calc(var(--dy, -3%) * -0.5), 0) scale(0.97); }
}

/* 固定网格：虚线十字 + 中心点，顶部实、向下渐隐 */
.ds-grid {
  position: absolute;
  inset: 0;
  background-image: var(--ds-grid-image);
  background-size: var(--grid-size) var(--grid-size);
  background-position: 0 0;
  mask-image: var(--ds-grid-mask);
}

/* 底部柔化，避免长页面底部网格/流体压过内容 */
.ds-vignette { position: absolute; inset: auto 0 0 0; height: 240px; background: linear-gradient(to top, rgba(249, 248, 248, 0.85), rgba(249, 248, 248, 0)); }

/* 四、启动 / 加载 */
#app { position: relative; z-index: 1; min-height: 100vh; }

.app-boot { min-height: 100vh; }

.boot-loading {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ds-muted);
}

.boot-logo {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--ds-brand);
  color: #fff;
  box-shadow: var(--ds-shadow-card);
  margin-bottom: 6px;
}
.boot-logo svg { width: 30px; height: 30px; }

.boot-title {
  margin: 0;
  font-size: 17px;
  line-height: 26px;
  font-weight: 600;
  color: var(--ds-heading);
  letter-spacing: 0.01em;
}

.boot-hint {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ds-muted);
}

.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(77, 107, 254, 0.22);
  border-top-color: var(--ds-brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
  vertical-align: -2px;
}
.spinner.lg { width: 26px; height: 26px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-loading {
  min-height: 52vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ds-muted);
  font-size: 14px;
}
.page-loading .hint { font-size: 13px; color: var(--ds-faint); }

@keyframes shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -60% 0; }
}

/* 五、页面骨架 / 容器 */
.page {
  position: relative;
  width: 100%;
  max-width: var(--col);
  margin: 0 auto;
  padding: 18px 16px calc(96px + env(safe-area-inset-bottom, 0px));
  animation: page-in 0.24s var(--ds-ease-out);
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.page-narrow { max-width: 760px; }
.page-session { max-width: calc(var(--col-session) + 64px); padding-left: 32px; padding-right: 32px; }
.page-session .session-inner { padding: 0; }

body.has-composer .page-session { padding-bottom: var(--composer-space, 190px); }

@media (max-width: 899px) {
    .page-session { max-width: var(--col-session); padding-left: 16px; padding-right: 16px; }
}

/* 六、桌面顶部导航（移动端隐藏） */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: block;
  padding: 8px 12px 4px;
}
.app-nav::before {
  content: "";
  position: absolute;
  inset: 0 0 -14px;
  background: linear-gradient(
    to bottom,
    rgba(249, 248, 248, 0.96) 0%,
    rgba(249, 248, 248, 0.84) 58%,
    rgba(249, 248, 248, 0) 100%
  );
  pointer-events: none;
}

.app-nav-inner {
  position: relative;
  z-index: 1;
  max-width: var(--col);
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px 0 14px;
  border-radius: var(--ds-r-pill);
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--ds-border);
  box-shadow: var(--ds-shadow-card);
  backdrop-filter: blur(12px) saturate(140%);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: var(--ds-heading);
  flex-shrink: 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--ds-brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(77, 107, 254, 0.28);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-word { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-word b { font-size: 15px; font-weight: 600; color: var(--ds-heading); letter-spacing: 0.01em; }
.brand-word span { font-size: 11px; color: var(--ds-faint); white-space: nowrap; }

.nav-links { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border-radius: var(--ds-r-pill);
  color: var(--ds-ink-soft);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 150ms var(--ds-ease-std), color 150ms var(--ds-ease-std);
}
.nav-link svg { width: 17px; height: 17px; }
.nav-link:hover { background: rgba(0, 0, 0, 0.04); color: var(--ds-heading); }
.nav-link.active { background: var(--ds-brand-soft); color: var(--ds-brand-ink); font-weight: 600; }

.nav-side {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.nav-due {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border-radius: var(--ds-r-pill);
  background: rgba(217, 119, 6, 0.10);
  border: 1px solid rgba(217, 119, 6, 0.22);
  color: var(--ds-warning-ink);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: background-color 150ms var(--ds-ease-std);
}
.nav-due:hover { background: rgba(217, 119, 6, 0.16); }
.nav-due svg { width: 15px; height: 15px; }
.nav-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border-radius: var(--ds-r-pill);
  border: 1px solid var(--ds-border-subtle);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ds-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.nav-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ds-success);
  box-shadow: 0 0 0 3px var(--ds-success-soft);
}

@media (min-width: 960px) {
  .app-nav { padding: 10px 20px 8px; }
  .bottom-nav { display: none; }
}

/* 移动端紧凑导航：品牌 + 待复习 + 退出；链接交给底部导航 */
@media (max-width: 959px) {
    .app-nav-inner { height: 50px; border-radius: 16px; padding: 0 8px 0 10px; gap: 8px; }
  .app-nav .brand-mark { width: 30px; height: 30px; border-radius: 10px; }
  .app-nav .brand-mark svg { width: 17px; height: 17px; }
  .app-nav .brand-word b { font-size: 13.5px; }
  .app-nav .brand-word span { display: none; }
  .app-nav .nav-links { display: none; }
  .app-nav .nav-side { gap: 4px; }
  .app-nav .nav-status { display: none; }
  .app-nav .nav-due { height: 32px; padding: 0 10px; font-size: 12px; }
  .app-nav .icon-btn { min-width: 34px; min-height: 34px; }
}

/* 七、顶部栏（页面内返回 / 标题 / 操作） */
.topbar {
  position: sticky;
  top: 8px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  margin: 0 0 16px;
  border-radius: 18px;
  background: rgba(249, 248, 248, 0.78);
  border: 1px solid var(--ds-border-subtle);
  box-shadow: 0 2px 12px rgba(21, 36, 67, 0.04);
  backdrop-filter: blur(14px) saturate(140%);
}
.page-session .topbar { margin: 0 0 16px; }

.topbar-titles { min-width: 0; flex: 1; padding: 0 4px; }
.topbar-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ds-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--ds-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

/* 学习页标题栏工具栏：讲解深度 / 临时会话清理（吸顶，滚动中始终可点） */
.topbar.has-tools { flex-wrap: wrap; row-gap: 2px; }
.topbar-tools {
  order: 1;
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 1px;
  padding: 6px 4px 1px;
  border-top: 1px solid var(--ds-border-subtle);
}
.topbar-tools .depth-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.topbar-tools .link-btn { margin-left: auto; min-height: 26px; font-size: 12px; white-space: nowrap; }
@media (min-width: 900px) {
  .topbar.has-tools { flex-wrap: nowrap; row-gap: 0; }
  .topbar.has-tools .topbar-tools {
    order: 2;
    flex-basis: auto;
    flex-wrap: nowrap;
    align-self: stretch;
    margin-top: 0;
    padding: 0 0 0 12px;
    border-top: 0;
    border-left: 1px solid var(--ds-border-subtle);
  }
  .topbar.has-tools .topbar-actions { order: 3; }
}

@media (min-width: 960px) {
    .topbar { top: 12px; border-radius: var(--ds-r-pill); padding: 7px 10px; background: rgba(255, 255, 255, 0.55); }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 38px;
  min-height: 38px;
  padding: 0 8px;
  border-radius: var(--ds-r-control);
  color: var(--ds-ink-soft);
  background: transparent;
  font-size: 13.5px;
  transition: background-color 150ms var(--ds-ease-std), color 150ms var(--ds-ease-std);
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.05); color: var(--ds-heading); }
.icon-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.danger:hover { background: var(--ds-danger-soft); color: var(--ds-danger); }

/* 八、按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 20px;
  border-radius: var(--ds-r-pill);
  border: 1px solid transparent;
  background: var(--ds-brand-btn);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 150ms var(--ds-ease-std),
    border-color 150ms var(--ds-ease-std), color 150ms var(--ds-ease-std),
    box-shadow 150ms var(--ds-ease-std), transform 100ms var(--ds-ease-std);
}
.btn:hover { background: var(--ds-brand-btn-hover); }
.btn:active { transform: scale(0.985); }
.btn[disabled],
.btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.btn-primary { background: var(--ds-brand-btn); color: #fff; }
.btn-primary:hover { background: var(--ds-brand-btn-hover); }

.btn-warm { background: rgba(217, 119, 6, 0.12); border-color: rgba(217, 119, 6, 0.24); color: var(--ds-warning-ink); }
.btn-warm:hover { background: rgba(217, 119, 6, 0.18); }

.btn-danger { background: var(--ds-danger-soft); border-color: var(--ds-danger-border); color: var(--ds-danger-ink); }
.btn-danger:hover { background: rgba(225, 29, 72, 0.16); }

.btn-ghost { background: rgba(255, 255, 255, 0.55); border-color: var(--ds-border-subtle); color: var(--ds-ink-soft); backdrop-filter: blur(10px); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.8); color: var(--ds-heading); }

.btn-outline { background: rgba(255, 255, 255, 0.6); border-color: var(--ds-border); color: var(--ds-heading); }
.btn-outline:hover { background: rgba(255, 255, 255, 0.85); }

.btn-sm { height: 34px; padding: 0 14px; gap: 5px; font-size: 12.5px; }
.btn-sm svg { width: 15px; height: 15px; }

.btn-lg { height: 48px; padding: 0 28px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row .btn { flex: 1 1 auto; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 2px 2px;
  border-radius: var(--ds-r-sm);
  color: var(--ds-brand-ink);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: color 150ms var(--ds-ease-std);
}
.link-btn:hover { color: var(--ds-brand-deep); text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger { color: var(--ds-danger); }
.link-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* 九、表单 */
.field { margin-bottom: 16px; }
.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ds-heading);
}
.field-hint { margin-top: 6px; font-size: 12px; line-height: 1.55; color: var(--ds-muted); }

.input,
.textarea,
.select {
  display: block;
  width: 100%;
  height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-r-input);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ds-ink);
  font-size: 14px;
  transition: border-color 150ms var(--ds-ease-std), box-shadow 150ms var(--ds-ease-std),
    background-color 150ms var(--ds-ease-std);
}
.input::placeholder,
.textarea::placeholder { color: var(--ds-faint); }
.input:hover,
.textarea:hover,
.select:hover { background: rgba(255, 255, 255, 0.9); }
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--ds-brand);
  box-shadow: var(--ds-ring);
  background: #fff;
}
.textarea {
  min-height: 92px;
  height: auto;
  padding: 11px 14px;
  resize: vertical;
  line-height: 1.65;
}
.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  cursor: pointer;
}

.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 140px; margin-bottom: 0; }

.form-error {
  margin-top: 10px;
  padding: 0;
  color: var(--ds-danger-ink);
  font-size: 12.5px;
  line-height: 1.55;
  min-height: 0;
}
.form-error:empty { display: none; }

/* 深度选择（L1–L4） */
.depth-seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-r-pill);
  background: rgba(0, 0, 0, 0.04);
}
.depth-dot {
  min-width: 42px;
  height: 30px;
  padding: 0 9px;
  border-radius: var(--ds-r-pill);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ds-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  transition: background-color 150ms var(--ds-ease-std), color 150ms var(--ds-ease-std),
    box-shadow 150ms var(--ds-ease-std);
}
.depth-dot:hover { color: var(--ds-heading); background: rgba(255, 255, 255, 0.75); }
.depth-dot[aria-pressed="true"] { background: #fff; color: var(--ds-brand-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04); }
.depth-label { font-size: 12px; font-weight: 500; color: var(--ds-muted); white-space: nowrap; }

/* 十、通用卡片 / 面板 / 区块头 */
.card {
  background: #fff;
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-r-card);
  box-shadow: var(--ds-shadow-card);
  padding: 20px;
}

.section { margin-top: 28px; }

.sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.sec-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 17px;
  line-height: 24px;
  font-weight: 600;
  color: var(--ds-heading);
  letter-spacing: 0;
}
.sec-head .sec-sub { font-size: 12.5px; font-weight: 400; color: var(--ds-muted); font-variant-numeric: tabular-nums; }

.muted { color: var(--ds-muted); }
.faint { color: var(--ds-faint); }
.small { font-size: 12.5px; }

/* 统计条：信息密度核心组件 */
.summary-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.strip-cell {
  padding: 13px 16px;
  border-radius: var(--ds-r-panel);
  border: 1px solid var(--ds-border-subtle);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(10px);
  min-width: 0;
}
.strip-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ds-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.strip-label i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ds-brand);
  flex-shrink: 0;
}
.strip-value {
  display: block;
  margin-top: 3px;
  font-size: 22px;
  line-height: 30px;
  font-weight: 600;
  color: var(--ds-heading);
  font-variant-numeric: tabular-nums;
}
.strip-value svg { width: 16px; height: 16px; }
.strip-hint { display: block; margin-top: 1px; font-size: 11.5px; color: var(--ds-faint); }
.strip-cell.is-warm .strip-label i { background: var(--ds-warning); }
.strip-cell.is-warm .strip-value { color: var(--ds-warning); }
.strip-cell.is-ok .strip-label i { background: var(--ds-success); }
.strip-cell.is-soft .strip-label i { background: var(--ds-violet); }

/* 空状态 / 错误 */
.empty-state {
  padding: 44px 20px;
  text-align: center;
  color: var(--ds-muted);
  border: 1px dashed var(--ds-border-strong);
  border-radius: var(--ds-r-card);
  background: rgba(255, 255, 255, 0.55);
}
.empty-state .empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: var(--ds-r-panel);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--ds-border-subtle);
  font-size: 26px;
  line-height: 1;
}
.empty-state h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; color: var(--ds-heading); }
.empty-state p { margin: 0 auto 16px; max-width: 380px; font-size: 13px; line-height: 1.6; }
.empty-state .btn { margin: 0 auto; }

/* 十一、登录页 / 首页 Hero */
.home-hero { position: relative; padding: 26px 0 20px; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ds-muted);
  letter-spacing: 0.02em;
}
.hero-eyebrow i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ds-brand);
  box-shadow: 0 0 0 4px var(--ds-brand-soft);
}

.hero-title {
  margin: 12px 0 0;
  font-size: 34px;
  line-height: 1.18;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--ds-heading);
}
.hero-sub {
  margin: 10px 0 0;
  max-width: 640px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ds-ink-soft);
}
.hero-strip { margin-top: 22px; }

/* 十二、今日复习卡 / 快速开始 / 学科网格 */
.due-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border-radius: var(--ds-r-card);
  border: 1px solid var(--ds-warning-border);
  background: linear-gradient(120deg, rgba(254, 243, 199, 0.82) 0%, rgba(255, 255, 255, 0.55) 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset, 0 2px 12px rgba(217, 119, 6, 0.06);
  backdrop-filter: blur(12px);
  color: var(--ds-ink);
  text-align: left;
  text-decoration: none;
  transition: border-color 180ms var(--ds-ease-std), transform 180ms var(--ds-ease-out);
}
.due-card:hover { border-color: var(--ds-warning); transform: translateY(-1px); }
.due-card .due-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  border-radius: var(--ds-r-control);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--ds-warning-border);
}
.due-card .due-main { flex: 1; min-width: 0; display: block; }
.due-card .due-title { display: block; font-size: 14.5px; font-weight: 600; color: var(--ds-heading); }
.due-card .due-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--ds-muted); }
.due-card .due-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: var(--ds-r-pill);
  background: rgba(217, 119, 6, 0.12);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ds-warning-ink);
  white-space: nowrap;
}
.due-card.is-done { background: rgba(255, 255, 255, 0.62); border-color: var(--ds-border-subtle); box-shadow: var(--ds-shadow-card); }
.due-card.is-done .due-icon { background: var(--ds-success-soft); border-color: var(--ds-success-border); }
.due-card.is-done .due-cta { background: var(--ds-success-soft); color: var(--ds-success); }

.quick-form {
  position: relative;
  padding: 20px;
  border-radius: var(--ds-r-card);
  border: 1px solid var(--ds-border-glass);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: var(--ds-shadow-card);
  backdrop-filter: blur(12px) saturate(140%);
}
.quick-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.quick-head h2 {
  margin: 0;
  font-size: 17px;
  line-height: 24px;
  font-weight: 600;
  color: var(--ds-heading);
}
.quick-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--ds-muted); }

/* 学科网格 */
.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.disc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-r-panel);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: var(--ds-shadow-card);
  text-align: left;
  text-decoration: none;
  color: var(--ds-ink);
  overflow: hidden;
  transition: border-color 180ms var(--ds-ease-std), transform 180ms var(--ds-ease-out),
    box-shadow 180ms var(--ds-ease-std), background-color 180ms var(--ds-ease-std);
  backdrop-filter: blur(10px);
}
.disc-card:hover {
  text-decoration: none;
  border-color: var(--ds-border);
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px #f1f5f9, 0 6px 16px rgba(0, 0, 0, 0.07), 0 18px 32px rgba(0, 0, 0, 0.06);
}
.disc-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--disc-color, var(--ds-brand));
  opacity: 0.9;
}
.disc-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.disc-emoji {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ds-r-control);
  font-size: 21px;
  line-height: 1;
  background: var(--disc-tint, var(--ds-brand-soft));
  border: 1px solid var(--disc-border, rgba(77, 107, 254, 0.16));
}
.disc-name {
  margin-top: 2px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ds-heading);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.disc-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ds-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.disc-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 8px;
  font-size: 11.5px;
  color: var(--ds-faint);
}
.disc-stats b { font-weight: 600; color: var(--ds-ink-soft); font-variant-numeric: tabular-nums; }
.disc-stats .due {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: var(--ds-r-pill);
  background: var(--ds-warning-soft);
  color: var(--ds-warning-ink);
  font-weight: 600;
}
.disc-card.add {
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ds-muted);
  border-style: dashed;
  border-color: var(--ds-border-strong);
  background: rgba(255, 255, 255, 0.32);
  box-shadow: none;
  font-size: 13px;
  gap: 6px;
}
.disc-card.add::after { display: none; }
.disc-card.add:hover { color: var(--ds-brand-ink); border-color: var(--ds-brand); background: rgba(255, 255, 255, 0.6); transform: translateY(-1px); }
.disc-card.add .plus { font-size: 24px; line-height: 1; font-weight: 300; }

/* 十三、列表 / 学习会话行 */
.list { display: flex; flex-direction: column; gap: 8px; }

.session-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-r-control);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  transition: border-color 150ms var(--ds-ease-std), background-color 150ms var(--ds-ease-std),
    box-shadow 150ms var(--ds-ease-std);
}
.session-row:hover { background: #fff; border-color: var(--ds-border); box-shadow: 0 2px 10px rgba(21, 36, 67, 0.07); }
.session-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 12px;
  text-align: left;
  color: var(--ds-ink);
  background: transparent;
}
.session-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ds-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--ds-muted);
}
.session-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.session-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  padding-right: 5px;
}
.session-actions .icon-btn { min-width: 34px; min-height: 34px; color: var(--ds-faint); }
.session-actions .icon-btn svg { width: 16px; height: 16px; }
.session-actions .icon-btn:hover { color: var(--ds-heading); }
.session-actions .danger:hover { color: var(--ds-danger); background: var(--ds-danger-soft); }

.session-row > svg {
  width: 18px;
  height: 18px;
  margin: auto 14px;
  flex-shrink: 0;
  color: var(--ds-muted);
}

/* 学科页会话列表：桌面双列 */
.session-rows { display: flex; flex-direction: column; gap: 8px; }

/* 十四、徽标 / chip */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 9px;
  border: 1px solid transparent;
  border-radius: var(--ds-r-pill);
  background: var(--ds-bg-sunken);
  border-color: var(--ds-border-subtle);
  color: var(--ds-ink-soft);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.75;
  white-space: nowrap;
  max-width: 100%;
}
.badge svg { width: 13px; height: 13px; flex-shrink: 0; }
.badge-ephemeral { background: rgba(217, 119, 6, 0.10); border-color: var(--ds-warning-border); color: var(--ds-warning-ink); }
.badge-accent { background: var(--ds-brand-soft); border-color: rgba(77, 107, 254, 0.18); color: var(--ds-brand-ink); }
.badge-warm { background: var(--ds-warning-soft); border-color: var(--ds-warning-border); color: var(--ds-warning-ink); }
.badge-ok { background: var(--ds-success-soft); border-color: var(--ds-success-border); color: var(--ds-success-ink); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--ds-r-pill);
  background: var(--ds-brand-soft);
  border: 1px solid rgba(77, 107, 254, 0.14);
  color: var(--ds-brand-deep);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.7;
}

/* 十五、登录页 */
.login-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 40px 18px calc(32px + env(safe-area-inset-bottom, 0px));
}

.login-shell {
  width: 100%;
  max-width: 1020px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  align-items: center;
}

.login-hero { display: block; }

/* 移动端：只保留品牌行，介绍内容隐藏 */
@media (max-width: 899px) {
    .login-hero { display: flex; justify-content: center; margin-bottom: 14px; }
  .login-hero .login-display,
  .login-hero .login-sub,
  .login-hero .login-features { display: none; }
  .login-shell { gap: 18px; }
}
.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ds-heading);
}
.login-display {
  margin: 22px 0 0;
  font-size: 46px;
  line-height: 1.16;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ds-heading);
}
.login-sub {
  margin: 16px 0 0;
  max-width: 440px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ds-ink-soft);
}
.login-features {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-feature { display: flex; align-items: flex-start; gap: 12px; }
.login-feature .lf-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ds-r-control);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--ds-border-subtle);
  color: var(--ds-brand);
}
.login-feature .lf-icon svg { width: 17px; height: 17px; }
.login-feature b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ds-heading);
}
.login-feature span {
  display: block;
  margin-top: 1px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ds-muted);
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 28px 24px 24px;
  border-radius: var(--ds-r-card);
  border: 1px solid var(--ds-border-glass);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--ds-shadow-card);
  backdrop-filter: blur(16px) saturate(150%);
}
.login-card-head { margin-bottom: 22px; }
.login-card-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ds-heading);
}
.login-card-head p {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ds-muted);
}
.login-card .field { margin-bottom: 14px; }
.login-card .btn { height: 46px; font-size: 14.5px; }
.login-hint {
  margin: 14px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ds-faint);
  text-align: center;
}
.login-foot {
  margin: 24px 0 0;
  font-size: 11.5px;
  color: var(--ds-faint);
  text-align: center;
}

@media (min-width: 900px) {
    .login-shell { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 64px; }
  .login-card { margin: 0; max-width: none; padding: 36px 32px 30px; }
}

/* 十六、底部移动导航（玻璃悬浮胶囊） */
.bottom-nav {
  position: fixed;
  z-index: 40;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--ds-border-subtle);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.18), 0 10px 30px rgba(21, 36, 67, 0.12);
  backdrop-filter: blur(16px) saturate(150%);
  overflow: hidden;
}
.bottom-nav-inner {
  display: flex;
  align-items: stretch;
  height: 58px;
  padding: 6px;
  gap: 4px;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 16px;
  color: var(--ds-muted);
  font-size: 10.5px;
  font-weight: 500;
  text-decoration: none;
  min-height: 44px;
  transition: background-color 150ms var(--ds-ease-std), color 150ms var(--ds-ease-std);
}
.tab svg { width: 20px; height: 20px; }
.tab:hover { color: var(--ds-heading); }
.tab.active { color: var(--ds-brand-ink); background: var(--ds-brand-soft); font-weight: 600; }

/* 十七、学科页 */
.disc-hero {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px;
  border-radius: var(--ds-r-card);
  border: 1px solid var(--ds-border-glass);
  background: rgba(255, 255, 255, 0.56);
  box-shadow: var(--ds-shadow-card);
  backdrop-filter: blur(12px) saturate(140%);
}
.disc-hero-emoji {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 29px;
  border-radius: var(--ds-r-panel);
  border: 1px solid var(--ds-border-subtle);
}
.disc-hero-main { flex: 1; min-width: 0; }
.disc-hero-main h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ds-heading);
  word-break: break-word;
}
.disc-hero-desc {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ds-muted);
}
.disc-goal {
  margin-top: 14px;
  padding: 11px 14px;
  border-left: 3px solid var(--ds-warning);
  background: rgba(254, 243, 199, 0.6);
  border-radius: 0 var(--ds-r-input) var(--ds-r-input) 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ds-ink-soft);
}
.disc-stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.disc-stat {
  padding: 12px 14px;
  border-radius: var(--ds-r-panel);
  border: 1px solid var(--ds-border-subtle);
  background: rgba(255, 255, 255, 0.6);
}
.disc-stat b {
  display: block;
  font-size: 21px;
  line-height: 28px;
  font-weight: 600;
  color: var(--ds-heading);
  font-variant-numeric: tabular-nums;
}
.disc-stat span {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--ds-muted);
}
.disc-stat.warm b { color: var(--ds-warning); }

.new-session-card {
  margin-top: 14px;
  padding: 20px;
  border-radius: var(--ds-r-card);
  border: 1px solid var(--ds-border-glass);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: var(--ds-shadow-card);
  backdrop-filter: blur(12px) saturate(140%);
}
.new-session-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ds-heading);
}
.new-session-opts {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.new-session-opts .select {
  flex: 1 1 170px;
  width: auto;
  max-width: 420px;
  height: 40px;
  font-size: 13px;
  border-radius: var(--ds-r-pill);
}
.new-session-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* 十八、学习页 */
.session-inner { position: relative; z-index: 1; padding: 0 16px; }

.chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 2px 12px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 10px;
  min-height: 140px;
}

.msg { display: flex; flex-direction: column; }
.msg-user { align-items: flex-end; }
.msg-user .msg-bubble {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: 18px 18px 6px 18px;
  background: var(--ds-brand-soft);
  border: 1px solid rgba(77, 107, 254, 0.14);
  color: var(--ds-ink);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-assistant { align-items: stretch; scroll-margin-top: 148px; }
.msg-assistant .msg-bubble {
  min-width: 0;
  padding: 16px 18px;
  border-radius: 6px var(--ds-r-panel) var(--ds-r-panel) var(--ds-r-panel);
  border: 1px solid var(--ds-border-subtle);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--ds-shadow-card);
  backdrop-filter: blur(10px);
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  font-size: 11.5px;
  color: var(--ds-faint);
  flex-wrap: wrap;
}
.msg-avatar {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--ds-brand) 0%, #7c9cff 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(77, 107, 254, 0.28);
}
.msg-avatar svg { width: 14px; height: 14px; }
.msg-avatar span { font-size: 12px; line-height: 1; }
.msg-meta .who {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ds-ink-soft);
}
.msg-meta .who svg { width: 14px; height: 14px; flex-shrink: 0; }
.msg-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 2px 4px;
  font-size: 12.5px;
  color: var(--ds-brand-ink);
}
.msg-status .spinner { width: 13px; height: 13px; }

.msg-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 11px 13px;
  border: 1px solid var(--ds-danger-border);
  border-radius: var(--ds-r-input);
  background: var(--ds-danger-soft);
  color: #9f1239;
  font-size: 12.5px;
}
.msg-error .err-text { flex: 1 1 180px; line-height: 1.55; }
.msg-error .btn { min-height: 34px; height: 34px; }

@keyframes blink { 50% { opacity: 0; } }

.msg-note { margin-top: 8px; font-size: 11.5px; color: var(--ds-faint); }

/* explain 分层卡片 */
.explain { display: flex; flex-direction: column; gap: 12px; }
.layer {
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-r-panel);
  background: rgba(255, 255, 255, 0.62);
  overflow: hidden;
  transition: border-color 180ms var(--ds-ease-std), box-shadow 180ms var(--ds-ease-std);
}
.layer[data-open="true"] { border-color: rgba(77, 107, 254, 0.18); box-shadow: 0 2px 12px rgba(21, 36, 67, 0.05); }
.layer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  text-align: left;
  background: transparent;
  transition: background-color 150ms var(--ds-ease-std);
}
.layer-head:hover { background: rgba(0, 0, 0, 0.025); }
.layer-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--ds-r-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}
.layer-title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ds-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.layer-chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--ds-muted);
  transition: transform 180ms var(--ds-ease-std);
}
.layer[data-open="false"] .layer-chevron { transform: rotate(-90deg); }
.layer-body { padding: 4px 16px 16px; border-top: 1px solid var(--ds-border-subtle); }
.layer[data-open="false"] .layer-body { display: none; }
.layer-body .md > :first-child { margin-top: 10px; }
.layer-body .md > :last-child { margin-bottom: 0; }

/* 分层讲解步骤卡：一条 assistant 消息就是一层（或一条研究级延伸），卡即步骤 */
.msg-assistant.is-step .msg-bubble {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.msg-assistant.is-step .msg-meta { display: none; }
.layer-ext .layer-badge { background: var(--ds-warning-soft); color: var(--ds-warning); }

/* 插件沙箱 iframe */
.frame-wrap {
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-r-card);
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
  box-shadow: var(--ds-shadow-card);
}
.plugin-frame {
  display: block;
  width: 100%;
  min-height: 140px;
  height: 220px;
  background: transparent;
}

/* 十九、Markdown 正文 */
.md {
  font-size: 14px;
  line-height: 1.78;
  color: var(--ds-ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5 {
  margin: 1.3em 0 0.5em;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ds-heading);
}
.md h1 { font-size: 1.32em; }
.md h2 { font-size: 1.18em; }
.md h3 { font-size: 1.06em; }
.md h4 { font-size: 1em; }
.md p { margin: 0 0 0.8em; }
.md ul, .md ol { margin: 0 0 0.85em; padding-left: 1.35em; }
.md li { margin: 0.24em 0; }
.md li > ul, .md li > ol { margin: 0.2em 0; }
.md strong { font-weight: 600; color: var(--ds-heading); }
.md em { font-style: italic; }
.md blockquote {
  margin: 0.85em 0;
  padding: 8px 14px;
  border-left: 3px solid rgba(77, 107, 254, 0.35);
  background: var(--ds-brand-soft);
  color: var(--ds-ink-soft);
  border-radius: 0 var(--ds-r-input) var(--ds-r-input) 0;
}
.md blockquote > :last-child { margin-bottom: 0; }
.md code {
  font-family: var(--ds-font-mono);
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--ds-border-subtle);
  overflow-wrap: anywhere;
}
.md pre {
  margin: 0.85em 0;
  padding: 13px 15px;
  border-radius: var(--ds-r-control);
  background: rgba(21, 36, 67, 0.04);
  border: 1px solid var(--ds-border-subtle);
  overflow-x: auto;
  max-width: 100%;
  line-height: 1.55;
}
.md pre code { padding: 0; border: 0; background: transparent; white-space: pre; }
.md-tablewrap {
  overflow-x: auto;
  max-width: 100%;
  margin: 0.85em 0;
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-r-input);
}
.md table { border-collapse: collapse; width: 100%; font-size: 0.94em; }
.md th, .md td {
  padding: 8px 11px;
  border-bottom: 1px solid var(--ds-border-subtle);
  border-right: 1px solid var(--ds-border-subtle);
  text-align: left;
  vertical-align: top;
}
.md th { background: rgba(0, 0, 0, 0.025); font-weight: 600; white-space: nowrap; }
.md tr:last-child td { border-bottom: 0; }
.md th:last-child, .md td:last-child { border-right: 0; }
.md hr { border: 0; border-top: 1px solid var(--ds-border-subtle); margin: 1.3em 0; }
.md img { border-radius: var(--ds-r-input); max-height: 440px; height: auto; }
.md a { color: var(--ds-brand-deep); overflow-wrap: anywhere; }
.md a:hover { text-decoration: underline; }
.md .katex { font-size: 1.05em; }
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 6px 0; max-width: 100%; }

/* 二十、知识地图 */
.map { display: flex; flex-direction: column; gap: 14px; }
.map-head { position: relative; }
.map-head h3 {
  margin: 0 0 3px;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 600;
}
.map-head .map-summary {
  margin: 10px 0 0;
  padding: 11px 14px;
  background: var(--ds-brand-soft);
  border: 1px solid rgba(77, 107, 254, 0.14);
  border-radius: var(--ds-r-input);
  font-size: 13px;
  line-height: 1.65;
  color: var(--ds-ink-soft);
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11.5px;
  color: var(--ds-muted);
}
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
}

.map-svg { display: block; width: 100%; height: auto; }
.map-edge { stroke: rgba(21, 36, 67, 0.22); stroke-width: 1.4; transition: stroke 150ms var(--ds-ease-std), stroke-width 150ms var(--ds-ease-std); }
.map-edge.hot { stroke: var(--ds-brand); stroke-width: 2.2; }
.map-edge-label {
  font-size: 10px;
  fill: var(--ds-muted);
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: none;
  user-select: none;
  font-family: var(--ds-font);
}
.map-node { cursor: pointer; }
.map-node rect {
  fill: #fff;
  stroke: rgba(21, 36, 67, 0.16);
  stroke-width: 1.4;
  transition: stroke 150ms var(--ds-ease-std), filter 150ms var(--ds-ease-std);
}
.map-node text {
  font-size: 12.5px;
  fill: var(--ds-heading);
  font-weight: 600;
  font-family: var(--ds-font);
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
}
.map-node:hover rect, .map-node:focus-visible rect { filter: brightness(0.97); stroke: var(--ds-brand-medium); }

/* v18 三层地图带：上=跨学科，中=概念（先修 | 焦点 | 延伸），下=应用 */
.map-band-rect { fill: rgba(255, 255, 255, 0.55); stroke: rgba(21, 36, 67, 0.07); stroke-width: 1; }
.map-band.band-cross .map-band-rect { fill: rgba(167, 139, 250, 0.07); stroke: rgba(124, 58, 237, 0.12); }
.map-band.band-concept .map-band-rect { fill: rgba(77, 107, 254, 0.05); stroke: rgba(77, 107, 254, 0.12); }
.map-band.band-application .map-band-rect { fill: rgba(16, 185, 129, 0.06); stroke: rgba(4, 120, 87, 0.12); }
.map-band-label {
  font-family: var(--ds-font);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  fill: var(--ds-muted);
  pointer-events: none;
  user-select: none;
}
.map-band.band-cross .map-band-label { fill: #7c3aed; }
.map-band.band-concept .map-band-label { fill: var(--ds-brand-ink); }
.map-band.band-application .map-band-label { fill: #047857; }
.map-side-label {
  font-family: var(--ds-font);
  font-size: 11px;
  font-weight: 600;
  text-anchor: middle;
  fill: #b45309;
  pointer-events: none;
  user-select: none;
}
.map-side-label[data-side="right"] { fill: #7c3aed; }

/* 旧版（schema 1）地图已停用提示 */
.map-legacy-notice {
  padding: 14px 16px;
  border: 1px dashed rgba(190, 18, 60, 0.28);
  border-radius: var(--ds-r-input);
  background: rgba(190, 18, 60, 0.04);
}
.map-legacy-title { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--ds-heading); }
.map-legacy-hint { margin: 6px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ds-muted); }

/* 二十一、复盘卡片视图 */
.card-view { display: flex; flex-direction: column; gap: 13px; }
.card-view .cv-title {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
  font-weight: 600;
}
.card-one-liner {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--ds-r-input);
  background: var(--ds-brand-soft);
  border: 1px solid rgba(77, 107, 254, 0.16);
  color: var(--ds-brand-deep);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.65;
}
.card-core {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.card-core li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  line-height: 1.65;
}
.card-core li::before {
  content: "✓";
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--ds-brand);
  font-weight: 700;
  font-size: 12.5px;
}
.card-section { padding-top: 11px; border-top: 1px solid var(--ds-border-subtle); }
.card-section h4 {
  margin: 0 0 5px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ds-muted);
}
.card-section p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.68;
  color: var(--ds-ink-soft);
}
.card-section ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.68;
  color: var(--ds-ink-soft);
}
.card-section .md { font-size: 13.5px; }
.card-formula {
  padding: 12px;
  text-align: center;
  background: rgba(21, 36, 67, 0.035);
  border-radius: var(--ds-r-input);
  font-size: 14px;
  overflow-x: auto;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.review-note {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  padding: 3px 11px;
  border-radius: var(--ds-r-pill);
  background: var(--ds-success-soft);
  border: 1px solid var(--ds-success-border);
  color: var(--ds-success-ink);
  font-size: 11.5px;
  font-weight: 500;
}
.review-note svg { width: 14px; height: 14px; }

/* 二十二、底部输入区（学习页） */
.composer {
  position: fixed;
  z-index: 35;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 12px;
  background: linear-gradient(
    to top,
    rgba(249, 248, 248, 0.96) 30%,
    rgba(249, 248, 248, 0.82) 68%,
    rgba(249, 248, 248, 0) 100%
  );
  pointer-events: none;
}
.composer-inner {
  pointer-events: auto;
  max-width: var(--col-session);
  margin: 0 auto;
  padding: 10px 0 calc(12px + env(safe-area-inset-bottom, 0px));
}
.composer-actions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 2px 9px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.composer-actions::-webkit-scrollbar { display: none; }
.action-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--ds-r-pill);
  border: 1px solid var(--ds-border-subtle);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ds-ink-soft);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 150ms var(--ds-ease-std), background-color 150ms var(--ds-ease-std),
    color 150ms var(--ds-ease-std);
}
.action-btn:hover { border-color: rgba(77, 107, 254, 0.3); color: var(--ds-brand-ink); background: rgba(255, 255, 255, 0.95); }
.action-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 8px 8px 8px 16px;
  border-radius: 26px;
  border: 1px solid var(--ds-border-glass);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--ds-shadow-float);
  backdrop-filter: blur(16px) saturate(150%);
}
.composer textarea {
  flex: 1;
  min-height: 42px;
  max-height: 148px;
  padding: 10px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
}
.composer textarea:focus { outline: none; box-shadow: none; }
.send-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ds-brand-btn);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(77, 107, 254, 0.32);
  transition: background-color 150ms var(--ds-ease-std), transform 120ms var(--ds-ease-std);
}
.send-btn:hover { background: var(--ds-brand-btn-hover); }
.send-btn:active { transform: scale(0.94); }
.send-btn[disabled] { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.send-btn svg { width: 19px; height: 19px; }
.send-btn.stop { background: var(--ds-ink); box-shadow: 0 4px 14px rgba(30, 35, 44, 0.28); }
.send-btn.stop:hover { background: #000; }

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 6px 0;
  font-size: 10.5px;
  color: var(--ds-faint);
}
.composer-foot .composer-mode { display: inline-flex; align-items: center; gap: 5px; }
.composer-foot .composer-mode i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ds-success);
  box-shadow: 0 0 0 3px var(--ds-success-soft);
}
body:not(.has-composer) .composer { display: none; }

/* 二十三、复习页 */
.review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.review-head h1 {
  margin: 4px 0 0;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--ds-heading);
}
.review-progress {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  white-space: nowrap;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--ds-r-pill);
  border: 1px solid var(--ds-border-subtle);
  background: rgba(255, 255, 255, 0.62);
  font-size: 12.5px;
  color: var(--ds-muted);
  font-variant-numeric: tabular-nums;
}
.review-progress b { font-size: 15px; font-weight: 600; color: var(--ds-heading); }
.review-progress:empty { display: none; }
.review-bar {
  margin-top: 12px;
  height: 6px;
  border-radius: var(--ds-r-pill);
  background: rgba(77, 107, 254, 0.12);
  overflow: hidden;
}
.review-bar > i {
  display: block;
  height: 100%;
  border-radius: var(--ds-r-pill);
  background: linear-gradient(90deg, var(--ds-brand) 0%, #7c9cff 100%);
  transition: width 300ms var(--ds-ease-std);
}
.review-stats { margin-top: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.review-body { margin-top: 18px; }

.flashcard {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  margin-top: 0;
  padding: 26px 24px;
  border-radius: var(--ds-r-card);
  border: 1px solid var(--ds-border-glass);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--ds-shadow-card);
  backdrop-filter: blur(14px) saturate(140%);
}
.flashcard .card { padding: 0; border: 0; box-shadow: none; background: transparent; }
.fc-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.fc-title {
  margin: 0 0 8px;
  font-size: 23px;
  line-height: 1.32;
  font-weight: 600;
  letter-spacing: -0.01em;
  word-break: break-word;
}
.fc-one-liner {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ds-ink-soft);
}
.fc-flip-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 20px;
}
.fc-flip-hint .hint-text { font-size: 12px; color: var(--ds-faint); }
.fc-back { display: flex; flex-direction: column; gap: 13px; margin-top: 4px; }
.fc-hotkey {
  margin-top: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--ds-faint);
  letter-spacing: 0.02em;
}
.grade-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin-top: 18px;
}
.grade-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 58px;
  padding: 9px 4px;
  border-radius: var(--ds-r-control);
  border: 1px solid var(--ds-border);
  background: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
  color: var(--ds-ink-soft);
  transition: border-color 150ms var(--ds-ease-std), background-color 150ms var(--ds-ease-std),
    transform 120ms var(--ds-ease-std);
}
.grade-btn .g-hint { font-size: 10px; font-weight: 400; color: var(--ds-faint); }
.grade-btn:hover { transform: translateY(-1px); background: #fff; }
.grade-btn.again { color: var(--ds-danger-ink); border-color: var(--ds-danger-border); background: var(--ds-danger-soft); }
.grade-btn.hard { color: var(--ds-warning-ink); border-color: var(--ds-warning-border); background: var(--ds-warning-soft); }
.grade-btn.good { color: var(--ds-brand-ink); border-color: rgba(77, 107, 254, 0.24); background: var(--ds-brand-soft); }
.grade-btn.easy { color: var(--ds-success-ink); border-color: var(--ds-success-border); background: var(--ds-success-soft); }
.grade-btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* 二十四、插件页 */
.plugin-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.plugin-row {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-r-panel);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 150ms var(--ds-ease-std), background-color 150ms var(--ds-ease-std),
    box-shadow 150ms var(--ds-ease-std);
  backdrop-filter: blur(10px);
}
.plugin-row:hover { background: #fff; border-color: var(--ds-border); box-shadow: 0 2px 12px rgba(21, 36, 67, 0.07); }
.plugin-row.is-off { opacity: 0.62; }
.plugin-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ds-r-control);
  font-size: 21px;
  background: var(--ds-brand-soft);
  border: 1px solid rgba(77, 107, 254, 0.12);
}
.plugin-info { flex: 1; min-width: 0; }
.plugin-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.plugin-name { font-size: 14px; font-weight: 600; color: var(--ds-heading); }
.plugin-desc {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ds-muted);
  overflow-wrap: anywhere;
}
.plugin-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.plugin-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.plugin-side .link-btn { min-height: 26px; padding: 0 2px; font-size: 12px; }

/* 开关 */
.toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  border-radius: var(--ds-r-pill);
  background: var(--ds-border-strong);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: background-color 180ms var(--ds-ease-std);
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 180ms var(--ds-ease-std);
}
.toggle[aria-checked="true"] { background: var(--ds-brand-btn); }
.toggle[aria-checked="true"]::after { transform: translateX(18px); }
.toggle[disabled] { opacity: 0.5; cursor: not-allowed; }

.generate-box {
  margin-top: 18px;
  padding: 22px;
  border-radius: var(--ds-r-card);
  border: 1px solid var(--ds-border-glass);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--ds-shadow-card);
  backdrop-filter: blur(12px) saturate(140%);
}
.generate-box textarea { min-height: 92px; }
.generate-box .new-session-opts { margin-top: 10px; }
.generate-box .new-session-actions { margin-top: 12px; }
.generate-preview {
  margin-top: 14px;
  padding: 15px 16px;
  border: 1px solid var(--ds-success-border);
  border-radius: var(--ds-r-panel);
  background: rgba(5, 150, 105, 0.05);
}
.generate-preview h4 { margin: 0 0 5px; font-size: 14px; }
.generate-preview p { margin: 0 0 7px; font-size: 12.5px; line-height: 1.55; color: var(--ds-ink-soft); }
.generate-preview .excerpt {
  max-height: 132px;
  overflow: auto;
  padding: 9px 11px;
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-r-input);
  background: rgba(255, 255, 255, 0.7);
  font-family: var(--ds-font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--ds-muted);
  white-space: pre-wrap;
}
.gen-status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 28px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--ds-brand-ink);
}
.gen-status.error { color: var(--ds-danger-ink); }
.gen-status .spinner { width: 14px; height: 14px; }

/* 二十五、弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(21, 36, 67, 0.32);
  backdrop-filter: blur(8px);
  animation: fade-in 0.18s var(--ds-ease-std);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: 100%;
  max-width: 500px;
  max-height: min(88vh, 760px);
  max-height: min(88svh, 760px);
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--ds-border-glass);
  border-radius: var(--ds-r-card) var(--ds-r-card) 0 0;
  box-shadow: var(--ds-shadow-e2);
  backdrop-filter: blur(20px) saturate(150%);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: sheet-up 0.26s var(--ds-ease-out);
}
@keyframes sheet-up {
  from { transform: translateY(36px); opacity: 0.5; }
  to { transform: none; opacity: 1; }
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 10px;
}
.modal-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--ds-heading);
}
.modal-close {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--ds-muted);
  transition: background-color 150ms var(--ds-ease-std), color 150ms var(--ds-ease-std);
}
.modal-close:hover { background: rgba(0, 0, 0, 0.05); color: var(--ds-heading); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 4px 20px 18px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot {
  display: flex;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--ds-border-subtle);
}
.modal-foot .btn { flex: 1; }
.modal-message { margin: 0; font-size: 13.5px; line-height: 1.7; color: var(--ds-ink-soft); }
.color-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--ds-border);
  transition: transform 120ms var(--ds-ease-std);
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ds-heading); }
.map-node-modal .modal-body { padding-bottom: 22px; }

@media (min-width: 768px) {
  .modal-overlay { align-items: center; padding: 24px; }
    .modal-card { border-radius: var(--ds-r-card); animation: modal-pop 0.22s var(--ds-ease-out); }
  @keyframes modal-pop {
    from { transform: translateY(12px) scale(0.97); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
}

/* 二十六、Toast */
.toast-host {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 440px);
  transform: translateX(-50%);
  pointer-events: none;
}
body.has-composer .toast-host { bottom: calc(var(--composer-space, 190px) + 10px); }
.toast {
  max-width: 100%;
  padding: 9px 18px;
  border-radius: var(--ds-r-pill);
  background: rgba(21, 36, 67, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 28px rgba(21, 36, 67, 0.24);
  backdrop-filter: blur(14px) saturate(150%);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
  word-break: break-word;
  animation: toast-in 0.22s var(--ds-ease-out);
}
.toast.ok { background: rgba(5, 150, 105, 0.92); }
.toast.error { background: rgba(190, 18, 60, 0.92); }
.toast.warm { background: rgba(180, 83, 9, 0.92); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* 二十七、杂项 / 工具类 */
.msg-meta .who { display: inline-flex; align-items: center; gap: 4px; }
.assistant-content > .explain > .md,
.assistant-content > .md,
.msg-content > .md { min-width: 0; }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--ds-bg-page);
  text-align: center;
}

.flashcard.card { padding: 26px 24px; }
.review-body { margin-top: 10px; }

.gen-status.error::before { content: "⚠"; }

/* 会话行左侧图标块 */
.session-ico {
  width: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 10px 10px;
  border-radius: var(--ds-r-control);
  background: var(--ds-brand-soft);
  border: 1px solid rgba(77, 107, 254, 0.10);
  font-size: 16px;
  line-height: 1;
}
.session-row:hover .session-ico { background: rgba(77, 107, 254, 0.14); }

.home-tagline {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ds-muted);
}

.mt-14 { margin-top: 14px; }
.hidden { display: none !important; }

body.modal-open { overflow: hidden; }

/* 二十八、断点：平板 / 桌面 */
@media (min-width: 640px) {
  .summary-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .home-hero { padding: 40px 0 26px; }
  .hero-title { font-size: 42px; }
  .hero-sub { font-size: 15px; }
  .quick-form { padding: 24px; }
  .page { padding-left: 24px; padding-right: 24px; }
}

@media (min-width: 900px) {
  .page { padding: 26px 28px 110px; }
  .page.page-session { padding: 20px 32px 110px; }
  .hero-title { font-size: 46px; }
  .hero-strip { margin-top: 26px; }
  .disc-grid { grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 14px; }
  .session-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plugin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .disc-hero { padding: 26px; }
  .disc-hero-main h1 { font-size: 30px; }
  .review-head h1 { font-size: 38px; }
  .fc-title { font-size: 25px; }
  .msg-user .msg-bubble { max-width: 76%; }
  .topbar-title { font-size: 16px; }
  .msg-assistant { scroll-margin-top: 112px; }
  .composer-inner { padding: 12px 0 calc(14px + env(safe-area-inset-bottom, 0px)); }
  .toast-host { bottom: 32px; }
}

@media (min-width: 960px) {
}

@media (min-width: 1200px) {
  .page { padding-left: 32px; padding-right: 32px; }
  .page.page-session { padding-left: 32px; padding-right: 32px; }
}

/* 二十九、小屏 / 无障碍 / 降级 */
@media (max-width: 359px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .disc-grid { grid-template-columns: 1fr; }
  .grade-row { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 28px; }
}

@media (max-width: 640px) {
  .ds-blob { filter: blur(44px); }
  .ds-wash { height: 340px; }
  .fc-flip-hint { flex-direction: column; align-items: stretch; }
  .fc-flip-hint .btn { width: 100%; }
  .disc-hero { flex-direction: column; gap: 12px; }
  .disc-hero-main h1 { font-size: 23px; }
  .review-head h1 { font-size: 28px; }
  .msg-user .msg-bubble { max-width: 88%; }
  /* 快捷动作增至 5 个：小屏改为换行展示，避免横向滚动把新动作藏起来 */
  .composer-actions { flex-wrap: wrap; overflow-x: visible; row-gap: 6px; }
  .topbar-tools { gap: 6px; padding-top: 5px; }
  .topbar-tools .depth-dot { min-width: 36px; height: 28px; padding: 0 7px; font-size: 12px; }
  .topbar-tools .link-btn { font-size: 11.5px; }
  .bottom-nav { left: 10px; right: 10px; }
  .login-card { padding: 24px 20px 20px; }
  .login-card-head h2 { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .ds-blob { animation: none !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .glass-panel,
  .login-card,
  .flashcard,
  .quick-form,
  .new-session-card,
  .generate-box,
  .msg-assistant .msg-bubble,
  .composer-input-row,
  .app-nav-inner,
  .bottom-nav,
  .topbar,
  .modal-card {
    background: #fff;
    backdrop-filter: none;
  }
  .ds-grid { display: none; }
}

/* 高对比度偏好下强化边框 */
@media (prefers-contrast: more) {
  :root {
    --ds-border-subtle: rgba(0, 0, 0, 0.16);
    --ds-border: rgba(0, 0, 0, 0.28);
    --ds-muted: #4b5563;
    --ds-faint: #6b7280;
  }
}

@media (prefers-reduced-data: reduce) {
  .ds-blob { display: none; }
  .ds-wash { opacity: 0.6; }
}

/* 二十二、学习地图 v2（路线优先 + 焦点网络） */

.map-page { max-width: 1180px; }
.map-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 12px;
  flex-wrap: wrap;
}
.map-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.map-page-actions { display: flex; gap: 8px; }
.map-page-actions .btn-sm { min-height: 38px; }

.map-recommend {
  position: relative;
  overflow: hidden;
  padding: 20px 22px;
  border-radius: 20px;
  border: 1px solid rgba(77, 107, 254, 0.16);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(77, 107, 254, 0.14), transparent 60%),
    rgba(255, 255, 255, 0.74);
  box-shadow: var(--ds-shadow-card);
  margin-bottom: 14px;
}
.map-recommend.is-due {
  border-color: rgba(245, 158, 11, 0.28);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(245, 158, 11, 0.16), transparent 60%),
    rgba(255, 255, 255, 0.78);
}
.map-recommend.is-expand {
  border-color: rgba(167, 139, 250, 0.3);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(167, 139, 250, 0.16), transparent 60%),
    rgba(255, 255, 255, 0.78);
}
.map-recommend-eyebrow {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--ds-brand-ink);
  text-transform: uppercase;
}
.map-recommend-label {
  margin: 6px 0 4px;
  font-size: 24px;
  line-height: 1.25;
  color: var(--ds-heading);
  font-weight: 650;
}
.map-recommend-why {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ds-muted);
}
.map-recommend-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.map-view-toggle {
  display: none;
  gap: 4px;
  padding: 4px;
  border-radius: 100px;
  background: rgba(21, 36, 67, 0.06);
  margin-bottom: 12px;
  width: max-content;
}
.map-view-btn {
  border: 0;
  background: transparent;
  border-radius: 100px;
  min-height: 36px;
  padding: 0 16px;
  font-size: 13px;
  color: var(--ds-muted);
  cursor: pointer;
}
.map-view-btn[aria-pressed="true"] { background: #fff; color: var(--ds-heading); box-shadow: 0 2px 8px rgba(21, 36, 67, 0.1); }

.map-columns {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.map-route-panel,
.map-network-panel {
  border: 1px solid var(--ds-border-subtle);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--ds-shadow-card);
  padding: 16px;
  min-width: 0;
}
.map-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.map-panel-head h2 { margin: 0; font-size: 16px; color: var(--ds-heading); }
.map-panel-sub { font-size: 11.5px; color: var(--ds-faint); }

.map-route-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.map-step {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 10px 10px 10px 6px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.5);
}
.map-step.is-focus { border-color: rgba(77, 107, 254, 0.22); background: var(--ds-brand-soft); }
.map-step-rail { display: flex; flex-direction: column; align-items: center; padding-top: 5px; }
.map-step-dot {
  width: 9px;
  height: 9px;
  border-radius: 100px;
  background: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.15);
}
.map-step.status-learning .map-step-dot { background: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16); }
.map-step.status-learned .map-step-dot { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16); }
.map-step.status-consolidated .map-step-dot { background: #047857; box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.16); }
.map-step.status-due .map-step-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.map-step-main { min-width: 0; }
.map-step-head { display: flex; gap: 6px; align-items: center; margin-bottom: 2px; }
.map-role { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; color: var(--ds-brand-ink); }
.map-step-title {
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  font-size: 14px;
  font-weight: 650;
  color: var(--ds-heading);
  cursor: pointer;
  line-height: 1.4;
}
.map-step-title:hover { color: var(--ds-brand-ink); text-decoration: underline; }
.map-step-note { margin: 2px 0 0; font-size: 11.5px; color: var(--ds-muted); line-height: 1.5; }
.map-step-why { margin: 3px 0 0; font-size: 11.5px; color: var(--ds-faint); line-height: 1.5; }
.map-step-action { min-height: 32px; padding: 0 10px; font-size: 12px; white-space: nowrap; }

.map-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.14);
  color: #475569;
}
.map-status-badge.status-learning { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.map-status-badge.status-learned { background: rgba(16, 185, 129, 0.12); color: #047857; }
.map-status-badge.status-consolidated { background: rgba(4, 120, 87, 0.14); color: #065f46; }
.map-status-badge.status-due { background: rgba(245, 158, 11, 0.16); color: #b45309; }

.map-done { margin-top: 14px; border-top: 1px dashed var(--ds-border-subtle); padding-top: 10px; }
.map-done summary { cursor: pointer; font-size: 12px; color: var(--ds-muted); }
.map-done-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.map-done-chip { border: 0; cursor: pointer; }

.map-network { display: flex; flex-direction: column; gap: 8px; }
.map-network-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 14px;
  border: 1px solid var(--ds-border-subtle);
  background:
    linear-gradient(rgba(21, 36, 67, 0.045) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, rgba(21, 36, 67, 0.045) 1px, transparent 1px) 0 0 / 56px 56px,
    #fff;
  -webkit-overflow-scrolling: touch;
}
.map-network-scroll .map-svg { display: block; min-width: 760px; width: 100%; height: auto; }
.map-network-hint { margin: 0; }
.map-network .map-legend-v2 { margin-bottom: 0; }
.map-legend .lg-concept { background: #818cf8; }
.map-legend .lg-application { background: #10b981; }
.map-legend .lg-cross { background: #a78bfa; }

.map-network-svg .map-edge { stroke: #b8b2a7; stroke-width: 1.3; opacity: 0.5; }
.map-network-svg .map-edge.is-hot { stroke: var(--ds-brand); stroke-width: 2; opacity: 0.9; }
.map-network-svg .map-edge.is-contrast { stroke-dasharray: 5 4; }
.map-network-svg .map-edge.hot { stroke: var(--ds-brand); stroke-width: 2.4; opacity: 1; }
.map-network-svg .map-edge-label { fill: var(--ds-muted); font-size: 10px; }
.map-network-svg .map-node rect { stroke-width: 1.2; }
.map-network-svg .map-node.kind-concept rect { fill: #eef2ff; stroke: #c7d2fe; }
.map-network-svg .map-node.kind-application rect { fill: #ecfdf5; stroke: #a7f3d0; }
.map-network-svg .map-node.kind-cross rect { fill: #f5f3ff; stroke: #ddd6fe; }
.map-network-svg .map-node text { fill: var(--ds-heading); font-size: 12px; font-weight: 550; }
.map-network-svg .map-node.is-focus rect { stroke: var(--ds-brand); stroke-width: 2.2; }
.map-network-svg .map-node.is-route:not(.is-focus) rect { stroke: rgba(77, 107, 254, 0.45); }
.map-network-svg .map-node.is-new rect { stroke: var(--ds-brand); stroke-width: 2.4; animation: mapPulse 1.6s ease-out 2; }
.map-network-svg .map-node:hover rect,
.map-network-svg .map-node:focus-visible rect { filter: brightness(0.97); stroke: var(--ds-brand-medium); }
.map-node-status.status-learning { fill: #3b82f6; }
.map-node-status.status-learned { fill: #10b981; }
.map-node-status.status-consolidated { fill: #047857; }
.map-node-status.status-due { fill: #f59e0b; }
.map-node-status.status-new { fill: #94a3b8; }

@keyframes mapPulse {
  0% { opacity: 0.35; }
  50% { opacity: 1; }
  100% { opacity: 1; }
}

.map-sheet { display: flex; flex-direction: column; gap: 12px; }
.map-sheet-note { margin: 0; font-size: 14px; line-height: 1.65; color: var(--ds-heading); }
.map-sheet-relations { display: flex; flex-direction: column; gap: 6px; }
.map-sheet-rel { display: flex; gap: 10px; font-size: 12.5px; line-height: 1.5; }
.map-sheet-rel-label { flex: 0 0 70px; color: var(--ds-faint); }
.map-sheet-stats { display: flex; gap: 14px; font-size: 12px; color: var(--ds-muted); }
.map-sheet-stats b { color: var(--ds-heading); }
.map-sheet-stats .is-due { color: #b45309; }

.map-expand-menu, .map-more-menu { display: flex; flex-direction: column; gap: 8px; }
.map-expand-option, .map-more-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--ds-border-subtle);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}
.map-expand-option:hover, .map-more-option:hover { border-color: var(--ds-brand-medium); background: var(--ds-brand-soft); }
.map-expand-option b, .map-more-option b { font-size: 13.5px; color: var(--ds-heading); }
.map-expand-option span, .map-more-option span { font-size: 12px; color: var(--ds-muted); line-height: 1.45; }
.map-hidden-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--ds-border-subtle);
  font-size: 13px;
}

.map-busy {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 100px;
  background: rgba(21, 36, 67, 0.92);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(21, 36, 67, 0.24);
}
.map-busy .spinner { border-color: rgba(255,255,255,.3); border-top-color: #fff; }

.map-empty {
  margin: 26px auto;
  max-width: 560px;
  text-align: center;
  padding: 30px 22px;
  border: 1px solid var(--ds-border-subtle);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--ds-shadow-card);
}
.map-empty-icon { font-size: 42px; margin-bottom: 6px; }
.map-empty h2 { margin: 0 0 8px; color: var(--ds-heading); }
.map-empty p { color: var(--ds-muted); font-size: 13.5px; line-height: 1.6; }
.map-empty-form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.map-empty-form .input { text-align: center; }

.map-entry-card {
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(77, 107, 254, 0.16);
  border-radius: 18px;
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(77, 107, 254, 0.1), transparent 60%),
    rgba(255, 255, 255, 0.72);
  box-shadow: var(--ds-shadow-card);
}
.map-entry-head { display: flex; gap: 12px; align-items: flex-start; }
.map-entry-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ds-brand-soft);
  color: var(--ds-brand-ink);
}
.map-entry-icon svg { width: 20px; height: 20px; }
.map-entry-titles { min-width: 0; }
.map-entry-titles h3 { margin: 0 0 2px; font-size: 15px; color: var(--ds-heading); }
.map-entry-titles p { margin: 0; font-size: 12.5px; color: var(--ds-muted); line-height: 1.5; }
.map-entry-rec {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(77, 107, 254, 0.06);
  font-size: 12px;
  color: var(--ds-muted);
}
.map-entry-rec b { color: var(--ds-heading); font-size: 13px; }
.map-entry-rec em { font-style: normal; color: var(--ds-faint); }
.map-entry-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .map-columns { display: block; }
  .map-view-toggle { display: flex; }
  .map-page[data-view="route"] .map-network-panel { display: none; }
  .map-page[data-view="network"] .map-route-panel { display: none; }
  .map-page-head { margin-top: 12px; }
  .map-recommend { padding: 16px; }
  .map-recommend-label { font-size: 21px; }
  .map-network-scroll .map-svg { min-width: 760px; width: 760px; }
  .map-step { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .map-step-action { min-height: 30px; font-size: 11.5px; }
  .map-page-actions .btn-sm { min-height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .map-network-svg .map-node.is-new rect { animation: none; }
}

/* 地图节点弹层：按钮多时换行，避免移动端横向溢出 */
.map-node-modal .modal-foot { flex-wrap: wrap; gap: 6px; }
.map-node-modal .modal-foot .btn { flex: 1 1 30%; min-height: 38px; }
@media (max-width: 640px) {
  .map-node-modal .modal-foot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-node-modal .modal-foot .btn { width: 100%; }
}

/* 会话内嵌 v2 地图预览：限制高度，避免被底部输入区遮挡 */
.map-v2-preview .map-network-scroll { max-height: 420px; overflow: auto; }
.map-v2-preview .map-network-scroll .map-svg { min-width: 760px; }
.map-v2-preview .map-preview-actions { margin-top: 4px; }
@media (max-width: 900px) {
  .map-v2-preview .map-network-scroll { max-height: 340px; }
}

/* P1 四模式协同：来源徽标 / 交接提示条 / 模式菜单 / 节点档案 / 未入图面板 */
.badge-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--ds-brand-soft);
  color: var(--ds-brand-ink);
}
.badge-close {
  border: 0;
  background: transparent;
  padding: 0;
  width: 16px;
  height: 16px;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.badge-close:hover { background: rgba(0, 0, 0, 0.06); }
.badge-close svg { width: 11px; height: 11px; }

.handoff-host { max-width: var(--col-session); margin: 0 auto; padding: 0 16px; }
.handoff-host:empty { display: none; }
.handoff {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 12px 0 0;
  padding: 12px 44px 12px 16px;
  border-radius: var(--ds-r-panel);
  background: linear-gradient(120deg, rgba(77, 107, 254, 0.09), rgba(255, 255, 255, 0.78));
  border: 1px solid var(--ds-brand-soft-2);
  box-shadow: var(--ds-shadow-card);
}
.handoff-text {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--ds-muted);
}
.handoff-text b { color: var(--ds-heading); font-size: 13.5px; }
.handoff-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.handoff-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ds-faint);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.handoff-close:hover { background: rgba(0, 0, 0, 0.05); color: var(--ds-ink); }
.handoff-close svg { width: 14px; height: 14px; }
@media (max-width: 640px) {
  .handoff { padding: 12px 40px 12px 12px; }
  .handoff-actions { width: 100%; }
  .handoff-actions .btn { flex: 1 1 40%; }
}

.mode-menu { display: flex; flex-direction: column; gap: 8px; }
.mode-menu-hint { margin: 0 0 4px; font-size: 12.5px; color: var(--ds-muted); }
.mode-menu-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--ds-border-subtle);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font: inherit;
  color: var(--ds-ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.mode-menu-item:hover { background: var(--ds-brand-soft); border-color: var(--ds-brand-soft-2); }
.mode-menu-item b { font-size: 13.5px; color: var(--ds-heading); }
.mode-menu-item span { font-size: 12px; color: var(--ds-muted); }

.map-sheet-modes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.map-sheet-modes span {
  font-size: 12px;
  color: var(--ds-muted);
  background: var(--ds-bg-sunken);
  border-radius: 100px;
  padding: 4px 10px;
}
.map-sheet-modes b { color: var(--ds-heading); }

.map-unmapped { margin-top: 16px; padding: 16px 18px; }
.map-unmapped-head h2 { margin: 0 0 4px; font-size: 16px; color: var(--ds-heading); }
.map-unmapped-sub { margin: 0; font-size: 12.5px; color: var(--ds-muted); }
.map-unmapped-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.map-unmapped-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--ds-border-subtle);
}
.map-unmapped-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.map-unmapped-concept { font-weight: 600; color: var(--ds-heading); font-size: 13.5px; }
.map-unmapped-info .chips-row { margin: 0; }
.map-unmapped-item .btn { flex: none; }
@media (max-width: 640px) {
  .map-unmapped-item { flex-direction: column; align-items: stretch; }
  .map-unmapped-item .btn { width: 100%; }
}

.attach-hint { margin: 0; font-size: 12.5px; color: var(--ds-muted); }
.attach-modal .field { margin-top: 12px; }

.review-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .review-head-actions { width: 100%; justify-content: space-between; }
}

/* 节点档案「最近记录」 */
.map-sheet-recent { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--ds-border-subtle); }
.map-sheet-recent-title { font-size: 12px; color: var(--ds-faint); margin-bottom: 6px; }
.map-sheet-recent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12.5px;
}
.map-sheet-recent-label { flex: none; color: var(--ds-heading); font-weight: 600; min-width: 32px; }
.map-sheet-recent-meta {
  flex: 1;
  min-width: 0;
  color: var(--ds-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-sheet-recent-row .btn { flex: none; }

/* v17 诊断优先（docs/06）：入口建议卡 / 诊断地图 / 诊断面板 / 补先修 / 手动开始 */

.home-v17 .intake-hero { margin-bottom: 6px; }
.intake { margin: 0 0 8px; }
.intake-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 14px;
  border: 1px solid var(--ds-border-subtle);
  border-radius: 20px;
  background: var(--ds-surface, #fff);
  box-shadow: 0 12px 40px rgba(15, 118, 110, 0.06);
}
.intake-label { font-size: 13px; font-weight: 600; color: var(--ds-heading); }
.intake-input-row { display: flex; gap: 10px; align-items: stretch; }
.intake-input {
  flex: 1;
  min-width: 0;
  min-height: 68px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--ds-border, #d9d4c8);
  border-radius: 14px;
  background: var(--ds-bg, #fbfaf6);
  color: var(--ds-text);
  font: inherit;
  font-size: 15.5px;
  line-height: 1.55;
}
.intake-input:focus { outline: 2px solid rgba(15, 118, 110, 0.28); outline-offset: 1px; }
.intake-submit { align-self: flex-end; white-space: nowrap; }
.intake-examples { display: flex; flex-wrap: wrap; gap: 8px; }
.intake-hint { margin: 0; font-size: 12.5px; color: var(--ds-faint); }
.suggest-host:empty { display: none; }
.suggest-card {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.05), transparent 45%), var(--ds-surface, #fff);
}
.suggest-head h2 { margin: 6px 0 4px; font-size: 18px; color: var(--ds-heading); }
.suggest-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: #0f766e;
  font-size: 11.5px;
  font-weight: 600;
}
.suggest-reason { margin: 0 0 8px; color: var(--ds-muted); font-size: 13px; line-height: 1.6; }
.suggest-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.suggest-field { min-width: 0; }
.suggest-field .input, .suggest-field .select { width: 100%; }
.suggest-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.home-disciplines { margin-top: 22px; }

.diag-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 8px;
}
.diag-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.diag-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ds-muted);
  background: rgba(120, 113, 96, 0.08);
}
.diag-stat b { color: var(--ds-heading); font-size: 13px; }
.diag-stat.is-passed { background: rgba(22, 163, 74, 0.1); color: #15803d; }
.diag-stat.is-failed { background: rgba(190, 18, 60, 0.09); color: #be123c; }
.diag-stat.is-in_progress { background: rgba(180, 83, 9, 0.1); color: #b45309; }

.diag-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 8px 12px;
  margin: 0 0 10px;
  border: 1px solid var(--ds-border-subtle);
  border-radius: 12px;
  background: var(--ds-surface, #fff);
  font-size: 12px;
  color: var(--ds-muted);
}
.diag-legend span { display: inline-flex; align-items: center; gap: 5px; }
.diag-dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #a8a29e; background: #fff; }
.diag-dot.is-untested { border-style: dashed; }
.diag-dot.is-in_progress { border-color: #b45309; background: #fef3c7; }
.diag-dot.is-passed { border-color: #16a34a; background: #dcfce7; }
.diag-dot.is-failed { border-color: #be123c; background: #ffe4e6; }
.diag-legend-sep { width: 1px; height: 14px; background: var(--ds-border-subtle); }
.lg-prereq { width: 16px; height: 0; border-top: 2px dashed #b45309; }

.diag-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.diag-badge.is-untested { color: #78716c; border-color: #d6d3d1; border-style: dashed; background: #fff; }
.diag-badge.is-in_progress { color: #b45309; border-color: #fcd34d; background: #fffbeb; }
.diag-badge.is-passed { color: #15803d; border-color: #86efac; background: #f0fdf4; }
.diag-badge.is-failed { color: #be123c; border-color: #fda4af; background: #fff1f2; }

/* 地图节点诊断外圈（与学习状态小圆点分开） */
.map-node .map-node-diag-ring { fill: none; pointer-events: none; }
.map-node.diag-untested .map-node-diag-ring { stroke: #d6d3d1; stroke-width: 1.5; stroke-dasharray: 5 4; }
.map-node.diag-in_progress .map-node-diag-ring { stroke: #f59e0b; stroke-width: 2.5; stroke-dasharray: 6 3; }
.map-node.diag-passed .map-node-diag-ring { stroke: #16a34a; stroke-width: 2.5; }
.map-node.diag-failed .map-node-diag-ring { stroke: #be123c; stroke-width: 2.5; }
.map-node.is-prereq rect:first-child { fill: #fffbeb; stroke: #b45309; stroke-width: 1.8; }
.map-edge.is-prereq { stroke: #b45309 !important; stroke-width: 2.4 !important; stroke-dasharray: 5 3; }

.map-recommend.is-diagnosis { border-color: rgba(15, 118, 110, 0.28); }
.map-recommend.is-diagnosis .map-recommend-kicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }

.map-sheet-diag {
  margin: 12px 0 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--ds-border-subtle);
  background: var(--ds-bg, #fbfaf6);
  font-size: 13px;
  line-height: 1.6;
}
.map-sheet-diag p { margin: 0 0 6px; }
.map-sheet-diag p:last-child { margin-bottom: 0; }
.map-sheet-diag.is-passed { border-color: #86efac; background: #f0fdf4; }
.map-sheet-diag.is-failed { border-color: #fda4af; background: #fff1f2; }
.map-sheet-diag.is-in_progress { border-color: #fcd34d; background: #fffbeb; }
.map-sheet-diag-result { font-weight: 600; color: var(--ds-heading); }
.diag-footnote { margin: 6px 0 0 !important; font-size: 11.5px; color: var(--ds-faint); }

/* 诊断面板：地图保持可见（桌面右侧） */
.diag-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  justify-content: flex-end;
  background: rgba(28, 25, 23, 0.18);
  backdrop-filter: blur(1px);
}
.diag-panel {
  display: flex;
  flex-direction: column;
  width: min(440px, 100vw);
  height: 100%;
  background: var(--ds-surface, #fff);
  border-left: 1px solid var(--ds-border-subtle);
  box-shadow: -24px 0 60px rgba(28, 25, 23, 0.18);
  animation: diagSlideIn 0.22s ease-out;
}
@keyframes diagSlideIn { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.diag-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--ds-border-subtle);
}
.diag-head-main { min-width: 0; }
.diag-kicker { font-size: 11px; letter-spacing: 0.04em; color: #0f766e; font-weight: 700; text-transform: uppercase; }
.diag-title { margin: 2px 0 2px; font-size: 18px; color: var(--ds-heading); }
.diag-progress { margin: 0; font-size: 12px; color: var(--ds-faint); }
.diag-close { flex: none; }
.diag-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.diag-messages { display: flex; flex-direction: column; gap: 10px; }
.diag-msg { display: flex; }
.diag-msg.is-user { justify-content: flex-end; }
.diag-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.65;
  background: var(--ds-bg, #fbfaf6);
  color: var(--ds-text);
  overflow-wrap: anywhere;
}
.diag-msg.is-user .diag-bubble { background: #0f766e; color: #fff; border-bottom-right-radius: 5px; }
.diag-msg.is-assistant .diag-bubble { border-bottom-left-radius: 5px; border: 1px solid var(--ds-border-subtle); }
.diag-bubble.is-error { color: #be123c; border-color: #fda4af; background: #fff1f2; }
.diag-bubble p:first-child { margin-top: 0; }
.diag-bubble p:last-child { margin-bottom: 0; }
.diag-verdict-host:empty { display: none; }
.diag-hint { margin: 0; font-size: 12px; line-height: 1.6; color: var(--ds-faint); }
.diag-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--ds-border-subtle);
  background: var(--ds-surface, #fff);
}
.diag-input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 132px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--ds-border, #d9d4c8);
  border-radius: 12px;
  background: var(--ds-bg, #fbfaf6);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
}
.diag-send { flex: none; width: 42px; height: 42px; border-radius: 12px; }
.diag-result { padding: 14px; border-radius: 16px; border: 1px solid var(--ds-border-subtle); background: var(--ds-bg, #fbfaf6); }
.diag-result.is-pass { border-color: #86efac; background: #f0fdf4; }
.diag-result.is-fail { border-color: #fda4af; background: #fff1f2; }
.diag-result-head { font-weight: 700; font-size: 15px; margin-bottom: 8px; color: var(--ds-heading); }
.diag-result-section { margin: 6px 0; font-size: 13px; line-height: 1.6; }
.diag-result-section ul { margin: 4px 0 0; padding-left: 18px; }
.diag-advice { margin: 8px 0 0; font-size: 13px; line-height: 1.6; }
.diag-result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* 分层讲解：诊断后不自动开始 */
.manual-start-card { margin: 16px 0; }
.manual-start-card .handoff-title { font-size: 15px; }
.manual-start-card .handoff-desc { margin: 4px 0 10px; }
.manual-start-verdict {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(120, 113, 96, 0.08);
  color: var(--ds-muted);
}
.manual-start-verdict.is-pass { background: #dcfce7; color: #15803d; }
.manual-start-verdict.is-fail { background: #ffe4e6; color: #be123c; }

@media (max-width: 720px) {
  .intake-form { padding: 14px; border-radius: 16px; }
  .intake-input-row { flex-direction: column; }
  .intake-submit { width: 100%; }
  .suggest-fields { grid-template-columns: 1fr; }
  .suggest-actions { flex-direction: column; }
  .suggest-actions .btn { width: 100%; }
  .diag-overlay { align-items: flex-end; }
  .diag-panel {
    width: 100%;
    height: min(92dvh, 760px);
    border-left: 0;
    border-top: 1px solid var(--ds-border-subtle);
    border-radius: 20px 20px 0 0;
    animation: diagSlideUp 0.24s ease-out;
  }
  @keyframes diagSlideUp { from { transform: translateY(28px); opacity: 0.7; } to { transform: none; opacity: 1; } }
  .diag-legend { overflow-x: auto; flex-wrap: nowrap; }
  .diag-head-row { align-items: flex-start; }
  .diag-legend-sep { display: none; }
}

/* v17 节点内的诊断标记（文字+符号，不只靠颜色） */
.map-node .map-node-diag-mark { font-size: 11px; font-weight: 700; dominant-baseline: middle; }
.map-node .map-node-diag-mark.diag-untested { fill: #a8a29e; }
.map-node .map-node-diag-mark.diag-in_progress { fill: #b45309; }
.map-node .map-node-diag-mark.diag-passed { fill: #15803d; }
.map-node .map-node-diag-mark.diag-failed { fill: #be123c; }

/* v17：通过后可学节点（未通过节点）虚线标记 */
.map-node.is-learnable rect:first-child { stroke: #2563eb; stroke-width: 1.8; stroke-dasharray: 6 3; }

/* v22 双风格分层讲解：风格徽标 / 选择器 / manual-start / 先修缺口条 */
.style-badge { border-color: currentColor; }

.style-badge.is-standard { color: #52525b; background: rgba(82, 82, 91, 0.08); }
.style-badge.is-socratic { color: #b45309; background: rgba(245, 158, 11, 0.14); }
.style-badge.is-feynman { color: #0f766e; background: rgba(15, 118, 110, 0.12); }

.diag-recommend {
  margin: 6px 0 0;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #0f766e;
  background: rgba(15, 118, 110, 0.08);
}

/* 讲解方式选择（manual-start 卡 / 换一种讲法弹层共用） */
.style-options { display: flex; flex-direction: column; gap: 8px; }
.style-options.is-compact { flex-direction: row; flex-wrap: wrap; }
.style-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ds-border-subtle);
  border-radius: 14px;
  background: var(--ds-surface, #fff);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms var(--ds-ease-std), background-color 150ms var(--ds-ease-std), box-shadow 150ms var(--ds-ease-std);
}
.style-option:hover { border-color: rgba(77, 107, 254, 0.4); }
.style-option.is-selected { border-color: var(--ds-brand, #4d6bfe); background: var(--ds-brand-soft, #eef2ff); box-shadow: 0 0 0 2px rgba(77, 107, 254, 0.14); }
.style-option-icon { font-size: 18px; line-height: 1.2; flex: none; }
.style-option-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.style-option-main b { font-size: 13.5px; color: var(--ds-heading); }
.style-option-main span { font-size: 12px; line-height: 1.5; color: var(--ds-muted); }
.style-option-tag {
  margin-left: auto;
  flex: none;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  color: #0f766e;
  background: rgba(15, 118, 110, 0.1);
}
.style-options.is-compact .style-option {
  flex: 1 1 0;
  width: auto;
  min-width: 104px;
  align-items: center;
  padding: 8px 10px;
}
.style-options.is-compact .style-option-main { flex-direction: row; align-items: center; }
.style-options.is-compact .style-option-main span { display: none; }
.style-options.is-compact .style-option-icon { font-size: 16px; }
.style-options.is-compact .style-option-tag { font-size: 10px; padding: 1px 5px; }
.style-switch-modal .style-options { max-height: 46vh; overflow-y: auto; }

/* manual-start 卡：诊断结论 + 讲解方式 */
.manual-start-styles { margin: 10px 0 4px; }
.manual-start-styles-label { margin-bottom: 6px; font-size: 12px; color: var(--ds-faint); }
.manual-start-hint { margin: 6px 0 0; font-size: 12px; line-height: 1.6; color: var(--ds-muted); }
.manual-start-btn { width: 100%; margin-top: 10px; }

/* 先修缺口提示条：位置在 handoff-host 与抽屉之间 */
.gap-hint-host { max-width: var(--col-session); margin: 0 auto; padding: 0 16px 10px; }
.gap-hint-host:empty { display: none; }
.gap-hint { border-color: rgba(180, 83, 9, 0.28); background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), rgba(255, 255, 255, 0.92)); }
.gap-hint-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.gap-hint-head b { font-size: 14px; color: var(--ds-heading); }
.gap-hint-desc { margin: 0 0 8px; font-size: 12.5px; line-height: 1.6; color: var(--ds-muted); }
.gap-hint-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gap-hint-close {
  width: 26px;
  height: 26px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--ds-faint);
}
.gap-hint-close:hover { background: rgba(0, 0, 0, 0.05); color: var(--ds-heading); }

.paper.is-gap { border-color: rgba(180, 83, 9, 0.3); }
.drawer-gap-cta { display: flex; justify-content: center; padding: 12px 4px 4px; }
.drawer-gap-cta .btn {
  max-width: 100%;
  height: auto;
  min-height: 40px;
  padding: 10px 18px;
  white-space: normal;
  text-align: center;
}

@media (max-width: 900px) {
  .drawer-empty .btn {
    max-width: 100%;
    height: auto;
    min-height: 40px;
    padding: 10px 18px;
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .manual-start-styles .style-options { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .manual-start-styles .style-option { flex: 0 0 auto; min-width: 0; white-space: nowrap; }
  .manual-start-styles .style-option-main span { display: none; }
  .gap-hint-actions { flex-direction: column; }
  .gap-hint-actions .btn { width: 100%; }
  .map-node-modal .modal-foot .btn-primary { grid-column: 1 / -1; }
}
