:root {
  --paper: #f5f2ea;
  --paper-light: #fbfaf6;
  --ink: #242a26;
  --moss: #315847;
  --muted: #69716a;
  --soft: #8e948c;
  --line: #d9d8cf;
  --wash: #e9ebe2;
  --ochre: #ab7b55;
  --gutter: clamp(24px, 4.5vw, 88px);
  --display: "Noto Sans SC", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --sans: "Noto Sans SC", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; }
body.source-viewer-open { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.page-width { width: min(100%, 1480px); margin-inline: auto; padding-inline: var(--gutter); }
main { flex: 1; }

.site-header {
  height: 74px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding-inline: var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--paper-light);
}
.wordmark {
  width: max-content;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 650 26px/1 var(--display);
  letter-spacing: -.035em;
}
.site-nav { height: 100%; display: flex; align-items: stretch; gap: clamp(24px, 3vw, 56px); }
.nav-item {
  position: relative;
  padding: 2px 0 0;
  border: 0;
  background: none;
  color: #626960;
  font-size: 14px;
  white-space: nowrap;
  transition: color .2s ease;
}
.nav-item:hover, .nav-item.active { color: var(--ink); }
.nav-item.active { font-weight: 600; }
.nav-item::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--moss);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.nav-item.active::after { transform: scaleX(1); }

.view { display: none; }
.view.active { display: block; animation: pageEnter .38s ease both; }
@keyframes pageEnter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.hero {
  position: relative;
  min-height: clamp(570px, 74svh, 760px);
  overflow: hidden;
  isolation: isolate;
  background: #e6dccb;
}
.hero-image {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 49%;
}
.hero-content {
  width: min(100%, 1480px);
  margin-inline: auto;
  padding: clamp(70px, 8.3vh, 108px) var(--gutter) 84px;
}
.hero h1 {
  margin: 0;
  color: #18231e;
  font: 650 clamp(76px, 9.2vw, 138px)/1.1 var(--display);
  letter-spacing: -.07em;
  animation: heroReveal .7s .08s both;
}
.hero-title {
  margin: 18px 0 0;
  color: #1f2922;
  font: 550 clamp(30px, 3.1vw, 48px)/1.35 var(--display);
  letter-spacing: -.055em;
  animation: heroReveal .7s .19s both;
}
.mobile-break { display: none; }
.hero-copy {
  margin: 13px 0 0;
  color: #49534a;
  font-size: clamp(15px, 1.25vw, 19px);
  line-height: 1.8;
  animation: heroReveal .7s .3s both;
}
.hero-actions {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-top: 32px;
  animation: heroReveal .7s .4s both;
}
@keyframes heroReveal { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

.primary {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0 22px;
  border: 1px solid var(--moss);
  border-radius: 3px;
  background: var(--moss);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  transition: background .2s ease, transform .2s ease;
}
.primary:hover { background: #254836; transform: translateY(-2px); }
.text-button {
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  padding: 5px 0;
  background: none;
  color: var(--ink);
  font-size: 14px;
}
.text-button:hover { color: var(--moss); }
.hero-actions .text-button { color: #29352d; }
.outline {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 0 17px;
  border: 1px solid #a6aca1;
  border-radius: 3px;
  background: transparent;
  color: var(--moss);
  font-size: 13px;
  white-space: nowrap;
  transition: background .2s ease, border-color .2s ease;
}
.outline:hover { background: var(--wash); border-color: var(--moss); }

.editor-section { padding-top: 70px; padding-bottom: 94px; scroll-margin-top: 18px; }
.section-heading h2, .history h2 {
  margin: 0;
  font: 600 clamp(29px, 2.5vw, 39px)/1.35 var(--display);
}
.section-heading p { margin: 9px 0 30px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.capture-form { border-top: 1px solid var(--line); }
.editor-toolbar { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.segmented { display: flex; align-items: stretch; align-self: stretch; gap: 30px; }
.segmented button {
  position: relative;
  border: 0;
  background: none;
  color: var(--muted);
  padding: 0 4px;
  font-size: 14px;
}
.segmented button.selected { color: var(--ink); font-weight: 600; }
.segmented button.selected::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--moss); }
.source-select { display: flex; align-items: center; gap: 13px; }
.source-select label { margin: 0; color: var(--muted); font-size: 13px; }
.source-select select {
  min-width: 146px;
  height: 39px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-light);
  color: var(--ink);
  font-size: 13px;
}
.editor-surface { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.editor-surface:focus-within { border-color: #a1b0a3; }
#original-text {
  display: block;
  width: 100%;
  min-height: 236px;
  resize: vertical;
  border: 0;
  outline: 0;
  padding: 30px 5px;
  background: transparent;
  color: var(--ink);
  font: 18px/1.95 var(--sans);
}
textarea::placeholder, input::placeholder { color: #a2a59d; }
.upload-zone { min-height: 236px; display: grid; place-content: center; text-align: center; padding: 26px; }
.upload-zone input { max-width: 100%; color: var(--ink); font-size: 13px; }
.upload-zone p { margin: 18px 0 4px; color: var(--ink); font-size: 15px; }
.upload-zone small { color: var(--soft); font-size: 12px; }
.editor-footer { display: flex; align-items: end; gap: 24px; padding-top: 25px; }
.note-field { flex: 1; min-width: 0; }
.note-field label { display: block; margin-bottom: 10px; color: var(--ink); font-size: 13px; }
.optional { color: var(--soft); font-weight: 400; }
.note-field input {
  width: 100%;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0 15px;
  background: var(--paper-light);
  color: var(--ink);
  font-size: 14px;
}
.privacy-note { margin: 21px 0 0; color: var(--soft); font-size: 12px; line-height: 1.7; }

.interior-view { padding-top: clamp(54px, 5vw, 72px); padding-bottom: 90px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 36px; }
.page-heading h1 { max-width: 1000px; margin: 0; font: 600 clamp(36px, 3.7vw, 57px)/1.35 var(--display); letter-spacing: -.055em; }
.page-heading p { margin: 12px 0 0; color: var(--muted); font: 15px/1.75 var(--sans); }
.page-heading .outline { margin-bottom: 7px; }

.library-layout { display: grid; grid-template-columns: minmax(260px, 29%) minmax(0, 1fr); align-items: start; border-top: 1px solid var(--line); }
.library-list { padding: 28px 34px 0 0; }
.library-list input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0 16px;
  background: var(--paper-light);
  color: var(--ink);
  font-size: 13px;
}
.material-list { margin-top: 24px; max-height: 72vh; overflow-y: auto; scrollbar-color: #c5cabf transparent; }
.material-row {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 18px 7px;
  background: none;
  color: var(--ink);
  text-align: left;
  transition: color .18s ease, background .18s ease;
}
.material-row:hover { background: #eeeee7; }
.material-row.selected { color: var(--moss); }
.material-marker { flex: none; display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid #c9d0c7; border-radius: 50%; color: var(--moss); font-size: 11px; }
.material-row.selected .material-marker { border-color: var(--moss); background: var(--moss); color: white; }
.material-row-body { min-width: 0; }
.material-row small { display: block; margin-top: 8px; color: var(--soft); font-size: 11px; line-height: 1.5; }
.material-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 550 15px/1.55 var(--display); }
.detail-pane { min-width: 0; min-height: 620px; border-left: 1px solid var(--line); padding: 30px 0 0 clamp(32px, 4.2vw, 68px); }
.empty-detail { padding: 70px 0; color: var(--soft); font: 17px/1.8 var(--display); }
.detail-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.meta { color: var(--soft); font-size: 12px; line-height: 1.6; }
.detail-actions { display: flex; gap: 18px; }
.detail-actions button { border: 0; border-bottom: 1px solid transparent; padding: 4px 0; background: none; color: var(--moss); font-size: 13px; }
.detail-actions button:hover { border-color: currentColor; }
.detail-actions .danger { color: #98695f; }
.detail-pane h2 { max-width: 820px; margin: 26px 0 35px; font: 600 clamp(25px, 2.35vw, 36px)/1.5 var(--display); letter-spacing: -.04em; }
.detail-tabs { display: flex; gap: 33px; border-bottom: 1px solid var(--line); }
.detail-tabs button { position: relative; border: 0; padding: 0 3px 16px; background: transparent; color: var(--muted); font-size: 14px; }
.detail-tabs button.selected { color: var(--moss); font-weight: 600; }
.detail-tabs button.selected::after { content: ""; position: absolute; inset: auto 0 -1px; height: 2px; background: var(--moss); }
.detail-content { min-height: 420px; padding-top: 33px; animation: pageEnter .28s ease both; }
.eyebrow { color: var(--moss); font-size: 11px; font-weight: 600; letter-spacing: .13em; }
.source-feature { display: flex; align-items: center; min-height: 165px; max-width: 820px; margin-top: 17px; border-left: 3px solid var(--moss); padding: 20px clamp(22px, 4vw, 58px); }
.source-feature p { max-width: 700px; margin: 0; font: 500 clamp(21px, 1.95vw, 29px)/1.7 var(--display); letter-spacing: -.035em; }
.source-visual { margin-top: 17px; background: #e9ebe3; }
.source-visual .detail-image { width: 100%; max-height: 350px; margin: 0; object-fit: contain; }
.source-link { margin-top: 16px; }
.insight-zone { max-width: 820px; margin-top: 42px; border-top: 1px solid var(--line); padding-top: 21px; }
.insight-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.insight-heading .text-button { flex: none; color: var(--moss); font-size: 12px; }
.insight-summary { margin: 24px 0 22px; max-width: 720px; font: 500 clamp(18px, 1.6vw, 22px)/1.85 var(--display); letter-spacing: -.025em; }
.insight-points { border-top: 1px solid var(--line); }
.insight-point { border-bottom: 1px solid var(--line); }
.insight-point summary { display: flex; align-items: baseline; gap: 20px; padding: 16px 0; list-style: none; cursor: pointer; font-size: 14px; line-height: 1.7; }
.insight-point summary::-webkit-details-marker { display: none; }
.insight-point summary::after { content: "+"; margin-left: auto; color: var(--moss); font-size: 19px; line-height: 1; }
.insight-point[open] summary::after { content: "−"; }
.point-index { flex: none; color: var(--ochre); font-size: 11px; letter-spacing: .08em; }
.point-evidence { margin: 0 0 20px 37px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.insight-empty { margin: 30px 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.source-note { margin: 27px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; line-height: 1.8; }
.ocr-details { margin-top: 35px; border-top: 1px solid var(--line); padding-top: 20px; }
.ocr-details summary, .connection-evidence summary { width: max-content; max-width: 100%; color: var(--moss); cursor: pointer; font-size: 13px; }
.connection-row { padding: 26px 0; border-bottom: 1px solid var(--line); }
.connection-target { border: 0; border-bottom: 1px solid currentColor; padding: 0 0 3px; background: none; color: var(--moss); text-align: left; font-size: 18px; font-weight: 600; }
.connection-target:disabled { cursor: default; opacity: .75; }
.connection-reason { margin: 13px 0 19px; font-size: 15px; line-height: 1.8; }
.connection-evidence p { color: var(--muted); font-size: 13px; line-height: 1.8; }
.section-label { color: var(--moss); font: 600 15px/1.6 var(--display); letter-spacing: .03em; }
.original-content { max-width: 760px; margin: 19px 0 0; color: var(--ink); font: 16px/2 var(--display); white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-image { display: block; max-width: 100%; max-height: 540px; margin-top: 16px; object-fit: contain; }
.note-text { color: var(--muted); font-size: 14px; line-height: 1.8; }
.ai-disclaimer { margin: 8px 0 0; color: var(--soft); font-size: 12px; line-height: 1.7; }
.edit-panel { display: grid; gap: 12px; }
.edit-panel label { margin-top: 12px; color: var(--muted); font-size: 13px; }
.edit-panel textarea, .edit-panel input, .edit-panel select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 10px 13px;
  background: var(--paper-light);
  color: var(--ink);
}
.edit-panel textarea { min-height: 170px; resize: vertical; line-height: 1.8; }
.edit-panel .buttons { display: flex; gap: 12px; margin-top: 12px; }

.thinking-intro { padding: 50px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.thinking-intro p { max-width: 650px; margin: 0 0 22px; font: 22px/1.8 var(--display); }
.topic-grid { border-top: 1px solid var(--line); }
.topic-card {
  position: relative;
  border-bottom: 1px solid var(--line);
  padding: 27px 7px 24px;
  transition: background .2s ease;
}
.topic-card:hover, .topic-card:focus-within { background: #ebece4; }
.topic-choice {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 32px;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 20px;
  width: 100%;
  min-height: 96px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.topic-choice small { grid-column: 1; grid-row: 1 / span 2; align-self: start; color: var(--moss); font: 24px/1.5 var(--display); }
.topic-choice h3 { grid-column: 2; grid-row: 1; margin: 0 0 5px; font: 500 clamp(22px, 2vw, 31px)/1.5 var(--display); }
.topic-choice p { grid-column: 2; grid-row: 2; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.topic-choice span { grid-column: 3; grid-row: 1 / span 2; color: var(--moss); font-size: 24px; }
.topic-source-trigger { margin: 12px 0 0 106px; border: 0; border-bottom: 1px solid currentColor; padding: 0 0 3px; background: transparent; color: var(--moss); cursor: pointer; font: 12px/1.5 var(--sans); }
.topic-source-hint { position: absolute; z-index: 6; top: calc(100% - 5px); left: 106px; width: min(470px, calc(100% - 110px)); border: 1px solid var(--line); padding: 22px 26px; background: var(--paper-light); box-shadow: 0 16px 38px #242a2620; opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-6px); transition: opacity .2s ease, transform .2s ease, visibility .2s; }
.topic-source-trigger:hover + .topic-source-hint, .topic-source-trigger:focus-visible + .topic-source-hint { opacity: 1; visibility: visible; transform: translateY(0); }
.topic-source-hint-label { color: var(--moss); font: 12px/1.5 var(--sans); }
.topic-source-hint-row { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); }
.topic-source-hint-row strong { display: block; color: var(--ink); font: 500 15px/1.5 var(--display); }
.topic-source-hint-row p { display: -webkit-box; overflow: hidden; margin: 6px 0 0; color: var(--muted); font: 12px/1.7 var(--sans); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.topic-source-hint small { display: block; margin-top: 12px; color: var(--soft); }
.history { margin-top: 70px; }
.history h2 { margin-bottom: 17px; font-size: 28px; }
.history-row { display: flex; justify-content: space-between; gap: 15px; width: 100%; padding: 20px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; font: 18px/1.5 var(--display); }
.history-row:hover { color: var(--moss); }
.history-row small { flex: none; align-self: center; color: var(--soft); font: 12px/1.5 var(--sans); }
.empty-list { margin: 0; padding: 28px 10px; color: var(--soft); font-size: 13px; line-height: 1.8; }

.conversation { max-width: 990px; border-top: 1px solid var(--line); padding-top: 28px; }
.conversation h2 { margin: 10px 0 22px; font: 500 clamp(27px, 3vw, 44px)/1.4 var(--display); }
.conversation-sources { display: flex; align-items: center; gap: 24px; min-height: 83px; margin-bottom: 32px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; }
.conversation-source-label { flex: none; color: var(--moss); font: 12px/1.5 var(--sans); }
.conversation-source-list { display: flex; flex-wrap: wrap; gap: 10px 23px; min-width: 0; }
.conversation-source-link { display: flex; align-items: center; gap: 11px; max-width: 100%; border: 0; padding: 0; background: none; color: var(--ink); text-align: left; font: 14px/1.4 var(--display); }
.conversation-source-link > span:first-of-type { max-width: 270px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-source-link:hover > span:first-of-type { color: var(--moss); text-decoration: underline; text-underline-offset: 4px; }
.conversation-source-thumb { width: 48px; height: 48px; border: 1px solid var(--line); object-fit: cover; object-position: top; background: #fff; }
.conversation-source-arrow { flex: none; color: var(--moss); font: 12px/1.5 var(--sans); white-space: nowrap; }
.conversation-source-missing { color: var(--muted); font-size: 13px; }
.prior-reflection summary { width: max-content; max-width: 100%; color: var(--moss); cursor: pointer; font: 13px/1.6 var(--sans); }
.prior-reflection { margin-top: 34px; }
.prior-reflection .note-text, .reflection .note-text { white-space: pre-wrap; }
.resume-discussion { margin: 10px 0 22px; }
.message { max-width: 79%; margin: 23px 0; padding: 2px 0 2px 21px; border-left: 2px solid var(--moss); white-space: pre-wrap; overflow-wrap: anywhere; font: 17px/1.9 var(--display); }
.message.user { margin-left: auto; border-left-color: var(--ochre); }
.message small { display: block; margin-bottom: 7px; color: var(--muted); font: 12px/1.5 var(--sans); }
.conversation textarea { display: block; width: 100%; min-height: 135px; resize: vertical; margin-top: 40px; border: 1px solid var(--line); border-radius: 2px; padding: 18px; background: var(--paper-light); color: var(--ink); font: 16px/1.8 var(--display); }
.conversation-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; }
.reflection { margin-top: 35px; padding-top: 23px; border-top: 1px solid var(--line); }
.article-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; max-width: 820px; margin-top: 32px; }
.article-heading h3 { margin: 0; font: 600 22px/1.5 var(--display); }
.article-heading-actions { display: flex; align-items: center; gap: 22px; }
.article-heading .text-button { flex: none; color: var(--moss); font-size: 12px; }
.reflection .article { max-width: 820px; margin-top: 20px; border-left: 2px solid var(--moss); padding-left: 24px; white-space: pre-wrap; overflow-wrap: anywhere; font: 17px/2 var(--display); }
.article-editor { max-width: 820px; margin-top: 20px; }
.article-editor textarea { display: block; width: 100%; min-height: 480px; resize: vertical; border: 1px solid var(--line); padding: 25px 28px; background: var(--paper-light); color: var(--ink); font: 17px/2 var(--display); }
.article-editor-actions { display: flex; justify-content: flex-end; align-items: center; gap: 27px; margin-top: 16px; }
.article-confirmation { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 820px; margin-top: 35px; border-top: 1px solid var(--line); padding: 22px 0; color: var(--moss); font-size: 13px; line-height: 1.7; }
.article-confirmation .primary { flex: none; }
.article-confirmation .text-button { flex: none; font-size: 12px; }

.shelf-heading { margin-bottom: 46px; }
.shelf-heading h1 { font-size: clamp(45px, 5vw, 70px); }
.shelf-layout { display: grid; grid-template-columns: minmax(225px, 300px) minmax(0, 1fr); gap: clamp(38px, 6vw, 100px); border-top: 1px solid var(--line); }
.shelf-list { min-width: 0; border-right: 1px solid var(--line); padding: 35px 26px 70px 0; }
.shelf-count { margin-bottom: 20px; color: var(--moss); font: 12px/1.5 var(--sans); letter-spacing: .05em; }
.shelf-row { display: grid; grid-template-columns: 29px minmax(0, 1fr); gap: 5px 10px; width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 18px 0 20px; background: transparent; color: var(--ink); text-align: left; }
.shelf-row:hover .shelf-row-title, .shelf-row.selected .shelf-row-title { color: var(--moss); }
.shelf-index { grid-row: 1 / span 2; color: var(--soft); font: 12px/1.8 var(--sans); }
.shelf-row-title { overflow-wrap: anywhere; font: 500 17px/1.55 var(--display); transition: color .2s ease; }
.shelf-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; min-width: 0; }
.shelf-row small { color: var(--soft); font: 11px/1.5 var(--sans); }
.shelf-use-mark { display: inline-flex; align-items: center; gap: 6px; width: max-content; max-width: 100%; border-radius: 20px; padding: 4px 9px; background: #dce8da; color: #2b5843; font: 600 11px/1.5 var(--sans); white-space: nowrap; }
.shelf-use-mark::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.shelf-row.selected { border-bottom-color: var(--moss); }
.shelf-reader { min-width: 0; max-width: 890px; padding: 35px 0 90px; }
.shelf-reader-meta { color: var(--moss); font: 12px/1.7 var(--sans); }
.shelf-usage { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 13px 24px; max-width: 760px; margin-top: 25px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 13px 0; }
.shelf-usage-status { color: var(--moss); font: 600 13px/1.5 var(--sans); }
.shelf-usage-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 22px; }
.shelf-usage-actions .text-button { color: var(--moss); font-size: 12px; }
.shelf-usage-actions .text-button:last-child:not(:first-child) { color: var(--muted); }
.shelf-manuscript { max-width: 760px; margin-top: 47px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; font: 400 clamp(17px, 1.45vw, 20px)/2.05 var(--display); }
.shelf-reader-actions { display: flex; flex-wrap: wrap; gap: 18px 34px; max-width: 760px; margin-top: 54px; border-top: 1px solid var(--line); padding-top: 22px; }
.shelf-reader-actions .text-button { font-size: 13px; }
.shelf-empty { min-height: 36vh; border-top: 1px solid var(--line); padding: 45px 0; }
.shelf-empty p { max-width: 520px; margin: 0 0 20px; color: var(--muted); font: 17px/1.9 var(--display); }

.source-viewer { width: min(1120px, calc(100vw - 52px)); max-width: none; height: min(880px, calc(100dvh - 52px)); max-height: none; margin: auto; border: 1px solid var(--line); padding: 0; background: var(--paper-light); color: var(--ink); box-shadow: 0 30px 85px #15261e3d; }
.source-viewer::backdrop { background: #14231bcc; backdrop-filter: blur(4px); }
.source-viewer-shell { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.source-viewer-header { display: flex; justify-content: space-between; align-items: start; gap: 28px; padding: 27px 36px 22px; border-bottom: 1px solid var(--line); }
.source-viewer-count, .source-viewer-label { color: var(--moss); font: 12px/1.5 var(--sans); letter-spacing: .04em; }
.source-viewer-header h2 { max-width: 850px; margin: 8px 0 0; font: 500 clamp(20px, 2vw, 27px)/1.45 var(--display); overflow-wrap: anywhere; }
.source-viewer-close { flex: none; border: 0; padding: 3px 0; background: none; color: var(--muted); font: 13px/1.5 var(--sans); }
.source-viewer-close span { margin-left: 10px; color: var(--ink); font: 24px/1 var(--sans); vertical-align: -2px; }
.source-viewer-close:hover { color: var(--moss); }
.source-viewer-nav { display: flex; gap: 24px; flex: none; overflow-x: auto; border-bottom: 1px solid var(--line); padding: 0 36px; }
.source-viewer-nav button { flex: none; max-width: 230px; overflow: hidden; border: 0; border-bottom: 2px solid transparent; padding: 12px 0; background: none; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.source-viewer-nav button.selected { border-color: var(--moss); color: var(--moss); }
.source-viewer-body { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, .85fr); align-content: start; gap: 32px; min-height: 0; overflow: auto; padding: 32px 36px 42px; overscroll-behavior: contain; }
.source-viewer-image-pane { min-width: 0; margin: 0; }
.source-viewer-image-caption { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 13px; }
.source-viewer-zoom { border: 0; border-bottom: 1px solid currentColor; padding: 1px 0; background: none; color: var(--moss); font: 12px/1.5 var(--sans); }
.source-viewer-image { display: block; width: 100%; height: auto; border: 1px solid var(--line); background: white; cursor: zoom-in; }
.source-viewer-image-pane.is-zoomed { grid-column: 1 / -1; overflow-x: auto; }
.source-viewer-image-pane.is-zoomed .source-viewer-image { width: max(100%, 1100px); max-width: none; cursor: zoom-out; }
.source-viewer-ocr { min-width: 0; border-left: 1px solid var(--line); padding-left: 27px; }
.source-viewer-ocr h3, .source-viewer-original h3 { margin: 0 0 15px; font-weight: 400; }
.source-viewer-text { color: var(--ink); font: 15px/1.9 var(--display); white-space: pre-wrap; overflow-wrap: anywhere; }
.source-viewer-original { grid-column: 1 / -1; max-width: 790px; }
.source-viewer-original .source-viewer-text { font-size: 17px; line-height: 2; }
.source-viewer-note { grid-column: 1 / -1; margin: 0; border-top: 1px solid var(--line); padding-top: 17px; color: var(--muted); font: 13px/1.8 var(--sans); }

.site-footer { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding-top: 21px; padding-bottom: 24px; color: var(--soft); font-size: 11px; line-height: 1.6; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: min(420px, calc(100vw - 32px)); padding: 13px 18px; border-radius: 3px; background: var(--moss); color: #fff; box-shadow: 0 12px 30px #242a2626; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .25s ease, transform .25s ease; font-size: 13px; line-height: 1.6; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #824e46; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .site-header { grid-template-columns: auto minmax(0, 1fr); }
  .site-nav { justify-content: flex-end; gap: clamp(18px, 3vw, 35px); }
  .header-spacer { display: none; }
  .page-heading { display: block; }
  .page-heading .outline { margin-top: 20px; }
  .hero { min-height: 620px; }
  .hero-image { object-position: 54% center; }
  .hero h1 { font-size: clamp(78px, 12vw, 120px); }
  .library-layout { grid-template-columns: minmax(235px, 31%) minmax(0, 1fr); }
  .library-list { padding-right: 22px; }
  .detail-pane { padding-left: 23px; }
}

@media (max-width: 680px) {
  .site-header { display: flex; flex-wrap: wrap; height: auto; gap: 0; padding-top: 19px; }
  .wordmark { font-size: 26px; }
  .site-nav { order: 2; justify-content: flex-start; gap: 27px; width: 100%; height: 55px; margin-top: 13px; overflow-x: auto; }
  .nav-item { flex: none; font-size: 13px; }
  .hero { min-height: 0; display: flex; flex-direction: column; background: var(--paper); }
  .hero-content { order: 1; padding: 55px var(--gutter) 47px; }
  .hero-image { order: 2; position: relative; z-index: 0; height: clamp(240px, 56vw, 360px); object-position: 65% center; }
  .hero h1 { font-size: clamp(72px, 16vw, 104px); }
  .hero-title { margin-top: 23px; font-size: clamp(28px, 7vw, 41px); }
  .mobile-break { display: block; }
  .hero-copy { font-size: 14px; }
  .hero-actions { flex-wrap: wrap; gap: 22px; }
  .editor-section { padding-top: 54px; padding-bottom: 65px; }
  .section-heading h2 { font-size: 31px; }
  .editor-toolbar { min-height: 65px; }
  .segmented { gap: 20px; }
  .source-select select { min-width: 122px; }
  .editor-footer { align-items: stretch; flex-direction: column; }
  .editor-footer .primary { align-self: flex-start; }
  .interior-view { padding-top: 48px; padding-bottom: 60px; }
  .page-heading { display: block; margin-bottom: 30px; }
  .page-heading h1 { font-size: clamp(36px, 9vw, 52px); }
  .page-heading .outline { margin-top: 24px; }
  .library-layout { display: block; }
  .library-list { padding: 0 0 16px; }
  .material-list { display: flex; max-height: none; overflow-x: auto; overflow-y: hidden; margin-top: 16px; border-bottom: 1px solid var(--line); }
  .material-row { flex: 0 0 220px; min-width: 0; border-right: 1px solid var(--line); border-bottom: 0; padding: 14px 10px; }
  .material-row.selected { background: var(--wash); }
  .material-marker { width: 26px; height: 26px; }
  .detail-pane { min-height: 0; border-left: 0; border-top: 1px solid var(--line); padding: 28px 0 0; scroll-margin-top: 18px; }
  .source-feature { min-height: 150px; padding: 20px 24px; }
  .source-feature p { font-size: 19px; line-height: 1.8; }
  .detail-pane h2 { margin: 18px 0 26px; font-size: 25px; }
  .insight-zone { margin-top: 34px; }
  .topic-card { padding: 20px 0; }
  .topic-choice { grid-template-columns: 42px minmax(0, 1fr) 18px; column-gap: 11px; min-height: 95px; }
  .topic-choice small { font-size: 19px; }
  .topic-choice h3 { font-size: 22px; }
  .topic-choice span { font-size: 17px; }
  .topic-source-trigger { margin-left: 53px; }
  .topic-source-hint { display: none; }
  .conversation-sources { display: block; }
  .conversation-source-list { margin-top: 12px; }
  .conversation-source-link { width: 100%; }
  .conversation-source-link > span:first-of-type { flex: 1; max-width: none; }
  .source-viewer { width: 100vw; height: 100dvh; max-height: none; border: 0; }
  .source-viewer-header { gap: 16px; padding: 21px 22px 17px; }
  .source-viewer-header h2 { font-size: 20px; }
  .source-viewer-close { font-size: 0; }
  .source-viewer-close span { font-size: 28px; }
  .source-viewer-nav { padding-inline: 22px; }
  .source-viewer-body { display: block; padding: 22px 22px 40px; }
  .source-viewer-ocr { margin-top: 30px; border-left: 0; border-top: 1px solid var(--line); padding: 22px 0 0; }
  .source-viewer-note { margin-top: 28px; }
  .message { max-width: 93%; }
  .article-editor textarea { min-height: 380px; padding: 17px; font-size: 16px; }
  .article-heading { align-items: start; }
  .article-heading-actions { flex-wrap: wrap; justify-content: flex-end; gap: 10px 16px; }
  .article-confirmation { align-items: flex-start; flex-direction: column; }
  .shelf-layout { display: block; }
  .shelf-heading { margin-bottom: 28px; }
  .shelf-list { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px 0 12px; }
  .shelf-count { margin: 0 0 8px; }
  .shelf-row { padding: 13px 0 15px; }
  .shelf-row.selected { border-bottom-color: var(--moss); }
  .shelf-reader { padding: 29px 0 50px; scroll-margin-top: 16px; }
  .shelf-usage { align-items: flex-start; margin-top: 20px; }
  .shelf-manuscript { margin-top: 30px; font-size: 17px; line-height: 1.95; }
  .site-footer { display: block; }
  .site-footer span { display: block; margin-top: 4px; }
  .toast { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* Cloud login is the only overlay in the private edition. */
body.cloud-locked { overflow: hidden; }
.cloud-login { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: #f5f2ea; }
.cloud-login-form { width: min(100%, 430px); display: flex; flex-direction: column; gap: 14px; }
.cloud-login-brand { font-size: 24px; font-weight: 700; letter-spacing: .08em; color: #285747; margin-bottom: 46px; }
.cloud-login-form h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.2; margin: 0; color: #202822; }
.cloud-login-form p { margin: 0 0 16px; color: #6d756f; line-height: 1.7; }
.cloud-login-form input { width: 100%; padding: 16px 18px; border: 1px solid #b7bdb5; border-radius: 4px; background: #fffdf8; color: #202822; font: inherit; }
.cloud-login-form input:focus { outline: 2px solid #285747; outline-offset: 2px; }
.cloud-login-form button { padding: 17px; border: 0; border-radius: 4px; color: white; background: #285747; font: inherit; cursor: pointer; }
.cloud-login-form button:disabled { opacity: .6; cursor: wait; }
.cloud-login-form .cloud-login-error { color: #9a3c35; min-height: 1.5em; margin: 0; }
.cloud-logout { min-width: 44px; min-height: 40px; border: 0; background: transparent; color: #4a6559; cursor: pointer; font: inherit; white-space: nowrap; }
