/* ═══════════════════════════════════════════════════════════════════════════
   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: #1b2550;             /* xanh mực: chữ */
    --ink-soft: #69728f;
    --brand: #ffc83d;           /* vàng bút chì */
    --brand-deep: #e9a400;
    --brand-soft: #fff5d6;
    --bg: #f6f7fb;
    --card: #ffffff;
    --line: #e6e9f2;
    --fill: #f2f4f9;
    --coral: #ef5a4c;
    --coral-soft: #fdecea;
    --mint: #14a06c;
    --mint-soft: #e6f7ef;
    --link: #2f5be3;            /* xanh dương: đường link trong nội dung */
    --link-hover: #1b3fb5;
    --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 #d9deea;
    --radius: 20px;
    --shadow-sm: 0 1px 2px rgba(27, 37, 80, .06);
    --shadow: 0 1px 2px rgba(27, 37, 80, .04), 0 8px 24px rgba(27, 37, 80, .07);
    --shadow-lift: 0 2px 4px rgba(27, 37, 80, .06), 0 14px 32px rgba(27, 37, 80, .12);
    --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: radial-gradient(900px 340px at 50% -120px, #fff1bf 0%, rgba(255, 241, 191, 0) 70%) no-repeat, 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; }
.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.45rem/1 var(--font-fun); letter-spacing: -.01em; }
.brand-name em { font-style: normal; background: linear-gradient(transparent 58%, var(--brand) 58%); padding: 0 2px; }
.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; }
.foot { max-width: 960px; margin: 0 auto; padding: 8px 16px 36px; color: var(--ink-soft); font-size: .82rem; text-align: center; }
.foot a { color: var(--ink-soft); font-weight: 500; text-decoration-color: transparent; }
.foot a:hover { color: var(--link); text-decoration-color: currentColor; }

.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], 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; }
.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.ok { background: var(--mint-soft); }
.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-fit, 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 {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    background: linear-gradient(120deg, #fff0b8, #ffe08a); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px;
}
.banner .icon { display: grid; place-items: center; width: 64px; height: 64px; font-size: 2.1rem; line-height: 1; flex: none; background: #fff; border-radius: 18px; box-shadow: var(--shadow-sm); }
.banner p { margin: 4px 0 0; font-weight: 500; color: #5c4a12; }
.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%; }
/* 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; }
.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; }
.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 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; }
.faq details p { margin: 8px 0 0; color: var(--ink-soft); }
.foot-contact { font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════════
   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: #ef5a4c; --t-soft: #fde9e6; }
.theme-blue   { --t: #3d7bf2; --t-soft: #e7efff; }
.theme-green  { --t: #17a673; --t-soft: #e1f6ec; }
.theme-purple { --t: #8b5cf6; --t-soft: #efe8ff; }
.theme-orange { --t: #ff8a3d; --t-soft: #fff0e3; }
.theme-teal   { --t: #0ea5a4; --t-soft: #dff7f6; }

.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='.5'%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"),
        radial-gradient(900px 340px at 50% -120px, #fff1bf 0%, rgba(255, 241, 191, 0) 70%) no-repeat,
        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-top: 2px; font: 700 .82rem/1.4 var(--font-fun); color: color-mix(in srgb, var(--k, var(--brand)) 60%, var(--ink)); }
.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); }

/* 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; } }

/* ───── 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; }
