/* Keep the story art on the same visible layer as the game boards. */
body.room-adventure #playScreen #roundBoard.rocket-mission {
  background: linear-gradient(#fff9e6a3, #fff5df66), url('art/rocket-room-v1.webp') center / cover no-repeat !important;
  border-radius: 22px;
}

body.room-adventure #playScreen #roundBoard:is(.feelings-fog, .icecream-shop) {
  background: linear-gradient(#fff9e6bb, #fff5df8c), url('art/ice-shop-empty-v2.webp') center / cover no-repeat !important;
  border-radius: 22px;
}

body.room-adventure.six-star-edition[data-six-part="1"]:has(#memoryScreen:not([hidden])),
body.six-notebook[data-qa-game="room-for-me"] {
  background: #fffdf8 !important;
}

body.room-adventure[data-six-part="1"]:has(#memoryScreen:not([hidden])) .story-world-backdrop {
  display: none !important;
}

body.room-adventure.feelings-fog-active #playScreen #roundBoard.face-game {
  container-type: size;
  grid-template-rows: minmax(0, 1fr) auto !important;
  min-height: 0 !important;
}

.face-game .face-portrait {
  width: min(100%, calc(100cqh - 28px), 580px);
}

.icecream-shop .ice-order {
  top: 11%;
  width: min(36%, 290px);
  height: min(61%, 235px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 4px;
  padding: 10px !important;
  transform: none;
}

.icecream-shop .ice-order > svg {
  min-height: 0;
}

.bed-scene {
  container-type: size;
}

.bed-scene .bed-room-plane {
  width: min(100cqw, 150cqh);
}

.bed-room-plane {
  --bed-sleep-height: .42;
}

.kt-scene[data-round="1"] .kt-sweet-world {
  --kt-photo-x: 50%;
  background-position: var(--kt-photo-x) top;
}

.kt-scene:is([data-round="0"], [data-round="1"]) .kt-sweet-world .kt-friend {
  top: auto;
  bottom: 23%;
  width: 36%;
  height: 45%;
}

.kt-scene:is([data-round="0"], [data-round="1"]) .kt-sweet-world .kt-ray {
  left: 9%;
}

.kt-scene:is([data-round="0"], [data-round="1"]) .kt-sweet-world .kt-dodu {
  left: auto;
  right: 9%;
}

.kt-sweet-world .kt-dodu > img:first-child {
  transform: scaleX(-1);
}

.kt-scene[data-round="1"] .kt-dodu > img:first-child {
  transform: none;
}

.kt-scene[data-round="1"] .kt-curtain-closed .kt-dodu > img:first-child {
  transform: scaleX(-1);
}

.kt-scene[data-round="1"] .kt-sweet-world .kt-friend {
  height: 38%;
  bottom: 16%;
}

.kt-scene[data-round="1"] .kt-window {
  --leading-edge: calc(100% * (1 - var(--closed)));
  right: auto;
  border-radius: 0;
  overflow: visible;
}

.kt-curtain-closed .kt-curtain-knob { visibility: hidden; }

.kt-curtain-track {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.kt-scene[data-round="1"] .kt-curtain {
  --check-width: clamp(12px, 3.6cqh, 39px);
  --check-height: clamp(18px, 4.9cqh, 49px);
  background:
    repeating-linear-gradient(90deg, #11173570 0%, #11173500 12%, #86bded35 30%, #11173580 41%, #11173500 51%),
    repeating-linear-gradient(0deg, #a5c2e05c 0 calc(var(--check-height) - 2px), #a5c2e000 calc(var(--check-height) + 2px) calc(2 * var(--check-height) - 2px), #a5c2e05c calc(2 * var(--check-height))),
    repeating-linear-gradient(90deg, #2c487a 0 calc(var(--check-width) - 2px), #6286ad calc(var(--check-width) + 2px) calc(2 * var(--check-width) - 2px), #2c487a calc(2 * var(--check-width)));
  border: 0;
  border-radius: 0 0 4px 4px;
  box-shadow: none;
}

.kt-scene[data-round="1"] .kt-curtain::after {
  background: linear-gradient(90deg, #c6e1fa40, #152a4b00 38%, #152a4b40);
  box-shadow: inset 0 0 10px #1b2c5266;
}

.kt-scene[data-round="1"] .kt-curtain-knob {
  --knob-size: clamp(48px, 7cqh, 64px);
  left: calc((100% - var(--knob-size)) * (1 - var(--closed)));
  top: 50%;
  width: var(--knob-size);
  height: var(--knob-size);
  translate: 0 -50%;
}

@media (orientation: portrait) {
  body.room-adventure .rocket-world[data-round="2"] .rocket-position {
    left: 30%;
    width: min(51cqw, 61cqh);
  }

  body.room-adventure .rocket-world[data-round="2"] .rocket-air-pump {
    right: 10%;
    width: min(27cqw, 28cqh);
    height: min(59cqh, 56cqw);
  }

  body.room-adventure.feelings-fog-active #playScreen #roundBoard.face-game {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) auto auto !important;
    gap: 8px !important;
    padding: 8px !important;
  }

  .face-game .face-portrait {
    width: min(100%, calc(100cqh - 135px), 580px);
  }

  .face-game .face-parts {
    grid-area: 2 / 1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: min(100%, 550px);
    gap: 5px;
    padding: 7px;
  }

  .face-game .face-part {
    height: clamp(60px, 11cqh, 96px);
    min-width: 0;
    padding: 4px !important;
  }

  .face-game .face-part span {
    font-size: clamp(10px, 2.7cqw, 15px);
  }

  .face-game .face-status {
    grid-area: 3 / 1;
  }

  .face-game .face-status:empty { display: none; }

  .icecream-shop .ice-order {
    left: 2%;
    width: min(39%, 235px);
    height: min(51%, 210px);
    padding: 7px !important;
  }

  .bed-scene {
    background: #665a39;
    border-radius: 20px;
  }

  .bed-scene::before {
    content: '';
    position: absolute;
    inset: -24px;
    background: url('art/bedroom-portrait-wa.webp') center / cover no-repeat;
    filter: blur(22px) brightness(.82);
    pointer-events: none;
    transition: filter 1.4s;
  }

  .bed-scene.light-off::before {
    filter: blur(22px) brightness(.33);
  }

  .bed-scene .bed-room-plane {
    --bed-sleep-height: .23;
    width: min(100cqw, calc(100cqh * 2 / 3));
    aspect-ratio: 2 / 3;
    left: 50%;
    top: 50%;
    border-radius: 20px;
    background-image: url('art/bedroom-portrait-wa.webp');
    mask-image: none;
  }

  .bed-scene .bed-instruction {
    top: 5%;
    left: 4%;
    right: 4%;
    font-size: clamp(22px, 5vw, 42px);
  }

  .bed-room-plane .bed-head-target {
    left: 39%;
    top: 35%;
    width: 26%;
    height: 13%;
  }

  .bed-scene:not(.head-on) .bed-dodu-piece {
    left: 6%;
    top: 65%;
    width: 25%;
    height: 23%;
  }

  .bed-scene .bed-cosy-blanket {
    left: 27%;
    top: calc(57% - var(--pull));
    width: 49%;
    height: calc(8% + var(--pull));
  }

  .bed-scene.blanket-up .bed-cosy-blanket {
    top: 46%;
    height: 19%;
  }

  .bed-room-plane .bed-real-lamp {
    left: 81%;
    top: 42%;
    width: 13%;
    height: 10%;
  }

  .bed-room-plane .bed-switch {
    left: 50%;
    top: 48%;
    translate: -50% -50%;
  }

  .kt-scene[data-round="1"] .kt-sweet-world {
    --kt-photo-x: 84%;
  }

  .kt-scene:is([data-round="0"], [data-round="1"]) .kt-sweet-world .kt-friend { width: 42%; }
  .kt-scene:is([data-round="0"], [data-round="1"]) .kt-sweet-world .kt-ray { left: 5%; }
  .kt-scene:is([data-round="0"], [data-round="1"]) .kt-sweet-world .kt-dodu { right: 5%; }
}

@media (orientation: landscape) and (max-height: 540px) {
  .icecream-shop .ice-order {
    top: 2%;
    height: min(81%, 155px);
    padding: 6px !important;
  }

  .kt-scene {
    container-type: size;
  }

  .kt-scene .kt-sweet-world {
    width: min(100%, 270cqh);
  }
}
