/* ========== 设计变量 ========== */
:root {
  --brand: #d9363e;
  --brand-dark: #b7282f;
  --brand-soft: #fdecec;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2329;
  --text-2: #4e5969;
  --muted: #86909c;
  --line: #e5e6eb;
  --ok: #1f9d55;   --ok-bg: #e8f7ee;
  --limit: #c27c0e; --limit-bg: #fdf4e3;
  --no: #c9353d;   --no-bg: #fdecec;
  --tip-bg: #eef6ff; --tip-line: #3b82f6;
  --warn-bg: #fff6e6; --warn-line: #f59e0b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --header-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #f0545b; --brand-dark: #ff6b72; --brand-soft: #3a1d20;
    --bg: #121316; --surface: #1c1e22; --text: #e8e9eb; --text-2: #b4b8bf; --muted: #868b94; --line: #2c2f35;
    --ok: #4ade80; --ok-bg: #16301f; --limit: #fbbf24; --limit-bg: #33280f; --no: #f87171; --no-bg: #3a1d20;
    --tip-bg: #15233a; --warn-bg: #33280f;
    --shadow: none;
    color-scheme: dark;
  }
}

/* ========== 基础 ========== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 56px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: .88em; font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }
mark { background: #ffe58f; color: inherit; padding: 0 2px; border-radius: 2px; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ========== 头部 ========== */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 16px; height: var(--header-h); }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.logo-text { font-weight: 700; font-size: 17px; line-height: 1.2; display: flex; flex-direction: column; }
.logo-text small { font-weight: 400; font-size: 12px; color: var(--muted); }
.header-search { margin-left: auto; }
.header-search input { width: 260px; height: 38px; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 19px; padding: 0 16px; font-size: 14px; outline: none; }
.header-search input:focus { border-color: var(--brand); background: var(--surface); }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; border-radius: 2px; }
.main-nav { border-top: 1px solid var(--line); }
.main-nav .container { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.main-nav .container::-webkit-scrollbar { display: none; }
.main-nav a { padding: 10px 12px; color: var(--text-2); font-size: 15px; white-space: nowrap; border-bottom: 2px solid transparent; }
.main-nav a:hover { color: var(--brand); text-decoration: none; }
.main-nav a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ========== 首页 Hero ========== */
.hero { background: linear-gradient(180deg, var(--brand-soft), var(--bg)); padding: 64px 0 48px; text-align: center; }
.hero h1 { font-size: 40px; line-height: 1.3; margin: 0 0 12px; }
.hero .lead { color: var(--text-2); max-width: 680px; margin: 0 auto 24px; }
.br-m { display: none; }
.hero-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.btn.btn-lg, .btn-ghost.btn-lg { height: 50px; line-height: 48px; padding: 0 28px; font-size: 17px; border-radius: 25px; font-weight: 600; }
.btn-download { display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 6px 18px rgba(217,54,62,.28); }
.btn-download:hover { background: var(--brand-dark); opacity: 1; }
.hero-note { font-size: 13px; color: var(--muted); margin: 10px 0 28px; }
.hero-search { display: flex; max-width: 620px; margin: 0 auto; background: var(--surface); border: 2px solid var(--brand); border-radius: 28px; overflow: hidden; }
.hero-search input { flex: 1; min-width: 0; border: 0; outline: none; padding: 0 22px; height: 52px; font-size: 16px; background: transparent; color: var(--text); }
.hero-search button { border: 0; background: var(--brand); color: #fff; padding: 0 28px; font-size: 16px; cursor: pointer; }
.hero-search button:hover { background: var(--brand-dark); }
.quick-links { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; font-size: 14px; color: var(--muted); align-items: center; }
.quick-links a { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 3px 12px; color: var(--text-2); }
.quick-links a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* ========== 区块 / 卡片 ========== */
.section { padding: 40px 16px 8px; }
.section-title { font-size: 22px; margin: 0 0 18px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card-grid.small { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 4px; color: var(--text); transition: .15s; box-shadow: var(--shadow); }
a.card:hover { border-color: var(--brand); transform: translateY(-2px); text-decoration: none; }
.card strong { font-size: 17px; }
.card span { color: var(--text-2); font-size: 14px; line-height: 1.6; }
.card em { font-style: normal; color: var(--muted); font-size: 13px; margin-top: auto; padding-top: 6px; }
.card-icon { width: 40px; height: 40px; border-radius: 10px; display: grid !important; place-items: center; font-weight: 700; font-size: 18px !important; color: #fff !important; background: var(--brand); margin-bottom: 6px; }
.ic-docs { background: #2b6de5 !important; } .ic-sheets { background: #1f9d55 !important; } .ic-slides { background: #e8710a !important; }
.ic-pdf { background: #c9353d !important; } .ic-cloud { background: #0ea5e9 !important; } .ic-recovery { background: #7c3aed !important; }
.ic-settings { background: #475569 !important; } .ic-mobile { background: #0d9488 !important; } .ic-shortcuts { background: #334155 !important; }
.ic-faq { background: #db2777 !important; } .ic-compare { background: #ca8a04 !important; } .ic-ads { background: #ef4444 !important; } .ic-install { background: #2563eb !important; }

.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; padding-bottom: 56px; }
.hot-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); counter-reset: hot; }
.hot-list li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); counter-increment: hot; }
.hot-list li:last-child { border-bottom: 0; }
.hot-list li::before { content: counter(hot); width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; background: var(--bg); color: var(--muted); font-size: 13px; display: grid; place-items: center; font-weight: 600; }
.hot-list li:nth-child(-n+3)::before { background: var(--brand); color: #fff; }
.hot-list a { color: var(--text); flex: 1; }
.hot-list a:hover { color: var(--brand); }
.hot-list span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.more { display: inline-block; margin-top: 12px; font-size: 14px; }
.tips-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 18px; }
.tip-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.tip-item:last-child { border-bottom: 0; }
.tip-item b { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 14px; }
.tip-item p { margin: 0; font-size: 15px; color: var(--text-2); }
.tip-item strong { color: var(--text); }

/* ========== 内页 ========== */
.page-hero { background: var(--surface); border-bottom: 1px solid var(--line); padding: 28px 0 24px; }
.page-hero h1 { font-size: 30px; line-height: 1.35; margin: 6px 0 8px; }
.page-hero .lead { color: var(--text-2); margin: 0; max-width: 820px; }
.page-hero .hero-search { margin: 16px 0 0; }
.breadcrumb { font-size: 13px; color: var(--muted); }
.breadcrumb span { margin: 0 4px; }

.layout-sidebar { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; padding-top: 28px; padding-bottom: 56px; }
.toc-inner { position: sticky; top: calc(var(--header-h) + 60px); max-height: calc(100vh - var(--header-h) - 80px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 6px 14px 14px; }
.toc-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.toc ol { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.5; }
.toc li { margin: 6px 0; color: var(--muted); }
.toc a { color: var(--text-2); }
.toc a.active { color: var(--brand); font-weight: 600; }

.content-wide { padding-top: 28px; padding-bottom: 56px; }
.content-narrow { max-width: 760px; padding-top: 28px; padding-bottom: 56px; }

.callout { background: var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 8px; padding: 14px 18px; margin-bottom: 20px; color: var(--text); }
.qa { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; margin-bottom: 16px; box-shadow: var(--shadow); }
.qa:target { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.qa h2 { font-size: 19px; line-height: 1.5; margin: 0 0 10px; padding-right: 24px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.qa-num { flex-shrink: 0; min-width: 26px; height: 26px; border-radius: 7px; background: var(--brand); color: #fff; font-size: 14px; display: inline-grid; place-items: center; position: relative; top: -2px; }
.tag-hot { font-size: 12px; font-weight: 500; color: var(--brand); background: var(--brand-soft); border-radius: 4px; padding: 0 6px; }
.qa-link { position: absolute; right: 18px; top: 20px; color: var(--muted); opacity: 0; transition: .15s; }
.qa:hover .qa-link { opacity: 1; }
.qa-body { color: var(--text-2); }
.qa-body p { margin: 8px 0; }
.qa-body ul, .qa-body ol { padding-left: 22px; margin: 8px 0; }
.qa-body li { margin: 4px 0; }
.qa-body b, .qa-body strong { color: var(--text); }
.tip, .warn { padding: 10px 14px; border-radius: 8px; font-size: 15px; }
.tip { background: var(--tip-bg); border-left: 3px solid var(--tip-line); }
.warn { background: var(--warn-bg); border-left: 3px solid var(--warn-line); }
.tip::before { content: "小提示："; font-weight: 600; color: var(--text); }
.warn::before { content: "注意："; font-weight: 600; color: var(--text); }
.related { margin-top: 32px; }
.related h3 { font-size: 18px; }

/* 对比表 */
.legend { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.table-title { font-size: 20px; margin: 28px 0 12px; }
.table-title a { color: var(--text); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.compare-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.compare-table th, .compare-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); font-size: 15px; }
.compare-table th { background: var(--bg); font-weight: 600; color: var(--text-2); font-size: 14px; }
.compare-table tr:last-child td { border-bottom: 0; }
.compare-table td:nth-child(2), .compare-table td:nth-child(3), .compare-table th:nth-child(2), .compare-table th:nth-child(3) { width: 110px; white-space: nowrap; }
.compare-table td.muted { font-size: 14px; }
.st { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 10px; font-weight: 500; white-space: nowrap; }
.st-yes { color: var(--ok); background: var(--ok-bg); }
.st-limit { color: var(--limit); background: var(--limit-bg); }
.st-no { color: var(--no); background: var(--no-bg); }
.card.static span { margin-top: 4px; }

/* 快捷键 */
.filter-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.filter-bar input { flex: 1; max-width: 480px; height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 14px; font-size: 15px; background: var(--surface); color: var(--text); outline: none; }
.filter-bar input:focus { border-color: var(--brand); }
.kbd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.kbd-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.kbd-card h2 { font-size: 18px; margin: 0 0 8px; }
.kbd-table { width: 100%; border-collapse: collapse; }
.kbd-table td { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; vertical-align: middle; }
.kbd-table tr:last-child td { border-bottom: 0; }
.kbd-table td:first-child { width: 55%; }
.kbd-table td:last-child { color: var(--text-2); }
.kbd-table i { font-style: normal; color: var(--muted); margin: 0 2px; }
kbd { display: inline-block; min-width: 24px; text-align: center; padding: 1px 7px; font: 13px/1.6 ui-monospace, Menlo, Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; color: var(--text); }

/* FAQ */
.faq-group { margin-bottom: 8px; }
.faq-item { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.faq-item summary { cursor: pointer; padding: 14px 44px 14px 18px; font-weight: 600; list-style: none; position: relative; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 18px; top: 10px; font-size: 22px; color: var(--muted); font-weight: 400; }
.faq-item[open] summary::after { content: "−"; }
.faq-item[open] summary { color: var(--brand); }
.faq-item .qa-body { padding: 0 18px 14px; }
.source { font-size: 14px; }
.btn, .btn-ghost { display: inline-block; height: 42px; line-height: 40px; padding: 0 18px; border-radius: 8px; font-size: 15px; cursor: pointer; border: 1px solid var(--brand); }
.btn { background: var(--brand); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--brand); }
.btn:hover, .btn-ghost:hover { text-decoration: none; opacity: .9; }

/* 搜索 */
.chip { display: inline-block; border: 1px solid var(--line); background: var(--surface); padding: 2px 12px; border-radius: 14px; margin: 4px 4px 0 0; color: var(--text-2); }
.result-list { list-style: none; padding: 0; margin: 0; }
.result-list li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 10px; }
.result-list a { font-size: 17px; font-weight: 600; }
.result-list p { margin: 6px 0 0; color: var(--text-2); font-size: 14px; }
.badge { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; margin-left: 8px; white-space: nowrap; }

.prose h2 { font-size: 20px; margin-top: 28px; }
.prose li { margin: 6px 0; }
.notfound h1 { font-size: 72px; margin: 20px 0 0; color: var(--brand); }

/* ========== 页脚 ========== */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 36px 0 20px; font-size: 14px; color: var(--text-2); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-title { font-weight: 600; color: var(--text); margin-bottom: 8px; }
.footer-grid p { margin: 0 0 8px; }
.footer-links { list-style: none; margin: 0; padding: 0; columns: 2; }
.footer-links li { margin-bottom: 6px; }
.footer-links a { color: var(--text-2); }
.copyright { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.back-top { position: fixed; right: 20px; bottom: 24px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 18px; cursor: pointer; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s; }
.back-top.show { opacity: 1; pointer-events: auto; }

/* ========== 响应式 ========== */
@media (max-width: 960px) {
  .layout-sidebar { grid-template-columns: 1fr; }
  .toc-inner { position: static; max-height: none; }
  .two-col { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  :root { --header-h: 56px; }
  .header-search { display: none; }
  .nav-toggle { display: block; margin-left: auto; }
  .main-nav { display: none; }
  .main-nav.open { display: block; }
  .main-nav .container { flex-wrap: wrap; padding-top: 6px; padding-bottom: 10px; }
  .main-nav a { width: calc(33.33% - 2px); text-align: center; border-bottom: 0; border-radius: 6px; padding: 8px 4px; }
  .main-nav a.active { background: var(--brand-soft); }
  html { scroll-padding-top: calc(var(--header-h) + 12px); }
  .hero { padding: 40px 0 32px; }
  .hero h1 { font-size: 28px; }
  .br-m { display: inline; }
  .hero-search input { height: 46px; padding: 0 16px; font-size: 15px; }
  .hero-search button { padding: 0 18px; }
  .page-hero h1 { font-size: 24px; }
  .qa { padding: 18px 16px; }
  .qa h2 { font-size: 17px; }
  .toc { display: none; }
  .kbd-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 14px; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* ========== 下载入口 ========== */
.header-download { flex-shrink: 0; height: 36px; line-height: 36px; padding: 0 16px; border-radius: 18px; background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; }
.header-download:hover { background: var(--brand-dark); text-decoration: none; }
.topic-cta { margin: 14px 0 0; }
.topic-cta .btn { border-radius: 21px; padding: 0 22px; font-weight: 600; }
.inline-download { display: inline-block; font-weight: 600; background: var(--brand-soft); padding: 4px 12px; border-radius: 6px; }
.footer-download { font-weight: 600; }
@media (max-width: 720px) {
  .header-download { margin-left: auto; height: 32px; line-height: 32px; padding: 0 12px; font-size: 13px; }
  .nav-toggle { margin-left: 4px; }
}

/* ========== 更新日期 ========== */
.updated { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--muted); }
.updated::before { content: "🕒 "; }

/* ========== 小屏手机：防止头部挤出屏幕 ========== */
@media (max-width: 720px) {
  .header-inner { gap: 10px; }
  .logo { min-width: 0; flex-shrink: 1; }
  .logo-text { min-width: 0; font-size: 16px; }
  .logo-text, .logo-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .header-download, .nav-toggle { flex-shrink: 0; }
}
@media (max-width: 400px) {
  .logo-mark { width: 32px; height: 32px; font-size: 16px; }
  .logo-text { font-size: 15px; }
  .logo-text small { display: none; }
  .header-download { padding: 0 10px; }
  .back-top { right: 12px; bottom: 16px; }
}
@media (max-width: 340px) {
  .logo-text { font-size: 13.5px; }
  .header-inner { gap: 8px; padding-left: 12px; padding-right: 10px; }
  .nav-toggle { padding: 8px 4px; }
}
