:root { --action:#ec7a2c; --border:#e6e9f2; }
main { max-width:1360px; padding-bottom:36px; }
button.primary { background:var(--action); border-color:var(--action); }
button { min-height:44px; }
.app-icon svg { width:29px; height:29px; }
.page-heading { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; }
.page-actions { display:flex; justify-self:end; align-items:center; gap:10px; }
.help-action { display:flex; align-items:center; gap:9px; padding:5px 5px 5px 14px; background:#fff2e8; border:1px solid #f6d4b4; border-radius:12px; }
.help-hint { margin:0; color:#d9661b; font-size:clamp(27px,3vw,38px); line-height:1.2; font-weight:800; white-space:nowrap; }
.help-arrow { position:relative; flex:none; width:24px; height:2px; border-radius:2px; background:#ec7a2c; }
.help-arrow::after { position:absolute; content:''; right:0; top:50%; width:8px; height:8px; border:solid #ec7a2c; border-width:2px 2px 0 0; transform:translateY(-50%) rotate(45deg); }
.faq-trigger { gap:7px; color:#fff; background:#ec7a2c; border-color:#ec7a2c; font-weight:700; white-space:nowrap; }
.faq-trigger:hover { color:#fff; background:#db6a1e; border-color:#db6a1e; }
.faq-trigger span { display:grid; place-items:center; width:18px; height:18px; border:1px solid currentColor; border-radius:50%; font-size:12px; }
.faq-dialog { max-height:85vh; max-height:85dvh; width:min(680px,calc(100% - 28px)); }
.faq-dialog .dialog-head { position:sticky; top:0; z-index:1; align-items:center; background:white; }
.faq-dialog .dialog-head h2 { margin:0; }
.faq-dialog .dialog-head button { min-height:44px; width:44px; margin:-8px -8px -8px 0; }
.faq-list { padding:0 26px 12px; }
.faq-list details + details { border-top:1px solid var(--border); }
.faq-list summary { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:56px; padding:13px 0; cursor:pointer; color:#1f2a44; font-weight:650; }
.faq-list summary::-webkit-details-marker { display:none; }
.faq-list summary::after { content:''; flex:none; width:8px; height:8px; border:solid currentColor; border-width:0 2px 2px 0; transform:rotate(45deg); margin-right:4px; }
.faq-list details[open] summary::after { transform:rotate(225deg); }
.faq-answer { padding:0 0 16px; color:#6b7280; font-size:14px; line-height:1.65; }
.faq-answer p + p { margin-top:8px; }
.faq-answer figure { margin:12px 0 0; }
.faq-answer img { display:block; width:100%; height:auto; max-width:540px; border:1px solid var(--border); border-radius:8px; }
.faq-answer .faq-settings-image { max-width:318px; }
.faq-answer .faq-compact-image { max-width:360px; }
.faq-answer img + img { margin-top:8px; }
.faq-answer figcaption { margin-top:5px; color:#6b7280; }
.faq-paired-images { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:6px 12px; max-width:650px; }
.faq-paired-images a { display:block; border-radius:8px; }
.faq-paired-images figcaption { grid-column:1/-1; }
@media(max-width:820px) { .page-actions .local-badge { display:none; } }
@media(max-width:720px) {
  .page-heading { grid-template-columns:minmax(0,1fr); }
  .page-actions { justify-self:center; }
}
@media(max-width:540px) {
  .faq-trigger { padding-inline:10px; font-size:13px; }
  .faq-list { padding-inline:18px; }
}
@media(max-width:380px) {
  .help-action { gap:8px; padding-inline:8px 4px; }
  .help-hint { font-size:24px; }
  .help-arrow { width:18px; }
}
.sr { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.steps { display:flex; justify-content:center; align-items:center; gap:20px; margin:0 0 22px; }
.steps button { gap:8px; border:0; background:transparent; color:#6b7280; }
.steps button[aria-current] { color:var(--action); background:#fff2e8; }
.steps b { border-radius:100%; background:#fde3cf; color:#d9661b; width:23px; height:23px; display:grid; place-items:center; flex:none; }
.steps button[aria-current] b { background:var(--action); color:white; }
.entry,.controls,.viewer { background:white; border:1px solid var(--border); border-radius:18px; overflow:hidden; }
.entry { max-width:990px; margin:auto; padding:36px 40px; }
.entry h2 { font-size:26px; margin-bottom:8px; }
.entry p,.subtle,.preview-footer { color:#6b7280; font-size:13px; line-height:1.65; }
.entry p { font-size:14px; }
.modes { display:grid; grid-template-columns:1fr 1fr; gap:18px; border:0; padding:0; margin:24px 0 20px; min-width:0; }
.modes label { position:relative; cursor:pointer; display:flex; flex-direction:column; gap:6px; border:1px solid var(--border); border-radius:12px; padding:20px; min-width:0; }
.modes label:has(:checked) { background:#fff8f2; border-color:#e8792b; box-shadow:inset 0 0 0 1px #e8792b; }
.modes input { position:absolute; right:18px; top:19px; accent-color:var(--action); }
.modes strong { font-size:19px; padding-right:25px; }
.modes label>span:not(.mini) { color:#6b7280; font-size:13px; }
.mini { display:grid; grid-template-columns:1.6fr repeat(3,1fr); align-content:start; gap:1px; margin-top:12px; padding:1px; background:#e6e9f2; text-align:center; font-size:12px; }
.mini>* { background:white; padding:7px 3px; }
.mini>*:nth-child(-n+4) { background:#fff7f0; }
.entry-footer { display:flex; justify-content:flex-end; }
.work { display:grid; grid-template-columns:320px minmax(0,1fr); gap:18px; align-items:start; }
.controls section { padding:17px 19px; border-bottom:1px solid #e6e9f2; }
.controls h2,.viewer h2 { font-size:16px; }
.field { display:block; margin:10px 0 5px; font-size:13px; font-weight:600; }
.exam-name { display:grid; grid-template-columns:42px minmax(0,1fr); align-items:center; gap:5px; font-size:12px; color:#6b7280; margin-top:7px; }
.controls input:not([type=checkbox]),.controls select { min-height:44px; }
.subject-choices { display:flex; flex-wrap:wrap; gap:5px; margin-top:8px; }
.subject-choices label { cursor:pointer; display:inline-flex; min-height:44px; align-items:center; border-radius:7px; border:1px solid var(--border); padding:0 8px; font-size:13px; }
.subject-choices label:has(:checked) { color:#d9661b; background:#ffffff; border-color:#f0c4a0; }
.subject-choices input,.rank-options input { accent-color:var(--action); margin:0 5px 0 0; }
#subject-form { display:flex; gap:6px; margin-top:9px; }
#subject-form button { flex:none; }
.rank-options { width:100%; margin-top:6px; text-align:center; border-collapse:collapse; font-size:13px; }
.rank-options tbody tr { border-top:1px solid #f4f6fb; }
.rank-options tbody th { text-align:left; font-weight:500; }
.rank-options label { display:grid; place-items:center; min-height:44px; cursor:pointer; }
.rank-options input { width:16px; height:16px; margin:0; }
.control-footer { display:flex; justify-content:space-between; gap:8px; padding:15px 19px; }
.viewer-head { display:flex; align-items:center; justify-content:space-between; padding:17px 20px; gap:10px; }
.sample-label { font-size:12px; font-weight:500; background:#ffffff; color:#d9661b; padding:3px 8px; border-radius:5px; margin-left:5px; white-space:nowrap; }
.preview-note { padding:10px 20px; background:#fff8f2; border-block:1px solid #f5e8dc; color:#6b7280; font-size:13px; }
.stage { overflow:auto; background:#f4f6fb; padding:20px; max-height:760px; }
.preview-paper { max-width:820px; min-width:655px; padding:24px 22px 30px; margin:auto; background:white; box-shadow:0 3px 12px #1f2a4418; }
.preview-paper.wide { min-width:780px; }
.preview-footer { padding:12px 20px; }
.slip { color:#1f2a44; }
.slip h3 { text-align:center; margin:0 0 4px; font-size:16px; overflow-wrap:anywhere; }
.student { display:flex; gap:20px; font-size:12px; margin:0 0 7px; }
.student b { margin-left:4px; }
.slip-table { table-layout:fixed; border-collapse:collapse; width:100%; text-align:center; font-size:11px; font-variant-numeric:tabular-nums; }
.slip-table :is(th,td) { border:1px solid #c4cad8; padding:4px 2px; line-height:1.25; overflow-wrap:anywhere; }
.slip-table thead th { background:#f5f6fa; font-weight:650; }
.slip-table .exam { width:14%; text-align:left; padding-left:6px; background:#fafbfc; font-weight:650; }
.slip-table .measure { width:7%; }
.slip-table .total { width:7%; }
.slip-table .overall { background:#fafbfc; font-size:1.08em; font-weight:700; }
.slip-table .rank-row { color:#6b7280; background:#fcfcfd; }
.slip-table tbody+tbody tr:first-child>* { border-top:2px solid #c4cad8; }
.cut { border-top:1px dashed #9aa1b0; margin:17px 0; }
@media screen and (min-width:901px) {
  .work > .viewer {
    position:sticky;
    top:16px;
    display:flex;
    flex-direction:column;
    max-height:calc(100vh - 32px);
  }
  .work > .viewer > :not(.stage) { flex-shrink:0; }
  .work > .viewer > .stage { min-height:0; }
}
@media(max-width:900px) { .work { grid-template-columns:minmax(0,1fr); } .stage { max-height:560px; } }
@media(max-width:600px) { .entry{padding:20px;} .modes{grid-template-columns:1fr; gap:10px; margin:16px 0;} .steps{gap:2px; justify-content:space-between;} .steps button{font-size:11px; padding:5px; gap:3px;} .steps b{width:19px;height:19px;} .stage{padding:12px;} .viewer-head{padding:12px;} }
@page { size:A4 portrait; margin:12mm; }
@media print {
  #screen { display:none!important; }
  #print-root { display:block; }
  .print-slip { break-inside:avoid; }
  .slip h3 { font-size:12pt; }
  .slip-table { font-size:8pt; }
  .slip-table :is(th,td) { padding:2.5pt 1.5pt; }
  .student { font-size:9pt; }
}
.modes input[type=radio] { width:18px; height:18px; min-height:0; margin:0; padding:0; box-shadow:none; }
.steps button[aria-current]:disabled { opacity:1; }
#exam-overrides { border-top:1px solid #e6e9f2; margin-top:4px; }
#exam-overrides summary { min-height:44px; align-content:center; cursor:pointer; font-size:13px; font-weight:600; color:#d9661b; }
#override-list fieldset { border:1px solid #e6e9f2; border-radius:7px; margin:0 0 8px; min-width:0; padding:0 8px 3px; }
#override-list legend { font-size:12px; font-weight:600; overflow-wrap:anywhere; }
#override-list label { display:flex; gap:5px; align-items:center; min-height:44px; font-size:12px; cursor:pointer; }
#override-list input { accent-color:var(--action); }
.override-ranks { display:grid; grid-template-columns:1fr 1fr; }
@media(max-width:900px) { .printing .viewer { grid-row:1; } }
.check-field { display:flex; align-items:center; min-height:44px; gap:7px; font-size:13px; }
.check-field input { accent-color:var(--action); }
.transfer-grid { display:grid; grid-template-columns:1fr 1fr; margin:24px 0; border-block:1px solid var(--border); }
.transfer-grid section { padding:18px 22px 18px 0; min-width:0; }
.transfer-grid section+section { border-left:1px solid var(--border); padding-left:22px; }
.transfer-grid h3 { margin:0 0 8px; font-size:17px; }
.transfer-grid button { margin-top:14px; }
.transfer-grid .subtle { margin-top:8px; overflow-wrap:anywhere; white-space:pre-line; }
#download-status,#import-status { min-height:22px; }
#import-status.error,#download-status.error,#pdf-status.error { color:#a62c37; }
#import-file { position:absolute; width:1px; height:1px; opacity:0; padding:0; pointer-events:none; }
.upload-pick { display:flex; flex-direction:column; justify-content:center; align-items:center; gap:6px; width:100%; min-height:126px; padding:14px; border:2px dashed #e8b98e; border-radius:10px; color:#d9661b; background:#fff8f2; cursor:pointer; }
.upload-pick > * { pointer-events:none; }
.upload-pick:hover,.upload-pick.is-dragging { color:#db6a1e; border-color:#ec7a2c; background:#fff2e8; }
.upload-pick.is-dragging { box-shadow:inset 0 0 0 2px #f6d4b4; }
.upload-pick:focus-visible { outline:2px solid #ec7a2c; outline-offset:3px; }
.upload-plus { display:grid; place-items:center; width:34px; height:34px; border-radius:50%; background:#fde3cf; font-size:26px; font-weight:500; line-height:1; }
.upload-formats { font-size:12px; font-weight:400; color:#6b7280; }
.actions { display:flex; gap:9px; flex-wrap:wrap; align-items:center; }
.entry-footer.actions,.result-tools { justify-content:space-between; }
.result-tools { display:flex; align-items:center; gap:12px; }
.result-tools button { min-height:36px; }
#clear-file { color:#a62c37; }
.result-stage { min-height:280px; }
.result-stage .paper { min-width:0; width:min(100%,800px); padding:0; margin:auto; }
.result-stage canvas { display:block; width:100%; height:auto; }
.pager-row { flex-wrap:wrap; }
#page-counter { font-size:13px; white-space:nowrap; }
@media(max-width:600px) {
  .transfer-grid { grid-template-columns:1fr; }
  .transfer-grid section+section { border-left:0; border-top:1px solid var(--border); padding-left:0; }
  .steps button { white-space:normal; }
  .result-stage .paper { min-width:460px; }
}
.subject-choices { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); padding:0; list-style:none; }
.subject-choices li { display:flex; align-items:center; min-width:0; border:1px solid var(--border); border-radius:7px; padding-right:3px; }
.subject-choices li:has(input:checked) { background:#ffffff; border-color:#f0c4a0; }
.subject-choices li label { flex:1; min-width:0; min-height:38px; border:0; background:none!important; padding:0 4px 0 6px; overflow-wrap:anywhere; line-height:1.2; }
.subject-choices li button { flex:none; border:0; background:transparent; min-width:24px; min-height:38px; padding:0; font-size:15px; }
.subject-choices li button:hover:not(:disabled) { background:#fde3cf; }
.slip-table .has-change { width:10%; }
.example-options { border-top:1px solid var(--border); margin-top:26px; padding-top:14px; }
.example-options h3 { margin:0 0 4px; font-size:16px; }
.example-options section { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:8px; flex-wrap:wrap; }
.example-options section strong { font-size:13px; }
.subject-choices li button[data-remove] { color:#964856; min-width:20px; }
.subject-choices li button[data-remove]:hover { background:#fbe7e9; }
.subject-choices li button[data-move] { min-width:19px; }
.control-footer { flex-wrap:wrap; }
#work .viewer-head { flex-wrap:wrap; }
.level-options { display:flex; flex-wrap:wrap; column-gap:12px; }
.level-options .check-field { min-height:38px; }
.print-options { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.print-options select { width:auto; min-height:36px; }
.print-option { display:inline-flex; align-items:center; gap:7px; }
.gap-option input[type=range] { width:96px; margin:0; height:16px; }
.gap-option output { min-width:38px; font-size:12px; color:var(--muted); font-variant-numeric:tabular-nums; }
.controls .option-section { padding:0 19px; }
.option-section > details[open] { padding-bottom:17px; }
.option-section > details > summary { margin-inline:-19px; padding:17px 19px; color:#1f2a44; cursor:pointer; font-weight:650; }
.option-section > details > summary:focus-visible { outline-offset:-3px; }
.option-section > details > summary + p { margin-bottom:8px; }
#cutoff-values fieldset { margin-top:10px; }
.cutoff-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.cutoff-grid label { display:grid; gap:3px; font-size:13px; }
.slip-table+.slip-table { margin-top:10px; }
.slip-table .score-row .subject-value,.slip-table .score-row .measure { font-size:12px; font-weight:700; }
.slip-table .overall-rank { font-weight:400; }
.slip-table .overall-combo { width:13%; white-space:pre-wrap; }
.template-preview { margin:0 0 20px; }
.template-preview h3 { font-size:16px; margin:0 0 10px; }
.template-preview .stage { border-radius:10px; max-height:440px; }
#template-example { margin-top:12px; }
.result-stage { position:relative; }
.pdf-progress {
  position:absolute;
  z-index:1;
  inset:132px 0 auto;
  width:min(384px, calc(100% - 72px));
  margin-inline:auto;
}
.pdf-progress:not([hidden]) + #pdf-paper .empty-preview { visibility:hidden; }
.pdf-progress-heading {
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  color:#1f2a44;
  font-size:14px;
  font-weight:650;
}
#pdf-progress-count {
  flex:none;
  color:var(--action);
  font-variant-numeric:tabular-nums;
}
.pdf-progress-track {
  height:8px;
  margin:12px 0 0;
  overflow:hidden;
  border-radius:999px;
  background:#f5e8dc;
}
.pdf-progress-track::before {
  content:"";
  display:block;
  width:var(--progress-fill, 0%);
  height:100%;
  border-radius:inherit;
  background:var(--action);
  transition:width 220ms ease-out;
}
.pdf-progress progress:indeterminate + .pdf-progress-track::before {
  width:32%;
  transition:none;
  animation:pdf-progress-slide 1.5s ease-in-out infinite alternate;
}
.pdf-progress p { margin:12px 0 0; }
@keyframes pdf-progress-slide {
  to { transform:translateX(212%); }
}
@media (prefers-reduced-motion:reduce) {
  .pdf-progress-track::before { transition:none; }
  .pdf-progress progress:indeterminate + .pdf-progress-track::before { animation:none; }
}
.pdf-progress p:empty { display:none; }
#settings-error:empty { display:none; }
#settings-error { margin:12px 19px 0; color:#a62c37; font-size:13px; }
.production .subject-choices { grid-template-columns:repeat(auto-fit,minmax(132px,1fr)); }

/* 自定义勾选框：白底 + 橙色对勾，不做填充（仅方形 checkbox，radio 保持原生） */
input[type=checkbox] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  min-height: 0;
  border: 1.5px solid var(--action);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex: none;
  box-shadow: none;
}
input[type=checkbox]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid var(--action);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type=checkbox]:disabled { opacity: .45; cursor: not-allowed; }
input[type=checkbox]:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
