/* Zero Square Theatre sits on the existing painted courtyard. */
body[data-place="zero-square"] .shuffle-stage {
  position: relative;
  container-type: inline-size;
  background: #eedbb3;
}
.shuffle-stage > img {
  display: block;
  width: 100%;
}
.shuffle-theatre {
  --shuffle-seat-height: clamp(3.15rem, 15cqw, 8rem);
  position: absolute;
  inset: 45% 4% 5%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  color: #40291b;
  text-align: center;
}
.shuffle-marquee,
.shuffle-caption {
  margin: 0;
  border: 1px solid #825633;
  border-radius: 7px;
  background: linear-gradient(110deg, #fff4cf, #f3dca6 68%, #f9e9bd);
  box-shadow: 0 2px 4px #53331d45, inset 0 0 0 2px #fff0c2;
}
.shuffle-marquee {
  display: grid;
  padding: .3rem clamp(.7rem, 3cqw, 1.5rem);
}
.shuffle-marquee span,
.shuffle-kicker {
  font: 700 .72rem/1.3 system-ui, sans-serif;
  letter-spacing: .12em;
}
.shuffle-marquee strong {
  font: 700 clamp(1.2rem, 3.5cqw, 2.35rem)/1.1 Georgia, serif;
  font-variant-numeric: lining-nums tabular-nums;
}
.shuffle-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, .9fr) repeat(3, minmax(0, 1fr));
  gap: clamp(2px, .8cqw, .5rem);
  align-items: stretch;
  width: 100%;
  isolation: isolate;
}
.shuffle-chair {
  position: relative;
  display: grid;
  grid-template-rows: var(--shuffle-seat-height) auto;
  justify-items: center;
  min-width: 0;
}
.shuffle-chair::before {
  content: "";
  position: absolute;
  inset: calc(var(--shuffle-seat-height) * .11) 0 auto;
  height: calc(var(--shuffle-seat-height) * .89);
  background: url("theatre-art/oak-chair.png") center / contain no-repeat;
}
.shuffle-chair-label {
  grid-row: 2;
  position: relative;
  z-index: 1;
  width: 100%;
  box-sizing: border-box;
  display: grid;
  align-content: center;
  border: 1px solid #895e37;
  border-radius: 3px;
  padding: .15rem 0;
  background: #fff1cc;
  box-shadow: 0 2px 1px #62432344;
  font: 600 clamp(.6rem, 1.42cqw, .8rem)/1.15 system-ui, sans-serif;
}
.shuffle-chair-label strong {
  font: 700 clamp(.8rem, 2.45cqw, 1.23rem)/1.1 Georgia, serif;
}
.shuffle-seat {
  position: relative;
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}
body[data-place="zero-square"] #counter-stage button.shuffle-seat-button {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  padding: 0;
  border: 0 !important;
  border-radius: 4px;
  background: transparent !important;
  box-shadow: none !important;
  translate: none;
}
body[data-place="zero-square"] #counter-stage button.shuffle-seat-button:focus-visible {
  outline-offset: 1px;
}
body[data-place="zero-square"] #counter-stage button.shuffle-misplaced-zero {
  position: relative;
  z-index: 4;
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0 !important;
  border-radius: 6px;
  background: transparent !important;
  box-shadow: none !important;
  translate: none;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
body[data-place="zero-square"] #counter-stage button.shuffle-perched-zero {
  width: 63%;
  height: 66%;
  align-self: start;
  justify-self: end;
  margin-top: -.55rem;
}
.shuffle-digit {
  --card-x: 52%;
  --card-y: 42%;
  --portrait-ratio: .62;
  display: block;
  position: relative;
  z-index: 2;
  height: 100%;
  aspect-ratio: var(--portrait-ratio);
  container-type: size;
  filter: drop-shadow(0 2px 1px #4a2f2350);
}
.shuffle-digit[data-costume="numberlander-ochre"] {
  --portrait-ratio: .58;
  --card-x: 53%;
  --card-y: 43%;
}
.shuffle-digit[data-costume="numberlander-burgundy"] {
  --portrait-ratio: .656;
  --card-x: 53%;
  --card-y: 43%;
}
.shuffle-digit[data-costume="zero-standing"] {
  --portrait-ratio: .52;
  --card-y: 36%;
}
.shuffle-digit img {
  display: block;
  width: 100%;
  height: 100%;
}
.shuffle-card-digit {
  position: absolute;
  top: var(--card-y);
  left: var(--card-x);
  translate: -50% -50%;
  color: #342015;
  font: 800 18.5cqh/1 system-ui, sans-serif;
  font-variant-numeric: lining-nums tabular-nums;
}
.shuffle-point {
  display: grid;
  grid-template-rows: var(--shuffle-seat-height) auto;
  align-items: end;
  justify-items: center;
  min-width: 0;
  position: relative;
}
.shuffle-point img {
  width: 100%;
  max-width: 5rem;
  height: auto;
  transform-origin: 46% 95%;
}
.shuffle-point.shuffle-trying img {
  transform: rotate(20deg);
}
.shuffle-caption {
  max-width: 100%;
  padding: .35rem .65rem;
  font: 600 clamp(.85rem, 2.5cqw, 1.25rem)/1.2 Georgia, serif;
}
.shuffle-caption strong {
  font: 700 clamp(.6rem, 1.5cqw, .78rem)/1.2 system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .06em;
}
body[data-place="zero-square"] #counter-stage .shuffle-caption {
  margin: 0;
}
.shuffle-pen {
  position: absolute;
  z-index: 3;
  right: 3%;
  bottom: calc(100% - clamp(3rem, 9dvh, 6.5rem));
  width: clamp(7.3rem, 22cqw, 17rem);
  aspect-ratio: 545 / 270;
  background: url("theatre-art/timber-pen.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 2px #57371960);
}
.shuffle-pen-sign {
  position: absolute;
  z-index: 4;
  bottom: 96%;
  left: 50%;
  translate: -50%;
  white-space: nowrap;
  border: 1px solid #895e37;
  border-radius: 3px;
  background: #fff1cc;
  padding: .12rem .35rem;
  font: 700 clamp(.66rem, 1.5cqw, .83rem)/1.2 Georgia, serif;
}
.shuffle-flock {
  position: absolute;
  inset: 3% 15% 10%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: 100%;
}
.shuffle-pen::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0;
  background: inherit;
  clip-path: inset(76% 0 0);
  pointer-events: none;
}
body[data-place="zero-square"] #counter-stage button.shuffle-pen-zero {
  display: grid;
  place-items: center;
  min-height: 44px;
  height: 100%;
  padding: 0;
  border: 0 !important;
  border-radius: 8px;
  background: transparent !important;
  box-shadow: none !important;
  translate: none;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
body[data-place="zero-square"] #counter-stage button.shuffle-pen-zero:disabled {
  opacity: 1;
  cursor: default;
}
.shuffle-pen-zero[aria-pressed="true"] .shuffle-digit {
  outline: 2px solid #285c4f;
  outline-offset: 2px;
}
.shuffle-picked-up .shuffle-digit {
  visibility: hidden;
}
body[data-place="zero-square"] #counter-stage #shuffle-return-zero {
  position: absolute;
  z-index: 5;
  inset: 0;
  width: 100%;
  padding: .3rem;
  font: 700 .75rem/1.2 system-ui, sans-serif;
}
.shuffle-drag-zero {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  height: clamp(3.5rem, 9vw, 6rem);
  transform: translate(-50%, -50%);
}
.shuffle-sound {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: .35rem 0 .8rem;
}
body[data-place="zero-square"] #counter-controls .shuffle-sound button {
  flex: 1;
  padding: .3rem;
  font: 600 .85rem/1.25 system-ui, sans-serif;
}
.shuffle-controls h2 {
  margin: .35rem 0 .6rem;
  font-size: clamp(1.45rem, 2.1vw, 2rem);
  line-height: 1.12;
}
.shuffle-controls p {
  margin: 0 0 .7rem;
}
.shuffle-controls .shuffle-kicker {
  margin: .8rem 0 .3rem;
}
.shuffle-script {
  padding: .15rem .75rem .8rem;
  border: 1px solid #b59b72;
  border-radius: 8px;
  background: #fffbef;
}
.shuffle-script h3 {
  margin: .25rem 0 .4rem;
}
.shuffle-script .shuffle-cue {
  font: 700 1.35rem/1.2 Georgia, serif;
}
.shuffle-script form {
  display: grid;
  gap: .4rem;
}
.shuffle-script :is(select, button) {
  width: 100%;
  min-height: 44px;
}
.shuffle-script select {
  box-sizing: border-box;
  border: 1px solid #927857;
  border-radius: 5px;
  padding: .4rem;
  color: #40291b;
  background: #fffdf5;
  font: inherit;
}
.shuffle-script label {
  font-weight: 700;
}
.shuffle-script button {
  margin-top: .25rem;
}
.shuffle-script details {
  margin-top: .4rem;
}
.shuffle-script summary {
  cursor: pointer;
}
.shuffle-script details p,
.shuffle-script #shuffle-feedback:not(:empty) {
  margin: .55rem 0 0;
}
.shuffle-script #shuffle-stop {
  font-weight: 700;
}
@container (max-width: 690px) {
  .shuffle-pen {
    width: clamp(7.3rem, 20cqw, 9rem);
    right: 1%;
  }
}
@media (max-width: 1199px) {
  body.atlas-location #counter-stage.shuffle-stage {
    min-height: 265px !important;
    overflow: hidden !important;
  }
  body.atlas-location .shuffle-stage > img {
    position: absolute;
    inset: 0;
    height: 100% !important;
  }
  .shuffle-theatre {
    inset: 38% 2% 3%;
    grid-template-rows: minmax(0, .6fr) auto minmax(0, 1.4fr);
  }
  .shuffle-pen {
    right: 3%;
    bottom: calc(100% - clamp(0px, (100cqw - 560px) * .12, 3rem));
  }
}
@media (max-width: 510px) {
  .shuffle-chair-label span { display: none; }
  .shuffle-marquee { translate: 0 -.3rem; }
  .shuffle-pen {
    bottom: calc(100% + 1.45rem);
    width: 6.5rem;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .shuffle-point img { transition: transform .35s ease-out; }
}
