:root {
  --blue: var(--brand);
  --bg: var(--canvas);
}

main {
  max-width: 1390px;
  margin: auto;
  padding: 0 25px;
}

.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 35px 0 30px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 1.8px;
  font-weight: 750;
  color: #6989a6;
}

h1 {
  font-size: clamp(29px,3.4vw,46px);
  line-height: 1.2;
  letter-spacing: -1.7px;
  margin: 10px 0;
}

h1 em {
  font-family: Georgia,serif;
  color: #4b8fbf;
  font-weight: 400;
}

p {
  margin: 7px 0;
}

.intro p {
  color: var(--muted);
}

.chapter {
  font: 56px Georgia,serif;
  color: #c1d3e3;
  display: flex;
  align-items: center;
  gap: 16px;
}

.chapter small {
  font: 9px system-ui;
  letter-spacing: 2px;
  max-width: 55px;
  color: #849bae;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0,1fr) 310px;
  gap: 20px;
  align-items: start;
}

.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 22px #334b6610;
}

.cardhead {
  padding: 19px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #edf1f5;
}

h2 {
  font-size: 17px;
  letter-spacing: -.4px;
  font-weight: 650;
  line-height: 1.4;
  margin: 4px 0 0;
}

.badge {
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 750;
  color: #467b9f;
  background: #eef5fb;
  border: 1px solid #dbe9f3;
  border-radius: 7px;
  padding: 5px 9px;
  white-space: nowrap;
}

.viewtools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 0;
  gap: 8px;
}

.segmented {
  display: flex;
  padding: 3px;
  background: #f0f4f8;
  border-radius: 8px;
}

.segmented button {
  border: 0;
  background: transparent;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--muted);
}

.segmented button.selected {
  background: white;
  color: var(--blue);
  box-shadow: 0 1px 4px #22334415;
}

.check {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.stage {
  position: relative;
  background: linear-gradient(white,#f8fafc);
}

#machine {
  display: block;
  width: 100%;
  aspect-ratio: 1000/680;
  max-height: 610px;
}

.schematic {
  position: absolute;
  bottom: 10px;
  left: 20px;
  font-size: 8px;
  color: #8c9eaf;
  letter-spacing: 1.4px;
}

.legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 11px 22px;
  border-top: 1px solid #edf1f5;
  font-size: 10px;
  color: var(--muted);
}

.legend i {
  display: inline-block;
  width: 13px;
  height: 6px;
  border-radius: 5px;
  margin-right: 5px;
}

.story {
  background: #edf5fc;
  display: flex;
  gap: 15px;
  padding: 17px 22px;
  min-height: 98px;
  border-block: 1px solid #dceaf5;
}

.story>span {
  font: 30px Georgia;
  color: #9bbbd5;
  min-width: 34px;
}

.story h3 {
  font-size: 14px;
  margin: 0;
  font-weight: 700;
}

.story p {
  font-size: 12px;
  line-height: 1.6;
  color: #62809b;
  margin: 3px 0 0;
}

.playback {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 17px 22px 10px;
  flex-wrap: wrap;
}

.playback .primary {
  min-width: 102px;
}

.playback label {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

select {
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
  padding: 9px;
}

.playback select {
  font-size: 11px;
  padding: 6px;
}

.timeline {
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 0 22px 16px;
}

.timeline input {
  width: 100%;
  accent-color: var(--blue);
  height: 5px;
}

.timeline output {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.journey {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  border-top: 1px solid var(--line);
}

.journey button {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  font-size: 10px;
  font-weight: 500;
  padding: 10px 4px;
  color: var(--muted);
}

.journey button.active {
  background: #eaf4fb;
  color: var(--blue);
  box-shadow: inset 0 2px var(--blue);
}

.pad {
  padding: 20px 22px;
}

.field {
  display: block;
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 8px;
}

.setup select {
  width: 100%;
  font-size: 12px;
  padding: 12px 9px;
}

.muted {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
  margin: 10px 0 17px;
}

.length {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-block: 1px solid #e9eef3;
  padding: 13px 0;
  font-size: 12px;
}

.length input {
  width: 65px;
  background: #f5f8fb;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  color: var(--ink);
  font-weight: 650;
}

.length span {
  color: var(--muted);
  font-size: 11px;
}

.sectionlabel {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #8a9bab;
  margin: 19px 0 8px;
}

.sectionlabel span {
  font-weight: 400;
  letter-spacing: 0;
}

.plate {
  border: 1px solid var(--line);
  padding: 12px;
  margin-top: 10px;
  border-radius: 11px;
  transition: background .2s;
}

.plate.current {
  background: #f0f7fc;
  border-color: #94bedb;
}

.plate.off {
  opacity: .65;
}

.platehead {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.platehead strong {
  background: #eaf0f7;
  border-radius: 6px;
  width: 25px;
  height: 25px;
  text-align: center;
  line-height: 25px;
  color: var(--blue);
}

.platehead small {
  color: var(--muted);
  font-size: 10px;
}

.platehead label {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
}

.platehead input {
  accent-color: var(--blue);
}

.quick {
  display: flex;
  gap: 5px;
  margin: 11px 0 9px;
}

.quick button {
  flex: 1;
  padding: 4px;
  font-size: 10px;
  color: #6d879f;
}

.stoprow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stoprow input {
  width: 100%;
  min-width: 0;
  accent-color: var(--blue);
  height: 4px;
}

.stoprow output {
  white-space: nowrap;
  font-size: 11px;
  color: #487ca4;
  font-variant-numeric: tabular-nums;
  min-width: 51px;
  text-align: right;
}

.micro {
  font-size: 10px;
  line-height: 1.7;
  color: var(--muted);
  margin-top: 12px;
}

#warning {
  font-size: 11px;
  color: #93652e;
  background: #fff4df;
  padding: 10px;
  border-radius: 8px;
}

.small-icon {
  font-size: 27px;
  color: #8eafd0;
}

.results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.edgeLabels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 8px;
}

#panels {
  display: flex;
  height: 96px;
  border: 1px solid #bdd3e5;
  border-radius: 8px;
  overflow: hidden;
}

#panels>div {
  display: grid;
  place-content: center;
  text-align: center;
  background: #e3eff9;
  color: #4279a3;
  border-right: 2px dashed #a4bfd4;
  min-width: 0;
  overflow: hidden;
}

#panels>div:nth-child(even) {
  background: #f0f6fb;
}

#panels>div:last-child {
  border: 0;
}

#panels b {
  font-size: 13px;
}

#panels small {
  font-size: 9px;
}

#stack {
  display: block;
  width: 100%;
  height: 170px;
}

.student-guide {
  margin: 34px 4px 28px;
  padding: 22px 24px;
  color: var(--ink-soft);
  background: rgba(255,255,255,.86);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(32,56,79,.06);
  font-size: 13px;
  line-height: 1.75;
}

@media(min-width:1300px) {
  .workspace {
    grid-template-columns: minmax(0,1fr) 320px;
  }

}

@media(max-width:850px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .setup {
    grid-row: 1;
  }

  .setup .pad {
    padding: 16px 20px;
  }

  .setup .cardhead {
    display: none;
  }

  #controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .plate {
    margin: 0;
  }

  .setup .muted {
    margin-bottom: 8px;
  }

  .sectionlabel {
    margin-top: 12px;
  }

  .chapter {
    display: none;
  }

  .results {
    grid-template-columns: 1fr;
  }

}

@media(max-width:500px) {
  main {
    padding: 0 13px;
  }

  .intro {
    padding: 25px 3px;
  }

  .intro p {
    font-size: 12px;
  }

  h1 {
    font-size: 30px;
    letter-spacing: -1px;
  }

  .cardhead {
    padding: 16px;
  }

  .cardhead h2 {
    font-size: 15px;
  }

  .pad {
    padding: 16px;
  }

  .viewtools {
    padding: 12px 12px 0;
  }

  .legend {
    gap: 10px;
    padding: 10px 14px;
  }

  .playback {
    padding: 14px 12px 10px;
    gap: 5px;
  }

  .playback button {
    font-size: 10px;
    padding: 8px;
  }

  .playback button.primary {
    min-width: 79px;
  }

  .story {
    padding: 15px;
  }

  .student-guide {
    margin: 25px 5px;
    padding: 18px;
  }

  footer {
    flex-wrap: wrap;
    font-size: 9px;
  }

  .plate {
    padding: 10px;
  }

  .platehead {
    gap: 4px;
  }

  .platehead small {
    font-size: 9px;
  }

  .quick button {
    font-size: 9px;
  }

  .segmented button {
    font-size: 10px;
  }

  #machine {
    min-height: 260px;
  }

}