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

:root {
    --bg: #f8f9fb;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #5a5a7a;
    --primary: #4f46e5;
    --primary-light: #eef2ff;
    --border: #e2e4ea;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --code-bg: #1e1e2e;
    --code-text: #cdd6f4;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: opacity .15s; }
a:hover { opacity: .8; }

.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1140px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.logo {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -.02em;
}
.logo span { color: var(--text); font-weight: 400; }
nav { display: flex; gap: 1.75rem; }
nav a {
    color: var(--text-secondary);
    font-size: .92rem;
    font-weight: 500;
    transition: color .15s;
}
nav a:hover, nav a.active { color: var(--primary); opacity: 1; }

.hero {
    text-align: center;
    padding: 4.5rem 2rem 3.5rem;
    max-width: 720px;
    margin: 0 auto;
}
.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -.03em;
    margin-bottom: .75rem;
    line-height: 1.15;
}
.hero p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 540px;
    margin: 0 auto 2rem;
}

.search-box {
    max-width: 520px;
    margin: 0 auto 1rem;
    position: relative;
}
.search-box input {
    width: 100%;
    padding: .85rem 1.25rem .85rem 3rem;
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 1rem;
    background: var(--surface);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.search-icon {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    padding: 1rem 0 0;
}
.stat { text-align: center; }
.stat-num { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: .8rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; }

.section {
    max-width: 1140px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}
.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-bottom: 2rem;
}
.cat-pill {
    display: inline-block;
    padding: .4rem 1rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50px;
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}
.cat-pill:hover { background: #dde3ff; opacity: 1; }
.cat-pill.all { background: var(--primary); color: #fff; }

.api-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}
.api-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: box-shadow .2s, transform .2s;
}
.api-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.api-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .6rem;
}
.api-card h3 { font-size: 1.05rem; font-weight: 600; }
.badge {
    font-size: .7rem;
    font-weight: 600;
    padding: .2rem .55rem;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.badge-free { background: #ecfdf5; color: var(--success); }
.badge-key { background: #fef3c7; color: var(--warning); }
.badge-oauth { background: #fef2f2; color: var(--danger); }
.api-card p {
    font-size: .9rem;
    color: var(--text-secondary);
    margin-bottom: .75rem;
    line-height: 1.5;
}
.api-card-meta {
    display: flex;
    gap: 1rem;
    font-size: .78rem;
    color: var(--text-secondary);
}
.api-card-meta span { display: flex; align-items: center; gap: .3rem; }
.tag {
    display: inline-block;
    background: var(--bg);
    padding: .15rem .5rem;
    border-radius: 4px;
    font-size: .75rem;
    color: var(--text-secondary);
    margin-right: .3rem;
}

.doc-layout {
    max-width: 1140px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 3rem;
}
.doc-sidebar { position: sticky; top: 80px; align-self: start; }
.doc-sidebar h4 {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-secondary);
    margin-bottom: .75rem;
}
.doc-sidebar ul { list-style: none; }
.doc-sidebar li { margin-bottom: .35rem; }
.doc-sidebar a {
    font-size: .9rem;
    color: var(--text-secondary);
    display: block;
    padding: .3rem .75rem;
    border-radius: 6px;
    transition: background .15s, color .15s;
}
.doc-sidebar a:hover, .doc-sidebar a.active {
    background: var(--primary-light);
    color: var(--primary);
    opacity: 1;
}
.doc-content h1 { font-size: 2rem; font-weight: 800; margin-bottom: 1rem; }
.doc-content h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 2rem 0 .75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.doc-content h3 { font-size: 1.05rem; font-weight: 600; margin: 1.25rem 0 .5rem; }
.doc-content p { margin-bottom: 1rem; color: var(--text-secondary); }
.doc-content ul, .doc-content ol {
    margin: 0 0 1rem 1.5rem;
    color: var(--text-secondary);
}
.doc-content li { margin-bottom: .35rem; }

pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: .88rem;
    line-height: 1.55;
    margin-bottom: 1.25rem;
}
code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: .88em;
}
p code, li code {
    background: var(--primary-light);
    color: var(--primary);
    padding: .15rem .4rem;
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
    font-size: .9rem;
}
th, td {
    text-align: left;
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border);
}
th {
    background: var(--bg);
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-secondary);
}

.about-hero {
    text-align: center;
    padding: 4rem 2rem 2.5rem;
    max-width: 680px;
    margin: 0 auto;
}
.about-hero h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: .75rem; }
.about-hero p { font-size: 1.1rem; color: var(--text-secondary); }
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 2rem 3rem;
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
}
.feature-icon { font-size: 2rem; margin-bottom: .75rem; }
.feature-card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: .5rem; }
.feature-card p { font-size: .9rem; color: var(--text-secondary); }

.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 2rem;
}
.error-code { font-size: 8rem; font-weight: 800; color: var(--primary); line-height: 1; opacity: .15; }
.error-page h1 { font-size: 1.75rem; font-weight: 700; margin: -1.5rem 0 .75rem; }
.error-page p { color: var(--text-secondary); margin-bottom: 1.5rem; }
.btn {
    display: inline-block;
    padding: .7rem 1.6rem;
    background: var(--primary);
    color: #fff;
    border-radius: 50px;
    font-weight: 600;
    font-size: .92rem;
    transition: opacity .15s;
}
.btn:hover { opacity: .9; color: #fff; }

.footer {
    border-top: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
    font-size: .85rem;
    color: var(--text-secondary);
    margin-top: auto;
}
.footer a { color: var(--text-secondary); }

@media (max-width: 768px) {
    .hero h1 { font-size: 1.75rem; }
    .api-grid { grid-template-columns: 1fr; }
    .doc-layout { grid-template-columns: 1fr; }
    .doc-sidebar { display: none; }
    .stats { gap: 1.5rem; }
    .header-inner { flex-direction: column; height: auto; padding: .75rem 0; gap: .5rem; }
    nav { gap: 1rem; }
}
