/* ==========================================================================
   Nay 的小站 —— 红白蓝 · 极简 · 留白
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --text: #14171c;
  --text-2: #545b68;
  --text-3: #8d939e;
  --line: #e8eaee;
  --line-2: #f1f2f5;
  --red: #e63946;
  --red-soft: #fdeef0;
  --blue: #1d4ed8;
  --blue-soft: #eef2ff;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-2: 0 8px 28px -12px rgba(16, 24, 40, .16);
  --radius: 14px;
  --radius-s: 9px;
  --maxw: 1040px;
  --head-h: 62px;
  color-scheme: light;
}

html[data-theme='dark'] {
  --bg: #0e1013;
  --bg-soft: #14171c;
  --surface: #16191f;
  --surface-2: #1a1e25;
  --text: #e9ebee;
  --text-2: #a2a8b3;
  --text-3: #6e7581;
  --line: #262b33;
  --line-2: #1d2128;
  --red: #ff5d6c;
  --red-soft: #2b1619;
  --blue: #7b97ff;
  --blue-soft: #171e33;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 10px 30px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* hidden 属性必须始终生效：
   否则 .lightbox 这类自带 display:flex 的元素会盖住整个页面 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'HarmonyOS Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 15.5px;
  line-height: 1.75;
  letter-spacing: .005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .25s ease, color .25s ease;
}

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

img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--red); color: #fff; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.narrow { max-width: 720px; margin: 0 auto; }

/* ---------- 顶栏 ---------- */
.site-head {
  position: sticky; top: 0; z-index: 60;
  height: var(--head-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line-2);
}
.head-inner { height: 100%; display: flex; align-items: center; gap: 26px; }

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 15.5px; letter-spacing: -.2px;
  color: var(--text); flex: none;
}
.brand:hover { text-decoration: none; }
.brand-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--red); flex: none;
  box-shadow: 0 0 0 4px var(--red-soft);
}

.nav { display: flex; gap: 2px; flex: 1; }
.nav a {
  color: var(--text-2); font-size: 14.5px; font-weight: 500;
  padding: 7px 13px; border-radius: var(--radius-s);
  transition: background .16s, color .16s; position: relative;
}
.nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav a.on { color: var(--text); font-weight: 600; }
.nav a.on::after {
  content: ''; position: absolute; left: 13px; right: 13px; bottom: 1px;
  height: 2px; background: var(--red); border-radius: 2px;
}

.head-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-2); transition: all .16s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); border-color: var(--text-3); }
.icon-btn svg { width: 17px; height: 17px; }
.menu-btn { display: none; }

/* ---------- 主区域 ---------- */
main { min-height: calc(100vh - var(--head-h) - 200px); padding-bottom: 90px; }

.page { animation: fade .32s ease both; }
@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 首页 Hero ---------- */
.hero { padding: 88px 0 72px; border-bottom: 1px solid var(--line-2); }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--red); margin-bottom: 20px;
}
.hero-eyebrow::before { content: ''; width: 22px; height: 2px; background: var(--red); }
.hero h1 {
  font-size: clamp(34px, 6vw, 56px); line-height: 1.14;
  letter-spacing: -.035em; margin: 0 0 18px; font-weight: 800;
}
.hero h1 .accent { color: var(--red); }
.hero .lede {
  font-size: 17.5px; color: var(--text-2); max-width: 560px;
  margin: 0 0 32px; line-height: 1.7;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px; font-size: 14.5px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  cursor: pointer; transition: all .16s; text-decoration: none;
}
.btn:hover { border-color: var(--text-3); transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: #d12f3d; border-color: #d12f3d; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 15px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.hero-links { display: flex; gap: 18px; margin-top: 30px; font-size: 13.5px; }

/* ---------- 区块 ---------- */
.section { padding: 64px 0; border-bottom: 1px solid var(--line-2); }
.section:last-child { border-bottom: none; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 20px; margin-bottom: 30px;
}
.section-head h2 {
  font-size: 21px; font-weight: 700; letter-spacing: -.02em; margin: 0;
  display: flex; align-items: center; gap: 11px;
}
.section-head h2::before {
  content: ''; width: 4px; height: 18px; border-radius: 3px; background: var(--red);
}
.section-head .more { font-size: 13.5px; color: var(--text-3); font-weight: 500; }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 20px 18px;
  transition: border-color .18s, box-shadow .18s;
}
.stat:hover { border-color: var(--text-3); box-shadow: var(--shadow-1); }
.stat .v {
  font-size: 30px; font-weight: 800; letter-spacing: -.03em;
  line-height: 1.1; font-variant-numeric: tabular-nums;
}
.stat .v small { font-size: 14px; font-weight: 600; color: var(--text-3); margin-left: 3px; }
.stat .k { font-size: 12.5px; color: var(--text-3); margin-top: 6px; letter-spacing: .02em; }
.stat.hl .v { color: var(--red); }

.charts { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; }
.chart-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}
.chart-card h3 {
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  margin: 0 0 14px; letter-spacing: .01em;
}
.chart-card canvas { width: 100%; display: block; }
.legend { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.legend-item {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--text-2);
}
.legend-item i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-item b { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text); }

/* ---------- 作品卡 ---------- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.work-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.work-card:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: transparent;
  text-decoration: none;
}
.work-thumb {
  aspect-ratio: 16 / 10; background: var(--bg-soft); overflow: hidden; position: relative;
}
.work-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.work-card:hover .work-thumb img { transform: scale(1.04); }
.work-thumb .ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: var(--text-3); letter-spacing: -.04em;
}
.work-body { padding: 17px 18px 19px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.work-body h3 { font-size: 15.5px; font-weight: 650; margin: 0; letter-spacing: -.01em; line-height: 1.45; }
.work-body p {
  font-size: 13.2px; color: var(--text-2); margin: 0; line-height: 1.62; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11.5px; padding: 2.5px 9px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--line);
  letter-spacing: .01em; white-space: nowrap;
}
.tag-blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }

/* ---------- 文章列表 ---------- */
.post-list { display: flex; flex-direction: column; }
.post-row {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 22px;
  align-items: baseline; padding: 20px 0;
  border-bottom: 1px solid var(--line-2); text-decoration: none; color: inherit;
  transition: padding-left .18s ease;
}
.post-row:hover { text-decoration: none; padding-left: 8px; }
.post-row:hover .post-row-title { color: var(--red); }
.post-row:last-child { border-bottom: none; }
.post-date {
  font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums;
  letter-spacing: .02em; padding-top: 3px;
}
.post-row-title { font-size: 16.5px; font-weight: 620; letter-spacing: -.012em; transition: color .16s; line-height: 1.5; }
.post-row-excerpt {
  font-size: 13.5px; color: var(--text-2); margin-top: 5px; line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-meta { font-size: 12px; color: var(--text-3); white-space: nowrap; padding-top: 3px; }

/* 筛选 */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 18px 0 6px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px;
}
.filter-bar .search {
  flex: 1; min-width: 180px; border: 1px solid var(--line); background: var(--bg-soft);
  border-radius: 999px; padding: 8px 16px; font-size: 13.5px;
}
.filter-bar .search:focus { outline: none; border-color: var(--blue); background: var(--surface); }
.chip {
  font-size: 13px; padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }

/* ---------- 页头 ---------- */
.page-head { padding: 62px 0 34px; border-bottom: 1px solid var(--line-2); margin-bottom: 10px; }
.page-head h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 0 0 10px; }
.page-head p { color: var(--text-2); font-size: 15px; margin: 0; max-width: 620px; }
.crumb { font-size: 13px; color: var(--text-3); margin-bottom: 16px; display: block; }
.crumb a { color: var(--text-3); }
.crumb a:hover { color: var(--red); }

/* ---------- 文章正文 ---------- */
.article { padding: 52px 0 0; }
.article-head { margin-bottom: 40px; }
.article-head h1 {
  font-size: clamp(27px, 4.2vw, 38px); line-height: 1.25;
  letter-spacing: -.03em; font-weight: 800; margin: 0 0 18px;
}
.article-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-3);
}
.article-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }

.prose { font-size: 16.5px; line-height: 1.85; color: var(--text); }
.prose > *:first-child { margin-top: 0; }
.prose h2 {
  font-size: 23px; font-weight: 700; letter-spacing: -.02em;
  margin: 52px 0 18px; padding-top: 26px; border-top: 1px solid var(--line-2);
}
.prose h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.prose h3 { font-size: 18.5px; font-weight: 700; margin: 34px 0 14px; letter-spacing: -.01em; }
.prose h4 { font-size: 16.5px; font-weight: 700; margin: 26px 0 12px; }
.prose p { margin: 0 0 20px; }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 24px; }
.prose li { margin-bottom: 9px; }
.prose li::marker { color: var(--red); }
.prose ol li::marker { color: var(--blue); font-weight: 600; }
.prose a { border-bottom: 1px solid color-mix(in srgb, var(--blue) 35%, transparent); }
.prose a:hover { text-decoration: none; border-bottom-color: var(--blue); }
.prose strong { font-weight: 700; }
.prose del { color: var(--text-3); }
.prose mark { background: var(--red-soft); color: var(--red); padding: 1px 5px; border-radius: 4px; }
.prose code {
  background: var(--bg-soft); border: 1px solid var(--line);
  padding: 1.5px 6px; border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .87em; color: var(--red);
}
.prose .code-block {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 20px; overflow-x: auto; margin: 0 0 24px;
  position: relative;
}
.prose .code-block code {
  background: none; border: none; padding: 0; color: var(--text-2);
  font-size: 13.2px; line-height: 1.72;
}
.prose .code-block[data-lang]::before {
  content: attr(data-lang); position: absolute; top: 10px; right: 16px;
  font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em;
}
.prose blockquote {
  margin: 0 0 24px; padding: 4px 0 4px 22px;
  border-left: 3px solid var(--red); color: var(--text-2);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 44px 0; }
.prose img { border-radius: 12px; margin: 8px 0 26px; cursor: zoom-in; }

.table-wrap { overflow-x: auto; margin: 0 0 26px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.prose th {
  text-align: left; font-weight: 650; padding: 11px 14px;
  border-bottom: 2px solid var(--text); white-space: nowrap;
}
.prose td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); color: var(--text-2); }
.prose tbody tr:hover td { background: var(--bg-soft); }

.article-foot { margin-top: 60px; padding-top: 28px; border-top: 1px solid var(--line-2); }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.pn {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  text-decoration: none; color: inherit; transition: all .18s; background: var(--surface);
}
.pn:hover { border-color: var(--text-3); transform: translateY(-2px); text-decoration: none; }
.pn .k { font-size: 11.5px; color: var(--text-3); display: block; margin-bottom: 5px; letter-spacing: .04em; }
.pn .t { font-size: 14.5px; font-weight: 600; }
.pn.next { text-align: right; }

/* ---------- 下载 ---------- */
.dl-list { display: flex; flex-direction: column; gap: 12px; }
.dl {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; transition: all .18s;
}
.dl:hover { border-color: var(--text-3); box-shadow: var(--shadow-1); }
.dl-icon {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  background: var(--blue-soft); color: var(--blue);
  display: flex; align-items: center; justify-content: center;
}
.dl-icon svg { width: 19px; height: 19px; }
.dl-body { flex: 1; min-width: 0; }
.dl-body h3 { font-size: 15px; font-weight: 620; margin: 0 0 3px; }
.dl-body p { font-size: 13px; color: var(--text-2); margin: 0; }
.dl-meta { font-size: 12px; color: var(--text-3); margin-top: 5px; display: flex; gap: 8px; align-items: center; }

/* ---------- 导航页 ---------- */
.nav-groups { padding: 34px 0 6px; display: flex; flex-direction: column; gap: 38px; }
.nav-group-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 15px; }
.nav-group-head h2 {
  font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; margin: 0;
  display: flex; align-items: center; gap: 9px;
}
.nav-group-head h2::before {
  content: ''; width: 3px; height: 14px; border-radius: 2px; background: var(--red);
}
.nav-group-head span { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.nav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.nav-site {
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px; height: 62px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); color: inherit;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.nav-site:hover {
  text-decoration: none; transform: translateY(-2px);
  border-color: transparent; box-shadow: var(--shadow-2);
}
.nav-ico {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; letter-spacing: -.02em;
  background: color-mix(in srgb, var(--ico) 13%, transparent);
  color: var(--ico);
}
.nav-txt { min-width: 0; flex: 1; }
.nav-txt b {
  display: block; font-size: 13.8px; font-weight: 620; letter-spacing: -.005em;
  line-height: 20px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-txt i {
  display: block; font-style: normal; font-size: 11.8px; color: var(--text-3);
  line-height: 16px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-arw {
  flex: none; color: var(--text-3); opacity: 0; transform: translate(-4px, 4px);
  transition: all .18s ease;
}
.nav-site:hover .nav-arw { opacity: 1; transform: none; color: var(--red); }

.nav-ico.c0 { --ico: #d92b3a; }
.nav-ico.c1 { --ico: #2f5fe0; }
.nav-ico.c2 { --ico: #0a8bbf; }
.nav-ico.c3 { --ico: #12894f; }
.nav-ico.c4 { --ico: #b9720a; }
.nav-ico.c5 { --ico: #6d3fd4; }
.nav-ico.c6 { --ico: #cf2f7e; }
.nav-ico.c7 { --ico: #0b8073; }
html[data-theme='dark'] .nav-ico.c0 { --ico: #ff6b78; }
html[data-theme='dark'] .nav-ico.c1 { --ico: #7d9bff; }
html[data-theme='dark'] .nav-ico.c2 { --ico: #56c1f0; }
html[data-theme='dark'] .nav-ico.c3 { --ico: #4cd08a; }
html[data-theme='dark'] .nav-ico.c4 { --ico: #e8a33d; }
html[data-theme='dark'] .nav-ico.c5 { --ico: #a98bff; }
html[data-theme='dark'] .nav-ico.c6 { --ico: #f579b6; }
html[data-theme='dark'] .nav-ico.c7 { --ico: #45c9b4; }

.nav-hint {
  margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line-2);
  font-size: 12.5px; color: var(--text-3);
}

/* ---------- AI 对话 ---------- */
.ai-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 22px; padding-top: 34px; align-items: start; }
.role-list { display: flex; flex-direction: column; gap: 8px; }
.role {
  text-align: left; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius); padding: 13px 15px; cursor: pointer; transition: all .16s;
}
.role:hover { border-color: var(--text-3); }
.role.on { border-color: var(--red); background: var(--red-soft); }
.role b { display: block; font-size: 14px; font-weight: 650; margin-bottom: 3px; }
.role span { font-size: 12.2px; color: var(--text-2); line-height: 1.5; display: block; }
.role.on span { color: var(--text-2); }

.chat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); display: flex; flex-direction: column;
  height: 620px; overflow: hidden;
}
.chat-head {
  padding: 14px 20px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 10px;
}
.chat-head b { font-size: 14.5px; }
.chat-head .st { font-size: 12px; color: var(--text-3); margin-left: auto; }
.chat-body { flex: 1; overflow-y: auto; padding: 22px 20px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 11px; max-width: 86%; }
.msg .av {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--blue);
}
.msg .bubble {
  background: var(--bg-soft); border-radius: 4px 13px 13px 13px;
  padding: 11px 15px; font-size: 14.5px; line-height: 1.72; white-space: pre-wrap;
  word-break: break-word;
}
.msg.me { margin-left: auto; flex-direction: row-reverse; }
.msg.me .av { background: var(--red); }
.msg.me .bubble {
  background: var(--blue-soft); color: var(--text);
  border-radius: 13px 4px 13px 13px;
}
.msg.err .bubble { background: var(--red-soft); color: var(--red); }
.chat-foot { border-top: 1px solid var(--line-2); padding: 14px 16px; display: flex; gap: 10px; align-items: flex-end; }
.chat-foot textarea {
  flex: 1; border: 1px solid var(--line); background: var(--bg-soft);
  border-radius: 12px; padding: 11px 14px; resize: none; font-size: 14.5px;
  min-height: 46px; max-height: 140px; line-height: 1.6;
}
.chat-foot textarea:focus { outline: none; border-color: var(--blue); background: var(--surface); }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ---------- 后台 ---------- */
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.admin-tabs button {
  border: none; background: none; padding: 11px 16px; cursor: pointer;
  font-size: 14.5px; font-weight: 550; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .16s;
}
.admin-tabs button:hover { color: var(--text); }
.admin-tabs button.on { color: var(--red); border-bottom-color: var(--red); }

/* ---------- 设备授权（后台） ---------- */
.dev-me {
  font-size: 13px; color: var(--text-3); margin: 16px 0 26px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--bg-soft);
}
.dev-me b.ok { color: var(--red); font-weight: 620; }
.dev-h {
  font-size: 13px; font-weight: 620; color: var(--text-2);
  letter-spacing: .02em; margin: 26px 0 10px;
}
.dev-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-s);
  margin-bottom: 8px; background: var(--surface);
}
.dev-main { min-width: 0; flex: 1; }
.dev-main b {
  display: block; font-size: 14px; font-weight: 620; letter-spacing: -.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dev-meta {
  display: block; font-size: 12px; color: var(--text-3); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dev-actions { display: flex; align-items: center; gap: 8px; }
.dev-name {
  width: 170px; border: 1px solid var(--line); background: var(--bg-soft);
  border-radius: var(--radius-s); padding: 7px 11px; font-size: 13px;
}
.dev-name:focus { outline: none; border-color: var(--red); }
.dev-empty {
  font-size: 13px; color: var(--text-3); padding: 16px 15px;
  border: 1px dashed var(--line); border-radius: var(--radius-s);
}
.dev-state { font-size: 13px; color: var(--text-2); margin-top: 12px; min-height: 18px; }
.code-list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.code-item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--bg-soft);
}
.code-item code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 17px; font-weight: 620; letter-spacing: .06em; color: var(--red);
}

/* ---------- 未授权设备的后台页 ---------- */
.gate { padding-top: 64px; max-width: 620px; }
.gate-mark {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); color: var(--red);
  font-size: 20px; margin-bottom: 20px; background: var(--bg-soft);
}
.gate h1 { font-size: 27px; font-weight: 650; letter-spacing: -.02em; }
.gate-sub { font-size: 14px; color: var(--text-2); line-height: 1.75; margin-top: 12px; }
.gate-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-top: 22px; background: var(--surface);
}
.gate-card h3 { font-size: 14.5px; font-weight: 620; margin-bottom: 8px; }
.gate-card p { font-size: 13px; color: var(--text-2); line-height: 1.7; margin-bottom: 14px; }
.gate-row { display: flex; gap: 10px; }
.gate-row input {
  flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg-soft);
  border-radius: var(--radius-s); padding: 10px 13px; font-size: 15px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em; text-transform: uppercase;
}
.gate-row input:focus { outline: none; border-color: var(--red); }
.gate-state { font-size: 13px; color: var(--text-2); margin-top: 12px; min-height: 18px; }
.gate-foot { font-size: 12px; color: var(--text-3); margin-top: 26px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--text-2); }
.field input[type='text'], .field input[type='password'], .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); background: var(--bg-soft);
  border-radius: var(--radius-s); padding: 10px 13px; font-size: 14px; transition: all .16s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--blue); background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent);
}
.field textarea { resize: vertical; line-height: 1.7; font-family: inherit; }
.field .desc { font-size: 12.2px; color: var(--text-3); margin-top: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); margin-bottom: 8px;
}
.list-item .t { flex: 1; min-width: 0; }
.list-item .t b { font-size: 14px; font-weight: 600; display: block; }
.list-item .t span { font-size: 12.2px; color: var(--text-3); }
.list-item .acts { display: flex; gap: 6px; flex: none; }

.note {
  background: var(--blue-soft); border: 1px solid transparent;
  border-radius: var(--radius-s); padding: 13px 16px; font-size: 13.2px;
  color: var(--text-2); margin-bottom: 20px; line-height: 1.68;
}
.note b { color: var(--text); }
.note.warn { background: var(--red-soft); }
.note code { background: var(--surface); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* 导航编辑器 */
.cat-block {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px 17px; margin-bottom: 13px; background: var(--surface);
}
.cat-block-head { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.cat-block-head .cat-name {
  flex: 1; min-width: 0; border: 1px solid transparent; background: transparent;
  font-size: 15px; font-weight: 700; padding: 4px 8px; border-radius: 7px;
  letter-spacing: -.01em; transition: all .15s;
}
.cat-block-head .cat-name:hover { background: var(--bg-soft); }
.cat-block-head .cat-name:focus {
  outline: none; background: var(--bg-soft); border-color: var(--blue);
}
.cat-count { font-size: 12px; color: var(--text-3); flex: none; }
.site-row {
  display: grid; grid-template-columns: 1.1fr 1.6fr 1.2fr 52px 26px;
  gap: 7px; align-items: center; margin-bottom: 7px;
}
.site-row input {
  width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--bg-soft);
  border-radius: 7px; padding: 7px 10px; font-size: 13px; transition: all .15s;
}
.site-row input:focus {
  outline: none; border-color: var(--blue); background: var(--surface);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 12%, transparent);
}
.site-row .row-del {
  border: none; background: none; cursor: pointer; color: var(--text-3);
  font-size: 17px; line-height: 1; padding: 3px; border-radius: 5px; transition: all .15s;
}
.site-row .row-del:hover { color: var(--red); background: var(--red-soft); }

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 10, 14, .93);
  display: flex; align-items: center; justify-content: center;
  animation: fade .2s ease both;
}
.lightbox img {
  max-width: 92vw; max-height: 84vh; object-fit: contain;
  border-radius: 8px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18);
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .16s; backdrop-filter: blur(6px);
}
.lb-btn:hover { background: rgba(255, 255, 255, .2); }
.lb-prev { left: 26px; }
.lb-next { right: 26px; }
.lb-close {
  position: absolute; top: 22px; right: 26px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18);
  color: #fff; cursor: pointer; font-size: 19px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.lb-close:hover { background: rgba(255, 255, 255, .2); }
.lb-count {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  color: rgba(255, 255, 255, .78); font-size: 13px; letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}

/* ---------- 空状态 / 加载 ---------- */
.empty { text-align: center; padding: 76px 20px; color: var(--text-3); }
.empty .big { font-size: 40px; margin-bottom: 14px; opacity: .3; }
.empty p { margin: 0 0 18px; font-size: 14.5px; }
.loading { text-align: center; padding: 90px 0; color: var(--text-3); font-size: 14px; }

/* ---------- 页脚 ---------- */
.site-foot {
  border-top: 1px solid var(--line-2); padding: 40px 0 54px; margin-top: 40px;
  background: var(--bg-soft);
}
.foot-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.foot-inner .c { font-size: 13px; color: var(--text-3); }
.foot-inner .c b { color: var(--text-2); font-weight: 600; }
.foot-links { display: flex; gap: 18px; font-size: 13px; }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 11px 22px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-2);
  opacity: 0; pointer-events: none; transition: all .26s ease; z-index: 300;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .nav-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .ai-wrap { grid-template-columns: 1fr; }
  .role-list { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .role { flex: none; min-width: 165px; }
  .chat { height: 560px; }
}

@media (max-width: 680px) {
  .wrap { padding: 0 18px; }
  .hero { padding: 56px 0 46px; }
  .section { padding: 46px 0; }
  .nav {
    position: fixed; top: var(--head-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    flex-direction: column; padding: 10px 14px 16px; gap: 2px;
    display: none; box-shadow: var(--shadow-2);
  }
  .nav.open { display: flex; }
  .nav a { padding: 11px 14px; }
  .nav a.on::after { display: none; }
  .menu-btn { display: inline-flex; }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .nav-grid { grid-template-columns: 1fr; }
  .nav-groups { gap: 30px; }
  .site-row { grid-template-columns: 1fr 40px; }
  .site-row input[data-f='name'],
  .site-row input[data-f='url'],
  .site-row input[data-f='desc'] { grid-column: 1 / 3; }
  .site-row input[data-f='short'] { grid-column: 1; }
  .site-row .row-del { grid-column: 2; grid-row: 4; }
  .post-row { grid-template-columns: 1fr; gap: 6px; padding: 17px 0; }
  .post-meta { padding-top: 0; }
  .dev-row { align-items: flex-start; }
  .dev-actions { width: 100%; }
  .dev-name { flex: 1; width: auto; min-width: 0; }
  .gate { padding-top: 40px; }
  .gate-row { flex-direction: column; }
  .prevnext { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .page-head { padding: 40px 0 26px; }
  .page-head h1 { font-size: 27px; }
  .article { padding-top: 34px; }
  .prose { font-size: 16px; }
  .msg { max-width: 94%; }
  .lb-prev { left: 10px; }
  .lb-next { right: 10px; }
}
