:root {
  --bg: #050817;
  --surface: #0c112c;
  --surface-2: #121a3d;
  --line: rgba(150, 165, 255, 0.16);
  --line-strong: rgba(170, 184, 255, 0.28);
  --text: #eef1ff;
  --muted: #c6ccec;
  --faint: #9aa3cf;
  --gold: #e3b93f;
  --gold-soft: rgba(227, 185, 63, 0.12);
  --accent: #7c6bff;
  --danger: #ff8a8a;
  --ok: #6fdba5;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: radial-gradient(ellipse 80% 40% at 50% -10%, rgba(91, 61, 240, 0.16), transparent 70%), var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans Hebrew", "IBM Plex Sans", "IBM Plex Sans Arabic", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--gold); text-underline-offset: 3px; overflow-wrap: anywhere; }
a:hover { color: #f0cd63; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body:lang(ar) { font-family: "IBM Plex Sans Arabic", "IBM Plex Sans Hebrew", "IBM Plex Sans", "Segoe UI", Arial, sans-serif; }
.skip-link { position: absolute; inset-inline-start: 16px; top: -48px; background: var(--gold); color: #1b1404; padding: 8px 14px; border-radius: 8px; font-weight: 700; z-index: 10; }
.skip-link:focus { top: 12px; }

.legal-header {
  position: sticky; top: 0; z-index: 5;
  background: rgba(5, 8, 23, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.legal-header-inner {
  max-width: 920px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.legal-brand { display: inline-flex; align-items: center; }
.legal-brand img { height: 34px; width: auto; display: block; }
.legal-header-actions { display: flex; align-items: center; gap: 12px; }
.legal-back { color: var(--muted); text-decoration: none; font-size: 0.9rem; font-weight: 500; }
.legal-back:hover { color: var(--text); }
.legal-language { position: relative; }
.legal-language select {
  appearance: none; font: inherit; font-size: 0.88rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 6px 30px 6px 12px; cursor: pointer;
}
[dir="rtl"] .legal-language select { padding: 6px 12px 6px 30px; }
.legal-language::after {
  content: ""; position: absolute; top: 50%; inset-inline-end: 12px; width: 7px; height: 7px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}

main { flex: 1; width: 100%; max-width: 920px; margin: 0 auto; padding: 40px 20px 56px; }
.legal-doc {
  background: linear-gradient(180deg, rgba(18, 26, 61, 0.78), rgba(12, 17, 44, 0.92));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(22px, 5vw, 52px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.legal-eyebrow { margin: 0 0 6px; color: var(--gold); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.legal-doc h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.25; font-weight: 800; letter-spacing: -0.01em; }
.legal-updated { margin: 10px 0 0; color: var(--faint); font-size: 0.9rem; }
.legal-translation-note {
  margin: 20px 0 0; padding: 12px 16px; border-radius: 12px;
  background: rgba(124, 107, 255, 0.1); border: 1px solid rgba(124, 107, 255, 0.3);
  color: var(--muted); font-size: 0.9rem;
}
.legal-translation-note[hidden] { display: none; }

.legal-toc { margin: 28px 0 8px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 8, 23, 0.35); }
.legal-toc summary { cursor: pointer; padding: 12px 16px; font-weight: 700; color: var(--text); list-style: none; display: flex; align-items: center; justify-content: space-between; }
.legal-toc summary::-webkit-details-marker { display: none; }
.legal-toc summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.2s; }
.legal-toc[open] summary::after { transform: rotate(-135deg); }
.legal-toc ol { margin: 0; padding: 4px 16px 14px; list-style: none; columns: 2 240px; column-gap: 24px; }
.legal-toc li { break-inside: avoid; padding: 3px 0; }
.legal-toc a { color: var(--muted); text-decoration: none; font-size: 0.92rem; }
.legal-toc a:hover { color: var(--gold); text-decoration: underline; }

.legal-body { margin-top: 28px; }
.legal-body h2 {
  margin: 40px 0 12px; padding-top: 22px; border-top: 1px solid var(--line);
  font-size: 1.2rem; line-height: 1.4; font-weight: 700; color: var(--text);
  scroll-margin-top: 84px;
}
.legal-body > h2:first-child, .legal-summary + h2 { margin-top: 32px; }
.legal-body p { margin: 0 0 14px; color: var(--muted); }
.legal-body p b, .legal-body li b { color: var(--text); font-weight: 700; }
.legal-body ul { margin: 0 0 16px; padding-inline-start: 22px; color: var(--muted); }
.legal-body li { margin-bottom: 8px; }
.legal-body li::marker { color: var(--gold); }
.legal-body [id] { scroll-margin-top: 84px; }

.legal-summary {
  margin: 0; padding: 22px 24px; border-radius: var(--radius);
  background: var(--gold-soft); border: 1px solid rgba(227, 185, 63, 0.35);
}
.legal-summary h2 { margin: 0 0 10px; padding: 0; border: 0; font-size: 1.05rem; color: var(--gold); }
.legal-summary ul { margin: 0; }
.legal-summary li { color: var(--text); }

.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 14px; }
.legal-body table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 560px; }
.legal-body th, .legal-body td { padding: 11px 14px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); color: var(--muted); }
.legal-body th { background: rgba(5, 8, 23, 0.5); color: var(--text); font-weight: 700; white-space: nowrap; }
.legal-body tr:last-child td { border-bottom: 0; }
.legal-body td:first-child { color: var(--text); font-weight: 500; }

.legal-footer { border-top: 1px solid var(--line); background: var(--surface); }
.legal-footer-inner { max-width: 920px; margin: 0 auto; padding: 22px 20px 28px; display: grid; gap: 10px; }
.legal-footer nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.legal-footer nav a { color: var(--muted); text-decoration: none; font-size: 0.88rem; }
.legal-footer nav a:hover, .legal-footer nav a[aria-current="page"] { color: var(--gold); }
.legal-footer p { margin: 0; color: var(--faint); font-size: 0.82rem; }

/* Cancellation page */
.cancel-intro { margin-top: 18px; }
.cancel-form { margin: 30px 0 8px; padding: clamp(18px, 4vw, 28px); border-radius: var(--radius); background: rgba(5, 8, 23, 0.45); border: 1px solid var(--line-strong); }
.cancel-form h2 { margin: 0 0 4px; font-size: 1.2rem; }
.cancel-form .cancel-required { margin: 0 0 18px; color: var(--faint); font-size: 0.86rem; }
.cancel-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.cancel-form label > span, .cancel-form legend { display: block; margin-bottom: 6px; color: var(--text); font-size: 0.9rem; font-weight: 600; }
.cancel-form input[type="text"], .cancel-form input[type="email"] {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px;
}
.cancel-form input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.cancel-form fieldset { margin: 20px 0 0; padding: 0; border: 0; }
.cancel-option { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-top: 8px; border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer; color: var(--muted); }
.cancel-option:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); color: var(--text); }
.cancel-option input { margin-top: 6px; accent-color: var(--gold); }
.cancel-notice { margin: 18px 0 0; color: var(--faint); font-size: 0.84rem; line-height: 1.65; }
.cancel-trap { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cancel-submit {
  margin-top: 20px; font: inherit; font-weight: 700; color: #1b1404; background: var(--gold);
  border: 0; border-radius: 12px; padding: 12px 22px; cursor: pointer;
}
.cancel-submit:hover { background: #f0cd63; }
.cancel-submit:disabled { opacity: 0.6; cursor: progress; }
.cancel-status { margin: 14px 0 0; font-weight: 600; }
.cancel-status:empty { display: none; }
.cancel-form[data-state="success"] .cancel-status { color: var(--ok); }
.cancel-form[data-state="error"] .cancel-status { color: var(--danger); }

@media (max-width: 560px) {
  body { font-size: 15px; }
  main { padding: 20px 12px 40px; }
  .legal-doc { border-radius: 18px; }
  .legal-back { display: none; }
}

@media print {
  :root { --text: #000; --muted: #111; --faint: #333; --gold: #000; --line: #bbb; }
  body { background: #fff; color: #000; }
  .legal-header, .legal-toc, .legal-footer nav, .skip-link, .cancel-form { display: none; }
  .legal-doc { background: none; border: 0; box-shadow: none; padding: 0; }
  .legal-summary { background: none; border: 1px solid #000; }
  a { color: #000; }
}
