:root {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", system-ui, sans-serif;
  color: #172742; background: #f5f7fb; font-synthesis: none;
  --blue: #285bdd; --dark-blue: #1c49c1; --line: #e0e7f1; --muted: #536985;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
:focus-visible { outline: 3px solid #80a4fc; outline-offset: 3px; }
h1, h2, p { margin: 0; }
.site-header { background: #fff; border-bottom: 1px solid #e6ecf5; }
.header-inner, .shell { width: min(calc(100% - 64px), 1240px); margin: auto; }
.header-inner { height: 69px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: #192a47; text-decoration: none; font-size: 20px; font-weight: 800; letter-spacing: .035em; }
.brand-credit { color: #355caa; background: #eef3ff; border: 1px solid #d9e4fa; border-radius: 5px; padding: 4px 6px; font: 700 12px/1.1 system-ui, sans-serif; letter-spacing: .025em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 12px; color: white; font: 700 31px/1 system-ui; background: #295ce0; box-shadow: 0 3px 8px #285bdd26; padding-bottom: 2px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 38px; border: 1px solid transparent; padding: 0 12px; border-radius: 8px; background: transparent; white-space: nowrap; color: #405775; font-weight: 650; font-size: 14px; }
.button:hover:not(:disabled) { background: #edf3ff; color: var(--dark-blue); }
.help-button { padding-inline: 10px; }
.help-icon { display: inline-grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; width: 16px; height: 16px; font: 700 11px/1 system-ui; }
.shell { padding: 26px 0 48px; }
.hero { position: relative; display: flex; align-items: center; min-height: 132px; overflow: hidden; padding: 22px 34px; border: 1px solid #d9e6fd; border-radius: 17px; background: linear-gradient(108deg, #e8f0ff 5%, #eef5ff 58%, #e4edff 100%); }
.hero-copy { z-index: 1; }
.hero h1 { color: #172d56; font-size: clamp(28px, 3.6vw, 39px); font-weight: 800; letter-spacing: .045em; line-height: 1.24; }
.math-art { position: absolute; width: 360px; height: 180px; right: 28px; top: 50%; transform: translateY(-50%); background-image: radial-gradient(#759cec44 1.2px, transparent 1.5px); background-size: 17px 17px; mask-image: linear-gradient(to right, transparent, black 22%, black 92%, transparent); }
.art-tile { position: absolute; display: grid; place-items: center; font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif; font-weight: 760; border-radius: 17px; box-shadow: 0 6px 12px #28487915; }
.tile-fraction { width: 71px; height: 77px; left: 66px; top: 52px; transform: rotate(-13deg); color: #2550ab; background: #fff; padding: 9px 20px; line-height: 1; font-size: 24px; }
.tile-fraction span { width: 100%; text-align: center; }
.tile-fraction span:first-child { border-bottom: 2px solid currentColor; padding-bottom: 3px; }
.tile-operation { width: 55px; height: 55px; left: 153px; top: 25px; transform: rotate(12deg); font-size: 39px; background: #cadcff; color: #285bdd; }
.tile-percent { width: 101px; height: 73px; left: 222px; top: 64px; transform: rotate(10deg); display: flex; justify-content: center; font-size: 35px; color: #754d16; background: #ffe5a8; }
.tile-percent span { font-size: 24px; margin-left: 2px; }
.art-plus { position: absolute; left: 166px; top: 108px; font: 400 34px/1 system-ui; color: #5c83d0; transform: rotate(-13deg); }
.art-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #7ba4fb; }
.dot-one { left: 61px; top: 26px; } .dot-two { left: 229px; top: 35px; width: 5px; height: 5px; } .dot-three { left: 312px; top: 151px; background: #edb34a; }
.workspace { margin-top: 22px; display: grid; grid-template-columns: 331px minmax(0, 1fr); align-items: start; gap: 21px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 3px 9px #28487907; min-width: 0; }
.settings { padding: 20px; }
.settings-heading, .preview-title, .preview-actions { display: flex; align-items: center; gap: 9px; }
h2 { color: #182a47; font-size: 19px; line-height: 1.3; }
.section-icon { width: 30px; height: 30px; position: relative; display: inline-grid; place-content: center; border-radius: 8px; background: #eaf1ff; color: #2b5ed8; flex-shrink: 0; }
.tune-icon { gap: 4px; }
.tune-icon i { width: 15px; height: 1.5px; background: currentColor; position: relative; border-radius: 2px; }
.tune-icon i::before { content: ""; position: absolute; top: -1.75px; left: 3px; width: 4.5px; height: 4.5px; background: currentColor; border-radius: 50%; }
.tune-icon i:nth-child(2)::before { left: 9px; }
.document-icon::before { content: ""; width: 11px; height: 14px; border: 1.5px solid currentColor; border-radius: 2px; }
.document-icon::after { content: ""; width: 6px; height: 5px; border-block: 1.5px solid currentColor; position: absolute; top: 11px; left: 12px; }
#settings { display: grid; gap: 13px; margin-top: 17px; }
.control { border: 0; min-width: 0; padding: 0; margin: 0; }
.control > label, legend { padding: 0; display: block; margin-bottom: 7px; font-size: 14px; font-weight: 700; }
select { width: 100%; color: #243858; background: #fbfcff; border: 1px solid #dce5f3; border-radius: 8px; appearance: none; height: 41px; padding: 0 34px 0 11px; font-size: 15px; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, #627896 50%), linear-gradient(135deg, #627896 50%, transparent 50%); background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: #f1f4fa; padding: 4px; border-radius: 9px; }
.segments label { display: grid; place-items: center; position: relative; min-height: 31px; border: 1px solid transparent; border-radius: 6px; font-weight: 650; font-size: 14px; color: #4b607e; cursor: pointer; white-space: nowrap; }
.segments label:hover { background: #e6edfc; }
.segments label:has(:checked) { background: #fff; color: #204ebc; border-color: #d7e4fd; box-shadow: 0 1px 2px #254b8e12; }
.segments input, .switch-label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segments label:has(:focus-visible), .switch-label:has(:focus-visible) { outline: 3px solid #80a4fc; outline-offset: 2px; }
.field-note { min-height: 20px; font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.layout-options { display: grid; gap: 12px; border-top: 1px solid #e9eef6; padding-top: 15px; }
.check-label { display: flex; align-items: center; gap: 7px; font-size: 14px; color: #405775; cursor: pointer; }
.check-label input { accent-color: var(--blue); width: 16px; height: 16px; margin: 0; }
.primary { background: var(--blue); color: #fff; box-shadow: 0 2px 3px #285bdd20; }
.primary:hover:not(:disabled) { background: var(--dark-blue); color: #fff; }
.generate { width: 100%; min-height: 43px; font-size: 16px; margin-top: 1px; }
.generate span { font-size: 18px; line-height: 1; }
.settings-note { color: var(--muted); font-size: 13px; text-align: center; line-height: 1.5; margin-top: -7px; }
.settings-note.changed { color: #7b4f10; }
.preview { overflow: hidden; }
.preview-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 65px; padding: 13px 16px; }
.preview-title { flex-wrap: wrap; }
.pill { border-radius: 6px; color: #2d57b9; background: #eaf1ff; font-size: 13px; font-weight: 750; padding: 4px 7px; white-space: nowrap; }
.preview-actions { gap: 13px; }
.switch-label { display: flex; align-items: center; gap: 6px; cursor: pointer; position: relative; border-radius: 8px; font-size: 14px; color: #405775; font-weight: 650; white-space: nowrap; }
.switch-track { width: 29px; height: 17px; border-radius: 12px; background: #bcc9dc; position: relative; }
.switch-track::after { content: ""; position: absolute; width: 13px; height: 13px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: transform .15s; }
.switch-label input:checked + .switch-track { background: var(--blue); }
.switch-label input:checked + .switch-track::after { transform: translateX(12px); }
.subtle, .outline { border-color: #dbe5f5; background: #fff; }
.button span[aria-hidden="true"] { font-size: 17px; line-height: 1; }
.help-button span[aria-hidden="true"] { font-size: 11px; }
.paper-zone { border-top: 1px solid #e8edf5; background: #eef2f8; padding: 9px 24px 22px; }
.paper-controls { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 auto 8px; max-width: 610px; }
.paper-format { color: #516785; font-size: 13px; font-weight: 650; }
.pagination { display: flex; gap: 8px; align-items: center; color: #465b78; font-size: 13px; font-variant-numeric: tabular-nums; }
.page-button { padding: 0; width: 27px; min-height: 27px; background: white; border: 1px solid #dee6f2; font: 700 19px/1 system-ui; }
.paper { font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", system-ui, sans-serif; position: relative; display: flex; flex-direction: column; align-items: stretch; width: 100%; max-width: 610px; margin: auto; padding: 26px 30px 15px; border: 1px solid #e0e6ee; border-radius: 4px; background: #fff; box-shadow: 0 4px 14px #2a3b6012; color: #191f2d; container-type: inline-size; }
.paper-header { text-align: center; border-bottom: 1px solid #d9e1ef; padding-bottom: 11px; }
.paper h3 { margin: 0; font-size: clamp(15px, 4cqw, 24px); line-height: 1.25; letter-spacing: .09em; }
.paper-header p { margin-top: 7px; color: #52617a; font-size: clamp(11px, 2.6cqw, 13px); }
.paper-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-top: 13px; color: #36465d; font-size: 12px; }
.paper-fields span { display: flex; align-items: end; gap: 4px; white-space: nowrap; }
.paper-fields i { display: inline-block; flex: 1; border-bottom: 1px solid #8693a6; margin-bottom: 3px; }
.questions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px 23px; margin: 15px 0 0; padding: 0; list-style: none; }
.questions.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.question { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; min-width: 0; gap: 6px; min-height: 29px; }
.question-body { min-width: 0; }
.with-writing-space { grid-auto-rows: minmax(106px, auto); }
.writing-space { display: grid; grid-template-rows: repeat(2, 24px); margin: 5px 0 0; }
.writing-space span { border-bottom: 1px dashed #adbbcf; }
.question-number { color: #51617b; font: 500 12px/1.6 system-ui, sans-serif; text-align: right; min-width: 22px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.equation { min-width: 0; color: #1e2637; font: 500 clamp(12px, 3.5cqw, 17px)/1.55 "Times New Roman", "Noto Serif CJK SC", serif; font-variant-numeric: lining-nums tabular-nums; overflow-wrap: anywhere; }
.fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  vertical-align: middle;
  max-width: 100%;
  margin: .15em .12em;
  min-width: .9em;
  font-size: .85em;
  line-height: 1.12;
  text-align: center;
  white-space: nowrap;
}
.fraction > span { display: block; padding: .08em .16em; }
.fraction > span + span { border-top: 1px solid currentColor; }
.fraction-inline { white-space: nowrap; }
.answer { color: #244caf; font-weight: 700; }
.swap { align-self: start; min-height: 25px; width: 25px; padding: 0; color: #486696; font: 700 16px/1 system-ui; flex-shrink: 0; }
.paper-footer { display: flex; justify-content: space-between; color: #5c6c84; border-top: 1px solid #e5eaf3; margin-top: 12px; padding-top: 8px; font-size: 11px; }
.export-bar { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding: 8px 16px; border-top: 1px solid #edf1f7; flex-wrap: wrap; }
.swap-tip { color: var(--muted); font-size: 13px; }
.swap-tip span { color: #2858c5; font-weight: 750; }
.export-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.export-actions .outline { color: #254fb9; }
dialog { width: min(440px, calc(100% - 32px)); margin: auto; border: 1px solid var(--line); border-radius: 16px; padding: 24px; color: #172742; box-shadow: 0 14px 60px #17274240; }
dialog::backdrop { background: #16294066; }
dialog ol { padding-left: 22px; margin: 17px 0; line-height: 1.65; color: #405775; }
dialog li + li { margin-top: 8px; }
.dialog-close { position: absolute; top: 10px; right: 10px; font-size: 25px; padding: 0; width: 34px; }
.toast { position: fixed; z-index: 3; bottom: 22px; right: 22px; max-width: calc(100vw - 44px); padding: 11px 16px; background: #182d53; color: white; border-radius: 9px; font-size: 14px; box-shadow: 0 4px 16px #192d5140; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
@media (max-width: 1070px) { .workspace { grid-template-columns: 290px minmax(0, 1fr); gap: 15px; } .settings { padding: 17px; } .paper-zone { padding-inline: 13px; } .paper { padding-inline: 18px; } }
@media (max-width: 870px) { .header-inner, .shell { width: min(calc(100% - 36px), 660px); } .workspace { grid-template-columns: minmax(0, 1fr); } #settings { grid-template-columns: repeat(2, minmax(0, 1fr)); } .layout-options { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; align-items: end; } .check-label { min-height: 41px; } .generate, .settings-note { grid-column: 1 / -1; } .math-art { right: -20px; opacity: .7; } }
@media (max-width: 600px) {
  .header-inner, .shell { width: calc(100% - 24px); }
  .header-inner { height: 60px; } .brand { font-size: 18px; gap: 6px; } .brand-mark { width: 33px; height: 33px; }
  .shell { padding-top: 15px; } .hero { min-height: 122px; padding: 17px; }
  .hero-copy { max-width: 80%; } .math-art { transform: translateY(-50%) scale(.52); transform-origin: right center; right: -44px; opacity: .39; }
  .workspace { margin-top: 15px; } .settings { padding: 15px; } #settings { gap: 12px; margin-top: 13px; }
  .segments { gap: 1px; padding: 3px; } .segments label { font-size: 13px; } .segment-numbers label { font-size: 12px; }
  .layout-options { gap: 10px; } .check-label { font-size: 13px; }
  .preview-heading { padding: 10px 11px; flex-wrap: wrap; } .preview-title h2 { font-size: 17px; }
  .preview-actions { gap: 9px; } .preview-actions .button { padding-inline: 6px; min-height: 34px; }
  .paper-zone { padding-inline: 8px; } .paper { padding-inline: 9px; padding-top: 17px; }
  .paper-fields { font-size: 11px; gap: 8px; } .questions { gap: 3px 8px; }
  .question { gap: 2px; } .question-number { min-width: 18px; font-size: 11px; } .swap { width: 21px; }
  .export-bar { padding: 8px 11px; } .export-actions .button { padding-inline: 9px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

.select-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.select-pair select { text-overflow: ellipsis; }
.topic-label { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.topic-label label { font-size: 14px; font-weight: 700; }
.search-button { min-height: 23px; padding: 0 4px; color: #2858c5; font-size: 13px; margin: -3px -4px -2px 0; }
.topic-search { margin-top: 8px; }
.topic-search input { width: 100%; min-height: 35px; border: 1px solid #dce5f3; border-radius: 7px; padding: 0 9px; font-size: 14px; color: #243858; }
#search-results { display: grid; gap: 3px; max-height: 140px; overflow-y: auto; padding: 4px 0; }
#search-results:empty { display: none; }
#search-results .button { justify-content: flex-start; min-height: 32px; text-align: left; white-space: normal; background: #f1f5fd; }
#search-results p { color: var(--muted); font-size: 13px; padding: 3px; }
@media (min-width: 601px) and (max-width: 870px) { .layout-options { grid-template-columns: 3fr 2fr; } .check-label { justify-self: end; } }
@media (max-width: 600px) { #settings > .select-pair, #settings > .select-pair + .control { grid-column: 1 / -1; } .layout-options { grid-template-columns: 1fr; } .check-label { min-height: 20px; } }

@media (max-width: 360px) { .export-actions { flex: 1 1 100%; } .export-actions .button { flex: 1; } }


@media (max-width: 480px) {
  .questions.two { grid-template-columns: minmax(0, 1fr); }
  .with-writing-space { grid-auto-rows: minmax(108px, auto); }
}
