/* Full-screen responsive layout. Loaded last.
   All sizes: the river is on top (sticky, always visible) and the play zone is below.
   ≥1024px  : wide river band across the screen · play zone centred below (up to 1320px)
   760–1023 : river on top · play zone full width
   <760     : mobile — rules in kawaii.css / studio.css
   Inside the play zone, layouts follow its own width (container queries), not the window. */

.sheet { container-type: inline-size; container-name: sheet; }

/* ---------- tablet ---------- */
@media (min-width: 760px) {
  .sheet { max-width: none; margin-top: 14px; padding: 0 24px 28px; }
  .scene { position: sticky; top: 0; z-index: 6; height: 46vh; min-height: 360px; }
  body.studio-on .scene { height: 34vh; min-height: 280px; }
}

/* ---------- desktop: river band on top, play zone below ---------- */
@media (min-width: 1024px) {
  /* the river stays pinned on top; the play zone scrolls underneath it */
  .scene, body.studio-on .scene {
    position: sticky; top: 0; z-index: 6; height: clamp(320px, 46vh, 540px); min-height: 0;
    box-shadow: 0 10px 30px rgba(33, 27, 83, .25);
  }
  body.studio-on .scene { height: clamp(300px, 40vh, 480px); }
  .sheet {
    max-width: 1320px; margin: 18px auto 0; padding: 0 32px 32px;
  }
  .card { margin-bottom: 18px; }
  .foot { padding-bottom: 12px; }
  .stage { bottom: calc(30px + 6%); }
  .shore { bottom: calc(30px + 5%); }
  .swipe-hint { bottom: 14px; }
  body.studio-on .stage { transform: none; }
  body.studio-on .swipe-hint { display: block; }
  /* sticky river: anything scrolled into view must clear it */
  .card, .step, .studio-preview, .dress { scroll-margin-top: calc(46vh + 16px); }
  .studio-preview { top: calc(40vh + 12px); }

  .moon { width: 84px; height: 84px; }
  /* bigger krathong + doll on the big river */
  .stage { width: 340px; margin-left: -170px; }
  .kt { width: 210px; }
  .raft { width: 124px; margin-right: -26px; }
  .doll { width: 110px; }
  .raft.group { width: 170px; }
  .raft.group .doll { width: 164px; }
  .shore { width: 120px; }
  .brand h1 { font-size: 2rem; }
}

/* ---------- panel layouts by panel width ---------- */
/* character step: directory left, dress-up right */
@container sheet (min-width: 760px) {
  .step[data-panel="1"]:not([hidden]) {
    display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 0 16px; align-items: start;
  }
  .step[data-panel="1"] > .modes,
  .step[data-panel="1"] > .nav-row { grid-column: 1 / -1; }
  .step[data-panel="1"] > #fanOnly { grid-column: 1; }
  /* not sticky: the dress panel is taller than the space under the pinned river and used to slide over the Next button */
  .step[data-panel="1"] > .dress { grid-column: 2; margin-top: 0; position: static; }
  .step[data-panel="1"]:has(#fanOnly[hidden]) > .dress { grid-column: 1 / -1; }
  .results { max-height: min(520px, 58vh); }
  /* wish step: comfortable reading width */
  .step[data-panel="2"] { max-width: 640px; margin: 0 auto; }
}
/* very wide panel: more items per row */
@container sheet (min-width: 980px) {
  .kitems { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}

/* compact filter chips on small screens */
.comp-pill span { white-space: nowrap; }
@media (max-width: 520px) {
  .filters { padding: 8px 10px 10px; }
  .cats.wrap { gap: 5px; }
  .cats.wrap .chip { padding: 2px 4px 2px 9px; font-size: .72rem; gap: 4px; border-width: 1.5px; }
  .cats.wrap .chip .n { min-width: 16px; padding: 0 4px; font-size: .6rem; line-height: 15px; }
  .comp-pill select { max-width: 170px; }
}

/* sticky panels inside the play zone must sit below the pinned river (after the container rules above) */
@media (min-width: 760px) {
  .studio-preview { top: calc(34vh + 12px); }
}
@media (min-width: 1024px) {
  .studio-preview { top: calc(clamp(300px, 40vh, 480px) + 12px); }
}

/* nav buttons always sit above neighbouring content */
.nav-row { position: relative; z-index: 3; }
