/* ============================================================================
   studio_rv0927.css — the owner's 2026-09-27 web review (run
   output/mobile/qc/reviews2/2026-09-27_w390_full), fixed AS CLASSES on the
   preview layer. Linked LAST (after studio_app_w6.css) so it outranks every
   band on order; the selector weight is six body classes so it outranks them
   on specificity too.

   ⛔ SCOPE: every rule sits under body.hts-studio (gate.js adds it only for
      /me.preview === true). Without it this file matches nothing — production
      stays byte-identical.
   ⛔ NO ADDED ELEMENTS: every change restyles an element that already exists.
   ⛔ NOTHING MOVES WHEN TOUCHED: no rule here reads a chosen/answered state
      to change a size.
   Companion script: assets/js/studio/studio_rv0927.js.
   ========================================================================== */

/* ── 1. THE GAME SETUP SHEET (#qsheet) — ONE shape at EVERY width ─────────
   Owner: "Done button not edge to edge and not touching the bottom" (38);
   "rounded at the top and square at the bottom … clipped" + remove the links
   to other lessons + "shrink all of these on mobile about 20%" (156);
   768 / 1024 "centered on bottom not centered vertically" (156);
   "almost ALL setup screens need a review" (162).
   A centred card with four rounded corners at every width (the ≥1050 desktop
   dialog shape, now also 701–1049 and phones), content-high, the body scrolls
   only if the card cannot fit the viewport. Applies with or without ex-active,
   so the sheets opened outside the exercise frame take it too. */
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet{
  position:fixed!important;
  inset:0!important;
  display:grid!important;
  place-items:center!important;
  align-content:center!important;
  justify-content:center!important;
  padding:16px!important;
}
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .qsheet{
  position:relative!important;
  inset:auto!important;
  width:min(680px,calc(100vw - 32px))!important;
  max-width:none!important;
  height:auto!important;
  min-height:0!important;
  max-height:calc(100dvh - 32px)!important;
  margin:0!important;
  padding:0!important;
  display:flex!important;
  flex-direction:column!important;
  overflow:hidden!important;
  border:1px solid var(--app-line-strong)!important;
  border-radius:var(--app-r-sheet)!important;
  transform:none!important;
  animation:none!important;
}
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .qsheet > *{ flex-shrink:0; }
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .qsheet__head{
  margin:0!important;
  padding:14px 16px 6px 20px!important;
}
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet #qsheet-body{
  flex:1 1 auto!important;
  min-height:0!important;
  overflow-y:auto!important;
  padding:8px 20px 12px!important;
}
/* the links to other lessons leave the setup sheet (Open the Sandbox, The
   Tone Formula, Back to Reading, All Sounds, How tones work, Hear-the-Tone,
   Back to <game>) */
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet :is(.qsheet__foot,.qsheet__leave){ display:none!important; }
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .ex-setup-foot:not(:has(> :not(.qsheet__foot,.qsheet__leave))){ display:none!important; }
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .ex-setup-foot:has(> :not(.qsheet__foot,.qsheet__leave)){
  display:block!important;
  padding:10px 20px 4px!important;
}
/* Done: inset from the card's edges and off its bottom */
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .b5-foot{
  position:static!important;
  margin:0!important;
  padding:10px 20px 20px!important;
  background:transparent!important;
}
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .b5-primary{
  width:100%!important;
  border-radius:var(--app-r-control)!important;
}
/* phones: the whole sheet about 20% smaller, still 44px targets */
@media (max-width:699px){
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet{ padding:12px!important; }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .qsheet{
    width:calc(100vw - 24px)!important;
    max-height:calc(100dvh - 24px)!important;
    border-radius:20px!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .qsheet__head{
    min-height:0!important;
    padding:10px 12px 2px 16px!important;
    gap:8px!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .qsheet__title{
    font-size:max(14px,calc(17px * var(--type-k,1)))!important;
    line-height:1.3!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet #qsheet-body{
    padding:4px 16px 8px!important;
    gap:6px!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .ex-sheet-section{ gap:6px!important; }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .qsheet__lbl{
    font-size:max(12px,calc(12px * var(--type-k,1)))!important;
    line-height:1.35!important;
    margin:10px 0 6px!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .qsheet__lbl:first-child{ margin-top:0!important; }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .b5-choice{ gap:6px!important; }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .b5-cell{
    min-height:44px!important;
    padding:5px 8px!important;
    font-size:max(13px,calc(13px * var(--type-k,1)))!important;
    line-height:1.3!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet :is(.b5-cell .qmode__t,.b5-cell > b){
    font-size:max(13px,calc(13px * var(--type-k,1)))!important;
    line-height:1.3!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet :is(.b5-cell .qmode__s,.b5-cell .qmode__n,.b5-cell .qmode__lock,.b5-cell > i){
    font-size:11px!important;
    line-height:1.3!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .qsheet__note{
    font-size:12px!important;
    line-height:1.4!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .ex-setup-foot:has(> :not(.qsheet__foot,.qsheet__leave)){ padding:6px 16px 2px!important; }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .ex-setup-pages{ margin:0 16px 4px!important; }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .b5-foot{ padding:8px 16px 16px!important; }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .b5-primary{
    min-height:44px!important;
    font-size:max(14px,calc(15px * var(--type-k,1)))!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio #qsheet .lg-count__n{ font-size:max(14px,calc(15px * var(--type-k,1)))!important; }
}

/* ── 2. THE EXERCISE RAIL — the progress bar never clips the ✕ / setup ─────
   Owner (42, 139 "a universal problem"): the 4px bar sat INSIDE the rail's
   bottom edge, under the 44px buttons. It now sits just below the rail,
   taking the place of the rail's hairline. */
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view .ex-bar.w3-rail:has(> .w3-rail__bar){
  border-bottom-color:transparent!important;
}
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view .ex-bar.w3-rail > .qx__bar.w3-rail__bar{
  bottom:-4px!important;
}

/* ── 3. THE GAME CONTAINER USES THE FULL HEIGHT ───────────────────────────
   Owner (146, 139 landscape): "the container only filling up top 60% of the
   screen"; landscape "extend to the full height and centered vertically".
   The dead band was the reserved feedback row under the board — the games
   no longer write feedback there (qx.judge paints the tapped choice), so an
   EMPTY foot row collapses and the board takes the whole arena. A foot that
   carries a control (Check, a self-grade row) keeps its row, written when
   the question renders, never on a tap. */
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view .qx__arena:not(:has(> .qx__foot:not(:empty))),
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view .lg-card:not(:has(> .lg-fb:not(:empty))){
  grid-template-rows:minmax(0,1fr)!important;
  row-gap:0!important;
}
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view :is(.qx__foot:empty,.lg-fb:empty){ display:none!important; }
/* 360 (ex-short): the board sits 3px above the dock, measured (the dock is
   taller than --dock-height once its art is in); --rv-dock-h is written by
   studio_rv0927.js from the dock's own box. */
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-short #view{
  height:calc(100dvh - var(--rv-dock-h, calc(72px + env(safe-area-inset-bottom))))!important;
  bottom:var(--rv-dock-h, calc(72px + env(safe-area-inset-bottom)))!important;
  padding-bottom:3px!important;
}

/* ── 4. DAILY / word prompts: the Thai word on 381–699 phones ─────────────
   Owner (139): "Font here for thai script seems unreasonably large, smaller
   phone is fine" — 360 keeps its size. */
@media (min-width:381px) and (max-width:699px){
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view :is(.qx__word,.qx__word .thai){
    font-size:max(14px,calc(clamp(34px,9cqh,50px) * var(--type-k-thai,1)))!important;
    line-height:1.35!important;
  }
}

/* ── 5. SENTENCE PRACTICE: one answer per row on phones, equal heights ────
   Owner (141): long sentences; "1 button per row … all 4 buttons always the
   same height … mobile only". The Sentence Lab games only (their head has
   the lg-back link; the Listening feed does not). */
@media (max-width:699px){
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view .qx-page.lg:has(> .lg-head > .lg-back) .lg-grid{
    grid-template-columns:minmax(0,1fr)!important;
    grid-auto-rows:1fr!important;
  }
}

/* ── 6. SENTENCE BUILDER on phones: it fits, one section ───────────────────
   Owner (115): "these games cannot have two sections … need so it fits";
   "reducing the font sizing … make the top placed chips read more like a
   full sentence rather than chips". The pager is gone (studio_exercise.js);
   the placed words lose their chip box and read as a line of text over a
   hairline, the bank tiles get smaller type. Feedback colours stay. */
@media (max-width:699px){
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view .qx__stage:has(#sb-build){
    gap:10px!important;
    padding:14px 12px!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view .qx__stage:has(#sb-build) .qx__prompt{ gap:6px!important; }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view .qx__stage:has(#sb-build) .qx__q{
    font-size:max(13px,calc(14px * var(--type-k,1)))!important;
    line-height:1.35!important;
    color:var(--app-ink-muted,var(--muted));
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view .qx__stage:has(#sb-build) .qx__promptline{
    font-size:max(14px,calc(17px * var(--type-k,1)))!important;
    line-height:1.35!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view #sb-build{
    min-height:48px!important;
    padding:6px 10px!important;
    gap:2px 6px!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view #sb-build .qx__tile{
    min-width:0!important;
    min-height:40px!important;
    padding:2px 2px!important;
    font-size:max(14px,calc(20px * var(--type-k-thai,1)))!important;
    line-height:1.4!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view #sb-build .qx__tile:not(.is-right):not(.is-wrong){
    background:transparent!important;
    border:0!important;
    border-bottom:2px solid var(--app-line-strong,var(--line))!important;
    border-radius:0!important;
    box-shadow:none!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view #sb-build .qx__tile:is(.is-right,.is-wrong){
    border-radius:8px!important;
    padding:2px 6px!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view #sb-tray{
    gap:6px!important;
    padding:6px!important;
  }
  body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view #sb-tray .qx__tile{
    min-width:40px!important;
    min-height:40px!important;
    padding:4px 10px!important;
    font-size:max(14px,calc(18px * var(--type-k-thai,1)))!important;
    line-height:1.4!important;
  }
}

/* ── 7. READING FLUENCY prompt (161) — now inside the exercise frame
   (studio_exercise.js adds /read/words), its English line at the frame's
   body size rather than a headline. */
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.ex-active #view .qx__stage:has(.qx__opts--fluency) .qx__q{
  font-size:max(14px,calc(clamp(16px,3.2cqh,20px) * var(--type-k,1)))!important;
  text-transform:none!important;
  letter-spacing:0!important;
  font-weight:500!important;
}

/* ── 8. CONSTELLATION: the centre node's Thai is regular weight (71) ────── */
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio .st-page .cmg-node--root .cmg-thai{ font-weight:400!important; }

/* ── 9. FOCUS RINGS — only for keyboard users (90) ────────────────────────
   Owner: "a weird blue border around the close button … not just on this
   screen … remove it". A dialog that focuses its close button on open painted
   the ring for a tap. The ring now shows only after the Tab key has been used
   (html.st-kbd, set by studio_rv0927.js, cleared on the next pointer press). */
html:not(.st-kbd) body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio :focus{ outline:none!important; }

/* ── 10. CATEGORY / COLLECTION / SET TILES — a little less tall (90) ───────
   The drawing keeps its 48×40; only the empty middle of the tile goes. */
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio .b3-tile{
  min-height:96px!important;
  gap:4px!important;
}

/* ── 11. PAYWALLS ─────────────────────────────────────────────────────────
   (84) The R04 purchase page is built INSIDE production's .htsup element,
   whose studio skin (studio_money.css) sets color:#fff on it — the wordmark,
   the headline, the plan name and the price inherited white on the light
   canvas. The R04 root's own ink wins now. Same for the boot expiry wall. */
body.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio.hts-studio :is(.htsup.r04,.htsv3.r04){
  color:var(--ink)!important;
  font-family:Inter,sans-serif!important;
}
