/* Frontier Mind · 阶段二界面样式 */
html[data-theme="light"] {
  --bg: #f6f7fb;
  --card: #fff;
  --text: #18202b;
  --muted: #667085;
  --border: #e3e7ef;
  --accent: #3d5afe;
  --accent-soft: #eaedff;
  --shadow: 0 10px 30px rgba(24, 32, 43, .08);
  --code-bg: #f6f8fa;
}
html[data-theme="dark"] {
  --bg: #0b0f16;
  --card: #141a24;
  --text: #e9eef6;
  --muted: #95a1b2;
  --border: #28313e;
  --accent: #8fa4ff;
  --accent-soft: #1b243a;
  --shadow: 0 10px 30px rgba(0, 0, 0, .24);
  --code-bg: #0d1117;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #0b0f16; --card: #141a24; --text: #e9eef6; --muted: #95a1b2;
    --border: #28313e; --accent: #8fa4ff; --accent-soft: #1b243a;
    --shadow: 0 10px 30px rgba(0,0,0,.24); --code-bg: #0d1117;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.72; font-size: 16px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 860px; }
.muted { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); padding: 24px; background: var(--card); border: 1px dashed var(--border); border-radius: 12px; }

#progress { position: fixed; top: 0; left: 0; z-index: 100; height: 3px; width: 0; background: var(--accent); }
.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 64px; }
.logo { color: var(--text); font-weight: 750; font-size: 17px; white-space: nowrap; }
.logo-mark { color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.site-nav a { color: var(--muted); font-size: 14px; }
.site-nav a:hover, .site-nav a.active { color: var(--accent); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.search-form { display: flex; align-items: center; width: 190px; height: 36px; padding: 0 6px 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); }
.search-form input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font-size: 13px; outline: none; }
.search-form button { border: 0; background: transparent; cursor: pointer; font-size: 14px; }
.theme-toggle, .small-button, .page-link, .wide-search button, .code-head button {
  border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 999px; cursor: pointer;
}
.theme-toggle { width: 36px; height: 36px; }
.small-button, .page-link { padding: 7px 13px; font-size: 13px; }
.small-button:hover, .page-link:hover, .theme-toggle:hover, .wide-search button:hover, .code-head button:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.hero { padding: 72px 0 36px; }
.hero h1 { max-width: 720px; margin: 0; font-size: clamp(30px, 5vw, 47px); line-height: 1.18; letter-spacing: -.03em; }
.hero-sub { max-width: 700px; margin: 12px 0 0; color: var(--muted); font-size: 16px; }
.hero-sub.muted { color: var(--muted); }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.badge { padding: 5px 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--text); font-size: 13px; }
.section { padding: 30px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 22px; }
.more-link { font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.stack { display: grid; gap: 14px; }
.card, .taxonomy-item, .weekly-item {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; color: var(--text);
}
.card:hover, .taxonomy-item:hover, .weekly-item:hover { box-shadow: var(--shadow); text-decoration: none; }
.card h3 { margin: 10px 0 7px; font-size: 17px; }
.card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; }
.post-card-title { color: var(--text); }
.post-card-title:hover { color: var(--accent); }
.card-desc { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 23px; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.chip-plain { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.chip-done { background: #e5f7eb; color:#16723b; }
.chip-ongoing { background:#fff5d9; color:#8a5a00; }
.chip-idea { background:#eef0f4; color:#59616d; }
/* 下载与作品状态：同一语义在浅色 / 深色主题下都保持可读。 */
.chip-planned { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.chip-prototyping { background: color-mix(in srgb, #7c5cff 18%, transparent); color: color-mix(in srgb, #7c5cff 80%, var(--text)); }
.chip-beta { background: color-mix(in srgb, #f59e0b 20%, transparent); color: color-mix(in srgb, #b45309 80%, var(--text)); }
.chip-released, .chip-available { background: color-mix(in srgb, #16a34a 18%, transparent); color: color-mix(in srgb, #15803d 85%, var(--text)); }
.chip-maintained { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.chip-retired { background: color-mix(in srgb, #dc2626 16%, transparent); color: color-mix(in srgb, #b91c1c 85%, var(--text)); }
.project-links { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 12px; }
.project-problem { color: var(--muted); font-size: 13px; }
.lab-card { border-left: 3px solid var(--accent); }
.weekly-strip, .weekly-list { display: grid; gap: 10px; }
.weekly-item { display: flex; align-items: center; gap: 12px; }
.weekly-item strong { font-size: 15px; }
.weekly-item span:last-child { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 1; }
.link-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 10px; }
.link-item { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--text); }
.link-item span { color: var(--muted); font-size: 13px; }

.page-head { padding: 48px 0 24px; }
.page-head h1 { margin: 0; font-size: clamp(28px,4vw,38px); }
.page-desc { margin: 8px 0 0; color: var(--muted); }
.eyebrow { margin: 0; color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 28px 0; }
.page-number { color: var(--muted); font-size: 14px; }
.wide-search { display: flex; gap: 8px; margin-top: 18px; }
.wide-search input { flex:1; height:42px; padding:0 14px; border:1px solid var(--border); border-radius:10px; background:var(--card); color:var(--text); }
.wide-search button { min-width:76px; background:var(--accent); border-color:var(--accent); color:#fff; }
.taxonomy-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:12px; }
.taxonomy-item { display:grid; gap:5px; }
.tag-cloud { display:flex; flex-wrap:wrap; gap:10px; }
.tag-lg { padding:8px 14px; border:1px solid var(--border); border-radius:999px; background:var(--card); font-size:14px; }
.tag-lg span { margin-left:6px; color:var(--muted); font-size:12px; }
.series-list { display:grid; gap:10px; margin:0; padding:0; list-style:none; counter-reset:series; }
.series-list li { display:flex; align-items:center; gap:12px; padding:14px 16px; border:1px solid var(--border); border-radius:12px; background:var(--card); }
.series-list li span:last-child { margin-left:auto; white-space:nowrap; }
.archive-year { margin-bottom:28px; }
.archive-year h2 { margin:0 0 14px; font-size:24px; }
.timeline { border-left:2px solid var(--border); margin-left:7px; }
.timeline-item { position:relative; display:flex; align-items:center; gap:12px; padding:10px 0 10px 20px; }
.timeline-item::before { position:absolute; left:-6px; width:10px; height:10px; border-radius:50%; background:var(--accent); content:""; }
.timeline-item time { min-width:58px; color:var(--muted); font-size:13px; }
.timeline-item span { margin-left:auto; white-space:nowrap; }

.article-layout { display:grid; grid-template-columns:minmax(0,1fr) 240px; gap:34px; padding:36px 0 70px; align-items:start; }
.article { max-width:820px; }
.article-head { padding-bottom:22px; margin-bottom:28px; border-bottom:1px solid var(--border); }
.article-head h1 { margin:12px 0 0; font-size:clamp(28px,4vw,40px); line-height:1.25; }
.article-summary { color:var(--muted); font-size:17px; }
.article-tools { display:flex; gap:10px; margin-top:16px; }
.toc { position:sticky; top:88px; max-height:calc(100vh - 110px); overflow:auto; padding:16px 18px; border:1px solid var(--border); border-radius:14px; background:var(--card); }
.toc h2 { margin:0 0 10px; font-size:14px; }
.toc ul { margin:0; padding-left:10px; list-style:none; }
.toc-link { display:block; padding:4px 0; color:var(--muted); font-size:13px; line-height:1.45; }
.toc-link.active, .toc-link:hover { color:var(--accent); }
.toc-level-1{font-weight:700}.toc-level-2{margin-left:7px}.toc-level-3{margin-left:14px}.toc-level-4{margin-left:21px}.toc-level-5,.toc-level-6{margin-left:28px}
.prose { font-size:17px; }
.prose > * + * { margin-top:1.05em; }
.prose h1,.prose h2,.prose h3,.prose h4,.prose h5,.prose h6 { scroll-margin-top:82px; line-height:1.3; font-weight:700; }
.prose h1{font-size:30px}.prose h2{font-size:25px;border-bottom:1px solid var(--border);padding-bottom:.35em}.prose h3{font-size:21px}.prose h4{font-size:18px}
.prose ul,.prose ol { padding-left:1.45em; }
.prose blockquote { margin:1.3em 0; padding:.7em 1em; border-left:4px solid var(--accent); border-radius:0 10px 10px 0; background:var(--accent-soft); color:var(--text); }
.prose blockquote p { margin:0; }
.prose table { display:block; width:100%; overflow:auto; border-collapse:collapse; }
.prose th,.prose td { padding:9px 12px; border:1px solid var(--border); }
.prose th { background:var(--accent-soft); }
.prose img { max-width:100%; border-radius:10px; }
.prose hr { border:0; border-top:1px solid var(--border); }
.prose :not(pre) > code { padding:.2em .4em; border-radius:6px; background:var(--code-bg); font-size:.88em; }
.code-block { overflow:hidden; border:1px solid var(--border); border-radius:11px; background:var(--code-bg); }
.code-head { display:flex; justify-content:space-between; align-items:center; padding:7px 11px; border-bottom:1px solid var(--border); background:var(--card); font-size:12px; color:var(--muted); }
.code-head button { padding:2px 9px; font-size:12px; }
.code-block pre { margin:0; padding:15px; overflow:auto; }
.code-block pre code { display:block; padding:0; background:transparent; white-space:pre; }
.series-box { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:28px; padding:14px 16px; border:1px solid var(--border); border-radius:12px; background:var(--card); font-size:14px; }
.post-nav { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:30px; }
.post-nav-item { display:grid; gap:3px; padding:15px 17px; border:1px solid var(--border); border-radius:12px; background:var(--card); color:var(--text); }
.post-nav-item span { color:var(--muted); font-size:12px; }
.post-nav-item.align-right { text-align:right; }
.related { margin-top:36px; }
.related h2 { margin-bottom:14px; font-size:20px; }
.site-footer { border-top:1px solid var(--border); margin-top:20px; padding:30px 0; color:var(--muted); font-size:13px; }
.site-footer p { margin:5px 0; }

@media (max-width:900px) {
  .article-layout{grid-template-columns:1fr}
  .toc{position:static;display:none}
  .search-form{display:none}
}
@media (max-width:680px) {
  .container{padding:0 16px}
  .site-nav{display:none}
  .header-actions{margin-left:auto}
  .hero{padding-top:42px}
  .grid{grid-template-columns:1fr}
  .post-nav{grid-template-columns:1fr}
  .post-nav-item.align-right{text-align:left}
  .weekly-item{align-items:flex-start;flex-direction:column}
  .series-list li{align-items:flex-start;flex-direction:column}
  .timeline-item{flex-wrap:wrap}
  .wide-search{flex-direction:column}
}

/* Agent Lab 与 AI 助手（阶段三） */
.lab-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:16px; }
.lab-wide h2 { margin:10px 0 6px; font-size:19px; }
.lab-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.agent-demo { overflow:hidden; margin:0 0 32px; border:1px solid var(--border); border-radius:16px; background:var(--card); box-shadow:var(--shadow); }
.demo-head { display:flex; justify-content:space-between; align-items:center; gap:14px; padding:18px 20px; border-bottom:1px solid var(--border); background:linear-gradient(135deg,var(--accent-soft),transparent); }
.demo-head h2 { margin:3px 0 0; font-size:21px; }
.demo-form { padding:18px 20px 14px; }
.demo-form label { display:block; margin-bottom:7px; font-size:14px; font-weight:650; }
.demo-input-row { display:grid; grid-template-columns:minmax(0,1fr) 92px; gap:8px; }
.demo-input-row input { height:42px; padding:0 13px; border:1px solid var(--border); border-radius:10px; background:var(--bg); color:var(--text); }
.demo-input-row input:focus, .wide-search input:focus { outline:2px solid var(--accent); outline-offset:1px; }
.demo-input-row button { border:0; border-radius:10px; background:var(--accent); color:#fff; font-weight:650; cursor:pointer; }
.demo-input-row button:disabled { opacity:.65; cursor:wait; }
.demo-samples { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.demo-samples button { padding:5px 10px; border:1px solid var(--border); border-radius:999px; background:var(--bg); color:var(--muted); font-size:12px; cursor:pointer; }
.demo-samples button:hover { color:var(--accent); border-color:var(--accent); }
.demo-status { padding:0 20px 12px; color:var(--muted); font-size:13px; }
.react-result { padding:0 20px 20px; }
.demo-goal { margin:0 0 14px; }
.react-steps { display:grid; gap:10px; }
.react-step { position:relative; padding:14px 16px 14px 20px; border:1px solid var(--border); border-radius:12px; background:var(--bg); }
.react-step::before { position:absolute; top:16px; left:8px; width:5px; height:calc(100% - 32px); border-radius:999px; background:var(--accent); content:""; }
.react-step h3 { margin:0 0 7px; font-size:13px; color:var(--accent); }
.react-step p { margin:4px 0; font-size:14px; }
.react-step code { display:block; margin:7px 0; padding:7px 9px; border-radius:7px; background:var(--code-bg); font-size:12.5px; overflow:auto; }
.react-answer { margin-top:14px; padding:13px 15px; border-left:3px solid var(--accent); border-radius:0 10px 10px 0; background:var(--accent-soft); }
.react-answer strong { display:block; margin-bottom:4px; }
.react-answer p { margin:0; }
.ai-fab { position:fixed; right:22px; bottom:24px; z-index:80; display:flex; align-items:center; gap:7px; min-height:44px; padding:9px 15px; border:1px solid var(--border); border-radius:999px; background:var(--accent); color:#fff; box-shadow:var(--shadow); cursor:pointer; }
.ai-fab:hover { transform:translateY(-1px); }
.ai-fab.active { background:var(--card); color:var(--text); }
.ai-panel { position:fixed; right:22px; bottom:80px; z-index:81; width:min(340px,calc(100vw - 32px)); overflow:hidden; border:1px solid var(--border); border-radius:16px; background:var(--card); color:var(--text); box-shadow:var(--shadow); }
.ai-panel header { display:flex; justify-content:space-between; align-items:center; padding:12px 14px; border-bottom:1px solid var(--border); background:var(--accent-soft); }
.ai-panel header button { width:28px; height:28px; border:0; border-radius:8px; background:transparent; color:var(--text); cursor:pointer; font-size:20px; }
.ai-panel-body { padding:14px; }
.ai-panel-body p { margin:10px 0; font-size:14px; }
.ai-panel-body ul { display:grid; gap:6px; margin:0; padding-left:18px; color:var(--muted); font-size:13px; }
.ai-panel-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:13px; font-size:14px; }
.comments { margin-top:38px; padding-top:20px; border-top:1px solid var(--border); }
.comments h2 { margin-bottom:12px; font-size:20px; }
.comments-pending { padding-bottom:20px; }
.error-page { min-height:50vh; padding-top:80px; }
@media (max-width:680px) {
  .lab-grid{grid-template-columns:1fr}
  .demo-input-row{grid-template-columns:1fr}
  .ai-fab-text{display:none}
  .ai-fab{right:16px;bottom:18px;width:46px;height:46px;justify-content:center;padding:0}
  .ai-panel{right:16px;bottom:76px}
}

/* Phase 4 AI assistant */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.ai-panel { width:min(430px,calc(100vw - 32px)); }
.ai-disclaimer { padding:10px 12px; border:1px solid var(--border); border-radius:12px; background:var(--accent-soft); color:var(--muted); }
.ai-recommendations { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.ai-recommendations button { padding:7px 10px; border:1px solid var(--border); border-radius:999px; background:var(--bg); color:var(--text); cursor:pointer; font-size:12px; }
.ai-recommendations button:hover { border-color:var(--accent); color:var(--accent); }
.ai-form { display:grid; gap:9px; margin-top:12px; }
.ai-form textarea { width:100%; resize:vertical; min-height:74px; padding:10px 11px; border:1px solid var(--border); border-radius:12px; background:var(--bg); color:var(--text); font:inherit; }
.ai-form button, .ai-feedback button { border:0; border-radius:10px; background:var(--accent); color:#fff; cursor:pointer; padding:9px 12px; }
.ai-tools {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent-soft) 62%, var(--card));
  font-size: 12px;
}
.ai-tools strong { display: block; color: var(--accent); font-size: 12px; }
.ai-tools ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ai-tools li {
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--card) 82%, var(--bg));
}
.ai-tools span { font-weight: 750; }
.ai-tools small { color: var(--muted); line-height: 1.5; }
.ai-tools[hidden] { display: none !important; }
.ai-answer { display:grid; gap:10px; margin:12px 0; padding:12px; border:1px solid var(--border); border-radius:14px; background:var(--bg); }
.ai-answer-text { white-space:pre-wrap; line-height:1.7; font-size:14px; }
.ai-sources { font-size:13px; }
.ai-sources strong { display:block; margin-bottom:5px; }
.ai-sources ol { margin:0; padding-left:20px; }
.ai-feedback { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:13px; }
.ai-feedback button { padding:6px 9px; background:var(--accent-soft); color:var(--text); border:1px solid var(--border); }
.ai-status { min-height:18px; margin:8px 0 0; color:var(--muted); font-size:12px; }
.tool-call-result { display:grid; gap:12px; padding:0 20px 20px; }
.tool-call-summary { padding:13px 15px; border-left:3px solid var(--accent); border-radius:0 10px 10px 0; background:var(--accent-soft); }
.tool-call-grid { display:grid; gap:10px; grid-template-columns:repeat(3,minmax(0,1fr)); }
.tool-card { padding:12px; border:1px solid var(--border); border-radius:12px; background:var(--bg); }
.tool-card h3 { margin:0 0 6px; font-size:14px; color:var(--accent); }
.tool-card code { display:block; overflow:auto; padding:7px; border-radius:8px; background:var(--code-bg); font-size:12px; }
@media (max-width:680px) { .tool-call-grid{grid-template-columns:1fr} }

/* Phase 4 UI polish: 首页卡片层次 + AI 助手不遮挡主体 */
html[data-theme="light"] {
  --bg: #f7f8fc;
  --card: #ffffff;
  --border: #dfe5f0;
  --shadow: 0 18px 45px rgba(24, 32, 43, .10);
  --shadow-strong: 0 24px 70px rgba(24, 32, 43, .16);
  --accent-2: #7c3aed;
}
html[data-theme="dark"] {
  --shadow-strong: 0 24px 70px rgba(0, 0, 0, .40);
  --accent-2: #c4b5fd;
}
body {
  background:
    radial-gradient(circle at 12% 4%, color-mix(in srgb, var(--accent-soft) 70%, transparent), transparent 28rem),
    radial-gradient(circle at 88% 12%, rgba(124, 58, 237, .10), transparent 24rem),
    var(--bg);
}
.site-main { min-height: calc(100vh - 210px); }
.site-header { box-shadow: 0 8px 28px rgba(24, 32, 43, .05); }
.logo { letter-spacing: -.02em; }
.site-nav a { padding: 6px 0; font-weight: 650; }
.site-nav a.active { position: relative; }
.site-nav a.active::after {
  position: absolute;
  right: 0;
  bottom: -13px;
  left: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.hero {
  position: relative;
  overflow: hidden;
  margin-top: 34px;
  padding: clamp(38px, 7vw, 72px);
  border: 1px solid var(--border);
  border-radius: 32px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--card) 88%, var(--accent-soft)), var(--card) 58%),
    var(--card);
  box-shadow: var(--shadow);
}
.hero::before,
.hero::after {
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  content: "";
}
.hero::before {
  width: 260px;
  height: 260px;
  right: -72px;
  top: -88px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.hero::after {
  width: 170px;
  height: 170px;
  right: 86px;
  bottom: -84px;
  background: rgba(124, 58, 237, .13);
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { max-width: 780px; font-weight: 850; }
.hero-sub { font-size: 17px; }
.badge {
  border-color: color-mix(in srgb, var(--accent) 18%, var(--border));
  box-shadow: 0 8px 20px rgba(24, 32, 43, .05);
  font-weight: 650;
}

.section { padding: 38px 0; }
.section-head {
  padding-bottom: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}
.section-head h2 {
  position: relative;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -.035em;
}
.section-head h2::after {
  display: block;
  width: 38px;
  height: 4px;
  margin-top: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  content: "";
}
.more-link {
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-weight: 650;
}
.more-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.grid { gap: 22px; }
.card, .taxonomy-item, .weekly-item, .link-item {
  border-color: color-mix(in srgb, var(--border) 86%, var(--accent));
  box-shadow: 0 10px 30px rgba(24, 32, 43, .055);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover, .taxonomy-item:hover, .weekly-item:hover, .link-item:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}
.post-card {
  position: relative;
  display: flex;
  min-height: 245px;
  flex-direction: column;
  overflow: hidden;
  padding: 24px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--card) 92%, var(--accent-soft)), var(--card));
}
.post-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  content: "";
}
.card-meta { gap: 10px; }
.card h3 { margin: 14px 0 10px; font-size: 20px; line-height: 1.45; }
.post-card-title { color: var(--text); text-decoration: none; }
.post-card-title:hover { color: var(--accent); text-decoration: none; }
.card-desc { color: color-mix(in srgb, var(--text) 72%, var(--muted)); font-size: 15px; }
.card-tags { margin-top: auto; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, var(--accent));
  border-radius: 999px;
  color: var(--muted);
  font-size: 12.5px;
  background: color-mix(in srgb, var(--card) 86%, var(--accent-soft));
}
.tag:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.chip { font-weight: 650; }
.lab-card { border-left: 0; }
.lab-card::before { background: linear-gradient(180deg, var(--accent), var(--accent-2)); }
.weekly-item { border-radius: 18px; padding: 18px 20px; }
.link-item { border-radius: 18px; }

.ai-fab {
  right: 28px;
  bottom: 28px;
  z-index: 90;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid color-mix(in srgb, #fff 30%, var(--accent));
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 18px 40px rgba(61, 90, 254, .28);
  font-weight: 750;
}
.ai-fab.active { background: var(--card); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 36%, var(--border)); }
.ai-panel {
  right: 28px;
  bottom: 92px;
  z-index: 91;
  display: flex;
  width: min(420px, calc(100vw - 40px));
  max-height: min(680px, calc(100dvh - 118px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 24px;
  background: color-mix(in srgb, var(--card) 96%, transparent);
  box-shadow: var(--shadow-strong);
  backdrop-filter: blur(18px);
}
.ai-panel header {
  flex: 0 0 auto;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--card) 78%, var(--accent-soft)));
}
.ai-panel header strong::before { content: "✨ "; }
.ai-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
}
.ai-disclaimer { margin-top: 0; }
.ai-form textarea {
  min-height: 92px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
}
.ai-form textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.ai-form button {
  min-height: 42px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 750;
}
.ai-answer {
  max-height: 48vh;
  overflow-y: auto;
  border-color: color-mix(in srgb, var(--accent) 20%, var(--border));
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg) 70%, var(--card));
}
.ai-recommendations button { transition: transform .18s ease, border-color .18s ease; }
.ai-recommendations button:hover { transform: translateY(-1px); }

@media (max-width: 900px) {
  .hero { border-radius: 24px; }
  .site-nav a.active::after { display: none; }
}
@media (max-width: 680px) {
  .hero { margin-top: 18px; padding: 28px 22px; }
  .section { padding: 28px 0; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .post-card { min-height: auto; padding: 20px; }
  .ai-fab { right: 16px; bottom: 18px; width: auto; min-width: 48px; height: 48px; }
  .ai-panel {
    right: 12px;
    bottom: 78px;
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 96px);
    border-radius: 22px;
  }
}
.ai-panel[hidden] { display: none !important; }

/* Theme fallback: tolerate old localStorage values such as "auto" */
:root,
html[data-theme="auto"],
html[data-theme="light"] {
  --bg: #f7f8fc;
  --card: #ffffff;
  --text: #18202b;
  --muted: #667085;
  --border: #dfe5f0;
  --accent: #3d5afe;
  --accent-soft: #eaedff;
  --shadow: 0 18px 45px rgba(24, 32, 43, .10);
  --shadow-strong: 0 24px 70px rgba(24, 32, 43, .16);
  --code-bg: #f6f8fa;
  --accent-2: #7c3aed;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #0b0f16;
    --card: #141a24;
    --text: #e9eef6;
    --muted: #95a1b2;
    --border: #28313e;
    --accent: #8fa4ff;
    --accent-soft: #1b243a;
    --shadow: 0 10px 30px rgba(0,0,0,.24);
    --shadow-strong: 0 24px 70px rgba(0,0,0,.40);
    --code-bg: #0d1117;
    --accent-2: #c4b5fd;
  }
}
/* Keep HTML hidden semantics even when component classes set display/grid/flex. */
[hidden] { display: none !important; }
@media (min-width: 1180px) {
  body.ai-panel-open .site-main,
  body.ai-panel-open .site-footer {
    margin-right: 460px;
    transition: margin-right .22s ease;
  }
}


/* ---------- 阶段五：Agent Hub 与运营看板 ---------- */
.hub-head { padding: 54px 0 20px; }
.hub-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.path-list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.path-step {
  display: grid; grid-template-columns: 58px 1fr; gap: 18px; align-items: start;
  padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--card);
}
.path-stage {
  display: grid; place-items: center; min-height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--accent-2) 16%, transparent));
  color: var(--accent); font-weight: 800; letter-spacing: -.02em;
}
.path-step h3 { margin: 0 0 6px; font-size: 18px; }
.path-step p { margin: 0; color: var(--muted); font-size: 14px; }
.checkpoint-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 10px; padding: 0; list-style: none; }
.checkpoint-list li { padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 12.5px; }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.metric-card { padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.metric-card span { display: block; color: var(--muted); font-size: 13px; }
.metric-card strong { display: block; margin: 5px 0; font-size: 28px; line-height: 1.15; }
.metric-card small { color: var(--muted); font-size: 12px; }
.weekly-rhythm, .action-list, .topic-row {
  padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--card);
}
.action-list { margin: 0; padding-left: 36px; }
.action-list li + li { margin-top: 7px; }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.topic-row { display: flex; justify-content: space-between; gap: 16px; }
.topic-row p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.topic-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex-shrink: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-wrap th, .table-wrap td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table-wrap th { color: var(--muted); font-weight: 650; white-space: nowrap; }
.table-wrap tr:last-child td { border-bottom: 0; }
.studio-link { display: inline-flex; align-items: center; min-height: 34px; padding: 0 11px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 13px; }
.studio-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
@media (max-width: 900px) { .dashboard-columns { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .path-step { grid-template-columns: 1fr; }
  .topic-row { flex-direction: column; }
  .topic-meta { justify-content: flex-start; }
}

/* ---------- 阶段六：鸿蒙学习中心与下载中心 ---------- */
.hero-eyebrow,
.section-eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .10em; text-transform: uppercase; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.primary-button, .secondary-button, .download-button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 20px;
  border-radius: 999px; font-weight: 750; text-decoration: none;
}
.primary-button, .download-button { border: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.secondary-button { border: 1px solid var(--border); background: var(--card); color: var(--text); }
.primary-button:hover, .secondary-button:hover, .download-button:hover { transform: translateY(-1px); text-decoration: none; }
.focus-grid, .capability-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.focus-card, .capability-card { display: flex; min-height: 158px; flex-direction: column; gap: 9px; padding: 20px; border: 1px solid var(--border); border-radius: 18px; background: var(--card); color: var(--text); text-decoration: none; }
.focus-card:hover, .capability-card:hover { border-color: color-mix(in srgb, var(--accent) 42%, var(--border)); box-shadow: var(--shadow); text-decoration: none; }
.focus-card strong, .capability-card strong { font-size: 17px; }
.focus-card span, .capability-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.capability-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--accent-soft); font-size: 20px; }
.capability-card .card-tags { margin-top: auto; }
.harmony-path { gap: 16px; }
.harmony-hero { border-top: 3px solid color-mix(in srgb, var(--accent) 62%, transparent); }
.download-hero { border-top: 3px solid color-mix(in srgb, var(--accent-2) 62%, transparent); }
.download-stats { display: grid; grid-template-columns: repeat(3, minmax(90px, 130px)); gap: 12px; margin-top: 24px; }
.download-stats div { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.download-stats strong { display: block; font-size: 24px; }
.download-stats span { color: var(--muted); font-size: 12px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.filter-bar a { min-height: 34px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 13px; text-decoration: none; }
.filter-bar a:hover, .filter-bar a.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.resource-card { display: flex; flex-direction: column; }
.resource-details { margin: 10px 0; color: var(--muted); font-size: 13px; }
.resource-details summary { cursor: pointer; color: var(--text); font-weight: 650; }
.resource-details + .resource-details { margin-top: 2px; }
.compact-prose { margin: 8px 0 0; font-size: 13px; line-height: 1.65; }
.resource-meta { display: grid; gap: 6px; margin: 8px 0 14px; color: var(--muted); font-size: 12px; }
.resource-meta div { display: grid; grid-template-columns: 58px 1fr; gap: 8px; }
.resource-meta dt { font-weight: 650; }
.resource-meta dd { margin: 0; overflow-wrap: anywhere; }
.download-button.disabled { border: 1px dashed var(--border); background: transparent; color: var(--muted); cursor: not-allowed; }
.resource-policy { padding: 26px; border: 1px dashed var(--border); border-radius: 18px; background: color-mix(in srgb, var(--card) 88%, var(--accent-soft)); }
.resource-policy h2 { margin-top: 0; font-size: 20px; }
.small-text { font-size: 13px; }
@media (max-width: 680px) {
  .hero-actions .primary-button, .hero-actions .secondary-button { flex: 1 1 100%; }
  .download-stats { grid-template-columns: repeat(3, 1fr); }
}

/* Phase 8 browser speech input */
.ai-form-actions { display: flex; align-items: center; gap: 8px; }
.ai-form-actions button[type="submit"] { flex: 1 1 auto; }
.ai-voice {
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 82%, var(--bg));
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.ai-voice:hover { border-color: var(--accent); color: var(--accent); }
.ai-voice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.ai-voice[hidden] { display: none !important; }
