/* ============================================================
   共享设计令牌 (Design Tokens) — 跨 app UI 统一
   注意：这些变量定义在 :root，page-level 样式优先用 var(--*) 引用
   ============================================================ */

:root {
  /* —— 文字与中性色 —— */
  --text:      #0f172a;
  --muted:     rgba(100, 116, 139, .7);
  --border:    rgba(148, 163, 184, .15);

  /* —— 卡片背景层 —— */
  --card-bg:   rgba(255, 255, 255, .04);
  --card-bg2:  rgba(255, 255, 255, .03);
  --input-bg:  rgba(0, 0, 0, .04);

  /* —— 圆角 —— */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  /* —— 阴影 —— */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow:    0 4px 12px rgba(15, 23, 42, .06), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 32px -8px rgba(15, 23, 42, .15);
  --shadow-xl: 0 24px 48px -12px rgba(15, 23, 42, .18);

  /* —— 过渡 —— */
  --t-fast: 120ms ease;
  --t-base: 180ms ease;
  --t-slow: 280ms cubic-bezier(.16, 1, .3, 1);

  /* —— 语义色（与 brand 解耦）—— */
  --c-success: #22c55e;
  --c-warning: #f59e0b;
  --c-danger:  #ef4444;
  --c-info:    #3b82f6;
}

.theme-dark {
  --text:      #f1f5f9;
  --muted:     rgba(148, 163, 184, .65);
  --border:    rgba(255, 255, 255, .08);
  --card-bg:   rgba(255, 255, 255, .04);
  --card-bg2:  rgba(255, 255, 255, .03);
  --input-bg:  rgba(255, 255, 255, .06);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow:    0 4px 12px rgba(0, 0, 0, .35), 0 2px 4px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, .5);
  --shadow-xl: 0 24px 48px -12px rgba(0, 0, 0, .6);
}

/* —— 标准化 .glass-card —— */
.glass-card {
  background: var(--card-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow) !important;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base) !important;
}

.glass-card:hover {
  box-shadow: var(--shadow-lg) !important;
}

/* —— 标准化按钮基线（保留学科 accent） —— */
.btn-primary,
button.btn-primary {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  border-radius: var(--r-md);
  transition: transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}

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

.btn-primary:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost,
button.btn-ghost {
  background: var(--card-bg2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}

.btn-ghost:hover:not(:disabled) {
  border-color: rgba(99, 102, 241, .3);
}

.btn-soft,
a.btn-soft {
  background: var(--card-bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r-md);
  font-weight: 600;
  text-decoration: none;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.btn-soft:hover {
  border-color: rgba(148, 163, 184, .3);
}

/* —— 表单元素统一 —— */
input:not([type=checkbox]):not([type=radio]):not([type=file]),
textarea,
select {
  background: var(--input-bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: inherit;
}

/* —— 滚动条标准化 —— */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, .25);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, .4);
  background-clip: padding-box;
}

.theme-dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .14);
  background-clip: padding-box;
}

/* —— 链接基线 —— */
a { text-underline-offset: 3px; }

/* —— page-header 模式统一（之前 vocab 用 .page-header） —— */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-header-text h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--text);
  letter-spacing: -.01em;
}
.page-header-text .meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

/* —— 全局 meta 类 —— */
.meta { color: var(--muted); }

/* === END shared tokens === */
/* ============================================================
   theme-overlay.css — 统一现代风主题层
   为子应用注入更克制的视觉细节，不动 HTML 与原 CSS
   仅作变量/阴影/圆角/按钮/字体 stack 的对齐
   ============================================================ */

:root {
  /* 字体回退栈，保留原应用的中英文偏好 */
  --font-sans-modern: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;

  /* 与门户对齐的圆角与阴影 */
  --radius: 16px;
  --radius-xl: 22px;
  --radius-sm: 10px;

  --elev-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.06);
  --elev: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --elev-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.12);
}

/* 全局字体栈对齐 */
body,
button,
input,
textarea,
select {
  font-family: var(--font-sans-modern);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 让 site-header 玻璃效果更克制 */
.site-header {
  border-bottom-color: var(--line, #e2e8f0);
}

/* 卡片/玻璃面板：圆角和阴影对齐 */
.panel,
.card,
.glass-card,
.book-card,
.summary-card,
.stat-card,
.dashboard-card {
  border-radius: var(--radius) !important;
  box-shadow: var(--elev) !important;
}

.panel:hover,
.card:hover,
.glass-card:hover,
.book-card:hover {
  box-shadow: var(--elev-lg) !important;
}

/* 按钮：圆角统一、过渡更顺滑 */
.btn,
button.btn,
.button,
.nav-pill {
  border-radius: var(--radius-sm) !important;
  transition: transform 150ms ease, box-shadow 150ms ease,
    background-color 150ms ease, border-color 150ms ease !important;
  font-weight: 500;
}

.btn:hover:not(:disabled),
.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

/* 输入框：聚焦态更清晰 */
input:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
  border-color: var(--accent, #f97316) !important;
}

.theme-dark input:focus,
.theme-dark textarea:focus,
.theme-dark select:focus {
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.18);
}

/* 表格：行 hover 一致 */
table tr:hover td {
  background: rgba(15, 23, 42, 0.02);
}

.theme-dark table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* 链接 underline-offset 更现代 */
a {
  text-underline-offset: 3px;
}

/* 滚动条更精致（仅 webkit） */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.28);
  background-clip: padding-box;
  border: 2px solid transparent;
}

.theme-dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* 选区颜色对齐学科色 */
::selection {
  background: rgba(249, 115, 22, 0.22);
  color: inherit;
}
