/* Self-hosted Khmer webfonts — no runtime external requests.
   Primary: Kantumruy Pro (Viseth's choice, 2026-11-30, from Google Fonts).
   Fallback: Noto Sans Khmer. Khmer needs proper shaping + generous
   line-height so subscript legs (ជើង/coeng) are not clipped. */
@font-face{
  font-family:'Kantumruy Pro';
  font-style:normal;
  font-weight:100 700;
  font-display:swap;
  src:url(/fonts/kantumruy-pro-khmer.woff2) format('woff2');
  unicode-range:U+1780-17FF, U+19E0-19FF, U+200C-200D, U+25CC;
}
@font-face{
  font-family:'Kantumruy Pro';
  font-style:normal;
  font-weight:100 700;
  font-display:swap;
  src:url(/fonts/kantumruy-pro-latin.woff2) format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face{
  font-family:'Kantumruy Pro';
  font-style:normal;
  font-weight:100 700;
  font-display:swap;
  src:url(/fonts/kantumruy-pro-latin-ext.woff2) format('woff2');
  unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face{
  font-family:'Noto Sans Khmer';
  font-style:normal;
  font-weight:100 900;
  font-display:swap;
  src:url(/fonts/noto-sans-khmer-khmer.woff2) format('woff2');
  unicode-range:U+1780-17FF, U+19E0-19FF, U+200C-200D, U+25CC;
}
@font-face{
  font-family:'Noto Sans Khmer';
  font-style:normal;
  font-weight:100 900;
  font-display:swap;
  src:url(/fonts/noto-sans-khmer-latin.woff2) format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root{
  --bg:#FFFBF2; --surface:#ffffff; --surface2:#FFF3E2; --text:#33272A; --muted:#7A6A5E;
  --accent:#FF6B35; --accent2:#1B8FBF; --blue:#1B8FBF; --orange:#FF6B35; --amber:#F5A623;
  --green:#2FA84F; --purple:#8B5CF6; --sky:#29B6E8; --teal:#0E8FA8; --pink:#E84A7F;
  --sun:#FFB703; --grape:#8338EC;
  --border:#F0E2CE; --good:#2FA84F; --bad:#D64545;
  --ink-on-light:#33272A; --radius:24px; --shadow:0 4px 18px rgba(120,70,20,.10), 0 2px 6px rgba(120,70,20,.06);
  --peach:#FFE8D6; --peach-soft:#FFF0E3;
}
html[data-theme="dark"]{
  --bg:#1D1826; --surface:#2A2438; --surface2:#352E47; --text:#F5EFE6; --muted:#C9B8A3;
  --accent:#FF8F70; --accent2:#4FC3E8; --blue:#2AA9D8; --orange:#FF8F70; --border:#4A4066; --good:#4CC983; --bad:#FF7B7B;
  --shadow:0 4px 14px rgba(0,0,0,.4); --peach:#3A2E3F; --peach-soft:#332A3E;
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent}
html,body{height:100%; margin:0}
body{font-family:'Kantumruy Pro','Noto Sans Khmer',system-ui,-apple-system,"Segoe UI",sans-serif; line-height:1.7; background:var(--bg); color:var(--text); overflow:hidden}
#shell{height:100dvh; display:flex; flex-direction:column}
.page{flex:1; min-height:0; display:flex; flex-direction:column}
.page[hidden]{display:none}
.page-scroll{flex:1; min-height:0; overflow-y:auto; padding:14px 14px 18px; max-width:900px; width:100%; margin:0 auto}
#app-main{flex:1; min-height:0; display:flex; flex-direction:column}
#app-main[hidden]{display:none}
h1,h2,h3{font-weight:800; line-height:1.65}
.page-heading{font-size:28px; font-weight:900; margin:4px 0 2px; color:var(--text); line-height:1.65}
.page-subtitle{color:var(--muted); font-weight:700; font-size:16px; margin:0 0 14px; line-height:1.7}

/* top bar */
#topbar{display:flex; align-items:center; gap:8px; padding:8px 12px; background:var(--surface); border-bottom:1px solid var(--border); flex:none}
#topbar-title{flex:1; font-weight:800; font-size:17px; text-align:center; line-height:1.6}
#topbar-actions{display:flex; gap:6px}
.icon-btn{width:40px; height:40px; border-radius:50%; border:2px solid var(--border); background:var(--surface2); color:var(--text); font-size:18px; cursor:pointer; display:grid; place-items:center}
.icon-btn.off{opacity:.35}
#btn-back{font-size:26px; line-height:1}

/* floating tab bar */
#tabbar-wrap{display:flex; align-items:center; gap:8px; padding:8px 10px calc(8px + env(safe-area-inset-bottom)); flex:none; background:transparent}
#tabbar{display:flex; flex:1; min-width:0; background:var(--surface); border-radius:28px; box-shadow:0 8px 24px rgba(60,30,10,.14), 0 2px 8px rgba(60,30,10,.08); padding:6px; gap:2px; border:1px solid var(--border)}
.tab{flex:1; min-width:0; padding:7px 2px 6px; border:none; background:none; color:var(--text); cursor:pointer; font-family:inherit; display:flex; flex-direction:column; align-items:center; gap:2px; border-radius:20px; line-height:1.55}
.tab-icon{width:24px; height:24px; display:grid; place-items:center}
.tab-icon svg{width:24px; height:24px}
.tab-label{font-size:13px; font-weight:800; line-height:1.55; white-space:nowrap}
.tab[data-page="home"] .tab-icon{color:#FF6B35}
.tab[data-page="lessons"] .tab-icon{color:#F5A623}
.tab[data-page="play"] .tab-icon{color:#2FA84F}
.tab[data-page="daily"] .tab-icon{color:#1B8FBF}
.tab[data-page="stories"] .tab-icon{color:#E84A7F}
.tab.active{color:#fff}
.tab.active .tab-icon{color:#fff}
.tab.active[data-page="home"]{background:#FF6B35}
.tab.active[data-page="lessons"]{background:#F5A623}
.tab.active[data-page="play"]{background:#2FA84F}
.tab.active[data-page="daily"]{background:#1B8FBF}
.tab.active[data-page="stories"]{background:#E84A7F}
#tabbar-side{display:flex; flex-direction:column; gap:6px; flex:none}
.side-btn{width:40px; height:40px; border-radius:50%; border:1px solid var(--border); background:var(--surface); cursor:pointer; display:grid; place-items:center; box-shadow:0 4px 12px rgba(60,30,10,.10)}
.side-btn svg{width:21px; height:21px}
.side-sound{color:#FF6B35}
.side-music{color:#8B5CF6}
.side-btn.off{opacity:.35}

/* generic */
.card{background:var(--surface); border:1px solid var(--border); border-radius:24px; padding:18px; box-shadow:var(--shadow); margin-bottom:14px}
.btn{border:none; border-radius:999px; padding:14px 22px; font-size:18px; font-weight:800; cursor:pointer; font-family:inherit; line-height:1.6; background:var(--surface2); color:var(--text); box-shadow:0 4px 14px rgba(120,70,20,.12)}
.btn-primary{background:var(--blue); color:#fff}
.btn-blue{background:var(--blue); color:#fff}
.btn-orange{background:var(--orange); color:#fff}
.btn-accent2{background:var(--blue); color:#fff}
.btn-ghost{background:none; color:var(--muted); text-decoration:underline; box-shadow:none}
.btn-outline{background:#fff; color:var(--text); border:2px solid var(--border); box-shadow:var(--shadow)}
html[data-theme="dark"] .btn-outline{background:var(--surface); color:var(--text)}
.btn-big{width:100%; padding:15px; font-size:19px; margin-top:10px}
.btn:active{transform:scale(.97)}
.btn:disabled{opacity:.45}
.big-input{width:100%; padding:14px 16px; font-size:18px; border:2px solid var(--border); border-radius:16px; background:#fff; color:var(--ink-on-light); font-family:inherit; margin:4px 0 10px; line-height:1.65}
html[data-theme="dark"] .big-input{background:var(--surface2); color:var(--text)}
.field-label{font-weight:800; color:var(--muted); font-size:15px; line-height:1.65; display:block; margin-top:10px}
.helper-text{color:var(--muted); font-weight:600; font-size:14px; line-height:1.7; margin:2px 0 6px}
.error-text{color:var(--bad); font-weight:700}
h2{margin:6px 0 10px}
.sticky-next{position:sticky; bottom:0; padding:10px 0 4px; background:linear-gradient(transparent, var(--bg) 30%)}
.progress-bar{height:12px; background:var(--surface2); border-radius:999px; overflow:hidden; margin:8px 0}
.progress-fill{height:100%; background:var(--blue); transition:width .3s; border-radius:999px}
.progress-fill.purple{background:var(--purple)}
.stars{font-size:30px; color:#FFB703; display:inline-flex; gap:4px; align-items:center}
#toast{position:fixed; left:50%; bottom:110px; transform:translateX(-50%); background:var(--text); color:var(--bg); padding:10px 18px; border-radius:20px; font-weight:700; z-index:99; max-width:90vw; text-align:center}

/* login */
#page-login{align-items:center; justify-content:flex-start; overflow-y:auto; padding:18px 16px 24px}
.login-wrap{width:100%; max-width:460px; margin:0 auto}
.login-owl-box{width:150px; height:150px; margin:6px auto 10px; background:var(--peach); border-radius:36px; display:grid; place-items:center; box-shadow:var(--shadow); overflow:hidden}
.login-owl-box svg{width:132px; height:132px}
.login-heading{text-align:center; font-size:30px; font-weight:900; margin:6px 0 2px; color:var(--text); line-height:1.65}
.login-subtitle{text-align:center; color:var(--muted); margin:2px 0 16px; font-weight:700; font-size:16px; line-height:1.7}
.auth-toggles{display:flex; gap:10px; margin-bottom:14px}
.auth-toggle{flex:1; padding:13px 8px; border-radius:999px; border:2px solid var(--border); background:#fff; color:var(--ink-on-light); font-size:16px; font-weight:800; cursor:pointer; font-family:inherit; line-height:1.6; box-shadow:var(--shadow)}
html[data-theme="dark"] .auth-toggle{background:var(--surface); color:var(--text)}
.auth-toggle.active{background:var(--blue); border-color:var(--blue); color:#fff}
.auth-toggle.active.signup{background:var(--orange); border-color:var(--orange); color:#fff}
.login-card{margin-bottom:12px; border-radius:24px}
.login-input{font-size:20px; padding:15px 16px; border-radius:16px}
.avatar-grid{display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin:6px 0 12px}
.avatar-opt{aspect-ratio:1/1; border-radius:18px; border:3px solid transparent; cursor:pointer; display:grid; place-items:center; padding:6px; font-family:inherit}
.avatar-opt svg{width:100%; height:100%}
.avatar-opt.sel{border-color:#FF6B35; box-shadow:0 0 0 2px #FF6B35}
.color-row{display:flex; gap:10px; flex-wrap:wrap; margin:6px 0 12px}
.color-opt{width:44px; height:44px; border-radius:50%; border:3px solid transparent; cursor:pointer}
.color-opt.sel{border-color:#33272A; box-shadow:0 0 0 2px #fff, 0 0 0 5px #33272A}
html[data-theme="dark"] .color-opt.sel{border-color:#fff; box-shadow:0 0 0 2px var(--surface), 0 0 0 5px #fff}
.grade-pills{display:flex; gap:8px; flex-wrap:wrap; margin:6px 0 12px}
.grade-pill{min-width:52px; padding:10px 14px; border-radius:999px; border:2px solid var(--border); background:#fff; color:var(--ink-on-light); font-size:17px; font-weight:800; cursor:pointer; font-family:inherit; line-height:1.6}
html[data-theme="dark"] .grade-pill{background:var(--surface2); color:var(--text)}
.grade-pill.sel{background:var(--orange); border-color:var(--orange); color:#fff}
.new-code{font-size:52px; font-weight:900; text-align:center; color:var(--orange); padding:14px; border:3px dashed var(--orange); border-radius:16px; margin:10px 0; line-height:1.4}

/* home */
.home-greet{font-size:28px; font-weight:900; margin:4px 0 2px; line-height:1.65}
.home-sub{color:var(--muted); font-weight:700; margin:0 0 14px; line-height:1.7}
.home-profile-row{display:flex; gap:14px; align-items:stretch; margin-bottom:12px}
.home-avatar{width:132px; min-height:132px; flex:none; background:var(--peach); border-radius:28px; display:grid; place-items:center; overflow:hidden; box-shadow:var(--shadow); padding:8px}
.home-avatar svg{width:100%; height:100%; max-height:132px}
.home-avatar-letter{font-size:56px; font-weight:900; color:var(--ink-on-light); line-height:1.2}
.home-pills{flex:1; min-width:0; display:flex; flex-direction:column; gap:8px}
.info-pill{display:flex; align-items:center; gap:8px; border-radius:999px; padding:9px 14px; font-weight:800; font-size:15px; line-height:1.6; color:var(--ink-on-light)}
.info-pill svg{width:18px; height:18px; flex:none}
.pill-yellow{background:#FFEC99}
.pill-purple{background:#E5DBFF}
.pill-peach{background:#FFE8D6}
.pill-blue{background:#D0EBFF}
.medal-mini-row{display:flex; gap:5px; align-items:center; padding:2px 4px}
.medal-mini{width:26px; height:26px; border-radius:50%; display:grid; place-items:center; font-size:13px; font-weight:900}
.medal-mini svg{width:20px; height:20px}
.level-caption{color:var(--muted); font-weight:700; font-size:14px; line-height:1.7; margin:2px 0 14px}
.daily-big-card{display:flex; gap:14px; align-items:center; width:100%; text-align:left; border:none; cursor:pointer; font-family:inherit; background:var(--blue); color:#fff; border-radius:24px; padding:18px; box-shadow:var(--shadow); margin-bottom:16px; line-height:1.65}
.daily-big-card:active{transform:scale(.98)}
.daily-cal-box{width:64px; height:64px; flex:none; background:#3AA7D4; border-radius:18px; display:grid; place-items:center}
.daily-cal-box svg{width:36px; height:36px}
.daily-big-title{font-size:22px; font-weight:900; line-height:1.6}
.daily-big-sub{font-weight:700; font-size:15px; line-height:1.65; opacity:.95}
.medals-heading{font-size:19px; font-weight:900; margin:8px 0 10px; line-height:1.65}
.medal-grid{display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:16px}
.medal-card{background:var(--surface); border:1px solid var(--border); border-radius:20px; padding:10px 6px 8px; text-align:center; box-shadow:var(--shadow); color:var(--ink-on-light)}
html[data-theme="dark"] .medal-card{color:var(--text)}
.medal-card svg{width:56px; height:64px}
.medal-name{font-weight:800; font-size:13px; line-height:1.6}
.medal-state{font-size:12px; font-weight:700; color:var(--muted); line-height:1.6}
.medal-card.earned .medal-state{color:var(--good)}
.profile-card{display:flex; align-items:center; gap:14px}
.avatar-big{width:72px; height:72px; border-radius:50%; display:grid; place-items:center; font-size:30px; font-weight:900; color:#fff; flex:none}
.flame{color:#FF7A1A; font-weight:900}
.grid2{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.grid3{display:grid; grid-template-columns:repeat(3,1fr); gap:12px}
.tile{background:var(--surface); border:1px solid var(--border); border-radius:24px; padding:18px 10px 14px; text-align:center; cursor:pointer; box-shadow:var(--shadow); color:var(--ink-on-light)}
html[data-theme="dark"] .tile{color:var(--text)}
.tile:active{transform:scale(.97)}
.tile .tile-title{font-weight:800; font-size:17px; margin-top:6px; line-height:1.65}
.tile .tile-sub{color:#7C5A41; font-size:13px; font-weight:700; line-height:1.65}
html[data-theme="dark"] .tile .tile-sub{color:var(--muted)}
.tile svg{width:72px; height:72px}
.tile-game{border-width:1px}
.tile-game svg{width:76px; height:76px}
.tile-game .tile-title{font-size:16px}
.stat-chip{display:inline-flex; align-items:center; gap:5px; background:#fff; color:var(--ink-on-light); border-radius:999px; padding:3px 12px; font-weight:800; margin-right:6px; box-shadow:0 2px 0 rgba(0,0,0,.12)}
.lesson-thumb{width:64px; height:64px; flex:none; border-radius:14px; background:#FFFDF7; border:2px solid #F0D9C0; display:grid; place-items:center; overflow:hidden}
.lesson-thumb svg{width:100%; height:100%}

/* lessons */
.subject-grid-big{display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:14px}
.subject-card-big{border:none; border-radius:24px; padding:20px 14px 16px; text-align:left; cursor:pointer; font-family:inherit; color:#fff; box-shadow:var(--shadow); min-height:148px; display:flex; flex-direction:column; gap:4px; line-height:1.65}
.subject-card-big:active{transform:scale(.97)}
.subject-card-big .sc-km{font-size:24px; font-weight:900; line-height:1.6}
.subject-card-big .sc-en{font-size:15px; font-weight:700; opacity:.95; line-height:1.6}
.subject-card-big .sc-stars{margin-top:auto; align-self:flex-start; display:inline-flex; align-items:center; gap:6px; background:rgba(255,255,255,.92); color:var(--ink-on-light); border-radius:999px; padding:3px 12px; font-weight:900; font-size:15px; line-height:1.6}
.subject-card-big .sc-stars svg{width:16px; height:16px}
.lessons-back{display:inline-flex; align-items:center; gap:6px; margin-bottom:10px}
.chip-row{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px}
.chip{padding:9px 16px; border-radius:999px; border:2px solid var(--border); background:var(--surface); color:var(--text); font-weight:800; cursor:pointer; font-family:inherit; font-size:15px; line-height:1.6}
.chip.sel{background:var(--orange); color:#fff; border-color:var(--orange)}
.lesson-row{display:flex; align-items:center; gap:12px; width:100%; text-align:left}
.lesson-row .grow{flex:1}
.learn-card{text-align:center; padding:22px 16px; background:#FFFDF7; color:var(--ink-on-light); border-color:#F0D9C0}
.learn-word{font-size:56px; font-weight:900; line-height:1.6}
.learn-en{font-size:20px; color:#7C5A41; font-weight:700; line-height:1.65}
.pic-frame{aspect-ratio:1/1; width:min(280px,80vw); margin:10px auto; background:#FFFDF7; border:3px solid #F0D9C0; border-radius:20px; display:grid; place-items:center; overflow:hidden}
.pic-frame svg{width:100%; height:100%}
.choice-grid{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.choice-btn{padding:16px 10px; font-size:20px; font-weight:800; line-height:1.65; border-radius:18px; border:3px solid var(--border); background:var(--surface); color:var(--text); cursor:pointer; font-family:inherit}
.choice-btn.correct{background:#D9F5E3; border-color:var(--good); color:#14532D}
.choice-btn.wrong{background:#FFE0E0; border-color:var(--bad); color:#7F1D1D}
.choice-btn .pic-frame{width:min(150px,60vw)}
.match-grid{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.match-btn{padding:14px 8px; font-size:19px; font-weight:800; line-height:1.65; border-radius:18px; border:3px solid var(--border); background:var(--surface); color:var(--text); cursor:pointer; font-family:inherit; min-height:64px}
.match-btn.sel{border-color:var(--orange); background:var(--surface2)}
.match-btn.done{opacity:.35; pointer-events:none}
.match-btn .pic-frame{width:min(120px,50vw); margin:0 auto}
.tiles{display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin:12px 0}
.tile-btn{min-width:52px; height:52px; padding:0 10px; font-size:24px; font-weight:800; border-radius:14px; border:2px solid var(--border); background:var(--surface2); color:var(--text); cursor:pointer; font-family:inherit}
.tile-btn.used{opacity:.3; pointer-events:none}
.built-word{font-size:44px; font-weight:900; text-align:center; min-height:60px; line-height:1.6}
.result-card{text-align:center; padding:26px 16px; background:#FFFDF7; color:var(--ink-on-light)}
.result-card .btn-primary{background:var(--blue); color:#fff}
.feedback{font-size:19px; font-weight:800; text-align:center; min-height:28px; margin:8px 0; line-height:1.65}
.feedback.good{color:var(--good)} .feedback.bad{color:var(--bad)}
.explain{background:var(--surface2); border-radius:14px; padding:10px 14px; margin-top:8px; color:var(--text); line-height:1.7}
.step-label{color:var(--muted); font-weight:800; text-align:center; line-height:1.65}
.q-text{font-size:23px; font-weight:800; text-align:center; margin:10px 0; line-height:1.75}
.lp-dots{display:flex; gap:7px; justify-content:center; margin:6px 0 2px}
.lp-dot{width:13px; height:13px; border-radius:50%; background:var(--surface2); border:2px solid var(--border)}
.lp-dot.done{background:var(--blue); border-color:var(--blue)}
.lp-dot.now{background:var(--sun); border-color:var(--sun); transform:scale(1.25)}

/* play */
.play-grid{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.play-card{background:#fff; border:1px solid var(--border); border-radius:24px; padding:12px 12px 14px; text-align:center; cursor:pointer; box-shadow:var(--shadow); color:var(--ink-on-light); font-family:inherit}
html[data-theme="dark"] .play-card{background:var(--surface); color:var(--text)}
.play-card:active{transform:scale(.97)}
.play-art{aspect-ratio:1/1; border-radius:18px; display:grid; place-items:center; overflow:hidden; margin-bottom:10px; padding:10px}
.play-art svg{width:100%; height:100%}
.play-title{font-weight:900; font-size:18px; line-height:1.65}
.play-desc{color:#7A6A5E; font-weight:600; font-size:14px; line-height:1.7; margin-top:2px}
html[data-theme="dark"] .play-desc{color:var(--muted)}
.play-entag{font-weight:900; color:#7A6A5E; font-size:13px; line-height:1.6; margin-top:4px}
html[data-theme="dark"] .play-entag{color:var(--muted)}

/* daily */
.daily-result-card{text-align:center; padding:24px 18px}
.star-row{display:flex; justify-content:center; gap:6px; margin:6px 0 8px}
.star-row svg{width:44px; height:44px}
.daily-result-title{font-size:26px; font-weight:900; line-height:1.65; margin:4px 0}
.daily-result-score{font-weight:700; color:var(--muted); line-height:1.7; margin:4px 0 8px}
.btn-print-outline{display:flex; align-items:center; justify-content:center; gap:10px; width:100%; padding:14px; border-radius:999px; border:2px solid var(--border); background:#fff; color:var(--ink-on-light); font-size:17px; font-weight:800; cursor:pointer; font-family:inherit; line-height:1.6; box-shadow:var(--shadow); margin-top:10px}
html[data-theme="dark"] .btn-print-outline{background:var(--surface); color:var(--text)}
.btn-print-outline svg{width:22px; height:22px; flex:none}
.streak-banner{display:flex; align-items:center; gap:10px; background:var(--peach); color:var(--ink-on-light); border-radius:20px; padding:14px 16px; font-weight:800; line-height:1.7; margin-bottom:16px; box-shadow:var(--shadow)}
html[data-theme="dark"] .streak-banner{color:var(--text)}
.streak-banner svg{width:26px; height:26px; flex:none}
.daily-sub-heading{font-size:20px; font-weight:900; line-height:1.65; margin:6px 0 2px}
.daily-sub-sub{color:var(--muted); font-weight:700; line-height:1.7; margin:0 0 12px}
.daily-subject-row{display:flex; align-items:center; gap:12px; width:100%; text-align:left; background:#fff; border:1px solid var(--border); border-radius:20px; padding:10px 14px 10px 10px; margin-bottom:10px; cursor:pointer; font-family:inherit; box-shadow:var(--shadow); color:var(--ink-on-light); line-height:1.65}
html[data-theme="dark"] .daily-subject-row{background:var(--surface); color:var(--text)}
.daily-subject-row:active{transform:scale(.98)}
.daily-sub-icon{width:56px; height:56px; flex:none; border-radius:16px; display:grid; place-items:center; overflow:hidden; padding:5px}
.daily-sub-icon svg{width:100%; height:100%}
.daily-subject-row .grow{flex:1; min-width:0}
.daily-sub-km{font-weight:900; font-size:18px; line-height:1.6}
.daily-sub-en{color:var(--muted); font-weight:700; font-size:14px; line-height:1.6}
.daily-chevron{font-size:26px; color:var(--orange); font-weight:900; line-height:1}

/* report / stories / games shared */
.cal{display:grid; grid-template-columns:repeat(7,1fr); gap:5px}
.cal-day{aspect-ratio:1; border-radius:9px; background:var(--surface2); display:grid; place-items:center; font-size:13px; font-weight:700; color:var(--muted)}
.cal-day.active-day{background:#FFE3B3; color:#B45309; border:2px solid #FF7A1A}
html[data-theme="dark"] .cal-day.active-day{background:#5A3413; color:#FFD9A8}
table.report{width:100%; border-collapse:collapse}
table.report td,table.report th{padding:8px; border-bottom:1px solid var(--border); text-align:left; line-height:1.65}
.sentence{padding:12px 14px; border-radius:16px; background:var(--surface); border:2px solid var(--border); margin-bottom:10px; cursor:pointer}
.sentence .km{font-size:21px; font-weight:700; line-height:1.8}
.sentence .en{color:var(--muted); font-size:15px; line-height:1.65}
.sentence.playing{border-color:var(--blue); background:var(--surface2)}
.game-wrap{display:flex; flex-direction:column; gap:12px}
canvas.trace{background:#FFFDF7; border:2px solid var(--border); border-radius:16px; touch-action:none; width:100%; max-width:420px; margin:0 auto; display:block}
.simon-pad{aspect-ratio:1; border-radius:20px; border:none; cursor:pointer; opacity:.55}
.simon-pad.lit{opacity:1; transform:scale(1.04)}
.clock-svg{width:min(260px,75vw); margin:0 auto; display:block}
.riel-note{display:inline-grid; place-items:center; min-width:86px; height:48px; padding:4px 10px; margin:4px; border-radius:8px; font-weight:900; color:#fff; font-size:18px}

/* print worksheet */
#print-area{display:none}
@media print{
  body{overflow:visible; background:#fff; color:#000}
  #shell,#toast{display:none !important}
  #print-area{display:block !important; padding:20px; font-size:16px; color:#000}
  #print-area h1{font-size:22px}
  #print-area .pq{margin:14px 0; page-break-inside:avoid}
  #print-area .key{margin-top:30px; border-top:2px dashed #000; padding-top:10px}
}
@media (min-width:760px){
  .grid3{grid-template-columns:repeat(4,1fr)}
  .play-grid{grid-template-columns:repeat(3,1fr)}
  .learn-word{font-size:72px}
}
@media (max-width:480px){
  .medal-grid{grid-template-columns:repeat(4,1fr); gap:8px}
  .medal-card svg{width:48px; height:56px}
  .home-avatar{width:112px; min-height:112px}
}

/* ---- Compact scale (2026-11-30, Viseth: everything too big) ---- */
body{font-size:15px}
.page-scroll{padding:10px 12px 14px}
.page-heading{font-size:23px}
.page-subtitle{font-size:14px; margin-bottom:10px}
.home-greet{font-size:23px}
.home-sub{font-size:14px; margin-bottom:10px}
.home-avatar{width:104px; min-height:104px; border-radius:22px}
.home-avatar svg{max-height:104px}
.home-avatar-letter{font-size:44px}
.info-pill{font-size:13px; padding:7px 12px}
.info-pill svg{width:15px; height:15px}
.medal-mini{width:22px; height:22px}
.medal-mini svg{width:17px; height:17px}
.level-caption{font-size:12.5px}
.daily-cal-box svg{width:28px; height:28px}
.medal-card{padding:8px 4px 6px; border-radius:16px}
.medal-card svg{width:44px; height:50px}
.card{padding:14px; border-radius:20px; margin-bottom:10px}
.btn{padding:11px 18px; font-size:16px}
.btn-big{padding:12px; font-size:17px}
.big-input{padding:11px 14px; font-size:16px}
.field-label{font-size:13.5px}
.helper-text{font-size:12.5px}
.login-owl-box{width:118px; height:118px; border-radius:28px}
.login-owl-box svg{width:104px; height:104px}
.login-heading{font-size:25px}
.login-subtitle{font-size:14px}
.auth-toggle{padding:10px 8px; font-size:14.5px}
.login-input{font-size:17px; padding:12px 14px}
.color-opt{width:36px; height:36px}
.grade-pill{min-width:44px; padding:8px 12px; font-size:15px}
.new-code{font-size:42px}
.tile{padding:14px 8px 10px; border-radius:20px}
.tile svg{width:56px; height:56px}
.tile-game svg{width:60px; height:60px}
.tile .tile-title{font-size:15px}
.tile .tile-sub{font-size:12px}
.lesson-thumb{width:52px; height:52px}
.subject-card-big{min-height:118px; padding:16px 12px 12px; border-radius:20px}
.subject-card-big .sc-km{font-size:20px}
.subject-card-big .sc-en{font-size:13px}
.subject-card-big .sc-stars{font-size:13px}
.tile-btn{min-width:44px; height:44px; font-size:20px}
.star-row svg{width:36px; height:36px}
.tab-icon{width:21px; height:21px}
.tab-icon svg{width:21px; height:21px}
.tab-label{font-size:12px}
.icon-btn{width:36px; height:36px; font-size:16px}
.side-btn{width:36px; height:36px}
.side-btn svg{width:18px; height:18px}
#topbar-title{font-size:15px}
.stars{font-size:24px}
.clock-svg{width:min(220px,70vw)}

/* ---- Compact scale 2 (2026-11-30, still too big) ---- */
body{font-size:14px}
.page-scroll{padding:8px 10px 12px}
.page-heading{font-size:19px}
.page-subtitle{font-size:12.5px; margin-bottom:8px}
.home-greet{font-size:19px}
.home-sub{font-size:12.5px; margin-bottom:8px}
.home-avatar{width:84px; min-height:84px; border-radius:18px; padding:6px}
.home-avatar svg{max-height:84px}
.home-avatar-letter{font-size:36px}
.info-pill{font-size:12px; padding:5px 10px; gap:6px}
.info-pill svg{width:13px; height:13px}
.medal-mini{width:19px; height:19px}
.medal-mini svg{width:15px; height:15px}
.level-caption{font-size:11.5px; margin-bottom:10px}
.daily-cal-box svg{width:24px; height:24px}
.medal-card{padding:6px 3px 5px; border-radius:14px}
.medal-card svg{width:36px; height:41px}
.card{padding:11px; border-radius:16px; margin-bottom:8px}
.btn{padding:9px 15px; font-size:14.5px}
.btn-big{padding:10px; font-size:15px}
.big-input{padding:9px 12px; font-size:14.5px}
.field-label{font-size:12.5px}
.helper-text{font-size:11.5px}
.login-owl-box{width:96px; height:96px; border-radius:24px}
.login-owl-box svg{width:84px; height:84px}
.login-heading{font-size:21px}
.login-subtitle{font-size:12.5px; margin-bottom:12px}
.auth-toggle{padding:8px 6px; font-size:13px}
.login-input{font-size:15px; padding:10px 12px}
.color-opt{width:31px; height:31px}
.grade-pill{min-width:38px; padding:6px 10px; font-size:13px}
.new-code{font-size:34px; padding:10px}
.tile{padding:11px 6px 8px; border-radius:16px}
.tile svg{width:44px; height:44px}
.tile-game svg{width:47px; height:47px}
.tile .tile-title{font-size:13px; margin-top:4px}
.tile .tile-sub{font-size:11px}
.lesson-thumb{width:44px; height:44px; border-radius:11px}
.subject-card-big{min-height:96px; padding:13px 10px 10px; border-radius:16px}
.subject-card-big .sc-km{font-size:17px}
.subject-card-big .sc-en{font-size:11.5px}
.subject-card-big .sc-stars{font-size:11.5px; padding:2px 9px}
.tile-btn{min-width:38px; height:38px; font-size:17px; border-radius:11px}
.star-row svg{width:30px; height:30px}
.tab-icon{width:19px; height:19px}
.tab-icon svg{width:19px; height:19px}
.tab-label{font-size:11px}
.tab{padding:5px 2px 4px}
.icon-btn{width:32px; height:32px; font-size:14px}
.side-btn{width:32px; height:32px}
.side-btn svg{width:16px; height:16px}
#topbar-title{font-size:13.5px}
.stars{font-size:20px}
.clock-svg{width:min(190px,65vw)}
.progress-bar{height:9px}

/* ---- Top bar +50% (2026-11-30, Viseth) ---- */
#topbar{padding:12px 18px; gap:12px}
#topbar-title{font-size:20px}
#topbar .icon-btn{width:48px; height:48px; font-size:24px}
#btn-back{font-size:39px}

/* ---- Home avatar square fix (2026-11-30) ---- */
.home-profile-row{align-items:center}
.home-avatar{width:84px; height:84px; min-height:84px; aspect-ratio:1/1; align-self:center}
.home-avatar svg{width:100%; height:100%; max-height:84px}

/* ---- Home avatar square, forced (2026-11-30) ---- */
.home-profile-row{align-items:center !important}
.home-avatar{height:84px !important; max-height:84px !important; flex:none !important}

/* ---- Home avatar bigger, pills narrower (2026-11-30) ---- */
.home-avatar{width:120px !important; height:120px !important; max-height:120px !important; min-height:120px !important}
.home-avatar svg{max-height:120px !important}
.home-pills{flex:1; min-width:0}
.info-pill{padding:5px 10px}

/* ---- Home stats: clean minimalist 2x2 grid (2026-11-30) ---- */
.stat-grid{display:grid; grid-template-columns:1fr 1fr; gap:6px}
.stat{background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:7px 10px; display:flex; flex-direction:column; gap:0; box-shadow:0 2px 8px rgba(60,30,10,.05)}
.stat-v{display:flex; align-items:center; gap:5px; font-weight:900; font-size:14.5px; line-height:1.55; color:var(--text)}
.stat-v svg{flex:none}
.stat-l{font-size:10.5px; font-weight:700; color:var(--muted); line-height:1.55}

/* ---- Play game icons 30% smaller (2026-11-30) ---- */
.play-art svg{width:70%; height:70%}

/* ---- Game/lesson pictures smaller + breathing room (2026-11-30) ---- */
.pic-frame{width:min(200px,62vw); padding:14px}
.choice-btn .pic-frame{width:min(105px,42vw); padding:10px}
.match-btn .pic-frame{width:min(90px,38vw); padding:8px}

/* ---- Responsive clean layout: phone / tablet / computer (2026-11-30) ---- */
@media (min-width:700px){
  .page-scroll{max-width:1000px; padding:16px 20px 20px}
  .subject-grid-big{grid-template-columns:repeat(3,1fr)}
  .play-grid{grid-template-columns:repeat(3,1fr)}
  .avatar-grid{grid-template-columns:repeat(6,1fr)}
  .choice-grid,.match-grid{max-width:640px; margin-left:auto; margin-right:auto}
  .home-avatar{width:140px !important; height:140px !important; max-height:140px !important; min-height:140px !important}
  .home-avatar svg{max-height:140px !important}
}
@media (min-width:1100px){
  .page-scroll{max-width:1100px; padding:18px 24px 24px}
  .play-grid{grid-template-columns:repeat(4,1fr)}
  .avatar-grid{grid-template-columns:repeat(8,1fr)}
  .medal-grid{grid-template-columns:repeat(8,1fr)}
  .grid3{grid-template-columns:repeat(4,1fr)}
}

/* ---- Match game pictures contained (2026-11-30) ---- */
.match-btn{padding:8px; overflow:hidden}
.match-btn .pic-frame{width:56px; height:56px; aspect-ratio:auto; padding:4px; margin:0 auto; border-width:2px; border-radius:12px}
.match-btn .pic-frame svg{width:100%; height:100%; display:block}

/* ---- Deep-scan picture containment for ALL games (2026-11-30) ----
   Games inject their own .ksg-pic rules (now 110px); these higher-
   specificity rules guarantee pictures stay contained inside cards
   in Match, Listen & Pick, Odd One Out, Shadow Match, etc. */
.ksg-card{overflow:hidden}
.ksg-card .ksg-pic{max-width:110px; margin:0 auto; overflow:hidden}
.ksg-card .ksg-pic svg{max-width:100%; max-height:100%}
.ksg2-shadow{max-width:140px}
.choice-btn{overflow:hidden}
.choice-btn .pic-frame svg{max-width:100%; max-height:100%}
