/* Forest Kitchen v16: keep the game portrait on wide screens and crop 2x2 sprites correctly. */
.wechat-app--forest-immersive.wechat-app--forest-play-portrait .wechat-content--forest-game {
  --forest-portrait-width: min(100vw, 560px, calc(100dvh * 390 / 844));
  left: 50%;
  top: 50%;
  width: var(--forest-portrait-width);
  height: min(100dvh, calc(var(--forest-portrait-width) * 844 / 390));
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(49, 68, 90, .16), 0 18px 48px rgba(49, 68, 90, .18);
}

.wechat-app--forest-immersive {
  background: #e8dfd1 !important;
}

.wechat-app--forest-immersive .forest-character-art {
  background-size: 200% 200% !important;
  background-repeat: no-repeat !important;
  background-origin: padding-box;
}

#wechatApp.wechat-app--forest-immersive .forest-character-art.forest-character-slot-0 {
  background-position: 0% 0% !important;
}
#wechatApp.wechat-app--forest-immersive .forest-character-art.forest-character-slot-1 {
  background-position: 100% 0% !important;
}
#wechatApp.wechat-app--forest-immersive .forest-character-art.forest-character-slot-2 {
  background-position: 0% 100% !important;
}
#wechatApp.wechat-app--forest-immersive .forest-character-art.forest-character-slot-3 {
  background-position: 100% 100% !important;
}

/* v3 uses a single 4x3 character atlas on every viewport. */
#wechatApp.wechat-app--forest-immersive .forest-character-art.forest-character-paper-sheet-a,
#wechatApp.wechat-app--forest-immersive .forest-character-art.forest-character-paper-sheet-b,
#wechatApp.wechat-app--forest-immersive .forest-character-art.forest-character-paper-sheet-c {
  background-size: 400% 300% !important;
}
#wechatApp.wechat-app--forest-immersive .forest-character-art.forest-character-paper-sheet-a { background-position-y: 0% !important; }
#wechatApp.wechat-app--forest-immersive .forest-character-art.forest-character-paper-sheet-b { background-position-y: 50% !important; }
#wechatApp.wechat-app--forest-immersive .forest-character-art.forest-character-paper-sheet-c { background-position-y: 100% !important; }

/* Forest Kitchen v17: portrait phones use the full viewport instead of a narrowed desktop ratio. */
@media (orientation: portrait) {
  #wechatApp.wechat-app--forest-immersive.wechat-app--forest-play-portrait .wechat-content--forest-game {
    --forest-portrait-width: 100vw;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100dvh;
    transform: none;
    box-shadow: none;
  }
}

@media (orientation: portrait) and (max-height: 650px) {
  #wechatApp.wechat-app--forest-play-portrait .forest-tactile-food small {
    display: none !important;
  }
}

/* Forest Kitchen v18: keep drag targets usable on short portrait screens. */
@media (orientation: portrait) {
  #wechatApp.wechat-app--forest-immersive .forest-ui-v2-play .forest-ui-tool {
    min-height: 44px !important;
  }

  #wechatApp.wechat-app--forest-immersive .forest-ui-v2-play .forest-drop-target.is-drop-hover {
    outline-width: 2px !important;
    outline-offset: 2px !important;
  }

  #wechatApp.wechat-app--forest-immersive .forest-ui-v2-play .forest-ui-workbench .forest-plate-preview {
    min-width: 108px;
    min-height: 108px;
  }
}

@media (orientation: portrait) and (max-height: 700px) {
  #wechatApp.wechat-app--forest-immersive .forest-ui-v2-play .forest-ui-workbench .forest-plate-preview {
    min-width: 92px;
    min-height: 92px;
  }
}
