#freight {
  color: #f8f5ee;
  background: #141513;
  font: 500 16px/1.45 -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --muted-ink: #c4c3bc;
  --brass: #ffba62;
  --land: .44;
}
#freight * { box-sizing: border-box; }
#freight [data-line="ore"] { --line: #ff8766; }
#freight [data-line="steel"] { --line: #ffca66; }
#freight [data-line="wood"] { --line: #70daef; }
#freight [data-line="local"] { --line: #96e4a8; }
#freight [data-line="coast"] { --line: #c1abff; }
#freight [data-line="yard"] { --line: #aeb9c6; }
#freight [data-line="depot"] { --line: #e5bb9e; }
#freight .network {
  margin: 0 auto;
  width: min(100%, 1220px);
  padding: clamp(24px, 5vw, 70px) 4% 6%;
  container-type: inline-size;
}
#freight :is(h2,h3,p) { color: inherit; margin: 0; font-family: inherit; }
#freight header, #freight .shipment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#freight header { margin-bottom: clamp(16px, 2.7cqw, 30px); }
#freight h2 { font-size: clamp(25px, 5cqw, 56px); line-height: 1.1; letter-spacing: -.05em; font-weight: 800; }
#freight h2::after { content: '.'; color: var(--brass); }
#freight p { margin-top: 7px; font-size: clamp(14px, 1.8cqw, 19px); color: var(--muted-ink); line-height: 1.4; }
#freight button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  color: inherit;
  background: none;
  border: none;
  font: 650 clamp(14px, 1.75cqw, 18px)/1.2 -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  padding: 0;
  min-height: 44px;
  cursor: pointer;
}
#freight .pause { color: var(--brass); white-space: nowrap; }
#freight .pause::before { content: ''; display: block; height: .95em; width: .67em; border-inline: .23em solid; box-sizing: border-box; }
#freight .paused::before { background: currentColor; border: 0; width: .8em; clip-path: polygon(0 0,100% 50%,0 100%); }
#freight .atlas {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  aspect-ratio: 2;
  border-radius: 6px;
  background: #10171b;
}
#freight .terrain, #freight .rails, #freight .trains, #freight .stops {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#freight .terrain { filter: saturate(.11) brightness(var(--land)); }
#freight .atlas::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(#fff1 1px, transparent 1px) 0 0 / 8.3333% 16.6667%,
    linear-gradient(90deg, #fff1 1px, transparent 1px) 0 0 / 8.3333% 16.6667%,
    radial-gradient(ellipse at center, transparent 58%, #070d1580);
  pointer-events: none;
  z-index: -1;
}
#freight .terrain { z-index: -2; }
#freight .rails path {
  fill: none;
  stroke: #11191e;
  stroke-width: 11;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#freight .rails .line {
  stroke: var(--line);
  stroke-width: 5;
  opacity: .78;
}
#freight .rails .active .line { stroke-width: 7; opacity: 1; }
#freight .rails .siding { stroke-width: 7; }
#freight .rails .siding.line { stroke-width: 3; }
#freight .rails .hit { pointer-events: stroke; stroke: transparent; stroke-width: 24; cursor: pointer; }
#freight .train {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#freight .train button {
  position: absolute;
  left: 0;
  top: 0;
  width: max(44px, 4.2cqw);
  height: max(44px, 4.2cqw);
  margin: min(-22px, -2.1cqw);
  pointer-events: auto;
}
#freight .car {
  position: absolute;
  left: 0;
  top: 0;
  height: max(5px, 1.12cqw);
  width: 1.89cqw;
  background: var(--line);
  border: 1.5px solid #101418;
  border-radius: 2px;
  box-shadow: 0 1px 3px #000b, inset 0 -3px #0003;
  pointer-events: auto;
  cursor: pointer;
}
#freight .car::before {
  content: '';
  position: absolute;
  inset: 12% 17%;
  border-inline: 2px solid #30271f80;
}
#freight .coach {
  background: var(--line);
  border-radius: 3px;
}
#freight .coach::before {
  inset: 24% 11%;
  border: 0;
  background: repeating-linear-gradient(90deg, #1b2937 0 20%, transparent 20% 27%);
}
#freight .parked {
  width: 1.69cqw;
  height: max(4px, .95cqw);
  transform: translate(-50%, -50%);
  filter: brightness(.83);
}
#freight .engine { border-radius: 2px 38% 38% 2px; background: #fbf7e8; }
#freight .engine::before { inset: 12% 24% 12% 54%; border: none; background: #203039; }
#freight .engine::after { content: ''; position: absolute; right: -8%; top: 30%; width: 16%; height: 40%; background: white; box-shadow: 0 0 6px 2px #ffde86; }
#freight .train.active .car { box-shadow: 0 0 0 1px #fff6d6, 0 0 9px 1px #0009; }
#freight .train:hover .car { filter: brightness(1.22); }
#freight .stops button {
  position: absolute;
  pointer-events: auto;
  transform: translate(-50%, -100%);
  min-height: 0;
  background: #121613ed;
  font-size: clamp(11px, 1.45cqw, 16px);
  color: #fff;
  border-radius: 3px;
  padding: .36em .65em;
  white-space: nowrap;
  box-shadow: 0 2px 5px #0005;
  margin-top: min(-9px, -1.45cqw);
}
#freight .stops button::before { content: ''; position: absolute; inset: -9px -2px -16px; }
#freight .stops button::after {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(100% + max(9px, 1.45cqw));
  transform: translate(-50%, -50%);
  width: max(7px, 1cqw);
  height: max(7px, 1cqw);
  border: 2px solid #171717;
  border-radius: 50%;
  background: white;
}
#freight .stops .served::after { box-shadow: 0 0 0 2px var(--selection); }
#freight .stops :is([data-station="port"],[data-station="south"]) { transform: translate(-50%, 0); margin-top: max(9px, 1.45cqw); }
#freight .stops :is([data-station="port"],[data-station="south"])::after { top: min(-9px, -1.45cqw); }
#freight .stops [data-station="depot"] { margin-top: min(-23px, -3.4cqw); }
#freight .stops [data-station="depot"]::after { top: calc(100% + max(23px, 3.4cqw)); }
#freight .stops [data-station="yard"] { margin-top: min(-22px, -3.3cqw); }
#freight .stops [data-station="yard"]::after { top: calc(100% + max(22px, 3.3cqw)); }
#freight .stops button:hover, #freight .stops button:focus-visible { background: #372f21; color: #ffcc7a; }
#freight .demo {
  position: absolute;
  right: 1.5%;
  bottom: 3%;
  padding: .25em .55em;
  background: #0e151cd9;
  font-size: clamp(11px, 1.4cqw, 15px);
  border-radius: 3px;
}
#freight .cargo { display: flex; justify-content: space-between; gap: 1cqw; border-bottom: 1px solid #ffffff29; }
#freight .cargo button {
  font-size: clamp(13px, 1.65cqw, 18px);
  color: var(--muted-ink);
  padding: 0 .25em;
  min-height: clamp(48px, 6.8cqw, 68px);
  border-bottom: 3px solid transparent;
}
#freight .cargo button::before { content: ''; width: .65em; height: .65em; background: var(--line); border-radius: 50%; }
#freight .cargo button[aria-pressed="true"] { border-color: var(--line); color: #fff; }
#freight .shipment { padding-top: clamp(15px, 2.5cqw, 30px); }
#freight .summary h3 { font-size: clamp(18px, 2.7cqw, 32px); font-weight: 750; line-height: 1.24; letter-spacing: -.03em; }
#freight .phase { font: 600 clamp(12px, 1.5cqw, 16px)/1.3 'SFMono-Regular', Consolas, monospace; color: var(--selection); white-space: nowrap; }
@container (max-width: 740px) {
  #freight .cargo { display: grid; grid-template-columns: repeat(4, auto); gap: 0; }
  #freight .cargo button { min-height: 44px; padding: 0; justify-content: start; }
  #freight .stops button { padding: 3px 5px; }
}
@container (max-width: 610px) {
  #freight header { align-items: start; gap: 6px; }
  #freight .pause { font-size: 12px; min-height: 44px; margin-top: -7px; }
  #freight .rails path { stroke-width: 15; }
  #freight .rails .line { stroke-width: 7; }
  #freight .rails .active .line { stroke-width: 9; }
  #freight .rails .hit { stroke-width: 32; }
  #freight .stops [data-station="forest"] { transform: translate(-50%, 0); margin-top: 8px; }
  #freight .stops [data-station="forest"]::after { top: -8px; }
  #freight .car { border-width: 1px; }
  #freight .stops button { margin-top: -7px; padding: 2px 4px; }
  #freight .stops button::after { top: calc(100% + 7px); width: 5px; height: 5px; border-width: 1px; }
  #freight .stops [data-station="yard"] { transform: translate(-22%, -100%); margin-top: -14px; }
  #freight .stops [data-station="yard"]::after { left: 22%; top: calc(100% + 14px); }
  #freight .stops [data-station="depot"] { transform: translate(-72%, -100%); margin-top: -12px; }
  #freight .stops [data-station="depot"]::after { left: 72%; top: calc(100% + 12px); }
  #freight .stops [data-station="south"] { transform: translate(-38%, 0); margin-top: 6px; }
  #freight .stops [data-station="south"]::after { left: 38%; top: -6px; }
  #freight .stops [data-station="port"] { margin-top: 6px; }
  #freight .stops [data-station="port"]::after { top: -6px; }
  #freight .demo { font-size: 10px; padding: .2em .4em; }
  #freight .shipment { flex-direction: column; align-items: start; gap: 8px; }
  #freight .summary { min-height: 76px; }
}
@container (max-width: 425px) {
  #freight .cargo { display: flex; flex-wrap: wrap; justify-content: start; column-gap: 4.5cqw; }
  #freight .cargo button { gap: .35em; font-size: 12px; }
  #freight .pause { font-size: 0; width: 44px; flex-shrink: 0; margin-top: -8px; }
  #freight .pause::before { font-size: 15px; }
  #freight .stops [data-station="forest"] { margin-top: 6px; }
  #freight .stops [data-station="forest"]::after { top: -6px; }
  #freight .stops [data-station="yard"] { margin-top: -11px; }
  #freight .stops [data-station="yard"]::after { top: calc(100% + 11px); }
  #freight .stops button { padding: 2px 3px; }
  #freight .train .car { border: .75px solid #141513; border-radius: 1px; height: 4.5px; }
  #freight .train .coach { background: #fbf7e8; }
  #freight .train .car::before { inset: 20% 12%; border: 0; background-color: var(--line); }
  #freight .train .engine::before { background-color: #25323d; inset: 15% 15% 15% 60%; }
  #freight .stops [data-station="north"], #freight .stops [data-station="river"] { margin-top: -5px; }
  #freight .stops [data-station="north"]::after, #freight .stops [data-station="river"]::after { top: calc(100% + 5px); }
}
