/* cc-web 官网与后台共用样式：浅色 / 深色跟随系统，移动端优先，不依赖外部字体与 CDN */

:root {
  --bg: #f7f8fa;
  --bg-elev: #ffffff;
  --bg-soft: #eef1f5;
  --fg: #1b1f24;
  --fg-soft: #4a5260;
  --fg-mute: #6b7380;
  --line: #dde2e8;
  --accent: #2f5bd3;
  --accent-fg: #ffffff;
  --accent-soft: #e6ecfb;
  --ok: #1f7a43;
  --ok-soft: #e3f4ea;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --code-bg: #f0f2f5;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .06);
  --radius: 10px;
  --wrap: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --bg-elev: #171b21;
    --bg-soft: #1d232b;
    --fg: #e6e9ee;
    --fg-soft: #b8c0cc;
    --fg-mute: #8d96a3;
    --line: #2a313b;
    --accent: #7a9cff;
    --accent-fg: #0f1216;
    --accent-soft: #1d2740;
    --ok: #5cc98a;
    --ok-soft: #14291d;
    --warn: #e7b450;
    --warn-soft: #2e2512;
    --danger: #ff7b72;
    --danger-soft: #34191a;
    --code-bg: #1b2028;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font-family: var(--mono); font-size: .9em; }
code { background: var(--code-bg); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--code-bg); padding: 12px 14px; border-radius: 8px; overflow-x: auto; line-height: 1.5; }
pre code { background: none; padding: 0; }
h1, h2, h3 { line-height: 1.3; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 12px; top: 8px; z-index: 100; background: var(--bg-elev); padding: 6px 10px; border-radius: 6px; }

/* ------------------------------------------------ 页头 / 导航 */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; color: var(--fg); display: inline-flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.logo {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  background: var(--accent); color: var(--accent-fg);
  border-radius: 6px; padding: 2px 6px; line-height: 1.4;
}
.site-nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  color: var(--fg-soft); padding: 6px 12px; border-radius: 8px; white-space: nowrap; font-size: 15px;
}
.site-nav a:hover { background: var(--bg-soft); color: var(--fg); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

@media (max-width: 640px) {
  .bar { gap: 4px; padding-top: 8px; }
  .site-nav { margin-left: -8px; width: calc(100% + 16px); padding-bottom: 6px; }
  .site-nav a { padding: 6px 10px; }
}

/* ------------------------------------------------ 页脚 */
.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 28px 0 40px; color: var(--fg-mute); font-size: 14px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.site-footer p { margin: 0; }
.site-footer strong { color: var(--fg-soft); }

/* ------------------------------------------------ 首页 */
.hero { padding: 64px 0 40px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); margin: 0 0 16px; letter-spacing: -.01em; }
.hero .lead { font-size: clamp(17px, 2.2vw, 20px); color: var(--fg-soft); max-width: 46em; margin: 0 0 28px; }
.eyebrow { display: inline-block; font-size: 13px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 12px; margin-bottom: 16px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 18px; border-radius: 8px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--fg); cursor: pointer;
  font-family: inherit;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.shot {
  margin: 40px 0 0; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--bg-elev);
}
.shot figcaption, figure.shot + .caption { font-size: 13px; color: var(--fg-mute); padding: 8px 14px; }

.section { padding: 48px 0 8px; }
.section > .wrap > h2, .section-title { font-size: clamp(24px, 3.4vw, 32px); margin: 0 0 8px; }
.section-sub { color: var(--fg-soft); margin: 0 0 28px; max-width: 44em; }

.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.card p { margin: 0; color: var(--fg-soft); font-size: 15px; }
.card .ico {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: 15px; font-weight: 700;
}
.card a.more { display: inline-block; margin-top: 10px; font-size: 14px; }

.gallery { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.gallery figure { margin: 0; }
.gallery img { border-radius: 8px; border: 1px solid var(--line); }
.gallery figcaption { font-size: 14px; color: var(--fg-soft); margin-top: 8px; }

.scenes { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.scene { border-left: 3px solid var(--accent); padding: 4px 0 4px 16px; }
.scene h3 { margin: 0 0 4px; font-size: 16px; }
.scene p { margin: 0; color: var(--fg-soft); font-size: 15px; }

.band {
  margin-top: 56px; padding: 28px; border-radius: var(--radius);
  background: var(--accent-soft); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.band h2 { margin: 0 0 4px; font-size: 22px; }
.band p { margin: 0; color: var(--fg-soft); }

/* ------------------------------------------------ 功能页 */
.page-head { padding: 48px 0 8px; }
.page-head h1 { font-size: clamp(28px, 4.4vw, 38px); margin: 0 0 8px; }
.page-head p { color: var(--fg-soft); margin: 0; max-width: 46em; }
.toc-inline { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; padding: 0; list-style: none; }
.toc-inline a { display: inline-block; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; color: var(--fg-soft); background: var(--bg-elev); }
.toc-inline a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.feature {
  display: grid; gap: 28px; align-items: center; padding: 40px 0; border-bottom: 1px solid var(--line);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
}
.feature:last-child { border-bottom: 0; }
.feature.flip > .feature-text { order: 2; }
.feature h2 { margin: 0 0 8px; font-size: 24px; }
.feature ul { padding-left: 1.2em; margin: 12px 0 0; color: var(--fg-soft); }
.feature li { margin: 4px 0; }
.feature p { color: var(--fg-soft); margin: 0; }
.feature img { border-radius: 8px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.feature .noshot {
  border: 1px dashed var(--line); border-radius: 8px; padding: 24px; color: var(--fg-soft); background: var(--bg-elev); font-size: 15px;
}
.feature .noshot strong { color: var(--fg); display: block; margin-bottom: 6px; }
@media (max-width: 800px) {
  .feature { grid-template-columns: 1fr; padding: 28px 0; }
  .feature.flip > .feature-text { order: 0; }
}

/* ------------------------------------------------ 帮助中心 */
.help { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; padding-top: 32px; }
.help-nav { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow-y: auto; font-size: 14px; }
.help-nav h2 { font-size: 13px; color: var(--fg-mute); text-transform: none; margin: 0 0 8px; letter-spacing: .04em; }
.help-nav ol { list-style: none; margin: 0; padding: 0; }
.help-nav a { display: block; padding: 4px 10px; border-radius: 6px; color: var(--fg-soft); }
.help-nav a:hover { background: var(--bg-soft); text-decoration: none; color: var(--fg); }
.help-nav details summary { display: none; }
.prose { min-width: 0; }
.prose h1 { font-size: 32px; margin: 0 0 12px; }
.prose h2 { font-size: 24px; margin: 48px 0 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.prose h2:first-of-type { border-top: 0; }
.prose h3 { font-size: 18px; margin: 28px 0 8px; }
.prose img { border-radius: 8px; border: 1px solid var(--line); margin: 12px 0 4px; }
.prose sub { color: var(--fg-mute); font-size: 13px; vertical-align: baseline; }
.prose blockquote { margin: 16px 0; padding: 8px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--fg-soft); }
.prose blockquote p { margin: 4px 0; }
.prose li { margin: 4px 0; }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.anchor { margin-left: 8px; color: var(--fg-mute); opacity: 0; font-weight: 400; }
h2:hover > .anchor, h3:hover > .anchor, .anchor:focus { opacity: 1; text-decoration: none; }
@media (max-width: 900px) {
  .help { grid-template-columns: 1fr; gap: 16px; }
  .help-nav { position: static; max-height: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--bg-elev); }
  .help-nav details summary { display: list-item; cursor: pointer; font-weight: 600; color: var(--fg); padding: 4px 0; }
  .help-nav h2 { display: none; }
}

/* ------------------------------------------------ 视频页 */
.video-box { margin-top: 28px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000; box-shadow: var(--shadow); }
.video-box video { width: 100%; aspect-ratio: 16 / 9; }
.video-notes { color: var(--fg-soft); margin-top: 20px; }

/* ------------------------------------------------ 更新日志 */
.releases { margin-top: 28px; display: grid; gap: 16px; }
.release { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.release header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 8px; }
.release h2 { margin: 0; font-size: 20px; font-family: var(--mono); }
.release time { color: var(--fg-mute); font-size: 14px; }
.release .notes > :first-child { margin-top: 0; }
.release .notes > :last-child { margin-bottom: 0; }
.empty, .loading { color: var(--fg-mute); padding: 32px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--bg-elev); }
.error-box { color: var(--danger); background: var(--danger-soft); padding: 12px 16px; border-radius: 8px; }

/* ------------------------------------------------ 404 */
.notfound { text-align: center; padding: 96px 0 40px; }
.notfound h1 { font-size: 64px; margin: 0; font-family: var(--mono); color: var(--accent); }

/* ------------------------------------------------ 后台 */
.admin-main { padding-top: 24px; }
.login { max-width: 420px; margin: 64px auto 0; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.login h1 { margin: 0 0 4px; font-size: 22px; }
.login p { margin: 0 0 16px; color: var(--fg-soft); font-size: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; font-size: 14px; }
.field > span { color: var(--fg-soft); }
input[type="text"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  font: inherit; font-size: 15px; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%;
}
textarea { min-height: 220px; font-family: var(--mono); font-size: 14px; line-height: 1.5; resize: vertical; }
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 16px; }
.tabs button {
  font: inherit; font-size: 15px; background: none; border: 0; padding: 6px 14px; border-radius: 8px; cursor: pointer; color: var(--fg-soft);
}
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tabs .spacer { flex: 1; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.toolbar select, .toolbar input { width: auto; min-width: 140px; }
.toolbar .hint { color: var(--fg-mute); font-size: 13px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
table.data th { color: var(--fg-mute); font-weight: 600; background: var(--bg-soft); position: sticky; top: 0; }
table.data td.wrap-cell { white-space: normal; min-width: 180px; max-width: 360px; word-break: break-word; }
table.data tr:last-child td { border-bottom: 0; }
.mono { font-family: var(--mono); font-size: 13px; }
.sub { color: var(--fg-mute); font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; font-weight: 500; border-radius: 6px; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn-danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge-ok { color: var(--ok); background: var(--ok-soft); }
.badge-warn { color: var(--warn); background: var(--warn-soft); }
.badge-danger { color: var(--danger); background: var(--danger-soft); }
.badge-info { color: var(--accent); background: var(--accent-soft); }
.badge-muted { color: var(--fg-mute); background: var(--bg-soft); }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.notice-error { color: var(--danger); background: var(--danger-soft); }
.notice-warn { color: var(--warn); background: var(--warn-soft); }
.notice-ok { color: var(--ok); background: var(--ok-soft); }
.usage { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); margin-bottom: 12px; font-size: 14px; }
.usage b { font-size: 16px; }
details.log summary { cursor: pointer; color: var(--accent); }
details.log pre { white-space: pre-wrap; word-break: break-all; max-height: 360px; max-width: 640px; overflow: auto; font-size: 12px; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); color: var(--fg); padding: 20px; width: min(720px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { margin: 0 0 12px; font-size: 18px; }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.preview { border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; max-height: 260px; overflow: auto; font-size: 14px; }
.hidden { display: none !important; }
