/* ============================================================
   优选网站项目 · 全局样式表 style.css
   设计维度：色彩 / 字体 / 框架布局 / 人机交互
   参考风格：以撒维基(卡片模块)、国博官网(克制留白)、
             明日方舟世界观页(深色主题 + 左侧导航 + 点阵动效)
   ============================================================ */

/* ---------- 一、色彩体系（CSS 变量） ---------- */
:root {
  /* 底色：深海军蓝黑，降低视觉干扰，突出内容（借鉴明日方舟深色主题） */
  --bg: #0b0f17;
  --bg-soft: #0e1420;
  --panel: #131b2a;
  --panel-2: #182235;
  --card: rgba(22, 32, 47, 0.72);
  --card-hover: rgba(28, 42, 62, 0.92);
  --border: #1f2c40;
  --border-light: #2a3a55;

  /* 文字层级：主文字 / 次要文字 / 弱化文字 */
  --text: #e8eef7;
  --text-2: #a3b1c7;
  --text-3: #66758d;

  /* 强调色：取自粒子背景主色 rgba(54,184,235,0.65) 的 #36b8eb */
  --accent: #36b8eb;
  --accent-soft: rgba(54, 184, 235, 0.14);
  --accent-strong: #7dd3fc;
  --amber: #f5b544;      /* 少量暖色点缀，用于徽标与高亮 */
  --amber-soft: rgba(245, 181, 68, 0.14);
  --green: #4ade80;
  --danger: #f87171;

  /* 渐变（克制使用） */
  --grad: linear-gradient(135deg, #36b8eb 0%, #5b8cff 100%);

  /* 圆角与阴影 */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --glow: 0 0 0 1px rgba(54, 184, 235, 0.35), 0 8px 30px rgba(54, 184, 235, 0.12);

  /* 侧栏宽度 */
  --sidebar-w: 248px;
}

/* ---------- 二、字体体系 ---------- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
}

/* 代码 / 品牌数字使用等宽字体 */
code, pre, .mono, .brand-sub, .hero-code {
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}

/* ---------- 三、基础重置与通用 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

ul, ol { list-style: none; }

img, svg { display: block; }

::selection { background: rgba(54, 184, 235, 0.35); color: #fff; }

/* 滚动条（深色适配） */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #243349; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #2f4a68; }
::-webkit-scrollbar-track { background: var(--bg); }

/* ---------- 四、框架布局：左侧固定导航 + 右侧主内容 ---------- */
.layout {
  display: flex;
  min-height: 100vh;
}

/* --- 左侧边栏 --- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 28px 18px 20px;
  background: linear-gradient(180deg, rgba(14, 20, 32, 0.96), rgba(9, 13, 21, 0.96));
  border-right: 1px solid var(--border);
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 22px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--grad);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0;
  box-shadow: 0 6px 18px rgba(54, 184, 235, 0.35);
}

.brand-name { font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.brand-sub { font-size: 11px; color: var(--text-3); letter-spacing: 2px; margin-top: 2px; }

/* 侧栏导航：竖排文字导航（借鉴明日方舟左侧导航） */
.sidebar-nav { margin-top: 26px; display: flex; flex-direction: column; gap: 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14.5px;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  position: relative;
}

.nav-item svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.nav-item:hover {
  color: var(--text);
  background: rgba(54, 184, 235, 0.08);
}

.nav-item.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: rgba(54, 184, 235, 0.35);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-item .tag {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--amber-soft);
  color: var(--amber);
  letter-spacing: 1px;
}

/* 侧栏底部：作者信息（化名 + 学号） */
.sidebar-foot {
  margin-top: auto;
  padding: 16px 10px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  line-height: 2;
}
.sidebar-foot .stu-id {
  display: inline-block;
  font-family: "JetBrains Mono", Consolas, monospace;
  color: var(--accent-strong);
  letter-spacing: 1px;
}

/* --- 右侧主内容区 --- */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 40px 48px 60px;
  min-width: 0;
}

.container { max-width: 1080px; margin: 0 auto; }

/* 页面头部 */
.page-head { margin-bottom: 34px; }

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 14px;
}
.crumb a:hover { color: var(--accent-strong); }
.crumb .sep { opacity: 0.6; }

.page-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.page-title .bar {
  width: 5px;
  height: 26px;
  border-radius: 3px;
  background: var(--grad);
}

.page-desc { color: var(--text-2); margin-top: 10px; max-width: 760px; }

/* ---------- 五、粒子背景画布 ---------- */
#particle-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

/* ---------- 六、首页 Hero ---------- */
.hero {
  padding: 56px 8px 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 34px;
}

.hero-code {
  font-size: 13px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(54, 184, 235, 0.3);
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}

.hero h1 {
  font-size: 40px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 1px;
}

.hero h1 .grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p.lead {
  margin-top: 16px;
  color: var(--text-2);
  font-size: 16px;
  max-width: 720px;
}

.hero-meta {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 12.5px;
  color: var(--text-2);
  border: 1px solid var(--border-light);
  background: var(--panel);
}

.chip b { color: var(--accent-strong); font-weight: 600; }

/* ---------- 七、卡片组件（借鉴以撒维基模块化卡片布局） ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 21px;
  font-weight: 800;
  margin: 40px 0 20px;
}

.section-title .no {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 13px;
  color: var(--accent);
  border: 1px solid rgba(54, 184, 235, 0.45);
  border-radius: 6px;
  padding: 2px 9px;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-light), transparent);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease, background 0.28s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(54, 184, 235, 0.5);
  background: var(--card-hover);
  box-shadow: var(--glow);
}

.card .icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-bottom: 14px;
}

.card .icon svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }

.card p { font-size: 13.5px; color: var(--text-2); }

.card .link-more {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--accent);
  transition: gap 0.2s ease;
}
.card .link-more:hover { gap: 9px; color: var(--accent-strong); }

/* 参考网站评价卡 */
.site-card { display: flex; flex-direction: column; }
.site-card .site-tag {
  align-self: flex-start;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}
.site-tag.wiki { background: rgba(74, 222, 128, 0.14); color: var(--green); }
.site-tag.museum { background: var(--amber-soft); color: var(--amber); }
.site-tag.game { background: var(--accent-soft); color: var(--accent-strong); }
.site-card .site-url { font-size: 12px; color: var(--text-3); word-break: break-all; margin-bottom: 10px; }
.site-card h3 { font-size: 15.5px; }
.site-card p { font-size: 13px; }

/* ---------- 八、表格（对比表） ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  margin: 20px 0;
}

table.compare {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

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

table.compare th {
  background: var(--panel-2);
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

table.compare td { color: var(--text-2); }
table.compare tr:last-child td { border-bottom: none; }
table.compare td b { color: var(--text); }

/* ---------- 九、学习章节（study 页） ---------- */
.note-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 22px;
  border-left: 4px solid var(--accent);
}

.note-block h2 { font-size: 19px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.note-block h2 .k { font-size: 12px; color: var(--accent-strong); }

.note-block p { color: var(--text-2); margin-bottom: 10px; }
.note-block p b { color: var(--text); }

.note-list li {
  position: relative;
  padding-left: 20px;
  color: var(--text-2);
  margin-bottom: 8px;
  font-size: 14px;
}

.note-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(54, 184, 235, 0.7);
}

/* 代码块 */
.code-box {
  background: #0a0e16;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 12px 0;
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  color: #cfe3f5;
}

.code-box .cm { color: #5b6b80; }
.code-box .ck { color: #7dd3fc; }
.code-box .cv { color: #f5b544; }

/* ---------- 十、留言板（guestbook 页） ---------- */
.gb-layout {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 24px;
  align-items: start;
}

.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.form-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-card .form-tip { font-size: 12.5px; color: var(--text-3); margin-bottom: 18px; }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 7px;
}

.field label .req { color: var(--danger); }

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(54, 184, 235, 0.15);
}

.field textarea { min-height: 96px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.22s ease;
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 18px rgba(54, 184, 235, 0.3);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(54, 184, 235, 0.42); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-light);
}

.btn-ghost:hover { color: var(--text); border-color: var(--text-3); }

.btn-sm { padding: 6px 14px; font-size: 12.5px; }

.btn-danger-ghost {
  background: transparent;
  color: var(--text-3);
  border: 1px solid var(--border-light);
  font-size: 12.5px;
  padding: 6px 14px;
}
.btn-danger-ghost:hover { color: var(--danger); border-color: rgba(248, 113, 113, 0.5); }

/* 留言列表 */
.gb-list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.gb-count {
  font-size: 13px;
  color: var(--text-2);
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid rgba(54, 184, 235, 0.3);
  padding: 3px 12px;
  border-radius: 20px;
}

.msg-list { display: flex; flex-direction: column; gap: 14px; }

.msg-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  animation: msgIn 0.35s ease both;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.msg-name { font-size: 14px; font-weight: 700; }

.msg-time { font-size: 12px; color: var(--text-3); }

.msg-body { font-size: 14px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }

.msg-empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--text-3);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  font-size: 13.5px;
}

/* 后端预留说明 */
.reserved-note {
  margin-top: 22px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  border: 1px solid rgba(245, 181, 68, 0.35);
  font-size: 13px;
  color: #e8c98a;
  line-height: 1.8;
}
.reserved-note code {
  color: var(--amber);
  font-size: 12px;
}

/* ---------- 十一、Toast / 返回顶部 ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%) translateY(20px);
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border-light);
  padding: 11px 22px;
  border-radius: 30px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 200;
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { border-color: rgba(74, 222, 128, 0.5); color: var(--green); }
#toast.err { border-color: rgba(248, 113, 113, 0.5); color: var(--danger); }

#back-top {
  position: fixed;
  right: 26px;
  bottom: 30px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border-light);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s ease;
  z-index: 100;
}

#back-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
#back-top:hover { color: var(--accent-strong); border-color: var(--accent); }

/* ---------- 十二、页脚 ---------- */
.footer {
  margin-top: 52px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.footer .mono { color: var(--accent-strong); }

/* ---------- 十三、滚动显现与动效 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---------- 十四、响应式 ---------- */
@media (max-width: 1000px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .gb-layout { grid-template-columns: 1fr; }
  .main { padding: 32px 24px 48px; }
}

@media (max-width: 760px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 8px 10px;
    border-right: none;
    border-top: 1px solid var(--border);
    background: rgba(9, 13, 21, 0.96);
  }
  .brand, .sidebar-foot { display: none; }
  .sidebar-nav {
    flex-direction: row;
    margin: 0;
    width: 100%;
    justify-content: space-around;
    gap: 4px;
  }
  .nav-item { flex-direction: column; gap: 3px; padding: 6px 10px; font-size: 11.5px; }
  .nav-item .tag { display: none; }
  .main { margin-left: 0; padding: 24px 16px 100px; }
  .hero { padding: 30px 4px 26px; }
  .hero h1 { font-size: 27px; }
  .card-grid, .card-grid.cols-2 { grid-template-columns: 1fr; }
  .page-title { font-size: 23px; }
}

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