:root{
  --wine:#6f1835;--rose:#c84870;--rose-soft:#f5b5c9;--cream:#fff8f2;--paper:#fffdf9;
  --ink:#3a1e2a;--muted:#765864;--line:rgba(111,24,53,.16);--gold:#d49a4a;--leaf:#5f7c54;
  --shadow:0 22px 60px rgba(77,24,45,.16);--radius:24px;
}
*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;font-family:Inter,"Noto Sans Thai",Tahoma,system-ui,sans-serif;color:var(--ink);background:
radial-gradient(circle at 12% 4%,rgba(245,181,201,.42),transparent 27%),
radial-gradient(circle at 88% 12%,rgba(212,154,74,.18),transparent 24%),
linear-gradient(180deg,#fff7f7,#fffaf4 42%,#f8f0e7);line-height:1.65;min-height:100vh}a{color:inherit}button,input{font:inherit}.eyebrow{text-transform:uppercase;letter-spacing:.15em;font-size:.75rem;font-weight:900;color:var(--rose);margin:0 0 .5rem}.thai-lead{font-size:1.05rem;color:#6b4b58}.thai-copy{color:var(--muted)}
.floating-hearts{position:fixed;inset:0;pointer-events:none;overflow:hidden;z-index:-1}.floating-hearts span{position:absolute;color:rgba(200,72,112,.12);font-size:4rem;animation:floatHeart 15s ease-in-out infinite}.floating-hearts span:nth-child(1){left:4%;top:30%}.floating-hearts span:nth-child(2){right:7%;top:55%;animation-delay:-5s}.floating-hearts span:nth-child(3){left:45%;top:82%;animation-delay:-9s}@keyframes floatHeart{50%{transform:translateY(-24px) rotate(7deg)}}
.mark-topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:20px;justify-content:space-between;padding:14px clamp(18px,4vw,48px);background:rgba(255,250,246,.9);backdrop-filter:blur(18px);border-bottom:1px solid var(--line)}.private-brand{text-decoration:none;font-weight:950;letter-spacing:-.02em}.private-brand span{color:var(--rose);font-size:1.25rem}.mark-topbar nav{display:flex;gap:8px;flex-wrap:wrap}.mark-topbar nav a{text-decoration:none;padding:8px 12px;border-radius:999px;font-size:.9rem;font-weight:800}.mark-topbar nav a:hover{background:#fff0f4;color:var(--wine)}
.mark-shell{width:min(1180px,calc(100% - 28px));margin:30px auto 72px}.course-hero,.lesson-hero{position:relative;overflow:hidden;border:1px solid rgba(111,24,53,.15);border-radius:32px;background:linear-gradient(135deg,rgba(255,253,249,.98),rgba(255,232,238,.92));box-shadow:var(--shadow)}.course-hero{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(250px,.65fr);gap:34px;padding:clamp(28px,5vw,62px)}.course-hero:after,.lesson-hero:after{content:"";position:absolute;right:-70px;bottom:-110px;width:280px;height:280px;border-radius:50%;background:radial-gradient(circle,rgba(200,72,112,.18),transparent 65%)}.hero-copy{position:relative;z-index:1}.course-hero h1{font-family:Georgia,"Times New Roman",serif;font-size:clamp(2.5rem,6vw,5.1rem);line-height:1.02;letter-spacing:-.055em;margin:.2rem 0 1.2rem;max-width:850px}.course-hero h1 span{color:var(--wine)}.hero-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:24px}.hero-emblem{min-height:300px;display:grid;place-items:center;align-content:center;border-radius:26px;background:linear-gradient(160deg,var(--wine),#9c2e55);color:white;box-shadow:inset 0 0 0 1px #ffffff25,0 20px 50px #6f18353a;transform:rotate(1.5deg);position:relative;z-index:1}.big-heart{font-size:7rem;line-height:1;text-shadow:0 15px 30px #3b0b1c80}.rice-line{letter-spacing:.3em;margin-top:6px}.hero-emblem small{font-weight:900;letter-spacing:.18em;margin-top:18px}.love-button,.soft-button,.complete-button{border:0;border-radius:14px;padding:12px 17px;font-weight:900;cursor:pointer;transition:.18s transform,.18s box-shadow}.love-button,.complete-button{background:linear-gradient(135deg,var(--wine),var(--rose));color:white;box-shadow:0 12px 24px rgba(111,24,53,.2)}.soft-button{background:#fff;border:1px solid var(--line);color:var(--wine)}.love-button:hover,.soft-button:hover,.complete-button:hover{transform:translateY(-2px)}.link-button{text-decoration:none;display:inline-flex;align-items:center}
.personal-greeting{display:grid;grid-template-columns:1fr auto;align-items:center;gap:24px;margin:24px 0;padding:26px 30px;border-radius:var(--radius);background:linear-gradient(120deg,#fff,#fff7ee);border:1px solid var(--line)}.personal-greeting h2{font-family:Georgia,serif;font-size:2rem;margin:.1rem 0}.progress-ring{width:118px;height:118px;border-radius:50%;display:grid;place-items:center;align-content:center;background:conic-gradient(var(--rose) var(--progress,0%),#f3dde4 0);position:relative}.progress-ring:before{content:"";position:absolute;inset:10px;background:var(--paper);border-radius:50%}.progress-ring strong,.progress-ring span{position:relative;z-index:1}.progress-ring strong{font-size:1.5rem}.progress-ring span{font-size:.7rem;text-transform:uppercase;letter-spacing:.1em}
.journey-section{margin-top:40px}.section-heading{display:grid;grid-template-columns:1fr minmax(280px,480px);gap:30px;align-items:end;margin-bottom:18px}.section-heading h2{font-family:Georgia,serif;font-size:clamp(2rem,4vw,3.2rem);margin:.1rem 0}.lesson-card-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(235px,1fr));gap:15px}.journey-card{position:relative;text-decoration:none;padding:20px;border-radius:20px;background:rgba(255,253,249,.94);border:1px solid var(--line);box-shadow:0 10px 25px rgba(77,24,45,.07);transition:.18s transform,.18s border-color}.journey-card:hover{transform:translateY(-5px);border-color:var(--rose)}.card-number{font-size:.7rem;text-transform:uppercase;letter-spacing:.13em;font-weight:900;color:var(--rose)}.card-icon{display:block;font-size:2.2rem;margin:10px 0}.journey-card h3{font-family:Georgia,serif;margin:.2rem 0;font-size:1.25rem}.journey-card p{margin:.25rem 0;color:var(--muted)}.journey-card small{display:block;margin-top:12px;padding-top:12px;border-top:1px dashed var(--line);color:#674554}.completion-mark{display:none;position:absolute;top:14px;right:14px;width:28px;height:28px;border-radius:50%;place-items:center;background:#6f8c62;color:white;font-weight:900}.journey-card.is-complete{border-color:#6f8c62;background:#fbfff8}.journey-card.is-complete .completion-mark{display:grid}.promise-section{text-align:center;margin:44px 0 0;padding:clamp(28px,5vw,54px);border-radius:30px;background:linear-gradient(135deg,#4c1028,#8d2d50);color:white;box-shadow:var(--shadow)}.promise-section blockquote{font-family:Georgia,serif;font-size:clamp(1.7rem,4vw,3.1rem);line-height:1.25;margin:12px auto;max-width:900px}.promise-section .pronunciation{color:#ffdce7}.promise-section .soft-button{margin-top:12px}
.lesson-hero{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:24px;align-items:center;padding:clamp(24px,4vw,42px)}.lesson-icon{width:96px;height:96px;display:grid;place-items:center;border-radius:26px;background:#fff;box-shadow:0 14px 30px rgba(111,24,53,.14);font-size:3rem}.lesson-hero h1{font-family:Georgia,serif;font-size:clamp(2.2rem,5vw,4.2rem);line-height:1.04;margin:.2rem 0}.lesson-hero h2{font-size:1.2rem;color:var(--wine);margin:.4rem 0}.complete-button{position:relative;z-index:1;white-space:nowrap}.complete-button.is-complete{background:linear-gradient(135deg,#56734b,#789a69)}.source-merge{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:18px 0}.source-merge article{padding:16px 18px;border-radius:16px;background:#fff;border:1px solid var(--line)}.source-merge span{display:block;font-size:.72rem;text-transform:uppercase;letter-spacing:.1em;color:var(--rose);font-weight:900;margin-bottom:5px}.source-merge strong{font-size:.92rem}.lesson-grid{display:grid;grid-template-columns:minmax(0,1fr) 285px;gap:20px}.content-card,.aside-card{padding:clamp(20px,3vw,30px);border-radius:var(--radius);background:rgba(255,253,249,.96);border:1px solid var(--line);box-shadow:0 12px 30px rgba(77,24,45,.07);margin-bottom:18px}.content-card h2,.aside-card h2{font-family:Georgia,serif;margin:.15rem 0 1rem}.objective-list{display:grid;gap:8px;padding-left:22px}.vocabulary-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}.word-card,.sentence-card,.dialogue-card{border:1px solid var(--line);border-radius:16px;padding:15px;background:linear-gradient(180deg,#fff,#fff8f6)}.english-audio-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:start}.english-audio-row strong{font-size:1.08rem}.speak-button{border:1px solid var(--line);background:#fff;border-radius:11px;width:40px;height:40px;cursor:pointer}.speak-button.is-speaking{animation:pulse .7s ease-in-out infinite alternate}@keyframes pulse{to{transform:scale(1.09);box-shadow:0 0 0 5px rgba(200,72,112,.13)}}.pronunciation,.translation{margin:.45rem 0 0}.pronunciation{color:#8c3154}.translation{color:var(--muted)}.pronunciation span,.translation span{font-weight:900}.grammar-card{background:linear-gradient(135deg,#fff6e5,#fffdf9);border-color:rgba(212,154,74,.35)}.sentence-stack,.dialogue-stack{display:grid;gap:12px}.speaker{display:inline-flex;margin-bottom:8px;padding:4px 9px;border-radius:999px;background:#f7dbe5;color:var(--wine);font-size:.72rem;font-weight:950;text-transform:uppercase;letter-spacing:.1em}.dialogue-card:nth-child(even){margin-left:32px;background:linear-gradient(180deg,#fffdf8,#fff4e7)}.quiz-question{border:0;padding:18px 0;margin:0;border-bottom:1px solid var(--line)}.quiz-question legend{font-weight:900;margin-bottom:10px}.quiz-question legend span{color:var(--rose)}.quiz-question label{display:block;margin:8px 0;padding:10px 12px;border-radius:12px;background:#fff7f8;cursor:pointer}.quiz-question label:has(input:checked){outline:2px solid rgba(200,72,112,.35)}.question-feedback,.quiz-result,.builder-feedback{font-weight:800}.question-feedback.ok,.quiz-result.ok,.builder-feedback.ok{color:#56734b}.question-feedback.bad,.quiz-result.bad,.builder-feedback.bad{color:#a3264e}.quiz-card .love-button{margin-top:18px}.builder-answer{min-height:58px;padding:12px;border:2px dashed rgba(111,24,53,.22);border-radius:14px;background:#fff;display:flex;gap:7px;flex-wrap:wrap;align-items:center}.builder-answer button,.word-bank button{border:1px solid var(--line);background:#fff;border-radius:11px;padding:8px 11px;cursor:pointer;font-weight:800}.word-bank{display:flex;gap:8px;flex-wrap:wrap;margin:13px 0}.word-bank button.is-used{opacity:.35;pointer-events:none}.builder-actions{display:flex;gap:8px;flex-wrap:wrap}.speaking-card{background:linear-gradient(135deg,#fff0f5,#fffdf9)}.speaking-card ol{display:grid;gap:10px}.lesson-aside{align-self:start;position:sticky;top:92px}.love-note{background:linear-gradient(160deg,#6f1835,#9f375d);color:white}.love-note .eyebrow{color:#ffd0df}.love-note p[lang="th"]{color:#ffeaf1}.mini-progress strong{display:block;font-size:1.3rem}.progress-track{height:10px;border-radius:999px;background:#f0dce3;overflow:hidden;margin:12px 0}.progress-track span{display:block;height:100%;width:var(--progress,0%);background:linear-gradient(90deg,var(--wine),var(--rose));border-radius:inherit}.lesson-navigation{display:flex;justify-content:space-between;gap:12px;margin-top:24px}.lesson-navigation a{text-decoration:none;font-weight:900;padding:12px 16px;border-radius:14px;background:#fff;border:1px solid var(--line)}.lesson-navigation .next{background:var(--wine);color:white}
.mark-footer{text-align:center;padding:24px 18px 38px;color:var(--muted)}.mark-footer p{margin:0}.mark-footer span{display:block}
.mark-login-page{display:grid;place-items:center;padding:22px}.love-gate{width:min(620px,100%)}.gate-card{position:relative;text-align:center;padding:clamp(28px,6vw,56px);border-radius:32px;background:rgba(255,253,249,.96);border:1px solid var(--line);box-shadow:var(--shadow)}.heart-seal{width:92px;height:92px;margin:-82px auto 18px;display:grid;place-items:center;border-radius:50%;background:linear-gradient(135deg,var(--wine),var(--rose));color:white;font-size:3.2rem;box-shadow:0 15px 35px rgba(111,24,53,.28)}.gate-card h1{font-family:Georgia,serif;font-size:clamp(2.4rem,7vw,4.4rem);line-height:1;margin:.3rem 0}.gate-form{text-align:left;display:grid;gap:10px;margin-top:24px}.gate-form label{font-weight:900}.gate-form label span{display:block;font-weight:600;color:var(--muted)}.gate-form input{width:100%;border:1px solid var(--line);border-radius:14px;padding:14px;background:#fff}.gate-form input:focus{outline:3px solid rgba(200,72,112,.18);border-color:var(--rose)}.gate-form button{border:0;border-radius:14px;padding:14px;background:linear-gradient(135deg,var(--wine),var(--rose));color:white;font-weight:950;cursor:pointer}.gate-form button span{display:block;font-weight:600}.gate-note{font-size:.8rem;color:var(--muted);margin-top:20px}.notice{padding:11px 13px;border-radius:12px;background:#fff4d8;border:1px solid #e7c87d}.notice.error{background:#fff0f3;border-color:#efafc2;color:#8b2447}
@media(max-width:900px){.course-hero{grid-template-columns:1fr}.hero-emblem{min-height:220px}.lesson-hero{grid-template-columns:auto 1fr}.complete-button{grid-column:1/-1;width:100%}.source-merge{grid-template-columns:1fr}.lesson-grid{grid-template-columns:1fr}.lesson-aside{position:static}.section-heading{grid-template-columns:1fr}.personal-greeting{grid-template-columns:1fr}.progress-ring{justify-self:start}}
@media(max-width:620px){.mark-topbar{align-items:flex-start}.mark-topbar nav{justify-content:flex-end}.private-brand{max-width:150px}.mark-shell{width:min(100% - 18px,1180px);margin-top:12px}.course-hero,.lesson-hero{border-radius:24px}.course-hero{padding:25px 20px}.course-hero h1{font-size:2.55rem}.lesson-hero{grid-template-columns:1fr;padding:24px 20px}.lesson-icon{width:76px;height:76px}.dialogue-card:nth-child(even){margin-left:0}.content-card,.aside-card{padding:20px;border-radius:20px}.lesson-navigation{flex-direction:column}.lesson-navigation a{text-align:center}.heart-seal{margin-top:-72px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;animation:none!important;transition:none!important}}

/* ===== Learn Thai PWA / mobile experience v2 ===== */
:root{color-scheme:light dark;--safe-bottom:env(safe-area-inset-bottom,0px);--surface:rgba(255,253,249,.96);--surface-soft:#fff7f8;--soil:#9d6645;--leaf-bright:#789a69}
[lang="th"]{line-height:1.8;padding-block:.08em;overflow:visible}.pronunciation{font-weight:400}.pronunciation span{font-weight:500}.translation{font-weight:600}.translation span{font-weight:800}
.love-button,.soft-button,.complete-button,.quiet-button{min-height:48px}.speak-button{width:52px;min-width:52px;height:52px;border-radius:15px;font-size:1.18rem}.quiz-question label{display:flex;align-items:center;gap:10px;min-height:52px;border:1px solid transparent}.quiz-question input{width:20px;height:20px;accent-color:var(--rose)}.builder-answer button,.word-bank button{min-height:48px}
.vocabulary-support{padding-top:4px}
.topbar-install{min-height:44px;padding:8px 12px;border:0;border-radius:999px;color:inherit;background:transparent;font-weight:800;cursor:pointer}.topbar-install:hover{background:#fff0f4;color:var(--wine)}
.rice-progress{display:grid;grid-template-columns:130px minmax(0,1fr);align-items:center;gap:14px}.rice-progress svg{width:130px;max-width:100%;overflow:visible}.rice-soil{fill:var(--soil);opacity:.28}.rice-plant{transform:scaleY(var(--growth,.08));transform-origin:75px 174px;transition:transform .75s cubic-bezier(.22,.75,.24,1)}.rice-stem,.rice-head{fill:none;stroke:var(--leaf);stroke-width:5;stroke-linecap:round}.rice-leaf{fill:var(--leaf-bright);opacity:0;transition:opacity .5s}.rice-grains{fill:var(--gold);opacity:0;transition:opacity .6s}.rice-progress[data-stage="1"] .leaf-1,.rice-progress[data-stage="2"] .leaf-1,.rice-progress[data-stage="3"] .leaf-1,.rice-progress[data-stage="4"] .leaf-1,.rice-progress[data-stage="5"] .leaf-1,.rice-progress[data-stage="6"] .leaf-1{opacity:1}.rice-progress[data-stage="2"] .leaf-2,.rice-progress[data-stage="3"] .leaf-2,.rice-progress[data-stage="4"] .leaf-2,.rice-progress[data-stage="5"] .leaf-2,.rice-progress[data-stage="6"] .leaf-2{opacity:1}.rice-progress[data-stage="3"] .leaf-3,.rice-progress[data-stage="4"] .leaf-3,.rice-progress[data-stage="5"] .leaf-3,.rice-progress[data-stage="6"] .leaf-3{opacity:1}.rice-progress[data-stage="5"] .rice-grains,.rice-progress[data-stage="6"] .rice-grains{opacity:1}.rice-progress-copy{display:grid;gap:2px}.rice-progress-copy strong{color:var(--wine);font-family:Georgia,serif;font-size:2rem}.rice-progress-copy span{font-weight:850}.rice-progress-copy small{color:var(--muted)}.rice-progress.compact{grid-template-columns:92px 1fr}.rice-progress.compact svg{width:92px}.rice-progress.compact .rice-progress-copy strong{font-size:1.4rem}
.personal-greeting{grid-template-columns:1fr minmax(250px,360px)}.mini-progress>a{display:inline-flex;min-height:48px;align-items:center;margin-top:8px;color:var(--wine);font-weight:850}.swipe-hint{margin:12px 0 0;color:var(--muted);font-size:.86rem;text-align:center}.mobile-action-bar{display:none}
.offline-controls{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:8px;margin-top:16px}.quiet-button{border:1px solid var(--line);border-radius:14px;color:var(--muted);background:transparent;cursor:pointer}.connection-status{min-height:32px;padding:5px 10px;border-radius:999px;background:rgba(95,124,84,.12);font-size:.82rem;font-weight:800}.connection-status.is-offline{color:#fff;background:var(--wine)}.offline-privacy-note{margin-top:10px!important;font-size:.78rem}.pwa-toast{position:fixed;z-index:60;right:18px;bottom:calc(18px + var(--safe-bottom));max-width:min(360px,calc(100% - 36px));padding:13px 16px;border-radius:14px;color:#fff;background:#4c1028;box-shadow:var(--shadow);font-weight:800}
@media(max-width:900px){.personal-greeting{grid-template-columns:1fr}}
@media(max-width:700px){body.mark-portal{padding-bottom:calc(78px + var(--safe-bottom))}.mark-topbar{align-items:center;min-height:58px}.mark-topbar nav a:not(:last-child),.mark-topbar nav button{display:none}.mark-topbar nav a:last-child{min-height:44px;padding-inline:10px;font-size:.78rem}.private-brand{max-width:210px;font-size:.9rem}.lesson-navigation{display:none}.swipe-hint{margin-bottom:6px}.vocabulary-grid{grid-template-columns:1fr}.english-audio-row{grid-template-columns:1fr 52px}.pronunciation,.translation{line-height:1.85;padding-block:.12em}.rice-progress{grid-template-columns:100px 1fr}.rice-progress svg{width:100px}.mobile-action-bar{position:fixed;z-index:50;right:10px;bottom:calc(8px + var(--safe-bottom));left:10px;display:grid;grid-template-columns:repeat(3,1fr);gap:6px;padding:7px;border:1px solid var(--line);border-radius:22px;background:rgba(255,253,249,.94);box-shadow:0 14px 40px rgba(57,20,36,.26);backdrop-filter:blur(20px)}.mobile-action-bar a,.mobile-action-bar button{display:grid;place-items:center;align-content:center;min-height:58px;border:0;border-radius:16px;color:var(--wine);background:transparent;font-size:1.2rem;font-weight:900;text-decoration:none;cursor:pointer}.mobile-action-bar span{display:block;font-size:.68rem;line-height:1.2}.mobile-action-bar .primary{color:#fff;background:linear-gradient(135deg,var(--wine),var(--rose))}.mobile-action-bar [data-complete-lesson].is-complete{color:#fff;background:var(--leaf)}.pwa-toast{right:12px;bottom:calc(88px + var(--safe-bottom));left:12px;max-width:none}.mark-footer{padding-bottom:calc(38px + var(--safe-bottom))}}
@media(max-width:430px){.hero-actions>*{width:100%;justify-content:center}.personal-greeting{padding:22px 18px}.rice-progress{grid-template-columns:86px 1fr}.rice-progress svg{width:86px}.rice-progress-copy strong{font-size:1.6rem}}
@media(prefers-color-scheme:dark){:root{--wine:#d982a0;--rose:#e292ad;--rose-soft:#6c3a4b;--cream:#201a1d;--paper:#2a2226;--surface:rgba(42,34,38,.97);--surface-soft:#33272d;--ink:#f4e9ed;--muted:#c9b2bb;--line:rgba(242,187,207,.17);--gold:#d9ae69;--leaf:#91aa83;--leaf-bright:#a5bc96;--soil:#b98767;--shadow:0 22px 60px rgba(0,0,0,.38)}body{background:radial-gradient(circle at 12% 4%,rgba(105,53,72,.34),transparent 28%),radial-gradient(circle at 88% 12%,rgba(128,94,51,.14),transparent 24%),linear-gradient(180deg,#1b1719,#221b1f 52%,#171416)}.mark-topbar{background:rgba(31,25,28,.9)}.course-hero,.lesson-hero{background:linear-gradient(135deg,rgba(42,34,38,.98),rgba(61,35,45,.94))}.course-hero h1 span,.lesson-hero h2,.rice-progress-copy strong{color:#f0a4bc}.personal-greeting{background:linear-gradient(120deg,#2a2226,#302722)}.journey-card,.content-card,.aside-card,.source-merge article,.word-card,.sentence-card,.dialogue-card,.gate-card{background:var(--surface)}.journey-card.is-complete{background:#263025}.grammar-card{background:linear-gradient(135deg,#352d21,var(--surface))}.speaking-card{background:linear-gradient(135deg,#38242d,var(--surface))}.dialogue-card:nth-child(even){background:linear-gradient(180deg,var(--paper),#342a25)}.quiz-question label{background:var(--surface-soft)}.mobile-action-bar{background:rgba(42,34,38,.94)}.pwa-toast{background:#321824}}

/* V3 private-gate input reliability and magic-link status */
.gate-card{isolation:isolate;overflow:visible}
.gate-form,.gate-input-row,.gate-form input,.gate-form button{position:relative;pointer-events:auto}
.gate-input-row{z-index:3}
.gate-form input{
  z-index:3;min-height:56px;color:var(--ink)!important;-webkit-text-fill-color:var(--ink);
  caret-color:var(--rose);opacity:1!important;touch-action:manipulation;user-select:text;
  -webkit-user-select:text;padding:14px 76px 14px 14px;background:var(--paper)!important;
}
.gate-form input:disabled,.gate-form input[readonly]{opacity:1!important}
.code-visibility{
  position:absolute!important;z-index:5!important;right:7px;top:50%;transform:translateY(-50%);
  min-width:60px;min-height:42px;border:1px solid var(--line)!important;border-radius:10px!important;
  padding:7px 10px!important;background:var(--cream)!important;color:var(--wine)!important;
  font-size:.82rem;font-weight:900;cursor:pointer;touch-action:manipulation;
}
.field-help{display:block;color:var(--muted);line-height:1.55;padding-block:.08em}
.magic-link-status{margin:18px 0 0;padding:12px 14px;border-radius:12px;background:#fff4d8;border:1px solid #e7c87d;font-weight:850}
@media(prefers-color-scheme:dark){
  .gate-form input{background:#f8eef1!important;color:#24171c!important;-webkit-text-fill-color:#24171c}
  .code-visibility{background:#382832!important;color:#ffd8e5!important}
  .magic-link-status{background:#3b3122;border-color:#75613d;color:#f7e7c2}
}


/* V4 Thai-first instructional scaffold */
.instruction-english{display:block;margin-top:.22rem;color:var(--muted);font-size:.82em;font-weight:500;letter-spacing:.01em;text-transform:none;line-height:1.55}
.eyebrow .instruction-english{display:inline;margin:0;font-size:.92em;font-weight:700;letter-spacing:.04em}
.objective-list li,.speaking-card li{padding-block:.18rem;line-height:1.8}
.objective-list li .instruction-english,.speaking-card li .instruction-english{margin-top:.12rem}
.scenario-primary{font-size:1.06rem;font-weight:650;margin-bottom:.15rem}.scenario-english{margin:.1rem 0 0}
.teacher-structure{margin:16px 0 22px;border:1px solid var(--line);border-radius:16px;background:rgba(255,253,249,.55)}
.teacher-structure>summary{min-height:48px;display:flex;align-items:center;padding:10px 16px;color:var(--muted);font-weight:800;cursor:pointer;list-style:none}
.teacher-structure>summary::-webkit-details-marker{display:none}.teacher-structure>summary:after{content:'＋';margin-left:auto;color:var(--rose)}.teacher-structure[open]>summary:after{content:'−'}
.teacher-structure .source-merge{margin:0;padding:0 12px 12px}.home-english{font-size:.9rem}
@media(max-width:700px){.instruction-english{font-size:.8em}.eyebrow .instruction-english{display:block;margin-top:.18rem}.teacher-structure .source-merge{padding-inline:8px}}

/* ===== V5 readability and bold sans-serif accessibility upgrade ===== */
:root{
  --font-ui:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans Thai","Leelawadee UI",Thonburi,Tahoma,Arial,sans-serif;
  --text-primary:#28141d;
  --text-secondary:#523541;
  --text-support:#684753;
  --text-pronunciation:#7b2948;
  --panel-solid:#fffdfb;
  --panel-soft:#fff6f8;
  --panel-raised:#ffffff;
  --focus-ring:#9d315b;
  --button-primary-start:#7b1d40;
  --button-primary-end:#bd3f6a;
  --button-primary-text:#ffffff;
}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body,button,input,textarea,select{font-family:var(--font-ui)!important}
body{font-size:17px;line-height:1.75;color:var(--text-primary);font-weight:500;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased}
h1,h2,h3,h4,h5,h6,.course-hero h1,.personal-greeting h2,.section-heading h2,.journey-card h3,.promise-section blockquote,.lesson-hero h1,.content-card h2,.aside-card h2,.gate-card h1,.rice-progress-copy strong{font-family:var(--font-ui)!important;font-weight:850;letter-spacing:-.025em;color:var(--text-primary)}
p,li,dd,dt,label,legend,summary,small{font-family:var(--font-ui)}
p,li{color:var(--text-secondary)}
small{line-height:1.65}
.thai-lead,.thai-copy,.home-english,.instruction-english,.field-help,.gate-note,.swipe-hint,.mark-footer,.offline-privacy-note,.rice-progress-copy small{color:var(--text-support)!important}
.thai-lead{font-size:1.08rem;font-weight:650;line-height:1.85}
[lang="th"],.thai-copy,.translation{line-height:1.88;padding-block:.12em;overflow:visible}
.translation{color:var(--text-secondary)!important;font-size:1rem;font-weight:650}
.pronunciation{color:var(--text-pronunciation)!important;font-size:.98rem;font-weight:550;line-height:1.85}
.pronunciation span,.translation span{font-weight:800}
.instruction-english{font-size:.9em;font-weight:600;line-height:1.65}
.eyebrow,.card-number,.source-merge span,.speaker{font-size:.82rem;font-weight:900;letter-spacing:.075em;color:#a42e59}
.course-hero h1{font-size:clamp(2.35rem,6vw,4.8rem);line-height:1.12;letter-spacing:-.045em}
.personal-greeting h2{font-size:clamp(1.75rem,5vw,2.35rem);line-height:1.3}
.section-heading h2{font-size:clamp(1.9rem,4vw,3rem);line-height:1.25}
.lesson-hero h1{font-size:clamp(2rem,5vw,3.8rem);line-height:1.12}
.lesson-hero h2{font-size:1.18rem;font-weight:750;line-height:1.6}
.content-card h2,.aside-card h2{font-size:clamp(1.35rem,4vw,1.75rem);line-height:1.35}
.journey-card h3{font-size:1.3rem;line-height:1.35}
.promise-section blockquote{color:#fff9fb;line-height:1.35}
.course-hero,.lesson-hero,.personal-greeting,.journey-card,.content-card,.aside-card,.source-merge article,.word-card,.sentence-card,.dialogue-card,.gate-card{background:var(--panel-solid);border-color:rgba(96,38,62,.24)}
.journey-card,.content-card,.aside-card,.word-card,.sentence-card,.dialogue-card,.gate-card{box-shadow:0 12px 30px rgba(51,18,32,.12)}
.journey-card p{color:var(--text-secondary)!important;font-size:1rem;line-height:1.75}
.journey-card small{color:var(--text-support)!important;font-size:.91rem;font-weight:600;line-height:1.7}
.source-merge strong{color:var(--text-primary);font-size:.98rem;font-weight:750;line-height:1.55}
.english-audio-row strong{color:var(--text-primary);font-size:1.16rem;font-weight:850;line-height:1.5}
.word-card,.sentence-card,.dialogue-card{padding:18px}
.word-card p,.sentence-card p,.dialogue-card p{margin:.48rem 0 0}
.objective-list li,.speaking-card li{font-size:1.02rem;font-weight:600;line-height:1.88;color:var(--text-secondary)}
.scenario-primary{color:var(--text-primary);font-size:1.08rem;font-weight:750;line-height:1.75}
.teacher-structure{background:var(--panel-soft);border-color:rgba(96,38,62,.24)}
.teacher-structure>summary{color:var(--text-secondary);font-size:.98rem;font-weight:750}
.quiz-question legend{color:var(--text-primary);font-size:1.03rem;line-height:1.65}
.quiz-question label{color:var(--text-primary);background:var(--panel-soft);font-size:1rem;font-weight:650;line-height:1.6;border-color:rgba(96,38,62,.12)}
.builder-answer{background:var(--panel-raised)}
.builder-answer button,.word-bank button{color:var(--text-primary);background:var(--panel-raised);font-weight:750}
.speak-button{color:#401827;background:#fff;border:2px solid rgba(103,36,63,.25);box-shadow:0 4px 12px rgba(51,18,32,.12);font-weight:900}
.love-button,.complete-button,.gate-form>button,.mobile-action-bar .primary{background:linear-gradient(135deg,var(--button-primary-start),var(--button-primary-end));color:var(--button-primary-text);font-weight:900;text-shadow:0 1px 1px rgba(0,0,0,.12)}
.soft-button{background:#ffffff;color:#681f3d;border:2px solid rgba(104,31,61,.22);font-weight:850}
.quiet-button{background:#fff8fa;color:#603348;border:2px solid rgba(96,51,72,.2);font-weight:800;padding-inline:14px}
.love-button,.soft-button,.complete-button,.quiet-button,.gate-form>button{min-height:54px;font-size:1rem}
.progress-track{background:#ead6de}.rice-progress-copy strong{color:#7b1d40}.rice-progress-copy span{color:var(--text-primary);font-size:1rem;font-weight:850;line-height:1.55}.rice-progress-copy small{font-size:.9rem;font-weight:600}
.mobile-action-bar a,.mobile-action-bar button{color:#68213f;font-weight:900}.mobile-action-bar span{font-size:.78rem;font-weight:800;line-height:1.35}
.mark-topbar{background:rgba(255,251,248,.97)}.private-brand,.mark-topbar nav a,.topbar-install{font-weight:850}
.mark-footer{font-size:.96rem;font-weight:600}
.connection-status{font-size:.9rem;font-weight:850}
.gate-card{text-align:left}.heart-seal,.gate-card>.eyebrow,.gate-card>h1,.gate-card>.thai-lead,.gate-card>p:not(.gate-note):not(.magic-link-status){text-align:center}
.gate-form label{color:var(--text-primary);font-size:1rem;font-weight:850}
.gate-form input{font-family:var(--font-ui)!important;font-size:1.05rem;font-weight:700;border:2px solid rgba(104,31,61,.28)}
.gate-form input:focus{outline:3px solid rgba(157,49,91,.28);outline-offset:2px;border-color:var(--focus-ring)}
.code-visibility{font-size:.9rem;font-weight:900}
.gate-note{font-size:.9rem;font-weight:600;line-height:1.7;text-align:center}
.notice,.magic-link-status{color:#4f3516;font-size:.96rem;font-weight:750;line-height:1.65}
.notice.error{color:#761f3d}
:focus-visible{outline:3px solid var(--focus-ring)!important;outline-offset:3px}

@media(max-width:700px){
  body{font-size:17px;line-height:1.78}
  .mark-shell{width:min(100% - 16px,1180px)}
  .course-hero,.lesson-hero{padding:24px 19px}
  .course-hero h1{font-size:2.45rem;line-height:1.14}
  .lesson-hero h1{font-size:2.35rem;line-height:1.14}
  .content-card,.aside-card{padding:22px 18px}
  .journey-card{padding:20px 17px}
  .journey-card h3{font-size:1.34rem}
  .journey-card p{font-size:1.02rem}
  .journey-card small{font-size:.94rem}
  .eyebrow,.card-number,.source-merge span,.speaker{font-size:.84rem}
  .english-audio-row strong{font-size:1.18rem}
  .pronunciation{font-size:1rem}
  .translation{font-size:1.03rem}
  .instruction-english{font-size:.88em}
  .mobile-action-bar{background:rgba(255,253,251,.98);border-color:rgba(96,38,62,.28)}
  .mobile-action-bar a,.mobile-action-bar button{min-height:62px}
}

@media(prefers-color-scheme:dark){
  :root{
    --wine:#ffb3cc;--rose:#f28fb3;
    --ink:#fff8fb;--muted:#edcfdb;
    --text-primary:#fff8fb;
    --text-secondary:#f2dce5;
    --text-support:#dfbdca;
    --text-pronunciation:#ffc1d6;
    --panel-solid:#2d2228;
    --panel-soft:#372932;
    --panel-raised:#3c2d36;
    --surface:#2d2228;
    --surface-soft:#372932;
    --line:rgba(255,210,228,.25);
    --focus-ring:#ffc0d6;
    --button-primary-start:#f2a0bd;
    --button-primary-end:#de779f;
    --button-primary-text:#32131f;
  }
  body{color:var(--text-primary);background:radial-gradient(circle at 12% 4%,rgba(128,61,85,.24),transparent 28%),linear-gradient(180deg,#1b1418,#21181d 52%,#171115)}
  .mark-topbar{background:rgba(28,20,24,.98);border-color:rgba(255,210,228,.2)}
  .course-hero,.lesson-hero{background:linear-gradient(135deg,#30232a,#382630)}
  .personal-greeting{background:#2b2126}
  .journey-card,.content-card,.aside-card,.source-merge article,.word-card,.sentence-card,.dialogue-card,.gate-card{background:var(--panel-solid);border-color:rgba(255,210,228,.22)}
  .journey-card.is-complete{background:#293329}
  .grammar-card{background:#352f24;border-color:rgba(239,195,120,.32)}
  .speaking-card{background:#38272f}
  .dialogue-card:nth-child(even){background:#342b27}
  .teacher-structure{background:#33272d;border-color:rgba(255,210,228,.2)}
  .quiz-question label{background:#392a33;color:var(--text-primary);border-color:rgba(255,210,228,.18)}
  .builder-answer,.builder-answer button,.word-bank button{background:#3b2c35;color:var(--text-primary);border-color:rgba(255,210,228,.22)}
  .speak-button{color:#32131f;background:#fff8fb;border-color:#efb5ca;box-shadow:0 5px 14px rgba(0,0,0,.3)}
  .soft-button{background:#fff8fb;color:#4a1d31;border-color:#ffd2e1}
  .quiet-button{background:#3a2a33;color:#fff3f8;border-color:rgba(255,210,228,.32)}
  .love-button,.complete-button,.gate-form>button,.mobile-action-bar .primary{color:#32131f;text-shadow:none}
  .progress-track{background:#49343e}
  .rice-progress-copy strong,.course-hero h1 span,.lesson-hero h2{color:#ffb7cf}
  .mobile-action-bar{background:rgba(45,34,40,.99);border-color:rgba(255,210,228,.24)}
  .mobile-action-bar a,.mobile-action-bar button{color:#ffd5e4}
  .mobile-action-bar .primary{color:#32131f}
  .gate-form input{background:#fff8fb!important;color:#25141b!important;-webkit-text-fill-color:#25141b;font-weight:750;border-color:#f0b4ca}
  .code-visibility{background:#3d2a34!important;color:#fff4f8!important;border-color:#d98aa7!important}
  .field-help,.gate-note{color:#e6c7d3!important}
  .notice,.magic-link-status{background:#46391f;border-color:#9c7c3a;color:#fff0c6}
  .notice.error{background:#4a2532;border-color:#b96885;color:#ffe2eb}
}

@media(forced-colors:active){
  .course-hero,.lesson-hero,.personal-greeting,.journey-card,.content-card,.aside-card,.word-card,.sentence-card,.dialogue-card,.gate-card{border:2px solid CanvasText}
  .love-button,.complete-button,.soft-button,.quiet-button,.speak-button{border:2px solid ButtonText}
}

/* ===== V6 selectable themes, cleaner header and daily-life phrase ===== */
.theme-control{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:5px 7px 5px 11px;border:1px solid var(--line);border-radius:14px;background:var(--panel-raised);color:var(--text-primary);font-weight:850;white-space:nowrap}
.theme-control>span{font-size:.84rem;line-height:1.2}
.theme-control select{min-height:34px;max-width:150px;padding:5px 28px 5px 9px;border:1px solid rgba(104,31,61,.2);border-radius:10px;background:var(--panel-soft);color:var(--text-primary);font-size:.88rem;font-weight:800;cursor:pointer}
.theme-control select:focus-visible{outline:3px solid var(--focus-ring)!important;outline-offset:2px}
.gate-theme-row{display:flex;justify-content:flex-end;margin:0 10px 18px}
.gate-theme-row .theme-control{box-shadow:0 8px 24px rgba(51,18,32,.1)}
.mark-topbar nav{align-items:center}

.daily-phrase-wrap{width:min(1180px,calc(100% - 28px));margin:46px auto 0}
.daily-phrase-card{padding:clamp(24px,4vw,38px);border:1px solid var(--line);border-radius:28px;background:var(--panel-solid);box-shadow:0 16px 42px rgba(51,18,32,.13)}
.daily-phrase-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:20px}
.daily-phrase-heading h2{margin:.15rem 0 0;font-family:var(--font-ui)!important;font-size:clamp(1.55rem,4vw,2.2rem);font-weight:900;line-height:1.3;color:var(--text-primary)}
.daily-phrase-day{display:inline-flex;align-items:center;justify-content:center;min-height:38px;padding:7px 13px;border-radius:999px;background:rgba(200,72,112,.12);color:#7b1d40;font-size:.86rem;font-weight:900}
.daily-phrase-main{display:grid;grid-template-columns:minmax(0,1fr) 58px;gap:16px;align-items:start;padding:20px;border:1px solid rgba(104,31,61,.16);border-radius:20px;background:var(--panel-soft)}
.daily-phrase-english{margin:0;color:var(--text-primary);font-size:clamp(1.7rem,5vw,2.7rem);font-weight:900;line-height:1.25;letter-spacing:-.02em}
.daily-phrase-main .pronunciation,.daily-phrase-main .translation{margin:.55rem 0 0}
.daily-phrase-audio{width:56px;min-width:56px;height:56px}
.daily-phrase-context{margin:18px 2px 0;color:var(--text-secondary);font-size:1.02rem;font-weight:650;line-height:1.85}
.daily-phrase-context strong{color:var(--text-primary);font-weight:900}
.daily-phrase-insights{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:16px}
.daily-phrase-insights section{padding:18px;border:1px solid rgba(104,31,61,.14);border-radius:18px;background:var(--panel-soft)}
.daily-phrase-insights h3{margin:0 0 7px;color:var(--text-primary);font-family:var(--font-ui)!important;font-size:1.05rem;font-weight:900;line-height:1.45}
.daily-phrase-insights p{margin:0;color:var(--text-secondary);font-size:.98rem;font-weight:600;line-height:1.85}

html[data-theme-resolved="light"]{
  color-scheme:light;
  --wine:#6f1835;--rose:#c84870;--rose-soft:#f5b5c9;--cream:#fff8f2;--paper:#fffdf9;
  --ink:#28141d;--muted:#684753;--line:rgba(96,38,62,.2);--gold:#c78e3f;--leaf:#5f7c54;--leaf-bright:#789a69;--soil:#9d6645;
  --text-primary:#28141d;--text-secondary:#523541;--text-support:#684753;--text-pronunciation:#7b2948;
  --panel-solid:#fffdfb;--panel-soft:#fff6f8;--panel-raised:#ffffff;--surface:#fffdfb;--surface-soft:#fff6f8;
  --focus-ring:#9d315b;--button-primary-start:#7b1d40;--button-primary-end:#bd3f6a;--button-primary-text:#ffffff;
  --shadow:0 22px 60px rgba(77,24,45,.16);
}
html[data-theme-resolved="light"] body{color:var(--text-primary);background:radial-gradient(circle at 12% 4%,rgba(245,181,201,.42),transparent 27%),radial-gradient(circle at 88% 12%,rgba(212,154,74,.18),transparent 24%),linear-gradient(180deg,#fff7f7,#fffaf4 42%,#f8f0e7)}
html[data-theme-resolved="light"] .mark-topbar{background:rgba(255,251,248,.98);border-color:rgba(96,38,62,.2)}
html[data-theme-resolved="light"] .course-hero,html[data-theme-resolved="light"] .lesson-hero{background:linear-gradient(135deg,#fffdfb,#ffeef3)}
html[data-theme-resolved="light"] .personal-greeting{background:#fffdfb}
html[data-theme-resolved="light"] .journey-card,html[data-theme-resolved="light"] .content-card,html[data-theme-resolved="light"] .aside-card,html[data-theme-resolved="light"] .source-merge article,html[data-theme-resolved="light"] .word-card,html[data-theme-resolved="light"] .sentence-card,html[data-theme-resolved="light"] .dialogue-card,html[data-theme-resolved="light"] .gate-card,html[data-theme-resolved="light"] .daily-phrase-card{background:var(--panel-solid);border-color:rgba(96,38,62,.22)}
html[data-theme-resolved="light"] .journey-card.is-complete{background:#f7fff5}
html[data-theme-resolved="light"] .grammar-card{background:#fff8e9;border-color:rgba(181,126,49,.3)}
html[data-theme-resolved="light"] .speaking-card{background:#fff5f8}
html[data-theme-resolved="light"] .dialogue-card:nth-child(even){background:#fff9f0}
html[data-theme-resolved="light"] .teacher-structure{background:#fffafc;border-color:rgba(96,38,62,.2)}
html[data-theme-resolved="light"] .quiz-question label{background:#fff6f8;color:var(--text-primary)}
html[data-theme-resolved="light"] .builder-answer,html[data-theme-resolved="light"] .builder-answer button,html[data-theme-resolved="light"] .word-bank button{background:#fff;color:var(--text-primary)}
html[data-theme-resolved="light"] .speak-button{color:#401827;background:#fff;border-color:rgba(103,36,63,.25)}
html[data-theme-resolved="light"] .soft-button{background:#fff;color:#681f3d;border-color:rgba(104,31,61,.22)}
html[data-theme-resolved="light"] .quiet-button{background:#fff8fa;color:#603348;border-color:rgba(96,51,72,.2)}
html[data-theme-resolved="light"] .mobile-action-bar{background:rgba(255,253,251,.99);border-color:rgba(96,38,62,.28)}
html[data-theme-resolved="light"] .mobile-action-bar a,html[data-theme-resolved="light"] .mobile-action-bar button{color:#68213f}
html[data-theme-resolved="light"] .mobile-action-bar .primary{color:#fff}
html[data-theme-resolved="light"] .gate-form input{background:#fff!important;color:#25141b!important;-webkit-text-fill-color:#25141b;border-color:rgba(104,31,61,.3)}
html[data-theme-resolved="light"] .code-visibility{background:#fff8fa!important;color:#681f3d!important;border-color:rgba(104,31,61,.28)!important}
html[data-theme-resolved="light"] .field-help,html[data-theme-resolved="light"] .gate-note{color:#684753!important}
html[data-theme-resolved="light"] .notice,html[data-theme-resolved="light"] .magic-link-status{background:#fff4d8;border-color:#e7c87d;color:#4f3516}
html[data-theme-resolved="light"] .notice.error{background:#fff0f3;border-color:#efafc2;color:#761f3d}
html[data-theme-resolved="light"] .daily-phrase-main,html[data-theme-resolved="light"] .daily-phrase-insights section{background:#fff7f9}

html[data-theme-resolved="dark"]{
  color-scheme:dark;
  --wine:#ffb3cc;--rose:#f28fb3;--rose-soft:#6c3a4b;--cream:#201a1d;--paper:#2a2226;
  --ink:#fff8fb;--muted:#edcfdb;--line:rgba(255,210,228,.25);--gold:#d9ae69;--leaf:#91aa83;--leaf-bright:#a5bc96;--soil:#b98767;
  --text-primary:#fff8fb;--text-secondary:#f2dce5;--text-support:#dfbdca;--text-pronunciation:#ffc1d6;
  --panel-solid:#2d2228;--panel-soft:#372932;--panel-raised:#3c2d36;--surface:#2d2228;--surface-soft:#372932;
  --focus-ring:#ffc0d6;--button-primary-start:#f2a0bd;--button-primary-end:#de779f;--button-primary-text:#32131f;
  --shadow:0 22px 60px rgba(0,0,0,.38);
}
html[data-theme-resolved="dark"] body{color:var(--text-primary);background:radial-gradient(circle at 12% 4%,rgba(128,61,85,.24),transparent 28%),linear-gradient(180deg,#1b1418,#21181d 52%,#171115)}
html[data-theme-resolved="dark"] .mark-topbar{background:rgba(28,20,24,.98);border-color:rgba(255,210,228,.2)}
html[data-theme-resolved="dark"] .course-hero,html[data-theme-resolved="dark"] .lesson-hero{background:linear-gradient(135deg,#30232a,#382630)}
html[data-theme-resolved="dark"] .personal-greeting{background:#2b2126}
html[data-theme-resolved="dark"] .journey-card,html[data-theme-resolved="dark"] .content-card,html[data-theme-resolved="dark"] .aside-card,html[data-theme-resolved="dark"] .source-merge article,html[data-theme-resolved="dark"] .word-card,html[data-theme-resolved="dark"] .sentence-card,html[data-theme-resolved="dark"] .dialogue-card,html[data-theme-resolved="dark"] .gate-card,html[data-theme-resolved="dark"] .daily-phrase-card{background:var(--panel-solid);border-color:rgba(255,210,228,.22)}
html[data-theme-resolved="dark"] .journey-card.is-complete{background:#293329}
html[data-theme-resolved="dark"] .grammar-card{background:#352f24;border-color:rgba(239,195,120,.32)}
html[data-theme-resolved="dark"] .speaking-card{background:#38272f}
html[data-theme-resolved="dark"] .dialogue-card:nth-child(even){background:#342b27}
html[data-theme-resolved="dark"] .teacher-structure{background:#33272d;border-color:rgba(255,210,228,.2)}
html[data-theme-resolved="dark"] .quiz-question label{background:#392a33;color:var(--text-primary);border-color:rgba(255,210,228,.18)}
html[data-theme-resolved="dark"] .builder-answer,html[data-theme-resolved="dark"] .builder-answer button,html[data-theme-resolved="dark"] .word-bank button{background:#3b2c35;color:var(--text-primary);border-color:rgba(255,210,228,.22)}
html[data-theme-resolved="dark"] .speak-button{color:#32131f;background:#fff8fb;border-color:#efb5ca;box-shadow:0 5px 14px rgba(0,0,0,.3)}
html[data-theme-resolved="dark"] .soft-button{background:#fff8fb;color:#4a1d31;border-color:#ffd2e1}
html[data-theme-resolved="dark"] .quiet-button{background:#3a2a33;color:#fff3f8;border-color:rgba(255,210,228,.32)}
html[data-theme-resolved="dark"] .love-button,html[data-theme-resolved="dark"] .complete-button,html[data-theme-resolved="dark"] .gate-form>button,html[data-theme-resolved="dark"] .mobile-action-bar .primary{color:#32131f;text-shadow:none}
html[data-theme-resolved="dark"] .progress-track{background:#49343e}
html[data-theme-resolved="dark"] .rice-progress-copy strong,html[data-theme-resolved="dark"] .course-hero h1 span,html[data-theme-resolved="dark"] .lesson-hero h2{color:#ffb7cf}
html[data-theme-resolved="dark"] .mobile-action-bar{background:rgba(45,34,40,.99);border-color:rgba(255,210,228,.24)}
html[data-theme-resolved="dark"] .mobile-action-bar a,html[data-theme-resolved="dark"] .mobile-action-bar button{color:#ffd5e4}
html[data-theme-resolved="dark"] .mobile-action-bar .primary{color:#32131f}
html[data-theme-resolved="dark"] .gate-form input{background:#fff8fb!important;color:#25141b!important;-webkit-text-fill-color:#25141b;border-color:#f0b4ca}
html[data-theme-resolved="dark"] .code-visibility{background:#3d2a34!important;color:#fff4f8!important;border-color:#d98aa7!important}
html[data-theme-resolved="dark"] .field-help,html[data-theme-resolved="dark"] .gate-note{color:#e6c7d3!important}
html[data-theme-resolved="dark"] .notice,html[data-theme-resolved="dark"] .magic-link-status{background:#46391f;border-color:#9c7c3a;color:#fff0c6}
html[data-theme-resolved="dark"] .notice.error{background:#4a2532;border-color:#b96885;color:#ffe2eb}
html[data-theme-resolved="dark"] .theme-control{background:#34272e;border-color:rgba(255,210,228,.28);color:#fff8fb}
html[data-theme-resolved="dark"] .theme-control select{background:#46343e;color:#fff8fb;border-color:rgba(255,210,228,.25)}
html[data-theme-resolved="dark"] .daily-phrase-main,html[data-theme-resolved="dark"] .daily-phrase-insights section{background:#382a32;border-color:rgba(255,210,228,.18)}
html[data-theme-resolved="dark"] .daily-phrase-day{background:rgba(242,143,179,.18);color:#ffd1e1}

@media(max-width:700px){
  .mark-topbar{padding:12px 14px;gap:10px}
  .mark-topbar nav{flex:0 0 auto;justify-content:flex-end}
  .mark-topbar nav a,.mark-topbar nav .topbar-install{display:none!important}
  .private-brand{max-width:185px;font-size:.94rem;line-height:1.35}
  .theme-control{padding:4px 5px 4px 8px;gap:5px;border-radius:12px}
  .theme-control>span{font-size:.76rem}
  .theme-control select{max-width:105px;min-height:36px;padding-left:7px;font-size:.79rem}
  .gate-theme-row{margin:0 0 18px}
  .daily-phrase-wrap{width:min(100% - 16px,1180px);margin-top:34px}
  .daily-phrase-card{padding:22px 17px;border-radius:22px}
  .daily-phrase-heading{align-items:center}
  .daily-phrase-heading h2{font-size:1.55rem}
  .daily-phrase-main{padding:17px 14px;grid-template-columns:minmax(0,1fr) 54px}
  .daily-phrase-english{font-size:1.85rem}
  .daily-phrase-audio{width:52px;min-width:52px;height:52px}
  .daily-phrase-insights{grid-template-columns:1fr}
}

@media(max-width:400px){
  .private-brand{max-width:155px;font-size:.86rem}
  .theme-control>span{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
  .theme-control select{max-width:112px}
}
/* V6 explicit light-theme resets for phones whose system remains in dark mode */
html[data-theme-resolved="light"] .course-hero h1 span,html[data-theme-resolved="light"] .lesson-hero h2,html[data-theme-resolved="light"] .rice-progress-copy strong{color:#7b1d40}
html[data-theme-resolved="light"] .love-button,html[data-theme-resolved="light"] .complete-button,html[data-theme-resolved="light"] .gate-form>button,html[data-theme-resolved="light"] .mobile-action-bar .primary{color:#fff;text-shadow:0 1px 1px rgba(0,0,0,.12)}
html[data-theme-resolved="light"] .pwa-toast{color:#fff;background:#4c1028}
html[data-theme-resolved="dark"] .pwa-toast{color:#fff;background:#321824}

/* ===== V10 additive vocabulary-game entry point ===== */
.game-entry-card{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:22px;margin:24px 0;padding:24px 28px;border:1px solid rgba(82,125,75,.26);border-radius:var(--radius);background:linear-gradient(120deg,#f7fff1,#fff9f5 58%,#eef9ff);box-shadow:0 14px 36px rgba(49,72,45,.1)}
.game-entry-world{display:flex;align-items:center;justify-content:center;min-width:130px;min-height:92px;padding:14px;border-radius:22px;background:linear-gradient(145deg,#9bc876,#5e915b);box-shadow:inset 0 0 0 1px rgba(255,255,255,.35)}
.game-entry-world span{font-size:2.3rem;filter:drop-shadow(0 5px 5px rgba(30,60,34,.18))}
.game-entry-world span:last-child{color:#fff;font-size:1.8rem}
.game-entry-card h2{margin:.15rem 0 .35rem;color:var(--text-primary);font-size:clamp(1.65rem,4vw,2.25rem);font-weight:900;line-height:1.25}
.game-entry-card p:not(.eyebrow){margin:0;color:var(--text-secondary);font-size:.96rem;font-weight:650;line-height:1.75}
.game-link-button{border-color:rgba(82,125,75,.3);color:#345d3a}
html[data-theme-resolved="dark"] .game-entry-card{background:linear-gradient(120deg,#293528,#30282c 58%,#24343a);border-color:rgba(174,211,151,.24)}
html[data-theme-resolved="dark"] .game-link-button{color:#345d3a}

@media(max-width:800px){
  .game-entry-card{grid-template-columns:auto 1fr}
  .game-entry-card>a{grid-column:1/-1;justify-content:center}
}
@media(max-width:700px){
  .mobile-action-bar.home-actions{grid-template-columns:repeat(4,1fr)}
  .game-entry-card{grid-template-columns:1fr;padding:21px 18px}
  .game-entry-world{min-height:82px}
}

/* ===== V11 bundled audio: normal and pitch-preserving slow playback ===== */
.audio-controls{display:inline-flex;flex-wrap:wrap;justify-content:flex-end;gap:7px}
.speak-button.audio-control{display:inline-flex;align-items:center;justify-content:center;gap:5px;width:auto;min-width:82px;height:44px;padding:7px 10px;font-size:.86rem;line-height:1;white-space:nowrap}
.speak-button.audio-control.slow-audio{border-color:rgba(116,103,54,.34);background:#fff9e8;color:#654f14}
.audio-controls.wide-audio-controls{justify-content:flex-start;margin-top:12px}
.daily-phrase-audio{width:auto;min-width:0;height:auto}
html[data-theme-resolved="dark"] .speak-button.audio-control.slow-audio{border-color:#e4c774;background:#40391f;color:#fff0b0}

@media(max-width:700px){
  .english-audio-row{grid-template-columns:1fr}
  .english-audio-row .audio-controls{justify-content:flex-start}
  .daily-phrase-main{grid-template-columns:1fr}
  .daily-phrase-audio{width:auto;min-width:0;height:auto;justify-content:flex-start}
  .speak-button.audio-control{min-width:88px}
}

/* ===== V12 illustrated love-and-topic learning world ===== */
.hero-emblem-art{position:relative;isolation:isolate;overflow:hidden;padding:0;transform:none;background:#4f2532}
.hero-emblem-art>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center;filter:saturate(.92) contrast(.96)}
.hero-emblem-art:after{content:"";position:absolute;inset:0;z-index:1;background:linear-gradient(180deg,rgba(35,16,23,.06),rgba(54,18,33,.68))}
.hero-emblem-overlay{position:relative;z-index:2;display:grid;place-items:center;align-content:center;width:100%;height:100%;padding:24px;color:#fff;text-shadow:0 3px 16px rgba(27,10,16,.72)}
.hero-emblem-overlay .big-heart{font-size:5.6rem}

.lesson-hero{grid-template-columns:auto minmax(0,1fr) minmax(240px,330px);grid-template-rows:auto auto}
.lesson-icon{grid-column:1;grid-row:1/3}
.lesson-hero-copy{grid-column:2;grid-row:1}
.lesson-topic-art{position:relative;grid-column:3;grid-row:1/3;align-self:stretch;min-height:230px;margin:0;overflow:hidden;border:1px solid rgba(111,24,53,.2);border-radius:24px;background:#eadfd7;box-shadow:0 14px 32px rgba(53,22,34,.16)}
.lesson-topic-art:after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,transparent 52%,rgba(42,18,27,.7))}
.lesson-topic-art img{display:block;width:100%;height:100%;min-height:230px;object-fit:cover}
.lesson-topic-art figcaption{position:absolute;z-index:1;right:14px;bottom:12px;left:14px;color:#fff;font-size:.8rem;font-weight:850;line-height:1.55;text-shadow:0 2px 8px #1c0c12}
.lesson-topic-art figcaption span{color:#ffb6cc}
.lesson-hero>.complete-button{grid-column:2;grid-row:2;justify-self:start}

.journey-card-visual{position:relative;display:block;height:104px;margin:11px 0 14px;overflow:hidden;border-radius:15px;background:#eadfd7}
.journey-card-visual:after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(34,16,22,.12),transparent 58%)}
.journey-card-visual img{display:block;width:100%;height:100%;object-fit:cover;transition:transform .25s ease}
.journey-card:hover .journey-card-visual img{transform:scale(1.035)}
.journey-card-visual .card-icon{position:absolute;z-index:1;left:10px;bottom:8px;display:grid;width:42px;height:42px;margin:0;place-items:center;border:1px solid rgba(255,255,255,.62);border-radius:13px;background:rgba(255,253,249,.9);box-shadow:0 6px 16px rgba(28,12,18,.18);font-size:1.55rem;backdrop-filter:blur(8px)}

html[data-theme-resolved="dark"] .lesson-topic-art,
html[data-theme-resolved="dark"] .journey-card-visual{border-color:rgba(255,205,220,.22);background:#362b30}
html[data-theme-resolved="dark"] .journey-card-visual .card-icon{background:rgba(42,34,38,.9)}

@media(max-width:1000px){
  .lesson-hero{grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto auto auto}
  .lesson-icon{grid-column:1;grid-row:1}
  .lesson-hero-copy{grid-column:2;grid-row:1}
  .lesson-topic-art{grid-column:1/-1;grid-row:2;min-height:260px;max-height:360px}
  .lesson-topic-art img{min-height:260px}
  .lesson-hero>.complete-button{grid-column:1/-1;grid-row:3;justify-self:stretch;width:100%}
}
@media(max-width:620px){
  .hero-emblem-art{min-height:250px}
  .lesson-hero{grid-template-columns:1fr}
  .lesson-hero-copy,.lesson-topic-art,.lesson-hero>.complete-button{grid-column:1}
  .lesson-icon{display:none}
  .lesson-hero-copy{grid-row:1}.lesson-topic-art{grid-row:2;min-height:210px}.lesson-topic-art img{min-height:210px}.lesson-hero>.complete-button{grid-row:3}
  .journey-card-visual{height:118px}
}

/* ===== V14.1 responsive vocabulary cards ===== */
.word-card .english-audio-row{
  grid-template-columns:minmax(0,1fr);
  gap:10px;
}
.word-card .english-audio-row>strong{
  min-width:0;
  overflow-wrap:normal;
  word-break:normal;
  hyphens:none;
}
.word-card .english-audio-row .audio-controls{
  max-width:100%;
  justify-content:flex-start;
}

/* ===== V239 reordered curriculum and conversation practice ===== */
.curriculum-unit{margin:26px 0 38px;scroll-margin-top:90px}
.curriculum-unit-heading{display:grid;grid-template-columns:58px minmax(0,1fr);gap:15px;align-items:start;margin:0 0 14px;padding:18px 20px;border:1px solid var(--line);border-radius:20px;background:var(--panel-solid);box-shadow:0 10px 26px rgba(51,18,32,.08)}
.curriculum-unit-number{display:grid;width:52px;height:52px;place-items:center;border-radius:16px;background:linear-gradient(135deg,var(--wine),var(--rose));color:#fff;font-size:1.65rem;box-shadow:0 8px 18px rgba(79,24,47,.2)}
.curriculum-unit-heading h3{margin:.08rem 0;font-size:1.35rem;line-height:1.35;color:var(--text-primary)}
.curriculum-unit-heading p[lang="en"]{margin:.18rem 0;color:var(--text-secondary);font-weight:750}
.curriculum-unit-heading small{display:block;margin-top:.4rem;color:var(--text-support);font-size:.94rem;line-height:1.65}
.curriculum-unit .lesson-card-grid{position:relative}

.conversation-lab{overflow:hidden}
.conversation-lab-heading{display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,340px);gap:18px;align-items:end;margin-bottom:16px}
.conversation-lab-heading>p{margin:0;color:var(--text-support);line-height:1.7}
.practice-conversation-stack{display:grid;gap:12px}
.practice-conversation{overflow:hidden;border:1px solid var(--line);border-radius:18px;background:var(--surface-soft)}
.practice-conversation>summary{display:flex;align-items:center;justify-content:space-between;gap:14px;min-height:62px;padding:14px 16px;cursor:pointer;list-style:none;background:var(--panel-solid)}
.practice-conversation>summary::-webkit-details-marker{display:none}
.practice-conversation>summary span:first-child{display:grid;gap:2px;min-width:0}
.practice-conversation>summary strong{font-size:1.05rem;color:var(--text-primary)}
.practice-conversation>summary small{color:var(--text-secondary);font-weight:700}
.conversation-count{flex:none;padding:5px 9px;border-radius:999px;background:var(--rose-soft);color:var(--text-primary);font-size:.76rem;font-weight:850;white-space:nowrap}
.practice-conversation-body{padding:16px}
.conversation-setting{margin:0 0 12px;color:var(--text-secondary);line-height:1.75}
.conversation-toolbar{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.conversation-toolbar button{min-height:42px;padding:8px 11px;border:1px solid var(--line);border-radius:12px;background:var(--panel-solid);color:var(--text-primary);font:inherit;font-size:.82rem;font-weight:800;cursor:pointer}
.conversation-toolbar button[aria-pressed="false"]{opacity:.64}
.conversation-toolbar button.is-speaking{outline:3px solid color-mix(in srgb,var(--rose) 28%,transparent);animation:pulse .7s ease-in-out infinite alternate}
.conversation-targets{display:flex;flex-wrap:wrap;gap:7px;margin:0 0 14px}
.conversation-targets span{padding:5px 9px;border:1px solid var(--line);border-radius:999px;background:var(--panel-solid);color:var(--text-secondary);font-size:.8rem;font-weight:800;white-space:normal;word-break:normal;overflow-wrap:normal;hyphens:none}
.practice-turn{word-break:normal;overflow-wrap:normal;hyphens:none}
.practice-turn strong{word-break:normal;overflow-wrap:normal;hyphens:none}
.practice-turn .conversation-pronunciation,.practice-turn .conversation-thai{line-height:1.8}
.practice-conversation.hide-conversation-thai .conversation-thai{display:none}
.practice-conversation.hide-conversation-pronunciation .conversation-pronunciation{display:none}

/* Audio labels stay available to assistive technology; only the icons show. */
.speak-button.audio-control{position:relative;width:44px;min-width:44px;height:44px;padding:0;font-size:1rem}
.speak-button.audio-control>span{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.conversation-line-audio{flex-wrap:nowrap}

@media(max-width:700px){
  .curriculum-unit{margin-block:22px 32px}
  .curriculum-unit-heading{grid-template-columns:48px minmax(0,1fr);padding:15px}
  .curriculum-unit-number{width:44px;height:44px;font-size:1.35rem}
  .conversation-lab-heading{grid-template-columns:1fr}
  .conversation-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .conversation-toolbar button{width:100%}
  .practice-conversation>summary{align-items:flex-start}
}

/* ===== V251.6 concise learner-facing journey introduction ===== */

/* ===== V251.7 staged lesson layout ===== */
.lesson-stage{
  margin:0 0 18px;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:22px;
  background:var(--panel-solid);
  box-shadow:0 12px 30px rgba(51,18,32,.09);
}
.lesson-stage-summary{
  display:grid;
  grid-template-columns:48px minmax(0,1fr) auto;
  gap:13px;
  align-items:center;
  min-height:74px;
  padding:13px 17px;
  cursor:pointer;
  list-style:none;
  color:var(--text-primary);
  background:linear-gradient(135deg,var(--panel-solid),var(--surface-soft));
}
.lesson-stage-summary::-webkit-details-marker{display:none}
.lesson-stage-summary::after{
  content:"⌄";
  display:grid;
  width:34px;
  height:34px;
  place-items:center;
  border:1px solid var(--line);
  border-radius:999px;
  color:var(--text-secondary);
  background:var(--panel-solid);
  font-weight:900;
  transition:transform .2s ease;
}
.lesson-stage[open]>.lesson-stage-summary::after{transform:rotate(180deg)}
.lesson-stage-icon{
  display:grid;
  width:46px;
  height:46px;
  place-items:center;
  border-radius:15px;
  color:#fff;
  background:linear-gradient(135deg,var(--wine),var(--rose));
  box-shadow:0 8px 18px rgba(79,24,47,.18);
  font-size:1.35rem;
}
.lesson-stage-summary-copy{display:grid;gap:2px;min-width:0}
.lesson-stage-summary-copy strong{font-size:1.12rem;line-height:1.35;color:var(--text-primary)}
.lesson-stage-summary-copy strong span{font-size:.92rem;color:var(--text-secondary);font-weight:800}
.lesson-stage-summary-copy small{color:var(--text-support);font-size:.86rem;line-height:1.45}
.lesson-stage-body{
  padding:18px;
  border-top:1px solid var(--line);
  background:color-mix(in srgb,var(--surface-soft) 36%,transparent);
}
.lesson-stage-body>.content-card:last-child{margin-bottom:0}
.lesson-stage-practise>.lesson-stage-summary .lesson-stage-icon{background:linear-gradient(135deg,#8a3157,#d9799b)}
.lesson-stage-more-practice>.lesson-stage-summary .lesson-stage-icon{background:linear-gradient(135deg,#3f7288,#79aeba)}
.lesson-stage-more-practice>.lesson-stage-summary{background:linear-gradient(135deg,var(--panel-solid),color-mix(in srgb,#e4f5f7 52%,var(--surface-soft)))}
.conversation-lab-body{padding:14px}
.conversation-lab-body .practice-conversation-stack{gap:10px}
.conversation-toolbar-primary{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
}
.conversation-toolbar-primary button{
  justify-content:center;
  min-width:0;
  padding-inline:8px;
}
.conversation-more-options{
  margin:0 0 13px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--panel-solid);
}
.conversation-more-options>summary{
  padding:11px 13px;
  cursor:pointer;
  color:var(--text-secondary);
  font-size:.84rem;
  font-weight:850;
  list-style:none;
}
.conversation-more-options>summary::-webkit-details-marker{display:none}
.conversation-more-options>summary::after{content:" +";font-weight:950}
.conversation-more-options[open]>summary::after{content:" −"}
.conversation-toolbar-secondary{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin:0;
  padding:0 11px 11px;
}
.conversation-toolbar-secondary button{justify-content:center;min-width:0}
html[data-theme-resolved="dark"] .lesson-stage-more-practice>.lesson-stage-summary{
  background:linear-gradient(135deg,var(--panel-solid),#29363a);
}
@media(max-width:620px){
  .lesson-stage{border-radius:18px;margin-bottom:13px}
  .lesson-stage-summary{grid-template-columns:42px minmax(0,1fr) 30px;gap:10px;min-height:65px;padding:11px 12px}
  .lesson-stage-icon{width:40px;height:40px;border-radius:13px;font-size:1.15rem}
  .lesson-stage-summary::after{width:30px;height:30px}
  .lesson-stage-summary-copy strong{font-size:1.02rem}
  .lesson-stage-summary-copy strong span{font-size:.84rem}
  .lesson-stage-summary-copy small{font-size:.79rem}
  .lesson-stage-body{padding:9px}
  .lesson-stage-body>.content-card{margin-bottom:10px;padding:18px 15px;border-radius:17px}
  .conversation-lab-body{padding:8px}
  .practice-conversation>summary{min-height:56px;padding:12px}
  .conversation-toolbar-primary,.conversation-toolbar-secondary{grid-template-columns:repeat(3,minmax(0,1fr))}
  .conversation-toolbar-primary button,.conversation-toolbar-secondary button{min-height:44px;padding:7px 5px;font-size:.75rem}
  .conversation-toolbar-primary button span,.conversation-toolbar-secondary button span{display:block}
}

/* ===== V251.8 compact daily phrase and offline controls ===== */
.daily-phrase-lesson{
  margin-top:28px;
}
.daily-phrase-lesson .daily-phrase-card{
  padding:clamp(18px,3vw,25px);
  border-radius:22px;
}
.daily-phrase-lesson .daily-phrase-heading{
  margin-bottom:13px;
}
.daily-phrase-lesson .daily-phrase-heading h2{
  font-size:clamp(1.25rem,3vw,1.65rem);
}
.daily-phrase-lesson .daily-phrase-main{
  padding:16px;
}
.daily-phrase-lesson .daily-phrase-english{
  font-size:clamp(1.4rem,4vw,2rem);
}
.daily-phrase-more{
  margin-top:12px;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:15px;
  background:var(--panel-soft);
}
.daily-phrase-more>summary{
  padding:12px 14px;
  cursor:pointer;
  color:var(--text-primary);
  font-weight:850;
  line-height:1.5;
}
.daily-phrase-more-body{
  display:grid;
  gap:12px;
  padding:0 14px 14px;
}
.daily-phrase-more-body .daily-phrase-context{
  margin:0;
}
.daily-phrase-more-body section{
  padding:13px 14px;
  border-radius:13px;
  background:var(--panel-solid);
}
.daily-phrase-more-body h3{
  margin:0 0 5px;
  font-size:.98rem;
}
.daily-phrase-more-body p{
  margin:0;
  color:var(--text-secondary);
  line-height:1.72;
}
.offline-settings{
  width:min(540px,100%);
  margin:14px auto 0;
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--panel-soft);
}
.offline-settings>summary{
  padding:12px 15px;
  cursor:pointer;
  color:var(--text-primary);
  font-weight:850;
}
.offline-settings-body{
  padding:0 14px 14px;
}
.lesson-footer-compact{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  gap:10px 16px;
  padding-top:20px;
}
.lesson-footer-compact>p{
  margin:0;
}
.lesson-connection-status{
  min-height:28px;
  padding:3px 9px;
  font-size:.76rem;
}
@media(max-width:620px){
  .daily-phrase-lesson{width:min(100% - 16px,1180px);margin-top:22px}
  .daily-phrase-lesson .daily-phrase-card{padding:17px 14px}
  .daily-phrase-lesson .daily-phrase-heading{gap:9px}
  .daily-phrase-lesson .daily-phrase-day{min-height:32px;padding:5px 10px;font-size:.76rem}
  .daily-phrase-lesson .daily-phrase-main{padding:14px 12px}
  .lesson-footer-compact{padding-bottom:calc(78px + var(--safe-bottom))}
}


/* ===== V251.9 restrained romantic journey heading ===== */
.journey-love-heading{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  margin:8px 0 20px;
  padding:10px 18px 12px;
  text-align:center;
}
.journey-love-heading::after{
  content:"";
  position:absolute;
  bottom:0;
  left:50%;
  width:min(96px,26vw);
  height:2px;
  transform:translateX(-50%);
  border-radius:999px;
  background:linear-gradient(90deg,transparent,var(--rose),transparent);
  opacity:.58;
}
.journey-love-heading h2{
  margin:0;
  color:var(--text-primary);
  font-size:clamp(1.6rem,3.5vw,2.35rem);
  font-weight:850;
  line-height:1.3;
  letter-spacing:-.025em;
}
@media(max-width:620px){
  .journey-love-heading{margin:4px 0 16px;padding:8px 12px 10px}
  .journey-love-heading h2{font-size:clamp(1.45rem,7vw,1.9rem)}
}

/* ===== V251.10 grammar patterns, difficult-word support, and quieter utilities ===== */
.grammar-pattern-card > h2{
  margin-bottom:16px;
}
.grammar-pattern-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.grammar-pattern-item{
  min-width:0;
  padding:15px;
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--panel-solid);
  box-shadow:0 8px 20px rgba(51,18,32,.06);
}
.grammar-pattern-label{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
  color:var(--rose);
  font-size:.78rem;
  font-weight:900;
  letter-spacing:.06em;
  text-transform:uppercase;
}
.grammar-pattern-label small{
  color:var(--text-support);
  font-size:.8rem;
  font-weight:750;
  letter-spacing:0;
  text-transform:none;
}
.grammar-pattern-item .english-audio-row{
  align-items:center;
}
.grammar-pattern-item .english-audio-row strong{
  color:var(--text-primary);
  font-size:1.05rem;
  line-height:1.45;
}
.grammar-pattern-item > p{
  margin:.55rem 0 0;
  color:var(--text-secondary);
  line-height:1.6;
}
.grammar-extra-note{
  margin-top:14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface-soft);
}
.grammar-extra-note > summary{
  padding:12px 14px;
  cursor:pointer;
  color:var(--text-primary);
  font-weight:800;
}
.grammar-extra-note > p{
  margin:0;
  padding:0 14px 14px;
  color:var(--text-secondary);
  line-height:1.75;
}
.challenge-word-card{
  border-color:color-mix(in srgb,var(--gold) 50%,var(--line));
}
.challenge-word-badge,
.challenge-phrase-label{
  display:inline-flex;
  width:max-content;
  max-width:100%;
  align-items:center;
  margin:0 0 10px;
  padding:5px 9px;
  border-radius:999px;
  background:color-mix(in srgb,var(--gold) 20%,var(--panel-solid));
  color:var(--text-primary);
  font-size:.72rem;
  font-weight:900;
  line-height:1.25;
}
.advanced-word-support{
  display:grid;
  gap:10px;
  margin-top:12px;
  padding-top:12px;
  border-top:1px dashed var(--line);
}
.simple-definition{
  margin:0;
  color:var(--text-secondary);
  line-height:1.65;
}
.simple-definition span{
  color:var(--text-primary);
  font-weight:850;
}
.challenge-example{
  display:grid;
  gap:7px;
  padding:11px;
  border:1px solid var(--line);
  border-radius:13px;
  background:var(--surface-soft);
}
.challenge-example .challenge-phrase-label{
  margin:0;
  background:color-mix(in srgb,var(--rose-soft) 58%,var(--panel-solid));
}
.challenge-example .english-audio-row{
  align-items:center;
}
.challenge-example .english-audio-row strong{
  min-width:0;
  font-size:.98rem;
  line-height:1.5;
}
.challenge-example .translation{
  margin:0;
}
@media(max-width:700px){
  .grammar-pattern-grid{
    grid-template-columns:1fr;
  }
  .grammar-pattern-item{
    padding:13px;
  }
  .grammar-pattern-label{
    align-items:flex-start;
    flex-direction:column;
    gap:2px;
  }
  .challenge-word-badge,
  .challenge-phrase-label{
    white-space:normal;
  }
}

/* ===== V251.11 compact welcome tile ===== */
.personal-greeting{
  grid-template-columns:minmax(0,1fr) minmax(220px,300px);
  gap:16px;
  margin:18px 0 22px;
  padding:18px 22px;
  border-radius:28px;
}
.personal-greeting-copy{
  min-width:0;
  display:flex;
  align-items:center;
}
.personal-greeting h2{
  margin:0;
  font-size:clamp(.98rem,3.55vw,1.55rem);
  line-height:1.1;
  white-space:nowrap;
  letter-spacing:-.045em;
}
.personal-greeting .eyebrow,
.personal-greeting p,
.personal-greeting .home-english,
.personal-greeting .instruction-english{display:none!important}
.rice-progress{
  grid-template-columns:82px minmax(0,1fr);
  gap:12px;
  align-items:center;
}
.rice-progress svg{width:82px}
.rice-progress-copy{gap:5px}
.rice-progress-copy strong{
  display:inline-flex;
  align-items:center;
  width:max-content;
  padding:6px 12px;
  border-radius:999px;
  background:linear-gradient(135deg,#ffe2ee,#ffd5e8);
  box-shadow:0 8px 22px rgba(219,120,156,.18);
  color:#c34473;
  font-size:1.65rem;
  line-height:1;
}
.rice-progress-copy span{
  font-size:.98rem;
  line-height:1.4;
}
.rice-progress-copy small{
  color:#5f8e4a!important;
  font-size:.88rem;
  font-weight:700;
  line-height:1.45;
}
@media(max-width:900px){
  .personal-greeting{
    grid-template-columns:1fr;
    gap:12px;
    padding:16px 18px;
  }
}
@media(max-width:700px){
  .personal-greeting h2{font-size:clamp(.92rem,3.8vw,1.08rem)}
  .rice-progress{grid-template-columns:74px 1fr;gap:10px}
  .rice-progress svg{width:74px}
  .rice-progress-copy strong{font-size:1.42rem;padding:5px 11px}
  .rice-progress-copy span{font-size:.92rem}
  .rice-progress-copy small{font-size:.82rem}
}
@media(max-width:430px){
  .personal-greeting{padding:14px 16px;border-radius:24px}
  .personal-greeting h2{font-size:.9rem}
  .rice-progress{grid-template-columns:70px 1fr}
  .rice-progress svg{width:70px}
}
html[data-theme-resolved="dark"] .rice-progress-copy strong{
  background:linear-gradient(135deg,#5a3141,#7a4561);
  color:#ffd3e1;
}
html[data-theme-resolved="dark"] .rice-progress-copy small{
  color:#b1d08c!important;
}

/* ===== V251.12 home hero refinement ===== */
.course-hero{
  grid-template-columns:minmax(0,1.3fr) minmax(270px,.8fr);
  gap:26px;
  padding:clamp(24px,4vw,42px);
  background:linear-gradient(145deg,#fffefa 0%,#fff6f8 54%,#fff3ed 100%);
}
.course-hero::before{
  content:"";
  position:absolute;
  inset:0;
  background:radial-gradient(circle at 15% 18%,rgba(255,255,255,.75),transparent 24%),
             radial-gradient(circle at 68% 78%,rgba(255,214,227,.38),transparent 22%);
  pointer-events:none;
}
.hero-copy{display:grid;align-content:center;gap:10px;min-width:0}
.hero-badge{
  display:inline-flex;
  align-items:center;
  width:max-content;
  padding:8px 14px;
  border-radius:999px;
  background:rgba(255,255,255,.78);
  border:1px solid rgba(111,24,53,.12);
  box-shadow:0 8px 18px rgba(111,24,53,.08);
}
.course-hero h1{
  margin:.05rem 0 .35rem;
  max-width:10.4ch;
  line-height:1.04;
}
.course-hero h1 span{
  display:inline-block;
  margin-top:.06em;
}
.course-hero .thai-lead{
  margin:0;
  max-width:22rem;
  font-size:1.08rem;
  line-height:1.7;
}
.hero-actions{
  margin-top:10px;
  gap:12px;
}
.hero-actions .audio-controls{
  display:flex;
  gap:10px;
}
.hero-actions .audio-controls button{
  min-width:52px;
  min-height:52px;
  border-radius:16px;
  box-shadow:0 10px 22px rgba(57,20,36,.12);
}
.hero-actions .love-button,
.hero-actions .soft-button{
  min-height:58px;
  padding-inline:20px;
  border-radius:18px;
}
.hero-emblem-art{
  min-height:340px;
  border-radius:30px;
  box-shadow:0 22px 54px rgba(48,17,29,.18);
}
.hero-emblem-art>img{filter:saturate(.96) contrast(1) brightness(.98)}
.hero-emblem-overlay{padding:28px}
.hero-emblem-overlay .big-heart{
  font-size:5rem;
  text-shadow:0 10px 24px rgba(27,10,16,.54);
}
.hero-emblem-overlay small{
  padding:6px 12px;
  border-radius:999px;
  background:rgba(255,255,255,.14);
  backdrop-filter:blur(8px);
}
@media(max-width:900px){
  .course-hero{grid-template-columns:1fr;gap:18px;padding:24px 22px}
  .course-hero h1{max-width:none;font-size:clamp(2.25rem,7vw,3.35rem)}
  .course-hero .thai-lead{max-width:none}
  .hero-emblem-art{min-height:280px}
}
@media(max-width:620px){
  .course-hero{padding:22px 18px;border-radius:24px}
  .hero-badge{padding:7px 12px;font-size:.9rem}
  .course-hero h1{font-size:2.25rem;line-height:1.06}
  .course-hero .thai-lead{font-size:.98rem;line-height:1.62}
  .hero-actions{display:grid;grid-template-columns:1fr;gap:10px}
  .hero-actions .audio-controls{justify-content:flex-start}
  .hero-actions .audio-controls button{min-width:50px;min-height:50px}
  .hero-emblem-art{min-height:230px}
  .hero-emblem-overlay .big-heart{font-size:4.4rem}
}
@media(max-width:430px){
  .course-hero h1{font-size:2.02rem}
  .course-hero .thai-lead{font-size:.94rem}
}
html[data-theme-resolved="dark"] .course-hero{
  background:linear-gradient(145deg,#30232a,#3a2730 52%,#442a36);
}
html[data-theme-resolved="dark"] .hero-badge{
  background:rgba(255,255,255,.08);
  border-color:rgba(255,255,255,.1);
  box-shadow:none;
}

/* ===== V251.13 mobile hero compaction ===== */
@media(max-width:620px){
  .course-hero{
    gap:14px;
    padding:18px 16px;
  }
  .hero-copy{
    gap:8px;
  }
  .course-hero h1{
    font-size:1.92rem;
    line-height:1.05;
    margin:.02rem 0 .2rem;
  }
  .course-hero .thai-lead{
    font-size:.92rem;
    line-height:1.52;
  }
  .hero-actions{
    gap:8px;
    margin-top:6px;
  }
  .hero-actions .love-button,
  .hero-actions .soft-button{
    min-height:50px;
    padding:12px 16px;
    border-radius:16px;
    font-size:.98rem;
  }
  .hero-actions .audio-controls{
    gap:8px;
  }
  .hero-actions .audio-controls button{
    min-width:46px;
    min-height:46px;
    border-radius:14px;
  }
  .hero-emblem-art{
    min-height:200px;
    border-radius:24px;
  }
  .hero-emblem-overlay{
    padding:20px;
  }
  .hero-emblem-overlay .big-heart{
    font-size:3.8rem;
  }
  .hero-emblem-overlay small{
    margin-top:10px;
    font-size:.92rem;
  }
}
@media(max-width:430px){
  .course-hero{
    padding:16px 14px;
    gap:12px;
  }
  .hero-badge{
    padding:6px 10px;
    font-size:.86rem;
  }
  .course-hero h1{
    font-size:1.78rem;
  }
  .hero-actions .love-button,
  .hero-actions .soft-button{
    min-height:46px;
    padding:11px 14px;
    font-size:.95rem;
  }
  .hero-actions .audio-controls button{
    min-width:42px;
    min-height:42px;
  }
  .hero-emblem-art{
    min-height:182px;
  }
  .hero-emblem-overlay{
    padding:16px;
  }
  .hero-emblem-overlay .big-heart{
    font-size:3.35rem;
  }
}


/* ===== V251.15 hero image between primary and secondary actions ===== */
.course-hero{
  grid-template-columns:minmax(0,1.06fr) minmax(280px,.94fr);
  align-items:center;
}
.hero-actions-primary{
  margin-top:14px;
}
.hero-actions-primary .love-button{
  width:min(100%,460px);
  justify-content:center;
}
.hero-secondary-actions{
  display:grid;
  gap:12px;
  align-self:start;
}
.hero-secondary-actions .soft-button{
  width:100%;
  min-height:58px;
  justify-content:center;
}
@media(min-width:901px){
  .hero-copy{align-self:center}
  .hero-emblem-art{grid-column:2;grid-row:1 / span 2}
  .hero-secondary-actions{grid-column:1;grid-row:2;width:min(100%,460px)}
}
@media(max-width:900px){
  .course-hero{grid-template-columns:1fr;gap:16px}
  .hero-actions-primary{margin-top:8px}
  .hero-secondary-actions{gap:10px}
  .hero-secondary-actions .soft-button{min-height:52px;border-radius:16px}
}
@media(max-width:620px){
  .hero-actions-primary .love-button{min-height:50px;padding:12px 16px;border-radius:16px;font-size:.98rem}
  .hero-secondary-actions .soft-button{min-height:50px;padding:12px 16px;border-radius:16px;font-size:.98rem}
}
@media(max-width:430px){
  .hero-actions-primary .love-button{min-height:46px;padding:11px 14px;font-size:.95rem}
  .hero-secondary-actions .soft-button{min-height:46px;padding:11px 14px;font-size:.95rem}
}


/* ===== V251.16 reliable single-tap hero actions ===== */
.course-hero::after,
.lesson-hero::after,
.hero-emblem-art::after,
.hero-emblem-overlay{
  pointer-events:none;
}
.hero-secondary-actions{
  position:relative;
  z-index:6;
  isolation:isolate;
  pointer-events:auto;
}
.hero-secondary-actions > .game-link-button,
.hero-secondary-actions > .install-button{
  position:relative;
  z-index:1;
  pointer-events:auto;
  touch-action:manipulation;
  -webkit-tap-highlight-color:rgba(52,93,58,.12);
  user-select:none;
  -webkit-user-select:none;
  transform:none;
}
.hero-secondary-actions > .game-link-button:active,
.hero-secondary-actions > .install-button:active,
.hero-secondary-actions > .game-link-button.is-touching,
.hero-secondary-actions > .install-button.is-touching{
  transform:scale(.985);
  filter:brightness(.97);
}
@media (hover:none), (pointer:coarse){
  .love-button:hover,
  .soft-button:hover,
  .complete-button:hover{
    transform:none;
  }
}
@media (hover:hover) and (pointer:fine){
  .hero-secondary-actions > .game-link-button:hover,
  .hero-secondary-actions > .install-button:hover{
    transform:translateY(-2px);
  }
}


/* ===== V251.18 restore featured Love & Rice quest card ===== */
.home-game-card{
  display:grid;
  grid-template-columns:1fr;
  gap:22px;
  margin:22px 0 28px;
  padding:28px;
  border-radius:34px;
}
.home-game-card .game-entry-world{
  width:100%;
  min-width:0;
  min-height:170px;
  border-radius:30px;
  gap:20px;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.38),0 14px 34px rgba(48,74,38,.12);
}
.home-game-card .game-entry-world span{font-size:3rem}
.home-game-card .game-entry-world span:last-child{font-size:2.5rem}
.home-game-card .game-entry-copy{display:grid;gap:10px}
.home-game-card .eyebrow{margin:0;font-size:clamp(1rem,2vw,1.12rem);letter-spacing:.04em}
.home-game-card h2{margin:0;color:var(--text-primary);font-size:clamp(2rem,5vw,3.35rem);font-weight:950;line-height:1.08;letter-spacing:-.045em}
.home-game-card p:not(.eyebrow){margin:0;color:var(--text-secondary);font-size:clamp(1.02rem,2.2vw,1.25rem);font-weight:650;line-height:1.7}
.home-game-card .love-button{width:100%;justify-content:center;min-height:66px;border-radius:22px;font-size:1.15rem}
@media(max-width:760px){
  .home-game-card{padding:22px 18px;gap:18px;border-radius:28px}
  .home-game-card .game-entry-world{min-height:140px;border-radius:24px}
  .home-game-card .game-entry-world span{font-size:2.5rem}
  .home-game-card .game-entry-world span:last-child{font-size:2.1rem}
  .home-game-card h2{font-size:2.15rem}
  .home-game-card p:not(.eyebrow){font-size:1rem}
  .home-game-card .love-button{min-height:58px;font-size:1.04rem;border-radius:18px}
}
@media(max-width:430px){
  .home-game-card{padding:18px 16px;gap:16px}
  .home-game-card .game-entry-world{min-height:118px}
  .home-game-card h2{font-size:1.78rem}
  .home-game-card .eyebrow{font-size:.92rem}
  .home-game-card p:not(.eyebrow){font-size:.96rem}
  .home-game-card .love-button{min-height:54px;font-size:1rem}
}


/* V277.2 learning-first shell */
.private-tools-menu{position:relative}.private-tools-menu>summary{cursor:pointer;list-style:none;font-weight:800}
.private-tools-menu>summary::-webkit-details-marker{display:none}.private-tools-popover{position:absolute;z-index:80;right:0;top:calc(100% + .5rem);min-width:230px;padding:.65rem;border-radius:16px;background:var(--surface,#fff);box-shadow:0 14px 34px rgba(0,0,0,.2);border:1px solid rgba(127,127,127,.22)}
.private-tools-popover a,.private-tools-popover label{display:block;padding:.6rem;border-radius:10px}
.private-learning-step-strip{display:grid;grid-template-columns:repeat(5,1fr);gap:.45rem;margin:1rem 0}
.private-learning-step-strip a{text-align:center;text-decoration:none;padding:.65rem .35rem;border-radius:14px;border:1px solid rgba(127,127,127,.2);font-weight:800}.private-learning-step-strip span{font-size:.75rem;opacity:.75}
.lesson-extra-help,.private-learning-tools{margin:1rem 0;border:1px solid rgba(127,127,127,.22);border-radius:16px;overflow:hidden}
.lesson-extra-help>summary,.private-learning-tools>summary{cursor:pointer;font-weight:800;padding:.9rem 1rem}
.lesson-extra-help-body{padding:0 1rem 1rem}.lesson-extra-help-body>.content-card{margin:0}
.private-learning-tools-grid{display:flex;flex-wrap:wrap;gap:.55rem;padding:0 1rem 1rem}.private-learning-tools-grid>a,.private-learning-tools-grid>button{min-height:42px}
.home-shell .personal-greeting-copy [data-current-lesson]{margin:.25rem 0 0;font-weight:800}
@media(max-width:760px){.private-learning-step-strip{grid-template-columns:1fr 1fr}.private-learning-step-strip a:last-child{grid-column:1/-1}.private-tools-popover{position:fixed;left:1rem;right:1rem;top:auto}}
