:root {
  --bg: #0b1020;
  --bg-soft: #111a33;
  --card: #151f3d;
  --card-hover: #1a2547;
  --border: #24315c;
  --text: #e8edf7;
  --muted: #93a0c4;
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #ff8080;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 14px;
  --glow: rgba(79, 140, 255, 0.14);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased;
}
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
::selection { background: rgba(79, 140, 255, 0.35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a3a6b; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Nav */
nav {
  position: sticky; top: 0; z-index: 50; background: rgba(11, 16, 32, 0.8);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
nav .container { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.3px; }
.logo-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(79, 140, 255, 0.7); animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
nav a { color: var(--muted); text-decoration: none; margin-left: 22px; font-size: 0.92rem; transition: color 0.2s; position: relative; }
nav a::after {
  content: ''; position: absolute; left: 0; right: 100%; bottom: -4px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: right 0.25s ease;
}
nav a:hover { color: var(--text); }
nav a:hover::after { right: 0; }

/* Hero */
.hero { padding: 90px 0 70px; position: relative; overflow: hidden; }
.hero .grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(79, 140, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 140, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, black, transparent 72%);
  mask-image: radial-gradient(ellipse at 50% 0%, black, transparent 72%);
  pointer-events: none;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(600px 300px at 20% 10%, rgba(79, 140, 255, 0.18), transparent 60%),
    radial-gradient(500px 250px at 80% 0%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(700px 400px at 50% 120%, rgba(52, 211, 153, 0.07), transparent 60%);
  background-size: 200% 200%;
  animation: heroShift 16s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes heroShift {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 100%; }
}
.orb { position: absolute; border-radius: 50%; filter: blur(70px); pointer-events: none; opacity: 0.5; }
.orb-a { width: 340px; height: 340px; background: rgba(79, 140, 255, 0.22); top: -120px; left: -60px; animation: float 18s ease-in-out infinite; }
.orb-b { width: 280px; height: 280px; background: rgba(124, 92, 255, 0.2); top: 40px; right: -80px; animation: float 22s ease-in-out infinite reverse; }
@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-26px) translateX(18px); }
}
.hero .container { position: relative; z-index: 1; }
.badge-row { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; font-size: 0.8rem; font-weight: 600;
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
  background: rgba(21, 31, 61, 0.6);
}
.badge.live { color: var(--green); border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.08); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 2s ease-in-out infinite; }
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.15; letter-spacing: -0.02em;
  background: linear-gradient(120deg, #fff, #b8c8f0);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p.sub { font-size: 1.15rem; color: var(--muted); max-width: 660px; margin-top: 16px; }
.cta-row { display: flex; gap: 14px; margin-top: 34px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 10px;
  font-weight: 600; font-size: 0.95rem; text-decoration: none; transition: transform 0.15s, box-shadow 0.2s;
}
.btn.primary { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 4px 20px rgba(79, 140, 255, 0.35); }
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(79, 140, 255, 0.45); }
.btn.primary::after {
  content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg); animation: shine 3.2s ease-in-out infinite;
}
@keyframes shine { 0% { left: -60%; } 45% { left: 130%; } 100% { left: 130%; } }
.btn.ghost { border: 1px solid var(--border); color: var(--text); background: rgba(21, 31, 61, 0.4); }
.btn.ghost:hover { transform: translateY(-2px); border-color: var(--accent); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 54px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: border-color 0.2s, transform 0.2s, box-shadow 0.25s; position: relative; overflow: hidden; }
.stat:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 8px 24px var(--glow); }
.stat::after {
  content: ''; position: absolute; top: -40%; left: -40%; width: 60%; height: 180%;
  background: linear-gradient(90deg, transparent, rgba(79, 140, 255, 0.08), transparent);
  transform: rotate(15deg) translateX(-100%); transition: transform 0.7s ease;
}
.stat:hover::after { transform: rotate(15deg) translateX(250%); }
.stat .label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat .value { font-size: 1.5rem; font-weight: 700; margin-top: 6px; font-family: var(--mono); }
.stat .hint { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }

/* Sections */
section { padding: 56px 0; }
.section-head { margin-bottom: 30px; }
.section-head .kicker {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent); margin-bottom: 8px;
}
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.01em; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; display: flex; flex-direction: column; gap: 10px;
  transition: transform 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.25s;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); background: var(--card-hover); box-shadow: 0 10px 30px var(--glow); }
.card .icon { font-size: 1.6rem; }
.card h3 { font-size: 1.05rem; }
.card p { color: var(--muted); font-size: 0.92rem; flex: 1; }
.card .meta { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }

/* Playground */
#playground { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
#playground .section-head p { color: var(--muted); margin-top: 8px; max-width: 700px; }
.playground { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.playground .toolbar {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--border); background: var(--bg-soft); flex-wrap: wrap;
}
.playground .toolbar .dots { display: flex; gap: 6px; margin-right: 10px; }
.playground .toolbar .dots span { width: 11px; height: 11px; border-radius: 50%; }
.dots span:nth-child(1) { background: #ff5f57; }
.dots span:nth-child(2) { background: #febc2e; }
.dots span:nth-child(3) { background: #28c840; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.field select, .field input {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 0.9rem; font-family: var(--mono); outline: none; transition: border-color 0.2s;
  max-width: 220px;
}
.field select:focus, .field input:focus { border-color: var(--accent); }
.field select:disabled, .field input:disabled { opacity: 0.4; cursor: not-allowed; }
#pg-year { width: 150px; }
.run-btn {
  align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  border: none; border-radius: 8px; padding: 9px 20px; font-weight: 600; font-size: 0.88rem;
  cursor: pointer; transition: transform 0.15s, opacity 0.15s, box-shadow 0.2s;
}
.run-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(79, 140, 255, 0.35); }
.run-btn:disabled { opacity: 0.5; cursor: wait; }

/* Mode toggle */
.mode-row { display: flex; gap: 0; margin: 18px 18px 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; width: fit-content; }
.mode-btn {
  background: var(--bg-soft); color: var(--muted); border: none; padding: 9px 18px;
  font-size: 0.84rem; font-weight: 600; cursor: pointer; transition: background 0.2s, color 0.2s;
}
.mode-btn.active { background: var(--accent); color: #fff; }
.mode-btn:not(:last-child) { border-right: 1px solid var(--border); }

.url-bar {
  font-family: var(--mono); font-size: 0.86rem; padding: 13px 18px; background: var(--bg);
  color: var(--muted); border-bottom: 1px solid var(--border); word-break: break-all;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.url-bar b { color: var(--accent); font-weight: 600; }
.url-bar .url-actions { margin-left: auto; display: flex; gap: 8px; }
.icon-btn {
  background: rgba(79, 140, 255, 0.1); border: 1px solid rgba(79, 140, 255, 0.25); color: var(--accent);
  border-radius: 7px; padding: 4px 10px; font-size: 0.76rem; cursor: pointer; transition: background 0.15s, transform 0.15s;
}
.icon-btn:hover { background: rgba(79, 140, 255, 0.2); transform: translateY(-1px); }

.raw-input { display: flex; gap: 10px; padding: 0 18px 16px; align-items: center; }
.raw-input input {
  flex: 1; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; font-family: var(--mono); font-size: 0.9rem; outline: none; transition: border-color 0.2s;
}
.raw-input input:focus { border-color: var(--accent); }

.history { display: flex; gap: 8px; padding: 16px 0 0; flex-wrap: wrap; }
.history .chip {
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--muted); border-radius: 999px;
  padding: 5px 13px; font-family: var(--mono); font-size: 0.76rem; cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.history .chip:hover { border-color: var(--accent); color: var(--text); }

.playground pre {
  font-family: var(--mono); font-size: 0.83rem; padding: 20px 18px; overflow: auto;
  max-height: 380px; color: #c9d4f2; background: var(--bg); border-top: 1px solid var(--border);
}
.playground pre .err { color: var(--red); }
.playground pre .string { color: #8fd48f; }
.playground pre .num { color: #6fc3ff; }
.playground pre .bool { color: #ffb86b; }
.playground pre .null { color: #ff7ab8; }
.status-line { padding: 8px 18px; font-size: 0.76rem; font-family: var(--mono); color: var(--green); border-top: 1px solid var(--border); background: var(--bg-soft); }
.status-line.waiting { color: var(--muted); }
.status-line.fail { color: var(--red); }
.status-line.loading::before {
  content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Docs tabs */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tab {
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  border-radius: 10px; padding: 10px 18px; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.15s;
}
.tab:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.doc-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 22px; }
.doc-group-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); padding: 16px 0 4px; }
.doc-row { display: flex; gap: 12px; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid rgba(36, 49, 92, 0.5); }
.doc-row:last-child { border-bottom: none; }
.method {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 700; color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.35); border-radius: 6px; padding: 3px 8px; margin-top: 2px; flex-shrink: 0;
}
.doc-row .path-wrap { flex: 1; min-width: 0; }
.doc-row code { font-family: var(--mono); font-size: 0.86rem; color: var(--accent); word-break: break-all; }
.doc-row code .opt { color: var(--muted); text-decoration: underline dotted rgba(147, 160, 196, 0.5); text-underline-offset: 4px; }
.doc-row .desc { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.opt-tag {
  display: inline-block; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--amber); border: 1px solid rgba(251, 191, 36, 0.35); border-radius: 5px; padding: 1px 6px; margin-left: 8px; vertical-align: 1px;
}
.doc-row .copy-btn {
  cursor: pointer; background: none; border: 1px solid var(--border); color: var(--muted);
  font-size: 0.76rem; padding: 4px 10px; border-radius: 7px; transition: color 0.15s, border-color 0.15s; flex-shrink: 0; align-self: center;
}
.doc-row .copy-btn:hover { color: var(--text); border-color: var(--accent); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; font-size: 0.82rem; color: var(--muted); }
.legend .lg { display: inline-flex; align-items: center; gap: 8px; }
.legend .lg code { font-family: var(--mono); color: var(--accent); font-size: 0.82rem; }
.legend .lg .opt { color: var(--muted); text-decoration: underline dotted rgba(147, 160, 196, 0.5); text-underline-offset: 4px; }

/* Indicator tabs */
.ind-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.ind-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; cursor: pointer; transition: transform 0.2s, border-color 0.2s, box-shadow 0.25s; text-align: left;
  font-family: inherit; color: var(--text); position: relative; overflow: hidden;
}
.ind-card::after {
  content: ''; position: absolute; top: -50%; left: -50%; width: 70%; height: 200%;
  background: linear-gradient(90deg, transparent, rgba(124, 92, 255, 0.09), transparent);
  transform: rotate(15deg) translateX(-100%); transition: transform 0.7s ease;
}
.ind-card:hover::after { transform: rotate(15deg) translateX(250%); }
.ind-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 8px 24px var(--glow); }
.ind-card .icon { font-size: 1.5rem; }
.ind-card h4 { font-size: 1rem; margin: 8px 0 4px; }
.ind-card p { font-size: 0.82rem; color: var(--muted); }
.ind-card .arrow { float: right; color: var(--muted); font-size: 1.1rem; transition: transform 0.2s, color 0.2s; }
.ind-card:hover .arrow { transform: translateX(4px); color: var(--accent); }

/* Footer */
footer { border-top: 1px solid var(--border); padding: 40px 0 50px; color: var(--muted); font-size: 0.88rem; }
footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* Reveal on scroll */
html.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
html.js .reveal.visible { opacity: 1; transform: none; }

@media (max-width: 700px) {
  nav a { margin-left: 14px; font-size: 0.85rem; }
  .hero { padding: 60px 0 50px; }
  .playground .toolbar { gap: 8px; }
  .field select, .field input { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  html.js .reveal { opacity: 1; transform: none; }
}
