:root {
    color-scheme: light;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #152238;
    background: #f4f7fb;
    --muted: #52647b;
    --line: #dce5ef;
    --primary: #174bb8;
    --primary-dark: #123a91;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
p { margin: 0; }
a { color: var(--primary); }
button, input, textarea, select { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #639cff; outline-offset: 3px; }
.site-head { background: #fff; border-bottom: 1px solid var(--line); }
.site-bar {
    min-height: 76px;
    max-width: 1200px;
    margin-inline: auto;
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #152238;
    font-size: 1.12rem;
    font-weight: 750;
    text-decoration: none;
    overflow-wrap: anywhere;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 11px;
    background: #1b4db7;
}
.brand-mark::after {
    content: "";
    width: 16px;
    height: 13px;
    border: 2px solid #fff;
    border-radius: 4px 4px 4px 1px;
    transform: translateY(-1px);
}
.public-main { max-width: 900px; margin: 0 auto; padding: 0 24px 56px; }
.hero { padding: clamp(52px, 9vw, 102px) 0 32px; text-align: center; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 4rem); letter-spacing: -0.055em; margin: 0 0 16px; line-height: 1.2; }
.hero p { color: var(--muted); font-size: 1.06rem; line-height: 1.65; }
.card { border: 1px solid var(--line); border-radius: 17px; background: white; }
.search-card, .result-card, .article-page { padding: clamp(18px, 4vw, 34px); }
.search-card { box-shadow: 0 12px 34px #2037580c; }
.ask-form label, .field > label:first-child, .login-card label { font-weight: 650; display: block; margin-bottom: 9px; }
.ask-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
input:not([type="checkbox"]), textarea, select {
    width: 100%;
    min-width: 0;
    border: 1px solid #b8c9dd;
    border-radius: 9px;
    background-color: #fff;
    padding: 10px 13px;
    color: inherit;
    min-height: 46px;
}
input::placeholder { color: #66768c; opacity: 1; }
input[type="file"]::file-selector-button {
    border: 0;
    border-radius: 5px;
    padding: 6px 9px;
    margin-right: 8px;
    background: #e8f0ff;
    color: #174bb8;
    cursor: pointer;
}
textarea { resize: vertical; line-height: 1.6; }
select {
    appearance: none;
    padding-right: 32px;
    background-image: linear-gradient(45deg, transparent 50%, #52647b 50%), linear-gradient(135deg, #52647b 50%, transparent 50%);
    background-position: calc(100% - 17px) 53%, calc(100% - 12px) 53%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 17px;
    min-height: 43px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-weight: 650;
    line-height: 1.3;
    white-space: nowrap;
    text-decoration: none;
}
.primary { background: var(--primary); color: #fff; }
.primary:hover { background: var(--primary-dark); }
.outline { background: #fff; border-color: var(--line); color: #213755; }
.outline:hover { background: #f0f5ff; }
.destructive { background: #ae283d; color: #fff; }
.destructive:hover { background: #8a1530; }
.ask-row .button { padding-inline: clamp(15px, 5vw, 32px); }
.text-link { text-underline-offset: 4px; font-weight: 650; }
.suggested { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 19px; }
.suggested > span { color: var(--muted); font-size: .92rem; }
.chip {
    background: #f3f7ff;
    border: 1px solid #d4e1f7;
    color: var(--primary-dark);
    padding: 6px 11px;
    border-radius: 99px;
    overflow-wrap: anywhere;
    max-width: 240px;
}
.chip:hover { background: #e5eeff; }
.result-card { margin-top: 20px; scroll-margin-top: 16px; }
.source { color: var(--primary); font-size: .9rem; font-weight: 700; margin-bottom: 12px; }
.result-card h2, .article-page h1 { margin: 0 0 15px; overflow-wrap: anywhere; }
.article-page { margin-top: 36px; }
.prose { line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.prose:empty { display: none; }
.result-links { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 18px; }
.article-page > .text-link { display: inline-block; margin-top: 18px; }
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: 12px;
    margin-top: 20px;
}
.gallery a { display: block; }
.gallery img { display: block; width: 100%; max-height: 410px; object-fit: contain; background: #f5f8fc; border-radius: 9px; }
.error { color: #a02135; line-height: 1.6; }
.login-main { padding: 50px 20px; }
.login-card { max-width: 402px; margin: 0 auto; padding: clamp(20px, 5vw, 32px); }
.login-card h1, .admin-content h1 { margin: 0 0 20px; font-size: 1.55rem; }
.login-card label { margin-bottom: -5px; }
.admin-main {
    max-width: 1160px;
    margin-inline: auto;
    padding: 27px 22px 56px;
    display: grid;
    grid-template-columns: 218px minmax(0, 1fr);
    align-items: start;
    gap: 18px;
}
.top-actions, .rule-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.side-nav { padding: 10px; }
.side-nav a {
    display: block;
    padding: 11px 12px;
    border-radius: 8px;
    color: #243a57;
    text-decoration: none;
    font-weight: 600;
}
.side-nav a:hover, .side-nav [aria-current] { background: #ebf2ff; color: #1748ac; }
.admin-content { padding: clamp(16px, 4vw, 30px); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.section-head h1 { margin: 0; }
.fields { display: grid; gap: 17px; max-width: 700px; }
.fields .button { justify-self: start; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field small { color: var(--muted); display: block; margin-top: 6px; line-height: 1.5; font-size: .875rem; }
.check { display: flex; gap: 7px; align-items: center; color: #35465c; }
.field > .check { margin-top: 8px; }
input[type="checkbox"] { accent-color: var(--primary); }
.checks { display: flex; gap: 18px; flex-wrap: wrap; }
.admin-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(106px, 1fr)); gap: 12px; }
.admin-gallery img { width: 100%; height: 90px; object-fit: contain; background: #f5f8fc; border-radius: 8px; }
.rule-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 17px;
    padding: 15px 0;
    border-top: 1px solid var(--line);
    overflow-wrap: anywhere;
}
.rule-row p { color: var(--muted); margin-top: 5px; }
.tag { background: #edf3f9; color: #435875; font-size: .875rem; padding: 3px 7px; border-radius: 5px; }
.delete-control { color: #9a1a32; }
.delete-control form { margin-top: 6px; }
.empty { color: var(--muted); border: 1px dashed #c7d5e6; padding: 18px; border-radius: 9px; }
.empty p + p { margin-top: 6px; }
.alert { border-radius: 8px; padding: 10px 12px; margin-bottom: 16px; line-height: 1.5; }
.danger { background: #fff0f2; color: #941c34; }
.success { background: #eaf7ef; color: #1b5d3c; }
@media (max-width: 670px) {
    .admin-main { grid-template-columns: 1fr; padding: 18px 14px 32px; }
    .side-nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .site-bar { padding-inline: 17px; }
    .public-main { padding-inline: 14px; }
    .field-row { grid-template-columns: 1fr; }
}
