/* The reader keeps the photograph and the answer sheet in two independent panes. */
#task-view {
  --reader-blue: #095789;
  --reader-edge: #d6e1e8;
  --entry-inset: clamp(16px, 1.6vw, 28px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(360px, 42%, 770px);
  min-height: 0;
  overflow: hidden;
}
#viewer-pane { background: #111; min-height: 0; }
#viewer-toolbar {
  background: #20262c; border-bottom: 1px solid #42484d;
  color: #e6e9ec; gap: 8px 15px; padding: 7px clamp(10px, 1.5vw, 24px);
  min-width: 0; flex: none;
}
#viewer-toolbar .zoom-tools { display: inline-flex; background: #30373d; border: 1px solid #50585f; border-radius: 5px; }
#viewer-toolbar button {
  min-height: 29px; background: transparent; color: #fff; border: 1px solid #50585f; border-radius: 5px;
  font-size: 13px; font-weight: 550; padding: 3px 10px;
}
#viewer-toolbar button:hover { background: #3d464e; }
#viewer-toolbar .zoom-tools button { border: none; border-radius: 4px; padding: 0; width: 33px; font: 21px/1 system-ui, sans-serif; }
#viewer-toolbar .zoom-tools button + button { border-left: 1px solid #50585f; border-radius: 0 4px 4px 0; }
#viewer-toolbar .reset-image { margin-left: -9px; }
#viewer-toolbar .image-slider { gap: 7px; white-space: nowrap; }
#viewer-toolbar input[type=range] { width: clamp(46px, 5vw, 94px); height: 18px; margin: 0; accent-color: #bfd8e8; }
#viewer-toolbar .toggle { gap: 7px; white-space: nowrap; cursor: pointer; }
#viewer-toolbar .toggle input {
  appearance: none; position: relative; width: 28px; height: 16px; margin: 0;
  border: 1px solid #929da4; border-radius: 12px; background: #333b41; cursor: pointer;
}
#viewer-toolbar .toggle input::before {
  content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%; top: 2px; left: 2px; background: #d9e0e4;
}
#viewer-toolbar .toggle input:checked { background: #1d644d; border-color: #96cead; }
#viewer-toolbar .toggle input:checked::before { left: 14px; background: #fff; }
#viewer-toolbar :focus-visible { outline: 2px solid #c4e5fb; outline-offset: 3px; }
#image-meta { background: #20262c; border-top: 1px solid #393f44; min-height: 32px; padding: 6px clamp(12px, 1.5vw, 24px); gap: 12px; align-items: center; font-size: 12px; }
#image-meta > span + span { border-left: 1px solid #586168; padding-left: 12px; }
#point-hint { width: max-content; max-width: 94%; border-radius: 4px; padding: 6px 12px; background: #165b80; pointer-events: none; }

#form-pane {
  min-width: 0; max-width: none; min-height: 0;
  border-left: 1px solid #c2cfd8; background: #fff; color: #182c39;
}
.reading-context { flex: 0 1 auto; max-height: 35%; overflow-y: auto; overscroll-behavior: contain; }
#step-banner, #ai-panel, #review-panel, #review-change-key {
  margin: 9px var(--entry-inset) 0; border-radius: 5px; padding: 7px 11px;
  font-size: 13px; line-height: 1.55;
}
#step-banner { border: 1px solid #eedcb0; border-left: 3px solid #bc8b2b; background: #fff8e8; color: #604715; }
#ai-panel { border: 1px solid #c9deeb; border-left: 3px solid #4383ac; background: #eff7fc; }
#review-panel { max-height: none; overflow: visible; border-color: #e3cfa6; }
#review-change-key { border-left: 3px solid #b42318; background: #fff5f2; }
#review-change-key .review-change-list { margin-bottom: 0; }
#form {
  min-height: 0; padding: 0 var(--entry-inset) 22px; scrollbar-gutter: stable;
  scrollbar-color: #b9c7d0 #fff; overscroll-behavior: contain;
}
#form fieldset.section {
  margin: 18px 0 0; padding: 0; min-inline-size: 0; border-top: 0;
}
#form fieldset.section > legend {
  float: left; width: 100%; padding: 0 0 7px; margin-bottom: 6px;
  border-bottom: 1px solid #d1dde5; color: #123d59;
  font-size: 17px; font-weight: 700; line-height: 1.4;
}
#form fieldset.section > legend + * { clear: both; }
#form fieldset.suspect { border-left: 0; }
#form .q { margin: 6px 0; padding: 4px 0; }
#form .q > .qlabel, #form .rname { font-size: 14px; font-weight: 650; color: #263a48; }
#form .q > .qlabel { margin-bottom: 5px; }
#form .help { color: #586973; font-size: 12.5px; line-height: 1.55; margin: 2px 0 7px; }
#form .chips { gap: 5px 6px; }
.chip:where(:not(.card-opt)) > span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 29px; padding: 3px 9px;
  font-size: 13.5px; line-height: 1.45; border-radius: 5px;
}
.chip:where(:not(.card-opt):not(.review-added):not(.review-removed)) > span { border-color: #cedbe3; color: #304553; }
.chip:where(:not(.card-opt):not(.review-added):not(.review-removed)):hover > span { border-color: #88aabf; background: #f4f8fb; }
.chip:where(:not(.card-opt):not(.review-added):not(.review-removed)) > input:checked + span {
  background: var(--reader-blue); border-color: var(--reader-blue); color: #fff;
}
.chip:where(:not(.card-opt)) > input + span::before {
  content: ""; flex: 0 0 auto; width: 11px; height: 11px; box-sizing: border-box;
  border: 1px solid currentColor; color: #788b98; border-radius: 2px;
}
.chip:where(:not(.card-opt)) > input[type=radio] + span::before { border-radius: 50%; }
.chip:where(:not(.card-opt)) > input:checked + span::before { color: #fff; }
.chip:where(:not(.card-opt)) > input[type=radio]:checked + span::before { border: 3px solid #fff; }
.chip:where(:not(.card-opt)) > input[type=checkbox]:checked + span::before {
  content: "✓"; width: 11px; height: auto; border: 0; font: bold 13px/1 system-ui, sans-serif;
}
.chip:where(.review-removed:not(.card-opt)) > input + span::before { color: #a5463f; }
#form .q.sub { margin-left: 0; padding: 8px 10px; }
#form .q.region { border-color: #dbe4ea; padding: 7px 9px; }
#form .region .rhead { gap: 5px 8px; }
#form .region .rname { min-width: 0; margin-right: auto; }
#form .eye-tag { display: inline-block; margin-left: 6px; background: #edf3f7; color: #3e5e70; font-size: 12px; }
#form .outline-ctrl, #form .point-ctrl, #form .outline-pick-row { flex-wrap: wrap; }
#form .outline-label, #form .suspect-note, #form .suspect-row select { min-width: 0; max-width: 100%; }
#form :where(textarea, input[type=text], input[type=search]) { border-color: #c6d5de; }
#form :where(textarea, input[type=text], input[type=search], select):focus-visible { outline: 2px solid var(--reader-blue); outline-offset: 2px; }
#form-pane .actions {
  flex: none; gap: 12px; min-height: 55px; align-items: center; padding: 8px var(--entry-inset);
  background: #fbfcfd; border-top: 1px solid #d4dfe6;
}
#form-errors { padding: 0; margin-right: auto; font-size: 13px; }
#submit-btn {
  min-height: 35px; padding: 6px 19px; border-radius: 5px; flex-shrink: 0;
  background: var(--reader-blue); border-color: var(--reader-blue); font-weight: 650;
}
#submit-btn:hover { background: #074675; }
#submit-btn:disabled { opacity: .65; }

@media (max-width: 1030px) {
  #viewer-toolbar { gap: 5px 9px; padding: 6px 9px; }
  #viewer-toolbar .reset-image { margin-left: -4px; }
  #viewer-toolbar input[type=range] { width: 46px; }
}
@media (max-width: 720px) and (orientation: portrait), (max-width: 580px) {
  #task-view { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(145px, 36%) minmax(0, 1fr); --entry-inset: 12px; }
  #form-pane { border-left: 0; }
  #viewer-toolbar { padding: 4px 8px; gap: 4px 8px; }
  #viewer-toolbar .zoom-tools button { width: 24px; }
  #viewer-toolbar button { min-height: 24px; padding: 2px 6px; }
  #viewer-toolbar label { font-size: 12px; gap: 4px; }
  #viewer-toolbar input[type=range] { width: clamp(28px, 8vw, 50px); }
  #image-meta { min-height: 23px; padding: 2px 9px; }
  #form fieldset.section { margin-top: 12px; }
  #form-pane .actions { min-height: 45px; padding-block: 5px; }
}
@media (max-height: 550px) and (min-width: 581px) and (orientation: landscape) {
  #task-view { grid-template-columns: minmax(0, 1fr) minmax(300px, 44%); --entry-inset: 11px; }
  #viewer-toolbar { padding: 3px 6px; gap: 3px 6px; }
  #viewer-toolbar button { min-height: 23px; }
  #image-meta { min-height: 22px; padding: 2px 8px; }
  #form-pane .actions { min-height: 40px; padding-block: 3px; }
  .reading-context { max-height: 26%; }
  #form fieldset.section { margin-top: 10px; }
}
