:root {
    --bg: #07080b;
    --panel: rgba(16, 18, 24, 0.82);
    --panel-2: rgba(22, 25, 34, 0.72);
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.16);
    --text: #f4f7fb;
    --muted: #9aa5b5;
    --soft: #687386;
    --accent: #75d7ff;
    --green: #72e49a;
    --yellow: #ffd27a;
    --red: #ff7e7e;
    --violet: #b9a4ff;
    --radius: 8px;
    --font: "Inter", system-ui, sans-serif;
    --mono: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scrollbar-color: rgba(255,255,255,.22) transparent; }
body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 25% -10%, rgba(117,215,255,.12), transparent 34rem),
        radial-gradient(circle at 90% 10%, rgba(185,164,255,.08), transparent 30rem),
        linear-gradient(180deg, #07080b 0%, #090b10 48%, #06070a 100%);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.65;
    display: grid;
    grid-template-columns: 280px 1fr;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.015) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.7), transparent 80%);
}

a { color: inherit; text-decoration: none; }
code, pre { font-family: var(--mono); }

/* Sidebar */
aside {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 16px;
    border-right: 1px solid var(--line);
    background: rgba(5, 6, 9, .85);
    backdrop-filter: blur(24px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.12) transparent;
}

.brand {
    padding: 10px 8px 18px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 14px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    font-size: .85rem;
    color: var(--text);
}

.brand-mark span {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
    color: var(--accent);
    font-size: .8rem;
}

.brand p {
    color: var(--soft);
    font-size: .78rem;
    margin-top: 6px;
}

.nav-group { margin: 14px 0; }
.nav-title {
    color: var(--soft);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin: 0 8px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--muted);
    font-size: .82rem;
    transition: color .2s ease, background .2s ease, transform .2s ease;
}

.nav-link i {
    width: 16px;
    text-align: center;
    font-size: .75rem;
    opacity: .7;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    background: rgba(255,255,255,.06);
    transform: translateX(2px);
}

.nav-link.active i { opacity: 1; color: var(--accent); }

/* Main */
main {
    position: relative;
    padding: 40px min(4vw, 64px) 80px;
}

.doc-shell { max-width: 1060px; margin: 0 auto; }

/* Hero */
.hero {
    min-height: 300px;
    display: grid;
    align-items: end;
    padding: 48px 0 36px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: .74rem;
    letter-spacing: .07em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

h1 {
    max-width: 800px;
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    line-height: 1;
    letter-spacing: -.05em;
    margin-bottom: 18px;
}

.hero p {
    max-width: 700px;
    color: var(--muted);
    font-size: 1.02rem;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 24px;
    background: rgba(255,255,255,.02);
}

.quick-card {
    padding: 14px 16px;
    border-right: 1px solid var(--line);
    min-height: 80px;
}
.quick-card:last-child { border-right: none; }
.quick-card strong { display: block; color: var(--text); margin-bottom: 4px; font-size: .85rem; }
.quick-card span { color: var(--muted); font-size: .82rem; }

/* Sections */
section {
    padding: 48px 0;
    border-bottom: 1px solid var(--line);
    opacity: 0;
    transform: translateY(20px);
    animation: sectionIn .6s cubic-bezier(.16, 1, .3, 1) forwards;
    animation-delay: calc(var(--i, 0) * 50ms);
}

@keyframes sectionIn {
    to { opacity: 1; transform: translateY(0); }
}

h2 {
    font-size: clamp(1.5rem, 2.5vw, 2.1rem);
    letter-spacing: -.03em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

h2 i {
    font-size: .85em;
    color: var(--accent);
    opacity: .8;
}

h3 {
    font-size: 1.02rem;
    margin: 22px 0 8px;
}

p, li { color: var(--muted); }
ul, ol { padding-left: 20px; margin: 12px 0; }
li { margin: 6px 0; }

.lead { max-width: 780px; font-size: .98rem; }

/* Panel */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin: 18px 0;
    box-shadow: 0 20px 50px rgba(0,0,0,.2);
}

.callout {
    border-left: 3px solid var(--accent);
    background: rgba(117,215,255,.06);
}
.callout.warning {
    border-left-color: var(--yellow);
    background: rgba(255,210,122,.06);
}

.kbd, p code, li code, td code {
    background: rgba(255,255,255,.06);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 6px;
    color: #eaf2ff;
    font-size: .85em;
}

/* Module Grid (cards) */
.module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.module-card {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    transition: transform .2s cubic-bezier(.16, 1, .3, 1), border-color .2s ease, background .2s ease;
}

.module-card:hover {
    transform: translateY(-2px);
    border-color: rgba(117,215,255,.35);
    background: rgba(28, 32, 43, .9);
}

.module-card h3 {
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .95rem;
}

.module-card i { color: var(--accent); width: 16px; }
.module-card p { font-size: .85rem; line-height: 1.5; }

/* Module Table (new clean list style) */
.mod-table {
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: rgba(255,255,255,.015);
}

.mod-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    border-bottom: 1px solid var(--line);
    transition: background .15s ease;
}

.mod-row:last-child { border-bottom: none; }

.mod-row:hover:not(.mod-row--header) {
    background: rgba(117,215,255,.04);
}

.mod-row--header {
    background: rgba(255,255,255,.04);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--soft);
}

.mod-row--header .mod-name,
.mod-row--header .mod-desc {
    color: var(--soft);
    font-size: .72rem;
}

.mod-name {
    padding: 10px 16px;
    font-family: var(--mono);
    font-size: .85rem;
    font-weight: 600;
    color: var(--accent);
    border-right: 1px solid var(--line);
    display: flex;
    align-items: center;
}

.mod-desc {
    padding: 10px 16px;
    color: var(--muted);
    font-size: .85rem;
    display: flex;
    align-items: center;
}

/* Steps */
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.step {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    background: rgba(255,255,255,.025);
}

.step b {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(117,215,255,.12);
    color: var(--accent);
    margin-bottom: 10px;
    font-family: var(--mono);
    font-size: .78rem;
}

.step h3 { margin: 0 0 6px; font-size: .95rem; }
.step p { font-size: .85rem; }

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    margin: 16px 0;
}
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--text); text-align: left; background: rgba(255,255,255,.05); font-size: .85rem; }
td { font-size: .88rem; }
tr:last-child td { border-bottom: none; }

/* Code */
pre {
    margin: 14px 0;
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #0c0f15;
    overflow-x: auto;
    font-size: .85rem;
}

/* API List */
.api-list { display: grid; gap: 10px; }

.api {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.025);
    padding: 14px;
}
.api .sig {
    color: var(--violet);
    font-family: var(--mono);
    font-size: .88rem;
    margin-bottom: 5px;
}
.api p { font-size: .85rem; }

/* Footer */
.footer-note {
    color: var(--soft);
    padding-top: 32px;
    font-size: .85rem;
    border-top: 1px solid var(--line);
    margin-top: 48px;
}

/* Script Playground */
.playground-shell {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #0a0c12;
    margin-top: 16px;
    box-shadow: 0 24px 60px rgba(0,0,0,.35);
}

.playground-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(255,255,255,.04);
    border-bottom: 1px solid var(--line);
}

.playground-dots {
    display: flex;
    gap: 6px;
}
.playground-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
}
.playground-dots span:nth-child(1) { background: #ff5f57; }
.playground-dots span:nth-child(2) { background: #febc2e; }
.playground-dots span:nth-child(3) { background: #28c840; }

.playground-title {
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--soft);
    letter-spacing: .5px;
    flex: 1;
}

.playground-actions {
    display: flex;
    gap: 6px;
}

.pg-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.04);
    color: var(--muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: .75rem;
    transition: all .2s;
}
.pg-btn:hover {
    background: rgba(255,255,255,.1);
    color: var(--text);
    border-color: var(--line-strong);
}

.playground-output {
    height: 260px;
    overflow-y: auto;
    padding: 14px 16px;
    font-family: var(--mono);
    font-size: .82rem;
    line-height: 1.7;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.12) transparent;
}

.pg-line {
    white-space: pre-wrap;
    word-break: break-word;
}

.pg-sys { color: var(--soft); }
.pg-cmd { color: var(--accent); }
.pg-out { color: var(--green); }
.pg-err { color: var(--red); }
.pg-hint {
    color: var(--yellow);
    cursor: pointer;
}
.pg-hint:hover { text-decoration: underline; }

.playground-input-row {
    display: flex;
    align-items: center;
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.02);
}

.pg-prompt {
    padding: 0 8px 0 16px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: .85rem;
    font-weight: 700;
    user-select: none;
}

.playground-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--mono);
    font-size: .82rem;
    padding: 10px 16px 10px 0;
    caret-color: var(--accent);
}

.playground-input::placeholder {
    color: rgba(255,255,255,.18);
}

.playground-snippets {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.pg-snippet-label {
    font-size: .78rem;
    color: var(--soft);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.pg-snippet {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.03);
    color: var(--muted);
    font-family: var(--mono);
    font-size: .75rem;
    cursor: pointer;
    transition: all .2s;
}
.pg-snippet:hover {
    background: rgba(117,215,255,.08);
    border-color: rgba(117,215,255,.3);
    color: var(--text);
}

/* Responsive */
@media (max-width: 1100px) {
    .mod-row {
        grid-template-columns: 150px 1fr;
    }
}

@media (max-width: 980px) {
    body { display: block; }
    aside {
        position: relative;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
    main { padding: 24px 18px 72px; }
    .quick-grid, .module-grid, .steps { grid-template-columns: 1fr; }
    .quick-card { border-right: none; border-bottom: 1px solid var(--line); }
    .quick-card:last-child { border-bottom: none; }
    .mod-row { grid-template-columns: 1fr; }
    .mod-name { border-right: none; border-bottom: 1px solid rgba(255,255,255,.04); padding-bottom: 2px; }
    .mod-desc { padding-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    section { opacity: 1; transform: none; }
}
