/* Privacy Policy and Terms pages. Theme tokens mirror src/input.css so the saved game theme carries over.
   Footer + HR live in footer.css. */

:root,
[data-theme="classic"] {
  color-scheme: light;
  --page-from: #e6f1ff; --page-to: #f2ecff;
  --foreground: #0f1f4d; --foreground-muted: #44577f;
  --surface: rgb(255 255 255 / 0.7); --surface-strong: #ffffff;
  --border: rgb(37 99 235 / 0.2);
  --brand: #2563eb; --brand-strong: #1d4ed8; --brand-foreground: #ffffff;
  --mark-x: #2563eb; --mark-o: #7c3aed;
  --success: #15803d; --danger: #b91c1c; --focus: #1d4ed8;
  --shadow-rgb: 15 31 77;
}
[data-theme="dark"], [data-theme="black"] {
  color-scheme: dark;
  --page-from: #070d1f; --page-to: #111d45;
  --foreground: #eef3ff; --foreground-muted: #b3c3e6;
  --surface: rgb(24 36 78 / 0.62); --surface-strong: #22336b;
  --border: rgb(140 170 255 / 0.28);
  --brand: #2563eb; --brand-strong: #1d4ed8; --brand-foreground: #ffffff;
  --mark-x: #5cc8ff; --mark-o: #c4a0ff;
  --success: #34d399; --danger: #ff8a8a; --focus: #7cc0ff;
  --shadow-rgb: 0 0 0;
}
[data-theme="neon"] {
  color-scheme: dark;
  --page-from: #1c0a47; --page-to: #2e1470;
  --foreground: #f5eeff; --foreground-muted: #cdbcf7;
  --surface: rgb(255 255 255 / 0.08); --surface-strong: #3b1c88;
  --border: rgb(255 255 255 / 0.18);
  --brand: #7c3aed; --brand-strong: #6d28d9; --brand-foreground: #ffffff;
  --mark-x: #38bdf8; --mark-o: #f78cc6;
  --success: #4ade80; --danger: #ff8a9b; --focus: #38bdf8;
  --shadow-rgb: 0 0 0;
}
[data-theme="nature"] {
  color-scheme: light;
  --page-from: #d8f1ee; --page-to: #cfe6f7;
  --foreground: #0c2f2c; --foreground-muted: #35605b;
  --surface: rgb(255 255 255 / 0.6); --surface-strong: #f4fffd;
  --border: rgb(15 118 110 / 0.28);
  --brand: #0f766e; --brand-strong: #115e59; --brand-foreground: #ffffff;
  --mark-x: #0f766e; --mark-o: #db2777;
  --success: #15803d; --danger: #b91c1c; --focus: #115e59;
  --shadow-rgb: 12 47 44;
}
[data-theme="cyberpunk"] {
  color-scheme: dark;
  --page-from: #080d1c; --page-to: #170b30;
  --foreground: #e6faff; --foreground-muted: #9cc0d0;
  --surface: rgb(255 255 255 / 0.06); --surface-strong: #121c38;
  --border: rgb(34 211 238 / 0.3);
  --brand: #22d3ee; --brand-strong: #06b6d4; --brand-foreground: #04141a;
  --mark-x: #22d3ee; --mark-o: #ff5fd8;
  --success: #34d399; --danger: #ff7a90; --focus: #22d3ee;
  --shadow-rgb: 0 0 0;
}
[data-theme="wooden"] {
  color-scheme: light;
  --page-from: #f3e3c7; --page-to: #e6c898;
  --foreground: #3a1f0b; --foreground-muted: #66421f;
  --surface: rgb(255 250 240 / 0.6); --surface-strong: #fff8ea;
  --border: rgb(122 67 30 / 0.3);
  --brand: #8a4a1c; --brand-strong: #6f3a14; --brand-foreground: #ffffff;
  --mark-x: #9a3412; --mark-o: #1e4e79;
  --success: #166534; --danger: #b91c1c; --focus: #6f3a14;
  --shadow-rgb: 58 31 11;
}
/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body.legal-body {
  min-height: 100dvh;
  margin: 0;
  color: var(--foreground);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-color: var(--page-from);
  background-image:
    radial-gradient(60rem 30rem at 0% 0%, color-mix(in oklab, var(--brand) 18%, transparent), transparent 60%),
    radial-gradient(50rem 28rem at 100% 100%, color-mix(in oklab, var(--mark-o) 16%, transparent), transparent 60%),
    linear-gradient(160deg, var(--page-from), var(--page-to));
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
a { color: inherit; }
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 50;
  padding: .6rem 1rem; border-radius: var(--r-sm);
  background: var(--surface-strong); color: var(--foreground); font-weight: 700; text-decoration: none;
  box-shadow: 0 8px 24px rgb(var(--shadow-rgb) / .25);
}
.skip-link:focus { top: max(1rem, env(safe-area-inset-top)); }

/* ---------- Top bar ---------- */
.lg-nav {
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--page-from) 72%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
}
.lg-nav .hr { position: absolute; inset-inline: 0; bottom: 0; width: auto; }
.lg-nav-inner {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
  padding-block: .75rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem;
}
.lg-brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font-weight: 800; letter-spacing: -.025em; text-decoration: none; border-radius: var(--r-sm);
}
.lg-brand img { display: block; width: auto; height: 1.75rem; }

.lg-tabs {
  order: 3; width: 100%;
  display: flex; gap: .25rem; padding: .25rem; border-radius: 999px;
  background: color-mix(in srgb, var(--foreground) 6%, transparent);
}
.lg-tabs a {
  flex: 1; display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.25rem; padding-inline: .9rem; border-radius: 999px;
  color: var(--foreground-muted); font-size: .875rem; font-weight: 700; text-decoration: none; white-space: nowrap;
  transition: color .15s ease-out, background-color .15s ease-out;
}
.lg-tabs a:hover { color: var(--foreground); background: color-mix(in srgb, var(--foreground) 7%, transparent); }
.lg-tabs a[aria-current="page"] {
  color: var(--foreground); background: var(--surface-strong);
  box-shadow: 0 1px 2px rgb(var(--shadow-rgb) / .12), 0 4px 10px -4px rgb(var(--shadow-rgb) / .18);
}

.lg-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 2.5rem; padding-inline: .9rem 1.05rem; border-radius: var(--r-md);
  color: var(--foreground); font-size: .875rem; font-weight: 700; text-decoration: none;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--surface-strong) 70%, transparent);
  transition: background-color .15s ease-out, border-color .15s ease-out;
}
.lg-btn:hover { background: var(--surface-strong); border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.lg-btn svg, .lg-badge svg, .lg-note svg { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.lg-btn svg { width: 1.25rem; height: 1.25rem; }

/* ---------- Page ---------- */
.lg-main { flex: 1; width: min(100% - 2rem, 72rem); margin-inline: auto; padding-top: clamp(2rem, 6vw, 4.5rem); }

.lg-hero { max-width: 46rem; padding-bottom: clamp(2rem, 5vw, 3.25rem); }
.lg-badge {
  display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: 1.25rem;
  border-radius: var(--r-lg); color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, var(--surface-strong));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 28%, transparent), 0 8px 20px -10px color-mix(in srgb, var(--brand) 55%, transparent);
}
.lg-badge svg { width: 1.5rem; height: 1.5rem; }
.lg-hero h1 {
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 3.5rem); font-weight: 800; line-height: 1.04; letter-spacing: -.045em;
}
.lg-lede { margin: 1rem 0 0; max-width: 40rem; color: var(--foreground-muted); font-size: 1.0625rem; line-height: 1.7; }
.lg-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.lg-meta li {
  padding: .35rem .8rem; border-radius: 999px;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--surface-strong) 60%, transparent);
  color: var(--foreground-muted); font-size: .8125rem; font-weight: 600;
}

/* ---------- Layout: contents + document ---------- */
.lg-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; padding-block: clamp(2rem, 5vw, 3rem) clamp(3rem, 8vw, 5rem); }

.lg-toc h2 { margin: 0 0 .75rem; font-size: .875rem; font-weight: 700; letter-spacing: -.01em; }
.lg-toc ol {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem;
  margin: 0; padding: 0; list-style: none;
}
.lg-toc a {
  display: block; padding: .4rem 0; color: var(--foreground-muted);
  font-size: .875rem; font-weight: 600; line-height: 1.4; text-decoration: none; border-radius: var(--r-sm);
  transition: color .15s ease-out;
}
.lg-toc a:hover { color: var(--foreground); }
.lg-toc a[aria-current="location"] { color: var(--foreground); font-weight: 800; }

.lg-doc { max-width: 44rem; min-width: 0; }
.lg-doc section { scroll-margin-top: 7.5rem; padding-bottom: 2.25rem; }
.lg-doc h2 { margin: 0 0 .75rem; font-size: 1.375rem; font-weight: 800; line-height: 1.25; letter-spacing: -.025em; }
.lg-doc p, .lg-doc li { color: var(--foreground-muted); font-size: 1rem; line-height: 1.75; }
.lg-doc p { margin: 0 0 1rem; }
.lg-doc ul { margin: 0 0 1rem; padding-left: 1.25rem; }
.lg-doc li { margin-bottom: .35rem; padding-left: .25rem; }
.lg-doc li::marker { color: var(--brand); }
.lg-doc a { color: var(--brand-strong); text-underline-offset: 3px; overflow-wrap: anywhere; }
[data-theme="dark"] .lg-doc a, [data-theme="neon"] .lg-doc a, [data-theme="cyberpunk"] .lg-doc a { color: var(--focus); }
[data-theme="dark"] .lg-badge, [data-theme="neon"] .lg-badge, [data-theme="cyberpunk"] .lg-badge,
[data-theme="dark"] .lg-note svg, [data-theme="neon"] .lg-note svg, [data-theme="cyberpunk"] .lg-note svg { color: var(--focus); }

.lg-doc > .hr { margin-block: .5rem 2rem; }
.lg-note {
  display: flex; gap: .85rem; padding: 1rem 1.15rem; border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--brand) 8%, var(--surface-strong));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 22%, transparent);
  color: var(--foreground-muted); font-size: .875rem; line-height: 1.65;
}
.lg-note svg { width: 1.25rem; height: 1.25rem; margin-top: .1rem; color: var(--brand); }
.lg-note p { margin: 0; color: inherit; font-size: inherit; line-height: inherit; }

.lg-next {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: 2rem; padding: 1.1rem 1.25rem; border-radius: var(--r-lg);
  border: 1px solid var(--border); background: color-mix(in srgb, var(--surface-strong) 60%, transparent);
  text-decoration: none; color: var(--foreground);
  transition: background-color .15s ease-out, border-color .15s ease-out;
}
.lg-doc a.lg-next { color: var(--foreground); text-decoration: none; }
.lg-next:hover { background: var(--surface-strong); border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.lg-next small { display: block; color: var(--foreground-muted); font-size: .8125rem; font-weight: 600; }
.lg-next strong { display: block; margin-top: .1rem; font-size: 1rem; font-weight: 800; letter-spacing: -.02em; }
.lg-next svg { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Footer on legal pages ---------- */
.legal-body .site-footer { padding-top: 0; }

@media (min-width: 720px) {
  .lg-tabs { order: 0; width: auto; }
  .lg-tabs a { flex: none; }
  .lg-nav-inner { flex-wrap: nowrap; }
}
@media (min-width: 980px) {
  .lg-layout { grid-template-columns: 15rem minmax(0, 1fr); gap: 4rem; }
  .lg-toc { position: sticky; top: 6.5rem; align-self: start; max-height: calc(100dvh - 8rem); overflow-y: auto; }
  .lg-toc ol { grid-template-columns: 1fr; gap: 0; border-left: 1px solid var(--hr-ink); }
  .lg-toc a { padding: .45rem 0 .45rem 1rem; margin-left: -1px; border-left: 1px solid transparent; border-radius: 0; }
  .lg-toc a[aria-current="location"] { border-left-color: var(--brand); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .lg-tabs a, .lg-btn, .lg-next, .lg-toc a { transition: none; }
}

.legal-body .site-footer { padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right)); }
.local-note { max-width: 20rem; margin: .5rem auto 0; font-size: .8rem; line-height: 1.4; font-weight: 600; color: var(--foreground-muted, inherit); text-align: center; }

/* narrow phones: brand, tabs and Back button wrap instead of overflowing or overlapping */
.lg-nav-inner > * { min-width: 0; }
@media (max-width: 719px) {
  .lg-tabs a { min-width: 0; padding: .3rem .5rem; white-space: normal; text-align: center; line-height: 1.15; font-size: .8125rem; }
  .lg-btn { min-height: 2.25rem; margin-left: auto; }
}
