:root {
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  color: #20372e;
  background: #f6f6ef;
  font-synthesis: none;
  line-height: 1.65;
  --paper: #fffefa;
  --ink: #20372e;
  --muted: #4e6156;
  --forest: #22533f;
  --deep: #164030;
  --line: #d9dfd4;
  --tint: #eaf1e8;
  --focus: #166e53;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, select, textarea, input { font: inherit; }
button, select, summary, input[type="checkbox"], input[type="radio"] { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: default; }
button:disabled { opacity: .58; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
h2, h3, h4 { line-height: 1.5; }

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

.skip-link {
  position: absolute;
  top: .6rem;
  left: .6rem;
  z-index: 2;
  transform: translateY(-180%);
  padding: .4rem .8rem;
  color: var(--forest);
  background: white;
}

.skip-link:focus { transform: none; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner, .shell { width: min(calc(100% - 64px), 1160px); margin-inline: auto; }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; font-size: .875rem; letter-spacing: .035em; }

.brand-icon {
  position: relative;
  flex: 0 0 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--deep);
}

.brand-icon i {
  width: 13px;
  height: 16px;
  border: 1.4px solid #eff3df;
  border-radius: 2px;
}

.brand-icon i::before, .brand-icon i::after {
  position: absolute;
  left: 13px;
  content: "";
  width: 8px;
  height: 1px;
  background: #eff3df;
}

.brand-icon i::before { top: 14px; }
.brand-icon i::after { top: 19px; }
.mode-label { border: 1px solid #c4d2c7; background: var(--tint); border-radius: 999px; padding: .15rem .7rem; font-size: .75rem; font-weight: 700; }

.intro { padding-block: clamp(2.4rem, 7vw, 5rem) clamp(1.7rem, 4vw, 2.7rem); }
.intro h1 { font-size: clamp(2.5rem, 7vw, 5.3rem); font-weight: 760; line-height: 1.16; letter-spacing: -.075em; }
.intro h1 span { display: inline-block; color: #387b5a; letter-spacing: -.10em; margin-left: .18em; }
.intro p { margin-top: .8rem; color: var(--muted); }
.workspace { display: grid; grid-template-columns: minmax(230px, 310px) minmax(0, 1fr); align-items: start; gap: 20px; }
.card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 36px -30px #3e5146aa; }
.assignment, .editor, .results { padding: clamp(1.1rem, 3vw, 2rem); }
.assignment { position: sticky; top: 20px; }
.section-heading { display: flex; gap: .7rem; align-items: center; margin-bottom: 1.35rem; }
.section-heading h2 { font-size: clamp(1.15rem, 3vw, 1.35rem); letter-spacing: -.02em; }
.step { display: grid; place-items: center; min-width: 29px; height: 29px; border-radius: 50%; background: var(--tint); color: var(--forest); font-size: .85rem; font-weight: 760; line-height: 1; }

.select-fields { display: grid; gap: .35rem; }
.select-fields label, .field-label { font-size: .875rem; font-weight: 700; }
.select-fields label:not(:first-child) { margin-top: .7rem; }
select, textarea, .upload-actions input { color: var(--ink); border: 1px solid #bfcbbf; background: var(--paper); border-radius: 8px; }
select { width: 100%; min-height: 46px; padding: .5rem .75rem; font-size: .875rem; }
.case-details { border-top: 1px solid var(--line); margin-top: 1.3rem; padding-top: 1rem; }
.case-details summary { color: var(--forest); font-size: .875rem; font-weight: 750; }
.case-details p { margin-top: .65rem; color: var(--muted); font-size: .875rem; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.select-fields + .hint { margin-top: .7rem; }
.assignment-source { margin-top: .9rem; font-size: .875rem; }
a { color: var(--forest); text-underline-offset: .2em; }

.editor-fields, .method-toggle { min-width: 0; border: 0; margin: 0; padding: 0; }
.method-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; border: 1px solid var(--line); border-radius: 10px; background: #f0f2eb; padding: .25rem; width: max-content; max-width: 100%; }
.method { position: relative; display: block; cursor: pointer; }
.method input { position: absolute; opacity: 0; margin: 0; width: 100%; height: 100%; }
.method span { display: grid; height: 100%; min-height: 40px; place-items: center; padding: .35rem .95rem; color: var(--muted); border: 1px solid transparent; border-radius: 7px; text-align: center; font-weight: 750; font-size: .85rem; }
.method input:checked + span { border-color: var(--line); background: var(--paper); color: var(--forest); box-shadow: 0 1px 2px #3e51461f; }
.method input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.method input:disabled + span { opacity: .65; }
.upload-panel { margin-top: 1rem; padding: .9rem; border: 1px dashed #a8b7a9; border-radius: 10px; background: #fafbf7; }
.upload-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .55rem; }
.upload-actions input { flex: 1 1 210px; width: 100%; min-width: 0; padding: .38rem; font-size: .875rem; }
input::file-selector-button { cursor: pointer; padding: .38rem .55rem; margin-right: .5rem; border: 0; border-radius: 5px; color: var(--deep); background: var(--tint); font: inherit; }
.answer-tools { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-top: 1.15rem; }
.hint { color: var(--muted); font-size: .8125rem; }
.questions { margin-top: .75rem; }
.question + .question { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.question-heading { display: block; margin-bottom: .3rem; font-size: .95rem; font-weight: 750; }
.question-prompt { margin-bottom: .6rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.answer-constraints { margin: -.2rem 0 .65rem; padding-inline-start: 1.25rem; }
.text-input { display: block; width: 100%; min-height: 135px; padding: .75rem .85rem; resize: vertical; line-height: 1.85; font-size: .9375rem; }
.text-input::placeholder { color: #617268; opacity: 1; }
.question-options { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: .3rem 1rem; margin-top: .4rem; }
.question-options details { flex: 1 1 12rem; min-width: 0; }
.char-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.char-count.over-limit { color: #842e20; font-weight: 700; }
.annotation summary { color: var(--forest); font-size: .8125rem; font-weight: 700; }
.annotation .hint { margin: .35rem 0 .3rem; }
.annotation .text-input { min-height: 65px; }
.check { display: flex; width: fit-content; gap: .5rem; align-items: start; font-size: .875rem; }
.check input { flex: 0 0 auto; width: 17px; height: 17px; margin: .2rem 0 0; accent-color: var(--forest); }
.annotation .check { margin-top: .65rem; }
.ocr-confirm { margin-top: 1.1rem; padding: .7rem .85rem; border-radius: 8px; background: var(--tint); font-weight: 650; }
.ocr-replace { margin-top: .45rem; }
.data-terms { margin-top: 1rem; }
.data-terms .check { margin-top: .5rem; }
.underlines { margin: .15rem 0 .4rem; padding: 0; list-style: none; }
.underlines li { display: flex; gap: .4rem; align-items: center; border-top: 1px solid var(--line); font-size: .875rem; }
.underlines u { white-space: pre-wrap; overflow-wrap: anywhere; }
.read-review { margin-block: 1rem; }
.read-review h3 { font-size: 1rem; }
.read-review > .hint { margin-top: .15rem; }
.import-pages { display: grid; gap: .7rem; margin-top: .65rem; }
.import-page { padding: .75rem; border: 1px solid var(--line); background: #fafbf7; border-radius: 8px; }
.page-controls { display: flex; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.page-controls h4 { flex: 1; font-size: .875rem; overflow-wrap: anywhere; min-width: 0; }
.page-controls button { padding-inline: .45rem; }
.page-ocr { margin-bottom: .5rem; }
.read-comparison { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: .55rem; align-items: start; }
.file-preview { display: block; max-width: 100%; max-height: 28rem; border: 1px solid var(--line); border-radius: 6px; margin-inline: auto; }
.page-text textarea { margin-top: .25rem; }
.page-map, .assign-actions, .candidate-notes { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-top: .55rem; }
.page-map select { flex: 1 1 8rem; width: auto; min-height: 40px; }
.mapped-text { list-style: none; margin: .45rem 0 0; padding: 0; }
.mapped-text li { display: flex; gap: .45rem; align-items: center; padding-block: .3rem; border-top: 1px solid var(--line); font-size: .8125rem; }
.mapped-text li strong { flex-shrink: 0; }
.mapped-text li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapped-text button { padding-inline: .45rem; }

.primary, .secondary, .subtle { min-height: 40px; border-radius: 8px; padding: .44rem .82rem; font-size: .875rem; color: var(--forest); font-weight: 750; white-space: nowrap; }
.primary { display: inline-flex; gap: 1rem; align-items: center; justify-content: center; min-height: 47px; padding-inline: 1.05rem; border: 1px solid var(--forest); background: var(--forest); color: white; }
.primary:hover:not(:disabled) { background: var(--deep); }
.primary span { font-size: 1.1rem; line-height: 1; }
.secondary { border: 1px solid #b4c2b6; background: var(--paper); }
.subtle { border: 1px solid transparent; background: transparent; }
.secondary:hover:not(:disabled), .subtle:hover:not(:disabled) { background: var(--tint); }
.operation { display: flex; justify-content: space-between; gap: .6rem; align-items: center; margin-top: 1rem; }
.activity { color: var(--forest); font-weight: 650; font-size: .875rem; }
.verify { margin-top: 1rem; }
.notice { padding: .67rem .85rem; border: 1px solid #d1decf; border-radius: 9px; background: var(--tint); color: #294c3c; overflow-wrap: anywhere; font-size: .875rem; }
.notice-error { border-color: #e4c6bd; color: #842e20; background: #fdf2ee; }
#startup-status, #demo-notice { margin-bottom: 1rem; }
#form-error { margin-top: 1rem; }
#refresh-assignments { margin-top: .5rem; }
.submit-row { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1.3rem; }

.results { margin-top: 1.4rem; overflow-wrap: anywhere; }
.results-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem 1rem; margin-bottom: 1.2rem; }
.results-header .section-heading { margin-bottom: 0; }
.results-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.results-status { margin-bottom: .6rem; }
.result-assignment { color: var(--muted); margin-bottom: .7rem; font-size: .875rem; }
.summary-panels { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1.3rem; }
.summary-panels.summary-single { grid-template-columns: 1fr; }
.summary-panel { min-width: 0; border: 1px solid #d1decf; border-radius: 10px; background: #f0f5ed; padding: 1rem; }
.summary-panel h3, .rubric-card h3, .sources h3 { font-size: 1rem; }
.summary-panel p, .summary-panel ol { margin-top: .4rem; }
.summary-panel ol, .summary-panel ul, .rubric-card ul, .sources ul { margin-bottom: 0; padding-inline-start: 1.35rem; }
.summary-panel ul { margin-top: .35rem; }
.summary-panel li + li, .rubric-card li + li { margin-top: .25rem; }
.rubric-card { padding: 1.05rem 0; border-top: 1px solid var(--line); }
.rubric-heading { font-weight: 750; }
.rubric-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, .85fr) minmax(0, 1fr); margin-top: .55rem; }
.original-answer { align-self: start; border: 1px solid var(--line); border-radius: 8px; padding: .75rem .9rem; background: #fafbf7; }
.original-answer h4 { margin-top: 0 !important; }
.original-text { margin-top: .35rem; white-space: pre-wrap; }
.original-text mark { background: #f3e5bb; color: inherit; }
.rubric-feedback ul.criteria { padding-inline-start: 0; list-style: none; }
.criteria li + li, .missing li + li { margin-top: .55rem; }
.criteria li > p { margin-top: .15rem; }
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 999px; background: #f1e9d7; color: #594724; font-size: .75rem; font-weight: 700; }
.badge[data-status="満たしている"] { background: var(--tint); color: var(--forest); }
.badge[data-status="改善が必要"] { background: #fae9e2; color: #8a3429; }
.badge[data-status="判断材料が不足"] { background: #edf0f1; color: #414d55; }
.rubric-card h4 { margin-top: .9rem; font-size: .9rem; }
.rubric-card ul { margin-top: .3rem; }
.findings { display: grid; gap: .55rem; margin-top: .35rem; }
.finding { padding: .7rem .9rem; background: #f7f8f3; border-left: 3px solid #779886; border-radius: 0 8px 8px 0; }
.finding blockquote { margin: 0 0 .4rem; font-weight: 650; white-space: pre-wrap; }
.finding p + p { margin-top: .35rem; }
.finding .hint { margin-top: .4rem; }
.result-note { margin: .5rem 0 .85rem; }
.report > h3 { margin: .35rem 0; font-size: 1rem; }
.sources { border-top: 1px solid var(--line); padding-top: 1rem; }
.sources ul { margin-top: .3rem; }
.site-footer { padding: 1.25rem 0 2.5rem; color: var(--muted); font-size: .8125rem; }

@media (max-width: 720px) {
  .header-inner, .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 62px; }
  .workspace, .summary-panels, .read-comparison, .rubric-layout { grid-template-columns: 1fr; }
  .workspace { gap: .85rem; }
  .assignment { position: static; }
}

@media (max-width: 395px) {
  .header-inner, .shell { width: calc(100% - 24px); }
  .method-toggle { width: 100%; }
  .method span { padding-inline: .35rem; }
  .submit-row .primary { width: 100%; }
}

@media print {
  :root { color: #141414; background: white; font-size: 10pt; }
  .shell { width: 100%; }
  .site-header, .intro, #startup-status, #demo-notice, .workspace, .site-footer, .results-actions, .results-status, .skip-link { display: none !important; }
  .results { margin: 0; border: 0; border-radius: 0; box-shadow: none; background: white; padding: 0; }
  .summary-panel, .finding { break-inside: avoid; }
  .rubric-heading, h4 { break-after: avoid; }
}
