.dispatch-hatch {
  --dispatch-ink: #17231c;
  --dispatch-paper: #fffaf0;
  --dispatch-floor: #d7cab6;
  --dispatch-red: #b9473d;
  --dispatch-green: #315f45;
  --dispatch-bright: #1c7c54;
  --dispatch-yellow: #f1c75b;
  --dispatch-pale: #8f8b7e;
  border: 2px solid var(--dispatch-ink);
  border-top: 0;
  color: var(--dispatch-ink);
  background: var(--dispatch-paper);
}

.dispatch-hatch[hidden],
.dispatch-hatch [hidden] {
  display: none !important;
}

.dispatch-hatch-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(24px, 5vw, 72px);
  padding: clamp(32px, 5vw, 62px);
  align-items: end;
  border-top: 8px solid var(--dispatch-yellow);
  border-bottom: 2px solid var(--dispatch-ink);
  background:
    linear-gradient(90deg, rgb(49 95 69 / 7%) 1px, transparent 1px),
    linear-gradient(rgb(49 95 69 / 7%) 1px, transparent 1px),
    #eef1e4;
  background-size: 28px 28px;
}

.dispatch-hatch-kicker,
.dispatch-hatch-step,
.dispatch-hatch-ticket,
.dispatch-hatch-room-tag,
.dispatch-hatch-legend {
  margin: 0;
  font: 850 0.65rem/1.35 ui-monospace, "SFMono-Regular", Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dispatch-hatch-kicker {
  color: var(--dispatch-red);
}

.dispatch-hatch-kicker span {
  display: inline-grid;
  width: 31px;
  height: 31px;
  margin-right: 8px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.dispatch-hatch-heading h2 {
  max-width: 800px;
  margin: 15px 0 17px;
  font-size: clamp(2.7rem, 7vw, 6.5rem);
  letter-spacing: -0.075em;
  line-height: 0.87;
  text-wrap: balance;
}

.dispatch-hatch-heading > div:first-child > p:last-child {
  max-width: 680px;
  margin: 0;
  color: #505a53;
  font-size: 0.95rem;
  font-weight: 680;
  line-height: 1.55;
}

.dispatch-hatch-room-tag {
  display: grid;
  width: 154px;
  min-height: 104px;
  padding: 16px;
  place-content: center;
  border: 4px double var(--dispatch-red);
  border-radius: 50%;
  color: var(--dispatch-red);
  background: rgb(255 250 240 / 80%);
  text-align: center;
  transform: rotate(5deg);
}

.dispatch-hatch-room-tag strong {
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 0.72rem;
  line-height: 1.2;
}

.dispatch-hatch-board {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.7fr);
  min-height: 690px;
  background: var(--dispatch-floor);
}

.dispatch-hatch-map {
  position: relative;
  display: grid;
  min-width: 0;
  padding: clamp(25px, 4vw, 54px);
  place-items: center;
  border-right: 2px solid var(--dispatch-ink);
  background:
    radial-gradient(circle at 21% 24%, rgb(255 255 255 / 38%) 0 2px, transparent 3px),
    linear-gradient(26deg, transparent 49%, rgb(23 35 28 / 5%) 49.5% 50.5%, transparent 51%),
    #cbbca6;
  background-size: 31px 31px, 170px 170px, auto;
}

.dispatch-hatch-map-paper {
  position: relative;
  width: min(100%, 780px);
  aspect-ratio: 1.5;
  overflow: hidden;
  border: 3px solid var(--dispatch-ink);
  border-radius: 8px 28px 9px 7px;
  background: #f8efd9;
  box-shadow: 15px 17px 0 rgb(23 35 28 / 22%), inset -28px 0 50px rgb(49 95 69 / 7%);
  isolation: isolate;
  transform: rotate(-0.7deg);
}

.dispatch-hatch-map-paper::before {
  position: absolute;
  z-index: 1;
  top: -4%;
  right: 24%;
  width: 3px;
  height: 112%;
  border-left: 3px dashed rgb(23 35 28 / 42%);
  content: "";
  transform: rotate(-12deg);
}

.dispatch-hatch-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, rgb(49 95 69 / 7%) 1px, transparent 1px),
    linear-gradient(rgb(49 95 69 / 7%) 1px, transparent 1px);
  background-size: 38px 38px;
}

.dispatch-hatch-map > p {
  position: absolute;
  right: clamp(18px, 3vw, 38px);
  bottom: 14px;
  left: clamp(18px, 3vw, 38px);
  z-index: 12;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgb(23 35 28 / 35%);
  color: #3e4a42;
  background: rgb(255 250 240 / 90%);
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.4;
  text-align: center;
}

.dispatch-hatch-loading {
  position: absolute;
  bottom: 8%;
  left: 3%;
  z-index: 3;
  padding: 8px;
  border: 2px dashed #756e62;
  color: #756e62;
  font: 900 0.46rem/1.15 ui-monospace, "SFMono-Regular", Menlo, monospace;
  letter-spacing: 0.08em;
  text-align: center;
  transform: rotate(-2deg);
}

.dispatch-hatch-zone {
  position: absolute;
  z-index: 8;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 8px;
  min-width: 130px;
  min-height: 68px;
  padding: 9px 11px;
  align-content: center;
  border: 2px solid var(--dispatch-ink);
  border-radius: 7px;
  color: var(--dispatch-ink);
  background: #fffaf0;
  box-shadow: 4px 5px 0 rgb(23 35 28 / 28%);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.dispatch-hatch-zone > span {
  grid-row: 1 / 3;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  color: var(--dispatch-red);
  font: 950 0.6rem/1 ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.dispatch-hatch-zone strong {
  align-self: end;
  font-size: 0.65rem;
  line-height: 1.15;
}

.dispatch-hatch-zone small {
  color: #667067;
  font-size: 0.5rem;
  font-weight: 750;
  line-height: 1.2;
}

.dispatch-hatch-zone:disabled {
  cursor: default;
  opacity: 0.72;
}

.dispatch-hatch[data-active-shift] .dispatch-hatch-zone:not(:disabled):hover,
.dispatch-hatch[data-active-shift] .dispatch-hatch-zone:not(:disabled):focus-visible {
  z-index: 11;
  background: #fff;
  box-shadow: 7px 8px 0 var(--dispatch-yellow);
  transform: translate(-2px, -2px);
}

.dispatch-hatch-zone[data-route-status="next"] {
  border-color: var(--dispatch-red);
  box-shadow: 0 0 0 4px rgb(241 199 91 / 52%), 5px 6px 0 var(--dispatch-ink);
}

.dispatch-hatch-zone[data-route-status="done"] {
  color: #fff;
  background: var(--dispatch-green);
  box-shadow: 3px 4px 0 var(--dispatch-ink);
}

.dispatch-hatch-zone[data-route-status="done"] > span,
.dispatch-hatch-zone[data-route-status="done"] small {
  color: #fff;
}

.dispatch-hatch-zone.is-crease { bottom: 34%; left: 17%; }
.dispatch-hatch-zone.is-detour { top: 8%; left: 38%; }
.dispatch-hatch-zone.is-fixture { right: 25%; bottom: 31%; }
.dispatch-hatch-zone.is-hatch {
  top: 18%;
  right: 2.5%;
  border-width: 3px;
  color: #fff;
  background: var(--dispatch-red);
  box-shadow: inset 0 0 0 4px #efdcb9, 5px 6px 0 var(--dispatch-ink);
}

.dispatch-hatch-zone.is-hatch small,
.dispatch-hatch-zone.is-hatch > span {
  color: #fff;
}

.dispatch-hatch-zone.is-hatch::after {
  position: absolute;
  right: 8px;
  bottom: 7px;
  width: 7px;
  height: 7px;
  border: 2px solid #fff;
  border-radius: 50%;
  content: "";
}

.dispatch-hatch button:focus-visible,
.dispatch-hatch-result:focus-visible {
  outline: 4px solid var(--dispatch-yellow);
  outline-offset: 4px;
}

.dispatch-hatch-parcel {
  position: absolute;
  z-index: 10;
  bottom: 16%;
  left: 8%;
  display: grid;
  width: 72px;
  height: 54px;
  padding: 7px;
  place-items: center;
  border: 2px solid var(--dispatch-ink);
  color: var(--dispatch-ink);
  background: #cb9c67;
  box-shadow: 4px 5px 0 rgb(23 35 28 / 23%);
  pointer-events: none;
  transform: rotate(4deg);
  transition: top 430ms cubic-bezier(0.2, 0.75, 0.2, 1), right 430ms cubic-bezier(0.2, 0.75, 0.2, 1), bottom 430ms cubic-bezier(0.2, 0.75, 0.2, 1), left 430ms cubic-bezier(0.2, 0.75, 0.2, 1), transform 430ms ease;
}

.dispatch-hatch-parcel span {
  padding: 3px;
  border: 1px solid;
  background: var(--dispatch-paper);
  font: 900 0.42rem/1.2 ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.dispatch-hatch-parcel i {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 50%;
  border-left: 2px solid rgb(23 35 28 / 35%);
}

.dispatch-hatch[data-parcel-zone="crease"] .dispatch-hatch-parcel { bottom: 48%; left: 24%; transform: rotate(-4deg); }
.dispatch-hatch[data-parcel-zone="detour"] .dispatch-hatch-parcel { top: 24%; bottom: auto; left: 46%; transform: rotate(7deg); }
.dispatch-hatch[data-parcel-zone="fixture"] .dispatch-hatch-parcel { right: 32%; bottom: 45%; left: auto; transform: rotate(-2deg); }
.dispatch-hatch[data-parcel-zone="hatch"] .dispatch-hatch-parcel { top: 33%; right: 7%; bottom: auto; left: auto; transform: rotate(2deg) scale(0.72); }

.dispatch-hatch.is-wrong-turn .dispatch-hatch-parcel {
  animation: dispatch-return-to-sender 420ms ease;
}

.dispatch-hatch-wear {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.dispatch-hatch-wear i {
  position: absolute;
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--dispatch-pale);
  opacity: 0.42;
  transform-origin: left center;
}

.dispatch-hatch-wear.is-current i {
  height: 9px;
  background: var(--dispatch-bright);
  box-shadow: 0 0 0 2px rgb(255 250 240 / 78%);
  opacity: 0.94;
}

.dispatch-hatch-wear .is-loading-crease { bottom: 30%; left: 14%; width: 17%; transform: rotate(-29deg); }
.dispatch-hatch-wear .is-crease-fixture { bottom: 51%; left: 28%; width: 34%; transform: rotate(-7deg); }
.dispatch-hatch-wear .is-crease-detour { bottom: 55%; left: 29%; width: 27%; transform: rotate(-48deg); }
.dispatch-hatch-wear .is-detour-fixture { top: 30%; left: 51%; width: 24%; transform: rotate(51deg); }
.dispatch-hatch-wear .is-fixture-hatch { top: 44%; right: 8%; width: 24%; transform: rotate(-34deg); transform-origin: right center; }
.dispatch-hatch-wear.is-current .is-loading-crease { bottom: 27%; }
.dispatch-hatch-wear.is-current .is-fixture-hatch { top: 47%; right: 7%; }

.dispatch-hatch-wear > span {
  position: absolute;
  bottom: 7%;
  left: 36%;
  padding: 4px 6px;
  border: 1px solid currentColor;
  color: #6d6a60;
  background: rgb(255 250 240 / 84%);
  font: 900 0.44rem/1 ui-monospace, "SFMono-Regular", Menlo, monospace;
  letter-spacing: 0.06em;
  transform: rotate(-3deg);
}

.dispatch-hatch-wear.is-current > span {
  bottom: 3%;
  left: 57%;
  color: var(--dispatch-bright);
  transform: rotate(2deg);
}

.dispatch-hatch-obstacle {
  position: absolute;
  z-index: 6;
  bottom: 39%;
  left: 43%;
  display: grid;
  width: 138px;
  min-height: 92px;
  padding: 13px;
  align-content: center;
  border: 3px solid var(--dispatch-ink);
  color: var(--dispatch-ink);
  background: var(--dispatch-yellow);
  box-shadow: 7px 8px 0 var(--dispatch-red);
  text-align: center;
  transform: rotate(3deg);
}

.dispatch-hatch-obstacle i {
  position: absolute;
  right: 12px;
  bottom: -12px;
  left: 12px;
  border-top: 5px solid var(--dispatch-ink);
}

.dispatch-hatch-obstacle i::before,
.dispatch-hatch-obstacle i::after {
  position: absolute;
  top: -1px;
  width: 11px;
  height: 11px;
  border: 3px solid var(--dispatch-ink);
  border-radius: 50%;
  background: var(--dispatch-paper);
  content: "";
}

.dispatch-hatch-obstacle i::before { left: 4px; }
.dispatch-hatch-obstacle i::after { right: 4px; }
.dispatch-hatch-obstacle strong { font: 950 0.62rem/1.2 ui-monospace, "SFMono-Regular", Menlo, monospace; }
.dispatch-hatch-obstacle span { margin-top: 5px; font-size: 0.48rem; font-weight: 780; line-height: 1.25; }

.dispatch-hatch-console {
  display: grid;
  min-width: 0;
  padding: clamp(28px, 4vw, 48px);
  align-content: center;
  background: var(--dispatch-paper);
}

.dispatch-hatch-ticket {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 11px 13px;
  border: 2px dashed var(--dispatch-red);
  color: var(--dispatch-red);
  background: #fff1e9;
}

.dispatch-hatch-step {
  color: var(--dispatch-red);
}

.dispatch-hatch-console h3 {
  margin: 10px 0 14px;
  font-size: clamp(2rem, 4vw, 3.8rem);
  letter-spacing: -0.06em;
  line-height: 0.94;
  text-wrap: balance;
}

.dispatch-hatch-console > p:not(.dispatch-hatch-step, .dispatch-hatch-status) {
  margin: 0;
  color: #4f5951;
  font-size: 0.8rem;
  line-height: 1.55;
}

.dispatch-hatch-route-list {
  display: grid;
  gap: 7px;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}

.dispatch-hatch-route-list li {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  gap: 9px;
  min-height: 38px;
  padding: 7px 9px;
  align-items: center;
  border: 1px solid #a79f90;
  border-radius: 4px;
  color: #5d645e;
  background: #f4eee2;
}

.dispatch-hatch-route-list li > span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font: 900 0.52rem/1 ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.dispatch-hatch-route-list li strong {
  font-size: 0.61rem;
  line-height: 1.2;
}

.dispatch-hatch-route-list li[data-route-status="next"] {
  border: 2px solid var(--dispatch-red);
  color: var(--dispatch-red);
  background: #fff4dc;
}

.dispatch-hatch-route-list li[data-route-status="done"] {
  border-color: var(--dispatch-green);
  color: #fff;
  background: var(--dispatch-green);
}

.dispatch-hatch-start {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 74px;
  padding: 14px 18px;
  border: 2px solid var(--dispatch-ink);
  color: #fff;
  background: var(--dispatch-red);
  box-shadow: 6px 7px 0 var(--dispatch-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dispatch-hatch-start.is-return {
  background: var(--dispatch-bright);
}

.dispatch-hatch-start span {
  font-size: 0.8rem;
  font-weight: 900;
}

.dispatch-hatch-start small {
  color: #ffe1d8;
  font-size: 0.56rem;
  font-weight: 740;
}

.dispatch-hatch-start.is-return small {
  color: #ddf6e8;
}

.dispatch-hatch-start:hover {
  box-shadow: 8px 9px 0 var(--dispatch-ink);
  transform: translate(-1px, -1px);
}

.dispatch-hatch-status {
  min-height: 3.1em;
  margin: 17px 0 0;
  color: #59625b;
  font-size: 0.68rem;
  font-weight: 780;
  line-height: 1.45;
}

.dispatch-hatch-result,
.dispatch-hatch-error {
  display: grid;
  gap: 7px;
  margin-top: 22px;
  padding: 17px;
  border: 3px solid var(--dispatch-green);
  background: #edf3e9;
  box-shadow: 7px 8px 0 var(--dispatch-yellow);
}

.dispatch-hatch-result > span {
  color: var(--dispatch-red);
  font: 950 0.55rem/1 ui-monospace, "SFMono-Regular", Menlo, monospace;
  letter-spacing: 0.08em;
}

.dispatch-hatch-result > strong {
  font-size: 0.79rem;
  line-height: 1.25;
}

.dispatch-hatch-result > p,
.dispatch-hatch-error > p {
  margin: 0;
  color: #536057;
  font-size: 0.63rem;
  font-weight: 690;
  line-height: 1.45;
}

.dispatch-hatch-result.is-return {
  border-color: var(--dispatch-bright);
  background: #e2f3e9;
  box-shadow: 8px 9px 0 #96cfac;
}

.dispatch-hatch-error {
  border-color: var(--dispatch-red);
  background: #fff1e9;
  box-shadow: none;
}

.dispatch-hatch-error > strong {
  font-size: 0.72rem;
}

.dispatch-hatch-legend {
  display: flex;
  gap: 18px 28px;
  padding: 17px clamp(22px, 4vw, 44px);
  flex-wrap: wrap;
  border-top: 2px solid var(--dispatch-ink);
  color: #edf4ee;
  background: var(--dispatch-green);
}

.dispatch-hatch-legend span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.dispatch-hatch-legend i {
  display: inline-block;
  width: 34px;
  border-top: 5px solid #bcb8ab;
  border-radius: 999px;
}

.dispatch-hatch-legend i.is-current {
  border-color: #5bd18d;
}

@keyframes dispatch-return-to-sender {
  0%, 100% { transform: rotate(4deg) translateX(0); }
  24% { transform: rotate(-7deg) translateX(-8px); }
  48% { transform: rotate(8deg) translateX(7px); }
  72% { transform: rotate(-4deg) translateX(-4px); }
}

@media (max-width: 980px) {
  .dispatch-hatch-board {
    grid-template-columns: 1fr;
  }

  .dispatch-hatch-map {
    min-height: 590px;
    padding-bottom: 70px;
    border-right: 0;
    border-bottom: 2px solid var(--dispatch-ink);
  }

  .dispatch-hatch-console {
    min-height: 550px;
  }
}

@media (max-width: 650px) {
  .dispatch-hatch-heading {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 29px 20px 32px;
  }

  .dispatch-hatch-heading h2 {
    font-size: clamp(2.75rem, 15vw, 4.5rem);
  }

  .dispatch-hatch-room-tag {
    width: 132px;
    min-height: 88px;
    justify-self: start;
  }

  .dispatch-hatch-map {
    min-height: 510px;
    padding: 24px 12px 65px;
  }

  .dispatch-hatch-map-paper {
    width: 100%;
    min-height: 390px;
    aspect-ratio: auto;
  }

  .dispatch-hatch-zone {
    min-width: 112px;
    min-height: 61px;
    padding: 7px;
  }

  .dispatch-hatch-zone > span {
    width: 25px;
    height: 25px;
  }

  .dispatch-hatch-zone strong { font-size: 0.57rem; }
  .dispatch-hatch-zone small { font-size: 0.45rem; }
  .dispatch-hatch-zone.is-crease { bottom: 29%; left: 12%; }
  .dispatch-hatch-zone.is-detour { top: 6%; left: 29%; }
  .dispatch-hatch-zone.is-fixture { right: 21%; bottom: 29%; }
  .dispatch-hatch-zone.is-hatch { top: 18%; right: 1%; }

  .dispatch-hatch-obstacle {
    bottom: 38%;
    left: 39%;
    width: 112px;
    min-height: 78px;
    padding: 9px;
  }

  .dispatch-hatch-obstacle strong { font-size: 0.54rem; }
  .dispatch-hatch-obstacle span { font-size: 0.42rem; }
  .dispatch-hatch-parcel { width: 60px; height: 46px; }
  .dispatch-hatch[data-parcel-zone="crease"] .dispatch-hatch-parcel { bottom: 44%; left: 19%; }
  .dispatch-hatch[data-parcel-zone="detour"] .dispatch-hatch-parcel { top: 22%; left: 42%; }
  .dispatch-hatch[data-parcel-zone="fixture"] .dispatch-hatch-parcel { right: 31%; bottom: 42%; }
  .dispatch-hatch-console { min-height: 0; padding: 32px 20px 39px; }
}

@media (max-width: 390px) {
  .dispatch-hatch-map { min-height: 475px; padding-right: 8px; padding-left: 8px; }
  .dispatch-hatch-map-paper { min-height: 360px; }
  .dispatch-hatch-zone { min-width: 101px; min-height: 57px; }
  .dispatch-hatch-zone strong { font-size: 0.52rem; }
  .dispatch-hatch-zone small { display: none; }
  .dispatch-hatch-zone.is-crease { left: 8%; }
  .dispatch-hatch-zone.is-detour { left: 28%; }
  .dispatch-hatch-zone.is-fixture { right: 18%; }
  .dispatch-hatch-obstacle { left: 37%; width: 102px; }
  .dispatch-hatch-parcel { width: 54px; height: 42px; }
  .dispatch-hatch-loading { left: 1%; font-size: 0.4rem; }
  .dispatch-hatch-wear > span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dispatch-hatch *,
  .dispatch-hatch *::before,
  .dispatch-hatch *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
