:root {
  color-scheme: light dark;
  --paper: #f7f2e9;
  --paper-strong: #fffaf1;
  --ink: #1d1c19;
  --muted: #605b53;
  --faint: #746e65;
  --accent: #e85823;
  --accent-deep: #b83b12;
  --line: color-mix(in srgb, var(--ink), transparent 87%);
  --gutter: clamp(20px, 4vw, 48px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; }

.skip-link {
  position: fixed; z-index: 20; left: 16px; top: 12px; padding: 10px 14px;
  border-radius: 12px; background: var(--ink); color: var(--paper); transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

.legal-header {
  width: min(1120px, calc(100% - 28px)); height: 58px; margin: 14px auto 0;
  padding: 0 12px; display: flex; align-items: center; gap: 20px;
  border-radius: 19px; background: color-mix(in srgb, var(--paper-strong), transparent 14%);
  box-shadow: 0 14px 46px rgba(52, 39, 21, .09);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 740; letter-spacing: -.02em; }
.brand img { width: 36px; height: 36px; border-radius: 9px; box-shadow: 0 4px 13px rgba(41, 29, 12, .17); }
.legal-nav { margin-left: auto; display: flex; gap: 5px; }
.legal-nav a { min-height: 44px; padding: 0 13px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); font-size: 13px; }
.legal-nav a:hover { background: color-mix(in srgb, var(--ink), transparent 94%); color: var(--ink); }

.legal-shell {
  width: min(1120px, 100%); margin: 0 auto; padding: 64px var(--gutter) 72px;
  display: grid; grid-template-columns: minmax(200px, 240px) minmax(0, 1fr); gap: clamp(40px, 6vw, 72px);
}
.legal-intro { position: sticky; top: 42px; align-self: start; }
h1 { margin: 0; font-size: 36px; font-weight: 700; letter-spacing: 0; line-height: 1.35; text-wrap: balance; }
.lede { max-width: 430px; margin: 14px 0 0; color: var(--muted); font-size: 16px; line-height: 1.75; }
.updated { margin: 18px 0 0; color: var(--faint); font-size: 12px; line-height: 1.75; }
.back-link { margin-top: 20px; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; color: var(--accent-deep); font-size: 13px; font-weight: 650; }
.support-nav { margin-top: 22px; display: grid; gap: 2px; }
.support-nav a { display: flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 14px; }
.support-nav a:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 4px; }

.legal-content { min-width: 0; }
.legal-content section { padding: 28px 0 32px; border-top: 1px solid var(--line); scroll-margin-top: 28px; }
.legal-content section:first-child { padding-top: 0; border-top: 0; }
.section-index { display: block; margin-bottom: 11px; color: var(--accent-deep); font: 730 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
h2 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: 0; line-height: 1.4; text-wrap: balance; }
.legal-content p, .legal-content li { color: var(--muted); font-size: 16px; line-height: 1.8; overflow-wrap: break-word; }
.legal-content p { margin: 14px 0 0; }
.legal-content ul, .legal-content ol { margin: 14px 0 0; padding-left: 1.25em; }
.legal-content li + li { margin-top: 9px; }
.legal-content strong { color: var(--ink); }
.callout { margin-top: 18px; padding: 4px 0 4px 16px; border-left: 2px solid var(--line); }
.callout p { margin: 0; }
.legal-content .quiet-note { font-size: 14px; line-height: 1.75; }
.support-details { margin-top: 12px; }
.support-details summary { min-height: 44px; padding: 9px 0; color: var(--accent-deep); font-size: 16px; line-height: 1.6; cursor: pointer; }
.action-link { display: inline-flex; min-height: 44px; margin-top: 16px; align-items: center; gap: 8px; color: var(--accent-deep); font-weight: 720; }
.redeem-form { margin-top: 18px; }
.redeem-form label { display: block; margin-bottom: 9px; color: var(--ink); font-size: 13px; font-weight: 720; }
.redeem-form div { display: flex; gap: 9px; }
.redeem-form input { min-width: 0; flex: 1; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper-strong); color: var(--ink); font: 650 15px/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.redeem-form button { min-height: 48px; padding: 0 18px; border: 0; border-radius: 13px; background: var(--ink); color: var(--paper); font: inherit; font-weight: 720; cursor: pointer; }
.redeem-form button:disabled { cursor: wait; opacity: .58; }
.redeem-form [data-dev-status] { min-height: 1.8em; margin-top: 8px; font-size: 13px; }

.legal-footer {
  width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 34px;
  display: flex; align-items: center; gap: 18px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px;
}
.legal-footer nav { margin-left: auto; display: flex; gap: 18px; }

a:focus-visible, summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent), transparent 30%); outline-offset: 3px; border-radius: 6px; }

@media (prefers-color-scheme: dark) {
  :root { --paper: #12110f; --paper-strong: #1b1916; --ink: #f2ece2; --muted: #aaa399; --faint: #a19a90; --accent: #ff7640; --accent-deep: #ff956e; --line: rgba(255,255,255,.12); }
  .legal-header { background: rgba(27,25,22,.92); box-shadow: 0 16px 48px rgba(0,0,0,.28); }
}

@media (max-width: 760px) {
  .legal-header { height: auto; min-height: 58px; margin-top: 10px; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .legal-nav { width: 100%; margin-left: 0; border-top: 1px solid var(--line); padding-top: 4px; }
  .legal-nav a { flex: 1; padding: 0 6px; }
  .legal-shell { padding-top: 36px; padding-bottom: 44px; grid-template-columns: 1fr; gap: 32px; }
  .legal-intro { position: static; }
  h1 { font-size: 30px; }
  h2 { font-size: 20px; }
  .support-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; gap: 0 20px; }
  .legal-footer { align-items: flex-start; flex-direction: column; }
  .legal-footer nav { margin-left: 0; }
  .redeem-form div { align-items: stretch; flex-direction: column; }
}

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

.legal-footer .language-links { flex-basis: 100%; flex-wrap: wrap; gap: 16px; }
