:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #64748b;
  --line: #d7dde5;
  --panel: #ffffff;
  --page: #edf2f7;
  --accent: #176f6b;
  --accent-2: #a6422b;
  --safe: #228056;
  --warn: #b56b16;
  --danger: #b83232;
  --shadow: 0 18px 50px rgba(31, 41, 51, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0)),
    radial-gradient(circle at 20% 0%, rgba(23,111,107,0.13), transparent 34rem),
    var(--page);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 0.1rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2.2vw, 2.35rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1.02rem;
}

h3 {
  margin-bottom: 0.4rem;
  font-size: 0.93rem;
}

.classroom-note {
  max-width: 22rem;
  color: #405062;
  font-weight: 650;
  text-align: right;
}

.two-panel-shell {
  display: grid;
  grid-template-columns: minmax(34rem, 1.35fr) minmax(22rem, 0.65fr);
  gap: 1rem;
  padding: 1rem;
  align-items: start;
}

.main-panel,
.experiment-controls,
.mouse-board,
.graph-panel,
.data-panel,
.analysis-panel,
.completion-check {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.main-panel {
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding: 1rem;
}

.instructions-panel {
  position: sticky;
  top: 1rem;
  align-self: start;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

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

.panel-title h2 {
  font-size: 1.35rem;
}

.experiment-controls {
  display: grid;
  grid-template-columns: minmax(11rem, 0.95fr) minmax(16rem, 1.25fr) minmax(14rem, 1fr);
  align-items: stretch;
  gap: 0.85rem;
  padding: 1rem;
}

.panel-heading,
.section-title,
.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.section-title {
  padding: 0.9rem 1rem 0;
}

.section-title span {
  color: var(--muted);
  font-size: 0.86rem;
}

.flat-title {
  padding: 0;
}

.icon-button,
.secondary-action,
.primary-action {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.icon-button {
  width: 2.25rem;
  height: 2.25rem;
  background: #e2e8f0;
  color: var(--ink);
  font-size: 1.15rem;
}

.primary-action {
  min-height: 2.8rem;
  background: var(--accent);
  color: white;
}

.primary-action:disabled {
  cursor: not-allowed;
  background: #a7b5c2;
}

.secondary-action {
  padding: 0.52rem 0.7rem;
  background: #e6f2f1;
  color: #0f5d59;
}

.field {
  display: grid;
  gap: 0.42rem;
  min-width: 0;
  margin: 0;
  color: #344255;
  font-size: 0.9rem;
  font-weight: 650;
}

.field input,
.field select {
  min-width: 0;
  border: 1px solid #c9d3df;
  border-radius: 6px;
  padding: 0.6rem 0.65rem;
  background: #fff;
  color: var(--ink);
}

.field input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

.field legend {
  padding: 0;
}

.setup-card {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid #dce6ee;
  border-radius: 8px;
  background: #f8fafc;
}

.step-label {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.standard-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
}

.standard-buttons button {
  min-height: 2.15rem;
  border: 1px solid #c9d3df;
  border-radius: 6px;
  background: #ffffff;
  color: #344255;
  cursor: pointer;
  font-weight: 750;
}

.standard-buttons button.selected {
  border-color: var(--accent);
  background: #e6f2f1;
  color: #0f5d59;
}

.dose-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.compact span::after {
  content: " mg/mL";
  color: var(--muted);
  font-weight: 500;
}

.compact + .compact span::after {
  content: " mL";
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid #c9d3df;
  border-radius: 6px;
}

.segmented label {
  display: grid;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  padding: 0.62rem;
  text-align: center;
  cursor: pointer;
}

.segmented label + label span {
  border-left: 1px solid #c9d3df;
}

.segmented input:checked + span {
  background: var(--accent);
  color: white;
}

.chemical-profile,
.ethics-box {
  border-radius: 8px;
  padding: 0.8rem;
}

.chemical-profile {
  background: #f1f7f6;
  border: 1px solid #c7dedc;
}

.chemical-profile p,
.ethics-box p {
  margin-bottom: 0;
  color: #405062;
  font-size: 0.9rem;
  line-height: 1.42;
}

.ethics-box {
  background: #fff7ed;
  border: 1px solid #f0cfaa;
}

.simulation-stack {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0.85rem 1rem;
  background: #24313f;
  color: white;
  border-radius: 8px;
}

.status-strip div {
  display: grid;
  gap: 0.1rem;
}

.metric-label {
  color: #bed1df;
  font-size: 0.77rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-strip strong {
  font-size: 1.16rem;
}

.workspace-grid,
.bottom-grid {
  display: grid;
  grid-template-columns: minmax(18rem, 0.9fr) minmax(24rem, 1.35fr);
  gap: 1rem;
}

.simulation-stack {
  grid-template-columns: minmax(18rem, 0.75fr) minmax(24rem, 1.25fr);
}

.data-panel {
  grid-column: 1 / -1;
}

.mouse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(3.2rem, 1fr));
  gap: 0.65rem;
  padding: 1rem;
}

.mouse {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 3.8rem;
  border: 1px solid #d5dde7;
  border-radius: 8px;
  background: #f8fafc;
}

.mouse::before {
  content: "";
  width: 2.15rem;
  height: 1.35rem;
  border-radius: 50% 46% 46% 50%;
  background: var(--mouse-color, #dfe7ee);
  box-shadow:
    1.15rem -0.52rem 0 -0.33rem var(--mouse-color, #dfe7ee),
    1.45rem -0.58rem 0 -0.39rem #c9d3df,
    -1.03rem 0.18rem 0 -0.47rem #aebdca;
}

.mouse::after {
  content: "";
  position: absolute;
  width: 0.18rem;
  height: 0.18rem;
  right: 1.02rem;
  top: 1.46rem;
  border-radius: 50%;
  background: #1f2933;
}

.mouse.affected {
  --mouse-color: #efc267;
  background: #fff8e7;
}

.mouse.lethal {
  --mouse-color: #d98b83;
  background: #fff1f0;
}

.mouse .tag {
  position: absolute;
  bottom: 0.3rem;
  color: #405062;
  font-size: 0.68rem;
  font-weight: 700;
}

.graph-panel canvas {
  display: block;
  width: 100%;
  height: min(50vh, 26rem);
  padding: 0.5rem 1rem 1rem;
}

.table-wrap {
  max-height: 23rem;
  overflow: auto;
  padding: 0.85rem 1rem 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th,
td {
  padding: 0.58rem 0.45rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: white;
  color: #405062;
}

.analysis-panel {
  display: grid;
  grid-template-rows: auto 1fr;
}

.prompt-list {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem 1rem 1rem;
}

.prompt {
  display: grid;
  gap: 0.45rem;
  padding: 0.75rem;
  border: 1px solid #dde5ee;
  border-radius: 8px;
  background: #f8fafc;
}

.prompt label {
  color: #2c3848;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.38;
}

.prompt textarea {
  width: 100%;
  min-height: 4rem;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.55rem;
  color: var(--ink);
}

.prompt.complete {
  border-color: #91c9ad;
  background: #f0fbf5;
}

.instruction-block {
  display: grid;
  gap: 0.45rem;
  padding: 0.9rem;
  border: 1px solid #dce6ee;
  border-radius: 8px;
  background: #f8fafc;
}

.instruction-block p,
.instruction-block ol {
  margin: 0;
  color: #405062;
  font-size: 0.92rem;
  line-height: 1.48;
}

.instruction-block ol {
  padding-left: 1.25rem;
}

.instruction-block li + li {
  margin-top: 0.45rem;
}

.progress-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.36rem 0.62rem;
  background: #e6f2f1;
  color: #0f5d59;
  font-size: 0.78rem;
  font-weight: 800;
}

.completion-check {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
}

.completion-check ul,
.completion-card ul {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.completion-check li {
  display: grid;
  grid-template-columns: 2.1rem 1fr;
  align-items: start;
  gap: 0.45rem;
  color: #405062;
  font-size: 0.9rem;
  line-height: 1.35;
}

.completion-check li span {
  border-radius: 999px;
  padding: 0.14rem 0.32rem;
  background: #e2e8f0;
  color: #405062;
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
}

.completion-check li.done span {
  background: #dff3e9;
  color: #17623f;
}

.completion-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 1rem;
  overflow: auto;
  background: rgba(31, 41, 51, 0.62);
}

.completion-screen[hidden] {
  display: none;
}

.completion-card {
  display: grid;
  gap: 0.8rem;
  width: min(76rem, 100%);
  padding: 1.25rem;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.completion-card h2,
.completion-card p {
  margin-bottom: 0;
}

.completion-card li {
  padding: 0.55rem 0;
  border-bottom: 1px solid #e2e8f0;
  color: #405062;
}

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

.summary-graph-card,
.response-card {
  display: grid;
  gap: 0.5rem;
  padding: 0.8rem;
  border: 1px solid #dce6ee;
  border-radius: 8px;
  background: #f8fafc;
}

.summary-graph-card h3,
.summary-graph-card p,
.response-card h4,
.response-card p {
  margin: 0;
}

.summary-graph-card canvas {
  width: 100%;
  height: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
}

.summary-responses {
  display: grid;
  gap: 0.65rem;
}

.summary-responses h3 {
  margin-bottom: 0;
}

.response-card h4 {
  color: #2c3848;
  font-size: 0.92rem;
}

.response-card p {
  color: #405062;
  line-height: 1.45;
  white-space: pre-wrap;
}

@media (max-width: 1050px) {
  .two-panel-shell,
  .workspace-grid,
  .bottom-grid,
  .simulation-stack {
    grid-template-columns: 1fr;
  }

  .instructions-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .data-panel {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  .experiment-controls {
    grid-template-columns: 1fr 1fr;
  }

  .experiment-controls .primary-action {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .topbar,
  .panel-heading,
  .section-title {
    align-items: flex-start;
  }

  .topbar,
  .section-title {
    flex-direction: column;
  }

  .classroom-note {
    text-align: left;
  }

  .two-panel-shell {
    padding: 0.65rem;
  }

  .status-strip,
  .dose-row,
  .experiment-controls {
    grid-template-columns: 1fr;
  }

  .graph-panel canvas {
    height: 19rem;
  }

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