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

:root {
    --bg: #0a0a0a;
    --text: #d4d4d4;
    --muted: #888;
    --dim: #555;
    --border: #1a1a1a;
    --link-border: #333;
    --link-hover: #888;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f5f2eb;
        --text: #2a2a2a;
        --muted: #666;
        --dim: #999;
        --border: #d4cfc5;
        --link-border: #bbb;
        --link-hover: #555;
    }
}

[data-theme="light"] {
    --bg: #f5f2eb;
    --text: #2a2a2a;
    --muted: #666;
    --dim: #999;
    --border: #d4cfc5;
    --link-border: #bbb;
    --link-hover: #555;
}

[data-theme="dark"] {
    --bg: #0a0a0a;
    --text: #d4d4d4;
    --muted: #888;
    --dim: #555;
    --border: #1a1a1a;
    --link-border: #333;
    --link-hover: #888;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Times New Roman', 'Noto Serif SC', serif;
    line-height: 1.8;
    padding: 4rem 2rem;
    max-width: 720px;
    margin: 0 auto;
    transition: background 0.3s, color 0.3s;
}

h1 {
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4rem;
    text-align: center;
}

h2 {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--muted);
    margin-top: 3rem;
    margin-bottom: 1rem;
    letter-spacing: 0.15em;
}

h3 {
    font-size: 1rem;
    font-weight: 400;
    color: var(--muted);
    margin-top: 2rem;
    margin-bottom: 0.8rem;
}

p { margin-bottom: 1.2rem; }

a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--link-border);
    transition: border-color 0.2s;
}
a:hover { border-color: var(--link-hover); }

ul { list-style: none; padding: 0; }
li { margin-bottom: 0.6rem; }

blockquote {
    border-left: 2px solid var(--border);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    color: var(--muted);
    font-style: italic;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}
th, td {
    padding: 0.5rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 400; }

strong { font-weight: 600; }
em { font-style: italic; }
hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

code {
    font-family: monospace;
    background: var(--border);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85em;
}

.section { margin-bottom: 3rem; }

.back {
    display: inline-block;
    margin-bottom: 2rem;
    font-size: 0.85rem;
    color: var(--dim);
    border-bottom: none;
}
.back:hover { color: var(--muted); }

.theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: 1px solid var(--border);
    color: var(--dim);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover { border-color: var(--muted); color: var(--muted); }

.footer {
    margin-top: 6rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--dim);
    text-align: center;
}

/* Chinese text styling */
.zh { line-height: 2.0; }

img {
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
    border-radius: 2px;
}
