:root {
  --ink: #172433;
  --muted: #627082;
  --line: #d7dde5;
  --canvas: #f4f6f8;
  --surface: #ffffff;
  --teal: #087e8b;
  --teal-dark: #05606b;
  --coral: #c95d3b;
  --gold: #a17316;
  --success: #1a8754;
  --danger: #b44545;
  --shadow: 0 10px 28px rgba(23, 36, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

.prompt-topbar {
  display: block;
}

.prompt-library {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.prompt-loading {
  margin: 0;
  color: var(--muted);
}

.prompt-list {
  display: grid;
  gap: 18px;
}

.prompt-card {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.prompt-card h2 {
  margin: 0;
  font-size: 18px;
}

.prompt-card pre {
  margin: 16px 0 0;
  padding: 14px;
  overflow: auto;
  color: #243746;
  white-space: pre-wrap;
  background: #f2f5f7;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 13px;
  line-height: 1.7;
}

.prompt-copy {
  width: auto;
  min-width: 116px;
  margin-top: 14px;
  padding: 0 14px;
}

@media (max-width: 640px) {
  .topbar {
    padding: 18px 20px;
  }

  .prompt-library {
    padding: 20px 14px 32px;
  }

  .prompt-card {
    padding: 16px;
  }
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p,
dd {
  overflow-wrap: anywhere;
}

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

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.25;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.35;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 20px max(48px, calc((100vw - 1440px) / 2));
  color: #ffffff;
  background: #172433;
}

.eyebrow,
.section-label {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.eyebrow {
  color: #b9d7dc;
}

.topbar-note {
  margin: 0;
  color: #d8e9ec;
  font-size: 14px;
}

.case-band,
.comparison-band,
.baseline-band {
  padding: 28px max(48px, calc((100vw - 1440px) / 2));
}

.case-band {
  display: grid;
  grid-template-columns: minmax(420px, 1.2fr) minmax(460px, 1fr);
  gap: 48px;
  background: #e5eff1;
  border-bottom: 1px solid #cbdde0;
}

.case-band .section-label {
  color: var(--teal-dark);
}

.course-matrix-band {
  padding: 28px max(48px, calc((100vw - 1440px) / 2)) 32px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.matrix-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  max-width: 1344px;
  margin: 0 auto 18px;
}

.matrix-header h2 {
  margin-bottom: 6px;
}

.matrix-header p:last-child {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
}

.matrix-action,
.matrix-download,
.matrix-open {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.matrix-action {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  color: #ffffff;
  text-decoration: none;
  background: var(--teal);
  border: 1px solid var(--teal);
  border-radius: 4px;
}

.matrix-action:hover {
  background: var(--teal-dark);
}

.matrix-scroll {
  max-width: 1344px;
  margin: 0 auto;
  overflow-x: auto;
}

.course-matrix-table {
  min-width: 1180px;
  overflow: visible;
  background: #ffffff;
  border: 1px solid var(--line);
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.course-matrix-table th,
.course-matrix-table td {
  width: 20%;
  padding: 14px;
  vertical-align: top;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.course-matrix-table tr > :last-child {
  border-right: 0;
}

.course-matrix-table tbody tr:last-child > * {
  border-bottom: 0;
}

.course-matrix-table thead th {
  color: var(--ink);
  background: #e8f1f2;
}

.course-matrix-table tbody th {
  background: #f8fafb;
}

.course-matrix-table strong,
.course-matrix-table small,
.course-matrix-table td span,
.matrix-system-number,
.matrix-pack-number {
  display: block;
}

.course-matrix-table strong {
  margin: 3px 0 5px;
  font-size: 14px;
  line-height: 1.4;
}

.matrix-heading {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.matrix-heading strong {
  flex: 1 1 auto;
  min-width: 0;
}

.matrix-info {
  position: relative;
  z-index: 2;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  padding: 0;
  color: var(--teal-dark);
  font-size: 13px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  background: #ffffff;
  border: 1px solid #8fb7bc;
  border-radius: 50%;
}

.matrix-info:hover,
.matrix-info:focus-visible {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
  outline: 2px solid rgba(8, 126, 139, 0.2);
  outline-offset: 2px;
}

.matrix-tooltip {
  position: absolute;
  z-index: 10;
  top: calc(100% + 10px);
  left: 0;
  width: min(310px, calc(100vw - 32px));
  padding: 12px 13px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.65;
  text-align: left;
  background: #172433;
  border: 1px solid #3d5268;
  border-radius: 4px;
  box-shadow: 0 10px 24px rgba(23, 36, 51, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
  pointer-events: none;
}

/* Floating tips escape the horizontally scrollable matrix on narrow screens. */
.matrix-tooltip.is-floating {
  position: fixed;
  top: var(--tooltip-top, 0px);
  right: auto;
  bottom: auto;
  left: var(--tooltip-left, 0px);
  width: min(310px, calc(100vw - 24px));
}

.course-matrix-table tbody tr:last-child .matrix-tooltip.is-floating {
  top: var(--tooltip-top, 0px);
  right: auto;
  bottom: auto;
  left: var(--tooltip-left, 0px);
  transform: translateY(-4px);
}

.course-matrix-table tbody tr:last-child .matrix-info:hover + .matrix-tooltip.is-floating,
.course-matrix-table tbody tr:last-child .matrix-info:focus-visible + .matrix-tooltip.is-floating {
  transform: translateY(0);
}

.course-matrix-table thead th:last-child .matrix-tooltip.is-floating {
  right: auto;
  left: var(--tooltip-left, 0px);
}

.matrix-info:hover + .matrix-tooltip,
.matrix-info:focus-visible + .matrix-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.course-matrix-table tbody tr:last-child .matrix-tooltip {
  top: auto;
  bottom: calc(100% + 10px);
  transform: translateY(4px);
}

.course-matrix-table tbody tr:last-child .matrix-info:hover + .matrix-tooltip,
.course-matrix-table tbody tr:last-child .matrix-info:focus-visible + .matrix-tooltip {
  transform: translateY(0);
}

.course-matrix-table thead th:last-child .matrix-tooltip {
  right: 0;
  left: auto;
}

.course-matrix-table small,
.course-matrix-table td span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.matrix-system-number,
.matrix-pack-number {
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 700;
}

.matrix-download,
.matrix-open {
  margin-top: 10px;
}

.matrix-fit {
  background: #eff8f3;
}

.matrix-fit strong {
  color: var(--success);
}

.matrix-limit {
  background: #fff8ea;
}

.matrix-limit strong {
  color: var(--gold);
}

.case-copy h2 {
  margin-bottom: 8px;
}

.case-copy p:last-child {
  max-width: 720px;
  margin-bottom: 0;
}

.case-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-bottom: 0;
}

.case-facts div {
  padding-left: 14px;
  border-left: 3px solid var(--teal);
}

dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

dd {
  margin: 0;
}

.lab-layout {
  display: grid;
  grid-template-columns: minmax(270px, 0.8fr) minmax(520px, 1.7fr) minmax(270px, 0.9fr);
  gap: 18px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 48px;
  scroll-margin-top: 18px;
}

.choice-surface,
.result-surface,
.teacher-surface {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.choice-surface,
.result-surface {
  padding: 20px;
}

.choice-surface label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #aab6c4;
  border-radius: 4px;
}

input[type="text"] {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #aab6c4;
  border-radius: 4px;
}

input[type="text"]:disabled {
  color: var(--muted);
  background: #eef2f4;
}

.mode-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.mode-control input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.second-choice-heading {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 17px;
}

.supporting-copy {
  min-height: 64px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.primary-action,
.secondary-action {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-weight: 700;
}

.primary-action {
  color: #ffffff;
  background: var(--teal);
}

.primary-action:hover {
  background: var(--teal-dark);
}

.primary-action:disabled {
  cursor: wait;
  background: #6faab0;
}

.secondary-action {
  color: var(--teal-dark);
  background: #ffffff;
  border-color: var(--teal);
}

.service-status {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.service-status::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  content: "";
  background: var(--gold);
  border-radius: 50%;
}

.service-status.is-configured::before {
  background: var(--success);
}

.result-header,
.evidence-header,
.band-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.readiness-badge,
.count-badge,
.benchmark-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.readiness-badge {
  color: var(--muted);
  background: #edf0f3;
}

.readiness-badge.is-ready,
.comparison-status.is-ready,
.benchmark-status {
  color: var(--success);
  background: #e6f5ed;
}

.readiness-badge.is-incomplete,
.comparison-status.is-incomplete {
  color: var(--gold);
  background: #fbf1dc;
}

.result-explanation {
  margin: 18px 0;
  color: #314151;
}

.evidence-section {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.count-badge {
  color: var(--teal-dark);
  background: #e3f1f2;
}

.evidence-list {
  display: grid;
  gap: 8px;
  margin-top: 13px;
  max-height: 490px;
  overflow: auto;
}

.evidence-item {
  padding: 11px 13px;
  background: #f8fafb;
  border-left: 3px solid var(--coral);
}

.source-span {
  display: block;
  margin-bottom: 5px;
  color: var(--coral);
  font-family: Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

.evidence-item p {
  margin: 0;
  font-size: 13px;
}

.evidence-item .matched-child {
  margin-top: 8px;
  padding-top: 8px;
  color: var(--teal-dark);
  border-top: 1px solid var(--line);
}

.teacher-surface {
  align-self: start;
  overflow: hidden;
}

.tab-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  min-height: 46px;
  color: var(--muted);
  background: #ffffff;
  border: 0;
  border-bottom: 3px solid transparent;
  font-weight: 700;
}

.tab-button.is-active {
  color: var(--teal-dark);
  border-bottom-color: var(--teal);
}

.teacher-content {
  padding: 18px;
}

.teacher-content h2 {
  margin-bottom: 9px;
  font-size: 18px;
}

.teacher-content p {
  color: var(--muted);
}

.method-notes {
  display: grid;
  gap: 16px;
  margin: 20px 0 0;
}

.method-notes div {
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.teacher-content pre {
  max-height: 520px;
  margin: 12px 0 0;
  padding: 12px;
  overflow: auto;
  color: #243746;
  white-space: pre-wrap;
  background: #f2f5f7;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 12px;
  line-height: 1.6;
}

.is-hidden {
  display: none;
}

.comparison-band {
  background: #ffffff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.band-header {
  max-width: 1344px;
  margin: 0 auto 18px;
}

.band-header h2 {
  margin-bottom: 0;
}

.band-header > p {
  max-width: 290px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.method-comparison {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-width: 1344px;
  margin: 0 auto;
}

.comparison-row {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 8px;
  min-height: 174px;
  padding: 15px;
  color: var(--ink);
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: 3px solid #aab6c4;
  border-radius: 4px;
}

.comparison-row:hover,
.comparison-row.is-selected {
  background: #f1f8f8;
  border-color: var(--teal);
  border-top-color: var(--teal);
}

.comparison-status {
  justify-self: start;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 700;
}

.comparison-row > span:not(.comparison-status) {
  font-size: 13px;
}

.comparison-explanation {
  color: var(--muted);
}

.baseline-band {
  max-width: 1440px;
  margin: 0 auto;
}

.benchmark-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.7fr);
  gap: 26px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 12px;
}

.benchmark-bars {
  display: grid;
  align-content: start;
  gap: 11px;
}

.bar-row {
  display: grid;
  grid-template-columns: 118px 1fr 46px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  background: #e5e9ee;
  border-radius: 2px;
}

.bar-fill {
  height: 100%;
  background: var(--teal);
}

.bar-row.is-partial .bar-fill {
  background: var(--coral);
}
