:root {
  --bg: #160708;
  --bg-soft: #231012;
  --panel: rgba(49, 18, 21, 0.9);
  --panel-strong: rgba(67, 21, 25, 0.96);
  --border: rgba(255, 185, 185, 0.16);
  --text: #f6e7e3;
  --muted: #d6b6b1;
  --accent: #ff6b57;
  --accent-strong: #ff8c73;
  --accent-deep: #9b2323;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --success: #ffb38a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(155, 35, 35, 0.35), transparent 32%),
    linear-gradient(160deg, #090304 0%, #160708 45%, #24090b 100%);
}

button,
select,
input {
  font: inherit;
}

.number-input {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  color: #5b5656;
  background: #ffffff;
}

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  display: flex;
  flex-direction: column;
}

.hero {
  margin-bottom: 1.75rem;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(101, 18, 18, 0.45), rgba(32, 9, 11, 0.92)),
    rgba(49, 18, 21, 0.8);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.hero h1,
.panel h2,
.panel h3,
.callout h3 {
  margin: 0;
  font-weight: 600;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.05;
  max-width: 14ch;
}

.hero-copy,
.panel-header p,
.callout p,
.progress-text,
.section-copy {
  color: var(--muted);
}

.step-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.step-link {
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
}

.step-link.active {
  background: linear-gradient(135deg, rgba(255, 107, 87, 0.28), rgba(155, 35, 35, 0.45));
  border-color: rgba(255, 140, 115, 0.55);
}

.completion-link {
  display: inline-flex;
  margin-top: 0.9rem;
}

.hero-copy {
  margin: 1rem 0 0;
  max-width: 58rem;
  line-height: 1.6;
  font-size: 1.05rem;
}

.stack-layout {
  margin-bottom: 1.25rem;
}

.stack-layout > * + * {
  margin-top: 1.25rem;
}

.layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1rem;
}

.panel {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--panel), var(--panel-strong));
  box-shadow: var(--shadow);
}

.attribution-card {
  margin-top: 1.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;
}

.page-footer {
  width: min(1180px, calc(100% - 2rem));
  margin: 1.25rem auto 3rem;
}

.attribution-card p {
  margin: 0.2rem 0;
  color: var(--muted);
  line-height: 1.5;
}

.attribution-card a {
  color: var(--accent-strong);
}

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

.step-tag {
  margin: 0 0 0.4rem;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.section-copy {
  margin: 0;
  max-width: 34rem;
  line-height: 1.55;
}

.control-panel,
.summary-panel,
.log-panel,
.calibration-table-panel {
  min-height: 100%;
}

.log-panel,
.calibration-table-panel {
  margin-top: 1rem;
}

.calibration-table-panel {
  padding-bottom: 1rem;
}

.panel-header p,
.control-label,
.readout-label,
.summary-title,
.progress-label {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
}

.control-group {
  margin-top: 1.4rem;
}

.control-label,
.readout-label,
.progress-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
  font-size: 0.78rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.toggle-button,
.primary-button,
.ghost-button,
select {
  border-radius: 14px;
  border: 1px solid transparent;
}

.toggle-button,
.ghost-button,
select {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.toggle-button,
.primary-button,
.ghost-button {
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.toggle-button:hover,
.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.toggle-button.active,
.radio-card.active {
  background: linear-gradient(135deg, rgba(255, 107, 87, 0.28), rgba(155, 35, 35, 0.45));
  border-color: rgba(255, 140, 115, 0.55);
}

select {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
  color: #5b5656;
  background: #ffffff;
}

select option {
  color: #5b5656;
  background: #ffffff;
}

.dual-select-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.radio-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.curve-radio-group {
  grid-template-columns: 1fr;
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.radio-card input {
  accent-color: var(--accent);
}

.instrument-readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 1.15rem;
  border-radius: 18px;
  background: rgba(9, 3, 4, 0.35);
  border: 1px solid var(--border);
}

.readout-value {
  margin: 0.25rem 0 0;
  font-size: 1.4rem;
}

.readout-value.signal {
  font-size: clamp(2rem, 5vw, 2.8rem);
  color: var(--accent-strong);
}

.action-row {
  margin-top: 1.2rem;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff8f5;
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.03);
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.callout,
.progress-box {
  margin-top: 1.4rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.3rem;
}

.summary-card {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid var(--border);
}

.summary-reading {
  margin: 0.55rem 0 0;
  font-size: 1.3rem;
}

.summary-card.complete {
  border-color: rgba(255, 140, 115, 0.45);
  background: rgba(255, 107, 87, 0.08);
}

.sample-status-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-top: 1.4rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.sample-status-title {
  margin: 0.35rem 0 0;
  font-size: 1.15rem;
}

.sample-status-copy {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.plot-card {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(9, 3, 4, 0.35);
}

#curve-plot {
  display: block;
  width: 100%;
  height: auto;
}

.plot-axis {
  stroke: rgba(246, 231, 227, 0.55);
  stroke-width: 1.5;
}

.plot-grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.plot-label {
  fill: var(--muted);
  font-size: 12px;
}

.plot-point {
  fill: var(--accent-strong);
  stroke: #fff8f5;
  stroke-width: 1.5;
}

.plot-line {
  fill: none;
  stroke: #ffd3c4;
  stroke-width: 2.5;
}

.curve-table-checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.success-callout {
  border-color: rgba(255, 179, 138, 0.4);
  background: rgba(255, 179, 138, 0.08);
}

.hidden {
  display: none;
}

.row-delete-cell {
  width: 4.5rem;
}

.delete-checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

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

.deleted-row .row-delete-cell,
.deleted-row .row-delete-cell * {
  text-decoration: none;
}

.table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
}

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

th,
td {
  padding: 0.95rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.empty-row td,
.baseline-row td {
  color: var(--muted);
}

.baseline-row td:first-child {
  color: var(--text);
}

@media (max-width: 860px) {
  .layout,
  .calibration-layout,
  .summary-grid,
  .instrument-readout,
  .dual-select-grid,
  .radio-group {
    grid-template-columns: 1fr;
  }

  .hero,
  .panel {
    padding: 1.2rem;
  }

  .sample-status-card {
    align-items: start;
    flex-direction: column;
  }

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

  .step-nav {
    width: 100%;
  }
}
