@font-face { font-family: ExamMyeongjo; src: url('/exam-fonts/myeongjo.ttf') format('truetype'); font-weight: 400; font-display: block; }
@font-face { font-family: ExamMyeongjo; src: url('/exam-fonts/myeongjo-bold.ttf') format('truetype'); font-weight: 700; font-display: block; }
* { box-sizing: border-box; }
body { margin: 0; background: #f4f3ef; color: #252823; font-family: Arial, 'Malgun Gothic', sans-serif; }
.toolbar { display: flex; justify-content: space-between; padding: 18px 26px; background: white; border-bottom: 1px solid #ddd; }
.toolbar a { color: #343b31; text-decoration: none; }
.toolbar span { font-weight: 800; letter-spacing: 2px; color: #d36024; }
.workspace { display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.controls { background: #fff; padding: 26px; border-right: 1px solid #ddd; }
h1 { margin: 0 0 12px; font-size: 24px; letter-spacing: -1px; }
h2 { font-size: 15px; margin: 0 0 14px; }
.intro, .hint { font-size: 12px; line-height: 1.65; color: #62675e; }
.intro { font-size: 13px; }
.controls section { padding: 22px 0; border-bottom: 1px solid #e4e5df; }
button, input, select, textarea { font: inherit; }
button, .upload { cursor: pointer; border: 1px solid #cccfc6; border-radius: 6px; padding: 10px 12px; background: #fff; color: #252823; font-size: 13px; }
button:hover, .upload:hover { background: #f4f3ef; }
button:disabled { opacity: .45; cursor: default; }
.upload { display: block; text-align: center; border: 1px dashed #c1794d; background: #fff8f2; }
#json-files { display: block; width: 100%; margin-top: 12px; font-size: 12px; }
#file-list { padding-left: 18px; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.backup-section { margin-top: 18px; font-size: 13px; }
.backup-section summary { cursor: pointer; margin-bottom: 14px; }
#saved-jobs { max-height: 260px; overflow-y: auto; margin-bottom: 12px; }
.saved-job { display: flex; align-items: start; gap: 8px; margin: 12px 0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.saved-job small { display: block; color: #777; }
.saved-job .saved-counts { color: #34492f; font-weight: 700; margin-top: 4px; }
#selected-jobs-count { line-height: 1.8; font-weight: 700; white-space: pre-line; }
.library-count-note { font-size: 11px; }
#selection-count.error, #selected-jobs-count.error { color: #b32520; }
#loaded-summary:empty { display: none; }
#load-jobs { margin-top: 10px; width: 100%; }
.load-feedback { display: flex; align-items: flex-start; gap: 9px; margin: 12px 0; padding: 12px; border: 1px solid #d9dcd3; border-radius: 6px; background: #f5f6f2; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.load-feedback[hidden], .load-feedback:not(.loading) .loading-spinner { display: none; }
.load-feedback strong { font-weight: 600; }
.load-feedback .hint { display: block; margin-top: 4px; }
.load-feedback.error { border-color: #e4b6b2; background: #fff3f1; color: #a32b24; }
.load-feedback.success { border-color: #bbcfb8; background: #f0f7ed; color: #345e2c; }
.load-feedback.warning { border-color: #e3cb98; background: #fff9ec; color: #805b18; }
.loading-spinner { width: 16px; height: 16px; margin-top: 3px; flex: 0 0 auto; border: 2px solid #dbded4; border-top-color: #c75924; border-radius: 50%; animation: exam-spin .8s linear infinite; }
@keyframes exam-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading-spinner { animation: none; } }
#type-feedback { padding: 9px 11px; border-left: 3px solid #c75924; background: #fff8f2; }
#selection-count { font-weight: 700; color: #343b31; }
.text-button { border: 0; padding-left: 0; color: #ad481b; }
.selection-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.selection-actions button { font-size: 12px; padding: 6px 10px; }
.type-option, .check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 10px 0; }
.type-row { display: grid; grid-template-columns: minmax(0, 1fr) 62px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid #efeee9; }
.type-row .type-option { margin: 0; align-items: start; line-height: 1.5; overflow-wrap: anywhere; }
.type-row small { display: block; font-size: 11px; font-weight: normal; color: #62675e; }
.type-row input[type=number] { width: 62px; min-width: 0; padding: 8px 5px; border: 1px solid #cccfc6; border-radius: 5px; }
.type-row input:disabled { background: #f4f3ef; }
#source-scope summary { font-size: 13px; cursor: pointer; }
#source-categories { max-height: 260px; overflow-y: auto; }
.source-category-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; align-items: center; gap: 8px; margin: 10px 0; font-size: 12px; }
.source-category-row span { overflow-wrap: anywhere; }
.source-category-row select { padding: 8px 4px; }
.ratio-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ratio-inputs label, .fixed-count { font-size: 12px; line-height: 1.7; }
.ratio-inputs input, .fixed-count input { width: 100%; padding: 8px; border: 1px solid #cccfc6; border-radius: 5px; }
.fixed-count { display: grid; grid-template-columns: minmax(0, 1fr) 62px; gap: 8px; align-items: center; }
#source-scope .check-row { margin-top: 20px; }
.hint.error { color: #b32520; }
#composition-summary:empty { display: none; }
dialog { width: min(500px, calc(100vw - 32px)); padding: 24px; border: 1px solid #d8d7d0; border-radius: 12px; line-height: 1.7; color: #252823; }
dialog::backdrop { background: #18201570; }
dialog h2 { font-size: 20px; }
#reuse-details { padding-left: 20px; font-size: 14px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 22px; }
input[type=checkbox] { accent-color: #c75924; width: 16px; height: 16px; flex: 0 0 auto; }
.settings > label:not(.check-row) { display: block; font-size: 12px; margin: 14px 0 7px; color: #62675e; }
.settings > input, select, textarea { width: 100%; padding: 10px; border: 1px solid #d3d6ce; border-radius: 5px; background: #fff; }
textarea { min-height: 130px; resize: vertical; font-size: 12px; }
#missing-passages label { display: block; font-size: 12px; margin: 16px 0 8px; overflow-wrap: anywhere; }
.actions { display: grid; gap: 10px; padding-top: 22px; }
.primary { background: #c85b25; border-color: #c85b25; color: #fff; }
.primary:hover { background: #aa4818; }
#status { font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
#status.error { color: #b32520; }
.preview-panel { min-width: 0; padding: 30px; }
#empty-preview { padding: 70px 20px; color: #777e70; text-align: center; font-size: 14px; }
.page-frame { margin: 0 auto 26px; overflow: hidden; }
.paper { width: 257mm; height: 364mm; padding: 12mm 13mm 9mm; background: #fff; color: #111; display: flex; flex-direction: column; transform-origin: top left; box-shadow: 0 5px 24px #00000012; font: var(--exam-font-size, 10.5pt)/1.55 ExamMyeongjo, 'Malgun Gothic', serif; }
.paper-header { flex: 0 0 auto; margin-bottom: 7mm; padding-bottom: 4mm; border-bottom: 1.5px solid #111; }
.paper-kicker { font-size: 9pt; display: flex; justify-content: space-between; min-height: 14px; }
.paper-title { text-align: center; font-size: 21pt; line-height: 1.4; margin: 3mm 0; overflow-wrap: anywhere; }
.student-info { display: flex; justify-content: space-between; font-size: 9pt; padding-top: 2mm; }
.paper-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12mm; flex: 1; min-height: 0; position: relative; }
.paper-columns::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; border-left: .5px solid #888; }
.paper-column { min-height: 0; min-width: 0; }
.paper-footer { flex: 0 0 8mm; padding-top: 3mm; text-align: center; font-size: 9pt; }
.question-block { margin: 0; padding-bottom: 7mm; overflow-wrap: anywhere; }
.question-header { display: flex; gap: 6px; margin-bottom: 2mm; font-weight: 700; }
.question-number { white-space: nowrap; }
.source-tag { font-size: 8pt; text-align: right; color: #555; margin-bottom: 2mm; }
.hide-source .source-tag { display: none; }
.passage-box, .passage-nobox { margin: 2mm 0 3mm; text-align: justify; line-height: 1.6; font-family: Arial, ExamMyeongjo, serif; white-space: normal; }
.given-sentence-box, .summary-box, .subjective-box { border: .8px solid #555; padding: 3mm; margin: 3mm 0; }
.order-paragraph { display: flex; gap: 6px; margin: 3mm 0; font-family: Arial, ExamMyeongjo, serif; }
.paragraph-label { flex: 0 0 auto; }
.choices-grid { display: grid; gap: 1mm; margin-top: 2mm; font-family: Arial, ExamMyeongjo, serif; }
.choices-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.underline-text, u { text-decoration: underline; text-underline-offset: 3px; }
.insert-marker { font-family: ExamMyeongjo, serif; font-weight: 700; white-space: nowrap; }
.blank { display: inline-block; min-width: 28mm; border-bottom: .8px solid #111; }
.summary-arrow { text-align: center; }
.summary-choices-table { border-collapse: collapse; width: 100%; font-family: Arial, ExamMyeongjo, serif; }
.summary-choices-table td, .summary-choices-table th { padding: 1mm; text-align: left; }
.answer-line { height: 9mm; border-bottom: .6px solid #444; }
.labelled-answer { display: flex; align-items: end; gap: 2mm; }
.labelled-answer .answer-line { flex: 1; }
.correction-line { display: flex; gap: 3mm; align-items: end; margin-top: 8mm; }
.correction-line span { flex: 1; border-bottom: 1px solid #444; }
.answer-value { font-weight: 700; margin: 2mm 0; }
.explanation { margin-top: 2mm; }
.paper p { margin: 2mm 0; }
@media (max-width: 760px) { .workspace { grid-template-columns: 1fr; } .controls { padding: 22px; border-right: 0; } .preview-panel { padding: 12px; } .toolbar { padding: 16px; font-size: 13px; } }
@page { size: 257mm 364mm; margin: 0; }
@media print {
  body { background: #fff; }
  .toolbar, .controls, #empty-preview { display: none !important; }
  .workspace, .preview-panel, #pages { display: block; margin: 0; padding: 0; }
  .page-frame { width: 257mm !important; height: 364mm !important; margin: 0; break-after: page; overflow: visible; }
  .page-frame:last-child { break-after: auto; }
  .paper { transform: none !important; box-shadow: none; }
  body:not(.print-ready) .preview-panel { display: none; }
}
