/* One painted room; animated details share the painting's native coordinates. */
body.pixel-palace {
  background: #030719 !important;
}

.pixel-palace #palaceStage {
  width: 1774px;
  height: 887px;
  overflow: hidden;
  background: #030719 url('assets/pixel-palace/room-v82.webp') 0 0 / 1774px 887px no-repeat;
}

.pixel-palace .palace-background,
.pixel-palace:not(.palace-paid) .palace-background,
.pixel-palace.palace-paid .palace-background,
.pixel-palace.room-animated .palace-background,
.pixel-palace.palace-paid.room-animated .palace-background {
  background: none !important;
}

/* Interface borders are live CSS, never photographed fragments of another wall. */
.pixel-palace:not(.responsive-room) #siteTopbar header nav,
.pixel-palace:not(.responsive-room) #playerCard,
.pixel-palace:not(.responsive-room) #overallBoard,
.pixel-palace:not(.responsive-room) #siteTopbar .music-controls,
.pixel-palace:not(.responsive-room) #roomMotionPanel {
  box-sizing: border-box;
  border: 2px solid #338fc2;
  border-radius: 8px;
  background: linear-gradient(145deg, #081a35f5, #030e24fa);
  box-shadow: inset 0 0 0 2px #07122b, 0 3px 0 #020716, 0 0 15px #30b7ff16;
}

.pixel-palace:not(.responsive-room) #siteTopbar .brand {
  left: 495px;
  top: 8px;
  width: 785px;
  height: 145px;
  background: none;
}

.pixel-palace:not(.responsive-room) #siteTopbar .early-access-banner {
  left: 767px;
  top: 128px;
  width: 240px !important;
  height: 23px !important;
  gap: 3px;
  background: none;
}

.pixel-palace:not(.responsive-room) #siteTopbar .early-access-banner > span {
  font: 700 18px/23px 'Chakra Petch', sans-serif;
  color: #72e8ff;
  text-shadow: 0 1px #02061c, 0 0 10px #29baff50;
}

.pixel-palace:not(.responsive-room) #siteTopbar header nav {
  left: 475px;
  top: 180px;
  width: 825px;
  height: 42px;
  padding: 2px;
  overflow: hidden;
}

.pixel-palace:not(.responsive-room) #siteTopbar header nav > a,
.pixel-palace:not(.responsive-room) #siteTopbar header nav > button {
  height: 34px;
  padding: 2px 6px;
  border-right: 1px solid #183f62;
  line-height: 15px;
  white-space: normal;
}

.pixel-palace:not(.responsive-room) #siteTopbar header nav > :last-child {
  border-right: 0;
}

body.pixel-palace:not(.responsive-room) #palaceStage main {
  top: 235px;
}

body.pixel-palace.palace-account:not(.responsive-room) #palaceStage main {
  height: 460px;
}

body.pixel-palace:is(.in-machine, .palace-workspace):not(.responsive-room) #palaceStage main {
  height: 622px;
}

.pixel-palace.in-machine:not(.responsive-room) .machine-browser {
  height: 534px;
}

.pixel-palace.in-machine:not(.responsive-room) .machine-rules {
  max-height: 395px;
}

.pixel-palace.in-machine:not(.responsive-room) .machine-interior.cabinet-closeup {
  position: relative;
}

.pixel-palace.in-machine:not(.responsive-room) .cabinet-pick-buttons,
.pixel-palace.in-machine:not(.responsive-room) .cabinet-page-buttons {
  position: absolute;
  left: calc(100% + 16px);
  width: 142px;
  margin: 0;
}

.pixel-palace.in-machine:not(.responsive-room) .cabinet-pick-buttons {
  top: 110px;
  flex-direction: column;
}

.pixel-palace.in-machine:not(.responsive-room) .cabinet-page-buttons {
  top: 230px;
}

.pixel-palace.in-machine:not(.responsive-room) .cabinet-pick-buttons button,
.pixel-palace.in-machine:not(.responsive-room) .cabinet-page-buttons button {
  min-height: 44px;
  height: auto;
  padding: 8px;
  line-height: 1.3;
}

.pixel-palace:not(.responsive-room) #playerCard {
  left: 286px;
  top: 272px;
  width: 218px;
  height: 298px;
  padding: 12px;
}

.pixel-palace:not(.responsive-room) #overallBoard {
  left: 1275px;
  top: 272px;
  width: 232px;
  height: 298px;
  padding: 12px;
}

.pixel-palace:not(.responsive-room) #siteTopbar .music-controls {
  left: min(1273px, calc(var(--room-visible-right, 1774px) - 424px));
  top: 710px;
  width: 400px;
  height: 147px;
  padding: 33px 14px 10px;
}

.pixel-palace.in-machine:not(.responsive-room) #siteTopbar .music-controls {
  left: 302px;
  top: 710px;
  width: 340px;
  height: 140px;
}

.pixel-palace:not(.responsive-room) #roomMotionPanel {
  left: max(40px, calc(var(--room-visible-left, 0px) + 24px));
  top: 735px;
}

/* Keep the switch reachable beside the header while the editor fills the room. */
.pixel-palace:is(.in-machine, .palace-workspace):not(.responsive-room) #roomMotionPanel {
  top: 180px;
  width: 150px;
  height: 42px;
  padding: 0;
  justify-content: center;
}

.pixel-palace:is(.in-machine, .palace-workspace):not(.responsive-room) #roomMotionPanel > span {
  display: none;
}

.pixel-palace:is(.in-machine, .palace-workspace):not(.responsive-room) #roomMotionPanel #roomMotion {
  width: 146px;
  height: 38px;
  min-height: 38px;
  padding: 3px 6px;
  border: 0;
  background: none;
  box-shadow: none;
  font-size: 14px;
}

.pixel-palace .palace-directory .machine-list > .machine::before {
  display: none !important;
}

.pixel-palace .palace-directory .cabinet-image {
  object-fit: contain !important;
  filter: drop-shadow(0 5px 4px #0009);
}

/* Align the solid cabinet frames, excluding vines, flowers and loose decoration.
   Artwork and glass share one transform so the preview stays inside its bezel.
   Drain/RLGL glass widths match; frame-based heights differ by only .11px at475px. */
.pixel-palace .palace-directory .machine {
  --cabinet-scale-x: 1;
  --cabinet-scale-y: 1;
  --cabinet-top-trim: 0%;
  --cabinet-play-anchor: 83%;
}

.pixel-palace .palace-directory .machine[data-machine='drain'] {
  /* Source984x1400; hard pink frame y36..1380. Leaves extend beyond it. */
  --cabinet-scale-x: 1.0717611628;
  --cabinet-scale-y: 1.0416666667;
  --cabinet-top-trim: 2.6785714286%;
}

.pixel-palace .palace-directory .machine[data-machine='rlgl'] {
  /* Source984x1400; hard frame y29..1369. */
  --cabinet-scale-x: 1.0218717989;
  --cabinet-scale-y: 1.0447761194;
  --cabinet-top-trim: 2.1641791045%;
}

.pixel-palace .palace-directory .machine[data-machine='stories'] {
  /* Source1051x1496; golden posts and feet y7..1487. */
  --cabinet-scale-x: 1.0108108108;
  --cabinet-scale-y: 1.0108108108;
  --cabinet-top-trim: .4729729730%;
}

.pixel-palace .palace-directory .machine .cabinet-art-fit {
  transform-origin: 50% 0;
  transform: translateY(calc(-1 * var(--cabinet-top-trim))) scale(var(--cabinet-scale-x), var(--cabinet-scale-y));
}

.pixel-palace .palace-directory .machine > .machine-start {
  top: var(--cabinet-play-anchor);
  transform: none;
}

/* Use the central gap to leave room for decorative vines beside the arrows. */
.pixel-palace:not(.responsive-room) .palace-directory .machine-list > .machine:not(:only-child) {
  left: 10px;
}

.pixel-palace:not(.responsive-room) .palace-directory .machine-list > .machine:nth-child(2) {
  left: 353px;
}

.pixel-palace.responsive-room .palace-directory .machine {
  --cabinet-play-anchor: 81%;
}

/* Keep decoration outside the measured body without clipping it on small screens. */
.pixel-palace.responsive-room .palace-directory .machine-list > .machine {
  width: min(calc(100cqw - 112px), calc(100cqh * .667714), 460px);
}

/* Cabinet browsing controls sit beside the screens, with clear arcade chevrons. */
.pixel-palace .palace-carousel > .room-arrow {
  --arrow-neon: #66edff;
  position: absolute;
  top: 50%;
  width: 48px;
  height: 72px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0;
  border: 2px solid var(--arrow-neon);
  border-radius: 12px;
  background: linear-gradient(145deg, #173459, #080e26 60%, #251038);
  color: #f2fdff;
  font-size: 0;
  line-height: 0;
  box-shadow: inset 0 0 13px #6cecff22, 0 3px 0 #020612, 0 0 12px #35cbff55;
  transform: translateY(-50%);
  transition: filter .15s ease, border-color .15s ease;
  cursor: pointer;
  z-index: 3;
}

.pixel-palace .palace-carousel > .room-previous {
  left: -30px;
}

.pixel-palace .palace-carousel > .room-next {
  --arrow-neon: #ff78d4;
  right: -30px;
  box-shadow: inset 0 0 13px #ff6dcc22, 0 3px 0 #020612, 0 0 12px #ff40bd55;
}

.pixel-palace .palace-carousel > .room-arrow::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 28px;
  box-sizing: border-box;
  border: 0;
  background: currentColor;
  clip-path: polygon(0 0, 33% 0, 100% 50%, 33% 100%, 0 100%, 67% 50%);
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 4px var(--arrow-neon));
  pointer-events: none;
}

.pixel-palace .palace-carousel > .room-previous::before {
  transform: translate(-50%, -50%) rotate(180deg);
}

.pixel-palace .palace-carousel > .room-arrow::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid #b2eaff44;
  border-radius: 6px;
  background: linear-gradient(#ffffff0d, transparent 45%);
  pointer-events: none;
}

.pixel-palace .palace-carousel > .room-arrow:hover {
  filter: brightness(1.22);
}

.pixel-palace .palace-carousel > .room-arrow:focus-visible {
  border-color: #fff;
  outline: 2px solid #fff;
  outline-offset: -7px;
}

.pixel-palace .palace-carousel > .room-arrow:active {
  filter: brightness(.92);
}

.pixel-palace.responsive-room .palace-carousel > .room-arrow {
  top: 50%;
  width: 48px;
  height: 64px;
  min-height: 44px;
  font-size: 0;
}

.pixel-palace.responsive-room .palace-carousel > .room-previous {
  left: 0;
}

.pixel-palace.responsive-room .palace-carousel > .room-next {
  right: 0;
}

@keyframes cabinet-neon {
  0%, 100% {
    filter: drop-shadow(0 5px 4px #0009) drop-shadow(0 0 3px #43d7ff26);
  }
  50% {
    filter: drop-shadow(0 5px 4px #0009) drop-shadow(0 0 9px #f62ab338);
  }
}

/* The original transparent pose animation is mounted by cat-matte-v82.mjs. */
.cat-left {
  width: 230px;
  height: 126px;
  background: none !important;
  clip-path: none !important;
}

.cat-left canvas {
  display: block;
  width: 100%;
}

/* Tiny lids move over the eyes, with no rectangular patch of old fur pixels. */
.cat-blink {
  left: 1577px;
  top: 561px;
  width: 40px;
  height: 18px;
  background: none;
  mask-image: none;
  clip-path: none;
  opacity: 0;
}

.cat-blink::before,
.cat-blink::after {
  content: '';
  position: absolute;
  background: #070620;
  border-radius: 48%;
  box-shadow: inset 0 -1px #261132;
}

.cat-blink::before {
  left: -2px;
  top: 0;
  width: 15px;
  height: 15px;
  transform: rotate(-8deg);
}

.cat-blink::after {
  left: 22px;
  top: 1px;
  width: 17px;
  height: 16px;
  transform: rotate(7deg);
}

.room-animated .cat-blink {
  animation: room82-cat-blink 9.4s linear infinite;
}

@keyframes room82-cat-blink {
  0%, 27%, 29.5%, 75%, 77.5%, 100% { opacity: 0; }
  27.7%, 28.5%, 75.7%, 76.5% { opacity: 1; }
}

/* The glass stays still and clips the moving carriage to its actual cabinet. */
.claw-window,
.room-animated .claw-window {
  left: 26px;
  top: 255px;
  width: 166px;
  height: 280px;
  background: none !important;
  animation: none !important;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 11%, 100% 100%, 0 100%);
}

.claw-carriage {
  position: absolute;
  inset: 0;
}

.room-animated .claw-carriage {
  animation: claw-travel 24s ease-in-out infinite;
}

/* Compact screens retain their reflowed UI and the same unified painting. */
.pixel-palace.responsive-room #palaceStage {
  width: 100%;
  height: 100dvh;
  background-position: center;
  background-size: cover;
}

.pixel-palace.responsive-room #siteTopbar .brand {
  position: relative;
  width: min(88vw, 560px);
  height: auto;
  aspect-ratio: 785 / 153;
  overflow: hidden;
  background: none;
}

.pixel-palace.responsive-room #siteTopbar .brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('assets/pixel-palace/room-v82.webp') 49.55% 0 / 225.9873% 579.7386% no-repeat;
}

.pixel-palace.responsive-room .palace-wordmark {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
}

.pixel-palace.responsive-room #siteTopbar .early-access-banner {
  position: static !important;
  display: flex;
  order: 1;
  align-items: center;
  justify-content: center;
  width: auto !important;
  max-width: 100%;
  height: 20px !important;
  min-height: 20px;
  margin: 0 !important;
  padding: 0 !important;
  gap: 2px;
  overflow: visible !important;
  clip-path: none;
  background: none;
}

.pixel-palace.responsive-room #siteTopbar .early-access-banner > span {
  font: 700 14px/20px 'Chakra Petch', sans-serif;
  letter-spacing: 0;
  color: #72e8ff;
  text-shadow: 0 1px #02061c, 0 0 8px #29baff50;
}

.pixel-palace.responsive-room.room-animated #siteTopbar .early-access-banner > span {
  animation-name: early-letter-hop-compact;
}

@keyframes early-letter-hop-compact {
  0%, 6%, 100% { transform: translateY(0); filter: brightness(1); }
  3% { transform: translateY(-3px); filter: brightness(2.8) drop-shadow(0 0 4px #4ce9ff); }
}

/* In short landscape windows the label stays beneath the logo, beside navigation. */
@media (max-height: 500px) and (min-width: 600px) {
  .pixel-palace.responsive-room #siteTopbar {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    grid-template-areas: 'brand nav' 'early nav';
    gap: 3px 12px;
  }

  .pixel-palace.responsive-room #siteTopbar .brand {
    grid-area: brand;
    width: 150px;
  }

  .pixel-palace.responsive-room #siteTopbar header nav {
    grid-area: nav;
    min-width: 0;
  }

  .pixel-palace.responsive-room #siteTopbar .early-access-banner {
    grid-area: early;
    height: 16px !important;
    min-height: 16px;
    gap: 1px;
  }

  .pixel-palace.responsive-room #siteTopbar .early-access-banner > span {
    font-size: 11px;
    line-height: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cat-blink { display: none; }
  .room-animated .claw-carriage { animation: none; }
}
