/* Basic Thai lessons 0–5 — shared overrides */
html body .hero h1{font-size:clamp(24px,4.2vw,34px);line-height:1.25}
/* floating vowel under/over a dash: the box draws the dash, the vowel sits on it */
.fv{display:inline-block;position:relative;width:.62em;padding-left:.18em;text-align:center;box-sizing:border-box;text-indent:0}
.fv::before{content:"–";position:absolute;left:0;right:0;text-align:center}
/* balanced grids: no lone card on the last row */
:is(.vowel-grid,.cons-sub-grid,.ld-letters,.keyword-grid,.recog-grid):is(:has(>:last-child:nth-child(3)),:has(>:last-child:nth-child(9))){grid-template-columns:repeat(3,minmax(0,1fr))}
.review-row.cons-mid-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
@media(min-width:601px){:is(.vowel-grid,.ld-letters,.keyword-grid,.recog-grid):has(>:last-child:nth-child(6)){grid-template-columns:repeat(3,minmax(0,1fr))}}
.ld-letters:has(>:last-child:nth-child(5)){grid-template-columns:repeat(5,minmax(0,1fr))}
@media(min-width:700px){.recog-grid:has(>:last-child:nth-child(10)){grid-template-columns:repeat(5,minmax(0,1fr))}}
@media(min-width:700px){
 .keyword-grid:has(>:last-child:nth-child(5)){grid-template-columns:repeat(5,minmax(0,1fr))}
 .hc-grid:has(>:last-child:nth-child(13)){display:flex;flex-wrap:wrap;justify-content:center}
 .hc-grid:has(>:last-child:nth-child(13))>*{flex:0 0 calc((100% - 48px)/5)}
}
@media(max-width:600px){
 :is(.vowel-grid,.hc-grid,.tone-grid):is(:has(>:last-child:nth-child(5)),:has(>:last-child:nth-child(7)),:has(>:last-child:nth-child(13)))>:last-child{grid-column:1/-1;justify-self:center;width:calc(50% - 6px)}
 :is(.sy-grid,.try-grid):is(:has(>:last-child:nth-child(4)),:has(>:last-child:nth-child(5)),:has(>:last-child:nth-child(7))){display:flex;flex-wrap:wrap;justify-content:center}
 :is(.sy-grid,.try-grid):is(:has(>:last-child:nth-child(4)),:has(>:last-child:nth-child(5)),:has(>:last-child:nth-child(7)))>*{flex:0 0 calc((100% - 20px)/3)}
}
/* tone label under a syllable (shared L3–L5) */
.tone-tag{display:inline-block;font-family:var(--font-en);font-size:13px;color:var(--gold);background:var(--gold-glow);border-radius:6px;padding:1px 8px;margin-top:4px}
body.lang-cn .tone-tag span{font-family:var(--font-cn)}
.cell-tone{margin-top:2px}
/* L3 diphthongs: same sizes as the L2 vowel lessons */
html body .diph-box-form,html body .diph-cv-row .cvitem .cvth{font-size:44px;line-height:1.3}
html body .diph-box-rom,html body .diph-box-decomp,html body .diph-cv-row .cvitem .cvrom{font-size:16px}
html body .diph-cv-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
html body .diph-cv-row .cvitem{width:auto;padding:14px}
html body .diph-card .cell-en{font-size:14px}
/* L3 letter cards: columns line up top and bottom */
.cons-cols.even .cons-sub-grid{align-content:stretch;height:100%}
.cons-cols.even>div{display:flex;flex-direction:column}
/* main vocabulary word: dark box, white text (same colour as the tone-rule band) */
html body .vocab-head.hl{background:var(--gold);border-radius:10px;padding:8px 16px;align-items:center;margin-bottom:14px}
html body .vocab-head.hl .vocab-word,html body .vocab-head.hl .vocab-mean,html body .vocab-head.hl .vocab-mean span{color:#fff}
html body .vocab-head.hl .play-pause{background:#fff;color:var(--gold)}
.class-card:has(.fs-cell){display:flex;flex-direction:column}
.class-card:has(.fs-cell) .ld-letters{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
.class-card:has(.fs-cell) .ld-chip{width:48px}
.class-card .fs-cell{margin-top:auto;padding-top:12px}
.class-card:has(.fs-cell) .ld-letters{margin-bottom:12px}
/* Apple (Safari / iPhone): Google's Sarabun keeps NBSP and Thai marks in two separate font files,
   so Safari draws a dotted circle. Use one system Thai font for the NBSP + mark pair. */
/* 3 boxes in a narrow card column: 2 on top, 1 full width below */
.cons-sub-grid.trio.trio{grid-template-columns:repeat(2,minmax(0,1fr))}
.cons-sub-grid.trio>:last-child{grid-column:1/-1}
.tr-box small b{font-weight:700}
html body .tr-box small b{white-space:nowrap}
/* L7 rule layouts */
html body .rule-box{background:var(--bg-card);border:1px solid var(--gold-line);border-radius:14px;padding:20px 22px;margin-top:16px;box-shadow:0 1px 3px rgba(0,0,0,.04)}
html body .rule-formula{display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap;margin:0}
html body .rule-formula+.rule-formula{margin-top:16px}
html body .rule-formula .ld-letters{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin:0}
html body .rule-formula .ld-chip{min-width:54px;padding:8px 12px;background:var(--gold);border-color:var(--gold);color:#fff;font-weight:400}
html body .rule-plus{font-family:var(--font-en);font-size:22px;font-weight:700;color:var(--gold)}
html body .rule-word{font-family:var(--font-en);font-size:16px;font-weight:700;color:var(--gold);background:var(--gold-glow);border:1.5px solid var(--gold);border-radius:9px;padding:9px 16px}
body.lang-cn .rule-word span{font-family:var(--font-cn)}
html body .cell-say{font-family:var(--font-th);font-size:14px;color:var(--gold-dim);margin-top:2px}
html body .cons-sub-grid.five{margin-top:16px;grid-template-columns:repeat(5,minmax(0,1fr))}
html body .cons-sub-grid.pair6{margin-top:16px;grid-template-columns:repeat(6,minmax(0,1fr))}
@media(max-width:600px){html body .cons-sub-grid.five{grid-template-columns:repeat(2,minmax(0,1fr))}
 html body .cons-sub-grid.pair6{grid-template-columns:repeat(2,minmax(0,1fr))}
 html body .cons-sub-grid.five>:last-child:nth-child(odd){grid-column:1/-1;justify-self:center;width:calc(50% - 5px)}}
html body .story-para-row{display:flex;align-items:flex-start;gap:12px;margin-top:14px}
html body .story-para-row .story-para{flex:1}
/* L7: silent-leader formulas lined up in a grid; all boxes the same size */
html body .rule-pairs{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:14px 16px;max-width:430px;margin:0 auto}
html body .rule-pairs .rule-formula,html body .rule-pairs .rule-formula .ld-letters{display:contents}
html body .rule-pairs .ld-chip,html body .rule-pairs .rule-word{width:100%;box-sizing:border-box;min-height:56px;margin:0;display:flex;align-items:center;justify-content:center;text-align:center}
html body .rule-word.thb{font-family:var(--font-th);font-size:24px;font-weight:400;line-height:1.3}
html body .cons-sub-grid.four-words{margin-top:10px;grid-template-columns:repeat(4,minmax(0,1fr))}
@media(max-width:600px){html body .cons-sub-grid.four-words{grid-template-columns:repeat(2,minmax(0,1fr))}}
html body .cell-mean{font-family:var(--font-en);font-size:13px;color:var(--ivory-sub);margin-top:3px;line-height:1.35}
body.lang-cn .cell-mean span{font-family:var(--font-cn)}
/* L8: reading-rule formula (A = B), symbol cards, pattern cards */
html body .rule-box .rule-formula .ld-chip{min-width:72px}
html body .vocab-head.hl .vocab-word .cell-say{color:#fff;opacity:.85;font-weight:400}
html body .qa-line{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
html body .qa-line+.qa-line{margin-top:10px}
html body .yt-prompt br{line-height:1.9}
html body .cons-sub-grid.three{margin-top:10px;grid-template-columns:repeat(3,minmax(0,1fr))}
html body .cons-sub-grid.one{margin-top:10px;grid-template-columns:minmax(0,255px);justify-content:center}
@media(max-width:600px){html body .cons-sub-grid.three{grid-template-columns:repeat(2,minmax(0,1fr))}}
html body .vocab-head.hl.sym .vocab-word{font-size:34px;line-height:1.15;min-width:64px;text-align:center}
html body .vocab-head.hl.sym .fv{width:1em}
/* L8: collapsible sentence-pattern cards */
html body details.pat{padding-bottom:0}
html body details.pat>summary{list-style:none;cursor:pointer;margin-bottom:0}
html body details.pat>summary::-webkit-details-marker{display:none}
html body details.pat[open]>summary{margin-bottom:14px}
html body details.pat .pat-arrow{margin-left:auto;width:9px;height:9px;border-right:2px solid #fff;border-bottom:2px solid #fff;transform:rotate(45deg);transition:transform .2s;flex:none}
html body details.pat[open] .pat-arrow{transform:rotate(-135deg)}
html body details.pat>.yt-item:last-child{border-bottom:0;padding-bottom:4px}
/* L7-L8 overall tone chart: By default on top, class-specific boxes stacked below */
html body .tr-overall .tr-col .tr-res{grid-template-columns:minmax(0,1fr)}
html body .tr-overall .tr-box small b{font-weight:700;color:inherit}

/* Thai combining marks shown on their own (–ิ, ไม้เอก …): one self-hosted font that
   contains BOTH the no-break space and the Thai marks, so the browser never splits the
   pair across two fonts and no dotted circle (U+25CC) can be inserted — this subset has
   no U+25CC glyph at all. Sarabun, SIL Open Font License. (Kru Toeii, 2026-11-23) */
@font-face{font-family:'SarabunTH';font-style:normal;font-weight:300;font-display:swap;src:url(fonts/sarabun-th-300.woff2) format('woff2')}
@font-face{font-family:'SarabunTH';font-style:normal;font-weight:400;font-display:swap;src:url(fonts/sarabun-th-400.woff2) format('woff2')}
@font-face{font-family:'SarabunTH';font-style:normal;font-weight:600;font-display:swap;src:url(fonts/sarabun-th-600.woff2) format('woff2')}
html body .fv,html body .tm,html body .tr-mark,html body .ld-table .ld-chip{font-family:'SarabunTH','Sarabun',sans-serif}
