/* ═══════════════════════════════════════════════════════════════════════════
   PHÒNG THI THỬ · bộ nhận diện
   - Linh vật: bút chì "Chì" (Pages/Shared/_Mascot.cshtml)
   - Hai màu chủ đạo: vàng bút chì + xanh mực. San hô cho cảnh báo, xanh lá cho câu đúng.
   - Phong cách: nền sáng, thẻ trắng nổi nhẹ bằng bóng đổ mềm, viền mảnh, nhiều khoảng thở.
     Màu vàng chỉ dùng làm điểm nhấn (nút chính, lựa chọn đang chọn, phần được tô sáng).
   Muốn đổi nhận diện thì sửa các biến dưới đây, không tô màu riêng cho từng trang.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
    --ink: #121a3f;             /* xanh mực: chữ */
    --ink-soft: #545d7c;
    --brand: #ffc83d;           /* vàng bút chì */
    --brand-deep: #e0a000;
    --brand-soft: #fff5d6;
    --bg: #f3f5f9;
    --card: #ffffff;
    --line: #e0e5ee;
    --fill: #f0f2f7;
    --coral: #e5484d;
    --coral-soft: #fdeced;
    --mint: #0f9a62;
    --mint-soft: #e6f7ef;
    --link: #2453de;            /* xanh dương: đường link trong nội dung */
    --link-hover: #173bb0;
    --focus: #8fb3ff;
    --control-h: 48px;          /* chiều cao chung của nút, ô nhập, ô chọn */
    --control-radius: 12px;
    --control-border: 1.5px solid #d2d8e5;
    --radius: 20px;
    --shadow-sm: 0 1px 2px rgba(18, 26, 63, .07);
    --shadow: 0 0 0 1px rgba(18, 26, 63, .05), 0 1px 2px rgba(18, 26, 63, .05), 0 4px 14px rgba(18, 26, 63, .05);
    --shadow-lift: 0 0 0 1px rgba(18, 26, 63, .07), 0 2px 4px rgba(18, 26, 63, .06), 0 10px 24px rgba(18, 26, 63, .10);
    --font-fun: "Baloo 2", "Be Vietnam Pro", system-ui, sans-serif;
    --font-text: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
/* Luôn chừa chỗ cho thanh cuộn để bố cục không xê dịch giữa trang ngắn và trang dài. */
html { scrollbar-gutter: stable; }
/* Chuyển trang: mờ dần sang trang mới thay vì chớp trắng (trình duyệt hỗ trợ View Transitions). */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; animation-timing-function: ease-out; }
[hidden] { display: none !important; }

body {
    margin: 0; min-height: 100vh;
    color: var(--ink);
    font: 500 17px/1.6 var(--font-text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* Đường link trong nội dung: màu xanh dương, gạch chân mờ; rê chuột thì đậm lên và gạch chân rõ. */
a { color: var(--link); font-weight: 600; text-decoration: underline; text-decoration-color: rgba(47, 91, 227, .3); text-decoration-thickness: 1.5px; text-underline-offset: 3px; transition: color .12s, text-decoration-color .12s; }
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }
a:active { color: var(--ink); }
h1, h2, h3 { font-family: var(--font-fun); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.4rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: .45rem 0; }
.muted { color: var(--ink-soft); }
.good { color: var(--mint); font-weight: 600; }
.bad { color: var(--coral); font-weight: 600; }
.error { color: var(--coral); font-weight: 600; font-size: .95rem; }
.error ul { margin: 0; padding-left: 18px; }
.validation-summary-valid { display: none; }
.center { text-align: center; }
.mascot { display: block; width: 100%; height: auto; }

/* ───── Khung trang ───── */
.top { background: rgba(255, 255, 255, .94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; view-transition-name: top-bar; }
/* Thanh đầu trang của phụ huynh và học sinh: nền kem nhạt cùng tông vàng bút chì, vạch vàng mảnh phía trên (khu giáo viên dùng tông xanh, xem teacher.css). */
.top.top-home { background: linear-gradient(180deg, rgba(255, 244, 214, .96), rgba(255, 250, 238, .96)); border-bottom-color: #f1e2b8; box-shadow: inset 0 3px 0 var(--brand); }
/* Bé đã chọn màu khác Vàng nắng trong Tủ đồ: nền nhạt theo màu của bé, vạch trên cùng đúng màu đó. */
.top.top-home.kid-tint { background: linear-gradient(180deg, color-mix(in srgb, var(--k-soft) 85%, #fff), color-mix(in srgb, var(--k-soft) 35%, #fff)); border-bottom-color: color-mix(in srgb, var(--k) 18%, #fff); box-shadow: inset 0 3px 0 var(--k); }
.top-in { max-width: 960px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 42px; height: 42px; padding: 4px 9px 0; flex: none; overflow: hidden; background: var(--brand); border-radius: 13px; }
.brand-name { font: 800 1.55rem/1 var(--font-fun); letter-spacing: -.01em; white-space: nowrap; }
/* Logo chữ (xem _Wordmark.cshtml): "PHÒNG" nhỏ giãn chữ ở trên, "THI THỬ" chữ vàng trên nhãn xanh mực nghiêng nhẹ như con dấu. */
.brand-name { display: inline-flex; flex-direction: column; align-items: flex-start; gap: .14em; text-transform: uppercase; letter-spacing: 0; }
.bn-1 { font: 800 max(.54em, 10px)/1 var(--font-fun); letter-spacing: .4em; color: var(--ink); padding-left: .12em; }
.bn-2 {
    font: 800 .86em/1 var(--font-fun); letter-spacing: .04em; color: var(--brand);
    background: var(--ink); padding: .2em .38em .12em; border-radius: .26em;
    box-shadow: 0 .1em 0 var(--brand-deep); transform: rotate(-2deg); transform-origin: left center;
    transition: transform .15s;
}
.brand:hover .bn-2 { transform: rotate(0deg); }
/* Thỉnh thoảng (khoảng 9 giây một lần) logo ở đầu trang tự "chào": nhãn THI THỬ đung đưa rồi về chỗ, linh vật nhún nhảy.
   Tắt khi người dùng chọn giảm chuyển động (quy tắc prefers-reduced-motion chung). */
@keyframes bn-wave { 0%, 82%, 100% { transform: rotate(-2deg); } 86% { transform: rotate(1.5deg) scale(1.04); } 90% { transform: rotate(-3deg); } 94% { transform: rotate(0deg); } }
@keyframes mark-hop { 0%, 82%, 100% { transform: translateY(0) rotate(0); } 86% { transform: translateY(-4px) rotate(-6deg); } 90% { transform: translateY(0) rotate(4deg); } 94% { transform: translateY(-2px) rotate(0); } }
.top .bn-2 { animation: bn-wave 9s ease-in-out 3s infinite; }
.top .brand-mark .mascot { animation: mark-hop 9s ease-in-out 3s infinite; transform-origin: 50% 90%; }
.top .brand:hover .bn-2 { animation: none; transform: rotate(0deg); }
.top-nav { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.nav-link { color: var(--ink); text-decoration: none; padding: 8px 4px; }
.nav-link:hover { color: var(--link); }
/* Nút trông như đường link (dùng trong form): cùng kiểu với thẻ a. */
.link { font: inherit; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; color: var(--link); text-decoration: underline; text-decoration-color: rgba(47, 91, 227, .3); text-decoration-thickness: 1.5px; text-underline-offset: 3px; transition: color .12s, text-decoration-color .12s; }
.link:hover { color: var(--link-hover); text-decoration-color: currentColor; }

/* ───── Menu tài khoản ───── */
.menu { position: relative; }
.menu summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1.5px solid transparent; transition: background .12s, border-color .12s; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: #fff; border-color: var(--line); }
.menu summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.menu-avatar { display: grid; place-items: center; width: 36px; height: 36px; padding-top: 2px; flex: none; border-radius: 50%; background: var(--brand); color: var(--ink); font: 800 1.05rem/1 var(--font-fun); }
.menu-avatar.lg { width: 44px; height: 44px; font-size: 1.25rem; }
.menu-name { font-weight: 600; font-size: .93rem; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-caret { width: 11px; color: var(--ink-soft); transition: transform .15s; }
.menu[open] .menu-caret { transform: rotate(180deg); }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 260px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lift); animation: menu-in .14s ease-out; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 8px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.menu-head b { display: block; font-size: .98rem; word-break: break-all; }
.menu-head small { color: var(--ink-soft); }
.menu-panel a, .menu-out { display: block; width: 100%; text-align: left; font: 500 .96rem/1.3 var(--font-text); color: var(--ink); text-decoration: none; padding: 10px 12px; border-radius: 10px; background: none; border: 0; cursor: pointer; transition: background .1s; }
.menu-panel a:hover, .menu-out:hover { background: var(--fill); color: var(--ink); }
.menu-panel form { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--line); }
.menu-out { color: var(--coral); }
.wrap { max-width: 960px; margin: 0 auto; padding: 26px 16px 28px; }

.card { background: var(--card); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.pill {
    display: inline-block; font: 600 .78rem/1.5 var(--font-text); letter-spacing: 0;
    background: var(--brand-soft); color: #8a6100; padding: 1px 10px; border-radius: 999px; vertical-align: middle;
}
.bad-pill { background: var(--coral-soft); color: var(--coral); }
.back { display: inline-block; margin-bottom: 14px; color: var(--ink-soft); text-decoration: none; font-size: .95rem; }
.back:hover { color: var(--link); }

/* ───── Nút ───── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: 700 1.02rem/1 var(--font-fun); cursor: pointer; text-decoration: none;
    min-height: var(--control-h); padding: 12px 20px 10px; border-radius: var(--control-radius);
    background: #fff; color: var(--ink); border: var(--control-border); box-shadow: var(--shadow-sm);
    transition: transform .12s, box-shadow .12s, background .12s, border-color .12s;
}
.btn:hover { transform: translateY(-1px); border-color: #c3cadb; box-shadow: var(--shadow); color: var(--ink); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.btn.primary { background: var(--brand); border-color: transparent; box-shadow: 0 2px 0 var(--brand-deep); }
.btn.primary:hover { background: #ffd057; box-shadow: 0 3px 0 var(--brand-deep), 0 10px 20px rgba(233, 164, 0, .22); }
.btn.primary:active { box-shadow: 0 0 0 var(--brand-deep); }
.btn.ink { background: var(--ink); color: #fff; border-color: transparent; }
.btn.ink:hover { background: #26336b; color: #fff; }
.btn.danger { background: var(--coral); color: #fff; border-color: transparent; }
.btn.small { min-height: 40px; padding: 8px 14px 6px; font-size: .93rem; border-radius: 10px; }
.btn:focus-visible, .link:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.actions form { margin: 0; }

/* ───── Biểu mẫu ───── */
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select {
    font: 500 1rem/1.3 var(--font-text); padding: 10px 14px; min-height: var(--control-h); width: 100%;
    border: var(--control-border); border-radius: var(--control-radius); background-color: #fff; color: var(--ink);
    transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover { border-color: #c3cadb; }
input:focus, select:focus { outline: none; border-color: var(--brand-deep); box-shadow: 0 0 0 4px var(--brand-soft); }
input::placeholder { color: #a3aac0; }
/* Ô chọn: bỏ mũi tên mặc định của trình duyệt, dùng mũi tên riêng cho đồng bộ với ô nhập. */
select {
    appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%2369728f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 12px;
}
label { font-weight: 600; }
.stack { display: grid; gap: 16px; margin: 16px 0; }
.stack label, .row label { display: grid; gap: 6px; font-size: .92rem; }
.stack label.consent { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; }
.consent input { width: 20px; height: 20px; flex: none; margin: 1px 0 0; accent-color: var(--brand-deep); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.row label { flex: 1 1 180px; }
.hint { font-size: .84rem; color: var(--ink-soft); font-weight: 500; }

/* Hộp dùng thử miễn phí: điểm bán hàng quan trọng nên nổi bật bằng nền vàng nhạt và viền màu thương hiệu. */
.trial-box { display: grid; gap: 4px; margin: 18px 0 0; padding: 14px 16px; border: 1.5px solid var(--brand); border-radius: 14px; background: var(--brand-soft); font-size: .95rem; }
.trial-box b { font-family: var(--font-fun); font-size: 1.08rem; }
.auth .trial-box { margin: 10px 0 0; text-align: center; }

/* Mục nói rõ đây là thi thử để ôn luyện. */
.disclaimer { border-left: 5px solid var(--brand); }
.disclaimer ul { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.auth { max-width: 440px; margin: 14px auto 22px; padding: 32px 28px; }
.auth-mascot { width: 88px; margin: -4px auto 6px; }
.auth .btn { width: 100%; }

/* ───── Thông báo ───── */
.notice { background: var(--brand-soft); border-radius: 14px; padding: 12px 16px; font-weight: 500; margin: 0 0 20px; }
.notice.gift, .gift-banner { background: #E1F6EC; color: #0E5C3C; border: 1.5px solid #17A673; }
.gift-banner { border-radius: 14px; padding: 12px 16px; font-weight: 500; margin: 0 0 20px; }
.ref-copy-cell { display: flex; gap: 6px; align-items: center; min-width: 0; }
.ref-copy-cell .ref-link { flex: 1; min-width: 0; width: 17rem; font-size: .85rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #F7F8FC; }
.ref-on { color: #17A673; font-weight: 600; }
.ref-ended td { opacity: .85; }
.ref-act form + form { margin-left: 6px; }
.gift-banner.ended { background: #FFF5D6; color: #6B4E00; border-color: #E9A400; }
.notice.ok { background: var(--mint-soft); }
.notice.warn { background: #fff4d6; border: 1.5px solid #f2c94c; }
.say { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.say .mascot { width: 84px; flex: none; }
.bubble { position: relative; background: #fff; border-radius: 18px; padding: 14px 18px; font: 700 1.2rem/1.35 var(--font-fun); box-shadow: var(--shadow); }
.bubble small { display: block; font: 500 .95rem/1.5 var(--font-text); color: var(--ink-soft); }
.bubble::before { content: ""; position: absolute; left: -7px; top: 50%; width: 16px; height: 16px; margin-top: -8px; background: #fff; transform: rotate(45deg); border-radius: 3px; }

/* ───── Trang chủ: học sinh và kỳ thi ───── */
.kid-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.avatar { display: grid; place-items: center; width: 60px; height: 60px; font-size: 2rem; flex: none; background: var(--brand-soft); border-radius: 50%; }
.kid-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.streak { font: 600 .86rem/1 var(--font-text); background: var(--brand-soft); color: #8a6100; border-radius: 999px; padding: 8px 13px; }
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile {
    display: flex; flex-direction: column; gap: 5px; text-decoration: none; color: var(--ink);
    background: #fff; border: 1.5px solid var(--line); border-radius: 18px; padding: 18px;
    transition: transform .14s, box-shadow .14s, border-color .14s;
}
.tile:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow-lift); }
.tile-icon { display: grid; place-items: center; width: 54px; height: 54px; font-size: 1.7rem; line-height: 1; background: var(--brand-soft); border-radius: 16px; margin-bottom: 6px; }
.tile small { color: var(--ink-soft); font-weight: 500; }
.tile-go { margin-top: auto; padding-top: 10px; font: 700 .98rem/1 var(--font-fun); color: var(--link); }

.avatars { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.avatars label { cursor: pointer; }
.avatars input { position: absolute; opacity: 0; }
.avatars span { display: grid; place-items: center; width: 50px; height: 50px; font-size: 1.55rem; background: var(--fill); border: 2px solid transparent; border-radius: 50%; transition: transform .12s; }
.avatars input:checked + span { background: var(--brand-soft); border-color: var(--brand); transform: scale(1.1); }
.avatars input:focus-visible + span { outline: 3px solid var(--focus); }

/* ───── Trang kỳ thi ───── */
/* Banner đầu trang: biểu tượng nằm ngang cạnh tiêu đề (không xuống dòng), gọn chiều cao. */
.banner {
    display: flex; align-items: center; gap: 14px; flex-wrap: nowrap;
    background: linear-gradient(120deg, #fff0b8, #ffe08a); border-radius: var(--radius); padding: 14px 20px; margin-bottom: 16px;
}
.banner > div { flex: 1; min-width: 0; }
.banner h1 { margin: 0; font-size: 1.5rem; line-height: 1.25; }
.banner .icon { display: grid; place-items: center; width: 50px; height: 50px; font-size: 1.6rem; line-height: 1; flex: none; background: #fff; border-radius: 14px; box-shadow: var(--shadow-sm); }
.banner p { margin: 3px 0 0; font-weight: 500; font-size: .95rem; line-height: 1.45; color: #5c4a12; }
@media (max-width: 560px) {
    .banner { gap: 12px; padding: 12px 14px; border-radius: 16px; align-items: flex-start; }
    .banner .icon { width: 42px; height: 42px; font-size: 1.35rem; border-radius: 12px; }
    .banner h1 { font-size: 1.2rem; }
    .banner p { font-size: .86rem; }
}
.banner .pill { background: rgba(255, 255, 255, .7); }
.level-title { display: inline-block; font: 600 .82rem/1 var(--font-text); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 22px 0 10px; }
.rounds { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
.round { display: flex; flex-direction: column; gap: 4px; margin: 0; background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; transition: border-color .12s, box-shadow .12s; }
.round:hover { border-color: #cfd5e6; box-shadow: var(--shadow); }
.round.passed { background: var(--mint-soft); border-color: #bfe8d5; }
.round b { font: 700 1.08rem/1.2 var(--font-fun); }
.round small { color: var(--ink-soft); font-weight: 500; font-size: .84rem; }
.stars { font-size: 1.25rem; letter-spacing: 2px; color: #dfe3ee; }
.stars .on { color: var(--brand); }
.round .btn { margin-top: 10px; width: 100%; }
/* Thẻ đã đạt: nhãn "✓ Đã đạt" và nút "Làm đề mới" để con hiểu bấm lại là ôn tiếp với đề khác, không phải làm lại đề cũ. */
.round-done { align-self: flex-start; font: 700 .78rem/1 var(--font-text); color: #17714d; background: #fff; border: 1px solid #bfe8d5; border-radius: 999px; padding: 4px 9px; }
.round.passed .btn.primary { background: #fff; color: #17714d; border: 1.5px solid #9fdcc0; }
.round.passed .btn.primary:hover { background: #17714d; color: #fff; box-shadow: none; }
.endless { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 8px; padding: 10px 14px; background: #eef6ff; border: 1px solid #cfe2fb; border-radius: 12px; color: #23466e; font-weight: 500; }
.endless > span:first-child { font-size: 1.3rem; line-height: 1.2; }
/* Trang có cả chục nút "Thi thử": để nền vàng nhạt, chỉ đậm lên khi rê chuột, cho trang đỡ nặng. */
.round .btn.primary { background: var(--brand-soft); color: #7a5600; box-shadow: none; }
.round .btn.primary:hover { background: var(--brand); color: var(--ink); box-shadow: 0 2px 0 var(--brand-deep); }

/* ───── Màn hình làm bài ───── */
.exam-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.exam-bar .title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.timer { font: 800 1.35rem/1 var(--font-fun); font-variant-numeric: tabular-nums; white-space: nowrap; background: #fff; color: var(--ink); border-radius: 12px; padding: 10px 14px 7px; box-shadow: var(--shadow-sm); }
.timer.low { background: var(--coral-soft); color: var(--coral); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }

.track { position: relative; height: 10px; background: #e5e8f1; border-radius: 999px; margin: 0 14px 30px; }
.track-fill { height: 100%; width: 0; background: var(--brand); border-radius: 999px; transition: width .3s; }
.track-runner { position: absolute; top: -18px; left: 0; width: 28px; transform: translateX(-50%) rotate(12deg); transition: left .3s; }

.q { background: #fff; border-radius: var(--radius); padding: 26px; min-height: 320px; box-shadow: var(--shadow); }
.q-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.q-num { font: 600 .86rem/1 var(--font-text); color: #8a6100; background: var(--brand-soft); border-radius: 999px; padding: 7px 13px; }
.flag { font: 500 .86rem/1 var(--font-text); cursor: pointer; background: transparent; color: var(--ink-soft); border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 12px; }
.flag:hover { border-color: #cfd5e6; color: var(--ink); }
.flag[aria-pressed=true] { background: var(--coral-soft); border-color: transparent; color: var(--coral); }
.prompt { font: 600 1.28rem/1.5 var(--font-text); margin: 18px 0 20px; }
.passage { background: var(--fill); border-radius: 14px; padding: 16px 18px; margin: 16px 0 4px; line-height: 1.75; }
.passage b { font: 700 1.05rem/1.3 var(--font-fun); }
.passage p { margin: 6px 0 0; white-space: pre-line; }
.figure { margin: 16px 0 0; }
.figure svg { display: block; width: 100%; max-width: 340px; height: auto; }
.figure svg[viewBox="0 0 200 200"] { max-width: 210px; }
.review .figure svg { max-width: 240px; }
.figure svg.pic { width: 100%; }
.review .figure svg[viewBox="0 0 200 200"] { max-width: 150px; }

.choices { display: grid; gap: 10px; }
@media (min-width: 640px) { .choices.short { grid-template-columns: 1fr 1fr; } }
.choice { display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice-box {
    display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 14px; font-weight: 500; font-size: 1.06rem;
    border: 1.5px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .12s, background .12s, box-shadow .12s;
}
.choice:hover .choice-box { border-color: #cfd5e6; box-shadow: var(--shadow-sm); }
.letter { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; padding-top: 2px; font: 700 1rem/1 var(--font-fun); color: var(--ink-soft); background: var(--fill); transition: background .12s, color .12s; }
.choice input:checked + .choice-box { border-color: var(--brand-deep); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-soft); font-weight: 600; }
.choice input:checked + .choice-box .letter { background: var(--brand); color: var(--ink); }
.choice input:focus-visible + .choice-box { outline: 3px solid var(--focus); outline-offset: 2px; }

.choices.pics { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .choices.pics { grid-template-columns: repeat(4, 1fr); } }
.choices.pics .choice-box { min-height: 96px; font-size: 2.8rem; line-height: 1; }

.listen-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; }
.btn.listen.playing { background: var(--brand-soft); border-color: var(--brand); }
.listen-row [data-voice-status]:not(.warn) { display: none; }
[data-voice-status] { display: block; margin-top: 4px; }
[data-voice-status].warn { color: #b3261e; }
.listen-check { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

.fill { max-width: 320px; font-size: 1.35rem !important; font-weight: 600 !important; text-align: center; }

.order-answer { min-height: 66px; padding: 8px; border: 1.5px dashed #c9cfe0; border-radius: 14px; background: var(--fill); display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.order-answer:empty::before { content: attr(data-empty); color: var(--ink-soft); font-size: .93rem; padding: 12px 10px; }
.order-pool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 50px; }
.tok { font: 600 1.02rem/1.2 var(--font-text); cursor: pointer; padding: 10px 15px; min-height: 46px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .1s; }
.tok:hover { transform: translateY(-1px); }
.order-answer .tok { background: var(--brand-soft); border-color: var(--brand); }

.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick.letters .tok { min-width: 48px; font: 700 1.3rem/1 var(--font-fun); text-align: center; }
.pick .tok[aria-pressed="true"] { text-decoration: line-through 3px var(--coral); background: #fff1ef; border-color: var(--coral); color: var(--ink-soft); }
.pick-hint { font-size: .9rem; margin: 10px 0 0; }

.parts { display: grid; gap: 8px; }
.part { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 10px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; }
.part-item { font-weight: 600; font-size: 1.05rem; }
.part-item.emoji { font-size: 2.4rem; line-height: 1.1; }
.part select { width: auto; min-width: 180px; min-height: 42px; padding-top: 8px; padding-bottom: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 9px 13px; min-height: 42px; border-radius: 10px; font-size: .92rem; font-weight: 500; background: var(--fill); border: 1.5px solid transparent; }
.seg input:checked + span { background: var(--brand-soft); border-color: var(--brand-deep); font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); }

.nav-row { display: flex; justify-content: space-between; gap: 10px; margin: 20px 0 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.grid button { position: relative; font: 600 .95rem/1 var(--font-text); min-height: 44px; cursor: pointer; border: 1.5px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink-soft); }
.grid button.done { background: var(--brand-soft); border-color: transparent; color: #8a6100; }
.grid button.current { background: var(--ink); border-color: var(--ink); color: #fff; }
.grid.many { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 6px; }
.grid.many button { min-height: 36px; font-size: .82rem; border-radius: 9px; }
.grid button.flagged::after { content: ""; position: absolute; top: -4px; right: -4px; width: 11px; height: 11px; background: var(--coral); border: 2px solid #fff; border-radius: 50%; }
.submit-row { display: flex; justify-content: center; margin-top: 24px; }

/* ───── Kết quả ───── */
.result { text-align: center; position: relative; overflow: hidden; padding-top: 30px; }
.result .mascot { width: 104px; margin: 0 auto; }
.big-stars { font-size: 3rem; line-height: 1.15; letter-spacing: 6px; color: #e3e6ef; }
.big-stars span { display: inline-block; }
.big-stars .on { color: var(--brand); animation: pop .5s backwards; }
.big-stars .on:nth-child(2) { animation-delay: .15s; }
.big-stars .on:nth-child(3) { animation-delay: .3s; }
@keyframes pop { 0% { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.3); } }
.score { font: 800 4rem/1 var(--font-fun); }
.score span { font-size: 1.3rem; font-weight: 600; color: var(--ink-soft); margin-left: 6px; }
.cheer { font: 700 1.3rem/1.3 var(--font-fun); margin: 8px 0; }
.facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0 4px; padding: 0; list-style: none; }
.facts li { background: var(--fill); border-radius: 999px; padding: 6px 14px; font-weight: 500; font-size: .93rem; }
.result .actions { justify-content: center; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -24px; width: 9px; height: 15px; border-radius: 3px; background: var(--brand); animation: fall 2.6s linear forwards; }
.confetti i:nth-child(3n) { background: var(--coral); }
.confetti i:nth-child(3n+1) { background: #9db8ff; }
@keyframes fall { to { transform: translateY(560px) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

table { width: 100%; border-collapse: collapse; }
td, th { padding: 11px 6px; border-bottom: 1px solid var(--line); text-align: left; font-size: .95rem; }
tr:last-child td { border-bottom: 0; }
th { color: var(--ink-soft); font-weight: 600; font-size: .84rem; }
.bar-cell { width: 36%; }
.num { white-space: nowrap; text-align: right; font-weight: 600; }
.bar { height: 8px; background: #e9ecf4; border-radius: 999px; overflow: hidden; }
.bar div { height: 100%; border-radius: 999px; }
.bar .ok { background: var(--mint); }
.bar .mid { background: var(--brand); }
.bar .low { background: var(--coral); }

.review { border-radius: 14px; padding: 16px 18px; margin: 0 0 12px; background: var(--fill); border-left: 4px solid #d5d9e6; }
.review.right { background: var(--mint-soft); border-left-color: var(--mint); }
.review.wrong { background: var(--coral-soft); border-left-color: var(--coral); }
.review-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .92rem; }
.mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 700; font-size: .85rem; }
.review.right .mark { background: var(--mint); }
.review.wrong .mark { background: var(--coral); }
.review .prompt { font-size: 1.04rem; margin: 10px 0 8px; }
.review .passage { background: rgba(255, 255, 255, .7); font-size: .95rem; }
.solution { background: rgba(255, 255, 255, .75); border-radius: 10px; padding: 10px 12px; font-size: .94rem; color: #3b456e; }

/* ───── Kích hoạt ───── */
.plans { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 14px 0; }
.plan { cursor: pointer; }
.plan input { position: absolute; opacity: 0; }
.plan div { border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; background: #fff; transition: border-color .12s, background .12s; }
.plan b { font: 600 1rem/1.2 var(--font-text); display: block; color: var(--ink-soft); }
.plan .price { font: 800 1.7rem/1.3 var(--font-fun); }
.plan input:checked + div { border-color: var(--brand-deep); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-soft); }
.plan input:focus-visible + div { outline: 3px solid var(--focus); }
.pay { display: grid; gap: 22px; grid-template-columns: minmax(200px, 260px) 1fr; align-items: start; }
@media (max-width: 640px) { .pay { grid-template-columns: 1fr; } }
.qr { background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 10px; }
.qr svg { display: block; width: 100%; height: auto; }
/* Trang kích hoạt: nút Tiếp tục và hộp mã QR (dialog) */
.pay-next { width: 100%; max-width: 420px; display: block; margin: 4px auto 0; font-size: 1.05rem; padding: 14px 18px; }
.pay-dialog { width: min(420px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; border: 0; border-radius: 20px;
    padding: 20px 20px 16px; background: #fff; color: var(--ink); box-shadow: 0 20px 60px rgba(15, 23, 42, .28); text-align: center; }
.pay-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.pay-dialog h2 { margin: 0 0 4px; font-size: 1.25rem; outline: 0; }
.pay-plan { margin: 0 0 10px; color: var(--ink-soft); }
.pay-dialog .qr { width: min(260px, 100%); margin: 0 auto; }
.pay-scan { margin: 8px 0 12px; font-size: .92rem; color: var(--ink-soft); }
.pay-dialog form { margin: 0; }
.pay-done { width: 100%; font-size: 1.08rem; padding: 14px 18px; }
.pay-back { display: block; width: 100%; margin-top: 8px; box-sizing: border-box; }
.pay-x { position: sticky; top: 0; z-index: 2; float: right; display: grid; place-items: center; width: 40px; height: 40px; margin: -8px -8px 0 0; font-size: 1.15rem; color: var(--ink-soft); background: var(--fill); border: 0; border-radius: 50%; cursor: pointer; }
.pay-x:hover, .pay-x:focus-visible { color: var(--ink); background: #e6eaf4; }
.pay-wide { width: min(760px, calc(100vw - 24px)); }
.pay-wide .pay-main > h2, .pay-wide .pay-plan { padding-left: 32px; }
.pay-wide.asking { width: min(420px, calc(100vw - 24px)); }
.pay-wide.asking .pay-main, .pay-wide.asking .pay-buttons { display: none; }
.pay-cols { display: grid; grid-template-columns: 260px 1fr; gap: 6px 26px; align-items: start; }
.pay-wide .pay-manual { margin-top: 0; padding-top: 0; border-top: 0; }
.pay-wide .pay-scan { margin: 8px 0 0; font-size: .88rem; }
.pay-wide .pay-finish { clear: both; margin-top: 12px; padding-top: 14px; border-top: 1px dashed var(--line); }
.pay-buttons { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.pay-buttons .pay-back { width: auto; margin: 0; }
.pay-wide.asking .pay-finish { margin-top: 0; padding-top: 0; border-top: 0; }
.pay-wide.asking .pay-confirm:not([hidden]) { padding: 4px 4px 6px; background: none; gap: 10px; }
.pay-confirm-ico { font-size: 2.2rem; line-height: 1; }
.pay-confirm b { font: 700 1.15rem/1.4 var(--font-fun); }
@media (max-width: 640px) {
    .pay-cols { grid-template-columns: 1fr; }
    .pay-dialog.pay-wide { padding: 14px 16px 14px; }
    .pay-wide .qr { width: min(210px, 100%); padding: 6px; }
    .pay-wide .pay-manual { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
    .pay-buttons { grid-template-columns: 1fr; }
    .pay-buttons .pay-done { grid-row: 1; }
}
.pay-phone { display: none; gap: 6px; justify-items: center; margin: 8px 0 0; }
.pay-phone small { line-height: 1.4; }
@media (pointer: coarse), (max-width: 760px) { .pay-phone { display: grid; } }
.qr img { display: block; width: 100%; height: auto; }
.pay-copy { margin-left: 4px; padding: 2px 10px; font: 600 .8rem/1.5 var(--font-text); color: var(--link); background: var(--fill); border: 1px solid var(--line); border-radius: 99px; cursor: pointer; white-space: nowrap; }
.pay-dialog .pay-finish { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.pay-confirm:not([hidden]) { display: grid; gap: 8px; padding: 14px; background: var(--brand-soft); border-radius: 16px; }
.pay-confirm p { margin: 0 0 2px; font-size: .9rem; line-height: 1.45; }
.pay-manual { text-align: left; margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.pay-manual h3 { margin: 0 0 8px; font-size: 1rem; }
.pay-manual .hint { font-size: .88rem; }
.pay-manual .kv { gap: 6px 12px; }
.pay-manual .kv dt { white-space: nowrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--ink-soft); font-weight: 500; }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.memo { font: 700 1.02rem/1.4 var(--font-fun); background: var(--brand-soft); border-radius: 8px; padding: 3px 9px 1px; white-space: nowrap; }
.ent { display: flex; flex-wrap: wrap; gap: 14px; align-items: baseline; margin: 8px 0; }

/* ───── Quản trị: cùng nhận diện, gọn hơn ───── */
.admin .wrap { max-width: 1120px; }
.admin .card { padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.admin h1 { font-size: 1.6rem; margin-bottom: 14px; }
.admin-nav, .tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.admin-nav a, .tabs a { font: 600 .93rem/1 var(--font-text); text-decoration: none; color: var(--ink-soft); border-radius: 10px; padding: 10px 14px; }
.admin-nav a:hover, .tabs a:hover { background: #fff; color: var(--ink); }
.admin-nav a.on, .tabs a.on { background: var(--ink); color: #fff; }
.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 2px; }
.stat span { color: var(--ink-soft); font-size: .84rem; font-weight: 500; }
.stat b { font: 800 1.7rem/1.15 var(--font-fun); }
.stat.live { border-color: #17A673; background: #F1FBF6; }
.stat.live .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #17A673; margin-right: 6px; vertical-align: 1px;
  box-shadow: 0 0 0 0 rgba(23,166,115,.6); animation: live-dot 2s infinite; }
@keyframes live-dot { 70% { box-shadow: 0 0 0 7px rgba(23,166,115,0); } 100% { box-shadow: 0 0 0 0 rgba(23,166,115,0); } }
@media (prefers-reduced-motion: reduce) { .stat.live .dot { animation: none; } }
.stat small { color: var(--ink-soft); font-size: .84rem; }
.admin table input { min-height: 40px; padding: 8px 10px; }

@media (max-width: 520px) {
    body { font-size: 16px; }
    h1 { font-size: 1.55rem; }
    .card, .q { padding: 18px; }
    .prompt { font-size: 1.12rem; }
    .bar-cell { width: 24%; }
    .history td:nth-child(4), .history th:nth-child(4) { display: none; }
    .brand-name { font-size: 1.2rem; }
    .brand-mark { width: 38px; height: 38px; }
    .account { gap: 10px; font-size: .85rem; }
    .who { display: none; }
    .say .mascot { width: 64px; }
    .bubble { font-size: 1.05rem; }
}

/* ───── Thành phần bổ sung ───── */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; margin: 14px 0 4px; padding: 12px 14px; background: var(--fill); border-radius: 14px; }
.switch input { position: absolute; opacity: 0; }
.switch-track { position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: #cfd5e6; transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--brand-deep); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch b { display: block; font-weight: 600; }
.switch small { color: var(--ink-soft); font-weight: 500; }

.practice-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 14px; }
.practice { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 16px; border: var(--control-border); border-radius: 16px; }
.practice b { font: 700 1.05rem/1.2 var(--font-fun); }
.practice small { color: var(--ink-soft); font-size: .88rem; }
.practice .actions { margin-top: auto; padding-top: 12px; gap: 8px; }

.landing-hero { display: grid; grid-template-columns: 1fr 200px; gap: 24px; align-items: center; padding: 18px 4px 30px; }
.landing-hero h1 { font-size: 2.5rem; }
.lead { font-size: 1.12rem; color: #3b456e; margin: 12px 0 4px; }
.landing-mascot { width: 180px; justify-self: center; }
.feature-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 20px; }
.feature-grid .card { margin: 0; }
.feature-grid p { color: var(--ink-soft); margin-top: 6px; }
.tile.static:hover { transform: none; box-shadow: none; border-color: var(--line); }
.plan.static { cursor: default; }
.prose { max-width: 760px; margin-inline: auto; }
.prose h2 { font-size: 1.2rem; margin: 22px 0 6px; }
.prose li { margin: 4px 0; }
.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 20px; }
.stat { background: #fff; border-radius: 16px; padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--shadow-sm); }

@media (max-width: 640px) {
    .landing-hero { grid-template-columns: 1fr; }
    .landing-hero h1 { font-size: 1.9rem; }
    .landing-mascot { width: 120px; order: -1; }
    .menu-name { display: none; }
    .menu summary { padding-right: 6px; }
    .kid-tools { margin-left: 0; width: 100%; }
}

/* ───── Liên hệ ───── */
.contact-grid { display: grid; gap: 16px; margin: 16px 0; }
@media (min-width: 760px) { .contact-grid { grid-template-columns: 1fr 1fr; } }
.contact-grid .card { margin: 0; }
.contact-address { display: inline-block; margin: 6px 0; font: 700 1.3rem/1.3 var(--font-fun); word-break: break-all; }
.contact-promise { display: inline-block; margin: 4px 0 10px; padding: 4px 12px; border-radius: 999px; background: var(--brand-soft); color: #8a6100; font-weight: 600; }
.contact-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.contact-strip h2 { margin-top: 0; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; resize: vertical; }
.faq details { border-top: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
/* Trang luyện thi công khai (/luyen-thi/...) */
.practice-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 6px 0 10px; }
.practice-facts > div { background: var(--brand-soft); border-radius: 14px; padding: 10px 12px; display: grid; text-align: center; }
.practice-facts b { font: 800 1.6rem/1.1 var(--font-fun); }
.practice-facts span { font-size: .85rem; color: var(--ink-soft); }
.practice-group h2 { margin-bottom: 2px; }
.faq details p { margin: 8px 0 0; color: var(--ink-soft); }

/* ═══════════════════════════════════════════════════════════════════════════
   VUI MẮT HƠN CHO HỌC SINH (19/11)
   - Mỗi kỳ thi một màu riêng (Competition.Theme): --t là màu đậm, --t-soft là nền nhạt.
   - Mỗi hồ sơ học sinh một màu riêng (Child.Theme): --k, --k-soft.
   - Nền có hoạ tiết sao/chấm rất nhạt; linh vật nhún nhảy nhẹ; khung avatar mở khoá bằng thành tích.
   ═══════════════════════════════════════════════════════════════════════════ */
.theme-red    { --t: #e5484d; --t-soft: #fdeced; }
.theme-blue   { --t: #2f6bf0; --t-soft: #e8efff; }
.theme-green  { --t: #0f9a62; --t-soft: #e3f6ed; }
.theme-purple { --t: #7c4fe8; --t-soft: #efe9ff; }
.theme-orange { --t: #ec7a1c; --t-soft: #fff0e2; }
.theme-teal   { --t: #0b9796; --t-soft: #e0f6f5; }

.kid-sun   { --k: #ffc83d; --k-soft: #fff5d6; }
.kid-sky   { --k: #4aa3ff; --k-soft: #e6f2ff; }
.kid-mint  { --k: #2cc38a; --k-soft: #e0f7ee; }
.kid-grape { --k: #9b6bff; --k-soft: #f0e9ff; }
.kid-peach { --k: #ff8f6b; --k-soft: #ffece5; }
.kid-berry { --k: #ff5fa2; --k-soft: #ffe6f1; }

body {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg opacity='.22'%3E%3Cpath d='M30 22l3 7 7 1-5 5 1 7-6-4-6 4 1-7-5-5 7-1z' fill='%23ffd76a'/%3E%3Ccircle cx='160' cy='40' r='4' fill='%23b9ccff'/%3E%3Ccircle cx='100' cy='130' r='3' fill='%23ffb4ab'/%3E%3Cpath d='M180 150l2 5 5 1-4 3 1 5-4-3-4 3 1-5-4-3 5-1z' fill='%23a8e6cc'/%3E%3Ccircle cx='40' cy='180' r='5' fill='%23ffe3a1'/%3E%3C/g%3E%3C/svg%3E"),
        var(--bg);
}

/* Linh vật nhún nhảy nhẹ (đã tắt khi người dùng chọn giảm chuyển động). */
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
.say .mascot, .landing-mascot .mascot, .result .mascot { animation: bob 2.8s ease-in-out infinite; transform-origin: 50% 90%; }
.brand:hover .mascot { animation: bob .8s ease-in-out 2; }

/* Ô kỳ thi: dải màu trên đầu, biểu tượng nền màu của kỳ thi, rê chuột thì nghiêng nhẹ. */
.tile { position: relative; overflow: hidden; padding-top: 22px; }
.tile::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: var(--t, var(--brand)); }
.tile-icon { background: var(--t-soft, var(--brand-soft)); transition: transform .2s; }
.tile:hover { border-color: var(--t, var(--brand)); }
.tile:hover .tile-icon { transform: rotate(-8deg) scale(1.08); }
.tile-go { color: var(--t, var(--link)); }

/* Banner trang kỳ thi theo màu kỳ thi. */
.banner[class*="theme-"] { background: linear-gradient(120deg, var(--t-soft), #fff 85%); border: 1.5px solid color-mix(in srgb, var(--t) 25%, transparent); }
.banner[class*="theme-"] p { color: var(--ink-soft); }
.banner[class*="theme-"] .icon { background: var(--t); box-shadow: 0 3px 0 color-mix(in srgb, var(--t) 70%, #000); }

/* Thẻ học sinh: viền trái và nền nhạt theo màu học sinh chọn. */
.kid-card { border-top: 6px solid var(--k, var(--brand)); background: linear-gradient(180deg, var(--k-soft, var(--brand-soft)) 0, #fff 140px); }
.kid-card .avatar { background: #fff; box-shadow: 0 0 0 4px var(--k, var(--brand)); }
.kid-greet { display: flex; align-items: center; gap: 12px; margin: -4px 0 16px; }
.kid-greet .mascot { width: 46px; flex: none; animation: bob 2.8s ease-in-out infinite; }
.kid-greet .bubble { font-size: 1.02rem; padding: 10px 14px; }
.kid-title { display: inline-block; margin: 2px 0 4px; padding: 2px 12px 2px 9px; border-radius: 999px; font: 700 .86rem/1.5 var(--font-fun); color: color-mix(in srgb, var(--k, var(--brand)) 55%, var(--ink));
    background: color-mix(in srgb, var(--k, var(--brand)) 16%, #fff); border: 1.5px solid color-mix(in srgb, var(--k, var(--brand)) 45%, #fff); }
.streak::before { content: "🔥 "; }

/* Khung avatar (mở khoá bằng thành tích, xem Tủ đồ). */
.avatar { position: relative; }
.frame-bronze  { box-shadow: 0 0 0 4px #cd8b4a, 0 0 0 7px #f3d9bd !important; }
.frame-silver  { box-shadow: 0 0 0 4px #aab4c8, 0 0 0 7px #e9edf5 !important; }
.frame-gold    { box-shadow: 0 0 0 4px #f2b705, 0 0 0 7px #ffe9a3 !important; }
.frame-rainbow { box-shadow: none !important; background: #fff; outline: 0; }
.frame-rainbow::after { content: ""; position: absolute; inset: -6px; z-index: -1; border-radius: 50%; background: conic-gradient(#ff5f6d, #ffc371, #5cd85a, #4aa3ff, #9b6bff, #ff5f6d); animation: spin 6s linear infinite; }
.frame-fire    { box-shadow: 0 0 0 4px #ff7a1a, 0 0 14px 4px rgba(255, 122, 26, .45) !important; }
.frame-diamond { box-shadow: 0 0 0 4px #57d7ff, 0 0 0 7px #d6f6ff, 0 0 16px 3px rgba(87, 215, 255, .5) !important; }
.frame-fixer   { box-shadow: 0 0 0 4px #17a673, 0 0 0 7px #c8f0dd !important; }
@keyframes spin { to { transform: rotate(360deg); } }
.avatar, .avatar-lg { isolation: isolate; }

/* Biểu tượng cấp độ ở mỗi vòng. */
.round b::before { content: attr(data-icon) " "; }
.round.passed::after { content: "✓"; position: absolute; top: 10px; right: 12px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--mint); color: #fff; font-weight: 800; font-size: .8rem; }
.round { position: relative; }
.stars .on { color: #ffb400; text-shadow: 0 1px 0 #e09a00; }

/* ───── Tủ đồ ───── */
.wardrobe-hero { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.avatar-xl { width: 104px; height: 104px; font-size: 3.6rem; }
.kid-stats { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 12px 0 0; }
.kid-stats li { background: #fff; border-radius: 999px; padding: 4px 12px; font-size: .9rem; box-shadow: var(--shadow-sm); }
.closet { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); margin-top: 14px; }
.closet-avatar { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
.closet-item { margin: 0; }
.closet-item button {
    width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px;
    font: 600 .86rem/1.3 var(--font-text); color: var(--ink); text-align: center; cursor: pointer;
    background: #fff; border: 2px solid var(--line); border-radius: 16px; transition: transform .12s, border-color .12s, box-shadow .12s;
}
.closet-item button:not(:disabled):hover { transform: translateY(-3px) rotate(-1deg); border-color: var(--brand); box-shadow: var(--shadow); }
.closet-item.on button { border-color: var(--brand-deep); background: var(--brand-soft); cursor: default; }
.closet-item.locked button { cursor: not-allowed; background: var(--fill); }
.closet-item.locked .closet-pic, .closet-item.locked .avatar, .closet-item.locked .swatch, .closet-item.locked .closet-title { filter: grayscale(1); opacity: .45; }
.closet-pic { font-size: 2.6rem; line-height: 1; }
.closet-item .avatar { width: 56px; height: 56px; font-size: 1.8rem; margin: 6px; }
.swatch { width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, var(--k), var(--k-soft)); box-shadow: inset 0 0 0 3px #fff, 0 0 0 2px var(--k); }
.closet-title { font-size: 2rem; line-height: 1; }
.closet-need { font-size: .76rem; font-weight: 600; color: var(--ink-soft); }

/* wardrobe-rare:start */
/* ───── Món quý trong Tủ đồ: hình đại diện có nền riêng, khung vẽ (wwwroot/wardrobe/*.svg), danh hiệu có nền ───── */
.rare-1 { --r: #1f8fe0; --r2: #6fd0ff; }
.rare-2 { --r: #8a3ffc; --r2: #d79bff; }
.rare-3 { --r: #e8780a; --r2: #ffd24a; }
.rare-4 { --r: #d6215f; --r2: #ffb13d; }
.rarity { display: inline-block; padding: 2px 10px; border-radius: 999px; font: 700 .72rem/1.5 var(--font-fun); color: #fff; background: linear-gradient(100deg, var(--r), color-mix(in srgb, var(--r) 55%, var(--r2))); }
.closet-item.rare button { position: relative; overflow: hidden; border-color: var(--r2); background: radial-gradient(120% 80% at 50% 0, color-mix(in srgb, var(--r2) 45%, #fff), #fff 75%); box-shadow: 0 0 0 1px var(--r2), 0 4px 14px color-mix(in srgb, var(--r) 22%, transparent); }
.closet-item.rare.on button { border-color: var(--r); box-shadow: 0 0 0 2px var(--r), 0 4px 16px color-mix(in srgb, var(--r) 35%, transparent); }
/* Món quý chưa mở vẫn giữ màu (chỉ dịu đi) để con thấy phần thưởng đang chờ. */
.closet-item.rare.locked button { background: radial-gradient(120% 80% at 50% 0, color-mix(in srgb, var(--r2) 30%, #fff), var(--fill) 80%); }
.closet-item.rare.locked .avatar, .closet-item.rare.locked .closet-title { filter: saturate(.75); opacity: .8; }
.closet-item.rare .closet-label { font-weight: 700; }
.closet-item.rare .closet-title { filter: drop-shadow(0 2px 5px color-mix(in srgb, var(--r) 45%, transparent)); font-size: 2.3rem; }
.closet-bar { width: 100%; height: 7px; border-radius: 999px; background: rgba(0, 0, 0, .09); overflow: hidden; }
.closet-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--r2), var(--r)); }
.closet-count { display: grid; gap: 2px; font-size: .74rem; line-height: 1.25; color: var(--ink-soft); margin-top: -3px; }
.closet-avatar .rarity { padding: 2px 7px; font-size: .62rem; white-space: nowrap; }
.closet-item button { justify-content: center; }
.closet-item.rare button { justify-content: flex-start; }

.title-rare { margin-bottom: 5px; padding: 2px 12px; border-radius: 999px; color: #fff; background: linear-gradient(100deg, var(--r) 0 35%, var(--r2) 50%, var(--r) 65% 100%); background-size: 260% 100%; box-shadow: 0 2px 8px color-mix(in srgb, var(--r) 40%, transparent); text-shadow: 0 1px 2px rgba(0, 0, 0, .35); animation: shine 4.5s linear infinite; }
@keyframes shine { from { background-position: 130% 0; } to { background-position: -130% 0; } }

/* Nền của hình đại diện quý. */
.avatar[class*="av-"] { color: #fff; text-shadow: 0 0 10px rgba(255, 255, 255, .75); background-size: 100% 100%; }
.avatar.av-eagle { background: conic-gradient(from 20deg at 50% 50%, transparent 0 8%, rgba(255, 255, 255, .55) 9% 11%, transparent 12% 40%, rgba(255, 255, 255, .5) 41% 43%, transparent 44% 72%, rgba(255, 255, 255, .55) 73% 75%, transparent 76%), radial-gradient(circle at 50% 35%, #c8f1ff, #38a7f5 45%, #14408f) !important; }
.avatar.av-genie { background: radial-gradient(circle at 24% 28%, #fff 0 2.5%, transparent 4%), radial-gradient(circle at 78% 22%, #ffe9a3 0 3%, transparent 4.5%), radial-gradient(circle at 80% 72%, #fff 0 2%, transparent 3.5%), radial-gradient(circle at 50% 100%, #ffd36b, transparent 45%), radial-gradient(circle at 50% 40%, #ff9df0, #a03df5 50%, #3d1390) !important; }
.avatar.av-dragon { background: repeating-conic-gradient(rgba(255, 246, 200, .65) 0 8deg, transparent 8deg 30deg), radial-gradient(circle, #fff2a8, #ffb020 42%, #e0331a 78%, #8d1020) !important; }

/* Khung vẽ: hình trang trí lớn hơn hình đại diện (136/200), nằm trên, không bắt chuột. */
.frame-laurel, .frame-aurora, .frame-galaxy, .frame-royal { box-shadow: none !important; }
.frame-laurel::after, .frame-aurora::after, .frame-galaxy::after, .frame-royal::after,
.frame-galaxy::before, .frame-aurora::before, .frame-royal::before { content: ""; position: absolute; inset: -23.53%; background: center / 100% 100% no-repeat; pointer-events: none; }
.frame-laurel::after { background-image: url(../wardrobe/laurel.svg); }
.frame-aurora::after { background-image: url(../wardrobe/aurora.svg); animation: spin 18s linear infinite; }
.frame-aurora::before { z-index: -1; border-radius: 50%; background: conic-gradient(#19e3b1, #4f7bff, #c44dff, #7dffcf, #19e3b1); filter: blur(5px); -webkit-mask: radial-gradient(farthest-side, transparent 66%, #000 69%, transparent 99%); mask: radial-gradient(farthest-side, transparent 66%, #000 69%, transparent 99%); animation: spin 7s linear infinite reverse; }
.frame-galaxy::before { background-image: url(../wardrobe/galaxy-ring.svg); animation: spin 24s linear infinite; }
.frame-galaxy::after { background-image: url(../wardrobe/galaxy-orbit.svg); }
.frame-royal::before { z-index: -1; inset: -34%; border-radius: 50%; background: repeating-conic-gradient(rgba(255, 196, 0, .55) 0 7deg, transparent 7deg 20deg); -webkit-mask: radial-gradient(farthest-side, transparent 60%, #000 62%, transparent 98%); mask: radial-gradient(farthest-side, transparent 60%, #000 62%, transparent 98%); animation: spin 26s linear infinite; }
.frame-royal::after { background-image: url(../wardrobe/royal.svg); }
/* Khung vẽ cần khoảng trống quanh hình. */
.avatar:is(.frame-laurel, .frame-aurora, .frame-galaxy, .frame-royal) { margin: 10px 16px 10px 12px; }
.avatar-xl:is(.frame-laurel, .frame-aurora, .frame-galaxy, .frame-royal) { margin: 26px; }
.closet-item .avatar:is(.frame-laurel, .frame-aurora, .frame-galaxy, .frame-royal) { margin: 16px; }
/* Khung cầu vồng không che nền của hình đại diện quý. */
.avatar[class*="av-"].frame-rainbow::after { -webkit-mask: radial-gradient(farthest-side, transparent 82%, #000 84%); mask: radial-gradient(farthest-side, transparent 82%, #000 84%); }
/* wardrobe-rare:end */

/* Quà mở khoá ở trang kết quả. */
.unlock { text-align: left; border: 2px dashed var(--brand-deep); background: var(--brand-soft); border-radius: 16px; padding: 14px 18px; margin: 16px auto 0; max-width: 520px; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.unlock b { font-family: var(--font-fun); font-size: 1.1rem; }
.unlock ul { margin: 6px 0 8px; padding-left: 20px; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }

/* ───── Báo lỗi câu hỏi ───── */
.report-btn { margin-top: 4px; padding: 4px 10px; font: 600 .82rem/1.5 var(--font-text); color: var(--ink-soft); background: none; border: 1px solid transparent; border-radius: 999px; cursor: pointer; }
.report-btn:not([hidden]) { display: inline-block; margin-left: -10px; }
.report-btn:hover, .report-btn:focus-visible { color: var(--ink); background: rgba(255, 255, 255, .8); border-color: var(--line); }
.report-done { display: inline-block; margin-top: 4px; padding: 3px 12px; font-size: .82rem; font-weight: 600; color: var(--ink-soft); background: rgba(255, 255, 255, .75); border-radius: 999px; }
.report-dialog .report-reasons { display: grid; gap: 8px; margin: 10px 0 14px; }
.report-dialog form { text-align: left; }
.report-dialog .report-reasons label { cursor: pointer; }
.report-dialog .report-reasons input { position: absolute; opacity: 0; }
.report-dialog .report-reasons span { display: block; padding: 11px 14px; font-weight: 600; border: 2px solid var(--line); border-radius: 12px; }
.report-dialog .report-reasons input:checked + span { border-color: var(--brand-deep); background: var(--brand-soft); }
.report-dialog .report-reasons input:focus-visible + span { outline: 3px solid var(--focus); }
.report-dialog .report-check { margin: -4px 0 14px; padding: 10px 14px; background: #fff7e0; border-radius: 12px; font-size: .92rem; }
.report-dialog .report-check p { margin: 0 0 8px; }
.report-dialog .report-check label { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.report-dialog .report-check input { width: 20px; height: 20px; }
.report-dialog .report-more { display: block; font-size: .9rem; font-weight: 600; }
.report-dialog textarea { width: 100%; margin-top: 6px; }
.report-dialog .actions { margin-top: 14px; }
.report-group .review { margin-top: 10px; }
.report-note { margin: 8px 0; padding: 8px 12px; background: #fff; border-radius: 10px; font-weight: 600; overflow-wrap: anywhere; }
.report-one { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 6px 0 0; }
.report-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.report-actions input[name=note] { flex: 1 1 240px; min-width: 0; padding: 8px 12px; font: inherit; font-size: .9rem; border: 1px solid var(--line); border-radius: 10px; }
.admin-side-count { margin-left: auto; padding: 0 8px; border-radius: 999px; background: var(--coral); color: #fff; font-size: .75rem; line-height: 1.6; }

/* ───── Góc ôn thi (bài viết) ───── */
.news-list { display: grid; gap: 16px; }
.news-card { margin: 0; }
.news-card h2 { margin: 4px 0 6px; font-size: 1.3rem; }
.news-card h2 a { color: var(--ink); text-decoration: none; }
.news-card h2 a:hover { color: var(--link); }
.news-more { font-family: var(--font-fun); }
.news-mini { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin: 12px 0; }
.pager { display: flex; gap: 8px; justify-content: center; margin: 20px 0; }
.article h1 { font-size: 2rem; margin: 8px 0 4px; }
.article h2 { font-size: 1.35rem; margin: 26px 0 8px; }
.article h3 { font-size: 1.12rem; margin: 18px 0 6px; }
.article p, .article li { line-height: 1.75; }
.article ul, .article ol { padding-left: 22px; }
.news-related { padding-left: 20px; display: grid; gap: 6px; }

/* Đề song ngữ (TIMO): dòng tiếng Anh và dòng tiếng Việt nằm trên hai dòng. */
.prompt { white-space: pre-line; }

/* Trang chủ: lượt miễn phí còn lại và mời bạn */
.quota { display: grid; gap: 12px; border: 2px solid var(--brand); background: var(--brand-soft); }
.quota-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.quota-head b { font-family: var(--font-fun); font-size: 1.15rem; }
.quota-items { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.quota-items small { font-size: .85rem; line-height: 1.25; }
.quota-items > div { background: #fff; border-radius: 14px; padding: 10px 6px; display: grid; text-align: center; }
.quota-items b { font-family: var(--font-fun); font-size: 1.9rem; line-height: 1.1; color: #b45309; }
.quota-items .empty b { color: #9ca3af; }
/* Thanh lượt miễn phí gọn (trang chủ, bản miễn phí) */
.quota-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 16px; padding: 8px 10px 8px 14px;
  border-radius: 14px; background: var(--brand-soft); border: 1.5px solid var(--brand); font-size: .92rem; }
.qb-title { font-weight: 700; }
.qb-chip { background: #fff; border-radius: 999px; padding: 3px 11px; font-weight: 600; white-space: nowrap; }
.qb-chip b { font-family: var(--font-fun); color: #b45309; font-size: 1.05rem; }
.qb-chip.empty { color: #9ca3af; }
.qb-chip.bonus b { color: #0E7A50; }
.qb-more summary { list-style: none; cursor: pointer; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink-soft); font-weight: 700; }
.qb-more summary::-webkit-details-marker { display: none; }
.qb-more summary:hover, .qb-more[open] summary { background: #fff; color: var(--ink); }
.qb-more[open] { flex-basis: 100%; order: 10; }
.qb-c, .qb-more[open] .qb-o { display: none; }
.qb-more[open] .qb-c { display: inline; }
.qb-more[open] summary { width: auto; height: auto; padding: 2px 10px; border-radius: 999px; font-size: .82rem; justify-self: start; display: inline-grid; }
.qb-info { font-size: .86rem; color: var(--ink-soft); line-height: 1.45; }
.qb-info p { margin: 4px 0; }
.qb-up { margin-left: auto; }
@media (max-width: 480px) {
  .quota-bar { gap: 5px 6px; padding: 7px 8px 7px 10px; font-size: .84rem; }
  .qb-t { display: none; }
  .qb-chip { padding: 2px 8px; }
  .qb-up { padding-left: 10px; padding-right: 10px; }
  .qb-pt { display: none; }
}
/* Đề mini mỗi ngày (trang kỳ thi) */
.mini { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; border: 2px dashed var(--brand); }
.mini b { font-family: var(--font-fun); font-size: 1.15rem; }
.mini > div { display: grid; gap: 2px; }
/* Trang kích hoạt: nhấn mạnh không giới hạn */
.unlimited { display: grid; gap: 10px; border: 2px solid var(--brand); background: var(--brand-soft); }
.unlimited h2 { margin: 0; }
.unlimited ul { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 8px; }
.unlimited li { background: #fff; border-radius: 12px; padding: 10px 12px; }
.unlimited li b { font-family: var(--font-fun); }

/* Chọn học sinh trên thanh menu (tài khoản có từ hai em trở lên) */
.kid-switch summary { padding: 4px 10px 4px 4px; background: var(--brand-soft); border-color: var(--brand); }
.kid-switch-avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; font-size: 1.3rem; line-height: 1; flex: none; }
.kid-switch .menu-panel { width: 240px; }
.kid-switch .menu-panel a { display: flex; align-items: center; gap: 10px; }
.kid-switch .menu-panel a small { margin-left: auto; }
.kid-switch .menu-panel a.current { background: var(--brand-soft); font-weight: 700; }
.menu-label { display: block; padding: 6px 12px 8px; color: var(--ink-soft); font-size: .85rem; }
/* Mời bạn: một dòng gọn trong ô lượt miễn phí */
.invite-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1.5px dashed var(--brand); font-size: .92rem; }
.add-kid > summary { cursor: pointer; font-family: var(--font-fun); font-size: 1.1rem; font-weight: 700; list-style: none; }
.add-kid > summary::-webkit-details-marker { display: none; }
.add-kid[open] > summary { margin-bottom: 12px; }
/* Điện thoại hẹp có thêm thanh chọn học sinh: thu nhỏ tên thương hiệu để không xuống dòng */
@media (max-width: 420px) {
    .brand { gap: 7px; }
    .brand-name { font-size: 1.05rem; }
    .top-nav { gap: 6px; }
}

.add-kid-note { margin: 0 0 12px; padding: 10px 12px; background: var(--brand-soft); border-radius: 12px; }

/* Trang kích hoạt: xác nhận đã báo chuyển khoản */
.sent { display: flex; gap: 16px; align-items: flex-start; border: 2px solid var(--mint, #34d399); background: var(--mint-soft, #ecfdf5); }
.sent .mascot, .sent svg:first-child { width: 72px; flex: none; }
.sent h2 { margin-bottom: 6px; }
.sent p { margin: 0 0 8px; }
.sent.just { animation: sent-pop .35s ease-out; }
.upgrade-sent { max-width: 640px; margin: 24px auto; }
/* Cộng đồng: số liệu hoạt động thật, bài chính thức của Phòng Thi Thử */
.community-activity { background: var(--brand-soft); border-radius: 14px; padding: 10px 16px; margin: 0 0 14px; }
.post.official { border: 1.5px solid var(--brand-deep); }
.official-pill { display: inline-block; width: auto; margin-left: 6px; padding: 1px 8px; font-size: .7rem; line-height: 1.5; vertical-align: 2px; background: var(--brand-deep); color: #fff; }
.admin-reply { display: flex; gap: 8px; margin: 8px 0; }
/* Quản trị · Link giới thiệu */
.table-scroll { overflow-x: auto; }
.ref-form { display: grid; gap: 14px 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; margin: 8px 0; }
.ref-form label { display: grid; gap: 6px; align-content: start; font-size: .92rem; font-weight: 600; }
.ref-form label input, .ref-form label select { width: 100%; min-width: 0; font-weight: 400; }
.ref-form .hint { font-weight: 400; font-size: .82rem; line-height: 1.45; }
.ref-form .ref-submit { grid-column: 1 / -1; }
.ref-out { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
/* Bảng trang Link giới thiệu: trên điện thoại mỗi dòng thành một thẻ, số liệu xếp 2 cột kèm nhãn. */
@media (max-width: 640px) {
  .ref-cards thead { display: none; }
  .ref-cards, .ref-cards tbody { display: block; width: auto; }
  .ref-cards tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; border: 1px solid var(--line); border-radius: 14px;
    padding: 10px 12px; margin-bottom: 10px; background: #fff; }
  .ref-cards td { display: block; border: 0; padding: 0; text-align: left !important; }
  .ref-cards td:first-child { grid-column: 1 / -1; font-weight: 700; }
  .ref-cards td[data-label]::before { content: attr(data-label); display: block; color: var(--ink-soft); font-size: .76rem; font-weight: 500; }
  .ref-cards td[data-label="Link"] { grid-column: 1 / -1; }
  .ref-cards td.ref-act { grid-column: 1 / -1; }
  .ref-cards td.ref-act .btn { width: 100%; }
  .table-scroll:has(> .ref-cards) { overflow: visible; }
}
@media (max-width: 560px) {
  .ref-form { grid-template-columns: 1fr; }
  .ref-form .ref-submit .btn, .ref-out .btn { width: 100%; }
  .ref-out input { flex-basis: 100%; }
}
.ref-out input { flex: 1; min-width: 0; font-weight: 600; }
.ref-rules { margin-top: 12px; }
.ref-rules summary { cursor: pointer; font-weight: 600; }
.ref-rules li { margin: 6px 0; }
.comment-form .dd { flex: 0 0 auto; width: 9.5em; max-width: 42%; }
.comment-form .dd .dd-btn { font-size: .85rem; border-radius: 999px; }
.comment-family { font-weight: 500; color: var(--ink-soft); font-size: .85em; }
.admin-reply input { flex: 1; min-width: 0; padding: 6px 10px; font: inherit; border: 1px solid var(--line); border-radius: 8px; }
/* Trang kết quả: lời cổ vũ tính từ số liệu thật */
.cheer-stats { list-style: none; padding: 0; margin: 4px auto 14px; display: grid; gap: 8px; max-width: 460px; }
.cheer-stats li { background: var(--brand-soft); border-radius: 12px; padding: 9px 14px; font-weight: 600; line-height: 1.4; }
/* Quản trị · đơn chuyển khoản: ô ghi chú ngắn */
.order-note { white-space: nowrap; }
.order-note input { width: 190px; max-width: 100%; padding: 6px 8px; font: inherit; font-size: .88rem; border: 1px solid var(--line); border-radius: 8px; }
.order-note .link { margin-left: 6px; font-size: .85rem; }
.upgrade-sent h1 { font-size: 1.4rem; margin: 0 0 8px; }
@keyframes sent-pop { from { transform: scale(.96); opacity: .4; } to { transform: none; opacity: 1; } }
@media (max-width: 520px) { .sent { flex-direction: column; } }

/* Lịch sử làm bài */
.page-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.page-tabs .active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-size: .9rem; font-weight: 600; }
.chip.on { background: var(--brand); border-color: var(--brand-deep); }
.history { padding: 6px; }
.history-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; color: var(--ink); text-decoration: none; }
.history-row + .history-row { border-top: 1px solid var(--line); }
.history-row:hover { background: var(--fill); }
.history-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; font-size: 1.3rem; flex: none; background: var(--brand-soft); }
.history-main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.history-main small { color: var(--ink-soft); }
.history-score { display: grid; justify-items: end; gap: 2px; text-align: right; }
.history-score b { font-family: var(--font-fun); font-size: 1.25rem; }
.history-score b small { font-size: .8rem; color: var(--ink-soft); }
.history-score > small { color: var(--ink-soft); font-size: .8rem; }
.history-go { color: var(--ink-soft); font-size: 1.4rem; }
.stars.small span { font-size: .85rem; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 12px 0; }
.review-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.small-switch { margin: 0; }
/* Nút Thành tích / Báo cáo / Lịch sử trên thẻ học sinh */
/* Lối tắt theo dõi (Thành tích, Báo cáo tuần, Lịch sử): thanh công cụ trung tính, khác hẳn thẻ kỳ thi nhiều màu. */
.kid-track { margin: 6px 0 18px; }
.kid-track-title { display: block; margin: 0 0 6px 2px; font: 700 .8rem/1.2 var(--font-text); color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }
.kid-links { display: grid; grid-template-columns: repeat(3, 1fr); background: #fff; border: 1px solid #dfe4ef; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); }
.kid-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; text-decoration: none; color: var(--ink); transition: background .12s; }
.kid-link + .kid-link { border-left: 1px solid #e8ecf4; }
.kid-link:hover { background: var(--fill); color: var(--ink); }
.kid-link-ico { flex: none; display: grid; place-items: center; width: 38px; height: 38px; font-size: 1.25rem; line-height: 1; background: var(--fill); border-radius: 50%; }
.kid-link:hover .kid-link-ico { background: #fff; box-shadow: 0 0 0 1px #dfe4ef; }
.kid-link-txt { display: grid; min-width: 0; }
.kid-link-txt b { font: 700 .95rem/1.25 var(--font-text); }
.kid-link-txt small { color: var(--ink-soft); font-size: .78rem; line-height: 1.3; }
.kid-link-go { margin-left: auto; font-size: 1.4rem; line-height: 1; color: #a8b0c6; transition: transform .12s; }
.kid-link:hover .kid-link-go { transform: translateX(3px); color: var(--ink); }
/* Điện thoại: danh sách dọc như trang cài đặt. */
@media (max-width: 600px) {
    .kid-links { grid-template-columns: 1fr; }
    .kid-link + .kid-link { border-left: 0; border-top: 1px solid #e8ecf4; }
}
/* ───── Bảng khen tuần ───── */
.week-goal-bar { display: block; height: 10px; border-radius: 999px; background: rgba(24, 119, 92, .13); overflow: hidden; }
.week-goal-bar i { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, #ffd24a, #ff9d3c 45%, #17a673); }
.week-strip { display: grid; grid-template-columns: auto 1fr minmax(150px, 230px); gap: 8px 16px; align-items: center; margin: 0 0 14px; padding: 11px 14px; text-decoration: none; color: var(--ink); background: linear-gradient(100deg, #fff8dd, #eefaf4); border: 1px solid #f1e3b0; border-radius: 14px; transition: transform .12s, box-shadow .12s; }
.week-strip:hover { color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.week-strip-title { font: 700 .98rem/1.3 var(--font-fun); white-space: nowrap; }
.week-strip-awards { display: flex; flex-wrap: wrap; gap: 6px; }
.week-strip-awards span { padding: 2px 10px; font-size: .82rem; font-weight: 600; color: var(--ink-soft); background: rgba(255, 255, 255, .8); border: 1px dashed #d9d3bd; border-radius: 999px; white-space: nowrap; }
.week-strip-awards span.on { color: #0e6b4a; background: #dcf5e8; border: 1px solid #8fd9b6; }
.week-strip-goal { display: grid; gap: 3px; }
.week-strip-goal small { font-size: .76rem; color: var(--ink-soft); }
@media (max-width: 720px) { .week-strip { grid-template-columns: 1fr; } }
.week-board { scroll-margin-top: 84px; }
.week-goal { padding: 14px 16px; background: linear-gradient(100deg, #fff8dd, #eefaf4); border-radius: 14px; display: grid; gap: 7px; }
.week-goal-head { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; }
.week-goal-head span { font-weight: 700; font-variant-numeric: tabular-nums; }
/* Hành trình chung: các chặng nối nhau bằng đường chấm, chặng đã mở có màu, chặng con góp sức có dấu riêng. */
.trip-map { position: relative; display: flex; gap: 0; margin: 4px 0 2px; padding: 4px 0 2px; list-style: none; overflow-x: auto; scrollbar-width: thin; }
.trip-stop { position: relative; flex: 0 0 auto; width: 84px; display: grid; justify-items: center; align-content: start; gap: 2px; text-align: center; }
.trip-stop + .trip-stop::before { content: ""; position: absolute; top: 21px; right: 50%; width: 100%; border-top: 3px dotted #d9cfa8; z-index: 0; }
.trip-stop.open + .trip-stop::before { border-top: 3px solid #17a673; }
.trip-ico { position: relative; z-index: 1; display: grid; place-items: center; width: 42px; height: 42px; font-size: 1.35rem; border-radius: 50%; background: #fff; border: 2px solid #e6dcb5; }
.trip-stop.open .trip-ico { border-color: #17a673; background: #e7f7ef; }
.trip-stop.now .trip-ico { border: 2.5px dashed #ff9d3c; background: #fff4e3; animation: trip-pulse 2.2s ease-in-out infinite; }
.trip-stop.locked .trip-ico { font-size: 1rem; opacity: .55; }
.trip-stop.mine .trip-ico { box-shadow: 0 0 0 3px #ffd24a; }
.trip-stop small { font-size: .72rem; font-weight: 600; line-height: 1.2; color: var(--ink-soft); }
.trip-stop.open small, .trip-stop.now small { color: var(--ink); }
.trip-stop em { font-style: normal; font-size: .68rem; font-weight: 700; color: #b26a00; }
.trip-stop.mine em { color: #0e6b4a; }
@keyframes trip-pulse { 50% { transform: scale(1.07); } }
@media (prefers-reduced-motion: reduce) { .trip-stop.now .trip-ico { animation: none; } }
.week-awards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); margin-top: 14px; }
.week-award { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 12px; text-align: center; background: var(--fill); border: 2px dashed var(--line); border-radius: 16px; }
.week-award.on { background: #eafaf2; border: 2px solid #8fd9b6; }
.week-award-ico { font-size: 2rem; line-height: 1; filter: grayscale(1); opacity: .5; }
.week-award.on .week-award-ico { filter: none; opacity: 1; }
.week-award small { font-size: .8rem; line-height: 1.35; }
.week-award-state { padding: 2px 10px; font-size: .8rem; font-weight: 700; background: #fff; border-radius: 999px; }
.week-award.on .week-award-state { color: #0e6b4a; }
.week-award-past { color: var(--ink-soft); }

/* Trang thành tích */
.ach-hero { display: flex; align-items: flex-start; gap: 16px; }
.ach-hero > div { flex: 1 1 0; min-width: 0; }
.ach-hero > .avatar { flex: none; }
.ach-hero h1 { margin: 0 0 4px; }
.ach-hero p { margin: 0; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 0 0 20px; }
.stat-tiles .stat { align-content: start; }
.stat-tiles .stat b { white-space: nowrap; }
.stat-tiles .stat b i { font-style: normal; font-size: .55em; font-weight: 700; margin: 0 4px 0 2px; }
.stat-tiles .stat small.sub { font-size: .76rem; opacity: .85; }
.stat { display: grid; gap: 4px; padding: 16px; border-radius: 18px; box-shadow: var(--shadow); }
.stat b { font-family: var(--font-fun); font-size: 1.9rem; line-height: 1.05; }
.stat small { color: var(--ink-soft); font-size: .85rem; }
.t-sun { background: #fff3c4; } .t-mint { background: #e2f6ea; } .t-sky { background: #e3f1ff; }
.t-coral { background: #ffe6e0; } .t-grape { background: #efe7ff; }
.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-grid.goal { stroke: var(--mint); stroke-dasharray: 5 5; }
.chart-axis { fill: var(--ink-soft); font: 600 11px var(--font-text); }
.chart-val { fill: var(--ink); font: 700 11px var(--font-text); }
.chart-line { fill: none; stroke: #2f5be3; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: rgba(47, 91, 227, .08); }
.chart-dot { fill: #fff; stroke: #2f5be3; stroke-width: 2.5; }
.chart-dot.hi { stroke: var(--mint); fill: var(--mint-soft); }
.chart-dot.lo { stroke: var(--coral); }
.chart-bar { fill: var(--brand); }
.chart-bar.zero { fill: var(--line); }
/* Huy hiệu */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 14px 10px; border-radius: 18px; border: 2px solid var(--line); background: #fff; }
.badge .bar { width: 100%; }
.badge-medal { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 2rem; background: var(--fill); box-shadow: inset 0 -4px 0 rgba(0,0,0,.08); }
.badge-tier { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.badge.locked { opacity: .55; filter: grayscale(1); }
.tier-bronze .badge-medal { background: linear-gradient(145deg, #f3c6a0, #c27c45); }
.tier-silver .badge-medal { background: linear-gradient(145deg, #f4f6f8, #a9b4c0); }
.tier-gold .badge-medal { background: linear-gradient(145deg, #fff1a8, #e5a50a); }
.tier-diamond .badge-medal { background: linear-gradient(145deg, #d9f6ff, #7cc4f5 50%, #c9a9ff); }
.badge.tier-bronze { border-color: #e2b48b; } .badge.tier-silver { border-color: #c3ccd6; }
.badge.tier-gold { border-color: #f0c53a; } .badge.tier-diamond { border-color: #9ccff5; }
.tier-bronze .badge-tier { color: #a3602d; } .tier-silver .badge-tier { color: #6b7785; }
.tier-gold .badge-tier { color: #b7860b; } .tier-diamond .badge-tier { color: #4a7fd1; }
.badge-share { width: 100%; margin-top: 4px; }
.badge-share summary { cursor: pointer; font-weight: 700; color: var(--link); font-size: .9rem; }
.share-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.share-row form { margin: 0; }
.btn.fb { background: #1877f2; color: #fff; border-color: transparent; }
.badge.big { padding: 18px 28px; }
.badge.big .badge-medal { width: 96px; height: 96px; font-size: 3rem; }
.badge.inline { display: flex; text-align: left; justify-items: start; align-items: center; gap: 12px; padding: 10px 12px; }
.badge.inline .badge-medal { width: 48px; height: 48px; font-size: 1.5rem; flex: none; }
.badge.inline small { display: block; color: var(--ink-soft); }
.new-badge { display: flex; gap: 12px; align-items: center; text-align: left; margin: 12px 0; padding: 12px 14px; border-radius: 16px; border: 2px solid var(--brand); background: var(--brand-soft); }
.new-badge .badge-medal { width: 56px; height: 56px; font-size: 1.8rem; flex: none; }
.new-badge small { display: block; color: var(--ink-soft); }
.new-badge .share-row { justify-content: flex-start; }
.share-card { position: relative; overflow: hidden; display: grid; justify-items: center; text-align: center; gap: 8px; }
.share-card .avatar { font-size: 2.6rem; }
/* Cộng đồng */
.composer textarea { width: 100%; resize: vertical; }
.composer-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.post { display: grid; gap: 10px; }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-head > div { display: grid; flex: 1; }
.post-del { margin-left: auto; }
.post-body { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.post-badge { display: flex; align-items: center; gap: 10px; }
.avatar.small { width: 44px; height: 44px; font-size: 1.5rem; }
.post-actions { display: flex; align-items: center; gap: 14px; }
.heart-form { margin: 0; }
.heart { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font: 600 .92rem var(--font-text); cursor: pointer; transition: transform .1s; }
.heart:hover { transform: scale(1.05); }
.heart.on { border-color: #f5a3b5; background: #fff0f3; }
.heart.small { padding: 2px 8px; font-size: .8rem; }
.comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.comment-bubble { background: var(--fill); border-radius: 14px; padding: 8px 12px; }
.comment-bubble p { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.comment-actions { display: flex; align-items: center; gap: 10px; margin: 4px 0 0 8px; }
.comment-actions form { margin: 0; }
.link.small { font-size: .8rem; }
.comment-form { display: flex; gap: 8px; }
.comment-form input { flex: 1; min-width: 0; }
.admin-post-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.admin-post-head > div { display: grid; }
.admin-comments { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.admin-comments li { display: flex; justify-content: space-between; gap: 10px; }
.admin-comments form { margin: 0; }
.hidden-item { opacity: .5; }

.gift-row { padding-top: 8px; border-top: 1px dashed var(--line); align-items: flex-end; }
.gift-log { margin: 6px 0 0; font-size: .88rem; }
/* Thanh trên cùng trên điện thoại: gọn một dòng. "Góc ôn thi" vẫn có ở chân trang và trang giới thiệu. */
@media (max-width: 560px) {
    .top-in { padding: 8px 12px; gap: 8px; }
    .top-nav { gap: 6px; }
    .nav-extra { display: none; }
    .top-nav .nav-link { padding: 6px 2px; font-size: .92rem; }
    .top-nav .btn.small { padding: 7px 12px; }
    .menu summary, .kid-switch summary { padding: 3px 4px 3px 3px; gap: 4px; }
    .menu-avatar { width: 32px; height: 32px; font-size: .95rem; }
    .kid-switch-avatar { width: 30px; height: 30px; font-size: 1.15rem; }
    .menu-caret { width: 9px; }
}
@media (max-width: 380px) {
    .brand { gap: 6px; }
    .brand-mark { width: 32px; height: 32px; padding: 3px 7px 0; border-radius: 10px; }
    .brand-name { font-size: .98rem; }
}

/* Nút Cộng đồng trên thanh trên cùng (cạnh nút tài khoản) */
.nav-community { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .93rem; transition: background .12s, border-color .12s; }
.nav-community span:first-child { font-size: 1.15rem; line-height: 1; }
.nav-community:hover, .nav-community.on { background: var(--brand-soft); border-color: var(--brand); color: var(--ink); }
@media (max-width: 640px) {
    .nav-community { padding: 0; width: 36px; height: 36px; justify-content: center; }
    .nav-community-label { display: none; }
}
/* Máy tính bảng / cửa sổ hẹp: thanh trên cùng có Cộng đồng, chọn học sinh, tài khoản nên ẩn "Góc ôn thi" (vẫn có ở chân trang) */
@media (max-width: 860px) { .nav-extra { display: none; } }

/* Premium */
.premium-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: linear-gradient(135deg, #ffe58a, #f5b301); color: #5a3d00; font: 700 .72rem/1.6 var(--font-text); vertical-align: middle; white-space: nowrap; }
.premium-on { display: inline-block; font-weight: 700; color: #8a5a00; background: linear-gradient(135deg, #fff3c4, #ffe08a); border-radius: 999px; padding: 2px 10px; }
.premium-banner { background: linear-gradient(135deg, #fff3c4, #ffd75e); }
.premium-hero { display: flex; gap: 16px; align-items: flex-start; background: linear-gradient(135deg, #fffaf0, #fff0c2); border: 2px solid #f5c84a; }
.premium-crown { font-size: 3rem; line-height: 1; }
.premium-tag { display: inline-block; margin-bottom: 4px; font-weight: 700; color: #8a5a00; text-transform: uppercase; letter-spacing: .05em; font-size: .78rem; }
.premium-hero h1 { margin: 0 0 6px; }
.premium-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.premium-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--fill); }
.premium-list li.on { background: #fff3c4; outline: 2px solid #f5c84a; }
.premium-list li > span { font-size: 1.4rem; line-height: 1.2; }
.premium-list li small { display: block; color: var(--ink-soft); }
.compare { width: 100%; border-collapse: collapse; font-size: .93rem; }
.compare th, .compare td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.compare th:first-child, .compare td:first-child { text-align: left; }
.compare th:last-child, .compare td:last-child { background: #fffaf0; }
.compare thead th:last-child { color: #8a5a00; }
.switch.locked { text-decoration: none; color: var(--ink); opacity: .85; }
.switch.locked .switch-track { filter: grayscale(1); }
.locked-more { display: grid; gap: 6px; justify-items: start; background: #fffaf0; border: 2px dashed #f5c84a; }
@media (max-width: 520px) { .premium-hero { flex-direction: column; } .compare { font-size: .85rem; } .compare th, .compare td { padding: 6px 4px; } }
/* Quản trị: danh sách học sinh / phụ huynh gọn, tìm kiếm, lọc nhanh */
.admin-toolbar { display: grid; gap: 10px; }
.admin-toolbar .chips { margin: 0; }
.chip small { color: var(--ink-soft); font-weight: 600; margin-left: 2px; }
.admin-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-search input[type=search] { flex: 1 1 260px; min-width: 0; }
.admin-list { padding: 4px 8px; }
.admin-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; }
.admin-list > .admin-row + .admin-row, .admin-list > .admin-parent + .admin-parent { border-top: 1px solid var(--line); }
.admin-row-main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.admin-row-main small { overflow-wrap: anywhere; }
.admin-row-status { display: grid; gap: 2px; justify-items: end; text-align: right; font-size: .88rem; }
.admin-gift { display: flex; gap: 6px; align-items: center; margin: 0; }
.admin-gift select { padding: 6px 8px; }
.admin-parent > summary { list-style: none; cursor: pointer; }
.admin-parent > summary::-webkit-details-marker { display: none; }
.admin-parent[open] > summary { background: var(--fill); border-radius: 12px; }
.admin-parent-body { display: grid; gap: 8px; padding: 8px 6px 14px 54px; }
.admin-parent-body form { margin: 0; }
@media (max-width: 640px) {
    .admin-row { flex-wrap: wrap; }
    .admin-row-status { justify-items: start; text-align: left; }
    .admin-gift { width: 100%; justify-content: flex-end; }
    .admin-parent-body { padding-left: 6px; }
}
/* Phương án trắc nghiệm là hình (đồng hồ, hình còn thiếu...) */
.choices.svgs .choice-box { min-height: 0; padding: 8px; display: grid; justify-items: center; gap: 4px; }
.choices.svgs .choice-box svg { width: 100%; max-width: 130px; height: auto; }
.answer-pic { display: inline-block; vertical-align: middle; }
.answer-pic svg { width: 90px; height: auto; }

/* Chọn mức độ khó trên trang kỳ thi */
.level-picker { display: grid; gap: 8px; margin: 4px 0 14px; }
.level-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.level-opt { position: relative; display: block; text-decoration: none; color: var(--ink); cursor: pointer; }
.level-opt input { position: absolute; opacity: 0; }
.level-opt > span { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--line); background: #fff; height: 100%; }
.level-opt input:checked + span { border-color: var(--brand-deep); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(255, 200, 61, .35); }
.level-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.level-opt small { color: var(--ink-soft); font-size: .8rem; }
.level-icon { font-size: 1.4rem; line-height: 1; }
.level-opt.locked > span { background: var(--fill); opacity: .8; }
.level-suggest { margin: 0; padding: 8px 12px; border-radius: 12px; background: #eef6ff; }
/* Quản trị: ngân hàng câu hỏi */
.table-wrap { overflow-x: auto; }
.bank-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.bank-table th, .bank-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.bank-table th { font-size: .8rem; color: var(--ink-soft); }
.bank-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.bank-table.small { font-size: .82rem; margin: 6px 0 10px; }
.bank-group { margin: 18px 0 6px; font-size: 1.05rem; }
.bank-topic { border-bottom: 1px solid var(--line); }
.bank-topic > summary { cursor: pointer; padding: 8px 4px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.bank-count { margin-left: auto; color: var(--ink-soft); font-size: .85rem; }
.bank-files { columns: 2; padding-left: 18px; }
@media (max-width: 640px) { .bank-files { columns: 1; } }

/* ── Hàng icon tiện ích ở trang chủ (kiểu biểu tượng ứng dụng) ── */
.app-icons { display: flex; gap: 8px; justify-content: space-between; margin: 0 0 22px; max-width: 560px; }
.t-peach { background: #ffe9dc; }
.app-icons a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); }
.app-icon { display: grid; place-items: center; width: 62px; height: 62px; font-size: 1.85rem; border-radius: 18px; box-shadow: var(--shadow); transition: transform .14s, box-shadow .14s; }
.app-icons a:hover .app-icon { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.app-icons small { font: 600 .86rem/1.2 var(--font-text); text-align: center; }
.app-icons a { min-width: 0; }
.app-icons small { white-space: nowrap; }
@media (max-width: 420px) {
    .app-icons { gap: 2px; }
    .app-icons a { flex: 1 1 auto; }
    .app-icon { width: 52px; height: 52px; font-size: 1.5rem; border-radius: 15px; }
    .app-icons small { font-size: .76rem; letter-spacing: -.01em; }
}

/* ── Thư viện học tập ── */
.lib-head h1 { margin-bottom: 4px; }
.crumbs { font-size: .9rem; color: var(--ink-soft); margin: 0 0 14px; }
.crumbs a { color: var(--link); text-decoration: none; }
.lib-daily { display: grid; column-gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 6px; }
.lib-day { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; margin: 0 0 14px; }
.lib-day b { font: 700 1.15rem/1.35 var(--font-fun); }
.lib-day-label { color: var(--ink-soft); font-weight: 600; }
.lib-subjects { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.lib-subject { display: flex; flex-direction: column; margin: 0; border-top: 6px solid var(--t, var(--brand)); }
.lib-subject-head { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); }
.lib-subject-head .tile-icon { flex: none; margin: 0; background: var(--t-soft, var(--brand-soft)); }
.lib-subject-head h2 { margin: 0 0 2px; }
.lib-links { list-style: none; padding: 0; margin: 14px 0 6px; display: grid; gap: 6px; }
.lib-links a { color: var(--ink); text-decoration: none; font-weight: 500; }
.lib-links a:hover { color: var(--link); }
.lib-subject .tile-go { margin-top: auto; text-decoration: none; }
.lib-banner p { margin: 3px 0 0; }
.lib-section { margin: 26px 0 12px; }
.lib-topics { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-bottom: 20px; }
.lib-topic { display: flex; gap: 10px; align-items: center; padding: 14px 16px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); transition: border-color .14s, transform .14s; }
.lib-topic:hover { border-color: var(--brand); transform: translateY(-2px); }
.lib-note ul { margin: 0 0 12px; padding-left: 20px; line-height: 1.6; }
.lib-formulas { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.lib-formulas span { background: var(--brand-soft); border: 1.5px solid #f4dc95; border-radius: 10px; padding: 8px 12px; font-weight: 600; }
.lib-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.lib-row h2 { margin: 0; }
.lib-example { border-top: 1.5px dashed var(--line); padding: 16px 0 6px; }
.lib-example-head { display: flex; gap: 8px; align-items: center; }
.lib-prompt { font-weight: 600; font-size: 1.05rem; line-height: 1.5; white-space: pre-line; margin: 10px 0; }
.lib-options { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.lib-options li { background: var(--fill); border-radius: 10px; padding: 8px 12px; }
.lib-options .answer-pic svg { width: 90px; height: auto; vertical-align: middle; }
.lib-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.lib-chips span { background: var(--fill); border-radius: 8px; padding: 6px 10px; font-weight: 500; }
.lib-chips.alt span { background: var(--brand-soft); }
.lib-answer summary, .lib-passage summary { cursor: pointer; color: var(--link); font-weight: 600; }
.lib-answer[open] { background: var(--mint-soft); border-radius: 12px; padding: 10px 12px; }
.lib-passage p { white-space: pre-line; background: var(--fill); border-radius: 10px; padding: 10px 12px; }
.lib-practice { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: linear-gradient(120deg, var(--brand-soft), #fff 80%); }
.lib-practice h2 { margin: 0 0 4px; }
.lib-practice p { margin: 0; }
.lib-dl { margin: 0; display: grid; gap: 4px; }
.lib-dl dt { font-weight: 700; margin-top: 10px; }
.lib-dl dd { margin: 0; color: var(--ink-soft); }
.lib-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.lib-card { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; background: var(--fill); border-radius: 14px; padding: 12px 8px; }
.lib-card b { font: 700 1.2rem/1.3 var(--font-fun); }
.lib-card span { color: var(--ink-soft); font-size: .92rem; }
.lib-card .lib-emoji { font-size: 1.8rem; color: inherit; }
.lib-vocab { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lib-word { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; background: var(--fill); border-radius: 12px; padding: 8px 10px; }
.lib-word .btn { grid-row: span 2; min-height: 40px; padding: 6px 10px; }
.lib-word span { color: var(--ink-soft); font-size: .92rem; }
.lib-back { margin: 10px 0 24px; }

/* ── Thẻ lật (Thư viện học tập) ── */
.lib-cards-cta { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: linear-gradient(120deg, #e7efff, #fff 80%); }
.lib-cards-cta h2 { margin: 0 0 4px; }
.lib-cards-cta p { margin: 0; }
.lib-known { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 4px; border-radius: 50%; background: var(--mint); color: #fff; font-size: .75rem; font-weight: 800; vertical-align: middle; }
.lib-card { position: relative; }
.lib-card .lib-known { position: absolute; top: 6px; right: 6px; margin: 0; }

/* ── Thư viện: lưới ô kiểu app (trang đầu, trang lớp, mục tra cứu khác) ── */
.lib-zone { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 30px 0 6px; font-size: 1.35rem; }
.lib-zone small { color: var(--ink-soft); font: 500 .86rem var(--font-text); }
.lib-area { margin: 14px 0 22px; }
.lib-area h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font: 700 1.08rem/1.2 var(--font-fun); }
.lib-area h3 small { padding: 2px 9px; border-radius: 99px; background: var(--fill); color: var(--ink-soft); font: 600 .75rem var(--font-text); }
.app-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); }
.app-tile:not([class*="theme-"]) { --t: #3d7bf2; --t-soft: #e7efff; }
.app-tile {
    position: relative; overflow: hidden; isolation: isolate; min-width: 0; aspect-ratio: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 8px; border-radius: 24px; text-align: center; text-decoration: none; color: var(--ink);
    background: linear-gradient(165deg, var(--t-soft) 0%, color-mix(in srgb, var(--t-soft) 45%, #fff) 100%);
    border: 1.5px solid color-mix(in srgb, var(--t) 20%, transparent);
    box-shadow: 0 3px 0 color-mix(in srgb, var(--t) 16%, transparent), 0 8px 20px color-mix(in srgb, var(--t) 10%, transparent);
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.app-tile::before { content: ""; position: absolute; z-index: -1; width: 90%; aspect-ratio: 1; right: -38%; top: -38%; border-radius: 50%; background: color-mix(in srgb, var(--t) 9%, transparent); }
.app-tile::after { content: ""; position: absolute; z-index: -1; width: 46%; aspect-ratio: 1; left: -16%; bottom: -18%; border-radius: 50%; background: rgba(255, 255, 255, .7); }
.app-tile:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--t) 45%, transparent); box-shadow: 0 5px 0 color-mix(in srgb, var(--t) 22%, transparent), 0 16px 28px color-mix(in srgb, var(--t) 18%, transparent); }
.app-tile:active { transform: translateY(1px); }
.app-tile-icon { flex: none; display: grid; place-items: center; width: 66px; height: 66px; border-radius: 21px; background: #fff; font-size: 2.45rem; line-height: 1; box-shadow: 0 4px 12px color-mix(in srgb, var(--t) 22%, transparent); transition: transform .2s; }
.app-tile:hover .app-tile-icon { transform: scale(1.08) rotate(-4deg); }
.app-tile b { flex: none; color: var(--ink); font: 800 1rem/1.22 var(--font-fun); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.app-tile small { flex: none; padding: 2px 10px; border-radius: 99px; background: #fff; color: color-mix(in srgb, var(--t) 85%, #000); font-size: .74rem; font-weight: 700; white-space: nowrap; border: 1px solid color-mix(in srgb, var(--t) 18%, transparent); }
.grade-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grade-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 16px 8px; border-radius: 22px; text-decoration: none; color: var(--ink); background: #fff; border: 2px solid var(--line); box-shadow: 0 4px 0 #e3e7f1; transition: transform .15s, border-color .15s; }
.grade-tile:hover { transform: translateY(-3px); border-color: var(--brand); }
.grade-num { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(150deg, #ffe08a, var(--brand) 60%, var(--brand-deep)); color: #5c3d00; font: 800 1.8rem/1 var(--font-fun); box-shadow: 0 3px 0 #d08f00; }
.grade-tile b { font: 700 1.05rem var(--font-fun); }
.grade-tile small { color: var(--ink-soft); font-size: .8rem; font-weight: 600; }
.grade-tile.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 4px 0 #f1cf6a; }
.lib-more { margin: 18px 0 24px; }
.lib-daily { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 4px 0 6px; }
a.lib-day { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 14px 16px; border-radius: 16px; background: #fff; border: 1.5px solid var(--line); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm); }
a.lib-day:hover { border-color: var(--brand); }
a.lib-day small { color: var(--ink-soft); font-weight: 600; }
a.lib-day b { font: 700 1.08rem/1.35 var(--font-fun); }
a.lib-day span { color: var(--ink-soft); font-size: .92rem; }
@media (max-width: 560px) {
    .app-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    .app-tile { padding: 6px 4px; gap: 4px; border-radius: 18px; }
    .app-tile-icon { width: 50px; height: 50px; border-radius: 16px; font-size: 1.85rem; }
    .app-tile b { font-size: .76rem; line-height: 1.15; }
    .app-tile small { font-size: .64rem; padding: 1px 7px; }
    .grade-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
    .grade-tile { padding: 10px 2px; border-radius: 16px; }
    .grade-num { width: 40px; height: 40px; font-size: 1.3rem; }
    .grade-tile b { font-size: .82rem; }
    .grade-tile small { display: none; }
    .lib-zone { font-size: 1.15rem; }
}

/* ── Trang mục tra cứu: tìm kiếm, lọc, danh sách ── */
.ref-tools { position: sticky; top: 64px; z-index: 5; display: grid; gap: 8px; margin: 0 0 8px; padding: 10px 12px; background: rgba(246, 247, 251, .94); backdrop-filter: blur(6px); border-radius: 16px; }
.ref-search { width: 100%; height: var(--control-h); padding: 0 14px; font: inherit; border: var(--control-border); border-radius: var(--control-radius); background: #fff; }
.ref-search:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
.ref-tools .chips { margin: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ref-tools .chips::-webkit-scrollbar { display: none; }
.ref-tools .chip { flex: none; cursor: pointer; font: inherit; font-size: .88rem; }
.ref-tools .chip small { opacity: .7; margin-left: 2px; }
.ref-count { margin: 0; font-size: .85rem; }
.ref-count:empty { display: none; }
.ref-legend { font-size: .85rem; margin: 0 0 14px; }
.ref-rows { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.ref-row { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: var(--fill); border-radius: 12px; }
.ref-row b { line-height: 1.4; }
.ref-row span { color: var(--ink-soft); font-size: .93rem; line-height: 1.45; }
.ref-lv { font-style: normal; font-size: .7rem; margin-left: 6px; letter-spacing: -2px; vertical-align: 1px; white-space: nowrap; }
.ref-row em { color: var(--ink-soft); font-size: .86rem; line-height: 1.45; }
.ref-qa details { margin-top: 2px; }
.ref-qa summary { cursor: pointer; color: var(--link); font-weight: 600; font-size: .9rem; }
.ref-qa details p { margin: 6px 0 0; line-height: 1.5; }
.ref-qa details p span { color: var(--ink-soft); }
.ref-note { margin: -4px 0 12px; font-size: .9rem; }
.ref-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.ref-fact { position: relative; padding: 10px 8px; text-align: center; border-radius: 12px; background: var(--fill); font: 600 1.12rem/1.2 var(--font-fun); }
.ref-fact b { color: var(--link); }
.ref-fact .lib-known { position: absolute; top: 4px; right: 4px; margin: 0; width: 16px; height: 16px; font-size: .6rem; }
.ref-table { width: 100%; border-collapse: collapse; }
.ref-table th { text-align: left; padding: 8px 10px; background: var(--fill); font-size: .85rem; }
.ref-table td { padding: 8px 10px; border-top: 1px solid var(--line); }
.ref-table tr[hidden] { display: none; }
.ref-empty { text-align: center; padding: 20px; }
.lib-cards-go { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 560px) {
    .ref-tools { top: 56px; padding: 8px; margin-inline: -4px; }
    .ref-rows { grid-template-columns: 1fr; }
}
@media print { .ref-tools, .ref-legend { display: none !important; } }

/* ── Thư viện: trang môn chia nhóm, trang bài dạng bài giảng ── */
.lib-section.lib-row { margin: 26px 0 4px; }
.lib-group { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 10px; font: 700 1.1rem/1.3 var(--font-fun); }
.lib-group small { color: var(--ink-soft); font: 600 .8rem var(--font-text); }
.lib-topics { gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lib-topic { position: relative; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 16px; box-shadow: var(--shadow-sm); }
.lib-topic:hover { border-color: var(--t, var(--brand)); box-shadow: var(--shadow-lift); }
.lib-topic-icon { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--t-soft, var(--brand-soft)); font-size: 1.45rem; line-height: 1; }
.lib-topic-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lib-topic-text b { line-height: 1.3; }
.lib-topic-text small { color: var(--ink-soft); font-size: .84rem; line-height: 1.4; }
.lib-topic.seen::after { content: "✓"; position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--mint); color: #fff; font-size: .72rem; font-weight: 800; }
.lib-topic.seen { border-color: color-mix(in srgb, var(--mint) 35%, var(--line)); }
.lib-progress { display: inline-flex; align-items: center; gap: 8px; }
.lib-progress-bar { display: inline-block; width: 120px; height: 8px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.lib-progress-bar i { display: block; height: 100%; width: 0; background: var(--mint); border-radius: inherit; }
.lib-progress small { color: var(--ink-soft); font-weight: 600; }

.lib-meta { display: inline-block; margin-top: 6px; color: var(--ink-soft); font-size: .8rem; font-weight: 600; }
.lib-toc { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 14px; padding: 2px 2px 6px; scrollbar-width: none; }
.lib-toc::-webkit-scrollbar { display: none; }
.lib-toc a { flex: none; padding: 7px 12px; border-radius: 99px; background: #fff; border: 1.5px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .88rem; white-space: nowrap; }
.lib-toc a:hover { border-color: var(--brand); }
.lib-idea, .lib-note, #loi-sai, #thu-lam, #luyen, .lib-two { scroll-margin-top: 80px; }

.lib-idea { display: flex; gap: 14px; align-items: flex-start; background: linear-gradient(120deg, #fff8e1, #fff 85%); border: 1.5px solid #f4dc95; }
.lib-idea-icon { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--brand); font-size: 1.4rem; box-shadow: 0 3px 0 var(--brand-deep); }
.lib-idea h2 { margin: 2px 0 4px; }
.lib-idea p { margin: 0; font-size: 1.06rem; line-height: 1.6; }

.lib-remember { list-style: none; padding: 0 !important; margin: 0 0 12px; display: grid; gap: 8px; }
.lib-remember li { position: relative; padding: 8px 12px 8px 38px; background: var(--fill); border-radius: 12px; line-height: 1.5; }
.lib-remember li::before { content: "✓"; position: absolute; left: 10px; top: 8px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--mint); color: #fff; font-size: .72rem; font-weight: 800; }
.lib-formulas span { font: 700 1.05rem/1.35 var(--font-fun); padding: 8px 14px; }

.lib-two { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.lib-steps ol, .lib-worked-steps { list-style: none; counter-reset: st; padding: 0; margin: 0; display: grid; gap: 10px; }
.lib-steps li, .lib-worked-steps li { counter-increment: st; position: relative; padding-left: 38px; line-height: 1.5; min-height: 28px; }
.lib-steps li::before, .lib-worked-steps li::before { content: counter(st); position: absolute; left: 0; top: -1px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--link); color: #fff; font: 700 .9rem/1 var(--font-fun); }
.lib-worked { background: linear-gradient(160deg, #eef4ff, #fff 70%); }
.lib-worked-q { margin: 0 0 12px; padding: 10px 14px; background: #fff; border: 1.5px dashed #b9cdf7; border-radius: 12px; font-weight: 600; line-height: 1.5; white-space: pre-line; }
.lib-worked-steps li::before { background: #8fb3ff; }
.lib-worked-a { margin: 12px 0 0; }
.lib-worked-a b { display: inline-block; padding: 3px 12px; border-radius: 99px; background: var(--mint-soft); color: var(--mint); }

.lib-mistakes { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.lib-mistake { border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; }
.lib-mistake p { margin: 0; padding: 9px 12px; line-height: 1.5; display: flex; gap: 8px; }
.lib-mistake .bad-way { background: var(--coral-soft); }
.lib-mistake .good-way { background: var(--mint-soft); }
.lib-tip { margin: 0 0 18px; padding: 12px 16px; border-radius: 14px; background: #f3edff; border: 1.5px solid #d9c9ff; line-height: 1.55; }

.lib-options { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.lib-opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 12px; text-align: left; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid #d9deea; border-radius: 12px; cursor: pointer; transition: border-color .12s, transform .12s; }
.lib-opt > b { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--fill); font-size: .9rem; }
.lib-opt:hover:not(:disabled) { border-color: var(--link); transform: translateY(-1px); }
.lib-opt:disabled { cursor: default; opacity: .7; }
.lib-opt.ok { opacity: 1; border-color: var(--mint); background: var(--mint-soft); }
.lib-opt.ok > b { background: var(--mint); color: #fff; }
.lib-opt.bad { opacity: 1; border-color: var(--coral); background: var(--coral-soft); }
.lib-opt.bad > b { background: var(--coral); color: #fff; }
.lib-feedback { margin: 0 0 10px; font-weight: 700; }
.lib-feedback.good { color: var(--mint); }
.lib-feedback.bad { color: #c2410c; }

.lib-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 10px; }
.lib-pager a { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm); }
.lib-pager a:hover { border-color: var(--brand); }
.lib-pager small { color: var(--ink-soft); font-weight: 600; }
.lib-pager-next { text-align: right; grid-column: 2; }
@media (max-width: 560px) {
    .lib-idea { gap: 10px; }
    .lib-idea-icon { width: 38px; height: 38px; font-size: 1.15rem; }
    .lib-idea p { font-size: 1rem; }
    .lib-two { grid-template-columns: 1fr; }
    .lib-options { grid-template-columns: 1fr 1fr; }
    .lib-pager { grid-template-columns: 1fr; }
    .lib-pager-next { grid-column: 1; }
    .lib-topics { grid-template-columns: 1fr; gap: 8px; }
    .lib-topic { padding: 12px; }
    .lib-topic-icon { width: 40px; height: 40px; font-size: 1.25rem; }
}
.fc-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 600; }
.fc-all { font-weight: 500; color: var(--ink-soft); display: inline-flex; gap: 6px; align-items: center; }
.fc-bar { height: 8px; background: var(--fill); border-radius: 99px; margin: 10px 0 18px; overflow: hidden; }
.fc-bar span { display: block; height: 100%; background: var(--mint); transition: width .3s; }
.fc-card { display: block; position: relative; width: 100%; max-width: 520px; height: 230px; margin: 0 auto; padding: 0; border: 0; background: none; cursor: pointer; perspective: 1000px; font: inherit; color: var(--ink); }
.fc-face { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; padding: 20px 24px; border-radius: 22px; backface-visibility: hidden; transition: transform .45s; box-shadow: var(--shadow); text-align: center; }
.fc-front { background: #fff; border: 2px solid var(--line); }
.fc-back { background: var(--brand-soft); border: 2px solid #f4dc95; transform: rotateY(180deg); }
.fc-card.flipped .fc-front { transform: rotateY(-180deg); }
.fc-card.flipped .fc-back { transform: rotateY(0); }
.fc-card.known .fc-front { border-color: var(--mint); }
.fc-face b { font: 700 1.5rem/1.35 var(--font-fun); }
.fc-face small { color: var(--ink-soft); font-size: .88rem; }
.fc-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 18px 0 6px; }
.fc-left { text-align: center; margin: 0; }
.fc-done { text-align: center; padding: 20px 0 6px; }
@media (max-width: 480px) { .fc-card { height: 210px; } .fc-face b { font-size: 1.25rem; } }

/* ── Bảng công thức (in được) ── */
.formula-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.formula-block { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; break-inside: avoid; }
.formula-block h3 { margin: 0 0 6px; font-size: 1rem; }
.formula-block ul { margin: 0; padding-left: 18px; line-height: 1.55; }
.print-only { display: none; }
@media print {
    header.top, footer, .crumbs, .lib-banner, .lib-back, .no-print, .lib-cards-cta { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; padding: 0; }
    .print-only { display: block; margin: 0 0 10px; }
    .formula-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .formula-block { padding: 8px 10px; font-size: 11pt; }
}

/* ── Chân trang: luôn nằm dưới cùng (trang ít nội dung không bị kéo lên giữa) ── */
body { display: flex; flex-direction: column; }
main.wrap { flex: 1 0 auto; width: 100%; }
.foot { margin-top: 32px; background: #fff; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .86rem; }
.foot-in { max-width: 960px; margin: 0 auto; padding: 26px 16px 22px; }
.foot-top { display: flex; align-items: center; justify-content: space-between; gap: 18px 28px; flex-wrap: wrap; }
.foot-brand .brand-mark { width: 38px; height: 38px; }
.foot-brand .brand-name { font-size: 1.2rem; display: flex; }
.foot-tagline { display: block; margin-top: 3px; color: var(--ink-soft); font-weight: 500; font-size: .8rem; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.foot-nav a { color: var(--ink); font-weight: 600; text-decoration: none; padding: 6px 12px; border-radius: 999px; background: var(--fill); transition: background .14s, color .14s; }
.foot-nav a:hover { background: var(--brand-soft); color: var(--ink); }
.foot-contact { margin: 16px 0 0; font-weight: 600; color: var(--ink); }
.foot-social { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.fb-link { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: #1877f2; color: #fff !important; font-weight: 700; text-decoration: none; }
.fb-link:hover { background: #166fe0; }
.fb-ico { width: 18px; height: 18px; flex: none; }
.tt-link { background: #111; }
.tt-link:hover { background: #2a2a2a; }
.foot-contact a { color: var(--link); }
.foot-bottom { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 6px 24px; flex-wrap: wrap; font-size: .78rem; line-height: 1.55; }
.foot-note { margin: 0; max-width: 680px; }
.foot-copy { margin: 0; white-space: nowrap; }
@media (max-width: 640px) {
    .foot-top { flex-direction: column; align-items: flex-start; }
    .foot-nav a { padding: 6px 10px; font-size: .84rem; }
}
@media print { .foot { display: none; } }

/* ── Trang Thống kê (quản trị) ── */
.stats-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 14px; }
.stats-grid .card { margin: 0; min-width: 0; overflow-x: auto; overflow-wrap: anywhere; }
.stats-grid .bank-table td, .bank-table.wrap-cells td { white-space: normal; overflow-wrap: anywhere; }
.bank-table.wrap-cells td.num, .stats-grid .bank-table td.num { white-space: nowrap; overflow-wrap: normal; }
.stats-grid .bank-table td:first-child { min-width: 120px; }
.bank-table .cell-sub { display: block; margin-top: 2px; color: var(--ink-soft); font-size: .8rem; }
.stats-tips { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 8px; }
.stats-tips li { padding: 10px 12px; border-radius: 10px; background: var(--fill); line-height: 1.5; }
.stats-tips .tip-bad { background: var(--coral-soft); }
.stats-tips .tip-warn { background: var(--brand-soft); }
.stats-tips .tip-ok { background: var(--mint-soft); }
.funnel { display: grid; gap: 8px; }
.funnel-row { display: grid; grid-template-columns: 210px 1fr 50px minmax(0, 220px); gap: 10px; align-items: center; font-size: .9rem; }
.funnel-bar { height: 14px; background: var(--fill); border-radius: 99px; overflow: hidden; }
.funnel-bar span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.funnel-row b { text-align: right; }
@media (max-width: 700px) { .funnel-row { grid-template-columns: 1fr 50px; } .funnel-bar, .funnel-row small { grid-column: 1 / -1; } }

/* ===== Hướng dẫn sử dụng (/huong-dan): cột danh mục bên trái, tìm nhanh, nội dung bên phải ===== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.help-page main.wrap { max-width: 1120px; }
.help { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 22px; align-items: start; }
.help-side { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 12px; box-shadow: var(--shadow-sm); }
.help-search input { width: 100%; height: 44px; padding: 0 12px; font: inherit; font-size: .95rem; border: var(--control-border); border-radius: var(--control-radius); background: var(--fill); }
.help-search input:focus { outline: 2px solid var(--focus); background: #fff; }
.help-menu > summary { list-style: none; cursor: pointer; font-weight: 700; padding: 10px 6px 4px; }
.help-menu > summary::-webkit-details-marker { display: none; }
@media (max-width: 820px) { .help-menu > summary::after { content: " ▾"; } .help-menu[open] > summary::after { content: " ▴"; } }
.help-menu nav { display: grid; gap: 2px; padding-top: 6px; }
.help-cat { display: grid; gap: 1px; margin-top: 10px; }
.help-cat b { font: 700 .8rem/1.3 var(--font-text); text-transform: uppercase; letter-spacing: .03em; color: var(--ink-soft); padding: 4px 8px; }
.help-menu nav a { display: block; padding: 7px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: .93rem; line-height: 1.35; }
.help-menu nav a:hover { background: var(--fill); }
.help-menu nav a.on { background: var(--brand-soft); font-weight: 700; box-shadow: inset 3px 0 0 var(--brand-deep); }
.help-home { font-weight: 600; }
.help-results { padding-top: 8px; }
.help-results ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.help-results a { display: block; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.help-results a:hover, .help-results a.hl { background: var(--brand-soft); }
.help-results a b { display: block; font-size: .93rem; }
.help-results a small { color: var(--ink-soft); font-size: .8rem; }
.help-count { font-size: .85rem; margin: 2px 4px 6px; }
.help-main { min-width: 0; }
.help-main .prose { max-width: none; }
.help-crumb { font-size: .88rem; color: var(--ink-soft); }
.help-crumb a { color: var(--ink-soft); }
.help-article h1 { font-size: 1.75rem; }
.help-article ol li, .help-article ul li { margin: 6px 0; }
.callout { background: var(--brand-soft); border-left: 4px solid var(--brand-deep); border-radius: 12px; padding: 12px 14px; margin: 14px 0; }
.help-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help-pager a.card { display: grid; gap: 4px; text-decoration: none; color: var(--ink); padding: 16px 18px; }
.help-pager a.card:hover { box-shadow: var(--shadow-lift); }
.help-pager a.next { text-align: right; }
.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 18px; }
.help-card h2 { font-size: 1.1rem; margin: 0 0 8px; }
.help-card ul, .help-popular { margin: 0; padding-left: 18px; }
.help-card li, .help-popular li { margin: 6px 0; }
.help-popular { columns: 2 240px; }
@media (max-width: 820px) {
    .help { grid-template-columns: 1fr; gap: 14px; }
    .help-side { position: static; max-height: none; }
    .help-pager { grid-template-columns: 1fr; }
}

/* ===== Đề kiểm tra trên lớp: tên phần, khuôn trình bày bài tự luận ===== */
.tile-group { font-size: 1.02rem; margin: 30px 0 12px; color: var(--ink); }
.q-part { margin: 0 0 8px; font: 800 .95rem/1.3 var(--font-text); color: var(--mint); text-transform: uppercase; letter-spacing: .02em; }
.tpl { display: grid; gap: 6px; margin-top: 10px; font-size: 1.08rem; }
.tpl.tpl-multi { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tpl-block { display: grid; gap: 8px; align-content: start; padding: 12px 14px; border: 1.5px dashed #d6dbe8; border-radius: 14px; background: #fff; }
.tpl:not(.tpl-multi) .tpl-block { border: 0; padding: 0; background: transparent; }
.tpl-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; line-height: 1.6; }
.tpl-line > span { white-space: pre-wrap; }
.tpl-title { font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.tpl-col { justify-self: start; display: grid; gap: 2px; padding: 4px 10px; font: 600 1.2rem/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.tpl-row, .tpl-col-review { display: flex; justify-content: flex-end; white-space: pre; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.tpl-rule { border-top: 2px solid var(--ink); margin: 2px 0; }
.tpl input.tpl-n { width: 5em; height: 40px; padding: 0 8px; font: 700 1.05rem/1 var(--font-text); text-align: center; border: var(--control-border); border-radius: 10px; background: var(--brand-soft); }
/* Ô kết quả đặt tính: cùng phông chữ đều với các số bên trên, căn phải, không đệm bên phải, để chữ số thẳng cột như viết trên giấy. */
.tpl .tpl-col input.tpl-n { width: 5.5em; height: 1.75em; padding: 0; text-align: right; font: inherit; letter-spacing: normal;
    border: 0; border-bottom: 2px solid #c9b46a; border-radius: 6px 6px 0 0; }
.tpl-n:focus, .tpl-s:focus { outline: 2px solid var(--focus); background: #fff; }
.tpl select.tpl-s { width: auto; height: 40px; padding: 0 8px; font: 700 1rem/1 var(--font-text); border: var(--control-border); border-radius: 10px; background: var(--brand-soft); }
.tpl select.tpl-s.sign { width: 3.6em; text-align: center; }
.tpl-s.wide { max-width: 100%; font-weight: 600; }
.tpl-review { font-size: 1rem; }
.tpl-ok { color: var(--mint); background: var(--mint-soft); border-radius: 6px; padding: 0 6px; }
.tpl-bad { color: var(--coral); text-decoration: line-through; padding: 0 4px; }
.tpl-fix { color: var(--mint); background: var(--mint-soft); border-radius: 6px; padding: 0 6px; margin-left: 2px; }
@media (max-width: 520px) { .tpl input.tpl-n:not([style]) { width: 4.2em; } .tpl.tpl-multi { grid-template-columns: 1fr; } }
.school-units { columns: 2 280px; padding-left: 18px; }
.school-units li { margin: 5px 0; break-inside: avoid; }
.school-sample .q-part { margin-top: 18px; }
.sample-q { border-top: 1px solid var(--line); padding: 12px 0; }
.sample-options { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 16px; }
.sample-q details { margin-top: 8px; }
.sample-q summary { cursor: pointer; color: var(--link); font-weight: 600; }

/* ===== Thẻ kỳ thi dễ phân biệt khi chưa kịp đọc chữ (20/11) =====
   Mỗi kỳ thi một màu không trùng nhau: nền nhạt chuyển từ màu kỳ thi sang trắng, viền cùng tông,
   biểu tượng lớn in mờ ở góc và nút "Vào luyện" mang màu kỳ thi. Nhìn lướt là nhận ra theo màu + hình. */
.theme-pink  { --t: #d6408a; --t-soft: #fde7f1; }
.theme-amber { --t: #d48f00; --t-soft: #fff3d2; }

.tile[data-icon] {
    background: linear-gradient(150deg, var(--t-soft) 0%, color-mix(in srgb, var(--t-soft) 55%, #fff) 52%, #fff 100%);
    border-color: color-mix(in srgb, var(--t) 30%, #fff);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--t) 18%, transparent);
}
.tile[data-icon]::after {
    content: attr(data-icon); position: absolute; right: -10px; bottom: -18px; font-size: 5.6rem; line-height: 1;
    opacity: .14; transform: rotate(-14deg); pointer-events: none; filter: saturate(1.2);
}
.tile[data-icon] > * { position: relative; z-index: 1; }
.tile[data-icon] .tile-icon { background: #fff; box-shadow: 0 0 0 2px color-mix(in srgb, var(--t) 40%, #fff), 0 4px 0 color-mix(in srgb, var(--t) 30%, #fff); }
.tile[data-icon] h3 { color: color-mix(in srgb, var(--t) 30%, var(--ink)); }
.tile[data-icon] small { color: color-mix(in srgb, var(--t) 18%, var(--ink-soft)); }
.tile[data-icon] .tile-go {
    align-self: flex-start; margin-top: auto; padding: 8px 14px; border-radius: 999px;
    background: var(--t); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--t) 70%, #000);
}
.tile[data-icon]:hover { border-color: var(--t); box-shadow: var(--shadow-lift); }
.tile[data-icon]:hover .tile-go { filter: brightness(1.06); }
.tile.static[data-icon]:hover { transform: none; }

/* ===== Nút Nộp bài to, rõ, dễ bấm ===== */
.submit-row { flex-direction: column; align-items: center; gap: 8px; margin-top: 28px; }
.submit-row .submit-btn {
    min-height: 58px; min-width: 280px; padding: 0 34px; border-radius: 16px;
    font: 800 1.22rem/1 var(--font-fun); letter-spacing: .01em;
    box-shadow: 0 4px 0 #0c1433, 0 10px 24px rgba(27, 37, 80, .22);
    transition: transform .08s, box-shadow .08s;
}
.submit-row .submit-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0c1433, 0 4px 10px rgba(27, 37, 80, .2); }
.submit-left { font-weight: 600; }
@media (max-width: 520px) { .submit-row .submit-btn { width: 100%; min-width: 0; } }
/* Điện thoại: thẻ kỳ thi xếp ngang (biểu tượng bên trái) cho gọn, đỡ phải cuộn dài. */
@media (max-width: 560px) {
    .tile[data-icon] { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 3px; align-items: start; padding: 18px 16px 14px; }
    .tile[data-icon] .tile-icon { grid-row: 1 / span 4; margin: 0; width: 50px; height: 50px; }
    .tile[data-icon] h3 { margin: 0; font-size: 1.05rem; }
    .tile[data-icon] .tile-go { justify-self: start; margin-top: 6px; padding: 7px 12px; font-size: .9rem; }
    .tile[data-icon]::after { font-size: 4.4rem; bottom: -14px; }
}

/* ===== Ô chọn trong khuôn trình bày (thay <select>): nút có mũi tên ▾, bảng chọn tự vẽ ===== */
.tpl-pick { position: relative; display: inline-flex; max-width: 100%; }
.tpl-pick-btn {
    display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 100%;
    min-height: 40px; padding: 0 10px 0 12px; cursor: pointer; text-align: left;
    font: 700 1.05rem/1.25 var(--font-text); color: var(--ink);
    background: var(--brand-soft); border: 1.5px dashed #e3b84a; border-radius: 10px;
    transition: border-color .12s, background .12s, box-shadow .12s;
}
.tpl-pick-btn:hover { border-color: var(--brand-deep); background: #fff0c2; }
.tpl-pick-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.tpl-pick.op .tpl-pick-btn, .tpl-pick.cmp .tpl-pick-btn { min-width: 66px; font-size: 1.3rem; }
.tpl-pick.text .tpl-pick-btn { font-size: 1rem; font-weight: 600; padding-block: 6px; }
.tpl-pick-val.empty { color: #9a7a1e; font-weight: 600; }
.tpl-pick.op .tpl-pick-val.empty, .tpl-pick.cmp .tpl-pick-val.empty { color: #b08a2a; }
.tpl-chev { flex: none; width: 13px; height: 9px; color: #9a7a1e; transition: transform .15s; }
.tpl-pick.open .tpl-chev { transform: rotate(180deg); }
.tpl-pick.chosen .tpl-pick-btn { background: #fff; border: 1.5px solid #c9d2ea; }
.tpl-pick.chosen .tpl-chev { color: var(--ink-soft); }

.tpl-menu {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; padding: 6px;
    background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lift);
    animation: menu-in .12s ease-out;
}
.tpl-menu[hidden] { display: none !important; }
.tpl-pick.right .tpl-menu { left: auto; right: 0; }
.tpl-pick.up .tpl-menu { top: auto; bottom: calc(100% + 6px); }
.tpl-menu [role=option] { cursor: pointer; color: var(--ink); font-family: var(--font-text); }
.tpl-menu [role=option]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }

/* Dấu phép tính, dấu so sánh: ô vuông to dễ bấm. */
.tpl-pick.op .tpl-menu, .tpl-pick.cmp .tpl-menu { display: grid; grid-template-columns: repeat(4, 50px); gap: 6px; }
.tpl-pick.cmp .tpl-menu { grid-template-columns: repeat(3, 50px); }
.tpl-pick.op [role=option], .tpl-pick.cmp [role=option] {
    width: 50px; height: 50px; font-size: 1.5rem; font-weight: 800; line-height: 1;
    background: var(--brand-soft); border: 1.5px solid #f0d58a; border-radius: 12px;
}
.tpl-pick.op [role=option]:hover, .tpl-pick.cmp [role=option]:hover,
.tpl-pick.op [role=option]:focus, .tpl-pick.cmp [role=option]:focus { background: var(--brand); border-color: var(--brand-deep); }
.tpl-pick [role=option][aria-selected=true] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Câu lời giải: danh sách, mục đang chọn có dấu ✓. */
.tpl-pick.text .tpl-menu { display: grid; gap: 2px; width: max-content; min-width: 100%; max-width: min(460px, 86vw); }
.tpl-pick.text [role=option] {
    display: flex; gap: 8px; align-items: baseline; padding: 10px 12px; border: 0; border-radius: 10px;
    background: transparent; font-size: 1rem; font-weight: 600; text-align: left; white-space: normal;
}
.tpl-pick.text [role=option]::before { content: "○"; color: #b6bdd3; flex: none; }
.tpl-pick.text [role=option]:hover, .tpl-pick.text [role=option]:focus { background: var(--brand-soft); }
.tpl-pick.text [role=option][aria-selected=true] { background: var(--mint-soft); color: var(--ink); }
.tpl-pick.text [role=option][aria-selected=true]::before { content: "✓"; color: var(--mint); }

/* Làm bài: thông báo khôi phục bài làm dở và trạng thái đang gửi lại bài. */
.exam-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 32px); background: var(--ink); color: #fff; font-weight: 600; padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow); transition: opacity .5s; }
.exam-toast.hide { opacity: 0; }
.submit-status { margin: 10px auto 0; max-width: 520px; padding: 10px 14px; background: #fff7e0; border: 1px solid #f3d98b; border-radius: 12px; color: #6b4e00; font-weight: 500; text-align: center; }

/* Quản trị · Ngân hàng câu hỏi: dòng thời điểm tính và nút "Tính lại". */
.bank-refresh { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: -4px 0 14px; }

/* ───── Trang giới thiệu gọn chữ: chọn lớp, lưu ý thu gọn, điểm nổi bật dạng biểu tượng ───── */
.trial-line { margin: 14px 0 0; font-weight: 600; color: #8a6100; }
details.disclaimer { padding: 12px 18px; }
details.disclaimer summary { cursor: pointer; list-style: none; font-size: .95rem; color: var(--ink-soft); }
details.disclaimer summary::-webkit-details-marker { display: none; }
details.disclaimer .more { color: var(--link); font-weight: 600; white-space: nowrap; }
details.disclaimer[open] .more { display: none; }
details.disclaimer ul { font-size: .92rem; color: var(--ink-soft); }
.grade-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.grade-tab { font: 700 1rem/1 var(--font-fun); padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.grade-tab.on { background: var(--brand); border-color: var(--brand-deep); }
.grade-panel:not(.on) { display: none; }
.tiles.compact { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tiles.compact .tile { padding: 16px 14px 14px; gap: 3px; }
.tiles.compact .tile-icon { width: 44px; height: 44px; font-size: 1.4rem; border-radius: 13px; margin-bottom: 4px; }
.tiles.compact h3 { font-size: 1.02rem; }
.tiles.compact .tile[data-icon]::after { font-size: 4.2rem; }
.feature-list { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); margin: 0 0 20px; }
.feature-list div { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-sm); font: 700 .98rem/1.25 var(--font-fun); }
.feature-list span { font-size: 1.4rem; flex: none; }
.news-list { margin: 8px 0 10px; padding-left: 20px; display: grid; gap: 8px; }
.news-list a { font-weight: 600; }
@media (max-width: 640px) {
    .tiles.compact { grid-template-columns: 1fr 1fr; gap: 10px; }
    .tiles.compact .tile { padding: 14px 10px 12px; }
    .tiles.compact h3 { font-size: .95rem; }
    .tiles.compact small { font-size: .8rem; }
    .feature-list { grid-template-columns: 1fr 1fr; gap: 8px; }
    .feature-list div { font-size: .9rem; padding: 10px; }
    .grade-tabs { gap: 6px; flex-wrap: nowrap; }
    .grade-tab { flex: 1; padding: 9px 4px; font-size: .92rem; }
    .tiles.compact .tile[data-icon] { display: flex; flex-direction: column; padding: 16px 12px 12px; }
    .tiles.compact .tile[data-icon] .tile-icon { width: 40px; height: 40px; margin: 0 0 4px; }
    .tiles.compact .tile[data-icon] h3 { font-size: .98rem; }
}

/* ───── Chân trang chia cột kiểu menu ───── */
.foot-top { display: grid; grid-template-columns: minmax(220px, 1.2fr) 2fr; align-items: start; gap: 24px 40px; }
.foot-about { display: grid; gap: 14px; }
.foot-contact { margin: 0; font-size: .9rem; display: grid; gap: 2px; }
.foot-contact small { color: var(--ink-soft); font-weight: 500; font-size: .8rem; }
.foot-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 24px; }
.foot-cols div { display: flex; flex-direction: column; gap: 9px; }
.foot-cols h2 { margin: 0 0 2px; font: 700 .76rem/1.2 var(--font-text); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.foot-cols a { color: var(--ink); font-weight: 600; font-size: .93rem; text-decoration: none; }
.foot-cols a:hover { color: var(--link); text-decoration: underline; }
@media (max-width: 640px) {
    .foot-top { grid-template-columns: 1fr; display: grid; }
    .foot-cols { grid-template-columns: 1fr 1fr; gap: 20px 16px; }
    .foot-cols a { font-size: .9rem; padding: 2px 0; }
}

/* ───── Cộng đồng: thanh tương tác và bình luận thoáng hơn ───── */
.post { gap: 12px; }
.post-actions { gap: 4px; margin: 2px -6px 0; padding-top: 8px; border-top: 1px solid var(--line); }
.post-actions .heart, .post-act {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 0; border-radius: 10px;
    background: transparent; color: var(--ink-soft); font: 600 .92rem/1 var(--font-text); cursor: pointer; transition: background .14s, color .14s;
}
.post-actions .heart:hover, .post-act:hover { background: var(--fill); transform: none; }
.post-actions .heart.on { color: #d6336c; background: #fff0f3; border: 0; }
.post-thread { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); margin: 0 -2px; }
.comments { gap: 12px; }
.comment { display: flex; align-items: flex-start; gap: 10px; }
.comment-avatar {
    flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
    background: var(--brand-soft); color: #8a6100; font: 700 .85rem/1 var(--font-fun);
}
.comment-main { min-width: 0; flex: 1; }
.comment-bubble { display: inline-block; max-width: 100%; padding: 8px 14px 9px; border-radius: 4px 16px 16px 16px; }
.comment-bubble b { font-size: .9rem; }
.comment-bubble p { margin: 3px 0 0; line-height: 1.45; }
.comment-meta { display: flex; align-items: center; gap: 12px; margin: 4px 0 0 6px; font-size: .78rem; color: var(--ink-soft); }
.comment-meta form { margin: 0; }
.comment-meta .link { font-size: .78rem; padding: 0; color: var(--ink-soft); }
.comment-meta .link:hover { color: #c0392b; }
.heart.mini { padding: 0; border: 0; background: none; gap: 3px; font: 600 .78rem/1 var(--font-text); color: var(--ink-soft); }
.heart.mini:hover { transform: none; color: #d6336c; }
.heart.mini.on { background: none; color: #d6336c; }
.heart.mini .heart-icon { font-size: .82rem; }
.comment-form { position: relative; gap: 0; }
.comment-form input { padding: 10px 46px 10px 16px; border-radius: 999px; background: var(--fill); border-color: transparent; }
.comment-form input:focus { background: #fff; border-color: var(--brand); }
.comment-send {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 50%;
    background: var(--brand); color: var(--ink); font-size: .95rem; cursor: pointer;
}
.comment-send:hover { filter: brightness(1.05); }
.comment-meta .link, .post-del .link { text-decoration: none; color: var(--ink-soft); font-weight: 600; }
.post-del .link { font-size: .85rem; }
.post-del .link:hover { color: #c0392b; }
.heart-count:empty { display: none; }

/* ───── Nhắc nghỉ ngơi theo thời gian luyện trong ngày ───── */
.rest-note { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 14px 18px; border-radius: 18px; background: #e8f7ef; border: 1.5px solid #9fd9b9; }
.rest-note.long { background: #fff3e0; border-color: #f6c27a; }
.rest-icon { font-size: 2rem; line-height: 1; flex: none; }
.rest-note p { margin: 0; display: grid; gap: 2px; }
.rest-note b { font-family: var(--font-fun); font-size: 1.05rem; color: var(--ink); }
.rest-note span { color: var(--ink-soft); }
.rest-line { margin: 8px 0 22px; padding: 8px 14px; border-radius: 12px; background: #fff3e0; color: #8a5200; font-weight: 600; font-size: .92rem; }

/* ───── Quản trị: Thu chi ───── */
.finance-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.finance-head .tabs { margin: 0; }
.gain { color: #1e8e5a; }
.loss { color: #c0392b; }
.finance-table td, .finance-table th { white-space: nowrap; }
.finance-table .bar-col { width: 28%; min-width: 120px; }
.fin-bar { height: 7px; border-radius: 4px; margin: 2px 0; min-width: 2px; }
.fin-bar.in, .fin-dot.in { background: #2fa36b; }
.fin-bar.out, .fin-dot.out { background: #e07a5f; }
.fin-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 10px; vertical-align: -1px; }
.fin-key { margin: 8px 0 0; font-size: .85rem; }
.finance-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; }
.finance-form label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
.finance-form .wide { grid-column: 1 / -1; }
.finance-form .check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.finance-form .btn { justify-self: start; }
.fin-actions { white-space: nowrap; text-align: right; }
.fin-actions form { display: inline; margin-left: 10px; }
@media (max-width: 640px) { .finance-form { grid-template-columns: 1fr; } }

/* ───── Ô chọn đẹp (select.js) ───── */
.dd { position: relative; display: block; width: 100%; }
.dd-native { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; pointer-events: none; }
.dd-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: var(--control-h);
    padding: 10px 14px; text-align: left; cursor: pointer; font: 500 1rem/1.3 var(--font-text); color: var(--ink);
    background: #fff; border: var(--control-border); border-radius: var(--control-radius); transition: border-color .12s, box-shadow .12s;
}
.dd-btn:hover { border-color: #c3cadb; }
.dd-btn:focus-visible, .dd.open .dd-btn { outline: none; border-color: var(--brand-deep); box-shadow: 0 0 0 4px var(--brand-soft); }
.dd-btn:disabled { opacity: .6; cursor: default; }
.dd-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-val.empty { color: #8a91a8; }
.dd-chev { flex: none; color: var(--ink-soft); transition: transform .15s; }
.dd.open .dd-chev { transform: rotate(180deg); }
.dd-menu {
    position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; min-width: 100%; max-width: min(92vw, 420px); max-height: 320px; overflow: auto;
    padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(27, 35, 72, .16);
}
.dd.up .dd-menu { top: auto; bottom: calc(100% + 6px); }
.dd-menu [role=option] {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap;
    font: 500 .95rem/1.3 var(--font-text); color: var(--ink); outline: none;
}
.dd-menu [role=option]:hover, .dd-menu [role=option]:focus { background: var(--brand-soft); }
.dd-menu [role=option][aria-selected=true] { font-weight: 700; }
.dd-menu [role=option][aria-selected=true]::after { content: "✓"; margin-left: auto; padding-left: 12px; color: #1e8e5a; font-weight: 800; }
.dd-menu [role=option][aria-disabled=true] { color: #a3aac0; cursor: default; background: none; }
.part .dd { width: auto; min-width: 150px; flex: 1; }

/* ───── Quản trị: menu dọc bên trái ───── */
.admin-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 24px; max-width: 1340px; margin: 0 auto; padding: 22px 16px 28px; align-items: start; }
.admin-main { min-width: 0; }
.admin-side { position: sticky; top: 84px; display: grid; gap: 14px; padding: 14px 10px; background: #fff; border: 1px solid var(--line); border-radius: 18px; max-height: calc(100vh - 100px); overflow: auto; }
.admin-side-group { display: grid; gap: 2px; }
.admin-side-title { padding: 0 10px 4px; font: 700 .72rem/1.2 var(--font-text); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.admin-side a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); font: 600 .92rem/1.2 var(--font-text); }
.admin-side a > span[aria-hidden] { width: 20px; text-align: center; flex: none; }
.admin-side a:hover { background: var(--fill); }
.admin-side a.on { background: var(--ink); color: #fff; }
@media (max-width: 900px) {
    .admin-shell { grid-template-columns: 1fr; gap: 14px; padding-top: 14px; }
    .admin-side { position: static; display: flex; gap: 4px; overflow-x: auto; max-height: none; padding: 8px; -webkit-overflow-scrolling: touch; }
    .admin-side-group { display: contents; }
    .admin-side-title { display: none; }
    .admin-side a { white-space: nowrap; flex: none; }
}

/* ───── Thu chi: nút thêm khoản chi xổ ra form ───── */
.add-expense > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; list-style: none; cursor: pointer; }
.add-expense > summary::-webkit-details-marker { display: none; }
.add-expense > summary .muted { font-size: .88rem; }
.add-expense[open] > summary .muted { display: none; }
.add-expense[open] > summary .btn { background: var(--fill); border-color: var(--line); }
.add-expense .finance-form { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.finance-form-actions { grid-column: 1 / -1; display: flex; gap: 8px; }

/* ───── Lịch sử: ô lọc kỳ thi cùng hàng với 3 nút ───── */
.history-bar { align-items: center; }
.history-filter { margin: 0 0 0 auto; width: 260px; }
.history-filter .dd-btn { min-height: 38px; padding: 7px 12px; font-size: .92rem; font-weight: 600; }
@media (max-width: 640px) { .history-filter { width: 100%; margin-left: 0; } }

/* ───── Trang chủ: thời gian luyện hôm nay ───── */
.today-time { font: 600 .86rem/1 var(--font-text); background: #eef2fb; color: #3b456e; border-radius: 999px; padding: 8px 13px; white-space: nowrap; }
.today-time.short { background: #e8f7ef; color: #1e6b45; }
.today-time.long { background: #fff1e0; color: #a1510a; }
.admin-main .stat b { font-size: 1.35rem; white-space: nowrap; }
.admin-main .stat-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
@media (max-width: 900px) { .admin-side { position: relative; top: auto; } }
/* Khung quản trị luôn rộng đủ (body là flex dọc nên khung tự co theo nội dung nếu không đặt width). */
.admin-shell { width: 100%; flex: 1 0 auto; }
/* Ô tìm kiếm: bỏ kiểu bo góc riêng của Safari để giống các ô nhập khác. */
input[type=search] { -webkit-appearance: none; appearance: none; }
.admin-search .btn { min-height: var(--control-h); }

/* ───── Biểu mẫu chia cột thẳng hàng (Cấu hình, Thông tin của bạn): nhãn, ô nhập, gợi ý cùng hàng ───── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); column-gap: 18px; row-gap: 6px; align-items: start; }
.form-grid > label { display: grid; grid-template-rows: subgrid; grid-row: span 3; row-gap: 6px; margin: 0 0 14px; font-weight: 600; }
.form-grid > label > .lbl { align-self: end; font-size: .92rem; }
.form-grid > label > .hint { font-weight: 500; margin: 0; }
.form-grid > .wide { grid-column: 1 / -1; }
.settings-form { display: grid; gap: 4px; }
.set { border: 0; margin: 0; padding: 18px 0 4px; border-top: 1px solid var(--line); min-width: 0; }
.set:first-child { border-top: 0; padding-top: 4px; }
.set > legend { float: left; width: 100%; padding: 0; margin: 0 0 6px; font: 700 1rem/1.3 var(--font-fun); color: var(--ink); }
.set > .hint { clear: both; margin: 0 0 12px; }
.set > legend + .form-grid { clear: both; padding-top: 6px; }
.settings-save { position: sticky; bottom: 12px; padding-top: 8px; }
.settings-save .btn { box-shadow: 0 6px 18px rgba(27, 35, 72, .14); }

/* ───── Trang giới thiệu: Chi phí (Miễn phí trước, Premium là phần thêm) ───── */
.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; align-items: stretch; }
.price-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: 18px; border: 1.5px solid var(--line); background: #fff; }
.price-card.free { border: 2px solid #8fd3ae; background: linear-gradient(160deg, #eefaf3, #fff 55%); }
.price-card.premium { border-color: #f2cf6b; background: linear-gradient(160deg, #fff8e1, #fff 55%); }
.price-tag { align-self: flex-start; font: 700 .85rem/1 var(--font-text); padding: 7px 12px; border-radius: 999px; background: #d9f3e4; color: #1e6b45; }
.premium .price-tag { background: #ffeeb8; color: #7a5600; }
.price-big { font: 800 2rem/1.1 var(--font-fun); color: #1e6b45; }
.price-big small { display: block; margin-top: 4px; font: 600 .86rem/1.3 var(--font-text); color: var(--ink-soft); }
.price-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.price-plan { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.price-plan span { font-size: .84rem; font-weight: 600; color: var(--ink-soft); }
.price-plan b { font: 800 1.2rem/1.2 var(--font-fun); color: var(--ink); }
.price-plan small { font-size: .8rem; color: var(--ink-soft); }
.price-plan.best { border-color: #e9b93c; box-shadow: 0 0 0 2px #fff1c2; }
.price-plus { margin: 4px 0 0; font-weight: 700; font-size: .92rem; }
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.ticks li { position: relative; padding-left: 26px; font-size: .95rem; line-height: 1.4; }
.ticks li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 800; background: #d9f3e4; color: #1e6b45; }
.premium .ticks li::before { background: #ffeeb8; color: #7a5600; }
.price-card .btn { align-self: flex-start; margin-top: auto; }
.price-card .hint { margin: auto 0 0; }
@media (max-width: 720px) { .price-grid { grid-template-columns: 1fr; } }

/* ───── Trang kỳ thi: phần làm bài gọn, hướng dẫn gom một chỗ ───── */
.banner-help { display: inline-block; margin-top: 8px; font-size: .88rem; font-weight: 600; }
.resume { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border: 2px solid var(--brand); }
.resume b { font-family: var(--font-fun); font-size: 1.1rem; }
.quota-line { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 0 0 16px; padding: 10px 14px; border-radius: 12px; background: #fff8e1; border: 1px solid #f6dc8c; font-size: .92rem; font-weight: 600; }
.quota-line a { font-weight: 700; }
.rounds-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.rounds-head h2 { margin: 0; }
.endless-tag { font-size: .84rem; font-weight: 600; color: #23466e; background: #eef6ff; border: 1px solid #cfe2fb; border-radius: 999px; padding: 6px 12px; cursor: help; }
.level-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 4px; }
.level-row-label { font-size: .84rem; font-weight: 700; color: var(--ink-soft); margin-right: 2px; }
.level-chip { position: relative; display: inline-block; text-decoration: none; color: var(--ink); cursor: pointer; }
.level-chip input { position: absolute; opacity: 0; }
.level-chip > span { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.level-chip input:checked + span { border-color: var(--brand-deep); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(255, 200, 61, .3); }
.level-chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.level-chip.locked > span { background: var(--fill); color: var(--ink-soft); }
.level-suggest { margin: 8px 0 0; }
.practice small { min-height: 0; }
.guide > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; cursor: pointer; font-weight: 700; }
.guide > summary::-webkit-details-marker { display: none; }
.guide-more { font-size: .85rem; color: var(--link); }
.guide-more::after { content: " ▾"; }
.guide[open] .guide-more { display: none; }
.guide-body { margin-top: 10px; padding-top: 6px; border-top: 1px dashed var(--line); color: var(--ink); }
.guide-body h3 { font-size: 1rem; margin: 16px 0 6px; }
.guide-body p, .guide-body li { font-size: .93rem; line-height: 1.55; }
.guide-body ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.guide-table td { font-size: .9rem; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rounds { margin-top: 16px; }
.rgroup .narrow { display: none; }
/* Nhóm vòng: mỗi nhóm một khung màu nhạt, tiêu đề có biểu tượng và số vòng đã đạt. */
.rgroup { --g: #1f9d6b; --g-soft: #eefaf4; --g-line: #c9ecda; margin-top: 18px; padding: 16px; background: var(--g-soft); border: 1.5px solid var(--g-line); border-radius: 20px; }
.rgroup.g-on { --g: #2f6fe0; --g-soft: #eff5ff; --g-line: #cfe0fb; }
.rgroup.g-thi { --g: #c98500; --g-soft: #fff8e6; --g-line: #f5dfa6; }
.rgroup-head { display: flex; align-items: center; gap: 12px; }
.rgroup-ico { flex: none; display: grid; place-items: center; width: 44px; height: 44px; font-size: 1.45rem; background: #fff; border: 2px solid var(--g-line); border-radius: 14px; }
.rgroup-head > div { flex: 1; min-width: 0; }
.rgroup-head h3 { margin: 0; font: 700 1.15rem/1.25 var(--font-fun); color: color-mix(in srgb, var(--g) 62%, var(--ink)); }
.rgroup-head p { margin: 2px 0 0; font-size: .9rem; line-height: 1.4; color: var(--ink-soft); }
.rgroup-done { flex: none; padding: 6px 12px; font: 700 .82rem/1 var(--font-text); color: color-mix(in srgb, var(--g) 70%, var(--ink)); background: #fff; border: 1.5px solid var(--g-line); border-radius: 99px; }
.rgroup-done.all { color: #fff; background: #1f9d6b; border-color: #1f9d6b; }
.rgroup .rounds { margin-top: 14px; }
.rgroup .round { border-color: var(--g-line); border-top: 4px solid color-mix(in srgb, var(--g) 55%, #fff); }
.rgroup .round:hover { border-color: color-mix(in srgb, var(--g) 45%, #fff); }
.rgroup .round .btn.primary { background: color-mix(in srgb, var(--g) 13%, #fff); color: color-mix(in srgb, var(--g) 55%, var(--ink)); }
.rgroup .round .btn.primary:hover { background: var(--g); color: #fff; box-shadow: none; }
.rgroup .round.passed { background: #fff; }
/* Thi thử: mỗi cấp một màu, cấp càng cao càng nổi. */
.rgroup .round.lv-truong { --g: #2f7de0; --g-line: #cbdff8; }
.rgroup .round.lv-xa { --g: #0e9a94; --g-line: #bfe6e3; }
.rgroup .round.lv-tinh { --g: #7c5ce6; --g-line: #d9cffa; }
.rgroup .round.lv-quocgia { --g: #d68a00; --g-line: #f3cf7a; background: linear-gradient(170deg, #fff4cf, #fff 55%); }
.round-tag { align-self: flex-start; padding: 5px 9px; font: 700 .76rem/1 var(--font-text); color: #fff; background: var(--g); border-radius: 99px; }
.rgroup .round.next, .rgroup .round.soon { border-color: var(--g); box-shadow: 0 0 0 3px color-mix(in srgb, var(--g) 16%, transparent); }
.rgroup .round.next .btn.primary, .rgroup .round.soon .btn.primary { background: var(--g); color: #fff; }
@media (min-width: 641px) { .rgroup .round.passed b { padding-right: 26px; } .rgroup .round .btn { margin-top: auto; } .rgroup .round > small:last-of-type { margin-bottom: 10px; } }
.rgroup .round small.round-date { font-weight: 700; color: color-mix(in srgb, var(--g) 70%, var(--ink)); }
/* Điện thoại: mỗi vòng / bài một hàng gọn (tên, sao, điểm bên trái; nút bên phải). */
@media (max-width: 640px) {
    .rounds { grid-template-columns: 1fr; gap: 8px; }
    .round { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 3px; align-items: center; padding: 12px 14px; }
    .round > * { grid-column: 1; }
    .round > .btn { grid-column: 2; grid-row: 1 / span 6; margin: 0; width: auto; align-self: center; }
    .rgroup { margin-left: -8px; margin-right: -8px; padding: 12px 8px; border-radius: 16px; }
    .rgroup-head { gap: 10px; padding: 0 4px; }
    .rgroup .wide { display: none; }
    .rgroup .narrow { display: inline; }
    .rgroup .round .btn { padding-left: 12px; padding-right: 12px; }
    .rgroup-ico { width: 38px; height: 38px; font-size: 1.2rem; }
    .rgroup .round { border-top-width: 1.5px; border-left: 5px solid color-mix(in srgb, var(--g) 55%, #fff); }
    .round-tag { justify-self: start; }
    .round b { font-size: 1rem; }
    .round .stars { font-size: .85rem; line-height: 1; }
    .round.passed::after { display: none; }
}

/* Độ khó: bong bóng giải thích luôn hiện dưới hàng nút, mũi nhọn chỉ vào nút đang chọn. */
.level-tip { position: relative; margin: 10px 0 4px; padding: 9px 14px; border-radius: 12px; background: #fff8e1; border: 1px solid #f2cf6b; color: #6b4d00; font-size: .9rem; font-weight: 600; --tip-x: 40px; }
.level-tip::before { content: ""; position: absolute; top: -7px; left: calc(var(--tip-x) - 7px); width: 12px; height: 12px; background: #fff8e1; border-left: 1px solid #f2cf6b; border-top: 1px solid #f2cf6b; transform: rotate(45deg); transition: left .15s; }
.level-tip.no-arrow::before { display: none; }

/* ───── Quản trị: bảng học sinh / tài khoản + ngăn kéo chi tiết bên phải ───── */
.notice.bad { background: var(--coral-soft); color: #a8322a; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--fill); color: var(--ink-soft); font: 600 .8rem/1.35 var(--font-text); white-space: nowrap; margin: 1px 4px 1px 0; }
.tag-premium { background: #fff1c2; color: #7a5600; }
.tag-bad { background: var(--coral-soft); color: #b8382c; }
.tag-online { background: #E1F6EC; color: #0E7A50; font-weight: 600; }
.tag-new { background: #FDE6F1; color: #B0306F; font-weight: 600; margin-left: 4px; }
.acc-sub { display: block; font-size: .78rem; }
.acc-name { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.same-chip { border: 1px solid #f0d58a; background: #fff7de; color: #8a5a00; border-radius: 999px; padding: 0 6px; font-size: .72rem; line-height: 1.5; cursor: pointer; white-space: nowrap; vertical-align: middle; }
.same-chip:hover { background: #ffedb8; }
.same-pop { white-space: normal; overflow-x: hidden; position: fixed; inset: 0; margin: auto; height: fit-content; text-align: left; font-weight: 400; border: 1px solid var(--line, #e5e5e5); border-radius: 14px; padding: 14px 16px; width: min(320px, 90vw); box-shadow: 0 12px 40px rgba(0, 0, 0, .18); font-size: .9rem; }
.same-pop::backdrop { background: rgba(0, 0, 0, .15); }
.same-pop .same-h { margin: 0 0 4px; font-weight: 700; }
.same-pop .same-h small { font-weight: 400; color: #777; }
.same-pop ul { margin: 0 0 10px; padding-left: 18px; }
.same-act { display: flex; gap: 8px; justify-content: flex-end; }
.online-card h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 1.1rem; }
.online-card h2 small { font-size: .82rem; font-weight: 500; }
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #17A673; animation: live-dot 2s infinite; }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.online-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.online-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #F7FCF9;
  cursor: pointer; min-width: 0; }
.online-list li:hover, .online-list li:focus-visible { border-color: #17A673; background: #EAF8F1; }
.online-who { display: grid; min-width: 0; flex: 1; }
.online-who small { color: var(--ink-soft); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-ago { font-size: .78rem; color: var(--ink-soft); white-space: nowrap; }
.tag-wait { background: #e8efff; color: #2f4fb0; }
.tag-deal { background: #ffe9e3; color: #b3361b; cursor: help; white-space: nowrap; }
.tag-deal.hot { background: #b3361b; color: #fff; }
.acc-list { padding: 6px 10px; }
.tag-grade { font-size: .72rem; padding: 1px 8px; margin: 0; }
.acc-table td, .acc-table th { vertical-align: middle; padding: 7px 8px; }
.acc-table td { font-size: .92rem; line-height: 1.35; }
.acc-table td[data-label="Truy cập"] { white-space: nowrap; }
.acc-table .num { text-align: right; white-space: nowrap; }
.acc-table tbody tr { cursor: pointer; transition: background .12s; }
.acc-table tbody tr:hover, .acc-table tbody tr:focus-visible { background: #f7f9ff; outline: none; }
.acc-table tbody tr:focus-visible { box-shadow: inset 3px 0 0 var(--link); }
.acc-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.acc-cell .avatar.small { width: 36px; height: 36px; font-size: 1.2rem; flex: none; }
.acc-cell-text { display: grid; min-width: 0; }
.acc-cell-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.acc-go { text-align: right; width: 1%; white-space: nowrap; color: var(--ink-soft); font-size: 1.2rem; }
@media (max-width: 760px) {
    .acc-table thead { display: none; }
    .acc-table, .acc-table tbody, .acc-table tr, .acc-table td { display: block; width: auto; }
    .acc-table tr { padding: 10px 2px; border-bottom: 1px solid var(--line); }
    .acc-table td { border: 0; padding: 3px 0; text-align: left !important; }
    .acc-table td[data-label]:not(:first-child)::before { content: attr(data-label) ": "; color: var(--ink-soft); font-size: .84rem; }
    .acc-table td:first-child { padding-bottom: 6px; }
    /* Học sinh trên điện thoại: tên và lớp bên trái, gói và truy cập bên phải, phụ huynh và số bài hàng dưới. */
    .acc-kids tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center; padding: 8px 2px; }
    .acc-kids td { padding: 1px 0; }
    .acc-kids td[data-label]:not(:first-child)::before { content: none; }
    .acc-kids td[data-label="Gói lớp"] { grid-column: 2; grid-row: 1; text-align: right !important; }
    .acc-kids td[data-label="Phụ huynh"] { grid-column: 1 / -1; grid-row: 2; }
    .acc-kids .acc-sub { display: inline; margin-left: 6px; }
    .acc-kids td[data-label="Truy cập"] { grid-column: 2; grid-row: 3; text-align: right !important; }
    .acc-kids td[data-label="Bài"] { grid-column: 1; grid-row: 3; }
    .acc-kids td[data-label="Bài"]::before { content: "Bài: " !important; color: var(--ink-soft); font-size: .84rem; }
    .acc-go { display: none !important; }
}

.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer[hidden] { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(20, 27, 58, .38); opacity: 0; transition: opacity .2s; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--bg); box-shadow: -12px 0 40px rgba(20, 27, 58, .18);
    transform: translateX(100%); transition: transform .22s ease-out; display: flex; flex-direction: column; }
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-close { position: absolute; top: 12px; right: 14px; z-index: 3; width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow-sm); font-size: 1rem; cursor: pointer; color: var(--ink); }
.drawer-close:hover { background: var(--fill); }
.drawer-body { flex: 1; min-height: 0; display: flex; }
.drawer-scroll { flex: 1; overflow-y: auto; padding: 18px 22px 40px; overscroll-behavior: contain; }
.drawer-loading { padding: 40px 24px; }
html.drawer-lock { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .drawer-panel, .drawer-backdrop { transition: none; } }

.acc { display: grid; gap: 14px; min-width: 0; }
.acc.card { max-width: 860px; }
.acc-head { display: flex; gap: 14px; align-items: flex-start; }
.drawer .acc-head { padding-right: 50px; }
.drawer .acc-tabs { margin-right: 46px; top: -18px; }
.acc-avatar { width: 52px; height: 52px; font-size: 1.4rem; }
.acc-title { display: grid; gap: 2px; min-width: 0; }
.acc-title h2 { margin: 0; font-size: 1.35rem; }
.acc-title > .muted { overflow-wrap: anywhere; }
.acc-badges { margin-top: 6px; }
.acc-msg { margin: 0; word-break: break-word; }
.acc-link { display: flex; gap: 8px; flex-wrap: wrap; }
.acc-link input { flex: 1 1 260px; font-size: .85rem; }
.acc-tabs { display: flex; gap: 4px; padding: 4px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 1; overflow-x: auto; scrollbar-width: none; }
.acc-tabs button { flex: 1 0 auto; border: 0; background: none; padding: 10px 14px; border-radius: 10px; font: 600 .92rem/1 var(--font-text); color: var(--ink-soft); cursor: pointer; white-space: nowrap; }
.acc-tabs button small { margin-left: 3px; font-size: .78rem; opacity: .75; }
.acc-tabs button:hover { color: var(--ink); background: var(--fill); }
.acc-tabs button[aria-selected=true] { background: var(--ink); color: #fff; }
.acc-pane { display: grid; gap: 14px; align-content: start; }
.acc-pane[hidden] { display: none; }
.acc-h { margin: 8px 0 -4px; font-size: 1rem; }
.acc-h small { font-weight: 500; font-size: .8rem; margin-left: 6px; }
.acc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.acc-stats > div { background: #fff; border-radius: 14px; padding: 12px 14px; display: grid; gap: 2px; box-shadow: var(--shadow-sm); min-width: 0; }
.acc-stats b { font: 800 1.15rem/1.2 var(--font-fun); color: var(--ink); }
.acc-stats b small { font: 600 .8rem var(--font-text); color: var(--ink-soft); }
.acc-stats span { font-size: .8rem; color: var(--ink-soft); }
.acc-stats.small > div { background: var(--fill); box-shadow: none; padding: 9px 12px; }
.acc-stats.small b { font-size: 1.02rem; }
.acc-pending { margin: 0; background: #e8efff; }
.acc-plans { display: grid; gap: 8px; }
.acc-plan { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 14px; align-items: start; background: #fff; border-radius: 14px; padding: 12px 14px; border-left: 4px solid #f2cf6b; box-shadow: var(--shadow-sm); }
.acc-plan.off { border-left-color: #e2e5ee; }
.acc-plan-main { display: grid; gap: 2px; }
.acc-plan-main span { font-size: .92rem; }
.acc-plan.off .acc-plan-main span { color: var(--coral); }
.acc-mini > summary { list-style: none; cursor: pointer; padding: 4px 0; }
.acc-mini > summary::-webkit-details-marker { display: none; }
.acc-mini[open] { grid-column: 1 / -1; order: 5; }
.acc-mini[open] > summary { font-weight: 700; }
.acc-mini .bad { color: var(--coral); }
.acc-form { display: grid; gap: 10px; margin-top: 8px; }
.acc-form label { display: grid; gap: 5px; font-weight: 600; font-size: .88rem; margin: 0; }
.acc-form .btn { justify-self: start; }
.acc-form .hint { margin: 0; }
.acc-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); align-items: end; }
.acc-grid .wide, .acc-grid .hint { grid-column: 1 / -1; }
.acc-add { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
.acc-box { background: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-sm); min-width: 0; }
details.acc-box > summary { cursor: pointer; font-weight: 700; font-size: .95rem; padding: 4px 0; }
details.acc-box[open] { grid-column: 1 / -1; }
.acc-box h4 { margin: 0; font-size: .95rem; }
.acc-box h4 small { font-weight: 500; }
.acc-info { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; background: #fff; border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-sm); font-size: .92rem; }
.acc-info dt { color: var(--ink-soft); }
.acc-info dd { margin: 0; overflow-wrap: anywhere; }
.acc-note-form { display: flex; gap: 8px; align-items: flex-end; }
.acc-note-form textarea { flex: 1; min-height: 48px; resize: vertical; }
.acc-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.acc-notes li { background: #fffbea; border-radius: 12px; padding: 9px 12px; }
.acc-notes p { margin: 0 0 2px; white-space: pre-line; }
.acc-kid { background: #fff; border-radius: 16px; padding: 14px; box-shadow: var(--shadow-sm); display: grid; gap: 10px; scroll-margin-top: 70px; }
.acc-kid > header { display: flex; align-items: center; gap: 10px; }
.acc-kid > header > div { flex: 1; min-width: 0; }
.acc-kid > header small { display: block; }
.acc-kid > p { margin: 0; font-size: .86rem; }
.acc-attempts td, .acc-attempts th { padding: 7px 6px; font-size: .86rem; }
.acc-attempts td:first-child, .acc-attempts td:last-child { white-space: nowrap; }
.acc-history { list-style: none; margin: 0; padding: 0; position: relative; }
.acc-history::before { content: ""; position: absolute; left: 17px; top: 10px; bottom: 10px; width: 2px; background: var(--line); }
.acc-history li { position: relative; display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding: 8px 0; }
.acc-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #fff; box-shadow: 0 0 0 3px var(--bg); font-size: 1rem; z-index: 1; border: 1.5px solid var(--line); }
.tone-good .acc-dot { border-color: #8fd3ae; background: var(--mint-soft); }
.tone-gift .acc-dot { border-color: #f2cf6b; background: #fff8e1; }
.tone-bad .acc-dot { border-color: #f3aaa2; background: var(--coral-soft); }
.tone-wait .acc-dot { border-color: #b7c8f5; background: #eef3ff; }
.acc-history li > div { display: grid; gap: 2px; min-width: 0; padding-top: 2px; }
.acc-history-top { display: flex; justify-content: space-between; gap: 10px; }
.acc-amount { font-weight: 800; color: var(--mint); white-space: nowrap; }
.acc-history-detail { font-size: .9rem; }
.acc-history q { font-size: .88rem; color: var(--ink); background: var(--fill); border-radius: 8px; padding: 4px 8px; justify-self: start; quotes: none; }
.acc-history small { font-size: .8rem; }
.acc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.acc-actions .acc-form { margin: 0; }
.acc-row { display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
.acc-danger { border: 1.5px solid var(--coral-soft); }
.btn.busy { opacity: .6; pointer-events: none; }
@media (max-width: 640px) {
    .drawer-scroll { padding: 14px 14px 32px; }
    .drawer .acc-tabs { top: -14px; }
    .acc-tabs button { flex: 1 1 auto; }
    .acc-tabs { gap: 2px; }
    .drawer .acc-tabs { margin-right: 42px; }
    .acc-tabs button { padding: 9px 7px; font-size: .8rem; }
    .acc-tabs button small { display: none; }
    .acc-stats { grid-template-columns: 1fr 1fr; }
    .acc-add, .acc-actions { grid-template-columns: 1fr; }
    .acc-plan { grid-template-columns: 1fr auto; }
    .acc-plan-main { grid-column: 1 / -1; }
    .acc-info { grid-template-columns: 1fr; gap: 2px; }
    .acc-info dd { margin-bottom: 8px; }
    .acc-note-form { flex-direction: column; align-items: stretch; }
    .acc-note-form .btn { align-self: flex-start; }
}
@media (max-width: 640px) { .admin-toolbar .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; } .admin-toolbar .chips .chip { flex: none; } }
@media (max-width: 640px) { .acc-kid > header { flex-wrap: wrap; } .acc-kid-plan { flex-basis: 100%; padding-left: 54px; } }

/* ───── Vừa học vừa chơi: trang chính, trang bài, khung chơi (play.js) ───── */

/* Đầu trang bài: một dòng gọn (biểu tượng nhỏ + tên bài), để khung chơi lên sát màn hình. */
.banner.play-banner { padding: 10px 16px; gap: 12px; margin-bottom: 12px; flex-wrap: nowrap; border-radius: 16px; }
.play-banner .icon { width: 42px; height: 42px; font-size: 1.35rem; border-radius: 12px; }
.play-banner h1 { font-size: 1.3rem; margin: 0; line-height: 1.25; }
.play-banner p { font-size: .9rem; margin-top: 2px; }
.play-head h1 { margin-bottom: 2px; }
.play-head p { margin-top: 0; }
.play { position: relative; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 20px; border-top: 6px solid var(--t, var(--brand)); }
.play-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.play-seg { display: inline-flex; gap: 3px; padding: 3px; background: var(--fill); border-radius: 12px; }
.play-seg button, .play-seg a { border: 0; background: none; padding: 8px 13px; border-radius: 9px; font: 700 .9rem/1.1 var(--font-text); color: var(--ink-soft); cursor: pointer; text-decoration: none; white-space: nowrap; }
.play-seg button:hover, .play-seg a:hover { color: var(--ink); }
.play-seg .on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.play-locked { color: #8a6100 !important; }
.play-sound { margin-left: auto; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; font-size: 1.05rem; cursor: pointer; }
.play-opts { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.play-opts::-webkit-scrollbar { display: none; }
.play-opts[hidden] { display: none; }
.play-opts .chip { cursor: pointer; flex: none; font: 600 .88rem/1.2 var(--font-text); }
.play-opts .chip.on { background: var(--t-soft, var(--brand)); border-color: var(--t, var(--brand-deep)); }
.play-stage { position: relative; overflow: hidden; min-height: 280px; margin-top: 10px; border-radius: 16px; background: linear-gradient(180deg, var(--t-soft, var(--brand-soft)), #fff 75%); display: grid; place-items: center; padding: 18px 14px; }
.play-hint { margin: 8px 2px 0; font-size: .8rem; }

.play-ready, .play-result { display: grid; justify-items: center; gap: 10px; text-align: center; max-width: 420px; }
.play-ready b, .play-result b { font: 800 1.25rem/1.3 var(--font-fun); }
.play-ready-icon { font-size: 3.2rem; line-height: 1; animation: play-bob 2.4s ease-in-out infinite; }
.play-go { min-width: 180px; font-size: 1.15rem; }
.play-result p { margin: 0; }
.play-record { font-weight: 700; color: #8a6100; }
.play-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.play-up { font-size: .9rem; color: var(--link); text-decoration: none; margin-top: 4px; }
.play-up:hover { text-decoration: underline; }
.play-stars { display: flex; gap: 6px; font-size: 2.8rem; line-height: 1; color: #dfe3ee; }
.play-stars .on { color: #ffc83d; text-shadow: 0 3px 0 #e9a400; animation: play-star .5s cubic-bezier(.3, 1.6, .5, 1) both; }

.pq, .pm { width: 100%; max-width: 560px; display: grid; gap: 12px; align-self: start; }
.pq-top { display: flex; align-items: center; gap: 10px; font: 700 .9rem/1 var(--font-text); color: var(--ink-soft); min-height: 22px; }
.pq-streak { color: #d4661f; }
.pq-timer { margin-left: auto; background: #fff; padding: 6px 10px; border-radius: 999px; box-shadow: var(--shadow-sm); color: var(--ink); }
.pq-timer.low { color: var(--coral); animation: play-pulse .9s ease-in-out infinite; }
.pq-bar { height: 8px; border-radius: 99px; background: rgba(27, 37, 80, .08); overflow: hidden; }
.pq-bar i { display: block; height: 100%; width: 0; background: var(--t, var(--brand)); border-radius: inherit; transition: width .35s ease; }
.pq-q { display: grid; justify-items: center; gap: 6px; text-align: center; min-height: 128px; align-content: center; background: #fff; border-radius: 16px; padding: 14px; box-shadow: var(--shadow-sm); }
.pq-q.in > * { animation: play-in .32s ease-out both; }
.pq-expr { font: 800 clamp(2rem, 7vw, 2.8rem)/1.15 var(--font-fun); color: var(--ink); white-space: pre; }
.pq-word { font: 700 clamp(2.2rem, 9vw, 3.2rem)/1.2 var(--font-text); color: var(--ink); }
.pq-word.small { font-size: clamp(1.5rem, 6vw, 2rem); letter-spacing: 2px; }
.pq-pic { font-size: clamp(3.4rem, 14vw, 4.6rem); line-height: 1.1; }
.pq-pics { font-size: clamp(1.6rem, 6vw, 2.2rem); line-height: 1.3; letter-spacing: 4px; max-width: 360px; word-break: break-all; }
.pq-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 380px; }
.pq-groups span { background: var(--fill); border-radius: 12px; padding: 6px; font-size: 1.05rem; line-height: 1.35; letter-spacing: 1px; word-break: break-all; display: grid; place-items: center; }
.pq-ask { font-size: .92rem; color: var(--ink-soft); font-weight: 600; }
.pq-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pq-opts.three { grid-template-columns: repeat(3, 1fr); }
.pq-opt, .pm-item { min-height: 64px; border-radius: 16px; border: 2px solid var(--line); background: #fff; color: var(--ink); font: 800 1.5rem/1.15 var(--font-fun); cursor: pointer; box-shadow: 0 3px 0 #dde2ee; transition: transform .12s, box-shadow .12s, border-color .12s, background .12s, opacity .3s; padding: 8px; touch-action: manipulation; }
.pq-opts:not(.pics) .pq-opt { font-family: var(--font-text); font-weight: 700; font-size: 1.35rem; }
.pq-opts.pics .pq-opt { font-size: 2.6rem; min-height: 86px; }
.pq-opt:hover:not(:disabled), .pm-item:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--t, var(--brand)); }
.pq-opt:active:not(:disabled), .pm-item:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.pq-opt:disabled { cursor: default; }
.pq-opt:disabled:not(.right):not(.wrong) { opacity: .55; }
.pq-opt.right, .pm-item.right { background: var(--mint-soft); border-color: var(--mint); color: #0b7a51; box-shadow: 0 3px 0 #9ad8bc; animation: play-pop .35s ease-out; }
.pq-opt.wrong, .pm-item.wrong { background: var(--coral-soft); border-color: var(--coral); color: #b8382c; box-shadow: 0 3px 0 #f3b3ac; animation: play-shake .4s ease-in-out; }

.pm-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pm-col { display: grid; gap: 10px; align-content: start; }
.pm-item { font-size: 1.3rem; min-height: 58px; }
.pm-item.pic { font-size: 2.1rem; }
.pm-item.dots { font-size: .95rem; letter-spacing: 2px; color: var(--t, var(--ink)); word-break: break-all; line-height: 1.25; }
.pm-item.sel { border-color: var(--t, var(--brand)); background: var(--t-soft, var(--brand-soft)); transform: scale(1.04); box-shadow: 0 0 0 4px color-mix(in srgb, var(--t, var(--brand)) 22%, transparent); }
.pm-item.gone { opacity: .38; transform: scale(.94); box-shadow: none; pointer-events: none; animation: none; }

.play-float { position: absolute; z-index: 3; font-size: 1.6rem; pointer-events: none; transform: translate(-50%, 0); animation: play-float .9s ease-out forwards; }
.play-confetti { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; z-index: 2; pointer-events: none; animation: play-confetti 1.8s cubic-bezier(.25, .6, .5, 1) forwards; }

@keyframes play-in { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes play-pop { 0% { transform: scale(1); } 45% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes play-shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes play-float { from { opacity: 1; transform: translate(-50%, 0) scale(.8); } to { opacity: 0; transform: translate(-50%, -60px) scale(1.25); } }
@keyframes play-confetti { to { transform: translate(var(--dx), 380px) rotate(var(--rot)); opacity: .2; } }
@keyframes play-star { from { transform: scale(0) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes play-bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
@keyframes play-pulse { 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) {
    .play *, .play *::before { animation: none !important; transition: none !important; }
}

.play-article h2 { margin-top: 0; }
.play-tips { padding-left: 20px; margin: 0; }
.play-tips li { margin: 8px 0; }
.mult-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mult-card { background: var(--fill); border-radius: 14px; padding: 12px 14px; scroll-margin-top: 80px; }
.mult-card h3 { margin: 0 0 6px; font-size: 1rem; color: #2f5fc4; }
.mult-card ol { list-style: none; margin: 0; padding: 0; font-variant-numeric: tabular-nums; }
.mult-card li { display: flex; justify-content: space-between; padding: 2px 0; font-size: .95rem; }
.mult-card li b { font-weight: 700; }
.abc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-bottom: 10px; }
.abc-card { background: var(--fill); border-radius: 14px; padding: 9px 10px; display: grid; gap: 4px; }
.abc-big { font: 800 1.7rem/1 var(--font-fun); color: #0b8584; }
.abc-big small { font: 700 1.3rem/1 var(--font-fun); margin-left: 6px; color: var(--ink); }
.abc-word { font-size: .92rem; }
button.abc-card { border: 1.5px solid transparent; text-align: left; cursor: pointer; font: inherit; color: var(--ink); transition: border-color .12s, transform .12s; }
button.abc-card:hover { border-color: #0ea5a4; transform: translateY(-2px); }
.abc-big i { font-style: normal; font-size: .8rem; margin-left: 6px; opacity: .45; vertical-align: middle; }
.abc-card.speaking { border-color: #0ea5a4; background: #dff7f6; }
.pq-say { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--t, var(--brand)); color: #fff; font-size: 2.3rem; cursor: pointer;
    box-shadow: 0 4px 0 color-mix(in srgb, var(--t, var(--brand)) 70%, #000); transition: transform .12s; }
.pq-say:hover { transform: scale(1.05); }
.pq-say.speaking { animation: play-pulse .6s ease-in-out infinite; }
.abc-word b { color: #0b8584; text-decoration: underline; text-underline-offset: 3px; }
.count-row { display: grid; grid-template-columns: repeat(11, 1fr); gap: 6px; margin-bottom: 12px; }
.count-cell { display: grid; justify-items: center; gap: 4px; background: var(--fill); border-radius: 12px; padding: 8px 4px; text-align: center; }
.count-cell b { font: 800 1.4rem/1 var(--font-fun); }
.count-cell span { font-size: .55rem; letter-spacing: 1px; color: #e07b2a; word-break: break-all; line-height: 1.3; }
.word-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.word-list li { background: var(--fill); border-radius: 999px; padding: 5px 12px 5px 8px; font-weight: 600; }
.word-list li.hard { background: var(--brand-soft); }
.word-list li:has(button) { padding: 0; }
.word-list button { border: 0; background: none; font: inherit; color: inherit; padding: 5px 12px 5px 8px; cursor: pointer; border-radius: inherit; }
.word-list button:hover, .word-list button.speaking { background: rgba(27, 37, 80, .07); }
.play-faq { border-top: 1px solid var(--line); padding: 10px 0; }
.play-faq:first-of-type { border-top: 0; }
.play-faq summary { cursor: pointer; font-weight: 700; }
.play-faq p { margin: 8px 0 0; color: var(--ink-soft); }
@media (max-width: 760px) {
    .mult-grid { grid-template-columns: repeat(2, 1fr); }
    .count-row { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 560px) {
    .play-banner p { display: none; }
    .play-banner h1 { font-size: 1.12rem; }
    .play-banner h1 .pill { display: none; }
    .play { padding: 10px; }
    .play-seg button, .play-seg a { padding: 8px 10px; font-size: .86rem; }
    .play-stage { min-height: 300px; padding: 14px 10px; }
    .pq-opts { grid-template-columns: repeat(2, 1fr); }
    .pq-opts.three { grid-template-columns: repeat(3, 1fr); }
    .pm-cols { gap: 10px; }
}

/* ───── Học mà chơi: ô bài học có hình minh hoạ trò chơi (Pages/Play/_PlayArt.cshtml) ───── */
.ptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.ptile { display: flex; flex-direction: column; background: #fff; border-radius: 20px; overflow: hidden; text-decoration: none; color: var(--ink);
    box-shadow: var(--shadow); border: 1.5px solid transparent; transition: transform .15s, box-shadow .15s, border-color .15s; }
a.ptile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); border-color: var(--t); color: var(--ink); }
.ptile-art { position: relative; height: 140px; display: flex; align-items: center; justify-content: center; overflow: hidden; text-decoration: none; color: var(--ink);
    background: radial-gradient(circle at 20% 25%, rgba(255, 255, 255, .7) 0 14px, transparent 15px),
                radial-gradient(circle at 85% 80%, rgba(255, 255, 255, .55) 0 22px, transparent 23px),
                linear-gradient(150deg, var(--t-soft), color-mix(in srgb, var(--t) 22%, #fff)); }
.ptile-body { display: grid; gap: 2px; padding: 12px 14px 14px; flex: 1; align-content: start; }
.ptile-body h2 { margin: 0; font-size: 1.14rem; line-height: 1.25; }
.ptile-body small { color: var(--ink-soft); font-size: .86rem; }
.ptile-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ptile-grade { font: 700 .72rem/1.2 var(--font-text); color: var(--t); background: var(--t-soft); padding: 4px 8px; border-radius: 999px; }
.ptile-go { font: 800 .9rem/1 var(--font-fun); color: #fff; background: var(--t); padding: 7px 12px 6px; border-radius: 999px; box-shadow: 0 2px 0 color-mix(in srgb, var(--t) 70%, #000); }
.ptile-grades { justify-content: flex-start; }
.ptile-grades { gap: 4px; }
.ptile-grades .chip { padding: 3px 8px; font-size: .78rem; }
.ptile-grades .chip:hover { border-color: var(--t); background: var(--t-soft); }
.play-about { padding: 16px 20px; }
.play-about p { margin: 0 0 6px; }
.play-about p:last-child { margin: 0; font-size: .9rem; }

/* Hình minh hoạ: khối chữ, thẻ nối, so sánh, phép nhân, thẻ lật. Rê chuột vào ô thì nhún nhẹ. */
.ptile-art > div { flex: none; transition: transform .25s; }
a.ptile:hover .ptile-art > div, .ptile-art:hover > div { transform: scale(1.06); }
.art-blocks { display: flex; gap: 6px; }
.art-blocks span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; color: #fff; font: 800 1.7rem/1 var(--font-fun);
    box-shadow: 0 4px 0 rgba(0, 0, 0, .18); }
.art-blocks .b1 { background: #ef5a4c; transform: rotate(-8deg) translateY(4px); }
.art-blocks .b2 { background: #ffc83d; color: #6b4a00; transform: rotate(5deg) translateY(-6px); }
.art-blocks .b3 { background: #3d7bf2; transform: rotate(-3deg) translateY(2px); }
.art-blocks .b4 { background: #14a06c; transform: rotate(7deg) translateY(-3px); }
.art-match { display: flex; align-items: center; }
.art-card { display: grid; place-items: center; min-width: 64px; height: 56px; padding: 0 12px; background: #fff; border-radius: 14px;
    font: 700 1.35rem/1 var(--font-text); box-shadow: 0 3px 0 #e3e6ef, var(--shadow-sm); }
.art-card:first-child { transform: rotate(-5deg); }
.art-card.pic { font-size: 2rem; transform: rotate(5deg); }
.art-link { width: 34px; border-top: 3px dashed var(--t); margin: 0 4px; }
.art-compare { display: flex; align-items: center; gap: 8px; }
.art-group { font-size: 1.3rem; letter-spacing: -2px; white-space: nowrap; line-height: 1.15; background: #fff; padding: 6px 8px; border-radius: 14px; box-shadow: var(--shadow-sm); }
.art-sign { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--t); color: #fff; font: 800 1.6rem/1 var(--font-fun);
    box-shadow: 0 3px 0 color-mix(in srgb, var(--t) 70%, #000); }
.art-quiz { display: grid; justify-items: center; gap: 8px; }
.art-expr { background: #fff; padding: 8px 16px; border-radius: 14px; font: 800 1.45rem/1 var(--font-fun); box-shadow: 0 3px 0 #e3e6ef; }
.art-opts { display: flex; gap: 6px; }
.art-opts i { font: 800 1rem/1 var(--font-fun); font-style: normal; background: #fff; border-radius: 10px; padding: 7px 10px; box-shadow: 0 2px 0 #e3e6ef; }
.art-opts i.ok { background: var(--mint); color: #fff; box-shadow: 0 2px 0 #0b7a51; transform: translateY(-3px) scale(1.08); }
.art-flip { position: relative; width: 150px; height: 84px; }
.art-flip span { position: absolute; inset: 0; border-radius: 14px; display: grid; place-items: center; text-align: center; }
.art-flip-back { background: var(--t); transform: rotate(-9deg) translate(-10px, 4px); font-size: 1.8rem; box-shadow: 0 3px 0 color-mix(in srgb, var(--t) 70%, #000); }
.art-flip-front { background: #fff; transform: rotate(4deg); padding: 8px 12px; font: 700 .88rem/1.3 var(--font-text); box-shadow: var(--shadow); }
@media (max-width: 560px) {
    .ptiles { grid-template-columns: 1fr 1fr; gap: 10px; }
    .ptile { border-radius: 16px; }
    .ptile-art { height: 100px; }
    .ptile-art > div { transform: scale(.72); }
    a.ptile:hover .ptile-art > div { transform: scale(.76); }
    .ptile-body { padding: 10px 11px 12px; }
    .ptile-body h2 { font-size: 1rem; }
    .ptile-body small { font-size: .8rem; line-height: 1.3; }
    .ptile-foot { margin-top: 6px; }
    .ptile-go { display: none; }
    .ptile-grade { font-size: .68rem; }
}
@media (prefers-reduced-motion: reduce) { .ptile, .ptile-art > div { transition: none; } }

/* ───── Thư viện: mẹo nhớ và nhấn nhá màu ───── */
.ref-tips { background: linear-gradient(160deg, #fffaf0, #fff 60%); border: 1.5px solid #f6dfae; }
.ref-tips h2 { margin: 0 0 4px; }
.ref-tips h2 small { margin-left: 6px; padding: 2px 10px; border-radius: 99px; background: var(--brand-soft); color: #8a6100; font: 700 .78rem var(--font-text); vertical-align: 3px; }
.ref-tips > .muted { margin: 0 0 14px; }
.tip-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.tip-card { --c: #e09a00; --c-soft: #fff6dd; padding: 13px 15px; background: var(--c-soft); border-left: 5px solid var(--c); border-radius: 14px; }
.tip-card:nth-child(4n+2) { --c: #3d7bf2; --c-soft: #eef4ff; }
.tip-card:nth-child(4n+3) { --c: #17a673; --c-soft: #e8f8f0; }
.tip-card:nth-child(4n+4) { --c: #d6519b; --c-soft: #fdeff6; }
.tip-card h3 { margin: 0 0 5px; font: 700 1.04rem/1.35 var(--font-fun); color: color-mix(in srgb, var(--c) 55%, var(--ink)); }
.tip-card p { margin: 0; line-height: 1.5; font-size: .95rem; }
.tip-ex { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.tip-ex span { padding: 4px 10px; font-size: .88rem; font-weight: 600; line-height: 1.4; background: #fff; border-radius: 9px; }
.tip-more { margin-top: 12px; }
.tip-more summary { display: inline-block; padding: 8px 16px; font-weight: 700; cursor: pointer; list-style: none; background: var(--brand-soft); border-radius: 99px; }
.tip-more summary::-webkit-details-marker { display: none; }
.tip-more summary::before { content: "＋ "; }
.tip-more[open] summary::before { content: "－ "; }
.tip-more[open] summary { margin-bottom: 12px; }
.sec-hint { margin: 0 0 12px; padding: 8px 12px; font-size: .94rem; line-height: 1.45; background: #fff6dd; border-radius: 10px; }

/* Tiêu đề mỗi phần có dải nền nhẹ sát mép thẻ, mỗi phần một màu: kéo xuống vẫn thấy rõ đang ở đâu. */
.ref-group, .lib-note, .lib-steps, .lib-worked, .lib-wrong, .lib-try { --h: #3d7bf2; --h-soft: #eaf1ff; }
.ref-group > h2, .lib-note > h2, .lib-steps > h2, .lib-worked > h2, .lib-wrong > h2 { margin: -24px -24px 16px; padding: 12px 24px; border-radius: var(--radius) var(--radius) 0 0; background: var(--h-soft); color: color-mix(in srgb, var(--h) 45%, var(--ink)); font-size: 1.22rem; border-bottom: 2px solid color-mix(in srgb, var(--h) 28%, transparent); }
.lib-try > .lib-row { margin: -24px -24px 14px; padding: 12px 24px; border-radius: var(--radius) var(--radius) 0 0; background: var(--h-soft); border-bottom: 2px solid color-mix(in srgb, var(--h) 28%, transparent); }
.lib-try > .lib-row h2 { font-size: 1.22rem; color: color-mix(in srgb, var(--h) 45%, var(--ink)); }
.lib-note { --h: #17a673; --h-soft: #e3f7ed; }
.lib-steps { --h: #3d7bf2; --h-soft: #e7efff; }
.lib-worked { --h: #7c5ce6; --h-soft: #ece6ff; }
.lib-wrong { --h: #ef5a4c; --h-soft: #fdeae7; }
.lib-try { --h: #0ea5a4; --h-soft: #dff5f4; }
.ref-group:nth-of-type(5n+1) { --h: #3d7bf2; --h-soft: #e7efff; }
.ref-group:nth-of-type(5n+2) { --h: #17a673; --h-soft: #e3f7ed; }
.ref-group:nth-of-type(5n+3) { --h: #e58a12; --h-soft: #fff0dc; }
.ref-group:nth-of-type(5n+4) { --h: #7c5ce6; --h-soft: #ece6ff; }
.ref-group:nth-of-type(5n+5) { --h: #d6519b; --h-soft: #fde8f2; }
.ref-group .ref-row, .ref-group .ref-fact, .ref-group .lib-word { background: color-mix(in srgb, var(--h-soft) 45%, #fff); }
.ref-group .ref-row { border-left: 4px solid color-mix(in srgb, var(--h) 45%, transparent); }
.ref-group .ref-row > b { color: color-mix(in srgb, var(--h) 40%, var(--ink)); }
.ref-group .ref-fact b { color: color-mix(in srgb, var(--h) 80%, #000); }
.ref-group .ref-table th { background: var(--h-soft); }
.ref-group .ref-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--h-soft) 35%, #fff); }
.ref-group .formula-block h3 { color: color-mix(in srgb, var(--h) 50%, var(--ink)); }

/* Ghi nhớ: mỗi ý một màu nền rất nhạt; cách làm và bài mẫu đọc theo từng bước. */
.lib-remember li { background: #eefaf4; }
.lib-remember li:nth-child(3n+2) { background: #fff7e3; }
.lib-remember li:nth-child(3n+3) { background: #eef4ff; }
.lib-steps li, .lib-worked-steps li { padding-bottom: 10px; border-bottom: 1px dashed #e3e8f3; }
.lib-steps li:last-child, .lib-worked-steps li:last-child { padding-bottom: 0; border-bottom: 0; }
.lib-idea .lib-kw, .lib-note .lib-kw, .lib-steps .lib-kw, .lib-worked .lib-kw, .lib-wrong .lib-kw, .lib-tip .lib-kw { color: #1c4fb5; }
.lib-idea mark, .lib-note mark, .lib-steps mark, .lib-worked mark, .lib-tip mark { padding: 0 3px; color: inherit; background: #fff0bf; border-radius: 5px; }
.lib-wrong mark { padding: 0; color: inherit; background: none; font-weight: 600; }
.lib-note .lib-formulas span { background: #fff6dd; }
@media (max-width: 520px) {
    .tip-grid { grid-template-columns: 1fr; }
    .ref-group > h2, .lib-note > h2, .lib-steps > h2, .lib-worked > h2, .lib-wrong > h2, .lib-try > .lib-row { margin: -18px -18px 14px; padding: 10px 18px; }
}
@media print { .ref-group > h2 { margin: 0 0 8px; padding: 6px 10px; } .ref-tips, .sec-hint { break-inside: avoid; } .tip-more > *:not(summary) { display: block; } }
.prompt-vi { margin: -6px 0 12px; color: var(--ink-soft); font-size: .95rem; }

/* ───── Thẻ khoe thành tích ───── */
.card-dialog { width: min(760px, calc(100vw - 24px)); text-align: left; }
.card-dialog h2 { padding-right: 44px; }
.card-cols { display: grid; grid-template-columns: 340px 1fr; gap: 22px; margin-top: 12px; clear: both; }
.card-preview { display: grid; place-items: center; aspect-ratio: 4 / 5; overflow: hidden; background: var(--fill); border-radius: 16px; }
.card-preview img { display: block; width: 100%; height: auto; }
.card-preview img[hidden] { display: none; }
.card-label { margin: 0 0 8px; font-weight: 700; }
.card-picks { display: flex; flex-wrap: wrap; gap: 8px; max-height: 190px; overflow: auto; margin-bottom: 14px; padding: 2px; }
.card-picks button { padding: 8px 13px; font: 600 .9rem/1.25 var(--font-text); color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 99px; cursor: pointer; }
.card-picks button[aria-pressed=true] { background: var(--brand-soft); border-color: var(--brand-deep); }
.card-name { display: flex; gap: 10px; align-items: center; margin: 0 0 12px; font-weight: 500; cursor: pointer; }
.card-name input { width: 20px; height: 20px; flex: none; }
.card-note { margin: 0 0 14px; padding: 10px 13px; font-size: .92rem; line-height: 1.5; background: #eef6ff; border-radius: 12px; }
.card-actions { display: grid; gap: 8px; }
.card-hold { display: none; margin: 8px 0 0; }
@media (pointer: coarse) { .card-hold { display: block; } }
.brag { display: flex; align-items: center; gap: 12px; margin: 14px auto; padding: 12px 16px; max-width: 520px; text-align: left; background: var(--brand-soft); border: 1.5px solid #f5dfa6; border-radius: 16px; }
.brag > span { font-size: 1.9rem; line-height: 1; }
.brag > div { flex: 1; min-width: 0; }
.brag b { display: block; font: 700 1.05rem/1.3 var(--font-fun); }
.brag small { color: var(--ink-soft); }
.ach-hero .ach-card { margin-left: auto; flex: none; white-space: nowrap; }
@media (max-width: 640px) {
    .card-cols { grid-template-columns: 1fr; gap: 14px; }
    .card-preview { max-width: 250px; width: 100%; margin: 0 auto; }
    .card-picks { max-height: 96px; }
    .brag { flex-wrap: wrap; }
    .brag .btn { width: 100%; }
    /* Điện thoại: ảnh đại diện cạnh tên, phần còn lại (lớp, cấp độ, cách tính) dàn hết bề ngang thay vì dồn vào cột hẹp. */
    .ach-hero { flex-wrap: wrap; row-gap: 8px; }
    .ach-hero > div { display: contents; }
    .ach-hero h1 { flex: 1 1 0; min-width: 0; align-self: center; }
    .ach-hero > div > :not(h1) { flex-basis: 100%; }
    .ach-hero .ach-card { width: 100%; margin-left: 0; }
}

/* ───── Thẻ báo sắp hết / vừa hết Premium ───── */
.premium-end { position: relative; border: 1.5px solid #f1d48a; background: linear-gradient(120deg, #fffdf6, #fff7e0); }
.premium-end h2 { margin: 2px 0 8px; padding-right: 34px; }
.premium-end p { margin: 8px 0; }
.pe-tag { margin: 0 34px 0 0 !important; font-size: .86rem; font-weight: 600; color: #7a5600; }
.pe-x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .8); color: var(--ink); cursor: pointer; }
.pe-x:hover { background: #fff; }
.pe-stats { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 0; padding: 0; max-width: 560px; }
.pe-skills { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: .95rem; }
/* Con vững gì, nên luyện thêm gì (trang kết quả) */
.skills h2 { margin-bottom: 2px; }
.skills > .muted { margin: 0 0 10px; font-size: .9rem; }
.skill-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.skill-col { border-radius: 14px; padding: 12px 16px; margin: 0; }
.good-col { background: var(--mint-soft); }
.more-col { background: var(--brand-soft); }
.skill-col h3 { margin: 0 0 4px; font-size: 1rem; }
.skill-col ul { list-style: none; margin: 0; padding: 0; }
.skill-col li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; font-size: .95rem; line-height: 1.4; }
.skill-col li small { flex: none; color: var(--ink-soft); white-space: nowrap; }
.skill-col li.skill-more { justify-content: flex-start; gap: 8px; }
.skill-none { display: flex; align-items: center; font-weight: 600; }
.pe-stats li { display: grid; justify-items: center; padding: 8px 6px; border-radius: 14px; background: #fff; }
.pe-stats b { font: 800 1.5rem/1.2 var(--font-fun); color: #b45309; }
.pe-stats span { font-size: .82rem; color: var(--ink-soft); text-align: center; }

/* ───── Hôm nay học gì (trang chủ) ───── */
.today-plan { margin: 4px 0 14px; padding: 14px 16px; border: 2px solid #ffd66b; border-radius: 18px; background: linear-gradient(120deg, #fffaf0, #fff6dc); }
.today-plan.all-done { border-color: #8fd9b6; background: linear-gradient(120deg, #f2fcf6, #e3f7ec); }
.tp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tp-head h3 { margin: 0; font: 800 1.15rem/1.3 var(--font-fun); }
.tp-count { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: .88rem; color: var(--ink-soft); white-space: nowrap; }
.tp-count i { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #e6c766; }
.tp-count i.on { background: #17a673; border-color: #17a673; }
.tp-praise { margin: 6px 0 0; }
.tp-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.tp-steps li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); }
.tp-steps li.lead { border-color: #ffb400; box-shadow: 0 3px 12px rgba(233, 164, 0, .16); }
.tp-steps li.done { background: transparent; border-style: dashed; color: var(--ink-soft); }
.tp-ico { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; background: #fff4d1; }
.tp-steps li.done .tp-ico { background: #17a673; color: #fff; font-weight: 800; }
.tp-txt { display: grid; min-width: 0; flex: 1; line-height: 1.35; }
.tp-txt small { color: var(--ink-soft); }
.tp-steps form { margin: 0; flex: none; }
.tp-resume { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 8px 12px; border-radius: 14px; background: #fff; border: 1.5px solid #ffb400; color: var(--ink); text-decoration: none; }
@media (max-width: 560px) {
    .today-plan { padding: 12px; margin-left: -6px; margin-right: -6px; }
    .tp-steps li { gap: 10px; padding: 8px 10px; }
    .tp-ico { width: 34px; height: 34px; font-size: 1.1rem; }
    .tp-txt b { font-size: .95rem; }
    .tp-txt small { font-size: .8rem; }
    .tp-steps .btn, .tp-resume .btn { padding-left: 12px; padding-right: 12px; }
    .premium-end { padding: 14px; }
    .premium-end h2 { font-size: 1.15rem; }
    .premium-end p { font-size: .92rem; line-height: 1.45; }
    .premium-end .actions { flex-direction: row; flex-wrap: nowrap; gap: 8px; }
    .premium-end .actions .btn { padding: 8px 10px; font-size: .86rem; width: auto; }
    .pe-stats { grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: 6px; }
    .pe-stats li { padding: 5px 4px; }
    .pe-stats span { font-size: .74rem; line-height: 1.25; }
    .pe-stats b { font-size: 1.25rem; }
}

/* ───── Quản trị: giữ chân ───── */
.table-scroll { overflow-x: auto; }
.rt-table { width: 100%; min-width: 640px; }
.rt-table td, .rt-table th { padding: 7px 10px; white-space: nowrap; }
.rt-table .num { text-align: right; }
.rt-total td { background: #fff8e1; }
.rt { display: inline-block; min-width: 46px; padding: 1px 8px; border-radius: 999px; text-align: center; background: var(--fill); }
.rt.ok { background: #dcf5e8; color: #0e6b4a; }
.rt.mid { background: #fff1c2; color: #7a5600; }
.rt.low { background: var(--coral-soft); color: #b8382c; }

/* ───── Ưu đãi riêng (gần hết dùng thử) ───── */
.deal-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 10px 14px; border-radius: 16px; background: linear-gradient(100deg, #fff0f3, #fff6dd); border: 1.5px solid #f7a8b8; color: var(--ink); text-decoration: none; }
.deal-bar:hover { color: var(--ink); box-shadow: var(--shadow-sm); }
.deal-off { flex: none; padding: 6px 10px; border-radius: 12px; background: #d6336c; color: #fff; font: 800 1.1rem/1 var(--font-fun); }
.deal-txt { display: grid; min-width: 0; flex: 1; line-height: 1.4; }
.deal-txt small { color: #6b3a4a; }
.deal-bar .btn { flex: none; }
.deal-tag { margin: 0; font-size: .9rem; color: #8a2346; }
.deal-dialog { width: min(460px, calc(100vw - 24px)); }
.deal-dialog .deal-tag { padding-right: 38px; }
.deal-dialog h2 { margin: 6px 0 10px; font: 800 1.4rem/1.3 var(--font-fun); }
.deal-prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.deal-prices div { display: grid; justify-items: center; padding: 10px; border-radius: 14px; background: #fff0f3; }
.deal-prices span { font-size: .88rem; color: var(--ink-soft); }
.deal-prices s, .price-old { color: #9aa1b5; font-size: .9rem; }
.deal-prices b { font: 800 1.3rem/1.3 var(--font-fun); color: #c2255c; }
.deal-now { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.deal-now > span { padding: 5px 12px; border-radius: 999px; background: #fff4d1; font-size: .92rem; font-variant-numeric: tabular-nums; }
.deal-terms { text-align: left; list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; font-size: .92rem; line-height: 1.45; }
.deal-actions { display: flex; gap: 10px; }
.deal-actions .btn.primary { flex: 1; text-align: center; }
.deal-free { margin: 10px 0 0; text-align: center; }
.deal-box { margin: 0 0 14px; padding: 12px 14px; border-radius: 16px; background: #fff7f9; border: 1.5px solid #f7a8b8; }
.deal-box .deal-terms { margin: 0; }
.deal-box .deal-now { justify-content: flex-start; }
.pay-hold { margin-left: 8px; padding: 2px 10px; border-radius: 999px; background: #dcf5e8; color: #0e6b4a; font-weight: 600; font-size: .86rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.deal-box.held { background: #f2fcf6; border-color: #8fd9b6; }
.deal-box.held p { margin: 0; }
.deal-box.held .deal-now { margin: 0 0 6px; }
.deal-box.held .deal-now > span { background: #dcf5e8; }
@media (max-width: 560px) {
    .deal-bar { padding: 9px 10px; gap: 9px; }
    .deal-off { font-size: .95rem; padding: 5px 8px; }
    .deal-txt b { font-size: .92rem; }
    .deal-txt small { font-size: .8rem; }
    .deal-txt small b { font-size: inherit; }
    .deal-bar .btn { padding-left: 10px; padding-right: 10px; }
}

/* ───── Email phụ huynh ───── */
.mail-page { max-width: 620px; margin: 0 auto; }
.mail-page h1 { margin-top: 8px; }
.actions.center { justify-content: center; }
.mail-kinds { display: grid; gap: 0; margin: 10px 0 16px; border-top: 1px solid var(--line); }
.mail-kinds label.switch { display: flex; align-items: center; gap: 14px; margin: 0; padding: 10px 2px; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
.mail-kinds label.switch b { display: inline; }
.mail-kinds label.locked { opacity: .55; cursor: default; }
.mail-kinds label.switch small { display: block; color: var(--ink-soft); font-size: .86rem; }
.mail-ask { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 10px 14px; border-radius: 16px; background: #eef4ff; border: 1.5px solid #bcd2fb; }
.mail-ask p { margin: 0; flex: 1; min-width: 0; line-height: 1.4; }
.mail-ask small { display: block; color: var(--ink-soft); }
.mail-sample { border-top: 1px solid var(--line); padding: 10px 0; }
.mail-sample summary { cursor: pointer; }
.mail-sample iframe { width: 100%; height: 760px; margin-top: 10px; border: 1px solid var(--line); border-radius: 14px; background: #f6f7fb; }
@media (max-width: 560px) { .mail-ask { flex-wrap: wrap; } .mail-ask p { flex-basis: calc(100% - 44px); } }

/* ───── Thông báo tắt được, góp ý nhanh ───── */
.bar-x { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .7); color: var(--ink-soft); font-size: .95rem; cursor: pointer; }
.bar-x:hover { background: #fff; color: var(--ink); }
.notice-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; }
.notice-bar > a, .notice-text { flex: 1; min-width: 0; color: var(--ink); text-decoration: none; }
.my-notice { background: #fff4d6; border: 1.5px solid #f2c94c; }
.my-notice .notice-text a { color: var(--ink); }
.notice-bar > a:hover { text-decoration: underline; }
.notice-bar > a b { white-space: nowrap; color: var(--link); }
.fb-ask { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 8px 10px 8px 14px; border-radius: 16px; background: #f3efff; border: 1.5px solid #d3c5f8; }
.fb-ask-link { flex: 1; min-width: 0; color: var(--ink); text-decoration: none; line-height: 1.35; }
.fb-ask-link:hover { color: var(--ink); }
.fb-ask-link small { display: block; color: #5b3db0; }
.fb-ask form { margin: 0; }
.fb-dialog { width: min(480px, calc(100vw - 24px)); text-align: left; }
.fb-dialog h2 { padding-right: 40px; margin-bottom: 12px; }
.fb-form { display: grid; gap: 14px; }
.fb-form input[type=radio], .fb-form input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fb-who { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fb-who span, .fb-tags span { display: block; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; text-align: center; font-weight: 600; cursor: pointer; background: #fff; }
.fb-faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.fb-faces span { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; border: 2px solid transparent; border-radius: 14px; font-size: .78rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; text-align: center; line-height: 1.2; }
.fb-faces i { font-style: normal; font-size: 2rem; line-height: 1.2; transition: transform .12s; }
.fb-faces span:hover i { transform: scale(1.12); }
.fb-faces input:checked + span { border-color: var(--brand-deep); background: var(--brand-soft); color: var(--ink); }
.fb-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.fb-tags span { padding: 6px 12px; border-radius: 999px; font-size: .88rem; }
.fb-who input:checked + span, .fb-tags input:checked + span { border-color: var(--brand-deep); background: var(--brand-soft); }
.fb-form input:focus-visible + span { outline: 3px solid var(--focus); }
.fb-form .small { margin: -6px 0 0; text-align: center; }
.fb-list { list-style: none; margin: 12px 0 0; padding: 0; }
.fb-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 8px; border-top: 1px solid var(--line); }
.fb-list li > div { flex: 1; min-width: 0; }
.fb-list li.new { background: #fffaf0; }
.fb-list p { margin: 0; }
.fb-text { margin-top: 4px !important; white-space: pre-line; overflow-wrap: anywhere; }
.fb-score { font-size: 1.6rem; line-height: 1.2; }

/* ───── Thời hạn link ưu đãi, thư mời ───── */
.gift-until { display: inline-block; margin-top: 2px; }
.ref-until { display: block; color: var(--ink-soft); font-size: .8rem; }
.ref-share { display: grid; gap: 8px; justify-items: start; margin: 8px 0; }
.ref-share textarea { width: 100%; }
.ref-act input[type=date] { width: auto; min-width: 0; padding: 4px 8px; height: 36px; }
.ref-act form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 2px 0; }
/* Bảng ưu đãi theo link: 3 cột (mã trên, link dưới · ưu đãi · thao tác), không tràn khung. */
.ref-gifts { width: 100%; }
.ref-gifts td { vertical-align: middle; }
.ref-gifts .ref-code { width: 99%; white-space: normal; min-width: 13rem; }
.ref-gifts .ref-code code { display: inline-block; font-weight: 700; overflow-wrap: anywhere; }
.ref-gifts .ref-copy-cell { margin-top: 4px; }
.ref-gifts .ref-copy-cell .ref-link { flex: 1 1 0; width: 8rem; padding: 4px 8px; font-size: .8rem; color: var(--ink-soft); text-overflow: ellipsis; }
.ref-gifts .btn.small { white-space: nowrap; padding-inline: 10px; }
.ref-gifts .ref-state { white-space: nowrap; }
.ref-gifts .ref-state b, .ref-gifts .ref-state span { display: block; font-size: .88rem; line-height: 1.45; }
.ref-gifts .ref-act { white-space: nowrap; }
.ref-gifts .ref-act input[type=date] { width: 8.4rem; font-size: .85rem; }
@media (max-width: 900px) and (min-width: 641px) {
  .ref-gifts .ref-act form.inline { display: flex; margin: 4px 0; }
}
@media (max-width: 640px) {
  .ref-gifts td { border: 0; padding: 0; min-width: 0; }
  .ref-gifts .ref-code { min-width: 0; width: auto; }
  .ref-gifts .ref-state { grid-column: 1 / -1; white-space: normal; display: flex !important; flex-wrap: wrap; gap: 0 10px; align-items: baseline; }
  .ref-gifts td.ref-act { display: flex !important; gap: 6px; }
  .ref-gifts td.ref-act form { flex: none; }
  .ref-gifts td.ref-act form:first-child { flex: 1; min-width: 0; }
  .ref-gifts td.ref-act form:first-child input { flex: 1; width: 0; }
  .ref-gifts td.ref-act form + form { margin-left: 0; }
  .ref-gifts td.ref-act .btn { width: auto; }
}

/* Mục lục bài học của một lớp trong thư viện */
.lib-index { margin-top: 18px; }
.lib-index h2 { margin: 0 0 8px; font-size: 1.1rem; }
.lib-index ul { margin: 8px 0 0; padding-left: 20px; columns: 2; column-gap: 28px; }
.lib-index li { margin: 4px 0; break-inside: avoid; line-height: 1.45; }
@media (max-width: 640px) { .lib-index ul { columns: 1; } }

/* Quản trị · xem lại bài làm: bảng số câu để nhảy nhanh */
.q-jump { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 16px; }
.q-jump a { min-width: 34px; padding: 4px 6px; border-radius: 8px; text-align: center; font-size: .82rem; font-weight: 700; text-decoration: none; }
.q-jump a.right { background: #e3f7ed; color: #0f6b49; }
.q-jump a.wrong { background: #fde4e1; color: #b3261e; }
.q-jump a.empty { background: #eceff6; color: #5a6482; }
body.admin .review { scroll-margin-top: 80px; }
.history-icon.theme- { background: var(--fill); }

/* ───── Khách đang xem (quản trị) ───── */
.guest-h { margin: 16px 0 6px; font-size: 1rem; }
.guest-list { list-style: none; margin: 0; padding: 0; }
.guest-list li { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; padding: 7px 4px; border-top: 1px solid var(--line); font-size: .92rem; }
.guest-src { font-weight: 700; min-width: 104px; }
.guest-page { flex: 1; min-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Món đồ, huy hiệu mới chưa xem */
.new-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; padding: 9px 14px; border-radius: 16px; background: #E1F6EC; border: 1.5px solid #17A673; color: #0E5C3C; }
.new-bar p { margin: 0; flex: 1; min-width: 150px; line-height: 1.35; }
.new-dot { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; margin-left: 6px; border-radius: 999px; font: 700 .75rem/1 var(--font-text); color: #fff; background: #d63b30; }
.new-tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font: 700 .74rem/1.6 var(--font-text); color: #fff; background: #d63b30; }
.closet-item.is-new, .badge.is-new { position: relative; }
.closet-item.is-new > .new-tag, .badge.is-new > .new-tag { position: absolute; top: -8px; right: -4px; z-index: 1; pointer-events: none; }
.closet-item.is-new button { border-color: #17A673; }
.btn .new-dot { margin-left: 2px; }
.new-jump { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#huy-hieu, [id^="nhom-"] { scroll-margin-top: 80px; }

/* Đăng ký, đăng nhập: hiện mật khẩu, ô không bắt buộc */
.pass-row { position: relative; display: block; }
.pass-row input { width: 100%; padding-right: 70px; }
.auth .pass-show { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 8px 12px; border: 0; background: none; color: var(--link); font: 700 .88rem/1 var(--font-text); cursor: pointer; }
.more-field summary { cursor: pointer; color: var(--link); font-weight: 600; font-size: .92rem; }
.more-field label { margin-top: 8px; }

/* Trang kết quả: mời thử mức khó hơn */
.harder { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 520px; margin: 16px auto 0; padding: 12px 16px; text-align: left; border-radius: 16px; background: #fff1e6; border: 1.5px solid #f0a35e; }
.harder > span { font-size: 1.8rem; line-height: 1; }
.harder > div:not(.harder-go) { flex: 1; min-width: 180px; }
.harder-go { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.harder small { display: block; color: var(--ink-soft); line-height: 1.4; }

/* Nhắc giờ học, hẹn ngày mai, ngày thi vào lịch */
.tp-next { margin: 0 0 10px; }
.remind { margin: -4px 0 16px; padding: 0 4px; }
.remind summary { cursor: pointer; padding: 6px 0; color: var(--link); font: 600 .92rem/1.4 var(--font-text); }
.remind > p { margin: 4px 0 10px; font-size: .9rem; }
.remind-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.remind-row label { display: grid; gap: 4px; font-size: .88rem; min-width: 140px; }
.remind [hidden] { display: none; }
.round-cal { font: 600 .8rem/1.3 var(--font-text); }

/* Bước thêm học sinh */
.one-step { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; padding: 14px 16px; border-radius: 16px; background: #fff; border: 2px solid var(--brand); }
.one-step p { margin: 0; flex: 1; min-width: 200px; }
.grade-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 0; padding: 0; border: 0; }
.grade-pick legend { margin-bottom: 6px; font-size: .92rem; }
.grade-pick label { position: relative; display: block; }
.grade-pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.grade-pick span { display: grid; place-items: center; height: 54px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font: 800 1.4rem/1 var(--font-fun); }
.grade-pick input:checked + span { border-color: var(--brand-deep); background: var(--brand-soft); }
.grade-pick input:focus-visible + span { outline: 3px solid var(--link); outline-offset: 2px; }

/* Mời bạn ở trang hết lượt */
.invite-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.invite-card > span { font-size: 1.8rem; line-height: 1; }
.invite-card div { flex: 1; min-width: 200px; }
.invite-card small { display: block; color: var(--ink-soft); line-height: 1.45; }

/* Nhắc tìm thư xác nhận trong Thư rác */
.mail-check:not([hidden]) { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 16px; padding: 12px 14px; border-radius: 16px; background: #eef4ff; border: 1.5px solid #bcd2fb; }
.mail-check > span { font-size: 1.5rem; line-height: 1.2; }
.mail-check > div { flex: 1; min-width: 0; }
.mail-check b { overflow-wrap: anywhere; }
.mail-check ol { margin: 6px 0 10px; padding-left: 20px; line-height: 1.45; font-size: .92rem; }
.mail-check .actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.mail-check form { margin: 0; }

/* Cấp độ hành trình */
.journey { display: flex; align-items: center; gap: 8px; margin: 4px 0 2px; }
.journey-ico { font-size: 1.5rem; line-height: 1; }
.journey-txt { display: grid; gap: 2px; min-width: 150px; }
.journey-txt b { font: 700 .9rem/1.2 var(--font-text); color: var(--ink); }
.journey-txt small { font-size: .78rem; color: var(--ink-soft); }
.journey-bar { display: block; width: 100%; max-width: 220px; height: 6px; border-radius: 999px; background: rgba(0, 0, 0, .08); overflow: hidden; }
.journey-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7ccf6b, #2e9d5b); }
a.journey-link { display: inline-block; text-decoration: none; color: inherit; }
a.journey-link:hover b { text-decoration: underline; }
.journey-how { margin-top: 8px; font-size: .9rem; }
.journey-how summary { cursor: pointer; color: var(--link); font-weight: 600; }
.journey-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 6px 14px; padding-left: 0; list-style: none; margin: 10px 0; }
/* Mỗi cấp một dòng: biểu tượng, tên, số điểm; không xuống dòng giữa tên và số. */
.journey-steps li { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; opacity: .55; }
.journey-steps li small { font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
    /* Điện thoại: hai cột, số điểm xuống dòng riêng ngay dưới tên. */
    .journey-steps { grid-template-columns: 1fr 1fr; gap: 8px 10px; }
    .journey-steps li { flex-wrap: wrap; white-space: normal; row-gap: 0; }
    .journey-steps li small { flex-basis: 100%; margin-left: 0; padding-left: 1.7em; }
}
.journey-steps li.on { opacity: 1; font-weight: 700; }
.journey-steps small { color: var(--ink-soft); font-weight: 400; }
.level-up { display: flex; align-items: center; gap: 12px; max-width: 520px; margin: 16px auto 0; padding: 12px 16px; text-align: left; border-radius: 16px; background: #e9f8ee; border: 1.5px solid #2e9d5b; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.level-up > span { font-size: 2rem; line-height: 1; }
.level-up small { display: block; color: var(--ink-soft); }
.kid-head h2 + .kid-title, .kid-head .kid-title + a.journey-link { display: table; }
a.journey-link { display: table; }
.title-rare { border-color: transparent; }

/* Trang chủ: cấp độ hành trình thành khung riêng bên phải phần tên bé */
.kid-head > .kid-level { margin-left: auto; padding: 10px 16px; border-radius: 16px; background: rgba(255, 255, 255, .75); border: 1.5px solid color-mix(in srgb, var(--k, var(--brand)) 35%, #fff); }
.kid-level .journey { margin: 0; gap: 12px; }
.kid-level .journey-ico { font-size: 2.2rem; }
.kid-level .journey-txt { min-width: 200px; gap: 4px; }
.kid-level .journey-txt b { font-size: 1rem; }
.kid-level .journey-bar { max-width: 240px; height: 8px; }
.kid-head > .kid-level + .kid-tools { flex-basis: 100%; justify-content: flex-end; }
@media (max-width: 640px) {
    .kid-head > .kid-level { margin-left: 0; width: 100%; }
    .kid-head > .kid-level + .kid-tools { justify-content: flex-start; }
}

/* ───── Quản trị: văn phòng ảo 3D ───── */
.office-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.office-head h1 { margin: 0; }
.office-head p { margin: 4px 0 12px; }
.o-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.o-dot.ok, .o-light.ok { background: #2fbf71; } .o-dot.warn, .o-light.warn { background: #f5b301; } .o-dot.alert, .o-light.alert { background: #ef4c3c; }
.office-title { margin: 0 0 12px; }
.office-at { position: absolute; top: 12px; right: 14px; z-index: 2; margin: 0; padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .9);
    box-shadow: 0 4px 14px rgba(20, 27, 58, .12); font-size: .8rem; color: var(--ink-soft); pointer-events: none; }
.office-at:empty { display: none; }
.office.flat .office-at { position: static; display: inline-block; margin-bottom: 10px; }
.office { position: relative; }
.office-stage { position: relative; isolation: isolate; /* gói z-index nhãn phòng, nút (tới 2100) bên trong sân khấu: menu trái đè lên được */ height: min(74vh, 760px); min-height: 460px; border-radius: 22px; overflow: hidden;
    background: radial-gradient(120% 90% at 50% 0%, #fdf8f0 0%, #f3e9dc 55%, #e8dccd 100%); box-shadow: var(--shadow); touch-action: none; }
.office-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.office-labels { position: absolute; inset: 0; pointer-events: none; }
.o-label { position: absolute; left: 0; top: 0; pointer-events: auto; display: flex; align-items: center; gap: 8px; max-width: 250px; padding: 7px 12px 7px 9px;
    border: 0; border-radius: 14px; background: rgba(255, 255, 255, .94); box-shadow: 0 6px 18px rgba(20, 27, 58, .16); font: inherit; color: var(--ink); cursor: pointer; text-align: left;
    transition: box-shadow .15s, background .15s; will-change: transform; }
.o-label:hover, .o-label.hover, .o-label:focus-visible { background: #fff; box-shadow: 0 10px 26px rgba(20, 27, 58, .26); outline: none; }
.o-label[data-status="alert"] { box-shadow: 0 0 0 2px #ef4c3c, 0 6px 18px rgba(239, 76, 60, .25); }
.o-label.empty { display: none !important; }
.o-label .o-tag-txt { font: 600 .7rem/1 var(--font-text); color: var(--ink-soft); }
.o-light { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.o-label[data-status="alert"] .o-light { animation: o-blink 1.1s ease-in-out infinite; }
@keyframes o-blink { 50% { opacity: .25; } }
.o-ico { font-size: 1.35rem; line-height: 1; }
.o-txt { display: grid; min-width: 0; }
.o-txt b { font: 700 .9rem/1.25 var(--font-text); white-space: nowrap; }
.o-txt small { font-size: .76rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-count { flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; font: 700 .78rem/1 var(--font-text); color: #fff; background: #8b93a7; }
.o-count.warn { background: #e0a100; } .o-count.alert { background: #ef4c3c; }
.office-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--ink-soft); }
.office-cards { display: none; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.office.flat .office-stage { display: none; }
.office.flat .office-cards { display: grid; }
.o-card { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1.5px solid #e3e8f2; border-radius: 16px; background: #fff; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.o-card.alert { border-color: #ef4c3c; } .o-card.warn { border-color: #f5c84d; }
.o-card .o-txt small { white-space: normal; }
.office-drawer .drawer-panel { width: min(520px, 100%); }
.o-people { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.o-people li { padding: 10px 12px; border: 1.5px solid #e3e8f2; border-radius: 12px; background: #fff; }
.o-people li > div { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.o-kid { display: inline-block; padding: 2px 9px; border-radius: 999px; background: #eef2fa; font-size: .8rem; }
.o-kid.doing { background: #fff3d1; }
/* Ghi chú trong phòng: nút nhỏ, mờ, không lấn số liệu. */
.o-notes { margin: 0 0 18px; }
.o-notes-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.o-notes-head h3 { margin: 0; font-size: .95rem; }
.o-notes ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.o-notes li { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.o-note-text { flex: 1; display: grid; gap: 2px; font-size: .9rem; }
.o-note-due { color: var(--ink-soft); font-size: .76rem; }
.o-note-due.warn { color: #9a6500; font-weight: 700; } .o-note-due.alert { color: #c8321f; font-weight: 700; }
.o-note-tools { display: flex; gap: 2px; opacity: .45; transition: opacity .15s; }
.o-notes li:hover .o-note-tools, .o-note-tools:focus-within { opacity: 1; }
.o-note-btn { border: 0; background: none; padding: 2px 6px; border-radius: 8px; font: inherit; font-size: .8rem; color: var(--ink-soft); cursor: pointer; }
.o-note-btn:hover, .o-note-btn:focus-visible { background: #eef2fa; color: var(--ink); }
.o-note-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; padding: 8px; border-radius: 12px; background: #f4f7fd; }
.o-note-form input[name="text"] { flex: 1 1 200px; }
.o-note-form input { padding: 6px 8px; border: 1.5px solid #dfe5f0; border-radius: 8px; font: inherit; font-size: .88rem; }
.o-note-err { flex-basis: 100%; color: #c8321f; }
.o-note-err:empty { display: none; }
.o-note-empty { font-size: .84rem; margin: 6px 0 0; }
/* Giữ chân: gửi thư hỏi thăm. */
.ci-cell { min-width: 170px; }
.ci-state { display: block; font-size: .8rem; color: var(--ink-soft); }
.ci-state.answered { color: #0e6b4a; font-weight: 700; } .ci-state.ready { color: var(--ink); }
.ci-send { margin-top: 4px; min-height: 32px; padding: 4px 10px; font-size: .82rem; }
.ci-form { display: grid; gap: 12px; }
.ci-form label { display: grid; gap: 4px; font-weight: 700; font-size: .9rem; }
.ci-form input, .ci-form textarea { padding: 8px 10px; border: 1.5px solid #dfe5f0; border-radius: 10px; font: inherit; font-weight: 400; }
.ci-preview iframe { width: 100%; height: 520px; border: 0; border-radius: 14px; background: #fff; }
.ci-error { margin: 0; color: #c8321f; } .ci-error:empty { display: none; }
.ci-form .actions { display: flex; gap: 8px; align-items: center; }
.o-room-head { display: flex; align-items: center; gap: 12px; margin: 6px 40px 16px 0; }
.o-room-head h2 { margin: 0; }
.o-room-head p { margin: 2px 0 0; }
.o-room-ico { font-size: 2.4rem; line-height: 1; }
.o-status { margin-left: auto; padding: 4px 12px; border-radius: 999px; font: 700 .8rem/1.4 var(--font-text); color: #fff; background: #2fbf71; white-space: nowrap; }
.o-status.warn { background: #e0a100; } .o-status.alert { background: #ef4c3c; }
.o-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.o-metric { padding: 12px; border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); display: grid; gap: 2px; }
.o-metric span { font-size: .8rem; color: var(--ink-soft); }
.o-metric b { font: 800 1.25rem/1.2 var(--font-fun); }
.o-metric small { font-size: .76rem; color: var(--ink-soft); }
.o-todos { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.o-todos a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); color: var(--ink); text-decoration: none; border-left: 5px solid #8b93a7; }
.o-todos li.warn a { border-left-color: #f5b301; } .o-todos li.alert a { border-left-color: #ef4c3c; }
.o-todos a span { flex: 1; }
.o-todos a b { white-space: nowrap; color: var(--link); font-size: .86rem; }
.o-todos a:hover { box-shadow: var(--shadow); }
/* Nhãn phòng trên khung 3D: gọn để thấy rõ phòng (thẻ dự phòng trên màn hình hẹp vẫn cỡ cũ). */
.o-label { gap: 6px; max-width: 230px; padding: 4px 9px 4px 7px; border-radius: 11px; box-shadow: 0 4px 12px rgba(20, 27, 58, .14); }
.o-label .o-light { width: 8px; height: 8px; }
.o-label .o-ico { font-size: 1.05rem; }
.o-label .o-txt b { font-size: .78rem; line-height: 1.2; }
.o-label .o-txt small { font-size: .68rem; line-height: 1.2; }
/* Số việc của phòng: nằm gọn trong chấm đèn trạng thái trên biển tên (màu theo trạng thái). */
.office-labels .o-label { width: 22px; height: 22px; max-width: none; padding: 0; gap: 0; justify-content: center; border-radius: 50%; border: 2px solid #fff;
    background: #2fbf71; color: #fff; font: 800 .74rem/1 var(--font-text); text-align: center; box-shadow: 0 2px 8px rgba(20, 27, 58, .35); }
.office-labels .o-label[data-status="warn"] { background: #f5b301; }
.office-labels .o-label[data-status="alert"] { background: #ef4c3c; box-shadow: 0 0 0 3px rgba(239, 76, 60, .35), 0 2px 8px rgba(20, 27, 58, .35); animation: o-pulse 1.4s ease-in-out infinite; }
@keyframes o-pulse { 50% { box-shadow: 0 0 0 7px rgba(239, 76, 60, .12), 0 2px 8px rgba(20, 27, 58, .35); } }
.o-label:hover, .o-label.hover, .o-label:focus-visible { transform-origin: center; filter: brightness(1.08); box-shadow: 0 0 0 3px rgba(255, 200, 61, .7), 0 2px 8px rgba(20, 27, 58, .35); }
.o-label .o-count { min-width: 18px; height: 18px; padding: 0 5px; font-size: .68rem; }
.o-label.big { padding: 6px 11px 6px 8px; }
.o-label.big .o-ico { font-size: 1.3rem; }
.o-label.big .o-txt b { font-size: .86rem; }

/* Quản trị: dán địa chỉ email bị trả lại */
.bad-find { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.bad-find textarea { flex: 1; min-width: 220px; }
/* Trang chủ: thư gửi phụ huynh bị trả lại, nhắc sửa email */
.mail-check.mail-bad:not([hidden]) { background: #fff4e8; border-color: #f6c999; }
.mail-bad p { margin: 4px 0 10px; font-size: .92rem; line-height: 1.45; }
/* Gợi ý sửa tên miền email gõ nhầm (đăng ký, tài khoản) */
.email-typo { display: block; margin-top: 4px; font-size: .88rem; color: #9a4b00; }
.email-typo button { border: 0; background: none; padding: 0; color: var(--brand, #2563eb); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ───── Quản trị, trang rộng (Văn phòng 3D): menu thành cột biểu tượng sát lề, rê chuột vào thì bung ra đè lên ───── */
@media (min-width: 901px) {
    .admin-shell-wide { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; max-width: none; padding: 12px 12px 14px 10px; }
    .admin-shell-wide .admin-side { position: sticky; top: 76px; z-index: 30; width: 56px; gap: 6px; padding: 8px 6px; max-height: calc(100vh - 90px);
        overflow-x: hidden; scrollbar-width: none; transition: width .16s ease, box-shadow .16s ease; }
    .admin-shell-wide .admin-side::-webkit-scrollbar { display: none; }
    .admin-shell-wide .admin-side-title { display: none; }
    .admin-shell-wide .admin-side-group + .admin-side-group { border-top: 1px solid var(--line); padding-top: 6px; }
    .admin-shell-wide .admin-side a { position: relative; gap: 0; padding: 9px 11px; white-space: nowrap; }
    .admin-shell-wide .admin-side-label { opacity: 0; width: 0; overflow: hidden; transition: opacity .12s; }
    .admin-shell-wide .admin-side-count { position: absolute; top: 2px; left: 26px; padding: 0 5px; font-size: .66rem; }
    /* Rê chuột (hoặc Tab tới) thì bung ra, chậm một chút để lướt chuột ngang qua không bị bật. */
    .admin-shell-wide .admin-side:hover, .admin-shell-wide .admin-side:focus-within { width: 264px; box-shadow: 0 16px 40px rgba(20, 27, 58, .22); transition-delay: .12s; }
    .admin-shell-wide .admin-side:hover .admin-side-title, .admin-shell-wide .admin-side:focus-within .admin-side-title { display: block; }
    .admin-shell-wide .admin-side:hover a, .admin-shell-wide .admin-side:focus-within a { gap: 10px; }
    .admin-shell-wide .admin-side:hover .admin-side-label, .admin-shell-wide .admin-side:focus-within .admin-side-label { opacity: 1; width: auto; transition-delay: .12s; }
    .admin-shell-wide .admin-side:hover .admin-side-count, .admin-shell-wide .admin-side:focus-within .admin-side-count { position: static; margin-left: auto; font-size: .75rem; }
    /* Khung văn phòng: hết chiều ngang, gần hết chiều cao còn lại. */
    .admin-shell-wide .office-title { font-size: 1.35rem; margin: 2px 0 8px; }
    .admin-shell-wide .office-stage { height: calc(100vh - 140px); min-height: 480px; }
}

/* ───── Quản trị: SEO (Search Console) ───── */
.seo-steps { margin: 8px 0 10px; padding-left: 20px; line-height: 1.5; font-size: .92rem; }
.seo-fetch { align-items: center; justify-content: space-between; margin-top: 12px; }
.seo-fetch p { margin: 0; flex: 1 1 320px; }
.seo-table td.num, .seo-table th.num { text-align: right; white-space: nowrap; }
.seo-table .seo-page { font-size: .85rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.seo-p1 { color: #0e7a4b; font-weight: 700; } .seo-p2 { color: #a36a00; font-weight: 700; }
.seo-up { color: #0e7a4b; } .seo-down { color: #c0392b; }
.seo-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.seo-tip { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; }
.seo-tip > span { font-size: 1.4rem; line-height: 1.2; }
.seo-tip > div { flex: 1; min-width: 0; }
.seo-tip p { margin: 4px 0 8px; font-size: .92rem; line-height: 1.5; color: var(--ink-soft); }
.seo-tip .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.seo-tip form { margin: 0; }
.seo-tip.seo-near { border-color: #f5c84d; } .seo-tip.seo-down { border-color: #f3a39a; }

/* ───── Liên kết nội bộ sang Thư viện ───── */
.lib-chips a { background: var(--fill); border-radius: 8px; padding: 6px 10px; font-weight: 600; color: #2a4fc7; text-decoration: none; border: 1.5px solid transparent; }
.lib-chips a:hover, .lib-chips a:focus-visible { border-color: var(--brand, #f5b301); background: #fff; }
.grade-lib { margin: 12px 0 0; font-size: .92rem; color: var(--ink-soft); line-height: 1.7; }
.grade-lib a { font-weight: 700; margin: 0 4px; }

/* ───── Văn phòng 3D: bong bóng thoại, nút công cụ, trời theo giờ ───── */
.office-stage[data-daypart="dusk"] { background: radial-gradient(120% 90% at 50% 0%, #fde9d6 0%, #e9d6d0 55%, #cfc3cf 100%); }
.office-stage[data-daypart="night"] { background: radial-gradient(120% 90% at 50% 0%, #3a4470 0%, #262d4f 55%, #1a1f3a 100%); }
.office-bubbles { position: absolute; inset: 0; pointer-events: none; z-index: 2050; }   /* trên nhãn phòng (z-index tới 2000) */
.o-bubble { position: absolute; left: 0; top: 0; max-width: 230px; padding: 8px 12px; border-radius: 14px; background: #fff; color: var(--ink);
    font-size: .85rem; line-height: 1.35; box-shadow: 0 8px 22px rgba(20, 27, 58, .22); will-change: transform; animation: o-pop .25s ease-out; }
.o-bubble b { display: block; font-size: .74rem; color: #2a4fc7; }
.o-bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: #fff; }
.o-bubble.out { opacity: 0; transition: opacity .25s; }
@keyframes o-pop { from { opacity: 0; scale: .85; } to { opacity: 1; scale: 1; } }
/* Toàn màn hình: khung 3D phủ kín, ngăn chi tiết phòng (z-index 60) vẫn nổi bên trên */
.office-full .office-stage { position: fixed; inset: 0; z-index: 55; height: 100vh; height: 100dvh; min-height: 0; border-radius: 0; }
.office-full body { overflow: hidden; }
.office-tools { position: absolute; top: 12px; left: 14px; z-index: 2100; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 200px); }
.o-tool { border: 0; border-radius: 50%; width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center;
    background: rgba(255, 255, 255, .92); box-shadow: 0 4px 12px rgba(20, 27, 58, .14);
    font: 600 1.05rem/1 var(--font-text); color: var(--ink); cursor: pointer; }
.o-tool.wide { width: auto; border-radius: 999px; padding: 6px 12px; font-size: .8rem; }
.o-tool:hover, .o-tool:focus-visible { background: #fff; box-shadow: 0 6px 16px rgba(20, 27, 58, .24); outline: none; }
.o-tool[hidden] { display: none; }
.office.flat .office-tools, .office.flat .office-bubbles { display: none; }
@media (prefers-reduced-motion: reduce) { .o-bubble { animation: none; } }

/* ───── Thử Sức Tuần ───── */
/* Thẻ trên trang chủ (thứ Sáu đến thứ Hai): nền xanh than của thương hiệu, điểm nhấn vàng, gọn một khối thấp. */
.weekly-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 0 0 18px; }
.weekly-card { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 16px; text-decoration: none; color: #fff;
    background: linear-gradient(135deg, #1e2a5e 0%, #2b3f8f 100%); border: 1.5px solid transparent; box-shadow: 0 6px 18px rgba(30, 42, 94, .22);
    transition: transform .14s, box-shadow .14s; }
.weekly-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(30, 42, 94, .32); color: #fff; }
.weekly-card.open { border-color: #ffc83d; box-shadow: 0 0 0 3px rgba(255, 200, 61, .35), 0 8px 22px rgba(30, 42, 94, .3); }
.weekly-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.weekly-badge-day { font: 800 .72rem/1 var(--font-text); letter-spacing: .07em; text-transform: uppercase; color: #ffc83d; }
.weekly-badge-no { font: 700 .72rem/1 var(--font-text); padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; }
.weekly-card-main { display: flex; align-items: center; gap: 10px; }
.weekly-card-ico { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .12); font-size: 1.25rem; }
.weekly-card-txt { display: grid; gap: 2px; min-width: 0; }
.weekly-card-txt b { font: 700 1.06rem/1.2 var(--font-fun); }
.weekly-card-txt small { color: rgba(255, 255, 255, .74); font-size: .78rem; }
.weekly-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .14); font-size: .84rem; }
.weekly-card-state b { color: #ffc83d; font-variant-numeric: tabular-nums; }
.weekly-card-go { flex: none; padding: 5px 11px; border-radius: 999px; background: #ffc83d; color: #1e2a5e; font-weight: 800; white-space: nowrap; }
.weekly-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #3ddc97; animation: weekly-pulse 1.6s infinite; }
@keyframes weekly-pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, .6); } 70%, 100% { box-shadow: 0 0 0 7px rgba(61, 220, 151, 0); } }
/* Ngày thường: một dòng gọn cuối thẻ học sinh. */
.weekly-mini { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding: 9px 12px; border-radius: 12px; background: var(--fill);
    color: var(--ink-soft); font-size: .86rem; text-decoration: none; }
.weekly-mini span:nth-child(2) { flex: 1; min-width: 0; }
.weekly-mini b { color: var(--link); white-space: nowrap; }
.weekly-mini:hover b { text-decoration: underline; }
/* Trang Đề Thử Sức Tuần */
.weekly-hero h1 { margin: 2px 0 8px; }
.weekly-kicker { margin: 0; font-weight: 700; color: #1e2a5e; }
.weekly-clock { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 14px 0 4px; padding: 12px 16px;
    border-radius: 16px; background: linear-gradient(135deg, #1e2a5e, #2b3f8f); color: #fff; }
.weekly-clock.open { box-shadow: 0 0 0 3px rgba(255, 200, 61, .45); }
.weekly-clock-label { font-weight: 600; }
.weekly-clock-time { font: 800 1.7rem/1 var(--font-fun); font-variant-numeric: tabular-nums; letter-spacing: .03em; color: #ffc83d; }
.weekly-points { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.weekly-kid-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.weekly-kid-head h2 { margin: 0; }
.weekly-sessions { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.weekly-session { padding: 12px 14px; border-radius: 16px; border: 1.5px solid #dde3f0; background: #fff; }
.weekly-session.open { border-color: #ffc83d; box-shadow: 0 0 0 3px rgba(255, 200, 61, .3); }
.weekly-session .weekly-card-head { margin-bottom: 6px; }
.weekly-session .weekly-badge-day { color: #1e2a5e; }
.weekly-session .weekly-badge-no { background: #1e2a5e; color: #ffc83d; }
.weekly-session h3 { margin: 0; }
.weekly-session p { margin: 6px 0; }
.weekly-open { background: #eef8f3; border-radius: 10px; padding: 8px 12px; }
.weekly-soon { background: var(--fill); border-radius: 10px; padding: 8px 12px; }
.weekly-open b, .weekly-soon b { font-variant-numeric: tabular-nums; }
.weekly-last { margin-top: 16px; padding-top: 12px; border-top: 1.5px dashed var(--line); }
.weekly-last h3 { margin: 0 0 4px; font-size: 1rem; }
.weekly-last p { margin: 6px 0; }
.weekly-table td, .weekly-table th { vertical-align: top; text-align: left; padding: 8px 10px; }
.weekly-rules ol { padding-left: 20px; display: grid; gap: 8px; }
.weekly-standing { margin: 10px auto 6px; max-width: 520px; padding: 12px 16px; border-radius: 14px; background: #f3f5fb; border: 1.5px solid #dde3f0; }
.weekly-standing p { margin: 4px 0; }
.weekly-tier { font-size: 1.15rem; }
.weekly-private { font-size: .82rem; }
.weekly-lock p { margin: 0; }
.weekly-level { font-weight: 600; color: var(--ink); }
.weekly-level-row td { background: #f3f5fb; }
@media (prefers-reduced-motion: reduce) { .weekly-dot { animation: none; } }

/* ═══════════════════════════════════════════════════════════════════════════
   LƯỢT MÀU "NÉT" (27/11)
   - Bỏ các mảng nền pastel loang (vàng kem, hồng, xanh bạc hà chuyển sắc): thẻ và khối thông báo
     dùng nền trắng, viền mảnh, một dải màu nhấn bên trái (hoặc trên đầu) để nhận biết loại khối.
   - Màu kỳ thi, màu học sinh vẫn giữ nhưng chỉ ở dải nhấn, biểu tượng và nút, không phủ cả nền.
   - Khối mới cũng theo cách này: .note-accent + --a là màu nhấn.
   ═══════════════════════════════════════════════════════════════════════════ */
.card { box-shadow: var(--shadow); }

/* Khối thông báo: nền trắng + dải nhấn trái. */
.deal-bar, .premium-end, .today-plan, .week-strip, .new-bar, .sent, .rest-note, .harder, .level-up,
.mail-ask, .mail-check:not([hidden]), .lib-practice, .lib-cards-cta, .lib-idea, .ref-tips, .premium-hero, .note-accent {
    --a: var(--brand-deep);
    background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--a); box-shadow: var(--shadow-sm); color: var(--ink);
}
.deal-bar { --a: #e5484d; }
.new-bar, .sent, .rest-note, .level-up, .today-plan.all-done { --a: var(--mint); }
.mail-ask, .mail-check:not([hidden]), .lib-cards-cta { --a: var(--link); }
.mail-check.mail-bad:not([hidden]), .harder, .rest-note.long { --a: #ec7a1c; background: #fff; }
.today-plan.all-done { background: #fff; }
.new-bar p, .new-bar b { color: var(--ink); }
.deal-prices div { background: var(--fill); }
.deal-box { background: #fff; border-color: #f3b9bd; }
.deal-box.held { background: #fff; border-color: #9fd9bc; }

/* Dải hạn mức và ghi chú nhỏ: nền xám nhạt trung tính thay cho vàng kem. */
.quota-bar, .quota-line, .add-kid-note, .submit-status, .sec-hint, .card-note, .level-suggest, .endless {
    background: var(--fill); border-color: var(--line); color: var(--ink);
}
.level-tip, .level-tip::before { background: #fff; border-color: var(--line); color: var(--ink); }
.tp-ico { background: var(--fill); }
.week-goal { background: var(--fill); }
.week-strip-awards span { background: #fff; border-color: var(--line); }

/* Banner đầu trang kỳ thi: nền trắng, dải màu kỳ thi bên trái. */
.banner { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--brand); box-shadow: var(--shadow-sm); }
.banner p { color: var(--ink-soft); }
.banner[class*="theme-"] { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--t); }

/* Thẻ học sinh: chỉ dải màu trên đầu, nền trắng. */
.kid-card { background: #fff; border-top-width: 4px; }

/* Thẻ kỳ thi: nền trắng, dải màu trên, biểu tượng trên nền nhạt của kỳ thi, chữ màu mực. */
.tile[data-icon] { background: #fff; border-color: var(--line); box-shadow: var(--shadow-sm); }
.tile[data-icon]::before { height: 5px; }
.tile[data-icon]::after { opacity: .07; filter: none; }
.tile[data-icon] .tile-icon { background: var(--t-soft); box-shadow: none; }
.tile[data-icon] h3 { color: var(--ink); }
.tile[data-icon] small { color: var(--ink-soft); }
.tile[data-icon] .tile-go { box-shadow: none; }

/* Bảng giá, Premium: viền mảnh, nền trắng. */
.price-card.free { border: 1px solid var(--line); border-top: 4px solid var(--mint); background: #fff; }
.price-card.premium { border: 1px solid var(--line); border-top: 4px solid var(--brand); background: #fff; }
.locked-more { background: #fff; border-color: #e8c25a; }
.compare th:last-child, .compare td:last-child { background: #fffbef; }

/* Nhóm vòng thi: nền trắng, dải màu nhóm bên trái. */
.rgroup { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--g); }
.rgroup .round.lv-quocgia { background: #fff; }

/* Thư viện: khung mẹo, ghi nhớ bớt màu nền. */
.tip-card { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--c); }
.lib-worked { background: #fff; }

/* Ô Thử Sức Tuần đang mở (28/11): khác hẳn ô chưa mở để nhìn lướt là biết.
   - Đang mở: nền vàng sáng, chữ xanh than, nhãn "● ĐANG MỞ", nút "Vào thi" xanh than nổi rõ, viền sáng nhấp nháy nhẹ.
   - Chưa mở / đã đóng / đã làm: nền xanh than, nút chỉ có viền (không giống nút bấm chính). */
.weekly-badge-right { display: inline-flex; align-items: center; gap: 6px; }
.weekly-badge-live { display: inline-flex; align-items: center; font: 800 .72rem/1 var(--font-text); letter-spacing: .06em; text-transform: uppercase;
    padding: 4px 9px 4px 7px; border-radius: 999px; background: #0f9a62; color: #fff; }
.weekly-badge-live .weekly-dot { width: 7px; height: 7px; margin-right: 5px; background: #fff; }
.weekly-card:not(.open) .weekly-card-go { background: transparent; color: #ffc83d; box-shadow: inset 0 0 0 1.5px rgba(255, 200, 61, .7); }
.weekly-card.open { color: #1e2a5e; background: linear-gradient(135deg, #ffd84d 0%, #ffc21a 100%); border-color: #ffe9a0;
    box-shadow: 0 8px 22px rgba(224, 160, 0, .35); animation: weekly-glow 2.4s ease-in-out infinite; }
.weekly-card.open:hover { color: #1e2a5e; box-shadow: 0 12px 28px rgba(224, 160, 0, .45); }
.weekly-card.open .weekly-badge-day { color: #1e2a5e; }
.weekly-card.open .weekly-badge-no { background: rgba(30, 42, 94, .12); color: #1e2a5e; }
.weekly-card.open .weekly-card-ico { background: rgba(255, 255, 255, .55); }
.weekly-card.open .weekly-card-txt small { color: rgba(30, 42, 94, .75); }
.weekly-card.open .weekly-card-foot { border-top-color: rgba(30, 42, 94, .16); }
.weekly-card.open .weekly-card-state b { color: #1e2a5e; }
.weekly-card.open .weekly-card-go { padding: 7px 16px; background: #1e2a5e; color: #fff; font-size: .95rem; box-shadow: 0 3px 0 #0c1433; }
@keyframes weekly-glow { 0%, 100% { box-shadow: 0 8px 22px rgba(224, 160, 0, .35), 0 0 0 0 rgba(255, 200, 61, .55); }
    50% { box-shadow: 0 8px 22px rgba(224, 160, 0, .35), 0 0 0 6px rgba(255, 200, 61, 0); } }
.weekly-session.open { background: #fffbea; border: 2px solid #ffc21a; }
@media (prefers-reduced-motion: reduce) { .weekly-card.open { animation: none; } }

/* Ô Thử Sức Tuần đã làm xong (28/11): nền trắng, viền xanh lá, nhãn "✓ ĐÃ HOÀN THÀNH" — khác hẳn ô chưa mở (xanh than) và ô đang mở (vàng). */
.weekly-badge-done { display: inline-flex; align-items: center; font: 800 .72rem/1 var(--font-text); letter-spacing: .06em; text-transform: uppercase;
    padding: 4px 9px; border-radius: 999px; background: #0f9a62; color: #fff; white-space: nowrap; }
.weekly-card.done { color: var(--ink); background: #fff; border: 2px solid #0f9a62; box-shadow: 0 4px 14px rgba(15, 154, 98, .15); }
.weekly-card.done:hover { color: var(--ink); box-shadow: 0 8px 20px rgba(15, 154, 98, .22); }
.weekly-card.done .weekly-badge-day { color: #0b7a4d; }
.weekly-card.done .weekly-badge-no { background: #e3f6ed; color: #0b7a4d; }
.weekly-card.done .weekly-card-ico { background: #e3f6ed; }
.weekly-card.done .weekly-card-txt small { color: var(--ink-soft); }
.weekly-card.done .weekly-card-foot { border-top-color: var(--line); }
.weekly-card.done .weekly-card-state { font-weight: 700; }
.weekly-card.done .weekly-card-state b { color: #0b7a4d; }
.weekly-card.done .weekly-card-go { background: #0f9a62; color: #fff; box-shadow: none; }
.weekly-card.missed { opacity: .72; }
.weekly-session.done { background: #f3fbf7; border: 2px solid #0f9a62; }

/* Quản trị · Thử Sức Tuần */
.weekly-admin-h { margin: 18px 0 10px; }
.weekly-admin-list { margin: 10px 0 4px; }
.weekly-admin-list summary { cursor: pointer; font-weight: 700; }

/* Quản trị · Hồ sơ học sinh */
.kid-profile-head { display: flex; gap: 14px; align-items: center; margin: 6px 0 14px; }
.kid-profile-head .avatar { width: 64px; height: 64px; font-size: 2rem; flex: none; }
.kid-profile-head h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kid-profile-head p { margin: 2px 0; }
.kid-level-bar { display: block; height: 8px; margin-top: 6px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.kid-level-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7ccf6b, #0f9a62); }
.kid-days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; min-height: 120px; }
.kid-day { display: grid; justify-items: center; gap: 4px; }
.kid-day b { font-size: .8rem; min-height: 1em; }
.kid-day i { display: block; width: 100%; max-width: 30px; border-radius: 6px 6px 2px 2px; background: #2f6bf0; }
.kid-day i.none { background: var(--line); }
.kid-day small { font-size: .68rem; color: var(--ink-soft); }
.kid-day.today small { color: var(--ink); font-weight: 800; }
.kid-plan { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.kid-plan li.done { color: var(--ink-soft); }
.kid-topics { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.kid-topics p { margin: 4px 0; }
@media (max-width: 560px) { .kid-days { gap: 3px; } .kid-day small { font-size: .6rem; writing-mode: vertical-rl; } }

/* Văn phòng 3D · Phòng học: tên bé online trên đầu (bé đang làm bài có ✏️ và viền vàng). */
.o-kidtag { position: absolute; left: 0; top: 0; pointer-events: none; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .94);
    color: var(--ink); font: 700 .72rem/1.5 var(--font-text); white-space: nowrap; box-shadow: 0 2px 6px rgba(20, 27, 58, .18); z-index: 5; }
.o-kidtag.doing { background: #fff6d6; box-shadow: 0 0 0 1.5px #ffc83d, 0 2px 6px rgba(20, 27, 58, .18); }

/* Menu quản trị (28/11): cột rộng hơn (252px), mỗi mục một dòng, không xuống dòng. */
@media (min-width: 901px) { .admin-side a { white-space: nowrap; } .admin-side-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; } }

/* Trang đề thi theo kỳ: đề số 2, 3 thu gọn */
.sample-more > summary { cursor: pointer; color: var(--link); font-weight: 700; padding: 6px 0; }

/* Văn phòng: việc đã đọc (mờ, không tính vào đèn) và đề xuất của phòng Giám đốc */
.o-todos li { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.o-todos li.read a { opacity: .55; border-left-color: #c3c8d4; box-shadow: none; background: #f6f7fa; }
.o-ack { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 10px; font: 600 .78rem/1.1 var(--font-text); color: var(--ink-soft); cursor: pointer; white-space: nowrap; }
.o-ack:hover { color: var(--ink); border-color: #b8bfcf; }
.o-ack-hint { font-size: .8rem; margin-top: -8px; }
.o-ideas { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.o-ideas a { display: flex; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #fffaf0; border: 1px solid #f3dfae; color: var(--ink); text-decoration: none; }
.o-ideas a:hover { background: #fff3d6; }
.o-idea-ico { font-size: 1.3rem; line-height: 1.2; }
.o-ideas b { display: block; font-weight: 700; }
.o-ideas small { display: block; color: var(--ink-soft); margin-top: 2px; }

/* Quản trị trên điện thoại, máy tính bảng: menu là ngăn trượt từ trái (nút ☰ ở đầu trang) thay cho hàng cuộn ngang. */
.admin-nav-toggle { display: none; }
@media (max-width: 900px) {
    .admin-nav-toggle { display: grid; place-items: center; width: 42px; height: 42px; margin-right: 6px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); cursor: pointer; flex: none; }
    .admin-nav-toggle svg { width: 22px; height: 22px; }
    .admin-shell .admin-side, .admin-shell-wide .admin-side {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 200; width: min(290px, 86vw); max-height: none; height: 100%;
        display: grid; align-content: start; gap: 14px; padding: 18px 10px 28px; overflow-x: hidden; overflow-y: auto;
        border-radius: 0 18px 18px 0; border: 0; box-shadow: 0 20px 50px rgba(20, 27, 58, .3);
        transform: translateX(-105%); transition: transform .22s ease; visibility: hidden;
    }
    body.admin-nav-open .admin-side { transform: none; visibility: visible; }
    .admin-shell .admin-side-group, .admin-shell-wide .admin-side-group { display: grid; gap: 2px; }
    .admin-shell .admin-side-title, .admin-shell-wide .admin-side-title { display: block; }
    .admin-shell .admin-side a, .admin-shell-wide .admin-side a { white-space: normal; gap: 10px; padding: 11px 10px; }
    .admin-shell-wide .admin-side-label { opacity: 1; width: auto; }
    .admin-shell-wide .admin-side-count { position: static; margin-left: auto; }
    .admin-nav-backdrop { position: fixed; inset: 0; z-index: 190; background: rgba(18, 26, 63, .38); }
    body.admin-nav-open { overflow: hidden; }
}

/* Trang Học sinh, tài khoản: lọc nhanh theo nhóm và lọc chi tiết */
.filter-row { display: flex; gap: 10px; align-items: baseline; margin-top: 8px; }
.filter-row .chips { margin: 0; }
.filter-group { flex: none; width: 76px; font: 700 .72rem/1.2 var(--font-text); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); }
.filter-more { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.filter-more > summary { cursor: pointer; font-weight: 700; }
.filter-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 14px; margin-top: 12px; align-items: end; }
.filter-form label { display: grid; gap: 4px; font-size: .86rem; color: var(--ink-soft); }
.filter-form label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.filter-form input:not([type=checkbox]), .filter-form select { width: 100%; }
.filter-form .actions { grid-column: 1 / -1; display: flex; gap: 8px; }
@media (max-width: 640px) { .filter-row { flex-direction: column; gap: 4px; } .filter-group { width: auto; } }

/* Lọc nhanh gọn: mọi nhóm chạy liền trên một dải, nút nhỏ; nhãn nhóm là chữ nhỏ đứng trước các nút của nhóm */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 10px; }
.filter-bar .filter-row, .filter-bar .filter-row .chips { display: contents; }
.filter-bar .filter-group { width: auto; margin: 0 2px 0 10px; font-size: .64rem; }
.filter-bar .filter-row:first-child .filter-group { margin-left: 0; }
.filter-bar .chip { padding: 2px 9px; font-size: .78rem; line-height: 1.55; border-width: 1px; }
.filter-bar .chip small { font-size: .7rem; }
.filter-bar .chip.on small { color: var(--ink); }

/* Chi tiết tài khoản, tab Chăm sóc */
.care-tips { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.care-tips li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: #fffaf0; border: 1px solid #f3dfae; }
.care-tips li > span { font-size: 1.25rem; }
.care-tips li > div { flex: 1; }
.care-tips small { display: block; margin-top: 2px; }
.care-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 0 0 16px; }
.care-facts > div { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.care-facts dt { font-size: .74rem; color: var(--ink-soft); }
.care-facts dd { margin: 2px 0 0; font-weight: 600; font-size: .9rem; }
.care-facts .tone-ok { border-color: #b9e6c9; } .care-facts .tone-warn { border-color: #f3dfae; } .care-facts .tone-bad { border-color: #f2b8b1; }
.care-filter { margin-bottom: 8px; }
.care-filter .chip { padding: 2px 9px; font-size: .78rem; cursor: pointer; }

/* Thanh "cập nhật mới" ở trang chủ và trang /cap-nhat */
.updates-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 14px; padding: 8px 10px 8px 12px; border-radius: 12px;
    background: #eef6ff; border: 1px solid #cfe2fb; font-size: .86rem; color: var(--ink); }
.updates-tag { flex: none; font-weight: 700; color: #1d4f91; }
.updates-text { flex: 1 1 260px; }
.updates-bar a { font-weight: 700; white-space: nowrap; }
.updates-bar .bar-x { margin-left: auto; }
.updates-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.updates-list h2 { font-size: 1rem; margin: 0 0 6px; text-transform: capitalize; }
.updates-list ul { margin: 0; padding-left: 4px; list-style: none; display: grid; gap: 6px; }

/* Văn phòng 3D: nhãn số việc gọn, cùng tông xanh than – vàng với biển phòng */

/* Mùa ôn thi cuối học kì 1: khung đề cuối kì 1 ở trang chủ */
.endterm { border: 2px solid var(--brand); }
.endterm h2 { margin: 0 0 6px; }
.endterm .chips { margin: 10px 0 0; }

/* Quản trị → Cấu hình → Giao diện sự kiện */
.theme-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.theme-pick .theme-opt { display: flex; flex-direction: row; text-align: left; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; }
.theme-opt:has(input:checked) { border-color: var(--brand-deep); background: var(--brand-soft); }
.theme-opt input { margin: 0; }
.theme-opt .ti { font-size: 1.5rem; line-height: 1; }
.theme-opt b { display: block; font-size: .95rem; }
.theme-opt small { color: var(--ink-soft); font-size: .8rem; }
#giao-dien .check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 4px 0; }
.solution.locked { background: var(--brand-soft); border: 1.5px dashed var(--brand-deep); color: var(--ink); }

/* ───── Khung chính và vùng thông tin ─────
   Trang có cả việc cần làm (vào thi, làm đề) lẫn thông tin đọc thêm (lịch, cấu trúc, nội quy, câu hỏi thường gặp):
   khung chính nổi bật (.zone-main + nhãn .zone-tag), phần đọc thêm gom trong .info-zone có dòng tiêu đề ngăn cách,
   các khung bên trong phẳng, nhạt hơn; khung dài có thể thu gọn bằng <details class="card fold">. */
.card.zone-main { position: relative; margin-top: 30px; padding-top: 30px; border: 2px solid var(--brand);
    background: linear-gradient(180deg, var(--brand-soft) 0, #fff 140px); box-shadow: var(--shadow-lift); }
.zone-tag { position: absolute; top: -13px; left: 20px; padding: 6px 12px; border-radius: 999px; background: var(--ink); color: var(--brand);
    font: 800 .74rem/1 var(--font-text); letter-spacing: .07em; text-transform: uppercase; box-shadow: var(--shadow-sm); }
.info-zone { margin-top: 44px; }
.info-head { display: flex; align-items: center; gap: 12px; margin: 0 2px 14px; color: var(--ink-soft);
    font: 800 .8rem/1.3 var(--font-text); letter-spacing: .08em; text-transform: uppercase; }
.info-head::before { content: "📖"; font-size: 1rem; letter-spacing: 0; }
.info-head::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: var(--line); }
.info-zone > .card, .info-zone > section.card { background: #fafbfd; border: 1px solid var(--line); box-shadow: none; padding: 20px 22px; margin-bottom: 14px; }
.info-zone > .card > h2, .info-zone > .card > summary h2, .info-zone > .card .rounds-head h2 { font-size: 1.12rem; }
.info-zone .zone-main { background: #fff; }
details.fold > summary { display: flex; align-items: center; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; }
details.fold > summary::after { content: "▾"; margin-left: auto; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
    background: var(--fill); color: var(--ink-soft); transition: transform .2s; }
details.fold[open] > summary::after { transform: rotate(180deg); }
details.fold[open] > summary { margin-bottom: 12px; }
.fold-hint { color: var(--ink-soft); font-size: .88rem; }
@media (max-width: 640px) {
    .card.zone-main { padding-top: 28px; }
    .info-zone > .card { padding: 16px; }
    .fold-hint { width: 100%; order: 3; }
}

/* Thử Sức Tuần: kết quả gần nhất thành bảng nhỏ trong khung bài thi */
.weekly-kid .weekly-last { margin-top: 18px; padding: 12px 16px; border: 0; border-radius: 14px; background: #f3f5fa; }
.weekly-kid .weekly-last p { margin: 0; padding: 8px 0; border-top: 1px solid #e3e7f0; }
.weekly-kid .weekly-last h3 + p { border-top: 0; }

/* ───── Hướng dẫn giải từng bước (Premium) ở trang kết quả ───── */
.guide { margin: 10px 0 4px; border: 1.5px solid #d6e2ff; border-radius: 12px; background: #f6f9ff; }
.guide > summary { cursor: pointer; padding: 10px 14px; font-weight: 700; color: #2a4fc7; list-style: none; }
.guide > summary::-webkit-details-marker { display: none; }
.guide > summary::after { content: " ▾"; }
.guide[open] > summary::after { content: " ▴"; }
.guide-steps { margin: 0; padding: 0 14px 6px 36px; }
.guide-steps > li { margin: 0 0 12px; padding-left: 4px; }
.guide-steps > li::marker { font-weight: 800; color: #2a4fc7; }
.guide-title { display: block; margin-bottom: 2px; color: var(--ink); }
.guide-steps p { margin: 2px 0; line-height: 1.55; }
.guide-steps ul { margin: 4px 0; padding-left: 20px; line-height: 1.55; }
.guide-locked { color: #9aa3bd; }
.guide-locked .guide-title { color: #9aa3bd; }
.guide-locked .guide-title::after { content: " 🔒"; }
.guide-upsell { margin: 0 14px 12px; padding: 10px 12px; background: var(--brand-soft); border: 1.5px dashed var(--brand-deep); border-radius: 10px; font-size: .94rem; }
.guide-try { margin: 0 14px 14px; padding: 12px 14px; background: #fff; border-radius: 12px; border: 1.5px solid #e3e8f2; }
.guide-try .prompt { margin: 8px 0; }
.guide-try details summary { cursor: pointer; color: #2a4fc7; font-weight: 600; }
.guide-options { margin: 4px 0 8px; padding-left: 26px; }

/* Báo lỗi câu hỏi: một dòng nhỏ cuối phần xem lại, bấm mới hiện nút ở từng câu */
.report-mode { margin: 18px 0 0; text-align: center; font-size: .86rem; }
.report-mode-btn { padding: 4px 8px; font: 500 .86rem/1.5 var(--font-text); color: var(--ink-soft); background: none; border: 0; text-decoration: underline; cursor: pointer; }
.report-mode-btn:hover, .report-mode-btn:focus-visible { color: var(--ink); }

/* Bài thầy cô giao (/bai): trang mở link, kết quả của học sinh. */
.hw-mine { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 16px; padding: 12px; border-radius: 14px; background: var(--brand-soft); }
.hw-mine b { width: 100%; font-size: .92rem; }
.hw-note { font-size: .88rem; }
.hw-cheer { font-size: 1.1rem; margin: 6px 0; }
.hw-invite { border: 2px dashed var(--brand-deep); }

/* Trang làm bài thầy cô giao (/bai): chân trang một dòng. */
.hw-foot { margin-top: 28px; padding: 16px; text-align: center; font-size: .82rem; color: var(--ink-soft); border-top: 1px solid var(--line); background: #fff; }
.hw-foot a { color: inherit; }

/* ───────── Quản trị: giáo viên (danh sách + ngăn kéo chi tiết) ───────── */
.tg-avatar { width: 36px; height: 36px; font-size: 1rem; flex: none; }
.tg-avatar, .tg-avatar-lg { position: relative; }
.is-online::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #18b26b; border: 2px solid #fff; }
.tg-avatar-lg.is-online::after { width: 14px; height: 14px; }
.tg-note { color: #8a5a00; }
.tg-state { text-align: right; white-space: nowrap; width: 1%; }
.tg-state form { display: inline; }
.tg-state .tag { margin-left: 4px; }
.tg-back { margin: 0 0 8px; font-size: .92rem; }
.tg-temp code { font-size: 1.1rem; padding: 2px 8px; background: #fff; border-radius: 6px; margin: 0 6px; }
.tg-temp small { display: block; margin-top: 4px; }
.tg-contact { font-size: .9rem; overflow-wrap: anywhere; }
.tg-box { background: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-sm); min-width: 0; }
.tg-box > .acc-h { margin: 0 0 8px; }
.tg-sum { cursor: pointer; display: block; margin: 0 !important; }
details[open] > .tg-sum { margin-bottom: 8px !important; }
.tg-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tg-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.tg-btns form { margin: 0; }
.tg-danger { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.tg-danger summary { cursor: pointer; color: var(--coral); font-weight: 600; font-size: .9rem; }
.tg-danger form { display: grid; gap: 8px; margin-top: 8px; justify-items: start; }
.tg-danger input[type=text] { width: 100%; }
.tg-danger .hint { margin: 0; font-size: .85rem; }
.tg-facts { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; margin: 0; font-size: .86rem; }
.tg-facts dt { color: var(--ink-soft); }
.tg-facts dd { margin: 0; overflow-wrap: anywhere; }
.tg-grades { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.tg-grades legend { font-weight: 600; font-size: .88rem; padding: 0; margin-bottom: 4px; }
.tg-grades label { display: inline-flex !important; gap: 4px; align-items: center; font-weight: 500 !important; }
.tg-assign-list { display: grid; gap: 8px; }
.tg-assign { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; background: #fff; border-radius: 14px; padding: 10px 14px; border-left: 4px solid #e2e5ee; box-shadow: var(--shadow-sm); }
.tg-assign.open { border-left-color: #18b26b; }
.tg-assign-main { display: grid; gap: 2px; min-width: 0; }
.tg-assign-main small { font-size: .82rem; }
.tg-assign-side { display: grid; gap: 4px; justify-items: end; align-content: start; text-align: right; font-size: .85rem; }
.tg-log { list-style: none; margin: 0; padding: 0; display: grid; background: #fff; border-radius: 14px; box-shadow: var(--shadow-sm); overflow: hidden; }
.tg-log li { display: flex; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.tg-log li:last-child { border-bottom: 0; }
.tg-log li.admin { background: #fbf8ef; }
.tg-log-icon { width: 22px; text-align: center; flex: none; }
.tg-log-text { display: grid; gap: 1px; font-size: .9rem; min-width: 0; overflow-wrap: anywhere; }
.tg-log-text b { font-weight: 600; }
@media (max-width: 720px) {
    .tg-two { grid-template-columns: minmax(0, 1fr); }
    .tg-table .tg-state { text-align: left; }
    .acc .acc-stats { grid-template-columns: repeat(2, 1fr); }
}
.stat-title { font-size: 1.05rem; margin: 18px 0 8px; }

/* ===== Trang chủ ba khu (12/2026): 1 Hôm nay của con · 2 Thi trong tuần · 3 Kho đề luyện =====
   Mỗi khu một nền riêng để nhìn là biết đang ở đâu; khu 1 gọn để con xuống ngay phần làm bài. */
.home-today { padding: 16px 18px; margin-bottom: 16px; background: #fff; }
.ht-head { display: flex; align-items: center; gap: 14px; }
.ht-kid { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.ht-kid .avatar { width: 54px; height: 54px; font-size: 1.75rem; }
.ht-name { flex: 1; min-width: 0; }
.ht-name h2 { font-size: 1.35rem; margin: 0; }
.ht-name .kid-title { margin: 2px 0 0; }
.ht-name h2 + .kid-title { display: table; }
.ht-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 4px 0 0; font-size: .84rem; color: var(--ink-soft); }
.ht-meta > * { background: none; padding: 0; border-radius: 0; font: 600 .82rem/1.3 var(--font-text); white-space: nowrap; }
.ht-meta > * + * { padding-left: 8px; border-left: 1.5px solid var(--line); }
.ht-meta .premium-on { color: #8a5a00; }
.ht-meta .streak { color: #b44d00; }
.ht-meta .today-time.short, .ht-meta .today-time.long { background: none; }
.ht-track { display: flex; gap: 6px; flex: none; }
.ht-btn { position: relative; display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line);
    box-shadow: 0 2px 0 var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .88rem; white-space: nowrap; transition: transform .14s, border-color .14s; }
.ht-btn:hover { color: var(--ink); transform: translateY(-1px); border-color: #b9c3d8; }
.ht-ico { width: 27px; height: 27px; border-radius: 9px; display: grid; place-items: center; font-size: 1rem; }
.ht-ico.t-sky { background: #e3f0ff; } .ht-ico.t-mint { background: #e2f7ec; } .ht-ico.t-grape { background: #efe7ff; } .ht-ico.t-peach { background: #ffe9e0; }
.ht-btn .new-dot { position: absolute; top: -8px; right: -6px; margin: 0; min-width: 18px; height: 18px; font-size: .7rem; box-shadow: 0 0 0 2px #fff; }

.ht-row { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.ht-row.no-plan { grid-template-columns: minmax(0, 1fr); }
.ht-row .today-plan { margin: 0; }
.ht-side { display: grid; grid-auto-rows: 1fr; gap: 10px; }
.ht-row.no-plan .ht-side { grid-template-columns: 1fr 1fr; grid-auto-rows: auto; }
.ht-box { display: grid; align-content: center; gap: 4px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 16px; }
.ht-level { background: linear-gradient(160deg, #fff 45%, #fdeef5); }
.ht-cap { font-size: .74rem; color: var(--ink-soft); }
.ht-level .journey { margin: 0; gap: 10px; }
.ht-level .journey-ico { font-size: 1.9rem; }
.ht-level .journey-txt { min-width: 0; flex: 1; gap: 4px; }
.ht-level .journey-txt b { font: 700 1.05rem/1.2 var(--font-fun); }
.ht-level .journey-bar { max-width: none; height: 8px; }
.ht-side .week-strip { margin: 0; grid-template-columns: 1fr; gap: 6px; align-content: center; padding: 10px 14px; border-radius: 16px; background: linear-gradient(160deg, #fff 45%, #fff6d9); border: 1.5px solid var(--line); }
.ht-side .week-strip-title { font-size: 1.02rem; }
.ht-side .week-strip-awards span { font-size: .78rem; padding: 1px 9px; }
.home-today .remind { margin: 8px 0 -4px; }

.home-zone { border-radius: 22px; padding: 16px 18px; margin-bottom: 16px; }
.home-week { background: #fff4d1; }
.home-week .tile-group { margin: 0 0 12px; font-size: 1.2rem; color: #6b4700; }
.home-week .weekly-cards { margin: 0; }
.home-bank { background: #e6ebf5; }
.hz-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.hz-head h2 { margin: 0; font-size: 1.4rem; }
.hz-head small { margin-left: auto; color: var(--ink-soft); }
.hz-group { margin: 14px 0 8px; font-size: 1.05rem; }
.home-bank .weekly-mini { margin: 14px 0 0; }

/* thẻ đề ngang: biểu tượng | chữ rộng hết thẻ; nút ở hàng riêng dưới cùng */
.xtiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.xtile { position: relative; display: grid; grid-template-columns: 46px minmax(0, 1fr); column-gap: 12px; row-gap: 8px; align-items: center; padding: 12px 14px;
    background: #fff; border-radius: 16px; border-left: 5px solid var(--t, var(--brand)); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s; }
a.xtile:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.xt-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 1.55rem; background: var(--t-soft, var(--brand-soft)); }
.xt-txt { display: grid; min-width: 0; }
.xt-txt b { font: 700 1.05rem/1.25 var(--font-fun); color: color-mix(in srgb, var(--t, var(--ink)) 30%, var(--ink)); }
.xt-txt small { font-size: .8rem; line-height: 1.4; color: var(--ink-soft); }
.xt-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding-top: 8px; border-top: 1px dashed var(--line); font-size: .8rem; color: var(--ink-soft); }
.xt-foot > span:first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xt-done { color: var(--mint); font-weight: 600; }
.xt-go { flex: none; white-space: nowrap; padding: 4px 14px; border-radius: 999px; background: var(--t, var(--brand)); color: #fff; font: 700 .84rem/1.4 var(--font-text); transition: transform .15s; }
a.xtile:hover .xt-go { transform: translateX(2px); }
.xt-term { --t: var(--brand-deep); --t-soft: var(--brand-soft); background: #fffaf0; box-shadow: var(--shadow), inset 0 0 0 1.5px #f6dc8f; }
.xt-rib { position: absolute; top: 10px; right: 12px; padding: 1px 9px; border-radius: 999px; background: var(--brand); color: #7a5600; font-size: .7rem; font-weight: 700; }
.xt-term .xt-txt b { padding-right: 76px; }
.xt-term .xt-foot { justify-content: flex-start; }
.xt-term .xt-foot a { flex: 1; text-align: center; white-space: nowrap; padding: 4px 10px; border-radius: 999px; background: #fff; box-shadow: 0 0 0 1.5px var(--brand-deep);
    color: #6b4700; font-weight: 700; font-size: .84rem; text-decoration: none; transition: background .15s; }
.xt-term .xt-foot a:hover { background: var(--brand); color: var(--ink); }

@media (max-width: 860px) {
    .ht-head { flex-wrap: wrap; }
    .ht-track { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .ht-btn { flex-direction: column; justify-content: center; gap: 2px; padding: 6px 2px; font-size: .78rem; }
    .ht-ico { width: 26px; height: 26px; font-size: .9rem; }
    .ht-row { grid-template-columns: minmax(0, 1fr); }
    .ht-side, .ht-row.no-plan .ht-side { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; gap: 8px; }
    .xtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .home-today { padding: 12px; }
    .ht-kid .avatar { width: 46px; height: 46px; font-size: 1.5rem; }
    .ht-name h2 { font-size: 1.2rem; }
    .home-zone { padding: 12px; border-radius: 18px; margin-left: -4px; margin-right: -4px; }
    .hz-head small { display: none; }
    .xtiles { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .xtile { grid-template-columns: 40px minmax(0, 1fr); column-gap: 10px; padding: 10px 12px; }
    .xt-ico { width: 40px; height: 40px; font-size: 1.35rem; }
    .home-week .tile-group { font-size: 1.05rem; margin-bottom: 8px; }
    .ht-meta { column-gap: 5px; }
    .ht-meta > * { font-size: .73rem; }
    .ht-meta > * + * { padding-left: 5px; }
    .ht-cap { display: none; }
    .ht-side .week-strip-goal small { font-size: .72rem; }
    .ht-box, .ht-side .week-strip { padding: 8px 12px; }
    .ht-level .journey-ico { font-size: 1.6rem; }
    .ht-row .today-plan { margin-left: 0; margin-right: 0; }
}
/* Lịch sử yêu cầu nâng cấp (trang Tài khoản): lý do huỷ nằm dưới trạng thái. */
.order-history .order-reason { display: block; margin-top: 3px; font-size: .82rem; color: var(--ink-soft); max-width: 420px; }

/* Đơn chuyển khoản (quản trị): mỗi đơn một hàng gọn, thao tác trong ngăn kéo bên phải. */
.ord-list { display: grid; }
.ord-row { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(130px, .9fr) minmax(170px, 1fr) minmax(0, 1.2fr) auto; gap: 6px 16px; align-items: center; padding: 11px 4px; border-top: 1px solid var(--line); }
.ord-row:first-child { border-top: 0; }
.ord-row:hover { background: var(--fill); }
.ord-row small { display: block; color: var(--ink-soft); font-size: .8rem; }
.ord-who a { text-decoration: none; }
.ord-amount { font-variant-numeric: tabular-nums; }
.ord-wait { display: inline; font-weight: 600; }
.ord-wait.mid { color: #b26a00; }
.ord-wait.late { color: #c0392b; }
.ord-list .memo, .ord-panel .memo { display: inline-block; padding: 2px 8px; font: 700 .8rem/1.5 ui-monospace, Consolas, monospace; background: #fff4d6; border-radius: 6px; word-break: break-all; }
.ord-notes { display: grid; gap: 2px; min-width: 0; }
.ord-notes small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord-reason { color: #a8322a !important; }
.ord-act { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.ord-act small { display: inline; }
.ord-drawer-panel { width: min(480px, 100%); }
.ord-panel { display: grid; gap: 14px; }
.ord-panel h2 { margin: 2px 50px 0 0; font-size: 1.25rem; }
.ord-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.ord-facts dt { color: var(--ink-soft); font-size: .86rem; }
.ord-facts dd { margin: 0; }
.ord-field { display: grid; gap: 5px; font-weight: 600; font-size: .9rem; }
.ord-field input { padding: 9px 11px; font: inherit; font-weight: 400; border: 1px solid var(--line); border-radius: 10px; }
.ord-box { display: grid; gap: 10px; padding: 14px; border-radius: 14px; }
.ord-box p { margin: 0; }
.ord-box.ok { background: var(--mint-soft); }
.ord-box.bad { background: #fff1ef; }
.ord-reasons { display: grid; gap: 6px; }
.ord-reasons label { display: flex; gap: 8px; align-items: baseline; font-size: .9rem; cursor: pointer; color: var(--ink, inherit); font-weight: 500; }
.ord-check { display: block; font-size: .9rem; cursor: pointer; color: var(--ink, inherit); }
.ord-check input { margin-right: 6px; }
.btn.danger-outline { background: #fff; color: #c0392b; border: 1.5px solid #e9a39b; }
.btn.danger-outline:hover { background: #fff6f5; }
@media (max-width: 760px) {
    .ord-row { grid-template-columns: 1fr auto; }
    .ord-plan { text-align: right; }
    .ord-memo, .ord-notes { grid-column: 1 / -1; }
    .ord-act { grid-column: 1 / -1; justify-content: stretch; }
    .ord-act .btn { flex: 1; }
}

/* ===== Bản điện thoại (máy chủ nhận ra thiết bị, body.m-ui): thanh tab dưới cùng + bảng trượt "Thêm" ===== */
.m-kid { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font: inherit; color: var(--ink); cursor: pointer; }
.m-kid .kid-switch-avatar { width: 30px; height: 30px; font-size: 1.1rem; }
.m-ui .m-kid .menu-name { display: inline; max-width: 110px; }
.m-ui .top-in { padding-top: max(8px, env(safe-area-inset-top)); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(18, 26, 63, .06); view-transition-name: tab-bar; -webkit-tap-highlight-color: transparent; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 52px; padding: 4px 0; border: 0; border-radius: 14px;
  background: none; color: var(--ink-soft); font-family: inherit; font-size: .72rem; font-weight: 600; line-height: 1.15; text-decoration: none; cursor: pointer; transition: transform .12s, background .15s; }
.tab-ico { font-size: 1.35rem; line-height: 1.1; filter: grayscale(.55); opacity: .8; transition: filter .15s, opacity .15s, transform .15s; }
.tab:active { transform: scale(.92); }
.tab.on { color: var(--ink); background: color-mix(in srgb, var(--brand) 22%, #fff); }
.tab.on .tab-ico { filter: none; opacity: 1; transform: translateY(-1px); }
.tab.on .tab-label { font-weight: 800; }
body.has-tabs { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
body.has-tabs.kb-open { padding-bottom: 0; }
body.kb-open .tabbar { display: none; }
.foot-m { margin-top: 20px; padding: 14px 16px 16px; text-align: center; font-size: .8rem; }
.foot-m p { margin: 4px 0; }
.foot-m a { color: inherit; }

dialog.sheet { position: fixed; inset: auto 0 0 0; width: 100%; max-width: 560px; margin: 0 auto; max-height: 86dvh; padding: 0; border: 0;
  border-radius: 22px 22px 0 0; background: #fff; color: var(--ink); box-shadow: 0 -10px 40px rgba(18, 26, 63, .18);
  transform: translateY(0); transition: transform .2s ease-out; }
dialog.sheet::backdrop { background: rgba(18, 26, 63, .42); }
dialog.sheet[open] { display: flex; flex-direction: column; }
@starting-style { dialog.sheet[open] { transform: translateY(100%); } }
dialog.sheet.closing { transform: translateY(100%); transition-duration: .18s; }
html:has(dialog.sheet[open]) { overflow: hidden; }
.sheet-in { position: relative; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-grip { width: 42px; height: 5px; margin: 2px auto 8px; border-radius: 3px; background: #d5dbe6; }
.sheet-x { position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f2f4f8; color: var(--ink-soft); font-size: 1rem; cursor: pointer; }
.sheet-label { margin: 14px 0 8px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.sheet-kids { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.sheet-kid { display: flex; align-items: center; gap: 8px; flex: none; padding: 6px 12px 6px 6px; border: 1.5px solid var(--line); border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; }
.sheet-kid small { display: block; font-weight: 500; font-size: .74rem; color: var(--ink-soft); }
.sheet-kid.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 16%, #fff); }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sheet-grid a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border-radius: 16px; background: #f6f7fb; color: var(--ink); text-decoration: none; font-size: .82rem; font-weight: 600; text-align: center; }
.sheet-grid a span { font-size: 1.5rem; line-height: 1; }
.sheet-grid a:active, .sheet-list a:active, .sheet-out:active { background: #eceff6; }
.sheet-list { display: grid; }
.sheet-list a, .sheet-out { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 6px; border: 0; border-bottom: 1px solid #eef1f6; background: none;
  color: var(--ink); text-decoration: none; font: inherit; font-weight: 600; text-align: left; width: 100%; cursor: pointer; }
.sheet-list a > span:first-child:not(.menu-avatar), .sheet-out > span { width: 36px; text-align: center; font-size: 1.2rem; }
.sheet-list small { display: block; font-weight: 500; font-size: .78rem; color: var(--ink-soft); }
.sheet-out { border-bottom: 0; color: #c0392b; }
@media (prefers-reduced-motion: reduce) { dialog.sheet, .tab, .tab-ico { transition: none; } }
@media print { .tabbar, dialog.sheet { display: none !important; } body.has-tabs { padding-bottom: 0; } }

/* Trang chủ bản điện thoại (tab Hôm nay): báo món mới, lối vào kho đề */
.ht-news { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.ht-news a { padding: 5px 10px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 20%, #fff); color: var(--ink); font-size: .84rem; font-weight: 700; text-decoration: none; }
.m-bank-link { display: flex; align-items: center; gap: 12px; margin: 14px 0; padding: 14px 16px; border-radius: 18px; background: #fff; box-shadow: var(--shadow-sm); color: var(--ink); text-decoration: none; }
.m-bank-link b { display: block; font-size: 1.05rem; }
.m-bank-link small { color: var(--ink-soft); }
.m-bank-ico { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 14px; background: #e6f2ff; font-size: 1.5rem; }
.m-bank-go { margin-left: auto; font-size: 1.6rem; color: var(--ink-soft); }
.m-bank-link:active { transform: scale(.98); }
.m-ui .home-bank { margin-top: 4px; }

/* ===== Bản điện thoại · làm bài (body.m-ui.focus): bỏ thanh trên và trang trí, đồng hồ ghim trên, nút ghim dưới ===== */
.m-ui.focus header.top, .m-ui.focus .ev-garland, .m-ui.focus .ev-greet, .m-ui.focus .ev-scene, .m-ui.focus footer.foot { display: none; }
.m-ui.focus main.wrap { padding-top: 0; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.m-ui.focus .exam-bar { position: sticky; top: 0; z-index: 20; margin: 0 -16px 10px; padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.m-ui.focus .exam-bar .timer { padding: 8px 12px 5px; font-size: 1.2rem; }
.exam-dock { position: fixed; left: 0; right: 0; bottom: var(--kb, 0px); z-index: 30; max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(18, 26, 63, .07); }
.exam-dock .btn { min-height: 52px; padding-left: 6px; padding-right: 6px; justify-content: center; }
.dock-mid { display: flex; flex-direction: column; align-items: center; gap: 0; line-height: 1.1; }
.dock-mid b { font-size: 1.05rem; }
.dock-mid small { font-size: .7rem; font-weight: 600; color: var(--ink-soft); }
.dock-finish { display: none; }
.exam-dock.at-end #next { display: none; }
.exam-dock.at-end .dock-finish { display: inline-flex; align-items: center; }
.q-sheet .grid { margin-top: 4px; }
.q-sheet .submit-row { margin: 18px 0 4px; }
.q-sheet .submit-btn { width: 100%; min-height: 52px; }

/* Bản điện thoại · kết quả: bảng theo dạng bài gấp lại, nút hành động xếp dọc */
details.topics-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
details.topics-card > summary::-webkit-details-marker { display: none; }
details.topics-card > summary::after { content: "▾"; color: var(--ink-soft); font-size: 1.1rem; }
details.topics-card[open] > summary::after { content: "▴"; }
details.topics-card > summary h2 { margin: 0; }
details.topics-card[open] > summary { margin-bottom: 12px; }
.m-ui .result .actions { flex-direction: column; align-items: stretch; }
.m-ui .result .actions .btn, .m-ui .result .actions form, .m-ui .result .actions form .btn { width: 100%; justify-content: center; }

/* ===== Bản điện thoại · giai đoạn 3: thẻ chọn phần trang, bỏ phần lặp, lịch sử gọn ===== */
.has-tabs a.back[href="/"] { display: none; }
.pseg { position: sticky; top: 56px; z-index: 9; display: flex; gap: 6px; margin: 0 -16px 14px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none;
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pseg::-webkit-scrollbar { display: none; }
.pseg a { position: relative; flex: 1 0 auto; padding: 8px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink-soft);
  font-weight: 700; font-size: .9rem; text-align: center; text-decoration: none; white-space: nowrap; }
.pseg a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.pseg a .new-dot { position: static; display: inline-grid; margin-left: 6px; vertical-align: 1px; }
.m-ui .page-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.m-ui .page-tabs .btn { justify-content: center; padding-left: 4px; padding-right: 4px; font-size: .82rem; white-space: nowrap; }
.m-ui .page-tabs .history-filter { grid-column: 1 / -1; width: 100%; margin: 0; }
.m-ui .wardrobe-hero { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 14px; row-gap: 6px; }
.m-ui .wardrobe-hero > div { display: contents; }
.m-ui .wardrobe-hero .avatar-xl { grid-row: 1 / 3; width: 76px; height: 76px; font-size: 2.6rem; margin: 10px; }
.m-ui .wardrobe-hero h1 { grid-column: 2; margin: 0; align-self: end; }
.m-ui .wardrobe-hero .kid-title { grid-column: 2; justify-self: start; align-self: start; }
.m-ui .wardrobe-hero .kid-stats { grid-column: 1 / -1; margin: 6px 0 0; }
.m-ui .wardrobe-hero h1 { font-size: 1.5rem; }
.m-ui .kid-stats { gap: 6px; }
.m-ui .history-row { gap: 10px; padding: 10px 4px; }
.m-ui .history-icon { width: 38px; height: 38px; font-size: 1.15rem; }
.m-ui .history-main b { font-size: .95rem; line-height: 1.3; }
.m-ui .history-main small { font-size: .78rem; }
.m-ui .history-score .stars { display: none; }
.m-ui .history-score b { font-size: 1.1rem; }
.m-ui .history-go { display: none; }

/* ===== Giai đoạn 4: vạch tải trang, mục thêm vào màn hình chính, phản hồi khi chạm ===== */
html.page-loading::before { content: ""; position: fixed; top: 0; left: 0; z-index: 1000; height: 3px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--brand) 30%, #ff8f6b 70%, transparent); background-size: 50% 100%; background-repeat: no-repeat;
  animation: page-loading 1s ease-in-out infinite; pointer-events: none; }
@keyframes page-loading { from { background-position: -50% 0; } to { background-position: 150% 0; } }
@media (prefers-reduced-motion: reduce) { html.page-loading::before { animation: none; background: var(--brand); opacity: .7; } }
.sheet-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 6px; border: 0; border-bottom: 1px solid #eef1f6; background: none;
  color: var(--ink); font: inherit; font-weight: 600; text-align: left; width: 100%; cursor: pointer; }
.sheet-row > span { width: 36px; text-align: center; font-size: 1.2rem; }
.sheet-row[hidden] { display: none; }
.install-in h2 { margin: 6px 44px 6px 0; font-size: 1.15rem; }
.install-in ol { margin: 8px 0 14px; padding-left: 22px; }
.install-in li { margin: 6px 0; }
.m-ui { -webkit-tap-highlight-color: transparent; }
.m-ui :is(.btn, .xtile, .history-row, .closet-item button, .sheet-grid a, .m-bank-link):active { transform: scale(.97); transition: transform .08s; }

/* ===== Thử Sức Tuần · bản điện thoại: bài thi của con lên đầu, chữ gọn, lịch thi theo lớp ===== */
.m-ui main.wrap:has(> .weekly-hero) { display: flex; flex-direction: column; }
.m-ui main.wrap > .weekly-kid { order: -1; }
.m-ui .weekly-hero { padding: 16px; }
.m-ui .weekly-hero h1 { font-size: 1.6rem; margin: 0 0 8px; }
.m-ui .weekly-kicker { font-size: .82rem; }
.weekly-facts { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: .9rem; line-height: 1.35; }
.weekly-facts li { padding: 6px 10px; border-radius: 10px; background: #f3f5fb; }
.weekly-facts li:last-child { flex-basis: 100%; }
.m-ui .weekly-clock { padding: 10px 14px; margin-top: 12px; }
.m-ui .weekly-clock-label { font-size: .9rem; }
.m-ui .weekly-clock-time { font-size: 1.45rem; }
.weekly-points.short { font-size: .88rem; line-height: 1.45; gap: 4px; }
.weekly-points.short li:nth-child(2) { display: none; }
.m-ui .weekly-kid { padding: 16px; }
.m-ui .weekly-kid-note { font-size: .85rem; }
.m-ui .weekly-session { padding: 12px; }
.m-ui .weekly-session h3 { font-size: 1.1rem; }
.m-ui .weekly-session p { font-size: .9rem; line-height: 1.45; }
.m-ui .weekly-session .btn { width: 100%; justify-content: center; }
.m-ui .weekly-meta { margin: 2px 0 8px; }
.m-ui .weekly-kid .weekly-last { padding: 10px 12px; }
.m-ui .weekly-kid .weekly-last p { font-size: .86rem; line-height: 1.45; }
.m-ui .info-zone > .card { font-size: .92rem; line-height: 1.5; }
.weekly-grid { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0 0 14px; font-size: .9rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.weekly-grid caption { text-align: left; font-weight: 700; font-size: .82rem; color: var(--ink-soft); padding: 0 2px 6px; }
.weekly-grid th { padding: 7px 8px; text-align: left; font-size: .8rem; color: #1e2a5e; background: #f3f5fb; white-space: nowrap; }
.weekly-grid td { padding: 7px 8px; border-top: 1px solid #eef1f6; white-space: nowrap; }
.weekly-grid tr.mine td { background: #fff6dc; font-weight: 700; }
.m-ui .info-zone > .card { padding: 14px; }
.weekly-levels.m-list .weekly-table thead { display: none; }
.weekly-levels.m-list .weekly-table, .weekly-levels.m-list .weekly-table tbody { display: block; }
.weekly-levels.m-list .weekly-table tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
.weekly-levels.m-list .weekly-table td { display: inline; padding: 0; background: none; }
.weekly-levels.m-list .weekly-table td:first-child { display: block; font-weight: 700; }
.weekly-levels.m-list .weekly-table td + td:not(:nth-child(2))::before { content: " · "; }
.weekly-levels.m-list .weekly-level-row { background: #f3f5fb; border-radius: 10px; padding: 8px 10px; }
