/* ===== Học Toán Thông Minh — giao diện chung ===== */
:root {
  --nen: #f6f4fb; --the: #ffffff; --chu: #1e1a2e; --phu: #5c5672; --mo: #8a84a0; --vien: #e7e2f1;
  --chinh: #5b3fd0; --chinh-dam: #3d2a9c; --chinh-nhat: #efeafe; --nhan: #f59e0b;
  --sdt: #0f9d8f; --inf: #ea580c; --st: #9333ea; --mp: #2563eb; --tc: #db2777; --de: #dc2626; --gt: #4f46e5; --ptm: #16a34a;
  --bo: 16px; --bong: 0 1px 2px rgba(30, 20, 60, .06), 0 6px 22px rgba(30, 20, 60, .07);
  --rong: 1200px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--nen); color: var(--chu); font: 16px/1.6 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif; }
a { color: var(--chinh); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--chinh) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.an { display: none !important; }
.khung { max-width: var(--rong); margin: 0 auto; padding: 0 16px; }

/* ---------- đầu trang ---------- */
.dau { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--vien); }
.dau .khung { display: flex; align-items: center; gap: 14px; height: 66px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--chu); flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo-o { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 22px;
  background: linear-gradient(135deg, var(--chinh), #9b5cf6 60%, #ec4899); box-shadow: 0 4px 12px rgba(91, 63, 208, .35); }
.logo b { display: block; font-size: 17px; line-height: 1.15; }
.logo small { display: block; font-size: 11.5px; color: var(--mo); line-height: 1.2; }
.menu { display: flex; align-items: center; gap: 2px; margin-left: 10px; flex: 1; }
.menu > a, .menu .nhom > button { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; color: var(--phu); font-weight: 600; font-size: 14.5px;
  background: none; border: 0; white-space: nowrap; }
.menu > a:hover, .menu .nhom > button:hover, .menu .nhom.mo > button { background: var(--chinh-nhat); color: var(--chinh-dam); text-decoration: none; }
.menu > a.dang, .menu .nhom.dang > button { color: var(--chinh-dam); background: var(--chinh-nhat); }
.nhom { position: relative; }
.nhom > button::after { content: ''; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); margin-left: 2px; }
.tha { position: absolute; top: calc(100% + 6px); left: 0; min-width: 290px; background: #fff; border: 1px solid var(--vien); border-radius: 14px; box-shadow: var(--bong); padding: 8px;
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: .15s; }
.nhom.mo .tha { opacity: 1; visibility: visible; transform: none; }
.tha a { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 10px; color: var(--chu); }
.tha a:hover { background: var(--nen); text-decoration: none; }
.tha a i { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-style: normal; font-size: 18px; flex-shrink: 0; background: color-mix(in srgb, var(--m) 14%, #fff); }
.tha a b { display: block; font-size: 14.5px; }
.tha a small { display: block; color: var(--mo); font-size: 12.5px; line-height: 1.35; }
.phai { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.dem { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fff7e6; color: #8a5300; font-weight: 700; font-size: 13.5px; border: 1px solid #fde4b0; white-space: nowrap; }
.dem:hover { text-decoration: none; background: #ffefcc; }
.dem .cham { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.ban { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--vien); background: #fff; color: var(--chu); font-weight: 600; font-size: 13.5px; max-width: 190px; }
.ban span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ban .av { width: 28px; height: 28px; border-radius: 50%; background: var(--chinh-nhat); color: var(--chinh-dam); display: grid; place-items: center; font-size: 14px; flex-shrink: 0; }
.nut-menu { display: none; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--vien); background: #fff; font-size: 20px; }

/* ngăn kéo điện thoại */
.ngan { position: fixed; inset: 0; z-index: 80; background: rgba(20, 14, 40, .45); opacity: 0; visibility: hidden; transition: .2s; }
.ngan.mo { opacity: 1; visibility: visible; }
.ngan nav { position: absolute; right: 0; top: 0; bottom: 0; width: min(340px, 88vw); background: #fff; padding: 14px; overflow-y: auto; transform: translateX(100%); transition: .25s; }
.ngan.mo nav { transform: none; }
.ngan h4 { margin: 16px 8px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mo); }
.ngan a { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 10px; color: var(--chu); font-weight: 600; }
.ngan a:hover, .ngan a.dang { background: var(--chinh-nhat); text-decoration: none; }
.ngan .dong { float: right; border: 0; background: var(--nen); width: 38px; height: 38px; border-radius: 10px; font-size: 18px; }

@media (max-width: 1420px) { .dem .chu { display: none; } .menu > a, .menu .nhom > button { padding: 8px 9px; font-size: 14px; } .logo small { display: none; } }
@media (max-width: 1140px) { .menu, .dau .ban span:last-child { display: none; } .nut-menu { display: grid; place-items: center; } .ban { padding: 4px; } }
@media (max-width: 520px) { .logo small { display: none; } .dem .chu { display: none; } }

/* ---------- đường dẫn, tiêu đề trang ---------- */
.vet { font-size: 13.5px; color: var(--mo); padding: 18px 0 0; }
.vet a { color: var(--phu); }
.vet span { margin: 0 6px; }
.tieu-de { padding: 10px 0 18px; }
.tieu-de h1 { margin: 6px 0 6px; font-size: clamp(26px, 4vw, 36px); line-height: 1.2; letter-spacing: -.01em; }
.tieu-de p { margin: 0; color: var(--phu); max-width: 760px; }
.tieu-de .bieu { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px; font-size: 26px; background: color-mix(in srgb, var(--m, var(--chinh)) 14%, #fff); }

/* ---------- thanh lọc ---------- */
.loc { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 18px; padding: 10px; background: #fff; border: 1px solid var(--vien); border-radius: 14px; position: sticky; top: 74px; z-index: 20; }
.tab { display: inline-flex; background: var(--nen); border-radius: 10px; padding: 3px; }
.tab button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 700; color: var(--phu); font-size: 14.5px; }
.tab button.on { background: #fff; color: var(--m, var(--chinh-dam)); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.o-tim { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; background: var(--nen); border-radius: 10px; padding: 0 12px; }
.o-tim input { border: 0; background: none; padding: 9px 0; width: 100%; font: inherit; font-size: 14.5px; outline: none; color: var(--chu); }
.dem-kq { color: var(--mo); font-size: 13.5px; }

/* ---------- thẻ ---------- */
.luoi { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.the { background: var(--the); border: 1px solid var(--vien); border-radius: var(--bo); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; color: var(--chu); }
a.the:hover, .the.bam:hover { transform: translateY(-3px); box-shadow: var(--bong); text-decoration: none; }
.the .anh { aspect-ratio: 4/3; background: #f1eef8 center top/cover no-repeat; position: relative; border-bottom: 1px solid var(--vien); }
.the .anh img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.the .nhan-bai { position: absolute; left: 10px; top: 10px; background: rgba(255, 255, 255, .94); color: var(--m); font-weight: 800; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.the .than { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.the h3 { margin: 0; font-size: 15.5px; line-height: 1.35; }
.the p { margin: 0; color: var(--phu); font-size: 13.5px; line-height: 1.45; }
.the .chan { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--phu); background: var(--nen); padding: 3px 9px; border-radius: 999px; }
.nut { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 11px; border: 1px solid var(--vien); background: #fff; color: var(--chu); font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.nut:hover { text-decoration: none; border-color: var(--m, var(--chinh)); color: var(--m, var(--chinh-dam)); }
.nut.chinh { background: var(--m, var(--chinh)); border-color: var(--m, var(--chinh)); color: #fff; }
.nut.chinh:hover { filter: brightness(1.08); color: #fff; }
.nut.nho { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.nhom-chuong { margin: 26px 0 12px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.nhom-chuong h2 { margin: 0; font-size: 19px; }
.nhom-chuong .so-ch { font-weight: 800; color: var(--m); font-size: 13px; background: color-mix(in srgb, var(--m) 12%, #fff); padding: 2px 10px; border-radius: 999px; }
.rong { text-align: center; color: var(--mo); padding: 40px 10px; }

/* ---------- trang chủ ---------- */
.hero { position: relative; z-index: 2; background: linear-gradient(135deg, #2e1f7a 0%, #5b3fd0 55%, #9b5cf6 100%); color: #fff; border-radius: 0 0 28px 28px; }
.hero::before { content: '∑  π  √x  ∫  Δ  ∞  θ  ≠  ≤  ∈  f(x)  →'; position: absolute; inset: 0; font-size: 46px; font-weight: 800; opacity: .07; letter-spacing: 20px; line-height: 1.9; word-spacing: 30px; padding: 10px; pointer-events: none; overflow: hidden; border-radius: 0 0 28px 28px; }
.hero .khung { position: relative; padding-top: 48px; padding-bottom: 54px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 30px; align-items: center; }
.hero h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.12; margin: 8px 0 12px; letter-spacing: -.02em; }
.hero p.mo-ta { font-size: 17px; opacity: .92; margin: 0 0 22px; max-width: 560px; }
.hero .loi { display: inline-block; background: rgba(255, 255, 255, .16); padding: 5px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; }
.tim-lon { display: flex; background: #fff; border-radius: 14px; padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); max-width: 560px; position: relative; }
.tim-lon input { flex: 1; border: 0; outline: none; padding: 10px 12px; font: inherit; color: var(--chu); min-width: 0; }
.tim-lon button { border: 0; background: var(--nhan); color: #3b2300; font-weight: 800; padding: 0 18px; border-radius: 10px; }
.goi-y { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; color: var(--chu); border-radius: 14px; box-shadow: var(--bong); max-height: 380px; overflow: auto; z-index: 10; padding: 6px; }
.goi-y a { display: flex; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--chu); align-items: center; }
.goi-y a:hover, .goi-y a.chon { background: var(--nen); text-decoration: none; }
.goi-y small { color: var(--mo); display: block; font-size: 12.5px; }
.lop-nhanh { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.lop-nhanh a { background: rgba(255, 255, 255, .14); color: #fff; padding: 9px 16px; border-radius: 12px; font-weight: 700; border: 1px solid rgba(255, 255, 255, .25); }
.lop-nhanh a:hover { background: rgba(255, 255, 255, .25); text-decoration: none; }
.hero-so { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hero-so div { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); border-radius: 16px; padding: 16px; }
.hero-so b { display: block; font-size: 30px; line-height: 1.1; }
.hero-so span { font-size: 13.5px; opacity: .9; }
@media (max-width: 860px) { .hero .khung { grid-template-columns: 1fr; padding-top: 30px; } }

.muc { padding: 40px 0 6px; }
.muc > h2 { font-size: 24px; margin: 0 0 4px; }
.muc > p.gt { margin: 0 0 18px; color: var(--phu); }
.o-muc { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.o-muc a { background: #fff; border: 1px solid var(--vien); border-radius: 18px; padding: 18px; color: var(--chu); display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; transition: .15s; }
.o-muc a::after { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: color-mix(in srgb, var(--m) 10%, transparent); }
.o-muc a:hover { transform: translateY(-3px); box-shadow: var(--bong); text-decoration: none; border-color: color-mix(in srgb, var(--m) 40%, var(--vien)); }
.o-muc i { font-style: normal; width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: color-mix(in srgb, var(--m) 14%, #fff); }
.o-muc h3 { margin: 4px 0 0; font-size: 18px; }
.o-muc p { margin: 0; font-size: 14px; color: var(--phu); }
.o-muc .so { font-size: 13px; font-weight: 700; color: var(--m); }
.o-muc .di { margin-top: auto; font-weight: 700; color: var(--m); font-size: 14px; }
.buoc { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); counter-reset: b; }
.buoc div { background: #fff; border: 1px solid var(--vien); border-radius: 16px; padding: 18px 18px 18px 64px; position: relative; }
.buoc div::before { counter-increment: b; content: counter(b); position: absolute; left: 18px; top: 18px; width: 32px; height: 32px; border-radius: 50%; background: var(--chinh); color: #fff; font-weight: 800; display: grid; place-items: center; }
.buoc b { display: block; margin-bottom: 4px; }
.buoc p { margin: 0; font-size: 14px; color: var(--phu); }

/* ---------- học theo bài ---------- */
.htb { display: grid; grid-template-columns: 330px 1fr; gap: 20px; align-items: start; padding-bottom: 30px; }
.ds-bai { background: #fff; border: 1px solid var(--vien); border-radius: 16px; padding: 10px; position: sticky; top: 78px; max-height: calc(100vh - 92px); overflow-y: auto; }
.ds-bai .tab { width: 100%; margin-bottom: 8px; }
.ds-bai .tab button { flex: 1; }
.ds-bai details { border-radius: 10px; }
.ds-bai summary { cursor: pointer; list-style: none; padding: 8px 10px; font-weight: 700; font-size: 13.5px; color: var(--phu); border-radius: 10px; display: flex; gap: 8px; }
.ds-bai summary::-webkit-details-marker { display: none; }
.ds-bai summary:hover { background: var(--nen); }
.ds-bai summary .ic { flex-shrink: 0; }
.ds-bai a { display: block; padding: 7px 10px 7px 34px; border-radius: 9px; font-size: 14px; color: var(--chu); line-height: 1.4; }
.ds-bai a:hover { background: var(--nen); text-decoration: none; }
.ds-bai a.dang { background: var(--chinh-nhat); color: var(--chinh-dam); font-weight: 700; }
.bai-chi-tiet { min-width: 0; }
.bai-dau { background: #fff; border: 1px solid var(--vien); border-radius: 18px; padding: 22px; border-top: 6px solid var(--m); }
.bai-dau .so-ch { font-weight: 700; color: var(--m); font-size: 13.5px; }
.bai-dau h1 { margin: 4px 0 6px; font-size: clamp(22px, 3.2vw, 30px); line-height: 1.25; }
.bai-dau p { margin: 0; color: var(--phu); }
.tai-nguyen { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 16px; }
.tn { background: #fff; border: 1px solid var(--vien); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.tn .anh { aspect-ratio: 16/10; background: #f1eef8; overflow: hidden; }
.tn .anh img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tn .bieu-lon { aspect-ratio: 16/10; display: grid; place-items: center; font-size: 48px; background: color-mix(in srgb, var(--m) 10%, #fff); }
.tn .than { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tn .loai { font-size: 12px; font-weight: 800; color: var(--m); text-transform: uppercase; letter-spacing: .05em; }
.tn h3 { margin: 0; font-size: 15.5px; line-height: 1.35; }
.tn p { margin: 0; font-size: 13.5px; color: var(--phu); }
.tn .chan { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.chuyen { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
@media (max-width: 900px) { .htb { grid-template-columns: 1fr; } .ds-bai { position: static; max-height: 360px; } }

/* ---------- trình xem ---------- */
body.trang-xem { overflow: hidden; }
.xem { position: fixed; inset: 0; display: flex; flex-direction: column; background: #2b2640; }
.xem-thanh { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--vien); flex-wrap: nowrap; }
.xem-thanh .ten { flex: 1; min-width: 0; }
.xem-thanh .ten b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xem-thanh .ten small { display: block; font-size: 12.5px; color: var(--mo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xem-thanh .nut { padding: 8px 12px; }
.xem iframe { flex: 1; width: 100%; border: 0; background: #fff; }
@media (max-width: 700px) { .xem-thanh .chu-nut { display: none; } .xem-thanh .nut { padding: 8px 10px; } }

/* ---------- hộp thoại ---------- */
.hop-nen { position: fixed; inset: 0; z-index: 100; background: rgba(20, 14, 40, .5); display: grid; place-items: center; padding: 16px; animation: hien .2s; }
@keyframes hien { from { opacity: 0; } }
.hop { background: #fff; border-radius: 20px; width: min(470px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); position: relative; }
.hop h2 { margin: 0 0 4px; font-size: 22px; }
.hop > p { margin: 0 0 16px; color: var(--phu); font-size: 14.5px; }
.hop .x { position: absolute; right: 14px; top: 14px; border: 0; background: var(--nen); width: 36px; height: 36px; border-radius: 10px; font-size: 16px; }
.vai { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.vai button { border: 2px solid var(--vien); background: #fff; border-radius: 12px; padding: 10px 4px; font-size: 13px; font-weight: 700; color: var(--phu); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.vai button span { font-size: 22px; }
.vai button.on { border-color: var(--chinh); background: var(--chinh-nhat); color: var(--chinh-dam); }
.hop label { display: block; font-size: 13.5px; font-weight: 700; margin: 10px 0 4px; }
.hop input { width: 100%; padding: 11px 12px; border: 1px solid var(--vien); border-radius: 11px; font: inherit; font-size: 15px; }
.hop input:focus { border-color: var(--chinh); outline: none; box-shadow: 0 0 0 3px var(--chinh-nhat); }
.hop .hang { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
.hop .nut-hang { display: flex; gap: 10px; margin-top: 18px; }
.hop .nut-hang .nut { flex: 1; }
.hop .loi-nho { font-size: 12.5px; color: var(--mo); margin: 12px 0 0; }
.hop .loi-sai { color: var(--de); font-size: 13.5px; margin-top: 8px; min-height: 1em; }
@media (max-width: 420px) { .vai { grid-template-columns: repeat(2, 1fr); } .hop .hang { grid-template-columns: 1fr; } }

.bao { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #1e1a2e; color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 120; font-size: 14.5px; box-shadow: var(--bong); animation: hien .2s; max-width: calc(100vw - 32px); }
.thong-bao { background: #fff7e6; border: 1px solid #fde4b0; color: #7a4a00; padding: 10px 14px; border-radius: 12px; font-size: 14px; margin: 0 0 16px; }

/* ---------- thống kê ---------- */
.o-so { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.o-so div { background: #fff; border: 1px solid var(--vien); border-radius: 16px; padding: 16px 18px; }
.o-so span { font-size: 13.5px; color: var(--phu); font-weight: 600; }
.o-so b { display: block; font-size: 32px; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.o-so small { color: var(--mo); font-size: 12.5px; }
.bang-tk { background: #fff; border: 1px solid var(--vien); border-radius: 16px; padding: 18px; margin-top: 16px; }
.bang-tk h2 { margin: 0 0 2px; font-size: 18px; }
.bang-tk > p { margin: 0 0 12px; color: var(--mo); font-size: 13.5px; }
.bieu-do { position: relative; }
.bieu-do svg { width: 100%; height: 240px; display: block; overflow: visible; }
.bieu-do .cot { fill: var(--chinh); }
.bieu-do .cot:hover, .bieu-do .cot.on { fill: var(--chinh-dam); }
.bieu-do text { font-size: 11px; fill: var(--mo); font-family: inherit; }
.bieu-do .luoi-ke { stroke: var(--vien); stroke-width: 1; }
.goi-tip { position: absolute; pointer-events: none; background: #1e1a2e; color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 13px; white-space: nowrap; transform: translate(-50%, -110%); }
.thanh-ngang { display: grid; grid-template-columns: 170px 1fr 54px; gap: 10px; align-items: center; margin: 8px 0; font-size: 14px; }
.thanh-ngang .vach { height: 14px; background: var(--nen); border-radius: 4px; overflow: hidden; }
.thanh-ngang .vach div { height: 100%; background: var(--chinh); border-radius: 0 4px 4px 0; }
.thanh-ngang b { text-align: right; font-variant-numeric: tabular-nums; }
table.bang { width: 100%; border-collapse: collapse; font-size: 14px; }
table.bang th, table.bang td { padding: 7px 8px; border-bottom: 1px solid var(--vien); text-align: left; }
table.bang td.so { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- hướng dẫn ---------- */
.hd { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; padding-bottom: 40px; }
.hd nav { position: sticky; top: 80px; background: #fff; border: 1px solid var(--vien); border-radius: 14px; padding: 10px; }
.hd nav a { display: block; padding: 7px 10px; border-radius: 9px; color: var(--phu); font-size: 14px; font-weight: 600; }
.hd nav a:hover { background: var(--nen); text-decoration: none; }
.hd article { background: #fff; border: 1px solid var(--vien); border-radius: 18px; padding: 8px 26px 26px; min-width: 0; }
.hd article h2 { margin: 28px 0 8px; font-size: 21px; scroll-margin-top: 84px; display: flex; gap: 10px; align-items: center; }
.hd article h3 { margin: 18px 0 6px; font-size: 16.5px; }
.hd article li { margin: 6px 0; }
.hd code, .hd kbd { background: var(--nen); border: 1px solid var(--vien); border-radius: 6px; padding: 1px 6px; font-size: 13.5px; font-family: Consolas, monospace; }
.hd .meo { background: #ecfdf5; border: 1px solid #bbf7d0; border-radius: 12px; padding: 10px 14px; margin: 12px 0; font-size: 14.5px; }
.hd .canh { background: #fff7e6; border: 1px solid #fde4b0; border-radius: 12px; padding: 10px 14px; margin: 12px 0; font-size: 14.5px; }
.hd table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.hd th, .hd td { border: 1px solid var(--vien); padding: 7px 9px; text-align: left; vertical-align: top; }
.hd th { background: var(--nen); }
.kiem { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.kiem input { flex: 1; min-width: 240px; padding: 10px 12px; border: 1px solid var(--vien); border-radius: 10px; font: inherit; font-size: 14px; }
@media (max-width: 860px) { .hd { grid-template-columns: 1fr; } .hd nav { position: static; } .hd article { padding: 4px 16px 20px; } }

/* ---------- chân trang ---------- */
.chan-trang { margin-top: 50px; background: #1e1a2e; color: #cfc9e3; font-size: 14px; }
.chan-trang .khung { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 26px; padding-top: 34px; padding-bottom: 24px; }
.chan-trang h4 { color: #fff; margin: 0 0 10px; font-size: 14.5px; }
.chan-trang a { color: #cfc9e3; display: block; padding: 3px 0; }
.chan-trang a:hover { color: #fff; }
.chan-trang .ban-quyen { border-top: 1px solid rgba(255, 255, 255, .1); padding: 14px 16px; text-align: center; font-size: 13px; color: #9a93b5; }
.chan-trang .dem-chan { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.chan-trang .dem-chan span { background: rgba(255, 255, 255, .07); padding: 6px 10px; border-radius: 10px; }
.chan-trang .dem-chan b { color: #fff; }
@media (max-width: 860px) { .chan-trang .khung { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .chan-trang .khung { grid-template-columns: 1fr; } }

/* nút lên đầu */
.len-dau { position: fixed; right: 18px; bottom: 18px; width: 46px; height: 46px; border-radius: 14px; border: 0; background: var(--chinh); color: #fff; font-size: 20px; box-shadow: var(--bong); opacity: 0; visibility: hidden; transition: .2s; z-index: 40; }
.len-dau.hien { opacity: 1; visibility: visible; }
@media print { .dau, .chan-trang, .loc, .len-dau { display: none !important; } }

/* điện thoại: đầu trang gọn, không tràn ngang */
.logo { min-width: 0; flex-shrink: 1; }
.logo > span:last-child { min-width: 0; }
.logo b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd code { overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .dau .khung { gap: 8px; }
  .logo-o { width: 36px; height: 36px; font-size: 20px; }
  .logo b { font-size: 15px; }
  .phai { gap: 6px; }
  .dem { padding: 5px 9px; }
  .nut-menu { width: 38px; height: 38px; }
}

/* ảnh bìa trang chủ */
.bia { background: linear-gradient(180deg, #eaf2fa, #f3f6fb); }
.bia img { display: block; width: 100%; max-width: 1600px; height: auto; margin: 0 auto; }
.bia + .hero { border-radius: 0 0 28px 28px; }
.bia + .hero .khung { padding-top: 30px; padding-bottom: 38px; }
.bia + .hero h1 { font-size: clamp(26px, 3.6vw, 38px); }

/* đề siêu VIP */
.vip-tk { border: 2px solid #f5c542; background: linear-gradient(135deg, #fff9e6, #fff); }
.vip-tk h2 { color: #9a6a00; }
/* tài khoản */
.tk-tab { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--nen); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.tk-tab button { border: 0; background: transparent; border-radius: 9px; padding: 8px; font-weight: 700; color: var(--phu); }
.tk-tab button.on { background: #fff; color: var(--chinh-dam); box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.tk-nut { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.tk-nut .nut { width: 100%; justify-content: center; text-align: center; }

/* ===== Thi đua (16/10/2026): chữ chạy, nút Zalo nổi, bảng vàng, điểm tích luỹ, hỏi đáp ===== */
.chu-chay { background: linear-gradient(90deg, #c2410c, #db2777); color: #fff; overflow: hidden; white-space: nowrap; font-size: 14px; font-weight: 600; position: relative; z-index: 51; }
.chu-chay-trong { display: inline-flex; gap: 80px; padding: 7px 0 7px 100%; color: #fff; text-decoration: none; animation: chay-trai 38s linear infinite; }
.chu-chay-trong span { flex: none; }
.chu-chay:hover .chu-chay-trong { animation-play-state: paused; }
@keyframes chay-trai { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .chu-chay-trong { animation-duration: 90s; } }
.zalo-noi { position: fixed; right: 16px; bottom: 74px; z-index: 60; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: #0068ff; color: #fff; font-weight: 700; text-decoration: none; box-shadow: 0 8px 24px rgba(0,104,255,.35); animation: zalo-nhip 2.4s ease-in-out infinite; }
.zalo-noi .zalo-o { width: 40px; height: 40px; border-radius: 50%; background: #fff; color: #0068ff; display: grid; place-items: center; font-size: 12px; font-weight: 800; letter-spacing: -.3px; }
.zalo-noi:hover { filter: brightness(1.08); }
@keyframes zalo-nhip { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@media (max-width: 600px) { .zalo-noi .zalo-chu { display: none; } .zalo-noi { padding: 5px; } }
.trang-xem .zalo-noi { bottom: 16px; }
.vang-noi { position: fixed; left: 16px; bottom: 18px; z-index: 60; display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 999px; border: 0; background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 8px 22px rgba(217,119,6,.35); cursor: pointer; }
.vang-noi span { font-size: 13.5px; }
@media (max-width: 600px) { .vang-noi span { display: none; } }
.diem-ban { background: #fff4d6; color: #9a6a00; border-radius: 999px; padding: 2px 8px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.diem-ban.an { display: none; }
@media (max-width: 1140px) { .dau .ban .diem-ban { display: inline-block !important; } .dau .ban .diem-ban.an { display: none !important; } }
.bang-vang { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.bang-vang li { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--vien); }
.bang-vang li.h1 { background: linear-gradient(90deg, #fff6d5, #fff); border-color: #f5c542; }
.bang-vang li.h2 { background: linear-gradient(90deg, #f1f5f9, #fff); }
.bang-vang li.h3 { background: linear-gradient(90deg, #fdeee2, #fff); }
.bang-vang .hang { font-size: 22px; text-align: center; font-weight: 800; color: var(--phu); }
.bang-vang .nguoi b { display: block; }
.bang-vang .nguoi small { color: var(--mo); }
.bang-vang .diem { font-weight: 800; color: #c2410c; font-size: 17px; white-space: nowrap; }
.bang-vang.gon li { padding: 6px 10px; }
.thi-dua { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
@media (max-width: 860px) { .thi-dua { grid-template-columns: 1fr; } }
.thi-dua-chu { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; align-items: start; background: linear-gradient(135deg, #fff7ed, #fff); border: 2px solid #fed7aa; border-radius: 20px; padding: 20px; }
@media (max-width: 860px) { .thi-dua-chu { grid-template-columns: 1fr; } }
.diem-lon { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 10px; }
.diem-lon b { font-size: 40px; color: #c2410c; line-height: 1; }
.diem-lon span { color: var(--phu); font-weight: 700; }
.tk-diem { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 12px 14px; border-radius: 14px; background: #fff7ed; border: 1px solid #fed7aa; margin: 10px 0 12px; }
.tk-diem > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tk-diem small { color: var(--phu); }
.ds-gon { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.ds-gon li { margin: 4px 0; }
.ds-gon .duong { color: #16a34a; font-weight: 800; }
.ds-gon .am { color: #dc2626; font-weight: 800; }
.hd-muc { border: 1px solid var(--vien); border-radius: 12px; padding: 10px 14px; margin: 10px 0; background: #fff; }
.hd-hoi { margin: 0 0 8px; }
.hd-tl { margin: 0; padding: 8px 12px; border-radius: 10px; background: #f0fdf4; border-left: 4px solid #16a34a; }
.hd-muc textarea, #gui textarea, #gui select { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--vien); border-radius: 10px; margin: 4px 0 8px; }
@media print { .chu-chay, .zalo-noi, .vang-noi { display: none !important; } }
@media (max-width: 1140px) { .dau .ban #ten-ban { display: none; } .dau .ban { gap: 4px; } }

/* ===== Đầu trang 2 tầng (16/10/2026): tầng 1 logo + tài khoản, tầng 2 thanh công cụ ===== */
.dau .khung { height: 64px; }
.logo { min-width: 0; }
.logo > span:last-child { min-width: 0; }
.logo b { white-space: nowrap; font-size: 18px; letter-spacing: -.2px;
  background: linear-gradient(90deg, var(--chinh-dam), #9b3fd0 55%, #db2777); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.thanh-cc { border-top: 1px solid var(--vien); background: linear-gradient(180deg, #fbfaff, #f4f0ff); }
.thanh-cc .khung { height: auto; padding: 7px 16px; }
.dau .menu { flex: 1; justify-content: center; gap: 6px; margin: 0; flex-wrap: nowrap; }
.dau .menu > a, .dau .menu .nhom > button { gap: 8px; padding: 6px 15px 6px 6px; border-radius: 999px; border: 1px solid transparent; color: #3b3355; font-weight: 650; font-size: 14.5px; transition: background .15s, box-shadow .15s, transform .15s, color .15s; }
.dau .menu .mi { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 15px; background: #fff; box-shadow: 0 1px 3px rgba(60, 40, 120, .15); flex-shrink: 0; }
.dau .menu > a:hover, .dau .menu .nhom > button:hover, .dau .menu .nhom.mo > button { background: #fff; border-color: var(--vien); color: var(--chinh-dam); box-shadow: 0 4px 14px rgba(91, 63, 208, .14); transform: translateY(-1px); text-decoration: none; }
.dau .menu > a.dang, .dau .menu .nhom.dang > button { background: linear-gradient(135deg, var(--chinh), #8b5cf6); color: #fff; box-shadow: 0 4px 14px rgba(91, 63, 208, .35); }
.dau .menu > a.dang .mi, .dau .menu .nhom.dang > button .mi { background: rgba(255, 255, 255, .22); box-shadow: none; }
.dau .menu > a.noi-bat { background: linear-gradient(135deg, #fff1e0, #ffe4ef); border-color: #fdc89a; color: #b4400a; }
.dau .menu > a.noi-bat:hover { background: linear-gradient(135deg, #ffe7cc, #ffd6e6); color: #9a3412; }
.dau .menu > a.noi-bat.dang { background: linear-gradient(135deg, #ea580c, #db2777); color: #fff; border-color: transparent; }
.dau .menu .nhom > button::after { margin-left: 0; opacity: .7; }
.dau .tha { top: calc(100% + 8px); }
@media (max-width: 1420px) { .dau .menu > a, .dau .menu .nhom > button { padding: 6px 12px 6px 6px; font-size: 14px; } .logo small { display: block; } }
@media (max-width: 1240px) { .dau .menu { gap: 3px; } .dau .menu > a, .dau .menu .nhom > button { padding: 5px 10px 5px 5px; font-size: 13.5px; } .dau .menu .mi { width: 26px; height: 26px; font-size: 13px; } }
@media (max-width: 1140px) { .thanh-cc { display: none; } }
@media (max-width: 640px) { .logo small { display: none; } .logo b { font-size: 16px; } }
/* ---- tối ưu điện thoại (rà soát 18/10/2026): vùng chạm ≥ 36px, nút chuyển bài không tràn ngang */
.chuyen .nut { max-width: 100%; white-space: normal; text-align: left; line-height: 1.35; }
@media (max-width: 860px) {
  .chan-trang a { padding: 8px 0; }
  .vet a { display: inline-block; padding: 8px 0; }
  .chuyen .nut { flex: 1 1 100%; }
}
/* tên đăng nhập dài không làm vỡ khung trên điện thoại */
.bang-vang li { grid-template-columns: 40px minmax(0, 1fr) auto; }
.bang-vang .nguoi { min-width: 0; overflow-wrap: anywhere; }
.thi-dua, .thi-dua-chu { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.thi-dua-chu { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.hero .khung { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
@media (max-width: 860px) { .thi-dua, .thi-dua-chu, .hero .khung { grid-template-columns: minmax(0, 1fr); } }

/* 📬 thông báo đề mới giao */
.chuong-lop { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; border-radius: 12px; background: #fff7ed; border: 1px solid #fed7aa; font-size: 19px; text-decoration: none; animation: lac-chuong 1.6s ease-in-out 2; }
.chuong-lop b { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: #dc2626; color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.chuong-lop.an { display: none; }
@keyframes lac-chuong { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-12deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) { .chuong-lop { animation: none; } }

/* ← Quay lại · 🏠 Trang chủ */
.dieu-huong { display: flex; gap: 8px; padding-top: 14px; }
.dieu-huong .nut { min-height: 38px; padding: 7px 14px; font-size: 14px; }

/* trang an toàn */
.an-toan .bang-tk { margin-bottom: 16px; }
.cuon-ngang { overflow-x: auto; }
.bang-at { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 560px; }
.bang-at th, .bang-at td { border-bottom: 1px solid var(--vien, #e4def0); padding: 9px 10px; text-align: left; vertical-align: top; }
.bang-at th { background: #f0fdfa; color: #115e59; }
.ds-at { margin: 6px 0 0; padding-left: 22px; line-height: 1.65; }
.ds-at li { margin: 4px 0; }
.ghi-at { color: var(--phu, #5c5672); font-size: 14px; }
.la-ban { color: #0f766e; font-weight: 800; }

/* bảng vàng: tab cá nhân / trường, chip lớp */
.bv-tab { display: flex; gap: 6px; background: #f4f1fb; padding: 4px; border-radius: 12px; margin: 6px 0 4px; }
.bv-tab button { flex: 1; border: 0; background: none; padding: 8px 6px; border-radius: 9px; font: inherit; font-weight: 700; font-size: 14px; color: var(--phu, #5c5672); cursor: pointer; }
.bv-tab button.on { background: #fff; color: #c2410c; box-shadow: 0 2px 8px rgba(30,20,60,.1); }
.bv-dau { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 2px; }
.bv-dau button, .bv-chip button { border: 1px solid var(--vien, #e4def0); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; color: inherit; min-height: 36px; }
.bv-chip { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.bv-chip button.on { background: #ea580c; border-color: #ea580c; color: #fff; }
.bv-tim { width: 100%; margin: 8px 0 2px; padding: 9px 12px; border: 1px solid var(--vien, #e4def0); border-radius: 12px; font: inherit; font-size: 15px; }
.bv-h { font-size: 14px; margin: 12px 0 0; color: #7c2d12; }
.bv-ghi { font-size: 12.5px; color: var(--phu, #5c5672); margin: 8px 0 0; }
.bang-vang li.bam { cursor: pointer; }
.bang-vang li.bam:hover, .bang-vang li.bam:focus-visible { border-color: #ea580c; outline: none; }
.bang-vang li.la-ban-hang { box-shadow: 0 0 0 2px #14b8a6 inset; }

/* huy hiệu lượt xem học liệu */
.luot { display: inline-block; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 2px 10px; margin: 4px 0; line-height: 1.5; }
.luot.da { background: #dcfce7; color: #166534; }
.luot.chua { background: #f1f5f9; color: #64748b; }
.luot:empty { display: none; }
/* hộp sửa thông tin tài khoản */
.tk-sua { margin-top: 12px; padding: 12px; border: 1.5px solid var(--vien, #e4def0); border-radius: 14px; background: #faf9ff; display: grid; gap: 6px; }
.tk-sua h3 { margin: 0 0 4px; font-size: 16px; }
.tk-sua label { font-weight: 700; font-size: 13px; color: var(--phu, #5c5672); }
.tk-sua input, .tk-sua select { width: 100%; padding: 9px 11px; border: 1px solid var(--vien, #e4def0); border-radius: 10px; font: inherit; font-size: 16px; background: #fff; min-height: 42px; }
.tk-sua .hang { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .tk-sua .hang { grid-template-columns: 1fr; } }

/* Vung cham du lon cho link trong chu (25/10/2026) */
p a, li a, td.so a, .hd a, small a { display: inline-block; min-height: 32px; line-height: 32px; padding: 0 6px; margin: -6px -4px; }
td.so a { min-width: 44px; text-align: center; }
.chu-chay-trong a { display: inline; min-height: 0; line-height: inherit; padding: 0; margin: 0; }
a[style*="justify-content:space-between"] { min-height: 34px; align-items: center; }
