/* Phone composition: the Regular preview is 390px wide. Scale artwork
   uniformly, give text/touch targets a floor, and bound decorative spacing.
   Native iPad keeps its accepted 374 × 709 portrait viewport. */
@media (max-width:600px) and (orientation:portrait) {
  html:not(.stickyword-native-ipad) {
    --phone-nav-lift:clamp(8px,3cqw,14px);
  }

  /* Regular remains the composition baseline. On wider phones, artwork
     grows at 35% of the extra width; the rest becomes breathing room.
     Container units also respect the fitted stage on short phones. */
  html:not(.stickyword-native-ipad) .home-stage {
    container-type:inline-size;
    --home-content-width:min(100cqw,calc(35cqw + 253.5px));
    --home-air:clamp(0px,calc(40cqw - 156px),20px);
    --home-foreground-down:clamp(14px,5.6cqw,24px);
  }
  html:not(.stickyword-native-ipad) .home-logo {left:calc(51% - .41 * var(--home-content-width));top:calc(9% - var(--home-air));width:calc(.82 * var(--home-content-width));}
  html:not(.stickyword-native-ipad) .home-sun {top:calc(6.220% - var(--home-air));width:calc(.17428 * var(--home-content-width));}
  html:not(.stickyword-native-ipad) .home-tagline {left:calc(50.5% - .265 * var(--home-content-width));top:calc(22.5% - .4 * var(--home-air));width:calc(.53 * var(--home-content-width));}
  html:not(.stickyword-native-ipad) .home-cat {left:calc(50% - .25 * var(--home-content-width));top:calc(37.5% + .2 * var(--home-air) + var(--home-foreground-down));width:calc(.5 * var(--home-content-width));}
  /* Keep the bubble below the castle and beside the hero's upper body. */
  html:not(.stickyword-native-ipad) .home-good-words {left:65.5%;top:46.8%;width:calc(.28 * var(--home-content-width));}
  html:not(.stickyword-native-ipad) .home-learn-sign {top:calc(38.337% + var(--home-foreground-down));width:calc(.32625 * var(--home-content-width));}
  html:not(.stickyword-native-ipad) .home-play-decor {left:calc(51.01% - .39745 * var(--home-content-width));top:calc(62.679% + .3 * var(--home-air) + var(--home-foreground-down));width:calc(.7949 * var(--home-content-width));}
  html:not(.stickyword-native-ipad) .btn-play-home {left:calc(50% - .32 * var(--home-content-width));top:calc(65.5% + .3 * var(--home-air) + var(--home-foreground-down));width:calc(.64 * var(--home-content-width));}
  html:not(.stickyword-native-ipad) .home-frog {top:calc(78.648% + var(--home-foreground-down));}
  html:not(.stickyword-native-ipad) .home-butterfly {top:calc(52.213% + var(--home-foreground-down));}
  html:not(.stickyword-native-ipad) .home-profile-sign {top:calc(77.800% + var(--home-foreground-down));}

  /* Game: use more of the board for the answer choices. All board layers
     move together; the category picker keeps its existing header clearance. */
  html:not(.stickyword-native-ipad) .game-stage {--board-shift-y:2%;}
  html:not(.stickyword-native-ipad) .game-logo {top:max(7.4%,52px);}
  html:not(.stickyword-native-ipad) .sticker-zone {
    --answer-slot-size:30cqw;--answer-row-left:15.5cqw;--answer-row-gap:9cqw;
  }
  html:not(.stickyword-native-ipad) .answer-choice-slot {top:calc(38% - var(--board-shift-y));}
  html:not(.stickyword-native-ipad) .game-buddy-group {left:23%;top:62%;width:48.5%;}
  html:not(.stickyword-native-ipad) .game-bubble-group {top:61%;}
  html:not(.stickyword-native-ipad) .game-ground-card-left {top:81%;}
  html:not(.stickyword-native-ipad) .game-ground-cards-right {top:76.5%;}
  html:not(.stickyword-native-ipad) .game-progress-text {font-size:clamp(11px,2.8cqw,13px);}

  /* Profile and Buddy: bring navigation closer to its content, and retain
     readable labels even on a small phone. The artwork keeps its proportions. */
  html:not(.stickyword-native-ipad) :is(.profile-nav,.buddy-nav) {transform:translateY(calc(-1 * var(--phone-nav-lift)));}
  html:not(.stickyword-native-ipad) .profile-nav-label {font-size:clamp(12px,3.2cqw,14px);}
  html:not(.stickyword-native-ipad) .profile-stat span {font-size:clamp(11px,2.9cqw,13px);}
  html:not(.stickyword-native-ipad) .profile-empty {font-size:clamp(12px,3.1cqw,14px);}
  html:not(.stickyword-native-ipad) .profile-empty button {min-height:44px;font-size:14px;}
  html:not(.stickyword-native-ipad) :is(.profile-see-all,.profile-avatar) {isolation:isolate;}
  html:not(.stickyword-native-ipad) .profile-see-all::before {
    content:"";position:absolute;left:0;right:0;top:50%;height:max(100%,44px);transform:translateY(-50%);z-index:-1;
  }
  html:not(.stickyword-native-ipad) .profile-visit-buddy::before {
    content:"";position:absolute;inset:-4px 0;min-height:44px;
  }
  html:not(.stickyword-native-ipad) .buddy-worlds-copy {font-size:clamp(11px,3cqw,13px);white-space:normal;}

  /* Result copy may wrap on a narrow screen instead of being clipped. */
  html:not(.stickyword-native-ipad) .result-reward-message {font-size:clamp(12px,3.3cqw,14.5px);line-height:1.25;gap:4px;white-space:normal;text-align:center;}
  html:not(.stickyword-native-ipad) .result-reward-message > span {min-width:0;}
  html:not(.stickyword-native-ipad) .result-message-accent {width:12px;}
  /* Transparent PNG margins must not make neighbouring buttons overlap.
     Keep each bitmap centered at its original size inside a shorter hit area. */
  html:not(.stickyword-native-ipad) .result-view-stickers {
    top:calc(54.85% + var(--result-content-shift) + var(--result-layer-nudge-y) + var(--result-actions-group-nudge-y) + var(--result-view-spacing-y) + 4.868cqw);height:18cqw;
  }
  html:not(.stickyword-native-ipad) .result-view-stickers > img {position:absolute;top:50%;height:auto;transform:translateY(-50%) scaleY(1.13);}
  html:not(.stickyword-native-ipad) .result-play-again {
    top:calc(66.50% + var(--result-content-shift) + var(--result-layer-nudge-y) + var(--result-actions-group-nudge-y) + var(--result-play-spacing-y) + 5.675cqw);height:18cqw;
  }
  html:not(.stickyword-native-ipad) .result-play-again > img {position:absolute;top:50%;height:29.35cqw;transform:translateY(-50%);}
  html:not(.stickyword-native-ipad) .result-home-control {height:44px;}

  /* Sticker Book uses the available height for scrolling, without shrinking
     its contents into a fixed illustration canvas. */
  html:not(.stickyword-native-ipad) .album-stage {width:100%;height:100%;aspect-ratio:auto;}
  html:not(.stickyword-native-ipad) .album-nav-control {width:44px;height:44px;}
  html:not(.stickyword-native-ipad) .album-group-head {min-height:44px;align-items:center;}
  html:not(.stickyword-native-ipad) .album-group-action {min-height:44px;font-size:clamp(12px,3.2cqw,14px);}
  html:not(.stickyword-native-ipad) .album-tab {min-height:44px;}
  html:not(.stickyword-native-ipad) .album-tab span {font-size:clamp(12px,3.35cqw,15px);}
  html:not(.stickyword-native-ipad) .album-empty {font-size:clamp(12px,3cqw,14px);}
  html:not(.stickyword-native-ipad) .album-name {height:auto;min-height:18px;font-size:clamp(13px,3.91cqw,17px);}

  /* Scene selection uses compact thumbnails. Editor geometry and saved
     sticker coordinates are independent of this preview grid. */
  html:not(.stickyword-native-ipad) .worlds-select-body {width:min(100%,460px);}
  html:not(.stickyword-native-ipad) .worlds-scene-card:not(.is-landscape) img {aspect-ratio:4/5;object-fit:cover;}
  html:not(.stickyword-native-ipad) .worlds-scene-card span {font-size:clamp(12px,3.7vw,17px);padding:8px 4px;}
  html:not(.stickyword-native-ipad) .worlds-rewards {margin-bottom:12px;}

  /* The same picker rules apply at every phone width; the footer stays visible. */
  html:not(.stickyword-native-ipad) .game-category-dialog {width:min(440px,calc(100vw - 24px));height:min(780px,calc(100dvh - 24px));}
  html:not(.stickyword-native-ipad) .game-category-header {padding:18px 16px 12px;}
  html:not(.stickyword-native-ipad) .game-category-choice {min-height:76px;}
  html:not(.stickyword-native-ipad) .game-category-choice-copy small {font-size:12px;}

  /* Short phones spend their limited height on the choices and start action. */
  @media (max-height:650px) {
    html:not(.stickyword-native-ipad) .game-category-header {padding:12px 16px 10px;}
    html:not(.stickyword-native-ipad) .game-category-header h2 {font-size:28px;margin-bottom:6px;}
    html:not(.stickyword-native-ipad) .game-category-header p {font-size:13px;}
  }
}
