
/* ===== ph3 (2026-11-23): sửa lỗi điện thoại từ đợt rà soát ===== */
@media (max-width: 640px) {
  /* Thanh trên và thanh dưới dính sát mép màn hình, không còn khe để chữ của trang lộ ra */
  #app > header.top { top: 0; margin-left: -12px; margin-right: -12px; border-radius: 0 0 22px 22px; padding-top: calc(8px + env(safe-area-inset-top)); }
  nav.tabbar { bottom: 0; left: 0; right: 0; border-radius: 22px 22px 0 0; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }

  /* Nút tốc độ đọc: trong bài Gõ câu/Học thì ẩn (đã có Tốc độ phát trong nút Cài đặt của bài) để khỏi đè nút mũi tên */
  body:has(#app .tsl) #spd { display: none; }

  /* Gõ câu: chừa chỗ dưới cùng để thanh địa chỉ của trình duyệt (Safari, Samsung) không che thanh Phát âm / Gợi ý / Làm lại */
  #app .tsl { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }

  /* Tra nghĩa nhanh: trên điện thoại hiện thành tấm dưới đáy màn hình thay vì bay lên che câu; bỏ ô xanh đánh dấu bị lệch chỗ */
  #tt-pop { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; max-height: 55vh; overflow-y: auto; }
  #tt-pop::after { display: none; }
  #tt-hl { display: none !important; }


  /* Trang Học: bỏ lời chào và nút Học tiếp bị lặp (ô Chào … bên dưới đã có Tiếp tục học) */
  body:has(#app .hero3) .dtop .dtr { display: none; }

  /* Xếp hạng: cột lưới không được rộng hơn màn hình */
  .rank-list { grid-template-columns: minmax(0, 1fr); }
  .rank-list .lrow { min-width: 0; padding: 10px 12px 10px 10px; gap: 10px; }
  .rank-list .rnick { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rank-list .rxp { flex: none; white-space: nowrap; padding-left: 8px; padding-right: 8px; font-size: .85rem; }
  .rank-list .rpos { flex: none; width: 30px; min-width: 30px; }
  .rank-list .rnick { flex: 1 1 auto; }
  .rank-list .lgmini { display: none; }

  /* Cửa hàng: khối dính trên đầu gọn lại (tab và bộ lọc thành một hàng vuốt ngang, Gương Thần nằm ngang) */
  .shopstick, .loadout { top: calc(var(--hbar, 61px) - 8px); }
  .shopstick .shoptabs, .shopstick .fashcats { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px; padding-bottom: 4px; }
  .shopstick .shoptabs::-webkit-scrollbar, .shopstick .fashcats::-webkit-scrollbar { display: none; }
  .shopstick .shoptabs > *, .shopstick .fashcats > * { flex: none; white-space: nowrap; }
  .shopstick .fit.mini { flex-direction: row; align-items: center; padding: 6px 10px; }
  .shopstick .fit.mini .fitfig { width: 46px; max-width: 46px; margin: 0; padding: 4px; border-radius: 14px; }
  .shopstick .fit.mini .fitinfo { align-items: stretch; }
  .shopstick .fit.mini .fithead { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
  /* Gương Thần: ô nhân vật cũng mang class "fit" nên bị dính padding của khung, làm hình nhân vật co về 0 */
  .fitfig .pffull.fit { display: block; padding: 0; border-radius: 12px; }
  .fitfig .pffull.fit .fbsvg { width: 100%; height: auto; }

  /* Cửa hàng: 2 món mỗi hàng thay vì 1 để đỡ cuộn */
  #app .shoplist:not(.invlist) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .shoplist .shopcard { min-width: 0; }

  /* Màn đăng nhập: nút Quên mật khẩu không có nền trắng thừa */
  .ag-opt .link { background: none; border: 0; box-shadow: none; padding: 6px 0; min-height: 0; }
}

/* Gõ câu: câu người học đã gõ, hiện khi Chưa đúng (mọi khổ màn hình) */
.styou { display: block; margin: 2px 0 6px; font-size: .9rem; color: var(--muted); }
.styou .zh { font-size: 1.1rem; }

/* ph4: Cửa hàng trên điện thoại từng làm Safari iPhone sập: mỗi thẻ Giao diện/Trò chơi có cảnh xem trước với hàng trăm hạt mưa, tuyết,
   tàn lửa chuyển động liên tục (kèm bóng mờ drop-shadow). Trên máy cảm ứng: đứng yên các cảnh xem trước, bỏ bóng mờ,
   và không vẽ các thẻ đang nằm ngoài màn hình. */
@media (hover: none), (max-width: 640px) {
  #app .hs-demo, #app .hs-demo * { animation-play-state: paused !important; }
  #app .hs-demo .fx, #app .hs-demo .fx * { filter: none !important; }
  #app .shoplist > *, #app .kmain .shoplist > * { content-visibility: auto; contain-intrinsic-size: auto 280px; }
}

/* ph6: Cửa hàng (bố cục 2 cột Gương Thần + danh sách): cột danh mục dính trên đầu cao quá màn hình, đè hết thẻ sản phẩm.
   Màn vừa và nhỏ: danh mục thành một hàng vuốt ngang; màn lớn: không cho cao quá 40% màn hình. */
.shopkho .shopmain .shopsecs { max-height: 40vh; overflow-y: auto; }
@media (max-width: 1100px) {
  .shopkho .shopmain .shopsecs { display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; max-height: none; scrollbar-width: thin; gap: 6px; padding-bottom: 6px; }
  .shopkho .shopmain .shopsecs > * { flex: none; white-space: nowrap; }
}

/* ph7: Bảng xếp hạng ở Trang chủ (kiểu AIO): tiêu đề + nút Tất cả / Bạn bè, bục 1-2-3, danh sách cuộn trong khung */
.hrank { min-width: 0; }
.hrank .hrk-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.hrank .hrk-t { flex: 1 1 auto; min-width: 0; }
.hrank .hrk-t h3 { margin: 0; }
.hrank .hrk-t small { display: block; color: var(--muted); font-size: .85rem; }
.hrank .hrk-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: color-mix(in srgb, var(--card, #fff) 70%, transparent); }
.hrank .hrk-tabs button { border: 0; background: none; box-shadow: none; padding: 7px 16px; border-radius: 999px; min-height: 0; font-weight: 700; color: var(--muted); }
.hrank .hrk-tabs button.on { background: #c8553d; color: #fff; }
.hrank.ok .hrk-b > p, .hrank.ok .hrk-b > .row { display: none; }
.hrank .rank-list { max-height: 460px; overflow-y: auto; overscroll-behavior: contain; }
.hrank .lgstat { margin-bottom: 8px; }
@media (max-width: 640px) {
  .hrank .hrk-tabs { width: 100%; }
  .hrank .hrk-tabs button { flex: 1; }
  .hrank .rank-list { max-height: 380px; }
}

/* ph7: Luyện phát âm có sẵn 9 bài Nhập môn Pinyin (gộp từ thẻ Pinyin cũ ở Trang chủ) */
.pr-py .pr-pyl { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 6px 0 10px; }
.pr-py .pr-pyb { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 10px 12px; min-width: 0; }
.pr-py .pr-pyb em { font-style: normal; font-size: .75rem; color: var(--muted); }
.pr-py .pr-pyb small { color: var(--muted); font-size: .8rem; }
@media (max-width: 640px) { .pr-py .pr-pyl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ph8: Bảng tin hiện ảnh nhân vật thật của người dùng */
.dact .pav.avw { padding: 0; background: none; }
.dact .pav.avw > * { width: 100%; height: 100%; }
.dact .pav.avw svg { width: 100%; height: 100%; }

/* ph8: Lối tắt Lộ trình ở Trang chủ (kiểu AIO) */
.hroad { display: flex; flex-direction: column; gap: 10px; }
.hroad .hrd-pct { display: flex; align-items: baseline; gap: 10px; }
.hroad .hrd-pct > b { font-size: 2.4rem; line-height: 1; font-weight: 800; }
.hroad .hrd-bar { position: relative; height: 10px; border-radius: 99px; background: color-mix(in srgb, var(--ink, #3a2e25) 12%, transparent); }
.hroad .hrd-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--t-green-ink, #3f8f5a); }
.hroad .hrd-bar em { position: absolute; top: -5px; width: 3px; height: 20px; border-radius: 2px; background: var(--ink, #3a2e25); }
.hroad .hrd-blb { display: flex; justify-content: flex-end; padding-right: 8%; font-size: .78rem; color: var(--muted); margin-top: -4px; }
.hroad .hrd-st { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hroad .hrd-st > div { background: var(--card, #fff); border-radius: 14px; padding: 8px 12px; }
.hroad .hrd-st small { display: block; color: var(--muted); font-size: .8rem; }
.hroad .hrd-list { display: flex; flex-direction: column; gap: 6px; max-height: 250px; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.hroad .hrd-u { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; padding: 8px 12px; border-radius: 14px; min-height: 0; }
.hroad .hrd-u span { min-width: 0; display: flex; flex-direction: column; }
.hroad .hrd-u small { color: var(--muted); font-size: .75rem; }
.hroad .hrd-u b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hroad .hrd-u em { font-style: normal; font-weight: 700; flex: none; }
.hroad .hrd-u.cur { outline: 2px solid var(--t-green-ink, #3f8f5a); }
.hroad .hrd-u.full em { color: var(--t-green-ink, #3f8f5a); }
.hroad .hrd-exam { width: 100%; justify-content: center; }

/* ph9: Hướng dẫn (tour) kiểu AIO: nền tối rõ, khung vàng quanh đúng khối, linh vật ở mọi bước, hộp gọn trên điện thoại */
#tour .tspot { box-shadow: 0 0 0 4px #f3b04c, 0 0 0 10px color-mix(in srgb, #f3b04c 30%, transparent), 0 0 0 200vmax rgba(40, 34, 20, .6); }
html[data-theme="dark"] #tour .tspot { box-shadow: 0 0 0 4px #f3b04c, 0 0 0 10px rgba(243, 176, 76, .25), 0 0 0 200vmax rgba(6, 7, 16, .72); }
#tour.nospot { background: rgba(40, 34, 20, .6); }
html[data-theme="dark"] #tour.nospot { background: rgba(6, 7, 16, .72); }
.tcard .tbody { align-items: center; }
.tcard .tmas.sm { width: 52px; height: 52px; flex: none; }
.tcard .tsay { min-width: 0; }
.tcard .tsay b { display: block; }
@media (max-width: 640px) {
  .tcard, .tcard.tbig { width: calc(100vw - 20px); padding: 12px 14px 10px; border-radius: 18px; }
  .tcard b { font-size: 1.05rem; margin-bottom: 2px; }
  .tcard p { font-size: .88rem; line-height: 1.45; }
  .tcard .tbody { gap: 10px; margin-bottom: 8px; }
  .tcard .tmas.sm { width: 40px; height: 40px; }
  .tcard .tgh { order: 0; flex-basis: auto; min-height: 40px; padding: 0 10px; font-size: .85rem; }
  .tcard .tnext { min-height: 42px; min-width: 84px; padding: 0 14px; }
  .tcard .tback { width: 40px; min-height: 40px; }
  .tcard .tskip { min-height: 40px; padding: 8px 2px; }
  .tcard .trow { gap: 6px; flex-wrap: nowrap; }
}

/* ph11: Trợ lý nổi góc dưới phải (Báo lỗi, Tin nhắn + Bạn bè, Từ điển nhanh, Nhiệm vụ) */
#tl { position: fixed; right: 18px; bottom: 18px; z-index: 180; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
html.auth-locked #tl, html.auth-locked #tl-pane, body:has(#tour) #tl { display: none; }
#tl .tl-fab { width: 58px; height: 58px; border-radius: 50%; padding: 4px; border: 2px solid var(--line); background: var(--card); box-shadow: 0 10px 24px -10px rgba(40, 30, 10, .55); position: relative; cursor: pointer; min-height: 0; }
#tl .tl-fab:hover { transform: translateY(-2px); }
#tl .tl-face, #tl .tl-face svg { display: block; width: 100%; height: 100%; }
#tl .tl-dot { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: #e0623a; color: #fff; font: 800 .72rem/20px var(--font-ui, inherit); font-style: normal; text-align: center; border: 2px solid var(--card); }
#tl .tl-menu { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 240px; }
#tl .tl-menu[hidden] { display: none; }
#tl .tl-mi { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); color: var(--fg); font-weight: 800; box-shadow: 0 8px 20px -12px rgba(40, 30, 10, .5); cursor: pointer; min-height: 0; text-align: left; }
#tl .tl-mi:hover { border-color: #f3b04c; }
#tl .tl-mi span { flex: 1; }
#tl .tl-mi svg { width: 20px; height: 20px; flex: none; }
#tl .tl-badge, #tl .tl-cnt { font-style: normal; font-size: .78rem; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, #f3b04c 30%, var(--card)); border: 1px solid #e0a82e; }
#tl .tl-badge { background: #e0623a; color: #fff; border-color: #e0623a; }

#tl-pane { position: fixed; right: 18px; bottom: 88px; z-index: 181; width: min(400px, calc(100vw - 24px)); max-height: min(640px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 24px 60px -20px rgba(40, 30, 10, .55); overflow: hidden; }
#tl-pane[hidden] { display: none; }
#tl-pane.tl-modal { right: 50%; bottom: auto; top: 50%; transform: translate(50%, -50%); width: min(520px, calc(100vw - 24px)); }
#tl-pane.tl-modal.tl-wide { width: min(760px, calc(100vw - 24px)); }
html.tl-open:has(#tl-pane.tl-modal) body::after { content: ""; position: fixed; inset: 0; z-index: 179; background: rgba(40, 34, 20, .45); backdrop-filter: blur(3px); }
#tl-pane .tl-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, #f3b04c 12%, var(--card)); }
#tl-pane .tl-h b { font-size: 1.12rem; font-weight: 900; }
#tl-pane .tl-hi { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: var(--card); border: 1px solid var(--line); flex: none; }
#tl-pane .tl-sp { flex: 1; }
#tl-pane .tl-x, #tl-pane .tl-ib { width: 36px; height: 36px; min-height: 0; padding: 0; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; position: relative; flex: none; }
#tl-pane .tl-ibd { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 99px; background: #e0623a; color: #fff; font: 800 .7rem/18px var(--font-ui, inherit); font-style: normal; }
#tl-pane .tl-link { background: none; border: 0; box-shadow: none; min-height: 0; padding: 4px 2px; color: var(--accent, #3b6fd6); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
#tl-pane .tl-pad { padding: 12px 16px; }
#tl-pane .note { margin: 0; }
#tl-pane .tl-form { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
#tl-pane .tl-form label { font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
#tl-pane .tl-where { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: color-mix(in srgb, var(--fg) 4%, var(--card)); font-weight: 700; }
#tl-pane textarea, #tl-pane input[type="text"], #tl-pane input[type="search"] { width: 100%; box-sizing: border-box; border-radius: 14px; border: 1.5px solid var(--line); padding: 10px 12px; font: inherit; background: var(--card); color: var(--fg); }
#tl-pane .tl-hint { color: var(--muted); font-size: .82rem; }
#tl-pane .tl-note { color: #b4532a; font-weight: 700; font-size: .88rem; margin: 4px 0; }
#tl-pane .tl-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
#tl-pane .tl-ok { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#tl-pane .tl-ok svg { width: 40px; height: 40px; color: #3f8f5a; }
#tl-pane .tl-bugrow { border-bottom: 1px dashed var(--line); padding: 10px 0; }
#tl-pane .tl-bugrow small { display: block; color: var(--muted); }
#tl-pane .tl-bugrow p { margin: 4px 0 0; white-space: pre-wrap; }
#tl-pane .tl-search { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 14px; padding: 0 12px; background: var(--card); }
#tl-pane .tl-search:focus-within { border-color: #8b5cf6; box-shadow: 0 0 0 3px color-mix(in srgb, #8b5cf6 20%, transparent); }
#tl-pane .tl-search input { border: 0 !important; padding: 10px 0 !important; outline: none; box-shadow: none; }
#tl-pane .tl-dr, #tl-pane .tl-ml, #tl-pane .tl-ql, #tl-pane .tl-cm { overflow-y: auto; overscroll-behavior: contain; }
#tl-pane .tl-dr { max-height: 380px; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
#tl-pane .tl-dw { flex: none; height: auto; display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
#tl-pane .tl-dw b.zh { font-size: 1.35rem; line-height: 1.2; flex: none; }
#tl-pane .tl-dw span { flex: 1; min-width: 0; display: block; }
#tl-pane .tl-dw em { display: inline; font-style: normal; font-weight: 700; color: #c8553d; margin-right: 6px; }
#tl-pane .tl-dw span > small { color: var(--muted); }
#tl-pane .tl-dv { display: block; margin-top: 3px; line-height: 1.35; color: var(--fg); opacity: .85; }
#tl-pane .tl-top { border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
#tl-pane .tl-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: color-mix(in srgb, var(--fg) 6%, var(--card)); align-self: flex-start; }
#tl-pane .tl-tabs button { border: 0; background: none; box-shadow: none; min-height: 0; padding: 6px 14px; border-radius: 999px; font-weight: 800; color: var(--muted); cursor: pointer; }
#tl-pane .tl-tabs button.on { background: #c8553d; color: #fff; }
#tl-pane .tl-ml { flex: 1; min-height: 160px; }
#tl-pane .tl-th, #tl-pane .tl-fr { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); background: none; box-shadow: none; border-radius: 0; min-height: 0; text-align: left; cursor: pointer; }
#tl-pane .tl-th:hover { background: color-mix(in srgb, #f3b04c 10%, transparent); }
#tl-pane .tl-av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: color-mix(in srgb, var(--t-peach, #f6c7a8) 80%, var(--card)); flex: none; }
#tl-pane .tl-tt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#tl-pane .tl-tt small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tl-pane .tl-th.un .tl-tt b, #tl-pane .tl-th.un .tl-tt small { color: var(--fg); font-weight: 800; }
#tl-pane .tl-tm { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: .75rem; color: var(--muted); flex: none; }
#tl-pane .tl-tm i { font-style: normal; background: #e0623a; color: #fff; border-radius: 99px; padding: 0 7px; font-weight: 800; }
#tl-pane .tl-req { width: calc(100% - 32px); margin: 10px 16px 0; display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 14px; border: 1.5px dashed #e0a82e; background: color-mix(in srgb, #f3b04c 12%, var(--card)); font-weight: 800; cursor: pointer; min-height: 0; }
#tl-pane .tl-sh { margin: 12px 16px 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#tl-pane .tl-fr { cursor: default; }
#tl-pane .sm { min-height: 34px; padding: 0 10px; border-radius: 10px; font-size: .85rem; }
#tl-pane .tl-cm { flex: 1; min-height: 240px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; background: color-mix(in srgb, var(--fg) 3%, var(--card)); }
#tl-pane .tl-b { max-width: 80%; align-self: flex-start; padding: 8px 12px; border-radius: 16px 16px 16px 4px; background: var(--card); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; }
#tl-pane .tl-b.me { align-self: flex-end; border-radius: 16px 16px 4px 16px; background: color-mix(in srgb, #f3b04c 28%, var(--card)); border-color: #e0a82e; }
#tl-pane .tl-b small { display: block; font-size: .7rem; color: var(--muted); margin-top: 2px; }
#tl-pane .tl-send { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
#tl-pane .tl-pad .tl-send { padding: 0; border: 0; }
#tl-pane .tl-send input { flex: 1; min-width: 0; }
#tl-pane .tl-send button { flex: none; }
#tl-pane .tl-qh { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#tl-pane .tl-qh small { display: block; color: var(--muted); }
#tl-pane .tl-qn b { font-size: 1.8rem; font-weight: 900; }
#tl-pane .tl-qbar { display: flex; gap: 6px; margin: 10px 0; }
#tl-pane .tl-qbar i { flex: 1; height: 8px; border-radius: 99px; background: var(--line); }
#tl-pane .tl-qbar i.on { background: #3f8f5a; }
#tl-pane .tl-ql { display: flex; flex-direction: column; gap: 8px; max-height: 420px; }
#tl-pane .tl-q { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; min-height: 0; }
#tl-pane .tl-q.next { border-color: #c98320; box-shadow: 0 0 0 2px color-mix(in srgb, #f3b04c 35%, transparent); }
#tl-pane .tl-q.ok { opacity: .65; }
#tl-pane .tl-qi { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, #f3b04c 18%, var(--card)); flex: none; }
#tl-pane .tl-q.ok .tl-qi { background: color-mix(in srgb, #3f8f5a 20%, var(--card)); color: #3f8f5a; }
#tl-pane .tl-qt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#tl-pane .tl-qt small { color: var(--muted); font-size: .78rem; }
#tl-pane .tl-q em { font-style: normal; color: var(--muted); font-size: .8rem; flex: none; }
@media (max-width: 899px) {
  #tl { right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); }
  #tl .tl-fab { width: 50px; height: 50px; }
  #tl-pane { right: 8px; left: 8px; width: auto; bottom: calc(86px + env(safe-area-inset-bottom)); max-height: calc(100vh - 170px); }
  #tl-pane.tl-modal, #tl-pane.tl-modal.tl-wide { left: 8px; right: 8px; top: auto; bottom: calc(86px + env(safe-area-inset-bottom)); transform: none; width: auto; }
  html.tl-open #tl .tl-menu { display: none; }
}

/* ph12: Bảng xếp hạng Trang chủ màu cam san hô như AIO + hàng giải đấu */
.tone-coral { --tbg: #f8c9b8; --acc: #ec8b6c; }
:root[data-theme="dark"] .tone-coral { --tbg: #5a3a33; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tone-coral { --tbg: #5a3a33; } }
.hrank.tone-coral { background-color: var(--tbg); background-image: linear-gradient(color-mix(in srgb, #fff 18%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, #fff 18%, transparent) 1px, transparent 1px); background-size: 22px 22px; }
.hrank .rkpod .rkstep, .hrank .rkp .rkstep { background: #f2a58c !important; color: #8e2f1a !important; }
.hrank .lrow { background: color-mix(in srgb, var(--card) 72%, var(--tbg)) !important; }
.hrank .hrk-tabs button.on { background: #d9573a !important; color: #fff !important; }
.hrk-lg { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 0 0 12px; border-radius: 20px; background: color-mix(in srgb, var(--card) 75%, transparent); }
.hrk-lg .hrk-lgn { display: flex; align-items: center; gap: 8px; flex: none; }
.hrk-lg .hrk-lgn .lgem, .hrk-lg .hrk-lgn > svg { width: 40px; height: 40px; }
.hrk-lg .hrk-lgn small { display: block; font-size: .72rem; color: var(--muted); }
.hrk-lg .hrk-lgn b { font-weight: 900; }
.hrk-lg .lgrow { flex: 1; min-width: 0; margin: 0; padding: 4px 2px; background: none; box-shadow: none; border-radius: 0; justify-content: flex-end; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.hrk-lg .lgrow::-webkit-scrollbar { display: none; }
.hrk-lg .lgt { flex: none; }
.hrk-lg .lgt .lgem { width: 28px; height: 28px; }
@media (max-width: 640px) { .hrk-lg { flex-direction: column; align-items: stretch; } .hrk-lg .lgrow { justify-content: flex-start; } }

/* ph12: Lộ trình Trang chủ theo chương (gọn, không chồng chữ) */
.hroad .hrd-u { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 14px; background: color-mix(in srgb, var(--card) 85%, transparent); border: 0; }
.hroad .hrd-u .hrd-ut { display: block; min-width: 0; }
.hroad .hrd-u .hrd-ut small, .hroad .hrd-u .hrd-ut b { display: block; position: static; }
.hroad .hrd-u .hrd-ut small { font-size: .72rem; line-height: 1.2; }
.hroad .hrd-u .hrd-ut b { line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hroad .hrd-u em .ic, .hroad .hrd-u em svg { width: 16px; height: 16px; vertical-align: -3px; }
.hroad .hrd-u.cur { outline: 0; background: #7a5a2c; color: #fff; }
.hroad .hrd-u.cur small { color: rgba(255, 255, 255, .8); }

/* ph12: Trang Lộ trình chế độ Kiến thức kiểu AIO */
.rd-kn2 { display: flex; flex-direction: column; gap: 18px; }
.rd-top { --lcd: #3f8f5a; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 18px 26px; align-items: start; }
.rd-lvcs { display: flex; flex-wrap: wrap; gap: 8px; }
.rd-lvc { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; min-height: 36px; border-radius: 999px; border: 1.5px solid transparent; background: var(--card); font-weight: 800; }
.rd-lvc .ic, .rd-lvc svg { width: 15px; height: 15px; color: #3f8f5a; }
.rd-lvc.on { border-color: #3f8f5a; color: #2f6f45; }
.rd-lvc[disabled] { opacity: .45; }
.rd-pct { display: flex; align-items: baseline; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.rd-pct > b { font-size: clamp(2.6rem, 6vw, 3.6rem); line-height: 1; font-weight: 900; }
.rd-top .rd-barlb { justify-content: flex-end; padding-right: 14%; }
.rd-tr { display: flex; flex-direction: column; gap: 10px; }
.rd-st2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rd-st2 > div { padding: 10px 14px; border-radius: 16px; background: color-mix(in srgb, var(--card) 80%, transparent); }
.rd-st2 small { display: block; color: var(--muted); font-size: .8rem; }
.rd-st2 b { font-size: 1.5rem; font-weight: 900; } .rd-st2 b span { font-size: .85rem; color: var(--muted); font-weight: 700; }
.rd-line { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border-radius: 16px; background: color-mix(in srgb, var(--card) 80%, transparent); }
.rd-line .rd-li { flex: none; color: #3f8f5a; display: grid; }
.rd-line .rd-lt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rd-line .rd-lt small { color: var(--muted); font-size: .8rem; }
.rd-do { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; min-height: 38px; border-radius: 999px; border: 1.5px solid #3f8f5a; background: var(--card); font-weight: 800; }
.rd-gedit { padding: 0 4px; } .rd-gedit .rd-goals { margin-top: 6px; }
.rd-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 18px; align-items: start; }
.rd-ch { display: flex; flex-direction: column; gap: 14px; }
.rd-chh { display: flex; align-items: flex-start; gap: 12px; }
.rd-chi { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--acc, #9bbcee) 30%, var(--card)); }
.rd-cht { flex: 1; min-width: 0; } .rd-cht small { color: var(--muted); font-weight: 700; }
.rd-cht h3 { margin: 2px 0 0; font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 900; line-height: 1.25; }
.rd-chn { flex: none; text-align: right; } .rd-chn b { font-size: 1.7rem; font-weight: 900; } .rd-chn b span { font-size: 1rem; } .rd-chn small { display: block; color: var(--muted); font-size: .78rem; }
.rd-cis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rd-ci { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 14px; min-height: 64px; border-radius: 16px; border: 2px solid transparent; background: color-mix(in srgb, var(--fg) 4%, var(--card)); }
.rd-ci .rd-ri { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.rd-ci .rd-rt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rd-ci .rd-rt small { color: var(--muted); font-size: .78rem; }
.rd-ci .rd-rt b { font-weight: 800; line-height: 1.3; } .rd-ci .rd-rt b i { font-style: normal; font-weight: 600; color: var(--muted); }
.rd-ci em { flex: none; font-style: normal; font-weight: 800; font-size: .8rem; padding: 5px 12px; border-radius: 999px; background: #1f4f7a; color: #fff; }
.rd-ci.now { border-color: #2d6aa3; background: var(--card); }
.rd-ci.done .rd-ri { background: #3f8f5a; color: #fff; border-color: #3f8f5a; }
.rd-chnav { display: flex; justify-content: space-between; gap: 8px; }
.rd-chnav button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; font-weight: 700; }
.rd-mlc { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 76px; max-height: calc(100vh - 96px); }
.rd-mlh { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rd-mlh h3 { margin: 0; font-weight: 900; font-size: 1.35rem; } .rd-mlh small { color: var(--muted); }
.rd-mll { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.rd-mi { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; text-align: left; padding: 9px 14px; border-radius: 14px; border: 0; background: color-mix(in srgb, var(--card) 85%, transparent); min-height: 0; }
.rd-mi .rd-mit { display: block; min-width: 0; } .rd-mi small, .rd-mi b { display: block; }
.rd-mi small { font-size: .75rem; color: var(--muted); } .rd-mi b { font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.rd-mi em { font-style: normal; font-weight: 800; font-size: .85rem; } .rd-mi em svg, .rd-mi em .ic { width: 16px; height: 16px; color: #3f8f5a; }
.rd-mi.on { background: #7a5a2c; color: #fff; } .rd-mi.on small { color: rgba(255, 255, 255, .8); } .rd-mi.on em svg { color: #fff; }
@media (max-width: 1000px) { .rd-top { grid-template-columns: minmax(0, 1fr); } .rd-main { grid-template-columns: minmax(0, 1fr); } .rd-mlc { position: static; max-height: none; } .rd-mll { max-height: 340px; } }
@media (max-width: 640px) { .rd-cis { grid-template-columns: minmax(0, 1fr); } .rd-chn b { font-size: 1.3rem; } .rd-ci { min-height: 56px; padding: 8px 12px; } .rd-pct > b { font-size: 2.4rem; } }

/* ph12: Cửa hàng trên điện thoại: Gương Thần luôn ở dạng gọn và vẫn thấy rõ nhân vật đang thử */
@media (max-width: 640px) {
  .fit.mini { flex-direction: row !important; align-items: center; gap: 12px; padding: 8px 12px; }
  .fit.mini .fitfig, .shopstick .fit.mini .fitfig { width: 84px !important; max-width: 84px !important; min-height: 84px; margin: 0; padding: 4px; border-radius: 16px; flex: none; }
  .fit.mini .fitfig .pffull, .fit.mini .fitfig svg { width: 100% !important; height: auto !important; display: block; }
  .fit.mini .fitinfo { flex: 1; min-width: 0; gap: 6px; }
  .fit.mini .fithead b { font-size: 1.02rem; }
  .fit.mini .row, .fit.mini .fitbtns { flex-wrap: wrap; gap: 6px; }
  .fit.mini .row button, .fit.mini .fitbtns button { padding: 6px 10px; min-height: 34px; font-size: .82rem; }
  .fit.mini .fittry, .fit.mini .fitchips { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px; }
  .fit.mini .fittry > * { flex: none; }
  .shopsecs, .shopstick .shoptabs, .shopkho .shopmain .shopsecs { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto !important; overflow-y: hidden !important; max-height: none !important; scrollbar-width: none; gap: 6px; padding-bottom: 4px; }
  .shopsecs::-webkit-scrollbar { display: none; }
  .shopsecs > *, .shopstick .shoptabs > * { flex: none !important; width: auto !important; white-space: nowrap; }
}

/* ph12: Nút trợ lý nổi kiểu AIO: viên thuốc lớn xếp dọc phía trên một nút linh vật dạng thuôn có chấm kéo */
#tl { gap: 12px; }
#tl .tl-fab { width: 62px; height: 92px; border-radius: 31px; padding: 22px 6px 8px; background: #f4d46a; border: 0; box-shadow: 0 10px 24px -10px rgba(60, 45, 10, .55); display: flex; align-items: flex-end; justify-content: center; }
#tl .tl-fab::before { content: ""; position: absolute; top: 10px; left: 50%; width: 12px; height: 16px; transform: translateX(-50%); background: radial-gradient(circle, rgba(70, 50, 10, .45) 1.6px, transparent 2.2px) 0 0 / 6px 5.4px; }
#tl .tl-fab .tl-face { width: 48px; height: 48px; }
#tl .tl-menu { min-width: 290px; gap: 12px; }
#tl .tl-mi { padding: 15px 22px; font-size: 1.05rem; border-width: 2px; border-color: color-mix(in srgb, var(--fg) 10%, transparent); background: color-mix(in srgb, #fff8e6 80%, var(--card)); box-shadow: 0 10px 26px -14px rgba(40, 30, 10, .55); }
#tl .tl-mi:hover, #tl .tl-mi:focus-visible { border-color: #2d6aa3; }
#tl .tl-mi svg { width: 22px; height: 22px; }
@media (max-width: 899px) {
  #tl .tl-fab { width: 54px; height: 80px; border-radius: 27px; padding-top: 20px; }
  #tl .tl-fab .tl-face { width: 42px; height: 42px; }
  #tl .tl-menu { min-width: min(290px, calc(100vw - 90px)); position: absolute; right: 62px; bottom: 0; }
  #tl .tl-mi { padding: 13px 18px; font-size: 1rem; }
}

/* ph12: Bảng điều khiển */
.ow2 { display: flex; flex-direction: column; gap: 16px; }
.ow-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 20px 24px; border-radius: 28px; background: linear-gradient(120deg, #fde7c8, #f8cfa0); box-shadow: 0 6px 0 rgba(224, 160, 90, .25); }
:root[data-theme="dark"] .ow-hero { background: linear-gradient(120deg, #4f3d3f, #5a4433); }
.ow-ht small { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); }
.ow-ht h1 { margin: 4px 0 0; font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 900; }
.ow-stats { display: grid; grid-template-columns: repeat(4, minmax(78px, 1fr)); gap: 10px; }
.ow-stats > div { padding: 10px 14px; border-radius: 18px; background: color-mix(in srgb, var(--card) 85%, transparent); text-align: center; }
.ow-stats b { display: block; font-size: 1.6rem; font-weight: 900; line-height: 1.1; }
.ow-stats small { color: var(--muted); font-size: .78rem; }
.ow-nav { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; position: sticky; top: 64px; z-index: 5; padding: 4px 0; }
.ow-nav::-webkit-scrollbar { display: none; }
.ow-nav button { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); font-weight: 800; min-height: 40px; }
.ow-nav button:hover { border-color: #e8962e; }
.ow-modes .panel { border-radius: 22px; }
.ow-bugl { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.ow-bug { padding: 10px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); }
.ow-bugh { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; } .ow-bugh small { color: var(--muted); }
.ow-bug p { margin: 6px 0 0; white-space: pre-wrap; }
@media (max-width: 640px) { .ow-hero { padding: 16px; } .ow-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; } }
.rd-mi, .hroad .hrd-u, .rd-ci { height: auto !important; max-height: none !important; line-height: 1.25; }
.rd-mi small, .hroad .hrd-u small { margin-bottom: 2px; }
.rd-lvcs { gap: 6px; } .rd-lvc { padding: 5px 12px; }
.rd-mi, .hroad .hrd-u { flex: none !important; }

/* ph13: Khung "Chọn cách học" kiểu AIO (sau Ôn nhiều Unit) */
.cw-bg { align-items: center; }
.sheet.cw { width: min(560px, calc(100vw - 24px)); padding: 22px 24px; border-radius: 28px; display: flex; flex-direction: column; gap: 16px; }
.cw-h { display: flex; align-items: center; justify-content: space-between; } .cw-h b { font-size: 1.5rem; font-weight: 900; }
.cw-info { padding: 14px 18px; border-radius: 16px; background: color-mix(in srgb, #e8962e 28%, var(--card)); }
.cw-info b { display: block; font-weight: 900; } .cw-info small { color: var(--muted); font-weight: 700; }
.cw-opts { display: flex; flex-direction: column; gap: 12px; }
.cw-o { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--card); text-align: left; min-height: 0; }
.cw-o .cw-i { flex: none; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, #e8962e 22%, var(--card)); }
.cw-o .cw-i .ic { width: 26px; height: 26px; }
.cw-o b { display: block; font-size: 1.15rem; font-weight: 900; } .cw-o small { color: var(--muted); }
.cw-o.on { background: #8a6a2e; border-color: #8a6a2e; color: #fff; } .cw-o.on small { color: rgba(255, 255, 255, .85); } .cw-o.on .cw-i { background: rgba(0, 0, 0, .18); color: #fff; }
.cw-o[disabled] { opacity: .5; }
.cw-f { display: flex; justify-content: flex-end; gap: 10px; }
.cw-go { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 999px; border: 2px solid #8a6a2e; background: var(--card); font-weight: 900; }

/* ph13: Bảng chọn minigame đẹp hơn: thẻ lưới có icon lớn */
.rv-bg .sheet { width: min(760px, calc(100vw - 24px)); border-radius: 28px; padding: 20px 22px; }
.rv-bg .games { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.rv-bg .gbtn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--card); text-align: left; min-height: 74px; box-shadow: 0 4px 0 rgba(120, 100, 50, .08); transition: transform .12s, border-color .12s; }
.rv-bg .gbtn:hover { transform: translateY(-2px); border-color: #e8962e; }
.rv-bg .gbtn .gi { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, #e8962e 20%, var(--card)); font-size: 1.4rem; }
.rv-bg .gbtn .gi .ic { width: 24px; height: 24px; }
.rv-bg .gbtn > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rv-bg .gbtn b { font-weight: 900; } .rv-bg .gbtn small { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.rv-bg .gbtn .gs { flex: none; }
@media (max-width: 640px) { .rv-bg .games { grid-template-columns: minmax(0, 1fr); } .sheet.cw { padding: 18px; } .cw-o .cw-i { width: 46px; height: 46px; } }

/* ph13: Lộ trình: nút Ôn nhiều Unit tổng hợp trên mục lục */
.rd-mu { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 18px; border: 0; background: #7a5a2c; color: #fff; min-height: 0; }
.rd-mu > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; } .rd-mu small { opacity: .85; font-size: .8rem; }
.rd-mu .rd-mui { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: rgba(255, 255, 255, .18); }

/* ph13: Luyện từ vựng: thanh tiêu đề giống Luyện ngữ pháp */
.fc-hero .ly-hh .ottabs { position: relative; z-index: 1; margin: 0; }
.fc-hero .glsum { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.fc-hero .glsum .stbar { flex: 1 1 200px; margin: 0; } .fc-hero .glsum small { font-weight: 800; color: var(--muted); }
.fc-hero .glsum .ghost { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; } .fc-hero .glsum .ic { width: 16px; height: 16px; }
.otfil .ppill .ic { width: 13px; height: 13px; vertical-align: -2px; }
@media (max-width: 640px) { .fc-hero .ly-hh .ottabs { width: 100%; } .fc-hero .idtabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .fc-hero .idtabs > * { flex: none; } }

/* ph13: Bảng điều khiển: Cảnh báo thu gọn, ô tự chỉnh tài nguyên, học viên mới */
.ow-alw { border-radius: 22px; background: var(--card); border: 1px solid var(--line); }
.ow-alw > summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; font-weight: 900; font-size: 1.05rem; list-style: none; }
.ow-alw > summary::-webkit-details-marker { display: none; }
.ow-alw > summary small { margin-left: auto; color: var(--muted); font-weight: 700; font-size: .82rem; }
.ow-alw[open] > summary small { display: none; }
.ow-aln { font-style: normal; min-width: 26px; padding: 2px 9px; border-radius: 999px; background: #e0623a; color: #fff; font-size: .82rem; text-align: center; }
.ow-aln:empty { display: none; }
.ow-alw #ow-alerts { padding: 0 14px 14px; max-height: 420px; overflow-y: auto; }
.ow-self { margin: 10px 0; padding: 12px 14px; border-radius: 16px; border: 1.5px dashed #e8962e; background: color-mix(in srgb, #e8962e 10%, var(--card)); display: flex; flex-direction: column; gap: 8px; }
.ow-self[hidden] { display: none; }
.ow-self > b { display: flex; align-items: center; gap: 6px; }
.ow-newl { display: flex; flex-direction: column; gap: 8px; max-height: 520px; overflow-y: auto; }
.ow-nw { border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
.ow-nw > summary { padding: 10px 14px; cursor: pointer; display: flex; flex-direction: column; } .ow-nw > summary small { color: var(--muted); }
.ow-nw dl { margin: 0; padding: 4px 14px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.ow-nw dt { font-size: .75rem; color: var(--muted); font-weight: 700; } .ow-nw dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

/* ph13: Màn chào mừng cho tài khoản mới */
html.wl-open { overflow: hidden; }
html.wl-open #tl, html.wl-open #tl-pane { display: none !important; }
#welcome { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 16px; background: rgba(40, 34, 20, .55); backdrop-filter: blur(4px); }
.wl-card { width: min(640px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--card); color: var(--fg); border-radius: 28px; box-shadow: 0 30px 70px -20px rgba(30, 20, 5, .6); overflow: hidden; }
.wl-top { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: color-mix(in srgb, #f3b04c 22%, var(--card)); }
.wl-mas { flex: none; width: 52px; height: 52px; } .wl-mas svg { width: 100%; height: 100%; display: block; }
.wl-steps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; } .wl-steps small { font-weight: 800; color: var(--muted); }
.wl-bar { display: block; height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--fg) 10%, transparent); overflow: hidden; } .wl-bar u { display: block; height: 100%; border-radius: 99px; background: #e8962e; transition: width .3s ease; }
.wl-skip { flex: none; background: none; border: 0; box-shadow: none; min-height: 0; padding: 6px 4px; font-weight: 800; color: var(--muted); }
.wl-body { padding: 18px 22px 6px; overflow-y: auto; overscroll-behavior: contain; }
.wl-body h2 { margin: 0 0 4px; font-size: clamp(1.3rem, 4vw, 1.7rem); font-weight: 900; line-height: 1.25; }
.wl-sub { margin: 0 0 14px; color: var(--muted); }
.wl-q { margin: 0 0 16px; } .wl-q > label { display: block; font-weight: 900; margin-bottom: 8px; } .wl-q > label small { font-weight: 600; color: var(--muted); }
.wl-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wl-chips button { padding: 8px 14px; min-height: 40px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); font-weight: 800; }
.wl-chips button.on, .wl-big button.on { background: #8a6a2e; border-color: #8a6a2e; color: #fff; }
.wl-big { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.wl-big button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 14px 16px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--card); min-height: 0; }
.wl-big button b { font-size: 1.1rem; font-weight: 900; } .wl-big button small { color: inherit; opacity: .75; } .wl-big button .zh { font-size: 1.6rem; line-height: 1.2; }
.wl-eta { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, #3f8f5a 14%, var(--card)); margin: 6px 0 14px; }
.wl-eta .ic { flex: none; width: 20px; height: 20px; color: #3f8f5a; }
.wl-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin-bottom: 14px; }
.wl-form label { display: flex; flex-direction: column; gap: 4px; } .wl-form label.wide { grid-column: 1 / -1; } .wl-form span { font-weight: 800; font-size: .85rem; }
.wl-form input { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--fg); font: inherit; }
.wl-sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.wl-sum > div { padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--fg) 4%, var(--card)); } .wl-sum small { display: block; color: var(--muted); font-size: .78rem; } .wl-sum b { font-weight: 800; }
.wl-note { margin: 0 22px; color: #b4532a; font-weight: 700; }
.wl-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.wl-foot .primary { display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; }
@media (max-width: 640px) {
  #welcome { padding: 0; place-items: end stretch; }
  .wl-card { width: 100%; max-height: 100dvh; border-radius: 24px 24px 0 0; }
  .wl-body { padding: 16px 16px 4px; } .wl-top { padding: 12px 16px; } .wl-mas { width: 44px; height: 44px; }
  .wl-big, .wl-form, .wl-sum { grid-template-columns: minmax(0, 1fr); } .wl-form label { grid-column: auto; }
}

/* ph13: ổ khoá trên huy hiệu giải đấu chưa mở nằm giữa huy hiệu */
.lgt.lock .lk, .wr-em.lock .lk { position: absolute; left: 50%; top: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); width: 14px; height: 14px; color: #5b5b66; background: color-mix(in srgb, var(--card) 85%, transparent); border-radius: 50%; padding: 2px; box-sizing: content-box; }

/* ph13: Kết quả giải đấu tuần (kiểu Duolingo) */
.wr-bg { align-items: center; }
.sheet.wr { width: min(460px, calc(100vw - 24px)); padding: 22px 20px 18px; border-radius: 28px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.wr-ems { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 4px; }
.wr-em { position: relative; display: grid; place-items: center; }
.wr-em .lgem, .wr-em > svg { width: 62px; height: 62px; }
.wr-em.mid .lgem, .wr-em.mid > svg { width: 108px; height: 108px; filter: drop-shadow(0 8px 14px rgba(60, 40, 10, .25)); animation: wrpop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.wr-em.side { opacity: .9; } .wr-em.lock .lgem, .wr-em.lock > svg { opacity: .45; filter: grayscale(1); }
.wr-em.none { width: 62px; }
@keyframes wrpop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet.wr h2 { margin: 4px 0 0; font-size: 1.35rem; font-weight: 900; line-height: 1.3; }
.wr-sub { margin: 0; color: var(--muted); }
.wr-list { text-align: left; border: 1.5px solid var(--line); border-radius: 18px; overflow: hidden; }
.wr-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.wr-row:last-child { border-bottom: 0; }
.wr-row.me { background: color-mix(in srgb, #e8962e 24%, var(--card)); }
.wr-n { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-weight: 900; color: #3f8f5a; }
.wr-n.m1 { background: #f6c945; color: #7a5500; } .wr-n.m2 { background: #cfd6e0; color: #4a5566; } .wr-n.m3 { background: #e9a46a; color: #6a3a12; }
.wr-av { flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--card); }
.wr-av > * { width: 100%; height: 100%; }
.wr-nk { flex: 1; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wr-row em { flex: none; font-style: normal; font-weight: 800; color: var(--muted); }
.wr-zone, .wr-gap { padding: 8px; text-align: center; font-weight: 900; font-size: .85rem; letter-spacing: .04em; color: #3f8f5a; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: center; gap: 6px; }
.wr-zone .ic { width: 16px; height: 16px; } .wr-gap { color: var(--muted); }
.wr-go { width: 100%; justify-content: center; padding: 12px; font-size: 1.05rem; }
.sheet.wr.down h2 { color: #b4532a; }
.rv-bg .gbtn { position: relative; display: flex !important; align-items: center; padding-right: 14px; }
.rv-bg .gbtn > span:nth-child(2) { flex: 1 1 auto !important; width: auto !important; max-width: none !important; padding-right: 54px; }
.rv-bg .gbtn small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rv-bg .gbtn .gs { position: absolute; top: 10px; right: 10px; transform: scale(.75); transform-origin: top right; }
.lgt.lock .lk, .wr-em.lock .lk { z-index: 1; }
.wr-em.lock .lk { width: 20px; height: 20px; }
.lgt.lock > svg.lk, .wr-em.lock > svg.lk, .wr-em.lock svg.lk { opacity: 1 !important; filter: none !important; }
@media (max-width: 640px) { .fc-hero .ly-hh .ottabs { display: flex; gap: 6px; } .fc-hero .ly-hh .ottabs > button { flex: 1; justify-content: center; padding: 8px 10px; font-size: .88rem; } }
/* ph14: nút Ôn nhiều Unit ở Lộ trình — chữ trắng rõ, không tràn */
.rd-mlc .rd-mu { width: 100%; height: auto !important; min-height: 64px; padding: 12px 14px; line-height: 1.3; color: #fff; }
.rd-mlc .rd-mu > span:nth-child(2) { min-width: 0; gap: 2px; }
.rd-mlc .rd-mu b { color: #fff !important; font-weight: 800; font-size: 1rem; }
.rd-mlc .rd-mu small { color: #fff !important; opacity: .82; font-size: .8rem; line-height: 1.3; white-space: normal; }
.rd-mlc .rd-mu .ic, .rd-mlc .rd-mu svg { color: #fff; flex: none; }
.rd-mlc .rd-mu:hover { background: #6a4c22; }
/* ph15: linh vật khỉ chibi — chuyển động */
.kblink { transform-box: fill-box; transform-origin: center; animation: kblink 3.4s infinite; }
@keyframes kblink { 0%, 45%, 51%, 100% { transform: scaleY(1); } 48% { transform: scaleY(.1); } }
.kbrand { overflow: visible; } .knod { transform-box: fill-box; transform-origin: 50% 100%; animation: knod 2.6s ease-in-out infinite; }
@keyframes knod { 0%, 70%, 100% { transform: rotate(0); } 80% { transform: rotate(-7deg); } 90% { transform: rotate(7deg); } }
#tl .tl-fab:hover .knod { animation-duration: .9s; }
.wl-hero { display: flex; justify-content: center; margin: -4px 0 4px; } .wl-hero .kfull { width: 120px; height: 154px; overflow: visible; filter: drop-shadow(0 4px 6px rgba(90, 60, 30, .18)); }
.kfull .ktail { transform-box: fill-box; transform-origin: 0% 100%; animation: ktail 1.6s ease-in-out infinite; }
@keyframes ktail { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(10deg); } }
.kfull .kwave { transform-box: fill-box; transform-origin: 20% 100%; animation: kwave .8s ease-in-out infinite; }
@keyframes kwave { 0%, 100% { transform: rotate(-18deg); } 50% { transform: rotate(22deg); } }
.k-stand .kbody, .k-wave .kbody { animation: kbob 1.6s ease-in-out infinite; }
@keyframes kbob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.k-jump .kbody { animation: kjump 1.2s cubic-bezier(.3, .6, .4, 1) infinite; }
@keyframes kjump { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-18px); } }
.kfull .karmL, .kfull .karmR { transform-box: fill-box; transform-origin: 50% 100%; animation: karm 1.2s ease-in-out infinite; }
.kfull .karmR { animation-direction: reverse; }
@keyframes karm { 0%, 100% { transform: rotate(-8deg); } 45% { transform: rotate(10deg); } }
@media (prefers-reduced-motion: reduce) { .kblink, .knod, .kfull * { animation: none !important; } }
@media (max-width: 640px) { .wl-hero .kfull { width: 92px; height: 118px; } }
/* ph17: khỉ ló đầu trên nút Điểm danh */
.dck-w { position: relative; display: inline-flex; }
.dck-w .kpeek { position: absolute; width: 72px; height: 64px; left: 50%; bottom: calc(100% - 11px); transform: translateX(-50%); pointer-events: none; z-index: 3; overflow: visible; filter: drop-shadow(0 0 0 #fff) drop-shadow(0 2px 3px rgba(90, 60, 30, .2)); }
.dck-w .kpeek .kpk { stroke-linejoin: round; }
.dck-w .kpaw { transform-box: fill-box; transform-origin: center; animation: kpaw 2.4s ease-in-out infinite; } .dck-w .kpaw.k2 { animation-delay: .2s; }
@keyframes kpaw { 0%, 80%, 100% { transform: translateY(0); } 88% { transform: translateY(-4px); } }
.dck-w:hover .kpeek .kpk { animation: kpop .5s ease; } @keyframes kpop { 50% { transform: translateY(-5px); } }
.dck-w .dcheck { position: relative; z-index: 2; }
@media (max-width: 640px) { .dck-w .kpeek { width: 60px; height: 53px; left: calc(100% + 6px); transform: none; bottom: 4px; } }
/* ph17: thanh chào kiểu AIO */
.dtop.dtop2 { display: block; padding: 18px 20px 16px; }
.dtop2 .dhi { margin: 0 0 12px; font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 900; letter-spacing: -.01em; }
.dtop2 .dbar { display: flex; align-items: center; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 8px 10px 8px 8px; box-shadow: 0 2px 0 color-mix(in srgb, var(--line) 70%, transparent); }
.dtop2 .dcal { flex: none; width: 128px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; text-align: left; }
.dtop2 .dcal small { display: block; background: #f6b9a8; color: #8a2e1c; font-weight: 800; font-size: .72rem; text-align: center; padding: 2px 0; }
.dtop2 .dcal span { display: flex; align-items: baseline; gap: 8px; padding: 4px 12px 6px; } .dtop2 .dcal b { font-size: 1.55rem; font-weight: 900; line-height: 1; } .dtop2 .dcal em { font-style: normal; font-weight: 700; font-size: .9rem; }
.dtop2 .dsk2 { flex: none; display: flex; align-items: center; gap: 10px; padding: 4px 16px 4px 14px; background: none; border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; min-height: 0; cursor: pointer; text-align: left; }
.dtop2 .dsk2 .dfl { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--fg) 7%, var(--card)); color: var(--muted); }
.dtop2 .dsk2 .dfl.on { background: #fde2cf; color: #e8622a; } .dtop2 .dsk2 .dfl svg { width: 22px; height: 22px; }
.dtop2 .dskt { display: flex; flex-direction: column; } .dtop2 .dskt b { font-weight: 800; } .dtop2 .dskt small { color: var(--muted); font-size: .78rem; }
.dtop2 .ddots { flex: 1; display: flex; justify-content: space-around; gap: 4px; padding: 0 10px; min-width: 0; }
.dtop2 .dd { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; padding: 0; min-width: 28px; }
.dtop2 .dd small { font-weight: 800; font-size: .8rem; color: var(--fg); } .dtop2 .dd i { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--fg) 12%, transparent); transform: scale(.45); transition: transform .2s; }
.dtop2 .dd.now i { transform: none; background: none; border: 2.5px solid #e0623a; }
.dtop2 .dd.on i { transform: none; background: #3f9a62; border: 0; color: #fff; } .dtop2 .dd.on i svg { width: 12px; height: 12px; }
.dtop2 .dwn { flex: none; display: flex; flex-direction: column; padding: 0 16px; border-left: 1px solid var(--line); } .dtop2 .dwn small { color: var(--muted); font-size: .78rem; } .dtop2 .dwn b { font-weight: 800; }
.dtop2 .dck-w { flex: none; } .dtop2 .dcheck { padding: 10px 26px; border-radius: 12px; font-size: 1rem; background: #d9573f; box-shadow: 0 3px 0 #a83a26; }
.dtop2 .dcheck.done { background: #3f9a62; box-shadow: 0 3px 0 #2e6e43; animation: none; }
@media (max-width: 1100px) { .dtop2 .dbar { flex-wrap: wrap; row-gap: 10px; } .dtop2 .ddots { order: 5; flex-basis: 100%; } }
@media (max-width: 640px) {
  .dtop.dtop2 { padding: 14px 12px 12px; } .dtop2 .dhi { font-size: 1.3rem; }
  .dtop2 .dbar { padding: 8px; } .dtop2 .dcal { width: 96px; } .dtop2 .dcal b { font-size: 1.25rem; } .dtop2 .dcal em { font-size: .78rem; }
  .dtop2 .dsk2 { padding: 4px 8px; border-right: 0; flex: 1; } .dtop2 .dwn { display: none; }
  .dtop2 .ddots { padding: 4px 0 0; } .dtop2 .dck-w { order: 6; flex-basis: 100%; display: flex; } .dtop2 .dcheck { flex: 1; justify-content: center; }
  .dtop2 .dck-w .kpeek { left: auto; right: 10px; bottom: calc(100% - 10px); width: 56px; height: 50px; transform: none; }
}
.dtop2 .dd:not(.now) i { border: 0; box-shadow: none; } .dtop2 .dcal em { white-space: nowrap; }
@media (max-width: 640px) { .dtop2 .dck-w { order: 4; margin-top: 6px; } .dtop2 .ddots { order: 6; } }

/* ph19 (2026-11-23): rà điện thoại */
@media (max-width: 640px) {
  /* thanh XP trống dưới header không có chú thích, trông như lỗi: ẩn, cấp độ đã có ở trang Cá nhân */
  #app > header.top + .xpbar { display: none; }
  /* "Tuần này x/7 ngày" hiện lại, nằm gọn dưới hàng T2–CN */
  .dtop2 .dwn { display: flex; order: 7; flex-basis: 100%; flex-direction: row; justify-content: center; align-items: baseline; gap: 6px; padding: 2px 0 0; border: 0; }
  /* nút linh vật trợ lý nhỏ lại, sát mép để bớt che nội dung */
  #tl { right: 6px; }
  #tl .tl-fab { width: 46px; height: 64px; border-radius: 23px; padding: 16px 4px 6px; opacity: .96; }
  #tl .tl-fab::before { top: 6px; }
  #tl .tl-fab .tl-face { width: 36px; height: 36px; }
}
@media (max-width: 640px) {
  /* nút tốc độ đọc (0.75x) từng nằm chồng lên nút linh vật: đẩy lên trên nút linh vật */
  #spd, html.nf-badge #spd { bottom: calc(344px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  /* trong bài học, Gõ câu và các trang con có nút ←: ẩn nút linh vật để không che thanh Học/Ôn tập và danh sách từ */
  body:has(#app [data-act="item-nav"]) #tl, body:has(#app .tsl) #tl, body:has(#app .bbtn) #tl { display: none; }
}

/* ph20 (2026-11-28): dòng hạng Giải đấu tuần lướt ngang được. flex-end làm phần tràn bên trái không cuộn tới được → căn trái, đẩy sang phải bằng margin của huy hiệu đầu. Máy tính: kéo chuột / lăn chuột (js/app.js lgDrag). */
.hrk-lg .lgrow { justify-content: flex-start; scroll-behavior: smooth; cursor: grab; touch-action: pan-x; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; padding: 6px 4px; }
.hrk-lg .lgrow > .lgt:first-child { margin-left: auto; }
.hrk-lg .lgrow.drag { cursor: grabbing; scroll-behavior: auto; user-select: none; }
.hrk-lg .lgrow.drag * { pointer-events: none; }
/* ph20: Gương Thần — hình nhân vật (.pffull.fit) bị dính luật sticky của khung .fit (style.css) nên trượt xuống 34px, đè lên bảng tên. Trả về vị trí bình thường. */
.fitfig .pffull.fit { position: relative; top: auto; z-index: auto; box-shadow: none; margin-bottom: 0; }
.kst .kfig .fitplate { margin-top: 8px; }
/* ph20: Bảng tin trang chủ kéo dài bằng khung Xếp hạng (giống AIO): danh sách cuộn bên trong, nút "Mở Tiến độ & Bạn bè" nằm đáy */
@media (min-width: 901px) {
  .dgrid.a > .dfeed { display: flex; flex-direction: column; min-width: 0; }
  .dgrid.a > .dfeed #dash-feed { flex: 1 1 auto; min-height: 320px; position: relative; }
  .dgrid.a > .dfeed #dash-feed > .dscroll { position: absolute; inset: 0; max-height: none; }
  .dgrid.a > .dfeed .dmore { margin-top: auto; padding-top: 12px; flex: none; }
}

/* ===== Quyền riêng tư: đổi biệt danh + công tắc hiện tên (2026-11-28 rt1) ===== */
.mebtn .pvsub { display: block; font-size: .8rem; font-weight: 400; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.mebtn .pvsub.bad, .pvedit .pvhint.bad { color: #c0392b; }
.mebtn .pvname { font-style: normal; font-weight: 700; }
.mebtn.pvtog[disabled] { opacity: .65; cursor: default; }
.pvedit { display: grid; gap: 8px; padding: 14px; border-radius: 18px; background: color-mix(in srgb, var(--card) 82%, transparent); border: 1.5px solid color-mix(in srgb, var(--fg) 10%, transparent); }
.pvedit label { font-weight: 700; }
.pvedit .typein { width: 100%; box-sizing: border-box; }
.pvedit .pvhint { font-size: .8rem; color: var(--muted); line-height: 1.4; }
.pvedit .row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.bottag.pvhid { background: #e8eef9; color: #3d5a8a; }
.rnick.anon { cursor: default; }
html[data-theme="dark"] .mebtn .pvsub.bad, html[data-theme="dark"] .pvedit .pvhint.bad { color: #ff8a7a; }
html[data-theme="dark"] .bottag.pvhid { background: #2f3a52; color: #b9cdf2; }
