/* exam.css — màn hình làm bài */
.exam {
  position: fixed; inset: 0; display: flex; flex-direction: column; background: #fff; color: var(--ink);
  user-select: none;
}
.ex-rule { height: 2px; flex: none; background: var(--accent); }

/* --- Thanh trên --- */
.ex-top { flex: none; height: 74px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 28px; background: #f3f5fb; }
.ex-top-left { min-width: 0; }
.ex-title { font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-dir-btn { display: inline-flex; align-items: center; gap: 4px; border: none; background: none; padding: 2px 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.ex-dir-btn:hover, .ex-dir-btn.on { color: var(--accent); text-decoration: underline; }
.ex-dir-btn.on .ico { transform: rotate(180deg); }

.ex-timer-box { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 120px; }
.ex-timer { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .5px; line-height: 1.2; height: 28px; }
.ex-timer-icon { display: none; height: 28px; align-items: center; color: var(--muted); }
.ex-timer-box.hidden-time .ex-timer { display: none; }
.ex-timer-box.hidden-time .ex-timer-icon { display: flex; }
.ex-timer-box.warn .ex-timer { color: var(--danger); }
.ex-timer-toggle { border: 1px solid #8a93a5; background: #fff; border-radius: 999px; font-size: 12px; font-weight: 600; padding: 1px 12px; margin-top: 3px; }
.ex-timer-toggle:hover { background: #eef0f4; }
/* Module không tính giờ (đề cá nhân hoá tắt thời gian): chỉ hiện chữ "Untimed", không có nút ẩn/hiện đồng hồ */
.ex-timer-box.untimed .ex-timer { font-size: 15px; font-weight: 600; letter-spacing: 0; color: var(--muted); display: flex; align-items: center; }
.ex-timer-box.untimed .ex-timer-toggle, .ex-timer-box.untimed .ex-timer-icon { display: none; }
.ex-timer-note {
  position: absolute; top: calc(100% + 10px); white-space: nowrap; background: var(--danger); color: #fff; font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 8px; z-index: 50; box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}

.ex-tools { display: flex; justify-content: flex-end; gap: 6px; }
.ex-tool {
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 68px; padding: 5px 8px 4px;
  border: none; background: none; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.ex-tool:hover { background: #e3e7f2; }
.ex-tool.on { color: var(--accent); background: #dfe6fa; box-shadow: inset 0 -3px 0 var(--accent); }

/* --- Vùng câu hỏi --- */
.ex-body { flex: 1; min-height: 0; display: flex; position: relative; }
.pane { min-width: 0; overflow: auto; user-select: text; }
.pane-inner { padding: 28px 36px 48px; max-width: 760px; margin: 0 auto; }
.ex-body.split .pane-left { flex: 0 0 50%; }
.ex-body.split .pane-q { flex: 1 1 0; }
.ex-body.single .pane-q { flex: 1; }
.ex-body.single .pane-inner { max-width: 720px; }
.ex-body.resizing { cursor: col-resize; }
.ex-body.resizing .pane { user-select: none; pointer-events: none; }
.divider { flex: none; width: 13px; cursor: col-resize; display: flex; align-items: center; justify-content: center; background: linear-gradient(90deg, transparent 5px, #9aa3b5 5px 8px, transparent 8px); touch-action: none; }
.divider:hover, .ex-body.resizing .divider { background: linear-gradient(90deg, transparent 4px, var(--accent) 4px 9px, transparent 9px); }
.divider-grip { background: #fff; border: 1px solid #9aa3b5; border-radius: 6px; padding: 5px 0; color: #6c7586; display: flex; }

.passage, .q-prompt, .choice-text { font-family: var(--read-font); font-size: 17.5px; line-height: 1.62; }
.q-figure { display: block; max-width: 100%; max-height: 420px; margin: 0 auto 18px; }
.q-head { display: flex; align-items: center; gap: 12px; background: #eef0f5; border-bottom: 2px dashed #8a93a5; margin-bottom: 18px; min-height: 38px; padding-right: 8px; user-select: none; }
.q-num { align-self: stretch; display: flex; align-items: center; justify-content: center; min-width: 38px; padding: 0 8px; background: #1a1f2b; color: #fff; font-weight: 700; font-size: 16px; }
.mark-btn { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.mark-btn:hover { background: #dfe3ec; }
.mark-btn.on { font-weight: 700; }
.mark-btn.on svg { fill: var(--danger); stroke: var(--danger); }
.elim-toggle { border: 1px solid #1a1f2b; background: #fff; border-radius: 6px; padding: 2px 6px; line-height: 1.2; }
.elim-toggle:hover { background: #e3e7f2; }
.elim-toggle.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.elim-abc { font-size: 12.5px; font-weight: 700; letter-spacing: .5px; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.q-prompt { margin-bottom: 20px; }

.choices { display: flex; flex-direction: column; gap: 12px; }
.choice-row { display: flex; align-items: center; gap: 10px; }
.choice {
  flex: 1; display: flex; align-items: center; gap: 14px; text-align: left; padding: 11px 16px; min-height: 52px;
  background: #fff; border: 1px solid #4a5263; border-radius: 10px; position: relative; user-select: none;
}
.choice:hover { background: #f4f6fb; }
.choice .letter {
  flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid #1a1f2b; display: flex; align-items: center; justify-content: center;
  font-family: var(--ui-font); font-weight: 700; font-size: 14px;
}
.choice.selected { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); background: #f3f6ff; }
.choice.selected .letter { background: var(--accent); border-color: var(--accent); color: #fff; }
.choice.eliminated { color: #7a8292; border-color: #b4bac6; }
.choice.eliminated .letter { border-color: #9aa1af; }
.choice.eliminated::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; border-top: 2px solid #1a1f2b; }
.elim-btn { flex: none; width: 46px; height: 30px; border: none; background: none; font-size: 13px; font-weight: 600; text-decoration: underline; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.elim-btn:hover { background: #eceff5; }
.elim-letter { width: 22px; height: 22px; border: 1.5px solid #1a1f2b; border-radius: 50%; font-size: 12px; display: flex; align-items: center; justify-content: center; position: relative; text-decoration: none; }
.elim-letter::after { content: ""; position: absolute; left: -5px; right: -5px; top: 50%; border-top: 1.5px solid #1a1f2b; }

.spr { margin-top: 4px; }
.spr-input { font: 600 20px var(--ui-font); width: 190px; padding: 10px 14px; border: 1.5px solid #4a5263; border-radius: 10px; letter-spacing: 1px; }
.spr-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #d5defa; }
.spr-preview { margin-top: 16px; display: flex; align-items: center; gap: 12px; min-height: 52px; font-size: 16px; }
.spr-preview-label { font-weight: 700; }
.spr-preview-value { font-size: 19px; }
.spr-directions { font-size: 15px; line-height: 1.55; }
.spr-directions h3 { margin: 0 0 10px; font-size: 17px; }
.spr-directions ul { padding-left: 20px; margin: 0 0 16px; }
.spr-directions li { margin-bottom: 7px; }
.spr-examples { width: 100%; font-size: 14px; }

/* --- Highlight & ghi chú --- */
mark.hl { color: inherit; padding: 1px 0; cursor: pointer; border-radius: 2px; }
.hl-yellow { background: #fff09a; }
.hl-blue { background: #c4e1ff; }
.hl-pink { background: #ffd0e3; }
mark.hl.has-note { border-bottom: 2px dashed #5d6676; }
.anno-pop {
  position: fixed; z-index: 1500; width: 300px; background: #fff; border: 1px solid #b4bac6; border-radius: 12px; padding: 12px;
  box-shadow: 0 12px 32px rgba(10, 20, 50, .22); display: flex; flex-direction: column; gap: 10px; font-family: var(--ui-font);
}
.anno-row { display: flex; align-items: center; gap: 8px; }
.anno-row.end { justify-content: flex-end; }
.anno-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid #8a93a5; padding: 0; }
.swatch.on { border-color: #1a1f2b; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a1f2b; }
.anno-del { display: inline-flex; align-items: center; gap: 4px; border: none; background: none; font-size: 13px; color: var(--danger); padding: 4px 6px; border-radius: 6px; }
.anno-del:hover { background: var(--danger-soft); }
.anno-note { font: 14px var(--ui-font); width: 100%; resize: vertical; border: 1px solid #b4bac6; border-radius: 8px; padding: 8px 10px; }

/* --- Bút tô (tô liên tục): nút Annotate khi chưa bôi đen gì → bảng chọn màu; bút bật thì .exam có data-pen --- */
.anno-ico { position: relative; display: inline-flex; }
.pen-ink { display: none; position: absolute; right: -4px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #dfe6fa; }
.anno-tool[data-pen] .pen-ink { display: block; }
.anno-tool[data-pen="yellow"] .pen-ink { background: #f5cf1d; }
.anno-tool[data-pen="blue"] .pen-ink { background: #4d9de8; }
.anno-tool[data-pen="pink"] .pen-ink { background: #ef7aa9; }
.anno-tool[data-pen="erase"] .pen-ink { background: #fff; box-shadow: inset 0 0 0 1.5px #5d6676; }

.pen-menu {
  position: fixed; z-index: 1500; width: 272px; background: #fff; border: 1px solid #b4bac6; border-radius: 12px; padding: 12px 14px 14px;
  box-shadow: 0 12px 32px rgba(10, 20, 50, .22); font-family: var(--ui-font); color: var(--ink); animation: pen-in .14s ease-out;
}
.pen-menu::before {
  content: ''; position: absolute; top: -7px; left: calc(var(--arrow-x, 50%) - 6px); width: 12px; height: 12px;
  background: #fff; border-left: 1px solid #b4bac6; border-top: 1px solid #b4bac6; transform: rotate(45deg);
}
@keyframes pen-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pen-head { font-size: 14.5px; }
.pen-hint { margin: 4px 0 12px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.pen-row { display: flex; align-items: center; gap: 10px; }
.pen-swatch { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid rgba(26, 31, 43, .3); padding: 0; transition: transform .12s ease; }
.pen-swatch:hover { transform: scale(1.1); }
.pen-swatch.on { border-color: #1a1f2b; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a1f2b; }
.pen-sep { width: 1px; align-self: stretch; background: #d5d9e2; }
.pen-erase { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #b4bac6; background: #fff; border-radius: 999px; padding: 5px 12px 5px 9px; font-size: 13px; font-weight: 600; color: var(--ink); }
.pen-erase:hover { background: #eef0f4; }
.pen-erase.on { border-color: #1a1f2b; background: #1a1f2b; color: #fff; }
.pen-stop {
  margin-top: 12px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; border: none; background: #eef0f5;
  border-radius: 8px; padding: 7px 10px; font-size: 13px; font-weight: 600; color: var(--ink);
}
.pen-stop:hover { background: #e1e5ee; }
.pen-stop kbd { font: 11px var(--ui-font); border: 1px solid #b4bac6; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: #fff; color: var(--muted); }

/* Con trỏ hình bút dạ quang (đầu bút mang màu đang chọn) / cục tẩy khi rê trên vùng chữ */
.exam[data-pen="yellow"] .annotatable { cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><g transform='rotate(45 12 12)' stroke='%231a1f2b' stroke-width='1.3' stroke-linejoin='round'><rect x='8.5' y='1.5' width='7' height='12' rx='1.5' fill='white'/><rect x='8.5' y='5' width='7' height='3' fill='%23f5cf1d'/><path d='M8.5 13.5h7l-1 3h-5z' fill='white'/><path d='M9.5 16.5h5v3.5l-5 2.5z' fill='%23f5cf1d'/></g></svg>") 3 18, text; }
.exam[data-pen="blue"] .annotatable { cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><g transform='rotate(45 12 12)' stroke='%231a1f2b' stroke-width='1.3' stroke-linejoin='round'><rect x='8.5' y='1.5' width='7' height='12' rx='1.5' fill='white'/><rect x='8.5' y='5' width='7' height='3' fill='%234d9de8'/><path d='M8.5 13.5h7l-1 3h-5z' fill='white'/><path d='M9.5 16.5h5v3.5l-5 2.5z' fill='%234d9de8'/></g></svg>") 3 18, text; }
.exam[data-pen="pink"] .annotatable { cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><g transform='rotate(45 12 12)' stroke='%231a1f2b' stroke-width='1.3' stroke-linejoin='round'><rect x='8.5' y='1.5' width='7' height='12' rx='1.5' fill='white'/><rect x='8.5' y='5' width='7' height='3' fill='%23ef7aa9'/><path d='M8.5 13.5h7l-1 3h-5z' fill='white'/><path d='M9.5 16.5h5v3.5l-5 2.5z' fill='%23ef7aa9'/></g></svg>") 3 18, text; }
.exam[data-pen="erase"] .annotatable { cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><g transform='rotate(45 12 12)' stroke='%231a1f2b' stroke-width='1.3' stroke-linejoin='round'><rect x='7.5' y='2.5' width='9' height='13' rx='1.5' fill='white'/><rect x='7.5' y='15.5' width='9' height='6' rx='1.5' fill='%23f7b3cb'/></g></svg>") 5 19, text; }
.exam[data-pen] .annotatable mark.hl { cursor: inherit; }

/* Bút bật: vùng đang bôi đen mang sẵn màu bút → kéo tới đâu thấy màu tới đó, thả tay là màu đọng lại đúng chỗ */
.exam[data-pen="yellow"] .annotatable::selection, .exam[data-pen="yellow"] .annotatable ::selection { background: #fff09a; color: inherit; }
.exam[data-pen="blue"] .annotatable::selection, .exam[data-pen="blue"] .annotatable ::selection { background: #c4e1ff; color: inherit; }
.exam[data-pen="pink"] .annotatable::selection, .exam[data-pen="pink"] .annotatable ::selection { background: #ffd0e3; color: inherit; }
.exam[data-pen="erase"] .annotatable::selection, .exam[data-pen="erase"] .annotatable ::selection { background: #e6e8ee; color: #8a93a5; }
mark.hl.hl-fresh { animation: hl-settle .45s ease-out; }
@keyframes hl-settle { from { filter: saturate(2.2) brightness(.93); } to { filter: none; } }

/* --- Thanh dưới --- */
.ex-bottom { flex: none; height: 66px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 28px; background: #f3f5fb; }
.ex-who { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; min-width: 0; }
.ex-who span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-nav-btn { display: inline-flex; align-items: center; gap: 8px; background: #1a1f2b; color: #fff; border: none; border-radius: 8px; padding: 8px 16px; font-weight: 700; font-size: 14.5px; }
.ex-nav-btn:hover, .ex-nav-btn.on { background: #313a4d; }
.ex-nav-btn.on .ico { transform: rotate(180deg); }
.ex-bottom-right { display: flex; justify-content: flex-end; gap: 12px; }
.ex-btn { border-radius: 999px; padding: 9px 26px; font-weight: 700; font-size: 15px; border: 1.5px solid var(--accent); background: var(--accent); color: #fff; }
.ex-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.ex-btn.ex-outline { background: #fff; color: var(--accent); }
.ex-btn.ex-outline:hover { background: var(--accent-soft); }
.ex-btn.ex-submit { background: #14613f; border-color: #14613f; }
.ex-btn.ex-submit:hover { background: #0f4d32; }

/* --- Bảng bật --- */
.ex-pop { position: absolute; z-index: 300; background: #fff; border: 1px solid #b4bac6; border-radius: 12px; box-shadow: 0 16px 40px rgba(10, 20, 50, .22); user-select: none; }
.pop-directions { top: 80px; left: 24px; width: min(760px, calc(100vw - 48px)); max-height: calc(100vh - 170px); display: flex; flex-direction: column; }
.pop-scroll { padding: 24px 28px 8px; overflow: auto; font-family: var(--read-font); font-size: 17px; line-height: 1.6; user-select: text; }
.pop-scroll ul { margin: 0 0 .8em; padding-left: 22px; }
.pop-foot { padding: 12px 24px 18px; display: flex; justify-content: flex-end; }
.pop-foot.center { justify-content: center; }
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pop-nav { bottom: 76px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 48px)); }
.pop-nav::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 14px; height: 14px; background: #fff; border-right: 1px solid #b4bac6; border-bottom: 1px solid #b4bac6; transform: translateX(-50%) rotate(45deg); }
.pop-more { top: 78px; right: 20px; min-width: 230px; padding: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: none; background: none; border-radius: 8px; font-size: 14.5px; text-align: left; }
.menu-item:hover { background: #eef0f5; }
.menu-item kbd { margin-left: auto; }

.nav-legend { display: flex; gap: 22px; justify-content: center; padding: 12px 16px; font-size: 13.5px; }
.pop-head .nav-legend { padding: 0; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-box { width: 18px; height: 18px; border: 1.5px dashed #4a5263; border-radius: 3px; }
.legend-flag svg, .nav-flag svg { fill: var(--danger); stroke: var(--danger); }
.nav-grid { display: flex; flex-wrap: wrap; gap: 26px 14px; padding: 26px 22px 12px; justify-content: flex-start; }
.nav-cell { position: relative; width: 38px; height: 38px; border-radius: 4px; font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.nav-cell.unanswered { background: #fff; border: 1.5px dashed #4a5263; color: var(--accent); }
.nav-cell.answered { background: var(--accent); border: 1.5px solid var(--accent); color: #fff; }
.nav-cell:hover { filter: brightness(.94); }
.nav-pin { position: absolute; top: -19px; left: 50%; transform: translateX(-50%); color: var(--ink); display: flex; }
.nav-flag { position: absolute; top: -8px; right: -8px; display: flex; }

/* --- Trang kiểm tra lại --- */
.ex-body.review { overflow: auto; display: block; background: #fafbfd; }
.review-page { max-width: 820px; margin: 0 auto; padding: 36px 32px 48px; text-align: center; }
.review-page h1 { font-size: 28px; margin-bottom: 12px; }
.review-card { margin-top: 22px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 20px rgba(10, 20, 50, .08); text-align: left; }
.review-card .nav-grid { padding-bottom: 26px; }

/* --- Bảng nổi (Calculator, Reference) --- */
.float-panel {
  position: fixed; z-index: 500; display: flex; flex-direction: column; background: #fff; border: 1px solid #6c7586; border-radius: 10px;
  box-shadow: 0 18px 46px rgba(10, 20, 50, .3); overflow: hidden; user-select: none;
}
.fp-head { flex: none; height: 40px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 6px 0 14px; background: #1a1f2b; color: #fff; cursor: move; touch-action: none; }
.fp-title { font-weight: 600; font-size: 14.5px; }
.fp-grip { display: flex; opacity: .75; }
.fp-actions { display: flex; justify-content: flex-end; gap: 2px; }
.fp-btn { display: inline-flex; padding: 6px; border: none; background: none; color: inherit; border-radius: 6px; }
.fp-head .fp-btn:hover { background: rgba(255, 255, 255, .18); }
.pop-head .fp-btn:hover { background: #eef0f5; }
.fp-body { flex: 1; min-height: 0; position: relative; overflow: auto; background: #fff; }
.fp-calc .fp-body { overflow: hidden; }
.calc-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.float-panel.dragging iframe { pointer-events: none; }
.fp-resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none; background: linear-gradient(135deg, transparent 50%, #6c7586 50% 58%, transparent 58% 70%, #6c7586 70% 78%, transparent 78%); z-index: 2; }

.fp-ref .fp-body { padding: 18px 20px; user-select: text; }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 12px; }
.ref-item { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; color: #1a1f2b; }
.ref-tex { font-size: 15px; line-height: 1.7; }
.ref-facts { margin: 22px 0 4px; padding-left: 20px; font-family: var(--read-font); font-size: 16px; line-height: 1.6; }

/* --- Giờ nghỉ --- */
.exam.is-break { background: #141a2a; color: #fff; overflow: auto; }
.break-wrap { margin: auto; display: flex; gap: 56px; align-items: center; padding: 40px; max-width: 980px; }
.break-card { flex: none; width: 300px; text-align: center; border: 1px solid #47506a; border-radius: 16px; padding: 30px 24px; background: #1d2540; }
.break-label { font-size: 15px; font-weight: 600; color: #c9d0e4; }
.break-clock { font-size: 64px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; margin: 6px 0 20px; }
.ex-btn.ex-resume { background: var(--gold); border-color: var(--gold); color: #1a1f2b; }
.ex-btn.ex-resume:hover { background: #f5b015; border-color: #f5b015; }
.break-tips h1 { font-size: 30px; margin-bottom: 12px; }
.break-tips h2 { margin-top: 22px; font-size: 18px; }
.break-tips p, .break-tips li { color: #d5daea; font-size: 16px; }
.break-tips ul { padding-left: 22px; margin: 0; }

/* --- Hoàn thành --- */
.exam.is-done { background: var(--bg); overflow: auto; user-select: text; }
.done { margin: auto; width: min(680px, calc(100vw - 48px)); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 36px 40px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.done h1 { margin-top: 10px; }
.done-total { font-size: 34px; font-weight: 700; color: var(--accent); margin: 8px 0 12px; }
.done .simple-table { text-align: left; }
.done .btn { margin-top: 10px; }

/* --- Xem lại bài --- */
.exam.is-review .pane { user-select: text; }
.rv-sub { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-status { display: flex; justify-content: center; }
.rv-pos { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.rv-marked, .rv-time { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; color: #3b4353; }
.rv-marked svg { fill: var(--danger); stroke: var(--danger); }
.rv-omitted { margin: 14px 0 0; color: var(--muted); font-style: italic; }
.divider.static { cursor: default; background: linear-gradient(90deg, transparent 5px, #c3c9d6 5px 8px, transparent 8px); }
.choices.readonly .choice { cursor: default; }
.choices.readonly .choice:hover { background: #fff; }
.choice.correct { border-color: #18794e; box-shadow: inset 0 0 0 2px #18794e; background: #effaf3 !important; }
.choice.correct .letter { background: #18794e; border-color: #18794e; color: #fff; }
.choice.wrong { border-color: var(--danger); box-shadow: inset 0 0 0 2px var(--danger); background: #fff5f4 !important; }
.choice.wrong .letter { background: var(--danger); border-color: var(--danger); color: #fff; }
.choice-tags { margin-left: auto; display: flex; gap: 6px; flex: none; padding-left: 10px; }
.spr-review { display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.spr-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-radius: 10px; border: 1.5px solid #b4bac6; }
.spr-line strong { font-size: 19px; }
.spr-line.ok { border-color: #18794e; background: #effaf3; }
.spr-line.bad { border-color: var(--danger); background: #fff5f4; }
.explain { margin-top: 26px; padding: 18px 20px; background: #f6f7fb; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; }
.explain h3 { margin: 0 0 8px; font-size: 15px; text-transform: uppercase; letter-spacing: .4px; color: var(--accent); }
.explain .rich { font-size: 16px; line-height: 1.6; }
.explain-meta { margin-top: 12px; font-size: 13px; color: var(--muted); }
.ex-btn:disabled { background: #c3c9d6; border-color: #c3c9d6; opacity: 1; }

/* --- Luyện từng câu --- */
.exam.is-practice .pane { user-select: text; }
.pr-chip { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pr-skill { font-size: 13.5px; color: #3b4353; }
.ex-tool.flag-on svg { fill: var(--danger); stroke: var(--danger); }
.practice-actions { display: flex; align-items: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.result-banner { margin-top: 22px; padding: 12px 18px; border-radius: 10px; font-weight: 700; font-size: 17px; }
.result-banner.ok { background: #e3f4ea; color: #14613f; }
.result-banner.bad { background: var(--danger-soft); color: var(--danger); }
.result-banner + .explain { margin-top: 14px; }
/* Hàng nút "Vì sao bạn sai câu này?" (xem lại bài + luyện từng câu) */
.reason-box { margin-top: 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-family: var(--ui-font); }
.reason-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 14px; margin-bottom: 10px; }
.reason-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.reason-chip { cursor: pointer; }
.reason-note { display: block; width: 100%; margin-top: 10px; font-size: 14px; }
.reason-box + .explain { margin-top: 14px; }
.note-box { margin-top: 26px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fffdf3; }
.note-head { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 8px; }
.note-status { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.note-area { width: 100%; font: 14.5px/1.5 var(--ui-font); border: 1px solid #d9d2a8; border-radius: 8px; padding: 8px 10px; resize: vertical; background: #fff; }

/* --- Xem lại bài: lưới điều hướng ở thanh dưới (đúng / sai / bỏ trống / chậm) --- */
.ex-nav-btn .rv-pos { color: inherit; }
.rv-nav { display: flex; flex-direction: column; max-height: min(70vh, 560px); }
.rv-nav[hidden] { display: none; }
.rv-nav-scroll { overflow: auto; padding: 4px 20px 18px; }
.rv-legend { flex-wrap: wrap; gap: 8px 18px; }
.rv-group { font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 8px; }
.rv-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0; }
.rv-cell { position: relative; width: 38px; height: 38px; border-radius: 6px; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid transparent; }
.rv-cell.ok { background: #e3f4ea; border-color: #18794e; color: #14613f; }
.rv-cell.bad { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.rv-cell.skip { background: #fff; border: 1.5px dashed #4a5263; color: #4a5263; }
.rv-cell.slow { box-shadow: 0 0 0 3px #f08a24; }
.rv-cell.slow::after { content: ""; position: absolute; top: -6px; right: -6px; width: 11px; height: 11px; border-radius: 50%; background: #f08a24; border: 2px solid #fff; }
.rv-cell.current { outline: 3px solid var(--ink); outline-offset: 3px; }
.rv-cell.slow.current { outline-offset: 5px; }
button.rv-cell:hover { filter: brightness(.95); }
.rv-cell.rv-key { width: 18px; height: 18px; border-radius: 4px; }
.rv-cell.rv-key.slow { box-shadow: 0 0 0 2px #f08a24; }
.rv-cell.rv-key.slow::after { width: 7px; height: 7px; top: -5px; right: -5px; border-width: 1.5px; }

/* --- Ảnh chèn trong chữ bằng ![](…) (đợt 3 phiên 2) --- */
.rich .rt-img, .choice-text .rt-img { display: inline-block; max-width: 100%; max-height: 360px; vertical-align: middle; margin: 4px 0; }
.choice-text .rt-img { max-height: 220px; }
.pane-inner > .q-figure + .q-figure { margin-top: -6px; }
