/* KyuJinHyoStudy V2 - giao diện: giấy washi lạnh + mực chàm (藍), con dấu đỏ (印) */
html { --acc-l:#25307A; --acc-d:#A3B4FF; --accs-l:#E4E8FA; --accs-d:#222A58; --pit-l:#E2683C; --pit-d:#FF9E6E; }
html[data-accent="matcha"] { --acc-l:#2C6B4C; --acc-d:#8FD3AE; --accs-l:#E0F0E7; --accs-d:#1D3A2D; --pit-l:#D2672E; --pit-d:#F7A06A; }
html[data-accent="sakura"] { --acc-l:#B03A68; --acc-d:#F5A3C4; --accs-l:#FBE3ED; --accs-d:#44202F; --pit-l:#23879A; --pit-d:#77CFDB; }
html[data-accent="amber"]  { --acc-l:#A9500A; --acc-d:#FFB66F; --accs-l:#FCEAD8; --accs-d:#402611; --pit-l:#2F6FB0; --pit-d:#8DB9F2; }
html[data-accent="violet"] { --acc-l:#573CA6; --acc-d:#BEA9FF; --accs-l:#EBE5FB; --accs-d:#2D2352; --pit-l:#C98510; --pit-d:#F5C266; }

:root {
  --bg:#F3F4F8; --surface:#FFFFFF; --surface2:#ECEEF5; --ink:#151A33; --muted:#656B8C; --line:#E1E4EE;
  --accent:var(--acc-l); --accent-soft:var(--accs-l); --accent-ink:#FFFFFF; --pitch:var(--pit-l);
  --good:#2B8A56; --good-soft:#DFF3E7; --hard:#B27407; --hard-soft:#FBEFD2;
  --again:#D2393A; --again-soft:#FBE1E0; --easy:#2878BF; --easy-soft:#DDEBF8;
  --seal:#D2393A;
  --shadow:0 1px 2px rgba(21,26,51,.06), 0 10px 26px -14px rgba(21,26,51,.28);
  --font-ui:system-ui,-apple-system,"Roboto","Noto Sans SC","Noto Sans CJK SC","Microsoft YaHei",sans-serif;
  --font-jp:"KJ NotoSC","Noto Sans SC","Noto Sans CJK SC","Microsoft YaHei","PingFang SC",sans-serif;
  --fs:16px;
}
html[data-theme="dark"] {
  --bg:#0B0F20; --surface:#141A33; --surface2:#1C2347; --ink:#EDEFFB; --muted:#9AA2C9; --line:#252D55;
  --accent:var(--acc-d); --accent-soft:var(--accs-d); --accent-ink:#0B0F20; --pitch:var(--pit-d);
  --good:#6FD39A; --good-soft:#173A29; --hard:#F0B84E; --hard-soft:#3F3112;
  --again:#FF7B78; --again-soft:#4A1E20; --easy:#7BBBF2; --easy-soft:#173653;
  --seal:#E5484D;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 10px 26px -14px rgba(0,0,0,.7);
}
html[data-fs="s"] { --fs:14.5px; } html[data-fs="m"] { --fs:16px; } html[data-fs="l"] { --fs:18px; }

* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { margin:0; height:100%; background:var(--bg); color:var(--ink); font-family:var(--font-ui); font-size:var(--fs); line-height:1.45; overflow:hidden; }
body { -webkit-user-select:none; user-select:none; }
input, textarea, select { -webkit-user-select:text; user-select:text; font-family:inherit; font-size:1rem; color:var(--ink); }
button { font-family:inherit; font-size:1rem; color:inherit; cursor:pointer; border:0; background:none; padding:0; }
h1,h2,h3,p { margin:0; }
.jp { font-family:var(--font-jp); }
ruby rt { font-size:.48em; color:var(--muted); font-family:var(--font-ui); letter-spacing:0; }
svg.i { width:1.35rem; height:1.35rem; stroke:currentColor; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; flex:none; }

#app { height:100%; display:flex; flex-direction:column; }
.screen { flex:1; overflow-y:auto; overflow-x:hidden; padding:14px 16px 28px; -webkit-overflow-scrolling:touch; }
.screen.pad-top { padding-top:10px; }
.hdr { display:flex; align-items:center; gap:10px; margin:4px 0 14px; min-height:44px; }
.hdr h1 { font-size:1.45rem; font-weight:800; letter-spacing:-.01em; flex:1; min-width:0; }
.hdr .sub { font-size:.85rem; color:var(--muted); font-weight:500; }
.ibtn { width:42px; height:42px; border-radius:14px; display:grid; place-items:center; background:var(--surface); box-shadow:var(--shadow); color:var(--ink); }
.ibtn:active { transform:scale(.94); }
.ibtn.plain { background:none; box-shadow:none; }

/* tab bar */
.tabbar { flex:none; display:flex; background:var(--surface); border-top:1px solid var(--line); padding:6px 6px 8px; }
.tab { flex:1; display:flex; flex-direction:column; align-items:center; gap:2px; padding:6px 0; border-radius:14px; color:var(--muted); font-size:.72rem; font-weight:600; }
.tab.on { color:var(--accent); }
.tab.on .tabi { background:var(--accent-soft); }
.tabi { width:52px; height:30px; border-radius:99px; display:grid; place-items:center; transition:background .2s; }

/* surfaces */
.panel { background:var(--surface); border-radius:20px; padding:16px; box-shadow:var(--shadow); margin-bottom:14px; }
.panel h2 { font-size:1rem; font-weight:700; margin-bottom:10px; }
.muted { color:var(--muted); } .small { font-size:.85rem; } .tiny { font-size:.75rem; }
.bold { font-weight:700; } .grow { flex:1; min-width:0; }
.row > .in.grow + .btn { width:auto; flex:none; }   /* ô nhập + nút cùng hàng: ô nhập chiếm phần còn lại */
.row { display:flex; align-items:center; gap:12px; }
.gap { gap:8px; } .mt { margin-top:12px; } .mt2 { margin-top:20px; } .mb { margin-bottom:12px; }
.center { text-align:center; }
.section-t { font-size:.85rem; font-weight:700; color:var(--muted); margin:18px 4px 8px; }

/* buttons */
.btn { min-height:52px; padding:0 20px; border-radius:16px; font-weight:700; display:flex; align-items:center; justify-content:center; gap:8px; width:100%; background:var(--surface2); color:var(--ink); transition:transform .08s; }
.btn:active { transform:scale(.98); }
.btn.primary { background:var(--accent); color:var(--accent-ink); }
.btn.danger { background:var(--again-soft); color:var(--again); }
.btn.ghost { background:none; border:1.5px solid var(--line); }
.btn.sm { min-height:40px; padding:0 14px; width:auto; border-radius:12px; font-size:.9rem; }
.btn[disabled], .btn.off { opacity:.45; pointer-events:none; }
.btnrow { display:flex; gap:10px; } .btnrow > * { flex:1; }

/* hero (home) */
.hero { display:flex; align-items:flex-start; gap:12px; margin:2px 0 16px; }
.hero .hi { font-size:.85rem; color:var(--muted); font-weight:600; }
.hero h1 { font-size:1.5rem; font-weight:800; letter-spacing:-.01em; line-height:1.25; }
.streak { margin-left:auto; text-align:center; background:var(--surface); box-shadow:var(--shadow); border-radius:16px; padding:8px 12px; min-width:64px; }
.streak b { display:block; font-size:1.3rem; line-height:1.1; }
.streak span { font-size:.7rem; color:var(--muted); font-weight:600; }
.tiles { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:14px; }
.tile { background:var(--surface2); border-radius:16px; padding:12px 10px; text-align:left; position:relative; }
.tile b { display:block; font-size:1.7rem; line-height:1.1; font-weight:800; letter-spacing:-.02em; }
.tile span { font-size:.78rem; color:var(--muted); font-weight:600; }
.tile::after { content:""; position:absolute; top:12px; right:12px; width:8px; height:8px; border-radius:50%; background:var(--c, var(--accent)); }
.tile:active { transform:scale(.97); }

/* progress */
.bar { height:8px; border-radius:99px; background:var(--surface2); overflow:hidden; }
.bar > i { display:block; height:100%; border-radius:99px; background:var(--accent); transition:width .5s cubic-bezier(.2,.8,.2,1); }
.bar.thin { height:5px; }

/* deck rows */
.deck { display:flex; gap:12px; align-items:center; padding:14px; background:var(--surface); border-radius:18px; box-shadow:var(--shadow); margin-bottom:10px; width:100%; text-align:left; }
.deck .ic { width:46px; height:46px; border-radius:14px; background:var(--accent-soft); display:grid; place-items:center; font-size:1.5rem; flex:none; }
.deck .nm { font-weight:700; }
.deck .meta { font-size:.8rem; color:var(--muted); margin:2px 0 7px; display:flex; gap:10px; flex-wrap:wrap; }
.deck .pct { font-weight:800; font-size:.9rem; color:var(--accent); }
.dot { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:4px; background:var(--c); }

/* chips / segmented / switch */
.chips { display:flex; gap:8px; flex-wrap:wrap; }
.chips.scroll { flex-wrap:nowrap; overflow-x:auto; padding-bottom:4px; margin:0 -16px; padding-left:16px; padding-right:16px; }
.chips.scroll::-webkit-scrollbar { display:none; }
.chip { display:inline-flex; align-items:center; gap:6px; padding:7px 13px; border-radius:99px; background:var(--surface2); font-size:.85rem; font-weight:600; color:var(--ink); white-space:nowrap; flex:none; }
.chip.on { background:var(--accent); color:var(--accent-ink); }
.chip .muted-in { opacity:.6; font-weight:500; }
.chip.tag { background:var(--accent-soft); color:var(--accent); font-weight:600; padding:4px 10px; font-size:.78rem; }
.seg { display:flex; background:var(--surface2); border-radius:14px; padding:4px; gap:2px; }
.seg button { flex:1; padding:9px 6px; border-radius:11px; font-weight:600; font-size:.88rem; color:var(--muted); }
.seg button.on { background:var(--surface); color:var(--ink); box-shadow:var(--shadow); }
.sw { width:50px; height:30px; border-radius:99px; background:var(--surface2); position:relative; flex:none; transition:background .2s; border:1.5px solid var(--line); }
.sw::after { content:""; position:absolute; top:2px; left:2px; width:23px; height:23px; border-radius:50%; background:var(--muted); transition:transform .2s, background .2s; }
.sw.on { background:var(--accent); border-color:var(--accent); }
.sw.on::after { transform:translateX(20px); background:var(--accent-ink); }

/* settings list */
.setl { background:var(--surface); border-radius:20px; box-shadow:var(--shadow); overflow:hidden; margin-bottom:14px; }
.set { display:flex; align-items:center; gap:12px; padding:14px 16px; min-height:56px; border-bottom:1px solid var(--line); width:100%; text-align:left; }
.set:last-child { border-bottom:0; }
.set .lb { flex:1; min-width:0; } .set .lb b { display:block; font-weight:600; } .set .lb span { font-size:.8rem; color:var(--muted); }
.set .val { color:var(--muted); font-weight:600; font-size:.92rem; }
.stepper { display:flex; align-items:center; gap:2px; background:var(--surface2); border-radius:12px; }
.stepper button { width:38px; height:38px; font-size:1.2rem; font-weight:700; }
.stepper span { min-width:38px; text-align:center; font-weight:700; }

/* form */
.field { margin-bottom:14px; }
.field > label { display:block; font-size:.82rem; font-weight:700; color:var(--muted); margin:0 2px 6px; }
.in { width:100%; padding:13px 14px; border-radius:14px; border:1.5px solid var(--line); background:var(--surface); outline:none; }
.in:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
textarea.in { min-height:84px; resize:vertical; line-height:1.5; }
.search { display:flex; align-items:center; gap:10px; padding:0 14px; background:var(--surface); border-radius:16px; box-shadow:var(--shadow); height:50px; color:var(--muted); }
.search input { flex:1; border:0; outline:none; background:none; height:100%; min-width:0; }

/* card list */
.crow { display:flex; align-items:center; gap:12px; padding:12px 14px; background:var(--surface); border-radius:16px; margin-bottom:8px; box-shadow:var(--shadow); width:100%; text-align:left; }
.crow .f { font-family:var(--font-jp); font-size:1.35rem; font-weight:600; min-width:2.4em; }
.crow .m { font-size:.82rem; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.crow .st { width:9px; height:9px; border-radius:50%; flex:none; background:var(--c); }
.star { color:var(--muted); } .star.on { color:#E6A817; } .star.on svg { fill:currentColor; }

/* seal (hanko) */
.seal { display:inline-grid; place-items:center; min-width:2.1rem; height:2.1rem; padding:0 .4rem; background:var(--seal); color:#fff; font-family:var(--font-jp); font-weight:700; font-size:.82rem; border-radius:6px; transform:rotate(-5deg); box-shadow:inset 0 0 0 2px rgba(255,255,255,.35); letter-spacing:.02em; }

/* card detail */
.big { font-family:var(--font-jp); font-size:3.4rem; font-weight:600; line-height:1.25; word-break:break-all; }
.kv { display:flex; justify-content:space-between; gap:12px; padding:9px 0; border-bottom:1px solid var(--line); font-size:.9rem; }
.kv:last-child { border:0; } .kv span:first-child { color:var(--muted); }
.ex { padding:10px 0; border-bottom:1px solid var(--line); } .ex:last-child { border:0; }
.ex .jp { font-size:1.15rem; line-height:2; }

/* study */
.study { position:fixed; inset:0; background:var(--bg); display:flex; flex-direction:column; z-index:20; }
.st-top { flex:none; display:flex; align-items:center; gap:12px; padding:10px 14px 6px; }
.st-top .bar { flex:1; }
.st-count { font-size:.82rem; font-weight:700; color:var(--muted); min-width:3.2em; text-align:right; }
.st-body { flex:1; overflow-y:auto; padding:8px 16px 12px; display:flex; flex-direction:column; }
.st-foot { flex:none; padding:10px 16px 16px; }
.face { position:relative; flex:1; min-height:240px; background:var(--surface); border-radius:26px; box-shadow:var(--shadow); padding:26px 20px; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:10px; animation:pop .22s ease-out; }
@keyframes pop { from { opacity:.0; transform:translateY(8px); } to { opacity:1; transform:none; } }
.face .seal { position:absolute; top:16px; right:16px; }
.face .tagrow { position:absolute; top:18px; left:18px; font-size:.75rem; color:var(--muted); font-weight:700; }
.face .front { font-family:var(--font-jp); font-size:clamp(2.6rem, 15vw, 4.6rem); font-weight:600; line-height:1.35; word-break:break-all; }
.face .front.sm { font-size:clamp(1.6rem, 8vw, 2.4rem); }
.face .prompt { font-size:1.35rem; font-weight:700; line-height:1.4; }
.face .rd { font-family:var(--font-jp); font-size:1.5rem; color:var(--accent); font-weight:600; }
.face .mn { font-size:1.35rem; font-weight:700; }
.face hr { width:60%; border:0; border-top:1.5px dashed var(--line); margin:6px 0; }
.face .exs { font-size:1.02rem; } .face .exs .jp { font-size:1.15rem; line-height:2; }
.face img { max-width:60%; max-height:120px; border-radius:12px; }
.audio { display:inline-flex; align-items:center; gap:8px; padding:10px 18px; border-radius:99px; background:var(--accent-soft); color:var(--accent); font-weight:700; }
.audio:active { transform:scale(.96); }
.rate { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.rate button { padding:10px 2px 9px; border-radius:16px; font-weight:800; display:flex; flex-direction:column; gap:1px; align-items:center; }
.rate small { font-weight:600; font-size:.7rem; opacity:.85; }
.rate .r1 { background:var(--again-soft); color:var(--again); } .rate .r2 { background:var(--hard-soft); color:var(--hard); }
.rate .r3 { background:var(--good-soft); color:var(--good); } .rate .r4 { background:var(--easy-soft); color:var(--easy); }
.rate button:active { transform:scale(.95); }
.opts { display:grid; gap:10px; margin-top:14px; }
.opt { text-align:left; padding:15px 16px; border-radius:16px; background:var(--surface); box-shadow:var(--shadow); font-weight:600; border:2px solid transparent; display:flex; gap:12px; align-items:center; }
.opt b { width:26px; height:26px; border-radius:8px; background:var(--surface2); display:grid; place-items:center; font-size:.8rem; flex:none; }
.opt.ok { border-color:var(--good); background:var(--good-soft); } .opt.bad { border-color:var(--again); background:var(--again-soft); }
.opt.dim { opacity:.55; }
.ans { margin-top:14px; display:flex; gap:10px; }
.ans .in { flex:1; font-size:1.2rem; font-family:var(--font-jp); text-align:center; }
.verdict { margin-top:12px; padding:14px; border-radius:16px; font-weight:700; text-align:center; }
.verdict.ok { background:var(--good-soft); color:var(--good); } .verdict.bad { background:var(--again-soft); color:var(--again); } .verdict.half { background:var(--hard-soft); color:var(--hard); }
.verdict .jp { font-size:1.5rem; display:block; margin-top:4px; color:var(--ink); }
.sumbig { font-size:3rem; font-weight:800; letter-spacing:-.03em; }

/* chart / heat */
.bars { display:flex; align-items:flex-end; gap:3px; height:110px; }
.bars div { flex:1; background:var(--accent); border-radius:5px 5px 2px 2px; min-height:3px; opacity:.9; }
.bars div.z { background:var(--surface2); }
.bars-l { display:flex; gap:3px; margin-top:4px; font-size:.62rem; color:var(--muted); } .bars-l span { flex:1; text-align:center; }
.heat { display:grid; grid-template-rows:repeat(7,1fr); grid-auto-flow:column; gap:3px; }
.heat i { aspect-ratio:1; border-radius:4px; background:var(--surface2); }
.heat i.l1 { background:color-mix(in srgb, var(--accent) 28%, var(--surface2)); } .heat i.l2 { background:color-mix(in srgb, var(--accent) 52%, var(--surface2)); }
.heat i.l3 { background:color-mix(in srgb, var(--accent) 76%, var(--surface2)); } .heat i.l4 { background:var(--accent); }
.stack { display:flex; height:14px; border-radius:99px; overflow:hidden; gap:2px; } .stack i { display:block; height:100%; }
.grid3 { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.stat { background:var(--surface2); border-radius:14px; padding:10px; } .stat b { display:block; font-size:1.25rem; font-weight:800; } .stat span { font-size:.74rem; color:var(--muted); font-weight:600; }
.badge { display:flex; flex-direction:column; align-items:center; gap:4px; padding:12px 6px; border-radius:16px; background:var(--surface2); font-size:.78rem; font-weight:700; opacity:.45; text-align:center; } .badge.on { opacity:1; background:var(--hard-soft); color:var(--hard); } .badge span { font-size:1.6rem; }

/* overlays */
.ov { position:fixed; inset:0; background:rgba(8,10,24,.5); z-index:50; display:flex; align-items:flex-end; animation:fade .15s; }
.ov.mid { align-items:center; padding:24px; }
@keyframes fade { from { opacity:0; } to { opacity:1; } }
.sheet { width:100%; max-height:88%; overflow-y:auto; background:var(--surface); border-radius:26px 26px 0 0; padding:10px 18px 22px; animation:up .22s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform:translateY(40px); opacity:.5; } to { transform:none; opacity:1; } }
.sheet .grab { width:42px; height:4px; background:var(--line); border-radius:9px; margin:0 auto 12px; }
.sheet h3 { font-size:1.15rem; font-weight:800; margin-bottom:12px; }
.dlg { width:100%; max-width:420px; margin:auto; background:var(--surface); border-radius:24px; padding:22px; box-shadow:var(--shadow); animation:pop .18s; }
.dlg h3 { font-size:1.15rem; font-weight:800; margin-bottom:8px; } .dlg p { color:var(--muted); margin-bottom:18px; white-space:pre-line; }
.act { display:flex; align-items:center; gap:14px; padding:14px 6px; width:100%; text-align:left; font-weight:600; border-bottom:1px solid var(--line); } .act:last-child { border:0; }
.act.danger { color:var(--again); }
.toast { position:fixed; left:50%; bottom:92px; transform:translateX(-50%); max-width:86%; background:var(--ink); color:var(--bg); padding:11px 18px; border-radius:99px; font-weight:600; font-size:.9rem; z-index:90; animation:pop .2s; text-align:center; }
.empty { text-align:center; padding:40px 20px; color:var(--muted); } .empty .em { font-size:2.6rem; margin-bottom:8px; }
.fab { position:fixed; right:18px; bottom:84px; width:58px; height:58px; border-radius:20px; background:var(--accent); color:var(--accent-ink); display:grid; place-items:center; box-shadow:0 12px 24px -8px rgba(0,0,0,.4); z-index:10; }
table.pv { width:100%; border-collapse:collapse; font-size:.8rem; } table.pv td, table.pv th { padding:6px 8px; border-bottom:1px solid var(--line); text-align:left; max-width:130px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } table.pv th { color:var(--muted); font-weight:700; }
.scrollx { overflow-x:auto; margin:0 -4px; }
.sel { appearance:none; -webkit-appearance:none; width:100%; padding:12px 14px; border-radius:12px; border:1.5px solid var(--line); background:var(--surface); }
@media (prefers-reduced-motion: reduce) { * { animation:none !important; transition:none !important; } }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.screen.fullscreen { padding:0; overflow:hidden; }
.verdict small { display:block; font-weight:500; margin-top:2px; }
.blank { display:inline-block; min-width:2.4em; border-bottom:3px solid var(--accent); margin:0 .15em; }
.hintline { margin-top:8px; font-size:.9rem; color:var(--muted); }
.modes .act small { display:block; color:var(--muted); font-weight:500; }
.modes .em { font-size:1.5rem; width:34px; text-align:center; }

/* ---- nhập file ---- */
.imp-tbl { border-collapse:collapse; font-size:.8rem; min-width:100%; }
.imp-tbl th, .imp-tbl td { padding:6px 9px; border-bottom:1px solid var(--line); text-align:left; white-space:nowrap; max-width:160px; overflow:hidden; text-overflow:ellipsis; }
.imp-tbl th { background:var(--surface2); color:var(--muted); font-weight:700; position:sticky; top:0; }
.imp-map { display:grid; grid-template-columns:96px 1fr; gap:8px; align-items:center; margin-bottom:8px; }
.imp-map label { font-size:.85rem; font-weight:700; color:var(--muted); }
select.in { appearance:none; -webkit-appearance:none; padding-right:30px; background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%); background-position:calc(100% - 17px) 55%,calc(100% - 12px) 55%; background-size:5px 5px; background-repeat:no-repeat; }
.imp-drop { border:2px dashed var(--line); border-radius:20px; padding:30px 16px; text-align:center; color:var(--muted); margin-bottom:14px; }


/* =====================================================================
   PHONG CÁCH 「仙境」 TIÊN CẢNH — núi non sương khói, trăng, hạc, đảo nổi
   ===================================================================== */
#scenery { display:none; }
html[data-skin="xian"] #scenery { display:block; position:fixed; inset:0; z-index:0; pointer-events:none; }
html[data-skin="xian"] #scenery svg { width:100%; height:100%; display:block; }
html[data-skin="xian"] #scenery::after { content:""; position:absolute; inset:0; background:linear-gradient(to bottom, var(--veil-a), var(--veil-b)); }
html[data-skin="xian"] #app { position:relative; z-index:1; }

html[data-skin="xian"] {
  --bg:#EEF0E4; --surface:rgba(251,249,240,.93); --solid:#FBF9F0; --surface2:#E4E9DD; --ink:#1F2B2A; --muted:#62756F; --line:#D3DACD;
  --gold:#A9802A; --seal:#C23B2E;
  --good:#2F7D55; --good-soft:#DCEFE3; --hard:#A77410; --hard-soft:#F6EBCB; --again:#BE3B3B; --again-soft:#F7DEDA; --easy:#2D6F9E; --easy-soft:#D9E8F2;
  --shadow:0 1px 2px rgba(30,60,50,.08), 0 12px 28px -16px rgba(30,60,50,.35);
  --sky1:#DCE8E2; --sky2:#EEF0E2; --sky3:#F4EFDD; --moon:#FBF5E2; --stars:0; --m3:#B5C8BF; --m2:#8FAAA0; --m1:#6A8A80; --mist:#FFFFFF; --crane:#3B4E4A;
  --veil-a:rgba(238,240,228,0); --veil-b:rgba(238,240,228,.28);
  --acc-l:#2C6B5E; --acc-d:#86D9C3; --accs-l:#D5E8E0; --accs-d:#1C3B37; --pit-l:#D8643A; --pit-d:#F59A72;
  --font-title:"Noto Serif","KJ NotoSC","Noto Sans SC","Microsoft YaHei",serif;
}
html[data-skin="xian"][data-theme="dark"] {
  --bg:#07141A; --surface:rgba(16,36,38,.9); --solid:#112628; --surface2:#1A3335; --ink:#E8EFE6; --muted:#8FA9A3; --line:#254142;
  --gold:#E3C170; --seal:#E0533F;
  --good:#6FD39A; --good-soft:#173A29; --hard:#F0B84E; --hard-soft:#3F3112; --again:#FF7B78; --again-soft:#4A1E20; --easy:#7BBBF2; --easy-soft:#173653;
  --shadow:0 1px 2px rgba(0,0,0,.45), 0 12px 28px -14px rgba(0,0,0,.8);
  --sky1:#06121A; --sky2:#0B2227; --sky3:#123432; --moon:#F4EFD8; --stars:.85; --m3:#1B3B3C; --m2:#12292B; --m1:#0A1B1D; --mist:#7FB8AE; --crane:#DCE8E0;
  --veil-a:rgba(7,20,26,0); --veil-b:rgba(7,20,26,.35);
}
/* màu chủ đạo theo phong cách tiên cảnh */
html[data-skin="xian"][data-accent="matcha"]  { --acc-l:#587A2A; --acc-d:#B6DC7C; --accs-l:#E3EDD2; --accs-d:#283818; --pit-l:#C7642F; --pit-d:#F2A06C; }
html[data-skin="xian"][data-accent="sakura"]  { --acc-l:#A8445E; --acc-d:#F2A7B6; --accs-l:#F6DDE1; --accs-d:#432029; --pit-l:#2A8296; --pit-d:#7FCAD8; }
html[data-skin="xian"][data-accent="amber"]   { --acc-l:#93691A; --acc-d:#E8C46A; --accs-l:#F3E8CB; --accs-d:#3B2F14; --pit-l:#336FA8; --pit-d:#92BCEB; }
html[data-skin="xian"][data-accent="violet"]  { --acc-l:#5A4A9E; --acc-d:#BDB1F2; --accs-l:#E6E1F6; --accs-d:#2B2550; --pit-l:#C2830F; --pit-d:#F2C46A; }

html[data-skin="xian"] .tabbar { background:var(--surface); -webkit-backdrop-filter:blur(10px); backdrop-filter:blur(10px); border-top:1px solid var(--line); }
html[data-skin="xian"] .sheet, html[data-skin="xian"] .dlg { background:var(--solid); }
html[data-skin="xian"] .study { background:transparent; }
html[data-skin="xian"] .hdr h1, html[data-skin="xian"] .hero h1, html[data-skin="xian"] .panel h2 { font-family:var(--font-title); letter-spacing:0; }
html[data-skin="xian"] .section-t { color:var(--muted); font-family:var(--font-title); font-weight:700; letter-spacing:.04em; display:flex; align-items:center; gap:8px; }
html[data-skin="xian"] .section-t::before { content:""; width:7px; height:7px; background:var(--gold); transform:rotate(45deg); flex:none; opacity:.9; }
html[data-skin="xian"] .panel, html[data-skin="xian"] .deck, html[data-skin="xian"] .setl { border:1px solid color-mix(in srgb, var(--gold) 22%, transparent); }
html[data-skin="xian"] .face { border:1px solid color-mix(in srgb, var(--gold) 38%, transparent); box-shadow:var(--shadow), inset 0 0 0 5px var(--surface), inset 0 0 0 6px color-mix(in srgb, var(--gold) 30%, transparent); }
html[data-skin="xian"] .face .front { text-shadow:0 1px 0 color-mix(in srgb, var(--bg) 60%, transparent); }
html[data-skin="xian"] .btn.primary { background:linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000)); box-shadow:0 8px 18px -10px var(--accent); }
html[data-skin="xian"][data-theme="dark"] .btn.primary { background:var(--accent); }
html[data-skin="xian"] .bar > i { background:linear-gradient(90deg, var(--accent), var(--gold)); }
html[data-skin="xian"] .bar { background:color-mix(in srgb, var(--accent) 14%, var(--surface2)); }

/* ruby: dồn furigana vào giữa thay vì giãn đều */
ruby { ruby-align:center; }
ruby rt { text-align:center; }

/* hiệu ứng lật thẻ nhẹ */
.face { animation:faceIn .2s ease-out; }
@keyframes faceIn { from { opacity:.55; transform:translateY(8px) scale(.985); } to { opacity:1; transform:none; } }

/* cảnh giới tu vi */
.realm { display:flex; align-items:center; gap:14px; }
.realm .rz { flex:none; width:64px; height:64px; border-radius:50%; display:grid; place-items:center; font-family:var(--font-jp); font-weight:800; font-size:1.25rem; letter-spacing:.02em; color:var(--gold); background:radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 70%); border:1.5px solid color-mix(in srgb, var(--gold) 55%, transparent); box-shadow:0 0 0 4px color-mix(in srgb, var(--gold) 12%, transparent); }
.realm .rt { flex:1; min-width:0; }
.realm .rn { font-family:var(--font-title); font-weight:800; font-size:1.08rem; }
.realm .rs { font-size:.78rem; color:var(--muted); margin:2px 0 8px; }

/* con dấu 修了 khi học xong */
.stamp { display:inline-grid; place-items:center; width:116px; height:116px; border:5px solid var(--seal); color:var(--seal); border-radius:14px; font-family:var(--font-jp); font-weight:800; font-size:2.1rem; line-height:1.05; text-align:center; letter-spacing:.04em; transform:rotate(-8deg); opacity:.92; animation:stamp .55s cubic-bezier(.2,1.4,.4,1) both; box-shadow:inset 0 0 0 2px color-mix(in srgb, var(--seal) 45%, transparent); }
@keyframes stamp { 0% { transform:rotate(-8deg) scale(2.2); opacity:0; } 60% { opacity:1; } 100% { transform:rotate(-8deg) scale(1); opacity:.92; } }

/* nút nhỏ trên thanh học */
.st-top .fbtn { width:38px; height:38px; border-radius:12px; display:grid; place-items:center; font-family:var(--font-jp); font-weight:800; font-size:1.05rem; color:var(--muted); background:var(--surface); box-shadow:var(--shadow); }
.st-top .fbtn.on { color:var(--accent-ink); background:var(--accent); }
.st-top .prac { font-size:.7rem; font-weight:800; color:var(--gold); border:1.5px solid color-mix(in srgb, var(--gold) 60%, transparent); border-radius:99px; padding:2px 8px; letter-spacing:.04em; }

/* dán danh sách */
textarea.in.paste { min-height:170px; font-family:var(--font-jp); line-height:1.7; resize:vertical; }

@media (prefers-reduced-motion: reduce) { .face, .stamp { animation:none; } #scenery animate { display:none; } }


/* ---- nền theo giờ trong ngày (data-tod) ---- */
html[data-skin="xian"]:not([data-theme="dark"])[data-tod="dawn"]  { --sky1:#F2D5CF; --sky2:#F7E6D4; --sky3:#F6EEDA; --moon:#FFF0CC; --m3:#C7C2BA; --m2:#9DAC9F; --m1:#738E7E; --mist:#FFF1E8; --stars:0; }
html[data-skin="xian"]:not([data-theme="dark"])[data-tod="dusk"]  { --sky1:#E8C6B4; --sky2:#F1DAC0; --sky3:#F4E7D0; --moon:#FFE0B4; --m3:#BCBDB1; --m2:#96A298; --m1:#6D8277; --mist:#FFE8D4; --stars:0; }
html[data-skin="xian"]:not([data-theme="dark"])[data-tod="night"] { --sky1:#C8D3DD; --sky2:#DAE2E1; --sky3:#E7E9DF; --moon:#F8F6E8; --m3:#AEBDBF; --m2:#8B9EA2; --m1:#65808A; --mist:#F0F5F5; --stars:.35; }
html[data-skin="xian"][data-theme="dark"][data-tod="dawn"]  { --sky1:#13202C; --sky2:#3A3340; --sky3:#69504F; --moon:#FFDDB0; --m3:#2A3A3B; --m2:#1B2D2E; --m1:#0E1F21; --mist:#C99A8C; --stars:.3; }
html[data-skin="xian"][data-theme="dark"][data-tod="dusk"]  { --sky1:#191B30; --sky2:#46304A; --sky3:#78494A; --moon:#FFD3A0; --m3:#2B3438; --m2:#1B2A2D; --m1:#0E1D20; --mist:#C99087; --stars:.4; }
html[data-skin="xian"][data-theme="dark"][data-tod="day"]   { --sky1:#0C1E27; --sky2:#14383A; --sky3:#1F5149; --moon:#F4EAC8; --m3:#245050; --m2:#183738; --m1:#0C2224; --mist:#8FCBBF; --stars:.35; }
.hearts { letter-spacing:1px; font-size:.95rem; white-space:nowrap; }
.stamp.lose { color:var(--muted); border-color:var(--muted); box-shadow:inset 0 0 0 2px color-mix(in srgb, var(--muted) 45%, transparent); }
.q-row { display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--line); }
.q-row:last-child { border-bottom:0; }
.q-row .qz { flex:none; width:34px; height:34px; border-radius:50%; display:grid; place-items:center; font-family:var(--font-jp); font-weight:800; font-size:.9rem; color:var(--gold); border:1.5px solid color-mix(in srgb, var(--gold) 55%, transparent); }
.q-row.done .qz { background:var(--gold); color:var(--solid); }
.q-row .qt { flex:1; min-width:0; font-size:.9rem; font-weight:700; }
.q-row .qp { font-size:.75rem; color:var(--muted); font-weight:600; }
.ach-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.ach { text-align:center; padding:12px 6px; border-radius:16px; background:var(--surface2); opacity:.5; }
.ach.on { opacity:1; background:color-mix(in srgb, var(--gold) 14%, var(--surface2)); border:1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.ach b { display:block; font-family:var(--font-jp); font-size:1.25rem; color:var(--gold); }
.ach span { display:block; font-size:.72rem; font-weight:700; margin-top:2px; }
.ach small { display:block; font-size:.62rem; color:var(--muted); margin-top:2px; line-height:1.25; }
.tier { display:flex; align-items:center; gap:12px; padding:12px; border-radius:16px; background:var(--surface2); margin-bottom:8px; }
.tier .tz { flex:none; font-family:var(--font-jp); font-weight:800; font-size:1.4rem; color:var(--gold); width:44px; text-align:center; }
.tier .tt { flex:1; min-width:0; } .tier .tt b { display:block; } .tier .tt span { font-size:.76rem; color:var(--muted); }
.stroke-box { width:min(78vw,300px); aspect-ratio:1; margin:6px auto 10px; border-radius:18px; background:var(--surface2); position:relative; }
.stroke-box svg { width:100%; height:100%; display:block; }
.kchips { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-bottom:6px; }
.kchips .chip { font-family:var(--font-jp); font-size:1.2rem; padding:4px 14px; }


/* ---- Luyện thi ---- */
button.hub, .panel.hub { display:flex; align-items:center; gap:12px; width:100%; text-align:left; }
.hub .hubi { font-size:1.6rem; flex:none; }
.hub .grow { display:flex; flex-direction:column; gap:2px; min-width:0; }
.good-t { color:var(--good); } .bad-t { color:var(--again); }
.ex-timer { font-variant-numeric:tabular-nums; font-weight:800; font-size:1rem; padding:4px 10px; border-radius:99px; background:var(--surface); box-shadow:var(--shadow); }
.ex-timer.warn { color:var(--again); }
.ex-body { gap:10px; }
.ex-stem { font-size:1.12rem; line-height:1.8; margin:6px 0 12px; background:var(--surface); border-radius:16px; padding:14px 16px; box-shadow:var(--shadow); }
.ex-stem.big { font-size:1.5rem; text-align:center; font-weight:700; }
.ex-stem .qno { display:inline-grid; place-items:center; min-width:24px; height:24px; border-radius:8px; background:var(--accent); color:var(--accent-ink); font-size:.75rem; font-weight:800; margin-right:8px; vertical-align:middle; }
.ex-stem u, .ex-opts u, .ex-pass u { text-decoration-thickness:2px; text-underline-offset:4px; }
.ex-qno { font-weight:800; font-size:1.2rem; text-align:center; margin:8px 0 12px; color:var(--accent); }
.ex-opts { display:flex; flex-direction:column; gap:10px; }
.ex-opts.grid { display:grid; grid-template-columns:1fr 1fr; }
.ex-opts.spoken { flex-direction:row; justify-content:center; gap:14px; flex-wrap:wrap; }
.xopt { display:flex; align-items:center; gap:12px; text-align:left; padding:13px 14px; border-radius:16px; background:var(--surface); box-shadow:var(--shadow); font-weight:600; border:2px solid transparent; font-size:1.02rem; line-height:1.5; }
.xopt b { flex:none; width:28px; height:28px; border-radius:9px; background:var(--surface2); display:grid; place-items:center; font-size:.85rem; }
.xopt.num { width:72px; height:72px; justify-content:center; font-size:1.6rem; font-weight:800; padding:0; }
.xopt.sel { border-color:var(--accent); background:var(--accent-soft); }
.xopt.ok { border-color:var(--good); background:var(--good-soft); }
.xopt.bad { border-color:var(--again); background:var(--again-soft); }
.ex-optimg { position:relative; display:block; width:100%; } .ex-optimg b { position:absolute; left:6px; top:6px; z-index:1; background:var(--surface); box-shadow:var(--shadow); }
.ex-opts.grid .xopt { padding:6px; flex-direction:column; align-items:stretch; }
.ex-img { width:100%; border-radius:12px; display:block; } .ex-img.big { max-width:520px; margin:4px auto 8px; }
.ex-pass { background:var(--surface); border-radius:16px; padding:12px 14px; box-shadow:var(--shadow); margin-bottom:10px; }
.ex-pass summary { font-weight:700; font-size:.85rem; color:var(--muted); margin-bottom:6px; }
.ex-pass p { line-height:1.85; margin:6px 0; }
.ex-pass .ex-tbl th, .ex-pass .ex-tbl td { white-space:normal; max-width:none; overflow:visible; vertical-align:top; line-height:1.7; }
.ex-pass .ex-tbl.grid { table-layout:fixed; width:100%; border:1px solid var(--line); }
.ex-pass .ex-tbl.grid td { border:1px solid var(--line); padding:7px 8px; font-size:.85rem; }
.ex-pass .ex-tbl.grid td b { display:block; text-align:center; margin-bottom:2px; }
.blank { display:inline-grid; place-items:center; min-width:24px; height:22px; border-radius:6px; background:var(--surface2); font-size:.75rem; padding:0 4px; } .blank.cur { background:var(--accent); color:var(--accent-ink); }
.ex-expl { margin-top:12px; padding:12px 14px; border-radius:16px; background:var(--surface2); }
.ex-asr { display:flex; gap:8px; align-items:flex-start; padding:3px 0; font-size:.85rem; } .ex-asr button { flex:none; color:var(--accent); font-weight:700; }
.ex-script { margin-top:6px; line-height:1.8; padding:8px 10px; background:var(--card2, rgba(0,0,0,.03)); border-radius:10px; }
.ex-audio { display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:16px; background:var(--surface); box-shadow:var(--shadow); margin-bottom:8px; }
.ex-play { width:46px; height:46px; border-radius:50%; background:var(--accent); color:var(--accent-ink); font-size:1.1rem; display:grid; place-items:center; flex:none; }
.ex-start { text-align:center; padding:40px 12px; } .ex-start .ex-big { font-size:3.4rem; margin-bottom:6px; }
.ex-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(52px,1fr)); gap:8px; }
.ex-cell { height:44px; border-radius:12px; background:var(--surface2); font-weight:700; font-size:.85rem; position:relative; }
.ex-cell.done { background:var(--accent-soft); color:var(--accent); } .ex-cell.cur { outline:2px solid var(--accent); }
.ex-cell.flag::after { content:'⚑'; position:absolute; top:-2px; right:3px; font-size:.7rem; color:var(--hard); }
.ex-cell.ok { background:var(--good-soft); color:var(--good); } .ex-cell.bad { background:var(--again-soft); color:var(--again); } .ex-cell.skip { opacity:.55; }
.ex-est { display:flex; gap:10px; } .ex-est > div { flex:1; text-align:center; background:var(--surface2); border-radius:14px; padding:10px 4px; } .ex-est b { font-size:1.5rem; display:block; }
.ex-ring { --p:0; width:120px; height:120px; border-radius:50%; margin:6px auto; display:grid; place-items:center; background:conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface2) 0); position:relative; }
.ex-ring::before { content:''; position:absolute; inset:10px; border-radius:50%; background:var(--solid, var(--surface)); }
.ex-ring b { position:relative; font-size:1.7rem; } .ex-ring small { font-size:.9rem; color:var(--muted); }
.ex-prow { display:flex; align-items:center; gap:12px; padding:6px 0; }
.set .val, button.act span b { font-weight:700; }


/* ---- furigana trong đề thi + nút nhỏ trên thanh tiêu đề ---- */
.fbtn { width:38px; height:38px; border-radius:12px; display:grid; place-items:center; font-family:var(--font-jp); font-weight:800; font-size:1.05rem; color:var(--muted); background:var(--surface); box-shadow:var(--shadow); flex:none; }
.fbtn.on { color:var(--accent-ink); background:var(--accent); }
.st-top .grow { min-width:0; }
.st-top .bold.small, .st-top .tiny { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.st-top .ex-timer { font-size:.95rem; padding:4px 8px; }
.ex-stem ruby, .ex-pass ruby, .xopt ruby { ruby-align:center; }
.ex-stem ruby rt, .ex-pass ruby rt, .xopt ruby rt { font-size:.45em; font-weight:500; }
.ex-stem:has(ruby) { line-height:2.3; }
.ex-pass p:has(ruby) { line-height:2.4; }
.xopt:has(ruby) { line-height:2.2; }
.set.warn { background:color-mix(in srgb, var(--hard) 12%, transparent); }
.set.warn .lb b { color:var(--hard); }
.study > .st-body { min-height:0; }

/* ---- màn chào ---- */
.welcome .st-top { justify-content:center; padding-top:16px; }
.wl-dots { display:flex; gap:8px; }
.wl-dots i { width:8px; height:8px; border-radius:99px; background:var(--line); transition:all .2s; }
.wl-dots i.on { width:24px; background:var(--accent); } .wl-dots i.done { background:var(--accent); opacity:.5; }
.wl-hero { text-align:center; margin:14px 0 18px; }
.wl-logo { width:76px; height:76px; margin:0 auto 10px; display:grid; place-items:center; border-radius:22px; background:var(--seal); color:#fff; font-family:var(--font-jp); font-size:2.4rem; font-weight:800; transform:rotate(-4deg); box-shadow:var(--shadow); }
.wl-hero h1 { font-size:1.6rem; font-weight:800; font-family:var(--font-title, inherit); }
.wl-feat { display:flex; gap:12px; align-items:flex-start; padding:8px 0; font-size:.92rem; line-height:1.45; }
.wl-feat b { font-size:1.3rem; flex:none; width:28px; text-align:center; }
.wl-t { font-size:1.35rem; font-weight:800; margin:10px 0 16px; font-family:var(--font-title, inherit); }
.wl-paths { display:flex; flex-direction:column; gap:10px; }
.wl-path { display:flex; align-items:center; gap:12px; text-align:left; width:100%; padding:14px; border-radius:16px; background:var(--surface); box-shadow:var(--shadow); border:2px solid transparent; color:var(--ink); }
.wl-path.on, .wl-path:active { border-color:var(--accent); }
.wl-path b { display:block; font-size:1rem; }
.wl-path .grow span { display:block; font-size:.85rem; color:var(--muted); margin-top:2px; }
.wl-pi { font-size:1.6rem; width:36px; text-align:center; flex:none; }
.wl-more { display:flex; flex-direction:column; gap:6px; margin-top:16px; }
.wl-more .btn { width:100%; }
.wl-quote { margin-top:10px; padding:10px 12px; border-radius:14px; background:var(--surface); box-shadow:var(--shadow); font-size:.88rem; }
.wl-ul { margin:8px 0 0; padding-left:20px; line-height:1.8; }

/* ---- bảng luyện viết ---- */
.wp { position:relative; width:min(86vw, 420px); aspect-ratio:1; margin:6px auto 4px; border-radius:20px; background:var(--surface); box-shadow:var(--shadow); --wp-ink:#1F2B2A; touch-action:none; -webkit-user-select:none; user-select:none; }
html[data-theme="dark"] .wp { --wp-ink:#EDEFE8; }
.wp > svg, .wp > canvas { position:absolute; inset:0; width:100%; height:100%; }
.wp-cv { touch-action:none; cursor:crosshair; }
.wp-grid rect { stroke:var(--line); stroke-width:1; }
.wp-grid path { stroke:var(--line); stroke-width:.5; stroke-dasharray:2.5 3; fill:none; }
.wp-grid path.dg { opacity:.5; }
.wp-ghost path.g { fill:none; stroke:var(--muted); stroke-opacity:.22; stroke-width:4.5; stroke-linecap:round; stroke-linejoin:round; }
.wp-ghost path.nx { fill:none; stroke:var(--accent); stroke-opacity:.75; stroke-width:4.5; stroke-linecap:round; stroke-linejoin:round; stroke-dasharray:3 3; }
.wp-ghost circle.st { fill:var(--again); }
.wp-res path { fill:none; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; opacity:.9; }
.wp-res path.bad { stroke-width:3; }
.wp-res text { font-size:6px; font-weight:800; font-family:var(--font-ui); }
.wp-load { position:absolute; left:0; right:0; bottom:10px; text-align:center; }
.wr-body { align-items:stretch; }
.wr-info { text-align:center; margin:4px 0; }
.wr-ch { font-size:2.4rem; line-height:1.2; font-weight:600; }
.wr-msg { text-align:center; min-height:1.4em; margin-top:8px; font-weight:600; }
.wr-chips .chip.good { box-shadow:inset 0 0 0 2px var(--good); }
.wr-chips .chip.bad { box-shadow:inset 0 0 0 2px var(--again); }
.wr-face { gap:8px; }
.wr-study .wp { width:min(78vw, 380px); }
.wr-sum { font-size:.95rem; font-weight:700; margin-top:6px; }
.rate button.sug { outline:3px solid var(--accent); outline-offset:2px; }

/* 5.1 - iPhone / bản web: chừa vùng tai thỏ và thanh Home (trên Android các giá trị này = 0) */
#app { padding-top:env(safe-area-inset-top); }
.tabbar { padding-bottom:calc(8px + env(safe-area-inset-bottom)); }
.study { padding-top:env(safe-area-inset-top); }
.st-foot { padding-bottom:calc(16px + env(safe-area-inset-bottom)); }
.sheet { padding-bottom:calc(22px + env(safe-area-inset-bottom)); }
.toast { bottom:calc(92px + env(safe-area-inset-bottom)); }
.fab { bottom:calc(84px + env(safe-area-inset-bottom)); }
.wp, .wp * { -webkit-touch-callout:none; -webkit-tap-highlight-color:transparent; }
html.is-web body { -webkit-text-size-adjust:100%; }
.web-steps { padding-left:20px; } .web-steps li { margin:7px 0; }
/* 5.3 - Kho đề */
.kho-row { display:flex; align-items:center; gap:12px; padding:14px 16px; }
.kho-row .grow { display:flex; flex-direction:column; gap:3px; min-width:0; }
.kho-row .btn { flex:none; }

/* ================= 6.0 — Home, Luyện, Cài đặt mới ================= */
/* nền tiên cảnh dịu hơn sau chữ cho dễ đọc */
html[data-skin="xian"] { --veil-a:rgba(238,240,228,.22); --veil-b:rgba(238,240,228,.6); }
html[data-skin="xian"][data-theme="dark"] { --veil-a:rgba(7,20,26,.2); --veil-b:rgba(7,20,26,.6); }
html[data-skin="xian"] #scenery [style*="--crane"] { opacity:.55; }

.h6-head { display:flex; align-items:flex-start; gap:10px; margin:6px 0 14px; }
.h6-date { font-size:.82rem; font-weight:600; color:var(--muted); }
.h6-title { font-family:var(--font-title, inherit); font-size:1.7rem; font-weight:700; line-height:1.2; margin:0; }
.h6-chips { display:flex; gap:6px; align-items:center; flex:none; }
.pchip { display:inline-flex; align-items:center; gap:5px; height:40px; padding:0 12px; border-radius:99px; background:var(--surface); border:1px solid var(--line); font-weight:700; font-size:.9rem; color:var(--ink); white-space:nowrap; }
.pchip svg.i { width:18px; height:18px; }
.pchip.ic { width:40px; padding:0; justify-content:center; }
.pchip.fl svg.i { stroke:#C2571E; }
.pchip.rm { padding-left:5px; font-size:.82rem; }
.pchip.rm .rz { display:grid; place-items:center; width:28px; height:28px; border-radius:50%; background:var(--hard-soft); color:var(--hard); font-family:var(--font-jp); font-weight:700; }
.pchip.scope { font-weight:600; font-size:.85rem; max-width:58%; overflow:hidden; text-overflow:ellipsis; }

.today { display:flex; flex-direction:column; gap:14px; padding:18px; }
.today > .row b { font-size:1rem; }
.t-time { display:inline-flex; align-items:center; gap:4px; font-size:.82rem; color:var(--muted); }
.t-time svg.i { width:16px; height:16px; }
.t-big { display:flex; align-items:baseline; gap:8px; }
.t-big b { font-family:var(--font-title, inherit); font-size:2.8rem; font-weight:700; line-height:1; }
.t-big span { font-size:1.05rem; font-weight:600; color:var(--muted); }
.t-pills { display:flex; gap:8px; flex-wrap:wrap; }
.t-pill { display:inline-flex; align-items:center; gap:6px; padding:7px 12px; border-radius:99px; font-size:.85rem; font-weight:700; }
.t-pill::before { content:""; width:8px; height:8px; border-radius:50%; background:currentColor; }
.t-pill.due { background:var(--again-soft); color:var(--again); }
.t-pill.new { background:var(--easy-soft); color:var(--easy); }
.t-goal { display:flex; flex-direction:column; gap:6px; font-size:.85rem; color:var(--muted); }
.t-goal b { color:var(--ink); }
.btn.t-go { min-height:56px; font-size:1.05rem; gap:10px; }
.t-go svg.i, .dr-play svg.i { width:18px; height:18px; fill:currentColor; stroke:none; }
.t-mode { display:flex; align-items:center; justify-content:space-between; width:100%; min-height:46px; padding:0 14px; border-radius:14px; border:1px solid var(--line); background:var(--surface2); font-size:.9rem; color:var(--ink); }
.t-mode b { font-weight:700; }
.t-mode svg.i { width:18px; height:18px; color:var(--muted); }
.t-done { display:flex; gap:12px; align-items:center; }
.t-ok { width:46px; height:46px; border-radius:50%; background:var(--good-soft); color:var(--good); display:grid; place-items:center; flex:none; }
.t-done b { display:block; } .t-done span { font-size:.85rem; color:var(--muted); }

.sec-h { display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin:18px 4px 10px; }
.sec-h h2 { font-family:var(--font-title, inherit); font-size:1.1rem; font-weight:700; margin:0; }
.lnk { color:var(--accent); font-weight:700; font-size:.88rem; padding:6px 0; }
.drow { display:flex; align-items:center; gap:6px; background:var(--surface); border-radius:18px; box-shadow:var(--shadow); margin-bottom:10px; padding:4px 10px 4px 4px; }
.dr-main { flex:1; min-width:0; display:flex; align-items:center; gap:12px; padding:8px; text-align:left; }
.dr-ic { width:44px; height:44px; border-radius:12px; background:var(--accent-soft); display:grid; place-items:center; font-size:1.35rem; flex:none; }
.dr-tx { flex:1; min-width:0; display:flex; flex-direction:column; gap:5px; }
.dr-top { display:flex; justify-content:space-between; gap:8px; align-items:baseline; }
.dr-top b { font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dr-tag { font-size:.78rem; font-weight:700; white-space:nowrap; }
.dr-tag.due { color:var(--again); } .dr-tag.new { color:var(--easy); } .dr-tag.ok { color:var(--good); }
.dr-sub { font-size:.76rem; color:var(--muted); }
.dr-play { width:44px; height:44px; border-radius:50%; background:var(--accent-soft); color:var(--accent); display:grid; place-items:center; flex:none; }
.h6-exam { display:flex; align-items:center; gap:12px; width:100%; text-align:left; margin-top:4px; }
.ex-lv { width:44px; height:44px; border-radius:12px; background:var(--accent); color:var(--accent-ink); display:grid; place-items:center; font-weight:800; flex:none; }
.h6-exam .grow, .h6-resume .grow { display:flex; flex-direction:column; gap:2px; min-width:0; }
.h6-exam .grow span, .h6-resume .grow span { font-size:.82rem; color:var(--muted); }
.h6-exam > svg.i { color:var(--muted); width:18px; height:18px; }
.h6-resume { display:flex; align-items:center; gap:10px; }

.p-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; }
.p-tile { display:flex; flex-direction:column; align-items:flex-start; gap:8px; padding:14px; border-radius:18px; background:var(--surface); box-shadow:var(--shadow); text-align:left; min-height:112px; color:var(--ink); }
.p-tile b { font-weight:700; }
.p-tile > span:last-child { font-size:.78rem; color:var(--muted); line-height:1.35; }
.p-tile.solid { background:var(--accent); color:var(--accent-ink); }
.p-tile.solid > span:last-child { color:inherit; opacity:.88; }
.pi { width:40px; height:40px; border-radius:12px; display:grid; place-items:center; flex:none; }
.pi svg.i { width:20px; height:20px; }
.pi.g { background:var(--accent-soft); color:var(--accent); }
.pi.b { background:var(--easy-soft); color:var(--easy); }
.pi.y, .pi.s2 { background:var(--hard-soft); color:var(--hard); }
.pi.r { background:var(--again-soft); color:var(--again); }
.pi.v { background:#E6E1F6; color:#4E3F96; }
html[data-theme="dark"] .pi.v { background:#2D2552; color:#C9BEFF; }
.pi.s { background:rgba(255,255,255,.18); color:inherit; }
.lcard { background:var(--surface); border-radius:18px; box-shadow:var(--shadow); overflow:hidden; }
.lrow { display:flex; align-items:center; gap:12px; width:100%; padding:12px 14px; border-bottom:1px solid var(--line); text-align:left; min-height:64px; color:var(--ink); }
.lrow:last-child { border-bottom:0; }
.lrow .grow { display:flex; flex-direction:column; gap:2px; min-width:0; }
.lrow b { font-weight:700; }
.lrow .grow span { font-size:.8rem; color:var(--muted); }
.lrow > svg.i { color:var(--muted); width:18px; height:18px; }
.badge { padding:3px 9px; border-radius:99px; background:var(--again); color:#fff; font-size:.75rem; font-weight:800; white-space:nowrap; }

.prof { display:flex; align-items:center; gap:12px; width:100%; text-align:left; color:var(--ink); }
.prof .av { width:46px; height:46px; border-radius:50%; background:var(--accent); color:var(--accent-ink); display:grid; place-items:center; font-family:var(--font-title, inherit); font-weight:700; font-size:1.2rem; flex:none; }
.prof .grow { display:flex; flex-direction:column; gap:2px; min-width:0; }
.prof .grow span { font-size:.82rem; color:var(--muted); }
.prof > svg.i, .lnkrow > svg.i { color:var(--muted); width:18px; height:18px; }
.grp-t { font-size:.75rem; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; margin:18px 6px 8px; }
.lnkrow .si { width:36px; height:36px; border-radius:10px; display:grid; place-items:center; flex:none; }
.lnkrow .si svg.i { width:18px; height:18px; }
.si.g { background:var(--accent-soft); color:var(--accent); }
.si.n { background:var(--surface2); color:var(--muted); }
.set .seg { flex:none; }
.set .seg button { flex:none; padding:8px 11px; }
.bk .grow b { display:block; }
.bk .grow span { font-size:.82rem; color:var(--muted); }
.bk .btn { width:100%; }
.bk-ic { width:44px; height:44px; border-radius:50%; display:grid; place-items:center; flex:none; }
.bk-ic.ok { background:var(--good-soft); color:var(--good); }
.bk-ic.no { background:var(--hard-soft); color:var(--hard); }
/* 6.3 luyện theo dạng / luyện nghe */
.dr-row { width:100%; background:none; border:0; text-align:left; padding:7px 0; color:inherit; }
.lis-bar .lis-pp { width:44px; height:44px; border-radius:50%; background:var(--accent); color:#fff; font-size:1.05rem; flex:none; margin-right:10px; }
.lis-lines { display:flex; flex-direction:column; gap:2px; }
.lis-line { display:flex; align-items:flex-start; gap:6px; padding:7px 6px; border-radius:10px; transition:background .15s; }
.lis-line.on { background:var(--accent-soft, rgba(80,120,200,.14)); }
.lis-line.opt .lis-tx { color:var(--muted); }
.lis-lp { flex:none; width:30px; height:30px; border-radius:50%; background:var(--surface2); font-size:.8rem; color:var(--ink); }
.lis-lp.sm { width:26px; height:26px; font-size:.85rem; background:none; color:var(--muted); }
.lis-who { flex:none; font-size:.75rem; font-weight:700; padding:2px 6px; border-radius:6px; background:var(--surface2); margin-top:5px; }
.lis-tx { flex:1; line-height:1.6; padding-top:3px; }
.lis-tx.blur { filter:blur(5px); cursor:pointer; user-select:none; }
.lis-sh { border-color:var(--accent); }

/* ================= 6.4: phông chữ đi kèm app (SIL OFL, xem fonts/OFL.txt) ================= */
@font-face { font-family:"KJ NotoSC"; src:url(fonts/noto-sc-hsk1.woff2) format("woff2"); font-display:swap; }
@font-face { font-family:"KJ BVP"; src:url(fonts/be-vietnam-pro-400.woff2) format("woff2"); font-weight:100 500; font-display:swap; }
@font-face { font-family:"KJ BVP"; src:url(fonts/be-vietnam-pro-700.woff2) format("woff2"); font-weight:600 900; font-display:swap; }
@font-face { font-family:"KJ Nunito"; src:url(fonts/nunito-400.woff2) format("woff2"); font-weight:100 500; font-display:swap; }
@font-face { font-family:"KJ Nunito"; src:url(fonts/nunito-700.woff2) format("woff2"); font-weight:600 900; font-display:swap; }
html[data-kfont="sans"]      { --font-jp:"Noto Sans SC","Noto Sans CJK SC","Microsoft YaHei",sans-serif; }
html[data-ufont="bvp"]    { --font-ui:"KJ BVP",system-ui,"Roboto","Noto Sans SC",sans-serif; --font-title:"KJ BVP",system-ui,sans-serif; }
html[data-ufont="nunito"] { --font-ui:"KJ Nunito",system-ui,"Roboto","Noto Sans SC",sans-serif; --font-title:"KJ Nunito",system-ui,sans-serif; }
.font-tiles { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.font-tile { text-align:left; padding:14px 16px; border:1.5px solid var(--line); border-radius:14px; background:var(--surface); }
.font-tile.on { border-color:var(--accent); background:var(--accent-soft); }
.font-tile .fp { display:block; font-size:2rem; line-height:1.2; color:var(--ink); }
.font-tile .fn { display:block; font-size:.85rem; color:var(--muted); margin-top:6px; }

/* ================= 6.4: Tiên cảnh — khung vẽ tay (luôn bật với Tiên cảnh; nền giữ nguyên) =================
   6 kiểu nét khác nhau, xoay vòng theo vị trí để các khung cạnh nhau không giống hệt nhau */
html[data-skin="xian"][data-sketch="1"] {
  --sk-l1:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%233d4f7a' stroke-linecap='round'%3E%3Cpath d='M28.4,13.8 Q46.0,12.4 67.2,14.9 Q80.6,13.3 83.0,29.7 Q83.9,50.8 83.3,66.1 Q80.7,84.0 64.2,81.8 Q46.4,85.3 28.0,83.9 Q15.4,80.5 16.0,65.3 Q15.5,45.9 13.2,31.2 Q11.8,13.5 37.4,15.0' stroke-width='2.4' opacity='1'/%3E%3Cpath d='M30.4,10.4 Q51.5,13.1 70.8,15.3 Q81.4,14.9 80.7,26.1 Q80.8,49.0 83.4,72.2 Q84.3,85.6 66.0,83.9 Q53.3,85.5 33.2,84.2 Q14.3,85.9 17.5,71.4 Q20.7,50.3 16.0,25.1 Q17.8,12.6 36.4,10.4' stroke-width='1.5' opacity='0.8'/%3E%3C/g%3E%3C/svg%3E");
  --sk-l2:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%233d4f7a' stroke-linecap='round'%3E%3Cpath d='M29.0,14.3 Q48.9,16.8 67.9,14.6 Q82.9,12.6 81.9,29.2 Q80.5,46.2 80.6,68.0 Q80.6,82.0 67.0,81.0 Q46.8,80.6 30.4,82.8 Q13.0,81.7 15.6,65.1 Q16.4,45.5 13.3,28.7 Q14.5,13.6 41.0,13.5' stroke-width='2.3' opacity='1'/%3E%3Cpath d='M29.3,17.2 Q50.4,17.0 66.6,16.9 Q84.3,17.8 84.8,34.9 Q83.2,47.1 81.3,61.9 Q81.8,82.2 64.9,82.2 Q49.1,83.0 32.2,83.9 Q11.8,82.9 14.3,66.4 Q15.5,54.1 13.5,34.6 Q15.3,12.6 33.3,16.6' stroke-width='1.4' opacity='0.7'/%3E%3C/g%3E%3C/svg%3E");
  --sk-l3:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%233d4f7a' stroke-linecap='round'%3E%3Cpath d='M27.5,11.7 Q47.4,9.1 67.9,12.6 Q83.4,16.6 82.7,27.1 Q82.1,46.5 84.7,68.0 Q84.1,83.4 65.8,79.6 Q51.6,82.8 30.9,84.2 Q12.5,84.5 13.1,64.8 Q17.3,50.9 16.7,31.2 Q13.1,12.9 43.5,14.4' stroke-width='2.6' opacity='1'/%3E%3C/g%3E%3C/svg%3E");
  --sk-l4:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%233d4f7a' stroke-linecap='round'%3E%3Cpath d='M32.5,14.3 Q46.7,16.7 61.6,15.5 Q82.9,13.8 82.4,34.1 Q81.6,46.9 83.6,61.2 Q81.7,80.6 63.3,81.7 Q51.1,83.4 34.6,83.7 Q14.1,80.9 15.1,62.4 Q14.2,46.9 15.1,32.3 Q12.7,13.4 39.5,13.8' stroke-width='2.2' opacity='1'/%3E%3Cpath d='M35.0,16.7 Q48.2,15.8 60.2,12.7 Q83.4,12.9 83.6,31.1 Q79.8,45.1 80.5,63.4 Q80.1,83.6 63.0,80.6 Q51.7,80.9 35.1,83.2 Q15.8,83.6 12.2,64.2 Q15.8,50.8 14.2,33.6 Q15.2,16.2 45.0,15.8' stroke-width='1.3' opacity='0.75'/%3E%3C/g%3E%3C/svg%3E");
  --sk-l5:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%233d4f7a' stroke-linecap='round'%3E%3Cpath d='M32.1,12.7 Q50.5,12.1 66.1,12.2 Q80.4,13.5 79.7,28.3 Q84.0,48.9 82.7,64.8 Q81.2,81.1 66.8,83.0 Q47.5,82.7 30.3,79.9 Q15.6,80.5 12.1,65.0 Q13.2,45.1 13.4,32.0 Q14.3,11.9 40.1,13.1' stroke-width='1.9' opacity='1'/%3E%3Cpath d='M29.0,14.7 Q46.6,17.5 65.7,14.5 Q81.0,14.1 81.9,27.0 Q82.6,49.6 83.4,67.4 Q84.1,81.5 64.2,79.8 Q48.6,84.5 30.2,81.6 Q15.8,81.0 14.3,70.0 Q18.4,51.3 17.2,30.8 Q16.5,10.8 34.0,12.2' stroke-width='1.2' opacity='0.7'/%3E%3Cpath d='M26.9,15.4 Q48.6,20.3 68.3,16.8 Q84.0,13.3 81.0,30.9 Q75.6,50.9 79.4,61.6 Q79.6,82.4 68.3,82.7 Q49.1,84.9 28.0,79.7 Q15.1,81.2 14.1,67.8 Q17.7,45.9 14.1,32.2 Q14.5,18.6 29.9,18.1' stroke-width='0.9' opacity='0.5'/%3E%3C/g%3E%3C/svg%3E");
  --sk-l6:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%233d4f7a' stroke-linecap='round'%3E%3Cpath d='M28.7,14.5 Q47.1,11.5 68.3,13.9 Q81.1,13.0 83.3,26.4 Q82.4,50.2 81.1,68.4 Q81.1,82.9 66.5,82.6 Q46.1,82.1 27.4,83.4 Q12.9,83.4 13.0,69.4 Q17.2,46.6 15.8,27.1 Q14.9,14.9 38.7,15.3' stroke-width='2.4' opacity='1'/%3E%3Cpath d='M28.9,13.9 Q47.0,16.7 71.7,15.8 Q85.3,15.5 83.1,30.6 Q78.7,46.6 81.6,69.0 Q81.4,81.7 69.4,86.3 Q49.5,81.1 29.4,83.6 Q16.2,82.8 18.2,69.5 Q13.5,46.5 14.2,27.8 Q17.4,17.1 33.9,12.3' stroke-width='1.5' opacity='0.7'/%3E%3C/g%3E%3C/svg%3E");
  --sk-d1:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23c4d2f0' stroke-linecap='round'%3E%3Cpath d='M28.4,13.8 Q46.0,12.4 67.2,14.9 Q80.6,13.3 83.0,29.7 Q83.9,50.8 83.3,66.1 Q80.7,84.0 64.2,81.8 Q46.4,85.3 28.0,83.9 Q15.4,80.5 16.0,65.3 Q15.5,45.9 13.2,31.2 Q11.8,13.5 37.4,15.0' stroke-width='2.4' opacity='1'/%3E%3Cpath d='M30.4,10.4 Q51.5,13.1 70.8,15.3 Q81.4,14.9 80.7,26.1 Q80.8,49.0 83.4,72.2 Q84.3,85.6 66.0,83.9 Q53.3,85.5 33.2,84.2 Q14.3,85.9 17.5,71.4 Q20.7,50.3 16.0,25.1 Q17.8,12.6 36.4,10.4' stroke-width='1.5' opacity='0.8'/%3E%3C/g%3E%3C/svg%3E");
  --sk-d2:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23c4d2f0' stroke-linecap='round'%3E%3Cpath d='M29.0,14.3 Q48.9,16.8 67.9,14.6 Q82.9,12.6 81.9,29.2 Q80.5,46.2 80.6,68.0 Q80.6,82.0 67.0,81.0 Q46.8,80.6 30.4,82.8 Q13.0,81.7 15.6,65.1 Q16.4,45.5 13.3,28.7 Q14.5,13.6 41.0,13.5' stroke-width='2.3' opacity='1'/%3E%3Cpath d='M29.3,17.2 Q50.4,17.0 66.6,16.9 Q84.3,17.8 84.8,34.9 Q83.2,47.1 81.3,61.9 Q81.8,82.2 64.9,82.2 Q49.1,83.0 32.2,83.9 Q11.8,82.9 14.3,66.4 Q15.5,54.1 13.5,34.6 Q15.3,12.6 33.3,16.6' stroke-width='1.4' opacity='0.7'/%3E%3C/g%3E%3C/svg%3E");
  --sk-d3:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23c4d2f0' stroke-linecap='round'%3E%3Cpath d='M27.5,11.7 Q47.4,9.1 67.9,12.6 Q83.4,16.6 82.7,27.1 Q82.1,46.5 84.7,68.0 Q84.1,83.4 65.8,79.6 Q51.6,82.8 30.9,84.2 Q12.5,84.5 13.1,64.8 Q17.3,50.9 16.7,31.2 Q13.1,12.9 43.5,14.4' stroke-width='2.6' opacity='1'/%3E%3C/g%3E%3C/svg%3E");
  --sk-d4:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23c4d2f0' stroke-linecap='round'%3E%3Cpath d='M32.5,14.3 Q46.7,16.7 61.6,15.5 Q82.9,13.8 82.4,34.1 Q81.6,46.9 83.6,61.2 Q81.7,80.6 63.3,81.7 Q51.1,83.4 34.6,83.7 Q14.1,80.9 15.1,62.4 Q14.2,46.9 15.1,32.3 Q12.7,13.4 39.5,13.8' stroke-width='2.2' opacity='1'/%3E%3Cpath d='M35.0,16.7 Q48.2,15.8 60.2,12.7 Q83.4,12.9 83.6,31.1 Q79.8,45.1 80.5,63.4 Q80.1,83.6 63.0,80.6 Q51.7,80.9 35.1,83.2 Q15.8,83.6 12.2,64.2 Q15.8,50.8 14.2,33.6 Q15.2,16.2 45.0,15.8' stroke-width='1.3' opacity='0.75'/%3E%3C/g%3E%3C/svg%3E");
  --sk-d5:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23c4d2f0' stroke-linecap='round'%3E%3Cpath d='M32.1,12.7 Q50.5,12.1 66.1,12.2 Q80.4,13.5 79.7,28.3 Q84.0,48.9 82.7,64.8 Q81.2,81.1 66.8,83.0 Q47.5,82.7 30.3,79.9 Q15.6,80.5 12.1,65.0 Q13.2,45.1 13.4,32.0 Q14.3,11.9 40.1,13.1' stroke-width='1.9' opacity='1'/%3E%3Cpath d='M29.0,14.7 Q46.6,17.5 65.7,14.5 Q81.0,14.1 81.9,27.0 Q82.6,49.6 83.4,67.4 Q84.1,81.5 64.2,79.8 Q48.6,84.5 30.2,81.6 Q15.8,81.0 14.3,70.0 Q18.4,51.3 17.2,30.8 Q16.5,10.8 34.0,12.2' stroke-width='1.2' opacity='0.7'/%3E%3Cpath d='M26.9,15.4 Q48.6,20.3 68.3,16.8 Q84.0,13.3 81.0,30.9 Q75.6,50.9 79.4,61.6 Q79.6,82.4 68.3,82.7 Q49.1,84.9 28.0,79.7 Q15.1,81.2 14.1,67.8 Q17.7,45.9 14.1,32.2 Q14.5,18.6 29.9,18.1' stroke-width='0.9' opacity='0.5'/%3E%3C/g%3E%3C/svg%3E");
  --sk-d6:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23c4d2f0' stroke-linecap='round'%3E%3Cpath d='M28.7,14.5 Q47.1,11.5 68.3,13.9 Q81.1,13.0 83.3,26.4 Q82.4,50.2 81.1,68.4 Q81.1,82.9 66.5,82.6 Q46.1,82.1 27.4,83.4 Q12.9,83.4 13.0,69.4 Q17.2,46.6 15.8,27.1 Q14.9,14.9 38.7,15.3' stroke-width='2.4' opacity='1'/%3E%3Cpath d='M28.9,13.9 Q47.0,16.7 71.7,15.8 Q85.3,15.5 83.1,30.6 Q78.7,46.6 81.6,69.0 Q81.4,81.7 69.4,86.3 Q49.5,81.1 29.4,83.6 Q16.2,82.8 18.2,69.5 Q13.5,46.5 14.2,27.8 Q17.4,17.1 33.9,12.3' stroke-width='1.5' opacity='0.7'/%3E%3C/g%3E%3C/svg%3E");
  --sk1:var(--sk-l1); --sk2:var(--sk-l2); --sk3:var(--sk-l3); --sk4:var(--sk-l4); --sk5:var(--sk-l5); --sk6:var(--sk-l6);
  --sk-wave:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='6' viewBox='0 0 120 6'%3E%3Cpath d='M0 3 Q15 1 30 3.2 T60 2.6 T90 3.4 T120 3' fill='none' stroke='%233d4f7a' stroke-width='1.3' stroke-linecap='round' opacity='.75'/%3E%3C/svg%3E");
}
html[data-skin="xian"][data-sketch="1"][data-theme="dark"] {
  --sk1:var(--sk-d1); --sk2:var(--sk-d2); --sk3:var(--sk-d3); --sk4:var(--sk-d4); --sk5:var(--sk-d5); --sk6:var(--sk-d6);
  --sk-wave:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='6' viewBox='0 0 120 6'%3E%3Cpath d='M0 3 Q15 1 30 3.2 T60 2.6 T90 3.4 T120 3' fill='none' stroke='%23c4d2f0' stroke-width='1.3' stroke-linecap='round' opacity='.75'/%3E%3C/svg%3E");
}
html[data-skin="xian"][data-sketch="1"] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .tab.on .tabi) {
  border:2px solid transparent; border-image-source:var(--sk1); border-image-slice:32; border-image-width:16px; border-image-outset:6px; border-image-repeat:stretch;
  background-clip:padding-box; border-radius:8px; box-shadow:none;
}
html[data-skin="xian"][data-sketch="1"] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .tab.on .tabi):nth-child(6n+2) { border-image-source:var(--sk2); }
html[data-skin="xian"][data-sketch="1"] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .tab.on .tabi):nth-child(6n+3) { border-image-source:var(--sk3); }
html[data-skin="xian"][data-sketch="1"] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .tab.on .tabi):nth-child(6n+4) { border-image-source:var(--sk4); }
html[data-skin="xian"][data-sketch="1"] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .tab.on .tabi):nth-child(6n+5) { border-image-source:var(--sk5); }
html[data-skin="xian"][data-sketch="1"] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .tab.on .tabi):nth-child(6n+6) { border-image-source:var(--sk6); }
html[data-skin="xian"][data-sketch="1"] :is(.chip, .seg button.on, .t-pill, .pchip) { border-radius:7px; }
html[data-skin="xian"][data-sketch="1"] .seg button.on { box-shadow:none; outline:1.5px dashed color-mix(in srgb, var(--ink) 45%, transparent); outline-offset:-3px; }
html[data-skin="xian"][data-sketch="1"] :is(.chip.on, .font-tile.on, .xopt.sel) { background-color:var(--accent-soft); color:var(--accent); }
html[data-skin="xian"][data-sketch="1"] .xopt.ok { background-color:color-mix(in srgb, var(--good, #2e7d4f) 16%, var(--surface)); }
html[data-skin="xian"][data-sketch="1"] .xopt.bad { background-color:color-mix(in srgb, var(--bad, #b0413e) 16%, var(--surface)); }
html[data-skin="xian"][data-sketch="1"] .sw { border:2px solid color-mix(in srgb, var(--ink) 70%, transparent); }
html[data-skin="xian"][data-sketch="1"] .setl .set + .set, html[data-skin="xian"][data-sketch="1"] .lcard .lrow + .lrow { border-top:1px dashed color-mix(in srgb, var(--ink) 22%, transparent); }
html[data-skin="xian"][data-sketch="1"] .tabbar { border-top:0; background-image:var(--sk-wave); background-repeat:repeat-x; background-position:top left; background-size:120px 6px; }
html[data-skin="xian"][data-sketch="1"] .tab.on .tabi { border-radius:10px; }
html[data-skin="xian"][data-sketch="1"] .drow .dr-main, html[data-skin="xian"][data-sketch="1"] .drow .dr-play { box-shadow:none; }
html[data-skin="xian"][data-sketch="1"] .wp { border-radius:12px; }
html[data-skin="xian"][data-sketch="1"] .act { margin-bottom:8px; }

/* 6.29: dòng cài đặt có nhóm nút dài → nút xuống dòng dưới */
.set.set-col { flex-wrap:wrap; }
.set.set-col > .seg { width:100%; margin-top:8px; }
.set.set-col > .seg button { flex:1; white-space:nowrap; padding-left:4px; padding-right:4px; font-size:.88rem; }

/* ================= 6.29: Tiên cảnh — 3 kiểu khung (settings.frame): tranh cuộn (= Cổ phong 6.43) · nét vẽ (= Phác họa, data-sketch ở trên); thủy mặc đã bỏ ở 6.43 =================
   Khung lớn (panel, thẻ học, danh sách, hộp thoại) có trang trí; khung vừa chỉ viền kép; nút / chip / ô tròn chỉ nét mảnh hợp hình. */
html[data-skin="xian"][data-frame="scroll"] { --fr-tl:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cg %3E%3Cpath d='M3 27V9Q3 3 9 3H27M8 21Q8 8 21 8Q14.5 10 14.5 15.5Q14.5 19.5 11.5 19.5Q9 19.5 9 17Q9 15 11.5 15' fill='none' stroke='%23A9802A' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='21.5' cy='3' r='1.1' fill='%23A9802A'/%3E%3Ccircle cx='3' cy='21.5' r='1.1' fill='%23A9802A'/%3E%3C/g%3E%3C/svg%3E"); --fr-tr:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cg transform='translate(30 0) scale(-1 1)'%3E%3Cpath d='M3 27V9Q3 3 9 3H27M8 21Q8 8 21 8Q14.5 10 14.5 15.5Q14.5 19.5 11.5 19.5Q9 19.5 9 17Q9 15 11.5 15' fill='none' stroke='%23A9802A' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='21.5' cy='3' r='1.1' fill='%23A9802A'/%3E%3Ccircle cx='3' cy='21.5' r='1.1' fill='%23A9802A'/%3E%3C/g%3E%3C/svg%3E"); --fr-bl:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cg transform='translate(0 30) scale(1 -1)'%3E%3Cpath d='M3 27V9Q3 3 9 3H27M8 21Q8 8 21 8Q14.5 10 14.5 15.5Q14.5 19.5 11.5 19.5Q9 19.5 9 17Q9 15 11.5 15' fill='none' stroke='%23A9802A' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='21.5' cy='3' r='1.1' fill='%23A9802A'/%3E%3Ccircle cx='3' cy='21.5' r='1.1' fill='%23A9802A'/%3E%3C/g%3E%3C/svg%3E"); --fr-br:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cg transform='translate(30 30) scale(-1 -1)'%3E%3Cpath d='M3 27V9Q3 3 9 3H27M8 21Q8 8 21 8Q14.5 10 14.5 15.5Q14.5 19.5 11.5 19.5Q9 19.5 9 17Q9 15 11.5 15' fill='none' stroke='%23A9802A' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='21.5' cy='3' r='1.1' fill='%23A9802A'/%3E%3Ccircle cx='3' cy='21.5' r='1.1' fill='%23A9802A'/%3E%3C/g%3E%3C/svg%3E"); --fr-g:color-mix(in srgb, var(--gold) 46%, transparent); --fr-g2:color-mix(in srgb, var(--gold) 26%, transparent); }
html[data-skin="xian"][data-frame="scroll"][data-theme="dark"] { --fr-tl:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cg %3E%3Cpath d='M3 27V9Q3 3 9 3H27M8 21Q8 8 21 8Q14.5 10 14.5 15.5Q14.5 19.5 11.5 19.5Q9 19.5 9 17Q9 15 11.5 15' fill='none' stroke='%23E3C170' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='21.5' cy='3' r='1.1' fill='%23E3C170'/%3E%3Ccircle cx='3' cy='21.5' r='1.1' fill='%23E3C170'/%3E%3C/g%3E%3C/svg%3E"); --fr-tr:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cg transform='translate(30 0) scale(-1 1)'%3E%3Cpath d='M3 27V9Q3 3 9 3H27M8 21Q8 8 21 8Q14.5 10 14.5 15.5Q14.5 19.5 11.5 19.5Q9 19.5 9 17Q9 15 11.5 15' fill='none' stroke='%23E3C170' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='21.5' cy='3' r='1.1' fill='%23E3C170'/%3E%3Ccircle cx='3' cy='21.5' r='1.1' fill='%23E3C170'/%3E%3C/g%3E%3C/svg%3E"); --fr-bl:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cg transform='translate(0 30) scale(1 -1)'%3E%3Cpath d='M3 27V9Q3 3 9 3H27M8 21Q8 8 21 8Q14.5 10 14.5 15.5Q14.5 19.5 11.5 19.5Q9 19.5 9 17Q9 15 11.5 15' fill='none' stroke='%23E3C170' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='21.5' cy='3' r='1.1' fill='%23E3C170'/%3E%3Ccircle cx='3' cy='21.5' r='1.1' fill='%23E3C170'/%3E%3C/g%3E%3C/svg%3E"); --fr-br:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cg transform='translate(30 30) scale(-1 -1)'%3E%3Cpath d='M3 27V9Q3 3 9 3H27M8 21Q8 8 21 8Q14.5 10 14.5 15.5Q14.5 19.5 11.5 19.5Q9 19.5 9 17Q9 15 11.5 15' fill='none' stroke='%23E3C170' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='21.5' cy='3' r='1.1' fill='%23E3C170'/%3E%3Ccircle cx='3' cy='21.5' r='1.1' fill='%23E3C170'/%3E%3C/g%3E%3C/svg%3E"); --fr-g:color-mix(in srgb, var(--gold) 40%, transparent); --fr-g2:color-mix(in srgb, var(--gold) 20%, transparent); }
html[data-skin="xian"][data-frame="scroll"] .panel, html[data-skin="xian"][data-frame="scroll"] .setl, html[data-skin="xian"][data-frame="scroll"] .lcard, html[data-skin="xian"][data-frame="scroll"] .deck, html[data-skin="xian"][data-frame="scroll"] .face, html[data-skin="xian"][data-frame="scroll"] .dlg { border:1px solid var(--fr-g); border-radius:6px;
  box-shadow:var(--shadow), inset 0 0 0 4px var(--solid), inset 0 0 0 5px var(--fr-g2);
  background-image:var(--fr-tl), var(--fr-tr), var(--fr-bl), var(--fr-br); background-position:3px 3px, calc(100% - 3px) 3px, 3px calc(100% - 3px), calc(100% - 3px) calc(100% - 3px); background-size:22px 22px; background-repeat:no-repeat; }
html[data-skin="xian"][data-frame="scroll"] .face { border-radius:8px; background-size:28px 28px; }
html[data-skin="xian"][data-frame="scroll"] .face .tagrow { top:20px; left:38px; }
html[data-skin="xian"][data-frame="scroll"] .face .seal { right:38px; }
html[data-skin="xian"][data-frame="scroll"] .panel { padding:18px; }
html[data-skin="xian"][data-frame="scroll"] .p-tile, html[data-skin="xian"][data-frame="scroll"] .drow, html[data-skin="xian"][data-frame="scroll"] .crow, html[data-skin="xian"][data-frame="scroll"] .wp, html[data-skin="xian"][data-frame="scroll"] .act, html[data-skin="xian"][data-frame="scroll"] .t-mode, html[data-skin="xian"][data-frame="scroll"] .font-tile, html[data-skin="xian"][data-frame="scroll"] .kho-row, html[data-skin="xian"][data-frame="scroll"] .rt-node, html[data-skin="xian"][data-frame="scroll"] .dc-row { border:1px solid var(--fr-g); border-radius:6px; box-shadow:var(--shadow), inset 0 0 0 3px var(--solid), inset 0 0 0 4px var(--fr-g2); }
html[data-skin="xian"][data-frame="scroll"] .rt-node.cur { border-color:var(--gold); }
html[data-skin="xian"][data-frame="scroll"] .btn, html[data-skin="xian"][data-frame="scroll"] .in, html[data-skin="xian"][data-frame="scroll"] .xopt, html[data-skin="xian"][data-frame="scroll"] .ex-cell { border:1px solid var(--fr-g); border-radius:8px; box-shadow:none; }
html[data-skin="xian"][data-frame="scroll"] .btn.primary { border-color:transparent; box-shadow:0 8px 18px -10px var(--accent), inset 0 0 0 3px var(--accent), inset 0 0 0 4px color-mix(in srgb, var(--gold) 70%, #fff 0%); }
html[data-skin="xian"][data-frame="scroll"] .xopt { box-shadow:inset 0 0 0 3px var(--solid), inset 0 0 0 4px var(--fr-g2); }
html[data-skin="xian"][data-frame="scroll"] :is(.xopt.sel, .chip.on, .font-tile.on) { border-color:var(--accent); }
html[data-skin="xian"][data-frame="scroll"] .chip, html[data-skin="xian"][data-frame="scroll"] .t-pill, html[data-skin="xian"][data-frame="scroll"] .pchip { border:1px solid var(--fr-g); border-radius:999px; }
html[data-skin="xian"][data-frame="scroll"] .seg { border:1px solid var(--fr-g); border-radius:10px; box-shadow:none; }
html[data-skin="xian"][data-frame="scroll"] .seg button.on { border-radius:7px; box-shadow:inset 0 0 0 1px var(--fr-g); }
html[data-skin="xian"][data-frame="scroll"] .ibtn:not(.plain), html[data-skin="xian"][data-frame="scroll"] .rt-dot, html[data-skin="xian"][data-frame="scroll"] .tab.on .tabi { border:1px solid var(--fr-g); box-shadow:inset 0 0 0 2px var(--solid), inset 0 0 0 3px var(--fr-g2); }
html[data-skin="xian"][data-frame="scroll"] .rt-node.ok .rt-dot, html[data-skin="xian"][data-frame="scroll"] .rt-node.cur .rt-dot { border-color:var(--gold); box-shadow:inset 0 0 0 2px color-mix(in srgb, var(--gold) 55%, transparent), 0 0 0 4px var(--accent-soft, transparent); }
html[data-skin="xian"][data-frame="scroll"] :is(.setl .set + .set, .lcard .lrow + .lrow) { border-top:1px solid var(--fr-g2); }
html[data-skin="xian"][data-frame="scroll"] .tabbar { border-top:1px solid var(--fr-g); box-shadow:inset 0 3px 0 -2px var(--fr-g2); }


/* ================= 6.4: giấy tập viết ================= */
.sheet-prev { margin:12px 0; background:#fff; border-radius:6px; box-shadow:var(--shadow); overflow:hidden; }
.sheet-prev svg { display:block; width:100%; height:auto; }
#print-root { display:none; }
.sheet-pen { padding:8px !important; }
.sheet-wrap { position:relative; background:#fff; box-shadow:var(--shadow); touch-action:none; }
.sheet-wrap svg { display:block; width:100%; height:auto; }
.sheet-wrap canvas { position:absolute; left:0; top:0; touch-action:none; }
@page { size:A4; margin:0; }
@media print {
  body > *:not(#print-root) { display:none !important; }
  html, body { background:#fff !important; height:auto !important; overflow:visible !important; }
  #print-root { display:block !important; }
  #print-root svg { display:block; width:210mm; height:297mm; page-break-after:always; break-after:page; }
}
.sheet-pen { overflow:auto; }
.sheet-pen.pan .sheet-wrap, .sheet-pen.pan .sheet-wrap canvas { touch-action:auto; pointer-events:none; }
.sheet-pen.pan { touch-action:pan-x pan-y; }
.sheet-pen .sheet-wrap { margin:0; }
.shp-bar { flex-wrap:wrap; gap:6px; }
.shp-bar .btn { flex:1 1 22%; min-width:0; padding-left:4px; padding-right:4px; }

/* 6.5: nhắc sao lưu, báo cáo AI */
.bk-remind { align-items: center; }
.bk-remind .col { display: flex; flex-direction: column; gap: 6px; flex: none; }
.bk-remind .col .btn { min-width: 84px; }
.ai-ex .lnk.tiny { font-size: .78rem; padding: 2px 4px; }
.wl-logo.wl-img { background:none; transform:none; padding:0; object-fit:cover; }

/* ===================================================================== 6.5: MÀN HÌNH RỘNG
   Máy tính, iPad xoay ngang, máy tính bảng (≥ 900px): thanh dưới đáy → menu bên trái,
   nội dung canh giữa (tối đa ~1100px), Trang chủ 2 cột, bảng bật lên thành hộp giữa màn hình.
   Điện thoại không bị ảnh hưởng. */
.tb-brand, .tb-foot { display:none; }
.h6-cols, .h6-l, .h6-r { display:contents; }
@media (min-width: 900px) {
  #app { display:grid; grid-template-columns:236px minmax(0, 1fr); grid-template-rows:minmax(0, 1fr); }
  #app > .screen { grid-column:2; grid-row:1; padding:30px max(36px, calc((100% - 1100px) / 2)) 48px; }
  #app > .screen.fullscreen { grid-column:1 / -1; padding:0; }
  .tabbar { grid-column:1; grid-row:1; flex-direction:column; align-items:stretch; gap:4px; padding:20px 12px calc(16px + env(safe-area-inset-bottom)); border-top:0; border-right:1px solid var(--line); overflow-y:auto; }
  html[data-skin="xian"][data-sketch="1"] .tabbar { background-image:none; border-top:0; border-right:1px solid var(--line); }
  .tb-brand { display:flex; align-items:center; gap:10px; padding:2px 10px 18px; }
  .tb-brand img { width:38px; height:38px; border-radius:10px; flex:none; }
  .tb-brand b { font-size:1.02rem; line-height:1.2; color:var(--ink); }
  .tab { flex:none; flex-direction:row; justify-content:flex-start; gap:8px; padding:6px 8px; border-radius:12px; font-size:.95rem; font-weight:700; }
  .tab .tabi { width:36px; height:32px; }
  .tab.on { background:var(--accent-soft); }
  .tab.on .tabi { background:transparent; }
  .tab:hover:not(.on) { background:color-mix(in srgb, var(--accent-soft) 45%, transparent); }
  .tb-foot { margin-top:auto; display:flex; flex-direction:column; gap:2px; padding:12px 14px; border:1px dashed var(--line); border-radius:12px; font-size:.8rem; color:var(--muted); }
  .tb-foot b { color:var(--ink); font-size:.85rem; }

  /* Trang chủ: 2 cột */
  .h6-cols { display:grid; grid-template-columns:minmax(0, 1.25fr) minmax(0, 1fr); gap:18px; align-items:start; }
  .h6-l, .h6-r { display:flex; flex-direction:column; gap:14px; min-width:0; }
  .h6-l > *, .h6-r > * { margin-top:0 !important; margin-bottom:0 !important; }
  .h6-r .sec-h { margin:4px 2px -6px !important; }

  /* bảng bật lên → hộp giữa màn hình */
  .ov { align-items:center; justify-content:center; padding:32px; }
  .sheet { max-width:640px; max-height:86vh; border-radius:24px; animation:pop .18s; }
  .sheet .grab { display:none; }
  .toast { bottom:36px; }

  /* học thẻ / thi / luyện nghe: nội dung canh giữa */
  .study > .st-top, .study > .st-body, .study > .st-foot { width:min(860px, 100%); margin-inline:auto; }
  .study > .st-top { padding-top:22px; }
  .study { justify-content:center; }
  .study > .st-top { position:absolute; top:0; left:0; right:0; }
  .study > .st-body { flex:0 1 auto; max-height:calc(100% - 190px); }
  .face { min-height:400px; max-height:520px; overflow-y:auto; }   /* 6.50 mặt sau dài (kanji: chiết tự + từ ghép) cuộn trong thẻ, không mất chữ ở trên */
}
/* gợi ý phím tắt khi có bàn phím + chuột */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .rate button::after { content:attr(data-g); margin-top:3px; min-width:18px; padding:0 5px; border:1.5px solid currentColor; border-bottom-width:2.5px; border-radius:5px; font-size:.68rem; line-height:1.3; opacity:.6; }
  [data-a="st-show"]::after, [data-a="st-next"]::after { content:"Space"; margin-left:10px; padding:0 6px; border:1.5px solid rgba(255,255,255,.55); border-bottom-width:2.5px; border-radius:6px; font-size:.7rem; opacity:.8; }
  [data-a="home-start"]::after { content:"Enter"; margin-left:10px; padding:0 6px; border:1.5px solid rgba(255,255,255,.55); border-bottom-width:2.5px; border-radius:6px; font-size:.7rem; opacity:.8; }
}
html[data-skin] #scenery svg.sc-wide { display:none; }
@media (min-width: 900px) {
  html[data-skin="xian"] #scenery > svg:not(.sc-wide) { display:none; }
  html[data-skin="xian"] #scenery svg.sc-wide { display:block; }
}

/* 6.5: chia bài */
.les-panel .les-go { width:100%; }
.les-list { display:flex; flex-direction:column; gap:6px; }
.les-row { display:flex; align-items:center; gap:10px; width:100%; text-align:left; padding:9px 10px; border-radius:14px; background:var(--surface2); color:var(--ink); }
.les-row.cur { background:var(--accent-soft); }
.les-row .grow { display:flex; flex-direction:column; gap:2px; min-width:0; }
.les-row .bar { height:5px; margin-top:3px; }
.les-b { flex:none; width:30px; height:30px; border-radius:50%; display:grid; place-items:center; font-weight:800; font-size:.82rem; background:var(--surface); color:var(--muted); border:1.5px solid var(--line); }
.les-b.on { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }
.les-b.ok { background:var(--good-soft); color:var(--good); border-color:var(--good); }
@media (min-width: 900px) { .les-list { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); } }

/* 6.5 bài tập câu: sắp xếp / dịch ghép ô / nghe ghép / tìm chỗ sai / AI chấm */
.sx-face { gap:8px; }
.sx-vi { font-size:1.2rem; line-height:1.5; }
.sx-line { min-height:64px; width:100%; margin-top:10px; padding:10px 8px; border-radius:14px; border:2px dashed var(--line); display:flex; flex-wrap:wrap; gap:8px; align-content:flex-start; justify-content:center; align-items:center; }
.sx-line.ok { border-style:solid; border-color:var(--good); background:var(--good-soft); }
.sx-line.bad { border-style:solid; border-color:var(--again); background:var(--again-soft); }
.sx-bank { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; margin-top:14px; }
.sx-tile { font-size:1.2rem; padding:10px 14px; border-radius:12px; background:var(--surface); border:1.5px solid var(--line); border-bottom-width:3px; box-shadow:var(--shadow); color:var(--ink); line-height:1.3; }
.sx-tile.put { background:var(--accent-soft); border-color:var(--accent); box-shadow:none; }
.sx-tile.used { opacity:.25; box-shadow:none; }
.sx-tile:disabled { cursor:default; }
.sx-spot { display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin:12px 0 4px; }
.sx-chip { font-size:1.35rem; padding:8px 10px; border-radius:10px; background:var(--surface2); border:2px solid transparent; color:var(--ink); }
.sx-chip.bad { border-color:var(--again); background:var(--again-soft); }
.sx-chip.miss { border-color:var(--hard); }
.sx-ans { margin-top:10px; padding:12px 14px; border-radius:14px; background:var(--surface); box-shadow:var(--shadow); text-align:left; width:100%; }
.sx-ans .jp { line-height:1.7; }
.good-t { color:var(--good); } .bad-t { color:var(--again); }
.linkbtn { background:none; border:0; padding:0; color:var(--accent); font:inherit; text-decoration:underline; cursor:pointer; }
/* 6.5 cặp dễ nhầm */
.pq-rule { white-space:pre-wrap; line-height:1.7; }
.pq-card { text-align:center; padding:22px 16px; }
.pq-s { font-size:1.45rem; line-height:1.9; margin:6px 0; }
.pq-fill { color:var(--accent); border-bottom:3px solid var(--accent); padding:0 .1em; }
.pq-opts { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:14px; }
.pq-opt { font-size:1.4rem; padding:16px 10px; border-radius:16px; background:var(--surface); border:1.5px solid var(--line); border-bottom-width:3px; box-shadow:var(--shadow); color:var(--ink); }
.pq-opt.ok { border-color:var(--good); background:var(--good-soft); color:var(--good); }
.pq-opt.bad { border-color:var(--again); background:var(--again-soft); color:var(--again); }
.pq-score { font:600 3rem var(--font-jp, serif); color:var(--accent); }
.pq-rev .jp { font-size:1.15rem; line-height:1.8; }
.p-tile .pi { font-size:1.25rem; }

/* 6.5: chiều học trên Trang chủ */
.t-dir { margin:10px 0; }

/* 6.5: tab Luyện gọn — lưới nhỏ 3 cột */
.p-mix { display:flex; align-items:center; gap:12px; width:100%; padding:12px 14px; border-radius:16px; background:var(--accent); color:var(--accent-ink, #fff); text-align:left; margin-bottom:10px; box-shadow:var(--shadow); }
.p-mix b { display:block; } .p-mix span span { display:block; font-size:.8rem; opacity:.85; }
.p-mix .pi { background:rgba(255,255,255,.18); color:inherit; }
.p-grid.mini { grid-template-columns:repeat(3, 1fr); gap:8px; }
.p-tile.mini { min-height:0; padding:10px 4px 9px; align-items:center; text-align:center; gap:6px; }
.p-tile.mini .pi { width:34px; height:34px; font-size:1.05rem; }
.p-tile.mini .pi svg.i { width:18px; height:18px; }
.p-tile.mini b { font-size:.8rem; line-height:1.25; }
@media (min-width:900px) { .p-grid.mini { grid-template-columns:repeat(6, 1fr); } }

/* 6.5: báo lỗi nội dung */
.st-report { margin-top:8px; opacity:.75; }
/* 6.7 tài khoản & gói Pro */
.pill{display:inline-block;font-size:.8rem;font-weight:700;padding:3px 10px;border-radius:999px;background:var(--surface2);color:var(--ink2,var(--ink))}
.pill.good{background:var(--accent);color:#fff}

/* 6.15: ô chọn ngày theo màu nền sáng / tối (biểu tượng lịch không bị mất trong chế độ tối) */
input[type=date] { color-scheme: light dark; }
/* 6.15: bôi đen chữ trong đề / đoạn văn / lời thoại / ví dụ → Chép · ＋ Thẻ · Nghe */
.ex-pass, .ex-stem, .ex-expl, .lis-lines, .exs, .pickable { -webkit-user-select:text; user-select:text; }
.ex-pass summary, .ex-stem .qno { -webkit-user-select:none; user-select:none; }
.pickbar { position:fixed; z-index:9000; display:none; gap:4px; padding:5px; border-radius:14px; background:var(--ink,#1F2B2A); box-shadow:0 8px 28px rgba(0,0,0,.28); }
.pickbar button { border:0; background:transparent; color:var(--surface,#fff); font:inherit; font-weight:700; font-size:.95rem; padding:8px 12px; border-radius:10px; }
.pickbar button:active { background:rgba(255,255,255,.15); }
/* 6.16: từ loại + luyện chia */
.poschip { display:inline-block; margin:2px auto 6px; padding:3px 10px; border-radius:999px; font-size:.78rem; font-weight:600; background:var(--surface-2, rgba(127,127,127,.12)); color:var(--muted, #888); border:1px solid var(--line); }
button.poschip { cursor:pointer; color:var(--ink); }
.cj-tbl { overflow-x:auto; margin:10px 0; }
.cj-tbl table { border-collapse:collapse; width:100%; font-size:.92rem; }
.cj-tbl th, .cj-tbl td { border-bottom:1px solid var(--line); padding:6px 8px; text-align:left; white-space:nowrap; }
.cj-tbl td:first-child { color:var(--muted, #888); font-size:.8rem; white-space:normal; min-width:5.5em; }
.cj-rules { display:grid; gap:8px; font-size:.86rem; line-height:1.5; margin-top:8px; }
.cj-to { margin-top:10px; font-weight:700; color:var(--primary, #c33); }
.cj-clock { margin-left:auto; font-weight:800; font-size:1.2rem; font-variant-numeric:tabular-nums; }
/* 6.17: tab Thư viện, khả năng đỗ JLPT, ô tiến độ, ảnh thành tích */
.lib-seg { width:100%; }
.lib-seg button { flex:1; }
.rd-card { color:var(--ink); }
.rd-card .rd-ring { flex:none; }
.rd-card .rd-tip { color:var(--accent) !important; font-weight:600; margin-top:2px; }
.rd-card b { font-size:1.02rem; }
.rd-card.rd-lg { padding:16px; margin-bottom:14px; }
.rd-card.rd-lg b { font-size:1.15rem; }
.rd-top { display:flex; align-items:center; gap:16px; margin:6px 0 12px; color:var(--ink); }
.rd-big { font-size:2rem; font-weight:800; line-height:1.1; }
.rd-big small { font-size:1rem; color:var(--muted); font-weight:600; }
.rd-parts { display:grid; gap:10px; }
.rd-p .row { margin-bottom:4px; }
.prog { display:block; width:100%; text-align:left; color:var(--ink); margin-top:12px; }
.prog-in { display:flex; align-items:flex-end; gap:16px; margin-top:8px; }
.prog-n { display:flex; flex-direction:column; }
.prog-n b { font-size:1.35rem; }
.prog-n span { font-size:.78rem; color:var(--muted); }
.prog-b { flex:1; display:flex; align-items:flex-end; gap:5px; height:46px; }
.prog-b i { flex:1; background:var(--accent); border-radius:4px 4px 2px 2px; min-height:4px; }
.prog-b i.z { background:var(--line); }
.sc-img { width:100%; border-radius:14px; display:block; box-shadow:var(--shadow); }
/* 6.18: lộ trình học */
.rt-path { display:flex; flex-direction:column; gap:10px; }
.rt-node { display:flex; align-items:center; gap:12px; text-align:left; background:var(--surface); border:1.5px solid var(--line); border-radius:18px; padding:12px 14px; margin-left:calc(var(--off,0) * 18px); margin-right:calc((2 - var(--off,0)) * 18px); color:var(--ink); box-shadow:var(--shadow); }
.rt-node .rt-dot { width:46px; height:46px; border-radius:50%; display:grid; place-items:center; flex:none; font-weight:800; font-size:1.15rem; background:var(--line); color:var(--ink); font-family:var(--font-jp); }
.rt-node.ok .rt-dot { background:var(--good); color:#fff; }
.rt-node.cur { border-color:var(--accent); }
.rt-node.cur .rt-dot { background:var(--accent); color:var(--accent-ink); box-shadow:0 0 0 5px var(--accent-soft, rgba(46,96,82,.18)); }
.rt-node.lock, .rt-node.soon { opacity:.6; }
.rt-node.soon { box-shadow:none; border-style:dashed; }
.rt-tx { display:flex; flex-direction:column; gap:2px; min-width:0; }
.rt-tx span { font-size:.8rem; color:var(--muted); }
.rt-top { position:sticky; top:0; z-index:2; }
.rt-body { padding:4px 16px 40px; max-width:720px; margin:0 auto; }
.rt-h { margin:2px 0 12px; }
.rt-text p { line-height:1.7; margin:0 0 10px; }
.rt-kana { display:flex; flex-direction:column; gap:8px; }
.rt-krow { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; }
.rt-kc { background:var(--surface); border:1.5px solid var(--line); border-radius:14px; padding:8px 4px; display:flex; flex-direction:column; align-items:center; color:var(--ink); }
.rt-kc .jp { font-size:1.9rem; line-height:1.2; }
.rt-kc small { color:var(--muted); font-size:.78rem; }
.rt-kc.sm .jp { font-size:1.3rem; }
.rt-grid3 { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin:8px 0; }
.rt-tips div { margin:4px 0; }
.rt-ex { display:flex; align-items:center; gap:10px; padding:8px 0; border-top:1px dashed var(--line); }
.rt-ex .jp { font-size:1.15rem; }
.rt-say { border:none; background:var(--accent-soft, rgba(46,96,82,.12)); color:var(--accent); border-radius:50%; width:34px; height:34px; display:inline-grid; place-items:center; flex:none; }
.rt-say.lg { width:46px; height:46px; margin-top:8px; }
.rt-say svg { width:18px; height:18px; }
.rt-word { display:flex; align-items:center; gap:10px; padding:10px 14px; border-bottom:1px solid var(--line); }
.rt-word:last-child { border-bottom:none; }
.rt-word b.jp { font-size:1.2rem; }
.rt-gp .rt-pat { font-size:1.25rem; font-weight:800; color:var(--accent); }
.rt-chk { margin-top:10px; padding-top:10px; border-top:1px solid var(--line); }
.rt-chk .chip.bad { border-color:var(--again); color:var(--again); }
.rt-sent { font-size:1.25rem; line-height:1.9; }
.rt-big { font-size:2.6rem; font-weight:700; line-height:1.3; }
.rt-mid { font-size:1.15rem; font-weight:700; margin-bottom:4px; }
.rt-opts .pq-opt { font-size:1.05rem; }
.rt-opt-big { font-size:1.9rem; }
.rt-built { min-height:56px; display:flex; flex-wrap:wrap; gap:8px; padding:10px; border:2px dashed var(--line); border-radius:14px; margin-top:12px; align-items:center; }
.rt-tiles { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.rt-tile { background:var(--surface); border:1.5px solid var(--line); border-bottom-width:3px; border-radius:12px; padding:8px 12px; font-size:1.1rem; color:var(--ink); }
.rt-tile.on { background:var(--accent-soft, rgba(46,96,82,.12)); }
.rt-dlg { display:flex; flex-direction:column; gap:10px; }
.rt-line { display:flex; align-items:flex-end; gap:8px; }
.rt-line.r { flex-direction:row-reverse; }
.rt-who { font-size:.75rem; color:var(--muted); width:46px; text-align:center; flex:none; }
.rt-bub { background:var(--surface); border:1.5px solid var(--line); border-radius:16px; padding:8px 12px; display:flex; flex-direction:column; gap:2px; max-width:78%; }
.rt-line.r .rt-bub { background:var(--accent-soft, rgba(46,96,82,.12)); }
.rt-bub .jp { font-size:1.1rem; line-height:1.8; }
.rt-read p { font-size:1.15rem; line-height:1.9; margin:0 0 8px; }
.rt-kj { display:flex; gap:14px; align-items:flex-start; }
.rt-kjc { font-size:3rem; line-height:1; }
.rt-srow.dn b { color:var(--muted); }
.rt-q .rt-say { margin-top:6px; }
.rt-scroll { height:100%; overflow-y:auto; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; }
/* 6.21: quảng cáo bản web */
.kj-ad { margin:16px 0; min-height:100px; text-align:center; }
.kj-ad small { display:block; color:var(--muted); font-size:.7rem; margin-bottom:4px; }
.adg { display:flex; flex-direction:column; height:100%; }
.adg-top { padding:10px 12px; }
.adg-body { flex:1; overflow-y:auto; padding:0 18px 12px; text-align:center; max-width:640px; margin:0 auto; width:100%; }
.adg-ic { font-size:3rem; }
.adg-body h2 { margin:6px 0 4px; }
.adg-info { text-align:left; }
.adg-info div { margin:4px 0; }
.adg-foot { padding:12px 18px calc(14px + env(safe-area-inset-bottom)); max-width:640px; margin:0 auto; width:100%; }

/* 6.23 trọng âm (pitch accent): vạch trên = cao, vạch dưới = thấp, vạch đứng = chỗ đổi; 6.25 màu riêng (--pitch, bổ sung cho màu chủ đạo) + nền nhạt dưới phần giọng cao */
.pa { display:inline-flex; align-items:stretch; vertical-align:middle; line-height:1.15; --pa:var(--pitch, var(--accent)); }
.pa i { font-style:normal; padding:.12em .03em .16em; border:0 solid transparent; border-width:.11em 0; min-width:.1em; }
.pa i.h { border-top-color:var(--pa); background:color-mix(in srgb, var(--pa) 13%, transparent); }
.pa i.l { border-bottom-color:var(--pa); }
.pa i.c { border-left:.11em solid var(--pa); }
.pa i.pt { width:.55em; padding-left:0; padding-right:0; opacity:.55; }
.face .rd .pa i { border-width:2.5px 0; } .face .rd .pa i.c { border-left-width:2.5px; }
.rt-pa { font-size:.9rem; color:var(--ink); margin-left:6px; }
.rt-pa .pa i { border-width:2px 0; } .rt-pa .pa i.c { border-left-width:2px; }
.rt-lvs { display:flex; } .rt-lvs button { flex:1; } .rt-lvs small { opacity:.7; font-weight:400; }
.tester-card { display:flex; align-items:center; gap:6px; }

/* 6.25 luyện nói */
.rt-mic { background:var(--seal-soft, rgba(210,57,58,.1)); color:var(--seal); margin-left:6px; }
.rt-say.sm { width:30px; height:30px; } .rt-say.sm svg { width:16px; height:16px; }
.rt-rl { display:flex; align-items:center; gap:6px; } .rt-rl p { margin:6px 0; }
.spk-sent { font-size:1.45rem; line-height:2; margin:4px 0 2px; }
.spk-live { min-height:56px; display:flex; align-items:center; gap:8px; margin:12px 0 0; font-size:.95rem; }
.spk-dot { width:12px; height:12px; border-radius:50%; background:var(--seal); animation:spkp 1s infinite; flex:none; }
@keyframes spkp { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.35; transform:scale(.75); } }
.spk-res { display:flex; gap:14px; align-items:center; margin:12px 0 0; padding:12px; border-radius:14px; background:var(--surface2); }
.spk-sc { flex:none; width:64px; height:64px; border-radius:50%; display:grid; place-items:center; font-size:1.4rem; font-weight:800; color:#fff; }
.spk-sc small { font-size:.7rem; } .spk-sc.ok { background:var(--good); } .spk-sc.mid { background:var(--hard); } .spk-sc.bad { background:var(--again); }
.spk-kana { font-size:1.15rem; letter-spacing:.04em; margin:4px 0; word-break:break-all; }
.spk-kana .ok { color:var(--good); } .spk-kana .miss { color:var(--again); text-decoration:underline wavy; text-underline-offset:4px; }

/* 6.28 từ điển tra nhanh (dict.js) */
.dc-list { display:flex; flex-direction:column; gap:8px; }
.dc-row { display:flex; align-items:center; gap:12px; background:var(--surface); border-radius:14px; padding:10px 12px; box-shadow:var(--shadow); cursor:pointer; }
.dc-row .small { line-height:1.45; }
.dc-f { font-size:1.15rem; }
.dc-r { font-size:.92rem; color:var(--muted); }
.dc-lv { display:inline-block; font-size:.7rem; font-weight:700; color:var(--accent); border:1px solid currentColor; border-radius:999px; padding:0 7px; vertical-align:2px; }
.dc-big { font-size:2rem; width:48px; text-align:center; flex:none; }
.dc-act { display:flex; gap:4px; flex:none; align-items:center; }
.dc-act .ibtn { width:38px; height:38px; font-size:1.05rem; }
.dc-got { width:38px; text-align:center; color:var(--good); font-weight:800; }
.dc-head { text-align:center; margin:4px 0 12px; }
.dc-hf { font-size:2rem; display:block; }
.dc-hk { font-size:3.4rem; display:block; line-height:1.2; }
.dc-hr { font-size:1.05rem; color:var(--muted); margin-top:2px; }
.dc-kan { display:flex; align-items:center; gap:12px; padding:8px 2px; border-bottom:1px solid var(--line); }
.dc-kan > b.jp { font-size:1.5rem; min-width:40px; text-align:center; }
.dc-hint p { margin:6px 0 0; }

/* 6.30 bài tập AI (js/aiex.js) */
.ax-go { display:block; margin-left:auto; }
.ax-opts .pq-opt { font-size:1.05rem; text-align:left; padding:12px 14px; }
.ax-opts { grid-template-columns:1fr; }
.ax-u { text-decoration:underline; text-decoration-thickness:2px; text-underline-offset:4px; text-decoration-color:var(--accent); }
.ax-u sub { font-size:.6em; color:var(--accent); font-weight:700; margin-left:1px; }
.ax-ex { margin-top:10px; line-height:1.6; }
.spin { width:34px; height:34px; margin:6px auto 10px; border-radius:50%; border:3px solid var(--line); border-top-color:var(--accent); animation:axspin 0.9s linear infinite; }
@keyframes axspin { to { transform:rotate(360deg); } }

/* 6.33 trò chơi (js/games.js) */
.game-wrap { position:fixed; inset:0; z-index:5; background:var(--bg); }
.game-fr { width:100%; height:100%; border:0; display:block; }
.game-card .gc-k { display:grid; place-items:center; width:46px; height:46px; flex:none; border-radius:50%; background:var(--accent); color:#fff; font-size:1.6rem; font-weight:700; }
.game-row { margin-bottom:14px; }
.game-row .pi { font-size:1.3rem; }
.game-tile .gt-ic { font-size:2.2rem; margin-right:12px; }
.game-tile .chip.sm { font-size:.72rem; padding:1px 8px; vertical-align:middle; }
.game-host { position:fixed; inset:0; z-index:60; background:var(--bg); }

/* ===== 6.35 tra / dịch khi bôi đen, Nghe & Đọc của tôi (đọc kỹ, shadowing YouTube) ===== */
.trapop { position:fixed; z-index:9001; max-height:62vh; overflow-y:auto; padding:12px 14px; border-radius:16px; background:var(--surface); color:var(--ink); box-shadow:0 12px 36px rgba(0,0,0,.28); border:1px solid var(--line); line-height:1.45; }
.tp-h { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
.tp-w { font-size:1.5rem; }
.tp-r { font-size:1rem; color:var(--muted); }
.tp-m { font-weight:600; margin:4px 0 2px; }
.tp-k { display:flex; flex-wrap:wrap; gap:4px 12px; margin-top:6px; font-size:.85rem; }
.tp-k b { font-size:1.05rem; }
.tp-s { font-size:1.15rem; line-height:1.9; }
.tp-vi { font-weight:600; margin:6px 0 4px; }
.tp-pts { font-size:.85rem; display:grid; gap:3px; margin-bottom:4px; }
.tp-gl { display:grid; gap:2px; margin-top:4px; }
.tp-g { display:flex; gap:10px; font-size:.86rem; justify-content:space-between; border-bottom:1px dashed var(--line); padding:3px 0; }
.tp-g span:last-child { text-align:right; }
.tp-b { display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }
.md-it { display:flex; align-items:center; gap:12px; width:100%; text-align:left; margin-bottom:10px; }
.md-it b { display:block; } .md-it .small { display:block; }
.md-ic { font-size:1.6rem; width:44px; text-align:center; flex:none; }
.md-th { width:88px; height:50px; object-fit:cover; border-radius:10px; flex:none; background:var(--surface2); }
.ell { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.rd-steps { display:flex; gap:6px; margin-bottom:12px; }
.rd-steps button { flex:1; min-width:0; padding:7px 2px; border-radius:12px; background:var(--surface2); color:var(--muted); font-size:.74rem; font-weight:600; line-height:1.2; }
.rd-steps button b { display:block; font-size:1rem; }
.rd-steps button.dn { color:var(--ink); }
.rd-steps button.on { background:var(--accent); color:var(--accent-ink,#fff); }
.rd-txt { font-size:1.12rem; line-height:2; }
.rd-txt p { margin:0 0 .7em; }
.rd-deep ruby rt { font-size:.55em; color:var(--muted); }
.rd-w { cursor:pointer; border-radius:4px; }
.rd-w:active { background:var(--surface2); }
.rd-new, .rd-new-l { text-decoration:underline; text-decoration-color:var(--accent); text-decoration-thickness:2px; text-underline-offset:5px; }
.rd-sn, .rd-sn-l { display:inline-grid; place-items:center; min-width:1.35em; height:1.35em; margin:0 3px 0 1px; padding:0 3px; border-radius:7px; background:var(--surface2); color:var(--muted); font:700 .62rem/1 system-ui, sans-serif; vertical-align:.3em; }
.rd-sum { display:flex; text-align:center; }
.rd-sum div { flex:1; } .rd-sum b { display:block; font-size:1.5rem; } .rd-sum span { font-size:.75rem; color:var(--muted); }
.rd-un { display:grid; gap:2px; max-height:46vh; overflow-y:auto; }
.rd-u { display:flex; align-items:center; gap:8px; padding:6px 2px; border-bottom:1px dashed var(--line); }
.rd-u input { width:20px; height:20px; flex:none; }
.rd-opt { justify-content:flex-start; text-align:left; }
.rd-opt.good { background:var(--good-soft); color:var(--good); } .rd-opt.bad { background:var(--again-soft, rgba(220,60,60,.12)); color:var(--again); } .rd-opt.dim { opacity:.55; }
#yt-host { position:fixed; left:0; right:0; top:0; z-index:40; aspect-ratio:16/9; max-height:38vh; margin:0 auto; max-width:720px; background:#000; }
#yt-host iframe, #yt-p { width:100%; height:100%; display:block; border:0; }
.yt-msg, .yt-err { position:absolute; inset:0; display:grid; place-items:center; align-content:center; gap:8px; color:#ddd; text-align:center; padding:12px; font-size:.9rem; }
.yt-pad { height:min(56.25vw, 38vh, 405px); margin:-14px -16px 10px; }
.yt-lines { display:grid; gap:6px; margin-bottom:12px; }
.yt-ln { padding:8px 10px; border-radius:12px; background:var(--surface); border:1px solid var(--line); }
.yt-ln.cur { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent); }
.yt-lc { display:flex; align-items:center; gap:4px; margin-bottom:2px; }
.yt-b { width:32px; height:28px; border-radius:8px; background:var(--surface2); font-size:.85rem; }
.yt-b.on { background:var(--accent); }
.yt-jp { font-size:1.1rem; line-height:1.9; }
.yt-sh { text-align:center; }
.yt-big { font-size:1.45rem; line-height:2; margin:8px 0; min-height:2.2em; }
/* 6.36 ô tra trên Trang chủ */
.h6-search { display:flex; align-items:center; gap:12px; width:100%; margin:0 0 14px; padding:12px 16px; border-radius:16px; background:var(--surface); border:1px solid var(--line); box-shadow:var(--shadow); text-align:left; color:var(--muted); }
.h6-search svg { width:20px; height:20px; flex:none; }
.h6-search b { display:block; color:var(--ink); font-size:.95rem; }
.h6-search .jp { display:block; font-size:.8rem; }
/* 6.36 lướt thẻ */
.face.swp { touch-action:pan-y; user-select:none; -webkit-user-select:none; cursor:grab; will-change:transform; }
.face.swp.drag { cursor:grabbing; animation:none; }
.swp-badge { position:absolute; top:16px; left:50%; transform:translateX(-50%) rotate(-4deg); padding:5px 14px; border-radius:10px; font-weight:800; font-size:1.05rem; opacity:0; pointer-events:none; border:2px solid currentColor; background:var(--surface); }
.swp-badge.ok { color:var(--good); } .swp-badge.no { color:var(--again); }
.swp-tip { position:absolute; bottom:10px; left:0; right:0; font-size:.72rem; color:var(--muted); pointer-events:none; }
.st-undo { font-size:1.1rem; }
.t-go2 { margin-top:12px; }
/* 6.37 bộ thủ / chiết tự */
.rad-blk { margin:8px 0; text-align:left; width:100%; }
.rad-cs { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:4px 0; }
.rad-plus { color:var(--muted); font-weight:700; }
.rad-c { display:flex; flex-direction:column; align-items:center; min-width:58px; padding:6px 8px; border-radius:12px; background:var(--surface2); line-height:1.15; }
.rad-c b { font-size:1.45rem; } .rad-c span { font-size:.72rem; font-weight:700; } .rad-c small { font-size:.66rem; color:var(--muted); max-width:90px; text-align:center; }
.rad-blk.sm .rad-c { min-width:46px; padding:4px 6px; } .rad-blk.sm .rad-c b { font-size:1.15rem; }
.rad-top { position:sticky; top:0; z-index:2; }
.rad-sel { display:flex; flex-wrap:wrap; gap:6px; }
.rad-res { display:grid; grid-template-columns:repeat(auto-fill, minmax(64px, 1fr)); gap:6px; margin-bottom:12px; }
.rad-k { display:flex; flex-direction:column; align-items:center; padding:6px 2px; border-radius:12px; background:var(--surface); border:1px solid var(--line); line-height:1.15; }
.rad-k b { font-size:1.7rem; } .rad-k span { font-size:.7rem; font-weight:700; } .rad-k small { font-size:.62rem; color:var(--accent); }
.rad-h { font-size:.75rem; font-weight:700; color:var(--muted); margin:10px 0 4px; }
.rad-h:first-child { margin-top:0; }
.rad-g { display:grid; grid-template-columns:repeat(auto-fill, minmax(50px, 1fr)); gap:4px; }
.rad-b { display:flex; flex-direction:column; align-items:center; padding:5px 1px; border-radius:10px; background:var(--surface2); line-height:1.1; }
.rad-b b { font-size:1.3rem; } .rad-b span { font-size:.56rem; color:var(--muted); max-width:100%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; padding:0 2px; }
.rad-b.on { background:var(--accent); color:var(--accent-ink,#fff); } .rad-b.on span { color:inherit; }
.rad-b.off { opacity:.25; }
/* 6.42 chiết tự dễ hiểu: công thức 亻 + 木 → 休, câu gợi nhớ, ô tìm thành phần, "Hay gặp", kết quả 1 hàng vuốt ngang trong khung dính đầu màn */
.rad-c.rad-eq { background:var(--accent-soft, var(--surface2)); box-shadow:inset 0 0 0 1.5px var(--accent); }
.rad-hint { margin:6px 0 2px; font-size:.86rem; color:var(--ink); }
.rad-hint b { color:var(--accent); }
.rad-how { display:flex; align-items:center; gap:6px; margin-bottom:8px; }
.rad-how .rad-c { min-width:54px; padding:5px 8px; } .rad-how .rad-c b { font-size:1.4rem; }
.rad-q { display:flex; align-items:center; gap:8px; margin:0 0 10px; padding:0 12px; height:46px; border-radius:14px; background:var(--surface); border:1px solid var(--line); color:var(--muted); }
.rad-q input { flex:1; min-width:0; height:100%; border:0; background:none; outline:none; }
.rad-b small { font-size:.54rem; color:var(--muted); max-width:100%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; padding:0 2px; line-height:1.2; }
.rad-b.on small { color:inherit; opacity:.85; }
.rad-b[hidden], .rad-grp[hidden] { display:none; }
.rad-g { grid-template-columns:repeat(auto-fill, minmax(58px, 1fr)); }
.rad-b { min-height:58px; justify-content:center; }
.rad-top .rad-res { display:flex; grid-template-columns:none; overflow-x:auto; gap:6px; margin:6px -4px 0; padding:2px 4px 4px; scroll-snap-type:x proximity; }
.rad-top .rad-res .rad-k { flex:none; width:64px; scroll-snap-align:start; }
.rad-sel .rad-plus { align-self:center; }
/* 6.38 hội thoại nhập vai */
.rp-chat { display:flex; flex-direction:column; gap:10px; margin-bottom:12px; }
.rp-m { display:flex; align-items:flex-end; gap:6px; max-width:92%; }
.rp-m.me { align-self:flex-end; flex-direction:row-reverse; }
.rp-who { font-size:.72rem; color:var(--muted); min-width:2.6em; text-align:center; }
.rp-b { padding:8px 12px; border-radius:16px; background:var(--surface); border:1px solid var(--line); display:flex; flex-direction:column; gap:2px; line-height:1.6; }
.rp-b .jp { font-size:1.05rem; } .rp-b small { color:var(--muted); font-size:.78rem; }
.rp-m.you .rp-b { border-bottom-left-radius:4px; }
.rp-m.me .rp-b { background:var(--accent-soft, var(--surface2)); border-bottom-right-radius:4px; }
.rp-sc { align-self:flex-start; font-size:.72rem; font-weight:700; padding:1px 8px; border-radius:999px; margin-top:2px; }
.rp-sc.ok, .rp-avg.ok { color:var(--good); background:var(--good-soft); } .rp-sc.mid, .rp-avg.mid { color:var(--hard); background:var(--hard-soft); } .rp-sc.bad, .rp-avg.bad { color:var(--again); background:var(--again-soft); }
.rp-turn { border:2px solid var(--accent); }
.rp-vi { font-weight:700; font-size:1.05rem; margin:4px 0; }
.rp-jp { font-size:1.2rem; line-height:1.9; margin:4px 0; }
.rp-avg { display:inline-block; margin-top:8px; padding:4px 12px; border-radius:999px; font-weight:700; }

/* 6.38 bản đồ Lộ trình kiểu Tiên cảnh: đảo nổi trên mây, đường nét đứt, ⛩ ở bài đang học, rương mỗi 5 bài */
.rt-map { position:relative; margin:4px 0 0; border-radius:20px; overflow:hidden; background:
  radial-gradient(120px 40px at 18% 12%, color-mix(in srgb, var(--surface) 70%, transparent), transparent 70%),
  radial-gradient(160px 50px at 82% 46%, color-mix(in srgb, var(--surface) 60%, transparent), transparent 70%),
  radial-gradient(140px 44px at 30% 78%, color-mix(in srgb, var(--surface) 60%, transparent), transparent 70%),
  linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--bg)), color-mix(in srgb, var(--gold, var(--accent)) 6%, var(--bg))); }
.rt-trail { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.rt-trail path { fill:none; stroke:color-mix(in srgb, var(--accent) 45%, var(--line)); stroke-width:3; stroke-dasharray:2 9; stroke-linecap:round; vector-effect:non-scaling-stroke; }
html .rt-map.rt-map .rt-node.rt-isl { position:absolute; transform:translate(-50%, -32px); width:150px; margin:0; padding:0; flex-direction:column; gap:4px; text-align:center; background:none; border:0; box-shadow:none; border-image:none; border-radius:0; }
html .rt-map.rt-map .rt-isl .rt-dot { position:relative; width:60px; height:60px; font-size:1.3rem; background:var(--surface); border:2px solid var(--line); box-shadow:0 10px 0 -4px color-mix(in srgb, var(--good) 35%, var(--line)), 0 16px 14px -8px rgba(0,0,0,.25); }
html .rt-map.rt-map .rt-isl.ok .rt-dot { background:var(--good); color:#fff; border-color:var(--gold, var(--good)); box-shadow:0 0 0 3px color-mix(in srgb, var(--gold, var(--good)) 45%, transparent), 0 10px 0 -4px color-mix(in srgb, var(--good) 55%, #000 10%), 0 16px 14px -8px rgba(0,0,0,.25); }
html .rt-map.rt-map .rt-isl.cur .rt-dot { width:68px; height:68px; background:var(--accent); color:var(--accent-ink); border-color:var(--gold, var(--accent)); box-shadow:0 0 0 6px var(--accent-soft, rgba(46,96,82,.18)), 0 12px 0 -4px color-mix(in srgb, var(--accent) 60%, #000 15%), 0 18px 16px -8px rgba(0,0,0,.3); animation:rt-float 3.2s ease-in-out infinite; }
html .rt-map.rt-map .rt-isl.lock .rt-tx, html .rt-map.rt-map .rt-isl.lock .rt-tx b { color:var(--muted); }
html .rt-map.rt-map .rt-isl.lock .rt-dot { filter:grayscale(1); color:var(--muted); }
html .rt-map.rt-map .rt-isl.soon .rt-tx, html .rt-map.rt-map .rt-isl.soon .rt-tx b { color:var(--muted); }
html .rt-map.rt-map .rt-isl.soon .rt-dot { border-style:dashed; box-shadow:none; background:var(--bg); color:var(--muted); }
html .rt-map.rt-map .rt-isl .rt-tx { align-items:center; max-width:150px; padding:3px 8px; border-radius:10px; background:var(--bg); box-shadow:0 0 0 1px color-mix(in srgb, var(--line) 60%, transparent); }
html .rt-map.rt-map .rt-isl .rt-tx span { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; line-height:1.25; }
html .rt-map.rt-map .rt-isl .rt-tx small { font-size:.72rem; color:var(--muted); }
html .rt-map.rt-map .rt-isl.cur .rt-tx small { color:var(--accent); font-weight:700; }
.rt-torii { position:absolute; top:-30px; left:50%; transform:translateX(-50%); font-size:1.35rem; z-index:1; filter:drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.rt-chest { position:absolute; transform:translate(-50%, -50%); display:flex; align-items:center; gap:6px; padding:6px 12px 6px 8px; border-radius:999px; border:1.5px dashed var(--line); background:var(--surface); color:var(--muted); font:inherit; box-shadow:var(--shadow); }
.rt-chest span { font-size:1.4rem; filter:grayscale(.8); }
.rt-chest small { font-size:.74rem; font-weight:600; }
.rt-chest.ready { border:2px solid var(--gold, var(--accent)); color:var(--ink); animation:rt-glow 1.8s ease-in-out infinite; }
.rt-chest.ready span, .rt-chest.got span { filter:none; }
.rt-chest.got { border-style:solid; opacity:.75; }
.rt-chest:disabled { cursor:default; }
@keyframes rt-float { 0%, 100% { transform:translateY(0); } 50% { transform:translateY(-4px); } }
@keyframes rt-glow { 0%, 100% { box-shadow:0 0 0 0 color-mix(in srgb, var(--gold, var(--accent)) 50%, transparent); } 50% { box-shadow:0 0 0 7px color-mix(in srgb, var(--gold, var(--accent)) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) { html .rt-map.rt-map .rt-isl.cur .rt-dot, .rt-chest.ready { animation:none; } }
html[data-frame="sketch"] .rt-map.rt-map .rt-isl .rt-dot { border-radius:52% 48% 50% 46% / 46% 52% 48% 54%; }

/* 6.39 bớt trang trí (theo nguyên tắc "khoảng trắng thay khung, chỉ nhấn vào việc chính"):
   hoa văn góc + viền kép chỉ còn ở ô chính "Hôm nay cần học", mặt thẻ học, hộp thoại; ô khác viền mảnh một nét */
html[data-skin="xian"][data-frame="scroll"] :is(.panel, .setl, .lcard, .deck):not(.today) { background-image:none; box-shadow:var(--shadow); }
html[data-skin="xian"][data-frame="scroll"] :is(.p-tile, .drow, .crow, .wp, .act, .t-mode, .font-tile, .kho-row, .dc-row) { box-shadow:0 1px 2px rgba(0,0,0,.05); }
html[data-skin="xian"][data-frame="scroll"] .p-tile.mini { border-color:var(--fr-g2, var(--line)); }
/* chữ tiêu đề mục nằm trên tranh nền (hạc / mây) → viền sáng quanh chữ cho khỏi bị nét tranh cắt ngang */
html[data-skin="xian"] .sec-h { position:relative; z-index:1; }
html[data-skin="xian"] .sec-h > * { text-shadow:0 0 3px var(--bg), 0 0 6px var(--bg), 0 0 10px var(--bg); }
/* tab Luyện: Trò chơi + Nghe & Đọc = 2 ô nhỏ cạnh nhau */
.p-duo { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:6px; }
.duo-t { display:grid; grid-template-columns:auto minmax(0,1fr); grid-template-rows:auto auto; column-gap:10px; align-items:center; padding:10px 12px; border-radius:16px; background:var(--surface); color:var(--ink); text-align:left; border:1px solid var(--line); box-shadow:0 1px 2px rgba(0,0,0,.05); min-width:0; margin:0 !important; }
.duo-t .pi { grid-row:1 / 3; width:40px; height:40px; }
.duo-t b { font-size:.95rem; align-self:end; }
.duo-t > span:last-child { font-size:.76rem; color:var(--muted); line-height:1.3; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; align-self:start; }
.p-tile.mini .pi.s { background:color-mix(in srgb, var(--accent) 14%, transparent); color:var(--accent); }
html[data-skin="xian"][data-frame="scroll"] .duo-t { border-color:var(--fr-g); border-radius:8px; }

/* ================= 6.43: 3 GIAO DIỆN — đổi toàn bộ app (core.js KJ.lookOf → html[data-look]) =================
   Cổ phong (cophong) = nền Tiên cảnh + khung tranh cuộn, tông giấy dó / mực / son: ô Hôm nay là cuộn tranh có trục gỗ + dấu 印,
     thanh tiến độ là nét bút lông, thẻ học như tờ giấy xé tay, 4 nút chấm màu đặc.
   Trắng tuyết (tuyet) = nền phẳng, trắng / đen, viền mảnh, chữ đậm, nút đen. Không có màu chủ đạo.
   Phác họa (phac) = giấy vở kẻ ô, khung vẽ tay mực bút bi xanh (data-sketch), chữ viết tay Patrick Hand, tô dạ quang.
   Bộ chọn cấp cao (3 thuộc tính) để thắng nền theo giờ trong ngày (data-tod) và màu chủ đạo của Tiên cảnh. */
@font-face { font-family:"KJ Serif"; src:url(fonts/noto-serif-700-latin.woff2) format("woff2"); font-weight:700; font-display:swap; 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:"KJ Serif"; src:url(fonts/noto-serif-700-vi.woff2) format("woff2"); font-weight:700; font-display:swap; unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family:"KJ Hand"; src:url(fonts/patrick-hand-latin.woff2) format("woff2"); font-display:swap; 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:"KJ Hand"; src:url(fonts/patrick-hand-vi.woff2) format("woff2"); font-display:swap; unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }

/* ---- bộ chọn giao diện trong Cài đặt: 3 ô có hình thu nhỏ ---- */
.look-pick { width:100%; display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:10px; margin-top:10px; }
.look-t { display:flex; flex-direction:column; align-items:stretch; gap:6px; padding:6px 6px 8px; border-radius:14px; border:1.5px solid var(--line); background:var(--surface); text-align:center; font-size:.86rem; }
.look-t.on { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-soft, transparent); }
.look-t.on b::before { content:"✓ "; color:var(--accent); }
.look-mini { position:relative; display:flex; flex-direction:column; justify-content:center; gap:5px; height:62px; padding:0 12px; border-radius:9px; overflow:hidden; }
.look-mini i { display:block; height:5px; border-radius:3px; }
.look-mini i:nth-child(1) { width:60%; } .look-mini i:nth-child(2) { width:85%; } .look-mini i:nth-child(3) { width:40%; height:11px; border-radius:6px; }
.lm-cophong { background:linear-gradient(170deg, transparent 58%, #8f8b82 59%, #cfc8b8 70%, transparent 71%), linear-gradient(190deg, transparent 62%, #59544c 63%, #a49e92 76%, transparent 77%), #efe8d8; }
.lm-cophong i { background:#2a2219; } .lm-cophong i:nth-child(3) { background:#1f2b4a; }
.lm-cophong::after { content:"印"; position:absolute; right:7px; top:7px; width:18px; height:18px; border:1.5px solid #b8312f; border-radius:3px; color:#b8312f; font:700 11px/16px var(--font-jp); text-align:center; transform:rotate(-6deg); }
.lm-tuyet { background:#fff; box-shadow:inset 0 0 0 1px #e6e6e4; } .lm-tuyet i { background:#d9d9d6; } .lm-tuyet i:nth-child(3) { background:#151515; }
.lm-phac { background:#fcfbf7 linear-gradient(#d6e1ef 1px, transparent 1px) 0 0 / 9px 9px, #fcfbf7; background-image:linear-gradient(#d6e1ef 1px, transparent 1px), linear-gradient(90deg, #d6e1ef 1px, transparent 1px); background-size:9px 9px; }
.lm-phac i { background:#3d4f7a; height:3px; } .lm-phac i:nth-child(3) { background:#c2410c; height:11px; border:1.5px solid #7c2d12; }
.t-seal { display:none; }

/* ========== CỔ PHONG ========== */
html[data-look="cophong"][data-skin][data-frame] {
  --bg:#EFE9DC; --surface:rgba(248,243,231,.94); --solid:#F8F3E7; --surface2:#E9DFCB; --ink:#1F1D1A; --muted:#5E564A; --line:#D9CCB2;
  --gold:#A47A3A; --seal:#B8312F; --fr-g:#C6AB7F; --fr-g2:color-mix(in srgb, #C6AB7F 55%, transparent);
  --good:#4E8C76; --good-soft:#DCEBE3; --hard:#A77A28; --hard-soft:#F2E6CC; --again:#B4513F; --again-soft:#F3DED8; --easy:#2F4A78; --easy-soft:#DDE3EE;
  --sky1:#E6DFCD; --sky2:#EDE7D9; --sky3:#F2ECDF; --moon:#F3E3C6; --stars:0; --m3:#CCC5B6; --m2:#A39C8F; --m1:#5F5951; --mist:#FFFFFF; --crane:#2A2725;
  --veil-a:rgba(239,233,220,0); --veil-b:rgba(239,233,220,.32);
  --font-title:"KJ Serif","Noto Serif","KJ NotoSC",serif;
  --paper:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .4 0 0 0 0 .33 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --scroll-a:#E6D8BB; --scroll-b:#F6EEDC; --rod-a:#A07A4A; --rod-b:#4A321A; --card-c:#F7F0DE;
}
html[data-look="cophong"][data-accent="indigo"][data-skin][data-frame] { --acc-l:#1F2B4A; --accs-l:#E1DFE3; --acc-d:#D9C08A; --accs-d:#3A3224; --pit-l:#B8312F; --pit-d:#F08A6E; }
html[data-look="cophong"][data-skin][data-frame][data-theme="dark"] {
  --bg:#14110E; --surface:rgba(30,26,22,.92); --solid:#1E1A16; --surface2:#2A251F; --ink:#EDE5D5; --muted:#A99F8D; --line:#3A3329;
  --gold:#D6B26A; --seal:#E0533F; --fr-g:#6F5B3A; --fr-g2:color-mix(in srgb, #6F5B3A 60%, transparent);
  --good:#7FC6A8; --good-soft:#1C3229; --hard:#E2B866; --hard-soft:#3A2F17; --again:#EE8A78; --again-soft:#43221C; --easy:#93ACDB; --easy-soft:#1E2840;
  --sky1:#0F0D0B; --sky2:#191511; --sky3:#231D17; --moon:#EFE0C2; --stars:.45; --m3:#2E2923; --m2:#221E19; --m1:#15120F; --mist:#8C8170; --crane:#E5DCC9;
  --veil-a:rgba(20,17,14,0); --veil-b:rgba(20,17,14,.35);
  --scroll-a:#2B241B; --scroll-b:#3A3125; --rod-a:#7A5A33; --rod-b:#2E1F10; --card-c:#2A241C;
}
html[data-look="cophong"] #scenery::after { background:var(--paper), linear-gradient(to bottom, var(--veil-a), var(--veil-b)); }
/* ô Hôm nay = cuộn tranh: giấy ngả vàng, hai trục gỗ, dấu son */
html[data-look="cophong"] .panel.today.today { position:relative; margin:22px 6px; border:0; border-radius:2px; padding:20px 18px;
  background:var(--paper), linear-gradient(90deg, var(--scroll-a), var(--scroll-b) 18%, var(--scroll-b) 82%, var(--scroll-a)); box-shadow:0 12px 24px -18px rgba(60,40,20,.7); }
html[data-look="cophong"] .panel.today::before, html[data-look="cophong"] .panel.today::after { content:""; position:absolute; left:-12px; right:-12px; height:14px; border-radius:7px;
  background:linear-gradient(var(--rod-a), color-mix(in srgb, var(--rod-a) 50%, var(--rod-b)) 55%, var(--rod-b)); box-shadow:0 3px 6px rgba(0,0,0,.28); }
html[data-look="cophong"] .panel.today::before { top:-10px; } html[data-look="cophong"] .panel.today::after { bottom:-10px; }
html[data-look="cophong"] .t-seal { display:grid; place-items:center; position:absolute; right:18px; top:46px; width:58px; height:58px; border:3px solid var(--seal); border-radius:8px;
  color:var(--seal); font:800 2.1rem/1 var(--font-jp); transform:rotate(-5deg); opacity:.88; pointer-events:none; }
html[data-look="cophong"] .t-big b { font-family:var(--font-title); font-style:italic; }
html[data-look="cophong"] .panel.today .btn { border-radius:999px; }
.t-go2 .btn { white-space:nowrap; }
html[data-look="cophong"] .btn.primary { background:var(--accent); box-shadow:0 8px 16px -10px var(--accent); }
html[data-look="cophong"][data-theme="dark"] .btn.primary { color:#1E1A16; }
/* thanh tiến độ = một nét bút lông */
html[data-look="cophong"] .bar { height:10px; border-radius:0; background:linear-gradient(transparent 45%, color-mix(in srgb, var(--ink) 18%, transparent) 45%, color-mix(in srgb, var(--ink) 18%, transparent) 60%, transparent 60%); }
html[data-look="cophong"] .bar > i { height:100%; border-radius:0; background:var(--ink);
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M1 11C20 4 70 3 130 6C165 7 190 8 199 10C192 15 150 17 100 15C60 15 25 18 1 13Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
          mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M1 11C20 4 70 3 130 6C165 7 190 8 199 10C192 15 150 17 100 15C60 15 25 18 1 13Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat; }
/* thẻ học = tờ giấy xé tay */
html[data-look="cophong"] .face.face:not(.wr-face) { border:0; border-radius:0; box-shadow:none; background:var(--paper), radial-gradient(ellipse at center, var(--card-c) 62%, var(--scroll-a)); background-color:var(--card-c);
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 140' preserveAspectRatio='none'%3E%3Cpath d='M2.0 2.0L4.5 3.7L7.0 2.5L9.5 2.4L12.0 3.3L14.5 3.0L17.0 2.6L19.5 3.4L22.0 3.4L24.5 3.0L27.0 3.2L29.5 3.1L32.0 3.5L34.5 2.4L37.0 2.7L39.5 3.3L42.0 3.3L44.5 2.1L47.0 3.2L49.5 2.8L52.0 3.7L54.5 3.5L57.0 2.2L59.5 2.9L62.0 3.7L64.5 3.2L67.0 3.2L69.5 3.0L72.0 3.6L74.5 3.6L77.0 2.7L79.5 2.6L82.0 3.5L84.5 2.6L87.0 2.3L89.5 2.5L92.0 2.8L94.5 2.5L97.0 3.7L97.1 4.0L96.8 7.0L96.6 10.0L97.9 13.0L97.6 16.0L97.1 19.0L97.2 22.0L97.3 25.0L97.7 28.0L96.5 31.0L97.9 34.0L97.4 37.0L97.4 40.0L96.9 43.0L96.5 46.0L97.2 49.0L97.7 52.0L97.4 55.0L97.5 58.0L97.4 61.0L97.3 64.0L97.5 67.0L97.1 70.0L97.0 73.0L97.6 76.0L96.5 79.0L97.3 82.0L96.6 85.0L97.0 88.0L97.0 91.0L97.2 94.0L97.2 97.0L96.9 100.0L96.5 103.0L97.4 106.0L96.9 109.0L97.6 112.0L97.1 115.0L97.4 118.0L97.5 121.0L97.4 124.0L96.7 127.0L96.6 130.0L97.8 133.0L96.7 136.0L97.0 137.9L94.5 137.3L92.0 137.7L89.5 137.9L87.0 136.2L84.5 137.6L82.0 136.9L79.5 137.7L77.0 137.2L74.5 136.9L72.0 137.8L69.5 136.3L67.0 136.4L64.5 136.4L62.0 136.4L59.5 136.4L57.0 136.6L54.5 137.5L52.0 138.0L49.5 137.6L47.0 137.9L44.5 138.0L42.0 136.9L39.5 137.6L37.0 136.7L34.5 137.1L32.0 136.8L29.5 137.6L27.0 136.4L24.5 137.6L22.0 137.3L19.5 136.4L17.0 137.8L14.5 137.1L12.0 138.0L9.5 136.4L7.0 136.9L4.5 136.3L2.0 138.0L3.4 136.0L2.3 133.0L3.5 130.0L2.9 127.0L3.1 124.0L2.4 121.0L2.4 118.0L2.3 115.0L2.9 112.0L2.1 109.0L3.2 106.0L3.1 103.0L3.1 100.0L2.8 97.0L2.1 94.0L2.2 91.0L3.5 88.0L2.2 85.0L3.1 82.0L3.4 79.0L2.1 76.0L3.4 73.0L3.4 70.0L3.6 67.0L3.5 64.0L3.2 61.0L2.7 58.0L2.4 55.0L3.2 52.0L3.4 49.0L2.6 46.0L2.4 43.0L2.6 40.0L3.4 37.0L2.9 34.0L2.6 31.0L3.0 28.0L3.2 25.0L2.5 22.0L3.2 19.0L2.7 16.0L2.3 13.0L2.5 10.0L3.6 7.0L3.6 4.0Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
          mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 140' preserveAspectRatio='none'%3E%3Cpath d='M2.0 2.0L4.5 3.7L7.0 2.5L9.5 2.4L12.0 3.3L14.5 3.0L17.0 2.6L19.5 3.4L22.0 3.4L24.5 3.0L27.0 3.2L29.5 3.1L32.0 3.5L34.5 2.4L37.0 2.7L39.5 3.3L42.0 3.3L44.5 2.1L47.0 3.2L49.5 2.8L52.0 3.7L54.5 3.5L57.0 2.2L59.5 2.9L62.0 3.7L64.5 3.2L67.0 3.2L69.5 3.0L72.0 3.6L74.5 3.6L77.0 2.7L79.5 2.6L82.0 3.5L84.5 2.6L87.0 2.3L89.5 2.5L92.0 2.8L94.5 2.5L97.0 3.7L97.1 4.0L96.8 7.0L96.6 10.0L97.9 13.0L97.6 16.0L97.1 19.0L97.2 22.0L97.3 25.0L97.7 28.0L96.5 31.0L97.9 34.0L97.4 37.0L97.4 40.0L96.9 43.0L96.5 46.0L97.2 49.0L97.7 52.0L97.4 55.0L97.5 58.0L97.4 61.0L97.3 64.0L97.5 67.0L97.1 70.0L97.0 73.0L97.6 76.0L96.5 79.0L97.3 82.0L96.6 85.0L97.0 88.0L97.0 91.0L97.2 94.0L97.2 97.0L96.9 100.0L96.5 103.0L97.4 106.0L96.9 109.0L97.6 112.0L97.1 115.0L97.4 118.0L97.5 121.0L97.4 124.0L96.7 127.0L96.6 130.0L97.8 133.0L96.7 136.0L97.0 137.9L94.5 137.3L92.0 137.7L89.5 137.9L87.0 136.2L84.5 137.6L82.0 136.9L79.5 137.7L77.0 137.2L74.5 136.9L72.0 137.8L69.5 136.3L67.0 136.4L64.5 136.4L62.0 136.4L59.5 136.4L57.0 136.6L54.5 137.5L52.0 138.0L49.5 137.6L47.0 137.9L44.5 138.0L42.0 136.9L39.5 137.6L37.0 136.7L34.5 137.1L32.0 136.8L29.5 137.6L27.0 136.4L24.5 137.6L22.0 137.3L19.5 136.4L17.0 137.8L14.5 137.1L12.0 138.0L9.5 136.4L7.0 136.9L4.5 136.3L2.0 138.0L3.4 136.0L2.3 133.0L3.5 130.0L2.9 127.0L3.1 124.0L2.4 121.0L2.4 118.0L2.3 115.0L2.9 112.0L2.1 109.0L3.2 106.0L3.1 103.0L3.1 100.0L2.8 97.0L2.1 94.0L2.2 91.0L3.5 88.0L2.2 85.0L3.1 82.0L3.4 79.0L2.1 76.0L3.4 73.0L3.4 70.0L3.6 67.0L3.5 64.0L3.2 61.0L2.7 58.0L2.4 55.0L3.2 52.0L3.4 49.0L2.6 46.0L2.4 43.0L2.6 40.0L3.4 37.0L2.9 34.0L2.6 31.0L3.0 28.0L3.2 25.0L2.5 22.0L3.2 19.0L2.7 16.0L2.3 13.0L2.5 10.0L3.6 7.0L3.6 4.0Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat; }
/* 4 nút chấm màu đặc */
html[data-look="cophong"] .rate button { color:#fff; box-shadow:inset 0 -3px 0 rgba(0,0,0,.16), 0 4px 10px -4px rgba(0,0,0,.25); }
html[data-look="cophong"] .rate .r1 { background:#C0584A; } html[data-look="cophong"] .rate .r2 { background:#C1923F; }
html[data-look="cophong"] .rate .r3 { background:#5F9C86; } html[data-look="cophong"] .rate .r4 { background:#2F4A78; }
html[data-look="cophong"][data-theme="dark"] .rate .r1 { background:#9C4537; } html[data-look="cophong"][data-theme="dark"] .rate .r2 { background:#9A7330; }
html[data-look="cophong"][data-theme="dark"] .rate .r3 { background:#3F7A65; } html[data-look="cophong"][data-theme="dark"] .rate .r4 { background:#34507F; }
html[data-look="cophong"] .tabbar { background:color-mix(in srgb, var(--solid) 94%, transparent); }

/* ========== TRẮNG TUYẾT ========== */
html[data-look="tuyet"] {
  --bg:#F6F6F4; --surface:#FFFFFF; --solid:#FFFFFF; --surface2:#F2F2F0; --ink:#151515; --muted:#6B7280; --line:#E8E8E6;
  --accent:#151515; --accent-soft:#EFEFED; --accent-ink:#FFFFFF; --seal:#C0392B; --gold:#151515; --pitch:#D8643A;
  --good:#1F7A55; --good-soft:#E3F3EC; --hard:#8A5A0B; --hard-soft:#FDF1DC; --again:#B42318; --again-soft:#FDE8E6; --easy:#3730A3; --easy-soft:#E8E8FB;
  --shadow:0 1px 2px rgba(0,0,0,.04), 0 8px 24px -18px rgba(0,0,0,.28);
}
html[data-look="tuyet"][data-theme="dark"] {
  --bg:#0E0E10; --surface:#18181B; --solid:#18181B; --surface2:#222226; --ink:#F4F4F5; --muted:#A1A1AA; --line:#2A2A2E;
  --accent:#F4F4F5; --accent-soft:#26262A; --accent-ink:#111113; --seal:#F0645A; --gold:#F4F4F5; --pitch:#FF9E6E;
  --good:#5BD49A; --good-soft:#132B21; --hard:#F2C46A; --hard-soft:#33270F; --again:#FF7B70; --again-soft:#3A1715; --easy:#A5A3FF; --easy-soft:#22224A;
  --shadow:0 1px 2px rgba(0,0,0,.5), 0 8px 24px -18px rgba(0,0,0,.8);
}
html[data-look="tuyet"]:not([data-ufont]) { --font-ui:"KJ BVP",system-ui,"Roboto","Noto Sans SC",sans-serif; --font-title:"KJ BVP",system-ui,sans-serif; }
html[data-look="tuyet"] :is(.panel, .deck, .setl, .lcard, .face, .dlg) { border:1px solid var(--line); box-shadow:var(--shadow); }
html[data-look="tuyet"] :is(.panel, .deck, .setl, .lcard) { border-radius:20px; }
html[data-look="tuyet"] .face { border-radius:24px; }
html[data-look="tuyet"] :is(.hdr h1, .h6-title, .t-big b) { font-weight:800; letter-spacing:-.02em; }
html[data-look="tuyet"] .t-big b { font-size:3rem; }
html[data-look="tuyet"] .btn.primary { background:var(--accent); color:var(--accent-ink); box-shadow:none; }
html[data-look="tuyet"] .btn:not(.primary) { background:var(--surface2); box-shadow:none; }
html[data-look="tuyet"] .bar > i { background:var(--ink); }
html[data-look="tuyet"] .rate .r4 { background:var(--ink); color:var(--bg); }
html[data-look="tuyet"] .section-t { text-transform:uppercase; font-size:.74rem; letter-spacing:.07em; font-weight:700; color:var(--muted); }
html[data-look="tuyet"] .tabbar { background:var(--surface); border-top:1px solid var(--line); box-shadow:none; }
html[data-look="tuyet"] .tab.on { color:var(--ink); }

/* ========== PHÁC HỌA ========== */
html[data-look="phac"][data-skin][data-frame] {
  --bg:#FCFBF7; --surface:#FFFFFF; --solid:#FFFFFF; --surface2:#F1F4FA; --ink:#2B3A55; --muted:#56637F; --line:#D6E1EF; --grid:#DCE5F1;
  --gold:#C2410C; --seal:#C2410C; --hl:#FFE58F;
  --good:#1F6B4F; --good-soft:#DCF1E7; --hard:#8A5A0B; --hard-soft:#FDF0D2; --again:#B42318; --again-soft:#FDE4E1; --easy:#2B3A55; --easy-soft:#E1E8F5;
  --shadow:none; --font-title:"KJ BVP",system-ui,sans-serif; --edge:color-mix(in srgb, var(--ink) 62%, transparent);
}
html[data-look="phac"][data-accent="indigo"][data-skin][data-frame] { --acc-l:#C2410C; --accs-l:#FDE9DB; --acc-d:#F08A4B; --accs-d:#3B2416; --pit-l:#2F6FB0; --pit-d:#8DB9F2; }
html[data-look="phac"][data-skin][data-frame][data-theme="dark"] {
  --bg:#141A26; --surface:#1B2232; --solid:#1B2232; --surface2:#232C40; --ink:#E6ECF8; --muted:#9AA8C4; --line:#2C3750; --grid:#1F2A40;
  --gold:#F08A4B; --seal:#F08A4B; --hl:rgba(255,229,143,.28);
  --good:#6FD39A; --good-soft:#173A29; --hard:#F0B84E; --hard-soft:#3F3112; --again:#FF7B78; --again-soft:#4A1E20; --easy:#A9C1F0; --easy-soft:#22304D;
}
html[data-look="phac"]:not([data-kfont]) { --font-jp:"KJ NotoSC","Noto Sans SC",sans-serif; }   /* 6.51 mặc định Yomogi */
html[data-look="phac"]:not([data-ufont]) { --font-ui:"KJ BVP",system-ui,"Roboto","Noto Sans SC",sans-serif; }
html[data-look="phac"] #scenery { display:none; }
html[data-look="phac"], html[data-look="phac"] body { background-color:var(--bg); background-image:linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size:24px 24px; }
html[data-look="phac"] :is(.hdr h1, .h6-title, .t-big b, .section-t, .panel h2) { font-family:var(--font-title); font-weight:700; letter-spacing:-.01em; }
html[data-look="phac"] :is(.hdr h1, .h6-title) { font-size:1.45rem; }
html[data-look="phac"] .t-big b { font-size:2.8rem; background:linear-gradient(transparent 62%, var(--hl) 62%); padding:0 2px; }
html[data-look="phac"] .section-t { font-size:.98rem; color:var(--ink); }
html[data-look="phac"] .section-t::before { display:none; }
html[data-look="phac"] .bar > i { background:var(--accent); }
html[data-look="phac"] .rate button { border:1.25px solid currentColor; border-radius:14px; font-weight:700; }
html[data-look="phac"] .rate .r4 { background:var(--ink); color:var(--bg); border-color:var(--ink); }
html[data-look="phac"] .tabbar { background-color:var(--bg); }

/* 6.45 Lộ trình khung 11 phần: nhóm từ, lưu ý, bảng mẫu câu, nghe, tự đặt câu, mở rộng */
.rt-gh { margin:14px 0 6px; font-size:1rem; display:flex; align-items:baseline; gap:8px; }
.rt-note { margin:6px 0 0; padding:6px 10px; border-left:3px solid var(--accent); background:color-mix(in srgb, var(--accent) 8%, transparent); border-radius:0 8px 8px 0; }
.rt-after { margin-top:10px; }
.rt-lscript { display:grid; gap:4px; margin-bottom:6px; }
.rt-lscript .jp { font-size:1.05rem; }
.rt-pt { margin-top:10px; }
.rt-pat { font-size:1.1rem; font-weight:700; color:var(--accent); margin:2px 0 4px; }
.rt-wr { margin-top:10px; display:grid; gap:6px; }
.rt-wr textarea { width:100%; font-size:1.05rem; }
.rt-aires { padding:8px 10px; border-radius:10px; background:color-mix(in srgb, var(--accent) 8%, transparent); }
.rt-xt { padding:6px; overflow-x:auto; }
.rt-xr { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:4px; border-top:1px dashed var(--line); padding:4px 0; }
.rt-xr:first-child { border-top:0; }
.rt-xh b { font-size:.8rem; color:var(--muted); padding:0 6px; }
.rt-xc { background:none; border:0; color:inherit; text-align:left; padding:4px 6px; border-radius:8px; cursor:pointer; font:inherit; }
.rt-xc:active { background:color-mix(in srgb, var(--accent) 12%, transparent); }
.rt-xc small { display:block; font-size:.75rem; color:var(--muted); }

/* 6.45 chọn nhiều thẻ trong bộ */
.crow .cbx { width:24px; height:24px; flex:none; border:2px solid var(--line); border-radius:7px; display:grid; place-items:center; font-weight:800; color:#fff; }
.crow.on .cbx { background:var(--accent); border-color:var(--accent); }
.crow.on { outline:2px solid var(--accent); }
.crow.susp { opacity:.6; }
.dsel-bar { position:sticky; bottom:calc(8px + env(safe-area-inset-bottom)); z-index:3; display:grid; gap:8px; padding:10px 12px; margin-top:8px; background:var(--surface); border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow); }
.dsel-bar .btnrow .btn { flex:1; }

/* 6.45 bỏ từ đã biết ở bước từ vựng Lộ trình */
.rt-word.rt-known { opacity:.5; }
.rt-word.rt-known b { text-decoration:line-through; }
.rt-kbar { padding:8px 4px 0; }

/* 6.46 chọn giọng: bấm tên = chọn, ▶ = nghe thử */
.tv-row { display:flex; align-items:center; gap:6px; }
.tv-row .tv-pick { background:none; border:0; color:inherit; text-align:left; font:inherit; padding:0; cursor:pointer; }

/* 6.47 Thư viện theo bài (js/libx.js) */
.lx-tiles { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:10px; margin:0 0 12px; }
.lx-tile { display:flex; flex-direction:column; align-items:center; gap:4px; padding:16px 6px 12px; border-radius:18px; background:var(--surface); box-shadow:var(--shadow); border:1px solid var(--line); color:inherit; font:inherit; cursor:pointer; text-align:center; }
.lx-tile .lx-ti { font-size:1.7rem; line-height:1; font-family:var(--font-jp); }
.lx-tile b { font-size:1rem; }
.lx-tile small { font-size:.72rem; color:var(--muted); }
.lx-sub { margin:-6px 4px 10px; }
.lx-row .bar { margin-top:5px; }
.lx-gh { font-weight:700; font-size:.88rem; margin:14px 4px 6px; color:var(--muted); }
.lx-act .btn { flex:1; }
.lx-w { display:flex; gap:10px; align-items:flex-start; padding:10px 12px; border-top:1px dashed var(--line); cursor:pointer; }
.lx-w:first-child { border-top:0; }
.lx-w .jp { font-size:1.15rem; }
.lx-w .lx-rd { font-size:.95rem; }
.lx-img { width:72px; height:72px; object-fit:contain; border-radius:12px; background:#fff; flex:none; border:1px solid var(--line); }
.lx-hv { font-size:.72rem; font-weight:700; letter-spacing:.03em; color:var(--accent); white-space:nowrap; }
.lx-dot { color:var(--good); font-size:.6rem; vertical-align:middle; }
.lx-ex { display:flex; align-items:center; gap:6px; margin-top:6px; padding:6px 8px; border-radius:10px; background:color-mix(in srgb, var(--accent) 7%, transparent); }
.lx-ex .jp { font-size:1rem; display:block; }
.lx-ex small { display:block; font-size:.78rem; }
.lx-gp { margin-top:12px; }
.lx-gpt { margin:2px 0 4px; font-size:1.2rem; color:var(--accent); }
.lx-chk { margin-top:10px; padding:10px; border-radius:12px; border:1px dashed var(--line); }
.lx-q { font-size:1.12rem; margin:6px 0; }
.lx-opts { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:6px; }
.lx-opts .chip.good, .lx-qo.good { background:color-mix(in srgb, var(--good) 22%, transparent); border-color:var(--good); }
.lx-opts .chip.bad, .lx-qo.bad { background:color-mix(in srgb, var(--again) 20%, transparent); border-color:var(--again); }
.lx-review { margin-top:14px; width:100%; }
.lx-qopts { display:grid; gap:8px; margin-top:10px; }
.lx-qo { justify-content:flex-start; text-align:left; }
.lx-kg { display:grid; grid-template-columns:repeat(auto-fill, minmax(64px, 1fr)); gap:8px; }
.lx-kc { display:flex; flex-direction:column; align-items:center; padding:8px 2px 6px; border-radius:14px; background:var(--surface); border:1px solid var(--line); color:inherit; font:inherit; cursor:pointer; }
.lx-kc .jp { font-size:1.7rem; line-height:1.15; }
.lx-kc small { font-size:.62rem; color:var(--muted); white-space:nowrap; overflow:hidden; max-width:100%; }
.lx-kc.on { border-color:var(--accent); }
.lx-kc.ok { background:color-mix(in srgb, var(--good) 14%, var(--surface)); border-color:var(--good); }
.lx-kh { display:flex; gap:14px; align-items:center; }
.lx-kbox { width:132px; height:132px; flex:none; display:grid; place-items:center; border-radius:16px; background:var(--surface2, var(--surface)); border:1px solid var(--line); color:var(--ink); }
.lx-kbox svg { width:100%; height:100%; }
.lx-kbig { font-size:5rem; }
.lx-khv { font-size:1.3rem; font-weight:800; letter-spacing:.04em; color:var(--accent); }
.lx-sp { stroke-dasharray:1; stroke-dashoffset:1; animation:lxdraw .6s linear forwards; }
@keyframes lxdraw { to { stroke-dashoffset:0; } }
.lx-kact { margin:10px 0 4px; display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.lx-kact .btn { white-space:nowrap; }
.lx-order { display:flex; gap:6px; overflow-x:auto; padding-bottom:4px; }
.lx-oc { flex:none; width:58px; text-align:center; color:var(--ink); }
.lx-oc svg { width:58px; height:58px; border-radius:10px; border:1px solid var(--line); background:var(--surface); }
.lx-oc small { font-size:.7rem; color:var(--muted); }
.lx-kw { display:flex; gap:8px; align-items:flex-start; width:100%; padding:9px 12px; border:0; border-top:1px dashed var(--line); background:none; color:inherit; font:inherit; text-align:left; cursor:pointer; }
.lx-kw:first-child { border-top:0; }
.lx-kwf { font-size:1.1rem; }
.lx-hl { color:var(--accent); font-weight:700; }
.lx-tap { color:var(--muted); flex:none; margin-top:3px; }
.lx-link { margin-top:4px; }

/* 6.47b bố cục Thư viện: thẻ lớn theo cấp, flashcard bài, mẫu ngữ pháp */
.lx-cards { display:grid; gap:12px; margin:0 0 14px; }
.lx-card { display:block; width:100%; padding:0; overflow:hidden; border-radius:20px; border:1.5px solid var(--line); background:var(--surface); box-shadow:var(--shadow); color:inherit; font:inherit; text-align:center; cursor:pointer; }
.lx-ct { display:flex; flex-direction:column; align-items:center; padding:14px 10px 10px; }
.lx-ct small { font-size:.85rem; color:var(--muted); }
.lx-ct b { font-family:var(--font-jp); font-size:2.6rem; line-height:1.2; }
.lx-cb { display:flex; flex-direction:column; padding:10px; color:#fff; }
.lx-cb b { font-size:1.05rem; }
.lx-cb small { font-size:.78rem; opacity:.9; }
.lx-c-words .lx-cb { background:#2f8f5b; }
.lx-c-gram .lx-cb { background:#2d63b8; }
.lx-c-kanji .lx-cb { background:#b8742d; }
.lx-prog { margin-bottom:12px; }
.lx-prog .bar { margin-top:8px; }
.lx-pa { color:var(--accent); }
.lx-lr { display:flex; align-items:center; gap:12px; width:100%; padding:14px 14px; margin-bottom:10px; border-radius:16px; border:1.5px solid var(--line); background:var(--surface); box-shadow:var(--shadow); color:inherit; font:inherit; text-align:left; cursor:pointer; }
.lx-lr .grow { display:flex; flex-direction:column; gap:2px; min-width:0; }
.lx-li { width:34px; text-align:center; color:var(--accent); flex:none; font-weight:800; }
.lx-lt { font-size:.85rem; color:var(--muted); }
.lx-ln { font-size:.85rem; font-weight:700; color:var(--accent); white-space:nowrap; }
.lx-leg { margin-bottom:12px; }
.lx-legg { display:grid; grid-template-columns:1fr 1fr; gap:8px 10px; margin:10px 0; font-size:.85rem; }
.lx-legg span { display:flex; align-items:center; gap:6px; }
.lx-tok { display:inline-block; min-width:26px; padding:1px 6px; border-radius:7px; font-style:normal; font-weight:800; font-size:.85em; text-align:center; border:1.5px solid; font-family:var(--font-ui); }
.lx-tok.t-N { color:#2d63b8; border-color:#2d63b8; background:color-mix(in srgb, #2d63b8 10%, transparent); }
.lx-tok.t-V { color:#2f8f5b; border-color:#2f8f5b; background:color-mix(in srgb, #2f8f5b 10%, transparent); }
.lx-tok.t-A { color:#c0612b; border-color:#c0612b; background:color-mix(in srgb, #c0612b 10%, transparent); }
.lx-tok.t-S { color:#8a4fc0; border-color:#8a4fc0; background:color-mix(in srgb, #8a4fc0 10%, transparent); }
.lx-tok.t-T { color:#1f8a7a; border-color:#1f8a7a; background:color-mix(in srgb, #1f8a7a 10%, transparent); }
.lx-conj { margin-top:4px; border-radius:12px; }
.lx-bnav { margin:0 0 10px; gap:8px; }
.lx-wh { margin:16px 4px 8px; }
.lx-addall { width:100%; margin-bottom:10px; }
.lx-wl { display:flex; flex-direction:column; align-items:center; gap:3px; width:78px; flex:none; padding-right:8px; border-right:1px solid var(--line); }
.lx-wl small { color:var(--muted); font-size:.72rem; }
.lx-wl b { font-size:1.35rem; text-align:center; word-break:keep-all; }
.lx-wl .poschip { font-size:.66rem; }
.lx-wr { min-width:0; }
.lx-wa { display:flex; flex-direction:column; align-items:center; gap:2px; }
.lx-wa .ibtn { width:34px; height:34px; font-size:1.1rem; }
.lx-wa .ibtn.on { color:var(--hard, #d9a400); }
.lx-wex { margin-top:4px; }
.lx-fcbar { display:flex; align-items:center; gap:4px; margin:0 0 8px; }
.lx-fcbar .seg { flex:none; margin:0 6px 0 0; }
.lx-fcbar .ibtn { width:36px; height:36px; font-size:1.05rem; }
.lx-fcbar .ibtn.on { color:var(--accent); background:color-mix(in srgb, var(--accent) 12%, transparent); }
.lx-fc { position:relative; min-height:300px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; padding:22px 44px 26px; border-radius:20px; border:1.5px solid var(--line); background:var(--card-c, var(--surface)); box-shadow:var(--shadow); text-align:center; cursor:pointer; }
.lx-fc.kn { border-color:var(--good); }
.lx-fc.un { border-color:var(--again); }
.lx-fcin { display:flex; flex-direction:column; align-items:center; gap:6px; }
.lx-fcimg { width:170px; height:170px; object-fit:contain; border-radius:14px; background:#fff; }
.lx-fcimg.sm { width:96px; height:96px; }
.lx-fcw { font-size:2.6rem; font-weight:700; }
.lx-fcw.sm { font-size:1.9rem; }
.lx-fcm { font-size:1.35rem; font-weight:700; }
.lx-fcm.sm { font-size:1.05rem; }
.lx-fcex { font-size:1.35rem; line-height:2; }
.lx-fcstar { position:absolute; top:8px; right:8px; font-size:1.3rem; }
.lx-fcstar.on { color:var(--hard, #d9a400); }
.lx-fcarr { position:absolute; top:50%; transform:translateY(-50%); width:34px; height:34px; border-radius:50%; border:1.5px solid var(--line); background:var(--surface); color:inherit; font-size:1.3rem; line-height:1; cursor:pointer; }
.lx-fcarr.l { left:6px; } .lx-fcarr.r { right:6px; }
.lx-fchint { position:absolute; bottom:6px; left:0; right:0; }
.lx-fcnav { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:10px 0 4px; }
.lx-fcnav .btn { flex:1; }
/* 6.50 Chưa thuộc / Đã thuộc: cùng kiểu 4 nút chấm khi học (.rate .r1 / .r3) của từng giao diện */
.lx-un { background:var(--again-soft); color:var(--again); border-color:transparent; }
.lx-kn { background:var(--good-soft); color:var(--good); border-color:transparent; }
html[data-look="cophong"] .lx-un, html[data-look="cophong"] .lx-kn { color:#fff; box-shadow:inset 0 -3px 0 rgba(0,0,0,.16), 0 4px 10px -4px rgba(0,0,0,.25); }
html[data-look="cophong"] .lx-un { background:#C0584A; } html[data-look="cophong"] .lx-kn { background:#5F9C86; }
html[data-look="cophong"][data-theme="dark"] .lx-un { background:#9C4537; } html[data-look="cophong"][data-theme="dark"] .lx-kn { background:#3F7A65; }
.lx-pl { padding:4px; }
.lx-pc { display:flex; align-items:center; gap:8px; padding:6px; border-top:1px dashed var(--line); }
.lx-pc:first-child { border-top:0; }
.lx-pcm { display:flex; flex-direction:column; align-items:flex-start; gap:2px; padding:8px; border:0; background:none; color:inherit; font:inherit; text-align:left; cursor:pointer; }
.lx-pcm .jp { font-size:1.15rem; }
.lx-pen { flex:none; width:44px; height:44px; border-radius:50%; border:0; background:var(--accent); color:var(--on-accent, #fff); font-size:1.15rem; cursor:pointer; }
.lx-gt { font-size:1.9rem; margin:4px 0 2px; }
.lx-gvi { margin:0 0 10px; color:var(--muted); }
.lx-gact { margin-bottom:12px; }
.lx-sec { margin-top:10px; }
.lx-sh { font-size:.75rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); margin-bottom:6px; }
.lx-struct { font-size:1.35rem; line-height:2.1; }
.lx-struct .lx-tok { font-size:.8em; }
.lx-ul { margin:0; padding-left:18px; display:grid; gap:4px; }
.lx-tabs .chip b { margin-left:4px; opacity:.7; }
.lx-tip { margin-bottom:10px; background:color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.lx-tr { position:relative; margin-top:10px; display:grid; gap:6px; }
.lx-trn { width:28px; height:28px; border-radius:8px; display:grid; place-items:center; background:var(--ink); color:var(--bg, #fff); font-weight:800; font-size:.85rem; }
.lx-trq { font-size:1.1rem; }
.lx-tr textarea { width:100%; }
.lx-ans { padding:6px 8px; border-radius:10px; background:color-mix(in srgb, var(--accent) 7%, transparent); }
.lx-sxa, .lx-sxt { display:flex; flex-wrap:wrap; gap:6px; min-height:36px; }
.lx-sxa { padding:6px; border-radius:10px; border:1px dashed var(--line); }
.lx-wex .jp { font-size:.95rem; }
.lx-fcbar .seg button, .lx-fcnav .btn { white-space:nowrap; }
.lx-fcnav .btn { padding-left:8px; padding-right:8px; font-size:.92rem; }
.lx-gact .btn { flex:1; white-space:nowrap; }

/* 6.48 "Luyện bài này" trong mỗi bài Thư viện + tab Nghe & Đọc */
.lx-prac { margin:4px 0 14px; padding:12px; border-radius:18px; border:1.5px solid var(--line); background:var(--surface); box-shadow:var(--shadow); display:grid; gap:10px; }
.lx-prac .p-mix { margin:0; }
.lx-prac .p-grid.mini { margin:0; }
.nd-tiles { display:grid; gap:10px; margin-bottom:6px; }
.nd-tile { display:flex; align-items:center; gap:14px; width:100%; padding:18px 16px; border-radius:20px; border:1.5px solid var(--line); background:var(--surface); box-shadow:var(--shadow); color:inherit; font:inherit; text-align:left; cursor:pointer; }
.nd-tile .pi { width:52px; height:52px; border-radius:16px; flex:none; }
.nd-tile .pi .i { width:28px; height:28px; }
.nd-tile .grow { display:flex; flex-direction:column; gap:3px; }
.nd-tile b { font-size:1.12rem; }
.nd-tile .grow > span { font-size:.85rem; color:var(--muted); }

/* 6.49 flashcard bài (vuốt, lật, phóng to) + nút Luyện bài này + ký hiệu gọn */
.lx-fcbar { display:flex; align-items:center; gap:6px; margin:0 0 8px; flex-wrap:wrap; }
.lx-fcbar .chip { white-space:nowrap; }
.lx-fc { touch-action:pan-y; user-select:none; -webkit-user-select:none; will-change:transform; }
.lx-fc img { pointer-events:none; }
.lx-fsw { position:fixed; inset:0; z-index:60; display:flex; flex-direction:column; justify-content:center; gap:6px; padding:16px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background:var(--bg); }
.lx-fsw .lx-fc { flex:1; min-height:0; }
.lx-fsw .lx-fcimg { width:min(62vw, 300px); height:min(62vw, 300px); }
.lx-fsw .lx-fcw { font-size:3.4rem; }
.lx-pbtn { display:flex; align-items:center; gap:12px; width:100%; margin:12px 0 4px; padding:14px; border-radius:18px; border:1.5px solid var(--line); background:var(--surface); box-shadow:var(--shadow); color:inherit; font:inherit; text-align:left; cursor:pointer; }
.lx-pbtn .grow { display:flex; flex-direction:column; gap:2px; }
.lx-pbtn .grow > span { font-size:.82rem; color:var(--muted); }
.ov .lx-prac { border:0; box-shadow:none; padding:0; background:none; }
.lx-legrow { display:flex; gap:8px; margin:0 0 12px; }
.lx-legbtn { display:flex; align-items:center; gap:4px; flex:1; padding:10px 12px; border-radius:14px; border:1.5px solid var(--line); background:var(--surface); color:inherit; font:inherit; font-size:.88rem; font-weight:700; cursor:pointer; white-space:nowrap; overflow:hidden; }
.lx-legbtn .lx-tok { font-size:.72rem; padding:0 4px; min-width:0; }
.lx-legbtn .grow { text-align:left; margin-left:4px; }
.lx-legg span { align-items:flex-start; }
.lx-legg .lx-tok { flex:none; }

/* 6.50 trang mẫu ngữ pháp: Nói theo mẫu (bảng mẫu câu gắn với mẫu) */
.lx-pat .lx-patp { margin:10px 0 2px; padding:4px 10px; border-radius:8px; background:var(--soft, rgba(127,127,127,.08)); font-weight:600; }
.lx-pat .tiny { margin:2px 0 4px; }
html[data-look="phac"] .lx-un, html[data-look="phac"] .lx-kn { border:1.25px solid currentColor; border-radius:14px; font-weight:700; }
/* 6.50 mặt thẻ dài hơn khung: canh giữa kiểu "safe" (tràn thì dồn lên đầu) để chữ chính ở trên không bị đẩy khuất; điện thoại: thẻ dài ra, cả màn cuộn */
.face { justify-content:safe center; }
.st-body > .face { flex:1 0 auto; }
@media (min-width: 900px) { .st-body > .face { flex:0 1 auto; } }

/* ================= 6.51 SỔ TAY (look phac, data-frame="line"): giấy kẻ ô + viền mảnh bo tròn, không còn nét vẽ tay =================
   Cùng danh sách khung với nét vẽ cũ (6.4). Viền = mực 62 %, 1.25 px; khung lớn bo 16, nút / ô nhỏ bo 12, chip bo 10. */
html[data-look="phac"] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .tab.on .tabi) {
  border:1.25px solid var(--edge); border-image:none; border-radius:12px; box-shadow:none; background-clip:padding-box;
}
/* bộ chọn 3 thuộc tính: ngang độ ưu tiên với quy tắc viền chung ở trên (có .tab.on .tabi trong :is) */
html[data-look="phac"][data-skin][data-frame] :is(.panel, .setl, .deck, .lcard, .face, .p-tile, .font-tile, .kho-row, .wp, .h6-search, .tb-foot) { border-radius:16px; }
html[data-look="phac"][data-skin][data-frame] :is(.chip, .t-pill, .pchip) { border-radius:10px; }
html[data-look="phac"] :is(.h6-search, .tb-foot) { border:1.25px solid var(--edge); box-shadow:none; }
html[data-look="phac"] .seg { padding:3px; }
html[data-look="phac"] .seg button.on { box-shadow:none; background:var(--accent-soft); color:var(--accent); border-radius:9px; }
html[data-look="phac"] .btn.primary { border-color:var(--accent); }
html[data-look="phac"] :is(.chip.on, .font-tile.on, .xopt.sel) { background-color:var(--accent-soft); color:var(--accent); border-color:var(--accent); }
html[data-look="phac"] .xopt.ok { background-color:color-mix(in srgb, var(--good) 14%, var(--surface)); border-color:var(--good); }
html[data-look="phac"] .xopt.bad { background-color:color-mix(in srgb, var(--again) 14%, var(--surface)); border-color:var(--again); }
html[data-look="phac"] .sw { border:1.25px solid var(--edge); }
html[data-look="phac"] .setl .set + .set, html[data-look="phac"] .lcard .lrow + .lrow { border-top:1px solid var(--line); }
html[data-look="phac"] .tabbar { border-top:1px solid var(--line); background-image:none; }
html[data-look="phac"] .tab.on .tabi { border-radius:12px; background:var(--accent-soft); border-color:var(--accent); }
html[data-look="phac"] .drow .dr-main, html[data-look="phac"] .drow .dr-play { box-shadow:none; }
html[data-look="phac"] .act { margin-bottom:8px; }
html[data-look="phac"] .rate .r4 { border-color:var(--ink); }
/* 6.51 các ô kiểu thẻ khác (trước dùng bóng --shadow, ở Sổ tay bóng = none) → cùng viền mảnh; giữ bo góc riêng của từng ô */
html[data-look="phac"] :is(.crow, .dc-row, .dlg, .dsel-bar, .ex-audio, .ex-pass, .ex-stem, .ex-timer, .fbtn, .lx-card, .lx-fc, .lx-lr, .lx-pbtn, .lx-prac, .lx-tile, .nd-tile, .opt, .p-mix, .pq-opt, .rt-chest, .search, .sheet-prev, .sheet-wrap, .streak, .sx-ans, .sx-tile, .wl-path, .wl-quote) { border:1.25px solid var(--edge); box-shadow:none; }

/* ================= 6.52 Sổ tay · nét bút thư pháp Khải thư (js/brush.js sinh SVG vào --bf* / --bh*) =================
   Khung = 3 nét như chữ 口, nằm sát mép; nền ô (padding-box) bắt đầu ngay dưới nét. Không có JS → vẫn là viền mảnh 6.51.
   Bộ chọn có 3 thuộc tính + :is(…) để thắng các quy tắc viền 6.51. */
html[data-look="phac"][data-brush="1"][data-skin] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .h6-search, .tb-foot, .dc-row, .dlg, .dsel-bar, .ex-audio, .ex-pass, .ex-stem, .ex-timer, .fbtn, .lx-card, .lx-fc, .lx-lr, .lx-pbtn, .lx-prac, .lx-tile, .nd-tile, .opt, .p-mix, .pq-opt, .rt-chest, .search, .sheet-prev, .sheet-wrap, .streak, .sx-ans, .sx-tile, .wl-path, .wl-quote, .rate button, .lx-un, .lx-kn) {
  border:2px solid transparent; border-image:var(--bf1) 44 / 22px / 0 stretch; background-clip:padding-box; border-radius:4px; box-shadow:none;
}
html[data-look="phac"][data-brush="1"][data-skin] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .h6-search, .tb-foot, .dc-row, .dlg, .dsel-bar, .ex-audio, .ex-pass, .ex-stem, .ex-timer, .fbtn, .lx-card, .lx-fc, .lx-lr, .lx-pbtn, .lx-prac, .lx-tile, .nd-tile, .opt, .p-mix, .pq-opt, .rt-chest, .search, .sheet-prev, .sheet-wrap, .streak, .sx-ans, .sx-tile, .wl-path, .wl-quote, .rate button, .lx-un, .lx-kn):nth-child(6n+2) { border-image-source:var(--bf2); }
html[data-look="phac"][data-brush="1"][data-skin] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .h6-search, .tb-foot, .dc-row, .dlg, .dsel-bar, .ex-audio, .ex-pass, .ex-stem, .ex-timer, .fbtn, .lx-card, .lx-fc, .lx-lr, .lx-pbtn, .lx-prac, .lx-tile, .nd-tile, .opt, .p-mix, .pq-opt, .rt-chest, .search, .sheet-prev, .sheet-wrap, .streak, .sx-ans, .sx-tile, .wl-path, .wl-quote, .rate button, .lx-un, .lx-kn):nth-child(6n+3) { border-image-source:var(--bf3); }
html[data-look="phac"][data-brush="1"][data-skin] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .h6-search, .tb-foot, .dc-row, .dlg, .dsel-bar, .ex-audio, .ex-pass, .ex-stem, .ex-timer, .fbtn, .lx-card, .lx-fc, .lx-lr, .lx-pbtn, .lx-prac, .lx-tile, .nd-tile, .opt, .p-mix, .pq-opt, .rt-chest, .search, .sheet-prev, .sheet-wrap, .streak, .sx-ans, .sx-tile, .wl-path, .wl-quote, .rate button, .lx-un, .lx-kn):nth-child(6n+4) { border-image-source:var(--bf4); }
html[data-look="phac"][data-brush="1"][data-skin] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .h6-search, .tb-foot, .dc-row, .dlg, .dsel-bar, .ex-audio, .ex-pass, .ex-stem, .ex-timer, .fbtn, .lx-card, .lx-fc, .lx-lr, .lx-pbtn, .lx-prac, .lx-tile, .nd-tile, .opt, .p-mix, .pq-opt, .rt-chest, .search, .sheet-prev, .sheet-wrap, .streak, .sx-ans, .sx-tile, .wl-path, .wl-quote, .rate button, .lx-un, .lx-kn):nth-child(6n+5) { border-image-source:var(--bf5); }
html[data-look="phac"][data-brush="1"][data-skin] :is(.panel, .setl, .deck, .lcard, .p-tile, .btn, .chip, .xopt, .face, .seg, .in, .ex-cell, .font-tile, .kho-row, .t-mode, .drow, .crow, .wp, .pchip, .ibtn:not(.plain), .t-pill, .act, .h6-search, .tb-foot, .dc-row, .dlg, .dsel-bar, .ex-audio, .ex-pass, .ex-stem, .ex-timer, .fbtn, .lx-card, .lx-fc, .lx-lr, .lx-pbtn, .lx-prac, .lx-tile, .nd-tile, .opt, .p-mix, .pq-opt, .rt-chest, .search, .sheet-prev, .sheet-wrap, .streak, .sx-ans, .sx-tile, .wl-path, .wl-quote, .rate button, .lx-un, .lx-kn):nth-child(6n+6) { border-image-source:var(--bf6); }
/* nút / chip nhỏ: nét dày hơn chút; nút chính (nền son) viền mực son đậm; ô đang chọn viền son */
html[data-look="phac"][data-brush="1"][data-skin][data-frame] :is(.chip, .pchip, .t-pill, .ibtn:not(.plain), .seg, .streak) { border-image-source:var(--bfs); }
html[data-look="phac"][data-brush="1"][data-skin][data-frame] :is(.btn.primary) { border-image-source:var(--bfp); }
html[data-look="phac"][data-brush="1"][data-skin][data-frame] :is(.chip.on, .font-tile.on, .xopt.sel, .tab.on .tabi) { border-image-source:var(--bfa); }
html[data-look="phac"][data-brush="1"][data-skin][data-frame] .rate .r1, html[data-look="phac"][data-brush="1"][data-skin][data-frame] .lx-un { border-image-source:var(--bfq); }
html[data-look="phac"][data-brush="1"][data-skin][data-frame] .rate .r2 { border-image-source:var(--bfh); }
html[data-look="phac"][data-brush="1"][data-skin][data-frame] .rate .r3, html[data-look="phac"][data-brush="1"][data-skin][data-frame] .lx-kn { border-image-source:var(--bfg); }
html[data-look="phac"][data-brush="1"][data-skin][data-frame] .rate .r4 { border-image-source:var(--bfs); }
html[data-look="phac"][data-brush="1"] .seg button.on { border-radius:3px; }
/* đường kẻ giữa các dòng + đầu thanh dưới: nét ngang mảnh */
html[data-look="phac"][data-brush="1"] .setl .set + .set, html[data-look="phac"][data-brush="1"] .lcard .lrow + .lrow { border-top:0; background-image:var(--bhr); background-position:top left; background-size:100% 5px; background-repeat:no-repeat; }
html[data-look="phac"][data-brush="1"] .tabbar { border-top:0; background-image:var(--bhr); background-position:top left; background-size:100% 5px; background-repeat:no-repeat; }
/* thanh tiến độ: vệt mực nhạt + nét son dài theo phần trăm */
html[data-look="phac"][data-brush="1"] .bar { height:10px; border-radius:0; background:var(--btr) left center/100% 100% no-repeat; overflow:visible; }
html[data-look="phac"][data-brush="1"] .bar.thin { height:7px; }
html[data-look="phac"][data-brush="1"] .bar > i { border-radius:0; background:var(--bpr) left center/100% 100% no-repeat; }
/* gạch chân tiêu đề màn */
html[data-look="phac"][data-brush="1"] :is(.h6-title, .hdr h1) { display:inline-block; padding-bottom:5px; background:var(--bul) left bottom/100% 7px no-repeat; }
html[data-look="phac"][data-brush="1"] .tab.on .tabi { border:2px solid transparent; border-image:var(--bfa) 44 / 22px / 0 stretch; background-clip:padding-box; border-radius:4px; }

/* ================= 6.54 ảnh từ vựng "vẽ ra" khi sang thẻ mới (mặt nạ quét chéo như nét bút + rõ dần), ảnh thẻ học, ảnh nhỏ trong danh sách từ ================= */
@keyframes inkIn { 0% { -webkit-mask-position:100% 0; mask-position:100% 0; filter:blur(1.2px) contrast(1.6); opacity:.35; } 70% { filter:blur(0) contrast(1.15); opacity:1; } 100% { -webkit-mask-position:0 0; mask-position:0 0; filter:none; opacity:1; } }
.ink-in { -webkit-mask-image:linear-gradient(120deg, #000 0 42%, rgba(0,0,0,.35) 48%, transparent 56% 100%); mask-image:linear-gradient(120deg, #000 0 42%, rgba(0,0,0,.35) 48%, transparent 56% 100%);
  -webkit-mask-size:280% 100%; mask-size:280% 100%; -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat; animation:inkIn 1.3s cubic-bezier(.4,.1,.3,1) both; }
@media (prefers-reduced-motion: reduce) { .ink-in { animation:none; -webkit-mask-image:none; mask-image:none; } }
.face .st-pic { width:auto; max-width:min(64%, 220px); max-height:180px; aspect-ratio:1; object-fit:contain; border-radius:12px; mix-blend-mode:multiply; }
html[data-theme="dark"] .face .st-pic, html[data-theme="dark"] .lx-wimg, html[data-theme="dark"] .lx-fcimg { mix-blend-mode:normal; filter:invert(.88) hue-rotate(180deg); }
.lx-w .lx-wimg { width:56px; height:56px; flex:none; object-fit:contain; border-radius:10px; background:#fff; mix-blend-mode:multiply; align-self:center; }

/* 6.54 nút あ nổi: bật / tắt furigana khắp app (html[data-furi]) */
html[data-furi="0"] ruby rt { display:none; }
#furi-fab { position:fixed; right:14px; bottom:calc(76px + env(safe-area-inset-bottom, 0px)); z-index:40; width:44px; height:44px; border-radius:50%;
  font:700 1.15rem var(--font-jp, sans-serif); color:var(--muted); background:var(--surface); border:1.25px solid var(--edge, var(--line)); box-shadow:0 4px 14px -6px rgba(0,0,0,.35); opacity:.92; cursor:pointer; }
#furi-fab.on { color:var(--accent); border-color:var(--accent); background:var(--accent-soft, var(--surface)); }
#furi-fab[hidden] { display:none; }
@media (min-width: 900px) { #furi-fab { bottom:20px; right:20px; } }
/* 6.54 học kanji: mỗi ô chữ + ô nét viết lớn có khung bút Khải thư (js/brush.js), xoay 6 nét; ô đã thêm = viền son, đã thuộc = viền xanh */
html[data-look="phac"][data-brush="1"] :is(.lx-kc, .lx-kbox) { border:2px solid transparent; border-image:var(--bf1) 44 / 22px / 0 stretch; background-clip:padding-box; border-radius:4px; box-shadow:none; }
html[data-look="phac"][data-brush="1"] .lx-kc:nth-child(6n+2) { border-image-source:var(--bf2); }
html[data-look="phac"][data-brush="1"] .lx-kc:nth-child(6n+3) { border-image-source:var(--bf3); }
html[data-look="phac"][data-brush="1"] .lx-kc:nth-child(6n+4) { border-image-source:var(--bf4); }
html[data-look="phac"][data-brush="1"] .lx-kc:nth-child(6n+5) { border-image-source:var(--bf5); }
html[data-look="phac"][data-brush="1"] .lx-kc:nth-child(6n+6) { border-image-source:var(--bf6); }
html[data-look="phac"][data-brush="1"] .lx-kc.on.lx-kc { border-image-source:var(--bfa); }
html[data-look="phac"][data-brush="1"] .lx-kc.ok.lx-kc { border-image-source:var(--bfg); }

/* 6.55 cầm bút vẽ ra: khung bọc canvas + cây bút lông chạy ở đầu nét */
.ink-wrap { position:relative; display:inline-block; line-height:0; }
.ink-pen { position:absolute; left:0; top:0; width:28px; height:28px; pointer-events:none; transition:transform 40ms linear; filter:drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.ink-pen svg { width:100%; height:100%; }

/* === HSK: mau thanh dieu pinyin ===
   Thanh 1 ngang (do) · 2 len (cam) · 3 xuong-len (luc) · 4 xuong (xanh) · nhe (xam)
   Dung chung cho .rd-py (mat sau the) va moi cho hien pinyin. */
.rd-py { font-size: .95em; letter-spacing: .02em; }
.rd-py .py-t1 { color: #d33a3a; }
.rd-py .py-t2 { color: #d97706; }
.rd-py .py-t3 { color: #15915a; }
.rd-py .py-t4 { color: #2563eb; }
.rd-py .py-t0, .rd-py .py-t-1 { color: var(--muted, #888); }
html[data-theme="dark"] .rd-py .py-t1 { color: #ff8080; }
html[data-theme="dark"] .rd-py .py-t2 { color: #fbbf24; }
html[data-theme="dark"] .rd-py .py-t3 { color: #4ade80; }
html[data-theme="dark"] .rd-py .py-t4 { color: #7dd3fc; }

/* === HSK: man tim chu theo bo thu + khoi chiet tu === */
.rad-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(64px, 1fr)); gap:8px; margin-top:10px; }
.rad-cell { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
  padding:8px 4px; border:1.25px solid var(--edge, var(--line)); border-radius:10px;
  background:var(--surface); cursor:pointer; min-height:64px; }
.rad-cell b { font-family:var(--font-jp); font-size:1.5rem; line-height:1.15; color:var(--ink); }
.rad-cell small { font-size:.62rem; line-height:1.1; text-align:center; color:var(--muted); word-break:break-word; }
.rad-cell.on { border-color:var(--accent); background:var(--accent-soft); box-shadow:0 0 0 2px var(--accent-soft); }

.rad-res { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.rad-r { display:grid; place-items:center; width:56px; height:56px; border-radius:10px;
  border:1.25px solid var(--edge, var(--line)); background:var(--surface); cursor:pointer; }
.rad-r b { font-family:var(--font-jp); font-size:1.7rem; color:var(--ink); }

.rad-box { padding:12px 14px; border:1.25px solid var(--edge, var(--line)); border-radius:12px; background:var(--surface); margin-top:8px; }
.rad-pt { display:flex; align-items:center; justify-content:center; gap:10px; flex-wrap:wrap; }
.rad-p { display:flex; flex-direction:column; align-items:center; gap:1px; min-width:52px; }
.rad-p b { font-family:var(--font-jp); font-size:1.9rem; line-height:1.1; color:var(--ink); }
.rad-p small { font-size:.68rem; font-weight:600; color:var(--accent); }
.rad-p span { font-size:.6rem; }
.rad-plus { font-size:1.2rem; color:var(--muted); }
.rad-gon { margin-top:6px; font-size:.85rem; }
.rad-gon b { font-family:var(--font-jp); font-size:1.15rem; color:var(--ink); }
