:root {
  color-scheme: light;
  --ink: #14221e;
  --muted: #66736f;
  --line: #dfe7e3;
  --paper: #f7f9f6;
  --white: #ffffff;
  --green: #0d795c;
  --green-dark: #075c46;
  --green-soft: #e5f4ee;
  --amber: #b35e13;
  --amber-soft: #fff1df;
  --danger: #b52b32;
  --shadow: 0 20px 60px rgba(26, 56, 46, 0.09);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 5%, rgba(80, 173, 132, 0.12), transparent 25rem),
    linear-gradient(180deg, #fbfcfa 0, var(--paper) 38rem);
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  color: #fff; background: var(--green); border-radius: 12px; font-weight: 800;
  box-shadow: 0 7px 20px rgba(13, 121, 92, 0.24);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .02em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.app-nav { display: flex; gap: 5px; margin-left: auto; margin-right: 18px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.7); }
.nav-link { padding: 8px 11px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 800; }
.nav-link:hover { color: var(--green-dark); background: var(--green-soft); }
.nav-link.active { color: #fff; background: var(--green); }

.local-badge { padding: 8px 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 12px; background: rgba(255,255,255,.72); }
.local-badge i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #24a774; box-shadow: 0 0 0 4px rgba(36,167,116,.12); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.hero { min-height: 390px; display: grid; grid-template-columns: 1.25fr .75fr; gap: 60px; align-items: center; padding: 48px 0 52px; }
.eyebrow, .step-label { margin: 0 0 12px; color: var(--green); font-weight: 800; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(38px, 5vw, 65px); line-height: 1.12; letter-spacing: -.045em; }
h1 span { color: var(--green); }
.hero-copy { max-width: 660px; margin: 24px 0 0; color: var(--muted); font-size: 16px; line-height: 1.85; }
.hero-card { padding: 28px; display: grid; gap: 12px; border: 1px solid rgba(13,121,92,.15); border-radius: 24px; background: rgba(255,255,255,.82); box-shadow: var(--shadow); transform: rotate(1deg); }
.hero-card span { padding: 15px 18px; border-radius: 13px; background: var(--paper); font-weight: 700; text-align: center; }
.hero-card span:last-child { color: var(--green-dark); background: var(--green-soft); }
.hero-card b { color: var(--green); text-align: center; }
.admin-subnav { display: inline-flex; gap: 5px; margin: 0 0 18px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.75); }
.admin-subnav-button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 800; cursor: pointer; }
.admin-subnav-button:hover { color: var(--green-dark); background: var(--green-soft); }
.admin-subnav-button.active { color: #fff; background: var(--green); }

.workspace-card, .results { padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: var(--white); box-shadow: var(--shadow); }
.api-card { margin-top: 26px; }
.section-heading { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 26px; }
.section-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.02em; }
.status-pill { padding: 8px 12px; border-radius: 99px; font-size: 12px; font-weight: 800; }
.status-pill.idle { color: var(--muted); background: #eef2f0; }
.status-pill.running { color: var(--green-dark); background: var(--green-soft); }
.status-pill.success { color: var(--green-dark); background: #d9f5e9; }
.status-pill.error { color: var(--danger); background: #fde8e8; }

#split-form, .api-form { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.direct-mineru-panel { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 13px; padding: 20px; border: 1px solid #b7dccc; border-radius: 16px; background: #f8fcfa; }
.source-screenshot-panel { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 13px; padding: 20px; border: 1px solid #9fcbb8; border-radius: 16px; background: #edf8f2; }
.source-screenshot-panel > div:first-child { min-width: 0; }
.source-screenshot-panel strong { display: block; font-size: 16px; }
.source-screenshot-panel small { display: block; max-width: 680px; margin-top: 8px; color: var(--muted); line-height: 1.55; }
.source-screenshot-panel.drag-active { border-color: var(--green); box-shadow: inset 0 0 0 2px rgba(8, 133, 96, .18); }
.bulk-queue-panel { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 13px; padding: 20px; border: 1px solid #c6ded3; border-radius: 16px; background: #f2faf5; }
.bulk-queue-panel > div:first-child { min-width: 0; }
.bulk-queue-panel strong { display: block; font-size: 16px; }
.bulk-queue-panel small { display: block; max-width: 630px; margin-top: 8px; color: var(--muted); line-height: 1.55; }
.queue-concurrency { white-space: nowrap; font-size: 13px; color: var(--muted); }
.queue-concurrency select { margin-left: 5px; padding: 7px; border: 1px solid #b9d2c6; border-radius: 8px; background: #fff; }
.direct-mineru-panel > div:first-child { min-width: 0; }
.direct-mineru-panel strong { display: block; font-size: 16px; }
.direct-mineru-panel small { display: block; max-width: 630px; margin-top: 8px; color: var(--muted); line-height: 1.55; }
.direct-mineru-actions { display: grid; gap: 8px; min-width: 235px; }
.direct-mineru-actions input { max-width: 270px; color: var(--muted); font-size: 12px; }
.direct-mineru-actions .primary-button { justify-content: center; }
.upload-file-list { display: grid; gap: 5px; max-height: 120px; overflow: auto; }
.upload-file-list:empty { display: none; }
.upload-file-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 7px; background: rgba(255, 255, 255, .75); font-size: 12px; }
.upload-file-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-remove { padding: 2px 5px; border: 0; background: transparent; color: var(--danger); cursor: pointer; font: inherit; }
.batch-label { margin: 0 0 5px; color: var(--green-dark); font-size: 12px; font-weight: 800; }
#split-form label > span, .api-form label > span, .ai-run-panel label > span { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 800; }
#split-form input, .api-form input, .ai-run-panel input, .filters input, .bank-filter-form input, .bank-filter-form select, .paper-builder input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fbfcfb; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
#split-form input, .api-form input, .ai-run-panel input, .bank-filter-form input, .bank-filter-form select, .paper-builder input { padding: 14px 15px; }
#split-form input:focus, .api-form input:focus, .ai-run-panel input:focus, .filters input:focus, .bank-filter-form input:focus, .bank-filter-form select:focus, .paper-builder input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 4px rgba(13,121,92,.1); }
#split-form small, .api-form small { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.primary-button, .secondary-button { min-height: 46px; padding: 0 20px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; text-decoration: none; cursor: pointer; }
.primary-button { min-width: 150px; border: 0; color: #fff; background: var(--green); box-shadow: 0 8px 18px rgba(13,121,92,.2); }
.primary-button:hover { background: var(--green-dark); }
.primary-button:disabled { cursor: wait; opacity: .76; }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.secondary-button:hover { border-color: #a9bbb4; }
.spinner { display: none; width: 17px; height: 17px; margin-left: 9px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.is-running .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-message { min-height: 20px; margin: 16px 0 -10px; color: var(--danger); font-size: 13px; }

.secret-input { position: relative; }
.secret-input input { padding-right: 64px; }
.secret-input .text-button { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.ai-run-panel { margin-top: 22px; padding-top: 22px; display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end; border-top: 1px solid var(--line); }
.compact-actions { grid-column: auto; margin: 0; }
.helper-message { grid-column: 1 / -1; min-height: 18px; margin: -4px 0 0; color: var(--muted); font-size: 12px; }
.helper-message.success-message { color: var(--green-dark); }
.helper-message.error-message { color: var(--danger); }
.bank-import-bar { margin: -6px 0 22px; padding: 12px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfb; font-size: 12px; }
.bank-import-bar label { display: flex; align-items: center; gap: 7px; }
.bank-import-bar input, .question-select { accent-color: var(--green); }
.bank-import-bar input[type="search"] { width: 180px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; outline: none; }
.bank-import-bar input[type="search"]:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(13,121,92,.1); }
.bank-import-bar .primary-button { min-height: 38px; margin-left: auto; }
.bank-import-bar .helper-message { grid-column: auto; margin: 0; }

.results { margin-top: 26px; box-shadow: none; }
.ai-summary { margin: -6px 0 22px; padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 9px 18px; align-items: center; border: 1px solid #badfce; border-radius: 13px; color: var(--green-dark); background: var(--green-soft); font-size: 12px; }
.explanation-panel { margin-top: 14px; padding: 12px 14px; border: 1px solid #bcd9eb; border-radius: 10px; background: #f5faff; }
.explanation-panel h4 { margin: 0 0 8px; color: #1f5f87; font-size: 13px; }
.explanation-text { margin: 0; white-space: pre-wrap; line-height: 1.7; color: #244357; }
.explanation-media { margin-top: 8px; }
.no-explanation-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.ai-summary strong { font-size: 14px; }
.results-heading { align-items: end; }
.output-location { max-width: 48%; color: var(--muted); font-size: 12px; word-break: break-all; }
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 26px; }
.metrics article { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfb; }
.metrics span { display: block; color: var(--muted); font-size: 12px; }
.metrics strong { display: block; margin-top: 6px; font-size: 28px; }
.metrics .review-metric { border-color: #f0d3ad; background: var(--amber-soft); }
.metrics .review-metric strong { color: var(--amber); }

.result-grid { display: block; }
.questions-panel { min-width: 0; border: 1px solid var(--line); border-radius: 17px; overflow: hidden; background: #fff; }
.panel-heading { min-height: 64px; padding: 14px 18px; display: flex; gap: 14px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: #fbfcfb; }
.panel-heading h3 { margin: 0; font-size: 15px; }
.filters { display: flex; gap: 10px; align-items: center; }
.filters input { width: 185px; padding: 9px 11px; font-size: 12px; }
.review-toggle { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.review-toggle input { accent-color: var(--green); }

.question-list { max-height: 820px; overflow: auto; padding: 12px; }
.question-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; }
.question-card + .question-card { margin-top: 10px; }
.question-card.review { border-color: #e8bf8e; background: #fffaf4; }
.question-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.question-select { width: 17px; height: 17px; margin: 0 2px 0 0; }
.question-number { min-width: 34px; height: 29px; padding: 0 9px; display: inline-grid; place-items: center; color: #fff; background: var(--green); border-radius: 9px; font-size: 13px; font-weight: 800; }
.edit-content-button { margin-left: auto; padding: 5px 9px; border: 1px solid #badfce; border-radius: 8px; color: var(--green-dark); background: var(--green-soft); font-size: 11px; font-weight: 800; cursor: pointer; }
.edit-content-button:hover { border-color: var(--green); background: #d9f1e7; }
.meta-chip { padding: 5px 8px; border-radius: 7px; color: var(--muted); background: #eef2f0; font-size: 11px; }
.review-chip { color: var(--amber); background: var(--amber-soft); font-weight: 800; }
.ai-chip { color: var(--green-dark); background: var(--green-soft); font-weight: 700; }
.warning-chip { color: var(--amber); background: var(--amber-soft); font-weight: 800; }
.error-chip { color: var(--danger); background: #fde8e8; font-weight: 800; }
.excluded-chip { color: #5d6670; background: #e8ebee; font-weight: 800; }
.question-text { margin: 0; font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.question-text .katex, .options .katex { font-size: 1.08em; }
.katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.options { margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; list-style: none; }
.options li { padding: 9px 11px; border-radius: 9px; background: var(--paper); font-size: 12px; line-height: 1.6; }
.options b { color: var(--green); margin-right: 6px; }
.media-strip { display: flex; gap: 8px; margin-top: 14px; overflow-x: auto; }
.question-table { width: max-content; max-width: 100%; margin: 13px auto 8px; overflow-x: auto; }
.question-table table { border-collapse: collapse; min-width: 190px; color: var(--ink); background: #fff; font-size: 13px; }
.question-table th, .question-table td { padding: 6px 11px; border: 1px solid #6d7d76; text-align: center; white-space: nowrap; }
.question-table th { background: #edf5f0; font-weight: 800; }
.question-table img { display: block; max-width: 100%; max-height: 260px; object-fit: contain; }
.question-table figcaption { margin-top: 4px; color: var(--muted); font-size: 11px; text-align: center; }
.option-images { display: flex; justify-content: center; margin-top: 8px; }
.option-images img { display: block; max-width: 100%; object-fit: contain; }
.media-item { position: relative; flex: 0 0 var(--media-width, 112px); width: var(--media-width, 112px); margin: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.media-item img { display: block; width: 100%; height: var(--media-height, 82px); object-fit: contain; }
.media-item figcaption { padding: 2px 4px 4px; color: var(--ink); background: #fff; font-size: 11px; line-height: 1.2; text-align: center; }
.media-item.suspect { border-color: var(--amber); }
.media-item.suspect::after { content: "疑似干扰图"; position: absolute; left: 4px; bottom: 4px; padding: 3px 5px; border-radius: 5px; color: #fff; background: rgba(179,94,19,.9); font-size: 9px; }
.source-screenshot-strip { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 14px; overflow: visible; }
.source-screenshot-item { width: 100%; max-width: 100%; margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: auto; background: #fff; }
.source-screenshot-item img { display: block; width: 100%; height: auto; max-height: none; object-fit: contain; }
.review-reason { margin: 12px 0 0; color: var(--amber); font-size: 11px; }
.normalized-note { margin: 7px 0 0; color: var(--green); font-size: 11px; }
.ocr-change-details { margin-top: 8px; padding: 8px 10px; border: 1px solid #c7e5d8; border-radius: 9px; color: #365249; background: #f6fcf8; font-size: 11px; line-height: 1.6; }
.ocr-change-details summary { color: var(--green-dark); font-weight: 800; cursor: pointer; }
.ocr-change-details p { margin: 5px 0 0; }
.knowledge-list { margin: 0 0 11px; display: flex; flex-wrap: wrap; gap: 6px; }
.knowledge-chip { padding: 5px 8px; border: 1px solid #c7e5d8; border-radius: 7px; color: var(--green-dark); background: #f1faf6; font-size: 10px; }

.text-button { border: 0; padding: 5px; color: var(--green); background: transparent; font-size: 12px; cursor: pointer; }
.empty-state { padding: 50px 20px; color: var(--muted); text-align: center; }
.hidden { display: none !important; }

.content-editor { width: min(820px, calc(100% - 30px)); max-height: calc(100vh - 30px); padding: 0; border: 0; border-radius: 22px; color: var(--ink); background: #fff; box-shadow: 0 28px 90px rgba(15, 42, 33, .28); }
.content-editor::backdrop { background: rgba(11, 29, 23, .58); backdrop-filter: blur(3px); }
.content-editor form { padding: 28px; }
.editor-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 22px; }
.editor-heading h2 { margin: 0; font-size: 23px; }
.dialog-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.editor-field { display: block; }
.editor-field > span, .option-editor legend { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 800; }
.editor-field input, .editor-field textarea, .option-row input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fbfcfb; outline: none; }
.editor-field textarea { resize: vertical; line-height: 1.65; }
.editor-field input:focus, .editor-field textarea:focus, .option-row input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(13,121,92,.1); }
.editor-wide { grid-column: 1 / -1; margin-bottom: 16px; }
.raw-text-preview { max-height: 150px; margin: 0; padding: 13px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; color: #394640; background: var(--paper); font: 12px/1.65 Consolas, "Microsoft YaHei UI", monospace; white-space: pre-wrap; }
.option-editor { margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 13px; }
.option-editor legend { padding: 0 6px; color: var(--ink); font-size: 12px; }
.option-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 8px; margin-bottom: 8px; }
.option-remove { width: 48px; border: 0; border-radius: 8px; color: var(--danger); background: #fde8e8; cursor: pointer; }
.option-editor small { margin-left: 10px; color: var(--muted); font-size: 10px; }
.image-size-list { display: grid; gap: 12px; }
.image-size-row { min-width: 0; display: grid; grid-template-columns: minmax(170px, 240px) minmax(0, 1fr); gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; }
.image-size-preview { min-height: 120px; max-height: 340px; padding: 8px; overflow: auto; display: flex; align-items: center; justify-content: center; border: 1px dashed #b7d3c7; border-radius: 9px; background: #fff; }
.image-size-preview img { display: block; max-width: none; height: auto; object-fit: contain; transition: width .15s ease; }
.image-size-row.crop-enabled { grid-template-columns: 1fr; }
.crop-stage { position: relative; display: inline-block; max-width: 100%; line-height: 0; touch-action: none; }
.crop-stage > img { width: auto; max-width: 100%; max-height: 440px; }
.crop-selection { position: absolute; border: 2px solid #0d795c; box-shadow: 0 0 0 9999px rgba(8, 32, 24, .42); }
.crop-handle { position: absolute; width: 16px; height: 16px; border: 2px solid #fff; border-radius: 50%; background: #0d795c; transform: translate(-50%, -50%); touch-action: none; }
.crop-handle-nw { left: 0; top: 0; cursor: nwse-resize; }
.crop-handle-n { left: 50%; top: 0; cursor: ns-resize; }
.crop-handle-ne { left: 100%; top: 0; cursor: nesw-resize; }
.crop-handle-e { left: 100%; top: 50%; cursor: ew-resize; }
.crop-handle-se { left: 100%; top: 100%; cursor: nwse-resize; }
.crop-handle-s { left: 50%; top: 100%; cursor: ns-resize; }
.crop-handle-sw { left: 0; top: 100%; cursor: nesw-resize; }
.crop-handle-w { left: 0; top: 50%; cursor: ew-resize; }
.crop-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--green-dark); font-size: 12px; font-weight: 800; }
.crop-enabled .image-size-controls small { margin-left: 0; }
.image-size-controls { min-width: 0; display: grid; align-content: center; gap: 10px; }
.image-size-controls strong { font-size: 12px; }
.image-size-toolbar { display: grid; grid-template-columns: 34px minmax(100px, 1fr) 34px 48px auto; align-items: center; gap: 8px; }
.image-size-toolbar input[type="range"] { width: 100%; accent-color: var(--green); }
.image-scale-button { width: 34px; height: 34px; border: 1px solid #b9d2c6; border-radius: 8px; color: var(--green-dark); background: #fff; font-size: 18px; font-weight: 800; cursor: pointer; }
.image-scale-button:hover { border-color: var(--green); background: var(--green-soft); }
.image-scale-value { color: var(--green-dark); font-size: 12px; font-weight: 800; text-align: center; }
.small-button { min-height: 34px; padding: 0 12px; font-size: 11px; }
.editor-save-note { margin: 0 0 10px; color: var(--green-dark); font-size: 11px; line-height: 1.6; }
.editor-actions { display: flex; justify-content: flex-end; gap: 10px; }
.editor-actions .text-button { margin-right: auto; }
.editor-actions .primary-button, .editor-actions .secondary-button { min-height: 42px; }

footer { width: min(1180px, calc(100% - 40px)); margin: 30px auto; color: var(--muted); font-size: 11px; text-align: center; }

.bank-card { margin-top: 26px; }
.bank-total { padding: 9px 13px; border-radius: 12px; color: var(--muted); background: var(--paper); font-size: 12px; }
.bank-total strong { color: var(--green); font-size: 20px; }
.bank-filter-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.bank-filter-form label > span, .paper-builder label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 800; }
.bank-filter-form .keyword-field { grid-column: span 2; }
.paper-builder { margin: 24px 0 16px; padding: 20px; display: grid; grid-template-columns: 1.35fr 1fr 120px 1fr auto auto; gap: 14px; align-items: end; border: 1px solid #badfce; border-radius: 16px; background: var(--green-soft); }
.paper-builder h3 { margin: 0 0 5px; font-size: 16px; }
.paper-builder small { color: var(--muted); }
.paper-builder .step-label { margin-bottom: 5px; }
#admin-bank-management, #store-management { min-width: 0; max-width: 100%; }
.bank-question-list { min-width: 0; max-width: 100%; margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.bank-question-card { min-width: 0; max-width: 100%; padding: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.bank-question-card > * { min-width: 0; max-width: 100%; }
.bank-question-header { min-width: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.bank-question-card .question-text,
.bank-question-card .options li { min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.bank-question-card .options { min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bank-question-card .media-strip { max-width: 100%; }
.bank-question-card .question-table { width: 100%; max-width: 100%; margin-right: 0; margin-left: 0; }
.bank-question-card .question-table table { width: max-content; max-width: none; }
.danger-text { color: var(--danger); }

.library-main { padding-bottom: 12px; }
.library-hero { padding: 62px 0 42px; }
.library-hero h1 { max-width: 660px; }
.library-hero > p:last-child { max-width: 620px; margin: 20px 0 0; color: var(--muted); line-height: 1.8; }
.library-layout { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 24px; align-items: start; }
.library-layout > * { min-width: 0; }
.library-filter-card, .library-results-panel { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); box-shadow: var(--shadow); }
.library-results-panel { overflow: hidden; }
.library-filter-card { position: sticky; top: 14px; }
.library-filter-card .section-heading { margin-bottom: 18px; }
.library-filter-card h2, .library-toolbar h2 { margin: 0; font-size: 21px; }
.library-filter-form { display: grid; gap: 14px; }
.library-filter-form label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 800; }
.library-filter-form input, .library-filter-form select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fbfcfb; outline: none; }
.library-filter-form input:focus, .library-filter-form select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(13,121,92,.1); }
.difficulty-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.library-filter-actions { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.library-filter-actions .primary-button { min-width: 0; flex: 1; min-height: 42px; }
.library-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.library-toolbar h2 span { color: var(--green); }
.paper-cart { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; color: var(--muted); font-size: 12px; white-space: normal; }
.paper-cart b { color: var(--green); font-size: 17px; }
.paper-cart .secondary-button { min-height: 40px; padding: 0 13px; font-size: 12px; }
.solution-export-toggle { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); cursor: pointer; }
.solution-export-toggle input { accent-color: var(--green); }
.library-results-panel > .helper-message { display: block; margin: 15px 0 0; }
.library-question-list { display: grid; gap: 12px; margin-top: 16px; }
.library-question-card { min-width: 0; max-width: 100%; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.library-question-card .question-text, .library-question-card .options li { min-width: 0; max-width: 100%; overflow-x: auto; overflow-wrap: anywhere; word-break: break-word; }
.library-question-card .options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.library-question-card .media-strip { max-width: 100%; }
.exam-paper-library { margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.compact-heading { margin-bottom: 8px; }
.compact-heading h2 { font-size: 18px; }
.exam-paper-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 10px; margin-top: 12px; }
.exam-paper-card { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; padding: 14px; border: 1px solid #c9ddd4; border-radius: 12px; background: #f7fcf9; }
.exam-paper-card h3 { margin: 0; font-size: 14px; line-height: 1.45; }
.exam-paper-card .secondary-button { min-height: 36px; padding: 0 12px; font-size: 12px; }
.exam-paper-count { margin: 0; color: var(--muted); font-size: 11px; }

.practice-main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 20px; }
.practice-hero { padding-left: 0; padding-right: 0; }
.practice-subnav { display: inline-flex; gap: 5px; margin: 0 0 18px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.75); }
.practice-subnav-button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 800; cursor: pointer; }
.practice-subnav-button:hover { color: var(--green-dark); background: var(--green-soft); }
.practice-subnav-button.active { color: #fff; background: var(--green); }
.practice-grid { display: block; }
.practice-upload-card, .practice-result { padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); box-shadow: var(--shadow); }
.practice-profile { margin: 24px 0; padding: 24px; border: 1px solid #badfce; border-radius: 20px; background: #fbfefc; box-shadow: var(--shadow); }
.practice-profile-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.compact-button { padding: 7px 10px; font-size: 12px; }
.practice-profile-list { display: grid; gap: 9px; }
.practice-smart-paper-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 12px; margin: 18px 0 12px; padding: 16px; border: 1px solid #c9ddd4; border-radius: 12px; background: #f7fcf9; }
#practice-smart-paper-scope { grid-column: 1 / -1; margin: 0; line-height: 1.7; }
.practice-smart-paper-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.practice-smart-paper-form input[type="text"], .practice-smart-paper-form select { width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font: inherit; }
.practice-smart-paper-form .solution-export-toggle { display: flex; min-height: 40px; align-items: center; font-weight: 600; }
.practice-smart-paper-form .primary-button { min-height: 40px; white-space: nowrap; }
.practice-smart-paper-result { margin-top: 14px; padding: 14px; border: 1px solid #badfce; border-radius: 12px; background: #fff; }
.practice-smart-paper-summary { margin: 0 0 10px; color: var(--green-dark); font-size: 13px; font-weight: 800; }
.practice-smart-paper-list { display: grid; gap: 8px; }
.practice-smart-paper-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 14px; padding: 10px 11px; border-radius: 8px; background: var(--green-soft); font-size: 12px; line-height: 1.55; }
.practice-smart-paper-row strong { color: var(--green-dark); }
.practice-smart-paper-row span { color: var(--muted); }
.practice-paper-filters { display: grid; grid-template-columns: 2fr repeat(3, minmax(120px, 1fr)); gap: 10px; margin: 16px 0 12px; }
.practice-paper-filters input, .practice-paper-filters select { min-height: 40px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font: inherit; }
.practice-subject-card { padding: 17px; border: 1px solid #b9dccc; border-radius: 13px; background: #fff; }
.practice-subject-heading, .practice-module-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.practice-subject-heading h3 { margin: 0; color: var(--green-dark); font-size: 17px; }
.practice-learning-module { margin-top: 11px; padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 10px; background: var(--green-soft); }
.practice-module-heading strong { color: var(--ink); font-size: 14px; }
.practice-mastery { flex: 0 0 auto; padding: 4px 7px; border-radius: 7px; color: var(--green-dark); background: #d9f0e5; font-size: 12px; font-weight: 800; }
.practice-stat-line { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.practice-topic-block { margin-top: 10px; padding: 10px 11px; border-radius: 8px; background: #fff; }
.practice-topic-title { margin: 0; color: var(--ink); font-size: 13px; font-weight: 800; }
.practice-point-row { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.practice-file-picker { display: grid; gap: 7px; padding: 26px; border: 2px dashed #b8d7c9; border-radius: 15px; color: var(--green-dark); background: var(--green-soft); cursor: pointer; }
.practice-file-picker strong { font-size: 16px; }
.practice-file-picker span { color: var(--muted); font-size: 12px; line-height: 1.65; }
#practice-files { width: 100%; margin-top: 12px; color: var(--muted); }
#practice-submit { margin-top: 16px; }
.compact-empty { padding: 26px 12px; }
.practice-result { margin-top: 24px; }
.practice-stage { margin: -8px 0 14px; color: var(--muted); font-size: 13px; }
.practice-summary { margin: 12px 0 16px; padding: 12px 14px; border: 1px solid #badfce; border-radius: 12px; color: var(--green-dark); background: var(--green-soft); font-size: 13px; }
.practice-question-list { display: grid; gap: 12px; }
.practice-question-card { position: relative; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.practice-question-header { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 11px; }
.practice-marker-status { padding: 5px 8px; border-radius: 7px; color: var(--muted); background: #eef2f0; font-size: 11px; font-weight: 800; }
.practice-marker-status.wrong { color: #a13a32; background: #fde8e8; }
.practice-marker-status.correct { color: var(--green-dark); background: var(--green-soft); }
.practice-marker-error { margin: 10px 150px 0 0; color: #a13a32; font-size: 12px; line-height: 1.5; }
.practice-marker-status.uncertain { color: var(--amber); background: var(--amber-soft); }
.practice-analysis-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 10px; }
.practice-mark-controls { display: flex; gap: 6px; margin-left: auto; }
.mark-button { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #fff; font-size: 11px; font-weight: 800; cursor: pointer; }
.mark-button:hover, .mark-button.selected { border-color: var(--green); color: var(--green-dark); background: var(--green-soft); }
.practice-question-text { margin-right: 150px; white-space: pre-wrap; font-size: 14px; line-height: 1.8; }
.practice-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 10px; margin: 12px 150px 0 0; }
.practice-option { min-width: 0; padding: 8px 10px; border-radius: 8px; background: #f4f8f6; font-size: 13px; line-height: 1.55; }
.practice-option-label { display: inline-block; min-width: 23px; color: var(--green-dark); }
.marker-crop { position: absolute; top: 58px; right: 16px; display: block; width: 165px; max-height: 118px; border: 1px solid var(--line); border-radius: 8px; object-fit: contain; background: #fff; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 30px; padding-top: 35px; }
  .hero-card { display: none; }
  #split-form, .api-form, .ai-run-panel, .result-grid { grid-template-columns: 1fr; }
  .direct-mineru-panel { align-items: flex-start; flex-direction: column; }
  .source-screenshot-panel { align-items: flex-start; flex-direction: column; }
  .bulk-queue-panel { align-items: flex-start; flex-direction: column; }
  .compact-actions { grid-column: 1 / -1; }
  .bank-filter-form { grid-template-columns: 1fr 1fr; }
  .paper-builder { grid-template-columns: 1fr 1fr; }
  .option-row { grid-template-columns: 64px 1fr auto; }
  .image-size-row { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .question-list { max-height: 560px; }
  .library-layout { grid-template-columns: 1fr; }
  .library-filter-card { position: static; }
}

@media (max-width: 1100px) {
  .library-layout { grid-template-columns: 1fr; }
  .library-filter-card { position: static; }
  .library-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-filter-actions { align-self: end; }
}

@media (max-width: 620px) {
  .topbar, main, footer { width: min(100% - 24px, 1180px); }
  .local-badge { display: none; }
  .app-nav { margin-right: 0; }
  .hero { min-height: 330px; }
  h1 { font-size: 38px; }
  .workspace-card, .results { padding: 20px; border-radius: 18px; }
  .section-heading, .results-heading { display: block; }
  .status-pill { display: inline-block; margin-top: 14px; }
  .output-location { display: block; max-width: none; margin-top: 10px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .filters { width: 100%; }
  .filters input { flex: 1; width: auto; }
  .options { grid-template-columns: 1fr; }
  .bank-filter-form, .paper-builder { grid-template-columns: 1fr; }
  .bank-filter-form .keyword-field { grid-column: auto; }
  .library-hero { padding: 40px 0 28px; }
  .library-toolbar { align-items: flex-start; flex-direction: column; }
  .paper-cart { width: 100%; justify-content: space-between; white-space: normal; }
  .library-filter-form { grid-template-columns: 1fr; }
  .library-question-card .options { grid-template-columns: 1fr; }
  .bank-question-card .options { grid-template-columns: 1fr; }
  .image-size-toolbar { grid-template-columns: 34px minmax(80px, 1fr) 34px 45px; }
  .image-size-toolbar .text-button { grid-column: 1 / -1; justify-self: start; }
  .practice-main { width: min(100% - 24px, 1180px); }
  .practice-upload-card, .practice-result, .practice-profile { padding: 18px; border-radius: 16px; }
  .practice-profile-actions { align-items: flex-end; flex-direction: column; }
  .practice-smart-paper-form { grid-template-columns: 1fr; }
  .practice-paper-filters { grid-template-columns: 1fr; }
  .practice-question-text { margin-right: 0; }
  .practice-marker-error { margin-right: 0; }
  .practice-options { grid-template-columns: 1fr; margin-right: 0; }
  .marker-crop { position: static; width: 185px; max-height: 135px; margin-top: 12px; }
  .practice-mark-controls { width: 100%; margin-left: 0; }
}
/* Account access */
.auth-page { min-height: 100vh; display: grid; place-items: center; background: #f3f8f5; }
.auth-shell { width: min(900px, calc(100% - 32px)); display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; }
.auth-intro h1 { font-size: clamp(40px, 7vw, 72px); margin: 8px 0; }
.auth-card { background: #fff; border: 1px solid #cde1d5; border-radius: 22px; padding: 28px; box-shadow: 0 18px 50px rgba(24, 78, 57, .10); }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 22px; }
.auth-tabs button { flex: 1; border: 0; border-radius: 10px; padding: 10px; background: #edf4f0; cursor: pointer; }
.auth-tabs button.active { color: #fff; background: #087c5b; }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; font-weight: 700; }
.auth-form input { border: 1px solid #c8d9d0; border-radius: 10px; padding: 12px; font: inherit; }
.auth-codes pre { padding: 14px; border-radius: 12px; background: #f2f7f4; font-size: 16px; line-height: 1.7; }
.account-menu { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 13px; }
.account-menu button, .admin-user-row button { border: 1px solid #b7d2c4; border-radius: 8px; background: #fff; padding: 7px 10px; cursor: pointer; }
.account-admin-card summary { cursor: pointer; display: flex; justify-content: space-between; gap: 14px; }
.account-admin-card summary span { color: #698077; font-size: 13px; }
.admin-user-list { display: grid; gap: 8px; margin-top: 18px; }
.admin-user-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid #e2ece7; }
.admin-user-row span { display: flex; gap: 8px; align-items: center; }
.admin-user-row small { color: #698077; }
.password-dialog { border: 0; border-radius: 18px; padding: 24px; width: min(420px, calc(100% - 32px)); }
.password-dialog::backdrop { background: rgba(10, 30, 22, .35); }
.password-dialog form > div { display: flex; justify-content: flex-end; gap: 10px; }
@media (max-width: 720px) { .auth-shell { grid-template-columns: 1fr; } .auth-intro { display: none; } .account-menu span { display: none; } }
