:root {
  --surface: #f4f2ec;
  --surface-quiet: #ebe8de;
  --panel: #fffef9;
  --panel-soft: #f8f7f1;
  --ink: #17211f;
  --ink-soft: #32413d;
  --muted: #69736f;
  --line: #dedbd0;
  --line-strong: #b8b3a4;
  --green: #0d5b50;
  --green-deep: #083f38;
  --green-soft: #e8f1ec;
  --slate: #3e5962;
  --slate-soft: #edf2f2;
  --amber: #8a5d16;
  --amber-soft: #f6edda;
  --red: #9a3832;
  --shadow-soft: 0 14px 32px rgba(23, 33, 31, 0.07);
  --shadow-tight: 0 8px 18px rgba(23, 33, 31, 0.05);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  color: var(--ink);
  font-family: "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(13, 91, 80, 0.22);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 378px) minmax(0, 1fr);
  min-height: 100vh;
}

.search-pane {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(255, 254, 249, 0.98);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.app-header h1,
.detail-header h2 {
  margin: 0;
  font-family: "Source Han Serif SC", "Songti SC", "STSong", serif;
  font-weight: 850;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: 25px;
  line-height: 1.16;
}

.danger {
  color: var(--red) !important;
}

.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--green-deep);
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
}

.icon-button:hover {
  border-color: rgba(13, 91, 80, 0.35);
  background: var(--green-soft);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-quiet);
  padding: 4px;
}

.mode-button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.mode-button.active {
  background: var(--panel);
  color: var(--green-deep);
  box-shadow: var(--shadow-tight);
}

.mode-panel {
  display: grid;
  gap: 10px;
}

.search-box {
  display: grid;
  gap: 7px;
}

.search-box span,
.case-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.search-box input,
.case-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

.search-box input {
  min-height: 42px;
  padding: 9px 11px;
}

.case-box {
  display: grid;
  gap: 7px;
}

.case-box textarea {
  min-height: 138px;
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.6;
}

.search-box input:focus,
.case-box textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(13, 91, 80, 0.12);
}

.case-actions {
  display: flex;
  justify-content: flex-end;
}

.primary-button {
  min-height: 38px;
  border: 1px solid rgba(13, 91, 80, 0.28);
  border-radius: 8px;
  background: var(--green-deep);
  color: #fffef9;
  cursor: pointer;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 900;
}

.primary-button:hover {
  background: var(--green);
}

.case-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.case-examples button {
  border: 1px solid rgba(62, 89, 98, 0.2);
  border-radius: 999px;
  background: var(--slate-soft);
  color: var(--slate);
  cursor: pointer;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
}

.case-examples button:hover {
  border-color: rgba(13, 91, 80, 0.34);
  background: var(--green-soft);
  color: var(--green-deep);
}

.result-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  min-height: 18px;
}

.results-list {
  flex: 1 1 auto;
  min-height: 0;
  list-style: none;
  margin: 0 -5px 0 0;
  padding: 0 5px 0 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
}

.result-button {
  width: 100%;
  border: 1px solid rgba(222, 219, 208, 0.92);
  border-radius: 8px;
  background: rgba(255, 254, 249, 0.82);
  color: var(--ink);
  cursor: pointer;
  padding: 11px 12px;
  text-align: left;
  display: grid;
  gap: 6px;
}

.result-button:hover {
  border-color: rgba(13, 91, 80, 0.28);
  background: #fffdf6;
}

.result-button.active {
  border-color: rgba(13, 91, 80, 0.58);
  background: #edf4ef;
  box-shadow: inset 4px 0 0 var(--green);
}

.case-result-separator {
  margin: 6px 2px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.case-result-button.secondary {
  border-color: rgba(222, 219, 208, 0.72);
  background: rgba(255, 254, 249, 0.58);
  padding: 9px 10px;
}

.case-result-button.secondary .result-name {
  color: var(--ink-soft);
  font-size: 13px;
}

.case-result-button.secondary .case-score {
  background: var(--slate);
}

.result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.result-name {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}

.result-gene,
.result-summary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.result-gene {
  color: var(--slate);
  font-weight: 850;
  overflow-wrap: anywhere;
}

.result-summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.result-tags em {
  border: 1px solid rgba(62, 89, 98, 0.18);
  border-radius: 999px;
  background: var(--slate-soft);
  color: var(--slate);
  padding: 3px 7px;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.result-tags .tag-kidney {
  border-color: rgba(13, 91, 80, 0.2);
  background: var(--green-soft);
  color: var(--green-deep);
}

.result-tags .tag-caution {
  border-color: rgba(138, 93, 22, 0.24);
  background: var(--amber-soft);
  color: #684819;
}

.result-tags .tag-quiet {
  border-color: rgba(105, 115, 111, 0.18);
  background: #f1f0eb;
  color: #59635f;
}

.result-tags .tag-diagnostic {
  border-color: rgba(62, 89, 98, 0.18);
  background: var(--slate-soft);
  color: var(--slate);
}

.case-result-button .result-head {
  align-items: center;
}

.result-action {
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 900;
}

.case-score {
  min-width: 34px;
  border-radius: 999px;
  background: var(--green-deep);
  color: #fffef9;
  padding: 3px 7px;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.detail-pane {
  min-width: 0;
  height: 100vh;
  overflow: auto;
  padding: 28px 30px 36px;
}

.empty-state {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
}

.empty-state:not(:empty) {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 254, 249, 0.5);
}

.disease-detail {
  display: grid;
  gap: 18px;
  max-width: 1120px;
  margin: 0 auto;
}

.case-match-detail {
  display: grid;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
}

.detail-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.detail-header h2 {
  font-size: 31px;
  line-height: 1.18;
}

.case-summary,
.case-questions,
.case-candidates {
  display: grid;
  gap: 10px;
}

.case-trigger-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  border: 1px solid rgba(13, 91, 80, 0.18);
  border-left: 4px solid var(--green-deep);
  border-radius: 8px;
  background: rgba(255, 254, 249, 0.96);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.case-summary.insufficient .case-trigger-card,
.case-summary.empty .case-trigger-card {
  border-left-color: var(--amber);
  background: #fffaf0;
}

.case-summary.suggestive .case-trigger-card {
  background: #eef5ef;
}

.case-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.case-trigger-card h3,
.case-trigger-card p {
  margin: 0;
}

.case-trigger-card h3 {
  margin-top: 4px;
  color: var(--green-deep);
  font-size: 20px;
  line-height: 1.35;
}

.case-summary.insufficient .case-trigger-card h3,
.case-summary.empty .case-trigger-card h3 {
  color: #684819;
}

.case-trigger-card p {
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.case-trigger-card > strong {
  min-width: 44px;
  border-radius: 8px;
  background: var(--green-deep);
  color: #fffef9;
  padding: 8px 9px;
  text-align: center;
  font-size: 19px;
}

.case-summary.insufficient .case-trigger-card > strong,
.case-summary.empty .case-trigger-card > strong {
  background: var(--amber);
}

.case-feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.case-feature-row em {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(62, 89, 98, 0.18);
  border-radius: 999px;
  background: var(--slate-soft);
  color: var(--slate);
  padding: 4px 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.case-feature-row em.normalized {
  border-style: dashed;
}

.case-feature-row em span {
  max-width: 128px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-feature-row .tag-kidney {
  border-color: rgba(13, 91, 80, 0.2);
  background: var(--green-soft);
  color: var(--green-deep);
}

.case-feature-row .tag-caution {
  border-color: rgba(138, 93, 22, 0.24);
  background: var(--amber-soft);
  color: #684819;
}

.case-block,
.candidate-card {
  border: 1px solid rgba(222, 219, 208, 0.9);
  border-radius: 8px;
  background: rgba(255, 254, 249, 0.9);
  padding: 14px 15px;
}

.case-block.muted {
  border-style: dashed;
  color: var(--muted);
  background: rgba(255, 254, 249, 0.55);
}

.case-block h3,
.case-candidate-grid h3 {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 900;
}

.case-block p {
  margin: 0;
  font-size: 14px;
  line-height: 1.72;
}

.case-block ol {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 9px;
}

.case-block li strong,
.case-block li span {
  display: block;
}

.case-block li strong {
  color: var(--ink);
  font-size: 14px;
}

.case-block li span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.case-candidate-grid {
  display: grid;
  gap: 10px;
}

.case-candidate-grid.secondary-candidates {
  margin-top: 4px;
  gap: 8px;
}

.case-candidate-grid.secondary-candidates h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.candidate-card {
  display: grid;
  gap: 12px;
}

.candidate-card.clickable {
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.candidate-card.clickable:hover,
.candidate-card.clickable:focus-visible {
  border-color: rgba(13, 91, 80, 0.34);
  background: #fffdf6;
  box-shadow: var(--shadow-soft);
  outline: none;
  transform: translateY(-1px);
}

.candidate-card.active {
  border-color: rgba(13, 91, 80, 0.58);
  background: #edf4ef;
  box-shadow: inset 4px 0 0 var(--green);
}

.candidate-card.secondary {
  gap: 9px;
  border-color: rgba(222, 219, 208, 0.72);
  background: rgba(255, 254, 249, 0.62);
  padding: 12px 13px;
}

.candidate-card.secondary:hover,
.candidate-card.secondary:focus-visible {
  background: rgba(255, 253, 246, 0.92);
}

.candidate-card header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.candidate-card header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.candidate-card h4 {
  margin: 3px 0 0;
  color: var(--green-deep);
  font-size: 20px;
  line-height: 1.3;
}

.candidate-card.secondary h4 {
  color: var(--ink);
  font-size: 16px;
}

.candidate-card-action {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.candidate-card-action strong {
  min-width: 42px;
  border-radius: 8px;
  background: var(--green-deep);
  color: #fffef9;
  padding: 7px 8px;
  text-align: center;
  font-size: 18px;
}

.candidate-card.secondary .candidate-card-action strong {
  min-width: 36px;
  background: var(--slate);
  padding: 5px 7px;
  font-size: 14px;
}

.candidate-card-action span {
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 900;
}

.candidate-card.secondary .candidate-card-action span {
  color: var(--slate);
  font-size: 11px;
}

.candidate-card > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.72;
}

.candidate-card.secondary > p {
  font-size: 13px;
  line-height: 1.58;
}

.detail-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.detail-context span {
  border: 1px solid rgba(13, 91, 80, 0.18);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-deep);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 850;
}

.detail-context button {
  border: 1px solid rgba(62, 89, 98, 0.18);
  border-radius: 999px;
  background: var(--panel);
  color: var(--slate);
  cursor: pointer;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 850;
}

.detail-context button:hover {
  border-color: rgba(13, 91, 80, 0.3);
  color: var(--green-deep);
}

.candidate-list {
  display: grid;
  gap: 5px;
}

.candidate-list > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.candidate-list ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.candidate-list li {
  border: 1px solid rgba(62, 89, 98, 0.18);
  border-radius: 999px;
  background: var(--slate-soft);
  color: var(--slate);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
}

.candidate-list.caution li {
  border-color: rgba(138, 93, 22, 0.24);
  background: var(--amber-soft);
  color: #684819;
}

.quick-band {
  border: 1px solid rgba(13, 91, 80, 0.18);
  border-top: 4px solid var(--green-deep);
  border-radius: 8px;
  background: rgba(255, 254, 249, 0.96);
  box-shadow: var(--shadow-soft);
  padding: 15px 16px 16px;
}

.quick-band-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(13, 91, 80, 0.15);
  padding-bottom: 10px;
}

.quick-band h3 {
  margin: 0;
  color: var(--green-deep);
  font-size: 17px;
  line-height: 1.3;
}

.quick-band-header span {
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}

.quick-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 0;
}

.quick-card {
  min-width: 0;
  border: 1px solid rgba(222, 219, 208, 0.85);
  border-radius: 8px;
  background: rgba(248, 247, 241, 0.78);
  padding: 12px 13px;
}

.quick-card.primary {
  grid-column: 1 / -1;
  border-color: rgba(13, 91, 80, 0.2);
  background: #eef5ef;
}

.quick-card.clinical {
  background: #fffdf6;
}

.quick-card.diagnostic {
  background: #f4f7f6;
}

.quick-card.treatment {
  border-left: 3px solid rgba(138, 93, 22, 0.56);
  background: #fffaf0;
}

.quick-card h4,
.quick-card p {
  margin: 0;
}

.quick-card h4 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.quick-card-body {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-card-text {
  display: block;
}

.quick-card p {
  color: #1d2825;
  font-size: 14px;
  font-weight: 580;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.quick-card.primary p {
  font-size: 15px;
  font-weight: 720;
}

.quick-chip,
.quick-muted {
  border: 1px solid rgba(62, 89, 98, 0.18);
  border-radius: 999px;
  background: rgba(255, 254, 249, 0.92);
  color: var(--slate);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
}

.quick-muted {
  border-color: rgba(105, 115, 111, 0.18);
  color: var(--muted);
  background: #f1f0eb;
}

.sections-grid {
  display: grid;
  gap: 7px;
}

.sections-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.sections-header h3 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 900;
}

.sections-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.section-block {
  border: 1px solid rgba(222, 219, 208, 0.9);
  border-radius: 8px;
  background: rgba(255, 254, 249, 0.88);
  overflow: hidden;
}

.section-block summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 14px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}

.section-block summary::-webkit-details-marker {
  display: none;
}

.section-block summary::before {
  content: "+";
  color: var(--green-deep);
  flex: 0 0 auto;
  font-weight: 900;
}

.section-block[open] summary::before {
  content: "-";
}

.section-block summary span {
  flex: 1 1 auto;
}

.section-body {
  border-top: 1px solid var(--line);
  padding: 14px 15px 16px;
}

.section-body p {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.78;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.section-body p + p {
  margin-top: 10px;
}

@media (max-width: 940px) {
  .app-shell {
    display: block;
  }

  .search-pane {
    position: relative;
    height: auto;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 18px 16px 14px;
  }

  .results-list {
    max-height: 34vh;
  }

  .detail-pane {
    height: auto;
    min-height: 60vh;
    overflow: visible;
    padding: 20px 16px 30px;
  }

  .disease-detail {
    gap: 15px;
  }

  .case-match-detail {
    gap: 14px;
  }

  .detail-header h2 {
    font-size: 27px;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 14px;
  }

  .app-header h1 {
    font-size: 23px;
  }

  .quick-facts {
    grid-template-columns: 1fr;
  }

  .case-trigger-card,
  .candidate-card header {
    grid-template-columns: 1fr;
  }

  .case-trigger-card > strong,
  .candidate-card-action {
    justify-self: start;
    justify-items: start;
  }

  .case-box textarea {
    min-height: 120px;
  }

  .quick-card.primary {
    grid-column: auto;
  }

  .detail-header {
    display: grid;
  }

  .quick-band {
    padding: 13px;
  }

  .quick-card p,
  .section-body p {
    font-size: 14px;
  }
}
