/* Companion website: same soft look as the cards. */
@font-face { font-family: "SarabunTH"; src: url("Sarabun-Regular.ttf"); font-weight: 400; unicode-range: U+0E00-0E7F; font-display: swap; }
@font-face { font-family: "SarabunTH"; src: url("Sarabun-Medium.ttf"); font-weight: 500 700; unicode-range: U+0E00-0E7F; font-display: swap; }
@font-face { font-family: "NotoSansLatin"; src: url("NotoSans.ttf"); font-weight: 100 900; font-display: swap; }
:root { --ink: #1d1d1f; --soft: #66645f; --rule: #e3dfd6; --paper: #fffdf8; --bg: #f4f1ea; --pair: #f3f1ec; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 "SarabunTH", "NotoSansLatin", system-ui, sans-serif; }
[lang="th"] { line-height: 1.6; }
a { color: inherit; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--paper); border-bottom: 1px solid var(--rule); }
.brand { font-weight: 600; text-decoration: none; }
.nav { font-size: 14px; color: var(--soft); text-decoration: none; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
footer { max-width: 720px; margin: 24px auto; padding: 0 16px; font-size: 13px; color: var(--soft); }
h1 { font-weight: 600; font-size: 26px; margin: 8px 0; }
h2 { font-weight: 600; font-size: 18px; margin: 20px 0 8px; }
.lead { color: var(--soft); }
#q { width: 100%; padding: 12px 14px; font: inherit; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); }

/* index */
.topic h2 { border-left: 4px solid var(--topic); padding-left: 8px; }
.topic ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.topic a { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--paper); text-decoration: none; border: 1px solid var(--rule); }
.topic a span:last-child { color: var(--soft); }

/* card page */
.card { background: var(--paper); border-radius: 18px; border-top: 6px solid color-mix(in srgb, var(--topic) 72%, var(--paper)); padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.meta { display: flex; justify-content: space-between; color: var(--soft); font-size: 14px; }
.side { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.side:last-of-type { border-bottom: 0; }
.lab { font-size: 13px; color: var(--soft); font-weight: 600; margin: 0 0 4px; }
.hw-th, .hw-en { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; font-size: 34px; font-weight: 500; line-height: 1.4; }
.rom, .pron { font-size: 18px; font-weight: 400; }
.pron b { text-decoration: underline; }
.exrow { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.g { color: #9a968d; font-size: 18px; width: 18px; }
.il { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.w { display: inline-flex; flex-direction: column; padding: 2px 8px 4px; border-radius: 10px; }
.wt { font-size: 19px; } .wr { font-size: 14px; color: var(--soft); }
.w sup { font-size: 11px; margin-left: 3px; color: #8f8b82; }
.box.plain { background: var(--pair); }
.t1.box { background: #f7efe2; } .t2.box { background: #e6eef4; } .t3.box { background: #e8f1e5; }
.t4.box { background: #f5e8e9; } .t5.box { background: #eeebf4; } .t6.box { background: #e3f1ef; }
.tip { color: var(--soft); font-size: 15px; }
.reg { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 12px; border-radius: 12px; background: var(--reg-tint); color: var(--reg); font-size: 15px; }
.reg b { width: 100%; font-size: 13px; }
.reg em { font-style: normal; font-size: 13px; opacity: .8; }
.voice-note { font-size: 13px; color: var(--soft); margin: 8px 0 0; }

/* tone colours (Central Thai only) */
.tM { color: var(--tone-M); } .tL { color: var(--tone-L); } .tF { color: var(--tone-F); } .tH { color: var(--tone-H); } .tR { color: var(--tone-R); }

/* play buttons: dark = real recording, grey = device voice */
.play { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 8px; background: var(--ink); color: #fff; cursor: pointer; font: 600 13px "NotoSansLatin", sans-serif; flex: none; }
.play.tts { background: #b7b2a8; }
.play svg { width: 20px; height: 20px; fill: currentColor; }
.play svg .w { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.play.on { outline: 3px solid color-mix(in srgb, var(--topic, #888) 50%, transparent); }
table.tones { border-collapse: collapse; } table.tones td { padding: 6px 10px; border-bottom: 1px solid var(--rule); }

/* ---- card page v2: flags, fork example with lines ---- */
.card { border-top: 0; }
.fl { display: inline-flex; margin-right: 8px; vertical-align: middle; }
.fl .flag { width: 22px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }
.words2 { display: grid; gap: 6px; margin: 10px 0 4px; }
.lang-block { display: flex; align-items: center; }
.hw { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 30px; font-weight: 500; line-height: 1.35; }
.hw.en { font-family: "NotoSansLatin", sans-serif; font-size: 26px; }
.gb { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: #efedea; color: #3f3d39; font: 600 18px/1 system-ui, sans-serif; }
.gb.none { background: transparent; }
.lab { margin-top: 14px; }
.fork { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px 6px; }
.fork-in { position: relative; display: inline-flex; flex-direction: column; gap: 26px; min-width: 100%; }
.frow { display: flex; align-items: center; gap: 8px; position: relative; z-index: 1; }
.words { display: flex; gap: 6px; flex-wrap: nowrap; }
.frow .w { position: relative; white-space: nowrap; }
.frow .w sup { position: absolute; right: 5px; top: 2px; }
.frow .w.box { padding-right: 16px; }
.frow .wt { font-size: 21px; } .frow.en .wt { font-family: "NotoSansLatin", sans-serif; font-size: 18px; }
.frow .pp { display: block; font-size: 16px; } .frow .pp .wr { font-size: 13px; } .pp .g { font-style: normal; color: #6b6964; margin-right: 4px; }
.pol { font-size: 11px; color: #9a968d; }
.links { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 0; }
.links path { fill: none; stroke-width: 2.2; stroke-linecap: round; opacity: .85; }
.reg span { display: inline-flex; align-items: center; gap: 4px; }
.reg .fl { margin-right: 2px; } .reg .fl .flag { width: 16px; height: 11px; }

/* ---- landing page ---- */
.landing main { max-width: 820px; }
.hero { text-align: center; padding: 28px 0 8px; }
.hero h1 { font-size: clamp(30px, 7vw, 46px); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 14px; }
.hero h1 em { font-style: normal; color: #6f8fa8; }
.hero .sub { max-width: 560px; margin: 0 auto 10px; color: var(--soft); font-size: 18px; }
.soon { display: inline-block; margin: 10px 0 22px; padding: 6px 14px; border-radius: 999px; background: #f7efe2; color: #8a6a3a; font-weight: 600; font-size: 14px; }
.hero-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }
.hero-cards img { width: 100%; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.08); background: #fff; }
.hero-cards img:nth-child(1) { transform: rotate(-1.5deg); } .hero-cards img:nth-child(2) { transform: rotate(1.5deg); }
@media (max-width: 560px) { .hero-cards { grid-template-columns: 1fr; } }
.how, .who { background: var(--paper); border-radius: 18px; padding: 18px 20px; margin: 22px 0; border: 1px solid var(--rule); }
.how ol { padding-left: 20px; margin: 0; } .how li { margin: 8px 0; }
.feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.feat { background: var(--paper); border: 1px solid var(--rule); border-radius: 16px; padding: 16px; }
.feat .fi { width: 40px; height: 40px; border-radius: 12px; background: #e6eef4; display: flex; align-items: center; justify-content: center; font-weight: 600; color: #4d6a82; margin-bottom: 8px; }
.feat:nth-child(2) .fi { background: #e8f1e5; color: #5b7a5d; } .feat:nth-child(3) .fi { background: #f5e8e9; color: #94606a; } .feat:nth-child(4) .fi { background: var(--reg-tint); color: var(--reg); }
.feat h3 { margin: 0 0 4px; font-size: 16px; } .feat h3 span { display: block; font-weight: 400; color: var(--soft); font-size: 14px; }
.feat p { margin: 0; color: var(--soft); font-size: 15px; }
footer { text-align: center; }
.frow .play { padding: 6px; } .frow .play svg { width: 18px; height: 18px; }

/* ---- v3: example grouped by language, smaller boxes, regional audio, mobile-first landing ---- */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
.fork-in { gap: 0; }
.exb { display: grid; grid-template-columns: 26px 1fr; column-gap: 6px; row-gap: 6px; align-items: center; position: relative; z-index: 1; }
.exb-flag { grid-row: 1 / span 2; align-self: start; padding-top: 10px; }
.exb-flag .fl { margin: 0; } .exb-flag .flag { width: 22px; height: 15px; }
.exb.en { margin-top: 30px; }
.exb .frow { grid-column: 2; }
.frow { gap: 6px; }
.frow .w { padding: 2px 14px 3px 7px; border-radius: 9px; }
.frow .wt { font-size: 17px; } .frow.en .wt { font-size: 15px; }
.frow .wr { font-size: 12px; } .frow .pp { font-size: 14px; } .frow .pp .wr { font-size: 11px; }
.frow .w sup { font-size: 10px; right: 4px; }
.frow .gb { width: 24px; height: 24px; font-size: 14px; }
.frow .play { padding: 5px; } .frow .play svg { width: 16px; height: 16px; }
.words { gap: 5px; }
.hw { font-size: 26px; } .hw.en { font-size: 22px; } .rom, .pron { font-size: 16px; }
.reg { display: block; }
.reg > b { display: block; margin-bottom: 6px; }
.rg-block { display: grid; grid-template-columns: 26px 1fr; gap: 6px; margin-top: 6px; }
.ri { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 3px 0; }
.ri em { font-style: normal; font-size: 12px; opacity: .8; min-width: 70px; }
.ri i { font-style: normal; font-size: 13px; }
.ri .play { padding: 5px; } .ri .play svg { width: 15px; height: 15px; }
.gb.sm { width: 20px; height: 20px; font-size: 12px; }
/* landing: small fanned cards, compact text on phones */
.hero-cards { display: flex; justify-content: center; gap: 0; margin: 4px auto 0; max-width: 560px; }
.hero-cards img { width: 52%; max-width: 280px; }
.hero-cards img:nth-child(1) { transform: rotate(-4deg) translateX(6%); z-index: 1; }
.hero-cards img:nth-child(2) { transform: rotate(3deg) translate(-6%, 10%); }
@media (max-width: 560px) {
  .hero { padding-top: 14px; }
  .hero h1 { font-size: 30px; }
  .hero .sub { font-size: 16px; }
  .hero-cards { display: flex; }
  .hero-cards img { width: 56%; }
  .how, .who { padding: 14px 16px; }
  .feats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .feat { padding: 12px; } .feat p { font-size: 14px; }
}
/* regional rows: [♂/♀] [play] [label over word + pronunciation] */
.ri { display: grid; grid-template-columns: 22px 30px 1fr; align-items: center; gap: 6px; flex-wrap: nowrap; }
.rt { display: flex; flex-direction: column; line-height: 1.3; }
.rt em { font-size: 11px; min-width: 0; }
.rt > span { font-size: 17px; } .rt b { font-weight: 600; }
/* landing cards: keep the fanned pair inside the screen */
.hero-cards { padding: 0 6%; }
.hero-cards img:nth-child(1) { transform: rotate(-3deg) translateX(4%); }
.hero-cards img:nth-child(2) { transform: rotate(3deg) translate(-4%, 8%); }
@media (max-width: 560px) { .hero-cards { padding: 0 4% 18px; } .hero-cards img { width: 50%; } }
.ri { justify-items: start; text-align: left; }
.ri .play { justify-self: start; }
.rt { align-items: flex-start; text-align: left; }
.rt > span, .rt i { white-space: nowrap; }
.reg .rt { display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
.reg .rt > span { display: block; }
.reg .rt span[lang="th"], .reg .rt i { display: inline; }
/* tip pairs and tones page */
.tp { display: inline-flex; align-items: center; gap: 5px; margin: 2px 6px 2px 0; }
.tp .play { padding: 5px; } .tp .play svg { width: 15px; height: 15px; }
.tlist { display: grid; gap: 10px; margin: 14px 0; }
.trow2 { display: grid; grid-template-columns: 8px 40px 1fr; align-items: center; gap: 10px; }
.trow2 .tb { width: 8px; height: 40px; border-radius: 4px; }
.bM { background: var(--tone-M); } .bL { background: var(--tone-L); } .bF { background: var(--tone-F); } .bH { background: var(--tone-H); } .bR { background: var(--tone-R); }
.tth2 { font-size: 22px; } .tone-how { color: var(--soft); font-size: 15px; }

:root{--tone-M:#3B3B3B;--tone-L:#0D3E9A;--tone-F:#CA2015;--tone-H:#26856C;--tone-R:#7B6FA0;--reg:#A86B00;--reg-tint:#FBF3E2}
