:root {
  --bg: #f8f9fb;
  --bg-soft: #f3f4f8;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --text: #111827;
  --text-strong: #0f172a;
  --muted: #64748b;
  --muted-dark: #475569;
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.12);
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.09);
  --shadow-soft: 0 16px 48px rgba(15, 23, 42, 0.06);
  --gradient: linear-gradient(45deg, #ff4d4d, #8b5cf6);
  --gradient-soft: linear-gradient(45deg, rgba(255, 77, 77, 0.14), rgba(139, 92, 246, 0.14));
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --container: 920px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 77, 77, 0.16), transparent 32rem),
    radial-gradient(circle at 86% 18%, rgba(139, 92, 246, 0.17), transparent 35rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 48%, #ffffff 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 70%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(15, 23, 42, 0.08) 0.5px, transparent 0.5px);
  background-size: 18px 18px;
  opacity: 0.16;
}

img,
svg {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
  font: inherit;
}

::selection {
  color: #ffffff;
  background: #8b5cf6;
}

.legal-page {
  min-height: 100vh;
  padding: clamp(28px, 5vw, 56px) 20px;
}

.legal-shell {
  width: min(100%, var(--container));
  margin: 0 auto;
}

.legal-topbar {
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-strong);
  font-weight: 780;
  letter-spacing: -0.03em;
}

.legal-brand-mark {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
}

.legal-brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.legal-back-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-dark);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
  font-size: 0.9rem;
  font-weight: 760;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.legal-back-link:hover {
  color: var(--text-strong);
  transform: translateY(-2px);
  border-color: rgba(139, 92, 246, 0.24);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
}

.legal-document {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 6vw, 58px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 77, 77, 0.09), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(139, 92, 246, 0.12), transparent 36%),
    var(--surface-strong);
  box-shadow: var(--shadow);
}

.legal-document::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--gradient);
}

.legal-kicker {
  width: fit-content;
  margin: 0 0 16px;
  padding: 9px 13px;
  border: 1px solid rgba(139, 92, 246, 0.18);
  border-radius: 999px;
  color: var(--muted-dark);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legal-document h1,
.legal-document h2,
.legal-document h3 {
  max-width: 100%;
  color: var(--text-strong);
  letter-spacing: -0.055em;
  line-height: 1.04;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

.legal-document h1 {
  margin: 0 0 18px;
  font-size: clamp(2.35rem, 5.8vw, 5rem);
  font-weight: 850;
  text-wrap: balance;
}

.legal-document h2 {
  margin: 42px 0 14px;
  font-size: clamp(1.55rem, 3.2vw, 2.45rem);
  font-weight: 830;
}

.legal-document p {
  margin: 0 0 16px;
  color: var(--muted-dark);
  font-size: 1rem;
}

.legal-document strong {
  color: var(--text-strong);
}

.legal-document ul {
  margin: 14px 0 24px;
  padding-left: 1.35rem;
}

.legal-document li {
  margin-bottom: 9px;
  color: var(--muted-dark);
}

.legal-document a {
  color: var(--text-strong);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
}

.legal-meta {
  margin-bottom: 28px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.68);
}

.legal-meta p {
  margin-bottom: 0;
}

.legal-address {
  margin: 16px 0 24px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--muted-dark);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  font-style: normal;
  overflow-wrap: anywhere;
}

.legal-footer {
  margin-top: 24px;
  padding: 22px 4px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.legal-footer a {
  color: var(--text-strong);
  font-weight: 800;
}

/* Desktop fixed language switcher */
.legal-language-rail {
  position: fixed;
  top: 50%;
  right: 22px;
  z-index: 80;
  transform: translateY(-50%);
  pointer-events: none;
}

.legal-language-switcher {
  padding: 6px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
  pointer-events: auto;
}

.legal-language-switcher a {
  min-width: 36px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--muted-dark);
  font-size: 0.76rem;
  font-weight: 760;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.legal-language-switcher a:hover {
  color: var(--text-strong);
  background: rgba(15, 23, 42, 0.055);
  transform: translateY(-1px);
}

.legal-language-switcher a.is-active {
  color: #ffffff;
  background: var(--gradient);
  box-shadow: 0 10px 24px rgba(139, 92, 246, 0.18);
}

/* Mobile language controls */
.mobile-top-controls,
.mobile-menu-backdrop,
.mobile-panel {
  display: none;
}

.mobile-menu-backdrop[hidden],
.mobile-panel[hidden] {
  display: none !important;
}

body.mobile-panel-is-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .legal-language-rail {
    display: none;
  }

  .legal-page {
    padding: 92px 14px 34px;
  }

  .legal-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .legal-back-link {
    display: none;
  }

  .legal-document {
    border-radius: 26px;
    padding: 26px 22px;
  }

  .legal-document h1 {
    font-size: clamp(2rem, 10.4vw, 3.45rem);
    line-height: 1.05;
    letter-spacing: -0.06em;
    overflow-wrap: anywhere;
    hyphens: auto;
  }

  .legal-document h2 {
    font-size: clamp(1.4rem, 7vw, 2.05rem);
    line-height: 1.08;
    letter-spacing: -0.05em;
    overflow-wrap: anywhere;
    hyphens: auto;
  }

  .legal-footer {
    flex-direction: column;
  }

  .mobile-top-controls {
    position: fixed;
    top: 14px;
    left: 14px;
    right: 14px;
    z-index: 160;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
  }

  .mobile-icon-button {
    width: 48px;
    height: 48px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.76);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.09);
    pointer-events: auto;
    cursor: pointer;
  }

  .mobile-icon-button i {
    font-size: 1.32rem;
    line-height: 1;
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 190;
    display: block;
    background: rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  .mobile-menu-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-panel {
    position: fixed;
    left: 14px;
    right: 14px;
    top: 76px;
    z-index: 200;
    display: block;
    padding: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 30px;
    background:
      radial-gradient(circle at 16% 0%, rgba(255, 77, 77, 0.12), transparent 34%),
      radial-gradient(circle at 92% 10%, rgba(139, 92, 246, 0.14), transparent 38%),
      rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(26px);
    -webkit-backdrop-filter: blur(26px);
    box-shadow: 0 28px 90px rgba(15, 23, 42, 0.16);
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
    pointer-events: none;
    transition: opacity 240ms ease, transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .mobile-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  .mobile-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    color: var(--text-strong);
    font-size: 1.02rem;
    font-weight: 850;
    letter-spacing: -0.035em;
  }

  .mobile-panel-close {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.7);
    cursor: pointer;
  }

  .mobile-panel-kicker {
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .mobile-language-list {
    display: grid;
    gap: 10px;
  }

  .mobile-language-list a {
    min-height: 58px;
    padding: 10px 14px;
    display: grid;
    grid-template-columns: 46px 1fr;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(15, 23, 42, 0.075);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.66);
  }

  .mobile-language-list a span {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    color: #ffffff;
    background: var(--gradient);
    font-size: 0.75rem;
    font-weight: 900;
  }

  .mobile-language-list a strong {
    color: var(--text-strong);
    font-size: 1rem;
    letter-spacing: -0.02em;
  }

  .mobile-language-list a.is-active {
    border-color: rgba(139, 92, 246, 0.28);
    box-shadow: 0 16px 40px rgba(139, 92, 246, 0.12);
  }
}

@media (max-width: 520px) {
  .legal-page {
    padding-inline: 12px;
  }

  .legal-document {
    padding: 24px 18px;
  }

  .legal-document h1 {
    font-size: clamp(1.85rem, 9.5vw, 3rem);
    line-height: 1.08;
    letter-spacing: -0.055em;
  }

  .legal-document h2 {
    font-size: clamp(1.32rem, 6.4vw, 1.8rem);
    line-height: 1.12;
    letter-spacing: -0.045em;
  }

  .legal-brand-mark {
    width: 40px;
    height: 40px;
  }

  .mobile-top-controls {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .mobile-icon-button {
    width: 46px;
    height: 46px;
  }

  .mobile-panel {
    left: 12px;
    right: 12px;
    top: 70px;
    border-radius: 26px;
  }
}

@media (max-width: 380px) {
  .legal-document {
    padding: 22px 16px;
  }

  .legal-document h1 {
    font-size: clamp(1.65rem, 8.6vw, 2.55rem);
    letter-spacing: -0.045em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

html:lang(ru) .legal-meta p,
html:lang(uk) .legal-meta p {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

html:lang(ru) .legal-meta [data-i18n="legal_pages.last_updated_value"],
html:lang(uk) .legal-meta [data-i18n="legal_pages.last_updated_value"] {
  white-space: nowrap;
}

@media (max-width: 520px) {
  html:lang(ru) .legal-document h1[data-i18n="legal_pages.privacy.title"] {
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
    font-size: clamp(1.72rem, 8vw, 2.35rem);
  }
}

@media (max-width: 380px) {
  html:lang(ru) .legal-document h1[data-i18n="legal_pages.privacy.title"] {
    font-size: clamp(1.55rem, 7.6vw, 2.1rem);
  }
}

/* Keep email addresses readable and unbroken */
.legal-document a[href^="mailto:"] {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
}

.legal-address a[href^="mailto:"] {
  margin-top: 4px;
}

/* Mobile email safety */
@media (max-width: 520px) {
  .legal-address a[href^="mailto:"],
  .legal-document p a[href^="mailto:"] {
    font-size: clamp(0.9rem, 4vw, 1rem);
    line-height: 1.35;
  }
}

@media (max-width: 380px) {
  .legal-address a[href^="mailto:"],
  .legal-document p a[href^="mailto:"] {
    font-size: clamp(0.86rem, 3.85vw, 0.96rem);
  }
}