/* 🙋 TAB «TÔI» SẮP XẾP LẠI (20/11/2026) — docs/tab-toi-sap-xep.md
   Thanh neo dính · hero Bậc + Điểm · hàng «Bài tập của tôi» · hộp «Các bậc học» · hàng «Tải ứng dụng».
   Chỉ dùng màu sáng đang có của Cổng (Cổng chưa có chế độ tối). Vùng chạm ≥ 44px, hàng ≥ 64px. */

/* ---- thanh neo ---- */
.toi-neo { position: sticky; top: var(--an-top, 0px); z-index: 30; display: flex; gap: 6px; margin: 0 -16px 6px; padding: 8px 16px; background: rgba(250,245,233,.94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid #e8dcc0; }
.toi-neo button { flex: 1; min-height: 46px; border-radius: 99px; border: 1.5px solid #e2d4b3; background: #fffdf6; color: #3b3220; font: inherit; font-weight: 800; font-size: .92rem; cursor: pointer; white-space: nowrap; padding: 0 6px; }
.toi-neo button:active { transform: scale(.97); }
.toi-neo button.on { background: #eef1e1; border-color: #5f6e33; color: #46521f; }
.toi-neo button[hidden] { display: none; }
.toi-khu { scroll-margin-top: 66px; }
#pane-me #khu-cai-dat { scroll-margin-top: 66px; }
.toi-khu[hidden] { display: none; }

/* ---- hero: Bậc cạnh Điểm hệ thống ---- */
.toi-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; align-items: stretch; }
#toi-bac:empty, #points-card:empty { display: none; }
.toi-hero:has(#toi-bac:empty), .toi-hero:has(#points-card:empty) { grid-template-columns: 1fr; }
.toi-hero:has(#toi-bac:empty):has(#points-card:empty) { display: none; }
.toi-hero #points-card .points-card { height: 100%; margin-bottom: 0; padding: 12px; box-sizing: border-box; }
.toi-hero:has(#toi-bac:not(:empty)) #points-card .pc-top { gap: 8px; }
.toi-hero:has(#toi-bac:not(:empty)) #points-card .pc-coin img { width: 38px; height: 38px; }
.toi-hero:has(#toi-bac:not(:empty)) #points-card .pc-total { font-size: 1.5rem; }
.toi-hero:has(#toi-bac:not(:empty)) #points-card .pc-vnd { display: none; }
.toi-hero:has(#toi-bac:not(:empty)) #points-card .pc-label { font-size: .64rem; }
@media (max-width: 340px) { .toi-hero { grid-template-columns: 1fr !important; } }

.toi-bac-nut { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; width: 100%; height: 100%; box-sizing: border-box; padding: 12px; text-align: left; font: inherit; color: #3b3220; background: #fffdf6; border: 1px solid #e2d4b3; border-radius: 16px; cursor: pointer; box-shadow: 0 1px 2px rgba(84,68,32,.05), 0 10px 26px -18px rgba(84,68,32,.5); }
.toi-bac-nut:active { transform: scale(.98); background: #f4ecd8; }
.toi-bac-nut .nhan { font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #8a7f6a; }
.toi-bac-nut .gd { display: flex; align-items: center; gap: 10px; }
.toi-bac-nut .an { width: 44px; height: 44px; flex: none; border-radius: 13px; background: #a8452f; color: #fffdf6; display: grid; place-items: center; font-family: "Noto Serif TC", "Songti TC", "Noto Serif", serif; font-weight: 800; font-size: 1.4rem; }
.toi-bac-nut .ten { font-family: "Noto Serif", Cambria, Georgia, serif; font-weight: 800; font-size: 1.02rem; line-height: 1.2; }
.toi-bac-nut .tien { height: 8px; border-radius: 99px; background: #ece4d0; overflow: hidden; }
.toi-bac-nut .tien i { display: block; height: 100%; background: #5f6e33; border-radius: 99px; }
.toi-bac-nut small { font-size: .78rem; font-weight: 700; color: #5f6e33; }

/* ---- hàng «Bài tập của tôi» ---- */
.toi-hang { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 68px; padding: 10px 16px; margin: 0 0 14px; box-sizing: border-box; text-align: left; background: #fffdf6; color: #3b3220; border: 1px solid #e2d4b3; border-radius: 18px; font: inherit; cursor: pointer; box-shadow: 0 1px 2px rgba(84,68,32,.05), 0 10px 26px -18px rgba(84,68,32,.5); }
.toi-hang:active { background: #f4ecd8; }
.toi-hang .bieu { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 1.35rem; flex: none; background: #eef1e1; }
.toi-hang .chu { flex: 1; min-width: 0; font-size: 1.04rem; line-height: 1.3; }
.toi-hang .chu b { display: block; font-weight: 800; }
.toi-hang .chu small { display: block; font-weight: 500; font-size: .86rem; color: #7c6f56; margin-top: 2px; }
.toi-hang .mui { color: #9a8d6e; font-size: 1.5rem; font-weight: 400; flex: none; }

/* ---- hộp «Các bậc học của bạn» ---- */
.toi-lop-phu { position: fixed; inset: 0; z-index: 12000; display: none; align-items: flex-end; justify-content: center; background: rgba(40,30,10,.45); }
.toi-lop-phu.mo { display: flex; }
.toi-to { width: 100%; max-width: 560px; max-height: 88%; display: flex; flex-direction: column; background: #faf5e9; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -10px 30px rgba(0,0,0,.2); }
@media (min-width: 700px) { .toi-lop-phu { align-items: center; } .toi-to { border-radius: 24px; } }
.toi-to .dau { display: flex; align-items: center; gap: 10px; padding: 16px 16px 6px; }
.toi-to .dau h3 { margin: 0; flex: 1; font-family: "Noto Serif", Cambria, Georgia, serif; font-size: 1.25rem; color: #3e4a22; }
.toi-to .dong-hop { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #f3ecdc; color: #7c6f56; font-size: 1.2rem; cursor: pointer; }
.toi-to .than { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px 20px; }
.toi-to .gt { color: #7c6f56; font-size: .95rem; line-height: 1.55; margin: 4px 0 14px; }
.toi-bh { display: flex; gap: 12px; align-items: flex-start; padding: 14px; margin-bottom: 10px; border-radius: 18px; border: 1px solid #e8dcc0; background: #fffdf6; }
.toi-bh .an { width: 50px; height: 50px; flex: none; border-radius: 15px; display: grid; place-items: center; background: #f4ecd8; color: #7c6f56; font-family: "Noto Serif TC", "Songti TC", "Noto Serif", serif; font-weight: 800; font-size: 1.6rem; }
.toi-bh b { font-family: "Noto Serif", Cambria, Georgia, serif; font-size: 1.08rem; }
.toi-bh .y { color: #7c6f56; font-size: .9rem; margin-top: 2px; line-height: 1.45; }
.toi-bh ul { margin: 8px 0 0; padding: 0; list-style: none; font-size: .92rem; }
.toi-bh li { padding: 2px 0; }
.toi-bh li::before { content: "○ "; color: #9a8d6e; }
.toi-bh li.xong::before { content: "✓ "; color: #5f6e33; font-weight: 800; }
.toi-bh .con { color: #a8452f; font-weight: 700; }
.toi-bh.dang { border: 2px solid #5f6e33; background: #eef1e1; }
.toi-bh.dang .an { background: #a8452f; color: #fffdf6; }
.toi-bh.da .an { background: #eef1e1; color: #5f6e33; }
.toi-bh .nd { display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 99px; background: #5f6e33; color: #fff; font-size: .72rem; font-weight: 800; vertical-align: middle; }
.toi-bh.ke { border: 1.5px dashed #5f6e33; }
.toi-bh.ke li { font-weight: 600; }
.toi-bh.ke li::before { content: "→ "; color: #5f6e33; font-weight: 800; }
.toi-bh.ke li.xong::before { content: "✓ "; }
.toi-to .luu-y { font-size: .85rem; color: #7c6f56; line-height: 1.5; margin: 4px 0 0; }

/* ---- hàng «Tải ứng dụng về điện thoại» trong Cài đặt (dùng khung hàng `.secondary` sẵn có của #khu-cai-dat) ---- */
#tai-app-btn[hidden] { display: none !important; }
#tai-app-btn .tai-ic { font-size: 1.4rem; flex: none; }
#khu-cai-dat .settings-wrap > button#tai-app-btn::after { transition: transform .18s ease; }
#tai-app-btn[aria-expanded="true"]::after { transform: rotate(90deg); }
.tai-tx { flex: 1; min-width: 0; line-height: 1.3; }
.tai-tx small { display: block; font-weight: 500; font-size: .84rem; color: #7c6f56; margin-top: 1px; }
#tai-app-ds .tai-a { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; box-sizing: border-box; padding: 10px 18px; background: #fffdf6; color: #3b3220; text-decoration: none; border: 1px solid #e2d4b3; border-top: 0; font-size: 1.06rem; font-weight: 700; }
#tai-app-ds .tai-a::after { content: "›"; margin-left: auto; color: #9a8d6e; font-size: 1.5rem; font-weight: 400; }
#tai-app-ds .tai-a:active { background: #f4ecd8; }
#tai-app-ds .tai-logo { width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center; background: #f4ecd8; }
/* «Thêm vào Màn hình chính» cũ: thay bằng hàng tải ứng dụng ở trên (giữ phần tử trong DOM vì mã cài PWA vẫn tham chiếu nó) */
#khu-cai-dat #install-banner { display: none !important; }
html.tn-app-hv #tai-app-btn, html.tn-app-hv #tai-app-ds { display: none !important; }

@media (prefers-reduced-motion: reduce) { .toi-neo button, .toi-bac-nut, .toi-hang, #khu-cai-dat .settings-wrap > button#tai-app-btn::after { transition: none !important; } }
