.source-panel {
  display: grid;
  grid-template-columns: minmax(230px, .55fr) minmax(0, 1.8fr);
  gap: 36px;
  padding: 26px 0 20px;
  border-bottom: 1px solid var(--line);
}

.source-intro h2 {
  margin: 0 0 10px;
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 400;
}

.source-intro > p:not(.step, .status) {
  max-width: 380px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.upload-button,
.reset-crop {
  display: inline-block;
  padding: 10px 14px;
  border: 1px solid var(--ink);
  background: var(--panel);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.status {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.status.error {
  color: #9e2d25;
  font-weight: 700;
}

.source-workspace {
  min-width: 0;
}

.samples {
  display: grid;
  grid-template-columns: repeat(5, minmax(70px, 1fr));
  gap: 8px;
}

.sample {
  min-width: 0;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.sample.active {
  border-color: var(--ink);
  background: var(--panel);
}

.sample img {
  display: block;
  width: 100%;
  height: 72px;
  object-fit: cover;
  border-radius: 3px;
}

.sample span {
  display: block;
  margin: 5px 1px 1px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crop-controls {
  display: grid;
  grid-template-columns: 1.1fr repeat(3, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin-top: 14px;
}

.crop-controls p {
  align-self: center;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.crop-controls strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crop-controls label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 11px;
}

.crop-controls input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--blue);
}

.crop-controls output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.reset-crop {
  padding: 8px 11px;
  background: transparent;
  font-size: 11px;
}

.construction-controls {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
}

.method-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 310px;
  border: 1px solid var(--ink);
}

.method,
.swap-orientation {
  padding: 10px 14px;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.method + .method {
  border-left: 1px solid var(--ink);
}

.method.active {
  color: white;
  background: var(--ink);
}

.swap-orientation {
  border: 1px solid var(--ink);
  background: var(--panel);
}

.swap-orientation[aria-pressed="true"] {
  color: white;
  background: var(--blue);
}

.types {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  padding: 22px 0;
}

.type {
  min-width: 0;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
}

.type:hover {
  transform: translateY(-2px);
}

.type.active {
  border-color: var(--ink);
  background: var(--panel);
}

.type canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1.9;
  border-radius: 4px;
  background: #ddd;
}

.type span {
  display: block;
  margin: 7px 1px 1px;
  font-size: 12px;
  font-weight: 700;
}

.farris-lab {
  margin-bottom: 22px;
  border: 1px solid var(--ink);
  background: var(--panel);
}

.lab-heading {
  display: grid;
  grid-template-columns: minmax(220px, .65fr) minmax(300px, 1.35fr);
  align-items: end;
  gap: 30px;
  padding: 24px;
  border-bottom: 1px solid var(--ink);
}

.lab-heading h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 31px;
  font-weight: 400;
}

.lab-heading > p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.study-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--ink);
}

.study {
  min-width: 0;
  padding: 12px 10px;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.study + .study {
  border-left: 1px solid var(--ink);
}

.study.active {
  color: white;
  background: var(--blue);
}

.lab-body {
  display: grid;
  grid-template-columns: minmax(380px, 1.15fr) minmax(320px, .85fr);
}

.derivation-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-width: 0;
  padding: 20px;
  border-right: 1px solid var(--ink);
}

.derivation-steps article {
  min-width: 0;
  padding: 8px 14px;
  border-left: 1px solid var(--line);
}

.derivation-steps article:first-child {
  border-left: 0;
}

.derivation-steps span {
  display: grid;
  width: 25px;
  height: 25px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--accent);
  font-family: Georgia, serif;
  font-size: 14px;
}

.derivation-steps strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
}

.derivation-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.wave-builder {
  min-width: 0;
  padding: 20px 24px;
}

.wave-control label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  font-weight: 750;
}

.wave-control output {
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.wave-control input {
  width: 100%;
  margin-top: 9px;
  accent-color: var(--blue);
}

.wave-control p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.term-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 14px;
}

.term-chip {
  padding: 5px 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  line-height: 1.2;
  opacity: .5;
}

.term-chip.active {
  border-color: var(--blue);
  color: var(--ink);
  background: #e8f0ef;
  opacity: 1;
}
