:root {
  color-scheme: dark;
  --background: #140e0f;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--background);
  color: #fff;
  font-family: system-ui, sans-serif;
}

/* Landscape uses a shared 1920 × 1080 reference frame.
   Portrait uses the separate composition defined below. */
.stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: min(100vw, 177.7777778vh);
  height: min(100vh, 56.25vw);
  width: min(100vw, 177.7777778dvh);
  height: min(100dvh, 56.25vw);
  background: var(--background);
}

button { font: inherit; color: inherit; }
.scene-button, .image-control {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.scene-button, .scene-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.scene-button img, .scene-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
button:focus-visible, a:focus-visible {
  outline: 2px solid #a1f5ef;
  outline-offset: 3px;
}
.scene-button:focus-visible { outline-offset: -4px; }

.club {
  background: var(--background) url("images/dj_table1.png") center bottom / 100% auto no-repeat;
}
.image-control { position: absolute; z-index: 2; }
.image-control img { display: block; width: 100%; height: auto; }
.image-control .alternate {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.image-control:focus-visible .alternate,
.image-control:active .alternate { opacity: 1; }
.image-control:focus-visible .normal,
.image-control:active .normal { opacity: 0; }
@media (hover: hover) {
  .image-control:hover .alternate { opacity: 1; }
  .image-control:hover .normal { opacity: 0; }
}
.mirror-ball { left: 45%; top: 0; width: 10%; z-index: 3; }
.exit-door { right: 3%; top: 7%; width: 10%; }
.animal-switch { left: 47%; top: 81%; width: 6%; }
.music-switches {
  position: absolute;
  z-index: 2;
  left: 41.5%;
  top: 91%;
  width: 17%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5.88235294%;
}
.music-switch { position: relative; width: 100%; }

/* The animal box is proportional, and each sprite stays inside it. */
.animal-area {
  position: absolute;
  inset: 12% 16% 47%;
  overflow: hidden;
  pointer-events: none;
}
.animal {
  position: absolute;
  width: 15.32%;
  aspect-ratio: 1;
  object-fit: contain;
}
.sound-status, .notice {
  position: absolute;
  z-index: 5;
  bottom: 2%;
  left: 2%;
  max-width: 60%;
  margin: 0;
  padding: 6px 8px;
  background: var(--background);
  color: #fff;
  font-size: clamp(11px, 1vw, 14px);
}
.notice a { color: #a1f5ef; }
@media (pointer: coarse) {
  /* Expand the hit areas without moving or enlarging the illustrations. */
  .image-control::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }
  .music-switch::after { width: 100%; }
}

/* Portrait: a separate full-height composition, not a scaled landscape stage.
   The original DJ illustration has transparent margins. Enlarging its canvas
   to 225% makes the visible DJ table 92% of the screen width. The cat and
   switches use the same width-based coordinate system as that illustration. */
@media (orientation: portrait) {
  .stage {
    width: 100%;
    height: 100vh;
    height: 100dvh;
  }
  .club {
    background-size: 225% auto;
  }
  .mirror-ball {
    left: 50%;
    top: 2%;
    width: min(30vw, 17vh);
    width: min(30vw, 17dvh);
    transform: translateX(-50%);
  }
  .exit-door {
    right: 2%;
    top: 3%;
    width: min(22vw, 15vh);
    width: min(22vw, 15dvh);
  }
  .animal-area {
    inset: 20% 5% calc(42vw + 2%);
  }
  .animal {
    width: min(32%, 14vh);
    width: min(32%, 14dvh);
  }
  .animal-switch {
    left: 43.25%;
    top: calc(100% - 24.05vw);
    width: 13.5%;
  }
  .music-switches {
    left: 30.875%;
    top: calc(100% - 11.39vw);
    width: 38.25%;
  }
}
