:root {
    color-scheme: light;
    --background: #ffffff;
    --surface: #f6f7f8;
    --surface-hover: #f0f4f8;
    --text: #1a1a1b;
    --muted: #576f7f;
    --line: #e2e8ed;
    --line-strong: #d3dbe1;
    --accent: rgb(23, 114, 246);
    --accent-soft: rgba(23, 114, 246, 0.09);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--text);
    background: var(--background);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Noto Sans SC", "Source Han Sans SC", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}
a { color: var(--accent); }
a:focus-visible, input:focus-visible, select:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 52px;
    padding: 0 max(18px, calc((100% - 1000px) / 2));
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
}
.site-title {
    color: var(--text);
    font-size: .98rem;
    font-weight: 700;
    text-decoration: none;
}
.site-title:hover { color: var(--accent); }
.site-subtitle, .headline, .result-count, .empty { color: var(--muted); }
.site-subtitle { font-size: .78rem; }
main { width: min(1000px, calc(100% - 28px)); margin: 0 auto; }
.hero { padding: 40px 4px 24px; }
.hero h1 {
    margin: 3px 0 4px;
    font-size: clamp(2rem, 5vw, 3.1rem);
    line-height: 1.15;
    letter-spacing: -.025em;
}
.hero p { margin: 6px 0; }
.hero p:last-child { color: var(--muted); font-size: .92rem; }
.eyebrow {
    color: var(--accent);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .14em;
}
.controls {
    position: sticky;
    top: 60px;
    z-index: 4;
    display: flex;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.97);
}
.search-box, .sort-box {
    display: flex;
    min-height: 36px;
    align-items: center;
    gap: 7px;
    padding: 3px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    background: var(--background);
}
.search-box:focus-within, .sort-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}
.search-box { flex: 1; }
.search-box > span { color: var(--accent); font-size: 1.1rem; }
input, select {
    width: 100%;
    min-height: 28px;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
    font: inherit;
}
input::placeholder { color: #7c8b95; }
.sort-box { white-space: nowrap; color: var(--muted); font-size: .8rem; }
.sort-box select { width: auto; cursor: pointer; color: var(--text); }
.result-count { margin: 15px 8px 6px; font-size: .76rem; }
.answer-list {
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: var(--background);
}
.answer-preview + .answer-preview { border-top: 1px solid var(--line); }
.answer-preview a {
    display: block;
    padding: 12px 16px 10px;
    color: inherit;
    text-decoration: none;
    transition: background-color 120ms ease-out;
}
.answer-preview a:hover { background: var(--surface-hover); }
.answer-preview a:active { background: var(--accent-soft); }
.answer-preview h2 {
    margin: 0 0 3px;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
}
.answer-preview a:hover h2 { color: var(--accent); }
.answer-preview p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0 0 5px;
    color: #38444d;
    font-size: .9rem;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.preview-meta, .answer-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 500;
}
.preview-meta span:first-child, .answer-stats span:first-child {
    color: var(--accent);
}
.back { margin: 18px 0 10px; }
.back a {
    display: inline-flex;
    min-height: 34px;
    padding: 6px 10px;
    align-items: center;
    border-radius: 4px;
    font-size: .84rem;
    text-decoration: none;
}
.back a:hover { background: var(--accent-soft); }
.answer-page { width: min(820px, 100%); margin: auto; }
.question-card, .answer-card, .comments-section {
    padding: clamp(20px, 4vw, 36px);
    border: 1px solid var(--line-strong);
    background: var(--background);
}
.question-card { border-radius: 6px 6px 0 0; background: var(--surface); }
.question-card h1 {
    margin: 7px 0 0;
    font-size: clamp(1.55rem, 4vw, 2.2rem);
    line-height: 1.3;
    letter-spacing: -.02em;
}
.answer-card { border-top: 0; border-radius: 0 0 6px 6px; }
.topics { display: flex; gap: 5px; flex-wrap: wrap; }
.topic, .badge {
    padding: 2px 7px;
    color: var(--accent);
    border-radius: 3px;
    background: var(--accent-soft);
    font-size: .7rem;
    font-weight: 600;
    line-height: 1.55;
}
.question-detail {
    margin-top: 18px;
    padding-top: 14px;
    color: var(--muted);
    border-top: 1px solid var(--line-strong);
}
.question-detail h2 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: .9rem;
}
.author-row { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.avatar {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 4px;
    flex: none;
}
.avatar-fallback {
    display: grid;
    place-items: center;
    color: white;
    background: var(--accent);
}
.headline { font-size: .76rem; }
.rich-content {
    overflow-wrap: anywhere;
    font-family: "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
    font-size: 17px;
    line-height: 1.75;
}
.rich-content p { margin: 1em 0; }
.rich-content figure { margin: 20px 0; }
.rich-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 16px auto;
    border-radius: 3px;
}
.rich-content blockquote {
    margin: 1.2em 0;
    padding: 2px 0 2px 14px;
    color: var(--muted);
    border-left: 3px solid var(--accent);
}
.rich-content pre {
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface);
}
.answer-stats {
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.comments-section { margin-top: 14px; border-radius: 6px; }
.comments-section h2 { margin: 0 0 8px; font-size: 1.2rem; }
.comments-section h2 span {
    color: var(--muted);
    font-size: .8em;
    font-weight: 400;
}
.comment {
    display: flex;
    gap: 9px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    border-radius: 3px;
    scroll-margin-top: 64px;
    transition: background-color 160ms ease-out, box-shadow 160ms ease-out;
}
.comment:target {
    padding-left: 8px;
    padding-right: 8px;
    background: var(--accent-soft);
    box-shadow: inset 3px 0 var(--accent);
}
.comment .avatar { width: 30px; height: 30px; }
.comment-main { min-width: 0; flex: 1; }
.comment-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.comment-head strong { font-size: .9rem; }
.reply-target { color: var(--muted); font-size: .73rem; }
.comment-permalink {
    margin-left: auto;
    display: inline-flex;
    gap: 4px;
    align-items: baseline;
    color: var(--muted);
    font-size: .68rem;
    text-decoration: none;
}
.comment-permalink:hover { color: var(--accent); }
.comment-content { margin-top: 2px; overflow-wrap: anywhere; font-size: .92rem; }
.comment-content p { margin: 0; }
.comment-meta { color: var(--muted); font-size: .73rem; }
.comment-replies {
    margin-top: 6px;
    padding-left: 12px;
    border-left: 2px solid var(--line-strong);
}
.comment-replies .comment { padding-bottom: 4px; border-top: 0; }
footer {
    padding: 32px 16px 20px;
    color: var(--muted);
    text-align: center;
    font-size: .72rem;
}
[hidden] { display: none !important; }
@media (max-width: 767px) {
    main { width: min(100% - 16px, 1000px); }
    .site-header { min-height: 48px; padding-inline: 10px; }
    .site-subtitle { display: none; }
    .hero { padding: 24px 2px 16px; }
    .controls { position: static; padding: 6px; flex-direction: column; }
    .sort-box select { width: 100%; }
    .answer-preview a { padding: 11px 12px 9px; }
    .question-card, .answer-card, .comments-section { padding: 18px 14px; }
    .comment-replies { padding-left: 7px; }
    .comment-permalink { width: 100%; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
