/* ============================================================================
   studio_cst.css — HAND-WRITTEN. Phase 6: the three places his atlas needs a
   rule the generated sheet cannot supply.

   Spec: output/design/STUDIO_PHASE6_CONSTELLATION_SPEC_2026-09-06.md
   ⛔ CONSTELLATION ISOLATION LAW: every selector is gated on body.hts-studio,
   so nothing here can reach a non-preview user's constellation.
   Values are his (studio.css / devices.css); the ones marked PROD keep
   production's geometry because they belong to production's own element.
   ============================================================================ */

/* ── 1 · his "All N connections" sheet ──────────────────────────────────────
   The scoper emitted every .atlas* rule under `.st-page`, but this list is the
   only atlas surface that lives in #device-sheet (a .st-scope root on <body>),
   so it arrived unstyled. These are his devices.css values, verbatim. */
body.hts-studio.hts-studio #device-sheet .atlas-word-list > div {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line); padding: 14px 0;
}
body.hts-studio.hts-studio #device-sheet .atlas-word-list a {
  display: grid; grid-template-columns: 1fr 20px; flex: 1; min-width: 0; gap: 3px 10px;
}
body.hts-studio.hts-studio #device-sheet .atlas-word-list [lang=th] { font-size: 27px; }
body.hts-studio.hts-studio #device-sheet .atlas-word-list small { font-size: 14px; line-height: 1.6; color: var(--muted); }
body.hts-studio.hts-studio #device-sheet .atlas-word-list a > .icon { grid-column: 2; grid-row: 1/3; align-self: center; width: 17px; }
body.hts-studio.hts-studio #device-sheet .atlas-word-list button {
  width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%;
  flex-shrink: 0; display: grid; place-items: center; background: none; color: inherit;
}
body.hts-studio.hts-studio #device-sheet .atlas-word-list button .icon { width: 18px; }

/* ── 2 · the trial lock ─────────────────────────────────────────────────────
   PROD geometry (position/backdrop) is production's `.cst-lock` and is kept —
   it is production's element, rendered with production's ids so
   applyTrialLocks still finds it. Only the CARD becomes his: the
   #device-sheet surface + .sheet-header type + .btn.primary.
   The doubled gate class beats `:root[data-theme="dark"] .cst-lock__card` (0,3,0). */
body.hts-studio.hts-studio .st-page .cst-lock__card {
  text-align: left; max-width: min(670px, 90%); width: auto;
  padding: 28px 30px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 25px 100px #102e5040;
}
body.hts-studio.hts-studio .st-page .cst-lock__card h2 {
  font-family: inherit; font-size: 29px; font-weight: 500;
  letter-spacing: -1px; line-height: 1.35; color: var(--ink); margin-top: 8px;
}
body.hts-studio.hts-studio .st-page .cst-lock__card p {
  font-size: 14px; color: var(--muted); line-height: 1.7; margin-top: 5px;
}
body.hts-studio.hts-studio .st-page .cst-lock__card .btn.primary { margin-top: 22px; }

/* ── 3 · full screen ────────────────────────────────────────────────────────
   Production's #cfull behaviour is reused (native Fullscreen on #view, iPhone
   faux-fullscreen). Production's own `.cst-fauxfs .constellation` rule cannot
   see his atlas, so the same pinning is spelled out for `.atlas`. */
body.hts-studio.cst-fauxfs .st-page .atlas,
body.hts-studio.hts-studio #view:fullscreen .st-page .atlas,
body.hts-studio.hts-studio #view:-webkit-full-screen .st-page .atlas {
  position: fixed; inset: 0; z-index: 9990; width: 100vw; height: 100dvh;
  max-width: none; border: 0; border-radius: 0; background: var(--bg);
  padding: 0; margin: 0; display: flex; flex-direction: column;
}
body.hts-studio.cst-fauxfs .st-page .atlas .atlas-heading,
body.hts-studio.hts-studio #view:fullscreen .st-page .atlas .atlas-heading,
body.hts-studio.hts-studio #view:-webkit-full-screen .st-page .atlas .atlas-heading {
  padding: 14px 20px 10px; margin: 0;
}
body.hts-studio.cst-fauxfs .st-page .atlas .atlas-body,
body.hts-studio.hts-studio #view:fullscreen .st-page .atlas .atlas-body,
body.hts-studio.hts-studio #view:-webkit-full-screen .st-page .atlas .atlas-body { flex: 1 1 auto; min-height: 0; }
body.hts-studio.cst-fauxfs .st-page .atlas .atlas-map,
body.hts-studio.hts-studio #view:fullscreen .st-page .atlas .atlas-map,
body.hts-studio.hts-studio #view:-webkit-full-screen .st-page .atlas .atlas-map { height: 100%; min-height: 0; }
body.hts-studio.cst-fauxfs .st-page .atlas .atlas-trail,
body.hts-studio.hts-studio #view:fullscreen .st-page .atlas .atlas-trail,
body.hts-studio.hts-studio #view:-webkit-full-screen .st-page .atlas .atlas-trail { display: none; }
body.hts-studio.hts-studio #view:fullscreen,
body.hts-studio.hts-studio #view:-webkit-full-screen { background: var(--bg); overflow: hidden; }

/* his satellites are real buttons — keep the affordance honest */
body.hts-studio.hts-studio .st-page .atlas-satellite { cursor: pointer; }

/* ============================================================================
   §CMG-01 — "connected branches" (DESIGN-HANDOFF.md, 7 Sep 2026).
   HAND-WRITTEN and OWNED by this build. Every value below is quoted from the
   spec with its section named; nothing is invented and nothing is "improved".
   ⛔ Every selector repeats the gate class (body.hts-studio.hts-studio = 0,3,1)
   so it beats premium.css's (0,3,0) and the generated sheet's dark rules on
   specificity rather than order — and so NOTHING here can reach a non-preview
   user's constellation (the CONSTELLATION ISOLATION LAW / p6iso gate).
   ============================================================================ */

/* ── the frame (§3 "the map owns the available page") ─────────────────────── */
body.hts-studio.hts-studio .st-page .cmg {
  display: flex; flex-direction: column; position: relative;
  margin: 0; padding: 0;                      /* desktop outer inset comes from his main gutter */
  /* §3's reserved chrome is the floor: 48px toolbar + 48px footer + 24px inset
     top and bottom. 420px was an invented minimum that could exceed the space
     genuinely available and push the map out of the viewport. */
  min-height: 144px;
}
body.hts-studio.hts-studio .st-page .cmg-toolbar {
  height: 48px; flex: 0 0 48px;               /* §3: a RESERVED band, not paint over words */
  display: flex; align-items: center; gap: 10px;
  position: relative; z-index: 4;
}
body.hts-studio.hts-studio .st-page .cmg-brandline {
  font-size: 14px; font-weight: 600; letter-spacing: -.2px; color: var(--ink);
}
body.hts-studio.hts-studio .st-page .cmg-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; position: relative; }
body.hts-studio.hts-studio .st-page .cmg-ico {
  width: 44px; height: 44px;                  /* §7: 44px touch target */
  display: grid; place-items: center; border-radius: 12px;
  border: 1px solid var(--line); background: none; color: var(--ink); cursor: pointer;
}
body.hts-studio.hts-studio .st-page .cmg-ico:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
body.hts-studio.hts-studio .st-page .cmg-ico[disabled] { opacity: .38; cursor: default; }
body.hts-studio.hts-studio .st-page .cmg-ico .icon { width: 18px; height: 18px; }
body.hts-studio.hts-studio .st-page .cmg-more[hidden],
body.hts-studio.hts-studio .st-page .cmg-zoom[hidden] { display: none !important; }
body.hts-studio.hts-studio .st-page .cmg-more {
  max-height:calc(100dvh - 200px);overflow-y:auto;overscroll-behavior:contain;
  position: absolute; top: 50px; right: 0; z-index: 20; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 6px; box-shadow: 0 22px 60px #102e5033; display: grid; gap: 2px;
}
body.hts-studio.hts-studio .st-page .cmg-more button,
body.hts-studio.hts-studio .st-page .cmg-more a {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  border: 0; background: none; border-radius: 10px; color: var(--ink);
  font-size: 14px; text-align: left; cursor: pointer; text-decoration: none;
}
body.hts-studio.hts-studio .st-page .cmg-more button:hover,
body.hts-studio.hts-studio .st-page .cmg-more a:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
body.hts-studio.hts-studio .st-page .cmg-more .icon { width: 17px; height: 17px; color: var(--muted); }
body.hts-studio.hts-studio .st-page .cmg-backover {
  order: -1; margin-right: auto; min-height: 44px; padding: 0 14px; border-radius: 999px;   /* §7 44px target */
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 14px; cursor: pointer;
}
/* §5: the return route is reachable for the WHOLE of branch mode. `cmg--branch`
   marks the case §5 singles out — the root has left the frame — and only
   strengthens the control; it never decides whether it exists. */
body.hts-studio.hts-studio .st-page .cmg:not(.cmg--inbranch) .cmg-backover { display: none; }
body.hts-studio.hts-studio .st-page .cmg--branch .cmg-backover {
  background: var(--brand); border-color: var(--brand); color: #fff;
}

body.hts-studio.hts-studio .st-page .cmg-body { flex: 1 1 auto; min-height: 0; position: relative; display: flex; gap: 16px; }

/* ── the stage (§6 map: subtle gradient #0b223c → #102e50, no multicolour fog) ── */
body.hts-studio.hts-studio .st-page .cmg-stage {
  flex: 1 1 auto; min-width: 0; position: relative; overflow: hidden;
  border-radius: 16px;                                     /* §3 stage radius */
  background: linear-gradient(158deg, #0b223c 0%, #102e50 100%);
  touch-action: none; -webkit-user-select: none; user-select: none;
}
/* CMG_FOCUS_R10: dialog focus restoration must not outline the map frame.
   Individual word and button focus indicators remain unchanged. */
body.hts-studio.hts-studio #view:has(.cmg):focus,
body.hts-studio.hts-studio .st-page .cmg:focus,
body.hts-studio.hts-studio .st-page .cmg-body:focus,
body.hts-studio.hts-studio .st-page .cmg-stage:focus,
body.hts-studio.hts-studio .st-page .cmg-stage:focus-visible { outline: none; box-shadow: none; }
/* §7 the text-enlargement probe — 1em of the map's own type, never painted */
body.hts-studio.hts-studio .st-page .cmg-em-probe {
  position: absolute; left: 0; top: 0; width: 1em; height: 1em;
  visibility: hidden; pointer-events: none;
}
body.hts-studio.hts-studio .st-page .cmg-world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
body.hts-studio.hts-studio .st-page .cmg-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
body.hts-studio.hts-studio .st-page .cmg-nodes { position: absolute; left: 0; top: 0; width: 0; height: 0; }

/* ── the cards (§3 card contract · §6 surfaces) ───────────────────────────── */
body.hts-studio.hts-studio .st-page .cmg-node {
  position: absolute; transform: translate(-50%, -50%);
  min-width: 44px; min-height: 44px;                        /* §3 / §7 touch floor */
  display: grid; justify-items: center; gap: 2px;
  padding: 10px 12px; cursor: pointer; text-align: center;
  font-family: Inter, sans-serif; line-height: 1.5;
  transition: box-shadow .14s ease, background-color .14s ease;
}
body.hts-studio.hts-studio .st-page .cmg-node .cmg-thai {
  font-family: Thai, sans-serif; letter-spacing: 0;         /* §3: Thai letter spacing stays zero */
  white-space: nowrap; word-break: keep-all; line-height: 1.5;
  /* §7.4: a Unicode grapheme boundary is NOT a licence to break a Thai word —
     nowrap makes an in-word break impossible, and the card grows instead. */
}
body.hts-studio.hts-studio .st-page .cmg-node .cmg-gloss { font-family: Inter, sans-serif; opacity: .82; }
body.hts-studio.hts-studio .st-page .cmg-node .cmg-acc {
  position: absolute; top: 0; left: 10px; right: 10px; height: 2px;   /* §6: community = a 2px top accent */
  background: var(--acc); border-radius: 0 0 2px 2px;
}
body.hts-studio.hts-studio .st-page .cmg-node.cmg-d1 .cmg-acc { opacity: .55; }
body.hts-studio.hts-studio .st-page .cmg-node.cmg-d2 .cmg-acc { opacity: .8; }
body.hts-studio.hts-studio .st-page .cmg-node.cmg-d3 .cmg-acc { opacity: 1; }
/* §3 "make degree visible without resizing the text arbitrarily": +0 / +4 / +8px
   of TOTAL horizontal padding by total direct degree (1–5 · 6–12 · 13+). Thai type
   size is held constant within the device class. */
body.hts-studio.hts-studio .st-page .cmg-node.cmg-d1 { padding-left: 12px; padding-right: 12px; }
body.hts-studio.hts-studio .st-page .cmg-node.cmg-d2 { padding-left: 14px; padding-right: 14px; }
body.hts-studio.hts-studio .st-page .cmg-node.cmg-d3 { padding-left: 16px; padding-right: 16px; }
/* §6 learning state: a SEPARATE corner slot, never the community accent. */
body.hts-studio.hts-studio .st-page .cmg-node .cmg-state {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; background: #0e2844; border: 1px solid #456780;
}
body.hts-studio.hts-studio .st-page .cmg-node .cmg-state .icon { width: 12px; height: 12px; }
body.hts-studio.hts-studio .st-page .cmg-node .cmg-state--due { color: #9dceff; }
body.hts-studio.hts-studio .st-page .cmg-node .cmg-state--learned { color: #a0be91; }
body.hts-studio.hts-studio .st-page .cmg-node .cmg-state--saved {
  color: #e6c995; right: auto; left: -7px;     /* §6: Saved keeps its OWN slot */
}
/* §6 "Use a FILLED/outline heart for Saved" — the mark is only drawn when the
   word is saved, so it is the filled state; Due and Learned stay outline marks
   so the three are never mistaken for one another at a glance. */
body.hts-studio.hts-studio .st-page .cmg-node .cmg-state--saved .icon { fill: currentColor; }

/* ═══ THE ROOT — the single most important element of the app (owner 2026-09-08) ═══
   Every edge on the map starts here, so the root is drawn as the map's LIGHT
   SOURCE, not as a card among cards:
   · a brand-blue body — a diagonal gradient from the brand (#1f70df) into the
     deep blue (#0b2f5c) so it has volume, with a 1px inner top highlight the way
     a lit surface catches light;
   · a pale-blue hairline border (#9dceff) — the same blue the whole map uses for
     selection and playing, so "selected" and "root" are one language;
   · a CONTIGUOUS three-ring halo painted entirely as box-shadow (4px at 55%,
     10px at 22%, then a 60px bloom) — nothing offset, nothing transparent between
     the card and its ring, so no edge can ever show through the frame;
   · the Thai in white at 44px with a soft drop so it is the brightest thing on
     the field, the gloss in the pale blue;
   · a slow 4s breath on the bloom (halted under reduced motion) so the root reads
     as alive even when nothing plays.
   Primaries stay the flat #1b3e5e cards, so at any zoom there is exactly one lit
   element — the word you are standing on. */
body.hts-studio.hts-studio .st-page .cmg-node--root {
  background: linear-gradient(150deg, #1f70df 0%, #155ec2 42%, #0e3f7a 100%);
  color: #ffffff; border-radius: 22px; border: 1.5px solid #9dceffb3;
  padding-top: 16px; padding-bottom: 14px; z-index: 3;
  min-width: 160px; max-width: 360px;
  box-shadow:
    inset 0 1px 0 #ffffff33,
    0 0 0 3px #1f70df66,
    0 0 0 8px #1f70df24,
    0 0 34px 8px #2f80e836,
    0 18px 44px #00000059;
  animation: cmgRootBreath 5s ease-in-out infinite;
}
@keyframes cmgRootBreath {
  0%, 100% { box-shadow: inset 0 1px 0 #ffffff33, 0 0 0 3px #1f70df66, 0 0 0 8px #1f70df24, 0 0 34px 8px #2f80e836, 0 18px 44px #00000059; }
  50%      { box-shadow: inset 0 1px 0 #ffffff33, 0 0 0 3px #1f70df80, 0 0 0 8px #1f70df33, 0 0 44px 12px #2f80e84a, 0 18px 44px #00000059; }
}
@media (prefers-reduced-motion: reduce) {
  body.hts-studio.hts-studio .st-page .cmg-node--root { animation: none; }
}
/* room for the heart: symmetric so the word stays centred under the card centre
   (the composer measures the rendered card, so the width is simply what it is);
   placed AFTER the degree rules so it wins on order at equal specificity. */
body.hts-studio.hts-studio .st-page .cmg-node.cmg-node--root { padding-left: 36px; padding-right: 36px; }
body.hts-studio.hts-studio .st-page .cmg-node--root .cmg-thai {
  font-size: 44px; font-weight: 700; color: #ffffff;
  text-shadow: 0 1px 6px #0b2f5c99;
}
body.hts-studio.hts-studio .st-page .cmg-node--root .cmg-gloss { font-size: 16px; font-weight: 500; color: #c5dcf7; opacity: 1; letter-spacing: .01em; }
/* the community accent stays: a 3px bar in the family colour, set into the top
   edge so the root still says which community it belongs to */
body.hts-studio.hts-studio .st-page .cmg-node--root .cmg-acc { opacity: .9; height: 3px; left: 22px; right: 22px; top: 0; border-radius: 0 0 3px 3px; box-shadow: none; }
/* the root's progress mark moves to the LEFT slot: the right corner belongs to the heart */
body.hts-studio.hts-studio .st-page .cmg-node--root .cmg-state { background: #114e98; border-color: #9dceff; right: auto; left: -8px; top: -8px; }
/* the heart: production's favbtn (C.heart) on the lit card — a white outline
   heart at rest, the shipped red when saved. Absolutely positioned so it never
   moves the word; keep its hit area 44px even at the opening overview zoom. */
body.hts-studio.hts-studio .st-page .cmg-node--root .cmg-fav {
  position: absolute; top: 0; right: 0; width:calc(44px * var(--cmg-hit-scale,1)); height:calc(44px * var(--cmg-hit-scale,1)); z-index: 4;
  display: grid; place-items: center; margin: 0; padding: 0; border: 0; background: none; box-shadow: none;
  -webkit-appearance: none; appearance: none; line-height: 1; cursor: pointer;
  font-size: 21px; color: #ffffff; opacity: .78; transform: none; text-shadow: 0 1px 6px #0b2f5c99;
  transition: color .15s ease, opacity .15s ease;
}
body.hts-studio.hts-studio .st-page .cmg-node--root .cmg-fav:hover { opacity: 1; transform: none; color: #ffffff; }
body.hts-studio.hts-studio .st-page .cmg-node--root .cmg-fav.is-on,
body.hts-studio.hts-studio .st-page .cmg-node--root .cmg-fav.is-on:hover { color: #ff5a7a; opacity: 1; text-shadow: 0 1px 6px #0b2f5c99; }
body.hts-studio.hts-studio .st-page .cmg-node--root .cmg-fav:focus-visible { outline: 2px solid #ffffff; outline-offset: 0; border-radius: 9px; }

body.hts-studio.hts-studio .st-page .cmg-node--primary {
  background: #1b3e5e; border: 1px solid #52748e; border-radius: 12px;    /* §6 primary surface */
  color: #edf4fc; z-index: 2; min-width: 112px; max-width: 300px;
}
body.hts-studio.hts-studio .st-page .cmg-node--primary .cmg-thai { font-size: 24px; }
body.hts-studio.hts-studio .st-page .cmg-node--primary .cmg-gloss { font-size: 14px; color: #c5d9e8; }
body.hts-studio.hts-studio .st-page .cmg-node--primary:hover { background: #22496c; }

body.hts-studio.hts-studio .st-page .cmg-node--secondary {
  background: #15334e; border: 1px solid #456780; border-radius: 9px;     /* §6 secondary surface */
  color: #edf4fc; z-index: 1; padding-top: 8px; padding-bottom: 8px;
}
body.hts-studio.hts-studio .st-page .cmg-node--secondary .cmg-thai { font-size: 18px; }   /* §3: no scaling below 18px */
body.hts-studio.hts-studio .st-page .cmg-node--secondary .cmg-gloss {font-size:14px;line-height:1.45;color:#e0edf7;opacity:1;}
body.hts-studio.hts-studio .st-page .cmg-node--secondary:hover { background: #1c4262; }
/* CMG_OPACITY_75_R03: owner ruling - third tier rests at 75%; interaction restores full opacity. */
body.hts-studio.hts-studio .st-page .cmg-node--secondary { opacity: .75; background: #122f48; border-color: #355873; box-shadow: none; transition: opacity .14s ease, box-shadow .14s ease, background-color .14s ease; }
body.hts-studio.hts-studio .st-page .cmg-node--secondary:hover,
body.hts-studio.hts-studio .st-page .cmg-node--secondary:focus-visible,
body.hts-studio.hts-studio .st-page .cmg-node--secondary.is-selected,
body.hts-studio.hts-studio .st-page .cmg-node--secondary.is-near { opacity: 1; }
/* OWNER 2026-09-08: primary→child connectors are DASHED; root→primary stay solid */
body.hts-studio.hts-studio .st-page .cmg-edge--child { stroke-dasharray: 5 4; stroke-linecap: round; }

/* §6 selection / keyboard focus: a clear 2px #9dceff outline with 2px offset,
   not community-dependent. §6 playing: a brief ring, once — a selected but not
   playing word does not pulse. */
body.hts-studio.hts-studio .st-page .cmg-node.is-selected,
body.hts-studio.hts-studio .st-page .cmg-node:focus-visible { outline: 2px solid #9dceff; outline-offset: 2px; }
body.hts-studio.hts-studio .st-page .cmg-node--root.is-selected { outline: 0; }
body.hts-studio.hts-studio .st-page .cmg-node--root:focus-visible { outline: 2px solid #ffffff; outline-offset: 0; }
body.hts-studio.hts-studio .st-page .cmg-node--root.is-playing { animation: cmgRootPlay .5s ease-out 1, cmgRootBreath 4s ease-in-out infinite; }
@keyframes cmgRootPlay {
  from { box-shadow: inset 0 1px 0 #ffffff33, 0 0 0 3px #9dceffb3, 0 0 0 8px #9dceff59, 0 0 56px 16px #4a8ef066, 0 18px 44px #00000059; }
  to   { box-shadow: inset 0 1px 0 #ffffff33, 0 0 0 3px #1f70df66, 0 0 0 8px #1f70df24, 0 0 34px 8px #2f80e836, 0 18px 44px #00000059; }
}
/* §6 family wash: "selected/hovered family only, confined to its LOCAL BOUNDS,
   at 6–8% COMMUNITY-COLOUR opacity with a SOFT EDGE." The colour is set from JS
   as --wash (comColor of the family's parent at alpha .07) — a fixed pale-blue
   ring carried no community information and had a hard edge. */
body.hts-studio.hts-studio .st-page .cmg-node.in-family {
  box-shadow: 0 0 0 4px var(--wash, transparent), 0 0 22px 12px var(--wash, transparent);
}
@keyframes cmgRipple { from { box-shadow: 0 0 0 0 #9dceff8c; } to { box-shadow: 0 0 0 16px #9dceff00; } }
body.hts-studio.hts-studio .st-page .cmg-node.is-playing { animation: cmgRipple .42s ease-out 1; }
/* §6 "… and ACTIVE LISTEN STATE." The same one active request drives both, and
   both are painted from the media's `playing` event, never from the click. */
body.hts-studio.hts-studio .st-page .cmg-listen.is-playing,
body.hts-studio.hts-studio #device-sheet .cmg-sheet-play.is-playing { box-shadow: 0 0 0 3px #9dceff66; }

/* ── §8 loading: a 2px indeterminate bar at the top edge of the map and the
   prior map dimmed to 60%. No text, no spinner, no skeleton nodes. ───────── */
body.hts-studio.hts-studio .st-page .cmg-busy {
  position: absolute; left: 0; right: 0; top: 48px; height: 2px;
  overflow: hidden; z-index: 7; pointer-events: none; opacity: 0;
  transition: opacity .12s ease;
}
body.hts-studio.hts-studio .st-page .cmg.is-busy .cmg-busy { opacity: 1; }
body.hts-studio.hts-studio .st-page .cmg-busy i {
  display: block; height: 100%; width: 38%; background: #9dceff; border-radius: 2px;
  animation: cmgBusy 1.1s cubic-bezier(.4,0,.2,1) infinite;
}
@keyframes cmgBusy { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
body.hts-studio.hts-studio .st-page .cmg.is-busy .cmg-world { opacity: .6; }
body.hts-studio.hts-studio .st-page .cmg-world { transition: opacity .16s ease; }
@media (prefers-reduced-motion: reduce) {
  body.hts-studio.hts-studio .st-page .cmg-busy i { animation: none; width: 100%; opacity: .7; }
  body.hts-studio.hts-studio .st-page .cmg-world { transition: none; }
}

/* §3 the selected family's bracket — inside the wash, never an edge.
   ⛔ Its stroke AND stroke-opacity come from edgeColor() on the element, because
   a CSS declaration beats a presentation attribute: pinning the opacity here
   would have silently overridden the value the contrast test chose. */
body.hts-studio.hts-studio .st-page .cmg-bracket {
  stroke-width: 1.25px; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

/* §6 cross-links: neutral, dashed, never part of the resting view. Colour and
   opacity are set from edgeColor() for the same reason as the bracket. */
body.hts-studio.hts-studio .st-page .cmg-xlink {
  stroke-width: .8px; stroke-dasharray: 4 5; fill: none;
}

/* ── the bottom control band (§3: 48px, All N · Fit · Zoom) ───────────────── */
body.hts-studio.hts-studio .st-page .cmg-band {
  position: absolute; left: 0; right: 0; bottom: 0; height: 48px; z-index: 5;
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: linear-gradient(#102e5000, #0b223cd9 42%);
}
body.hts-studio.hts-studio .st-page .cmg-all {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1px solid #52748e; background: #15334eec; color: #edf4fc;
  font-size: 14px; cursor: pointer;                          /* §3: 14px minimum for functional labels */
  /* §7: 44px is this design's touch target and it applies to EVERY control, not
     only the word cards — these footer pills were 36px. */
}
body.hts-studio.hts-studio .st-page .cmg-all .icon { width: 15px; height: 15px; }
body.hts-studio.hts-studio .st-page .cmg-band-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
body.hts-studio.hts-studio .st-page .cmg-btn {
  min-height: 44px; padding: 0 14px; border-radius: 999px; font-size: 14px; cursor: pointer;   /* §7 44px target */
  border: 1px solid #52748e; background: #15334eec; color: #edf4fc;
}
body.hts-studio.hts-studio .st-page .cmg-zoom { display: flex; gap: 6px; }
body.hts-studio.hts-studio .st-page .cmg-zoom button {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid #52748e; background: #15334eec; color: #edf4fc; cursor: pointer;
}
body.hts-studio.hts-studio .st-page .cmg-zoom .icon { width: 18px; height: 18px; }

/* ── the inspector (§3 / §5) ──────────────────────────────────────────────── */
body.hts-studio.hts-studio .st-page .cmg-inspector {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; display: flex; flex-direction: column;
}
body.hts-studio.hts-studio .st-page .cmg-inspector > div { display: flex; flex-direction: column; min-height: 0; height: 100%; }
body.hts-studio.hts-studio .st-page .cmg-inspector > #cmg-word {flex:1 1 0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;} /* Recovery 4 (PM): the word panel scrolls instead of clipping */
body.hts-studio.hts-studio .st-page .cmg-peek {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
}
body.hts-studio.hts-studio .st-page .cmg-peek-word { min-width: 0; display: grid; gap: 1px; }
body.hts-studio.hts-studio .st-page .cmg-ithai { font-family: Thai, sans-serif; font-size: 24px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.hts-studio.hts-studio .st-page .cmg-peek-word small { font-size: 14px; color: var(--muted); line-height: 1.5; }
body.hts-studio.hts-studio .st-page .cmg-peek-actions { margin-left: auto; display: flex; gap: 6px; flex-shrink: 0; }
body.hts-studio.hts-studio .st-page .cmg-listen,
body.hts-studio.hts-studio .st-page .cmg-expand,
body.hts-studio.hts-studio .st-page .cmg-peek-actions [data-fav] {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); background: none; color: var(--ink); cursor: pointer;
}
body.hts-studio.hts-studio .st-page .cmg-listen { background: var(--brand); border-color: var(--brand); color: #fff; }
body.hts-studio.hts-studio .st-page .cmg-peek-actions .icon { width: 18px; height: 18px; }
body.hts-studio.hts-studio .st-page .cmg-detail { padding: 16px; overflow: auto; flex: 1 1 auto; min-height: 0; }
body.hts-studio.hts-studio .st-page .cmg-eyebrow {
  display: block; font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;                    /* §3: nonfunctional overlines may be 12px */
}
/* §7.4: the heading never breaks inside a Thai word, so its scrollWidth is a
   truthful measure of overflow and paintInspector() can turn it into the
   scrollable reading row when it does not fit the inspector column. */
body.hts-studio.hts-studio .st-page .cmg-ithai-lg {
  font-family: Thai, sans-serif; font-size: 40px; line-height: 1.5; font-weight: 400; margin: 0;
  white-space: nowrap; word-break: keep-all;
}
body.hts-studio.hts-studio .st-page .cmg-meaning { font-size: 18px; line-height: 1.6; color: var(--ink); margin: 6px 0 0; }
/* §7.5 the exceptional label: the card GROWS to the whole word and keeps every
   glyph of it visible. There is no overflow:hidden and no text-overflow here —
   cropping the word is exactly what the spec forbids ("do not silently clip,
   truncate or corrupt it"), and the card's real width is what the composer
   packs. The readable copy lives in the inspector heading below. */
/* §7.5 the full-word reading row: the ENLARGED HEADING ITSELF scrolls
   horizontally, with keyboard access, so an exceptional word is never a cropped
   heading with a duplicate row underneath it. */
body.hts-studio.hts-studio .st-page .cmg-ithai-lg.cmg-wide-row {
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  white-space: nowrap; word-break: keep-all; padding-bottom: 6px;
}
body.hts-studio.hts-studio .st-page .cmg-ithai-lg.cmg-wide-row:focus-visible { outline: 2px solid #9dceff; outline-offset: 2px; }

body.hts-studio.hts-studio .st-page .cmg-branch { margin-top: 14px; font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
body.hts-studio.hts-studio .st-page .cmg-branch b { font-family: Thai, sans-serif; font-weight: 400; color: var(--ink); }
/* §7: a link that IS a touch action gets the same 44px target. The negative
   block margin keeps the visual density the 32px version had — the target grows,
   the layout does not. */
body.hts-studio.hts-studio .st-page .cmg-link {
  border: 0; background: none; color: var(--brand); font-size: 14px; cursor: pointer;
  padding: 6px 0; text-align: left;
  display: inline-flex; align-items: center;
  min-height: 44px; margin-top: -6px; margin-bottom: -6px;
}
body.hts-studio.hts-studio .st-page .cmg-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
body.hts-studio.hts-studio .st-page .cmg-tags span {
  font-size: 14px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
/* §8 "Also connected to …" — the same weight as the tag row, because it is a
   fact about the word, not a call to action. */
body.hts-studio.hts-studio .st-page .cmg-also {
  margin: 12px 0 0; font-size: 14px; line-height: 1.7; color: var(--muted);
}
body.hts-studio.hts-studio .st-page .cmg-also-link {
  min-width:44px;min-height:44px;display:inline-flex;align-items:center;justify-content:center;
  border: 0; background: none; padding: 0; cursor: pointer;
  font-family: Thai, sans-serif; font-size: 16px; color: var(--ink);
  border-bottom: 1px solid var(--line);
}
body.hts-studio.hts-studio .st-page .cmg-acts { display: grid; gap: 8px; margin-top: 16px; }
body.hts-studio.hts-studio .st-page .cmg-cta {
  min-height: 44px; border-radius: 12px; font-size: 14px; cursor: pointer;
  border: 1px solid var(--line); background: none; color: var(--ink); padding: 0 14px;
}
body.hts-studio.hts-studio .st-page .cmg-cta span { font-family: Thai, sans-serif; }
body.hts-studio.hts-studio .st-page .cmg-cta--travel { background: var(--brand); border-color: var(--brand); color: #fff; }
body.hts-studio.hts-studio .st-page .cmg-lookin {
  min-height:44px;min-width:44px;
  display: inline-flex; align-items: center; gap: 6px; margin-top: 16px;
  border: 0; background: none; padding: 0; cursor: pointer; font-size: 14px; color: var(--brand);
}
body.hts-studio.hts-studio .st-page .cmg-lookin .icon { width: 15px; height: 15px; }
body.hts-studio.hts-studio .st-page .cmg-list { margin-top: 18px; }
body.hts-studio.hts-studio .st-page .cmg-row {
  width: 100%; min-height: 44px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px;
  align-items: center; text-align: left; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line);
  background: none; color: var(--ink); cursor: pointer;
}
body.hts-studio.hts-studio .st-page .cmg-row [lang=th] { font-family: Thai, sans-serif; font-size: 20px; }
body.hts-studio.hts-studio .st-page .cmg-row small { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.hts-studio.hts-studio .st-page .cmg-row b { font-size: 14px; color: var(--muted); font-weight: 400; }
body.hts-studio.hts-studio .st-page .cmg-empty { margin-top: 16px; font-size: 14px; color: var(--muted); }
body.hts-studio.hts-studio .st-page .cmg-journey { margin-top: 20px; }
body.hts-studio.hts-studio .st-page .cmg-journey > div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
body.hts-studio.hts-studio .st-page .cmg-journey a { font-family: Thai, sans-serif; font-size: 18px; color: var(--ink); text-decoration: none;min-width:44px;min-height:44px;display:inline-flex;align-items:center;justify-content:center; }
body.hts-studio.hts-studio .st-page .cmg-journey a[aria-current] { color: var(--brand); }
body.hts-studio.hts-studio .st-page .cmg-journey span { color: var(--muted); font-size: 13px; }

/* composition A — wide: right inspector, default 304px (§3) */
body.hts-studio.hts-studio .st-page .cmg--side .cmg-inspector { position: relative; flex: 0 0 304px; width: 304px; }

/* compositions B/C — bottom inspector (tablet portrait 88px) and phone peek
   (72px, excluding the device safe-area inset, which the shell owns). The
   expanded states OVERLAY the map so opening a sheet to read a word never
   repacks the branches (§5 "preserve the current overview/camera"). */
/* §5 the resting band. The nominal heights are the spec's 72px (phone) and
   88px (tablet portrait), and THE SAME VALUE is the sheet's height and the map
   body's bottom padding, so the stage's usable height is always exactly the
   band reserved. The arithmetic the 72px baseline has to hold:
     inspector top border            1
   + grip (4 above + 4 bar + 2 below) 10
   + peek padding (8 + 8)            16
   + peek content, the taller of:
       actions 44  ·  word block 24px Thai × 1.5 = 36 + 1 gap + 14px gloss × 1.5 = 21  → 58
   + peek bottom border              1
   = 86 — which does NOT fit 72, and clipping the gloss under `overflow:hidden`
   is not an answer. So 72 is a MINIMUM: sizePeek() measures the real grip +
   peek and publishes it as --peekh, and both rules below follow it. */
body.hts-studio.hts-studio .st-page .cmg--bottom .cmg-body { padding-bottom: var(--peekh, 88px); }
body.hts-studio.hts-studio .st-page .cmg--peek .cmg-body { padding-bottom: var(--peekh, 72px); }
body.hts-studio.hts-studio .st-page .cmg--bottom .cmg-inspector,
body.hts-studio.hts-studio .st-page .cmg--peek .cmg-inspector {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  border-radius: 16px 16px 0 0; box-shadow: 0 -18px 50px #102e5024;
}
/* §8 branch framing timing, reused for the sheet's snap */
body.hts-studio.hts-studio .st-page .cmg--bottom .cmg-inspector,
body.hts-studio.hts-studio .st-page .cmg--peek .cmg-inspector { transition: height .34s cubic-bezier(.2,.7,.2,1); }
body.hts-studio.hts-studio .st-page .cmg-inspector.is-dragging { transition: none; }
body.hts-studio.hts-studio .st-page .cmg-grip {
  flex: 0 0 auto; padding: 8px 0 2px; display: grid; place-items: center;
  cursor: grab; touch-action: none;
}
body.hts-studio.hts-studio .st-page .cmg-grip span {
  display: block; width: 40px; height: 4px; border-radius: 999px; background: var(--line);
}
body.hts-studio.hts-studio .st-page .cmg-inspector.is-dragging .cmg-grip { cursor: grabbing; }
@media (prefers-reduced-motion: reduce) {
  body.hts-studio.hts-studio .st-page .cmg--bottom .cmg-inspector,
  body.hts-studio.hts-studio .st-page .cmg--peek .cmg-inspector { transition: none; }
}
body.hts-studio.hts-studio .st-page .cmg--bottom .cmg-inspector[data-state=peek] { height: var(--peekh, 88px); }
body.hts-studio.hts-studio .st-page .cmg--peek .cmg-inspector[data-state=peek] { height: var(--peekh, 72px); }
body.hts-studio.hts-studio .st-page .cmg--bottom .cmg-inspector[data-state=peek] .cmg-detail,
body.hts-studio.hts-studio .st-page .cmg--peek .cmg-inspector[data-state=peek] .cmg-detail { display: none; }
body.hts-studio.hts-studio .st-page .cmg--bottom .cmg-inspector[data-state=read],
body.hts-studio.hts-studio .st-page .cmg--peek .cmg-inspector[data-state=read] { height: 45%; }
body.hts-studio.hts-studio .st-page .cmg--bottom .cmg-inspector[data-state=full],
body.hts-studio.hts-studio .st-page .cmg--peek .cmg-inspector[data-state=full] { height: 92%; }
body.hts-studio.hts-studio .st-page .cmg--peek .cmg-peek { padding: 8px 14px; }
body.hts-studio.hts-studio .st-page .cmg--peek .cmg-ithai-lg { font-size: 32px; }
body.hts-studio.hts-studio .st-page .cmg--peek .cmg-meaning { font-size: 16px; }

/* phone chrome only — the card tier never changes per device (ONE WORLD, 2026-09-07) */
@media (max-width: 700px) {
  body.hts-studio.hts-studio .st-page .cmg-toolbar { padding: 0 14px; }
  body.hts-studio.hts-studio .st-page .cmg-brandline { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.hts-studio.hts-studio .st-page .cmg-more { right: 14px; }
  /* the 48px control band is a RESERVED band: its pills may not wrap it open */
  body.hts-studio.hts-studio .st-page .cmg-all span { white-space: nowrap; }
  body.hts-studio.hts-studio .st-page .cmg-all { min-width: 0; max-width: 58%; overflow: hidden; }
  /* ONE WORLD (owner ruling 2026-09-07): the card tier is the SAME on every
     device — the phone shrinks the camera, never the type. */
  body.hts-studio.hts-studio .st-page .cmg-stage { border-radius: 14px; }
}

/* ── touch layouts (owner ruling 2026-09-07): iPads and phones pinch — no Zoom
   button; and the band's pills are smaller and cushioned so they never touch
   the stage's bottom edge. `.cmg--touch` is set by the app from the layout
   (isTouchLayout), never from a pointer media query. ──────────────────────── */
body.hts-studio.hts-studio .st-page .cmg--touch .cmg-zoomtoggle,
body.hts-studio.hts-studio .st-page .cmg--touch .cmg-zoom { display: none !important; }
body.hts-studio.hts-studio .st-page .cmg--touch .cmg-all,
body.hts-studio.hts-studio .st-page .cmg--touch .cmg-btn { min-height: 44px; padding: 0 12px; font-size: 14px; }
body.hts-studio.hts-studio .st-page .cmg--touch .cmg-band { height: 52px; padding: 0 10px 6px; align-items: flex-end; }
body.hts-studio.hts-studio .st-page .cmg--touch .cmg-band-right { align-items: flex-end; }
/* the full-screen pill: icon only, on every device */
body.hts-studio.hts-studio .st-page .cmg-btn--full { display: inline-grid; place-items: center; padding: 0 12px; }
body.hts-studio.hts-studio .st-page .cmg-btn--full .icon { width: 18px; height: 18px; }
body.hts-studio.hts-studio .st-page .cmg--touch .cmg-btn--full { padding: 0 10px; }
body.hts-studio.hts-studio .st-page .cmg--touch .cmg-btn--full .icon { width: 16px; height: 16px; }

/* ── TRUE FULL SCREEN (owner ruling 2026-09-07): the entire screen is the map.
   body.cst-fauxfs fixes the stage to the viewport above everything and hides
   the toolbar, inspector, band, phone dock and app header; one exit button.
   Ancestor transforms/filters are neutralised so position:fixed is truly the
   viewport (views.css already does this for .page). ──────────────────────── */
body.hts-studio.hts-studio.cst-fauxfs { overflow: hidden; }
body.hts-studio.hts-studio.cst-fauxfs .st-page,
body.hts-studio.hts-studio.cst-fauxfs .st-page .cmg,
body.hts-studio.hts-studio.cst-fauxfs .st-page .cmg-body,
body.hts-studio.hts-studio.cst-fauxfs main,
body.hts-studio.hts-studio.cst-fauxfs #view { transform: none !important; filter: none !important; contain: none !important; }
body.hts-studio.hts-studio.cst-fauxfs .st-page .cmg-stage {
  position: fixed; inset: 0; z-index: 10000; width: 100vw; height: 100dvh; border-radius: 0;
}
body.hts-studio.hts-studio.cst-fauxfs .st-page .cmg-toolbar,
body.hts-studio.hts-studio.cst-fauxfs .st-page .cmg-inspector,
body.hts-studio.hts-studio.cst-fauxfs .st-page .cmg-band,
body.hts-studio.hts-studio.cst-fauxfs .st-page .cmg-backover,
body.hts-studio.hts-studio.cst-fauxfs #device-dock,
body.hts-studio.hts-studio.cst-fauxfs #device-sheet,
body.hts-studio.hts-studio.cst-fauxfs #topbar,
body.hts-studio.hts-studio.cst-fauxfs #sidebar { display: none !important; }
body.hts-studio.hts-studio.cst-fauxfs .st-page .cmg .cst-lock { position: fixed; inset: 0; z-index: 10001; }
body.hts-studio.hts-studio .st-page .cmg-fsbar { display: none; }
body.hts-studio.hts-studio.cst-fauxfs .st-page .cmg-fsbar {
  display: flex; gap: 8px; position: fixed; z-index: 10002;
  top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right));
}
body.hts-studio.hts-studio.cst-fauxfs .st-page .cmg-fsbtn {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid #52748e; background: #15334eec; color: #edf4fc; cursor: pointer;
}
body.hts-studio.hts-studio.cst-fauxfs .st-page .cmg-fsbtn .icon { width: 18px; height: 18px; }

/* ── the lists in his #device-sheet (§8 All N connections · More via) ─────── */
body.hts-studio.hts-studio #device-sheet .cmg-find { display: block; margin-bottom: 6px; }
body.hts-studio.hts-studio #device-sheet .cmg-find input {
  width: 100%; min-height: 44px; border-radius: 12px; padding: 0 14px; font-size: 14px;
  border: 1px solid var(--line); background: none; color: var(--ink);
}
body.hts-studio.hts-studio #device-sheet .cmg-sheet-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
body.hts-studio.hts-studio #device-sheet .cmg-sheet-pick {
  flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; border: 0; background: none;
  color: var(--ink); cursor: pointer; min-height: 44px;
}
body.hts-studio.hts-studio #device-sheet .cmg-sheet-pick [lang=th] { font-family: Thai, sans-serif; font-size: 24px; line-height: 1.5; }
body.hts-studio.hts-studio #device-sheet .cmg-sheet-pick small { font-size: 14px; color: var(--muted); line-height: 1.5; }
body.hts-studio.hts-studio #device-sheet .cmg-tag { font-style: normal; color: var(--brand); }
body.hts-studio.hts-studio #device-sheet .cmg-sheet-row button:not(.cmg-sheet-pick),
body.hts-studio.hts-studio #device-sheet .cmg-sheet-go {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); background: none; color: var(--ink);
}
body.hts-studio.hts-studio #device-sheet .cmg-sheet-row .icon { width: 18px; height: 18px; }
body.hts-studio.hts-studio #device-sheet .cmg-legend { display: grid; gap: 12px; font-size: 14px; line-height: 1.6; }

/* ── full screen (production's #cfull behaviour, his frame) ───────────────── */
body.hts-studio.cst-fauxfs .st-page .cmg,
body.hts-studio.hts-studio #view:fullscreen .st-page .cmg,
body.hts-studio.hts-studio #view:-webkit-full-screen .st-page .cmg {
  position: fixed; inset: 0; z-index: 9990; width: 100vw; height: 100dvh;
  max-width: none; border-radius: 0; background: var(--bg); padding: 0 12px; margin: 0;
}

/* ── the trial lock composes ABOVE the phone sheet ────────────────────────── */
body.hts-studio.hts-studio .st-page .cmg .cst-lock { position: absolute; inset: 0; z-index: 40; }

/* §8 reduced motion: immediate camera placement, a short state change only. */
@media (prefers-reduced-motion: reduce) {
  body.hts-studio.hts-studio .st-page .cmg-world { transition: none !important; }
  body.hts-studio.hts-studio .st-page .cmg-node.is-playing { animation: none; }
}

/* ── §7 secondary English on hover AND keyboard focus ──────────────────────
   Out of flow on purpose: the composer measured and packed this card's real
   footprint, so revealing its meaning must not be able to resize it. */
body.hts-studio.hts-studio .st-page .cmg-node .cmg-tip {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-family: Inter, sans-serif; font-size: 14px; line-height: 1.4;
  color: #edf4fc; background: #0b223cf2; border: 1px solid #456780;
  border-radius: 7px; padding: 4px 9px; pointer-events: none;
  opacity: 0; transition: opacity .12s ease; z-index: 9;
}
body.hts-studio.hts-studio .st-page .cmg-node:hover .cmg-tip,
body.hts-studio.hts-studio .st-page .cmg-node:focus-visible .cmg-tip { opacity: 1; }

/* ── §8 hover / keyboard focus traces the neighbourhood ───────────────────
   It brightens; it never moves anything and never plays. */
body.hts-studio.hts-studio .st-page .cmg-edge { transition: stroke-opacity .14s ease, stroke-width .14s ease; }
body.hts-studio.hts-studio .st-page .cmg-edge.is-traced { stroke-opacity: .9 !important; stroke-width: 1.4px; }
body.hts-studio.hts-studio .st-page .cmg-node.is-near { filter: brightness(1.16); }
@media (prefers-reduced-motion: reduce) {
  body.hts-studio.hts-studio .st-page .cmg-edge { transition: none; }
  body.hts-studio.hts-studio .st-page .cmg-node .cmg-tip { transition: none; }
}

/* โ”€โ”€ ยง8 loading / unavailable / error โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   "Failed graph load keeps navigation and Retry." "Unavailable audio is
   indicated next to Listen without hiding the word." No fabricated word
   skeletons are ever shown as content. */
body.hts-studio.hts-studio .st-page .cmg--empty { min-height: 320px; }
body.hts-studio.hts-studio .st-page .cmg-fail {
  flex: 1 1 auto; display: grid; align-content: center; justify-items: start; gap: 10px;
  padding: 32px; border-radius: 16px;
  background: linear-gradient(158deg, #0b223c 0%, #102e50 100%); color: #edf4fc;
}
body.hts-studio.hts-studio .st-page .cmg-fail h2 { font-size: 24px; font-weight: 500; margin: 0; letter-spacing: -.4px; }
body.hts-studio.hts-studio .st-page .cmg-fail p { font-size: 14px; line-height: 1.7; color: #c5d9e8; margin: 0; }
body.hts-studio.hts-studio .st-page .cmg-fail .cmg-link { color: #9dceff; }
/* the fail panel is always the dark map surface, so its actions take the map's
   own ink rather than the shell's (Retry keeps the brand fill). */
body.hts-studio.hts-studio .st-page .cmg-fail .cmg-cta { color: #edf4fc; border-color: #52748e; }
body.hts-studio.hts-studio .st-page .cmg-fail .cmg-cta--travel { color: #fff; border-color: var(--brand); }
body.hts-studio.hts-studio .st-page .cmg-unavailable {
  align-self: center; margin-left: 8px; font-size: 14px; color: var(--muted); white-space: nowrap;
}

/* CMG_FINISH_R02 - one world, a clearer frame and readable branch context. */
body.hts-studio.hts-studio .st-page .cmg-phone-all,
body.hts-studio.hts-studio .st-page .cmg-more .cmg-mobile-option { display: none; }
body.hts-studio.hts-studio .st-page .cmg-edge,
body.hts-studio.hts-studio .st-page .cmg-xlink,
body.hts-studio.hts-studio .st-page .cmg-bracket { vector-effect: non-scaling-stroke; }
body.hts-studio.hts-studio .st-page .cmg-connection-path {
  padding: 12px 14px; margin-top: 14px; border-left: 2px solid var(--brand);
  border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--brand) 6%, transparent);
}
body.hts-studio.hts-studio .st-page .cmg-connection-path p {
  margin: 7px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 10px;
  color: var(--ink); line-height: 1.6; font-size: 18px;
}
body.hts-studio.hts-studio .st-page .cmg-connection-path [lang=th] { font-family: Thai, sans-serif; }
body.hts-studio.hts-studio .st-page .cmg-map-count,
body.hts-studio.hts-studio .st-page .cmg-route-status { margin: 16px 0 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
body.hts-studio.hts-studio .st-page .cmg-phone-all {
  min-height: 44px; min-width: 44px; border: 0; border-radius: 10px;
  padding: 0 10px; background: color-mix(in srgb, var(--brand) 7%, transparent);
  color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
body.hts-studio.hts-studio .st-page .cmg-phone-all span { color: var(--muted); font-weight: 400; }
@media (max-width: 700px) {
  body.hts-studio.hts-studio .st-page .cmg .cmg-brandline,
  body.hts-studio.hts-studio .st-page .cmg .cmg-band { display: none; }
  /* CMG_CONTROLS_R09: mobile Random is a full-size dice-only toolbar button. */
  body.hts-studio.hts-studio .st-page .cmg .cmg-random-shortcut { display: grid; }
  body.hts-studio.hts-studio .st-page .cmg .cmg-random-shortcut > span { display: none; }
  body.hts-studio.hts-studio .st-page .cmg .cmg-phone-all { display: block; white-space: nowrap; }
  body.hts-studio.hts-studio .st-page .cmg .cmg-more .cmg-mobile-option { display: flex; }
  body.hts-studio.hts-studio .st-page .cmg.cmg--inbranch .cmg-phone-all { display: none; }
  body.hts-studio.hts-studio .st-page .cmg .cmg-toolbar { gap: 8px; }
  body.hts-studio.hts-studio .st-page .cmg .cmg-tools { flex-shrink: 0; gap: 4px; }
  body.hts-studio.hts-studio .st-page .cmg .cmg-backover {
    min-width: 0; max-width: calc(100% - 196px); white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; padding: 0 10px; flex: 1 1 auto;
  }
  body.hts-studio.hts-studio .st-page .cmg--peek .cmg-grip { padding: 5px 0 1px; }
  body.hts-studio.hts-studio .st-page .cmg--peek .cmg-peek { padding: 6px 12px; gap: 8px; }
  body.hts-studio.hts-studio .st-page .cmg--peek .cmg-peek-actions { gap: 4px; }
}

@media (max-width: 374px) {
  body.hts-studio.hts-studio .st-page .cmg .cmg-phone-all span { display: none; }
}

/* CMG_NOTE_R11: word context above the connection actions, in the reading pane. */
body.hts-studio.hts-studio .st-page .cmg-note {
  margin: 16px 0; padding: 12px 14px; border-left: 2px solid var(--brand);
  border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--brand) 6%, transparent);
}
body.hts-studio.hts-studio .st-page .cmg-note p {
  margin: 6px 0 0; color: var(--ink); font-size: 16px; line-height: 1.6;
  white-space: pre-line; overflow-wrap: anywhere;
}

/* CMG_FRAME_R06: a steady blue map, fixed screen frame, and clear controls.
   Scoped by the real constellation element; every other route keeps its shell. */
body.hts-studio.hts-studio:has(#view .cmg) { overflow: hidden; }
body.hts-studio.hts-studio .workspace:has(#view .cmg) {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh; min-height: 0; box-sizing: border-box;
  overflow: hidden;
}
body.hts-studio.hts-studio .workspace:has(#view .cmg) > #view {
  width: 100%; min-height: 0; margin: 0 auto; box-sizing: border-box;
  padding-bottom: 12px; display: flex; flex-direction: column; overflow: hidden;
}
body.hts-studio.hts-studio .workspace:has(#view .cmg) > .footer {
  margin-top: 0; padding-top: 0; padding-bottom: 12px;
}
body.hts-studio.hts-studio #view > .st-page:has(> .cmg) {
  flex: 1 1 0; min-height: 0; width: 100%; display: flex; flex-direction: column;
  animation: none; opacity: 1; transform: none;
}
body.hts-studio.hts-studio .st-page .cmg { min-height: 0; flex: 1 1 auto; }
body.hts-studio.hts-studio .st-page .cmg .cmg-world { animation: cmgWordArrivalR06 .32s ease-out backwards; }
@keyframes cmgWordArrivalR06 { from { opacity: .86; } to { opacity: 1; } }
body.hts-studio.hts-studio .st-page .cmg .cmg-more {
  max-height: calc(100dvh - 180px); overflow-y: auto; overscroll-behavior: contain;
}
@media (min-width: 701px) {
  /* Only the map rises into the retired title space. Inspector and controls
     keep their original top edge; the controls occupy the inspector column. */
  body.hts-studio.hts-studio .st-page .cmg--side .cmg-stage { margin-top: -48px; }
  /* CMG_TOOLBAR_R07: split the 28px main inset equally above/below controls. */
  body.hts-studio.hts-studio .st-page .cmg .cmg-tools { top: -14px; }
  body.hts-studio.hts-studio .st-page .cmg .cmg-ico {
    background: var(--surface); border-color: color-mix(in srgb, var(--brand) 24%, var(--line));
    box-shadow: 0 2px 6px #102e5009; color: var(--ink);
  }
  body.hts-studio.hts-studio .st-page .cmg .cmg-random-shortcut {
    width: auto; min-width: 104px; padding: 0 12px; display: inline-flex; gap: 8px;
    align-items: center; justify-content: center; background: var(--brand); color: #fff;
    border-color: var(--brand); box-shadow: 0 3px 8px #1f70df24;
    font: inherit; font-size: 14px; font-weight: 600;
  }
  body.hts-studio.hts-studio .st-page .cmg .cmg-random-shortcut .icon { width: 22px; height: 22px; }
  body.hts-studio.hts-studio .st-page .cmg .cmg-random-shortcut:hover { filter: brightness(1.08); }
}
@media (max-width: 700px) {
  body.hts-studio.hts-studio .workspace:has(#view .cmg) > #view { padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  body.hts-studio.hts-studio .st-page .cmg .cmg-world { animation: none; }
}

/* ══ W4 (owner item 11, 2026-09-23) — THE RESTING WORD BAR IS GONE; AN INFO
   BUTTON BESIDE THE FULL-SCREEN CONTROL OPENS THE CARD ══════════════════════
   Owner: *"Webapp is missing the i info button we added to app.. we need to
   remove the bottom word bar on webapp as well, just like we did for the app."*
   and *"this should give us more space on the screen for a non-full-screen
   constellation"*. This is the app's island patch set (hta-mobile
   app/assets/constellation/APP_PATCHES.md W-r7 phone, W-r9 glyph, W-r13 full
   screen), carried into the WEB source so the two islands converge; recorded in
   ENGINEERING §5y. UI only — the composer is untouched: it measures the stage it
   is given, and the stage now reaches the bottom.

   1 · the resting peek (`data-state="peek"`) is not painted in the two layouts
       that have one — `.cmg--peek` (phone, ≤700) and `.cmg--bottom` (tablet
       portrait / narrow landscape). `read` and `full` are the sheet that
       shipped, opened by the same `data-cmg="expand"`, closed by its own minus,
       the grip and Escape.
   2 · the map body stops padding for a bar that is not there, so the stage
       takes that height (--peekh: 83px on a phone, 99px on a tablet, by the
       island's own sizePeek arithmetic).
   3 · phone: `.cmg-infofab` = the full-screen FAB's own box one gap to its left
       (44 + 10 + the FAB's 12 inset = right 66px). Tablet: `.cmg-btn--info` in
       the band, beside `.cmg-btn--full`. The side composition (desktop, wide
       landscape) has no resting bar — its inspector is a column that always
       shows the word — so nothing there changes.
   4 · full screen keeps the info button in the same place and paints the card
       it opens over the stage (the §"TRUE FULL SCREEN" rule hides the whole
       sheet; `read`/`full` are given back). The resting peek stays gone.
   ══════════════════════════════════════════════════════════════════════ */
body.hts-studio.hts-studio.hts-studio .st-page .cmg-infofab,
body.hts-studio.hts-studio.hts-studio .st-page .cmg-btn--info { display: none; }

/* 1 · */
body.hts-studio.hts-studio.hts-studio .st-page .cmg--peek .cmg-inspector[data-state="peek"],
body.hts-studio.hts-studio.hts-studio .st-page .cmg--bottom .cmg-inspector[data-state="peek"] { display: none; }
/* 2 · */
body.hts-studio.hts-studio.hts-studio .st-page .cmg--peek .cmg-body,
body.hts-studio.hts-studio.hts-studio .st-page .cmg--bottom .cmg-body { padding-bottom: 0; }

/* 3 · phone: the app's round-7/9 button, verbatim */
body.hts-studio.hts-studio.hts-studio .st-page .cmg--peek .cmg-infofab {
  position: absolute; right: 66px; bottom: 12px; z-index: 6;
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid #7fb0fb66; background: #102e50e6; color: #fff;
  box-shadow: 0 8px 24px -8px #000000aa; cursor: pointer; padding: 0;
}
body.hts-studio.hts-studio.hts-studio .st-page .cmg-infofab .icon { width: 25px; height: 25px; }
body.hts-studio.hts-studio.hts-studio .st-page .cmg-infofab:active { transform: scale(.96); }
/* 3 · tablet band: a 44 circle in the band's own pill colours, beside the full pill */
body.hts-studio.hts-studio.hts-studio .st-page .cmg--bottom .cmg-btn--info {
  display: inline-grid; place-items: center; width: 44px; min-width: 44px; padding: 0;
}
body.hts-studio.hts-studio.hts-studio .st-page .cmg-btn--info .icon { width: 25px; height: 25px; }

/* 4 · full screen: the button stays where it was, the card it opens is painted */
body.hts-studio.hts-studio.hts-studio.cst-fauxfs .st-page .cmg--peek .cmg-infofab { display: grid; z-index: 10002; }
body.hts-studio.hts-studio.hts-studio.cst-fauxfs .st-page .cmg--bottom .cmg-infofab {
  /* the band is hidden in full screen; the stage-level button takes the band
     pill's own spot — right 10 + the 38 full pill + the 8 gap, bottom 6 */
  position: absolute; right: 56px; bottom: 6px; z-index: 10002;
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid #52748e; background: #15334eec; color: #edf4fc; cursor: pointer; padding: 0;
}
body.hts-studio.hts-studio.hts-studio.cst-fauxfs .st-page .cmg--peek .cmg-inspector[data-state="read"],
body.hts-studio.hts-studio.hts-studio.cst-fauxfs .st-page .cmg--peek .cmg-inspector[data-state="full"],
body.hts-studio.hts-studio.hts-studio.cst-fauxfs .st-page .cmg--bottom .cmg-inspector[data-state="read"],
body.hts-studio.hts-studio.hts-studio.cst-fauxfs .st-page .cmg--bottom .cmg-inspector[data-state="full"] {
  display: flex !important; z-index: 10001;
}

/* ── FULL SCREEN IS EDGE TO EDGE ON EVERY PHONE (owner, 2026-09-25) ──────────
   At ≤700 studio_finish.css §7 sets `.cmg-stage{position:relative}` at the same
   specificity as the fixed-stage rule above and wins by source order, so under
   cst-fauxfs the stage stayed inside the fixed `.cmg` and its `padding:0 12px`
   on the light bed showed as bars at both edges. One more class keeps the stage
   pinned to the viewport, and the frame behind it takes the map's night bed. */
body.hts-studio.hts-studio.hts-studio.cst-fauxfs .st-page .cmg {
  padding: 0; background: linear-gradient(158deg, #0b223c 0%, #102e50 100%);
}
body.hts-studio.hts-studio.hts-studio.cst-fauxfs .st-page .cmg-stage {
  position: fixed; inset: 0; z-index: 10000; width: 100vw; height: 100dvh;
  margin: 0; border-radius: 0;
}
