@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/noto-sans-sc-ui-0.ttf') format('truetype');
}
@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/noto-sans-sc-ui-1.ttf') format('truetype');
}

:root {
  --background: #f4f5f7;
  --text: #1c2733;
  --muted: #5b6570;
  --border: #e2e6ea;
  --blue: #1f6feb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 24px 16px 32px;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, 'Noto Sans SC', sans-serif;
  font-size: 16px;
  line-height: 1.7;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
a { color: #175ec4; }
a:hover { text-decoration: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
h1, h2, h3 { line-height: 1.4; margin: 0 0 16px; font-weight: 600; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 16px; }
ul, ol { padding-left: 24px; }
li { margin-bottom: 6px; }
form { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 16px; z-index: 100; padding: 8px 16px; background: white; clip-path: inset(100%); }
.skip-link:focus { clip-path: none; }

.site-header, .site-footer { max-width: 680px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.site-header { padding-bottom: 16px; }
.brand { color: var(--text); font-size: 16px; font-weight: 600; text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.language-switch { display: flex; gap: 4px; }
.language-switch button { padding: 3px 9px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 4px; font-size: 13px; }
.language-switch button.active { color: #175ec4; background: white; border-color: #c6ccd2; }
.connection-status { font-size: 12px; color: var(--muted); }
.connection-status.offline { color: #865d0b; }
.site-footer { padding-top: 18px; font-size: 12px; color: var(--muted); }
.site-footer a { color: var(--muted); }
.page-main { max-width: 680px; margin: 0 auto; padding: 32px 36px; background: white; border: 1px solid var(--border); border-radius: 8px; }
.button, .send-button, .selection-button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 6px; padding: 9px 20px; font-size: 15px; line-height: 1.6; text-decoration: none; }
.button-primary, .send-button, .selection-button { color: white; background: var(--blue); }
.button-primary:hover, .send-button:hover, .selection-button:hover { background: #195fc9; }
.button-secondary { color: var(--text); background: white; border-color: #c6ccd2; }
.button-secondary:hover { background: var(--background); }
.button-small { font-size: 13px; padding: 6px 12px; }
.text-button { color: #175ec4; border: 0; background: transparent; padding: 0; font-size: 13px; text-decoration: underline; }
.text-button:hover { text-decoration: none; }
.quiet-link { font-size: 14px; }
.small-note, .muted { color: var(--muted); }
.small-note { font-size: 13px; }
.study-progress { color: var(--muted); font-size: 13px; padding-bottom: 12px; margin: 0 0 24px; border-bottom: 1px solid var(--border); }
.page-heading { margin-bottom: 24px; }
.page-heading p { margin-bottom: 0; }
.study-procedure { margin: 16px 0 24px; }
.home-actions { margin-top: 24px; }
.paper-card { min-width: 0; }

.consent-copy section { margin-bottom: 24px; }
.consent-copy p { margin-bottom: 0; }
.consent-form { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 24px; }
.choice-row { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.choice-row > span { flex: 1; }
.choice-row small { display: block; color: var(--muted); font-size: 13px; }
input[type='checkbox'], input[type='radio'] { accent-color: var(--blue); width: 16px; height: 16px; flex-shrink: 0; margin: 5px 0 0; }
.form-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.form-heading-row h1 { margin-bottom: 0; }
.timer-card { text-align: right; flex-shrink: 0; }
.timer-card > span { display: block; color: var(--muted); font-size: 12px; }
.timer-value { font-size: 24px; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; }
.timer-warning .timer-value { color: #b42318; }
.question-field { min-width: 0; margin: 24px 0; padding: 0 0 24px; border: 0; border-bottom: 1px solid var(--border); }
.question-field legend { padding: 0; margin-bottom: 12px; font-weight: 600; }
.required-mark { color: #b42318; }
.question-intro { color: var(--muted); font-size: 14px; }
.text-input { width: 100%; padding: 9px 11px; color: var(--text); background: white; border: 1px solid #c6ccd2; border-radius: 5px; }
textarea.text-input { min-height: 110px; resize: vertical; }
.number-input { max-width: 180px; }
.likert-options { display: flex; gap: 10px; }
.likert-choice { display: flex; flex: 1; min-width: 0; flex-direction: column; align-items: center; text-align: center; cursor: pointer; font-size: 12px; line-height: 1.5; gap: 8px; }
.likert-choice input { margin: 4px 0 0; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 24px; }
.form-actions p { margin: 0; }
.instruction-card { margin-bottom: 24px; }
.start-reading-bar { border-top: 1px solid var(--border); padding-top: 24px; margin-top: 24px; }
.notice, .form-error { padding: 12px 16px; margin-bottom: 20px; background: #f1f6ff; border: 1px solid #cbdcf6; border-radius: 4px; font-size: 14px; }
.notice-warning { background: #fffbeb; border-color: #eedaa7; color: #795615; }
.form-error { background: #fff4f3; border-color: #f0c3bf; color: #a1261d; }
#connection-banner { max-width: 1160px; margin: 0 auto 16px; width: 100%; flex-shrink: 0; }
.participant-code { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 0; margin-bottom: 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.participant-code strong { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.done-bottom { color: var(--muted); font-size: 14px; }
.login-card label { display: block; margin: 24px 0 8px; }
.login-card .button { margin-top: 20px; }
.login-card > .quiet-link { display: block; margin-top: 24px; }

/* Separate scroll areas keep the reading measurements tied to the visible material. */
.reader-body { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding: 16px 20px 0; }
.reader-body .site-header { max-width: 1160px; width: 100%; flex-shrink: 0; }
.reader-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 1160px; width: 100%; margin: 0 auto; padding-bottom: 12px; flex-shrink: 0; }
.reader-toolbar-title { font-size: 15px; font-weight: 600; }
.reader-toolbar h1 { font-size: 18px; margin: 0; }
.reader-timer { display: flex; align-items: baseline; gap: 10px; flex-shrink: 0; }
.reader-timer > span { font-size: 13px; color: var(--muted); }
.reader-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; flex: 1; min-height: 0; width: 100%; max-width: 1160px; margin: 0 auto; background: white; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.reading-pane { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; position: relative; scrollbar-width: thin; }
.reading-article { max-width: 760px; padding: 28px 32px; margin: 0 auto; }
.article-header { border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.article-header h1 { font-size: 24px; }
.article-deck { color: var(--muted); }
.article-meta { color: var(--muted); font-size: 13px; margin-bottom: 16px; display: flex; justify-content: space-between; gap: 12px; }
.reading-chunk { scroll-margin-top: 20px; }
.reading-chunk h2 { font-size: 18px; margin: 24px 0 12px; }
.reading-chunk p, .reading-chunk li { font-size: 16px; line-height: 1.8; }
.reading-chunk blockquote { border-left: 3px solid #c6ccd2; margin: 16px 0; padding: 0 16px; }
.reading-chunk.flash { background: #fff6ce; }
.article-end { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 16px; color: var(--muted); font-size: 13px; }
.article-end p { margin: 0; }
.chat-pane { border-left: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-heading { padding: 16px; border-bottom: 1px solid var(--border); }
.chat-heading h2 { font-size: 16px; margin-bottom: 4px; }
.chat-heading p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }
.chat-messages { overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; padding: 16px; scrollbar-width: thin; }
.chat-empty { color: var(--muted); font-size: 14px; }
.chat-empty p { margin: 0; }
.chat-message { font-size: 14px; margin-bottom: 20px; }
.message-role { font-weight: 600; font-size: 12px; display: block; margin-bottom: 6px; }
.message-content { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.chat-message.user .message-content { background: var(--background); padding: 10px 12px; border-radius: 4px; }
.citation-button { background: #f1f6ff; color: #175ec4; border: 1px solid #cbdcf6; border-radius: 3px; font-size: 12px; padding: 0 4px; margin: 0 2px; }
.chat-feedback { font-size: 13px; margin: 0 16px 12px; color: var(--muted); }
.chat-feedback.error { color: #a1261d; }
.chat-composer { margin: 0 16px 16px; }
.chat-composer textarea { display: block; width: 100%; min-height: 80px; max-height: 160px; resize: vertical; padding: 9px 10px; border: 1px solid #c6ccd2; border-radius: 4px; font-size: 14px; line-height: 1.5; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.composer-bottom > span { font-size: 11px; color: var(--muted); line-height: 1.5; }
.send-button { font-size: 14px; padding: 6px 14px; flex-shrink: 0; }
.selection-preview { background: var(--background); border-left: 2px solid #98a5b5; padding: 8px 10px; margin-bottom: 8px; }
.selection-preview > div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.selection-preview p { font-size: 12px; max-height: 58px; overflow: hidden; margin: 5px 0 0; }
.selection-button { position: fixed; z-index: 20; max-width: 240px; font-size: 13px; padding: 7px 12px; }
.invitation-card { margin: 12px 16px 0; padding: 12px; border: 1px solid #cbdcf6; border-radius: 4px; background: #f1f6ff; }
.invitation-card h3 { font-size: 14px; margin-bottom: 6px; }
.invitation-card p { font-size: 13px; line-height: 1.6; margin-bottom: 10px; }
.invitation-card > div { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.reader-footer { width: 100%; max-width: 1160px; margin: 0 auto; padding: 9px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.reader-mobile-tabs { display: none; }
.session-expired .reading-pane, .session-expired .chat-pane { visibility: hidden !important; }
.session-expired .reader-main { position: relative; }
.reader-expired { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 32px; text-align: center; background: white; z-index: 5; }

.admin-main, .review-main { max-width: 1000px; }
.workspace-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
.workspace-header p { color: var(--muted); font-size: 14px; margin: 0; }
.workspace-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; flex-shrink: 0; }
.stats-grid { display: flex; flex-wrap: wrap; gap: 16px 28px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 16px 0; margin-bottom: 28px; }
.stat-card dt { color: var(--muted); font-size: 13px; }
.stat-card dd { font-size: 16px; font-weight: 600; margin: 2px 0 0; }
.admin-section { margin-bottom: 28px; min-width: 0; }
.admin-section + .admin-section { border-top: 1px solid var(--border); padding-top: 24px; }
.admin-section > p { font-size: 14px; }
.section-heading { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; }
.section-heading > .muted { font-size: 13px; }
.group-summary { display: flex; gap: 24px; margin: 0 0 16px; font-size: 14px; }
.group-summary strong { margin-left: 6px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 13px; }
th, td { padding: 9px 10px; border: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; background: #f7f8fa; }
.stage-badge { white-space: nowrap; }
.empty-table { text-align: center; color: var(--muted); padding: 20px; }
.config-list { font-size: 14px; margin: 0; }
.config-list > div { display: grid; grid-template-columns: 160px 1fr; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.config-list dt { color: var(--muted); }
.config-list dd { margin: 0; overflow-wrap: anywhere; }
.reviewer-create { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.reviewer-create label { font-size: 14px; white-space: nowrap; }
.reviewer-create .text-input { max-width: 280px; }
.reviewer-create button { white-space: nowrap; }
.token-notice { overflow-wrap: anywhere; }
.token-notice button { margin-left: 12px; }
.review-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; align-items: start; }
.case-list { position: sticky; top: 20px; max-height: 80vh; overflow: auto; border: 1px solid var(--border); }
.case-list > h2, .case-list > p { padding: 12px; margin: 0; }
.case-list > .section-heading { padding: 12px; margin: 0; }
.case-list h2 { font-size: 16px; }
.case-link { display: block; padding: 12px; text-decoration: none; color: var(--text); border-top: 1px solid var(--border); }
.case-link:hover, .case-link.active { background: #f1f6ff; }
.case-link.active { border-left: 3px solid var(--blue); padding-left: 9px; }
.case-link > strong { display: block; font-weight: 400; font-size: 14px; margin: 6px 0; }
.case-link > span { display: block; font-size: 14px; }
.case-link > .small-note { font-size: 12px; margin-top: 6px; }
.case-link > .case-meta { font-size: 12px; }
.case-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.empty-state { padding: 16px; font-size: 14px; color: var(--muted); }
.evidence-question { padding: 12px 16px; background: var(--background); white-space: pre-wrap; margin-bottom: 16px; }
.evidence-history { font-size: 14px; margin: 20px 0; }
.evidence-history summary { cursor: pointer; color: #175ec4; }
.evidence-message { padding-left: 12px; border-left: 2px solid var(--border); margin-top: 16px; }
.evidence-message p { white-space: pre-wrap; margin: 6px 0 0; }
.insufficient-row { margin: 20px 0; }
.annotation-passages { margin: 20px 0; }
.annotation-passage { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.annotation-passage p { font-size: 14px; margin: 6px 0 0; }
.annotation-passage:has(input:checked) { background: #f1f6ff; }
.notes-label { display: block; font-size: 14px; margin-bottom: 8px; }
.review-placeholder { padding: 20px 0; }
.validation-reading { border: 1px solid var(--border); padding: 16px; margin-bottom: 24px; }
.validation-reading summary { cursor: pointer; }
.validation-reading .reading-article { padding: 20px 0 0; }
body:has(.admin-main) .site-header, body:has(.admin-main) .site-footer,
body:has(.review-main) .site-header, body:has(.review-main) .site-footer { max-width: 1000px; }

@media (max-width: 760px) {
  body { padding: 16px 12px 24px; }
  .page-main { padding: 24px 20px; }
  .header-actions { gap: 10px; }
  .connection-status { font-size: 11px; }
  .form-heading-row { gap: 16px; }
  .timer-value { font-size: 22px; }
  .likert-options { flex-direction: column; gap: 8px; }
  .likert-choice { flex-direction: row; text-align: left; align-items: flex-start; font-size: 14px; gap: 10px; }
  .likert-choice input { margin-top: 3px; }
  .reader-body { padding: 12px 12px 0; }
  .reader-body .site-header { padding-bottom: 10px; }
  .reader-toolbar { gap: 12px; padding-bottom: 10px; }
  .reader-toolbar-title { font-size: 14px; }
  .reader-timer { display: block; text-align: right; }
  .reader-timer > span { display: block; font-size: 11px; }
  .reader-mobile-tabs { display: flex; flex-shrink: 0; margin-bottom: 8px; border-bottom: 1px solid #c6ccd2; }
  .reader-mobile-tabs button { flex: 1; padding: 8px; border: 0; background: transparent; color: var(--muted); font-size: 14px; }
  .reader-mobile-tabs button.active { color: #175ec4; border-bottom: 2px solid var(--blue); font-weight: 600; }
  .reader-main { display: flex; }
  .reading-pane { width: 100%; }
  .reading-article { padding: 22px 20px; }
  .chat-pane { display: none; width: 100%; border-left: 0; }
  .reader-body.chat-open .chat-pane { display: flex; }
  .reader-body.chat-open .reading-pane { display: none; }
  .reader-footer { font-size: 11px; }
  .workspace-header { flex-direction: column; gap: 16px; }
  .workspace-actions { flex-shrink: 1; }
  .reviewer-create { flex-wrap: wrap; }
  .reviewer-create .text-input { max-width: none; }
  .config-list > div { grid-template-columns: 110px 1fr; }
  .review-layout { grid-template-columns: 1fr; gap: 24px; }
  .case-list { position: static; max-height: 240px; }
  .stats-grid { gap: 10px 20px; }
}
