:root {
  --ink: #0f2f4f;
  --text: #263d55;
  --muted: #6c8298;
  --line: #d8e8f6;
  --paper: #f5faff;
  --panel: #ffffff;
  --soft: #edf7ff;
  --blue: #2f80c9;
  --blue-dark: #155a91;
  --blue-soft: #e2f2ff;
  --yellow: #f3c84b;
  --yellow-soft: #fff5cc;
  --green: #35a872;
  --green-soft: #dff7eb;
  --shadow: 0 20px 55px rgba(35, 99, 148, 0.13);
  font-family:
    "Noto Serif SC", "Source Han Serif SC", "Songti SC", "Microsoft YaHei",
    serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 8%, rgba(185, 226, 255, 0.58), transparent 26%),
    radial-gradient(circle at 88% 4%, rgba(219, 242, 255, 0.9), transparent 22%),
    var(--paper);
}

a,
button {
  color: inherit;
  font: inherit;
}

a {
  text-decoration: none;
}

button {
  cursor: pointer;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 66px;
  padding: 0 clamp(18px, 4vw, 56px);
  background: rgba(250, 253, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--blue-dark);
  border-radius: 8px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: var(--ink);
  font-size: 18px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 12px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #506980;
  font-size: 14px;
}

.nav button {
  padding: 0;
  background: transparent;
  border: 0;
}

.nav a:hover,
.nav button:hover {
  color: var(--blue-dark);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(360px, 2fr);
  gap: clamp(18px, 2.4vw, 30px);
  align-items: start;
  min-height: calc(100dvh - 66px);
  padding: clamp(18px, 3vw, 34px) clamp(18px, 4vw, 56px) clamp(30px, 4vw, 56px);
}

.input-pane,
.feedback-pane {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.input-pane {
  display: grid;
  gap: 18px;
  padding: clamp(20px, 3vw, 32px);
}

.feedback-pane {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.intro-block {
  max-width: 860px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 16px;
  color: var(--ink);
  font-size: clamp(34px, 4.1vw, 56px);
  font-weight: 900;
  line-height: 1.14;
  text-wrap: balance;
}

.intro-block p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: #4e667d;
  font-size: 18px;
  line-height: 1.82;
}

.fast-start {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 14px;
}

.demo-link {
  padding: 0;
  color: var(--blue-dark);
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  font-weight: 800;
}

.fast-start span {
  color: var(--muted);
  font-size: 14px;
}

.config-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.2fr);
  gap: 14px;
}

.input-pane label,
.discipline-field,
.text-editor {
  display: grid;
  gap: 8px;
}

.input-pane label span,
.discipline-field > span,
.text-editor > span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  padding: 13px 14px;
  color: var(--ink);
  background: #fbfdff;
  border: 1px solid #c8ddec;
  border-radius: 12px;
  outline: none;
  font: inherit;
  line-height: 1.65;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

input:focus,
textarea:focus {
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 128, 201, 0.14);
}

.discipline-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.discipline-tags button {
  padding: 7px 10px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  border: 1px solid #c5e2f6;
  border-radius: 999px;
  font-size: 13px;
}

.discipline-tags button:hover {
  background: #d7edff;
}

.upload-box {
  padding: 14px;
  background: #f1f9ff;
  border: 1px dashed #94c7ec;
  border-radius: 14px;
}

.upload-box input {
  padding: 4px 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.upload-box small {
  color: var(--muted);
  line-height: 1.55;
}

.sample-panel {
  display: grid;
  gap: 12px;
}

.sample-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sample-panel-head span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.sample-panel-head button {
  padding: 0;
  color: var(--blue);
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 800;
}

.sample-select-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.sample-select-row select {
  min-width: 0;
  padding: 12px 14px;
  color: var(--ink);
  background: #fbfdff;
  border: 1px solid #c8ddec;
  border-radius: 12px;
  font: inherit;
}

.sample-select-row button {
  padding: 0 14px;
  color: var(--blue-dark);
  background: #fff;
  border: 1px solid #bddcf1;
  border-radius: 12px;
  font-weight: 800;
}

.text-editor textarea {
  min-height: 330px;
  resize: vertical;
}

.annotated-text {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.annotated-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.annotated-head strong {
  color: var(--ink);
}

#annotatedBody {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.annotated-line {
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid transparent;
  border-radius: 10px;
  line-height: 1.75;
}

.annotated-line.background {
  background: rgba(226, 242, 255, 0.58);
  border-color: #91caf2;
}

.annotated-line.literature {
  background: rgba(236, 239, 245, 0.72);
  border-color: #aebfd0;
}

.annotated-line.gap {
  background: rgba(255, 245, 204, 0.75);
  border-color: #f0cf5f;
}

.annotated-line.purpose {
  background: rgba(223, 247, 235, 0.82);
  border-color: #8dd8ae;
}

.console-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 18px;
  border-radius: 11px;
  font-weight: 800;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button.primary {
  color: #fff;
  background: linear-gradient(180deg, #3c93d6, #1e67a2);
  border: 1px solid #1e67a2;
}

.button.secondary {
  color: var(--blue-dark);
  background: #fff;
  border: 1px solid #bddcf1;
}

.panel-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.panel-top strong {
  color: var(--ink);
  font-size: 16px;
}

.health-card,
.legend-card,
.highlight-card,
.scaffold-card,
.agent-output {
  padding: 16px;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.health-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.health-header span {
  color: var(--muted);
  font-size: 14px;
}

.health-header strong {
  color: var(--blue-dark);
  font-family: Arial, sans-serif;
  font-size: 34px;
}

.meter {
  height: 10px;
  margin: 12px 0;
  overflow: hidden;
  background: #dcecf8;
  border-radius: 999px;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #79c7ff, #2f80c9);
  border-radius: inherit;
  transition: width 500ms ease;
}

.health-card p,
.legend-card p,
.scaffold-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.legend-card h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 17px;
}

.legend-items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.legend-items span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #435d74;
  font-size: 13px;
}

.legend-items i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.legend-items .blue,
.mark.blue {
  background: var(--blue-soft);
  border-color: #91caf2;
}

.legend-items .yellow,
.mark.yellow {
  background: var(--yellow-soft);
  border-color: #f0cf5f;
}

.legend-items .green,
.mark.green {
  background: var(--green-soft);
  border-color: #8dd8ae;
}

.term {
  position: relative;
  color: var(--blue-dark);
  border-bottom: 1px dashed currentColor;
  cursor: help;
}

.term::after {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: none;
  width: 220px;
  padding: 10px 12px;
  color: #fff;
  background: var(--ink);
  border-radius: 10px;
  content: attr(data-tip);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 12px 28px rgba(16, 47, 79, 0.22);
}

.term:hover::after {
  display: block;
}

.agent-output {
  min-height: 250px;
  max-height: 520px;
  overflow: auto;
  color: var(--text);
  font-size: 15px;
  line-height: 1.78;
}

.report-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  background: #edf6ff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.report-tabs button {
  padding: 10px 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
}

.report-tabs button.active {
  color: var(--blue-dark);
  background: #fff;
  box-shadow: 0 8px 18px rgba(47, 128, 201, 0.1);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.structure-bars {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.structure-bars div {
  display: grid;
  grid-template-columns: 92px 44px 1fr;
  gap: 10px;
  align-items: center;
  color: var(--text);
  font-size: 14px;
}

.structure-bars strong {
  color: var(--blue-dark);
  font-family: Arial, sans-serif;
  font-size: 13px;
}

.structure-bars i {
  height: 8px;
  overflow: hidden;
  background: #edf3f8;
  border-radius: 999px;
}

.structure-bars i::before {
  display: block;
  width: var(--w);
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
  content: "";
}

.structure-bars .warn i::before {
  background: #d6a900;
}

.structure-bars .danger i::before {
  background: #d96c52;
}

.sentence-cards {
  display: grid;
  gap: 10px;
}

.sentence-cards article {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.sentence-cards span {
  display: block;
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.sentence-cards p {
  margin: 0;
}

.agent-output h4 {
  margin: 18px 0 8px;
  color: var(--ink);
  font-size: 17px;
}

.agent-output p {
  margin: 0 0 12px;
}

.agent-output ul {
  margin: 8px 0 14px;
  padding-left: 22px;
}

.agent-output.loading {
  background:
    linear-gradient(90deg, rgba(47, 128, 201, 0.04), rgba(47, 128, 201, 0.13), rgba(47, 128, 201, 0.04)),
    #fbfdff;
  background-size: 240% 100%;
  animation: shimmer 1.2s infinite linear;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -100% 0;
  }
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(18px, 4vw, 56px);
  color: #d7ebfb;
  background: var(--blue-dark);
}

.footer p {
  margin: 0;
  line-height: 1.6;
}

.about-dialog {
  width: min(620px, calc(100vw - 32px));
  padding: 28px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.about-dialog::backdrop {
  background: rgba(15, 47, 79, 0.28);
  backdrop-filter: blur(4px);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: var(--soft);
  border: 0;
  border-radius: 999px;
  font-size: 22px;
}

.about-dialog h2 {
  margin: 0 0 14px;
  color: var(--ink);
}

.about-dialog p {
  color: var(--muted);
  line-height: 1.8;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .feedback-pane {
    position: static;
  }
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    height: auto;
    flex-direction: column;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .nav {
    flex-wrap: wrap;
  }

  .config-row,
  .sample-select-row,
  .legend-items {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 32px;
  }

  .footer {
    display: grid;
  }
}
