/* type Guide — Light/Dark adaptive, matching app design */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #F8F8F8;
    --surface: #FFFFFF;
    --surface-dim: #F0F0F0;
    --border: #E0E0E0;
    --text-primary: #111111;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent: #16A34A;
    --accent-light: #22C55E;
    --accent-bright: #15803D;
    --code-bg: #F0F0F0;
    --code-text: #15803D;
    --code-border: #E0E0E0;
    --pre-bg: #F5F5F5;
    --table-header-bg: #F0F0F0;
    --tip-bg: rgba(22,163,74,0.06);
    --btn-bg: #FFFFFF;
    --btn-border: #E0E0E0;
    --btn-text: #666666;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1A1A1A;
        --surface: #2C2C2C;
        --surface-dim: #222222;
        --border: #3A3A3A;
        --text-primary: #E8E8E8;
        --text-secondary: #C8C8C8;
        --text-muted: #9A9A9A;
        --accent: #16A34A;
        --accent-light: #22C55E;
        --accent-bright: #4ADE80;
        --code-bg: #2C2C2C;
        --code-text: #4ADE80;
        --code-border: #3A3A3A;
        --pre-bg: #111111;
        --table-header-bg: #222222;
        --tip-bg: rgba(22,163,74,0.08);
        --btn-bg: #2C2C2C;
        --btn-border: #3A3A3A;
        --btn-text: #9A9A9A;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.7;
}
.container { max-width: 720px; margin: 0 auto; padding: 0 20px 80px; }

/* Header */
.header { padding: 40px 0 20px; text-align: center; }
.header h1 {
    font-size: 2rem; font-weight: 700; margin-bottom: 4px;
    color: var(--accent);
    letter-spacing: -0.02em;
}
.header p { font-size: 0.95rem; color: var(--text-muted); }
.lang-links { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.lang-switch {
    display: inline-block; padding: 5px 14px;
    border: 1px solid var(--border); border-radius: 20px;
    color: var(--text-muted); text-decoration: none; font-size: 0.82rem;
    transition: all 0.2s;
}
.lang-switch:hover { background: var(--surface); color: var(--text-primary); border-color: var(--text-muted); }

/* TOC */
.toc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 24px 0 32px;
}
.toc h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 12px; }
.toc ol { padding-left: 20px; }
.toc li { margin: 6px 0; }
.toc a { color: var(--accent); text-decoration: none; font-size: 0.95rem; }
.toc a:hover { color: var(--accent-light); text-decoration: underline; }

/* Sections */
section { margin-bottom: 40px; }
h2 {
    font-size: 1.4rem; font-weight: 700; color: var(--text-primary);
    margin-bottom: 16px; padding-top: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
h3 {
    font-size: 1.05rem; font-weight: 600; color: var(--accent-light);
    margin: 24px 0 8px;
}
p { margin-bottom: 12px; color: var(--text-secondary); }
ul, ol { padding-left: 20px; margin-bottom: 12px; color: var(--text-secondary); }
li { margin: 4px 0; }
strong { color: var(--text-primary); }

/* Code */
code {
    background: var(--code-bg);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 0.88em;
    color: var(--code-text);
    border: 1px solid var(--code-border);
}
pre {
    background: var(--pre-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 16px;
    font-size: 0.88rem;
    line-height: 1.5;
}
pre code { background: none; padding: 0; color: var(--code-text); border: none; }

/* Tables */
.table-wrap { overflow-x: auto; margin-bottom: 16px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td {
    padding: 10px 12px;
    border: 1px solid var(--border);
    text-align: left;
}
th {
    background: var(--table-header-bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
td { color: var(--text-secondary); }
td code { font-size: 0.85em; }

/* Tip box */
.tip {
    background: var(--tip-bg);
    border-left: 3px solid var(--accent);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin: 16px 0;
    font-size: 0.92rem;
    color: var(--text-secondary);
}
.tip strong { color: var(--accent-light); }

/* Back to top */
.back-top {
    position: fixed; bottom: 24px; right: 24px;
    width: 44px; height: 44px;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 50%;
    color: var(--btn-text); font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    opacity: 0; transition: opacity 0.3s;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.back-top.show { opacity: 1; pointer-events: auto; }
.back-top:hover { background: var(--surface-dim); color: var(--text-primary); }
