:root {
    --primary-500: #2dd4bf;
    --primary-400: #5eead4;
    --primary-600: #14b8a6;
    --accent-500: #8b5cf6;
    --accent-400: #c4b5fd;
    --accent-600: #a78bfa;

    --surface-950: oklch(0.09 0.02 250);
    --surface-900: oklch(0.13 0.03 250);
    --surface-800: oklch(0.18 0.04 250);
    --surface-700: oklch(0.25 0.04 250);
    --surface-600: oklch(0.35 0.04 250);

    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);

    --font-display: 'Outfit', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --guide-toolbar-height: 0px;
    --header-height: 99px;
    --surface-100: var(--text-primary);
    --surface-400: var(--text-secondary);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.08);
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
}

[data-theme="light"] {
    --surface-950: oklch(0.98 0.01 250);
    --surface-900: oklch(0.95 0.01 250);
    --surface-800: oklch(0.92 0.02 250);
    --surface-700: oklch(0.85 0.02 250);
    --surface-600: oklch(0.70 0.03 250);

    --text-primary: oklch(0.15 0.02 250);
    --text-secondary: oklch(0.40 0.03 250);
    --text-tertiary: oklch(0.48 0.03 250);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-display);
    background: var(--surface-950);
    color: var(--text-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    font-family: var(--font-display);
    white-space: nowrap;
    text-decoration: none;
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--accent-500) 100%);
    color: white !important;
    box-shadow: 0 4px 20px rgba(45, 212, 191, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(45, 212, 191, 0.5);
    text-decoration: none;
    color: white !important;
}

/* A quiet reading layout aligned to the landing page's 1280px header. */
.main-container {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    max-width: 1280px;
    margin: 0 auto;
    padding-top: var(--header-height);
    min-height: 100vh;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: var(--header-height);
    height: calc(100dvh - var(--header-height));
    background: var(--glass-bg);
    border-right: 1px solid var(--glass-border);
    padding: 2rem 1.25rem 2rem 2rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(72, 91, 110, .22) transparent;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.sidebar-title {
    margin: 0 0 1rem .75rem;
    color: var(--text-primary);
    font-size: .9375rem;
    font-weight: 600;
}

.sidebar-nav { list-style: none; margin: 0; padding: 0; }
.sidebar-nav li { margin: .125rem 0; padding: 0; }
.sidebar-nav a {
    display: block;
    padding: .625rem .75rem;
    color: var(--text-secondary);
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.45;
    border: 1px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    overflow-wrap: normal;
    transition: background-color 150ms ease, color 150ms ease;
}
.sidebar-nav a:hover { background: rgba(20, 184, 166, .05); color: var(--text-primary); text-decoration: none; }
.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(45, 212, 191, 0.1), rgba(139, 92, 246, 0.1));
    color: var(--primary-600);
    border-color: rgba(20, 184, 166, .16);
}
.sidebar-nav .subsection { margin-left: .875rem; }
.sidebar-nav .subsection a { padding-block: .45rem; font-weight: 400; }
.sidebar-nav .subsection a.active { font-weight: 500; }

.content { min-width: 0; padding: 2.75rem 3rem 6rem; scroll-margin-top: calc(var(--header-height) + var(--guide-toolbar-height) + 1rem); }
.content-inner { max-width: 760px; margin: 0 auto; }
.content section {
    padding: 0;
    z-index: auto;
    content-visibility: visible;
    contain-intrinsic-size: none;
}
.content p, .content li { overflow-wrap: break-word; }
.content a:not(.btn) { text-decoration: underline; text-underline-offset: .2em; }
.content section[id], .content [id] { scroll-margin-top: calc(var(--header-height) + var(--guide-toolbar-height) + 1.5rem); }
.guide-language { margin-bottom: 1.5rem; font-size: .875rem; }
.guide-toolbar, .sidebar-overlay { display: none; }

/* Typography */
h1, h2, h3 { overflow-wrap: break-word; hyphens: auto; }
h1 {
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 3.5rem 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    scroll-margin-top: calc(var(--header-height) + 2rem);
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 2rem 0 1rem 0;
    scroll-margin-top: calc(var(--header-height) + 2rem);
}

h4, .setup-step-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-600);
    margin: 1.5rem 0 0.75rem 0;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1.0625rem;
}

.intro-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.75;
}

/* Lists */
ul, ol {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

li {
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

ul li::marker {
    color: var(--primary-600);
}

/* All six tables share one responsive layout; every row keeps its label. */
.guide-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    font-size: .9375rem;
    line-height: 1.65;
}
.guide-table thead {
    background: linear-gradient(135deg, rgba(45, 212, 191, 0.1), rgba(139, 92, 246, 0.1));
}
.guide-table th, .guide-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    vertical-align: top;
    overflow-wrap: break-word;
}
.guide-table thead th { color: var(--text-primary); font-size: .875rem; font-weight: 600; }
.guide-table thead th:first-child { width: 31%; }
.guide-table tbody th { color: var(--text-primary); font-weight: 600; }
.guide-table tbody td { color: var(--text-secondary); }
.guide-table tbody th, .guide-table tbody td { border-top: 1px solid var(--glass-border); }
.guide-table th p:last-child, .guide-table td p:last-child { margin-bottom: 0; }
.guide-table--three-columns thead th:first-child { width: 27%; }
.guide-table--three-columns thead th:last-child { width: 25%; }

/* Info Boxes */
.info-box {
    background: linear-gradient(135deg, rgba(45, 212, 191, 0.05), rgba(139, 92, 246, 0.05));
    border: 1px solid rgba(20, 184, 166, .2);
    padding: 1.25rem;
    margin: 1.5rem 0;
    border-radius: 12px;
}

.warning-box {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.05), rgba(234, 88, 12, 0.05));
    border: 1px solid rgba(180, 105, 20, .24);
    padding: 1.25rem;
    margin: 1.5rem 0;
    border-radius: 12px;
}

.warning-box p {
    color: #794416;
}

.tip-box {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(167, 139, 250, 0.05));
    border: 1px solid rgba(139, 92, 246, .2);
    padding: 1.25rem;
    margin: 1.5rem 0;
    border-radius: 12px;
}

.callout-label { display: block; font-weight: 600; margin-bottom: .4rem; color: var(--text-primary); }

.info-box > :last-child, .warning-box > :last-child, .tip-box > :last-child { margin-bottom: 0; }

/* Steps */
.step-header {
    font-weight: 600;
    color: var(--primary-600);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
}

/* Code/Inline */
code {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--primary-600);
    white-space: normal;
    overflow-wrap: anywhere;
}

p,
li,
a {
    overflow-wrap: anywhere;
}

/* Links */
a {
    color: var(--primary-600);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--primary-600);
    text-decoration: underline;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(45, 212, 191, 0.3);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 30px rgba(45, 212, 191, 0.5);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
    fill: white;
}

/* The mobile contents panel is an extension of the header, not a second rail. */
@media (max-width: 1024px) {
    :root { --guide-toolbar-height: 56px; }
    .main-container { display: block; padding-top: calc(var(--header-height) + var(--guide-toolbar-height)); }
    .content { padding: 2rem 2rem 6rem; }
    .guide-toolbar {
        display: block;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        z-index: 90;
        background: var(--glass-bg);
        border-bottom: 1px solid var(--glass-border);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }
    .guide-toolbar button {
        display: flex;
        align-items: center;
        gap: .75rem;
        width: 100%;
        height: var(--guide-toolbar-height);
        padding: 0 1.5rem;
        border: 0;
        background: transparent;
        color: var(--text-primary);
        font: 500 .9375rem var(--font-display);
        text-align: left;
        cursor: pointer;
    }
    .guide-contents-label { flex: 0 0 auto; }
    .guide-current-section { min-width: 0; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); font-size: .8125rem; }
    .guide-toolbar svg { flex: 0 0 auto; width: 18px; height: 18px; }
    .guide-toolbar [aria-expanded="true"] svg { transform: rotate(180deg); }
    .sidebar {
        display: none;
        position: fixed;
        top: calc(var(--header-height) + var(--guide-toolbar-height));
        left: 0;
        right: 0;
        width: auto;
        height: auto;
        max-height: calc(100dvh - var(--header-height) - var(--guide-toolbar-height) - 1rem);
        padding: .75rem 1.25rem 1.25rem;
        border: 0;
        border-bottom: 1px solid var(--glass-border);
        background: #fbfdff;
        box-shadow: 0 16px 24px rgba(14, 30, 45, .08);
        z-index: 1001;
    }
    .sidebar.open { display: block; }
    .sidebar-title { display: none; }
    .sidebar-nav a, .sidebar-nav .subsection a { min-height: 44px; display: flex; align-items: center; }
    .sidebar-overlay { position: fixed; inset: calc(var(--header-height) + var(--guide-toolbar-height)) 0 0; background: rgba(14, 30, 45, .16); z-index: 999; }
    .sidebar-overlay.visible { display: block; }
    body.guide-contents-open { overflow: hidden; }
}

@media (max-width: 700px) {
    .content { padding: 1.75rem 1.25rem 6rem; }
    h1 { font-size: 2rem; letter-spacing: -.02em; }
    h2 { font-size: 1.5rem; margin-top: 2.75rem; }
    h3 { font-size: 1.1875rem; }
    p, .content li { font-size: 1rem; }
    .intro-text { font-size: 1.0625rem; }
    .guide-toolbar button { padding-inline: 1.25rem; }
    .content ul, .content ol { margin-left: 1.25rem; }
    .content li { padding-left: .25rem; }
    .guide-table, .guide-table tbody { display: block; width: 100%; }
    .guide-table { position: relative; }
    /* Keep real column headers available to assistive technology. */
    .guide-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .guide-table tbody tr { display: block; padding: 1rem; }
    .guide-table tbody tr + tr { border-top: 1px solid var(--glass-border); }
    .guide-table tbody th, .guide-table tbody td { display: block; width: auto; border: 0; padding: 0; font-size: 1rem; }
    .guide-table tbody th { margin-bottom: .35rem; line-height: 1.5; }
    .guide-table tbody td + td { margin-top: .75rem; }
    .guide-table--three-columns tbody td::before { content: attr(data-label); display: block; margin-bottom: .15rem; color: var(--text-secondary); font-size: .8125rem; font-weight: 600; }
    .info-box, .warning-box, .tip-box { padding: 1rem 1.125rem; }
    .btn { max-width: 100%; white-space: normal; }
    .back-to-top { right: 1rem; bottom: max(1rem, env(safe-area-inset-bottom)); }
}

@media print {
    header, .sidebar, .guide-toolbar, .sidebar-overlay, .back-to-top, .cookie-banner { display: none !important; }
    .main-container { display: block; padding-top: 0; }
    .content { padding: 0; }
    .content-inner { max-width: none; }
    h2, h3, h4 { break-after: avoid; }
    tr, .info-box, .warning-box, .tip-box { break-inside: avoid; }
}
