/* ======================================================================
   Java 学习笔记 · 样式表
   亮色主题 / 响应式 / 零依赖
   ====================================================================== */

:root {
  --brand: #e0561d;
  --brand-deep: #c2470f;
  --brand-soft: #fdf0e8;
  --brand-line: #f7cdb4;
  --link: #2f6f9f;
  --link-soft: #eaf3fa;

  --bg: #f5f6f8;
  --bg-alt: #eef0f4;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e4e7ec;
  --border-strong: #d3d8e0;

  --text: #1b1f27;
  --text-2: #454c58;
  --muted: #737c8a;
  --muted-2: #98a0ad;

  --green: #1a7f52;
  --green-soft: #e7f5ee;
  --red: #c92a2a;
  --red-soft: #fdecec;
  --amber: #b7791f;
  --amber-soft: #fdf5e3;
  --blue: #2f6f9f;
  --blue-soft: #eaf3fa;
  --purple: #6741d9;
  --purple-soft: #f1ecfd;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow: 0 4px 14px rgba(16, 24, 40, .07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .1);

  --mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --max: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--brand-deep); }
h1, h2, h3, h4 { line-height: 1.35; margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
img { max-width: 100%; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ---------- 阅读进度条 ---------- */
.read-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100;
  background: transparent; pointer-events: none;
}
.read-progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand), #f5a623);
  transition: width .1s linear;
}

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 24px; height: 62px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #f5a623);
  color: #fff; font-family: var(--mono); font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(224, 86, 29, .3);
}
.brand-text { font-size: 16px; font-weight: 700; line-height: 1.2; }
.brand-text em {
  display: block; font-style: normal; font-size: 11px;
  font-weight: 500; color: var(--muted-2); letter-spacing: .04em;
}

.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 7px 13px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: var(--text-2); transition: .16s;
}
.nav a:hover { background: var(--bg-alt); color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }

.header-tools { display: flex; align-items: center; gap: 10px; }
.search-box {
  position: relative; display: flex; align-items: center;
  background: var(--bg-alt); border: 1px solid transparent;
  border-radius: 9px; padding: 0 10px; height: 36px; width: 250px;
  transition: .16s;
}
.search-box:focus-within {
  background: var(--surface); border-color: var(--brand-line);
  box-shadow: 0 0 0 3px rgba(224, 86, 29, .1);
}
.search-box .icon {
  width: 15px; height: 15px; flex-shrink: 0; stroke: var(--muted);
  stroke-width: 2; fill: none; stroke-linecap: round;
}
.search-box input {
  flex: 1; border: 0; background: transparent; outline: none;
  font-size: 13.5px; color: var(--text); padding: 0 8px; min-width: 0;
  font-family: inherit;
}
.search-box input::placeholder { color: var(--muted-2); }
.search-box kbd {
  font-family: var(--mono); font-size: 10px; color: var(--muted-2);
  border: 1px solid var(--border-strong); border-radius: 4px;
  padding: 1px 5px; background: var(--surface);
}
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text); margin: 4px 0; border-radius: 2px; }

/* ---------- 主体 ---------- */
main { min-height: 62vh; padding: 32px 24px 72px; }

.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 28px; margin-bottom: 8px; }
.page-head p { color: var(--muted); font-size: 15px; margin: 0; max-width: 720px; }
.breadcrumb { font-size: 13px; color: var(--muted-2); margin-bottom: 12px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span { margin: 0 6px; }

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

/* ---------- 首页 Hero ---------- */
.hero {
  background: linear-gradient(135deg, #fff9f4 0%, #f4f8fb 60%, #f7f4fd 100%);
  border: 1px solid var(--border); border-radius: 18px;
  padding: 46px 44px; margin-bottom: 32px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(224, 86, 29, .12), transparent 65%);
}
.hero h1 { font-size: 34px; margin-bottom: 14px; letter-spacing: -.02em; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p { font-size: 16px; color: var(--text-2); max-width: 640px; margin-bottom: 22px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; position: relative; z-index: 1; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: 9px; font-size: 14.5px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: .16s; font-family: inherit;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 10px rgba(224, 86, 29, .28); }
.btn-primary:hover { background: var(--brand-deep); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-deep); }
.btn-sm { padding: 6px 14px; font-size: 13px; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 32px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px;
}
.stat b { display: block; font-size: 24px; font-weight: 750; letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--muted); }

/* ---------- 区块标题 ---------- */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin: 34px 0 16px;
}
.section-head h2 { font-size: 20px; display: flex; align-items: center; gap: 9px; }
.section-head h2::before {
  content: ""; width: 4px; height: 18px; border-radius: 2px;
  background: linear-gradient(var(--brand), #f5a623);
}
.section-head .more { font-size: 13.5px; color: var(--muted); }
.section-head .more:hover { color: var(--brand-deep); }

/* ---------- 文章列表 ---------- */
.article-grid { display: grid; gap: 16px; }
.article-card {
  display: flex; gap: 20px; padding: 22px 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); transition: .18s; position: relative;
}
.article-card:hover {
  border-color: var(--brand-line); box-shadow: var(--shadow); transform: translateY(-2px);
}
.article-card.accent { border-left: 3px solid var(--brand); }
.ac-body { flex: 1; min-width: 0; }
.ac-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.ac-title a { color: var(--text); }
.ac-title a:hover { color: var(--brand-deep); }
.ac-summary {
  color: var(--muted); font-size: 14px; margin: 0 0 14px; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ac-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted-2); }
.ac-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  background: var(--bg-alt); color: var(--muted); font-size: 12px; font-weight: 500;
  transition: .15s;
}
a.tag:hover { background: var(--brand-soft); color: var(--brand-deep); }
.tag.active { background: var(--brand); color: #fff; }

/* ---------- 标签云 ---------- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 9px; }
.tag-cloud .tag { padding: 5px 13px; font-size: 13px; }

/* ---------- 文章详情 ---------- */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 34px; align-items: start; }
.article-main {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px 46px 48px;
}
.article-title { font-size: 30px; margin-bottom: 14px; letter-spacing: -.02em; }
.article-meta {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
  padding-bottom: 20px; margin-bottom: 26px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--muted);
}

/* Markdown 正文 */
.md { font-size: 15.5px; line-height: 1.85; color: var(--text-2); }
.md > *:first-child { margin-top: 0; }
.md h2 {
  font-size: 21px; color: var(--text); margin: 40px 0 14px;
  padding-bottom: 9px; border-bottom: 1px solid var(--border);
}
.md h3 { font-size: 17.5px; color: var(--text); margin: 28px 0 12px; }
.md h4 { font-size: 15.5px; color: var(--text); margin: 22px 0 10px; }
.md p { margin: 0 0 16px; }
.md ul, .md ol { margin: 0 0 18px; padding-left: 24px; }
.md li { margin-bottom: 7px; }
.md li::marker { color: var(--brand); }
.md strong { color: var(--text); font-weight: 650; }
.md blockquote {
  margin: 0 0 18px; padding: 12px 18px; background: var(--brand-soft);
  border-left: 3px solid var(--brand); border-radius: 0 8px 8px 0;
  color: var(--text-2); font-size: 14.5px;
}
.md blockquote p:last-child { margin: 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 30px 0; }
.md code {
  font-family: var(--mono); font-size: .88em; padding: 2px 6px;
  background: var(--bg-alt); border-radius: 4px; color: #b5283f;
}
.md table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 9px 13px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 650; color: var(--text); }
.md tbody tr:nth-child(even) { background: var(--surface-2); }

.code-block {
  position: relative; margin: 0 0 20px; border-radius: 10px; overflow: hidden;
  border: 1px solid #e6e9ef; background: #fbfaf7;
}
.code-block .code-lang {
  position: absolute; top: 0; right: 0; padding: 3px 10px;
  font-family: var(--mono); font-size: 11px; color: var(--muted-2);
  background: rgba(255, 255, 255, .85); border-left: 1px solid #e6e9ef;
  border-bottom: 1px solid #e6e9ef; border-radius: 0 9px 0 8px;
}
.code-block pre { margin: 0; padding: 16px 18px; overflow-x: auto; }
.code-block code {
  font-family: var(--mono); font-size: 13px; line-height: 1.72;
  background: none; padding: 0; color: #2a2f3a; white-space: pre;
}

/* 侧边目录 */
.toc-card { position: sticky; top: 82px; }
.toc-card h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); margin-bottom: 12px; }
.toc { list-style: none; margin: 0; padding: 0; font-size: 13.5px; border-left: 2px solid var(--border); }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 6px 12px; color: var(--muted);
  border-left: 2px solid transparent; margin-left: -2px; line-height: 1.5;
}
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--brand-deep); border-left-color: var(--brand); font-weight: 600; background: var(--brand-soft); }
.toc .toc-h3 { padding-left: 26px; font-size: 13px; }

/* ---------- 算法题库 ---------- */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 14px 18px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.filter-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filter-label { font-size: 12.5px; color: var(--muted-2); margin-right: 2px; }
.chip {
  padding: 5px 13px; border-radius: 999px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  transition: .15s; font-family: inherit;
}
.chip:hover { border-color: var(--brand-line); color: var(--brand-deep); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

.prob-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.prob-row {
  display: grid; grid-template-columns: 46px 1fr 76px 150px 96px;
  gap: 12px; align-items: center; padding: 14px 20px;
  border-bottom: 1px solid var(--border); transition: .15s;
}
.prob-row:last-child { border-bottom: 0; }
.prob-row:hover { background: var(--surface-2); }
.prob-row.head {
  background: var(--surface-2); font-size: 12px; color: var(--muted-2);
  font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.prob-row.head:hover { background: var(--surface-2); }
.prob-no { font-family: var(--mono); color: var(--muted-2); font-size: 13px; }
.prob-title { font-weight: 600; color: var(--text); font-size: 15px; }
.prob-title:hover { color: var(--brand-deep); }
.level { font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 6px; display: inline-block; }
.level-简单 { color: var(--green); background: var(--green-soft); }
.level-中等 { color: var(--amber); background: var(--amber-soft); }
.level-困难 { color: var(--red); background: var(--red-soft); }
.prob-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.prob-status { font-size: 12.5px; color: var(--muted-2); text-align: right; }
.prob-status.done { color: var(--green); font-weight: 600; }

/* ---------- 题目详情 + 编辑器 ---------- */
.prob-layout { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 22px; align-items: start; }
.prob-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px; }
.prob-detail h1 { font-size: 22px; margin-bottom: 12px; }
.md-sm { font-size: 14.5px; line-height: 1.8; color: var(--text-2); }
.md-sm h2 { font-size: 16px; margin: 22px 0 10px; border: 0; padding: 0; }
.md-sm h3 { font-size: 15px; margin: 18px 0 8px; }
.md-sm p { margin: 0 0 12px; }
.md-sm ul { padding-left: 20px; margin-bottom: 12px; }
.md-sm code { font-family: var(--mono); font-size: .88em; padding: 2px 6px; background: var(--bg-alt); border-radius: 4px; color: #b5283f; }
.md-sm pre { background: #fbfaf7; border: 1px solid #e6e9ef; border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 0 0 12px; }
.md-sm pre code { background: none; padding: 0; color: #2a2f3a; font-size: 12.5px; line-height: 1.7; }
.md-sm strong { color: var(--text); }

.example-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 14px 16px; margin-bottom: 14px; }
.example-box .ex-line { font-family: var(--mono); font-size: 12.5px; margin-bottom: 5px; word-break: break-all; }
.example-box .ex-line:last-child { margin-bottom: 0; }
.example-box b { color: var(--text); font-weight: 650; }

/* 编辑器 */
.editor-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.editor-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.editor-toolbar .spacer { flex: 1; }
.editor-toolbar .hint { font-size: 12px; color: var(--muted-2); }

.editor { position: relative; display: flex; background: #fbfaf7; font-family: var(--mono); font-size: 13px; line-height: 1.72; }
.editor-gutter {
  flex-shrink: 0; width: 46px; padding: 14px 8px 14px 0; text-align: right;
  color: var(--muted-2); background: #f5f4ef; border-right: 1px solid #e9e6de;
  user-select: none; overflow: hidden;
  font-size: 13px; line-height: 1.72; white-space: pre;
}
.editor-area { position: relative; flex: 1; min-width: 0; height: 380px; }
.editor-area pre, .editor-area textarea {
  position: absolute; inset: 0; margin: 0; padding: 14px 16px;
  font-family: var(--mono); font-size: 13px; line-height: 1.72;
  border: 0; white-space: pre; overflow: auto; tab-size: 4;
}
.editor-area pre { pointer-events: none; color: #2a2f3a; }
.editor-area textarea {
  background: transparent; color: transparent; caret-color: var(--brand);
  resize: none; outline: none; overflow: auto;
}
.editor-area textarea::selection { background: rgba(224, 86, 29, .18); }

/* 运行结果 */
.result-panel { border-top: 1px solid var(--border); }
.result-tabs { display: flex; gap: 2px; padding: 0 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.result-tab {
  padding: 9px 14px; font-size: 13px; cursor: pointer; border: 0; background: none;
  color: var(--muted); border-bottom: 2px solid transparent; font-family: inherit;
}
.result-tab.active { color: var(--brand-deep); border-bottom-color: var(--brand); font-weight: 600; }
.result-body { padding: 16px; max-height: 340px; overflow: auto; }
.case-item {
  border: 1px solid var(--border); border-radius: 9px; padding: 11px 14px; margin-bottom: 10px;
  font-size: 13px; background: var(--surface-2);
}
.case-item:last-child { margin-bottom: 0; }
.case-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.badge { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 5px; }
.badge-pass { background: var(--green-soft); color: var(--green); }
.badge-fail { background: var(--red-soft); color: var(--red); }
.badge-err { background: var(--amber-soft); color: var(--amber); }
.case-line { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); word-break: break-all; margin-bottom: 3px; }
.case-line .k { color: var(--muted-2); display: inline-block; min-width: 62px; }
.case-line .ok { color: var(--green); }
.case-line .no { color: var(--red); }

.console {
  background: #1e222a; color: #d7dae0; border-radius: 9px; padding: 13px 15px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7; white-space: pre-wrap;
  word-break: break-all; margin: 0; max-height: 260px; overflow: auto;
}
.console .c-err { color: #ff8a8a; }
.console .c-dim { color: #7d8798; }
.empty-tip { color: var(--muted-2); font-size: 13.5px; text-align: center; padding: 30px 0; }

/* ---------- 实战项目 ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.proj-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 26px; transition: .18s; cursor: pointer; display: flex; flex-direction: column;
}
.proj-card:hover { border-color: var(--brand-line); box-shadow: var(--shadow); transform: translateY(-2px); }
.proj-cover {
  height: 6px; border-radius: 3px; margin-bottom: 16px;
  background: linear-gradient(90deg, var(--brand), #f5a623);
}
.proj-card h3 { font-size: 17.5px; margin-bottom: 6px; }
.proj-card h3 a { color: var(--text); }
.proj-card h3 a:hover { color: var(--brand-deep); }
.proj-sub { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.proj-sum { font-size: 14px; color: var(--text-2); margin-bottom: 14px; flex: 1; }
.proj-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.proj-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted-2); }

.timeline { margin-top: 8px; }
.tl-item { display: grid; grid-template-columns: 30px 1fr; gap: 14px; padding-bottom: 22px; position: relative; }
.tl-item::before {
  content: ""; position: absolute; left: 14px; top: 28px; bottom: 0;
  width: 2px; background: var(--border);
}
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-deep); font-family: var(--mono);
  font-size: 12px; font-weight: 700; border: 2px solid var(--surface); z-index: 1;
}
.tl-body h4 { font-size: 15.5px; margin-bottom: 6px; }
.tl-body p { font-size: 14px; color: var(--text-2); margin-bottom: 10px; }

.pitfalls { background: var(--amber-soft); border: 1px solid #f2e0b6; border-radius: var(--radius); padding: 20px 24px; margin-top: 26px; }
.pitfalls h3 { font-size: 15.5px; color: var(--amber); margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.pitfalls ul { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 14px; }
.pitfalls li { margin-bottom: 6px; }

.goal-list { list-style: none; padding: 0; margin: 0 0 20px; }
.goal-list li { padding-left: 24px; position: relative; margin-bottom: 8px; color: var(--text-2); font-size: 14.5px; }
.goal-list li::before {
  content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700;
}

.stack-row { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 26px; }
.stack-pill {
  font-size: 12.5px; padding: 4px 11px; border-radius: 6px;
  background: var(--link-soft); color: var(--link); font-weight: 500;
}

/* ---------- 八股 ---------- */
.note-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 26px; align-items: start; }
.note-side { position: sticky; top: 82px; }
.note-side h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); margin-bottom: 12px; }
.cat-nav { list-style: none; margin: 0; padding: 0; }
.cat-nav button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px;
  border: 0; background: none; border-radius: 8px; cursor: pointer;
  font-size: 14px; color: var(--text-2); text-align: left; font-family: inherit; transition: .15s;
}
.cat-nav button:hover { background: var(--bg-alt); }
.cat-nav button.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }
.cat-nav .cnt { margin-left: auto; font-size: 11.5px; color: var(--muted-2); font-family: var(--mono); }

.note-list { display: grid; gap: 14px; }
.note-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: .16s; overflow: hidden;
}
.note-item.open { border-color: var(--brand-line); box-shadow: var(--shadow-sm); }
.note-q {
  display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px;
  cursor: pointer; font-size: 15px; font-weight: 600; color: var(--text);
}
.note-q:hover { background: var(--surface-2); }
.note-q .q-mark { color: var(--brand); font-family: var(--mono); flex-shrink: 0; }
.note-q .arrow { margin-left: auto; color: var(--muted-2); transition: transform .2s; flex-shrink: 0; }
.note-item.open .note-q .arrow { transform: rotate(90deg); }
.note-a { padding: 0 20px 20px 52px; display: none; }
.note-item.open .note-a { display: block; }
.note-a .md { font-size: 14.5px; }
.note-a .md h2 { font-size: 15px; margin: 16px 0 8px; border: 0; padding: 0; }
.note-a .md h3 { font-size: 14.5px; margin: 14px 0 8px; }

/* ---------- 搜索结果 ---------- */
.result-group { margin-bottom: 28px; }
.result-group h3 { font-size: 14px; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em; }
.result-item {
  display: block; padding: 14px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 9px;
  transition: .15s;
}
.result-item:hover { border-color: var(--brand-line); }
.result-item h4 { font-size: 15px; margin-bottom: 4px; color: var(--text); }
.result-item p { font-size: 13.5px; color: var(--muted); margin: 0; }
.result-item mark { background: #ffe9a8; color: inherit; padding: 0 2px; border-radius: 2px; }

/* ---------- 空态 ---------- */
.empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty .big { font-size: 34px; margin-bottom: 10px; }

/* ---------- 分页/加载 ---------- */
.fade-in { animation: fadeIn .28s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 页脚 ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 44px 0 26px; margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 1.4fr 2fr; gap: 40px; padding-bottom: 30px; }
.footer-brand p { font-size: 13.5px; color: var(--muted); margin-top: 12px; }
.footer-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.footer-links h4 { font-size: 13px; margin-bottom: 12px; color: var(--text); }
.footer-links a, .footer-links .muted { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 8px; }
.footer-links a:hover { color: var(--brand-deep); }
.copyright { border-top: 1px solid var(--border); padding-top: 20px; font-size: 12.5px; color: var(--muted-2); }

/* ---------- 代码高亮配色 ---------- */
.tok-key { color: #8250df; }
.tok-str { color: #0a7c42; }
.tok-num { color: #b5283f; }
.tok-com { color: #8a919e; font-style: italic; }
.tok-ann { color: #b7791f; }
.tok-typ { color: #0f6fa8; }
.tok-fun { color: #1a6b4e; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .article-layout { grid-template-columns: 1fr; }
  .toc-card { display: none; }
  .prob-layout { grid-template-columns: 1fr; }
  .note-layout { grid-template-columns: 1fr; }
  .note-side { position: static; }
  .cat-nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .cat-nav button { width: auto; }
  .cat-nav .cnt { margin-left: 4px; }
}
@media (max-width: 880px) {
  .nav {
    position: absolute; top: 62px; left: 0; right: 0; flex-direction: column;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 8px 16px 14px; gap: 2px; display: none; box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 12px; }
  .nav-toggle { display: block; }
  .search-box { width: 170px; }
  .search-box kbd { display: none; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 32px 26px; }
  .hero h1 { font-size: 26px; }
  .article-main { padding: 28px 22px 34px; }
  .article-title { font-size: 24px; }
  .footer-inner { grid-template-columns: 1fr; gap: 26px; }
  .prob-row { grid-template-columns: 34px 1fr 70px; }
  .prob-row .prob-tags, .prob-row .prob-status { display: none; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  main { padding: 22px 16px 56px; }
  .header-inner { gap: 12px; }
  .brand-text em { display: none; }
  .search-box { width: 42px; }
  .search-box input { display: none; }
  .search-box:focus-within { width: 200px; position: absolute; right: 16px; z-index: 10; }
  .search-box:focus-within input { display: block; }
  .proj-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .footer-links { grid-template-columns: 1fr 1fr; }
}

/* ======================================================================
   登录注册 / 点赞收藏 / 评论 / 用户中心 新增样式
   ====================================================================== */

/* ---- 用户区域 ---- */
.user-area { display: flex; align-items: center; gap: 8px; }
.user-menu { position: relative; }
.user-menu-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 20px;
  background: var(--surface); cursor: pointer; font-size: 13px; color: var(--text);
  transition: border-color .2s;
}
.user-menu-btn:hover { border-color: var(--brand); }
.user-avatar-sm {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.user-name { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 160px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 6px 0; display: none; z-index: 100;
}
.user-dropdown.show { display: block; }
.user-dropdown a, .user-dropdown button {
  display: block; width: 100%; text-align: left; padding: 8px 14px;
  font-size: 14px; color: var(--text-2); background: none; border: none; cursor: pointer;
  text-decoration: none;
}
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--bg-alt); color: var(--brand); }

/* ---- 模态框 ---- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: none; align-items: center; justify-content: center; z-index: 1000;
}
.modal-mask.show { display: flex; }
.modal-box {
  background: var(--surface); border-radius: var(--radius); padding: 28px 30px;
  width: 90%; max-width: 380px; box-shadow: var(--shadow-lg); position: relative;
}
.modal-close {
  position: absolute; right: 12px; top: 12px; width: 28px; height: 28px;
  border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--text); }
.modal-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.modal-tab {
  flex: 1; padding: 10px; border: none; background: none; cursor: pointer;
  font-size: 15px; color: var(--muted); border-bottom: 2px solid transparent;
  transition: all .2s;
}
.modal-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.modal-form .form-group { margin-bottom: 14px; }
.modal-form label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-2); }
.modal-form input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; background: var(--surface-2); transition: border-color .2s;
}
.modal-form input:focus { outline: none; border-color: var(--brand); }
.form-error { color: var(--red); font-size: 13px; margin-bottom: 12px; min-height: 18px; }
.btn-block { width: 100%; }
.modal-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; }

/* ---- 点赞收藏按钮 ---- */
.action-bar {
  display: flex; gap: 12px; align-items: center; margin: 24px 0;
  padding: 16px 20px; background: var(--bg-alt); border-radius: var(--radius-sm);
}
.action-btn {
  display: flex; align-items: center; gap: 6px; padding: 8px 16px;
  border: 1px solid var(--border); border-radius: 20px; background: var(--surface);
  cursor: pointer; font-size: 14px; color: var(--text-2); transition: all .2s;
}
.action-btn:hover { border-color: var(--brand); color: var(--brand); }
.action-btn.active { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.action-icon { font-size: 16px; }
.action-count { font-weight: 600; }

/* ---- 评论区 ---- */
.comment-section { margin-top: 36px; }
.comment-input-area {
  margin-bottom: 24px;
}
.comment-input {
  width: 100%; min-height: 80px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--sans); resize: vertical;
  background: var(--surface-2); color: var(--text);
}
.comment-input:focus { outline: none; border-color: var(--brand); }
.comment-input-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.comment-tip { font-size: 12px; color: var(--muted); }
.comment-list { display: flex; flex-direction: column; gap: 16px; }
.comment-item { display: flex; gap: 12px; }
.comment-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600;
}
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-user { font-weight: 600; font-size: 14px; }
.comment-time { font-size: 12px; color: var(--muted-2); }
.comment-del {
  margin-left: auto; font-size: 12px; color: var(--muted); background: none; border: none;
  cursor: pointer; padding: 0 4px;
}
.comment-del:hover { color: var(--red); }
.comment-text { font-size: 14px; color: var(--text-2); line-height: 1.6; word-break: break-word; }
.comment-text code { background: var(--bg-alt); padding: 1px 4px; border-radius: 3px; font-size: 13px; }
.comment-actions { display: flex; gap: 14px; margin-top: 8px; }
.comment-actions button {
  font-size: 12px; color: var(--muted); background: none; border: none; cursor: pointer; padding: 0;
}
.comment-actions button:hover { color: var(--brand); }
.comment-actions button.active { color: var(--brand); }
.comment-loading, .comment-empty { text-align: center; padding: 30px; color: var(--muted); font-size: 14px; }

/* ---- 用户中心 ---- */
.user-profile { display: flex; align-items: center; gap: 16px; }
.user-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 600; flex-shrink: 0;
}
.user-info { flex: 1; }
.user-info h2 { font-size: 20px; margin-bottom: 2px; }
.user-tabs { display: flex; border-bottom: 1px solid var(--border); }
.user-tab {
  padding: 14px 20px; border: none; background: none; cursor: pointer;
  font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; transition: all .2s;
}
.user-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.user-tab-content { min-height: 200px; padding: 0; }
.user-item { padding: 14px 20px; border-bottom: 1px solid var(--bg-alt); }
.user-item:last-child { border-bottom: none; }
.user-item a { text-decoration: none; display: block; }
.user-item h4 { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.user-item p { font-size: 14px; color: var(--text-2); margin-bottom: 4px; }
.user-item a:hover h4 { color: var(--brand); }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  padding: 10px 24px; border-radius: 24px; font-size: 14px; color: #fff;
  opacity: 0; transition: all .3s; z-index: 2000; pointer-events: none;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--blue); }

/* ---- 响应式 ---- */
@media (max-width: 768px) {
  .user-name { display: none; }
  .action-bar { flex-wrap: wrap; padding: 12px 14px; }
  .modal-box { padding: 24px 20px; }
}
