:root {
  --color-dark: #10112D;
  --color-paper: #F5F0E5;
  --color-text: #151523;
  --color-brand: #1416EB;
  --color-accent: #89ED6E;
  --color-accent-dark: #10112D;
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 1px solid rgba(21, 21, 35, 0.16);
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--color-brand); text-decoration: none; transition: color .2s; }
a:hover { opacity: 0.85; }

/* Typography */
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: var(--color-text); }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: var(--gap); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-top: var(--section-y); margin-bottom: var(--gap); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-top: var(--gap); margin-bottom: calc(var(--gap) * 0.5); }
p { margin-bottom: var(--gap); max-width: 38em; }
ul, ol { margin-bottom: var(--gap); padding-left: 1.5rem; }
li { margin-bottom: 0.5rem; }

/* Layout */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding-block: var(--section-y); position: relative; }
.bg-dark { background-color: var(--color-dark); color: var(--color-paper); }
.bg-dark h1, .bg-dark h2, .bg-dark h3, .bg-dark p, .bg-dark li, .bg-dark span, .bg-dark td { color: var(--color-paper); }
.bg-dark a { color: var(--color-accent); }
.bg-dark .badge { color: var(--color-accent); }
.bg-dark .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.bg-dark .card { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }
.bg-paper { background-color: var(--color-paper); }
.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 0.5rem; }
.hl { color: var(--color-brand); }
.bg-dark .hl { color: var(--color-accent); }

/* Header */
header { position: sticky; top: 0; z-index: 100; background: rgba(245, 240, 229, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--card-border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo img { height: 32px; width: auto; }
nav ul { display: flex; gap: var(--gap); list-style: none; }
nav a { font-weight: 500; color: var(--color-text); }
nav a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
.btn-nav { padding: 0.5rem 1.25rem; background: var(--color-accent); color: var(--color-accent-dark); border-radius: var(--radius-btn); font-weight: 600; display: inline-flex; align-items: center; gap: 0.4rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0 1.5rem; height: 48px; border-radius: var(--radius-btn); font-weight: 600; font-size: 1rem; cursor: pointer; border: none; transition: transform .2s, opacity .2s; }
.btn-primary { background: var(--color-accent); color: var(--color-accent-dark); }
.btn-secondary { background: transparent; border: 1px solid var(--color-text); color: var(--color-text); }
.btn:hover { transform: translateY(-1px); opacity: 0.95; }
.btn:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

/* Cards & Grid */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.card { background: var(--color-paper); border: var(--card-border); border-radius: var(--radius-card); padding: var(--gap); box-shadow: var(--card-shadow); }
.feature-panel { aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; background: rgba(20, 22, 235, 0.08); border-radius: var(--radius-card); overflow: hidden; }

/* Table */
table { width: 100%; border-collapse: collapse; margin-bottom: var(--gap); table-layout: fixed; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--card-border); overflow-wrap: break-word; }
th { font-weight: 700; }

/* FAQ */
details { border: var(--card-border); border-radius: var(--radius-card); margin-bottom: var(--gap); overflow: hidden; }
summary { padding: 1rem; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.2rem; transition: transform .2s; }
details[open] summary::after { transform: rotate(90deg); }
details p { padding: 0 1rem 1rem; margin: 0; }

/* Layout Split (Desktop) */
.layout-split { display: grid; grid-template-columns: 240px 1fr; gap: var(--gap); align-items: start; }
.toc { position: sticky; top: 80px; align-self: start; }
.toc ul { list-style: none; padding: 0; }
.toc li { margin-bottom: 0.5rem; }
.toc a { font-size: 0.9rem; color: var(--color-text); display: block; padding: 0.4rem 0; border-left: 2px solid transparent; }
.toc a:hover, .toc a.active { color: var(--color-brand); border-left-color: var(--color-brand); }
.bg-dark .toc a { color: var(--color-paper); }
.bg-dark .toc a:hover, .bg-dark .toc a.active { color: var(--color-accent); border-left-color: var(--color-accent); }

/* SVG Base */
.svg-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.svg-scene { width: 100%; height: auto; }
.star { fill: currentColor; }
.line { stroke: currentColor; stroke-width: 1.5; pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.draw-line { animation: drawDash 6s linear infinite alternate; }
.twinkle { animation: twinkleStar 4s ease-in-out infinite alternate; }
.float-ui { animation: floatPanel 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

/* Keyframes */
@keyframes twinkleStar { 0%, 100% { opacity: 0.2; } 50% { opacity: 0.9; } }
@keyframes drawDash { to { stroke-dashoffset: 1; } }
@keyframes floatPanel { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* Responsive */
@media (max-width: 900px) {
  .layout-split { grid-template-columns: 1fr; }
  .toc { position: static; margin-bottom: var(--gap); min-width: 0; }
  .toc ul { display: flex; flex-wrap: wrap; gap: 0.5rem; min-width: 0; }
  .content-area { min-width: 0; }
  .toc a { border-left: none; padding: 0.4rem 0.8rem; background: rgba(0,0,0,0.05); border-radius: 8px; }
  .feature-panel { aspect-ratio: 16/9; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .draw-line, .twinkle, .float-ui { animation: none; }
}
