/* Original UI informed by the REA reference study; see docs/REFERENCE-IMPLEMENTATION.zh-CN.md. */
.detector-section { scroll-margin-top: 24px; }
.workspace-caption { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; }
.section-label { display: inline-flex; align-items: center; gap: 8px; font-size: 10px; font-weight: 600; letter-spacing: 1px; color: #607088; }
.section-label svg { width: 15px; height: 15px; color: #7284a5; }
.service-status { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #8290a7; }
.service-status.ready .status-dot { background: #398063; box-shadow: 0 0 0 3px #e6f1ec; }
.service-status.unavailable .status-dot { background: #aa712f; }
.workspace { display: grid; grid-template-columns: minmax(0,2.23fr) minmax(300px,1fr); background: white; border: 1px solid #d9e1ed; border-radius: var(--radius); overflow: clip; box-shadow: 0 4px 8px #23334e03, 0 16px 44px #23334e06; }
.workspace:has(textarea:focus) { border-color: #9eafd0; }
.editor { min-width: 0; display: flex; flex-direction: column; }
.editor-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; min-height: 60px; padding: 8px 24px; border-bottom: 1px solid #edf0f6; }
.editor-head label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.editor-head label svg { width: 17px; height: 17px; color: #6e7d97; }
.editor-head .text-button { font-size: 12px; font-weight: 500; color: var(--blue); margin-left: auto; }
.editor-head .text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-field { position: relative; flex: 1; min-height: 320px; display: flex; flex-direction: column; padding: 0 24px; }
textarea { display: block; flex: 1; width: 100%; min-height: 320px; height: 100%; max-height: 720px; padding: 22px 0 18px; resize: vertical; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-size: 16px; font-weight: 400; line-height: 1.8; letter-spacing: 0; white-space: pre-wrap; }
textarea::placeholder { color: #6b7a93; }
textarea:focus-visible { outline: none; }
textarea[readonly] { color: #758197; }
.input-notes { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 10px 24px; border-top: 1px solid #edf0f6; }
.input-notes p { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 0; }
.input-notes p[data-state="ready"] { color: var(--green); }
.input-notes p[data-state="invalid"] { color: var(--danger); }
.editor-action { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; padding: 14px 20px 14px 24px; background: #fbfcfe; border-top: 1px solid var(--line); }
.document-counts { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.word-count { font-size: 12px; font-weight: 500; color: #4b5c76; }
.word-count.invalid { color: var(--danger); }
.toolbar-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; }
.toolbar-actions .text-button { font-size: 12px; gap: 5px; }
.toolbar-actions svg { width: 16px; height: 16px; }
#detect-button { min-width: 136px; font-size: 13px; gap: 12px; }
#cancel-button { color: var(--blue); }

/* Empty, processing, and real model result states */
.result-panel { display: flex; flex-direction: column; min-width: 0; padding: 20px 24px 16px; background: #f8faff; border-left: 1px solid var(--line); }
.result-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.result-head h2 { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; letter-spacing: -.2px; margin: 0; }
.result-head h2 svg { width: 18px; height: 18px; color: #7687a3; }
.small-tag { font-size: 10px; font-weight: 600; letter-spacing: .3px; line-height: 1.5; color: #667794; background: #edf2f9; padding: 4px 6px; border: 1px solid #dfe6f2; border-radius: 5px; }
.result-panel.complete:not(.stale):not([aria-busy="true"]) .small-tag { color: var(--green); background: #eaf4ee; border-color: #d5e8dc; }
.result-panel[aria-busy="true"] .small-tag { color: var(--blue); background: var(--blue-soft); border-color: #d9e3fb; }
.result-panel.stale .small-tag { color: var(--amber); background: var(--amber-soft); border-color: #f0dcc0; }
.result-empty, .result-loading { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 0; min-height: 330px; }
.report-symbol { width: 66px; height: 66px; display: grid; place-items: center; margin-bottom: 18px; color: #8095b9; border: 1px solid #e1e8f4; border-radius: 50%; background: #f0f4fc; }
.report-symbol svg { width: 36px; height: 36px; stroke-width: 1.4; }
.result-empty h3, .result-loading h3 { font-size: 16px; font-weight: 600; letter-spacing: -.3px; line-height: 1.5; margin: 0 0 8px; }
.result-empty p, .result-loading p { color: var(--muted); font-size: 13px; line-height: 1.8; margin: 0; }
.report-includes { display: grid; gap: 10px; list-style: none; margin: 24px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); text-align: left; width: 100%; }
.report-includes li { display: flex; align-items: center; gap: 10px; color: #5b6c87; font-size: 12px; }
.report-includes li span { color: #687fa8; font-size: 10px; font-variant-numeric: tabular-nums; }
.scan-orbit { display: grid; place-items: center; position: relative; width: 72px; height: 72px; color: var(--blue); margin-bottom: 24px; }
.scan-orbit svg { width: 32px; height: 32px; }
.scan-orbit::after { content: ''; position: absolute; inset: 0; border: 2px solid #dce5ff; border-top-color: var(--blue); border-radius: 50%; animation: spin 1.8s linear infinite; }
.result-loading .loading-note { margin-top: 20px; font-size: 11px; }
.result-content { flex: 1; padding: 24px 0 18px; animation: reveal .2s var(--ease); }
.result-kicker { font-size: 9px; font-weight: 600; letter-spacing: 1.2px; color: var(--muted); margin: 0 0 8px; }
.result-content h3 { font-size: 21px; font-weight: 600; line-height: 1.3; letter-spacing: -.025em; margin: 0 0 18px; }
.score-card { background: white; border: 1px solid #dfe6f0; border-radius: 10px; padding: 16px; }
.score-caption { font-size: 12px; color: var(--muted); display: block; margin-bottom: 5px; }
.score-line { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--muted); }
#score-number { font-size: 46px; line-height: 1.2; letter-spacing: -.04em; font-weight: 600; color: var(--green); font-variant-numeric: lining-nums tabular-nums; }
.flagged #score-number { color: var(--amber); }
progress { appearance: none; display: block; width: 100%; height: 6px; margin-top: 14px; border: 0; border-radius: 5px; overflow: hidden; background: #e8eef4; color: var(--green); }
progress::-webkit-progress-bar { background: #e8eef4; border-radius: 5px; }
progress::-webkit-progress-value { background: #418468; border-radius: 5px; }
progress::-moz-progress-bar { background: #418468; border-radius: 5px; }
.flagged progress::-webkit-progress-value { background: #b17d3a; }
.flagged progress::-moz-progress-bar { background: #b17d3a; }
.score-scale { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px 10px; margin-top: 7px; font-size: 9px; color: var(--muted); }
.score-explanation { font-size: 12px; line-height: 1.8; color: var(--muted); margin: 12px 0 18px; }
.score-explanation strong { color: #465872; font-weight: 500; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; padding: 14px 0; border-block: 1px solid var(--line); }
.result-stats dt { color: var(--muted); font-size: 11px; }
.result-stats dd { font-size: 17px; font-weight: 600; margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.technical-details { color: var(--muted); font-size: 12px; margin-top: 4px; }
.technical-details summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; cursor: pointer; list-style: none; }
.technical-details summary::after { content: '+'; font-size: 19px; }
.technical-details[open] summary::after { content: '−'; }
.technical-details dl { margin: 0 0 12px; }
.technical-details dl div { margin-bottom: 10px; }
.technical-details dt { font-size: 11px; color: var(--muted); }
.technical-details dd { font-size: 12px; margin: 0; color: #394e6b; overflow-wrap: anywhere; }
.technical-details p { font-size: 11px; line-height: 1.8; margin: 0 0 16px; }
.download-button { width: 100%; min-height: 44px; font-size: 12px; margin-top: 4px; }
.result-footnote { display: flex; align-items: flex-start; gap: 6px; padding-top: 14px; margin: 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.75; }
.result-footnote svg { width: 14px; height: 14px; margin-top: 2px; }
.stale-note { color: var(--amber); background: var(--amber-soft); border: 1px solid #ead2af; font-size: 12px; line-height: 1.7; border-radius: 8px; padding: 12px; margin: 0 0 18px; }
.result-panel.stale .score-card { opacity: .6; }
.error-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid #ebcbc3; background: #fff4f0; border-radius: 10px; padding: 10px 16px; margin-top: 12px; color: #9c4636; font-size: 13px; line-height: 1.7; }
.error-banner button { color: #9c4636; flex-shrink: 0; }
.editor .error-banner { margin: 0 16px 12px; }
.workspace-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.workspace-footer > span { display: flex; align-items: center; gap: 7px; }
.workspace-footer svg { width: 15px; height: 15px; color: #6e83a5; }
.workspace-footer button { font-size: 11px; white-space: nowrap; }
.detector-benefits { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px 30px; padding: 18px 0 0; margin: 10px 0 0; list-style: none; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.detector-benefits li { display: flex; align-items: center; gap: 8px; }
.detector-benefits li::before { content: '✓'; color: #4e6d9d; font-size: 13px; }

@media (min-width: 1600px) { .text-field, textarea { min-height: 350px; } }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0,1.8fr) minmax(280px,1fr); }
  .editor-action { gap: 12px; } .document-counts { width: 100%; } .toolbar-actions { width: 100%; }
  .editor-head, .input-notes { padding-inline: 20px; } .text-field { padding-inline: 20px; }
  .result-panel { padding-inline: 20px; }
}
@media (max-width: 800px) {
  .workspace { grid-template-columns: 1fr; }
  .result-panel { border-left: 0; border-top: 1px solid var(--line); padding: 22px 24px 18px; }
  .result-empty { min-height: 0; padding: 24px 0; }
  .result-empty .report-symbol { display: none; }
  .result-empty p br { display: none; }
  .report-includes { display: flex; flex-wrap: wrap; gap: 12px 18px; justify-content: center; margin-top: 18px; }
  .result-content { padding-top: 24px; }
  .result-head { flex-wrap: wrap; }
  .result-loading { min-height: 260px; }
  .result-footnote { justify-content: center; }
  .document-counts { width: auto; } .toolbar-actions { width: auto; }
  .score-card { max-width: none; } .score-explanation { font-size: 12px; }
}
@media (max-width: 540px) {
  .workspace-caption { gap: 6px 12px; }
  .section-label { font-size: 9px; letter-spacing: .45px; gap: 5px; }
  .section-label svg { width: 13px; height: 13px; } .service-status { font-size: 10px; }
  .workspace { border-radius: 13px; }
  .editor-head { padding: 8px 16px; gap: 6px 8px; }
  .editor-head label { font-size: 13px; } .editor-head .text-button { font-size: 11px; }
  .text-field { padding-inline: 18px; }
  .text-field, textarea { min-height: 330px; }
  textarea { font-size: 16px; padding-top: 18px; }
  .input-notes { padding: 10px 16px; display: block; }
  .input-notes p { font-size: 12px; } .input-notes #input-message { margin-top: 2px; }
  .editor-action { padding: 10px 14px 14px; gap: 8px; }
  .document-counts { width: 100%; font-size: 10px; } .word-count { font-size: 11px; }
  .toolbar-actions { width: 100%; justify-content: space-between; gap: 8px; }
  .toolbar-actions .text-button { font-size: 11px; }
  .toolbar-actions svg { width: 15px; height: 15px; }
  #detect-button { min-width: 126px; font-size: 12px; padding-inline: 13px; }
  #cancel-button { margin-left: auto; }
  .result-panel { padding: 20px 18px 16px; }
  .report-includes { justify-content: flex-start; gap: 12px; display: grid; width: auto; margin-inline: auto; }
  .result-empty { padding: 24px 0; } .result-empty h3 { font-size: 16px; }
  .result-empty p { max-width: 240px; }
  .result-footnote { font-size: 11px; justify-content: flex-start; }
  .technical-details { font-size: 12px; }
  .workspace-footer { flex-wrap: wrap; gap: 0; margin-top: 14px; }
  .workspace-footer > span { align-items: flex-start; font-size: 11px; line-height: 1.8; }
  .workspace-footer svg { margin-top: 2px; }
  .workspace-footer button { min-height: 44px; margin-left: 22px; }
  .detector-benefits { gap: 8px 16px; font-size: 11px; margin-top: 2px; padding-top: 16px; }
}
@media (max-width: 360px) {
  .section-label { font-size: 9px; } .service-status { font-size: 10px; }
  .toolbar-actions { gap: 8px; } .toolbar-actions .text-button { font-size: 10px; }
  #detect-button { min-width: 118px; font-size: 11px; padding-inline: 10px; gap: 8px; }
}
