:root {
    --blue:    #0A84FF;
    --dark:    #1C1C1E;
    --mid:     #3A3A3C;
    --subtle:  #6E6E73;
    --border:  #D1D1D6;
    --bg:      #F5F7FA;
    --white:   #FFFFFF;
    --radius:  10px;
    --max:     860px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.6;
    font-size: 16px;
    padding-top: calc(56px + 48px);
    padding-bottom: 32px;
}

/* ── Top bar ── */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(135deg, #0A84FF 0%, #0060CC 100%);
    z-index: 100;
    display: flex;
    align-items: center;
}
.top-bar-inner {
    width: 100%;
    padding: 0 24px;
}
.top-bar-brand {
    font-weight: 700;
    font-size: 17px;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.2px;
}

/* ── Page nav (below blue bar) ── */
.bottom-nav {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    height: 48px;
    background: #F2F2F7;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    scrollbar-width: none;
    z-index: 95;
}
.bottom-nav::-webkit-scrollbar { display: none; }
.tab-item {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    color: var(--subtle);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    padding: 0 12px;
    border-bottom: 3px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.tab-item:hover { color: var(--dark); }
.tab-item.active {
    color: var(--blue);
    font-weight: 700;
    border-bottom-color: var(--blue);
}
.tab-icon { font-size: 15px; line-height: 1; }
.tab-label { font-size: 13px; }

/* ── Hero ── */
.hero {
    background: linear-gradient(135deg, #0A84FF 0%, #0060CC 100%);
    color: var(--white);
    padding: 72px 24px;
    text-align: center;
}
.hero p { color: rgba(255,255,255,0.9); }
.hero h1 {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
}
.hero p {
    font-size: clamp(16px, 2.5vw, 20px);
    opacity: 0.88;
    max-width: 600px;
    margin: 0 auto 32px;
}
.hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ── Container ── */
.container {
    max-width: var(--max);
    margin: 0 auto;
    padding: 64px 24px;
}
.container + .container { padding-top: 0; }

/* ── Section title ── */
.section-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--blue);
    margin-bottom: 8px;
}
h2 {
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.3px;
}
h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}
p { color: var(--mid); margin-bottom: 12px; }
p:last-child { margin-bottom: 0; }

/* ── Cards ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 32px;
}
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}
.card-icon {
    font-size: 28px;
    margin-bottom: 14px;
}

/* ── Steps ── */
.steps { margin-top: 28px; }
.step {
    display: flex;
    gap: 20px;
    margin-bottom: 28px;
    align-items: flex-start;
}
.step-num {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    background: var(--blue);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    margin-top: 2px;
}
.step-body h3 { margin-bottom: 4px; }

/* ── Code blocks ── */
.code-block {
    background: #1C1C1E;
    color: #E5E5EA;
    border-radius: var(--radius);
    padding: 20px 24px;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 13px;
    line-height: 1.7;
    overflow-x: auto;
    margin: 16px 0;
}
.code-block .comment { color: #98989D; }
.code-block .value    { color: #64D2FF; }
.code-block .label    { color: #FFD60A; }

/* ── Table ── */
.table-wrap { overflow-x: auto; margin: 16px 0; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th {
    background: var(--dark);
    color: var(--white);
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
}
td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--mid);
}
tr:last-child td { border-bottom: none; }
td code, th code {
    background: rgba(0,0,0,0.07);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "SF Mono", monospace;
    font-size: 12px;
}

/* ── Alert / note ── */
.note {
    background: #EBF4FF;
    border-left: 4px solid var(--blue);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 14px 18px;
    margin: 16px 0;
    font-size: 14px;
    color: var(--mid);
}
.note strong { color: var(--dark); }

/* ── FAQ ── */
.faq-item {
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
}
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { color: var(--dark); margin-bottom: 8px; }

/* ── Screenshot grid ── */
.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    margin-top: 32px;
}
.screenshot-thumb {
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--white);
    border: 1px solid var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
}
.screenshot-thumb:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.screenshot-thumb img {
    width: 100%;
    aspect-ratio: 9 / 19.5;
    object-fit: cover;
    display: block;
    background: #E5E5EA;
}
.screenshot-thumb .thumb-placeholder {
    width: 100%;
    aspect-ratio: 9 / 19.5;
    background: #E5E5EA;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--subtle);
    font-size: 12px;
    text-align: center;
    padding: 12px;
}
.screenshot-thumb .thumb-placeholder-icon { font-size: 28px; }
.screenshot-thumb .thumb-caption {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--dark);
    border-top: 1px solid var(--border);
}

/* ── Lightbox ── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.92);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.lightbox.active { display: flex; }
.lb-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 100%;
    max-width: 420px;
    width: 100%;
}
.lb-img-wrap {
    flex-shrink: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lb-img-wrap img {
    max-height: calc(100dvh - 180px);
    max-width: 100%;
    width: auto;
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
    display: block;
}
.lb-caption {
    margin-top: 16px;
    color: rgba(255,255,255,0.9);
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    line-height: 1.5;
}
.lb-sub {
    margin-top: 6px;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    text-align: center;
}
.lb-counter {
    margin-top: 4px;
    color: rgba(255,255,255,0.35);
    font-size: 12px;
}
.lb-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.lb-close:hover { background: rgba(255,255,255,0.22); }
.lb-prev, .lb-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,0.22); }

/* ── Footer ── */
footer {
    background: var(--dark);
    color: #98989D;
    text-align: center;
    padding: 32px 24px;
    font-size: 13px;
}
footer a { color: #98989D; }
footer .footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

/* ── Home page section nav ── */
body.has-subnav { padding-top: calc(56px + 48px + 48px); }

.section-nav {
    position: fixed;
    top: calc(56px + 48px);
    left: 0;
    right: 0;
    height: 48px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    z-index: 90;
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    scrollbar-width: none;
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav-inner {
    display: flex;
    align-items: stretch;
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 16px;
    gap: 4px;
}
.section-nav a {
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--subtle);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}
.section-nav a:hover { color: var(--dark); }
.section-nav a.active {
    color: var(--blue);
    font-weight: 700;
    border-bottom-color: var(--blue);
}

/* scroll-margin so sections don't hide behind fixed bars */
.scrollsec { scroll-margin-top: 168px; }

/* ── Table of contents ── */
.toc {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
}
.toc-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--subtle);
    margin-bottom: 12px;
}
.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.toc-list li a {
    display: block;
    padding: 7px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--blue);
    transition: background 0.15s;
}
.toc-list li a:hover {
    background: #EBF4FF;
}

/* ── Collapsible permissions ── */
.perm-details {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 12px;
    overflow: hidden;
}
.perm-details summary {
    cursor: pointer;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--blue);
    background: var(--white);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
.perm-details summary::-webkit-details-marker { display: none; }
.perm-details summary::before {
    content: "▶";
    font-size: 10px;
    transition: transform 0.2s ease;
    display: inline-block;
}
.perm-details[open] summary::before { transform: rotate(90deg); }
.perm-details[open] summary {
    border-bottom: 1px solid var(--border);
}
.perm-body {
    padding: 20px 18px;
    background: var(--white);
}

/* ── Divider ── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

@media (max-width: 600px) {
    .hero { padding: 48px 20px; }
    .container { padding: 40px 20px; }
}
