:root {
  color-scheme: light;
  --ink: #17202b;
  --muted: #64717f;
  --paper: #eef1f3;
  --surface: #ffffff;
  --surface-soft: #f7f8f9;
  --line: #d6dce1;
  --blue: #165b91;
  --blue-soft: #e9f2f8;
  --green: #247454;
  --green-soft: #e8f3ed;
  --yellow: #9a6814;
  --yellow-soft: #fbf1d8;
  --red: #a43a35;
  --red-soft: #f8e9e7;
  --shadow: 0 18px 46px rgba(23, 32, 43, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(22, 91, 145, 0.28);
  outline-offset: 2px;
}

.review-header {
  align-items: center;
  background: rgba(238, 241, 243, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 68px;
  padding: 12px clamp(18px, 4vw, 56px);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
}

.review-header p {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0;
}

.brand-link,
.section-kicker {
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
}

.review-main {
  margin: 0 auto;
  max-width: 1680px;
  padding: clamp(24px, 4vw, 52px) clamp(16px, 3vw, 48px) 64px;
}

.locked-view {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin: clamp(32px, 8vh, 96px) auto 0;
  max-width: 620px;
  padding: clamp(28px, 5vw, 52px);
}

.locked-view h1 {
  font-family: "Songti SC", SimSun, serif;
  font-size: 2.25rem;
  line-height: 1.25;
  margin: 10px 0 16px;
}

.locked-intro {
  color: var(--muted);
  line-height: 1.8;
  margin: 0 0 28px;
}

.access-form {
  display: grid;
  gap: 10px;
}

.access-form label,
.review-toolbar label,
.annotation-editor > label,
.attachment-field > label {
  font-size: 0.86rem;
  font-weight: 750;
}

input,
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  line-height: 1.65;
  resize: vertical;
}

.access-form button,
.editor-actions button,
.review-decisions button,
.source-upload-bar > button,
.quiet-button,
.icon-command,
.upload-progress button {
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 750;
  min-height: 42px;
  padding: 9px 16px;
}

.access-form button,
.editor-actions button:first-child,
.source-upload-bar > button,
.approve-button {
  background: var(--blue);
  color: #fff;
}

.quiet-button,
.icon-command,
.upload-progress button {
  background: var(--blue-soft);
  color: #104d7b;
}

.workspace-view {
  min-width: 0;
}

.source-upload-bar {
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1.5fr) minmax(270px, 0.9fr) auto minmax(180px, 0.7fr);
  margin-bottom: 16px;
  padding: 14px;
}

.source-file-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.source-file-field > span,
.source-mode legend {
  font-size: 0.86rem;
  font-weight: 750;
}

.source-file-field small {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.source-mode {
  border: 0;
  display: flex;
  gap: 6px;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.source-mode legend {
  margin-bottom: 6px;
}

.source-mode label {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  font-size: 0.8rem;
  gap: 5px;
  min-height: 44px;
  padding: 8px 10px;
}

.source-mode input {
  min-height: auto;
  padding: 0;
  width: auto;
}

.source-upload-status {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.8rem;
  line-height: 1.45;
  margin: 0;
  min-height: 44px;
  min-width: 0;
}

.review-toolbar {
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 0.8fr) auto auto auto;
  margin-bottom: 16px;
  padding: 14px;
}

.review-toolbar label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.progress-label,
.save-status {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.82rem;
  min-height: 42px;
  white-space: nowrap;
}

.review-columns {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.75fr);
}

.article-pane,
.annotation-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  min-width: 0;
}

.article-pane {
  min-width: 0;
  padding: clamp(24px, 4vw, 54px);
}

.article-heading {
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
  padding-bottom: 24px;
}

.article-heading h1 {
  font-family: "Songti SC", SimSun, serif;
  font-size: 2rem;
  line-height: 1.35;
  margin: 8px 0 0;
}

.article-block {
  border-left: 3px solid transparent;
  font-family: "Songti SC", SimSun, serif;
  font-size: 1.08rem;
  line-height: 2;
  margin: 0;
  padding: 8px 12px;
  scroll-margin: 110px;
  transition: background 160ms ease, border-color 160ms ease;
  white-space: pre-wrap;
}

.article-block + .article-block {
  margin-top: 8px;
}

.article-block--heading {
  font-size: 1.3rem;
  font-weight: 800;
  margin-top: 26px;
}

.article-block--focused {
  background: var(--blue-soft);
  border-left-color: var(--blue);
}

.article-block[data-rating="red"] {
  border-left-color: var(--red);
}

.article-block[data-rating="yellow"] {
  border-left-color: var(--yellow);
}

.article-block[data-rating="green"] {
  border-left-color: var(--green);
}

.text-mark {
  border-radius: 2px;
  color: inherit;
  padding: 1px 0;
}

.text-mark--green {
  background: #cfe9da;
}

.text-mark--yellow {
  background: #f7dfa6;
}

.text-mark--red {
  background: #f2c6c2;
}

.annotation-pane {
  align-self: start;
  max-height: calc(100vh - 112px);
  min-width: 0;
  overflow-y: auto;
  padding: 18px;
  position: sticky;
  top: 84px;
}

.annotation-heading,
.annotation-meta,
.attachment-row,
.upload-progress,
.editor-actions,
.review-decisions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.annotation-heading {
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding-bottom: 14px;
}

.annotation-heading h2 {
  font-size: 1.2rem;
  margin: 5px 0 0;
}

.annotation-heading span,
.annotation-empty {
  color: var(--muted);
  font-size: 0.84rem;
}

.annotation-editor {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
}

.selected-quote,
.annotation-card blockquote {
  border-left: 3px solid var(--blue);
  color: #384653;
  font-family: "Songti SC", SimSun, serif;
  line-height: 1.7;
  margin: 0;
  padding-left: 12px;
}

.rating-control {
  border: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
}

.rating-control legend {
  font-size: 0.86rem;
  font-weight: 750;
  margin-bottom: 8px;
}

.rating-control label {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  font-size: 0.8rem;
  gap: 5px;
  min-height: 42px;
  padding: 8px;
}

.rating-control input {
  min-height: auto;
  padding: 0;
  width: auto;
}

.attachment-field {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding-top: 12px;
}

.attachment-field > p,
#annotationMessage,
#accessMessage {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
  margin: 0;
}

.attachment-drafts {
  display: grid;
  gap: 6px;
}

.attachment-row,
.upload-progress {
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  min-width: 0;
  padding: 7px 9px;
}

.attachment-row span,
.upload-progress span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.danger-command {
  color: var(--red);
}

.annotation-list {
  display: grid;
  gap: 10px;
}

.annotation-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  gap: 10px;
  padding: 13px;
}

.annotation-card--green {
  border-left-color: var(--green);
}

.annotation-card--yellow {
  border-left-color: var(--yellow);
}

.annotation-card--red {
  border-left-color: var(--red);
}

.annotation-card p {
  line-height: 1.6;
  margin: 0;
}

.rating-label {
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 750;
  padding: 4px 8px;
}

.rating-label--green {
  background: var(--green-soft);
  color: var(--green);
}

.rating-label--yellow {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.rating-label--red {
  background: var(--red-soft);
  color: var(--red);
}

.attachment-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.attachment-button {
  background: #dde3e7;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  padding: 0;
}

.attachment-thumb {
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  width: 100%;
}

.review-decisions {
  background: var(--surface);
  border: 1px solid var(--line);
  margin-top: 16px;
  padding: 14px;
}

.review-decisions button {
  min-width: 150px;
}

.request-button {
  background: var(--red-soft);
  color: var(--red);
}

.attachment-dialog {
  background: #11161a;
  border: 0;
  color: #fff;
  max-height: 92vh;
  max-width: min(92vw, 1100px);
  padding: 42px 18px 16px;
}

.attachment-dialog::backdrop {
  background: rgba(10, 15, 20, 0.78);
}

.attachment-dialog img {
  display: block;
  max-height: 76vh;
  max-width: 100%;
  object-fit: contain;
}

.attachment-dialog p {
  margin: 12px 0 0;
  text-align: center;
}

.dialog-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  color: #fff;
  font-size: 1.4rem;
  height: 34px;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 10px;
  top: 8px;
  width: 34px;
}

@media (max-width: 1100px) {
  .source-upload-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-toolbar .quiet-button {
    justify-self: start;
  }
}

@media (max-width: 900px) {
  .review-header {
    position: static;
  }

  .review-main {
    padding: 14px 10px 40px;
  }

  .review-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .annotation-pane {
    max-height: none;
    position: static;
  }

  .article-pane {
    padding: 22px 16px;
  }
}

@media (max-width: 620px) {
  .review-header p {
    display: none;
  }

  .locked-view h1 {
    font-size: 1.75rem;
  }

  .review-toolbar,
  .source-upload-bar,
  .rating-control {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-toolbar {
    align-items: stretch;
  }

  .source-mode {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .source-mode label {
    justify-content: center;
  }

  .source-upload-bar > button {
    width: 100%;
  }

  .progress-label,
  .save-status {
    min-height: 28px;
  }

  .article-heading h1 {
    font-size: 1.6rem;
  }

  .article-block {
    font-size: 1rem;
    line-height: 1.9;
    padding: 7px 8px;
  }

  .review-decisions {
    align-items: stretch;
    flex-direction: column;
  }

  .review-decisions button {
    width: 100%;
  }
}
