:root {
  color-scheme: light;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: #1c1c1e;
  background: #f2f2f7;
  --surface: #fff;
  --group: #f7f7fa;
  --control: #e8e8ee;
  --line: #e5e5eb;
  --muted: #606068;
  --accent: #0066cc;
  --accent-strong: #0059b3;
  --tint: #eaf3ff;
  --gutter: clamp(12px, 2vw, 34px);
  --workspace-width: 1920px;
  --stepper-width: 124px;
  --control-height: 38px;
  --work-radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; accent-color: var(--accent); }
header, main { width: 100%; max-width: var(--workspace-width); margin: auto; padding-inline: var(--gutter); }
header { padding-top: clamp(18px, 3vh, 32px); padding-bottom: 14px; }
.app-name { color: var(--accent-strong); font-size: 13px; font-weight: 650; }
.app-name span { color: var(--muted); font-weight: 500; }
h1 { font-size: clamp(27px, 3.2vw, 38px); margin: 4px 0 0; letter-spacing: -.04em; line-height: 1.1; }
h2 { font-size: 21px; margin: 0 0 16px; letter-spacing: -.02em; }
main { padding-bottom: 32px; }
section { background: var(--surface); border-radius: 18px; border: 1px solid var(--line); padding: clamp(14px, 2.5vw, 22px); min-width: 0; margin-bottom: 14px; }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 4px; gap: 3px; background: var(--control); border-radius: 12px; margin-bottom: 16px; }
.segmented button { padding-inline: 3px; background: transparent; color: var(--muted); white-space: nowrap; }
.segmented button[aria-current="true"] { background: var(--surface); color: var(--accent-strong); box-shadow: 0 1px 4px #1c1c1e1a; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 12px; margin-bottom: 12px; }
label { min-width: 0; display: grid; align-content: start; gap: 5px; font-size: 13px; font-weight: 600; color: #424249; }
input, select, button { font: inherit; color: inherit; }
input, select { width: 100%; padding: 7px 9px; height: var(--control-height); border: 1px solid transparent; border-radius: 9px; background: var(--group); font-weight: 400; }
select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 51%), linear-gradient(135deg, var(--muted) 50%, transparent 51%);
  background-position: calc(100% - 14px) center, calc(100% - 9px) center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
}
select:disabled { color: var(--muted); opacity: .68; }
input[type="file"] { padding: 4px; font-size: 12px; }
input::file-selector-button { border: 0; border-radius: 6px; background: var(--tint); color: var(--accent-strong); padding: 4px 6px; font: inherit; cursor: pointer; }
button { height: var(--control-height); background: var(--tint); border: 0; color: var(--accent-strong); border-radius: 9px; padding: 7px 12px; cursor: pointer; font-size: 14px; font-weight: 650; -webkit-appearance: none; appearance: none; }
button:hover { background: #d8eaff; }
button:disabled { opacity: .48; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-strong); }
.hint, [role="status"] { color: var(--muted); font-size: 13px; margin: 10px 0; }
[role="status"]:empty { display: none; }
.work-surface { min-width: 0; border: 1px solid var(--line); border-radius: var(--work-radius); background: var(--group); }
.image-viewport { position: relative; min-width: 0; padding: clamp(12px, 2vw, 24px); max-height: 620px; max-height: clamp(240px, 66dvh, 940px); overflow: auto; overscroll-behavior: contain; }
.image-viewport:has(#empty:not([hidden])) { display: grid; place-items: center; min-height: clamp(150px, 24vh, 260px); }
#empty { color: var(--muted); margin: 0; text-align: center; }
#sourceCanvas { display: block; margin: auto; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.section-head, .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head { justify-content: space-between; }
.section-head h2 { margin: 0; }
.scroll { overflow: auto; }
table { width: 100%; background: var(--surface); border-collapse: collapse; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--group); color: #424249; }
.scroll tbody:last-child tr:last-child > * { border-bottom: 0; }
td input { width: 100px; }
td input[type="number"] { width: 68px; }
td select { max-width: 230px; }
td button + button { margin-left: 4px; }
.destructive { color: #ad2533; background: #fff1f1; }
.destructive:hover { background: #ffe0e2; }
.roi { display: flex; gap: 4px; }
.export-status { padding-inline: 8px; }
dialog { border: 0; border-radius: 22px; padding: 18px; width: min(92vw, 420px); color: inherit; background: #f2f2f7; }
dialog::backdrop { background: rgb(28 28 30 / .35); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; }
.export-dimensions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.export-dimensions input { background: var(--surface); border-color: var(--line); }
.format-list { background: var(--surface); border-radius: 12px; overflow: hidden; }
.format-list button { display: block; width: 100%; border-radius: 0; background: var(--surface); text-align: left; padding-inline: 16px; }
.format-list button:hover { background: var(--tint); }
.format-list button + button { border-top: 1px solid var(--line); }
@media (max-width: 680px) {
  .segmented button { font-size: 13px; }
  dialog { margin: auto auto 0; width: min(100%, 520px); border-radius: 22px 22px 0 0; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
}

output { display: flex; align-items: center; height: var(--control-height); padding: 7px 9px; border-radius: 9px; background: var(--group); color: var(--accent-strong); }
.recognition { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
#bandTable { position: relative; max-height: clamp(250px, 55dvh, 740px); }
.measure-table td:last-child { max-width: 24ch; overflow-wrap: anywhere; white-space: normal; }
.measure-table td:nth-child(4), .measure-table td:nth-child(8),
.measurement-columns th:nth-child(4), .measurement-columns th:nth-child(8),
.measurement-group th + th { border-left: 1px solid var(--line); }
.measurement-group th { background: var(--tint); color: var(--accent-strong); font-weight: 700; text-align: center; }
.measurement-group:not(:first-child) th { border-top: 4px solid var(--surface); }
.measure-table tbody tr[data-target] { cursor: pointer; background: var(--surface); }
.measure-table tbody tr[data-target]:hover { background: #f0f7ff; }
.measure-table tbody tr[data-target].selected { background: #dceaff; }
.measure-table tbody tr[data-target]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#canvasFrame { position: relative; width: 100%; margin-inline: auto; }
.image-tools { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface); border-radius: calc(var(--work-radius) - 1px) calc(var(--work-radius) - 1px) 0 0; color: var(--muted); font-size: 13px; }
.image-adjustments { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-inline-end: auto; }
.image-adjustments .number-field { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.image-adjustments label { white-space: nowrap; }
.image-adjustments .number-stepper { width: 102px; }
#layoutImage .rolling-radius { display: none; }
.invert-icon { width: 15px; height: 15px; border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
#invertImage[aria-pressed="true"] { background: var(--accent); color: white; }
@media (max-width: 640px) {
  .image-adjustments { flex-basis: 100%; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
}
.zoom-tools { display: flex; align-items: center; gap: 3px; border-radius: 11px; padding: 2px; background: var(--group); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: var(--control-height); padding: 0; vertical-align: middle; }
.icon-button > span { flex: none; }
.segmented > .icon-button { width: 100%; min-width: 0; }
.segmented .icon-button > :first-child { width: 15px; height: 15px; }
.segmented .nav-measure-icon, .segmented .nav-layout-icon { width: 17px; }
.nav-measure-icon { display: grid; justify-items: center; align-content: center; gap: 2px; border: 1.5px dashed currentColor; border-radius: 3px; }
.nav-measure-icon i { width: 9px; height: 2px; border-radius: 1px; background: currentColor; }
.nav-measure-icon i:last-child { width: 6px; opacity: .5; }
.nav-layout-icon { display: grid; align-content: center; gap: 3px; }
.nav-layout-icon i { height: 6px; border: 1px solid currentColor; border-radius: 1.5px; }
.nav-layout-icon i::after { content: ""; display: block; margin: 1px auto 0; width: 3px; height: 2px; background: currentColor; box-shadow: -4px 0 currentColor, 4px 0 currentColor; }
.action-glyph { font-size: 19px; line-height: 1; }
.band-delete {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #d13b42;
  border-radius: 50%;
  background: var(--surface);
  color: #a72b34;
  font: 600 17px/1 system-ui;
  box-shadow: 0 1px 3px #18213120;
}
.band-delete:hover { background: #fcebed; }
#sourceCanvas { border-radius: 4px; box-shadow: 0 1px 4px #18213126; }
.image-tools .zoom-tools button { background: transparent; }
.image-tools .zoom-tools button:hover { background: var(--tint); }
#recognitionSection {
  --recognition-gap: 12px;
  --recognition-form-width: 700px;
}
.recognition-header {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
}
.recognition-header h2 { margin: 0; line-height: var(--control-height); }
.recognition-fields {
  width: min(100%, var(--recognition-form-width));
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) max-content max-content;
  gap: var(--recognition-gap);
  align-items: end;
  margin: 0 auto;
}
.recognition-fields > label { min-width: 0; }
.recognition-fields output { font-weight: 500; color: #424249; }
.recognition-fields select { min-width: 0; }
.detection-toggle { justify-self: start; white-space: nowrap; }
.detection-toggle[aria-expanded="false"] { background: var(--group); }
.detection-toggle[aria-expanded="false"]:hover { background: var(--tint); }
.settings-sliders {
  position: relative;
  width: 15px;
  height: 14px;
  background: linear-gradient(currentColor, currentColor) 0 3px / 100% 1.5px no-repeat,
              linear-gradient(currentColor, currentColor) 0 10px / 100% 1.5px no-repeat;
}
.settings-sliders::before, .settings-sliders::after {
  content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}
.settings-sliders::before { top: 1.25px; left: 3px; }
.settings-sliders::after { top: 8.25px; right: 2px; }
.recognition-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--recognition-gap); align-items: start; }
.recognition, #measureImage, #imageWorkspace { min-width: 0; }
.detection-settings {
  min-width: 0;
  width: min(100%, var(--recognition-form-width));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--group);
  padding: 13px;
  container-type: inline-size;
}
.detection-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; margin: 0; }
.detection-fields label { gap: 5px; }
.detection-fields select { width: var(--stepper-width); max-width: 100%; min-width: 0; background-color: var(--surface); border-color: var(--line); }
.sensitivity-row { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.sensitivity-field { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 10px; height: var(--control-height); }
.sensitivity-field output { display: inline-block; height: auto; min-width: 2ch; margin-left: 2px; padding: 0; color: var(--accent-strong); background: none; font-variant-numeric: tabular-nums; }
.sensitivity-field input {
  appearance: none;
  --sensitivity-fill: 54.55%;
  width: 75%;
  min-width: 0;
  height: var(--control-height);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--accent) var(--sensitivity-fill), var(--control) var(--sensitivity-fill)) center / 100% 4px no-repeat;
  cursor: pointer;
}
.sensitivity-field input::-webkit-slider-thumb { appearance: none; width: 15px; height: 15px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px #1c1c1e24; }
.sensitivity-field input::-moz-range-thumb { width: 15px; height: 15px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px #1c1c1e24; }
#resetDetection { padding-inline: 9px; white-space: nowrap; }
#recognitionSection:has(#empty:not([hidden])) .recognition-workspace { align-items: stretch; }
#recognitionSection:has(#empty:not([hidden])) #measureImage, #recognitionSection:has(#empty:not([hidden])) #imageWorkspace, #recognitionSection:has(#empty:not([hidden])) #imageArea { display: grid; }
@container (min-width: 530px) {
  .detection-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .recognition-fields { grid-template-columns: minmax(0, 1fr) max-content; }
  .recognition-fields > label { grid-column: 1 / -1; }
  .detection-settings { padding: 10px; }
  .sensitivity-field { gap: 6px; }
}

.image-library > .hint, #importStatus { text-align: center; }
.image-library > .hint { margin: 0; padding: 15px 12px 10px; }
.image-library .scroll { border-radius: calc(var(--work-radius) - 1px) calc(var(--work-radius) - 1px) 0 0; }
#imageRows input { width: 100%; min-width: 12ch; }
#imageRows td:first-child { width: 33%; }
#imageRows td:nth-child(3) { width: 22%; }
#imageRows tr.selected { background: #eaf3ff; }
#recognitionImage { overflow-wrap: anywhere; }
#recognitionSection { scroll-margin-top: 60px; }

#imageRows tr { cursor: pointer; }
#imageRows tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.image-library-footer { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 10px; border-top: 1px solid var(--line); }
.add-images { width: var(--control-height); border-radius: 50%; background: var(--surface); color: var(--accent); }
.add-images:hover { background: var(--tint); }


/* Shapes from the mini program's bench, shared controls and qPCR plate. */
.bench-plus { position: relative; display: block; width: 17px; height: 17px; }
.bench-plus::before, .bench-plus::after { content: ""; position: absolute; top: 50%; left: 50%; width: 17px; height: 2px; border-radius: 1px; background: currentColor; transform: translate(-50%, -50%); }
.bench-plus::after { transform: translate(-50%, -50%) rotate(90deg); }
.report-save-icon { position: relative; display: block; width: 16px; height: 17px; border: 1.5px solid currentColor; border-radius: 2.5px 4px 2.5px 2.5px; }
.report-save-icon::before { content: ""; position: absolute; top: 0; left: 2.5px; right: 2.5px; height: 4px; border-bottom: 1px solid currentColor; border-right: 1px solid currentColor; }
.report-save-icon::after { content: ""; position: absolute; left: 2px; right: 2px; bottom: 0; height: 4.5px; border: 1px solid currentColor; border-bottom: 0; border-radius: 1.5px 1.5px 0 0; }
.swipe-trash { position: relative; display: block; width: 21px; height: 21px; }
.swipe-trash-lid { position: absolute; top: 5.5px; left: 1px; width: 19px; height: 1.5px; border-radius: 1.5px; background: currentColor; }
.swipe-trash-lid::before { content: ""; position: absolute; top: -3.5px; left: 6px; width: 7px; height: 4px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 2.5px 2.5px 0 0; }
.swipe-trash-bin { position: absolute; top: 8px; left: 3.5px; width: 14px; height: 11.5px; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; }
.swipe-trash-bin::after { content: ""; position: absolute; top: 1.5px; left: 3px; width: 1.5px; height: 4.5px; border-radius: 1px; background: currentColor; box-shadow: 3.5px 0 currentColor; }
.ocr-scan-icon { position: relative; display: block; width: 16px; height: 16px; border: 1px solid currentColor; border-radius: 3px; }
.ocr-scan-icon::after { content: ""; position: absolute; left: -2.5px; right: -2.5px; top: calc(50% - .5px); height: 1px; background: currentColor; }
.ruler-icon { position: relative; display: block; width: 21px; height: 9px; border: 1.5px solid currentColor; border-radius: 2px; transform: rotate(-25deg); }
.ruler-icon::after { content: ""; position: absolute; inset: 0 2px auto; height: 3px; background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 4px); }
.minus-icon::after { display: none; }
.fit-icon { position: relative; display: block; width: 16px; height: 16px; }
.fit-icon i { position: absolute; width: 6px; height: 6px; border: 1.5px solid currentColor; }
.fit-icon i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 2px; }
.fit-icon i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 2px; }
.fit-icon i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 2px; }
.fit-icon i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 2px; }
.qpcr-direction-arrow { position: relative; display: block; width: 1.5px; height: 13.5px; border-radius: 1px; background: currentColor; }
.qpcr-direction-arrow::before { content: ""; position: absolute; left: 0; width: 1.5px; height: 6px; border-radius: 1px; background: currentColor; transform: rotate(45deg); }
.qpcr-direction-up::before { top: 0; transform-origin: top center; }
.qpcr-direction-down::before { bottom: 0; transform-origin: bottom center; }

.lane-count, .number-field { display: grid; align-content: start; justify-items: start; gap: 5px; }
.number-stepper { display: grid; grid-template-columns: 30px minmax(0, 1fr) 30px; width: var(--stepper-width); height: var(--control-height); max-width: 100%; border: 1px solid #d1d1da; border-radius: 9px; overflow: hidden; background: var(--surface); }
.number-stepper input, .number-stepper button { height: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; }
.number-stepper input { appearance: textfield; text-align: center; background: var(--surface); border-inline: 1px solid #d7e5f6; }
.number-stepper input::-webkit-inner-spin-button, .number-stepper input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.number-stepper button { display: grid; place-items: center; }
.number-stepper :focus-visible { outline-offset: -2px; }

.image-navigation {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.image-navigation:has(.level-controls:not([hidden])) { flex: 1 1 430px; }
.image-navigation > #levelImage, .image-navigation > .zoom-tools { flex: none; }
.level-controls {
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 1fr);
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  column-gap: 8px;
}
.level-controls > button, .level-slider-label { white-space: nowrap; }
.level-controls input[type="range"] { width: 100%; min-width: 0; max-width: 250px; margin: 0; padding-inline: 3px; }
.level-controls #levelNotice { grid-column: 1 / -1; margin: 0; }
#levelImage[aria-expanded="true"] { background: var(--accent); color: var(--surface); }
@media (max-width: 680px) {
  .image-navigation, .level-controls { column-gap: 4px; }
  .level-controls > button { padding-inline: 7px; }
  .image-navigation:has(.level-controls:not([hidden])) > #levelImage,
  .image-navigation:has(.level-controls:not([hidden])) .zoom-tools button { width: 30px; flex: none; }
  .image-tools .image-navigation:has(.level-controls:not([hidden])) .zoom-tools { gap: 1px; }
}

.quantification-card h2 { font-size: 19px; }
.quantification-card .section-head { min-height: 32px; }
.quantification-card .section-head > .icon-button { background: var(--tint); }
.quantification-card .section-head > .icon-button:hover { background: #d8eaff; }
@media (min-width: 900px) {
  .segmented { position: sticky; top: 8px; z-index: 5; }
}
@media (max-width: 400px) {
  .image-tools { padding-inline: 8px; gap: 4px; }
}

/* 窄屏（手机/平板竖屏/被压缩的窗口）只留图标；1024px 以上才补文字。 */
.wide-action-label { display: none; }
@media (min-width: 1024px) {
  .icon-button:has(> .wide-action-label) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    padding-inline: 10px;
    border-radius: 9px;
    white-space: nowrap;
  }
  .icon-button > .wide-action-label { display: inline; }
  .segmented > .icon-button { width: 100%; }
  .group-note-form .icon-button:has(> .wide-action-label) { width: auto; padding-inline: 7px; }
}

.plot-palette-row, .plot-option-row { align-items: end; }
.switch-field { display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; cursor: pointer; }
.switch-field input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: #d5d7da; transition: background .15s ease; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #0002; transition: transform .15s ease; }
.switch-field input:checked + .switch-track { background: var(--accent); }
.switch-field input:checked + .switch-track::after { transform: translateX(14px); }
.switch-field input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.table-tools { display: flex; flex: 1 1 280px; justify-content: space-between; gap: 10px; min-width: 0; }
.table-tools button { flex: none; white-space: nowrap; }
.table-tools select {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-width: 420px;
  border-color: #c7daf0;
  background-color: var(--tint);
  color: var(--accent-strong);
  font-weight: 600;
}
.plot-fields { align-items: end; }
.palette-swatches { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; height: var(--control-height); }
.palette-swatch { width: 18px; height: 18px; min-height: 0; padding: 0; border: 1px solid #1c1c1e33; border-radius: 50%; flex: none; cursor: grab; }
.palette-swatch.dragging { opacity: .55; cursor: grabbing; }
.swatch-editor { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.swatch-editor input { width: 92px; height: auto; padding: 5px 7px; }
.group-note-form {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  width: 206px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 2px 8px #1821312b;
  transform: translateX(-50%);
}
.group-note-form input { min-width: 0; flex: 1; height: 28px; padding: 3px 6px; text-align: center; font-size: 13px; }
.group-note-form button { width: 28px; height: 28px; padding: 0; }
.plot-result { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.chart-surface { max-width: 1120px; margin-inline: auto; background: var(--surface); }
.plot-editor-frame { position: relative; width: fit-content; max-width: min(100%, 1080px); margin-inline: auto; scroll-margin-top: 62px; }
#plotImage { display: block; width: auto; max-width: 100%; height: auto; margin-inline: auto; }
.chart-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px clamp(8px, 1.5vw, 16px); border-bottom: 1px solid var(--line); border-radius: var(--work-radius) var(--work-radius) 0 0; background: var(--group); }
.chart-toolbar button { flex: none; white-space: nowrap; }
.chart-toolbar button:last-child { margin-inline-start: auto; }
.chart-stage { min-width: 0; display: grid; justify-items: center; padding: clamp(8px, 1.6vw, 18px); }
#plotImage { cursor: crosshair; border-radius: calc(var(--work-radius) - 1px); }
.plot-text-editor { position: absolute; z-index: 5; padding: 0 3px; border: 1px solid var(--accent); border-radius: 4px; background: #fff; color: #151515; text-align: center; box-shadow: 0 0 0 2px #0066cc22; font-family: Arial, "Songti SC", SimSun, Symbol, serif; }
.plot-text-delete { position: absolute; z-index: 6; height: 28px; font-size: 12px; background: #fff; border: 1px solid var(--line); color: #b3261e; }

.plot-hotspots { position: absolute; inset: 0; pointer-events: none; }
.plot-hotspot { position: absolute; pointer-events: auto; min-height: 0; padding: 0; border: 1px solid transparent; border-radius: 3px; background: transparent; }
.plot-hotspot:hover, .plot-hotspot:focus-visible, .plot-hotspot.active-plot-group { background: #0066cc12; border-color: #0066cc58; }
.plot-hotspot.empty-plot-title { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.plot-hotspot.empty-plot-title::after { content: attr(data-placeholder); opacity: 0; transition: opacity .12s ease; }
.plot-hotspot.empty-plot-title:hover::after, .plot-hotspot.empty-plot-title:focus-visible::after { opacity: 1; }
.plot-hotspot.selected-annotation { background: #0066cc24; border-color: #0066cc; }
.plot-title-handle { z-index: 3; cursor: move; }
.plot-title-handle:hover, .plot-title-handle:focus-visible { background: #0066cc10; border-color: #0066cc66; }
.plot-title-handle.dragging { background: #0066cc1f; border-color: #0066cc; cursor: grabbing; }
/* 图例：整体拖动，四角拖动缩放 */
.plot-legend-handle { z-index: 2; cursor: move; outline: none; }
.plot-legend-grip {
  position: absolute; z-index: 2; width: 11px; height: 11px; border-radius: 3px;
  border: 1.5px solid var(--accent); background: #fff; opacity: 0; pointer-events: none;
  touch-action: none; transition: opacity .12s ease;
}
/* 拉动框只在鼠标移到图例上（或键盘选中/正在缩放）时出现 */
.plot-legend-handle:hover .plot-legend-grip,
.plot-legend-handle:focus-visible .plot-legend-grip,
.plot-legend-handle.resizing .plot-legend-grip { opacity: 1; pointer-events: auto; }
@media (hover: none) {
  .plot-legend-grip { opacity: .9; pointer-events: auto; }
}
.plot-legend-grip.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.plot-legend-grip.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.plot-legend-grip.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.plot-legend-grip.se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.plot-legend-handle.resizing { background: #0066cc1f; border-color: var(--accent); }
.plot-legend-handle:hover, .plot-legend-handle:focus-visible { background: #0066cc12; border-color: #0066cc80; }
.plot-legend-handle.dragging { background: #0066cc1f; border-color: #0066cc; cursor: grabbing; }


.plot-legend-handle { touch-action: none; }
#addSignificance[aria-pressed="true"], #addAxisLine[aria-pressed="true"] { background: var(--accent); color: white; }

.plot-settings {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: var(--group);
}
.plot-settings .fields { margin: 0; }
.plot-settings .fields + .fields { border-top: 1px solid var(--line); padding-top: 12px; }
.plot-option-row, .plot-switch-row { grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); }
.plot-option-row select, .plot-angle-field input { background: var(--surface); }
.plot-switch-row .switch-field { min-height: var(--control-height); justify-content: space-between; padding: 5px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.plot-angle-field input { padding: 0 7px; margin: 0; }
.plot-angle-field output { display: inline; height: auto; padding: 0; margin-inline-start: 4px; background: none; color: var(--accent-strong); font-variant-numeric: tabular-nums; }

.plot-test-results {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.plot-test-results > summary { padding: 12px 14px; cursor: pointer; font-weight: 600; }


.test-group { padding: 10px 12px; border-top: 1px solid var(--line); }
.test-group h3 { margin: 0 0 8px; font-size: 14px; }

.plot-mode-row { grid-template-columns: minmax(0, 1fr); }
.plot-mode-row:has(#normalizationField:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(0, 40%); }
.plot-mode-row #normalizationGroup { min-width: 0; }
.plot-mode-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
.plot-mode-picker legend { padding: 0 0 5px; color: #424249; font-size: 13px; font-weight: 600; }
.plot-mode-options { display: flex; min-height: var(--control-height); padding: 3px; gap: 3px; border-radius: 10px; background: var(--control); }
.plot-mode-options label { flex: 1; position: relative; cursor: pointer; }
.plot-mode-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.plot-mode-options span { display: grid; place-items: center; padding: 4px 7px; border-radius: 7px; text-align: center; }
.plot-mode-options input:checked + span { background: var(--surface); color: var(--accent-strong); }
.plot-mode-options input:focus-visible + span { outline: 2px solid var(--accent); }

.plot-parameters { border-top: 1px solid var(--line); padding-top: 10px; }
.plot-parameters summary, .plot-methods summary { display: flex; align-items: center; gap: 8px; color: var(--accent-strong); cursor: pointer; font-weight: 650; }
.plot-parameters summary::-webkit-details-marker, .plot-methods summary::-webkit-details-marker { display: none; }
.plot-parameters summary::after, .plot-methods summary::after { content: ""; margin-inline-start: auto; width: 7px; height: 7px; border-inline-end: 2px solid; border-block-end: 2px solid; transform: rotate(45deg); }
.plot-parameters[open] summary::after, .plot-methods[open] summary::after { transform: rotate(225deg); }
.plot-parameter-fields { display: grid; gap: 12px; padding-top: 12px; }
.plot-parameter-fields input:not([type="checkbox"]), .plot-parameter-fields select { background-color: var(--surface); }
.plot-option-row .switch-field { min-height: var(--control-height); }
.significance-icon, .group-line-icon { display: inline-block; width: 15px; height: 14px; text-align: center; border-bottom: 1.5px solid currentColor; line-height: 10px; }
.significance-icon { border-inline: 1.5px solid currentColor; border-bottom: 0; border-top: 1.5px solid currentColor; line-height: 17px; }
.group-line-icon::before { content: "Aa"; font: 650 9px/10px Arial, sans-serif; }
.plot-hotspot[data-kind="group"], .plot-hotspot[data-kind="treatment"] { touch-action: none; }

.strip-source-fields { max-width: 1120px; }
.plot-hotspot.strip-label-selected { background: #0066cc30; border-color: #0066cc; box-shadow: inset 0 0 0 1px #0066cc; }

.strip-note-form { position: absolute; z-index: 9; width: min(240px, calc(100% - 8px)); transform: none; padding: 6px; margin: 0; border: 1px solid var(--line); box-shadow: 0 8px 24px #0000001f; }
.strip-note-form[hidden] { display: none; }
.strip-note-form input { height: 28px; padding: 3px 6px; }
.strip-note-form button { width: 28px; min-height: 0; height: 28px; padding: 0; }
.strip-label-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.strip-label-head strong { font-size: 13px; }
.strip-label-tabs { display: inline-flex; gap: 4px; }
.strip-label-tabs button { height: 28px; padding: 3px 9px; font-size: 12px; }
.strip-label-tabs button[aria-selected="true"] { background: var(--accent); color: #fff; }
.strip-parameters { margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--group); padding: 10px 12px; }
.strip-parameters summary { display: flex; align-items: center; gap: 8px; color: var(--accent-strong); cursor: pointer; font-weight: 650; }
.strip-parameters .plot-fields { margin-top: 10px; }
#stripCanvas { display: block; max-width: 100%; height: auto; }
#stripEmpty { text-align: center; color: var(--muted); margin: 12px; }
.strip-cell:empty::after { content: attr(data-placeholder); opacity: 0; font-size: 12px; color: var(--muted); }
.strip-cell:empty:hover::after, .strip-cell:empty:focus-visible::after { opacity: 1; }
.strip-row-delete { font-size: 13px; line-height: 1; color: #a72b34; }

#stripList { margin-bottom: 12px; }

#layoutImage #sourceCanvas { cursor: default; }

.mass-marker-area { cursor: crosshair; }
.mass-marker { z-index: 2; cursor: ns-resize; touch-action: none; }
.mass-marker.dragging { background: var(--surface); border-color: var(--accent); }
.mass-marker.dragging::after { content: attr(data-drag-label); opacity: 1; color: var(--accent-strong); }


.strip-order { white-space: nowrap; }
.strip-order button + button { margin-inline-start: 6px; }

.lane-group-input { width: 110px; }
.strip-source-fields { grid-template-columns: minmax(120px, 1fr) minmax(140px, 1.5fr) minmax(64px, .55fr) minmax(90px, .8fr); }
@media (max-width: 560px) {
  .strip-source-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.strip-cell[data-strip-label-zone] { touch-action: none; }




.strip-cell[data-movable] { touch-action: none; cursor: grab; }
.strip-cell[data-movable]:active { cursor: grabbing; }



.levels-tool { position: relative; }
.levels-icon { display: inline-flex; align-items: end; gap: 2px; height: 15px; }
.levels-icon i { width: 3px; height: 42%; border-radius: 1px; background: currentColor; }
.levels-icon i:nth-child(2) { height: 100%; }
.levels-icon i:nth-child(3) { height: 68%; }
.levels-controls { display: grid; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.levels-controls[hidden] { display: none; }
#levelsHistogram { display: block; width: min(100%, 512px); margin-inline: auto; cursor: ew-resize; touch-action: none; }

#groupNoteForm { width: max-content; max-width: 100%; }
#groupNoteForm:has(#groupNoteText:not([hidden])) { width: min(240px, 100%); }


.label-angle-tools { position: absolute; z-index: 11; display: flex; align-items: center; gap: 7px; box-sizing: border-box; width: min(155px, 100%); padding: 4px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: 0 3px 12px #0002; font-size: 12px; }
.label-angle-tools output { width: 28px; flex: none; color: var(--accent-strong); font-variant-numeric: tabular-nums; text-align: right; }
.label-angle-tools input { flex: 1; min-width: 0; width: 100%; margin: 0; padding: 0; height: 22px; }

.plot-methods { margin-block: 4px 12px; }
.plot-methods p { margin: 6px 0 0; font: 13px/1.5 Arial, sans-serif; color: var(--muted); }

.export-resolution { margin-bottom: 10px; }
