:root {
  color-scheme: dark;
  --bg: #080807;
  --surface: #11110f;
  --surface-soft: #161512;
  --text: #f5f0e7;
  --muted: rgba(235, 226, 210, .66);
  --border: rgba(201, 168, 76, .18);
  --border-strong: rgba(201, 168, 76, .38);
  --gold: #c9a84c;
  --gold-soft: #e2c76c;
  --shadow: rgba(0, 0, 0, .32);
  --serif: "Instrument Serif", Georgia, "Noto Serif TC", "Source Han Serif TC", "Songti TC", "PMingLiU", serif;
  --sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f0e7;
  --surface: #fffdf8;
  --surface-soft: #eee7da;
  --text: #17130e;
  --muted: rgba(35, 28, 20, .68);
  --border: rgba(121, 87, 25, .2);
  --border-strong: rgba(121, 87, 25, .42);
  --gold: #8b681f;
  --gold-soft: #6f5015;
  --shadow: rgba(73, 54, 22, .12);
}

:lang(zh) body :is(h1, h2) { letter-spacing: normal !important; }
:lang(zh) [data-zh] { text-transform: none !important; }

* { box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 82% -12%, rgba(201, 168, 76, .1), transparent 31rem),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

button { font: inherit; }

:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 12px;
  padding: 9px 13px;
  transform: translateY(-160%);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px);
}

.nav-shell {
  display: flex;
  min-height: 66px;
  width: 100%;
  margin: 0 auto;
  padding: 0 40px;
  align-items: center;
  gap: 32px;
}

.brand {
  flex: 0 0 auto;
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.65rem;
  line-height: 1;
  text-decoration: none;
}

.primary-links {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 22px;
}

.primary-links a,
.legal-footer a {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-decoration: none;
  text-transform: uppercase;
}

.primary-links a:hover,
.primary-links a:focus-visible,
.legal-footer a:hover,
.legal-footer a:focus-visible { color: var(--gold-soft); }

.nav-utilities {
  display: flex;
  margin-left: auto;
  align-items: center;
  gap: 9px;
}

.language-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
}

.language-group button,
.theme-toggle {
  min-width: 38px;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
}

.language-group button + button { border-left: 1px solid var(--border); }

.language-group button[aria-pressed="true"] {
  background: var(--surface-soft);
  color: var(--gold-soft);
}

.theme-toggle {
  padding: 0 12px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.language-group button:hover,
.theme-toggle:hover { color: var(--text); }

.legal-main {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 72px 40px;
}

.legal-hero {
  max-width: 720px;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--border);
}

.legal-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--gold-soft);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.legal-kicker::before {
  width: 28px;
  height: 1px;
  background: currentColor;
  content: "";
}

h1 {
  max-width: 12ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.125rem, 4vw, 3rem);
  font-weight: 400;
  letter-spacing: -.01em;
  line-height: 1.05;
}

.legal-lead {
  max-width: 680px;
  margin: 20px 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(1.125rem, 1.6vw, 1.5rem);
  font-style: italic;
  line-height: 1.35;
}

.legal-meta {
  margin: 17px 0 0;
  color: var(--muted);
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.legal-layout {
  display: grid;
  grid-template-columns: minmax(160px, 210px) minmax(0, 720px);
  gap: clamp(48px, 8vw, 110px);
  padding-top: clamp(44px, 6vw, 72px);
}

.legal-aside { align-self: start; }

.legal-aside-inner {
  position: sticky;
  top: 96px;
}

.legal-aside-title {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.legal-toc {
  display: grid;
  border-top: 1px solid var(--border);
}

.legal-toc a {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: .78rem;
  text-decoration: none;
}

.legal-toc a:hover,
.legal-toc a:focus-visible { color: var(--gold-soft); }

.legal-body { min-width: 0; }

.legal-section {
  padding: 0 0 30px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 100px;
}

.legal-section + .legal-section { padding-top: 30px; }

.legal-section h2 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: .01em;
  line-height: 1.4;
}

.legal-section p {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.82;
}

.legal-next {
  display: flex;
  margin-top: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: .82rem;
}

.legal-next a {
  color: var(--gold-soft);
  font-weight: 650;
  text-underline-offset: 4px;
}

.legal-footer {
  border-top: 1px solid var(--border);
}

.footer-shell {
  display: flex;
  width: 100%;
  min-height: 110px;
  margin: 0 auto;
  padding: 0 40px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-signature {
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.3rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-links [aria-current="page"] { color: var(--gold-soft); }

@media (max-width: 760px) {
  .nav-shell {
    width: 100%;
    min-height: auto;
    padding: 13px 24px 12px;
    flex-wrap: wrap;
    gap: 12px 18px;
  }

  .primary-links {
    order: 3;
    width: 100%;
    padding-top: 10px;
    overflow-x: auto;
    border-top: 1px solid var(--border);
    gap: 19px;
    scrollbar-width: none;
  }

  .primary-links::-webkit-scrollbar { display: none; }

  .brand,
  .primary-links a,
  .footer-links a {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
  }

  .primary-links a { flex: 0 0 auto; }

  .language-group button,
  .theme-toggle { min-height: 44px; }

  .language-group button { min-width: 44px; }

  .legal-main { width: 100%; padding-right: 24px; padding-left: 24px; }

  .legal-layout { grid-template-columns: 1fr; gap: 34px; }

  .legal-aside-inner { position: static; }

  .legal-toc { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .legal-toc a:nth-child(odd) { padding-right: 12px; }

  .footer-shell {
    width: 100%;
    padding: 28px 24px;
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .brand { font-size: 1.45rem; }
  .nav-utilities { gap: 6px; }
  .language-group button { min-width: 44px; }
  .theme-toggle { padding: 0 9px; }
  .legal-toc { grid-template-columns: 1fr; }
  .legal-toc a:nth-child(odd) { padding-right: 0; }
  .legal-next { align-items: flex-start; flex-direction: column; }
  .footer-links { align-items: flex-start; flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

@media print {
  .site-header, .legal-aside, .legal-next, .legal-footer, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  .legal-main { width: 100%; padding: 0; }
  .legal-layout { display: block; }
  .legal-section { break-inside: avoid; }
}
