/* The illustrated purchase is readable before JavaScript runs. */
.order-story {
  --story-blue: #315e82;
  --story-blue-fill: #e1ebf4;
  --story-green-fill: #e1ede3;
  position: relative;
  border-top: 4px solid var(--ink);
  padding-top: 1.5rem;
}

.order-story .story-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.story-example {
  margin-bottom: 1.25rem;
  color: var(--steel);
  font-size: 0.9375rem;
}
.story-controls {
  position: sticky;
  bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  margin: 1rem auto;
  z-index: 10;
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  width: min(27rem, calc(100% - 2rem));
  padding: 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 0.875rem;
  background: var(--surface);
  box-shadow: 0 4px 20px #1b26311a;
}
.story-controls.is-offscreen {
  visibility: hidden;
}
@supports (backdrop-filter: blur(12px)) {
  .story-controls {
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    backdrop-filter: blur(12px) saturate(1.2);
    border-color: #ffffffb3;
  }
}
.story-controls button {
  min-width: 3.25rem;
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0.5rem 0.625rem;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.story-controls #diagram-play {
  min-width: 5.25rem;
  background: var(--ink);
  color: var(--surface);
}
.story-controls button:hover:not(:disabled) {
  border-color: var(--ink);
}
.story-controls button:disabled {
  opacity: 0.4;
  cursor: default;
}
.story-current-step {
  display: flex;
  flex-direction: column;
  padding-inline: 0.5rem;
  border-left: 1px solid var(--rule);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--steel);
}
.story-current-step strong {
  color: var(--ink);
  font-weight: 600;
}
.story-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--steel);
  font-size: 0.8125rem;
}
.story-legend span {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.story-legend span:last-child {
  color: var(--story-blue);
}
.story-panels {
  position: relative;
}
.story-connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.story-connections path {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1.5;
}
.purchase-steps {
  list-style: none;
  display: grid;
  gap: 2rem;
  padding: 0;
  margin: 0;
}
.purchase-step {
  position: relative;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 3px;
}
.purchase-step.is-active {
  box-shadow: 0 0 0 2px var(--signal);
}
.purchase-step h3 {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.35;
}
.story-number {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.875rem;
}
.is-active .story-number {
  background: var(--signal);
  color: var(--ink);
}
.purchase-step > p {
  margin-top: 1rem;
  color: var(--steel);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.order-story .story-art {
  height: 11rem;
  width: 100%;
  max-width: 26rem;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.order-story .paper {
  width: 85%;
  max-width: 19rem;
  padding: 0.625rem 0.875rem;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px var(--rule);
  transform: rotate(-3deg);
}
.order-story .paper > span {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.6875rem;
  color: var(--steel);
}
.order-story .paper strong {
  display: block;
  font-size: 1.375rem;
  font-weight: 650;
}
.order-story .paper small {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.4;
}
.order-story .down {
  font-size: 1.375rem;
  line-height: 1.25;
}
.order-story .bot {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
}
.order-story .request {
  width: 100%;
  padding: 0.625rem;
  background: var(--ink);
  color: var(--surface);
  text-align: center;
  font-size: 0.875rem;
}
.order-story .request-branches {
  height: 3rem;
  width: 100%;
  overflow: visible;
}
.order-story .request-branches path {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.order-story .sellers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.375rem;
  width: 100%;
}
.order-story .sellers > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  font-size: 0.8125rem;
}
.order-story .sellers .story-icon {
  color: var(--go);
}
.order-story .seal-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 1rem;
  color: var(--steel);
  font-size: 0.75rem;
}
.order-story .offers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  gap: 0.5rem;
}
.order-story .offers > div {
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 0.5rem 0.25rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-size: 0.8125rem;
}
.order-story .offers strong {
  font-size: 1.375rem;
  font-weight: 650;
}
.order-story .offers small {
  font-size: 0.75rem;
  color: var(--steel);
}
.order-story .offers .story-icon {
  margin-top: 0.25rem;
  width: 1rem;
  height: 1rem;
}
.order-story .offers .winner {
  background: var(--story-green-fill);
  border-color: var(--go);
}
.order-story.has-played .offers:not(.chosen) .winner {
  background: var(--surface);
  border-color: var(--rule);
}
.order-story .quote-cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.375rem;
  background: var(--surface);
  color: var(--steel);
  border-radius: 3px;
  transform-origin: left center;
}
.order-story .offers.revealed .quote-cover {
  visibility: hidden;
}
.order-story .gate {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
  color: var(--go);
  font-size: 0.8125rem;
}
.order-story .transfer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  font-size: 0.8125rem;
  text-align: center;
}
.order-story .transfer strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 650;
}
.order-story .arrow {
  font-size: 1.5rem;
}
.order-story .hold {
  display: flex;
  align-items: center;
  flex-direction: column;
  flex: 1;
  max-width: 12rem;
  padding: 0.5rem 0.375rem 2.5rem;
  border-radius: 5px;
  background: var(--story-blue-fill);
}
.order-story .hold strong {
  font-size: 0.9375rem;
}
.order-story .hold small {
  font-size: 0.75rem;
}
.order-story .funded {
  margin-top: 0.625rem;
  font-size: 0.75rem;
  text-align: center;
  color: var(--steel);
}
.order-story .delivery {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}
.order-story .delivery > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  font-size: 0.8125rem;
}
.order-story .delivery > span > .story-icon {
  width: 1.75rem;
  height: 1.75rem;
}
.order-story .road {
  position: relative;
  flex: 1;
  min-width: 2rem;
  height: 2.25rem;
  border-bottom: 2px solid var(--rule);
}
.order-story .road > span:last-child {
  position: absolute;
  right: -2px;
  bottom: -0.75rem;
  font-size: 1.5rem;
}
.order-story .parcel {
  position: absolute;
  left: 35%;
  top: 0;
  padding: 0.25rem;
  border-radius: 3px;
  background: var(--signal);
  color: var(--ink);
}
.order-story.has-played .parcel {
  visibility: hidden;
}
.order-story .still-held {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.5rem;
  background: var(--story-blue-fill);
  font-size: 0.75rem;
}
.order-story.is-holding .still-held {
  box-shadow: inset 3px 0 var(--story-blue);
}
.order-story .receipt {
  display: flex;
  align-items: center;
  flex-direction: column;
  width: 90%;
  padding: 0.75rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  font-size: 0.875rem;
  text-align: center;
}
.order-story .receipt small {
  font-size: 0.75rem;
  color: var(--steel);
}
.order-story .paid {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--go);
  font-size: 0.8125rem;
}
.order-story.has-played:not(.is-settled) .paid {
  visibility: hidden;
}
.story-notes {
  display: grid;
  gap: 0.875rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--steel);
}
.order-story .story-notes strong {
  color: var(--ink);
  font-weight: 650;
}
.story-notes p:last-child {
  font-size: 0.875rem;
}
.story-motion {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.story-cargo {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 2px 5px #1b263124;
  will-change: transform;
}
.story-cargo.money {
  background: var(--story-blue-fill);
  color: var(--story-blue);
  border-color: var(--story-blue);
}
.story-cargo.parts {
  background: var(--signal);
  color: var(--ink);
}
.story-cargo.confirmation {
  background: var(--story-green-fill);
  color: var(--go);
  border-color: var(--go);
}
.order-story .story-cargo > span {
  position: absolute;
  top: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  padding-inline: 0.1875rem;
  background: var(--surface);
  color: var(--ink);
  border-radius: 2px;
  font-size: 0.6875rem;
  white-space: nowrap;
}
@media (min-width: 48rem) {
  .purchase-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem 1.75rem;
  }
}
@media (max-width: 30rem) {
  .purchase-step {
    padding: 1rem;
  }
  .story-controls {
    width: calc(100% - 1rem);
    gap: 0.25rem;
  }
  .story-controls button {
    padding-inline: 0.375rem;
    font-size: 0.8125rem;
  }
  .story-controls #diagram-play {
    min-width: 4.75rem;
  }
  .story-current-step {
    padding-inline: 0.375rem;
  }
  .order-story .paper small {
    font-size: 0.75rem;
  }
  .order-story .gate {
    font-size: 0.75rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .order-story .story-controls,
  .order-story .story-motion {
    display: none;
  }
}

/* Keep hidden controls and moving objects out of layout despite their display rules. */
.order-story [hidden] {
  display: none;
}
