/* ============================================================
   Local LLM Hub — 站点样式
   浅色主题 / 渐变光晕 / 虚线边框 / 3D 抬升 / 响应式
   ============================================================ */

:root {
  --bg: #f6f8fc;
  --bg-grad-1: #eef4ff;
  --bg-grad-2: #f7f2ff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.10);
  --border-dash: rgba(99, 102, 241, 0.45);
  --text: #16203a;
  --text-soft: #4b5772;
  --text-mute: #7b86a1;
  --brand: #4f46e5;
  --brand-2: #0ea5e9;
  --brand-3: #7c3aed;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow-sm: 0 2px 10px rgba(23, 33, 61, 0.06);
  --shadow-md: 0 12px 32px rgba(23, 33, 61, 0.10);
  --shadow-lg: 0 24px 60px rgba(23, 33, 61, 0.14);
  --glow: 0 0 0 1px rgba(99, 102, 241, 0.18), 0 12px 40px rgba(79, 70, 229, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --sans: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 8% -8%, #e0ecff 0%, transparent 60%),
    radial-gradient(900px 560px at 96% 4%, #f1e4ff 0%, transparent 58%),
    linear-gradient(180deg, var(--bg-grad-1) 0%, var(--bg) 42%, var(--bg-grad-2) 100%);
  background-attachment: fixed;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-3); }

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 26px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 26px 24px 80px;
}

/* ---------- 侧边栏 ---------- */
.sidebar { position: sticky; top: 22px; align-self: start; }

.brand-card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 18px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.brand-card::before {
  content: "";
  position: absolute; inset: -40% -60% auto auto;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(79,70,229,.28), transparent 70%);
  filter: blur(6px);
}
.brand-title {
  font-size: 19px; font-weight: 800; letter-spacing: .3px;
  background: linear-gradient(92deg, var(--brand) 0%, var(--brand-2) 55%, var(--brand-3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: 12.5px; color: var(--text-mute); margin-top: 4px; }

.nav {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 12px;
}
.nav-group-title {
  font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-mute); padding: 10px 12px 6px; font-weight: 700;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 11px;
  color: var(--text-soft); font-size: 14.2px; font-weight: 600;
  transition: transform .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}
.nav a .ico { width: 22px; text-align: center; font-size: 15px; }
.nav a:hover {
  background: rgba(79, 70, 229, .08); color: var(--brand);
  transform: translateX(3px);
}
.nav a.active {
  background: linear-gradient(96deg, rgba(79,70,229,.14), rgba(14,165,233,.14));
  color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(79,70,229,.22);
}

.status-mini {
  margin-top: 14px; padding: 12px;
  border: 1px dashed var(--border-dash); border-radius: var(--radius-sm);
  background: rgba(255,255,255,.6);
  font-size: 12.5px; color: var(--text-soft);
}
.status-mini .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-mute); margin-right: 6px; vertical-align: 1px;
}
.status-mini .dot.on { background: var(--ok); box-shadow: 0 0 10px rgba(5,150,105,.7); }
.status-mini .dot.off { background: #cbd5e1; }

/* ---------- 主内容 ---------- */
.main { min-width: 0; }

.hero {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 30px 30px 26px;
  position: relative; overflow: hidden;
  margin-bottom: 22px;
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,.22), transparent 68%);
}
.hero h1 {
  margin: 0 0 8px; font-size: 29px; line-height: 1.3; font-weight: 850; letter-spacing: .2px;
}
.hero h1 .grad {
  background: linear-gradient(92deg, var(--brand) 0%, var(--brand-2) 50%, var(--brand-3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { margin: 0; color: var(--text-soft); font-size: 14.8px; max-width: 78ch; }

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.badge {
  font-size: 12.2px; font-weight: 650; padding: 4px 11px; border-radius: 999px;
  border: 1px dashed var(--border-dash); background: rgba(255,255,255,.75); color: var(--text-soft);
}
.badge.solid {
  border: none; color: #fff;
  background: linear-gradient(96deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 18px rgba(79,70,229,.24);
}

/* ---------- 卡片 / 区块 ---------- */
.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.section-head h2 {
  margin: 0; font-size: 21px; font-weight: 800; letter-spacing: .2px;
}
.section-head .rule {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(79,70,229,.35), rgba(14,165,233,.05));
}
.section-head .hint { font-size: 12.5px; color: var(--text-mute); }

.card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: rgba(79,70,229,.28); }
.card h3 { margin: 0 0 8px; font-size: 16.5px; font-weight: 800; }
.card p { margin: 0 0 8px; font-size: 14.3px; color: var(--text-soft); }
.card ul { margin: 8px 0 0; padding-left: 20px; color: var(--text-soft); font-size: 14.2px; }
.card li { margin-bottom: 5px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* 概念卡：3D 抬升 + 虚线边框 */
.concept {
  position: relative;
  border: 1px dashed var(--border-dash);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(247,248,255,.72));
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .25s cubic-bezier(.2,.8,.3,1), box-shadow .25s ease;
  transform-style: preserve-3d;
}
.concept:hover { transform: translateY(-6px) rotateX(2deg); box-shadow: var(--glow); }
.concept .kicker {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 1px;
  color: var(--brand-2); font-weight: 700; text-transform: uppercase;
}
.concept h3 { margin: 6px 0 6px; font-size: 17px; font-weight: 800; }
.concept .analogy {
  margin-top: 10px; padding: 8px 10px; border-radius: 10px;
  background: rgba(14,165,233,.08); border-left: 3px solid var(--brand-2);
  font-size: 13.2px; color: var(--text-soft);
}

/* 统计块 */
.stat {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  padding: 16px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat .num {
  font-size: 26px; font-weight: 850; line-height: 1.2;
  background: linear-gradient(92deg, var(--brand), var(--brand-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .lbl { font-size: 12.6px; color: var(--text-mute); margin-top: 2px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-solid); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13.8px; min-width: 620px; }
thead th {
  text-align: left; padding: 12px 14px; font-size: 13px; font-weight: 800; color: #fff;
  background: linear-gradient(96deg, var(--brand), var(--brand-2));
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-top: 1px solid var(--border); color: var(--text-soft); vertical-align: top; }
tbody tr:nth-child(even) { background: rgba(79,70,229,.035); }
tbody tr:hover { background: rgba(14,165,233,.07); }
td strong { color: var(--text); }
.pick { color: var(--ok); font-weight: 800; }

/* ---------- 代码 / 命令 ---------- */
pre, code { font-family: var(--mono); }
.code {
  position: relative; margin: 12px 0;
  background: #101528; color: #dbe4ff; border-radius: var(--radius-sm);
  padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.7;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), var(--shadow-md);
}
.code .c { color: #7f8bb0; }
.code .k { color: #7dd3fc; }
.code .s { color: #a7f3d0; }
.code-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: #93a4c8; margin-bottom: 8px; font-family: var(--mono);
}
.copy-btn {
  border: 1px dashed var(--border-dash); background: rgba(255,255,255,.7);
  color: var(--text-soft); font-size: 12px; padding: 3px 10px; border-radius: 8px; cursor: pointer;
  font-family: var(--sans);
}
.copy-btn:hover { background: rgba(79,70,229,.1); color: var(--brand); }
.inline-code {
  background: rgba(79,70,229,.09); color: var(--brand); padding: 1px 6px;
  border-radius: 6px; font-size: 12.8px; border: 1px dashed rgba(79,70,229,.3);
}

/* ---------- 时间线 / 流程 ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(180deg, var(--brand), var(--brand-2), var(--brand-3));
  opacity: .5;
}
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 7px; width: 12px; height: 12px;
  border-radius: 50%; background: #fff; border: 3px solid var(--brand);
  box-shadow: 0 0 0 4px rgba(79,70,229,.12);
}
.tl-item h4 { margin: 0 0 4px; font-size: 15.4px; font-weight: 800; }
.tl-item .meta { font-size: 12.4px; color: var(--text-mute); margin-bottom: 4px; font-family: var(--mono); }
.tl-item p { margin: 0; font-size: 14px; color: var(--text-soft); }

.steps { counter-reset: st; }
.step {
  display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 14px;
  padding: 14px; border-radius: var(--radius-sm);
  border: 1px dashed var(--border-dash); background: rgba(255,255,255,.72);
  margin-bottom: 12px;
}
.step .n {
  counter-increment: st; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 850; color: #fff; font-size: 16px;
  background: linear-gradient(140deg, var(--brand), var(--brand-3));
  box-shadow: 0 8px 20px rgba(79,70,229,.28);
}
.step .n::before { content: counter(st); }
.step h4 { margin: 0 0 4px; font-size: 15.2px; font-weight: 800; }
.step p { margin: 0; font-size: 14px; color: var(--text-soft); }

/* ---------- 折叠（答辩题） ---------- */
details.acc {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-solid); margin-bottom: 10px; box-shadow: var(--shadow-sm);
  overflow: hidden;
}
details.acc > summary {
  cursor: pointer; padding: 14px 16px; font-weight: 750; font-size: 14.8px;
  list-style: none; display: flex; gap: 10px; align-items: flex-start;
  transition: background .18s ease;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::before {
  content: "＋"; color: var(--brand); font-weight: 900; flex: 0 0 auto;
}
details.acc[open] > summary::before { content: "－"; }
details.acc > summary:hover { background: rgba(79,70,229,.06); }
details.acc .body { padding: 0 16px 16px 38px; font-size: 14.2px; color: var(--text-soft); }
details.acc .body strong { color: var(--text); }

/* ---------- 聊天控制台 ---------- */
.console {
  border: 1px solid var(--border); border-radius: 22px; overflow: hidden;
  background: var(--surface-solid); box-shadow: var(--shadow-lg);
}
.console-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(96deg, rgba(79,70,229,.08), rgba(14,165,233,.08));
}
.console-bar label { font-size: 12.6px; color: var(--text-soft); font-weight: 700; }
.console-bar input[type=text], .console-bar select {
  font-family: var(--mono); font-size: 12.8px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--text);
}
.console-bar input[type=text] { min-width: 190px; flex: 1 1 190px; }
.btn {
  border: none; cursor: pointer; font-family: var(--sans); font-weight: 750; font-size: 13.2px;
  padding: 8px 16px; border-radius: 10px; color: #fff;
  background: linear-gradient(96deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 20px rgba(79,70,229,.26);
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(79,70,229,.32); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.ghost {
  background: #fff; color: var(--brand);
  border: 1px dashed var(--border-dash); box-shadow: none;
}
.btn.ghost:hover { background: rgba(79,70,229,.07); }

.chat-log {
  height: 420px; overflow-y: auto; padding: 18px; background:
    linear-gradient(180deg, rgba(246,248,252,.6), rgba(255,255,255,.4));
}
.msg { display: flex; gap: 10px; margin-bottom: 14px; }
.msg .avatar {
  flex: 0 0 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-size: 14px; color: #fff; background: linear-gradient(140deg, var(--brand), var(--brand-3));
}
.msg.user .avatar { background: linear-gradient(140deg, #0ea5e9, #059669); }
.msg .bubble {
  max-width: 88%; padding: 11px 14px; border-radius: 14px; font-size: 14.2px;
  background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  white-space: pre-wrap; word-break: break-word;
}
.msg.user .bubble { background: linear-gradient(96deg, rgba(79,70,229,.08), rgba(14,165,233,.08)); }
.msg .src { font-size: 11.8px; color: var(--text-mute); margin-top: 6px; }
.msg .src b { color: var(--brand); }

.composer { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--border); background: #fff; }
.composer textarea {
  flex: 1; resize: vertical; min-height: 60px; font-family: var(--sans); font-size: 14px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; color: var(--text);
}
.composer textarea:focus { outline: 2px solid rgba(79,70,229,.28); border-color: var(--brand); }

.retrieval {
  padding: 12px 16px; border-top: 1px dashed var(--border-dash);
  background: rgba(14,165,233,.05); font-size: 13px; color: var(--text-soft);
}
.retrieval h5 { margin: 0 0 8px; font-size: 13px; color: var(--brand); font-weight: 800; }
.retrieval .hit {
  border-left: 3px solid var(--brand-2); padding: 6px 10px; margin-bottom: 8px;
  background: #fff; border-radius: 8px; font-size: 12.8px;
}
.retrieval .hit .t { font-weight: 750; color: var(--text); }
.retrieval .hit .sc { float: right; font-family: var(--mono); color: var(--text-mute); }

/* ---------- 提示 / 注意 ---------- */
.note {
  border-left: 4px solid var(--brand-2); border-radius: 10px;
  background: rgba(14,165,233,.08); padding: 12px 14px; font-size: 13.8px; color: var(--text-soft);
  margin: 12px 0;
}
.note.warn { border-color: var(--warn); background: rgba(217,119,6,.09); }
.note.danger { border-color: var(--danger); background: rgba(220,38,38,.08); }
.note.ok { border-color: var(--ok); background: rgba(5,150,105,.08); }
.note b { color: var(--text); }

/* ---------- 页脚 ---------- */
.footer {
  max-width: 1440px; margin: 0 auto; padding: 24px;
  color: var(--text-mute); font-size: 12.8px; text-align: center;
  border-top: 1px dashed var(--border-dash);
}

/* ---------- 返回顶部 ---------- */
#topBtn {
  position: fixed; right: 22px; bottom: 22px; width: 44px; height: 44px; border-radius: 50%;
  border: none; cursor: pointer; display: none; place-items: center; color: #fff; font-size: 18px;
  background: linear-gradient(140deg, var(--brand), var(--brand-3));
  box-shadow: 0 12px 28px rgba(79,70,229,.34); z-index: 60;
}
#topBtn.show { display: grid; }

/* ---------- 移动端 ---------- */
.nav-toggle {
  display: none; width: 100%; margin-bottom: 12px;
  border: 1px dashed var(--border-dash); background: #fff; color: var(--brand);
  border-radius: 12px; padding: 10px; font-weight: 750; cursor: pointer; font-family: var(--sans);
}
@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 16px 14px 60px; }
  .sidebar { position: static; }
  .nav-toggle { display: block; }
  .nav { display: none; }
  .nav.open { display: block; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 22px 18px; }
  .hero h1 { font-size: 23px; }
  .chat-log { height: 340px; }
}
