:root {
  --bg: #0b0d12;
  --bg-elev: #0f1218;
  --card-bg: rgba(22, 26, 34, 0.7);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #e8e9ed;
  --text-muted: rgba(232, 233, 237, 0.6);
  --text-dim: rgba(232, 233, 237, 0.4);
  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.12);
  --accent: #f59e0b;
  --green: #22c55e;
  --red: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(ellipse at top, rgba(59,130,246,0.06), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(245,158,11,0.04), transparent 50%),
    var(--bg);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.legal-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.legal-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.legal-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 700; font-size: 17px;
  text-decoration: none;
}
.legal-brand-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), #6366f1);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 14px;
}
.legal-brand:hover { text-decoration: none; }
.legal-back {
  color: var(--text-muted);
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.15s;
}
.legal-back:hover {
  color: var(--text);
  border-color: var(--border-strong);
  text-decoration: none;
}

/* Layout */
.legal-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
}

/* Sidebar TOC */
.legal-sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.legal-toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 14px;
  padding-left: 14px;
}
.legal-nav { list-style: none; }
.legal-nav li a {
  display: block;
  padding: 9px 14px;
  color: var(--text-muted);
  font-size: 14px;
  border-radius: 8px;
  margin-bottom: 2px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.legal-nav li a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
  text-decoration: none;
}
.legal-nav li a.active {
  color: var(--text);
  background: var(--blue-soft);
  border-left-color: var(--blue);
  font-weight: 600;
}

/* Main content */
.legal-main {
  max-width: 760px;
}
.legal-hero {
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.legal-hero h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 12px;
  background: linear-gradient(180deg, #fff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.legal-hero .subtitle {
  color: var(--text-muted);
  font-size: 16px;
}
.legal-updated {
  display: inline-block;
  margin-top: 14px;
  padding: 5px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  color: var(--text-muted);
}

.legal-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 42px 0 14px;
  color: var(--text);
  letter-spacing: -0.01em;
  scroll-margin-top: 100px;
}
.legal-content h2:first-child { margin-top: 0; }
.legal-content h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--text);
}
.legal-content p {
  margin-bottom: 14px;
  color: var(--text);
}
.legal-content p.muted {
  color: var(--text-muted);
  font-size: 14px;
}
.legal-content ul, .legal-content ol {
  margin: 12px 0 18px 22px;
  color: var(--text);
}
.legal-content li { margin-bottom: 8px; }
.legal-content li strong { color: var(--text); }
.legal-content strong { color: #fff; font-weight: 600; }
.legal-content em { color: var(--text-muted); font-style: italic; }
.legal-content code {
  background: rgba(59,130,246,0.1);
  color: var(--blue);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
}
.legal-content a { color: var(--blue); }
.legal-content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* Placeholder - data to fill */
.tbd {
  display: inline-block;
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  padding: 1px 8px;
  border-radius: 4px;
  border: 1px dashed rgba(245, 158, 11, 0.4);
  font-weight: 600;
  font-size: 13px;
}

/* Card for important info */
.legal-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin: 20px 0;
}
.legal-card h3 { margin-top: 0; }
.legal-card .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: var(--blue-soft);
  color: var(--blue);
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 20px;
}

/* Table */
.legal-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.legal-content th, .legal-content td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.legal-content th {
  background: rgba(255,255,255,0.03);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.legal-content tr:last-child td { border-bottom: none; }

/* Footer */
.legal-footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px 60px;
  margin-top: 40px;
}
.legal-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: space-between;
  align-items: flex-start;
}
.legal-footer-brand { font-size: 13px; color: var(--text-muted); max-width: 340px; line-height: 1.6; }
.legal-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 13px;
}
.legal-footer-links a { color: var(--text-muted); }
.legal-footer-links a:hover { color: var(--text); }
.legal-footer-copy {
  width: 100%;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 20px;
}

/* Mobile */
@media (max-width: 900px) {
  .legal-wrap { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; }
  .legal-sidebar { position: static; max-height: none; }
  .legal-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .legal-nav li a { padding: 8px 12px; font-size: 13px; border-left: none; border: 1px solid var(--border); }
  .legal-nav li a.active { border-color: var(--blue); }
  .legal-hero h1 { font-size: 28px; }
  .legal-header-inner { padding: 14px 16px; }
  .legal-main { max-width: 100%; }
}
