:root {
  --bg: #130607;
  --bg-panel: rgba(34, 10, 12, 0.82);
  --bg-panel-strong: rgba(47, 13, 16, 0.94);
  --bg-panel-soft: rgba(66, 18, 22, 0.58);
  --line: rgba(255, 214, 206, 0.12);
  --line-strong: rgba(255, 214, 206, 0.24);
  --text: #ffeae5;
  --muted: #d8b7af;
  --accent: #ff8f7a;
  --accent-deep: #7e1f28;
  --accent-hot: #ffb08a;
  --accent-gold: #ffc28a;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --heading-font: "Aptos Display", "Segoe UI Variable Display", "Trebuchet MS", sans-serif;
  --body-font: "Aptos", "Bahnschrift", "Gill Sans", sans-serif;
  --mono-font: "Consolas", "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body-font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(198, 63, 48, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 18%, rgba(255, 122, 88, 0.14), transparent 20rem),
    linear-gradient(145deg, #160708 0%, #1a090a 34%, #120505 100%);
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: -8rem;
  right: -6rem;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 126, 94, 0.12) 0%, rgba(255, 126, 94, 0) 70%);
  filter: blur(8px);
}

body::after {
  bottom: -10rem;
  left: -6rem;
  width: 26rem;
  height: 26rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(148, 24, 31, 0.22) 0%, rgba(148, 24, 31, 0) 70%);
  filter: blur(10px);
}

.site-shell {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.4rem 0 2rem;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 22%),
    linear-gradient(150deg, var(--bg-panel) 0%, var(--bg-panel-strong) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  padding: 2rem;
  display: grid;
  gap: 1.5rem;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent, rgba(255, 166, 140, 0.05), transparent),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 7.5rem,
      rgba(255, 214, 206, 0.03) 7.5rem,
      rgba(255, 214, 206, 0.03) 7.56rem
    );
  opacity: 0.7;
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.eyebrow,
.kicker {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-hot);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--heading-font);
  font-weight: 700;
  line-height: 1.05;
}

h1 {
  # max-width: 16ch;
  font-size: clamp(2.2rem, 5vw, 4.45rem);
}

h2 {
  font-size: clamp(1.45rem, 2vw, 2rem);
}

h3 {
  font-size: 1.05rem;
}

.hero-text,
.section-copy,
.sample-copy,
.run-narrative,
.note-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.section-warning {
  margin: 0.55rem 0 0;
  color: var(--accent-gold);
}

.hero-text {
  # max-width: 70ch;
  margin-top: 1rem;
}

.attribution-card {
  margin-top: 1.25rem;
  margin-left: 2.25rem;
  margin-right: 2.25rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(145, 145, 145, 0.18);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 0;
  flex-shrink: 0;
}

.metric-card,
.status-pill,
.condition-card,
.note-card,
.sample-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.metric-card {
  padding: 1rem 1.05rem;
}

.metric-label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-value {
  display: block;
  margin-top: 0.4rem;
  font-size: 1.35rem;
  color: var(--text);
}

.metric-wide {
  font-size: 1rem;
}

.single-panel-layout {
  margin-top: 1.25rem;
}

.part3-prep-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 1rem;
}

.part3-pane-stack {
  display: grid;
  gap: 1rem;
}

.run-layout {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.assignment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 1rem;
}

.unknown-controls-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
  margin-bottom: 1rem;
}

.unknown-identification-layout {
  margin-top: 1rem;
}

.unknown-check {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.unknown-check input {
  accent-color: var(--accent);
}

.controls-panel {
  padding: 1.4rem;
  width: 100%;
}

.run-panel {
  padding: 1.4rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.section-heading .section-copy {
  max-width: 42ch;
}

.controls-form,
.sample-fieldset,
.condition-fieldset {
  display: grid;
  gap: 1.2rem;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 0.9rem;
  font-family: var(--heading-font);
  font-size: 1rem;
  color: var(--accent-hot);
}

.sample-grid,
.condition-grid {
  display: grid;
  gap: 0.95rem;
}

.sample-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.part3-standard-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sample-action-row {
  margin-top: 1rem;
}

.condition-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.part3-condition-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.condition-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
}

.summary-card {
  padding: 1rem;
}

.sample-card,
.condition-card,
.note-card,
.solution-panel {
  padding: 1rem;
}

.sample-card {
  display: grid;
  gap: 0.75rem;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.standard-card {
  cursor: pointer;
}

.sample-card[data-active="true"] {
  border-color: rgba(255, 164, 132, 0.36);
  background:
    linear-gradient(180deg, rgba(255, 166, 140, 0.08), rgba(255, 255, 255, 0.018)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  transform: translateY(-2px);
}

.sample-card[data-active="false"] {
  opacity: 0.68;
}

.sample-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.sample-select {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  color: var(--text);
}

.sample-select input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.formula-chip {
  padding: 0.38rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--accent-gold);
  background: rgba(255, 194, 138, 0.08);
  border: 1px solid rgba(255, 194, 138, 0.18);
  font-family: var(--mono-font);
}

.range-label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}

.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.range-output {
  min-width: 6.6rem;
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.trace-tip,
.inspector-feedback,
.reference-readout {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

select,
input[type="number"],
input[type="text"] {
  width: 100%;
  padding: 0.82rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
}

.volume-select {
  margin-top: 0.35rem;
}

select:disabled,
input[type="number"]:disabled,
input[type="text"]:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.peak-inspector-card {
  display: grid;
  gap: 0.85rem;
}

.inspector-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.peak-badge,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.peak-badge {
  background: rgba(255, 176, 138, 0.08);
  border: 1px solid rgba(255, 176, 138, 0.2);
  color: var(--accent-hot);
}

.inspector-meta strong {
  color: var(--text);
}

.reference-readout {
  margin-top: 0.6rem;
  font-family: var(--mono-font);
  color: var(--accent-gold);
}

.gate-card[data-ready="true"] {
  border-color: rgba(255, 186, 128, 0.36);
  background:
    linear-gradient(180deg, rgba(255, 194, 138, 0.08), rgba(255, 255, 255, 0.018)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
}

.analysis-row {
  cursor: pointer;
}

.analysis-row.is-selected {
  background: rgba(255, 166, 140, 0.08);
}

.analysis-row.is-complete {
  background: rgba(255, 194, 138, 0.05);
}

.status-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.status-chip.status-ready {
  color: #ffe7c8;
  border-color: rgba(255, 194, 138, 0.28);
  background: rgba(255, 194, 138, 0.12);
}

.status-chip.status-error {
  color: #ffb2a7;
  border-color: rgba(255, 130, 122, 0.28);
  background: rgba(255, 130, 122, 0.1);
}

.status-chip.status-pending {
  color: var(--muted);
}

.action-row {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.solution-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
}

.solution-heading {
  margin-bottom: 0.9rem;
}

.solution-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.solution-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(255, 214, 206, 0.08);
}

.solution-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.solution-list strong,
.solution-total {
  color: var(--text);
}

.solution-total,
.solution-feedback {
  margin: 0.9rem 0 0;
}

.solution-total {
  font-family: var(--mono-font);
}

.solution-feedback {
  color: var(--muted);
  line-height: 1.5;
}

.solution-feedback[data-state="ready"] {
  color: #ffe7c8;
}

.solution-feedback[data-state="error"] {
  color: #ffb2a7;
}

.inspector-feedback[data-state="ready"] {
  color: #ffe7c8;
}

.inspector-feedback[data-state="error"] {
  color: #ffb2a7;
}

.pending-total-card[data-over-limit="true"] {
  border-color: rgba(255, 130, 122, 0.3);
  background:
    linear-gradient(180deg, rgba(255, 130, 122, 0.12), rgba(255, 255, 255, 0.018)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
}

.pending-total-card[data-over-limit="true"] .metric-value {
  color: #ffbdb1;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.92rem 1.2rem;
  font: inherit;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

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

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.primary-button {
  color: #200909;
  background: linear-gradient(135deg, var(--accent-hot), var(--accent));
  box-shadow: 0 14px 28px rgba(255, 132, 104, 0.24);
  font-weight: 700;
}

.secondary-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.status-strip {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.status-pill {
  padding: 0.82rem 1rem;
  min-width: 8rem;
}

.status-pill span {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.status-pill strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1rem;
}

.plot-frame {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(255, 214, 206, 0.16);
  background:
    radial-gradient(circle at top, rgba(255, 143, 122, 0.08), transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, rgba(31, 9, 11, 0.98), rgba(19, 6, 7, 0.98));
  min-height: 420px;
}

#chromatogram,
#unknownChromatogram,
#part3Chromatogram {
  display: block;
  width: 100%;
  height: auto;
  min-height: 420px;
}

.plot-corners {
  position: absolute;
  inset: 0;
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: end;
  pointer-events: none;
  color: rgba(255, 234, 229, 0.58);
  font-size: 0.82rem;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.9rem;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.legend-swatch {
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  display: inline-block;
}

.legend-air {
  background: #ffd9b6;
}

.legend-methanol {
  background: #ffbb7f;
}

.legend-alcohol {
  background: linear-gradient(135deg, #ff9468, #ff6464);
}

.run-narrative {
  margin-top: 1rem;
}

.trace-tip {
  margin-top: 0.9rem;
}

.data-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 1rem;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.85rem 1rem;
  text-align: left;
  white-space: nowrap;
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-hot);
  border-bottom: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.025);
}

td {
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.role-tag {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.78rem;
}

.note-stack {
  display: grid;
  gap: 1rem;
}

.mix-breakdown {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.mix-breakdown li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
}

.mix-breakdown strong {
  color: var(--text);
}

.trace-surface {
  fill: transparent;
}

.trace-grid {
  stroke: rgba(255, 234, 229, 0.09);
  stroke-width: 1;
}

.trace-axis {
  stroke: rgba(255, 234, 229, 0.18);
  stroke-width: 1.2;
}

.trace-axis-label,
.trace-tick-label {
  fill: rgba(255, 234, 229, 0.62);
  font-size: 12px;
  font-family: var(--body-font);
}

.trace-area {
  fill: url(#traceFill);
  opacity: 0;
  animation: area-fade 650ms ease forwards 220ms;
}

.trace-line {
  fill: none;
  stroke: #ffe7db;
  stroke-width: 3.1;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 12px rgba(255, 180, 152, 0.22));
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: trace-draw 1600ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.trace-marker {
  stroke-width: 1.2;
  stroke-dasharray: 4 5;
  opacity: 0.9;
}

.trace-peak-dot {
  stroke: rgba(0, 0, 0, 0.25);
  stroke-width: 1.5;
}

.trace-label {
  font-size: 12px;
  font-family: var(--body-font);
  letter-spacing: 0.02em;
}

.trace-integral-value {
  font-size: 10px;
  fill: rgba(255, 240, 222, 0.88);
}

.trace-group-analyte {
  cursor: pointer;
}

.table-select {
  min-width: 11.5rem;
}

.series-meta {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.series-row.is-deleted td:not(.series-action-cell) {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.series-row.is-deleted .series-meta,
.series-row.is-deleted strong {
  color: inherit;
}

.series-action-cell {
  width: 5rem;
  text-align: center;
}

.series-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 206, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #ffbdb1;
  box-shadow: none;
}

.series-action-button:hover:not(:disabled) {
  background: rgba(255, 130, 122, 0.12);
  border-color: rgba(255, 130, 122, 0.28);
}

.series-action-button:disabled {
  opacity: 0.45;
}

.series-action-icon {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.part3-analysis-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 1rem;
  margin-top: 1rem;
}

.part3-analysis-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
}

.empty-row td {
  text-align: center;
  color: var(--muted);
}

.part3-method-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.trace-hit-area {
  fill: transparent;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: all;
}

.trace-group-analyte .trace-label {
  fill: rgba(255, 240, 222, 0.95);
}

.trace-group-analyte.is-selected .trace-marker,
.trace-group-analyte.is-selected .trace-peak-dot {
  stroke: #fff0c8;
  stroke-width: 2.2;
}

.trace-group-analyte.is-complete .trace-marker {
  stroke-dasharray: none;
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  animation: panel-rise 720ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.reveal-delay-1 {
  animation-delay: 120ms;
}

.reveal-delay-2 {
  animation-delay: 240ms;
}

.reveal-delay-3 {
  animation-delay: 360ms;
}

@keyframes panel-rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes trace-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes area-fade {
  to {
    opacity: 0.92;
  }
}

@media (max-width: 1080px) {
  .condition-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .condition-summary-grid {
    grid-template-columns: 1fr;
  }

  .assignment-layout {
    grid-template-columns: 1fr;
  }

  .part3-prep-layout {
    grid-template-columns: 1fr;
  }

  .part3-analysis-layout {
    grid-template-columns: 1fr;
  }

  .part3-standard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .unknown-controls-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .site-shell {
    width: min(100% - 1rem, 1280px);
    padding-top: 0.6rem;
  }

  .hero,
  .controls-panel,
  .run-panel {
    padding: 1.1rem;
    border-radius: 22px;
  }

  .sample-grid,
  .condition-grid {
    grid-template-columns: 1fr;
  }

  .part3-standard-grid,
  .part3-condition-grid {
    grid-template-columns: 1fr;
  }

  .part3-analysis-row {
    grid-template-columns: 1fr;
  }

  .action-row,
  .status-strip {
    flex-direction: column;
  }

  .range-row {
    grid-template-columns: 1fr;
  }

  .range-output {
    min-width: 0;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
