:root {
  color-scheme: light;
  --ink: #171918;
  --muted: #686d69;
  --line: #d9ddda;
  --surface: #ffffff;
  --page: #f4f6f4;
  --green: #176b52;
  --green-soft: #eef8f4;
  --blue: #246b91;
  --blue-soft: #eef6fa;
  --red: #b9362a;
  --red-soft: #fff1ef;
  --amber: #825b13;
  --amber-soft: #fff8e8;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

header {
  min-height: 84px;
  padding: 18px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 25px; font-weight: 650; }
h2 { margin-bottom: 7px; font-size: 18px; }
h3 { margin: 0; font-size: 15px; }
p { color: var(--muted); }
.title-block { min-width: 0; }
.header-funding { margin: 6px 0 0; font-size: 12px; font-weight: 700; line-height: 1.5; }

main { width: min(1240px, calc(100% - 40px)); margin: 26px auto 56px; }

.control-panel {
  padding: 24px 0 28px;
  border-bottom: 1px solid var(--line);
}

form { min-width: 0; }
.mode-switch {
  display: inline-flex;
  padding: 3px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ecefed;
}
.mode-button {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.mode-button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.single-fields {
  display: grid;
  grid-template-columns: .72fr 1fr 1fr .7fr .7fr;
  gap: 10px;
}
label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
input, textarea {
  width: 100%;
  border: 1px solid #b8beba;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input { height: 42px; padding: 0 10px; }
textarea {
  min-height: 148px;
  padding: 11px 12px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
  overflow: auto;
}
input:focus, textarea:focus { outline: 2px solid rgba(23, 107, 82, .18); border-color: var(--green); }
.batch-fields > label { margin-bottom: 7px; }
.batch-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #ecefed;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.batch-fields textarea { border-radius: 0 0 4px 4px; }

.input-guidance {
  margin-top: 14px;
  padding: 10px 14px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  color: #244b60;
  font-size: 12px;
  line-height: 1.65;
}
.input-guidance strong { display: block; margin-bottom: 3px; font-size: 13px; }
.input-guidance ol { margin: 0; padding-left: 20px; }
.input-guidance li { padding-left: 2px; }

.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 14px; }
.input-count { margin-right: auto; color: var(--muted); font-size: 12px; }
#submit-button {
  height: 42px;
  padding: 0 20px;
  border: 0;
  border-radius: 4px;
  background: var(--green);
  color: white;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
#submit-button:disabled { opacity: .55; cursor: wait; }

.result-panel { padding-top: 24px; }
.result-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 5px; color: var(--green); font-size: 12px; font-weight: 700; }
.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #a9cfc1;
  border-radius: 4px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  white-space: nowrap;
}
.status.neutral { border-color: var(--line); background: #f5f6f5; color: var(--muted); }
.status.failed { border-color: #e3aca7; background: var(--red-soft); color: var(--red); }
.status.benign { border-color: #a9cfc1; background: var(--green-soft); color: var(--green); }
.status.pathogenic { border-color: #e3aca7; background: var(--red-soft); color: var(--red); }
.status.uncertain { border-color: #e1ca96; background: var(--amber-soft); color: var(--amber); }

.empty-state {
  min-height: 64px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.running-state {
  min-height: 104px;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
}
.running-state p { margin-bottom: 0; font-size: 13px; }
.progress { width: min(360px, 72vw); height: 4px; overflow: hidden; background: #dfe4e1; }
.progress span { display: block; width: 42%; height: 100%; background: var(--green); animation: move 1.3s ease-in-out infinite alternate; }
@keyframes move { from { transform: translateX(-100%); } to { transform: translateX(240%); } }

.completed-state { display: grid; gap: 14px; margin-top: 18px; }
.variant-result { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); overflow: hidden; }
.variant-result-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.variant-result-body { padding: 16px; }
.result-step + .result-step { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.step-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.step-title { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; }
.step-index { display: inline-grid; width: 23px; height: 23px; place-items: center; border-radius: 50%; background: #e3e8e5; color: #3f4843; font-size: 12px; }
.step-progress { margin: 14px auto 4px; }
.result-message { margin: 0 0 14px; padding: 10px 12px; border-left: 3px solid var(--blue); background: var(--blue-soft); color: #244b60; font-size: 13px; }
.result-message.benign { border-color: var(--green); background: var(--green-soft); color: #18543f; }
.result-message.pathogenic { border-color: var(--red); background: var(--red-soft); color: #7b2a23; }
.result-message.failed { border-color: var(--red); background: var(--red-soft); color: #7b2a23; white-space: pre-wrap; }
.details-wrap { overflow-x: auto; }
.details-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.details-table th, .details-table td { padding: 8px 10px; border-bottom: 1px solid #e8ebe9; text-align: left; vertical-align: top; }
.details-table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.details-table td { overflow-wrap: anywhere; }
.score-row { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 14px 0 0; font-size: 13px; }
.score-row strong { font-weight: 700; }
.property-scores { margin: 10px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.result-image { display: block; width: min(100%, 920px); height: auto; margin: 18px auto; background: white; }
.downloads { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.downloads a { padding: 8px 13px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); text-decoration: none; background: white; font-size: 13px; }
pre { max-height: 320px; overflow: auto; padding: 16px; border-left: 3px solid var(--red); background: #fff; color: #5a1c17; white-space: pre-wrap; }

@media (max-width: 940px) {
  main { width: min(100% - 28px, 760px); margin-top: 18px; }
  .single-fields { grid-template-columns: 1fr 1fr; }
  .single-fields label:first-child { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  header { min-height: 72px; padding: 14px 16px; }
  header .status { display: none; }
  h1 { font-size: 20px; }
  .header-funding { max-width: 330px; font-size: 11px; }
  .single-fields { grid-template-columns: 1fr; }
  .single-fields label:first-child { grid-column: auto; }
  .batch-columns { display: none; }
  .batch-fields textarea { border-radius: 4px; }
  .result-header, .variant-result-header { align-items: flex-start; }
  .variant-result-header { padding: 12px; }
  .variant-result-body { padding: 12px; }
}
