/* ============================================================
   Hyacine Studio · 浅色极简主题
   设计变量 → 基础排版 → 组件 → 页面 → 响应式
   ------------------------------------------------------------
   想换壁纸：把图片放进 static/，然后取消文件末尾「壁纸」那段的注释。
   ============================================================ */

:root {
  color-scheme: light;

  /* 背景与层次 */
  --bg: #ffffff;
  --bg-2: #f7f8fa;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-2: #fbfcfd;
  --surface-3: #f4f6f9;
  --line: #e7e9ee;
  --line-soft: #eef0f4;
  --line-strong: #d5d9e1;

  /* 文字 */
  --text: #262b33;
  --text-strong: #0f1319;
  --muted: #5f6875;
  --muted-2: #8d95a1;

  /* 强调色（深青，白底上足够对比） */
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.07);
  --accent-line: rgba(15, 118, 110, 0.28);
  --accent-bright: #14b8a6;
  --link: #0b6b62;

  /* 语义色 */
  --ok: #059669;
  --warn: #b45309;
  --bad: #dc2626;
  --orange: #c2410c;
  --purple: #7c3aed;

  /* 形状与阴影 */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lift: 0 4px 16px -6px rgba(16, 24, 40, 0.12),
                 0 1px 2px rgba(16, 24, 40, 0.06);

  /* 尺寸 */
  --topbar-h: 58px;
  --wrap: 1040px;

  /* 笔记正文可调字号（app.js 改写） */
  --read-size: 16px;

  /* 等宽字体：装了 Cascadia / JetBrains 就优先用，否则 Consolas */
  --mono: "Cascadia Mono", "Cascadia Code", "JetBrains Mono", "Fira Code",
          Consolas, "SF Mono", ui-monospace, monospace;
  /* 代码字号：正文代码 14px，表格里的对比/测试数据密一点 */
  --code-size: 14px;
  --code-size-sm: 13.5px;
  --code-lh: 1.75;

  /* --- 壁纸（默认关闭，见文件末尾开启方法） --- */
  --wallpaper: none;
  --wallpaper-scrim: rgba(255, 255, 255, 0.62);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
  scrollbar-color: #d3d8e0 transparent;
  scrollbar-width: thin;
}

/* 壁纸层：没设 --wallpaper 时什么也不画 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: var(--wallpaper);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

/* 壁纸上的白色蒙层，保证正文可读；没壁纸时与底色一致，无副作用 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--wallpaper-scrim);
  pointer-events: none;
}

body {
  background: transparent;
  color: var(--text);
  font: 15px/1.7 "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC",
        system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(15, 118, 110, 0.16); color: var(--text-strong); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #dcdfe6;
  border: 2px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: #c3c8d2; background-clip: content-box; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

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

h1, h2, h3 { line-height: 1.3; color: var(--text-strong); font-weight: 600; }
h1 { letter-spacing: -0.015em; }

/* ============ 顶栏 ============ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  color: var(--text-strong);
  font-weight: 650;
  font-size: 15.5px;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 0;
}
.brand:hover { text-decoration: none; }
.brand span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  background: var(--surface-3);
}

.nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }

.nav a {
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  transition: color 0.15s, background 0.15s;
}
.nav a:hover {
  color: var(--text-strong);
  background: var(--surface-3);
  text-decoration: none;
}
.nav a.on {
  color: var(--text-strong);
  background: var(--surface-3);
  font-weight: 600;
}

.nav-form { display: inline; margin: 0; }
.nav-link {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover {
  color: var(--text-strong);
  background: var(--surface-3);
  border: none;
  transform: none;
}

.nav-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0 6px 4px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1;
}
.nav-user::after {
  content: "";
  width: 1px;
  height: 14px;
  background: var(--line-strong);
  margin-left: 12px;
}
.nav-user em {
  font-style: normal;
  font-size: 11px;
  line-height: 1.2;
  padding: 2px 7px;
  border: none;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted-2);
  font-weight: 500;
}

/* ============ 布局骨架 ============ */

.wrap {
  max-width: var(--wrap);
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 72px;
  flex: 1;
}

.foot {
  max-width: var(--wrap);
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 40px;
  color: var(--muted-2);
  font-size: 12px;
  border-top: 1px solid var(--line-soft);
}

.footer-shutdown { display: inline; margin-left: 8px; }
.foot .link-btn { font-size: 12px; }

.muted { color: var(--muted); }
.right { text-align: right; }
.grow { flex: 1; }

.row { display: flex; align-items: center; gap: 8px; }
.row.spread { justify-content: space-between; }

/* ============ 页头 ============ */

.hero { padding: 4px 0 30px; }
.hero h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -0.025em; }
.hero p { margin: 0; color: var(--muted); font-size: 14.5px; }

.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0 0 6px; font-size: 25px; }
.page-head p { margin: 0; }

.page-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head-row h1 { margin: 0 0 6px; font-size: 25px; }
.page-head-row p { margin: 0; }

/* ============ 统计卡 ============ */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}
.stat b {
  display: block;
  font-size: 26px;
  font-family: var(--mono);
  color: var(--text-strong);
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 600;
}
.stat span { color: var(--muted); font-size: 12.5px; }

/* ============ 栏格与卡片 ============ */

.cols {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; font-size: 15px; letter-spacing: -0.005em; }
.card-head a { font-size: 13px; }

.card h2 { font-size: 16px; letter-spacing: -0.005em; }
.card > h2 { margin: 0 0 12px; }

.card > h2:first-child { margin-top: 0; }

/* ============ 按钮 ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--text-strong);
  color: #fff;
  border: 1px solid var(--text-strong);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover {
  text-decoration: none;
  background: #2b313a;
  border-color: #2b313a;
}
.btn.ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--text);
}
.btn.ghost:hover {
  background: var(--surface-3);
  border-color: #c3c9d3;
  color: var(--text-strong);
}

button {
  background: var(--text-strong);
  color: #fff;
  border: 1px solid var(--text-strong);
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
button:hover { background: #2b313a; border-color: #2b313a; }

button.danger {
  border-color: rgba(220, 38, 38, 0.28);
  color: var(--bad);
  background: #fff;
  margin-top: 4px;
}
button.danger:hover {
  border-color: rgba(220, 38, 38, 0.5);
  background: rgba(220, 38, 38, 0.05);
}

/* 文字按钮 */
.link-btn {
  background: none;
  border: none;
  color: var(--link);
  padding: 0;
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
}
.link-btn:hover {
  text-decoration: underline;
  background: none;
  border: none;
  color: var(--link);
}
.link-btn.danger-text { color: var(--bad); }

/* ============ 表单 ============ */

.note-form .form-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.note-form label,
.form-stack label { display: block; color: var(--muted); font-size: 12px; }
.note-form .block { margin-bottom: 14px; }

.note-form input,
.form-stack input,
.filter-input,
.note-form textarea,
.submit-card textarea {
  width: 100%;
  margin-top: 5px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  color: var(--text);
  font: 14px "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.note-form input:focus,
.form-stack input:focus,
.filter-input:focus,
.note-form textarea:focus,
.submit-card textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.note-form textarea {
  min-height: 460px;
  resize: vertical;
  margin-top: 5px;
  padding: 14px 16px;
  font: var(--code-size)/var(--code-lh) var(--mono);
  tab-size: 4;
}

.submit-card textarea {
  min-height: 340px;
  resize: vertical;
  padding: 14px 16px;
  font: var(--code-size)/var(--code-lh) var(--mono);
  tab-size: 4;
  background: #fbfcfd;
}

.form-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.form-stack button { margin-top: 4px; align-self: flex-start; }

.alert {
  background: rgba(220, 38, 38, 0.05);
  border: 1px solid rgba(220, 38, 38, 0.22);
  color: #b42318;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  margin: 10px 0;
}

/* ============ 表格与列表 ============ */

.list { width: 100%; border-collapse: collapse; }
.list th {
  text-align: left;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.list td {
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.list tbody tr:hover td { background: var(--surface-2); }
.list tr:last-child td { border-bottom: none; }
.list.wide td { font-size: 14px; }
.list th:first-child,
.list td:first-child { width: 1%; white-space: nowrap; }

.table-actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.table-actions form { display: inline; margin: 0; }

/* 题库行 */
.prob-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 9px;
  border-radius: 8px;
  color: var(--text);
  transition: background 0.15s;
}
.prob-row:hover { background: var(--surface-3); text-decoration: none; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: #d3d8e0; flex: none; }
.dot.ok { background: var(--ok); }
.dot.try { background: #f59e0b; }

/* ============ 卡片网格：笔记 / 题库 ============ */

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

.note-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--text);
  box-shadow: var(--shadow-card);
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.note-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift);
  text-decoration: none;
}
.note-card .meta {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.note-card h3 { margin: 7px 0 8px; font-size: 15px; line-height: 1.45; font-weight: 600; }
.note-card p { margin: 0; font-size: 12px; }
.note-card .card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  font-size: 11.5px;
  color: var(--muted-2);
  font-family: var(--mono);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.prob-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text);
  box-shadow: var(--shadow-card);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.prob-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift);
  text-decoration: none;
}
.prob-card h3 { margin: 10px 0 6px; font-size: 17px; font-weight: 600; }
.prob-card p { margin: 0 0 12px; font-size: 12px; }

/* ============ 徽标 / 标签 / 状态 ============ */

.badge {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 5px;
  padding: 2px 7px;
}
.diff { margin-left: auto; color: var(--warn); font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 16px; }
.chip {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  line-height: 1.6;
  background: #fff;
}

.status { font-size: 12px; color: var(--muted); }
.status.ok { color: var(--ok); }

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  letter-spacing: 0.04em;
}
.pill.AC { color: #047857; background: rgba(5, 150, 105, 0.09); }
.pill.WA { color: #b42318; background: rgba(220, 38, 38, 0.08); }
.pill.TLE { color: #a16207; background: rgba(202, 138, 4, 0.1); }
.pill.RE { color: #c2410c; background: rgba(234, 88, 12, 0.09); }
.pill.DRAFT { color: var(--purple); background: rgba(124, 58, 237, 0.08); }

.pill-link { text-decoration: none; display: inline-block; }
.pill-link:hover { text-decoration: none; filter: brightness(0.94); }

/* ============ 判题结果 ============ */

.verdict {
  display: inline-block;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 5px 14px;
  border-radius: 8px;
  margin: 4px 0 8px;
}
a.verdict:hover { text-decoration: none; filter: brightness(0.94); }
.verdict.big { font-size: 22px; padding: 8px 20px; margin: 0 0 18px; }
.verdict.AC { color: #047857; background: rgba(5, 150, 105, 0.07); border: 1px solid rgba(5, 150, 105, 0.25); }
.verdict.WA { color: #b42318; background: rgba(220, 38, 38, 0.06); border: 1px solid rgba(220, 38, 38, 0.22); }
.verdict.TLE { color: #a16207; background: rgba(202, 138, 4, 0.08); border: 1px solid rgba(202, 138, 4, 0.25); }
.verdict.RE { color: #c2410c; background: rgba(234, 88, 12, 0.07); border: 1px solid rgba(234, 88, 12, 0.24); }

.fail-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(220, 38, 38, 0.04);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 10px;
  padding: 12px 15px;
  margin: 0 0 16px;
  font-size: 14px;
}
.fail-banner a { margin-left: auto; font-size: 13px; }
.fail-title { font-weight: 600; color: #b42318; letter-spacing: 0.02em; }

.fail-row td { background: rgba(220, 38, 38, 0.035); }
.fail-row td:first-child { border-left: 2px solid var(--bad); }
.detail-row td { background: var(--surface-2); }

.admin-tests { scroll-margin-top: 82px; }
tr[id^="test-"] { scroll-margin-top: 82px; }

/* ============ 页脚（一行放完所有元信息） ============ */

.foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.foot-item { color: var(--muted-2); font-size: 12px; }
.foot-link {
  font-family: var(--mono);
  color: var(--muted-2);
  font-size: 12px;
}
.foot-link:hover { color: var(--accent); text-decoration: none; }
.foot-dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--line-strong);
  flex: none;
}
.foot .foot-copy {
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 0 -5px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted-2);
  opacity: 1;
  cursor: pointer;
}
.foot .foot-copy:hover {
  background: none;
  border: none;
  color: var(--accent);
  transform: none;
}
.foot .foot-copy.copied { color: var(--ok); background: none; }
.foot .footer-shutdown { display: inline; margin: 0; }

/* ============ 笔记正文排版 ============ */

.article { padding: 30px 34px; }
.article h1 { margin: 0 0 6px; font-size: 26px; }
.article > h2 { margin: 30px 0 12px; }
.crumbs { color: var(--muted-2); font-size: 12px; margin-bottom: 8px; letter-spacing: 0.02em; }

.md { margin-top: 16px; color: #333a45; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }

.md h1 { font-size: 23px; margin: 32px 0 10px; }
.md h2 {
  font-size: 18px;
  margin: 30px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.md h3 { font-size: 15.5px; margin: 24px 0 8px; }
.md p { margin: 11px 0; }

.md ul { list-style: none; margin: 12px 0; padding-left: 2px; }
.md ul > li { position: relative; padding-left: 18px; margin: 8px 0; }
.md ul > li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0.72em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-bright);
  opacity: 0.7;
}
.md ul ul { margin: 5px 0 5px 6px; }
.md ul ul > li::before {
  width: 4px;
  height: 1.5px;
  border-radius: 1px;
  top: 0.8em;
  background: var(--line-strong);
  opacity: 1;
}

.md ol { margin: 12px 0; padding-left: 24px; }
.md ol > li { margin: 8px 0; padding-left: 2px; }
.md ol > li::marker {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.9em;
}

.md li > ul, .md li > ol { margin: 5px 0; }

.md strong { color: var(--text-strong); font-weight: 600; }
.md em { color: #4b5563; }

.md code {
  font-family: var(--mono);
  font-size: 0.87em;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  color: #0b4f49;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.md pre code { white-space: pre; }

.md pre {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px 17px;
  overflow: auto;
  font: var(--code-size)/var(--code-lh) var(--mono);
  tab-size: 4;
}
.md pre code {
  background: none;
  border: none;
  padding: 0;
  color: #24292f;
  font-size: var(--code-size);
}

.md table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--line); padding: 8px 11px; text-align: left; }
.md th { background: var(--surface-2); color: var(--text-strong); font-weight: 600; }

.md blockquote {
  margin: 16px 0;
  padding: 11px 15px;
  border-left: 2px solid var(--accent-line);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
}
.md blockquote p { margin: 4px 0; }

.md hr { border: none; border-top: 1px solid var(--line); margin: 28px 0; }

.codehilite {
  background: var(--surface-2) !important;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 16px 0;
  overflow: hidden;
}
.codehilite pre { border: none; margin: 0; background: transparent !important; }

/* 代码块复制按钮（app.js 动态插入） */
.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.md pre:hover .code-copy { opacity: 1; }
.code-copy:hover { color: var(--accent); border-color: var(--accent-line); background: #fff; }
.code-copy.copied { opacity: 1; color: var(--ok); border-color: rgba(5, 150, 105, 0.4); }
@media (hover: none) { .code-copy { opacity: 1; } }

/* ============ 样例 / 测试点 ============ */

.sample { border: 1px solid var(--line); border-radius: 10px; margin: 14px 0; overflow: hidden; }
.sample-head {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  padding: 8px 13px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.02em;
}
.sample-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.sample-grid > div { padding: 10px 13px; }
.sample-grid > div + div { border-left: 1px solid var(--line); }
.label {
  color: var(--muted-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}
.sample pre, .sample-grid pre, .diff-grid pre, .copy-block pre {
  margin: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  overflow: auto;
  font: var(--code-size-sm)/var(--code-lh) var(--mono);
  white-space: pre-wrap;
  color: #2b3441;
}

/* 不一致的行：淡红底，期望/实际两边都标出来 */
.dl.bad {
  background: rgba(220, 38, 38, 0.13);
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.copy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}
.copy-head .label { margin-bottom: 0; }

.copy-btn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s, background 0.15s;
}
.copy-btn:hover {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
  transform: none;
}
.copy-btn.copied {
  opacity: 1;
  color: var(--ok);
  border-color: rgba(5, 150, 105, 0.4);
  background: rgba(5, 150, 105, 0.06);
}
@media (hover: none) { .copy-btn { opacity: 1; } }

.test-item { border: 1px solid var(--line); border-radius: 9px; margin: 9px 0; overflow: hidden; }
.test-item summary {
  cursor: pointer;
  padding: 9px 13px;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-2);
  transition: color 0.15s, background 0.15s;
}
.test-item summary:hover { color: var(--text-strong); background: var(--surface-3); }
.test-item[open] summary { border-bottom: 1px solid var(--line); }
.test-item .sample-grid { border-top: none; }

.diff-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin: 10px 0 4px; }

/* 期望 / 实际 两列做颜色区分，方便一眼比对 */
.diff-grid > div:nth-child(2) pre {
  background: rgba(5, 150, 105, 0.04);
  border-color: rgba(5, 150, 105, 0.22);
}
.diff-grid > div:nth-child(3) pre {
  background: rgba(220, 38, 38, 0.035);
  border-color: rgba(220, 38, 38, 0.2);
}
.diff-grid > div:nth-child(2) .label { color: #047857; }
.diff-grid > div:nth-child(3) .label { color: #b42318; }

pre.code {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  overflow: auto;
  font: 14px/1.75 var(--mono);
  color: #1f2933;
  tab-size: 4;
}
pre.code code { font: inherit; }

/* 语法高亮配色（Pygments friendly，调过对比度） */
.codehl { background: none; }
.codehl .c, .codehl .ch, .codehl .cm, .codehl .cpf,
.codehl .c1, .codehl .cs { color: #74808f; font-style: italic; }
.codehl .cp { color: #0f766e; }
.codehl .k, .codehl .kc, .codehl .kd, .codehl .kn,
.codehl .kr, .codehl .kp { color: #0b6b62; font-weight: 600; }
.codehl .kt { color: #a15c00; }
.codehl .o { color: #5b6572; }
.codehl .ow { color: #0b6b62; font-weight: 600; }
.codehl .m, .codehl .mb, .codehl .mf, .codehl .mh,
.codehl .mi, .codehl .mo, .codehl .il { color: #1c7d4d; }
.codehl .s, .codehl .sa, .codehl .sb, .codehl .sc, .codehl .dl,
.codehl .sd, .codehl .s2, .codehl .sh, .codehl .sx,
.codehl .sr, .codehl .s1, .codehl .ss { color: #1f5c8b; }
.codehl .se { color: #a15c00; font-weight: 600; }
.codehl .si { color: #1f5c8b; font-style: italic; }
.codehl .n { color: #1f2933; }
.codehl .na { color: #1f5c8b; }
.codehl .nb, .codehl .bp { color: #0b6b62; }
.codehl .nc, .codehl .nn { color: #8a4b00; font-weight: 600; }
.codehl .nf, .codehl .fm { color: #1d4ed8; }
.codehl .nd { color: #6b7280; }
.codehl .ne { color: #b42318; }
.codehl .nv, .codehl .vc, .codehl .vg, .codehl .vi { color: #7c3aed; }
.codehl .w { color: transparent; }
.codehl .err { color: #b42318; border-bottom: 1px dotted #b42318; }
.codehl .hll { background: #fff7cc; }

/* ============ 笔记阅读页：正文 + 侧栏 ============ */

.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 40;
  pointer-events: none;
}
.read-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.08s linear;
}

.note-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 242px;
  gap: 22px;
  align-items: start;
}

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

.note-article { padding: 32px 36px; }
.note-article .md {
  font-size: var(--read-size);
  line-height: 1.9;
  margin-top: 20px;
}
.note-article .md > p:first-child { color: var(--text); }

.note-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.note-head h1 { margin: 0; flex: 0 1 auto; font-size: 27px; }
.note-head .badge { margin-top: 1px; }

.note-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 12px;
}
.note-meta .sep { width: 2px; height: 2px; border-radius: 50%; background: var(--line-strong); }
.note-meta a { font-size: 12px; }

.note-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
}

.side-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-card);
}

.side-title {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 10px;
  font-weight: 600;
}

.side-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  padding: 3px 0;
}
.side-row b {
  color: var(--text);
  font-family: var(--mono);
  font-weight: 500;
}

.font-ctl { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.font-btn {
  width: 30px;
  height: 26px;
  padding: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line-strong);
}
.font-btn:hover {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
  transform: none;
}
.font-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.font-val {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted-2);
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px;
}
.side-list a {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  transition: color 0.12s, background 0.12s;
}
.side-list a:hover { color: var(--text-strong); background: var(--surface-3); text-decoration: none; }
.side-list a.on {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.side-list a .lec {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
  margin-right: 6px;
}
.side-list a.on .lec { color: var(--accent); opacity: 0.75; }

.outline a.lvl3 { padding-left: 20px; font-size: 12px; color: var(--muted-2); }
.outline a.lvl3:hover { color: var(--text-strong); }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 6px;
  font-size: 13px;
}
.pager a { color: var(--muted); transition: color 0.15s; }
.pager a:hover { color: var(--accent); text-decoration: none; }

/* ============ 笔记列表筛选条 ============ */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.filter-bar .chips { margin: 0; }

.filter-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
}

.filter-input {
  flex: 0 1 300px;
  margin-top: 0;
  padding: 8px 13px;
  border-radius: 8px;
  font-size: 13.5px;
  background: #fff;
}

.chips button.chip {
  cursor: pointer;
  background: #fff;
  font-family: inherit;
  font-weight: 400;
  height: auto;
  line-height: 1.6;
  padding: 2px 10px;
  border-radius: 999px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.chips button.chip:hover {
  color: var(--text-strong);
  border-color: var(--line-strong);
  background: var(--surface-3);
  transform: none;
}
.chips .chip.on {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
  font-weight: 500;
}

.note-count {
  margin-left: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted-2);
  white-space: nowrap;
}

.empty-hint { color: var(--muted-2); font-size: 13px; padding: 26px 0; text-align: center; }

/* ============ 管理后台 ============ */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  color: var(--muted);
  padding: 9px 13px;
  border-bottom: 2px solid transparent;
  font-size: 13.5px;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tabs a:hover { color: var(--text-strong); text-decoration: none; }
.tabs a.on { color: var(--text-strong); border-bottom-color: var(--accent); font-weight: 600; }

.auth-wrap { display: flex; justify-content: center; padding: 40px 0 64px; }
.auth-card { width: 100%; max-width: 420px; padding: 30px 32px; }
.auth-card h1 { margin: 0 0 8px; font-size: 22px; }

/* ============ 模块切换 ============ */

.modnav {
  display: flex;
  gap: 2px;
  align-items: center;
  background: var(--surface-3);
  padding: 3px;
  border-radius: 9px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.modnav::-webkit-scrollbar { display: none; }

.modtab {
  padding: 5px 13px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13.5px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.modtab:hover { color: var(--text-strong); text-decoration: none; }
.modtab.on {
  background: #fff;
  color: var(--text-strong);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1);
}

.subnav {
  position: sticky;
  top: var(--topbar-h);
  z-index: 19;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.subnav-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.subnav a {
  padding: 6px 11px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13.5px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.subnav a:hover { color: var(--text-strong); background: var(--surface-3); text-decoration: none; }
.subnav a.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.subnav-hint { margin-left: auto; font-size: 12px; color: var(--muted-2); white-space: nowrap; }

/* ============ 模块总览卡片 ============ */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.module-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  color: var(--text);
  box-shadow: var(--shadow-card);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.module-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift);
  text-decoration: none;
}
.module-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.module-top h2 { margin: 0; font-size: 19px; }
.module-sub {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted-2);
}
.module-card p { margin: 0; font-size: 13px; line-height: 1.65; }
.module-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  margin-top: auto;
}
.module-stats b {
  color: var(--text-strong);
  font-family: var(--mono);
  font-weight: 600;
}
.module-go { font-size: 12.5px; color: var(--accent); }

/* ============ 讨论列表 ============ */

.rule-hint { font-size: 12.5px; color: var(--muted-2); margin: -10px 0 16px; }

.thread-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.thread-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
}
.thread-row:last-child { border-bottom: none; }
.thread-row:hover { background: var(--surface-2); text-decoration: none; }

.thread-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.thread-title { font-weight: 600; color: var(--text-strong); font-size: 14.5px; }
.thread-snippet {
  font-size: 12.5px;
  color: var(--muted-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-side {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  font-size: 12px;
  color: var(--muted-2);
  font-family: var(--mono);
}
.thread-count { color: var(--accent); }

.thread-mini { display: flex; flex-direction: column; }
.thread-mini a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 8px;
  border-radius: 7px;
  color: var(--text);
  font-size: 13.5px;
}
.thread-mini a:hover { background: var(--surface-3); text-decoration: none; }
.thread-mini-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-mini-meta { flex: none; font-size: 11.5px; color: var(--muted-2); font-family: var(--mono); }

/* ============ 帖子详情 ============ */

.crumbs a { color: var(--muted-2); }
.crumbs a:hover { color: var(--accent); }

.thread-post h1 { margin: 0 0 10px; font-size: 24px; }
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted-2);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.post-author { color: var(--text-strong); font-weight: 600; }

.thread-admin { margin: -6px 0 16px; }

.thread-replies { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.reply {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-card);
}
.reply-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  color: var(--muted-2);
  margin-bottom: 6px;
}
.reply-no { margin-left: auto; font-family: var(--mono); }
.reply .md { margin-top: 0; }

.form-title { font-size: 22px; margin: 0 0 16px; }

.thread-form .block,
.reply-form .block {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}
.thread-form input,
.thread-form textarea,
.reply-form textarea {
  width: 100%;
  margin-top: 6px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font: 14px/1.75 "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.thread-form input:focus,
.thread-form textarea:focus,
.reply-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.thread-form textarea, .reply-form textarea { resize: vertical; }
.author-input { width: auto; max-width: 200px; }
.form-hint { font-size: 12px; color: var(--muted-2); margin: 10px 0 0; }
.reply-form .row.spread { align-items: center; }
.reply-form .row.spread button { flex: none; }

/* ============ 公式 ============ */

.katex { font-size: 1.03em; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }

/* ============ 动效偏好 ============ */

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

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

@media (max-width: 960px) {
  .note-layout { grid-template-columns: 1fr; }
  .note-side {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .note-side > .side-card:only-child,
  .note-side > .side-card:last-child { grid-column: 1 / -1; }
  .side-list { max-height: none; overflow: visible; }
}

@media (max-width: 820px) {
  .wrap { padding: 28px 18px 52px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cols { grid-template-columns: 1fr; }
  .sample-grid, .diff-grid { grid-template-columns: 1fr; }
  .sample-grid > div + div { border-left: none; border-top: 1px solid var(--line); }
  .article, .note-article { padding: 22px 20px; }
  .note-form .form-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 25px; }
  .page-head h1, .page-head-row h1 { font-size: 22px; }
  .note-head h1 { font-size: 23px; }
  .note-side { grid-template-columns: 1fr; }
  .topbar-inner { padding: 0 18px; }
  .subnav-hint { display: none; }
}

@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; gap: 6px 12px; padding: 9px 16px 10px; min-height: 0; }
  .brand { font-size: 15px; }
  .brand span { display: none; }
  .modnav { order: 3; width: 100%; }
  .modtab { flex: 1; text-align: center; }
  .nav { flex-wrap: wrap; gap: 2px; overflow: visible; margin-left: auto; }
  .nav a, .nav-link { padding: 5px 8px; font-size: 13px; white-space: nowrap; }
  .subnav { position: static; }
  .subnav-inner { height: auto; padding: 6px 16px; overflow-x: auto; scrollbar-width: none; }
  .subnav-inner::-webkit-scrollbar { display: none; }
  .card { padding: 16px 15px; }
  .card:has(> .list), .card:has(> table) { overflow-x: auto; }
  .stat b { font-size: 22px; }
  .filter-input { max-width: none; }
  .note-count { margin-left: 0; }
  .thread-side { display: none; }
  .thread-row { padding: 12px 14px; }
  .author-input { max-width: none; }
}

/* ============================================================
   壁纸
   ------------------------------------------------------------
   开启方法（两步）：
   1) 把图片放到 static/，例如 static/wallpaper.jpg
   2) 取消下面这行注释，改成你的文件名
   ------------------------------------------------------------
   :root { --wallpaper: url("/static/wallpaper.jpg"); }
   ------------------------------------------------------------
   觉得正文不够清楚，就把 --wallpaper-scrim 的白色调浓一点（0.62 → 0.75）。
   卡片本身是 90% 白，壁纸会若隐若现地透出来。
   ============================================================ */

/* ============ 站点人格：图标 / 表情 ============ */

.brand { gap: 8px; }
.brand-mark {
  width: 30px;
  height: 30px;
  display: block;
  flex: none;
  border-radius: 8px;
}

/* 404 */
.notfound { text-align: center; padding: 40px 0 64px; }
.notfound-art { width: 132px; height: 132px; display: block; margin: 0 auto 12px; }
.notfound h1 { font-size: 24px; margin: 0 0 8px; }
.notfound p { margin: 0; color: var(--muted); }
.notfound-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

/* 空状态 */
.empty-state { text-align: center; padding: 26px 0 32px; color: var(--muted-2); }
.empty-state img { width: 92px; height: 92px; display: block; margin: 0 auto 8px; }
.empty-state p { margin: 0; font-size: 13.5px; }

/* 表情条 */
.emoji-bar { display: flex; align-items: center; gap: 2px; margin-top: 8px; }
.emoji-hint { font-size: 12px; color: var(--muted-2); margin-right: 6px; }
.emoji-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 3px;
  line-height: 0;
  cursor: pointer;
}
.emoji-btn img { width: 28px; height: 28px; display: block; }
.emoji-btn:hover {
  border-color: var(--line);
  background: var(--surface-3);
  transform: none;
}

/* 正文里插入的小表情 */
.md img { max-width: 100%; height: auto; }
.md img[src^="/static/emoji/"] {
  height: 1.9em;
  width: auto;
  vertical-align: -0.45em;
  margin: 0 1px;
}
