/* views.css — styles specific to particular pages/experiences */

/* ===== Wing landing banners ===== */
.wingbar{ display:flex; align-items:center; gap:var(--s5); padding:var(--s5) var(--s6); border-radius:var(--r-xl); color:#fff; box-shadow:var(--shadow-md); margin-bottom:var(--s5); }
.wingbar .glyph{ font-size:40px; line-height:1; display:flex; align-items:center; }
.wingbar h1{ color:#fff; margin:0; }
/* WHITE-BOX-AROUND-TITLES FIX: app.js moves focus to the page h1/h2 (and #view) on every
   route change for screen-reader users; WebKit painted a default focus ring around the
   focused heading that looked like a white box and only cleared on tap. These headings/#view
   are tabindex=-1 (programmatic focus only, never in the Tab order), so suppressing their
   focus outline is safe — real keyboard focus rings use :focus-visible and are untouched. */
#view:focus, #view h1:focus, #view h2:focus, #view [tabindex="-1"]:focus{ outline:none; }
.wingbar p{ color:rgba(255,255,255,.92); margin:.3em 0 0; max-width:60ch; }
.wing-sounds{ background:linear-gradient(135deg,#5a4fb0,var(--violet-500)); }
.wing-words{ background:linear-gradient(135deg,var(--blue-700),var(--blue-500)); }
.wing-grammar{ background:linear-gradient(135deg,#24714f,var(--green-500)); }
.wing-sentences{ background:linear-gradient(135deg,#a9752a,var(--amber-500)); }
.wing-scenarios{ background:linear-gradient(135deg,#a8434f,var(--rose-500)); }

/* ===== Page Masthead — the single quiet page header (replaces .hero/.wingbar/.studio-hero slabs).
   Light canvas, 3px accent rule, dark 30px title, accent eyebrow, ink-500 sub, inline state + optional thumb. */
.masthead{ position:relative; display:flex; align-items:center; gap:var(--s5); padding:6px 0 18px 22px; margin:0 0 var(--s5); }
.masthead::before{ content:""; position:absolute; left:0; top:8px; bottom:16px; width:3px; border-radius:3px; background:var(--mh,var(--blue-500)); }
.masthead__body{ flex:1 1 auto; min-width:0; }
.masthead__eyebrow{ font-size:11px; font-weight:800; letter-spacing:.09em; text-transform:uppercase; color:var(--mh,var(--blue-500)); margin:0 0 7px; }
.masthead__head{ display:flex; align-items:baseline; gap:var(--s4); flex-wrap:wrap; }
.masthead__title{ font-family:var(--font-display); font-size:var(--fs-2xl); line-height:1.08; font-weight:700; letter-spacing:-.02em; color:var(--ink-900); margin:0; }
.masthead__meta{ display:flex; align-items:center; gap:var(--s2); flex-wrap:wrap; margin-left:auto; }
/* pronounced XP badge (Arcade masthead, top-right) — bigger/bolder than a plain tag */
.masthead__meta .mh-xp{ display:inline-flex; align-items:center; gap:7px; font-family:var(--font-display); font-weight:700; font-size:var(--fs-lg); line-height:1;
  color:var(--amber-700,#92400e); background:linear-gradient(180deg,color-mix(in srgb,var(--amber-500) 20%,var(--mix-base)),color-mix(in srgb,var(--amber-500) 9%,var(--mix-base)));
  border:1px solid color-mix(in srgb,var(--amber-500) 45%,var(--line)); border-radius:999px; padding:8px 16px; box-shadow:var(--shadow-sm), var(--hi-top); }
.masthead__meta .mh-xp b{ font-size:var(--fs-2xl); font-weight:800; color:var(--amber-800,#7c2d12); letter-spacing:-.01em; }
.masthead__meta .mh-xp .ic{ color:var(--amber-500); display:inline-flex; }
.masthead__meta .mh-xp .ic svg{ width:20px; height:20px; }
.masthead__sub{ margin:8px 0 0; font-size:var(--fs-md); line-height:1.5; color:var(--ink-500); max-width:64ch; }
.masthead__thumb{ flex:0 0 auto; width:104px; height:104px; border-radius:var(--r-lg); overflow:hidden; border:1px solid var(--line); box-shadow:var(--shadow-sm); }
.masthead__thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
@media (max-width:560px){
  .masthead{ gap:var(--s4); padding-left:18px; }
  .masthead__thumb{ display:none; }
  .masthead__meta{ margin-left:0; width:100%; }
  .masthead__title{ font-size:var(--fs-xl); }
}

/* ===== Filter bar ===== */
.filters{ display:flex; gap:var(--s2); flex-wrap:wrap; align-items:center; margin-bottom:var(--s5); }
.filters .label{ font-size:var(--fs-sm); font-weight:700; color:var(--ink-400); margin-right:var(--s2); }
/* When it hangs directly off a masthead, read it as an attached sub-bar:
   pull it up under the title block and align to the accent-rule indent. */
.masthead + .filters{ margin-top:-14px; padding-left:22px; }
@media (max-width:560px){ .masthead + .filters{ padding-left:18px; } }

/* ===== Consonants & Vowels grids ===== */
.sgrid{ display:grid; gap:var(--s4); grid-template-columns:repeat(auto-fill,minmax(255px,1fr)); }
.ccard{ background:var(--surface); border:1px solid var(--line); border-left:4px solid var(--c,var(--blue-500)); border-radius:var(--r-lg);
  box-shadow:var(--shadow-sm); padding:var(--s4); transition:transform .12s, box-shadow .15s; }
.ccard:hover{ transform:translateY(-2px); box-shadow:var(--shadow-md); }
.chead{ display:flex; gap:14px; align-items:center; margin-bottom:10px; }
.cchar{ font-size:46px; font-weight:800; line-height:1; min-width:56px; text-align:center; color:var(--c,var(--blue-600)); }
.cchar.sm{ font-size:36px; }
.cname{ font-weight:800; font-size:var(--fs-md); text-transform:capitalize; }
.cmeta{ margin-top:3px; display:flex; align-items:center; gap:8px; }
.cbadge{ color:#fff; font-size:10px; font-weight:800; padding:2px 8px; border-radius:99px; letter-spacing:.03em; }
.cwords{ display:flex; flex-direction:column; gap:6px; }
.cw{ display:flex; align-items:center; gap:9px; padding:7px 11px; border:1px solid var(--line); border-radius:var(--r-sm);
  background:var(--surface-2); cursor:pointer; text-align:left; transition:.12s; }
.cw:hover{ background:var(--surface); border-color:var(--c,var(--blue-400)); }
.cw .thai{ font-weight:700; font-size:var(--fs-md); }
.cw .g{ color:var(--ink-500); font-size:var(--fs-sm); flex:1; }
.cw .pl{ color:var(--c,var(--blue-500)); font-size:11px; flex:none; }
.cw.noaudio{ cursor:default; opacity:.7; }

/* ===== TONES drill ===== */
/* Never squeeze all 5 tones onto one thin line. Centered flex capped at ~3 per row
   gives a balanced 3 + 2 across two rows (each card roomy); on phones it drops to
   2 per row and the lone 5th card auto-centers. */
.tone-grid{ display:flex; flex-wrap:wrap; justify-content:center; gap:var(--s3); }
/* Premium tinted tone cards: the tone colour is an ACCENT (top bar, name, wave, button), NOT a
   full saturated rainbow fill. Soft tint reads calm and works in light + dark; layout unchanged. */
.tone-card{ flex:0 1 clamp(190px, 30%, 300px); border-radius:var(--r-lg); padding:var(--s5); text-align:center;
  background:color-mix(in srgb, var(--tc) 9%, var(--surface));
  border:1px solid color-mix(in srgb, var(--tc) 26%, var(--line)); border-top:3px solid var(--tc);
  color:var(--ink-900); box-shadow:var(--shadow-sm); }
@media (max-width:560px){ .tone-card{ flex-basis:44%; padding:var(--s4); } }
.tone-card--mid{ --tc:var(--tone-mid); }
.tone-card--low{ --tc:var(--tone-low); }
.tone-card--high{ --tc:var(--tone-high); }
.tone-card--rising{ --tc:var(--tone-rising); }
.tone-card--falling{ --tc:var(--tone-falling); }
.tone-card .name{ font-weight:800; letter-spacing:.07em; text-transform:uppercase; font-size:var(--fs-xs); color:var(--tc); margin-bottom:4px; }
/* big Thai tone word — line-height gives the tone mark vertical room; real bold keeps the mai-ek off the consonant */
.tc-word{ font-size:52px; font-weight:700; line-height:1.55; margin:4px 0 0; color:var(--ink-900); }
.tc-roman{ font-size:var(--fs-md); font-weight:600; color:var(--ink-600); margin-top:2px; }
.tc-en{ font-size:var(--fs-sm); color:var(--ink-500); margin-top:1px; }
/* the contour wave sits in a faintly tinted well so the tone-coloured stroke reads vivid, not washed grey */
.tc-wave{ margin-top:12px; padding:7px 9px; border-radius:10px;
  background:color-mix(in srgb, var(--tc) 9%, var(--surface-2));
  border:1px solid color-mix(in srgb, var(--tc) 16%, var(--line)); }
/* hear button: a solid tone-coloured pill, not a washed-out grey ghost */
.tc-hear{ margin-top:12px; background:var(--tc); color:#fff; border-color:transparent; }
.tc-hear:hover{ filter:brightness(1.06); color:#fff; }

/* horizontal minimal-sets carousel */
.set-carousel{ display:flex; gap:var(--s4); overflow-x:auto; padding:4px 2px var(--s4); scroll-snap-type:x mandatory; scrollbar-width:thin; }
/* fluid slide: never wider than 310, never wider than 85vw on a narrow phone
   (so the next card always peeks). step() reads offsetWidth so JS stays in sync. */
.set-carousel .set-slide{ flex:0 0 min(310px, 85vw); scroll-snap-align:start; }
.set-carousel::-webkit-scrollbar{ height:8px; }
.set-carousel::-webkit-scrollbar-thumb{ background:var(--line-strong); border-radius:99px; border:2px solid var(--surface-2); }

/* word-collection carousel — arrow-controlled, self-contained quick-reference cards */
.carwrap{ position:relative; }
.carnav{ position:absolute; top:50%; transform:translateY(-50%); z-index:3;
  width:42px; height:42px; border-radius:99px; display:flex; align-items:center; justify-content:center;
  background:var(--surface); border:1px solid var(--line); box-shadow:0 4px 14px rgba(13,27,42,.14);
  color:var(--ink-900); cursor:pointer; transition:opacity .15s ease, background .15s ease; }
.carnav:hover{ background:var(--surface-2); }
.carnav svg{ width:20px; height:20px; }
.carnav--prev{ left:-6px; } .carnav--next{ right:-6px; }
.carnav:disabled{ opacity:0; pointer-events:none; }
/* phones: the arrows hang off-edge and the carousel is swipeable — hide them. */
@media (max-width:560px){ .carnav{ display:none; } }

.ccol{ display:flex; flex-direction:column; height:min(430px, 80vh); padding:0; overflow:hidden;
  border:1px solid var(--line); border-top:3px solid var(--c); border-radius:var(--r-lg); background:var(--surface); }
.ccol__head{ padding:var(--s4) var(--s4) var(--s3); border-bottom:1px solid var(--line); }
.ccol__top{ display:flex; align-items:center; justify-content:space-between; margin-bottom:var(--s2); }
.ccol__ic{ width:34px; height:34px; border-radius:10px; display:flex; align-items:center; justify-content:center;
  font-size:20px; background:color-mix(in srgb, var(--c) 12%, transparent); }
.ccol__n{ font-size:var(--fs-xs); font-weight:700; letter-spacing:.02em; color:var(--c);
  background:color-mix(in srgb, var(--c) 12%, transparent); padding:3px 9px; border-radius:99px; }
.ccol__title{ font-family:var(--font-display); font-weight:700; font-size:var(--fs-lg); line-height:1.15; }
.ccol__sub{ color:var(--ink-500); font-size:var(--fs-sm); margin-top:3px; }
.ccol__list{ flex:1; overflow-y:auto; padding:4px 0; }
.ccol__list::-webkit-scrollbar{ width:7px; }
.ccol__list::-webkit-scrollbar-thumb{ background:var(--line-strong); border-radius:99px; border:2px solid var(--surface); }
.ccol__row{ display:flex; align-items:center; gap:var(--s3); padding:8px var(--s4); border-top:1px solid var(--line); }
.ccol__row:first-child{ border-top:0; }
.ccol__th{ font-size:var(--fs-lg); font-weight:700; min-width:78px; }
.ccol__en{ flex:1; color:var(--ink-500); font-size:var(--fs-sm); }
.ccol__play{ flex:0 0 auto; }
.t-mid{ background:var(--tone-mid);} .t-low{ background:var(--tone-low);} .t-high{ background:var(--tone-high);}
.t-rising{ background:var(--tone-rising);} .t-falling{ background:var(--tone-falling);}

/* ===== The Tone Formula — banner, hero, tone-mark rows, tone tags ===== */
.formula-cta{ display:block; position:relative; overflow:hidden;
  padding:var(--s6); border-radius:var(--r-xl); color:#fff; text-decoration:none;
  background:linear-gradient(90deg, rgba(8,12,22,.93) 0%, rgba(8,12,22,.68) 48%, rgba(8,12,22,.30) 100%),
    url('../img/sounds/formula.webp') center/cover, #0a0e16;
  box-shadow:0 18px 50px rgba(13,27,42,.45), 0 0 60px -28px rgba(110,99,240,.6);
  transition:transform .18s ease, box-shadow .18s ease; }
.formula-cta:hover{ transform:translateY(-3px); box-shadow:0 26px 60px rgba(13,27,42,.55), 0 0 80px -22px rgba(47,148,104,.7); color:#fff; }
.formula-cta, .formula-cta:hover, .formula-cta *{ text-decoration:none; }
.formula-cta__title, .formula-cta:hover .formula-cta__title{ color:#fff; }
/* luminous gradient hairline border */
.formula-cta::before{ content:""; position:absolute; inset:0; border-radius:inherit; padding:1.5px; z-index:3; pointer-events:none;
  background:linear-gradient(120deg,#6d5cf0,#1f70df,#16b36b,#cf9233);
  -webkit-mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite:xor;
  mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite:exclude; opacity:.75; }
/* shine sweep on hover */
.formula-cta::after{ content:""; position:absolute; top:0; bottom:0; left:-65%; width:45%; z-index:1; pointer-events:none;
  background:linear-gradient(100deg, transparent, rgba(255,255,255,.18), transparent); transform:skewX(-18deg); }
.formula-cta:hover::after{ animation:ctaShine .9s ease; }
@keyframes ctaShine{ from{ left:-65%; } to{ left:135%; } }
.formula-cta > *{ position:relative; z-index:1; }
.formula-cta__eyebrow{ font-size:11px; font-weight:800; letter-spacing:.16em; text-transform:uppercase; color:rgba(255,255,255,.88); }
.formula-cta__title{ font-family:var(--font-display); font-weight:800; font-size:var(--fs-3xl); line-height:1.04; margin:6px 0 8px;
  text-shadow:0 2px 30px rgba(110,99,240,.5); }
.formula-cta__sub{ color:rgba(255,255,255,.93); max-width:64ch; font-size:var(--fs-md); }
.formula-cta__eq{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:var(--s5) 0 var(--s4); }
.formula-cta__go{ display:inline-flex; align-items:center; gap:7px; font-weight:800; font-size:var(--fs-md);
  background:#fff; color:#0d1b2a; padding:11px 20px; border-radius:99px; box-shadow:0 8px 22px rgba(0,0,0,.34);
  transition:box-shadow .18s ease, transform .18s ease; }
.formula-cta:hover .formula-cta__go{ box-shadow:0 10px 30px rgba(110,99,240,.55); transform:translateX(2px); }
.formula-cta__go svg{ width:18px; height:18px; }
.formula-cta--sm{ display:flex; align-items:center; justify-content:space-between; gap:var(--s4); flex-wrap:wrap; padding:var(--s5); }
.formula-cta--sm .formula-cta__title{ font-size:var(--fs-xl); margin:0 0 4px; }
.formula-cta--sm .formula-cta__sub{ font-size:var(--fs-sm); }
/* slim formula bar (Sounds page) — BRIGHT warm treatment, dark text */
.formula-cta--bar{ display:flex; align-items:center; justify-content:space-between; gap:var(--s4); flex-wrap:wrap;
  padding:var(--s4) var(--s5); margin-top:var(--s4);
  background-color:#f6e7c8;
  background-image:linear-gradient(90deg, rgba(255,250,240,.6), rgba(255,250,240,.12) 46%, rgba(255,250,240,0) 70%),
    url('../img/sounds/formula-bar-1.webp');
  background-size:cover; background-position:center; background-repeat:no-repeat; }
.formula-cta--bar, .formula-cta--bar:hover{ color:#0d1b2a; }
.formula-cta--bar .formula-cta__eyebrow{ font-size:10px; color:rgba(13,27,42,.72); }
.formula-cta--bar .formula-cta__title, .formula-cta--bar:hover .formula-cta__title{ color:#0d1b2a; text-shadow:none; font-size:var(--fs-2xl); line-height:1.05; margin:2px 0 0; }
.formula-cta--bar .formula-cta__go{ background:#0d1b2a; color:#fff; box-shadow:0 6px 18px rgba(0,0,0,.3); }
.formula-cta--bar:hover .formula-cta__go{ box-shadow:0 10px 26px rgba(0,0,0,.42); }

/* compact "parts of the formula" cards */
.sysrow{ display:grid; grid-template-columns:repeat(3,1fr); gap:var(--s4); }
@media (max-width:780px){ .sysrow{ grid-template-columns:1fr; } }
.syscard{ display:flex; align-items:center; gap:var(--s3); padding:10px 12px; background:var(--surface);
  border:1px solid var(--line); border-radius:var(--r-lg); text-decoration:none; color:inherit;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.syscard:hover{ transform:translateY(-2px); box-shadow:0 8px 20px rgba(13,27,42,.1);
  border-color:color-mix(in srgb,#2f9468 45%,var(--line)); }
.syscard__ic{ width:60px; height:60px; flex:0 0 auto; border-radius:12px; overflow:hidden; background:#0d1b2a; }
.syscard__ic img{ width:100%; height:100%; object-fit:cover; display:block; }
.syscard__bd{ min-width:0; }
.syscard__t{ display:block; font-weight:700; font-size:var(--fs-md); }
.syscard__d{ display:block; color:var(--ink-500); font-size:var(--fs-sm); margin-top:2px; }

.fchip{ background:rgba(255,255,255,.16); border:1px solid rgba(255,255,255,.38); color:#fff; font-weight:700;
  font-size:var(--fs-sm); padding:7px 14px; border-radius:99px; white-space:nowrap; }
.fchip--out{ background:#fff; color:#13243b; border-color:#fff; letter-spacing:.04em; animation:tonePulse 2.8s ease-in-out infinite; }
@keyframes tonePulse{ 0%,100%{ box-shadow:0 4px 14px rgba(0,0,0,.25); } 50%{ box-shadow:0 4px 26px rgba(255,255,255,.6); } }
.fchip--link{ text-decoration:none; cursor:pointer; transition:background .15s ease, border-color .15s ease, transform .15s ease; }
.fchip--link:hover{ background:rgba(255,255,255,.32); border-color:#fff; color:#fff; transform:translateY(-1px); }
.fop{ font-weight:800; font-size:var(--fs-lg); opacity:.9; }
@media (prefers-reduced-motion:reduce){ .formula-cta:hover::after{ animation:none; } .fchip--out{ animation:none; } }

.formula-hero{ position:relative; overflow:hidden; min-height:300px; display:flex; flex-direction:column; justify-content:center;
  padding:var(--s7) var(--s6); border-radius:var(--r-xl); color:#fff;
  margin-bottom:var(--s5); box-shadow:0 14px 34px rgba(13,27,42,.4);
  background:linear-gradient(90deg, rgba(8,12,22,.92) 0%, rgba(8,12,22,.62) 44%, rgba(8,12,22,.12) 100%),
    url('../img/sounds/formula.webp') center/cover, #0a0e16; }
.formula-hero::after{ content:none; }
.formula-hero > *{ position:relative; z-index:1; }
.formula-hero__eyebrow{ font-size:11px; font-weight:800; letter-spacing:.16em; text-transform:uppercase; color:rgba(255,255,255,.88); }
.formula-hero__title{ font-family:var(--font-display); font-weight:800; font-size:var(--fs-4xl); line-height:1.03; color:#fff; margin:8px 0 10px; }
.formula-hero__title i{ font-style:italic; }
.formula-hero__sub{ color:rgba(255,255,255,.93); max-width:62ch; font-size:var(--fs-lg); margin:0; }
.formula-hero__eq{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:var(--s5); }

/* tone-formula — step panels */
.tstep{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-xl);
  box-shadow:0 6px 22px rgba(13,27,42,.06); padding:var(--s5) var(--s5) var(--s6); margin:var(--s5) 0; }
.tstep__head{ display:flex; align-items:center; gap:var(--s3); margin-bottom:var(--s5); }
.tstep__num{ width:40px; height:40px; flex:0 0 auto; border-radius:50%; display:flex; align-items:center; justify-content:center;
  font-family:var(--font-display); font-weight:800; font-size:21px; color:#fff;
  background:linear-gradient(135deg,#6d5cf0,#1f70df); box-shadow:0 4px 12px rgba(31,112,223,.35); }
.tstep__title{ font-family:var(--font-display); font-weight:800; font-size:var(--fs-xl); }
.tstep__count{ margin-left:auto; font-size:var(--fs-xs); font-weight:700; letter-spacing:.04em; text-transform:uppercase;
  color:var(--ink-500); background:var(--surface-2); border:1px solid var(--line); padding:5px 11px; border-radius:99px; }
@media (max-width:560px){ .tstep__count{ display:none; } }

/* tone-formula: table (left) + decode widget (right) */
.fxlayout{ display:grid; grid-template-columns:minmax(0,1fr) 350px; gap:var(--s5); align-items:stretch; }
/* Stack below 1280: with the sidebar present from 1024, a 638px matrix + 350px panel
   can't sit side-by-side until the viewport is wide enough — give the matrix the full
   row on tablet/landscape so it isn't crushed into an internal scroll. */
@media (max-width:1279px){ .fxlayout{ grid-template-columns:1fr; } }
.fxside{ display:flex; flex-direction:column; }
.fxw{ flex:1 1 auto; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-xl); box-shadow:0 6px 22px rgba(13,27,42,.07); padding:var(--s5); }
.fxw__word{ font-size:50px; font-weight:700; line-height:1; }
.fxw__roman{ color:var(--ink-500); margin-top:7px; font-size:var(--fs-md); }
.fxw__en{ font-size:var(--fs-md); margin-top:2px; }
.fxw__play{ margin-top:var(--s3); }
.fxw__answer{ display:flex; align-items:center; gap:12px; margin:var(--s4) 0; padding:10px var(--s4);
  background:var(--surface-2); border:1px solid var(--line); border-radius:13px; }
.fxw__answer .tcurve{ margin:0; flex:0 0 auto; }
.fxw__ar{ font-size:var(--fs-lg); font-weight:600; color:var(--ink-500); }
.fxw__ar b{ text-transform:capitalize; }
.fxw__factors{ display:flex; flex-direction:column; gap:11px; }
/* iPad / stacked range (680–1279): the example panel would otherwise stretch full-width
   and read sparse. Lay it out 2-up — word + audio + answer beside the four decode
   factors — so it fills the width as a balanced card instead of a thin slab. */
@media (min-width:680px) and (max-width:1279px){
  .fxw{ display:grid; grid-template-columns:minmax(230px,.82fr) 1.18fr; column-gap:var(--s6); align-items:center; }
  .fxw__id{ align-self:center; padding-right:var(--s6); border-right:1px solid var(--line); }
  .fxw__factors{ align-self:center; }
}
.fxf{ display:flex; align-items:center; gap:12px; }
.fxf__ic{ width:54px; height:54px; flex:0 0 auto; border-radius:13px; display:flex; align-items:center; justify-content:center;
  background:var(--surface-2); border:1px solid var(--line); font-size:30px; font-weight:700; line-height:1; }
.fxf__markg{ font-size:32px; }
.fxf__k{ font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-400); font-weight:800; }
.fxf__v{ font-weight:700; font-size:var(--fs-md); }
.tn-cls--mid{ color:#1f70df; } .tn-cls--high{ color:#138a55; } .tn-cls--low{ color:#c47a16; }
.vmeter{ width:42px; height:9px; border-radius:99px; background:var(--surface-3); overflow:hidden; }
.vmeter i{ display:block; height:100%; background:var(--blue-500); border-radius:99px; }
.fxw__hint{ flex:0 0 auto; text-align:center; color:var(--ink-400); font-size:var(--fs-sm); margin-top:var(--s3); }

.fxcell{ cursor:pointer; position:relative; user-select:none; -webkit-user-select:none; transition:box-shadow .12s ease, transform .12s ease; }
.fxcell:hover{ transform:translateY(-2px); }
.fxcell:hover .tcurve{ box-shadow:0 0 0 2px var(--blue-300); }
.fxcell.is-sel{ box-shadow:0 0 0 2px var(--blue-500); z-index:2; }
.fxcell.is-sel .tcurve{ background:color-mix(in srgb, var(--blue-500) 10%, var(--mix-base)); }

/* tone-formula matrices (step 1 & 2) — sized ~33% larger */
.tfm-wrap{ max-width:904px; width:100%; height:100%; margin:0 auto; overflow-x:auto;
  -webkit-overflow-scrolling:touch; scrollbar-width:thin;
  /* scroll-shadow affordance: edge shadows appear only when there's more to scroll
     (Lea Verou technique) — tells touch users the matrix pans sideways. */
  background:
    linear-gradient(to right, var(--surface) 30%, rgba(255,255,255,0)) left center,
    linear-gradient(to left, var(--surface) 30%, rgba(255,255,255,0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(13,27,42,.14), transparent) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(13,27,42,.14), transparent) right center;
  background-repeat:no-repeat;
  background-size:42px 100%, 42px 100%, 15px 100%, 15px 100%;
  background-attachment:local, local, scroll, scroll; }
.tfm-wrap--marks{ max-width:851px; }
.tfm{ width:100%; height:100%; min-width:638px; border-collapse:separate; border-spacing:9px; }
/* PHONES: don't force a min-width (which caused sideways scroll / apparent clipping). Let the
   whole matrix SHRINK to the container width — curves + labels scale with the viewport so the
   entire table is visible at once, no scroll. Text is small but readable (owner accepted small). */
@media (max-width:560px){
  .tfm{ min-width:0; border-spacing:4px; table-layout:fixed; }
  .tcurve{ width:100%; max-width:74px; height:clamp(30px,9vw,36px); padding:3px 4px; }
  .tfm__h{ font-size:clamp(13px,3.9vw,18px); padding:8px 3px; }
  .tfm__h span{ font-size:clamp(10px,3vw,14px); }
  .tfm__sub{ font-size:clamp(10px,3vw,14px); padding:5px 3px; }
  .tfm .cls{ font-size:clamp(13px,3.9vw,18px); padding:9px 3px; }
  .tfm .col-live, .tfm .col-dead, .tfm .rc{ padding:7px 3px; }
  .tcell__n{ font-size:clamp(11px,3.2vw,16px); margin-top:3px; }
  .tfm .na{ font-size:clamp(16px,4.6vw,21px); }
  /* table-2 (marks) first column: stack the glyph + name tight so the class columns get room. */
  .markcell{ gap:2px; padding:6px 4px; }
  .markcell__g{ font-size:clamp(30px,9vw,48px); min-width:0; }
  .markcell__n b{ font-size:clamp(12px,3.4vw,21px); }
  .markcell__n i{ font-size:clamp(10px,3vw,19px); }
}
.tfm th, .tfm td{ padding:0; vertical-align:middle; text-align:center; }
.tfm__corner{ font-size:19px; color:var(--ink-500); font-weight:700; }
.tfm__h{ border-radius:13px; padding:11px 8px; font-size:21px; font-weight:800; }
.tfm__h span{ display:block; font-weight:600; font-size:17px; opacity:.85; margin-top:1px; }
.tfm__sub{ font-size:17px; font-weight:700; padding:7px 5px; border-radius:11px; }
.tfm__h--live{ background:color-mix(in srgb, var(--tone-low) 12%, var(--mix-base)); color:var(--tone-low); }
.tfm__h--dead{ background:color-mix(in srgb, var(--tone-falling) 15%, var(--mix-base)); color:#b9791f; }

.tfm .cls{ border-radius:13px; padding:13px 8px; font-weight:800; font-size:21px; }
.cls--mid{ color:#1f70df; background:color-mix(in srgb,#1f70df 9%,var(--mix-base)); }
.cls--high{ color:#138a55; background:color-mix(in srgb,#16b36b 11%,var(--mix-base)); }
.cls--low{ color:#c47a16; background:color-mix(in srgb,#e08a2b 12%,var(--mix-base)); }

.tfm .col-live{ background:color-mix(in srgb, var(--tone-low) 8%, var(--mix-base)); border:1px solid color-mix(in srgb, var(--tone-low) 22%, var(--line)); border-radius:13px; padding:12px 7px; box-shadow:0 1px 2px rgba(13,27,42,.05); }
.tfm .col-dead{ background:color-mix(in srgb, var(--tone-falling) 10%, var(--mix-base)); border:1px solid color-mix(in srgb, var(--tone-falling) 24%, var(--line)); border-radius:13px; padding:12px 7px; box-shadow:0 1px 2px rgba(13,27,42,.05); }
.tfm .rc{ background:var(--surface); border:1px solid var(--line); border-radius:13px; padding:12px 7px; box-shadow:0 1px 2px rgba(13,27,42,.05); }
.tfm .na{ color:var(--ink-400); font-weight:800; font-size:25px; }

.tcurve{ width:100px; height:42px; margin:0 auto; background:rgba(13,27,42,.045); border-radius:9px; padding:5px 7px; box-sizing:border-box; }
.tcurve .contour{ width:100%; height:100%; display:block; }
.tcell__n{ display:block; margin-top:6px; font-weight:800; font-size:19px; text-transform:capitalize; }
.tn--mid{ color:var(--tone-mid);} .tn--low{ color:var(--tone-low);} .tn--high{ color:var(--tone-high);}
.tn--rising{ color:var(--tone-rising);} .tn--falling{ color:var(--tone-falling);}

.tfm--marks th.mcell{ text-align:left; vertical-align:middle; }
.markcell{ display:flex; align-items:center; gap:13px; padding:11px 13px; border-radius:13px;
  background:color-mix(in srgb, #0f9a5b 7%, var(--mix-base)); }
.markcell__g{ font-size:56px; line-height:1; font-weight:700; min-width:64px; text-align:center; color:#0d1b2a; }
.markcell__n{ display:flex; flex-direction:column; line-height:1.25; }
.markcell__n b{ font-size:21px; }
.markcell__n i{ font-style:normal; color:var(--ink-500); font-size:19px; }
@media (max-width:560px){ .markcell{ flex-direction:column; gap:4px; text-align:center; } .markcell__g{ font-size:48px; } }

.ttag{ display:inline-block; font-weight:700; font-size:var(--fs-sm); padding:2px 11px; border-radius:99px; color:#fff; text-transform:capitalize; }
.ttag--mid{ background:var(--tone-mid);} .ttag--low{ background:var(--tone-low);} .ttag--high{ background:var(--tone-high);}
.ttag--rising{ background:var(--tone-rising);} .ttag--falling{ background:var(--tone-falling);}

.tmarks{ display:flex; flex-direction:column; gap:var(--s4); }
.tmark{ display:flex; gap:var(--s4); align-items:flex-start; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); padding:var(--s4); }
.tmark__mark{ flex:0 0 auto; width:88px; height:88px; display:flex; align-items:center; justify-content:center;
  font-size:56px; font-weight:700; color:#0d1b2a; border:1px solid var(--line); border-radius:var(--r-md);
  background:color-mix(in srgb, #0f9a5b 8%, var(--mix-base)); }
.tmark__bd{ flex:1; min-width:0; }
.tmark__head{ display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; }
.tmark__name{ font-size:var(--fs-lg); font-weight:700; }
.tmark__lead{ margin-left:auto; font-weight:700; color:#0f9a5b; font-size:var(--fs-sm);
  background:color-mix(in srgb, #0f9a5b 12%, transparent); padding:3px 11px; border-radius:99px; }
.tmark__note{ font-size:var(--fs-sm); color:var(--ink-500); margin:6px 0 10px; }
@media (max-width:560px){ .tmark__mark{ width:64px; height:64px; font-size:40px; } .tmark__lead{ margin-left:0; } }
.tone-row{ display:flex; align-items:center; gap:var(--s4); padding:var(--s4); border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); }
.tone-row .mark{ width:44px; height:44px; border-radius:12px; color:#fff; display:flex; align-items:center; justify-content:center; font-weight:900; font-size:22px; }
.contour{ height:46px; }

/* minimal-pair listening drill */
.drill{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); padding:var(--s6); text-align:center; }
.drill__play{ margin:var(--s4) auto; }
.drill__opts{ display:grid; grid-template-columns:repeat(2,1fr); gap:var(--s3); max-width:520px; margin:var(--s5) auto 0; }
.opt{ padding:var(--s4); border:2px solid var(--line-strong); border-radius:var(--r-md); background:var(--surface); font-weight:700; font-size:var(--fs-lg); transition:.12s; }
.opt:hover{ border-color:var(--blue-400); }

/* ===== WORD FEED (TikTok-style) ===== */
.feed{ max-width:460px; margin:0 auto; }
.feed__card{ height:560px; border-radius:var(--r-xl); padding:var(--s6); color:#fff; display:flex; flex-direction:column; justify-content:space-between;
  box-shadow:var(--shadow-lg); position:relative; overflow:hidden; }
.feed__card .big{ font-size:64px; font-weight:800; }
.feed__card .roman{ font-size:var(--fs-xl); opacity:.95; font-weight:600; }
.feed__card .gloss{ font-size:var(--fs-2xl); font-weight:800; margin-top:var(--s2); }
.feed__rail{ position:absolute; right:16px; bottom:90px; display:flex; flex-direction:column; gap:var(--s3); }
.feed__rail button{ width:48px; height:48px; border-radius:99px; border:0; background:rgba(255,255,255,.18); color:#fff; font-size:20px; backdrop-filter:blur(4px); }
.feed__nav{ display:flex; justify-content:center; gap:var(--s3); margin-top:var(--s4); }

/* ===== CONSTELLATION (graph) ===== */
/* Fill the whole main column edge-to-edge: drop the 1400px container cap for this
   page only, then size container-relative (width:100%). No 100vw — that included the
   scrollbar and overflowed; % of the main column excludes it and adapts to
   sidebar / rail / off-canvas at every breakpoint automatically. */
.container:has(.constellation){ max-width:none; }
.constellation{ position:relative; width:100%; height:clamp(560px,84vh,1100px);
  border:1px solid #1b2c46; border-radius:var(--r-xl); overflow:hidden; background:#0b1322;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.04), inset 0 0 140px rgba(0,0,0,.55), var(--shadow-md);
  --px:0; --py:0; }
@media (max-width:1023px){ .constellation{ height:min(76vh,640px); } }

/* animated mesh-gradient background — the far parallax layer */
.cmesh{ position:absolute; inset:-60px; z-index:0; pointer-events:none;
  background:
    radial-gradient(38% 48% at 24% 28%, rgba(111,99,196,.30), transparent 70%),
    radial-gradient(40% 50% at 80% 34%, rgba(47,107,191,.32), transparent 70%),
    radial-gradient(44% 54% at 62% 82%, rgba(47,148,104,.20), transparent 72%),
    radial-gradient(48% 58% at 28% 84%, rgba(204,85,103,.16), transparent 72%),
    linear-gradient(160deg,#0c1528,#0d1b2a 55%,#0a1220);
  background-size:200% 200%,210% 210%,220% 220%,210% 210%,100% 100%;
  animation:cmesh 36s ease-in-out infinite alternate;
  transform:translate(calc(var(--px)*-26px),calc(var(--py)*-26px)) scale(1.08);
  transition:transform .4s ease-out; will-change:transform,background-position; }
@keyframes cmesh{ 0%{ background-position:0% 0%,100% 0%,0% 100%,100% 100%,0 0; } 100%{ background-position:100% 60%,0% 50%,70% 0%,20% 90%,0 0; } }

/* the graph layer (edges + nodes together, so connectors stay attached) — near parallax layer */
.cspace{ position:absolute; inset:0; z-index:1;
  transform:translate(calc(var(--px)*13px),calc(var(--py)*13px)); transition:transform .3s ease-out; }
/* native fullscreen (true full-viewport, like a video) on the persistent #view element */
#view:fullscreen{ background:#0b1322; padding:var(--s4) var(--s5); overflow:auto; max-width:none; }
#view:fullscreen .breadcrumb{ display:none; }
#view:fullscreen .page{ height:100%; display:flex; flex-direction:column; }
#view:fullscreen .cwrap{ flex:1; display:flex; flex-direction:column; min-height:0; }
#view:fullscreen .chead__t{ display:none; }
#view:fullscreen .chead{ margin-bottom:var(--s3); }
#view:fullscreen .constellation{ position:relative; left:auto; transform:none; width:100%; height:auto; flex:1; min-height:0; border-radius:var(--r-lg); }
#view:-webkit-full-screen{ background:#0b1322; padding:var(--s4) var(--s5); overflow:auto; }
#view:-webkit-full-screen .breadcrumb{ display:none; }
#view:-webkit-full-screen .page{ height:100%; display:flex; flex-direction:column; }
#view:-webkit-full-screen .cwrap{ flex:1; display:flex; flex-direction:column; min-height:0; }
#view:-webkit-full-screen .chead__t{ display:none; }
#view:-webkit-full-screen .constellation{ position:relative; left:auto; transform:none; width:100%; height:auto; flex:1; min-height:0; border-radius:var(--r-lg); }

/* iPhone faux-fullscreen (iOS phones have NO element Fullscreen API) — pin the stage to the viewport.
   100dvh tracks the dynamic Safari toolbar; the controls dodge the notch via the safe-area inset. */
body.cst-fauxfs{ overflow:hidden; }
body.cst-fauxfs .constellation{ position:fixed; inset:0; z-index:9990; width:100vw; height:100dvh; max-width:none; border:0; border-radius:0; }
body.cst-fauxfs .cstage-ctl{ top:max(var(--s4), env(safe-area-inset-top)); }

/* PHONES in full screen (native Android FS or iPhone faux-FS): make it TRULY edge-to-edge — drop the
   page title header + all padding, and never show the search bar (no room; search stays in windowed). */
@media (max-width:600px), (max-height:520px){
  #view:fullscreen .chead, #view:-webkit-full-screen .chead, body.cst-fauxfs .chead{ display:none; }
  #view:fullscreen, #view:-webkit-full-screen{ padding:0; }
  #view:fullscreen .cwrap, #view:-webkit-full-screen .cwrap{ margin:0; }
  #view:fullscreen .constellation, #view:-webkit-full-screen .constellation{ border-radius:0; border:0; }
  #view:fullscreen .cstage-ctl .wsearch, #view:-webkit-full-screen .cstage-ctl .wsearch, body.cst-fauxfs .cstage-ctl .wsearch{ display:none; }
}

/* ============================================================================================
   MOBILE CONSTELLATION — PHONE-ONLY improvements, LIVE FOR ALL USERS (promoted from the preview
   gate 2026-07-22, owner-approved). Everything here is scoped to phone selectors/media only, so
   tablet/desktop are byte-unchanged. (The PREVIEW_EMAILS / body.hts-preview infra stays in place for
   future gated experiments — it just no longer scopes these rules.)
   ---------------------------------------------------------------------------------------------
   iPhone faux-fullscreen was trapped because .page holds a transform (layout.css: animation:fadeIn
   ... both → base.css @keyframes fadeIn animates transform), which makes .page the containing block
   for the fixed stage — so `.constellation{position:fixed;inset:0}` anchored to .page (below the
   topbar + inside the content padding) instead of the viewport, leaving the chrome uncovered.
   Neutralize that transform so the fixed stage escapes to the real viewport (!important beats the
   animation's fill-held value in the cascade). `.cst-fauxfs` is only ever added on phones (no native
   Fullscreen API), so these two rules are inherently phone-only: */
body.cst-fauxfs .page{ transform:none !important; }
/* ...and hide the app chrome outright while pinned (belt-and-suspenders — the stage covers it anyway,
   but this guarantees the hamburger/search/profile can't peek or catch a tap underneath): */
body.cst-fauxfs .topbar{ display:none !important; }
/* (The old preview-only control z-index bump is gone: the "See the whole sky" hint is now suppressed on
   ALL phones via JS — phones auto-open immersive — so it can no longer sit over the ⤢ button there, and
   on tablet/desktop the hint keeps its original stacking. Nothing to override.) */
/* --- PHONE-ONLY presentation (R2/R5). Phone media query → tablets/desktop untouched. --- */
@media (max-width:600px), (max-height:520px){
  /* R2: reclaim the windowed chrome (title/hint header + breadcrumb). */
  .cwrap > .chead{ display:none; }
  .page:has(.constellation) > .breadcrumb{ display:none; }
  /* WINDOWED height (revised 2026-07-22): the old min(88vh,900px) used the LARGE iOS viewport, so with
     Safari's toolbars showing it exceeded the visible content area and .content scrolled. Use dvh (the
     DYNAMIC/visible viewport) at a fraction that always fits under the 64px topbar + padding on every phone
     (0.8·visible + chrome ≤ visible for visible ≥ 480). Fullscreen (body.cst-fauxfs, position:fixed 100dvh)
     is exempt. overflow:hidden on .content is belt-and-suspenders so it can NEVER scroll. */
  body:not(.cst-fauxfs) .constellation{ height:min(80dvh,880px); }
  body:not(.cst-fauxfs) .content:has(.constellation){ overflow:hidden; }
  /* R5: per-node, space-adaptive English-gloss cap (--gcap, set by the layout from each node's free room;
     95px is only the fallback for a node the JS didn't size). Thai is NEVER touched. Hub excluded (it shows
     its full definition). */
  .cnode:not(.cnode--hub) .cen{ max-width:var(--gcap,95px); overflow:hidden; text-overflow:ellipsis; }
}
/* Dev overlay — OFF unless localStorage hts_cst_debug='1' (→ body.hts-cst-debug). */
body.hts-cst-debug .cnode{ outline:1px dashed rgba(255,90,90,.55); outline-offset:2px; }
/* ITEM 1: +10% THAI script on phones (English gloss .cen unchanged; padding unchanged). Base mobile sizes
   ×1.1 — MUST stay in lockstep with estR2's tf constants in words_constellation.js. Two blocks so portrait
   (max-width:600 base 18/34/14) and short/landscape (max-height:520 base 15/24/12) each scale from their base. */
/* NOTE the `.constellation ` prefix: it lifts specificity to (0,2,0)/(0,3,0) so these win over the base
   mobile `.cthai{18px}` / `.cnode--hub .cthai{34px}` rules that appear LATER in this file (equal-specificity
   later rules would otherwise override). All .cthai live inside .constellation, so the match set is identical. */
@media (max-width:600px){
  .constellation .cthai{ font-size:19.8px; }
  .constellation .cnode--sm .cthai{ font-size:15.4px; }
  .constellation .cnode--hub .cthai{ font-size:37.4px; }
}
@media (max-height:520px){
  .constellation .cthai{ font-size:16.5px; }
  .constellation .cnode--sm .cthai{ font-size:13.2px; }
  .constellation .cnode--hub .cthai{ font-size:26.4px; }
}
/* ============================================================================================ */

/* in-stage controls overlay (top-left) — available windowed and in fullscreen */
.cstage-ctl{ position:absolute; top:var(--s4); left:var(--s4); right:var(--s4); z-index:20; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.cstage-ctl a.cbtn{ margin-left:auto; }   /* push Random to the far right, off the search bar */
.cstage-ctl .wsearch{ max-width:240px; }
.cstage-ctl .wsearch input{ height:38px; background:rgba(10,18,36,.72); -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px); border:1px solid rgba(255,255,255,.18); color:#fff; }
.cstage-ctl .wsearch input::placeholder{ color:rgba(255,255,255,.5); }
.cbtn{ height:38px; min-width:38px; padding:0 12px; display:inline-flex; align-items:center; justify-content:center; gap:6px;
  border-radius:var(--r-pill); background:rgba(10,18,36,.72); -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px);
  border:1px solid rgba(255,255,255,.18); color:#fff; font-weight:700; font-size:var(--fs-md); cursor:pointer; transition:background .18s, border-color .18s, transform .12s; }
/* hover only on real hover devices — on touch, an emulated :hover sticks the gray until the next tap */
@media (hover:hover){ .cbtn:hover{ background:rgba(255,255,255,.16); border-color:rgba(255,255,255,.4); } }
.cbtn:active{ transform:scale(.93); background:rgba(255,255,255,.28); border-color:rgba(255,255,255,.55); transition:transform .06s; }
.cbtn:focus{ outline:none; }
.cbtn:focus-visible{ outline:2px solid rgba(255,255,255,.6); outline-offset:2px; }
.cbtn[disabled]{ opacity:.4; cursor:default; }
.cbtn .ico{ width:18px; height:18px; }
/* the ⤢ fullscreen glyph a touch bigger WITHOUT growing the 38px button (trim its padding to fit) */
#cfull{ font-size:calc(var(--fs-md) + 4px); line-height:1; padding-inline:8px; }

/* edges: organic bézier curves with flowing particles */
.cedges{ position:absolute; inset:0; width:100%; height:100%; z-index:1; opacity:0; transition:opacity .45s ease; overflow:visible; }
.cedge{ fill:none; vector-effect:non-scaling-stroke; stroke-linecap:round; }
.cedge--base{ stroke-width:1.1; opacity:.22; }
.cedge--flow{ stroke-width:2.3; opacity:.62; stroke-dasharray:0.1 11; animation:cflow 1.5s linear infinite; }
.cedge--r2{ stroke:rgba(241,233,216,.16); stroke-width:1; }
.cedge--out{ stroke:rgba(241,233,216,.13); stroke-width:1; }   /* faint stubs to off-screen (infinite map) */
@keyframes cflow{ to{ stroke-dashoffset:-22.2; } }

/* nodes: glass-lite by default; hub + hovered get real frost */
.cnode{ position:absolute; transform:translate(-50%,-50%); z-index:2; display:flex; flex-direction:column; align-items:center; gap:1px;
  padding:12px 21px 14px; border-radius:var(--r-lg); cursor:pointer; text-align:center; color:#f4eede; outline:none; will-change:left,top,opacity;
  /* near-opaque body so the connector lines never show THROUGH the chip; the white gradient on
     top still gives the glassy sheen, so it reads as glass without the see-through. */
  background:linear-gradient(180deg,rgba(255,255,255,.14),rgba(255,255,255,.05)),rgba(11,19,37,.985);
  border:1px solid rgba(255,255,255,.18);
  border-color:color-mix(in srgb, var(--nc) 38%, rgba(255,255,255,.2));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.22), 0 10px 30px rgba(4,10,24,.5);
  transition:left .5s cubic-bezier(.22,.61,.36,1), top .5s cubic-bezier(.22,.61,.36,1),
    opacity .45s ease, transform .18s ease, box-shadow .2s, border-color .2s, backdrop-filter .2s; }
.cnode:hover, .cnode:focus-visible{ z-index:5; transform:translate(-50%,-50%) scale(1.035);
  backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); background:linear-gradient(180deg,rgba(255,255,255,.2),rgba(255,255,255,.08)),rgba(12,20,38,.5);
  border-color:color-mix(in srgb, var(--nc) 70%, #fff);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.3), 0 14px 36px rgba(4,10,24,.55), 0 0 26px color-mix(in srgb, var(--nc) 45%, transparent); }
.cnode:active{ transform:translate(-50%,-50%) scale(.97); }
.cnode.zoomin{ transform:translate(-50%,-50%) scale(1.18); z-index:6; }
.cthai{ font-weight:800; font-size:26.5px; line-height:1.15; color:#fff; letter-spacing:-.01em; white-space:nowrap; }
.cen{ font-size:12px; line-height:1.2; color:rgba(255,255,255,.55); margin-top:2px; white-space:nowrap; }
.cnode--sm{ padding:9px 15px 10px; } .cnode--sm .cthai{ font-size:18px; font-weight:700; }
.cnode--hub{ z-index:4; padding:24px 44px 28px;
  background:rgba(20,40,80,.42);
  background:color-mix(in srgb, var(--nc) 34%, rgba(8,16,34,.55));
  border:1px solid rgba(255,255,255,.5);
  border-color:color-mix(in srgb, var(--nc) 75%, #fff);
  backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px);
  box-shadow:inset 0 0 30px color-mix(in srgb, var(--nc) 38%, transparent), 0 0 48px color-mix(in srgb, var(--nc) 38%, transparent), 0 16px 46px rgba(0,0,0,.55); }
.cnode--hub .cthai{ font-size:50px; } .cnode--hub .cen{ font-size:17px; color:rgba(255,255,255,.8); }
/* Big screens (laptop/desktop) have the most room — push the nodes further so the graph fills it.
   Tablets/iPad landscape already get the bumped default above; small screens keep their own smaller
   breakpoints below (no room). */
@media (min-width:1280px) and (min-height:700px){
  .cnode{ padding:14px 24px 16px; }
  .cthai{ font-size:30px; }
  .cnode--sm .cthai{ font-size:22px; }
  .cnode--hub{ padding:28px 52px 32px; }
  .cnode--hub .cthai{ font-size:57px; } .cnode--hub .cen{ font-size:18px; }
}
/* the centered word "lands" with a clear pop on every render (you see it arrive, not flash) */
.cnode--hub{ animation:cland .5s cubic-bezier(.2,.85,.3,1); }
@keyframes cland{ 0%{ transform:translate(-50%,-50%) scale(.5); opacity:0; } 55%{ opacity:1; } 100%{ transform:translate(-50%,-50%) scale(1); opacity:1; } }
@media (prefers-reduced-motion:reduce){ .cnode--hub{ animation:none; } }
/* perf: drop blur while the graph is animating (entrance / glide) */
.cspace.is-moving .cnode, .cspace.is-moving .cnode--hub{ backdrop-filter:none; -webkit-backdrop-filter:none; }
/* ...but the HUB's frosted look comes FROM that blur — without it, its ~70%-opaque background
   lets the connection lines show straight through for the ~650ms entrance. Give it a near-opaque
   fill only while moving, so it reads solid the whole time (blur + translucency return at rest). */
.cspace.is-moving .cnode--hub{ background:color-mix(in srgb, var(--nc) 40%, rgba(8,16,34,.94)); }

/* decluttered controls revealed on hover/focus — a frosted popover pill (fades, doesn't slide) */
.cpop{ position:absolute; top:calc(100% + 5px); left:50%; transform:translateX(-50%);
  display:flex; align-items:center; gap:3px; padding:5px; border-radius:var(--r-pill);
  background:rgba(10,18,36,.9); border:1px solid rgba(255,255,255,.14);
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); box-shadow:0 10px 26px rgba(0,0,0,.55);
  opacity:0; pointer-events:none; transition:opacity .13s ease; white-space:nowrap; z-index:9; }
/* invisible bridge across the gap so moving the cursor down keeps the node hovered */
.cpop::before{ content:""; position:absolute; left:-12px; right:-12px; top:-11px; height:12px; }
.cnode:hover .cpop, .cnode:focus-within .cpop, .cnode--hub .cpop{ opacity:1; pointer-events:auto; }
.ctool{ width:32px; height:32px; border-radius:50%; border:none; background:transparent; color:rgba(255,255,255,.8);
  font-size:14px; line-height:1; display:flex; align-items:center; justify-content:center; cursor:pointer; padding:0; transition:background .12s, color .12s; }
.ctool .ico{ width:15px; height:15px; }
.ctool:hover{ background:rgba(255,255,255,.14); color:#fff; }
.ctool--play{ color:#fff; } .ctool--play:hover{ background:var(--nc,#2b6); }
.ctool--info{ font-style:italic; font-weight:800; }
.cpop .favbtn{ color:rgba(255,255,255,.78); font-size:15px; } .cpop .favbtn.is-on{ color:var(--rose-500); }
.creg{ font-size:11px; font-weight:800; letter-spacing:.03em; color:#fff; padding:2px 8px; border-radius:99px; line-height:1.6; margin-left:2px; }
.creg--C{ background:#cf9233; } .creg--SF{ background:#2f6bbf; } .creg--F{ background:#2f9468; }
@media (prefers-reduced-motion:reduce){ .cmesh{ animation:none; } .cedge--flow{ animation:none; opacity:.55; } }

/* small stages: shrink nodes + labels so the (already-thinned) rings don't collide */
@media (max-width:600px){
  .cnode{ padding:7px 12px 8px; }
  .cthai{ font-size:18px; }
  .cen{ font-size:11px; }
  .cnode--sm{ padding:6px 10px 7px; } .cnode--sm .cthai{ font-size:14px; }
  .cnode--hub{ padding:16px 28px 18px; }
  .cnode--hub .cthai{ font-size:34px; } .cnode--hub .cen{ font-size:13px; }
}
/* SHORT stages (landscape phones: ~375–430px tall) — width query above misses these
   because they're 660–930px WIDE. Shrink by height so the ring never crushes vertically. */
@media (max-height:520px){
  .cnode{ padding:5px 10px 6px; }
  .cthai{ font-size:15px; }
  .cen{ font-size:10px; }
  .cnode--sm{ padding:4px 8px 5px; } .cnode--sm .cthai{ font-size:12px; }
  .cnode--hub{ padding:9px 18px 11px; }
  .cnode--hub .cthai{ font-size:24px; } .cnode--hub .cen{ font-size:11px; }
}

/* PC / large laptop (NOT small laptop) — a touch more presence: nodes + labels ~15% larger. */
@media (min-width:1440px) and (pointer:fine){
  .cthai{ font-size:26px; } .cen{ font-size:14px; }
  .cnode{ padding:12px 21px 14px; }
  .cnode--sm .cthai{ font-size:18px; }
  .cnode--hub{ padding:25px 46px 29px; }
  .cnode--hub .cthai{ font-size:52px; } .cnode--hub .cen{ font-size:18px; }
}
/* PHONES (portrait ≤600w OR landscape ≤520h): drop the in-stage search — it crowded the top ring
   and clipped it. Back + Fullscreen then sit top-left, Random top-right (flex margin-left:auto).
   Also shrink the hover control pill ~33% so it doesn't clip under the small center node. */
@media (max-width:600px), (max-height:520px){
  .cstage-ctl .wsearch{ display:none; }
  .cpop{ gap:2px; padding:3px; }
  .ctool{ width:22px; height:22px; font-size:11px; }
  .ctool .ico{ width:11px; height:11px; }
  .cpop .favbtn{ font-size:11px; }
  .creg{ font-size:9px; padding:1px 6px; margin-left:1px; }
}

/* ================= Constellation Phase-1 "alive" layer ================= */
/* A3 — degree → node size (sun/planet hierarchy). --k is set per ring star in JS; hub stays 1.
   Difficulty → a soft community-hued heat glow (hue = community identity, intensity = difficulty). */
.cnode{ transform:translate(-50%,-50%) scale(var(--k,1));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.22), 0 10px 30px rgba(4,10,24,.5),
    0 0 calc(6px + var(--df,0)*6px) color-mix(in srgb, var(--nc) calc(5% + var(--df,0)*8%), transparent); }
.cnode:hover, .cnode:focus-visible{ transform:translate(-50%,-50%) scale(calc(1.035*var(--k,1))); }
.cnode:active{ transform:translate(-50%,-50%) scale(calc(.97*var(--k,1))); }

/* A2 — focus + context: the hovered star's neighbourhood stays lit; everything else recedes. */
.cspace.cst-focus .cnode:not(.is-lit){ opacity:.24 !important; filter:saturate(.55); }
.cspace.cst-focus .cnode.is-lit{ z-index:5; }
.cspace.cst-focus .cedge--base:not(.is-lit), .cspace.cst-focus .cedge--flow:not(.is-lit){ opacity:.06; }
.cedge--base.is-lit{ opacity:.55; }
.cedge--flow.is-lit{ opacity:.98; stroke-width:2.8; }
/* sibling links: invisible until one of their stars is lit */
.cedge--sib{ stroke:rgba(176,198,236,.6); stroke-width:1; opacity:0; vector-effect:non-scaling-stroke; transition:opacity .18s ease; }
.cedge--sib.is-lit{ opacity:.5; }
/* "See-Also" edge labels — fade in on hover at the link midpoint (why X links to Y) */
.cedge-lbls{ position:absolute; inset:0; z-index:3; pointer-events:none; }
.cedge-lbl{ position:absolute; transform:translate(-50%,-50%) scale(.86); white-space:nowrap;
  font-size:9.5px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; color:rgba(226,236,252,.92);
  padding:2px 7px; border-radius:99px; background:rgba(12,20,38,.82); border:1px solid rgba(255,255,255,.14);
  -webkit-backdrop-filter:blur(4px); backdrop-filter:blur(4px); box-shadow:0 4px 12px rgba(0,0,0,.4);
  opacity:0; transition:opacity .15s ease, transform .15s ease; }
.cedge-lbl.is-lit{ opacity:1; transform:translate(-50%,-50%) scale(1); }

/* A4 — progress as light: the sky becomes a map of YOUR learning (halos keyed off SRS/♥ state). */
.cn-learned::after, .cn-due::after, .cn-missed::after{ content:""; position:absolute; inset:-3px; border-radius:16px; pointer-events:none; }
.cn-learned::after{ box-shadow:0 0 0 1.5px rgba(242,201,120,.8), 0 0 20px 2px rgba(240,188,88,.5); }
.cn-missed::after{ box-shadow:0 0 0 1.5px rgba(96,156,244,.85), 0 0 18px 2px rgba(72,132,232,.45); }
.cn-due::after{ box-shadow:0 0 0 1.5px rgba(242,201,120,.85), 0 0 18px 2px rgba(240,188,88,.5); animation:cdue 1.9s ease-in-out infinite; }
@keyframes cdue{ 0%,100%{ box-shadow:0 0 0 1.5px rgba(242,201,120,.55), 0 0 12px 1px rgba(240,188,88,.32); } 50%{ box-shadow:0 0 0 2px rgba(245,210,140,.95), 0 0 26px 4px rgba(240,188,88,.6); } }
/* favourited marker: tier-3 (no heart button) shows the ✦ spark; hub + ring-1 show it via their heart. */
.cnode--sm.cn-fav::before{ content:"✦"; position:absolute; top:-6px; right:-4px; z-index:6; font-size:11px; line-height:1;
  color:#ff6f9b; text-shadow:0 0 8px rgba(255,90,140,.85); pointer-events:none; }
@media (prefers-reduced-motion:reduce){ .cn-due::after{ animation:none; box-shadow:0 0 0 1.5px rgba(242,201,120,.8), 0 0 18px 2px rgba(240,188,88,.5); } }

/* ================= Constellation Phase-2 (depth + regions) ================= */
/* A6 — community "region" halos: a soft coloured haze behind each cluster (drifts WITH the graph). */
.chalos{ position:absolute; inset:0; z-index:0; pointer-events:none; }
.chalo{ position:absolute; transform:translate(-50%,-50%); border-radius:50%; pointer-events:none;
  background:radial-gradient(closest-side, color-mix(in srgb, var(--hc) 24%, transparent), transparent 76%);
  opacity:.5; filter:blur(7px); }

/* A5 — depth-2 satellite links: faint at rest, brighten when their neighbourhood is lit. */
.cedge--d2{ stroke:rgba(150,172,214,.5); stroke-width:.8; opacity:.26; vector-effect:non-scaling-stroke; }
.cedge--d2.is-lit{ opacity:.9; stroke-width:1.4; }

/* A5 — depth-2 satellite stars set "further away": pushed BEHIND ring-1, slightly scaled down, softly
   desaturated, and 50% opacity — so they recede into the background but stay READABLE (no blur).
   Opacity comes through the filter chain (opacity()) so the entrance's inline opacity:1 can't wash it
   back to full; hover/focus/lit pulls a satellite forward (sharp, full, up-scaled, on top). */
.cnode--sm.cn-d2{ z-index:1; transform:translate(-50%,-50%) scale(.94); filter:saturate(.85) opacity(.5);
  transition:left .5s cubic-bezier(.22,.61,.36,1), top .5s cubic-bezier(.22,.61,.36,1), transform .22s ease, filter .22s ease, opacity .45s ease; }
.cnode--sm.cn-d2 .cthai{ font-size:15px; font-weight:700; }
.cnode--sm.cn-d2:hover, .cnode--sm.cn-d2:focus-visible{ transform:translate(-50%,-50%) scale(1); filter:saturate(1) opacity(1); z-index:5; }
.cspace.cst-focus .cnode--sm.cn-d2.is-lit{ transform:translate(-50%,-50%) scale(1); filter:saturate(1) opacity(1); }
@media (max-width:600px){ .cnode--sm.cn-d2 .cthai{ font-size:13px; } }

/* ================= Constellation interaction (single=hear / double=travel / ♥=save) ================= */
/* fast double-tap-to-travel: kill the browser's double-tap-zoom + 300ms tap delay on the stage. */
.constellation{ touch-action:manipulation; }

/* heart — HUB ONLY, a bare ICON (no button chrome). Top-right corner, absolutely positioned so it never
   shifts the centered word. Outline when unsaved, RED when saved. Invisible padding gives a comfy tap area. */
.cfav{ position:absolute; top:2px; right:6px; z-index:8; padding:5px; margin:0; border:0; background:none; box-shadow:none;
  -webkit-appearance:none; appearance:none; -webkit-backdrop-filter:none; backdrop-filter:none; line-height:1; cursor:pointer;
  color:rgba(255,255,255,.82); font-size:20px; transition:color .15s ease; }
.cfav.is-on{ color:#ff3b30; text-shadow:0 0 10px rgba(255,59,48,.5); }
/* NO scale on hover/active — scaling the heart (and hub, below) moved the target under the cursor = tap-jitter */
@media (hover:hover){ .cfav:hover{ color:#fff; } .cfav.is-on:hover{ color:#ff3b30; } }
@media (max-width:600px){ .cfav{ font-size:18px; top:1px; right:4px; } }
@media (min-width:1280px) and (pointer:fine){ .cfav{ font-size:24px; } }   /* PC: bigger hub → heart looked small */
/* the hub does NOT scale on hover — its scaling shifted the corner heart under the cursor and flickered */
.cnode--hub:hover, .cnode--hub:focus-visible{ transform:translate(-50%,-50%); }

/* formality pill — HUB ONLY — straddling the bottom border as supplementary info (tiny, doesn't affect centering). */
.creglbl{ position:absolute; left:50%; bottom:0; transform:translate(-50%,50%); z-index:7; white-space:nowrap; pointer-events:none;
  font-size:9px; font-weight:800; letter-spacing:.16em; text-transform:uppercase; line-height:1; color:rgba(255,255,255,.74);
  padding:3px 9px; border-radius:99px; background:color-mix(in srgb, var(--nc) 30%, rgba(8,16,34,.94));
  border:1px solid rgba(255,255,255,.18); -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px); box-shadow:0 3px 10px rgba(0,0,0,.4); }
/* iPad / tablet + desktop: the hub is larger, so the label can carry a touch more size */
@media (min-width:768px){ .creglbl{ font-size:11px; letter-spacing:.18em; padding:3px 11px; } }

/* one-time "go full screen" hint — theme-aware (light + dark) via the app's surface/ink tokens. */
.cfshint{ position:absolute; inset:0; z-index:40; display:flex; align-items:center; justify-content:center; padding:20px;
  background:rgba(6,12,24,.5); -webkit-backdrop-filter:blur(2px); backdrop-filter:blur(2px); opacity:0; transition:opacity .22s ease; }
.cfshint.is-in{ opacity:1; }
.cfshint__card{ width:min(360px,92%); text-align:center; padding:22px 22px 18px;
  background:var(--surface); color:var(--ink-900); border:1px solid var(--line); border-radius:var(--r-xl,18px); box-shadow:var(--shadow-lg);
  transform:translateY(10px) scale(.98); transition:transform .24s cubic-bezier(.2,.8,.3,1); }
.cfshint.is-in .cfshint__card{ transform:none; }
.cfshint__ic{ font-size:26px; line-height:1; margin-bottom:8px; color:var(--blue-500); }
.cfshint__t{ font-size:18px; font-weight:800; color:var(--ink-900); margin-bottom:5px; }
.cfshint__s{ font-size:13.5px; line-height:1.5; color:var(--ink-600); margin-bottom:16px; }
.cfshint__row{ display:flex; gap:9px; }
.cfshint__btn{ flex:1; height:42px; border-radius:12px; font:inherit; font-weight:700; font-size:14px; cursor:pointer;
  border:1px solid transparent; transition:background .15s ease, border-color .15s ease, filter .15s ease, transform .1s ease; }
.cfshint__btn:active{ transform:scale(.97); }
.cfshint__btn--ghost{ background:transparent; border-color:var(--line); color:var(--ink-700); }
.cfshint__btn--go{ background:var(--blue-500); color:#fff; }
@media (hover:hover){ .cfshint__btn--ghost:hover{ background:var(--surface-2, rgba(127,127,127,.08)); } .cfshint__btn--go:hover{ filter:brightness(1.06); } }
@media (prefers-reduced-motion:reduce){ .cfshint, .cfshint__card{ transition:none; } }

/* word info dialog (floating) */
.winfo-back{ position:fixed; inset:0; background:rgba(13,27,42,.45); z-index:300; display:flex; align-items:center; justify-content:center;
  padding:max(var(--s4), var(--safe-t)) max(var(--s4), var(--safe-r)) max(var(--s4), var(--safe-b)) max(var(--s4), var(--safe-l)); animation:fadeIn .15s ease both; }
.winfo{ background:var(--surface); border-radius:var(--r-xl); box-shadow:var(--shadow-lg); max-width:440px; width:100%;
  max-height:calc(100dvh - 2*var(--s4)); overflow-y:auto; -webkit-overflow-scrolling:touch; padding:var(--s6); position:relative; }
.winfo__x{ position:absolute; top:12px; right:14px; width:32px; height:32px; border-radius:50%; border:1px solid var(--line); background:var(--surface); cursor:pointer; font-size:16px; color:var(--ink-500); }
.winfo__x:hover{ background:var(--surface-2); }
.winfo .thai{ font-size:30px; font-weight:800; line-height:1.1; }
.winfo .en{ color:var(--ink-700); font-weight:600; margin-top:2px; }
.winfo__meta{ display:flex; gap:8px; align-items:center; margin:10px 0 14px; flex-wrap:wrap; }
.winfo__desc{ color:var(--ink-700); line-height:1.55; }

/* ===== CONNECTIONS game ===== */
.conn-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:var(--s3); max-width:680px; margin:0 auto; }
@media (max-width:680px){ .conn-grid{ grid-template-columns:repeat(2,1fr);} }
.conn-tile{ aspect-ratio:5/3; display:flex; align-items:center; justify-content:center; text-align:center; padding:var(--s2);
  border-radius:var(--r-md); background:var(--surface-3); border:2px solid transparent; font-weight:700; cursor:pointer; transition:.12s; }
.conn-tile:hover{ background:var(--line); }
.conn-tile.sel{ background:var(--ink-900); color:#fff; }
.conn-solved{ border-radius:var(--r-md); padding:var(--s3) var(--s4); color:#fff; margin-bottom:var(--s3); }
.cs-1{ background:var(--amber-500);} .cs-2{ background:var(--green-500);} .cs-3{ background:var(--blue-500);} .cs-4{ background:var(--violet-500);}

/* ===== RULES (sentences wing) ===== */
.rule{ display:flex; align-items:center; gap:var(--s4); padding:var(--s4) var(--s5); border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); transition:.12s; }
.rule:hover{ border-color:var(--blue-200); box-shadow:var(--shadow-sm); transform:translateX(2px); }
.rule__num{ width:38px; height:38px; flex:none; border-radius:10px; background:var(--blue-50); color:var(--blue-600); display:flex; align-items:center; justify-content:center; font-weight:900; }
.rule__t{ font-weight:700; color:var(--ink-900); }
.rule__t .thai{ color:var(--ink-500); font-weight:600; font-size:var(--fs-sm); }
.tier-pill{ font-size:10px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; padding:3px 8px; border-radius:99px; }
.tier-core{ background:#fde3e8; color:#c23350;} .tier-key{ background:#fdf0d9; color:#b9791a;} .tier-extra{ background:var(--surface-3); color:var(--ink-500);}

/* ===== Sentences/Patterns — compact category cards ===== */
.sx-grid{ display:grid; gap:var(--s4); grid-template-columns:repeat(auto-fill,minmax(340px,1fr)); align-items:start; }
.sx-card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); box-shadow:var(--shadow-sm); overflow:hidden; display:flex; flex-direction:column; transition:transform .12s, box-shadow .15s; }
.sx-card:hover{ transform:translateY(-2px); box-shadow:var(--shadow-md); }
.sx-head{ padding:var(--s4) var(--s5); color:#fff; position:relative; }
.sx-head .row{ display:flex; align-items:center; gap:10px; }
.sx-head .ic{ font-size:24px; line-height:1; }
.sx-head .title{ font-weight:800; font-size:var(--fs-lg); letter-spacing:-.01em; }
.sx-head .tag{ display:block; color:rgba(255,255,255,.92); font-size:var(--fs-sm); margin-top:4px; background:none; padding:0; }
.sx-head .cnt{ position:absolute; top:var(--s4); right:var(--s5); font-size:11px; font-weight:800; background:rgba(255,255,255,.22); padding:3px 9px; border-radius:99px; }
.sx-body{ padding:var(--s4) var(--s5); display:flex; flex-direction:column; gap:var(--s4); }
.sx-sub__name{ font-size:var(--fs-sm); font-weight:800; color:var(--ink-800,var(--ink-900)); display:flex; align-items:center; gap:7px; margin-bottom:7px; }
.sx-sub__name .dot{ width:7px; height:7px; border-radius:50%; flex:none; }
.sx-chips{ display:flex; flex-wrap:wrap; gap:6px; }
.sx-chip{ font-size:12px; font-weight:600; padding:4px 10px; border-radius:99px; background:var(--surface-2); border:1px solid var(--line); color:var(--ink-700); white-space:nowrap; cursor:default; }
.sx-chip:hover{ border-color:var(--blue-300); color:var(--blue-700); background:var(--surface); }
.sx-chip .thai{ font-weight:700; }
.sx-more{ font-size:11px; font-weight:700; color:var(--ink-400); align-self:center; padding:0 4px; }

/* ===== Patterns drill-down selector ===== */
.sx2{ display:flex; flex-direction:column; gap:var(--s5); }
.sx2-cats{ display:grid; grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); gap:var(--s3); }
.sx2-cat{ display:flex; align-items:center; gap:10px; padding:14px 16px; border:1px solid var(--line); border-radius:var(--r-md);
  background:var(--surface); cursor:pointer; font-weight:700; font-size:var(--fs-sm); color:var(--ink-800,var(--ink-900)); transition:.12s; }
.sx2-cat:hover{ border-color:var(--blue-300); transform:translateY(-2px); box-shadow:var(--shadow-sm); }
.sx2-cat .ic{ font-size:20px; line-height:1; }
.sx2-cat.is-active{ color:#fff; border-color:transparent; box-shadow:var(--shadow-md); }
.sx2-cat .n{ margin-left:auto; font-size:11px; font-weight:800; opacity:.55; }

.sx2-ctx{ display:flex; align-items:center; gap:12px; }
.sx2-ctx .badge2{ font-size:24px; }
.sx2-ctx h3{ margin:0; }
.sx2-ctx p{ margin:0; color:var(--ink-500); font-size:var(--fs-sm); }

.sx2-subs{ display:flex; flex-wrap:wrap; gap:8px; }
.sx2-sub{ padding:8px 14px; border-radius:var(--r-pill); border:1px solid var(--line-strong); background:var(--surface);
  font-weight:700; font-size:var(--fs-sm); color:var(--ink-700); cursor:pointer; transition:.12s; }
.sx2-sub:hover{ border-color:var(--blue-300); color:var(--blue-700); }
.sx2-sub.is-active{ color:#fff; border-color:transparent; }

.sx2-panel{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); box-shadow:var(--shadow-sm); padding:var(--s5); min-height:120px; }
.sx2-panel__head{ display:flex; align-items:center; justify-content:space-between; gap:var(--s3); margin-bottom:var(--s4); }
.sx2-panel__head .lbl{ font-weight:800; font-size:var(--fs-lg); }
.sx2-learn{ display:flex; flex-wrap:wrap; gap:var(--s2); }
.sx2-lchip{ display:inline-flex; align-items:center; gap:8px; padding:8px 14px; border-radius:var(--r-md);
  border:1px solid var(--line); background:var(--surface-2); font-weight:600; cursor:pointer; transition:.12s; }
.sx2-lchip:hover{ background:var(--surface); border-color:var(--blue-300); box-shadow:var(--shadow-sm); }
.sx2-lchip .thai{ font-size:var(--fs-md); font-weight:700; }
.sx2-lchip .arr{ color:var(--ink-300,var(--ink-400)); }

/* ===== Patterns: zoned witty category grid ===== */
.pz{ margin-bottom:var(--s7); }
.pz__head{ display:flex; align-items:baseline; gap:10px; margin-bottom:var(--s3); }
.pz__head .bar{ width:11px; height:11px; border-radius:3px; align-self:center; }
.pz__head h3{ margin:0; font-size:var(--fs-xl); }
.pz__head .sub{ color:var(--ink-500); font-size:var(--fs-sm); }
.pc-grid{ display:grid; gap:var(--s3); grid-template-columns:repeat(auto-fill,minmax(225px,1fr)); }
.pc-card{ display:block; padding:var(--s4); background:var(--surface); border:1px solid var(--line); border-left:4px solid var(--blue-500);
  border-radius:var(--r-md); box-shadow:var(--shadow-sm); transition:transform .12s, box-shadow .15s; }
.pc-card:hover{ transform:translateY(-1px); box-shadow:var(--shadow-md); }
.pc-card .t{ font-family:var(--font-display); font-weight:700; color:var(--ink-900); letter-spacing:-.01em; }
.pc-card .b{ font-size:var(--fs-sm); color:var(--ink-500); margin-top:3px; line-height:1.4; }
.pc-card .c{ margin-top:10px; font-size:11px; font-weight:800; display:flex; align-items:center; gap:8px; }
.pc-card .c .ico{ width:1em; height:1em; }
.pc-card .pc-prog{ flex:1; max-width:90px; height:5px; background:var(--surface-3); border-radius:99px; overflow:hidden; }
.pc-card .pc-prog i{ display:block; height:100%; background:currentColor; border-radius:99px; }
.pc-card.is-empty{ opacity:.6; }
.pc-card.is-empty:hover{ opacity:.85; }
.pc-card.is-allmastered{ border-color:var(--green-300); background:linear-gradient(180deg,var(--green-100),var(--surface) 60%); }

/* ===== Chapter head (rule list page) ===== */
.chap-head{ display:flex; align-items:center; gap:var(--s4); padding:var(--s5); background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-lg); box-shadow:var(--shadow-sm); border-left:5px solid var(--c,var(--blue-500)); }
.chap-head__bar{ display:none; }
.chap-head h1{ font-size:var(--fs-2xl); }
.chap-head__prog{ flex:none; text-align:center; }
.chap-ring{ font-family:var(--font-display); font-weight:700; font-size:var(--fs-lg); color:var(--c,var(--blue-600));
  border:2px solid var(--c,var(--blue-500)); border-radius:var(--r-pill); padding:6px 14px; }
.chap-head__prog .muted{ display:block; font-size:var(--fs-xs); margin-top:3px; }

/* ===== Rule list inside a chapter (rich rows + mastered toggle) ===== */
.rulelist{ display:flex; flex-direction:column; gap:10px; }
.rulerow{ display:flex; align-items:stretch; gap:0; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md);
  overflow:hidden; box-shadow:var(--shadow-sm); transition:border-color .15s, box-shadow .15s, transform .1s; }
.rulerow:hover{ border-color:var(--c,var(--blue-300)); box-shadow:var(--shadow-md); transform:translateY(-1px); }
.rulerow__go{ flex:1; min-width:0; display:flex; align-items:center; gap:var(--s4); padding:var(--s4) var(--s4);
  border-left:4px solid var(--c,var(--blue-500)); color:var(--ink-900); }
.rulerow__idx{ flex:none; width:30px; height:30px; border-radius:50%; background:var(--surface-3); color:var(--ink-500);
  font-family:var(--font-display); font-weight:700; font-size:var(--fs-sm); display:flex; align-items:center; justify-content:center; }
.rulerow__txt{ min-width:0; flex:1; display:flex; flex-direction:column; }
.rulerow__title{ font-weight:700; color:var(--ink-900); line-height:1.3; }
.rulerow__prev{ font-size:var(--fs-sm); color:var(--ink-500); line-height:1.35; margin-top:2px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rulerow__open{ flex:none; display:inline-flex; align-items:center; gap:4px; color:var(--c,var(--blue-600)); font-weight:700;
  font-size:var(--fs-sm); opacity:0; transition:opacity .15s; }
.rulerow__open .ico{ width:1em; height:1em; }
.rulerow:hover .rulerow__open{ opacity:1; }
.rulerow__master{ flex:none; display:inline-flex; align-items:center; gap:6px; padding:0 var(--s4); border:0; border-left:1px solid var(--line);
  background:var(--surface-2); color:var(--ink-500); font-weight:700; font-size:var(--fs-sm); transition:background .15s, color .15s; }
.rulerow__master .ico{ width:16px; height:16px; }
.rulerow__master:hover{ background:var(--green-100); color:var(--green-600); }
.rulerow__master.is-on{ background:var(--green-500); color:#fff; }
.rulerow.is-mastered .rulerow__idx{ background:var(--green-500); color:#fff; }
.rulerow.is-mastered .rulerow__title{ color:var(--ink-700); }
@media (max-width:560px){ .rulerow__open{ display:none; } .rulerow__master .lbl{ display:none; } .rulerow__master{ padding:0 14px; } }

/* "mark as mastered" button (also used inside the rule) */
.masterbtn{ display:inline-flex; align-items:center; gap:7px; height:36px; padding:0 16px; border-radius:var(--r-pill);
  border:1px solid var(--green-500); background:var(--surface); color:var(--green-600); font-weight:700; font-size:var(--fs-sm);
  transition:background .15s, color .15s, box-shadow .15s; }
.masterbtn .ico{ width:16px; height:16px; }
.masterbtn:hover{ background:var(--green-100); }
.masterbtn.is-on{ background:var(--green-500); border-color:var(--green-500); color:#fff; }
.masterbtn--lg{ height:46px; padding:0 var(--s5); font-size:var(--fs-md); }
.pat-foot{ display:flex; align-items:center; justify-content:space-between; gap:var(--s4); margin-top:var(--s6); flex-wrap:wrap; }

/* ===== Universal 1-pager (Pattern) ===== */
.pat{ max-width:780px; margin:0 auto; }
.pat-title{ font-family:var(--font-display); font-size:var(--fs-2xl); font-weight:700; letter-spacing:-.02em; margin:6px 0 4px; }
.pat-tldr{ font-size:var(--fs-lg); color:var(--ink-700); margin:0; }
.pat-formula{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin:var(--s5) 0;
  font-family:ui-monospace,Menlo,Consolas,monospace; font-weight:800; font-size:var(--fs-lg);
  background:var(--blue-50); border:1px solid var(--blue-100); color:var(--blue-700); padding:14px 18px; border-radius:var(--r-md); }
.pat-formula .k{ font-family:var(--font); font-size:10px; letter-spacing:.12em; color:var(--blue-500); background:#fff; padding:3px 8px; border-radius:99px; }
.pat-hero{ background:linear-gradient(135deg,var(--blue-600),var(--blue-500) 60%,#2b86ef); color:#fff; border-radius:var(--r-lg);
  padding:var(--s6); text-align:center; box-shadow:var(--shadow-md); margin:var(--s5) 0; }
.pat-hero .th{ font-size:var(--fs-3xl); font-weight:800; }
.pat-hero .rm{ opacity:.9; font-weight:600; margin-top:6px; }
.pat-hero .en{ opacity:.95; margin-top:2px; }
.pat-hero .audio{ margin-top:16px; background:rgba(255,255,255,.2); border-color:transparent; color:#fff; }
.pat-hero .audio:hover{ background:rgba(255,255,255,.32); }
.pat-sec{ margin-top:var(--s6); }
.pat-sec h4{ font-size:11px; text-transform:uppercase; letter-spacing:.1em; color:var(--ink-400); margin:0 0 var(--s3); font-weight:800; }
.pat-callout{ display:flex; gap:14px; padding:14px 16px; border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); margin-bottom:10px; }
.pat-callout .k{ flex:none; width:96px; font-weight:800; font-size:var(--fs-sm); }
.pat-callout .t{ color:var(--ink-700); }
.pat-callout--remember{ border-left:4px solid var(--blue-500); } .pat-callout--remember .k{ color:var(--blue-600); }
.pat-callout--watch{ border-left:4px solid var(--amber-500); background:#fdf6e9; } .pat-callout--watch .k{ color:#b9791a; }
.pat-callout--native{ border-left:4px solid var(--green-500); background:var(--green-100); } .pat-callout--native .k{ color:var(--green-600); }
.pat-callout--note{ border-left:4px solid var(--line-strong); }
.pat-prose{ font-size:var(--fs-md); line-height:1.75; color:var(--ink-700); }
.pat-term{ font-weight:700; color:var(--blue-700); background:var(--blue-50); padding:1px 6px; border-radius:6px; }
.pat-gloss{ color:var(--ink-500); }
.pat-inline-formula{ font-family:ui-monospace,Menlo,Consolas,monospace; font-weight:700; background:var(--surface-3); padding:1px 7px; border-radius:6px; color:var(--ink-900); }
.pat-ex{ display:flex; align-items:center; gap:var(--s3); padding:12px 14px; border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); margin-bottom:8px; }
.pat-ex .th{ font-size:var(--fs-lg); font-weight:700; }
.pat-ex .meta{ color:var(--ink-500); font-size:var(--fs-sm); }
.pat-source{ margin-top:var(--s6); padding-top:var(--s4); border-top:1px solid var(--line); color:var(--ink-400); font-size:var(--fs-sm); }

/* ===== Grammar compact browser (category -> rules) ===== */
.gx-wrap{ display:grid; grid-template-columns:248px 1fr; gap:var(--s5); align-items:start; }
@media (max-width:820px){ .gx-wrap{ grid-template-columns:1fr; } }
.gx-cats{ position:sticky; top:84px; display:flex; flex-direction:column; gap:3px; max-height:calc(100vh - 110px); overflow:auto; padding-right:4px; }
.gx-cat{ display:flex; align-items:center; gap:8px; padding:9px 12px; border-radius:var(--r-md); cursor:pointer; font-size:var(--fs-sm); font-weight:700; color:var(--ink-700); }
.gx-cat:hover{ background:var(--surface-2); }
.gx-cat.is-active{ background:var(--green-100); color:var(--green-600); }
.gx-cat .n{ margin-left:auto; font-size:11px; color:var(--ink-400); font-weight:800; }
.gx-rules{ display:flex; flex-direction:column; gap:7px; }
.gx-rulehead{ display:flex; align-items:baseline; gap:10px; margin-bottom:var(--s2); }
.gx-rulehead h3{ margin:0; }
.gx-rule{ display:flex; align-items:center; gap:var(--s3); padding:11px 14px; border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); transition:.12s; }
.gx-rule:hover{ border-color:var(--green-300); transform:translateX(2px); box-shadow:var(--shadow-sm); }
.gx-rule .nm{ font-weight:700; color:var(--ink-900); }
.gx-rule .fm{ font-family:ui-monospace,Menlo,Consolas,monospace; color:var(--green-600); font-size:var(--fs-sm); }
.gx-rule .arr{ margin-left:auto; color:var(--ink-400); flex:none; }

/* evidence list */
.evidence{ display:flex; flex-direction:column; gap:var(--s2); }
.ev{ display:flex; align-items:center; gap:var(--s3); padding:var(--s3) var(--s4); border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); }
.ev .thai{ font-size:var(--fs-lg); font-weight:600; }

/* ===== SCENARIO detail / Panic Card ===== */
.dialog{ display:flex; flex-direction:column; gap:var(--s3); }
.bubble{ max-width:78%; padding:var(--s3) var(--s4); border-radius:18px; background:var(--surface); border:1px solid var(--line); box-shadow:var(--shadow-sm); }
.bubble .thai{ font-size:var(--fs-lg); font-weight:600; }
.bubble .en{ color:var(--ink-500); font-size:var(--fs-sm); margin-top:2px; }
.bubble .who{ font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.08em; color:var(--ink-400); margin-bottom:4px; }
.turn{ display:flex; }
.turn--me{ justify-content:flex-end; }
.turn--me .bubble{ background:var(--blue-500); border-color:var(--blue-500); color:#fff; }
.turn--me .bubble .en{ color:rgba(255,255,255,.85);} .turn--me .bubble .who{ color:rgba(255,255,255,.7);}

.panic{ background:linear-gradient(135deg,var(--surface),var(--surface)); border:2px solid var(--rose-500); border-radius:var(--r-xl); padding:var(--s5); }
.panic h3{ color:var(--rose-500); display:flex; align-items:center; gap:8px; }
.panic-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:var(--s3); }
.panic-word{ border:1px solid var(--line); border-radius:var(--r-md); padding:var(--s4); text-align:center; background:var(--surface); cursor:pointer; transition:.12s; }
.panic-word:hover{ border-color:var(--rose-500); background:#fff6f7; }
.panic-word .thai{ font-size:26px; font-weight:800; }
.panic-word .en{ font-size:var(--fs-sm); color:var(--ink-500); }

/* ===== TUTOR ===== */
.chat{ display:flex; flex-direction:column; gap:var(--s4); max-width:760px; margin:0 auto; }
.msg{ display:flex; gap:var(--s3); }
.msg__av{ width:34px; height:34px; border-radius:99px; flex:none; display:flex; align-items:center; justify-content:center; font-weight:800; color:#fff; }
.msg--ai .msg__av{ background:var(--blue-500);} .msg--me .msg__av{ background:var(--green-500);}
.msg__body{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); padding:var(--s3) var(--s4); }
.msg--me{ flex-direction:row-reverse; } .msg--me .msg__body{ background:var(--blue-50); border-color:var(--blue-100); }
.composer{ position:sticky; bottom:0; display:flex; gap:var(--s2); padding:var(--s4) 0; background:linear-gradient(transparent,var(--surface-2) 30%); }
.composer input{ flex:1; height:48px; padding:0 var(--s4); border-radius:var(--r-pill); border:1px solid var(--line-strong); background:var(--surface); }
.tutor-suggest{ display:flex; gap:var(--s2); flex-wrap:wrap; }

/* ===== Playlists ===== */
.pl-card{ display:flex; gap:var(--s4); padding:var(--s4); }
.pl-card .cover{ width:96px; height:96px; border-radius:var(--r-md); flex:none; display:flex; align-items:center; justify-content:center; font-size:38px; color:#fff; }

/* big number lockups for placement */
.quiz{ max-width:640px; margin:0 auto; }
.quiz__opts{ display:flex; flex-direction:column; gap:var(--s3); margin-top:var(--s5); }

/* ===== SOUNDS: drills / games / registers (added for the full Sounds wing) ===== */
.cw .r{ color:var(--ink-400); font-size:var(--fs-sm); font-weight:600; }
.cw .thai{ min-width:2.2em; }

/* minimal-pair cards (aspiration, vowel length) */
.pairgrid{ display:grid; gap:var(--s4); grid-template-columns:repeat(auto-fill,minmax(290px,1fr)); }
.paircard{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); padding:var(--s4); box-shadow:var(--shadow-sm); }
.paircard .ph{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.paircard .ph .hint{ font-size:var(--fs-sm); color:var(--ink-500); }
.paircard .ph .badge2{ font-size:11px; font-weight:800; color:#fff; background:var(--blue-500); padding:2px 9px; border-radius:99px; letter-spacing:.02em; }
.pairvs{ display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:var(--s3); }
.pairvs .vs{ font-weight:800; color:var(--ink-400); font-size:var(--fs-sm); }
.pcell{ text-align:center; border:1px solid var(--line); border-radius:var(--r-md); padding:var(--s4) var(--s2); cursor:pointer; transition:.12s; background:var(--surface-2,#fafcff); }
.pcell:hover{ border-color:var(--blue-400); background:var(--surface); box-shadow:var(--shadow-sm); }
.pcell .thai{ font-size:30px; font-weight:800; line-height:1.1; }
.pcell .r{ color:var(--ink-500); font-size:var(--fs-sm); font-weight:600; margin-top:2px; }
.pcell .g{ color:var(--ink-400); font-size:var(--fs-xs); }
.pcell .pl{ color:var(--blue-500); font-size:11px; margin-top:4px; }

/* register ladders */
.ladgrid{ display:grid; gap:var(--s4); grid-template-columns:repeat(auto-fill,minmax(340px,1fr)); }
.ladcard{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); padding:var(--s4); box-shadow:var(--shadow-sm); }
.ladcard h3{ margin:0 0 10px; font-size:var(--fs-md); }
.rungs{ display:flex; flex-direction:column; gap:8px; }
.rung{ display:flex; align-items:center; gap:11px; padding:9px 12px; border:1px solid var(--line); border-left:4px solid var(--lc,var(--blue-500)); border-radius:var(--r-sm); background:var(--surface); cursor:pointer; transition:.12s; }
.rung:hover{ background:#fafcff; border-color:var(--lc,var(--blue-400)); }
.rung .lvl2{ font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.03em; color:#fff; background:var(--lc,var(--blue-500)); padding:3px 9px; border-radius:99px; flex:none; min-width:62px; text-align:center; }
.rung .mid{ flex:1; min-width:0; display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
.rung .thai{ font-size:var(--fs-lg); font-weight:800; white-space:nowrap; }
.rung .r{ color:var(--ink-500); font-size:var(--fs-sm); white-space:nowrap; }
.rung .g{ color:var(--ink-400); font-size:var(--fs-sm); }
.rung .pl{ flex:none; }

/* class explainer table */
.tonerule{ width:100%; border-collapse:collapse; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); overflow:hidden; }
.tonerule th,.tonerule td{ padding:8px 12px; text-align:left; border-bottom:1px solid var(--line); font-size:var(--fs-sm); }
.tonerule th{ background:var(--blue-50); font-weight:800; }
.tonerule td .thai{ font-weight:700; }
.classchips{ display:flex; flex-wrap:wrap; gap:6px; }
.classchips .cc{ font-weight:800; font-size:var(--fs-md); padding:6px 12px; border-radius:var(--r-sm); color:#fff; }

/* game */
.tgame{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); padding:var(--s6); text-align:center; max-width:620px; margin:0 auto; }
.tgame .score{ display:flex; justify-content:center; gap:var(--s5); margin-bottom:var(--s4); }
.tgame .score b{ font-size:26px; display:block; }
.tgame .score span{ font-size:var(--fs-sm); color:var(--ink-500); }
.bigplay{ font-size:var(--fs-lg); padding:16px 26px; }
.toneopts{ display:grid; grid-template-columns:repeat(5,1fr); gap:var(--s2); margin-top:var(--s5); }
@media (max-width:560px){ .toneopts{ grid-template-columns:repeat(2,1fr);} }
.toneopts .opt.correct{ border-color:var(--green-500); background:#eafaf2; color:var(--green-600,#0f9a5b); }
.toneopts .opt.wrong{ border-color:var(--rose-500); background:#fff1f3; color:var(--rose-500); }
.abopts{ display:grid; grid-template-columns:1fr 1fr; gap:var(--s3); margin-top:var(--s5); }
/* reserve space so a correct/wrong reveal never shifts the page */
.tg-fb{ height:3.2em; overflow:hidden; margin-top:var(--s4); font-weight:700; display:flex; align-items:center; justify-content:center; text-align:center; }
.tg-fb.ok{ color:var(--green-600,#0f9a5b);} .tg-fb.no{ color:var(--rose-500);}
.tgame #g-next{ visibility:hidden; }            /* always occupies height; only shown when answered */
.tgame #g-next.is-shown{ visibility:visible; }

/* ===== CONSTELLATION explorer: word search ===== */
.wsearch{ position:relative; max-width:360px; }
.wsearch input{ width:100%; height:38px; padding:0 14px; border-radius:var(--r-pill); border:1px solid var(--line-strong); background:var(--surface); font-size:var(--fs-sm); }
.wsearch-list{ display:none; position:absolute; z-index:30; top:42px; left:0; right:0; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); box-shadow:var(--shadow-lg); max-height:340px; overflow:auto; }
.wsearch-list.show{ display:block; }
.wsr{ display:block; width:100%; text-align:left; padding:8px 12px; border:0; border-top:1px solid var(--line); background:var(--surface); cursor:pointer; font-size:var(--fs-sm); }
.wsr:first-child{ border-top:0; } .wsr:hover{ background:var(--surface-2); }
.wsr .thai{ font-weight:700; }

/* ===== SCENARIO detail: scene hero, dialogue breakdown, story word chips ===== */
.scene-hero{ position:relative; min-height:240px; border-radius:var(--r-xl); background-size:cover; background-position:center; overflow:hidden; display:flex; align-items:flex-end; box-shadow:var(--shadow-md); margin-bottom:var(--s5); }
.scene-hero__in{ padding:var(--s5) var(--s6); color:#fff; }
.scene-hero__in h1{ margin:0; color:#fff; text-shadow:0 2px 12px rgba(0,0,0,.5); }
.scene-hero__in .muted2{ color:rgba(255,255,255,.85); font-size:var(--fs-sm); margin-top:6px; }
.bubble__act{ display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.turn--me .bubble__act .audio{ background:rgba(255,255,255,.18); border-color:transparent; color:#fff; }
.brk{ border-top:1px dashed var(--line); padding-top:8px; }
.turn--me .brk{ border-top-color:rgba(255,255,255,.35); }
.brk summary{ cursor:pointer; font-size:var(--fs-sm); font-weight:700; list-style:none; opacity:.9; }
.brk summary::-webkit-details-marker{ display:none; }
.brk__words{ display:flex; flex-wrap:wrap; gap:6px; margin:10px 0; }
.brk__lesson{ font-size:var(--fs-sm); line-height:1.5; opacity:.92; }
.turn--me .brk__lesson{ color:rgba(255,255,255,.92); }
/* story word chip (thai · gloss · pos) */
.swcwrap{ display:flex; flex-wrap:wrap; gap:8px; }
.swc{ display:inline-flex; align-items:center; gap:7px; border:1px solid var(--line); border-radius:var(--r-pill); padding:6px 8px 6px 13px; background:var(--surface); cursor:pointer; transition:.12s; white-space:nowrap; }
.swc:hover{ border-color:var(--blue-400); background:var(--surface-2); }
.swc .thai{ font-weight:700; font-size:var(--fs-md); }
.swc .g{ color:var(--ink-500); font-size:var(--fs-sm); }
.swc .p{ color:var(--ink-400); font-size:10px; text-transform:uppercase; letter-spacing:.03em; }
.swc--sm{ padding:4px 10px; background:var(--surface-2); }
.turn--me .swc{ background:rgba(255,255,255,.16); border-color:transparent; color:#fff; }
.turn--me .swc .g{ color:rgba(255,255,255,.8); } .turn--me .swc .p{ color:rgba(255,255,255,.6); }
/* vocab category selector (one group at a time) */
.vocab-tabs{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:var(--s4); }
.vtab{ border:1px solid var(--line-strong); background:var(--surface); color:var(--ink-700); border-radius:var(--r-pill);
  padding:7px 14px; font-weight:700; font-size:var(--fs-sm); cursor:pointer; display:inline-flex; align-items:center; gap:7px; transition:.15s; }
.vtab:hover{ border-color:var(--blue-300); color:var(--blue-700); }
.vtab.is-active{ background:var(--blue-500); border-color:var(--blue-500); color:#fff; }
.vtab__n{ font-size:11px; opacity:.85; background:rgba(0,0,0,.08); padding:1px 7px; border-radius:99px; }
.vtab.is-active .vtab__n{ background:rgba(255,255,255,.25); opacity:1; }
.vocab-panel{ display:none; }
.vocab-panel.is-active{ display:block; animation:fadeIn .2s ease both; }
.vgroup{ margin-bottom:var(--s4); }
.vgroup__t{ font-weight:800; font-size:var(--fs-sm); text-transform:uppercase; letter-spacing:.04em; color:var(--ink-500); margin-bottom:8px; }

/* ===== WORD CATEGORY grid ===== */
.wcat-grid{ display:grid; gap:var(--s4); grid-template-columns:repeat(auto-fill,minmax(208px,1fr)); }
.wcard{ position:relative; background:var(--surface); border:1px solid var(--line); border-left:5px solid var(--c,var(--blue-500)); border-radius:var(--r-lg); padding:18px 18px 14px; cursor:pointer; transition:.12s; text-align:left; box-shadow:var(--shadow-sm); display:flex; flex-direction:column; min-height:128px; }
.wcard:hover{ transform:translateY(-2px); box-shadow:var(--shadow-md); border-color:var(--c,var(--blue-400)); }
/* Thai has no spaces, so a long string is one unbreakable "word" — force it to wrap inside the
   card (was writing off the edge). No right padding now that the heart has moved to the foot. */
.wcard__thai{ font-size:34px; font-weight:800; line-height:1.15; overflow-wrap:anywhere; word-break:break-word; }
.wcard__en{ color:var(--ink-600,#475866); font-size:var(--fs-md); margin-top:4px; flex:1; }
.wcard__foot{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:12px; }
.wcard__play{ font-size:11px; font-weight:700; color:var(--c,var(--blue-600)); display:inline-flex; align-items:center; gap:5px; }
.wcard__web{ font-size:11px; font-weight:700; color:var(--ink-400); border:1px solid var(--line); border-radius:99px; padding:3px 11px; }
.wcard__web:hover{ border-color:var(--c,var(--blue-400)); color:var(--c,var(--blue-600)); background:var(--surface-2); }

/* ===== FAVORITE ♥ (global, on every displayed word) ===== */
.favbtn{ border:none; background:transparent; cursor:pointer; color:var(--ink-300,#aab6c2); font-size:16px; line-height:1; padding:2px; transition:transform .12s, color .12s; }
.favbtn:hover{ transform:scale(1.2); color:var(--rose-500); }
.favbtn.is-on{ color:var(--rose-500); }
.wcard__fav{ font-size:20px; margin-right:auto; }  /* now a foot item (left), not an absolute corner overlay */
.swc__fav{ font-size:14px; margin-left:2px; }
.cfav{ font-size:13px; } .cnode--hub .cfav, .cnode--hub .cfav.is-on{ color:#fff; }
.feed-fav{ width:48px; height:48px; border-radius:99px; background:rgba(255,255,255,.18)!important; color:#fff; font-size:22px; backdrop-filter:blur(4px); }
.feed-fav.is-on{ color:#ff5a7a; }

/* ===== Collapsible vocab block (scenario detail) ===== */
.vocab-wrap{ border:1px solid var(--line); border-radius:var(--r-lg); background:var(--surface); box-shadow:var(--shadow-sm); overflow:hidden; }
.vocab-wrap > summary{ list-style:none; cursor:pointer; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:16px 20px; font-size:var(--fs-lg); font-weight:800; }
.vocab-wrap > summary::-webkit-details-marker{ display:none; }
.vocab-wrap > summary .muted{ font-size:var(--fs-sm); font-weight:600; }
.vocab-wrap[open] > summary{ border-bottom:1px solid var(--line); }
.vocab-body{ padding:18px 20px; }

/* ===== REVIEW flashcards ===== */
.rv-wrap{ max-width:560px; margin:0 auto; }
.rv-prog{ height:6px; border-radius:99px; background:var(--surface-3); overflow:hidden; }
.rv-prog i{ display:block; height:100%; background:var(--green-500); transition:width .25s; }
.rv-meta{ font-size:var(--fs-sm); margin:8px 0 12px; text-align:center; }
.rv-card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-xl); box-shadow:var(--shadow-md); padding:var(--s7) var(--s6); text-align:center; }
.rv-thai{ font-size:clamp(34px, 8vw, 54px); font-weight:800; line-height:1.1; }
.rv-en{ font-size:var(--fs-xl); font-weight:700; color:var(--ink-900); margin-top:var(--s4); }
.rv-actions{ display:flex; gap:var(--s3); justify-content:center; margin-top:var(--s5); }
.rv-done h2{ margin:8px 0; }
.btn--lg{ height:50px; padding:0 var(--s5); font-size:var(--fs-md); }

/* ===== PLAYLIST steps ===== */
.plist__cover{ width:64px; height:64px; border-radius:var(--r-lg); flex:none; display:flex; align-items:center; justify-content:center; font-size:32px; color:#fff; }
.pl-steps{ margin-top:10px; border-top:1px solid var(--line); }
.pl-step{ display:flex; align-items:center; gap:12px; padding:10px 4px; border-bottom:1px solid var(--line); transition:.12s; }
.pl-step:hover{ background:var(--surface-2); }
.pl-step__n{ width:24px; height:24px; border-radius:50%; color:#fff; font-size:12px; font-weight:800; display:flex; align-items:center; justify-content:center; flex:none; }
.pl-step__l{ flex:1; font-weight:600; }
.pl-step__go{ color:var(--ink-400); }

/* ===== Bigger, cohesive scenario dialogue ===== */
.dialog--lg{ gap:var(--s4); max-width:840px; }
.dialog--lg .bubble{ max-width:76%; padding:var(--s4) var(--s5); border-radius:20px; }
.dialog--lg .bubble .who{ font-size:11px; margin-bottom:6px; opacity:.85; }
.dialog--lg .bubble .thai{ font-size:25px; font-weight:700; line-height:1.4; }
.dialog--lg .bubble .en{ font-size:var(--fs-md); margin-top:5px; }
.dialog--lg .brk summary{ font-size:var(--fs-sm); }
.dialog--lg .turn--me .favbtn{ color:rgba(255,255,255,.85); } .dialog--lg .turn--me .favbtn.is-on{ color:#ff9db0; }

/* ===== Scenario dialogue — chat interface (redesign) ===== */
.chat{ display:flex; flex-direction:column; gap:var(--s5); max-width:840px; }
.cturn{ display:flex; gap:var(--s3); align-items:flex-start; }
.cturn--me{ flex-direction:row-reverse; }
.cturn__avatar{ flex:none; width:42px; height:42px; border-radius:50%; background:var(--av,var(--blue-500)); color:#fff;
  display:flex; align-items:center; justify-content:center; font-family:var(--font-display); font-weight:700; font-size:var(--fs-md);
  box-shadow:var(--shadow-sm); margin-top:22px; }
.cturn__avatar .ico{ width:20px; height:20px; }
.cturn__col{ min-width:0; max-width:82%; display:flex; flex-direction:column; gap:8px; }
.cturn--me .cturn__col{ align-items:flex-end; }
.cturn__who{ font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-400); padding:0 8px; }
.cbubble{ position:relative; align-self:flex-start; background:var(--surface); border:1px solid var(--line); border-radius:18px;
  padding:15px 18px 15px 56px; box-shadow:var(--shadow-sm); }
.cturn--me .cbubble{ align-self:flex-end; background:var(--blue-500); border-color:var(--blue-500); color:#fff; padding:15px 56px 15px 18px; }
.cturn--them .cbubble{ border-top-left-radius:6px; }
.cturn--me .cbubble{ border-top-right-radius:6px; }
.cbubble__play{ position:absolute; top:14px; left:14px; width:34px; height:34px; border-radius:50%; border:0;
  background:var(--av,var(--blue-500)); color:#fff; display:flex; align-items:center; justify-content:center; box-shadow:var(--shadow-sm); transition:transform .08s, filter .15s; }
.cturn--me .cbubble__play{ left:auto; right:14px; background:rgba(255,255,255,.22); }
.cbubble__play .ico{ width:15px; height:15px; }
.cbubble__play:hover{ filter:brightness(1.08); } .cbubble__play:active{ transform:scale(.92); }
.cbubble__thai{ font-size:25px; font-weight:700; line-height:1.45; }
.cbubble__en{ font-size:var(--fs-md); color:var(--ink-500); margin-top:5px; }
.cturn--me .cbubble__en{ color:rgba(255,255,255,.9); }

/* break-it-down (redesigned) */
.brk2{ align-self:flex-start; max-width:100%; }
.cturn--me .brk2{ align-self:flex-end; }
.brk2__sum{ list-style:none; cursor:pointer; display:inline-flex; align-items:center; gap:7px; font-size:var(--fs-sm); font-weight:700;
  color:var(--ink-700); background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r-pill); padding:7px 15px; transition:.15s; }
.brk2__sum::-webkit-details-marker{ display:none; }
.brk2__sum:hover{ border-color:var(--blue-300); color:var(--blue-700); }
.brk2__sum .ico{ width:15px; height:15px; color:var(--amber-500); }
.brk2__chev .ico{ width:14px; height:14px; color:var(--ink-400); transition:transform .2s; }
.brk2[open] .brk2__chev .ico{ transform:rotate(90deg); }
.brk2__body{ margin-top:10px; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); padding:var(--s4); box-shadow:var(--shadow-sm); }
.brk2__words{ display:grid; grid-template-columns:repeat(auto-fill,minmax(136px,1fr)); gap:10px; }
.brkword{ position:relative; text-align:left; background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r-md);
  padding:11px 12px; cursor:pointer; transition:.12s; }
.brkword:hover{ border-color:var(--blue-400); background:var(--surface); box-shadow:var(--shadow-sm); transform:translateY(-1px); }
.brkword__top{ display:flex; align-items:flex-start; justify-content:space-between; gap:6px; }
.brkword__thai{ font-size:var(--fs-xl); font-weight:700; line-height:1.2; }
.brkword__en{ display:block; font-size:var(--fs-sm); color:var(--ink-500); margin-top:3px; }
.brkword__play{ display:inline-flex; align-items:center; gap:4px; margin-top:9px; color:var(--blue-600); font-size:var(--fs-xs); font-weight:700; }
.brkword__play .ico{ width:13px; height:13px; }
.brkword__fav{ font-size:15px; }
.brk-tip{ display:flex; gap:11px; align-items:flex-start; margin-top:var(--s4); padding:12px 14px; border-radius:var(--r-md);
  background:#f4eedd; border:1px solid #ece1c4; }
.brk-tip__k{ flex:none; display:inline-flex; align-items:center; gap:5px; font-weight:800; font-size:var(--fs-xs); text-transform:uppercase;
  letter-spacing:.04em; color:var(--amber-600); white-space:nowrap; }
.brk-tip__k .ico{ width:14px; height:14px; }
.brk-tip__t{ font-size:var(--fs-sm); line-height:1.5; color:var(--ink-700); }
@media (max-width:560px){ .cturn__col{ max-width:90%; } .cbubble__thai{ font-size:21px; } .brk2__words{ grid-template-columns:repeat(auto-fill,minmax(116px,1fr)); } }

/* ===== LIVE CONVERSATION (scenario dialogue, owner redesign 2026-07-08) =====
   The dialogue is no longer dumped at once — it UNFOLDS like a real chat: the upcoming
   speaker "types" (three pulsing dots in their own bubble), the line lands with a spring
   fade and auto-plays, and a glowing Next prompt advances the conversation (space/enter/→
   on desktop). A quiet "Show all" chip remains for skimming. Reduced-motion: instant. */
.cturn.is-hidden{ display:none; }
.cturn.is-in{ animation:chatIn .42s var(--ease-out,ease) both; }
@keyframes chatIn{ from{ opacity:0; transform:translateY(16px) scale(.985); } to{ opacity:1; transform:none; } }
/* typing indicator — borrows the upcoming speaker's avatar + bubble side */
.cturn--typing .cbubble{ padding:17px 22px; min-width:72px; animation:chatIn .25s var(--ease-out,ease) both; }
.ctyping{ display:inline-flex; align-items:center; gap:5px; height:12px; }
.ctyping i{ width:7px; height:7px; border-radius:50%; background:var(--ink-400); animation:ctype 1s ease-in-out infinite; }
.cturn--me .ctyping i{ background:rgba(255,255,255,.85); }
.ctyping i:nth-child(2){ animation-delay:.14s; } .ctyping i:nth-child(3){ animation-delay:.28s; }
@keyframes ctype{ 0%,100%{ transform:translateY(0); opacity:.35; } 50%{ transform:translateY(-4px); opacity:.95; } }
/* the continue prompt — one glowing, gently breathing pill under the latest line */
.chat-flow{ display:flex; flex-direction:column; align-items:center; }
.chat-next{ display:inline-flex; align-items:center; gap:9px; margin-top:2px; padding:12px 24px; border:0; border-radius:999px;
  cursor:pointer; color:#fff; font-family:inherit; font-weight:800; font-size:var(--fs-sm); letter-spacing:.01em;
  background:linear-gradient(135deg, color-mix(in srgb,var(--cv,var(--blue-500)) 82%,var(--mix-base)), var(--cv,var(--blue-500)));
  box-shadow:0 10px 26px -8px var(--cv,var(--blue-500)), var(--hi-top);
  animation:chatNextIn .3s var(--ease-out,ease) both, chatBreath 2.6s ease-in-out .9s infinite; }
.chat-next:hover{ filter:brightness(1.05); }
.chat-next:active{ transform:scale(.97); }
.chat-next .ico{ width:16px; height:16px; }
.chat-next__hint{ font-size:10px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:rgba(255,255,255,.72);
  border:1px solid rgba(255,255,255,.4); border-radius:6px; padding:2px 7px; margin-left:2px; display:none; }
@media (min-width:1024px) and (pointer:fine){ .chat-next__hint{ display:inline-block; } }
@keyframes chatNextIn{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:none; } }
@keyframes chatBreath{ 0%,100%{ box-shadow:0 10px 26px -8px var(--cv,var(--blue-500)), var(--hi-top); }
  50%{ box-shadow:0 12px 34px -6px var(--cv,var(--blue-500)), 0 0 24px -4px color-mix(in srgb,var(--cv,var(--blue-500)) 55%,transparent), var(--hi-top); } }
/* end-of-conversation row */
.chat-done{ display:flex; gap:var(--s3); flex-wrap:wrap; justify-content:center; animation:chatNextIn .3s var(--ease-out,ease) both; }
@media (prefers-reduced-motion:reduce){
  .cturn.is-in, .cturn--typing .cbubble, .chat-next, .chat-done{ animation:none; }
  .ctyping i{ animation:none; opacity:.7; }
}

/* ============================================================
   New experiences: Start path · Practice · Speaking · Read · Progress
   ============================================================ */

/* ---- shared studio hero ---- */
.studio-hero{ display:flex; align-items:center; gap:var(--s5); padding:var(--s5) var(--s6); border-radius:var(--r-xl);
  color:#fff; box-shadow:var(--shadow-md); overflow:hidden; }
.studio-hero__txt{ flex:1; min-width:0; }
.studio-hero h1{ color:#fff; margin:0 0 .2em; }
.studio-hero p{ color:rgba(255,255,255,.92); max-width:56ch; font-size:var(--fs-lg); margin:0; }
.studio-hero__art{ flex:none; width:96px; height:96px; display:flex; align-items:center; justify-content:center;
  font-size:52px; color:#fff; background:rgba(255,255,255,.14); border-radius:var(--r-xl); }
.studio-hero__art .ico{ width:1em; height:1em; stroke-width:1.5; }
.studio-hero__art .wave{ height:54px; color:#fff; }
.studio-hero__art .wave i{ width:6px; }
@media (max-width:680px){ .studio-hero__art{ display:none; } .studio-hero{ padding:var(--s6) var(--s5); } }

/* ---- vertical "path" (Start + Read track) ---- */
.path{ display:flex; flex-direction:column; gap:0; }
.pathstep{ display:flex; gap:var(--s4); padding:var(--s4) 0; position:relative; color:var(--ink-900); }
.pathstep__n{ flex:none; width:36px; height:36px; border-radius:50%; background:var(--blue-500); color:#fff;
  font-family:var(--font-display); font-weight:700; display:flex; align-items:center; justify-content:center; z-index:2; }
.pathstep__line{ position:absolute; left:18px; top:36px; bottom:-4px; width:2px; background:var(--line); z-index:1; }
.pathstep:last-child .pathstep__line{ display:none; }
.pathstep__body{ flex:1; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg);
  padding:var(--s4) var(--s5); box-shadow:var(--shadow-sm); transition:transform .12s, box-shadow .15s, border-color .15s; }
.pathstep:hover .pathstep__body{ transform:translateX(2px); border-color:var(--blue-200); box-shadow:var(--shadow-md); }
.pathstep__top{ display:flex; align-items:center; gap:var(--s2); }
.pathstep__ic{ color:var(--blue-500); display:flex; }
.pathstep__title{ font-family:var(--font-display); font-weight:700; font-size:var(--fs-lg); }
.pathstep__mins{ margin-left:auto; font-size:var(--fs-xs); font-weight:700; color:var(--ink-400);
  background:var(--surface-2); border:1px solid var(--line); padding:2px 9px; border-radius:var(--r-pill); }
.pathstep__desc{ display:block; color:var(--ink-500); font-size:var(--fs-sm); margin:6px 0 8px; }
.pathstep__cta{ display:inline-flex; align-items:center; gap:6px; color:var(--blue-600); font-weight:700; font-size:var(--fs-sm); }
.pathstep__cta .ico{ width:1em; height:1em; }
/* done + next states */
.pathstep.is-done .pathstep__n{ background:var(--green-500); }
.pathstep.is-done .pathstep__body{ border-color:var(--green-300); }
.pathstep.is-done .pathstep__cta{ color:var(--ink-500); }
.pathstep.is-next .pathstep__body{ border-color:var(--blue-400); box-shadow:0 0 0 3px var(--blue-100), var(--shadow-sm); }
.pathstep__here{ font-size:10px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; color:#fff;
  background:var(--blue-500); padding:2px 9px; border-radius:var(--r-pill); }

/* floating "back to your path" button */
.path-fab{ position:fixed; right:max(var(--s5), var(--safe-r)); bottom:max(var(--s5), var(--safe-b)); z-index:70; display:inline-flex; align-items:center; gap:8px;
  padding:11px 18px; border-radius:var(--r-pill); background:var(--blue-600); color:#fff; font-weight:700; font-size:var(--fs-sm);
  box-shadow:var(--shadow-lg); animation:fadeIn .25s ease both; }
.path-fab:hover{ background:var(--blue-700); color:#fff; }
.path-fab .ic{ display:flex; }
/* when the trial buy-pill is present (bottom-right), lift the path FAB above it so they don't overlap */
body.hts-has-buypill .path-fab{ bottom:calc(76px + var(--safe-b)); }
@media (max-width:560px){ .path-fab{ right:max(var(--s4), var(--safe-r)); bottom:max(var(--s4), var(--safe-b)); }
  body.hts-has-buypill .path-fab{ bottom:calc(72px + var(--safe-b)); } }

/* ---- "wander freely" callout ---- */
.freebird{ display:flex; gap:var(--s4); align-items:flex-start; background:var(--blue-50);
  border:1px solid var(--blue-100); border-radius:var(--r-lg); padding:var(--s5); }
.freebird__ic{ flex:none; width:46px; height:46px; border-radius:var(--r-md); background:var(--surface); color:var(--blue-600);
  display:flex; align-items:center; justify-content:center; font-size:22px; }
.freebird h3{ margin:0 0 .2em; }

/* ---- practice hub ---- */
.pmode-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:var(--s4); }
.pmode{ display:flex; gap:var(--s4); align-items:flex-start; padding:var(--s4); background:var(--surf-raised);
  border:1px solid var(--line); border-radius:var(--r-lg); box-shadow:var(--shadow-sm), var(--hi-top);
  transition:transform .12s, box-shadow .15s, border-color .15s; color:var(--ink-900); }
.pmode:hover{ transform:translateY(-2px); box-shadow:var(--glow-cv), var(--hi-top); border-color:color-mix(in srgb,var(--cv) 32%,var(--line)); }
.pmode:focus-visible{ outline:none; box-shadow:var(--ring-cv), var(--hi-top); border-color:var(--cv); }
.pmode__ic{ flex:none; width:48px; height:48px; border-radius:var(--r-md); display:flex; align-items:center; justify-content:center;
  color:#fff; font-size:24px;
  background:linear-gradient(150deg, color-mix(in srgb,var(--cv) 78%,var(--mix-base)), var(--cv)); box-shadow:0 10px 22px -8px var(--cv), var(--hi-top); }
.pmode__ic .ico{ width:1em; height:1em; }
.pmode__title{ display:flex; align-items:center; gap:8px; font-family:var(--font-display); font-weight:700; font-size:var(--fs-lg); }
.pmode__desc{ display:block; color:var(--ink-500); font-size:var(--fs-sm); margin-top:3px; }
.pmode__live{ font-size:10px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; color:#fff;
  background:var(--green-500); padding:2px 8px; border-radius:var(--r-pill); }

/* ---- exercise / stage shells ---- */
.exhead{ display:flex; align-items:center; gap:var(--s4); margin-bottom:var(--s5); }
.exhead__ic{ flex:none; width:54px; height:54px; border-radius:var(--r-md); background:var(--cv); color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:26px; }
.exhead__ic .ico{ width:1em; height:1em; }
.exhead h1,.exhead h2{ margin:0; }
.exhead .soon{ margin-left:auto; align-self:flex-start; }
.exstage{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-xl); padding:var(--s6); box-shadow:var(--shadow-sm); }
.exprog{ height:6px; background:var(--surface-3); border-radius:99px; overflow:hidden; margin-bottom:var(--s5); }
.exprog i{ display:block; height:100%; background:var(--blue-500); }
.exq{ text-align:center; margin-bottom:var(--s5); }
.exq__prompt{ color:var(--ink-500); font-size:var(--fs-sm); font-weight:600; }
.exq__thai{ font-size:var(--fs-4xl); font-weight:700; margin:var(--s2) 0; }
.exopts{ display:grid; grid-template-columns:1fr 1fr; gap:var(--s3); max-width:560px; margin:0 auto; }
.exopt{ padding:var(--s4); border:1px solid var(--line-strong); border-radius:var(--r-md); background:var(--surface);
  font-size:var(--fs-md); color:var(--ink-700); text-align:center; }
.exopt.is-key{ border-color:var(--green-500); }
.exopt:disabled{ opacity:.7; cursor:not-allowed; }
@media (max-width:560px){ .exopts{ grid-template-columns:1fr; } }

/* ---- tabs ---- */
.tabs{ display:flex; gap:var(--s2); border-bottom:1px solid var(--line); margin-bottom:var(--s5); flex-wrap:wrap; }
.tab{ display:inline-flex; align-items:center; gap:8px; padding:10px var(--s4); color:var(--ink-500); font-weight:600;
  border-bottom:2px solid transparent; margin-bottom:-1px; }
.tab:hover{ color:var(--ink-900); }
.tab.is-active{ color:var(--blue-700); border-bottom-color:var(--blue-500); }
.tab .ic{ font-size:15px; }

/* ---- speaking studio ---- */
.studio__card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-xl); padding:var(--s7) var(--s6);
  box-shadow:var(--shadow-sm); text-align:center; }
.studio__step{ font-size:var(--fs-sm); font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--ink-400); }
.studio__thai{ font-size:var(--fs-4xl); font-weight:700; margin:var(--s2) 0 4px; }
.studio__en{ font-size:var(--fs-lg); }
.studio__waves{ display:flex; justify-content:center; margin:var(--s5) 0; }
.studio__waves .wave{ height:48px; color:var(--blue-400); gap:5px; }
.studio__waves .wave i{ width:5px; }
.studio__controls{ display:flex; gap:var(--s3); justify-content:center; flex-wrap:wrap; }
.studio__hint{ font-size:var(--fs-sm); margin-top:var(--s4); }
.studio__nav{ display:flex; align-items:center; justify-content:center; gap:var(--s4); margin-top:var(--s5); }
.btn--rec{ background:var(--rose-500) !important; border-color:var(--rose-500) !important; color:#fff !important;
  animation:recPulse 1.1s ease-in-out infinite; }
@keyframes recPulse{ 0%,100%{ box-shadow:0 0 0 0 rgba(204,85,103,.5); } 50%{ box-shadow:0 0 0 8px rgba(204,85,103,0); } }
.paircompare{ display:flex; align-items:center; gap:var(--s5); justify-content:center; margin:var(--s5) 0; flex-wrap:wrap; }
.paircol{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); padding:var(--s5) var(--s6); text-align:center; box-shadow:var(--shadow-sm); }
.pairvs{ font-weight:800; color:var(--ink-400); }

/* ---- read: letter board + syllable builder ---- */
.letter-board{ display:grid; grid-template-columns:repeat(auto-fill,minmax(110px,1fr)); gap:var(--s3); }
.letter{ position:relative; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); padding:26px var(--s2) var(--s4);
  text-align:center; box-shadow:var(--shadow-sm); transition:transform .1s, border-color .15s, box-shadow .15s; }
.letter:hover{ transform:translateY(-2px); border-color:var(--violet-500); box-shadow:var(--shadow-md); }
.letter__cls{ position:absolute; top:7px; left:50%; transform:translateX(-50%); font-size:9px; font-weight:800;
  text-transform:uppercase; letter-spacing:.04em; color:#fff; background:var(--cc,var(--ink-400)); padding:2px 8px; border-radius:99px; white-space:nowrap; }
.letter__char{ display:block; font-size:var(--fs-3xl); font-weight:700; line-height:1; color:var(--ink-900); }
.letter__name{ display:block; font-size:var(--fs-xs); color:var(--ink-500); margin-top:6px; }
.letter__sound{ display:block; font-size:var(--fs-xs); color:var(--violet-500); font-weight:700; }
.sylbuild{ display:flex; align-items:center; gap:var(--s4); justify-content:center; flex-wrap:wrap; }
.sylslot{ width:120px; height:120px; border:2px dashed var(--line-strong); border-radius:var(--r-lg); display:flex;
  flex-direction:column; align-items:center; justify-content:center; gap:6px; background:var(--surface); }
.sylslot .thai{ font-size:var(--fs-3xl); font-weight:700; }
.sylslot--res{ border-style:solid; border-color:var(--green-500); background:var(--green-100); }
.sylplus{ font-size:var(--fs-2xl); color:var(--ink-400); display:flex; }

/* ---- progress dashboard ---- */
.coverage{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); padding:var(--s5); box-shadow:var(--shadow-sm); }
.cov-row{ display:flex; align-items:center; gap:var(--s4); padding:var(--s3) 0; }
.cov-row + .cov-row{ border-top:1px solid var(--line); }
.cov-ic{ flex:none; width:38px; height:38px; border-radius:var(--r-sm); background:var(--cv); color:#fff; display:flex; align-items:center; justify-content:center; }
.cov-ic .ico{ width:19px; height:19px; }
.cov-top{ display:flex; justify-content:space-between; font-weight:600; font-size:var(--fs-sm); margin-bottom:6px; }
.prog-ic{ flex:none; width:44px; height:44px; border-radius:var(--r-md); color:#fff; display:flex; align-items:center; justify-content:center; font-size:22px;
  background:linear-gradient(150deg, color-mix(in srgb,var(--cv) 78%,var(--mix-base)), var(--cv)); box-shadow:0 10px 22px -8px var(--cv), var(--hi-top); }
.prog-ic .ico{ width:1em; height:1em; }
.bignum{ font-family:var(--font-display); font-weight:700; font-size:var(--fs-4xl); line-height:1; margin:var(--s4) 0; color:var(--ink-900); }
.daygrid{ display:flex; gap:6px; flex-wrap:wrap; }
.daycell{ width:22px; height:22px; border-radius:6px; background:var(--surface-3); border:1px solid var(--line); }
.daycell.on{ background:var(--green-500); border-color:var(--green-600); }
.srs-soon{ display:flex; gap:var(--s4); align-items:flex-start; background:linear-gradient(135deg,var(--blue-50),#f4f0ff);
  border:1px solid var(--blue-100); border-radius:var(--r-lg); padding:var(--s5); }
.srs-soon__ic{ flex:none; width:46px; height:46px; border-radius:var(--r-md); background:var(--surface); color:var(--violet-500);
  display:flex; align-items:center; justify-content:center; font-size:22px; }
.srs-soon h3{ margin:0 0 .2em; }
/* dark: the gradient ended in a literal #f4f0ff (pale) → dark→white wash with unreadable text; keep both ends dark */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .srs-soon{ background:linear-gradient(135deg,var(--blue-50),color-mix(in srgb,var(--violet-500) 15%,var(--surface))); }
}
:root[data-theme="dark"] .srs-soon{ background:linear-gradient(135deg,var(--blue-50),color-mix(in srgb,var(--violet-500) 15%,var(--surface))); }

/* ============================================================
   Practice quizzes (mode picker + runner)
   ============================================================ */
/* COMPACT pool-picker: a short horizontal card (icon · text · arrow) instead of a tall
   stacked block — the old cards ballooned the "Pick your set / Where the words come from"
   setup screens. Grid auto-flow: icon spans the left, arrow the right, every text child
   flows down the middle column, so the card is robust to any subset of title/sub/count/lock. */
.qmode-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(238px,1fr)); gap:var(--s3); }
.qmode{ position:relative; display:grid; grid-template-columns:auto 1fr auto; align-items:center; column-gap:13px;
  padding:11px 14px;
  background:var(--surf-raised); border:1px solid var(--line); border-radius:var(--r-md); box-shadow:var(--shadow-sm), var(--hi-top);
  color:var(--ink-900); transition:transform .12s, box-shadow .15s, border-color .15s; }
.qmode > *{ grid-column:2; min-width:0; }
.qmode:hover{ transform:translateY(-2px); box-shadow:var(--glow-cv), var(--hi-top); border-color:color-mix(in srgb,var(--cv) 32%,var(--line)); }
.qmode:focus-visible{ outline:none; box-shadow:var(--ring-cv), var(--hi-top); border-color:var(--cv); }
.qmode__ic{ grid-column:1; grid-row:1 / -1; align-self:center; width:40px; height:40px; border-radius:var(--r-md); color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:20px; margin:0;
  background:linear-gradient(150deg, color-mix(in srgb,var(--cv) 78%,var(--mix-base)), var(--cv)); box-shadow:0 8px 18px -8px var(--cv), var(--hi-top); }
.qmode__ic .ico{ width:1em; height:1em; }
.qmode__t{ font-family:var(--font-display); font-weight:700; font-size:var(--fs-md); line-height:1.2; }
.qmode__s{ font-size:var(--fs-xs); color:var(--ink-500); line-height:1.3; }
.qmode__n{ font-size:var(--fs-xs); font-weight:800; color:var(--ink-700); margin-top:1px; }
.qmode.is-disabled{ opacity:.6; }
.qmode__lock{ font-size:var(--fs-xs); color:var(--ink-400); margin-top:1px; }

.quiz{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-xl); box-shadow:var(--shadow-sm); overflow:hidden; }
.quiz__bar{ display:flex; align-items:center; justify-content:space-between; gap:var(--s3); padding:var(--s4) var(--s5); border-bottom:1px solid var(--line); background:var(--surface-2); }
.quiz__id{ display:flex; align-items:center; gap:10px; font-size:var(--fs-md); }
.quiz__ic{ width:34px; height:34px; border-radius:var(--r-sm); background:var(--cv); color:#fff; display:flex; align-items:center; justify-content:center; }
.quiz__ic .ico{ width:18px; height:18px; }
.quiz__mode{ font-size:var(--fs-xs); font-weight:800; text-transform:uppercase; letter-spacing:.05em; color:#fff; background:var(--ink-700); padding:2px 9px; border-radius:var(--r-pill); }
.quiz__score{ display:flex; gap:var(--s4); font-size:var(--fs-sm); color:var(--ink-500); font-weight:700; }
.quiz__score .ico{ width:1em; height:1em; }
.quiz__streak .ico{ color:var(--amber-500); }
.quiz__stage{ padding:var(--s6) var(--s5); min-height:360px; display:flex; flex-direction:column; align-items:center; justify-content:flex-start; }

.qz-prompt{ text-align:center; margin-bottom:var(--s5); }
.qz-thai{ font-size:var(--fs-4xl); font-weight:700; line-height:1.4; }
.qz-q{ color:var(--ink-500); font-weight:600; margin-top:var(--s3); }
.qz-play{ margin-top:var(--s3); width:46px; height:46px; border-radius:50%; border:1px solid var(--blue-100); background:var(--blue-50); color:var(--blue-600); display:inline-flex; align-items:center; justify-content:center; }
.qz-play .ico{ width:18px; height:18px; }
.qz-play:hover{ background:var(--blue-100); }
.qz-bigplay{ display:inline-flex; align-items:center; gap:10px; padding:16px 30px; border-radius:var(--r-pill); border:0; background:var(--blue-500); color:#fff; font-size:var(--fs-lg); font-weight:700; box-shadow:var(--shadow-sm); }
.qz-bigplay .ico{ width:20px; height:20px; }
.qz-bigplay:hover{ background:var(--blue-600); }
.qz-prompt--listen .qz-q{ margin-top:var(--s4); }

.qz-opts{ display:grid; grid-template-columns:1fr 1fr; gap:var(--s3); width:100%; max-width:600px; }
.qz-opts--thai .qz-opt{ font-size:var(--fs-xl); }
.qz-opt{ padding:var(--s4); border:1px solid var(--line-strong); border-radius:var(--r-md); background:var(--surface); color:var(--ink-900);
  font-size:var(--fs-md); text-align:center; transition:.12s; cursor:pointer; }
.qz-opt:hover:not(:disabled){ border-color:var(--blue-400); background:var(--blue-50); }
.qz-opt:disabled{ cursor:default; }
.qz-opt.is-correct{ border-color:var(--green-500); background:var(--green-100); color:var(--green-600); font-weight:700; }
.qz-opt.is-wrong{ border-color:var(--rose-500); background:#fff1f3; color:var(--rose-500); }
@media (max-width:560px){ .qz-opts{ grid-template-columns:1fr; } }

.qz-typewrap{ display:flex; gap:var(--s2); justify-content:center; margin-top:var(--s4); }
.qz-input{ height:46px; padding:0 var(--s4); border:1px solid var(--line-strong); border-radius:var(--r-md); font-size:var(--fs-md); min-width:240px; }
.qz-input:focus{ border-color:var(--blue-400); box-shadow:none; outline:none; }

/* fixed-height feedback zone: revealing an answer never grows/shifts the layout */
.qz-fb{ height:3em; overflow:hidden; margin:var(--s4) 0 var(--s3); font-weight:700; text-align:center; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; }
.qz-fb.ok{ color:var(--green-600); } .qz-fb.no{ color:var(--rose-500); }
.qz-full{ font-weight:500; font-size:var(--fs-sm); max-width:520px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.qz-next{ visibility:hidden; }
.qz-next.is-shown{ visibility:visible; }
/* --- practice/review/playlists polish --- */
.qz-x{ color:var(--rose-500); font-weight:800; margin-right:.3em; }
.qz-opt.is-correct{ animation:qzPop .3s ease; }
@keyframes qzPop{ 0%{ transform:scale(1);} 45%{ transform:scale(1.045);} 100%{ transform:scale(1);} }
.qz-opt:active:not(:disabled){ transform:scale(.99); }
.pmode__body{ display:flex; flex-direction:column; flex:1; min-width:0; }
.pmode__go{ display:inline-flex; align-self:flex-start; align-items:center; gap:5px; margin-top:9px; font-weight:700; font-size:var(--fs-sm); color:var(--blue-600); transition:gap .15s ease; }
.pmode__go .ico{ width:15px; height:15px; }
.pmode:hover .pmode__go{ gap:9px; }
.studio-hero__tags{ margin-top:var(--s3); display:flex; gap:6px; flex-wrap:wrap; }
.plist{ transition:transform .15s ease, box-shadow .15s ease; }
.plist:hover{ transform:translateY(-2px); box-shadow:var(--shadow-md); }

/* ===== redesigned quiz engine (q2) ===== */
.q2{ max-width:680px; margin:0 auto; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-xl); box-shadow:0 12px 32px rgba(13,27,42,.09); overflow:hidden; }
.q2__head{ display:flex; align-items:center; justify-content:space-between; gap:var(--s3); padding:var(--s4) var(--s5); }
.q2__id{ display:flex; align-items:center; gap:12px; min-width:0; }
.q2__ic{ width:42px; height:42px; flex:0 0 auto; border-radius:12px; background:var(--cv); color:#fff; display:flex; align-items:center; justify-content:center; }
.q2__ic .ico{ width:22px; height:22px; }
.q2__titles{ display:flex; flex-direction:column; min-width:0; }
.q2__title{ font-family:var(--font-display); font-weight:800; font-size:var(--fs-lg); line-height:1.1; }
.q2__mode{ font-size:var(--fs-xs); font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-400); }
.q2__stats{ display:flex; gap:8px; flex:0 0 auto; }
.q2__stat{ display:inline-flex; align-items:center; gap:5px; font-weight:800; font-size:var(--fs-sm); color:var(--ink-700);
  background:var(--surface-2); border:1px solid var(--line); padding:5px 11px; border-radius:99px; }
.q2__stat i{ color:var(--ink-400); font-style:normal; }
.q2__stat .ico{ width:15px; height:15px; }
.q2__streak .ico{ color:var(--amber-500); }
.q2__progress{ height:6px; background:var(--surface-3); }
.q2__progress i{ display:block; height:100%; width:0; background:var(--cv); border-radius:0 99px 99px 0; transition:width .35s cubic-bezier(.4,0,.2,1); }
.q2__stage{ padding:var(--s6) var(--s5) var(--s7); min-height:380px; display:flex; flex-direction:column; align-items:center; justify-content:flex-start; }

/* lettered options */
.qz-opt{ display:flex; align-items:center; gap:12px; text-align:left; }
.qz-opt__k{ flex:0 0 auto; width:27px; height:27px; border-radius:8px; background:var(--surface-3); color:var(--ink-500);
  font-weight:800; font-size:var(--fs-sm); display:flex; align-items:center; justify-content:center; }
.qz-opt__v{ flex:1; min-width:0; }
.qz-opt.is-correct .qz-opt__k{ background:var(--green-500); color:#fff; }
.qz-opt.is-wrong .qz-opt__k{ background:var(--rose-500); color:#fff; }
.qz-opt--pair{ justify-content:center; text-align:center; padding:var(--s5) var(--s4); }
.qz-opt--pair .qz-opt__v{ flex:0 1 auto; }

/* results card — §4.5 the payoff moment. The ring FILLS on mount (0→--pct over ~0.6s via
   the animated @property --qp), the % counts up (wired in qx.js), high tiers glow, and the
   top tier fires a one-shot sparkle. Accent-tint framing borrows Daily's celebratory energy. */
@property --qp{ syntax:"<number>"; inherits:false; initial-value:0; }
.q2-res{ text-align:center; padding:var(--s5) var(--s4) var(--s4); animation:fadeIn .3s ease both;
  border-radius:var(--r-xl); background:var(--surf-accent-tint); }
.q2-res__ring{ position:relative; width:130px; height:130px; margin:0 auto var(--s4); border-radius:50%;
  --qp:var(--pct);
  background:conic-gradient(var(--cv) calc(var(--qp) * 3.6deg), var(--surface-3) 0); display:flex; align-items:center; justify-content:center;
  animation:qxRingFill .6s cubic-bezier(.3,.9,.3,1) both; }
@keyframes qxRingFill{ from{ --qp:0; } to{ --qp:var(--pct); } }
.q2-res__ring::after{ content:""; position:absolute; inset:11px; background:var(--surface); border-radius:50%; box-shadow:var(--inset-well); }
.q2-res__ic{ position:relative; z-index:1; color:var(--cv); }
.q2-res__ic .ico{ width:48px; height:48px; }
.q2-res__pct{ font-family:var(--font-display); font-weight:800; font-size:var(--fs-3xl); line-height:1; letter-spacing:-.02em; }
.q2-res__t{ font-family:var(--font-display); font-weight:800; font-size:var(--fs-lg); margin-top:6px; }
.q2-res__sub{ color:var(--ink-500); font-size:var(--fs-sm); margin-top:4px; }
.q2-res__actions{ display:flex; gap:var(--s3); justify-content:center; flex-wrap:wrap; margin-top:var(--s5); }
/* tier-scaled celebration: qx.js adds .is-win (≥70%) and .is-top (≥90%) on the .q2-res. */
.q2-res.is-win .q2-res__ring{ filter:drop-shadow(0 6px 22px color-mix(in srgb,var(--cv) 55%,transparent)); }
.q2-res.is-top .q2-res__ring{ filter:drop-shadow(0 8px 30px color-mix(in srgb,var(--cv) 72%,transparent)); }
/* top-tier luminous gradient hairline around the ring (the .formula-cta::before mask move) */
.q2-res.is-top .q2-res__ring::before{ content:""; position:absolute; inset:-4px; border-radius:50%; padding:2px; pointer-events:none;
  background:linear-gradient(120deg,#6d5cf0,#1f70df,#16b36b,#cf9233);
  -webkit-mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite:xor;
  mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite:exclude; opacity:.85; }
/* one-shot sparkle burst at the top tier — a few CSS dots that fly out and fade once. */
.q2-res__spark{ position:absolute; left:50%; top:50%; width:7px; height:7px; margin:-3.5px; border-radius:50%;
  background:radial-gradient(circle,#fff,color-mix(in srgb,var(--cv) 70%,#fff)); pointer-events:none; opacity:0;
  animation:qxSpark .9s ease-out both; }
.q2-res__spark:nth-child(1){ --sx:-56px; --sy:-30px; animation-delay:.05s; }
.q2-res__spark:nth-child(2){ --sx:52px; --sy:-38px; animation-delay:.12s; }
.q2-res__spark:nth-child(3){ --sx:-40px; --sy:36px; animation-delay:.1s; }
.q2-res__spark:nth-child(4){ --sx:46px; --sy:30px; animation-delay:.17s; }
.q2-res__spark:nth-child(5){ --sx:0px; --sy:-60px; animation-delay:.02s; }
.q2-res__spark:nth-child(6){ --sx:64px; --sy:2px; animation-delay:.22s; }
@keyframes qxSpark{ 0%{ transform:translate(0,0) scale(.2); opacity:0; } 25%{ opacity:1; } 100%{ transform:translate(var(--sx),var(--sy)) scale(1); opacity:0; } }

/* mode-picker arrow — now the grid's right column, always subtly present */
.qmode__go{ grid-column:3; grid-row:1 / -1; align-self:center; color:var(--ink-400); opacity:.45; transition:opacity .15s ease, transform .15s ease; }
.qmode__go .ico{ width:18px; height:18px; }
.qmode:hover .qmode__go{ opacity:1; transform:translateX(2px); }

/* review flashcard polish */
.rv-card{ border-top:3px solid var(--blue-500); }
.rv-en{ animation:rvReveal .28s ease both; }
@keyframes rvReveal{ from{ opacity:0; transform:translateY(7px);} to{ opacity:1; transform:none;} }
.rv-done .ico{ width:46px; height:46px; color:var(--amber-500); }

/* playlist polish */
.plist__cover{ box-shadow:inset 0 0 0 1px rgba(255,255,255,.18); }
.pl-step__go{ transition:transform .15s ease, color .15s ease; }
.pl-step:hover .pl-step__go{ transform:translateX(3px); color:var(--blue-500); }

/* ===================== app-grade quiz surface (qx) ===================== */
/* §4.1 ACCENT AURA: a faint top-anchored --cv radial as the card background + an inset
   top-highlight + a whisper of colored shadow, so every game feels owned by its lane the
   instant it opens. Layout untouched. */
.qx{ --pad:28px; position:relative; max-width:760px; margin:0 auto;
  background:radial-gradient(120% 62% at 50% 0%, color-mix(in srgb,var(--cv) 8%,var(--mix-base)), var(--mix-base) 60%);
  border:1px solid var(--line);
  border-radius:28px;
  box-shadow:0 24px 60px -20px color-mix(in srgb,var(--cv) 22%, rgba(13,27,42,.28)), 0 2px 8px rgba(13,27,42,.06), var(--hi-top);
  overflow:hidden; min-height:0; flex:1 1 auto; display:flex; flex-direction:column; }

/* ── WIDTH RULE (owner-directed 2026-07-04): the game shell uses ~80% of the available
   width in LANDSCAPE (≤10% gutter each side) and the FULL width in PORTRAIT. This replaces
   the fixed 760px cap that wasted the sides on wide screens and cramped content — which also
   forced feedback panels to grow tall and overlap the answers. Applies to every qx game. */
.content:has(.qx-page) > .container{ max-width:none !important; width:100% !important; }
.qx{ width:100% !important; }
@media (orientation:portrait){ .qx{ max-width:100% !important; } }
@media (orientation:landscape){ .qx{ max-width:80% !important; } }
/* PC / laptop (mouse-driven, pointer:fine): 80% is too wide — use 60%. iPad/phone landscape
   (touch, pointer:coarse) keeps 80%. */
@media (orientation:landscape) and (pointer:fine){ .qx{ max-width:60% !important; } }
/* small phones: trim the shell padding so content isn't crushed by heavy gutters (#1b). */
@media (max-width:560px){
  .qx{ --pad:14px; }
  .qx__opt{ min-height:52px; padding:12px 14px; }
  .qx__foot{ min-height:76px; padding:12px var(--pad); gap:12px; }
}

/* ===================== GAMES = ONE SCREEN, NO SCROLL =====================
   The round (.qx-page) fills the viewport minus the topbar and never scrolls: header
   and footer are fixed-size, the stage flexes, and its content scales to fit (qx.fit()
   in qx.js) so every game is a genuine single-screen experience in any orientation.
   Scoped with :has so only game ROUNDS lock — setup/menu screens still scroll normally. */
.content:has(.qx-page){ height:calc(100svh - var(--topbar-h)); overflow:hidden; padding:var(--s3) var(--s4); }
.content:has(.qx-page) > .container{ height:100%; min-height:0; display:flex; flex-direction:column; }
/* .qx-page fills the fixed game zone and TOP-ANCHORS the card directly under the topbar. The card
   (.qx) fills that zone (flex:1 1 auto), so it reaches from the topbar to the bottom of the zone —
   no small floating card, no outer whitespace band. The stage centers inside the arena and qx.fit()
   scales it to fit; the answer dialog docks at the arena bottom with real room (no overlap/stranding).
   The zone itself never scrolls (locked shell, layout.css), so nothing runs off-screen. */
.qx-page{ flex:1 1 auto; min-height:0; display:flex; flex-direction:column; justify-content:flex-start; }
.qx-page > .qx{ min-height:0; }
/* CONTAINER IS GOD (rev) — the ARENA is the fixed box between the top bar and the card edge.
   It centers the .qx__fit block (STAGE ONLY), which qx.fit() transform-scales until the stage
   fits on BOTH axes. The feedback foot is an absolute overlay pinned to the arena bottom (below),
   so it is NOT measured/scaled with the stage: showing the dialog never shifts or rescales the
   stage. position:relative anchors that overlay. */
.qx__arena{ position:relative; flex:1 1 auto; min-height:0; overflow:hidden; display:flex; flex-direction:column;
  justify-content:center; align-items:center; padding:var(--s3) var(--pad) var(--s4); }
/* the fit block = the STAGE as a natural-height unit that gets scaled to fit the arena. */
/* cap the inner content width so a wide (60% of a 1920) card doesn't stretch 2-col tiles into
   ultra-wide slabs — the card keeps its owner-set width, only the content column is centered+capped. */
.qx__fit{ width:100%; max-width:760px; margin-inline:auto; display:flex; flex-direction:column; align-items:stretch;
  gap:clamp(10px, 2vh, var(--s4)); transform-origin:center center; }

.qx__top{ display:flex; align-items:center; gap:16px; padding:clamp(10px,1.6vh,18px) var(--pad); }
.qx__quit{ flex:0 0 auto; width:38px; height:38px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  color:var(--ink-500); background:var(--surface-2); border:1px solid var(--line); }
.qx__quit:hover{ color:var(--ink-900); background:var(--surface-3); }
.qx__quit .ico{ width:18px; height:18px; }
.qx__bar{ flex:1; height:14px; border-radius:99px; background:var(--surface-3); overflow:hidden; box-shadow:var(--inset-well); }
.qx__bar i{ display:block; height:100%; width:0; border-radius:99px; transition:width .4s cubic-bezier(.4,0,.2,1);
  background:linear-gradient(90deg, color-mix(in srgb,var(--cv) 65%,var(--mix-base)), var(--cv)); }
.qx__streak{ flex:0 0 auto; display:inline-flex; align-items:center; gap:5px; font-weight:800; font-size:var(--fs-sm);
  color:var(--ink-700); background:var(--surface-2); border:1px solid var(--line); padding:6px 12px; border-radius:99px;
  transition:background .25s ease, border-color .25s ease, box-shadow .25s ease, color .25s ease; }
.qx__streak .ico{ width:15px; height:15px; color:var(--amber-500); }
/* §4.1/§6.1 STREAK ESCALATION — promoted to the shell so EVERY game escalates, not just
   Rapid Fire. `is-hot` (toggled in qx.js when the streak is running) tints the pill in --cv
   with a soft accent glow; the flame stamps on each +1 via the promoted dailyFlame keyframe. */
.qx__streak.is-hot{ color:color-mix(in srgb,var(--cv) 62%,var(--ink-900));
  background:color-mix(in srgb,var(--cv) 12%,var(--mix-base)); border-color:color-mix(in srgb,var(--cv) 40%,var(--line));
  box-shadow:0 4px 16px -6px color-mix(in srgb,var(--cv) 55%,transparent); }
.qx__streak.is-hot .ico{ color:var(--amber-500); }
/* streak-flame roll-up stamp: dailyFlame promoted from _w4_daily.css to the shared shell. */
.qx__streak.is-roll .ico{ animation:dailyFlame .5s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes dailyFlame{ 0%{ transform:scale(.4) translateY(6px); opacity:0; } 60%{ transform:scale(1.25); } 100%{ transform:scale(1); opacity:1; } }

/* vertical rhythm is vh-responsive so contents GROW to fill a tall zone and COMPRESS on a
   small one (qx.fit() remains the shrink safety-net). One rule, all 22 games. */
.qx__stage{ display:flex; flex-direction:column; align-items:stretch; gap:clamp(12px, 2.4vh, 26px); }
.qx__stage > *{ animation:qxIn .28s cubic-bezier(.2,.7,.3,1) both; }
@keyframes qxIn{ from{ opacity:0; transform:translateY(10px);} to{ opacity:1; transform:none;} }

.qx__prompt{ text-align:center; display:flex; flex-direction:column; align-items:center; gap:clamp(14px, 2.6vh, 30px); }
.qx__prompt--listen{ gap:clamp(18px, 3.4vh, 40px); }
/* §4.2 hero Thai word gets a soft accent text-glow — presence without a box. */
/* the hero Thai is the point of the card — size it up ~20%. The container-is-god fit() scales
   the whole stage down if a cramped screen can't hold it, so bigger here is safe everywhere. */
.qx__word{ font-size:clamp(34px, min(8.4vw, 10vh), 76px); font-weight:700; line-height:1.15; letter-spacing:-.01em;
  text-shadow:0 2px 30px color-mix(in srgb,var(--cv) 30%, transparent); }
/* Decode's hero is a SINGLE syllable (≤3 chars) and the point of the card — size it much bigger
   than a generic word. It's always short so it won't overflow; fit() shrinks the stage if needed. */
.qx__word--syl{ font-size:clamp(64px, min(26vw, 24vh), 136px); line-height:1.05; }
.qx__q{ color:var(--ink-500); font-weight:600; font-size:var(--fs-md); max-width:100%; overflow-wrap:break-word; }
.qx__q--top{ text-align:center; text-wrap:balance; }
.qx__play{ width:56px; height:56px; border-radius:50%; border:0; cursor:pointer; display:inline-flex; align-items:center; justify-content:center;
  color:#fff; background:var(--cv); box-shadow:0 8px 20px -6px var(--cv), var(--hi-top); transition:transform .12s ease; }
.qx__play:hover{ transform:scale(1.06); } .qx__play:active{ transform:scale(.95); }
.qx__play:focus-visible{ outline:none; box-shadow:0 8px 20px -6px var(--cv), var(--ring-cv); }
.qx__play .ico{ width:22px; height:22px; }
/* §4.2 luminous halo behind the big play button — reads as a "source of sound". */
.qx__bigplay{ width:clamp(56px,13vh,112px); height:clamp(56px,13vh,112px); border-radius:50%; border:0; cursor:pointer; color:#fff; position:relative;
  background:radial-gradient(circle at 50% 38%, color-mix(in srgb,var(--mix-base) 26%,var(--cv)), var(--cv));
  display:inline-flex; align-items:center; justify-content:center;
  box-shadow:0 16px 36px -10px var(--cv), 0 0 44px -8px color-mix(in srgb,var(--cv) 60%,transparent), var(--hi-top); transition:transform .12s ease; }
.qx__bigplay:focus-visible{ outline:none; box-shadow:0 16px 36px -10px var(--cv), var(--ring-cv); }
.qx__bigplay::after{ content:""; position:absolute; inset:-8px; border-radius:50%; border:2px solid var(--cv); opacity:.4; animation:qxPulse 1.8s ease-out infinite; }
@keyframes qxPulse{ 0%{ transform:scale(1); opacity:.4;} 100%{ transform:scale(1.28); opacity:0;} }
.qx__bigplay:hover{ transform:scale(1.05); } .qx__bigplay .ico{ width:40px; height:40px; }
/* "Play slower" (0.6×): a small, NON-animated button anchored to the RIGHT of the big play. It is
   absolutely positioned off the wrapper, so the big play stays perfectly centered — adding this
   never shifts anything. ~33% the size of the big play. */
.qx__bigwrap{ position:relative; display:inline-flex; }
/* aligned to the BOTTOM of the big play, set well apart from it, 25% larger, with a "slow" (turtle)
   icon instead of a number. Absolute so the big play stays centered. */
.qx__slowplay{ position:absolute; left:100%; bottom:0; margin-left:clamp(16px,3vh,30px);
  width:clamp(35px,5.5vh,50px); height:clamp(35px,5.5vh,50px); border-radius:50%; border:0; cursor:pointer; padding:0;
  display:inline-flex; align-items:center; justify-content:center; line-height:1;
  background:var(--surface-3,#eef2f7); color:var(--ink-600,#4a5a6a);
  box-shadow:var(--shadow-xs), var(--hi-top); transition:background .12s ease, transform .12s ease; }
.qx__slowplay:hover{ background:var(--surface-2,#e6ecf2); }
.qx__slowplay:active{ transform:scale(.94); }
.qx__slowico{ font-size:clamp(18px,2.6vh,24px); line-height:1; }

.qx__opts{ display:grid; grid-template-columns:1fr 1fr; gap:clamp(10px, 1.8vh, 18px); }
@media (max-width:560px){ .qx__opts{ grid-template-columns:1fr; } }
/* §3.4/§4.3 tactile answer keys: raised top-lit gradient + top-highlight at rest; hover
   lifts to the accent glow; correct/wrong washes deepened (~16–18%) with matching colored
   glow; the correct tile snaps (tile-lock, promoted keyframe qxTileSnap). */
.qx__opt{ display:flex; align-items:center; gap:13px; text-align:left; padding:16px 18px; min-height:clamp(52px, 8.5vh, 84px);
  background:var(--surf-raised); border:2px solid var(--line-strong); border-radius:16px; cursor:pointer; font-size:var(--fs-md); color:var(--ink-900);
  box-shadow:var(--shadow-xs), var(--hi-top);
  transition:transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease; }
.qx__opt:hover:not(:disabled){ border-color:var(--cv); box-shadow:var(--glow-cv-sm), var(--hi-top); transform:translateY(-2px); }
/* Touch devices: :hover STICKS to the last-tapped position after a tap, so an untouched option
   (often the one under the finger, e.g. D) shows a phantom accent border before any real action.
   Kill the hover styling where there's no true hover — resting look until actually chosen. */
@media (hover:none){
  .qx__opt:hover:not(:disabled){ border-color:var(--line-strong); box-shadow:var(--shadow-xs), var(--hi-top); transform:none; }
  /* ...and the A–D letter key: the sticky hover left ONLY the key tinted in the game accent
     (green/blue, or red for Define's --cv) with no border — a phantom "highlighted letter". */
  .qx__opt:hover:not(:disabled) .qx__optk{ background:var(--surface-3); color:var(--ink-500); }
}
.qx__opt:active:not(:disabled){ transform:translateY(0) scale(.99); }
.qx__opt:focus-visible{ outline:none; border-color:var(--cv); box-shadow:var(--ring-cv), var(--hi-top); }
.qx__opt:disabled{ cursor:default; }
.qx__optk{ flex:0 0 auto; width:30px; height:30px; border-radius:9px; background:var(--surface-3); color:var(--ink-500);
  font-weight:800; font-size:var(--fs-sm); display:flex; align-items:center; justify-content:center; transition:background .12s ease, color .12s ease; }
.qx__opt:hover:not(:disabled) .qx__optk{ background:color-mix(in srgb,var(--cv) 16%,var(--surface-3)); color:color-mix(in srgb,var(--cv) 70%,var(--ink-700)); }
.qx__optv{ flex:1; min-width:0; font-weight:600; line-height:1.5; }  /* roomy line-height so Thai sub/superscript vowels never clip */
.qx__opt--thai .qx__optv{ font-size:var(--fs-xl); }
/* ── SIZING (owner): bigger option/prompt text on LARGE screens only. Keyed on min-width so
   it can NEVER trickle down to phones (<1024 keep the base sizes), and it deliberately leaves
   the audio buttons alone. There's plenty of room on big screens, so no overflow risk. */
@media (min-width:1024px){
  .qx__optv{ font-size:clamp(17px, 1.55vw, 22px); }
  .qx__opt--thai .qx__optv{ font-size:clamp(22px, 2.1vw, 32px); }
  .qx__opt{ min-height:clamp(64px, 8vh, 96px); }
  .qx__q{ font-size:clamp(17px, 1.4vw, 22px); }
}
/* ── SIZING (owner): shrink the big audio button HARD on short landscape phones so it (and the
   slow-play button off its right edge) stops clipping. Audio-button size only. */
@media (max-height:480px) and (orientation:landscape){
  .qx__bigplay{ width:clamp(44px, 20vh, 66px); height:clamp(44px, 20vh, 66px); }
  .qx__bigplay .ico{ width:26px; height:26px; }
  .qx__bigplay::after{ inset:-5px; }
  .qx__slowplay{ width:clamp(26px, 7.5vh, 38px); height:clamp(26px, 7.5vh, 38px); margin-left:clamp(8px,2vh,16px); }
}
.qx__opt.is-correct{ border-color:var(--green-500); background:color-mix(in srgb,var(--green-500) 17%,var(--mix-base)); color:var(--green-600);
  box-shadow:0 6px 20px -10px var(--green-500), var(--hi-top); animation:qxTileSnap .18s cubic-bezier(.2,.7,.3,1); }
.qx__opt.is-correct .qx__optk{ background:var(--green-500); color:#fff; }
.qx__opt.is-wrong{ border-color:var(--rose-500); background:color-mix(in srgb,var(--rose-500) 16%,var(--mix-base)); color:var(--rose-500);
  box-shadow:0 6px 20px -10px var(--rose-500), var(--hi-top); }
.qx__opt.is-wrong .qx__optk{ background:var(--rose-500); color:#fff; }
.qx__opt.is-dim{ opacity:.5; }
.qx__input.is-correct{ border-color:var(--green-500); background:color-mix(in srgb,var(--green-500) 12%,var(--mix-base)); }
.qx__input.is-wrong{ border-color:var(--rose-500); background:color-mix(in srgb,var(--rose-500) 12%,var(--mix-base)); }
/* tile-lock snap — promoted from _w2_words.css matchSnap / _w3_sentences.css qxLockSnap to
   the shared shell as qxTileSnap (a 0.18s scale overshoot). Reduced-motion collapses it. */
@keyframes qxTileSnap{ 0%{ transform:scale(1); } 55%{ transform:scale(1.045); } 100%{ transform:scale(1); } }

.qx__input{ width:100%; max-width:420px; height:54px; padding:0 18px; border:2px solid var(--line-strong); border-radius:14px;
  font-size:var(--fs-lg); text-align:center; font-family:inherit; }
.qx__input:focus{ border-color:var(--cv); outline:none; box-shadow:none; }

.qx__foot:empty{ display:none; }
/* CONTAINER IS GOD (rev): the feedback foot is an ABSOLUTE OVERLAY pinned to the arena bottom —
   it is a sibling of .qx__fit, NOT measured/scaled with the stage. So it can appear/grow without
   ever shifting or rescaling the stage (no jerky reflow). It has an opaque background, so where a
   tall stage reaches the bottom the dialog cleanly overlays the lowest options (overlap > jump). */
.qx__foot{ position:absolute; left:var(--pad); right:var(--pad); bottom:var(--s3); z-index:5;
  box-sizing:border-box; display:flex; align-items:center; gap:16px;
  padding:14px var(--pad); border:1px solid var(--line); border-radius:16px;
  background:var(--surface); box-shadow:var(--shadow-sm); animation:qxFoot .22s ease both; }
@keyframes qxFoot{ from{ transform:translateY(100%);} to{ transform:none;} }
.qx__foot--check{ justify-content:flex-end; }
/* §4.4 the footer "lights up" from the result: deepened tint + an accent top-border glow.
   Layout, reserved min-height and zero-shift slide-up (qxFoot) are UNCHANGED. */
.qx__foot.is-ok{ background:color-mix(in srgb,var(--green-500) 16%,var(--mix-base)); border-top-color:color-mix(in srgb,var(--green-500) 42%,var(--line));
  box-shadow:0 -1px 14px -6px var(--green-500); }
.qx__foot.is-no{ background:color-mix(in srgb,var(--rose-500) 15%,var(--mix-base)); border-top-color:color-mix(in srgb,var(--rose-500) 40%,var(--line));
  box-shadow:0 -1px 14px -6px var(--rose-500); }
/* short / landscape viewports: tighten chrome + reclaim the menu sub-row so the arena gets
   more height (the foot is already in-flow + the fit block scales, so no overlap logic needed). */
@media (max-height:560px){
  .qx{ min-height:0; }
  .qx__top{ padding:8px var(--pad); }
  .qx__foot{ padding:10px var(--pad); }
  .qx__sub{ display:none; }
}
/* §4.4 gradient fill + inset highlight (the .tool__ic recipe) + a brief pop-in. */
.qx__fbic{ flex:0 0 auto; width:40px; height:40px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:800; color:#fff;
  box-shadow:var(--hi-top); animation:qxFbicPop .28s cubic-bezier(.2,1.5,.4,1) both; }
.is-ok .qx__fbic{ background:linear-gradient(150deg,color-mix(in srgb,var(--green-500) 76%,var(--mix-base)),var(--green-500)); box-shadow:0 8px 18px -8px var(--green-500), var(--hi-top); }
.is-no .qx__fbic{ background:linear-gradient(150deg,color-mix(in srgb,var(--rose-500) 76%,var(--mix-base)),var(--rose-500)); box-shadow:0 8px 18px -8px var(--rose-500), var(--hi-top); }
.qx__fbic .ico{ width:20px; height:20px; }
@keyframes qxFbicPop{ 0%{ transform:scale(.4); opacity:0; } 60%{ transform:scale(1.12); } 100%{ transform:scale(1); opacity:1; } }
.qx__fbtx{ flex:1; min-width:0; }
.qx__fbt{ font-weight:800; font-size:var(--fs-xs); text-transform:uppercase; letter-spacing:.05em; }
.is-ok .qx__fbt{ color:var(--green-600); } .is-no .qx__fbt{ color:var(--rose-500); }
.qx__fbs{ font-weight:600; color:var(--ink-900); }
.qx__full{ font-weight:500; font-size:var(--fs-sm); color:var(--ink-500); margin-top:2px; }
/* narrow screens: the feedback row (icon | text | Continue) squeezes side-by-side. Wrap so the
   Continue/Check button drops to its own FULL-WIDTH line below the answer — no cramping/overlap. */
@media (max-width:640px){
  /* phones: the dialog text is already small, so give it MORE room — widen the overlay to ~95%
     of the arena (wider than the answer tiles) so more text fits per line. */
  .qx__foot{ flex-wrap:wrap; align-items:flex-start; left:2.5%; right:2.5%; bottom:var(--s2); padding:12px 14px; }
  .qx__foot .qx__cont{ flex:1 0 100%; width:100%; margin-top:10px; }
}
/* §4.4 premium primary action: gradient + tinted shadow + top-highlight (matches
   landing .lbtn--primary). Tint follows the result state. */
.qx__cont{ flex:0 0 auto; color:#fff; border:0;
  background:linear-gradient(135deg,color-mix(in srgb,var(--cv) 82%,var(--mix-base)),var(--cv));
  box-shadow:0 10px 26px -8px var(--cv), var(--hi-top); transition:transform .12s ease, box-shadow .15s ease, filter .12s ease; }
.is-ok .qx__cont{ background:linear-gradient(135deg,color-mix(in srgb,var(--green-500) 82%,var(--mix-base)),var(--green-500)); box-shadow:0 10px 26px -8px var(--green-500), var(--hi-top); }
.is-no .qx__cont{ background:linear-gradient(135deg,color-mix(in srgb,var(--rose-500) 82%,var(--mix-base)),var(--rose-500)); box-shadow:0 10px 26px -8px var(--rose-500), var(--hi-top); }
.qx__cont:hover:not(:disabled){ transform:translateY(-1px); filter:brightness(1.04); }
.qx__cont:active:not(:disabled){ transform:translateY(0) scale(.98); }
/* Disabled Check (no selection yet): the pale accent gradient + white text read as an unreadable
   washed-out button. Make "disabled" clear and LEGIBLE — neutral fill, readable ink, no glow. */
.qx__cont:disabled, .qx__cont[disabled]{
  background:var(--surface-3); color:var(--ink-400); box-shadow:none; filter:none; cursor:default; }

.qx__match{ display:flex; gap:var(--s4); width:100%; max-width:600px; margin:0 auto; }
.qx__mcol{ flex:1; display:flex; flex-direction:column; gap:clamp(7px,1.4vh,10px); }
/* uniform cell size so the two columns' rows LINE UP (they were misaligned: Thai cells ran
   taller than English) and don't oversize on short/landscape phones. Content centered. */
.qx__mcell{ min-height:clamp(46px,7.2vh,64px); display:flex; align-items:center; justify-content:center; text-align:center;
  padding:8px 12px; border:2px solid var(--line-strong); border-radius:14px; background:var(--surface); cursor:pointer;
  font-size:var(--fs-md); font-weight:600; transition:.12s; }
.qx__mcell .thai{ font-size:var(--fs-xl); font-weight:700; }
.qx__mcell:hover:not(.done){ border-color:var(--cv); }
.qx__mcell.sel{ border-color:var(--cv); background:color-mix(in srgb,var(--cv) 9%,var(--mix-base)); }
.qx__mcell.done{ border-color:var(--green-500); background:color-mix(in srgb,var(--green-500) 9%,var(--mix-base)); opacity:.65; cursor:default; }
.qx__mcell.flash{ border-color:var(--rose-500); background:color-mix(in srgb,var(--rose-500) 9%,var(--mix-base)); animation:shakeX .35s; }

.qx__scene{ text-align:center; display:flex; flex-direction:column; align-items:center; gap:13px; }
/* The Define/Fill quiz games reuse .qx__scene as a CENTERED question wrapper. But the Scene
   Player's _w4_conversation.css hard-resets bare .qx__scene to a left-aligned, framed block and
   stays loaded globally — leaking left-alignment + a panel background onto these games. This
   more-specific modifier re-asserts the centered, unframed layout regardless of load order. */
.qx__scene.qx__scene--quiz{ display:flex !important; flex-direction:column; align-items:center;
  text-align:center; gap:13px; width:100%; max-width:none; margin:0; padding:0;
  background:none; border:0; box-shadow:none; overflow:visible; }
.qx__line{ font-size:clamp(24px,3.4vw,32px); font-weight:700; line-height:1.55; }
.qx__u{ text-decoration:underline; text-decoration-color:var(--cv); text-decoration-thickness:3px; text-underline-offset:5px; }
.qx__blank{ display:inline-block; min-width:84px; border-bottom:3px solid var(--cv); margin:0 4px; }

.qx__sub{ flex:0 0 auto; max-width:760px; width:100%; margin:var(--s3) auto 0; display:flex; align-items:center; justify-content:space-between; gap:var(--s3); flex-wrap:wrap; }
.qx__chip{ display:inline-flex; align-items:center; gap:9px; font-weight:700; font-size:var(--fs-sm); color:var(--ink-700); }
/* §3.6 gradient icon chip + tinted drop-shadow (the .tool__ic recipe). */
.qx__chip-ic{ width:28px; height:28px; border-radius:8px; color:#fff; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(150deg, color-mix(in srgb,var(--cv) 78%,var(--mix-base)), var(--cv)); box-shadow:0 6px 14px -6px var(--cv), var(--hi-top); }
.qx__chip-ic .ico{ width:16px; height:16px; }
.qx__menu{ color:var(--ink-500); font-weight:600; font-size:var(--fs-sm); display:inline-flex; align-items:center; gap:5px; }
.qx__menu .ico{ width:15px; height:15px; } .qx__menu:hover{ color:var(--ink-900); }
.qx__badge{ flex:0 0 auto; width:38px; height:38px; border-radius:50%; background:var(--cv); color:#fff; display:flex; align-items:center; justify-content:center; }
.qx__badge .ico{ width:18px; height:18px; }
.qx__opt--pair{ justify-content:center; text-align:center; padding:var(--s5) var(--s4); }
.qx__opt--pair .qx__optv{ flex:0 1 auto; }

/* ---- generalized results: optional honest next-step line (H.qx.results opts.next) ---- */
.q2-res__next{ color:var(--ink-700); font-size:var(--fs-sm); font-weight:600; margin-top:var(--s3); max-width:52ch; margin-left:auto; margin-right:auto; }

/* ---- shared self-grade row: Again / Hard / Good (FOUNDATION §3.4, H.qx.gradeRow) ----
   Lives in the #qx-foot; three pills only. Colors: Again=rose, Hard=amber, Good=green. */
.grade-row{ display:flex; gap:var(--s2); flex:0 0 auto; margin-left:auto; }
.grade-row__lead{ flex:1; min-width:0; }
/* §4.7 always-on semantic tint + top-highlight so the three choices read as distinct
   tactile buttons at rest; colored glow on hover. Text stays -600 for AA on the tint. */
.grade-row__btn{ flex:0 0 auto; min-width:76px; padding:12px 16px; border-radius:14px; border:2px solid var(--line-strong);
  background:var(--surface); color:var(--ink-900); font-family:inherit; font-weight:800; font-size:var(--fs-sm); cursor:pointer;
  box-shadow:var(--hi-top);
  transition:transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease; }
.grade-row__btn:hover{ transform:translateY(-2px); }
.grade-row__btn:active{ transform:translateY(0) scale(.98); }
.grade-row__btn:focus-visible{ outline:none; box-shadow:var(--ring); }
.grade-row__btn--again{ border-color:color-mix(in srgb,var(--rose-500) 45%,var(--line)); color:var(--rose-500); background:color-mix(in srgb,var(--rose-500) 6%,var(--mix-base)); }
.grade-row__btn--again:hover{ background:color-mix(in srgb,var(--rose-500) 13%,var(--mix-base)); border-color:var(--rose-500); box-shadow:0 6px 16px -8px var(--rose-500), var(--hi-top); }
.grade-row__btn--hard{ border-color:color-mix(in srgb,var(--amber-500) 50%,var(--line)); color:var(--amber-600); background:color-mix(in srgb,var(--amber-500) 8%,var(--mix-base)); }
.grade-row__btn--hard:hover{ background:color-mix(in srgb,var(--amber-500) 16%,var(--mix-base)); border-color:var(--amber-500); box-shadow:0 6px 16px -8px var(--amber-500), var(--hi-top); }
.grade-row__btn--good{ border-color:color-mix(in srgb,var(--green-500) 45%,var(--line)); color:var(--green-600); background:color-mix(in srgb,var(--green-500) 6%,var(--mix-base)); }
.grade-row__btn--good:hover{ background:color-mix(in srgb,var(--green-500) 13%,var(--mix-base)); border-color:var(--green-500); box-shadow:0 6px 16px -8px var(--green-500), var(--hi-top); }
@media (max-width:560px){ .grade-row__btn{ min-width:0; flex:1; padding:12px 6px; } .grade-row{ width:100%; } }

/* ---- canonical tap-to-assemble tile family (QA D1: the ONE tile component) ----
   .qx__tile leaves .qx__tray, lands in a .qx__slot on the .qx__buildline. Same tile
   chrome as .qx__opt; NO synonyms (.qx__forge*, .qx__opt--tile are retired). States are
   the shared .is-right / .is-wrong / .is-dim (mirroring .qx__opt reveal states). */
/* §4.8 depth communicates the mechanic: buildline is a RECESSED well (target), tray is a
   subtly RAISED shelf (source), tiles are tactile physical keys. */
.qx__buildline{ display:flex; flex-wrap:wrap; gap:var(--s2); justify-content:center; align-items:center;
  min-height:60px; padding:var(--s3); border:2px dashed var(--line-strong); border-radius:16px;
  background:var(--surf-sunken); box-shadow:var(--inset-well); }
.qx__slot{ display:inline-flex; align-items:center; justify-content:center; min-width:54px; min-height:44px;
  padding:8px 12px; border-radius:12px; border:2px dashed transparent; background:var(--surface-3);
  font-size:var(--fs-xl); font-weight:700; color:var(--ink-900); transition:background .12s ease, border-color .12s ease, box-shadow .12s ease; }
.qx__slot:empty{ border-color:var(--line); background:var(--surface-3); box-shadow:var(--inset-well); }
.qx__slot.is-right{ border-style:solid; border-color:var(--green-500); background:color-mix(in srgb,var(--green-500) 16%,var(--mix-base));
  color:var(--green-600); box-shadow:0 4px 14px -8px var(--green-500); animation:qxTileSnap .18s cubic-bezier(.2,.7,.3,1); }
.qx__slot.is-wrong{ border-style:solid; border-color:var(--rose-500); background:color-mix(in srgb,var(--rose-500) 15%,var(--mix-base)); color:var(--rose-500); animation:shakeX .35s; }
.qx__tray{ display:flex; flex-wrap:wrap; gap:var(--s2); justify-content:center; padding:var(--s3);
  border-radius:16px; background:var(--surf-raised); box-shadow:var(--shadow-xs), var(--hi-top); }
.qx__tile{ display:inline-flex; align-items:center; justify-content:center; min-height:52px; padding:12px 18px;
  background:var(--surf-raised); border:2px solid var(--line-strong); border-radius:14px; cursor:pointer;
  font-size:var(--fs-xl); font-weight:700; color:var(--ink-900); box-shadow:var(--shadow-xs), var(--hi-top);
  transition:transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease, opacity .12s ease; }
.qx__tile:hover:not(:disabled):not(.is-used){ border-color:var(--cv); box-shadow:var(--glow-cv-sm), var(--hi-top); transform:translateY(-2px); }
.qx__tile:active:not(:disabled):not(.is-used){ transform:translateY(0) scale(.98); }
.qx__tile:focus-visible{ outline:none; border-color:var(--cv); box-shadow:var(--ring-cv), var(--hi-top); }
.qx__tile.is-used{ opacity:.32; pointer-events:none; }
.qx__tile:disabled{ cursor:default; }
.qx__tile.is-right{ border-color:var(--green-500); background:color-mix(in srgb,var(--green-500) 16%,var(--mix-base)); color:var(--green-600);
  box-shadow:0 6px 20px -10px var(--green-500), var(--hi-top); animation:qxTileSnap .18s cubic-bezier(.2,.7,.3,1); }
.qx__tile.is-wrong{ border-color:var(--rose-500); background:color-mix(in srgb,var(--rose-500) 15%,var(--mix-base)); color:var(--rose-500); animation:shakeX .35s; }
.qx__tile.is-dim{ opacity:.5; }

/* ===================== EARS LANE: Hear-the-Tone + Ear Gym =====================
   Contour glyphs on tone tiles (spec 01 §3/§10), the 5-up tone grid, the A/B
   re-listen control (lane_ears §A10), and the setup .qmode buttons. All reuse the
   qx family chrome + tokens; new classes are prefixed + token-matched (FOUNDATION §1). */

/* setup .qmode cards rendered as <button> (in-place setup, no deep hash route). */
.qmode--btn{ font-family:inherit; text-align:left; cursor:pointer; width:100%; appearance:none; }
.qmode--btn:hover{ transform:translateY(-1px); box-shadow:var(--shadow-md); border-color:var(--blue-200); }
.qmode--btn.is-active{ border-color:var(--violet-500); box-shadow:0 0 0 2px color-mix(in srgb,var(--violet-500) 40%,transparent); }
.qmode--btn.is-active .qmode__go{ opacity:1; }

/* five-up tone grid: 5 across ≥560, 2 across below (mirrors .toneopts). */
.qx__opts--tone{ grid-template-columns:repeat(5,1fr); }
@media (max-width:560px){ .qx__opts--tone{ grid-template-columns:repeat(2,1fr); } }

/* tone tile: stacks the contour glyph above the label; glyph in the tone token color. */
.qx__opt--tone{ flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:6px; padding:clamp(8px,1.4vh,14px) 10px; min-height:clamp(60px,10.5vh,96px); }
.qx__opt--tone .qx__optv{ flex:0 0 auto; font-weight:700; }
.tone-glyph{ width:60px; height:32px; display:block; }
.qx__opt--tone[data-tone="mid"] .tone-glyph{ color:var(--tone-mid); }
.qx__opt--tone[data-tone="low"] .tone-glyph{ color:var(--tone-low); }
.qx__opt--tone[data-tone="high"] .tone-glyph{ color:var(--tone-high); }
.qx__opt--tone[data-tone="rising"] .tone-glyph{ color:var(--tone-rising); }
.qx__opt--tone[data-tone="falling"] .tone-glyph{ color:var(--tone-falling); }
/* correct/wrong/dim inherit from .qx__opt; on reveal the correct tone glyph pops. */
.qx__opt--tone.is-correct .tone-glyph{ transform:scale(1.12); transition:transform .18s cubic-bezier(.2,1.5,.4,1); }
/* "contour trace": a subtle draw-on of the glyph path during the reveal replay. */
.qx__opt--tone.is-tracing .tone-glyph path{ stroke-dasharray:60; stroke-dashoffset:60; animation:contourTrace .7s ease-out forwards; }
@keyframes contourTrace{ to{ stroke-dashoffset:0; } }

/* Ear Gym Thai tiles carry a small verified-roman sub-line under the Thai word. */
.qx__optroman{ font-size:var(--fs-xs); color:var(--ink-500); font-weight:600; }
.qx__opt--tone .qx__optroman{ text-align:center; width:100%; }
/* An option tile that shows a Thai word + its romanization (Ear Gym) is a horizontal row
   [letter][Thai]; the roman was set width:100% and landed ON TOP of the Thai. Wrap it to its
   own line, indented under the Thai — a clean stacked flashcard, no overlap. */
.qx__opt:has(.qx__optroman):not(.qx__opt--tone){ flex-wrap:wrap; row-gap:2px; }
.qx__opt:has(.qx__optroman):not(.qx__opt--tone) .qx__optv{ flex:1 1 auto; }
.qx__opt:has(.qx__optroman):not(.qx__opt--tone) .qx__optroman{ flex-basis:100%; padding-left:43px; }

/* A/B re-listen control — lives INSIDE #qx-foot so it inherits foot-rise (no shift). */
.qx__ab{ flex:1; min-width:0; }
.qx__ab-cap{ font-size:var(--fs-xs); font-weight:700; color:var(--ink-500); margin-bottom:6px; }
.qx__ab-row{ display:flex; gap:var(--s2); flex-wrap:wrap; }
.qx__ab-btn{ display:inline-flex; align-items:center; gap:7px; padding:9px 14px; border-radius:var(--r-pill);
  border:2px solid var(--line-strong); background:var(--surface); color:var(--ink-900); font-family:inherit; font-weight:700;
  font-size:var(--fs-sm); cursor:pointer; transition:transform .12s ease, border-color .12s ease, background .12s ease; }
.qx__ab-btn .ico{ width:15px; height:15px; color:var(--cv); }
.qx__ab-btn .thai{ font-weight:700; }
.qx__ab-btn:hover{ border-color:var(--cv); background:color-mix(in srgb,var(--cv) 7%,var(--mix-base)); transform:translateY(-1px); }
.qx__ab-btn:active{ transform:scale(.97); }
.is-ok .qx__ab-btn .ico, .is-no .qx__ab-btn .ico{ color:inherit; }

/* Ear Gym overlay segmented control (reuses .chip). */
.eg-chips{ display:flex; gap:var(--s2); flex-wrap:wrap; margin-bottom:var(--s3); }
.chip.is-disabled{ opacity:.5; cursor:default; pointer-events:none; }

@media (max-width:560px){
  .qx__ab-row{ width:100%; }
  .qx__ab-btn{ flex:1; justify-content:center; }
}
@media (prefers-reduced-motion:reduce){
  .qx__opt--tone.is-correct .tone-glyph{ transition:none; transform:none; }
  .qx__opt--tone.is-tracing .tone-glyph path{ animation:none; stroke-dashoffset:0; }
  /* --- collapse every NEW shared-shell animation to an instant final state --- */
  .qx__streak.is-roll .ico{ animation:none; }
  .qx__opt.is-correct{ animation:none; }
  .qx__slot.is-right, .qx__tile.is-right{ animation:none; }
  .qx__fbic{ animation:none; }
  /* results ring: render the fill + tier state instantly, keep the glow (color, not motion) */
  .q2-res__ring{ animation:none; --qp:var(--pct); }
  .q2-res__spark{ animation:none; display:none; }
}

/* match-up */
.qz-match{ display:flex; gap:var(--s5); width:100%; max-width:600px; }
.qz-mcol{ flex:1; display:flex; flex-direction:column; gap:10px; }
.qz-mcell{ padding:14px 12px; border:1px solid var(--line-strong); border-radius:var(--r-md); background:var(--surface); cursor:pointer; transition:.12s; font-size:var(--fs-md); }
.qz-mcell .thai{ font-size:var(--fs-xl); font-weight:700; }
.qz-mcell:hover:not(.done){ border-color:var(--blue-400); }
.qz-mcell.sel{ border-color:var(--blue-500); background:var(--blue-50); box-shadow:var(--ring); }
.qz-mcell.done{ border-color:var(--green-500); background:var(--green-100); opacity:.7; cursor:default; }
.qz-mcell.flash{ border-color:var(--rose-500); background:#fff1f3; animation:shakeX .35s; }
@keyframes shakeX{ 0%,100%{transform:translateX(0);} 25%{transform:translateX(-4px);} 75%{transform:translateX(4px);} }

/* scenario quiz */
.qz-scene{ text-align:center; margin-bottom:var(--s5); max-width:640px; }
.qz-line{ font-size:var(--fs-2xl); font-weight:700; line-height:1.6; }
.qz-u{ text-decoration:underline; text-decoration-color:var(--amber-500); text-decoration-thickness:3px; text-underline-offset:4px; }
.qz-blank{ display:inline-block; min-width:80px; border-bottom:3px solid var(--blue-400); margin:0 4px; }

/* role-play */
.rp-pick{ display:flex; align-items:center; gap:10px; margin:var(--s4) 0; }
.rp-select{ flex:1; max-width:460px; height:42px; padding:0 var(--s3); border:1px solid var(--line-strong); border-radius:var(--r-md); background:var(--surface); font-size:var(--fs-md); font-family:inherit; }
.rp-stage{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-xl); padding:var(--s6) var(--s5); box-shadow:var(--shadow-sm); }
.rp-prog{ text-align:center; font-size:var(--fs-sm); color:var(--ink-400); font-weight:700; margin-bottom:var(--s4); }
.rp-turn{ max-width:560px; margin:0 auto; padding:var(--s5); border-radius:var(--r-lg); border:1px solid var(--line); }
.rp-turn--them{ background:var(--surface-2); }
.rp-turn--me{ background:var(--blue-50); border-color:var(--blue-100); }
.rp-who{ font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-400); margin-bottom:6px; }
.rp-thai{ font-size:var(--fs-2xl); font-weight:700; line-height:1.5; }
.rp-en{ font-size:var(--fs-md); margin-top:4px; }
.rp-controls{ display:flex; gap:var(--s2); flex-wrap:wrap; margin-top:var(--s4); }
.rp-nav{ display:flex; align-items:center; justify-content:space-between; gap:var(--s3); max-width:560px; margin:var(--s5) auto 0; }

/* syllable builder */
.sb{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-xl); padding:var(--s6) var(--s5); box-shadow:var(--shadow-sm); }
.sb-preview{ text-align:center; padding:var(--s5) 0 var(--s6); }
.sb-built{ display:block; font-size:clamp(44px, 12vw, 84px); font-weight:700; line-height:1.2; color:var(--ink-900); }
.sb-roman{ display:block; font-size:var(--fs-xl); color:var(--violet-500); font-weight:700; margin-top:6px; }
.sb-row{ margin-top:var(--s4); }
.sb-label{ font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-400); margin-bottom:8px; }
.sb-chips{ display:flex; gap:8px; flex-wrap:wrap; }
.sb-chip{ display:flex; flex-direction:column; align-items:center; gap:2px; min-width:54px; padding:8px 10px; border:1px solid var(--line-strong);
  border-radius:var(--r-md); background:var(--surface); cursor:pointer; transition:.12s; }
.sb-chip .thai{ font-size:var(--fs-xl); font-weight:700; line-height:1; }
.sb-chip small{ font-size:11px; color:var(--ink-400); }
.sb-chip:hover{ border-color:var(--violet-500); }
.sb-chip.is-on{ background:var(--violet-500); border-color:var(--violet-500); color:#fff; }
.sb-chip.is-on small{ color:rgba(255,255,255,.85); }

/* read real words */
.rdr-card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-xl); padding:var(--s7) var(--s5); box-shadow:var(--shadow-sm); text-align:center; }
.rdr-thai{ font-size:clamp(38px, 9vw, 64px); font-weight:700; line-height:1.3; }
.rdr-reveal{ margin-top:var(--s3); }
.rdr-en{ font-size:var(--fs-xl); color:var(--ink-700); }
.rdr-controls{ display:flex; gap:var(--s3); justify-content:center; flex-wrap:wrap; margin-top:var(--s5); }

/* ===================== VOICE LANE: Tone Reading Lab + Shadowing =====================
   Tone PRODUCTION overlay device (.contour: native solid + mine dashed + tracing dot),
   the tone-prompt (.qx__prompt--tone), the mic block (.qx__record), the listen-mode
   self-grade, and the Shadowing two-row waveform compare. All token-matched extensions
   of the qx / studio families (specs/lane_voice.md §10, FOUNDATION §1). New motion is
   wrapped for prefers-reduced-motion at the end of the block. */

/* the tone prompt: stacks word -> tone line -> contour hero -> play -> record. */
.qx__prompt--tone{ display:flex; flex-direction:column; align-items:center; gap:var(--s3); text-align:center; width:100%; max-width:520px; margin:0 auto; }
.qx__prompt--tone .qx__word{ font-size:var(--fs-4xl); font-weight:700; line-height:1.2; }
.qx__toneline{ display:flex; align-items:center; justify-content:center; gap:8px; flex-wrap:wrap; font-size:var(--fs-md); color:var(--ink-700); }
.qx__toneline .muted{ color:var(--ink-500); }

/* the pitch-overlay device — the ONE new visual primitive this lane adds.
   Native curve solid, learner curve dashed; both in the tone token color. */
.contour--target{ position:relative; width:min(100%,380px); height:120px; margin:2px auto var(--s2);
  background:color-mix(in srgb, var(--cv) 5%, var(--surface-2)); border:1px solid var(--line);
  border-radius:var(--r-lg); padding:var(--s3) var(--s4); box-sizing:border-box; }
.contour--target[data-tone="mid"]{ color:var(--tone-mid); }
.contour--target[data-tone="low"]{ color:var(--tone-low); }
.contour--target[data-tone="high"]{ color:var(--tone-high); }
.contour--target[data-tone="rising"]{ color:var(--tone-rising); }
.contour--target[data-tone="falling"]{ color:var(--tone-falling); }
.contour--target svg{ width:100%; height:100%; display:block; overflow:visible; }
.contour__native{ fill:none; stroke:currentColor; stroke-width:5; stroke-linecap:round; stroke-linejoin:round; }
.contour__mine{ fill:none; stroke:var(--ink-500); stroke-width:4; stroke-linecap:round; stroke-linejoin:round;
  stroke-dasharray:7 6; opacity:0; transition:opacity .4s ease; }
.contour--target.is-compared .contour__mine{ opacity:1; animation:contourSpring .4s cubic-bezier(.2,1.4,.4,1); }
.contour--target.is-diverged .contour__mine{ stroke:var(--rose-500); }
.contour--target.is-shake .contour__mine{ animation:shakeX .35s; }
.contour__dot{ fill:currentColor; opacity:0; }
.contour--target.is-tracing .contour__dot{ opacity:1; animation:contourDot var(--trace,1.1s) linear forwards; }
@keyframes contourSpring{ from{ opacity:0; transform:translateY(6px) scaleY(.86); } to{ opacity:1; transform:none; } }
@keyframes contourDot{ from{ offset-distance:0%; } to{ offset-distance:100%; } }
/* the match ring (auto-scoring upgrade only) — reuses the results-ring conic device. */
.contour__ring{ --pct:0; width:64px; height:64px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:var(--fs-md); color:var(--ink-900); flex:0 0 auto;
  background:conic-gradient(var(--green-500) calc(var(--pct)*1%), var(--line) 0); }
.contour__ring i{ width:50px; height:50px; border-radius:50%; background:var(--surface); display:flex; align-items:center; justify-content:center; font-style:normal; }

/* the mic control block: record toggle + Hear mine + live waveform. */
.qx__record{ display:flex; flex-direction:column; align-items:center; gap:var(--s3); width:100%; }
.qx__record .wave{ height:34px; color:var(--rose-500); opacity:.35; transition:opacity .2s ease; }
.qx__record.is-recording .wave{ opacity:1; }
.qx__recrow{ display:flex; gap:var(--s3); justify-content:center; flex-wrap:wrap; }
.qx__recbtn{ /* inherits .btn; .btn--rec red-pulse applied while recording */ }

/* listen-mode (mic denied) two-button self-grade — reuses grade-row pills. */
.grade-row--listen .grade-row__btn{ min-width:96px; }

/* results per-tone breakdown chips (reuses ttag tokens). */
.tl-tones{ display:flex; gap:6px; flex-wrap:wrap; justify-content:center; margin-top:6px; }

/* ---- Shadowing: two-row waveform compare (extends the .wave device) ---- */
.shadow__compare{ display:flex; flex-direction:column; gap:var(--s3); margin:var(--s5) 0; }
.shadow__wave{ display:flex; align-items:center; gap:var(--s3); }
.shadow__wave .wave{ flex:1; height:44px; gap:5px; }
.shadow__wave .wave i{ width:5px; }
.shadow__wave-lbl{ flex:0 0 64px; font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-400); text-align:right; }
.shadow__wave--native .wave{ color:var(--blue-400); }
.shadow__wave--mine .wave{ color:var(--rose-500); opacity:.4; transition:opacity .3s ease; }
.shadow__wave--mine.has-take .wave{ opacity:1; }
.shadow__compare .contour--target{ margin-top:var(--s2); }
.studio .grade-row{ margin:var(--s4) 0 0; flex-wrap:wrap; }
.studio__end{ text-align:center; padding:var(--s5); }

@media (max-width:560px){
  .contour--target{ height:100px; }
  .shadow__wave-lbl{ flex-basis:52px; }
}
@media (prefers-reduced-motion:reduce){
  .contour--target.is-compared .contour__mine{ animation:none; }
  .contour--target.is-shake .contour__mine{ animation:none; }
  .contour--target.is-tracing .contour__dot{ animation:none; opacity:0; }
}

/* ===================== WING LANE SECTIONS (design overhaul §3.2/§4) =====================
   The control-panel grouping device, generalized from the Arcade's .arc-lanesec: a dense
   wing stops being a flat contact-sheet and becomes labeled, lane-tinted zones. Set --cv
   on the section root; the head gains a color dot, a tinted rule and a count chip. */
.wing-sec .section__head{ padding-bottom:var(--s3); border-bottom:1px solid color-mix(in srgb,var(--cv,var(--blue-500)) 22%,var(--line)); }
.wing-sec .section__title .dot{ display:inline-block; width:10px; height:10px; border-radius:3px;
  background:var(--cv,var(--blue-500)); margin-right:9px; }
.seccount{ display:inline-block; font-size:var(--fs-xs); font-weight:700; white-space:nowrap; vertical-align:middle;
  color:color-mix(in srgb,var(--cv,var(--blue-500)) 55%,var(--ink-500));
  background:color-mix(in srgb,var(--cv,var(--blue-500)) 12%,var(--surface));
  border-radius:var(--r-pill); padding:2px 10px; margin-left:10px; }

/* ===================== THE SETUP SLIDE-OVER (design overhaul §5) =====================
   Kills the pre-game picker: games start instantly at a smart default, and the existing
   difficulty / pool / count controls RELOCATE into this dismissible Rung-4 sheet, one tap
   away behind a quiet "Setup" button. Right slide-over on desktop/tablet; bottom sheet on
   phones (full-width, thumb zone). Created/destroyed by H.qx.sheet(). */
.qsheet-back{ position:fixed; inset:0; z-index:400; background:rgba(13,27,42,.42);
  display:flex; justify-content:flex-end; align-items:stretch; animation:fadeIn var(--dur-3,.26s) ease both; }
.qsheet{ position:relative; width:min(410px,94vw); max-height:100%; overflow-y:auto; -webkit-overflow-scrolling:touch;
  background:var(--surface); border-left:1px solid var(--line); box-shadow:var(--shadow-xl);
  padding:calc(var(--s5) + var(--safe-t)) var(--s5) calc(var(--s6) + var(--safe-b)) var(--s5);
  animation:qsheetInX var(--dur-3,.26s) var(--ease-out,ease) both; }
@keyframes qsheetInX{ from{ transform:translateX(44px); opacity:.3; } to{ transform:none; opacity:1; } }
@keyframes qsheetInY{ from{ transform:translateY(48px); opacity:.3; } to{ transform:none; opacity:1; } }
.qsheet__head{ display:flex; align-items:center; gap:var(--s3); margin-bottom:var(--s3); }
.qsheet__title{ font-family:var(--font-display); font-weight:700; font-size:var(--fs-xl); letter-spacing:-.01em; margin:0; flex:1 1 auto; }
.qsheet__x{ flex:0 0 auto; width:38px; height:38px; border-radius:50%; border:1px solid var(--line); background:var(--surface-2);
  color:var(--ink-500); display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:15px; }
.qsheet__x:hover{ background:var(--surface-3); color:var(--ink-900); }
.qsheet__lbl{ font-size:11px; font-weight:800; letter-spacing:.09em; text-transform:uppercase; color:var(--ink-400); margin:var(--s5) 0 var(--s2); }
.qsheet__lbl:first-child{ margin-top:0; }
.qsheet__note{ color:var(--ink-500); font-size:var(--fs-sm); margin:0 0 var(--s2); }
.qsheet__foot{ margin-top:var(--s5); display:flex; flex-direction:column; gap:var(--s3); }
/* clear "leave the game" link at the foot of the setup sheet — the shell's own back link is
   hidden behind the sheet on phones, so this is the reliable return to the Arcade. */
.qsheet__leave{ display:inline-flex; align-items:center; gap:6px; margin-top:var(--s5);
  padding-top:var(--s4); border-top:1px solid var(--line); width:100%;
  color:var(--ink-500); font-weight:700; font-size:var(--fs-sm); }
.qsheet__leave:hover{ color:var(--ink-900); }
.qsheet__leave .ico{ width:16px; height:16px; }
/* the narrow sheet stacks any relocated .qmode picker single-column */
.qsheet .qmode-grid{ grid-template-columns:1fr; }
.qsheet .lg-levels, .qsheet .lg-count{ align-self:flex-start; }
@media (max-width:767px){
  .qsheet-back{ justify-content:stretch; align-items:flex-end; }
  .qsheet{ width:100%; max-height:min(84vh, 660px); border-left:0; border-top:1px solid var(--line);
    border-radius:var(--r-2xl) var(--r-2xl) 0 0; animation-name:qsheetInY; }
}

/* the quiet in-game "Setup" trigger (lives in the game chrome, zero pixels of config on
   the play surface until summoned) */
.qx__gear{ flex:0 0 auto; display:inline-flex; align-items:center; gap:7px; height:38px; padding:0 14px;
  border-radius:999px; border:1px solid var(--line); background:var(--surface-2); color:var(--ink-500);
  font-weight:700; font-size:var(--fs-sm); cursor:pointer; font-family:inherit;
  transition:background .15s, color .15s, border-color .15s; }
.qx__gear:hover{ background:var(--surface-3); color:var(--ink-900); }
.qx__gear .ico{ width:16px; height:16px; }
@media (max-width:560px){ .qx__gear .qx__gear-lbl{ display:none; } .qx__gear{ width:38px; padding:0; justify-content:center; } }

/* ===================== MATERIAL SWEEP (design overhaul §2.2/§6) =====================
   Late-loaded overrides so every raised content surface carries the raised gradient +
   top-highlight ("no flat #fff card anywhere"), and the LEGACY quiz surfaces (.qz-*,
   drills, connections tiles) match the loved .qx__opt state machine. Layout untouched. */

/* Rung-1 quiet cards: raised material + top-highlight (same footprint, richer skin) */
.ccard,.paircard,.ladcard,.sx-card,.pc-card,.rulerow,.wcard,.coverage,.vocab-wrap,
.pathstep__body,.chap-head,.exstage,.rp-stage,.sb,.rdr-card,.drill,.tgame,.studio__card,.paircol{
  background:var(--surf-raised);
  box-shadow:var(--shadow-sm), var(--hi-top);
}
/* medium-elevation study panels keep their deeper shadow, gain the highlight + material */
.tstep,.fxw{ background:var(--surf-raised); box-shadow:0 6px 22px rgba(13,27,42,.07), var(--hi-top); }
.rv-card{ background:var(--surf-raised); box-shadow:var(--shadow-md), var(--hi-top); }

/* grammar browser: the sticky category rail becomes a Rung-1 panel; rows tint on hover */
.gx-cats{ background:var(--surf-raised); border:1px solid var(--line); border-radius:var(--r-lg);
  padding:var(--s3); box-shadow:var(--shadow-sm), var(--hi-top); }
.gx-rule{ background:var(--surf-raised); box-shadow:var(--shadow-xs), var(--hi-top); }
.gx-rule:hover{ background:color-mix(in srgb,var(--green-500) 5%,var(--mix-base)); }

/* pattern one-pager: the "Remember" callout earns a quiet accent wash like its siblings */
.pat-callout--remember{ background:color-mix(in srgb,var(--blue-500) 6%,var(--mix-base)); }

/* ---- legacy .qz quiz surface → the .qx__opt state machine (§6.2) ---- */
.qz-opt{ background:var(--surf-raised); border:2px solid var(--line-strong); border-radius:16px;
  box-shadow:var(--shadow-xs), var(--hi-top);
  transition:transform var(--dur-1,.12s) var(--ease-out,ease), border-color var(--dur-1,.12s) ease,
    background var(--dur-1,.12s) ease, box-shadow var(--dur-1,.12s) ease; }
.qz-opt:hover:not(:disabled){ border-color:var(--cv,var(--blue-500)); background:var(--surf-raised);
  box-shadow:var(--glow-cv-sm), var(--hi-top); transform:translateY(-2px); }
@media (hover:none){
  .qz-opt:hover:not(:disabled){ border-color:var(--line-strong); background:var(--surf-raised);
    box-shadow:var(--shadow-xs), var(--hi-top); transform:none; }
}
.qz-opt:focus-visible{ outline:none; border-color:var(--cv,var(--blue-500)); box-shadow:var(--ring-cv), var(--hi-top); }
.qz-opt.is-correct{ border-color:var(--green-500); background:color-mix(in srgb,var(--green-500) 17%,var(--mix-base)); color:var(--green-600);
  box-shadow:0 6px 20px -10px var(--green-500), var(--hi-top); }
.qz-opt.is-wrong{ border-color:var(--rose-500); background:color-mix(in srgb,var(--rose-500) 16%,var(--mix-base)); color:var(--rose-500);
  box-shadow:0 6px 20px -10px var(--rose-500), var(--hi-top); }
.qz-mcell{ background:var(--surf-raised); border:2px solid var(--line-strong); border-radius:14px;
  box-shadow:var(--shadow-xs), var(--hi-top); }
.qz-mcell:hover:not(.done){ border-color:var(--cv,var(--blue-500)); box-shadow:var(--glow-cv-sm), var(--hi-top); }
.qz-mcell.sel{ border-color:var(--cv,var(--blue-500)); background:color-mix(in srgb,var(--cv,var(--blue-500)) 9%,var(--mix-base));
  box-shadow:var(--ring-cv), var(--hi-top); }

/* the q2 quiz shell gains the qx accent aura + lane-tinted depth */
.q2{ background:radial-gradient(120% 62% at 50% 0%, color-mix(in srgb,var(--cv,var(--blue-500)) 7%,var(--mix-base)), var(--mix-base) 60%);
  box-shadow:0 24px 60px -20px color-mix(in srgb,var(--cv,var(--blue-500)) 20%, rgba(13,27,42,.28)), 0 2px 8px rgba(13,27,42,.06), var(--hi-top); }

/* sounds drills: the generic .opt + practice .exopt tiles join the family */
.opt,.exopt{ background:var(--surf-raised); box-shadow:var(--shadow-xs), var(--hi-top);
  border-radius:14px;
  transition:transform var(--dur-1,.12s) var(--ease-out,ease), border-color var(--dur-1,.12s) ease,
    background var(--dur-1,.12s) ease, box-shadow var(--dur-1,.12s) ease; }
.opt:hover{ border-color:var(--cv,var(--blue-400)); box-shadow:var(--glow-cv-sm), var(--hi-top); transform:translateY(-2px); }
@media (hover:none){ .opt:hover{ border-color:var(--line-strong); box-shadow:var(--shadow-xs), var(--hi-top); transform:none; } }
.opt:active{ transform:scale(.98); }

/* Connections board tiles: tactile keys instead of flat gray slabs */
.conn-tile{ background:var(--surf-raised); border:2px solid var(--line-strong);
  box-shadow:var(--shadow-xs), var(--hi-top);
  transition:transform var(--dur-1,.12s) var(--ease-out,ease), border-color var(--dur-1,.12s) ease,
    background var(--dur-1,.12s) ease, box-shadow var(--dur-1,.12s) ease; }
.conn-tile:hover{ background:var(--surf-raised); border-color:var(--cv,var(--green-500));
  box-shadow:var(--glow-cv-sm), var(--hi-top); transform:translateY(-2px); }
@media (hover:none){ .conn-tile:hover{ border-color:var(--line-strong); box-shadow:var(--shadow-xs), var(--hi-top); transform:none; } }
.conn-tile:active{ transform:scale(.97); }
.conn-tile.sel{ border-color:var(--ink-900); box-shadow:var(--shadow-md); transform:none; }

/* ===================== TOUCH / COARSE-POINTER ADAPTATIONS ===================== */
/* Reveal hover-only affordances and neutralize sticky lift/scale on touch devices. */
@media (hover:none){
  /* hover-revealed cues become permanently visible (can't hover to summon them) */
  .rulerow__open{ opacity:1; }
  .qmode__go{ opacity:1; }
  /* decorative lift/scale would stick after a tap — cancel it (positioning transforms
     like the constellation node centering are deliberately NOT touched here) */
  .lbtn:hover, .qx__opt:hover:not(:disabled), .fxcell:hover, .pl-step:hover,
  .favbtn:hover, .onb-opt:hover, .carnav:hover, .formula-cta:hover{ transform:none; }
}
/* ≥44px comfortable tap targets on coarse pointers (icons stay the same size) */
@media (pointer:coarse){
  .favbtn{ padding:10px; }
  .ctool{ width:40px; height:40px; }
  .winfo__x{ width:42px; height:42px; }
  .qx__quit{ width:44px; height:44px; }
}

/* ===================== HOME · BEGIN-HERE (new-user zero-state) ===================== */
/* Replaces the three empty cockpit rings for a brand-new user. Two content-first cards:
   one obvious first step (hear the tones) + the Constellation, front and center. */
.begin-band{ display:grid; grid-template-columns:1fr 1fr; gap:var(--s3); }
.begin-card{ position:relative; display:flex; flex-direction:column; gap:var(--s3);
  padding:var(--s4); border-radius:var(--r-lg,18px); border:1px solid var(--line);
  background:var(--card,#fff); text-decoration:none; color:inherit; overflow:hidden;
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.begin-card::before{ content:""; position:absolute; inset:0 auto 0 0; width:4px; background:var(--cv); }
.begin-card:hover{ transform:translateY(-3px); box-shadow:var(--shadow-md); border-color:color-mix(in srgb,var(--cv) 45%,var(--line)); }
.begin-card--lead{ background:linear-gradient(180deg,color-mix(in srgb,var(--cv) 9%,var(--card,#fff)),var(--card,#fff)); }
.begin-card__ic{ display:inline-flex; align-items:center; justify-content:center; width:46px; height:46px;
  border-radius:14px; background:color-mix(in srgb,var(--cv) 16%,transparent); color:var(--cv); }
.begin-card__ic svg{ width:24px; height:24px; }
.begin-card__tx{ display:flex; flex-direction:column; gap:4px; flex:1; }
.begin-card__k{ font-size:var(--fs-sm); font-weight:800; letter-spacing:.04em; text-transform:uppercase; color:var(--cv); }
.begin-card__tx b{ font-size:var(--fs-lg); font-weight:800; line-height:1.15; }
.begin-card__tx i{ font-style:normal; color:var(--ink-500,#5a6b7b); font-size:var(--fs-sm); line-height:1.5; }
.begin-card__go{ align-self:flex-start; margin-top:2px; }
@media (max-width:720px){ .begin-band{ grid-template-columns:1fr; } }

/* ===================== WORDS · CONSTELLATION HERO ===================== */
/* One big feature card (the wing's flagship), image left / copy right, stacks on mobile. */
.words-hero{ position:relative; display:grid; grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);
  gap:0; border-radius:var(--r-lg,18px); overflow:hidden; border:1px solid var(--line);
  background:var(--card,#fff); text-decoration:none; color:inherit;
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.words-hero:hover{ transform:translateY(-3px); box-shadow:var(--shadow-md); border-color:color-mix(in srgb,var(--cv) 45%,var(--line)); }
.words-hero__media{ position:relative; min-height:220px; background:
  radial-gradient(120% 120% at 30% 20%,color-mix(in srgb,var(--cv) 30%,#0b1b34),#0b1b34); }
.words-hero__media img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; }
.words-hero__body{ display:flex; flex-direction:column; gap:10px; justify-content:center; padding:var(--s5); }
.words-hero__title{ font-size:var(--fs-2xl,26px); font-weight:800; line-height:1.12; }
.words-hero__desc{ color:var(--ink-500,#5a6b7b); font-size:var(--fs-md); line-height:1.55; }
.words-hero__go{ align-self:flex-start; margin-top:6px; }
@media (max-width:720px){
  .words-hero{ grid-template-columns:1fr; }
  .words-hero__media{ min-height:150px; }
}

/* ===================== SMART-START ⚙ POOL SHEET (Match-Up / Shadowing) ===================== */
.mpool-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:8px; }
.mpool{ display:flex; flex-direction:column; align-items:flex-start; gap:2px; text-align:left;
  padding:12px 14px; border-radius:12px; border:1px solid var(--line); background:var(--card,#fff);
  color:inherit; cursor:pointer; transition:border-color .15s, background .15s, transform .12s; }
.mpool b{ font-weight:800; font-size:var(--fs-md); }
.mpool i{ font-style:normal; color:var(--ink-500,#5a6b7b); font-size:var(--fs-sm); }
.mpool:hover:not(:disabled){ border-color:color-mix(in srgb,var(--green-500) 45%,var(--line)); transform:translateY(-1px); }
.mpool.is-on{ border-color:var(--green-500); background:color-mix(in srgb,var(--green-500) 10%,var(--card,#fff)); }
.mpool:disabled{ opacity:.5; cursor:not-allowed; }

/* ===================== BIG-LIST SCANNABILITY (search + filter tools) ===================== */
.listtools{ display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin:var(--s4) 0 var(--s2); }
.listsearch{ display:inline-flex; align-items:center; gap:8px; flex:1 1 240px; min-width:200px;
  padding:8px 14px; border-radius:999px; border:1px solid var(--line); background:var(--card,#fff); }
.listsearch .ic{ color:var(--ink-400,#8493a3); display:inline-flex; }
.listsearch .ic svg{ width:18px; height:18px; }
.listsearch input{ border:0; outline:0; background:transparent; width:100%; font-size:var(--fs-md); color:inherit; }
.listempty{ padding:24px; text-align:center; color:var(--ink-500,#5a6b7b); }

/* ===================== SCENARIO DETAIL — vocab-first, gated dialogue ===================== */
/* Vocab is the simple primary layer: a soft color-tinted panel (no more white-on-white),
   with the white word cards popping against it, capped at 5 across on desktop. */
.vocab-wrap{ background:color-mix(in srgb, var(--c,var(--blue-500)) 6%, var(--mix-base));
  border-color:color-mix(in srgb, var(--c,var(--blue-500)) 22%, var(--line)); }
.vocab-wrap > summary{ background:color-mix(in srgb, var(--c,var(--blue-500)) 12%, var(--mix-base)); }
.vocab-wrap[open] > summary{ border-bottom-color:color-mix(in srgb, var(--c,var(--blue-500)) 22%, var(--line)); }
/* Responsive column caps — Thai chips need room, so fewer-but-wider beats many-and-narrow.
   phones/portrait: 2 · iPad-11 landscape (~1180): 3 · iPad-13 landscape (~1366): 4 · desktop: 5. */
.vocab-body .wcat-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--s3); }
@media (max-width:400px){ .vocab-body .wcat-grid{ grid-template-columns:1fr; } }
@media (min-width:1100px){ .vocab-body .wcat-grid{ grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media (min-width:1300px){ .vocab-body .wcat-grid{ grid-template-columns:repeat(4,minmax(0,1fr)); } }
@media (min-width:1500px){ .vocab-body .wcat-grid{ grid-template-columns:repeat(5,minmax(0,1fr)); } }
/* smaller Thai on small screens so words fit before needing to wrap */
@media (max-width:640px){ .vocab-body .wcard__thai{ font-size:26px; } .vocab-body .wcard{ min-height:112px; padding:14px; } }
/* the tinted panel lets us drop the card shadows to a cleaner flat look */
.vocab-body .wcard{ box-shadow:none; border-color:color-mix(in srgb, var(--c,var(--blue-500)) 14%, var(--line)); }
.vocab-body .wcard:hover{ box-shadow:var(--shadow-sm); }

/* the "See example dialogue" gateway button (advanced layer opens on demand) */
.see-dialog-wrap{ display:flex; flex-direction:column; align-items:center; gap:8px; margin-top:var(--s5); text-align:center; }
.see-dialog{ background:var(--cv,var(--blue-500)); color:#fff; border:0;
  box-shadow:0 8px 22px color-mix(in srgb, var(--cv,var(--blue-500)) 35%, transparent); }
.see-dialog:hover{ filter:brightness(1.05); transform:translateY(-1px); }
.see-dialog__hint{ color:var(--ink-500,#5a6b7b); font-size:var(--fs-sm); }

/* ===================== TRIAL-EXHAUSTED LOCK OVERLAY (constellation TEST) =====================
   Gaussian-blur scrim over the content + an upgrade card. Currently rendered UNCONDITIONALLY on
   the Constellation for the owner to evaluate the look; real gating (per-unit usage) comes later. */
.cwrap{ position:relative; }
.cst-lock{ position:absolute; inset:0; z-index:20; display:flex; align-items:center; justify-content:center;
  padding:20px; border-radius:inherit; overflow:hidden;
  backdrop-filter:blur(11px) saturate(1.05); -webkit-backdrop-filter:blur(11px) saturate(1.05);
  background:radial-gradient(120% 90% at 50% 40%, rgba(13,27,42,.24), rgba(13,27,42,.52)); }
.cst-lock__card{ text-align:center; max-width:360px; width:100%; padding:30px 28px; border-radius:22px;
  background:rgba(255,255,255,.94); box-shadow:0 26px 66px -18px rgba(4,10,24,.62), var(--hi-top); }
.cst-lock__ic{ font-size:36px; line-height:1; margin-bottom:10px; }
.cst-lock__t{ font-family:var(--font-display); font-weight:800; font-size:var(--fs-xl); color:var(--ink-900); letter-spacing:-.01em; }
.cst-lock__s{ color:var(--ink-600); font-size:var(--fs-sm); margin:10px 0 20px; line-height:1.55; }
.cst-lock__btn{ border:0; cursor:pointer; font:inherit; font-weight:800; font-size:var(--fs-md); color:#fff;
  padding:14px 30px; border-radius:999px; background:linear-gradient(135deg,var(--blue-500,#1f70df),#4a90ff);
  box-shadow:0 14px 30px -8px var(--blue-500,#1f70df), var(--hi-top); transition:filter .12s ease, transform .12s ease; }
.cst-lock__btn:hover{ filter:brightness(1.06); transform:translateY(-1px); }
.cst-lock__btn:active{ transform:translateY(0) scale(.98); }

/* ── Generic reusable trial-lock overlay (c.trialLock) — same look, any surface ── */
.trial-lock{ position:absolute; inset:0; z-index:20; display:flex; align-items:center; justify-content:center;
  padding:18px; border-radius:inherit; overflow:hidden;
  backdrop-filter:blur(11px) saturate(1.05); -webkit-backdrop-filter:blur(11px) saturate(1.05);
  background:radial-gradient(120% 90% at 50% 40%, rgba(13,27,42,.22), rgba(13,27,42,.5)); }
/* full-cover on a (possibly scrolling) page: keep the card near the top so it's visible without scrolling */
.trial-lock:not(.trial-lock--image){ align-items:flex-start; }
.trial-lock:not(.trial-lock--image) .trial-lock__card{ margin-top:clamp(40px, 16vh, 180px); }
.trial-lock__card{ text-align:center; max-width:360px; width:min(100%,360px); padding:28px 26px; border-radius:22px;
  background:rgba(255,255,255,.94); box-shadow:0 26px 66px -18px rgba(4,10,24,.62), var(--hi-top); }
.trial-lock__ic{ font-size:34px; line-height:1; margin-bottom:10px; }
.trial-lock__t{ font-family:var(--font-display); font-weight:800; font-size:var(--fs-xl); color:var(--ink-900); letter-spacing:-.01em; }
.trial-lock__s{ color:var(--ink-600); font-size:var(--fs-sm); margin:10px 0 20px; line-height:1.55; }
.trial-lock__btn{ border:0; font:inherit; font-weight:800; font-size:var(--fs-md); color:#fff;
  padding:13px 28px; border-radius:999px; background:linear-gradient(135deg,var(--blue-500,#1f70df),#4a90ff);
  box-shadow:0 14px 30px -8px var(--blue-500,#1f70df), var(--hi-top); cursor:default; opacity:1; }
.trial-lock__btn[data-trial-upgrade]{ cursor:pointer; }
/* hosts need positioning so the absolute overlay covers them */
.page:has(> .trial-lock), .qx:has(.trial-lock), .trial-host{ position:relative; }

/* ── HUB-CARD trial lock (c.lockCard) — blur the real entry card, forbid entry, tap → upgrade ── */
.trial-card{ position:relative; display:block; cursor:pointer; border-radius:20px; overflow:hidden;
  -webkit-tap-highlight-color:transparent; }
.trial-card:focus-visible{ outline:3px solid var(--blue-500,#1f70df); outline-offset:2px; }
/* the real card, blurred + fully inert (no navigation into the locked unit) */
.trial-card__blur{ filter:blur(5px) saturate(.9); opacity:.9; pointer-events:none; }
.trial-card__blur *{ pointer-events:none !important; }
/* compact veil: a small lock + caption centered over the tile */
.trial-card__veil{ position:absolute; inset:0; z-index:5; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:8px; text-align:center; padding:14px;
  background:radial-gradient(120% 90% at 50% 42%, rgba(13,27,42,.16), rgba(13,27,42,.4));
  backdrop-filter:blur(1.5px); -webkit-backdrop-filter:blur(1.5px); }
.trial-card__ic{ font-size:20px; line-height:1; opacity:.85;
  filter:drop-shadow(0 2px 6px rgba(4,10,24,.35)); }
.trial-card__cap{ font-family:var(--font-display); font-weight:800; font-size:var(--fs-xs);
  line-height:1.2; color:#fff; max-width:92%; letter-spacing:-.005em;
  background:rgba(11,22,42,.62); padding:4px 11px; border-radius:999px;
  backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px); }
.trial-card:hover .trial-card__veil{ background:radial-gradient(120% 90% at 50% 42%, rgba(13,27,42,.1), rgba(13,27,42,.32)); }
.trial-card:active{ transform:scale(.985); }

/* ── CARD image lock (.trial-media on the card itself), two sizes ── */
.trial-media{ cursor:pointer; -webkit-tap-highlight-color:transparent; }
.trial-media:focus-visible{ outline:3px solid var(--blue-500,#1f70df); outline-offset:2px; border-radius:12px; }
.trial-media .card__media, .trial-media .syscard__ic{ position:relative; overflow:hidden; }
/* SMALL cards → blur the cover art + a centered lock icon only */
.trial-media--icon .card__media > *, .trial-media--icon .syscard__ic > *{ filter:blur(6px) saturate(.9); transform:scale(1.06); }
.trial-media--icon .card__media::after, .trial-media--icon .syscard__ic::after{
  content:"🔒"; position:absolute; inset:0; z-index:3; display:grid; place-items:center;
  font-size:clamp(12px,2.4vw,17px); opacity:.8; filter:drop-shadow(0 2px 5px rgba(4,10,24,.4)); pointer-events:none; }
/* BIG cards → blur the cover + a "Trial Exhausted" + Upgrade panel over it (title/desc stay readable) */
.trial-media--cover .card__media > *:not(.tl-cover){ filter:blur(8px) saturate(.9); transform:scale(1.06); }
.tl-cover{ position:absolute; inset:0; z-index:3; border-radius:inherit; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:7px; padding:10px; text-align:center;
  background:radial-gradient(130% 100% at 50% 45%, rgba(13,27,42,.12), rgba(13,27,42,.5) 82%); }
.tl-cover__ic{ font-size:clamp(14px,2.6vw,18px); line-height:1; opacity:.82; filter:drop-shadow(0 2px 5px rgba(4,10,24,.4)); }
.tl-cover__t{ font-family:var(--font-display); font-weight:800; font-size:var(--fs-xs); color:#fff; letter-spacing:-.01em;
  background:rgba(11,22,42,.62); padding:4px 12px; border-radius:999px; backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px); }
.tl-cover__btn{ font-weight:800; font-size:12px; color:#fff; padding:6px 14px; border-radius:999px;
  background:linear-gradient(135deg,var(--blue-500,#1f70df),#4a90ff); box-shadow:0 8px 18px -6px var(--blue-500,#1f70df); }
/* the Golden Formula bar has no cover: just a small lock pin, no blur */
.formula-cta.is-trial-lock{ position:relative; cursor:pointer; }
.formula-cta.is-trial-lock .tl-pin{ position:absolute; top:8px; right:12px; z-index:3; font-size:16px;
  filter:drop-shadow(0 2px 6px rgba(4,10,24,.5)); }
/* arcade full-card veil gets an Upgrade pill too */
.trial-card__btn{ font-weight:800; font-size:12px; color:#fff; padding:6px 15px; border-radius:999px;
  background:linear-gradient(135deg,var(--blue-500,#1f70df),#4a90ff); box-shadow:0 8px 18px -6px var(--blue-500,#1f70df); }
/* text-only category cards (Fluency Rules) have no cover: a corner lock pin, content dimmed, entry forbidden */
.pc-card.is-trial-lock{ position:relative; cursor:pointer; }
.pc-card.is-trial-lock .t, .pc-card.is-trial-lock .b, .pc-card.is-trial-lock .c{ opacity:.5; }
.pc-card.is-trial-lock .tl-pin{ position:absolute; top:8px; right:10px; z-index:3; font-size:15px;
  filter:drop-shadow(0 2px 6px rgba(4,10,24,.5)); }
/* reading-track steps: each live exercise is its own 1-time lock (corner pin, content dimmed) */
.pathstep.is-trial-lock{ position:relative; cursor:pointer; }
.pathstep.is-trial-lock .pathstep__desc, .pathstep.is-trial-lock .pathstep__cta{ opacity:.5; }
.pathstep.is-trial-lock .tl-pin{ position:absolute; top:10px; right:12px; z-index:3; font-size:15px;
  filter:drop-shadow(0 2px 6px rgba(4,10,24,.5)); }

/* ── GROUP/AREA lock (c.lockOverlay + .is-trial-blur host content) — one lock per group ── */
/* SOFT edges: round the host + feather the blur (radial mask) so there is no hard rectangular corner */
.trial-host{ border-radius:18px; }
.is-trial-blur{ filter:blur(8px) saturate(.92); pointer-events:none; user-select:none;
  overflow:hidden; border-radius:18px;
  -webkit-mask-image:radial-gradient(135% 135% at 50% 50%, #000 60%, transparent 100%);
          mask-image:radial-gradient(135% 135% at 50% 50%, #000 60%, transparent 100%); }
.trial-overlay{ position:absolute; inset:0; z-index:6; border-radius:inherit; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:10px; text-align:center; padding:16px; cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  background:radial-gradient(130% 100% at 50% 45%, rgba(13,27,42,.05), rgba(13,27,42,.3) 80%); }
.trial-overlay:focus-visible{ outline:3px solid var(--blue-500,#1f70df); outline-offset:-4px; }
.trial-overlay:hover{ background:radial-gradient(130% 100% at 50% 45%, rgba(13,27,42,.03), rgba(13,27,42,.24) 80%); }
.trial-overlay__ic{ font-size:clamp(19px,3.4vw,27px); line-height:1; opacity:.85; filter:drop-shadow(0 2px 8px rgba(4,10,24,.4)); }
.trial-overlay__t{ font-family:var(--font-display); font-weight:800; font-size:var(--fs-md); color:#fff; letter-spacing:-.01em;
  background:rgba(11,22,42,.6); padding:5px 15px; border-radius:999px; backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px); }
.trial-overlay__btn{ font-weight:800; font-size:var(--fs-sm); color:#fff; padding:10px 22px; border-radius:999px;
  background:linear-gradient(135deg,var(--blue-500,#1f70df),#4a90ff); box-shadow:0 12px 26px -8px var(--blue-500,#1f70df); }
.trial-overlay--mini{ gap:0; }
.trial-overlay--mini .trial-overlay__ic{ font-size:clamp(18px,3.5vw,26px); }
/* review: page stays a positioning context so the lock overlay covers it with NO extra wrapper */
.rv-page{ position:relative; }


/* ============================================================
   DARK MODE OVERRIDES — element-level fixes a token flip can't reach
   (dark_mode_spec_2026-07 §3). Light output is unchanged; these only
   apply under OS-dark (no explicit choice) or data-theme="dark".
   ============================================================ */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .tn-cls--mid, :root:not([data-theme="light"]) .cls--mid{ color:var(--tone-low); }
  :root:not([data-theme="light"]) .tn-cls--high, :root:not([data-theme="light"]) .cls--high{ color:var(--tone-rising); }
  :root:not([data-theme="light"]) .tn-cls--low, :root:not([data-theme="light"]) .cls--low{ color:var(--tone-falling); }
  :root:not([data-theme="light"]) .tfm__h--dead{ color:var(--ink-900); }
  /* tone-formula matrix (dark palette redesign 2026-07-30): CLEAN navy surfaces, NO olive. Class
     row-headers carry the app's class-colour language (MID blue / HIGH green / LOW gold); Live is a
     cool tint, Dead is a clean neutral raised navy (the amber→olive tint is gone). Curve wells RECESS
     (dark inset) instead of a clashing pale-gray box. Cells still lift via border + drop shadow. */
  :root:not([data-theme="light"]) .tfm .cls--mid{ background:color-mix(in srgb, var(--tone-low) 20%, var(--surface-3)); }
  :root:not([data-theme="light"]) .tfm .cls--high{ background:color-mix(in srgb, var(--tone-rising) 20%, var(--surface-3)); }
  :root:not([data-theme="light"]) .tfm .cls--low{ background:color-mix(in srgb, var(--tone-falling) 20%, var(--surface-3)); }
  :root:not([data-theme="light"]) .tfm .col-live{ background:color-mix(in srgb, var(--tone-low) 15%, var(--surface-3)); border-color:color-mix(in srgb, var(--tone-low) 34%, var(--line-strong)); box-shadow:0 2px 5px rgba(0,0,0,.4); }
  :root:not([data-theme="light"]) .tfm .col-dead{ background:color-mix(in srgb, #ffffff 3%, var(--surface-3)); border-color:var(--line-strong); box-shadow:0 2px 5px rgba(0,0,0,.4); }
  :root:not([data-theme="light"]) .tfm .rc{ background:var(--surface-3); border-color:var(--line-strong); box-shadow:0 2px 5px rgba(0,0,0,.4); }
  :root:not([data-theme="light"]) .tfm__h--live{ background:color-mix(in srgb, var(--tone-low) 22%, var(--surface-3)); }
  :root:not([data-theme="light"]) .tfm__h--dead{ background:color-mix(in srgb, #ffffff 7%, var(--surface-3)); }
  :root:not([data-theme="light"]) .markcell{ background:color-mix(in srgb, #ffffff 5%, var(--surface-3)); }
  :root:not([data-theme="light"]) .markcell__g, :root:not([data-theme="light"]) .tmark__mark{ color:var(--ink-900); }
  :root:not([data-theme="light"]) .tmark__lead{ color:var(--green-600); }
  :root:not([data-theme="light"]) .tcurve{ background:rgba(0,0,0,.2); }
  :root:not([data-theme="light"]) .vtab__n{ background:rgba(255,255,255,.12); }
  :root:not([data-theme="light"]) .toneopts .opt.correct{ background:color-mix(in srgb, var(--green-500) 12%, var(--mix-base)); }
  :root:not([data-theme="light"]) .toneopts .opt.wrong{ background:color-mix(in srgb, var(--rose-500) 12%, var(--mix-base)); }
  :root:not([data-theme="light"]) .qz-opt.is-wrong{ background:color-mix(in srgb, var(--rose-500) 16%, var(--mix-base)); }
  :root:not([data-theme="light"]) .qz-mcell.flash{ background:color-mix(in srgb, var(--rose-500) 9%, var(--mix-base)); }
  :root:not([data-theme="light"]) .panic-word:hover{ background:color-mix(in srgb, var(--rose-500) 6%, var(--mix-base)); }
  :root:not([data-theme="light"]) .brk-tip{ background:color-mix(in srgb, var(--amber-500) 12%, var(--mix-base)); border-color:color-mix(in srgb, var(--amber-500) 30%, var(--line)); }
  :root:not([data-theme="light"]) .pat-callout--watch{ background:color-mix(in srgb, var(--amber-500) 10%, var(--mix-base)); }
  :root:not([data-theme="light"]) .pat-callout--watch .k{ color:var(--amber-600); }
  :root:not([data-theme="light"]) .tier-core{ background:color-mix(in srgb, var(--rose-500) 16%, var(--mix-base)); color:var(--rose-500); }
  :root:not([data-theme="light"]) .tier-key{ background:color-mix(in srgb, var(--amber-500) 18%, var(--mix-base)); color:var(--amber-600); }
  :root:not([data-theme="light"]) .cst-lock__card, :root:not([data-theme="light"]) .trial-lock__card{ background:rgba(24,35,47,.96); }
  :root:not([data-theme="light"]) .conn-tile.sel{ background:#2a3746; border-color:#2a3746; }
}
:root[data-theme="dark"] .tn-cls--mid, :root[data-theme="dark"] .cls--mid{ color:var(--tone-low); }
:root[data-theme="dark"] .tn-cls--high, :root[data-theme="dark"] .cls--high{ color:var(--tone-rising); }
:root[data-theme="dark"] .tn-cls--low, :root[data-theme="dark"] .cls--low{ color:var(--tone-falling); }
:root[data-theme="dark"] .tfm__h--dead{ color:var(--ink-900); }
:root[data-theme="dark"] .tfm .cls--mid{ background:color-mix(in srgb, var(--tone-low) 20%, var(--surface-3)); }
:root[data-theme="dark"] .tfm .cls--high{ background:color-mix(in srgb, var(--tone-rising) 20%, var(--surface-3)); }
:root[data-theme="dark"] .tfm .cls--low{ background:color-mix(in srgb, var(--tone-falling) 20%, var(--surface-3)); }
:root[data-theme="dark"] .tfm .col-live{ background:color-mix(in srgb, var(--tone-low) 15%, var(--surface-3)); border-color:color-mix(in srgb, var(--tone-low) 34%, var(--line-strong)); box-shadow:0 2px 5px rgba(0,0,0,.4); }
:root[data-theme="dark"] .tfm .col-dead{ background:color-mix(in srgb, #ffffff 3%, var(--surface-3)); border-color:var(--line-strong); box-shadow:0 2px 5px rgba(0,0,0,.4); }
:root[data-theme="dark"] .tfm .rc{ background:var(--surface-3); border-color:var(--line-strong); box-shadow:0 2px 5px rgba(0,0,0,.4); }
:root[data-theme="dark"] .tfm__h--live{ background:color-mix(in srgb, var(--tone-low) 22%, var(--surface-3)); }
:root[data-theme="dark"] .tfm__h--dead{ background:color-mix(in srgb, #ffffff 7%, var(--surface-3)); }
:root[data-theme="dark"] .markcell{ background:color-mix(in srgb, #ffffff 5%, var(--surface-3)); }
:root[data-theme="dark"] .markcell__g, :root[data-theme="dark"] .tmark__mark{ color:var(--ink-900); }
:root[data-theme="dark"] .tmark__lead{ color:var(--green-600); }
:root[data-theme="dark"] .tcurve{ background:rgba(0,0,0,.2); }
:root[data-theme="dark"] .vtab__n{ background:rgba(255,255,255,.12); }
:root[data-theme="dark"] .toneopts .opt.correct{ background:color-mix(in srgb, var(--green-500) 12%, var(--mix-base)); }
:root[data-theme="dark"] .toneopts .opt.wrong{ background:color-mix(in srgb, var(--rose-500) 12%, var(--mix-base)); }
:root[data-theme="dark"] .qz-opt.is-wrong{ background:color-mix(in srgb, var(--rose-500) 16%, var(--mix-base)); }
:root[data-theme="dark"] .qz-mcell.flash{ background:color-mix(in srgb, var(--rose-500) 9%, var(--mix-base)); }
:root[data-theme="dark"] .panic-word:hover{ background:color-mix(in srgb, var(--rose-500) 6%, var(--mix-base)); }
:root[data-theme="dark"] .brk-tip{ background:color-mix(in srgb, var(--amber-500) 12%, var(--mix-base)); border-color:color-mix(in srgb, var(--amber-500) 30%, var(--line)); }
:root[data-theme="dark"] .pat-callout--watch{ background:color-mix(in srgb, var(--amber-500) 10%, var(--mix-base)); }
:root[data-theme="dark"] .pat-callout--watch .k{ color:var(--amber-600); }
:root[data-theme="dark"] .tier-core{ background:color-mix(in srgb, var(--rose-500) 16%, var(--mix-base)); color:var(--rose-500); }
:root[data-theme="dark"] .tier-key{ background:color-mix(in srgb, var(--amber-500) 18%, var(--mix-base)); color:var(--amber-600); }
:root[data-theme="dark"] .cst-lock__card, :root[data-theme="dark"] .trial-lock__card{ background:rgba(24,35,47,.96); }
:root[data-theme="dark"] .conn-tile.sel{ background:#2a3746; border-color:#2a3746; }

/* ---- FONT LAW clamps (2026-08-25, owner-approved): the Thai faces ship real 400
   and 700 ONLY. Declarations above 700 forced the browser to fake the weight,
   smearing Thai loops and tone marks (the arcade sighting). Clamp every audited
   >700 Thai surface to the real bold; 500-600 declarations already resolve to the
   real 700 face and are left alone. Appended last so it wins the cascade. */
.tone-row .mark{ font-weight:700; }
.cthai, .winfo .thai, .panic-word .thai, .pcell .thai, .rung .thai, .wcard__thai{ font-weight:700; }
.qx__optv{ font-weight:700; }

/* ---- Consonant Classes redesign (2026-08-25, pending owner approval) -------
   .ccl class cards: tinted banner (class color), strategy tag, tile grid.
   Tiles carry glyph + sound + acrophonic anchor and play audio on tap via the
   global [data-audiosrc] delegate. Tokens only — adapts to dark mode. */
.ccl{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); margin-top:var(--s4); overflow:hidden; }
.ccl-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 16px;
  background:color-mix(in srgb, var(--c) 10%, var(--surface)); border-bottom:1px solid color-mix(in srgb, var(--c) 25%, var(--line)); }
.ccl-head__l{ display:flex; align-items:baseline; gap:10px; min-width:0; }
.ccl-name{ font-weight:800; font-size:var(--fs-lg); color:var(--c); }
.ccl-count{ font-weight:700; font-size:var(--fs-xs); color:var(--ink-500,#5d6b7c); white-space:nowrap; }
.ccl-tag{ flex:none; font-size:10px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:#fff; background:var(--c); padding:4px 10px; border-radius:999px; }
.ccl-gist{ margin:10px 16px 0; font-size:var(--fs-sm); color:var(--ink-500,#5d6b7c); }
.ccl-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(88px,1fr)); gap:8px; padding:10px 16px 14px; }
.ccl-t{ display:flex; flex-direction:column; align-items:center; gap:1px; padding:10px 4px 8px; min-width:0; text-align:center;
  background:color-mix(in srgb, var(--c) 5%, var(--surface)); border:1px solid color-mix(in srgb, var(--c) 22%, var(--line));
  border-radius:12px; cursor:pointer; position:relative; transition:transform .12s ease, box-shadow .12s ease; }
.ccl-t::after{ content:""; position:absolute; inset:-3px; }
.ccl-t:hover{ transform:translateY(-2px); box-shadow:var(--shadow-md); }
.ccl-t__ch{ font-size:34px; font-weight:700; line-height:1.2; color:var(--c); }
.ccl-t__s{ font-weight:800; font-size:12px; color:var(--ink-700,#3c4654); line-height:1.2; }
.ccl-t__a{ font-size:10px; color:var(--ink-400,#8a97a5); line-height:1.3; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media (max-width:560px){
  .ccl-head{ padding:10px 12px; }
  .ccl-gist{ margin:8px 12px 0; font-size:12.5px; }
  .ccl-grid{ grid-template-columns:repeat(auto-fill,minmax(62px,1fr)); gap:6px; padding:8px 10px 10px; }
  .ccl-t{ padding:8px 2px 6px; border-radius:10px; }
  .ccl-t__ch{ font-size:29px; }
  .ccl-t__s{ font-size:11px; }
  .ccl-t__a{ font-size:9px; }
}
