/* 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; }
html[data-accent="matcha"] { --acc-l:#2C6B4C; --acc-d:#8FD3AE; --accs-l:#E0F0E7; --accs-d:#1D3A2D; }
html[data-accent="sakura"] { --acc-l:#B03A68; --acc-d:#F5A3C4; --accs-l:#FBE3ED; --accs-d:#44202F; }
html[data-accent="amber"]  { --acc-l:#A9500A; --acc-d:#FFB66F; --accs-l:#FCEAD8; --accs-d:#402611; }
html[data-accent="violet"] { --acc-l:#573CA6; --acc-d:#BEA9FF; --accs-l:#EBE5FB; --accs-d:#2D2352; }

: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;
  --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 JP","Noto Sans CJK JP",sans-serif;
  --font-jp:"Noto Serif CJK JP","Noto Serif JP","Hiragino Mincho ProN","Yu Mincho","Source Han Serif JP",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;
  --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 { 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.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;
  --font-title:"Noto Serif","Noto Serif CJK JP","Noto Serif JP","Hiragino Mincho ProN","Yu Mincho",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; }
html[data-skin="xian"][data-accent="sakura"]  { --acc-l:#A8445E; --acc-d:#F2A7B6; --accs-l:#F6DDE1; --accs-d:#432029; }
html[data-skin="xian"][data-accent="amber"]   { --acc-l:#93691A; --acc-d:#E8C46A; --accs-l:#F3E8CB; --accs-d:#3B2F14; }
html[data-skin="xian"][data-accent="violet"]  { --acc-l:#5A4A9E; --acc-d:#BDB1F2; --accs-l:#E6E1F6; --accs-d:#2B2550; }

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; }
.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-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 Klee"; src:url(fonts/klee-one.woff2) format("woff2"); font-display:swap; }
@font-face { font-family:"KJ ZenMaru"; src:url(fonts/zen-maru-gothic.woff2) format("woff2"); font-display:swap; }
@font-face { font-family:"KJ Yomogi"; src:url(fonts/yomogi.woff2) format("woff2"); font-display:swap; }
@font-face { font-family:"KJ Kurenaido"; src:url(fonts/zen-kurenaido.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="klee"]      { --font-jp:"KJ Klee","Noto Sans CJK JP",sans-serif; }
html[data-kfont="zenmaru"]   { --font-jp:"KJ ZenMaru","Noto Sans CJK JP",sans-serif; }
html[data-kfont="yomogi"]    { --font-jp:"KJ Yomogi","Noto Sans CJK JP",sans-serif; }
html[data-kfont="kurenaido"] { --font-jp:"KJ Kurenaido","Noto Sans CJK JP",sans-serif; }
html[data-kfont="sans"]      { --font-jp:"Noto Sans CJK JP","Noto Sans JP","Hiragino Sans",sans-serif; }
html[data-ufont="bvp"]    { --font-ui:"KJ BVP",system-ui,"Roboto","Noto Sans CJK JP",sans-serif; --font-title:"KJ BVP",system-ui,sans-serif; }
html[data-ufont="nunito"] { --font-ui:"KJ Nunito",system-ui,"Roboto","Noto Sans CJK JP",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='%233b342c' 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='%233b342c' 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='%233b342c' 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='%233b342c' 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='%233b342c' 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='%233b342c' 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='%23d9cfbf' 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='%23d9cfbf' 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='%23d9cfbf' 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='%23d9cfbf' 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='%23d9cfbf' 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='%23d9cfbf' 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='%233b342c' 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='%23d9cfbf' 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); }
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.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; }
}
/* 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; }
}
