/* 配色与 App 一致 (client/app/src/ui/theme.ts)：黛色夜景作底，粉墙色文字，月光金，梅红点缀 */
:root {
  --bg: #14191B;
  --surface: #1C2326;
  --surface-raised: #242C30;
  --line: #2E383C;
  --text: #F3EFE6;
  --text-muted: #9AA39F;
  --text-faint: #6B7479;
  --moon: #E8BE69;
  --moon-deep: #C9973F;
  --blossom: #D8352A;
  --seal: #B8332A;
  --radius: 14px;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.25; margin: 0; letter-spacing: 0.02em; }
p { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; color: var(--moon); }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 760px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px;
  border-radius: 999px;
  background: var(--moon); color: #1F2629;
  font-weight: 600; font-size: 16px;
  transition: background .2s, transform .2s;
}
.btn:hover { background: #F2CD80; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface); }
.btn-sm { min-height: 36px; padding: 0 16px; font-size: 14px; }
.btn-disabled { background: var(--surface-raised); color: var(--text-faint); cursor: default; }
.btn-disabled:hover { background: var(--surface-raised); }

/* 导航 */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(20, 25, 27, 0.82);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid rgba(46, 56, 60, 0.6);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img { border-radius: 7px; }
.brand-name { font-family: Baskerville, Georgia, var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 0.01em; }
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 15px; color: var(--text-muted); }
.nav-links a:not(.btn):hover { color: var(--text); }
.nav-links > * { white-space: nowrap; }
@media (max-width: 719px) {
  .nav-links { gap: 10px; }
  .nav-links a:not(.btn) { display: none; }
  .nav-links .lang-select-nav { display: none; }
  .nav-links .btn { white-space: nowrap; }
}
@media (max-width: 400px) {
  .nav-links .btn-sm { padding: 0 12px; }
}

/* 语言切换 (导航与页脚)：不显眼的小号下拉，配色跟随所在位置的链接 */
.lang-select {
  -webkit-appearance: none; appearance: none;
  height: 32px; padding: 0 26px 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background-color: transparent;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 13px center, right 9px center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  color: inherit; font: inherit; font-size: 13px; line-height: 1;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.lang-select:hover { color: var(--text); border-color: var(--text-faint); }
.lang-select:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.lang-select option { background: var(--surface-raised); color: var(--text); }

/* 首屏：月夜动画铺满作背景，文字压在左侧暗墙上 */
.hero {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-start;
  /* 手机上文字在上，门在文字下方露出，只有瓦顶压在文字后面 */
  --gx: 50%; --gh: min(58svh, 470px);
  padding: 40px 0 calc(var(--gh) * .78);
}
.hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  /* 墙外夜空：由上往下渐亮，门的上方透出月光 */
  background:
    radial-gradient(ellipse 60% 55% at var(--gx) calc(100% - var(--gh) * .55), rgba(232, 190, 105, .16), rgba(232, 190, 105, 0) 70%),
    linear-gradient(180deg, var(--bg) 0%, #121C22 40%, #182630 100%);
}
.hero-bg .sky { position: absolute; left: 0; top: 0; width: 100%; height: calc(100% - var(--gh) * .88); }
/* 门洞中心在 SVG 宽度的 59.21% (scripts/gate.py 输出的 GATE_FRACTION)，用 --gx 定位 */
.hero-bg .gate {
  position: absolute; bottom: 0; left: var(--gx);
  height: var(--gh); width: auto; max-width: none;
  transform: translateX(-59.21%);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20, 25, 27, 0) 50%, rgba(20, 25, 27, .6) 62%, rgba(20, 25, 27, 0) 72%);
}
.hero-inner { position: relative; }
.hero-copy { max-width: 36em; }
@media (min-width: 900px) {
  .hero { justify-content: center; padding: 0; min-height: min(calc(100svh - 64px), 900px); --gx: 66%; --gh: 100%; }
  .hero-bg::after {
    background:
      linear-gradient(90deg, rgba(20, 25, 27, .92) 0%, rgba(20, 25, 27, .7) 30%, rgba(20, 25, 27, 0) 50%),
      linear-gradient(180deg, var(--bg) 0%, rgba(20, 25, 27, 0) 12%);
  }
  .hero-copy { max-width: 30em; padding: 48px 0; }
}
.eyebrow {
  display: inline-block; margin-bottom: 20px;
  color: var(--moon); font-size: 14px; letter-spacing: 0.3em;
}
.hero h1 { font-size: clamp(34px, 6.4vw, 62px); text-shadow: 0 2px 24px rgba(0, 0, 0, .5); }
.hero h1 span { display: block; white-space: nowrap; }
/* 英文句子更长，标题允许换行；字距收窄 */
html:lang(en) .hero h1 span { white-space: normal; }
html:lang(en) .eyebrow { letter-spacing: 0.12em; }
@media (min-width: 900px) { .hero h1 { font-size: clamp(44px, 4.6vw, 66px); } }
.lead { margin-top: 24px; max-width: 34em; color: #B4BCB8; font-size: clamp(16px, 2vw, 18px); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.hero-note { margin-top: 24px; color: var(--text-faint); font-size: 14px; }
.btn-ghost { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); background: rgba(20, 25, 27, .35); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* 通用区块 */
.section { padding: 72px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (min-width: 900px) { .section { padding: 104px 0; } }
.section h2 { font-size: clamp(26px, 4vw, 38px); }
.section-lead { margin-top: 14px; max-width: 40em; color: var(--text-muted); }

/* 卖点 */
.features, .scenes { display: grid; gap: 16px; margin-top: 40px; }
@media (min-width: 640px) { .features, .scenes { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .features, .scenes { grid-template-columns: repeat(4, 1fr); gap: 20px; } }
.features article, .scenes article {
  padding: 28px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--line);
}
.f-icon {
  display: grid; place-items: center;
  width: 48px; height: 48px; margin-bottom: 20px; border-radius: 12px;
  background: rgba(232, 190, 105, 0.1);
}
.f-icon svg { width: 24px; height: 24px; fill: none; stroke: var(--moon); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.features h3, .scenes h3 { font-size: 21px; }
.features p, .scenes p { margin-top: 10px; color: var(--text-muted); }
.scenes article { background: var(--surface); }

/* 步骤 */
.steps { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 28px; counter-reset: none; }
@media (min-width: 900px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 40px; } }
.steps li { position: relative; padding-top: 4px; }
.step-no {
  display: grid; place-items: center;
  width: 44px; height: 44px; margin-bottom: 18px; border-radius: 50%;
  border: 3px solid #8A9296;
  font-family: var(--serif); font-size: 18px; color: var(--moon);
}
.steps h3 { font-size: 21px; }
.steps p { margin-top: 8px; color: var(--text-muted); }

/* 下载 */
.downloads { display: grid; gap: 16px; margin-top: 40px; }
@media (min-width: 900px) { .downloads { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.dl {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 28px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--line);
}
.dl h3 { font-size: 20px; }
.dl > p:first-of-type { margin: 8px 0 24px; color: var(--text-muted); flex: 1; }
.dl-tip { margin-top: 16px; color: var(--text-faint); font-size: 14px; }
.dl-beta { margin-top: 6px; font-size: 13px; }
.dl-beta a { color: inherit; text-decoration: underline; }

/* 常见问题 */
#faq h2 { margin-bottom: 28px; }
details { border-bottom: 1px solid var(--line); }
details:first-of-type { border-top: 1px solid var(--line); }
summary {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 20px 0; cursor: pointer; list-style: none;
  font-size: 17px; font-weight: 600;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: ""; flex: none; width: 10px; height: 10px;
  border-right: 2px solid var(--text-faint); border-bottom: 2px solid var(--text-faint);
  transform: rotate(45deg) translateY(-3px); transition: transform .2s;
}
details[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
details p { padding: 0 0 22px; color: var(--text-muted); }

/* 页脚 */
.footer { padding: 48px 0 calc(48px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: center; }

/* 页脚链接 */
.footer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; color: var(--text-faint); font-size: 14px; }
.footer-meta a:hover { color: var(--text); }

/* 隐私政策、服务条款 */
.legal { padding: 48px 0 72px; }
@media (min-width: 900px) { .legal { padding: 72px 0 104px; } }
.legal h1 { font-size: clamp(30px, 5vw, 42px); }
.legal-meta { margin-top: 12px; color: var(--text-faint); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
/* 法律页日期旁的语言切换：窄屏导航里的切换器隐藏了，这里补一个；宽屏用导航里的 */
@media (min-width: 720px) { .legal-meta .lang-select-legal { display: none; } }
.legal-intro { margin-top: 28px; color: var(--text-muted); }
.legal h2 { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 22px; }
.legal h3 { margin-top: 28px; font-family: var(--sans); font-size: 17px; }
.legal p, .legal ul { margin-top: 14px; }
.legal ul { padding-left: 1.3em; }
.legal li + li { margin-top: 8px; }
.legal li::marker { color: var(--text-faint); }
.legal strong { color: var(--text); font-weight: 600; }
.legal p, .legal li { color: #C9CFCB; }
.legal a:not(.btn) { color: var(--moon); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.legal a:not(.btn):hover { color: #F2CD80; }
.legal-table { width: 100%; margin-top: 16px; border-collapse: collapse; font-size: 15px; }
.legal-table th, .legal-table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.legal-table th { color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.legal-table td { color: #C9CFCB; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .legal-table { min-width: 520px; }
