:root {
    color-scheme: light;
    --page: #f7f7f2;
    --paper: #fff;
    --ink: #182340;
    --muted: #555f73;
    --line: #dce0e8;
    --blue: #2b48c6;
    --blue-deep: #1f358f;
    --blue-wash: #eef2ff;
    --hero: #e3eaff;
    --answer: #205b42;
    --answer-wash: #eff7f0;
    --answer-line: #d9ebdb;
    --width: 1224px;
    --gutter: clamp(18px, 4vw, 44px);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 0;
    color: var(--ink);
    background: var(--page);
    font: 400 15px/1.6 "Geist", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}
::selection { background: #d6e0ff; color: var(--blue-deep); }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: fixed;
    z-index: 10;
    top: 12px;
    left: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--paper);
    color: var(--blue-deep);
    transform: translateY(calc(-100% - 16px));
}
.skip-link:focus { transform: none; }

.masthead {
    background: var(--paper);
    border-bottom: 1px solid #e6e7e3;
}
.masthead-inner, .layout {
    width: min(var(--width), calc(100% - 2 * var(--gutter)));
    margin-inline: auto;
}
.masthead-inner {
    min-height: 67px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .055em;
    text-decoration: none;
}
.brand-icon {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: end;
    justify-content: center;
    gap: 3px;
    padding-bottom: 9px;
    border-radius: 9px;
    background: var(--blue);
}
.brand-icon i {
    width: 4px;
    height: 8px;
    border-radius: 1px;
    background: #fff;
}
.brand-icon i:nth-child(2) { height: 12px; }
.brand-icon i:nth-child(3) { height: 16px; }
.edition {
    padding: 3px 0 3px 16px;
    border-left: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.layout { padding-top: 28px; }
.hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 710px) 1fr;
    min-height: 298px;
    align-items: center;
    column-gap: clamp(18px, 4vw, 58px);
    padding: 36px clamp(24px, 4.5vw, 58px);
    border: 1px solid #d2ddfa;
    border-radius: 22px;
    background: var(--hero);
}
.hero-content { position: relative; z-index: 1; min-width: 0; }
.hero h1 {
    color: #172b6a;
    font-size: clamp(34px, 4.1vw, 55px);
    font-weight: 850;
    line-height: 1.12;
    letter-spacing: .026em;
}
.hero-content > p {
    margin-top: 12px;
    color: #43547f;
    font-size: clamp(14px, 1.3vw, 17px);
    line-height: 1.65;
}

.search-form {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 66px;
    gap: 13px;
    margin-top: 26px;
    padding: 6px 6px 6px 19px;
    border: 1px solid #bdc9ed;
    border-radius: 13px;
    background: var(--paper);
    box-shadow: 0 6px 17px #263d9912;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.search-form:focus-within {
    border-color: #5270de;
    box-shadow: 0 0 0 3px #aebffc80, 0 6px 17px #263d9912;
}
.search-icon {
    position: relative;
    display: block;
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    margin: 0 2px 2px 0;
    border: 2px solid #4c64a7;
    border-radius: 50%;
}
.search-icon::after {
    position: absolute;
    right: -5px;
    bottom: -3px;
    width: 7px;
    height: 2px;
    content: "";
    background: #4c64a7;
    border-radius: 3px;
    transform: rotate(45deg);
}
#query {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
    align-self: stretch;
    appearance: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline: none;
    background: transparent;
    color: var(--ink);
    font-size: 17px;
}
#query::placeholder { color: #606b83; opacity: 1; }
#query::-webkit-search-cancel-button { -webkit-appearance: none; }

.clear-query {
    display: grid;
    flex: 0 0 36px;
    width: 36px;
    height: 38px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #555f78;
    font-size: 23px;
    line-height: 1;
}
.clear-query:hover { background: var(--blue-wash); color: var(--blue-deep); }
.search-submit {
    flex: 0 0 auto;
    min-height: 52px;
    padding: 0 clamp(16px, 3.2vw, 32px);
    border: 0;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    font-weight: 750;
    white-space: nowrap;
    transition: background .16s ease;
}
.search-submit:hover { background: var(--blue-deep); }

.search-examples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-top: 14px;
    font-size: 13px;
}
.search-examples > span { color: #4c5e8b; margin-right: 3px; }
.search-examples button {
    min-height: 32px;
    padding: 4px 11px;
    border: 1px solid #bac9f0;
    border-radius: 6px;
    background: #eff3ff;
    color: #284496;
    white-space: nowrap;
    transition: background .16s ease, border-color .16s ease;
}
.search-examples button:hover, .search-examples button[aria-pressed="true"] {
    background: #d3dffd;
    border-color: #9dafe9;
}

.hero-art {
    position: relative;
    z-index: 0;
    height: 230px;
    min-width: 228px;
    justify-self: stretch;
    pointer-events: none;
}
.art-grid {
    position: absolute;
    inset: -56px -65px -47px -55px;
    mask-image: radial-gradient(ellipse at 62% 49%, #000 13%, transparent 70%);
    background-image:
        linear-gradient(to right, #7c94d845 1px, transparent 1px),
        linear-gradient(to bottom, #7c94d845 1px, transparent 1px);
    background-size: 19px 19px;
}
.art-sheet {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 144px;
    height: 168px;
    border-radius: 13px;
}
.art-sheet-back {
    width: 153px;
    height: 176px;
    border: 1px solid #6882d8;
    background: #6e8aea;
    box-shadow: 0 16px 22px #25428c1a;
    transform: translate(-34%, -53%) rotate(16deg);
}
.art-sheet-back::before, .art-sheet-back::after {
    position: absolute;
    right: 14px;
    width: 41px;
    height: 1px;
    background: #c4d1ff;
    content: "";
}
.art-sheet-back::before { top: 18px; }
.art-sheet-back::after { top: 25px; width: 26px; }
.art-sheet-front {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #aabcea;
    background: #fcfdff;
    padding: 17px;
    box-shadow: 0 13px 25px #20367825;
    transform: translate(-73%, -47%) rotate(-11deg);
}
.art-lines {
    width: 74%;
    height: 24px;
    background:
        linear-gradient(#3958c7, #3958c7) 0 0 / 67% 5px,
        linear-gradient(#c8d4f4, #c8d4f4) 0 12px / 100% 3px,
        linear-gradient(#c8d4f4, #c8d4f4) 0 21px / 80% 3px;
    background-repeat: no-repeat;
}
.art-chart {
    display: flex;
    align-items: end;
    justify-content: space-around;
    gap: 8px;
    height: 77px;
    padding-inline: 5px;
    border-bottom: 1px solid #adbde7;
    background: repeating-linear-gradient(to top, transparent 0 18px, #e5eafd 18px 19px);
}
.art-chart i {
    display: block;
    flex: 0 1 16px;
    height: 31%;
    border-radius: 3px 3px 0 0;
    background: #adc0f7;
}
.art-chart i:nth-child(2) { height: 57%; background: #819aeb; }
.art-chart i:nth-child(3) { height: 44%; background: #adc0f7; }
.art-chart i:nth-child(4) { height: 88%; background: #395bd5; }

.workspace {
    display: grid;
    grid-template-columns: minmax(176px, .235fr) minmax(0, 1fr);
    align-items: start;
    gap: clamp(25px, 3.4vw, 48px);
    margin-top: 38px;
}
.sidebar {
    padding-top: 5px;
    min-width: 0;
}
.rail-label {
    margin-bottom: 14px;
    color: #4f5a73;
    font-size: 13px;
    font-weight: 750;
    letter-spacing: .08em;
}
.group-filters {
    display: grid;
    gap: 5px;
}
.group-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #414d67;
    text-align: left;
    font-weight: 600;
    transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.group-filter:hover { background: #eeefe9; }
.group-filter[aria-pressed="true"] {
    border-color: #d5dffa;
    background: #e8eeff;
    color: #243eaa;
    box-shadow: inset 3px 0 0 #4766dc;
    font-weight: 750;
}
.group-count {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: #596782;
}
.group-filter[aria-pressed="true"] .group-count { color: #344cb0; }
.source-note {
    margin-top: 22px;
    padding-top: 17px;
    border-top: 1px solid #dedfd9;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.85;
}

.results-area { min-width: 0; }
.results-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px 24px;
    margin-bottom: 16px;
}
.results-head > div:first-child { min-width: 0; }
.results-head h2 {
    font-size: clamp(21px, 2.5vw, 27px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .03em;
}
#result-status {
    min-height: 1.55em;
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.type-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 3px;
    border: 1px solid #e2e4de;
    border-radius: 9px;
    background: #eeefe9;
}
.type-filter {
    min-height: 36px;
    padding: 5px 11px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #4c586e;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    transition: color .16s ease, background .16s ease;
}
.type-filter:hover { background: #e1e6f3; color: var(--blue-deep); }
.type-filter[aria-pressed="true"] {
    border-color: #dce2ed;
    background: var(--paper);
    color: #233caa;
    box-shadow: 0 1px 3px #1422470c;
    font-weight: 750;
}

#results {
    display: grid;
    gap: 12px;
    transition: opacity .15s ease;
}
#results[aria-busy="true"] { opacity: .66; }
.question-card {
    min-width: 0;
    padding: 20px 22px 18px;
    border: 1px solid #e1e4e9;
    border-radius: 12px;
    background: var(--paper);
    box-shadow: 0 1px 2px #18234106;
    overflow-wrap: anywhere;
}
.card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 7px;
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}
.tag {
    padding: 3px 8px;
    border-radius: 5px;
    background: var(--blue-wash);
    color: #3049a4;
    font-weight: 650;
}
.tag + .tag { background: #f0f1f5; color: #46516a; }
.question-number {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}
.question-text {
    font-size: clamp(16px, 1.65vw, 19px);
    font-weight: 680;
    line-height: 1.65;
    white-space: pre-line;
}
.question-media {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 9px;
}
.question-media img {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}
.formula-image {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}
.answer-block {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
    margin-top: 12px;
    padding: 9px 11px;
    border: 1px solid var(--answer-line);
    border-radius: 7px;
    color: var(--answer);
    background: var(--answer-wash);
    font-size: 14px;
    line-height: 1.6;
}
.answer-label {
    flex: 0 0 auto;
    color: #315f4b;
    font-size: 12px;
    font-weight: 650;
}
.answer-value {
    flex: 0 0 auto;
    font-size: 15px;
    font-weight: 800;
}
.answer-text {
    min-width: 0;
    flex: 1 1 145px;
    white-space: pre-line;
}
.answer-block.is-unknown {
    border-color: #e3e5eb;
    background: #f2f3f6;
    color: var(--muted);
}
.answer-block.is-unknown .answer-label { color: inherit; }

.question-note, .question-explanation {
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.option-details { margin-top: 7px; }
.option-details summary {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    gap: 9px;
    padding: 4px 4px 4px 0;
    border-radius: 4px;
    color: #2945a4;
    font-size: 13px;
    font-weight: 650;
    list-style: none;
    cursor: pointer;
}
.option-details summary:hover { color: var(--blue-deep); text-decoration: underline; }
.option-details summary::-webkit-details-marker { display: none; }
.option-details summary::before {
    width: 6px;
    height: 6px;
    margin-left: 2px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    content: "";
    transform: rotate(-45deg);
}
.option-details[open] summary::before { transform: translateY(-2px) rotate(45deg); }
.option-list {
    display: grid;
    gap: 5px;
    margin: 3px 0 0;
    padding: 0;
    list-style: none;
}
.option-list > li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #f7f8fb;
    color: #36415c;
}
.option-key {
    flex: 0 0 auto;
    font-weight: 800;
    color: var(--ink);
}
.option-text { min-width: 0; white-space: pre-line; }
.option-list > .is-answer {
    border-color: var(--answer-line);
    background: var(--answer-wash);
    color: var(--answer);
}
.is-answer > .option-key { color: var(--answer); }
mark {
    padding: 0;
    border-radius: 2px;
    background: #dde7ff;
    color: #203caa;
}

.empty-state {
    padding: clamp(24px, 5vw, 52px);
    border: 1px dashed #cbd3e8;
    border-radius: 12px;
    background: var(--paper);
}
.empty-state h3 { font-size: 20px; font-weight: 750; }
.empty-state p { margin-top: 6px; color: var(--muted); }
.empty-state button {
    min-height: 42px;
    margin-top: 16px;
    padding: 7px 15px;
    border: 1px solid #d3ddfa;
    border-radius: 7px;
    background: var(--blue-wash);
    color: var(--blue-deep);
    font-size: 14px;
    font-weight: 700;
}
.empty-state button:hover { background: #dce6ff; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 22px;
}
.pagination button {
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid #dce1ec;
    border-radius: 7px;
    background: var(--paper);
    color: var(--blue-deep);
    font-size: 14px;
    font-weight: 650;
}
.pagination button:not(:disabled):hover { background: var(--blue-wash); }
.pagination button:disabled {
    border-color: #e2e4dd;
    background: transparent;
    color: #6a7382;
}
#page-status {
    color: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 42px;
    padding-block: 19px 23px;
    border-top: 1px solid #dedfd9;
    color: var(--muted);
    font-size: 12px;
}
.site-footer > :first-child { color: #3a4764; font-weight: 750; }

@media (max-width: 1000px) {
    .hero { column-gap: 20px; }
    .hero-art { min-width: 188px; }
    .art-sheet-front { transform: translate(-65%, -47%) rotate(-11deg) scale(.9); }
    .art-sheet-back { transform: translate(-38%, -53%) rotate(16deg) scale(.9); }
}

@media (max-width: 780px) {
    .hero { grid-template-columns: minmax(0, 1fr); min-height: auto; }
    .hero-content > h1, .hero-content > p { position: relative; z-index: 1; }
    .hero-art {
        position: absolute;
        top: -48px;
        right: -6px;
        width: 190px;
        min-width: 0;
        opacity: .42;
        transform: scale(.66);
        transform-origin: 100% 0;
    }
    .workspace { grid-template-columns: minmax(0, 1fr); gap: 23px; margin-top: 27px; }
    .sidebar { padding-top: 0; }
    .rail-label { margin-bottom: 8px; }
    .group-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .group-filter { min-height: 44px; padding: 6px 9px; border-color: #e2e4de; background: #fbfbf8; }
    .source-note { margin-top: 9px; padding-top: 0; border-top: 0; }
    .results-head { margin-bottom: 13px; }
}

@media (max-width: 480px) {
    .masthead-inner { min-height: 56px; }
    .brand { font-size: 16px; }
    .brand-icon { width: 30px; height: 30px; flex-basis: 30px; padding-bottom: 7px; }
    .edition { padding-left: 11px; font-size: 12px; }
    .layout { padding-top: 16px; }
    .hero { border-radius: 16px; padding: 23px 16px 16px; }
    .hero h1 { font-size: clamp(29px, 8.3vw, 36px); }
    .hero-content > p { margin-top: 8px; font-size: 13px; }
    .hero-art { right: -20px; opacity: .25; }
    .search-form { min-height: 54px; gap: 7px; margin-top: 16px; padding: 4px 4px 4px 10px; }
    .search-icon { width: 14px; height: 14px; flex-basis: 14px; margin-right: 2px; }
    .search-icon::after { width: 6px; right: -4px; }
    #query { font-size: 16px; }
    #query::placeholder { font-size: 12px; }
    .clear-query { flex-basis: 28px; width: 28px; }
    .search-submit { min-height: 44px; padding-inline: 11px; font-size: 14px; }
    .search-examples { gap: 5px; margin-top: 10px; font-size: 12px; }
    .search-examples > span { margin-right: 0; }
    .search-examples button { min-height: 32px; padding: 3px 7px; }
    .group-filter { gap: 4px; font-size: 12px; padding-inline: 6px; }
    .group-count { font-size: 11px; }
    .results-head { gap: 9px; }
    .type-filters { width: 100%; }
    .type-filter { flex: 1 1 0; min-height: 39px; padding-inline: 4px; }
    .question-card { padding: 15px; }
    .card-meta { margin-bottom: 7px; }
    .answer-block { margin-top: 10px; }
    .site-footer { margin-top: 31px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
