body.location-page[data-place="amazing-prime"] .prime-centre:has(.depot-arrival:not([hidden])) {
  align-self: start !important;
  min-height: 0 !important;
  aspect-ratio: 1402 / 1122 !important;
  overflow: hidden !important;
}

body.location-page[data-place="amazing-prime"] .painted-depot > img {
  display: block;
  object-fit: contain !important;
  object-position: center !important;
}

.depot-arrival {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.yard-figure {
  position: absolute;
  display: block;
  height: var(--figure-height);
  width: auto;
}

.yard-driver {
  --figure-height: 5.05%;
  left: 16.35%;
  top: 46.85%;
  width: 4.25%;
  object-fit: cover;
  object-position: center top;
  filter: brightness(.86) saturate(.88);
  clip-path: polygon(11% 8%, 83% 0, 95% 18%, 100% 97%, 1% 100%, 0 35%);
}

.yard-truck-worker {
  --figure-height: 19.3%;
  left: 13.8%;
  top: 50.2%;
  transform: translateX(-50%);
  filter: drop-shadow(2px 2px 2px #34241755);
}

.yard-stock-worker {
  --figure-height: 11.7%;
  left: 57.2%;
  bottom: 41.5%;
  transform: translateX(-50%);
  filter: brightness(.77) saturate(.9);
}

.yard-greeter {
  display: block;
  width: 100%;
  height: min(53svh, 510px);
  margin: .75rem auto 0;
  object-fit: contain;
}

#activity .locker-entrance {
  position: absolute;
  left: 70%;
  top: 45%;
  width: 20%;
  height: 26%;
  min-height: 0;
  padding: 0;
  /* Older copies of the shared Numberland theme give every action button an amber fill. */
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  translate: none !important;
  color: #fff8e9;
  pointer-events: auto;
}

#activity .locker-entrance:hover,
#activity .locker-entrance:focus-visible {
  box-shadow: 0 0 0 2px #ffe7a5, 0 0 18px #ffe7a588 !important;
}

.locker-scene {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 650px;
  background: #b1a08a url("locker-interior.jpg") center bottom / cover no-repeat;
  border-radius: inherit;
  overflow: hidden;
  container-type: inline-size;
}

.locker-title {
  position: absolute;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.locker-stage {
  position: relative;
  display: grid;
  grid-template-columns: clamp(54px, 24%, 250px) minmax(0, 1fr);
  gap: .5rem;
  padding: clamp(.55rem, 1.6vw, 1.25rem);
  container-type: size;
  overflow: hidden;
}

.locker-porter {
  width: 100%;
  aspect-ratio: 1;
  align-self: end;
  background: url("locker-porter.png") left bottom / 300% 100% no-repeat;
}

.locker-worker {
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: .5rem;
  min-width: 0;
  min-height: 0;
}

.locker-stage .locker-porter {
  flex: none;
  align-self: start;
  width: min(100%, max(54px, 100cqh - 10rem));
  filter: drop-shadow(3px 4px 3px #33211477);
}

.porter-dialogue {
  position: relative;
  z-index: 5;
  flex: none;
  max-inline-size: 18rem;
  padding: .5rem .65rem;
  border: 1px solid #a1845a;
  border-radius: 10px;
  background: #fff7e8;
  color: #30251b;
  box-shadow: 0 3px 8px #33211455;
  font-size: .92rem;
  line-height: 1.35;
}

.porter-dialogue::after {
  content: '';
  position: absolute;
  left: 40%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  background: inherit;
  border-right: 1px solid #a1845a;
  border-bottom: 1px solid #a1845a;
}

.porter-dialogue p {
  margin: 0;
}

.porter-dialogue button {
  min-height: 30px;
  margin-top: .35rem;
  padding: .15rem .6rem;
  font-size: .85rem;
}

.locker-porter[data-pose^="talk-"] {
  background-image: url("locker-porter-speaking.png");
  background-size: 200% 100%;
}

.locker-porter[data-pose="talk-empty"] {
  background-position: right bottom;
}

.depot-arrival .yard-porter {
  position: absolute;
  left: 57%;
  bottom: 30.5%;
  width: 15%;
  filter: drop-shadow(2px 3px 2px #36261766);
}

.locker-porter[data-pose="placing"] {
  background-position: center bottom;
}

.locker-porter[data-pose="empty"] {
  background-position: right bottom;
}

.locker-bay {
  container-type: size;
  display: grid;
  place-items: center;
  min-width: 0;
  overflow: hidden;
}

.locker-grid {
  --cell: min(100px, calc((100cqw - 12px) / var(--columns)), calc((100cqh - 12px) / var(--rows) * 1.2));
  display: grid;
  grid-template-columns: repeat(var(--columns), var(--cell));
  grid-template-rows: repeat(var(--rows), calc(var(--cell) / 1.2));
  padding: 5px;
  border: 1px solid #17292c;
  border-radius: 5px;
  background: linear-gradient(110deg, #5e7374, #253c40 58%, #485f62);
  box-shadow: 2px 4px 7px #261c1755;
}

.locker {
  position: relative;
  overflow: hidden;
  container-type: size;
  background: linear-gradient(155deg, #16262a, #334247 80%, #6a7d80);
  border: 1px solid #25363a;
  perspective: 150px;
}

.locker-door {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform-origin: left;
  background: #365861 url("locker-doors.jpg") var(--door-position, left top) / 200% 200% no-repeat;
}

.locker-door::before {
  content: '';
  position: absolute;
  inset: 31% 30% 36% 19%;
  background: url("amazing-prime-logo.svg") center / contain no-repeat #e4c793;
  border-radius: 2px;
  opacity: .86;
}

.chipped { --door-position: right top; }
.dented { --door-position: left bottom; }
.scratched { --door-position: right bottom; }

@container (width < 36px) {
  .locker-door::before { display: none; }
}

.locker-light {
  position: absolute;
  z-index: 3;
  top: 10%;
  right: 10%;
  width: 14%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #203437;
}

.locker.loaded .locker-light {
  background: #b8f79b;
  box-shadow: 0 0 5px #b8f79b;
}

.locker-grid.is-complete .unfinished-row {
  border-bottom-color: #e6af55;
}

.locker-grid.is-complete .locker:not(.loaded) .locker-door {
  filter: brightness(.68) saturate(.65);
}

.locker-parcel {
  position: absolute;
  z-index: 1;
  inset: 21% 20% 15%;
  display: grid;
  place-items: center;
  color: #2d2317;
  background: linear-gradient(90deg, #be965f 39%, #e2c492 40% 58%, #ac804c 59%);
  border: 1px solid #604221;
  font: 700 min(15px, 24cqw) / 1 system-ui, sans-serif;
  opacity: 0;
}

.locker.loading .locker-door {
  animation: swing-door 440ms ease-in-out both;
}

.locker.loading .locker-parcel {
  animation: deliver-parcel 440ms ease-out both;
}

@keyframes swing-door {
  0%, 100% { transform: rotateY(0); }
  28%, 72% { transform: rotateY(-84deg); }
}

@keyframes deliver-parcel {
  0%, 25% { transform: translate(28%, 95%) scale(1.2); opacity: 0; }
  38% { opacity: 1; }
  72%, 100% { transform: none; opacity: 1; }
}

.locker-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  grid-template-rows: minmax(0, 1fr);
  block-size: 10rem;
  gap: .75rem;
  padding: .75rem;
  border-top: 1px solid #f5d89b88;
  background: linear-gradient(#32211312, #32211348);
  font-size: .9rem;
  line-height: 1.4;
}

.locker-toolbar > * {
  min-width: 0;
  min-height: 0;
  padding: .55rem .75rem;
  overflow: auto;
  border: 1px solid #ac9471;
  border-radius: 9px;
  background: #fff7e8ec;
  box-shadow: 0 2px 6px #35261555;
}

.locker-toolbar h3 {
  margin: 0 0 .2rem;
  color: #433323;
  font-size: 1rem;
  line-height: 1.3;
}

#locker-instructions {
  margin: 0 0 .45rem;
}

.locker-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .45rem;
}

.locker-tools label {
  font-size: .8rem;
}

.locker-tools input[type="number"],
.locker-tools select {
  width: 100%;
  min-height: 36px;
  margin-top: .18rem;
  padding: .25rem .4rem;
}

.locker-tools button {
  min-height: 36px;
  padding: .35rem .6rem;
}

#new-load {
  inline-size: 8.5rem;
}

.locker-feedback:focus-visible {
  outline: 2px solid #285c4f;
  outline-offset: -3px;
}

.locker-feedback p {
  margin: 0;
}

.locker-feedback p + p {
  margin-top: .2rem;
}

#dispatch-feedback.is-discovery {
  padding: .65rem .75rem;
  border-left: 3px solid #285c4f;
  border-radius: 4px;
  background: #e9f0e4;
}

.locker-progress,
#trial-record {
  font-size: .8rem;
}

#trial-record:empty {
  display: none;
}

#locker-controls button:disabled {
  opacity: .55;
  cursor: default;
}

.locker-sound {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 36px;
  font-size: .85rem;
}

.locker-sound input {
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  margin: 0;
  accent-color: #285c4f;
}

@media (min-width: 1200px) {
  body.location-page[data-place="amazing-prime"] .prime-workspace:has(.locker-scene:not([hidden])) {
    height: max(470px, var(--location-height, 650px));
    grid-template-rows: minmax(0, 1fr) !important;
  }

  body.location-page[data-place="amazing-prime"] .prime-workspace:has(.locker-scene:not([hidden])) > :is(.prime-intro, .prime-instructions) {
    grid-row: 1 !important;
    overflow: auto !important;
  }

  body.location-page[data-place="amazing-prime"] .prime-centre:has(.locker-scene:not([hidden])) {
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .locker-scene {
    height: 100%;
    min-height: 0;
  }

  body.location-page[data-place="amazing-prime"]:has(.locker-scene:not([hidden])) > footer {
    padding: 0 1rem;
    font-size: .8rem;
    line-height: 20px;
  }
}

@media (max-width: 1199px) {
  body.location-page[data-place="amazing-prime"] .prime-centre:has(.locker-scene:not([hidden])) {
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .locker-scene {
    grid-template-rows: clamp(260px, 52svh, 520px) auto;
    min-height: 0;
  }
}

@container (max-width: 800px) {
  .locker-stage {
    padding-block-start: 8.25rem;
    background: url("locker-interior.jpg") center bottom / cover no-repeat;
  }

  .locker-stage .locker-porter {
    width: min(100%, 90cqh);
  }

  .porter-dialogue {
    position: absolute;
    inset: .6rem auto auto .6rem;
    width: min(22rem, calc(100% - 1.2rem));
    max-inline-size: none;
  }

  .porter-dialogue::after {
    left: 10%;
  }

  .locker-toolbar {
    block-size: 12rem;
  }
}

@container (max-width: 510px) {
  .locker-toolbar {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 9rem;
    block-size: auto;
  }
}

.flying-parcel {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  width: 18px;
  height: 14px;
  background: linear-gradient(90deg, #be965f 39%, #e2c492 40% 58%, #ac804c 59%);
  border: 1px solid #604221;
  opacity: 0;
  pointer-events: none;
}
