@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  --bg: #050507;
  --bg-alt: #0b0b10;
  --surface: rgba(18, 18, 24, 0.78);
  --surface-strong: rgba(28, 29, 38, 0.92);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-soft: rgba(255, 255, 255, 0.07);
  --text: #f5f7fa;
  --text-muted: rgba(214, 220, 232, 0.7);
  --accent: #ff2745;
  --accent-2: #ff6b7f;
  --accent-soft: rgba(255, 39, 69, 0.14);
  --glow: rgba(255, 39, 69, 0.28);
  --shadow: rgba(0, 0, 0, 0.55);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgba(102, 106, 128, 0.2), transparent 45%),
    radial-gradient(circle at 92% -8%, rgba(82, 88, 118, 0.2), transparent 45%),
    linear-gradient(150deg, #020202 0%, var(--bg) 45%, var(--bg-alt) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(1.2rem, 3.5vw, 2.4rem);
  gap: clamp(1rem, 2.2vw, 1.8rem);
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 42vw;
  max-width: 640px;
  aspect-ratio: 1;
  filter: blur(160px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: -24vh;
  left: -18vw;
  background: radial-gradient(circle, rgba(255, 39, 69, 0.25) 0%, rgba(255, 39, 69, 0) 70%);
}

body::after {
  bottom: -28vh;
  right: -18vw;
  background: radial-gradient(circle, rgba(130, 150, 255, 0.2) 0%, rgba(130, 150, 255, 0) 70%);
}

.topbar {
  width: min(1120px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.3rem;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(10, 10, 15, 0.65);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px var(--shadow);
  position: sticky;
  top: 0.75rem;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

#lang-select {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.04em;
  appearance: none;
  outline: none;
  cursor: pointer;
}

#content {
  width: min(980px, 100%);
  background: var(--surface-strong);
  border: 1px solid var(--stroke);
  border-radius: 28px;
  padding: clamp(1.6rem, 3vw, 2.8rem);
  box-shadow: 0 25px 60px var(--shadow);
  position: relative;
  z-index: 1;
}

#content::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at top left, rgba(255, 39, 69, 0.2), transparent 55%);
  pointer-events: none;
  opacity: 0.8;
}

#content > * {
  position: relative;
  z-index: 1;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.02em;
}

h2 {
  margin-top: 2.4rem;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
}

h3 {
  margin-top: 1.6rem;
  font-size: 1.1rem;
  color: var(--accent-2);
}

p,
li {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-muted);
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover,
a:focus {
  color: #ffd3d9;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--stroke-soft);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.88rem;
  color: var(--text);
}

.notice,
.callout {
  background: rgba(10, 10, 15, 0.65);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 1.25rem 1.4rem;
  margin: 1.4rem 0;
}

.notice ul,
.callout ul {
  margin: 0.65rem 0 0 1.2rem;
}

.callout {
  border-left: 3px solid var(--accent);
  position: relative;
}

.callout .tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--accent-2);
  margin-bottom: 0.35rem;
}

.toc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  padding: 1.1rem;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  margin: 1.6rem 0 1.8rem;
}

.toc a {
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  font-weight: 500;
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.toc a:hover,
.toc a:focus {
  border-color: var(--accent-soft);
  background: rgba(255, 39, 69, 0.08);
}

hr {
  border: none;
  border-top: 1px solid var(--stroke-soft);
  margin: 2.4rem 0;
}

footer {
  width: min(980px, 100%);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding-bottom: 1rem;
  z-index: 1;
}

footer a {
  color: var(--text);
  font-weight: 600;
}

html[dir="rtl"] body {
  direction: rtl;
}

html[dir="rtl"] .topbar {
  flex-direction: row-reverse;
}

html[dir="rtl"] .meta {
  justify-content: flex-end;
}

html[dir="rtl"] .notice ul,
html[dir="rtl"] .callout ul,
html[dir="rtl"] ul {
  padding-right: 1.1rem;
  padding-left: 0;
}

html[dir="rtl"] .toc {
  text-align: right;
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    gap: 0.8rem;
    border-radius: 20px;
  }

  #content {
    padding: 1.4rem 1.2rem;
  }

  .toc {
    grid-template-columns: 1fr;
  }
}
