:root {
  --bg: #0d0f14;
  --surface: #13161e;
  --surface2: #1a1e2a;
  --border: #252a38;
  --accent: #e8a020;
  --accent2: #4e9af1;
  --accent3: #3ecf8e;
  --accent4: #e15656;
  --text: #d4d8e8;
  --text-dim: #7a819a;
  --text-bright: #f0f3ff;
  --code-bg: #0a0c12;
  --tag-txt: #c2d4ff;
  --mono: "JetBrains Mono", monospace;
  --serif: "Noto Serif SC", serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.7;
  overflow-x: hidden;
}


/* ─── NOISE OVERLAY ─── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.35;
}

/* ─── HEADER ─── */
header {
  padding: 80px 40px 60px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
header::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.header-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 40px;
  max-width: 1100px;
  margin: 0 auto;
}
.badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 3px 10px;
  margin-bottom: 20px;
  opacity: 0.85;
}
h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 900;
  color: var(--text-bright);
  line-height: 1.2;
}
h1 span {
  color: var(--accent);
}
.subtitle {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-dim);
  max-width: 600px;
}
.version-tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 6px 14px;
  font-size: 11px;
  color: var(--accent2);
  white-space: nowrap;
}

/* ─── NAV ─── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
}
nav ul {
  display: flex;
  gap: 2px;
  list-style: none;
  max-width: 1100px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
nav ul::-webkit-scrollbar {
  display: none;
}
nav a {
  display: block;
  padding: 14px 16px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transition: color 0.2s;
  border-bottom: 2px solid transparent;
}
nav a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ─── MAIN LAYOUT ─── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px 100px;
}

/* ─── SECTIONS ─── */
.section {
  padding: 60px 0 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.section:last-child {
  border-bottom: none;
}

.section-num {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
}
h2 {
  font-family: var(--serif);
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 24px;
}
h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent2);
  margin: 32px 0 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
h3::before {
  content: "";
  width: 20px;
  height: 2px;
  background: var(--accent2);
  display: inline-block;
}
p {
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.8;
}

/* ─── CODE BLOCKS ─── */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  margin: 20px 0 28px;
  overflow: hidden;
}
.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}
.code-lang {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.code-desc {
  color: var(--text-dim);
  font-size: 11px;
}
pre {
  padding: 20px 20px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.75;
  font-family: var(--mono);
}
code {
  font-family: var(--mono);
}

/* syntax highlights */
.c-key {
  color: #7dd3fc;
}
.c-str {
  color: #86efac;
}
.c-num {
  color: #fda4af;
}
.c-cmt {
  color: #475569;
  font-style: italic;
}
.c-kw {
  color: #c084fc;
}
.c-tag {
  color: var(--accent);
}
.c-attr {
  color: #93c5fd;
}
.c-val {
  color: #86efac;
}
.c-hl {
  background: rgba(232, 160, 32, 0.08);
  display: block;
  border-left: 2px solid var(--accent);
  margin: 0 -20px;
  padding: 0 20px 0 18px;
  box-sizing: border-box;
}

/* ─── CARDS ─── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 20px;
  position: relative;
  transition:
    border-color 0.2s,
    transform 0.15s;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.card-icon {
  font-size: 24px;
  margin-bottom: 10px;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 6px;
}
.card-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}
.card-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid;
}
.tag-m3u {
  color: var(--accent3);
  border-color: var(--accent3);
}
.tag-txt {
  color: var(--accent2);
  border-color: var(--accent2);
}
.tag-json {
  color: var(--accent);
  border-color: var(--accent);
}

/* ─── TABLE ─── */
.table-wrap {
  overflow-x: auto;
  margin: 20px 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
th {
  background: var(--surface2);
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(37, 42, 56, 0.6);
  vertical-align: top;
}
tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.td-key {
  color: #7dd3fc;
  font-weight: 600;
}
.td-type {
  color: var(--accent4);
  font-size: 11px;
}
.td-req {
  color: var(--accent3);
  font-size: 10px;
  text-transform: uppercase;
}
.td-opt {
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
}

/* ─── CALLOUT ─── */
.callout {
  padding: 16px 20px;
  border-left: 3px solid;
  margin: 20px 0;
  font-size: 13px;
}
.callout-tip {
  border-color: var(--accent3);
  background: rgba(62, 207, 142, 0.05);
}
.callout-warn {
  border-color: var(--accent);
  background: rgba(232, 160, 32, 0.05);
}
.callout-info {
  border-color: var(--accent2);
  background: rgba(78, 154, 241, 0.05);
}
.callout-title {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 6px;
}
.callout-tip .callout-title {
  color: var(--accent3);
}
.callout-warn .callout-title {
  color: var(--accent);
}
.callout-info .callout-title {
  color: var(--accent2);
}

/* ─── STEP LIST ─── */
.step-list {
  list-style: none;
  margin: 20px 0;
}
.step-list li {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  align-items: flex-start;
}
.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.step-content {
  padding-top: 4px;
}
.step-title {
  color: var(--text-bright);
  font-weight: 600;
  margin-bottom: 4px;
}
.step-desc {
  font-size: 12px;
  color: var(--text-dim);
}

/* ─── INLINE CODE ─── */
.ic {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 1px 6px;
  font-size: 12px;
  font-family: var(--mono);
}

/* ─── DIVIDER ─── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 40px 0;
}

/* ─── TOC ─── */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px 28px;
  margin: 40px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 40px;
}
.toc-title {
  grid-column: 1/-1;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.toc a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s;
}
.toc a:hover {
  color: var(--text-bright);
}
.toc-dot {
  width: 4px;
  height: 4px;
  background: var(--border);
  flex-shrink: 0;
}

/* ─── FOOTER ─── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 40px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* ─── ANIMATIONS ─── */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.section {
  animation: fade-up 0.5s ease both;
}
.section:nth-child(2) {
  animation-delay: 0.1s;
}
.section:nth-child(3) {
  animation-delay: 0.15s;
}
.section:nth-child(4) {
  animation-delay: 0.2s;
}
.section:nth-child(5) {
  animation-delay: 0.25s;
}
.section:nth-child(6) {
  animation-delay: 0.3s;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 680px) {
  header,
  main,
  footer {
    padding-left: 20px;
    padding-right: 20px;
  }
  nav {
    padding: 0 20px;
  }
  .header-grid {
    grid-template-columns: 1fr;
  }
  .toc {
    grid-template-columns: 1fr;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
}

