/* ─────────────────────────── BINGMEX Legal Pages — Shared Styles ─────────────────────────── */

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

:root {
  --bg:        #07080C;
  --bg-1:      #0B0E16;
  --bg-2:      #11151F;
  --bg-3:      #161B27;
  --line:      rgba(255,255,255,0.06);
  --line-2:    rgba(255,255,255,0.10);
  --text:      #F5F7FB;
  --text-2:    #A6AFC2;
  --text-3:    #6C748A;
  --brand:     #2A54FF;
  --brand-2:   #5378FF;
  --brand-3:   #7C99FF;
  --brand-d:   #1A3FE0;
  --success:   #00C896;
  --warn:      #F0B90B;
  --danger:    #F6465D;
  --r-sm:      6px;
  --r:         10px;
  --r-lg:      16px;
  --ff:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --fm:        'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --max:       960px;
}

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff);
  font-size: 15.5px;
  line-height: 1.7;
  overflow-x: hidden;
}
a { color: var(--brand-2); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-3); }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--brand); color: #fff; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #1f2535; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #2a3346; }

/* ─────────────────────────── NAV ─────────────────────────── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(7, 8, 12, 0.92);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1240px; margin: 0 auto;
  padding: 0 32px; height: 68px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo {
  height: 26px; width: auto; color: var(--text);
  transition: color .2s;
}
.brand:hover .brand-logo { color: var(--brand-2); }
.brand-x { fill: var(--brand-2); }

.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a {
  font-size: 14px; font-weight: 500; color: var(--text-2);
}
.nav-links a:hover { color: var(--text); }

.nav-right { display: flex; align-items: center; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--ff); font-weight: 600; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--r-sm);
  transition: all .18s; white-space: nowrap;
  text-decoration: none;
}
.btn-ghost {
  background: transparent; color: var(--text);
  border-color: var(--line-2);
  padding: 9px 18px; font-size: 13.5px;
}
.btn-ghost:hover { border-color: var(--brand-2); color: var(--brand-2); }
.btn-primary {
  background: var(--brand); color: #fff;
  padding: 9px 20px; font-size: 13.5px;
  box-shadow: 0 4px 14px rgba(42,84,255,0.35);
}
.btn-primary:hover { background: var(--brand-d); }
.nav-toggle {
  display: none; background: none; border: none; color: var(--text);
  width: 36px; height: 36px; cursor: pointer; align-items: center; justify-content: center;
}
.nav-toggle svg { width: 22px; height: 22px; }

/* ─────────────────────────── PAGE HEADER ─────────────────────────── */
.legal-head {
  position: relative;
  padding: 130px 32px 60px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 400px at 20% 0%, rgba(42,84,255,0.10), transparent 60%),
    var(--bg);
  overflow: hidden;
}
.legal-head::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 60% 50% at 30% 30%, black, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 30% 30%, black, transparent 80%);
  pointer-events: none;
}
.legal-head-inner { max-width: var(--max); margin: 0 auto; position: relative; z-index: 1; }
.crumb {
  font-size: 12.5px; font-weight: 600; color: var(--text-3);
  margin-bottom: 18px; letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 8px;
}
.crumb a { color: var(--text-3); }
.crumb a:hover { color: var(--brand-2); }
.crumb svg { width: 12px; height: 12px; opacity: 0.5; }
.legal-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brand-2); margin-bottom: 16px;
}
.legal-eyebrow::before {
  content: ''; width: 24px; height: 1px; background: var(--brand);
}
.legal-head h1 {
  font-size: clamp(32px, 4.4vw, 52px);
  font-weight: 800; letter-spacing: -0.025em; line-height: 1.1;
  margin-bottom: 18px;
}
.legal-head p.lede {
  font-size: 16.5px; color: var(--text-2); line-height: 1.7;
  max-width: 700px;
}
.legal-meta {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 28px; padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; font-family: var(--fm); color: var(--text-3);
}
.legal-meta-item { display: flex; align-items: center; gap: 6px; }
.legal-meta-item strong { color: var(--text); font-weight: 600; }

/* ─────────────────────────── BODY LAYOUT ─────────────────────────── */
.legal-body {
  padding: 60px 32px 100px;
  position: relative;
}
.legal-grid {
  max-width: 1240px; margin: 0 auto;
  display: grid; grid-template-columns: 240px 1fr;
  gap: 64px;
  align-items: start;
}
.toc {
  position: sticky; top: 92px;
  font-size: 13.5px; line-height: 1.55;
  max-height: calc(100vh - 120px);
  overflow-y: auto; padding-right: 8px;
}
.toc h5 {
  font-size: 11px; font-weight: 700; color: var(--brand-2);
  letter-spacing: 0.14em; text-transform: uppercase;
  margin-bottom: 14px;
}
.toc ol { list-style: none; counter-reset: toc; }
.toc li { margin-bottom: 8px; }
.toc a {
  color: var(--text-2); display: block; padding: 4px 0;
  border-left: 1px solid transparent; padding-left: 14px; margin-left: -14px;
  transition: color .15s, border-color .15s;
}
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--brand-2); border-left-color: var(--brand); }

.prose {
  max-width: 760px;
  font-size: 15.5px; color: var(--text-2);
  line-height: 1.78;
}
.prose h2 {
  color: var(--text); font-size: 22px; font-weight: 800;
  letter-spacing: -0.015em; margin: 56px 0 20px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
  scroll-margin-top: 92px;
}
.prose h2:first-child { margin-top: 0; }
.prose h2 .num {
  display: inline-block; width: 38px; font-family: var(--fm);
  font-size: 16px; font-weight: 600; color: var(--brand-2);
  margin-right: 8px;
}
.prose h3 {
  color: var(--text); font-size: 16.5px; font-weight: 700;
  letter-spacing: -0.01em; margin: 32px 0 12px;
  scroll-margin-top: 92px;
}
.prose p { margin-bottom: 18px; }
.prose ul, .prose ol {
  padding-left: 22px; margin-bottom: 22px;
}
.prose ul li, .prose ol li {
  margin-bottom: 10px; color: var(--text-2);
  line-height: 1.7;
}
.prose ul li::marker { color: var(--brand-2); }
.prose ol li::marker { color: var(--brand-2); font-weight: 600; font-family: var(--fm); }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { color: var(--text); font-style: italic; }

.callout {
  background: rgba(42,84,255,0.06);
  border: 1px solid rgba(42,84,255,0.25);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-sm);
  padding: 18px 22px;
  margin: 24px 0;
  font-size: 14.5px;
  line-height: 1.7;
}
.callout strong { color: var(--brand-3); }

.callout.warn {
  background: rgba(240,185,11,0.05);
  border-color: rgba(240,185,11,0.25);
  border-left-color: var(--warn);
}
.callout.warn strong { color: var(--warn); }

.callout.danger {
  background: rgba(246,70,93,0.05);
  border-color: rgba(246,70,93,0.20);
  border-left-color: var(--danger);
}
.callout.danger strong { color: var(--danger); }

.deflist {
  display: grid; grid-template-columns: 200px 1fr; gap: 14px 28px;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--r); padding: 22px 26px;
  margin: 22px 0; font-size: 14px;
}
.deflist dt {
  color: var(--text-3); font-family: var(--fm);
  font-size: 12.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  align-self: start; padding-top: 2px;
}
.deflist dd { color: var(--text); font-weight: 500; }
.deflist dd a { color: var(--brand-2); }

.tbl {
  width: 100%; border-collapse: collapse; margin: 22px 0;
  font-size: 14px; background: var(--bg-1);
  border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden;
}
.tbl th, .tbl td {
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--line);
}
.tbl th {
  background: rgba(255,255,255,0.025);
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl td { color: var(--text-2); }
.tbl td strong { color: var(--text); }

.legal-cite {
  display: inline-block;
  font-family: var(--fm); font-size: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-2);
  padding: 2px 8px; border-radius: 4px;
  color: var(--text-2); white-space: nowrap;
}

/* ─────────────────────────── FOOTER ─────────────────────────── */
footer {
  background: #04050A;
  border-top: 1px solid var(--line);
  padding: 56px 32px 28px;
  color: var(--text-2);
}
.foot-inner { max-width: 1240px; margin: 0 auto; }
.foot-cols {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 48px;
  margin-bottom: 40px; padding-bottom: 36px;
  border-bottom: 1px solid var(--line);
}
.foot-brand .brand { margin-bottom: 18px; }
.foot-brand .brand-logo { height: 28px; }
.foot-brand p { font-size: 13px; color: var(--text-2); line-height: 1.7; max-width: 380px; margin: 18px 0 18px; }
.foot-licence {
  display: inline-block; font-family: var(--fm); font-size: 11.5px;
  color: var(--brand-2);
  background: rgba(42,84,255,0.08);
  border: 1px solid rgba(42,84,255,0.25);
  padding: 6px 12px; border-radius: var(--r-sm);
}
.foot-col h5 {
  font-size: 12px; font-weight: 700; color: var(--text);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 18px;
}
.foot-col ul { list-style: none; }
.foot-col li { margin-bottom: 10px; }
.foot-col a { font-size: 13.5px; color: var(--text-2); }
.foot-col a:hover { color: var(--brand-2); }
.foot-bottom {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
  font-size: 12.5px; color: var(--text-3);
}
.foot-bottom .legal-links { display: flex; gap: 22px; }
.foot-bottom a { color: var(--text-3); }
.foot-bottom a:hover { color: var(--brand-2); }

/* ─────────────────────────── RESPONSIVE ─────────────────────────── */
@media (max-width: 1024px) {
  .legal-grid { grid-template-columns: 1fr; gap: 32px; }
  .toc {
    position: static; max-height: none;
    background: var(--bg-1); border: 1px solid var(--line);
    border-radius: var(--r); padding: 18px 22px;
  }
  .toc a { padding-left: 0; margin-left: 0; border-left: none; }
  .toc a.active { color: var(--brand-2); border-left: none; padding-left: 0; }
  .deflist { grid-template-columns: 1fr; gap: 6px 0; }
  .deflist dt { padding-top: 8px; }
  .foot-cols { grid-template-columns: 1fr 1fr; gap: 36px; }
}
@media (max-width: 720px) {
  .nav-links, .nav-right .btn-ghost { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-links.mobile-open {
    display: flex; position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg-1); border-bottom: 1px solid var(--line);
    padding: 12px 24px;
  }
  .nav-links.mobile-open li { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav-links.mobile-open li:last-child { border-bottom: none; }
  .legal-head { padding: 110px 24px 50px; }
  .legal-body { padding: 40px 24px 70px; }
  .prose h2 { font-size: 20px; }
  .foot-cols { grid-template-columns: 1fr; gap: 32px; }
}
