/* ==========================================================
   exam.css – Luyện thi HSK online (thi-thu.html)
   Trang chọn cấp / danh sách đề: nền tối · Xác nhận dự thi, phòng thi, kết quả: nền sáng, điểm nhấn đỏ
   ========================================================== */
/* Màu theo hệ thống (site.css): xanh thương hiệu + vàng lúa. Các trang danh sách, lịch sử, thống kê dùng nền sáng. */
.xp-body { --xr: var(--brand); --xr-d: var(--brand-dark); --xr-50: var(--brand-50); --xr-100: var(--brand-100);
  --dk: var(--bg); --dk-2: #fff; --dk-3: var(--brand-50); --dk-line: var(--line); --dk-ink: var(--ink); --dk-mute: var(--ink-3); background: var(--bg); }
.xp { min-height: calc(100vh - 140px); padding: 28px 0 56px; }
.xp-wrap { width: min(1380px, calc(100% - 32px)); margin: 0 auto; }
body.xp-dark { background: var(--dk); color: var(--dk-ink); }

.xp-muted { color: #94a3b8; }
.xp-empty { padding: 40px 20px; text-align: center; border: 1.5px dashed var(--dk-line); border-radius: 14px; color: var(--dk-mute); }
body:not(.xp-dark) .xp-empty { border-color: #e2e8f0; color: #64748b; background: #fff; }

/* ---------- Tiêu đề + nút ---------- */
.xp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.xp-head h1 { margin: 0; font-size: 1.75rem; font-weight: 800; letter-spacing: -.01em; }
.xp-head p { margin: 4px 0 0; color: var(--dk-mute); font-size: .95rem; }
.xp-head-acts { display: flex; gap: 10px; }
.xp-btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 10px; font-weight: 700; font-size: .9rem; color: #fff !important;
  text-decoration: none !important; box-shadow: 0 4px 0 rgba(0,0,0,.28); transition: transform .1s, box-shadow .1s; }
.xp-btn svg { width: 16px; height: 16px; }
.xp-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.28); }
.xp-btn.orange { background: #f59e0b; } .xp-btn.green { background: #16a34a; }
.xp-crumb { margin-bottom: 14px; }
.xp-crumb a { display: inline-flex; align-items: center; gap: 6px; color: var(--dk-mute); font-weight: 600; font-size: .9rem; }
.xp-crumb a:hover { color: var(--brand); text-decoration: none; }
.xp-crumb svg { width: 16px; height: 16px; }

/* ---------- 6 thẻ cấp HSK ---------- */
.xp-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.xp-lv { position: relative; overflow: hidden; display: grid; grid-template-rows: auto auto auto auto; padding: 22px 22px 18px; border-radius: 16px;
  background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--c1) 22%, transparent), transparent 55%), var(--dk-2);
  border: 2px solid color-mix(in srgb, var(--c1) 70%, transparent); box-shadow: 0 5px 0 color-mix(in srgb, var(--c1) 55%, #000);
  color: var(--dk-ink) !important; text-decoration: none !important; transition: transform .15s, box-shadow .15s; }
.xp-lv::before { content: ""; position: absolute; width: 110px; height: 110px; border-radius: 50%; right: -30px; top: -42px; background: linear-gradient(135deg, var(--c1), var(--c2)); }
.xp-lv:hover { transform: translateY(-3px); box-shadow: 0 8px 0 color-mix(in srgb, var(--c1) 55%, #000); }
.xp-lv-k { font-size: .78rem; font-weight: 800; letter-spacing: .14em; color: var(--dk-mute); }
.xp-lv b { font-size: 4rem; line-height: 1; font-weight: 800; margin: 2px 0 10px; background: linear-gradient(180deg, var(--c2), var(--c1)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.xp-lv-m, .xp-lv-s { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: .95rem; color: #d6d3d1; }
.xp-lv-s { font-size: .82rem; font-weight: 600; color: var(--dk-mute); margin-top: 4px; }
.xp-lv svg { width: 15px; height: 15px; }
.xp-go { position: absolute; right: 20px; bottom: 22px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 6px 16px -6px var(--c1); }
.xp-go svg { width: 18px; height: 18px; }
.xp-info { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 20px; margin-top: 26px; padding: 16px 18px; border: 1px solid var(--dk-line); border-radius: 12px; background: var(--dk-2); }
.xp-info div { display: flex; gap: 8px; font-size: .84rem; color: var(--dk-mute); }
.xp-info b { color: var(--dk-ink); min-width: 52px; }

/* ---------- Danh sách đề ---------- */
.xp-exams, .xp-hist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.xp-exam { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; background: var(--dk-2); border: 1.5px solid var(--dk-line);
  box-shadow: 0 4px 14px -10px rgba(15, 34, 87, .25); color: var(--dk-ink) !important; text-decoration: none !important; }
a.xp-exam:hover, .xp-exam:hover { border-color: var(--brand-100); }
.xp-exam-b { flex: 1; min-width: 0; display: grid; gap: 6px; }
.xp-exam-t { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.xp-exam-t b { font-size: .98rem; }
.xp-tag { font-size: .72rem; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); border-radius: 6px; padding: 3px 8px; }
.xp-free, .xp-mem, .xp-fail { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; border-radius: 999px; padding: 3px 10px; display: inline-flex; align-items: center; gap: 4px; }
.xp-free { background: #16a34a; color: #fff; }
.xp-mem { background: var(--gold); color: #3b2a00; }
.xp-fail { background: #dc2626; color: #fff; }
.xp-mem svg { width: 11px; height: 11px; }
.xp-best { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; color: #fbbf24; }
.xp-best svg { width: 13px; height: 13px; }
.xp-exam-m { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--dk-mute); }
.xp-exam-m span { display: inline-flex; align-items: center; gap: 5px; }
.xp-exam-m svg { width: 14px; height: 14px; }
.xp-done { color: var(--ok); }
.xp-view { flex-shrink: 0; padding: 10px 16px; border-radius: 12px; border: 1.5px solid #57534e; color: var(--dk-ink) !important; font-weight: 800; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .06em; text-decoration: none !important; background: #1f1b19; }
.xp-view:hover { border-color: var(--xr); background: var(--xr); }
.xp-score { font-size: 1.4rem; font-weight: 800; color: var(--brand); white-space: nowrap; }
.xp-score small { font-size: .8rem; color: var(--dk-mute); }
.xp-pager { display: flex; gap: 8px; justify-content: center; margin-top: 22px; }
.xp-pager a { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--dk-2); color: var(--dk-ink); font-weight: 700; text-decoration: none; }
.xp-pager a.on { background: var(--xr); color: #fff; }

/* ---------- Thẻ trắng chung ---------- */
.xp-card { background: #fff; border: 1px solid #ececec; border-radius: 16px; box-shadow: 0 10px 30px -18px rgba(15,23,42,.25); color: #1c2536; }
.xp-btn-r, .xp-btn-o { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 10px; font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: none !important; transition: background .15s; }
.xp-btn-r { background: var(--xr); color: #fff !important; border: 0; box-shadow: 0 8px 20px -10px var(--xr); }
.xp-btn-r:hover { background: var(--xr-d); }
.xp-btn-r:disabled { background: #a9b8dc; box-shadow: none; cursor: not-allowed; }
.xp-btn-o { background: #fff; color: var(--xr) !important; border: 1.5px solid var(--xr); }
.xp-btn-o:hover { background: var(--xr-50); }
.xp-btn-o:disabled { opacity: .45; cursor: not-allowed; }
.xp-btn-r svg, .xp-btn-o svg { width: 16px; height: 16px; }
.xp-btn-r.sm, .xp-btn-o.sm { padding: 8px 14px; font-size: .88rem; }
.xp-btn-r.block { width: 100%; }
.xp-btn-r.xl { width: 100%; padding: 16px; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Xác nhận dự thi ---------- */
.xp-confirm { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 20px; align-items: start; max-width: 1100px; }
.xp-ready { overflow: hidden; }
.xp-ready-h { background: linear-gradient(180deg, var(--xr), var(--xr-d)); color: #fff; text-align: center; padding: 22px 20px; }
.xp-ready-h small { display: block; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .76rem; opacity: .9; }
.xp-ready-h h2 { margin: 6px 0 0; font-size: 1.5rem; color: #fff; }
.xp-ready-b { padding: 20px 24px 24px; display: grid; gap: 14px; }
.xp-pill { text-align: center; font-weight: 800; color: var(--xr); background: var(--xr-50); border: 1px solid var(--xr-100); border-radius: 10px; padding: 10px 14px; text-transform: uppercase; }
.xp-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.xp-3 > div { display: grid; justify-items: center; gap: 2px; padding: 14px 8px; border: 1px solid #ececec; border-radius: 12px; }
.xp-3 svg { width: 22px; height: 22px; color: var(--xr); }
.xp-3 b { font-size: 1.5rem; color: #0f172a; }
.xp-3 small { color: #64748b; font-size: .8rem; }
.xp-ready-b h4 { margin: 4px 0 -4px; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #64748b; }
.xp-secs { display: grid; gap: 6px; }
.xp-secs div { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid #f1f1f1; border-radius: 10px; background: #fafafa; }
.xp-secs span { width: 24px; height: 24px; border-radius: 50%; background: var(--xr); color: #fff; display: grid; place-items: center; font-size: .78rem; font-weight: 800; }
.xp-secs b { flex: 1; font-size: .9rem; }
.xp-secs em { font-style: normal; color: #64748b; font-size: .82rem; }
.xp-who { margin: 0; border: 1px solid #ececec; border-radius: 12px; overflow: hidden; }
.xp-who div { display: grid; grid-template-columns: 170px minmax(0, 1fr); padding: 10px 14px; border-bottom: 1px solid #f3f3f3; font-size: .9rem; }
.xp-who div:last-child { border-bottom: 0; }
.xp-who dt { display: flex; align-items: center; gap: 8px; color: #64748b; }
.xp-who dt svg { width: 15px; height: 15px; }
.xp-who dd { margin: 0; font-weight: 600; word-break: break-word; }
.xp-who dd b { color: var(--xr); }
.xp-note { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 10px; background: #f8fafc; font-size: .9rem; }
.xp-note svg { width: 18px; height: 18px; }
.xp-check { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; font-size: .88rem; }
.xp-check li { display: flex; align-items: center; gap: 8px; }
.xp-check svg { width: 18px; height: 18px; color: #fff; background: #22c55e; border-radius: 50%; padding: 3px; flex-shrink: 0; }
.xp-warn { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: .88rem; }
.xp-warn svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.xp-warn.red { background: var(--xr-50); border-color: var(--xr-100); color: var(--xr-d); }
.xp-mine { margin: 0; font-size: .86rem; color: #475569; }
.xp-ready-f { display: grid; grid-template-columns: auto 1fr; gap: 12px; margin-top: 4px; }
.xp-top { padding: 18px 18px 14px; position: sticky; top: 80px; }
.xp-top h3 { margin: 0 0 12px; display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.xp-top h3 svg { width: 20px; height: 20px; color: #f59e0b; }
.xp-rank { display: grid; grid-template-columns: 26px 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 10px; }
.xp-rank.me { background: var(--xr-50); }
.xp-rank .n { font-weight: 800; color: #94a3b8; text-align: center; }
.xp-rank .n.r1 { color: #f59e0b; } .xp-rank .n.r2 { color: #94a3b8; } .xp-rank .n.r3 { color: #b45309; }
.xp-rank .av, .xp-me .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #3b2a00; font-weight: 800; }
.xp-rank b { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-rank small { color: #94a3b8; font-size: .76rem; }
.xp-rank em { font-style: normal; font-weight: 800; color: #fff; background: var(--xr); border-radius: 8px; padding: 4px 9px; font-size: .86rem; }
.xp-top .small { margin: 10px 0 0; font-size: .76rem; }

/* ---------- Phòng chờ ---------- */
body.xp-room .site-header, body.xp-room .site-footer { display: none; }
body.xp-room { background: #f4f4f5; }
body.xp-room .xp { padding: 0; min-height: 100vh; }
.xp-lobby { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }
.xp-lobby-c { width: min(520px, 100%); overflow: hidden; }
.xp-lobby-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; background: linear-gradient(180deg, var(--xr-50), #fff); border-bottom: 1px solid #f1f1f1; }
.xp-lobby-h small { display: block; font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #64748b; }
.xp-lobby-h b { font-size: 1.05rem; }
.xp-lobby-h .sbd { text-align: right; }
.xp-lobby-h .sbd b { color: var(--xr); font-size: 1.5rem; letter-spacing: .04em; }
.xp-lobby-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid #f1f1f1; }
.xp-lobby-3 div { padding: 12px 16px; border-right: 1px solid #f1f1f1; }
.xp-lobby-3 div:last-child { border-right: 0; }
.xp-lobby-3 small { display: block; color: #64748b; font-size: .74rem; }
.xp-lobby-3 b { font-size: .86rem; text-transform: uppercase; }
.xp-count { text-align: center; padding: 18px 20px 6px; }
.xp-count small { color: #64748b; }
.xp-count b { display: block; font-size: 3.4rem; font-weight: 800; color: var(--xr); letter-spacing: .02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.xp-count p { margin: 4px auto 0; max-width: 300px; font-size: .84rem; color: #64748b; }
.xp-struct-h { display: flex; justify-content: space-between; padding: 10px 22px 6px; font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #64748b; }
.xp-struct-h b { color: #0f172a; }
.xp-struct { display: grid; gap: 10px; padding: 4px 22px 10px; position: relative; }
.xp-struct > div { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: center; position: relative; }
.xp-struct > div:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 34px; height: calc(100% - 22px); width: 2px; background: #e5e7eb; }
.xp-struct .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid #e5e7eb; background: #fff; font-weight: 800; color: #64748b; font-size: .86rem; z-index: 1; }
.xp-struct .n svg { width: 14px; height: 14px; }
.xp-struct .b { display: grid; gap: 2px; padding: 10px 92px 10px 14px; border: 1px solid #ececec; border-radius: 12px; background: #fafafa; }
.xp-struct .b b { font-size: .92rem; }
.xp-struct .b small { display: flex; align-items: center; gap: 6px; color: #64748b; font-size: .78rem; }
.xp-struct .b small svg { width: 13px; height: 13px; }
.xp-struct em { position: absolute; right: 12px; font-style: normal; font-size: .72rem; font-weight: 700; color: #64748b; background: #f1f5f9; border-radius: 999px; padding: 3px 10px; }
.xp-struct .cur .n { background: var(--xr); border-color: var(--xr); color: #fff; }
.xp-struct .cur .b { border-color: var(--brand-100); background: linear-gradient(90deg, var(--xr-50), #fff); }
.xp-struct .cur em { background: var(--xr-100); color: var(--xr-d); }
.xp-struct .done .n { background: #22c55e; border-color: #22c55e; color: #fff; }
.xp-struct .done em { background: #dcfce7; color: #15803d; }
.xp-tip { display: flex; align-items: center; gap: 8px; margin: 4px 22px; padding: 10px 12px; border-radius: 10px; background: #eef3fc; color: #1f3c88; font-size: .84rem; }
.xp-tip svg { width: 18px; height: 18px; flex-shrink: 0; }
.xp-rule { margin: 8px 22px; text-align: center; font-size: .8rem; color: #64748b; }
.xp-rule b { color: var(--xr); }
.xp-lobby-c > .xp-btn-r.xl { width: calc(100% - 44px); margin: 6px 22px 10px; }
.xp-exit { display: block; text-align: center; font-size: .8rem; color: #94a3b8; margin: 0 0 16px; }

/* ---------- Phòng thi ---------- */
.xp-roomwrap { min-height: 100vh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.xp-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 10px max(16px, calc((100% - 1380px) / 2)); background: #fff; border-bottom: 1px solid #ececec; }
.xp-bar .logo-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--xr); color: #fff; font-family: var(--font-hanzi); font-weight: 700; }
.xp-bar b { font-size: .98rem; }
.xp-timer { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; background: var(--xr-50); color: var(--xr); font-weight: 800; font-variant-numeric: tabular-nums; }
.xp-timer svg { width: 16px; height: 16px; }
body.xp-hurry .xp-timer, body.xp-hurry .xp-left b { animation: xpBlink 1s steps(2) infinite; }
@keyframes xpBlink { 50% { opacity: .45; } }
.xp-roombody { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; padding: 14px max(16px, calc((100% - 1380px) / 2)); align-items: start; }
.xp-stage { background: #fff; border: 1px solid #ececec; border-radius: 14px; min-height: calc(100vh - 160px); max-height: calc(100vh - 150px); overflow: auto; }
.xp-audio { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #eef3fc; border-bottom: 1px solid #dbe6f8; font-weight: 600; color: #1f3c88; font-size: .88rem; }
.xp-audio svg { width: 18px; height: 18px; }
.xp-audio audio { margin-left: auto; height: 34px; max-width: 60%; }
.xp-page { padding: 18px 20px; }
.xp-page.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 12px; }
.xp-passage { background: #eef0ff; border-radius: 10px; padding: 16px 18px; max-height: calc(100vh - 200px); overflow: auto; font-size: 1rem; line-height: 1.9; font-family: "Noto Sans SC", var(--font); }
.xp-passage h4 { text-align: center; margin: 0 0 10px; }
.xp-qcol { display: grid; gap: 12px; align-content: start; }
.xp-page.split .xp-qcol { max-height: calc(100vh - 200px); overflow: auto; padding-right: 4px; }
.xp-q { padding: 4px 0 14px; border-bottom: 1px solid #f1f1f1; display: grid; gap: 10px; scroll-margin-top: 60px; }
.xp-q:last-child { border-bottom: 0; }
.xp-q-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.xp-q-h b { color: var(--xr); font-size: .98rem; }
.xp-flag { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #e5e7eb; background: #fff; border-radius: 8px; padding: 5px 10px; font: inherit; font-size: .8rem; color: #64748b; cursor: pointer; }
.xp-flag svg { width: 14px; height: 14px; }
.xp-flag.on { background: #fef3c7; border-color: #f59e0b; color: #b45309; }
.xp-qtext { font-size: 1.05rem; line-height: 1.8; font-family: "Noto Sans SC", var(--font); }
.xp-img { max-width: min(420px, 100%); max-height: 260px; border-radius: 10px; border: 1px solid #ececec; }
.xp-img.sm { max-height: 120px; }
.xp-q audio { height: 36px; max-width: 100%; }
.xp-opts { display: grid; gap: 8px; }
.xp-opts.pics { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.xp-opt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1.5px solid #ececec; border-radius: 10px; cursor: pointer; font-weight: 500; margin: 0;
  font-family: "Noto Sans SC", var(--font); font-size: 1rem; transition: border-color .12s, background .12s; }
.xp-opt:hover { border-color: var(--brand-100); }
.xp-opt.on { border-color: var(--xr); background: var(--xr-50); }
.xp-opt input { width: 18px; height: 18px; accent-color: var(--xr); flex-shrink: 0; margin: 0; }
.xp-opt b { color: #334155; }
.xp-opt img { max-width: 100%; max-height: 120px; border-radius: 8px; }
/* Lựa chọn là tranh: thẻ đều nhau, ký hiệu đè góc trên trái, tranh căn giữa */
.xp-opts.pics { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.xp-opts.pics .xp-opt { position: relative; flex-direction: column; align-items: stretch; gap: 6px; padding: 34px 10px 10px; background: #fff; }
.xp-opts.pics .xp-opt input { position: absolute; top: 10px; right: 10px; }
.xp-opts.pics .xp-opt b { position: absolute; top: 8px; left: 10px; }
.xp-opts.pics .xp-opt img { width: 100%; height: 130px; max-height: none; object-fit: contain; }
.xp-opts.pics .xp-opt span { text-align: center; }
.xp-keys { display: flex; gap: 8px; flex-wrap: wrap; }
.xp-keys label { width: 46px; height: 42px; display: grid; place-items: center; border: 1.5px solid #e5e7eb; border-radius: 10px; font-weight: 800; cursor: pointer; margin: 0; position: relative; }
.xp-keys label input { position: absolute; opacity: 0; pointer-events: none; }
.xp-keys label.on { background: var(--xr); border-color: var(--xr); color: #fff; }
.xp-gopts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; padding: 12px; border: 1px dashed #c7d2fe; border-radius: 12px; background: #f8f9ff; }
.xp-gopts div { display: flex; gap: 8px; align-items: flex-start; font-family: "Noto Sans SC", var(--font); }
.xp-gopts b { width: 24px; height: 24px; flex-shrink: 0; border-radius: 6px; background: var(--xr); color: #fff; display: grid; place-items: center; font-size: .8rem; }
.xp-gopts img { max-width: 100%; max-height: 110px; border-radius: 8px; }
/* Bộ tranh A–F dùng chung: lưới thẻ đều nhau (3 cột trên màn rộng), ký hiệu nằm trong thẻ ở góc trên trái */
.xp-gopts.pics { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.xp-gopts.pics > div { position: relative; flex-direction: column; align-items: stretch; justify-content: center; gap: 6px; min-height: 150px;
  padding: 10px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.xp-gopts.pics > div > b { position: absolute; top: 8px; left: 8px; z-index: 1; width: 28px; height: 28px; font-size: .9rem; box-shadow: 0 2px 6px rgba(31, 60, 136, .25); }
.xp-gopts.pics img { width: 100%; height: 130px; max-height: none; object-fit: contain; }
.xp-gopts.pics span { text-align: center; }
@media (min-width: 1100px) { .xp-gopts.pics { grid-template-columns: repeat(3, 1fr); } }
/* Pinyin trên chữ Hán (HSK 1–2) */
/* Mỗi từ 1 khối: pinyin căn giữa phía trên, các từ cách nhau như đề in (VD: Zuótiān wánr de → 昨天 玩儿 得) */
.xp-body ruby { ruby-position: over; ruby-align: center; margin: 0 .16em; }
.xp-body rt { font-family: Arial, "Be Vietnam Pro", sans-serif; font-size: .58em; color: #334155; font-weight: 400; letter-spacing: 0; line-height: 1.1; padding-bottom: .1em; }
body.xp-nopy ruby { margin: 0; }
.xp-qtext:has(ruby), .xp-opt span:has(ruby), .xp-gopts span:has(ruby), .xp-passage div:has(ruby) { line-height: 2.3; }
body.xp-nopy rt { display: none; }
body.xp-nopy .xp-qtext:has(ruby), body.xp-nopy .xp-opt span:has(ruby), body.xp-nopy .xp-gopts span:has(ruby) { line-height: 1.8; }
.xp-pybtn { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1.5px solid #e2e8f0; border-radius: 8px; background: #fff;
  color: #475569; font-weight: 700; font-size: .85rem; cursor: pointer; }
.xp-pybtn i { position: relative; width: 30px; height: 17px; border-radius: 99px; background: #cbd5e1; transition: background .15s; }
.xp-pybtn i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform .15s; }
.xp-pybtn.on { border-color: var(--xr-100); color: var(--xr); }
.xp-pybtn.on i { background: var(--xr); }
.xp-pybtn.on i::after { transform: translateX(13px); }
.xp-pybtn + .xp-timer { margin-left: 0; }
.xp-hint { color: #64748b; font-size: .84rem; margin: 0; }
.xp-fill { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 0; }
.xp-fill input { max-width: 260px; font-family: "Noto Sans SC", var(--font); font-size: 1.05rem; }
.xp-essay { width: 100%; font-family: "Noto Sans SC", var(--font); font-size: 1.05rem; line-height: 1.8; }
.xp-tf { border-collapse: collapse; width: 100%; max-width: 640px; }
.xp-tf th, .xp-tf td { border: 1px solid #e5e7eb; padding: 8px 12px; }
.xp-tf th { background: #f8fafc; }
.xp-tf td:not(:first-child), .xp-tf th:not(:first-child) { width: 64px; text-align: center; }
.xp-tf input { width: 18px; height: 18px; accent-color: var(--xr); }
.xp-order, .xp-dfill { display: grid; gap: 12px; }
.xp-line { min-height: 54px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border: 2px dashed var(--brand-100); border-radius: 12px; background: var(--xr-50); }
.xp-line em { color: #94a3b8; font-size: .86rem; }
.xp-bank { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border: 1px dashed #a9c1ef; border-radius: 12px; background: #f8fbff; min-height: 52px; }
.xp-chip { display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 8px; background: #2f5fd0; color: #fff; font-weight: 600; cursor: grab; user-select: none;
  font-family: "Noto Sans SC", var(--font); font-size: 1rem; }
.xp-chip.on { background: var(--xr); }
.xp-chip.used { opacity: .35; }
.xp-chip.sel { outline: 3px solid #f59e0b; outline-offset: 2px; }
.xp-dfill p { margin: 0; line-height: 2.4; font-family: "Noto Sans SC", var(--font); font-size: 1.05rem; }
.xp-slot { display: inline-block; min-width: 92px; padding: 2px 12px; margin: 0 4px; border: 1.5px solid #94a3b8; border-radius: 8px; text-align: center; cursor: pointer; background: #fff; line-height: 1.7; }
.xp-slot.on { background: #2f5fd0; color: #fff; border-color: #2f5fd0; }
.xp-side { display: grid; gap: 12px; position: sticky; top: 70px; }
.xp-me { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.xp-me b { display: block; font-size: .92rem; }
.xp-me small { color: #64748b; } .xp-me em { font-style: normal; color: var(--xr); font-weight: 800; }
.xp-nav { padding: 14px; display: grid; gap: 10px; }
.xp-left { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--xr-50); }
.xp-left span { font-size: .84rem; color: #64748b; }
.xp-left b { font-size: 1.3rem; color: var(--xr); font-variant-numeric: tabular-nums; }
.xp-nav-h { display: flex; justify-content: space-between; font-size: .88rem; }
.xp-nav-h span { color: var(--xr); font-weight: 800; }
.xp-progress { height: 5px; border-radius: 999px; background: #f1f1f1; overflow: hidden; }
.xp-progress i { display: block; height: 100%; background: var(--xr); }
.xp-legend { display: flex; gap: 12px; font-size: .74rem; color: #64748b; }
.xp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #cbd5e1; margin-right: 4px; vertical-align: -1px; }
.xp-legend i.d { background: var(--xr); border-color: var(--xr); } .xp-legend i.f { border-color: #f59e0b; background: #fef3c7; }
.xp-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; max-height: 260px; overflow: auto; padding: 2px; }
.xp-grid button { height: 34px; border-radius: 8px; border: 1.5px solid #e5e7eb; background: #fff; font: inherit; font-size: .8rem; font-weight: 600; color: #475569; cursor: pointer; }
.xp-grid button.d { background: var(--xr); border-color: var(--xr); color: #fff; }
.xp-grid button.f { border-color: #f59e0b; box-shadow: inset 0 0 0 1px #f59e0b; }
.xp-grid button.d.f { box-shadow: inset 0 0 0 2px #fde68a; }
.xp-grid button.cur { outline: 2px solid #0f172a; outline-offset: 1px; }
.xp-saved { color: #94a3b8; font-size: .74rem; text-align: center; min-height: 1em; }
.xp-foot { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px max(16px, calc((100% - 1380px) / 2)); background: #fff; border-top: 1px solid #ececec; font-size: .9rem; color: #64748b; }
.xp-foot > div { display: flex; gap: 10px; }
.xp-foot b { color: var(--xr); font-variant-numeric: tabular-nums; }

/* ---------- Xác nhận nộp bài ---------- */
.xp-modal { position: fixed; inset: 0; z-index: 100; background: rgba(15,23,42,.5); display: grid; place-items: center; padding: 16px; }
.xp-modal-c { position: relative; width: min(440px, 100%); background: #fff; border-radius: 16px; padding: 28px 26px 24px; text-align: center; box-shadow: 0 30px 60px -20px rgba(0,0,0,.4); }
.xp-modal-c .x { position: absolute; right: 14px; top: 14px; width: 30px; height: 30px; border: 0; background: none; cursor: pointer; color: #64748b; }
.xp-modal-c h3 { margin: 0 0 8px; font-size: 1.5rem; }
.xp-ring { width: 170px; height: 170px; display: block; margin: 6px auto; }
.xp-ring circle { fill: none; stroke-width: 14; }
.xp-ring .bg { stroke: #ececec; }
.xp-ring .fg { stroke: var(--brand); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 80px 80px; transition: stroke-dashoffset .6s; }
.xp-ring .t1 { font-size: 30px; font-weight: 800; fill: #0f172a; font-family: var(--font); }
.xp-ring .t2 { font-size: 13px; font-weight: 600; fill: #475569; font-family: var(--font); }
.xp-modal-c p { margin: 8px 0 18px; font-size: 1.02rem; color: #334155; }
.xp-modal-c p small { color: #94a3b8; }
.xp-modal-f { display: flex; justify-content: center; gap: 14px; }
.xp-modal-f button { min-width: 140px; }

/* ---------- Kết quả ---------- */
.xp-result { display: grid; gap: 18px; max-width: 1100px; }
.xp-res-h { display: grid; grid-template-columns: 240px minmax(0, 1fr); overflow: hidden; }
.xp-res-score { display: grid; place-content: center; justify-items: center; gap: 4px; padding: 24px; color: #fff; text-align: center; background: linear-gradient(160deg, #16a34a, #15803d); }
.xp-res-h.fail .xp-res-score { background: linear-gradient(160deg, var(--xr), var(--xr-d)); }
.xp-res-score small { font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: .76rem; opacity: .9; }
.xp-res-score b { font-size: 3.2rem; line-height: 1; font-weight: 800; }
.xp-res-score b span { font-size: 1.2rem; opacity: .8; }
.xp-res-score em { font-style: normal; font-size: .82rem; font-weight: 700; }
.xp-res-info { padding: 20px 24px; display: grid; gap: 10px; }
.xp-res-info h2 { margin: 0; font-size: 1.3rem; }
.xp-res-info p { margin: 0; color: #64748b; }
.xp-res-meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: .88rem; color: #334155; font-weight: 600; }
.xp-res-meta span { display: inline-flex; align-items: center; gap: 6px; }
.xp-res-meta svg { width: 16px; height: 16px; color: var(--xr); }
.xp-skills { display: grid; gap: 8px; }
.xp-skills > div { display: grid; grid-template-columns: 90px minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: .88rem; }
.xp-skills .bar { height: 10px; border-radius: 999px; background: #f1f1f1; overflow: hidden; }
.xp-skills .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--gold)); border-radius: 999px; }
.xp-skills b { text-align: right; }
.xp-res-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.xp-review { padding: 18px 22px; }
.xp-review-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.xp-review-h h3 { margin: 0; }
.xp-filter { display: flex; gap: 6px; }
.xp-filter button { border: 1px solid #e5e7eb; background: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; }
.xp-filter button.on { background: var(--xr); border-color: var(--xr); color: #fff; }
.xp-rv-skill { margin: 18px 0 6px; color: var(--xr); }
.xp-rv { display: grid; grid-template-columns: 40px minmax(0, 1fr) 30px; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f3f3f3; align-items: start; }
.xp-rv-n { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; background: #f1f5f9; }
.xp-rv.right .xp-rv-n { background: #dcfce7; color: #15803d; } .xp-rv.wrong .xp-rv-n { background: #fee2e2; color: #b91c1c; } .xp-rv.wait .xp-rv-n { background: #fef3c7; color: #b45309; }
.xp-rv-b { display: grid; gap: 6px; font-size: .92rem; min-width: 0; }
.xp-rv-a span, .xp-rv-k span { color: #64748b; font-weight: 600; }
.xp-rv-k { color: #15803d; }
.xp-rv-e { background: #f8fafc; border-left: 3px solid #94a3b8; border-radius: 6px; padding: 8px 10px; font-size: .86rem; color: #334155; }
.xp-rv-s svg { width: 22px; height: 22px; }
.xp-rv.right .xp-rv-s { color: #16a34a; } .xp-rv.wrong .xp-rv-s { color: #dc2626; } .xp-rv.wait .xp-rv-s { color: #f59e0b; }
.xp-essay-view { white-space: pre-wrap; background: #fffbeb; border-radius: 8px; padding: 8px 10px; font-family: "Noto Sans SC", var(--font); }

/* ---------- Thống kê ---------- */
.xp-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.xp-stats div { background: var(--dk-2); border: 1px solid var(--dk-line); border-radius: 14px; padding: 16px; display: grid; gap: 4px; }
.xp-stats small { color: var(--dk-mute); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.xp-stats b { font-size: 1.7rem; font-weight: 800; }
.xp-table { overflow-x: auto; border: 1px solid var(--dk-line); border-radius: 14px; background: var(--dk-2); }
.xp-table table { width: 100%; border-collapse: collapse; }
.xp-table th, .xp-table td { padding: 12px 14px; border-bottom: 1px solid var(--dk-line); text-align: left; font-size: .9rem; white-space: nowrap; }
.xp-table th { color: var(--dk-mute); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
.xp-sbar { position: relative; width: 120px; height: 18px; border-radius: 999px; background: var(--dk-3); overflow: hidden; }
.xp-sbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--brand), #4a7be6); }
.xp-sbar b { position: relative; display: block; text-align: center; font-size: .74rem; line-height: 18px; color: var(--ink); }
.xp-h3 { margin: 24px 0 12px; }
.xp-recent { display: grid; gap: 8px; }
.xp-recent a { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; background: var(--dk-2); color: var(--dk-ink); text-decoration: none; }
.xp-recent span { font-size: .76rem; font-weight: 800; color: var(--dk-mute); }
.xp-recent b { flex: 1; font-size: .9rem; }
.xp-recent em { font-style: normal; font-weight: 800; color: var(--danger); }
.xp-recent em.ok { color: var(--ok); }

/* ---------- Phòng thi lấp đầy màn hình (toàn màn hình) ---------- */
body.xp-room, body.xp-room .xp { background: #eef1f6; }
.xp-roomwrap { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.xp-bar, .xp-foot { padding-left: 20px; padding-right: 20px; }
.xp-roombody { grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; padding: 14px 20px; align-items: stretch; min-height: 0; }
.xp-stage { height: 100%; min-height: 0; max-height: none; box-sizing: border-box; }
.xp-page { box-sizing: border-box; }
.xp-page.split { height: 100%; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.xp-passage, .xp-page.split .xp-qcol { max-height: none; height: 100%; box-sizing: border-box; overflow: auto; }
.xp-side { position: static; min-height: 0; overflow: auto; align-content: start; }
.xp-grid { max-height: none; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.xp-grid button { min-width: 0; }
:fullscreen body, body:fullscreen { overflow: hidden; }
/* Cảnh báo thoát toàn màn hình */
.xp-guard { z-index: 200; background: rgba(15, 23, 42, .72); backdrop-filter: blur(3px); }
.xp-guard-c { width: min(460px, 100%); }
.xp-guard-i { width: 58px; height: 58px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: #fef2f2; color: #dc2626; }
.xp-guard-i.ok { background: var(--xr-50); color: var(--xr); }
.xp-guard-i svg { width: 28px; height: 28px; }
.xp-guard-bar { display: flex; justify-content: center; gap: 8px; margin: 4px 0 6px; }
.xp-guard-bar i { width: 46px; height: 8px; border-radius: 99px; background: #e2e8f0; }
.xp-guard-bar i.on { background: #dc2626; }
.xp-modal-c p.xp-guard-n { font-size: .92rem; color: #64748b; }

@media (max-width: 1100px) {
  .xp-roombody { grid-template-columns: minmax(0, 1fr); }
  .xp-side { position: static; order: -1; }
  .xp-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); max-height: 120px; }
  .xp-stage { max-height: none; min-height: 0; }
  .xp-page.split { grid-template-columns: minmax(0, 1fr); }
  .xp-passage, .xp-page.split .xp-qcol { max-height: none; height: auto; }
  .xp-roomwrap { height: auto; min-height: 100vh; overflow: visible; }
  .xp-stage, .xp-page.split { height: auto; }
  .xp-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); max-height: 120px; }
  .xp-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .xp-levels, .xp-info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xp-exams, .xp-hist { grid-template-columns: minmax(0, 1fr); }
  .xp-confirm { grid-template-columns: minmax(0, 1fr); }
  .xp-top { position: static; }
  .xp-res-h { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .xp-levels, .xp-info { grid-template-columns: minmax(0, 1fr); }
  .xp-check { grid-template-columns: minmax(0, 1fr); }
  .xp-who div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .xp-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .xp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xp-foot { flex-direction: column; align-items: stretch; }
  .xp-foot > div { justify-content: space-between; }
}


/* ==========================================================
   DANH SÁCH ĐỀ (bố cục thanh lọc + khu theo cấp + thẻ đề)
   ========================================================== */
.xp-top-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.xp-top-h h1 { margin: 0; font-size: 1.6rem; font-weight: 800; color: var(--ink); }
.xp-top-h p { margin: 4px 0 0; color: var(--ink-2); font-size: .92rem; }
.xp-lnk { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  color: var(--ink-2) !important; font-weight: 600; font-size: .88rem; text-decoration: none !important; }
.xp-lnk:hover { border-color: var(--brand); color: var(--brand) !important; }
.xp-lnk svg { width: 16px; height: 16px; }
.xp-filter-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 18px; margin-bottom: 26px; background: #fff;
  border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 18px -12px rgba(15, 34, 87, .25); }
.xp-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.xp-tabs a { padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-size: .9rem;
  text-decoration: none !important; transition: all .15s; }
.xp-tabs a:hover { border-color: var(--brand-100); color: var(--brand); background: var(--brand-50); }
.xp-tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 14px -6px rgba(31, 60, 136, .6); }
.xp-search { position: relative; margin: 0 0 0 auto; width: min(260px, 100%); }
.xp-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-3); }
.xp-search input { width: 100%; height: 40px; padding: 0 12px 0 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font: inherit; font-size: .9rem; }
.xp-search input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-50); }

.xp-sec { margin-bottom: 30px; }
.xp-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.xp-sec-h h2 { position: relative; margin: 0; padding-left: 14px; font-size: 1.35rem; font-weight: 800; color: var(--ink); }
.xp-sec-h h2::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; border-radius: 4px; background: linear-gradient(180deg, var(--brand), var(--gold)); }
.xp-sec-h h2 span { color: var(--ink-2); font-family: var(--font-hanzi); font-weight: 700; }
.xp-sec-h a { color: var(--ink-2); font-weight: 600; font-size: .9rem; }
.xp-sec-h a:hover { color: var(--brand); text-decoration: none; }
.xp-sec-n { color: var(--ink-3); font-size: .86rem; }
.xp-egrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.xp-egrid > .xp-empty { grid-column: 1 / -1; }

.xp-ecard { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  box-shadow: 0 4px 14px -10px rgba(15, 34, 87, .25); transition: transform .15s, box-shadow .15s; }
.xp-ecard:hover { transform: translateY(-3px); box-shadow: 0 14px 28px -16px rgba(15, 34, 87, .4); }
.xp-ecard-h { position: relative; min-height: 96px; padding: 34px 20px 18px; display: flex; align-items: flex-end;
  background: linear-gradient(135deg, var(--brand-50), #fff 80%); border-bottom: 1px solid var(--line-2); }
.xp-ecard-h h3 { margin: 0; font-size: 1.08rem; font-weight: 700; color: var(--ink); line-height: 1.35; }
.xp-lvb { position: absolute; top: 14px; right: 14px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand), #2a4fb8); }
.xp-ecard-b { padding: 16px 20px 18px; display: grid; gap: 12px; flex: 1; }
.xp-ecard-code { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.xp-ecard-code span { font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.xp-ecard-code em { font-style: normal; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 2px 9px; display: inline-flex; align-items: center; gap: 3px; }
.xp-ecard-code em.free { background: var(--ok-soft); color: var(--ok); }
.xp-ecard-code em.mem { background: var(--gold-50); color: var(--gold-600); }
.xp-ecard-code em svg { width: 11px; height: 11px; }
.xp-ecard-m { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.xp-ecard-m > div { display: flex; align-items: center; gap: 10px; }
.xp-ecard-m i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); flex-shrink: 0; }
.xp-ecard-m i svg { width: 16px; height: 16px; }
.xp-ecard-m span { display: grid; font-size: .92rem; color: var(--ink); font-weight: 500; }
.xp-ecard-m small { font-size: .66rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.xp-ecard-s { display: flex; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: .8rem; color: var(--ink-3); }
.xp-ecard-s span { display: inline-flex; align-items: center; gap: 5px; }
.xp-ecard-s svg { width: 14px; height: 14px; }
.xp-ecard-s .best { color: var(--gold-600); font-weight: 700; }
.xp-ecard-go { margin-top: auto; display: block; text-align: center; padding: 11px 16px; border-radius: 12px; font-weight: 700; color: #fff !important; text-decoration: none !important;
  background: linear-gradient(90deg, var(--brand), #2a4fb8); box-shadow: 0 8px 18px -10px rgba(31, 60, 136, .7); transition: filter .15s; }
.xp-ecard-go:hover { filter: brightness(1.1); }
.xp-pager a { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.xp-pager a.on { background: var(--brand); border-color: var(--brand); }
@media (max-width: 720px) {
  .xp-search { margin-left: 0; width: 100%; }
  .xp-filter-bar { padding: 12px; }
}

/* Lọc câu ở trang kết quả: phần tử có thuộc tính hidden phải ẩn (đè display: grid của .xp-rv) */
.xp-body [hidden] { display: none !important; }
.xp-filter button em { font-style: normal; font-size: .74rem; font-weight: 700; margin-left: 4px; padding: 0 7px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); }
.xp-filter button.on em { background: rgba(255,255,255,.25); color: #fff; }
.xp-rv-none { text-align: center; padding: 24px 0; }

/* ---------- Đề được giao cho lớp (trang danh sách) ---------- */
.xp-asg .xp-sec-h h2 { display: flex; align-items: center; gap: 8px; }
.xp-asg .xp-sec-h h2 svg { width: 20px; height: 20px; color: var(--brand); }
.xp-asg-list { display: grid; gap: 10px; }
.xp-asg-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 14px 16px; background: #fff;
  border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 14px; box-shadow: 0 4px 14px -12px rgba(15, 34, 87, .3); }
.xp-asg-row.open { border-left-color: var(--brand); }
.xp-asg-row.soon { border-left-color: var(--gold, #d4a017); }
.xp-asg-row.ok { border-left-color: var(--ok, #16a34a); }
.xp-asg-row.off { opacity: .75; }
.xp-asg-row .xp-lvb { position: static; }
.xp-asg-row .b { display: grid; gap: 3px; min-width: 0; }
.xp-asg-row .b b { font-size: 1rem; color: var(--ink); }
.xp-asg-row .b small { color: var(--ink-2); font-size: .84rem; }
.xp-asg-row .b small b { font-size: inherit; }
.xp-asg-row .b .left { color: var(--danger, #dc2626); }
.xp-asg-row .st { font-style: normal; font-size: .75rem; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: var(--surface-2, #f1f5f9); color: var(--ink-2); white-space: nowrap; }
.xp-asg-row .st.open { background: var(--brand-50); color: var(--brand); }
.xp-asg-row .st.soon { background: #fef3c7; color: #92400e; }
.xp-asg-row .st.ok { background: #dcfce7; color: #166534; }
.xp-asg-row .xp-btn-r.sm, .xp-asg-row .xp-btn-o.sm { padding: 9px 16px; font-size: .88rem; white-space: nowrap; }
.xp-asg-row .xp-btn-r svg, .xp-asg-row .xp-btn-o svg { width: 15px; height: 15px; }
.xp-asg-lock { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: .86rem; white-space: nowrap; }
.xp-asg-lock svg { width: 15px; height: 15px; }
@media (max-width: 720px) {
  .xp-asg-row { grid-template-columns: auto minmax(0, 1fr); }
  .xp-asg-row .st { justify-self: start; }
  .xp-asg-row > a, .xp-asg-row .xp-asg-lock { grid-column: 1 / -1; justify-self: stretch; }
}

/* ---------- Hộp đăng nhập / bổ sung thông tin trước khi thi ---------- */
.xp-gate { width: min(420px, 100%); }
.xp-gate .xp-guard-i { margin-bottom: 8px; }
.xp-gate-acts { display: grid; gap: 10px; margin: 6px 0 12px; }
.xp-gate-acts .block, .xp-btn-o.block { width: 100%; }
.xp-gate-or { display: flex; align-items: center; gap: 10px; color: var(--ink-3, #94a3b8); font-size: .86rem; }
.xp-gate-or::before, .xp-gate-or::after { content: ""; flex: 1; height: 1px; background: var(--line, #e2e8f0); }
.xp-prof { text-align: left; }
.xp-prof h3, .xp-prof > p { text-align: center; }
.xp-prof label { display: grid; gap: 5px; margin-bottom: 12px; font-size: .86rem; font-weight: 700; color: #334155; }
.xp-prof input, .xp-prof select { height: 42px; padding: 0 12px; border: 1px solid var(--line, #e2e8f0); border-radius: 10px; font: inherit; font-weight: 500; background: #fff; }
.xp-prof input:focus, .xp-prof select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.xp-prof-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.xp-prof .xp-modal-f { margin-top: 6px; }

/* ===== Popup điểm sau khi nộp bài + pháo giấy ===== */
.xp-done { --xr: var(--brand, #c62828); position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); animation: xpDoneBg .25s ease; }
.xp-done-c { position: relative; width: min(460px, 100%); background: #fff; color: #0f172a; border-radius: 12px; padding: 28px 26px 24px; text-align: center; box-shadow: 0 40px 80px -24px rgba(0, 0, 0, .45);
  border-top: 6px solid #94a3b8; animation: xpDonePop .35s cubic-bezier(.2, 1.2, .4, 1); }
.xp-done-c.ok { border-top-color: #16a34a; }
.xp-done-c.bad { border-top-color: #dc2626; }
.xp-done-c.wait { border-top-color: #f59e0b; }
.xp-done-c .x { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #f1f5f9; color: #64748b; cursor: pointer; display: grid; place-items: center; }
.xp-done-c .x svg { width: 16px; height: 16px; }
/* Dòng kết luận ĐẠT / KHÔNG ĐẠT ở trên, điểm / tổng điểm ở dưới */
.xp-done-c h3 { margin: 4px 0 8px; font-size: 2rem; font-weight: 800; letter-spacing: .5px; color: #0f172a; }
.xp-done-c h3.ok { color: #16a34a; }
.xp-done-c h3.bad { color: #dc2626; }
.xp-done-c h3.wait { color: #d97706; }
.xp-done-score { display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.xp-done-score b { font-size: 3.1rem; line-height: 1; font-weight: 800; color: #0f172a; letter-spacing: -1px; }
.xp-done-score b small { font-size: 1.1rem; color: #94a3b8; font-weight: 700; letter-spacing: 0; }
.xp-done-c p { margin: 8px 0 12px; color: #475569; font-size: .98rem; }
.xp-done-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.xp-done-meta span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; background: #f1f5f9; color: #334155; font-size: .84rem; font-weight: 600; }
.xp-done-meta svg { width: 15px; height: 15px; }
.xp-done-c p.xp-done-x { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 10px 12px; font-size: .9rem; }
.xp-done-f { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.xp-done-f > * { flex: 1 1 160px; justify-content: center; }
.xp-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 1300; }
@keyframes xpDoneBg { from { opacity: 0; } }
@keyframes xpDonePop { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@media (prefers-reduced-motion: reduce) { .xp-done, .xp-done-c { animation: none !important; } }
/* Bài chưa đạt: khóa xem đáp án */
.xp-locked-rv { display: flex; align-items: flex-start; gap: 14px; padding: 22px 24px; border: 1px dashed #fca5a5; background: #fff7f7; }
.xp-locked-rv .ic { font-size: 1.8rem; line-height: 1; }
.xp-locked-rv h3 { margin: 0 0 6px; font-size: 1.1rem; color: #b91c1c; }
.xp-locked-rv p { margin: 0; color: #475569; }
.xp-done-c p.xp-done-lock { margin: 4px 0 0; font-size: .86rem; color: #b91c1c; }
/* Điểm từng phần thi (chữ nhỏ hơn tổng điểm) */
.xp-done-parts { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 6px; font-size: .9rem; color: #475569; }
.xp-done-parts b { color: #0f172a; font-size: 1rem; }
.xp-res-parts { display: grid; gap: 2px; margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .3); font-size: .82rem; font-weight: 600; opacity: .95; }
.xp-res-parts span { display: block; }
.xp-res-parts b { font-size: .95rem; }
/* Bài thi bị khóa (vi phạm / giáo viên tạm dừng) */
.xp-lock { z-index: 210; background: rgba(15, 23, 42, .82); backdrop-filter: blur(4px); }
.xp-lock-c { width: min(470px, 100%); border-top: 6px solid #dc2626; border-radius: 12px; }
.xp-lock-c h3 { color: #b91c1c; }
.xp-lock-cd { display: grid; justify-items: center; gap: 4px; margin: 6px auto 12px; padding: 12px 16px; max-width: 280px; border-radius: 10px; background: #fef2f2; }
.xp-lock-cd small { color: #991b1b; font-weight: 600; font-size: .82rem; }
.xp-lock-cd b { font-size: 2.4rem; line-height: 1; font-weight: 800; color: #dc2626; font-variant-numeric: tabular-nums; }
.xp-lock-cd i { display: block; width: 100%; height: 6px; border-radius: 99px; background: #fecaca; overflow: hidden; }
.xp-lock-cd em { display: block; height: 100%; background: #dc2626; transition: width 1s linear; }

/* ---------- Thi thử cho khách (app./hsk): banner, form để lại thông tin xem đáp án ---------- */
.xp-guest-ban { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; margin-bottom: 16px; border-radius: 14px;
  background: linear-gradient(120deg, #eef3ff, #fff7e6); border: 1px solid #dbe4ff; color: var(--ink, #1e293b); }
.xp-guest-ban > svg { width: 26px; height: 26px; flex: none; color: var(--brand, #1f3c88); margin-top: 2px; }
.xp-guest-ban b { display: block; font-size: 1rem; margin-bottom: 2px; }
.xp-guest-ban span { font-size: .9rem; color: #475569; line-height: 1.55; }
.xp-guest-ban span b { display: inline; font-size: inherit; margin: 0; color: var(--ink, #1e293b); }
.xp-guest-ban a { color: var(--brand, #1f3c88); font-weight: 700; }
.xp-done-c p.xp-done-lock.guest { color: #b45309; }
.xp-lead { padding: 20px 24px; border: 2px dashed #f5c26b; background: #fffdf7; }
.xp-lead-h { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.xp-lead-h .ic { font-size: 1.8rem; line-height: 1; }
.xp-lead-h h3 { margin: 0 0 4px; font-size: 1.15rem; }
.xp-lead-h p { margin: 0; color: #475569; font-size: .92rem; line-height: 1.55; }
.xp-lead-f { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.xp-lead-f label { display: grid; gap: 5px; font-size: .84rem; font-weight: 700; color: #334155; }
.xp-lead-f input, .xp-lead-f select { height: 44px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; font-weight: 500; background: #fff; }
.xp-lead-f input:focus, .xp-lead-f select:focus { outline: none; border-color: var(--brand, #1f3c88); box-shadow: 0 0 0 3px rgba(31, 60, 136, .15); }
.xp-lead-f button { height: 44px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.xp-lead-f button svg { width: 16px; height: 16px; }
.xp-lead-f > small { grid-column: 1 / -1; }
.xp-lead-ok { display: flex; gap: 12px; align-items: center; color: #166534; }
.xp-lead-ok > svg { width: 30px; height: 30px; flex: none; }
.xp-lead-ok b { display: block; font-size: 1.05rem; }
.xp-lead-ok span { color: #334155; font-size: .92rem; }
.xp-lead:has(.xp-lead-ok) { border-style: solid; border-color: #86efac; background: #f0fdf4; }
@media (max-width: 860px) {
  .xp-lead-f { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .xp-lead-f button { grid-column: 1 / -1; justify-content: center; }
}
@media (max-width: 520px) {
  .xp-lead { padding: 16px; }
  .xp-lead-f { grid-template-columns: minmax(0, 1fr); }
  .xp-guest-ban { padding: 12px 14px; }
}
/* Biểu tượng nét mảnh (đồng bộ hệ thống) */
.xp-locked-rv .ic svg, .xp-lead-h .ic svg { width: 34px; height: 34px; color: var(--brand); }

/* Trang xác nhận: 3 nút cùng 1 hàng */
.xp-ready-f { display: flex; flex-wrap: nowrap; gap: 10px; }
.xp-ready-f > * { flex: 1 1 0; min-width: 0; justify-content: center; white-space: nowrap; }
.xp-ready-f > .xp-btn-r { flex: 1.3 1 0; }
@media (max-width: 520px) { .xp-ready-f { flex-wrap: wrap; } .xp-ready-f > .xp-btn-r { flex-basis: 100%; } }
/* Nút nộp phần thi: bấm = câu tiếp theo, bấm đúp = nộp */
#xpSubmit { user-select: none; display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.2; }
#xpSubmit small { font-size: .68rem; font-weight: 500; opacity: .8; }
#xpSubmit svg { width: 15px; height: 15px; vertical-align: -2px; }