:root {
  color-scheme: light;
  --paper: #f5f8f8;
  --panel: #ffffff;
  --ink: #172f36;
  --muted: #526b72;
  --line: #d6e1e3;
  --accent: #156259;
  --wash: #e6f2ef;
  --alert: #9d3e29;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100dvh; min-width: 280px; display: flex; flex-direction: column; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, p { margin: 0; }
.top { min-height: 54px; padding: 8px 19px; display: flex; gap: 14px; align-items: center; justify-content: space-between; background: var(--panel); border-bottom: 1px solid var(--line); }
.identity, .account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.identity strong { font-size: 16px; white-space: nowrap; }
.identity svg { width: 25px; stroke: var(--accent); stroke-width: 1.65; fill: none; }
.badge { border: 1px solid #a9c7c0; background: var(--wash); color: var(--accent); padding: 2px 6px; font-size: 11px; white-space: nowrap; }
.account span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.entry { display: grid; grid-template-columns: minmax(260px, 440px) minmax(290px, 365px); gap: clamp(26px, 6vw, 96px); align-items: start; justify-content: center; padding: clamp(32px, 12vh, 128px) 28px 42px; overflow: auto; }
.intro { padding: 19px 0; }
.folio { color: var(--accent); font-size: 13px; display: block; margin-bottom: 12px; }
h1 { font-family: "Songti SC", "Noto Serif CJK SC", Georgia, serif; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; }
.intro h1 { font-size: clamp(30px, 4vw, 49px); }
.intro p, .empty p { margin: 17px 0; line-height: 1.8; color: var(--muted); }
.bookmarks { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--accent); font-size: 13px; }
.gate { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent); padding: 19px; }
.tabs { display: flex; gap: 14px; margin-bottom: 15px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 0 0 9px; }
.tabs button[aria-pressed="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.gate label { display: grid; gap: 5px; margin-bottom: 13px; }
.gate input:not([type="checkbox"]), textarea, .feedback-input { color: var(--ink); background: var(--panel); border: 1px solid #aebfc2; border-radius: 3px; padding: 8px 10px; width: 100%; }
.gate .check { display: flex; align-items: center; gap: 7px; }
.gate .primary { width: 100%; }
.primary { border: 1px solid var(--accent); background: var(--accent); color: white; font-weight: 650; padding: 7px 16px; border-radius: 3px; }
.quiet { border: 1px solid var(--line); background: var(--panel); color: var(--accent); padding: 5px 8px; border-radius: 3px; white-space: nowrap; }
.quiet:hover, .example:hover { background: var(--wash); }
.status { font-size: 13px; color: var(--alert); }
.status:not(:empty) { padding: 7px 0; }
.desk { display: grid; grid-template-columns: minmax(140px, 200px) minmax(0, 1fr) minmax(148px, 215px); flex: 1; min-height: 0; }
.history, .evidence { display: flex; flex-direction: column; overflow: auto; background: var(--paper); }
.history { border-right: 1px solid var(--line); }
.evidence { border-left: 1px solid var(--line); }
.side-head { min-height: 46px; border-bottom: 1px solid var(--line); padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.side-head h2 { font-size: 13px; white-space: nowrap; }
.side-head span { font-size: 12px; color: var(--muted); }
#threads { padding: 5px; }
.thread { background: transparent; border: 1px solid transparent; color: var(--ink); padding: 7px; text-align: left; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread[aria-current="true"], .thread:hover { background: var(--wash); border-color: #bcd6d0; }
.trace { padding: 9px 10px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.trace p { padding: 3px 0; }
.trace-row { display: grid; grid-template-columns: 1fr auto; padding: 6px 0; gap: 2px 7px; border-bottom: 1px solid var(--line); }
.trace-row strong { color: var(--ink); font-size: 12px; }
.trace-row small { grid-column: 1 / -1; color: var(--muted); }
.trace-hits { grid-column: 1 / -1; overflow-wrap: anywhere; }
.trace-hits summary { color: var(--accent); cursor: pointer; }
.trace-hit { border-top: 1px solid var(--line); margin-top: 5px; padding-top: 4px; }
.trace-hit small { display: block; }
.conversation { background: var(--panel); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.scroll { flex: 1; min-height: 0; overflow: auto; }
.empty, #transcript, .draft, .working, #composer { width: min(100%, 810px); margin-inline: auto; padding-inline: clamp(14px, 3vw, 28px); }
.empty { padding-top: min(11vh, 80px); }
.empty h1 { font-size: 34px; }
.example { display: block; margin: 6px 0; padding: 7px 10px; border: 1px solid var(--line); background: var(--panel); color: var(--accent); text-align: left; }
.turn { padding: 15px 0; border-bottom: 1px solid var(--line); }
.question { color: var(--ink); padding: 8px 10px; background: var(--paper); border-left: 2px solid #a5c2bf; margin-bottom: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.answer { line-height: 1.72; overflow-wrap: anywhere; }
.answer p { margin: 6px 0; }
.answer h3 { font-size: 15px; margin: 10px 0 5px; }
.answer ul { margin: 5px 0; padding-left: 21px; }
.sources { display: flex; overflow-x: auto; gap: 6px; padding: 1px 0 6px; }
.source { flex: 0 0 142px; min-width: 0; min-height: 66px; border: 1px solid var(--line); padding: 4px; display: flex; gap: 6px; align-items: center; text-align: left; color: var(--ink); background: var(--paper); }
.source:hover { border-color: var(--accent); }
.source img { width: 34px; height: 50px; object-fit: contain; background: #fff; }
.source span { display: grid; gap: 4px; min-width: 0; }
.source strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 11px; }
.source small, .citation { color: var(--accent); }
.citation { border: 0; background: var(--wash); padding: 0 4px; margin-inline: 2px; border-radius: 3px; font-size: .83em; }
.feedback { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.feedback .quiet { font-size: 12px; }
.feedback-input { flex: 1 1 110px; width: auto; padding: 4px 7px; font-size: 12px; }
.working { color: var(--accent); padding-top: 12px; padding-bottom: 12px; }
.draft { padding-top: 15px; }
.stream-text { white-space: pre-wrap; }
#composer { border-top: 1px solid var(--line); padding-top: 9px; padding-bottom: 8px; }
#composer textarea { display: block; resize: vertical; min-height: 48px; max-height: 160px; }
.compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; color: var(--muted); }
#reader { width: min(900px, 96vw); max-height: 94dvh; padding: 0; border: 1px solid var(--line); color: var(--ink); }
#reader::backdrop { background: #17313b8a; }
#reader header { position: sticky; top: 0; display: flex; justify-content: space-between; padding: 9px 12px; gap: 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
#reader-meta { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
#reader-body { background: var(--paper); text-align: center; }
#reader-image { display: block; max-width: 100%; margin: auto; }
#reader-status:not(:empty) { padding: 12px; }
.sr { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
@media (max-width: 820px) { .desk { grid-template-columns: 135px minmax(0, 1fr); } .evidence { display: none; } }
@media (max-width: 590px) {
  .entry { grid-template-columns: minmax(0, 365px); padding: 18px 16px; gap: 15px; }
  .intro { padding: 10px 0 0; }
  .desk { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .history { border-right: 0; border-bottom: 1px solid var(--line); }
  #threads { display: flex; overflow: auto; }
  .thread { width: auto; max-width: 155px; flex-shrink: 0; }
}
