/* ── Cryptogaming Legal & FAQ Pages — Brand Theme ─────────────────────────── */
:root {
  --bg: #070B12;
  --bg-elevated: #0B111C;
  --bg-panel: #0D1420;
  --bg-card: #111927;
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.14);
  --text: #eceef2;
  --text-secondary: #b4bac4;
  --muted: #7a828e;
  --cyan: #00E5FF;
  --purple: #cc33ff;
  --brand-grad: linear-gradient(90deg, #00E5FF 0%, #14E386 100%);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --header-h: 64px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── BASE & TYPOGRAPHY ─────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 45% at 0% 0%, rgba(0, 204, 255, 0.08), transparent 55%),
    radial-gradient(ellipse 55% 40% at 100% 100%, rgba(204, 51, 255, 0.07), transparent 50%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: -0.01em;
  min-height: 100vh;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
}

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color 0.18s var(--ease), opacity 0.18s var(--ease);
}

a:hover {
  text-decoration: underline;
}

/* ── STICKY HEADER ─────────────────────────────────────────────────────────── */
.legal-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.legal-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--brand-grad);
  opacity: 0.85;
  pointer-events: none;
}

.legal-header-inner {
  max-width: 1040px;
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  text-decoration: none;
  flex-shrink: 0;
}

.legal-brand:hover {
  text-decoration: none;
  opacity: 0.92;
}

.legal-brand img {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
}

.legal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.legal-nav a {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid transparent;
  text-decoration: none;
  transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}

.legal-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  text-decoration: none;
}

.legal-nav a.active {
  color: var(--text);
  font-weight: 600;
  background: linear-gradient(135deg, rgba(0, 204, 255, 0.14) 0%, rgba(204, 51, 255, 0.14) 100%);
  border-color: rgba(0, 204, 255, 0.35);
}

/* ── MAIN CONTAINER ────────────────────────────────────────────────────────── */
.legal-main {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 20px 64px;
  flex: 1;
}

/* ── HERO SECTION ──────────────────────────────────────────────────────────── */
.legal-hero {
  background: linear-gradient(180deg, rgba(16, 16, 24, 0.92) 0%, rgba(10, 10, 16, 0.95) 100%);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 32px 32px 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.legal-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand-grad);
}

.legal-eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

.legal-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(1.65rem, 3.2vw, 2.25rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text);
}

.legal-updated {
  display: inline-flex;
  align-items: center;
  margin: 0 0 18px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(0, 204, 255, 0.08);
  border: 1px solid rgba(0, 204, 255, 0.22);
}

.legal-intro {
  margin: 0;
  color: var(--text-secondary);
}

.legal-intro + .legal-intro {
  margin-top: 12px;
}

/* ── TABLE OF CONTENTS ─────────────────────────────────────────────────────── */
.legal-toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  backdrop-filter: blur(12px);
}

.legal-toc-title {
  margin: 0 0 12px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.legal-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.legal-toc-list a {
  display: block;
  padding: 4px 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid transparent;
}

.legal-toc-list a:hover {
  color: var(--cyan);
  text-decoration: none;
}

/* ── LEGAL CONTENT SECTIONS (TERMS & PRIVACY) ──────────────────────────────── */
.legal-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.legal-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  scroll-margin-top: 84px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.legal-section h2 {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.015em;
}

.legal-section h3 {
  margin: 18px 0 8px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--cyan);
}

.legal-section p {
  margin: 0 0 12px;
  color: var(--text-secondary);
}

.legal-section p:last-child,
.legal-section ul:last-child,
.legal-section ol:last-child {
  margin-bottom: 0;
}

.legal-section ul,
.legal-section ol,
.faq-answer ul,
.faq-answer ol {
  margin: 0 0 14px;
  padding-left: 22px;
  color: var(--text-secondary);
}

.legal-section li,
.faq-answer li {
  margin-bottom: 6px;
}

.legal-section li:last-child,
.faq-answer li:last-child {
  margin-bottom: 0;
}

.legal-section ul li::marker,
.faq-answer ul li::marker {
  color: var(--cyan);
}

.legal-section ol li::marker,
.faq-answer ol li::marker {
  color: var(--purple);
  font-weight: 600;
}

/* ── FAQ ACCORDION CARDS ───────────────────────────────────────────────────── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.faq-item:hover,
.faq-item[open] {
  border-color: var(--border-2);
}

.faq-item[open] {
  background: linear-gradient(180deg, rgba(16, 16, 24, 1) 0%, rgba(12, 12, 19, 1) 100%);
}

.faq-question {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  user-select: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  content: '+';
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  color: var(--cyan);
  background: rgba(0, 204, 255, 0.08);
  border: 1px solid rgba(0, 204, 255, 0.22);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}

.faq-item[open] > .faq-question::after {
  content: '−';
  color: var(--text);
  background: rgba(204, 51, 255, 0.16);
  border-color: rgba(204, 51, 255, 0.35);
}

.faq-answer {
  padding: 0 22px 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.faq-answer p {
  margin: 0 0 12px;
  color: var(--text-secondary);
}

.faq-answer p:last-child,
.faq-answer ul:last-child,
.faq-answer ol:last-child {
  margin-bottom: 0;
}

.faq-handle {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(0, 204, 255, 0.08);
  border: 1px solid rgba(0, 204, 255, 0.2);
}

/* ── CLOSING NOTE CARD ─────────────────────────────────────────────────────── */
.legal-closing {
  margin-top: 24px;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(0, 204, 255, 0.08) 0%, rgba(204, 51, 255, 0.08) 100%);
  border: 1px solid var(--border-2);
  text-align: center;
}

.legal-closing p {
  margin: 0;
  color: var(--text);
  font-weight: 500;
}

.legal-closing p + p {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ── FOOTER (MATCHES MAIN APP) ─────────────────────────────────────────────── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.45);
}

.site-footer a {
  color: var(--cyan);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer-sep {
  opacity: 0.4;
}

/* ── RESPONSIVE (MOBILE <= 640PX) ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .legal-header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
    gap: 10px;
  }

  .legal-nav {
    width: 100%;
    gap: 6px;
  }

  .legal-nav a {
    padding: 6px 11px;
    font-size: 13px;
  }

  .legal-main {
    padding: 24px 14px 48px;
  }

  .legal-hero {
    padding: 22px 18px 20px;
  }

  .legal-toc {
    padding: 16px 18px;
  }

  .legal-toc-list {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .legal-section {
    padding: 18px 16px;
  }

  .faq-question {
    padding: 15px 16px;
    font-size: 0.96rem;
  }

  .faq-answer {
    padding: 14px 16px 16px;
  }

  .legal-closing {
    padding: 16px;
  }
}
