/* Hình vẽ SVG: màu theo vai trò nét. Đổi màu = đặt --hv-chinh / --hv-phu / --hv-nhan trên body; mặc định là màu gốc. */
.hv-chinh{stroke:var(--hv-chinh,#002060)}
.hv-chinh-chu,.hv-chinh-diem{fill:var(--hv-chinh,#002060)}
.hv-phu{stroke:var(--hv-phu,#0070C0)}
.hv-phu-dau{fill:var(--hv-phu,#0070C0)}
.hv-nhan{stroke:var(--hv-nhan,#BF4E14)}
.hv-nhan-dau,.hv-nhan-chu{fill:var(--hv-nhan,#BF4E14)}
/* In màu gốc: đặt lại biến trong phạm vi tờ in. */
.hv-mau-goc{--hv-chinh:#002060;--hv-phu:#0070C0;--hv-nhan:#BF4E14}

/* Khung thay cho <iframe sandbox>: giữ đúng kích thước chỗ đặt cũ, hình tối đa 96%. */
.hv-khung{width:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}
.hv-khung svg{max-width:96%;max-height:96%}
.nhd-svg-paper .hv-khung{height:100%}
/* Khung co theo đúng cỡ hình (trước đây cao cố định 300px → hình nhỏ bị chừa khoảng trắng, trông cách xa lời giải). */
.nhd-question-main-asset .hv-khung,.nhd-option-asset .hv-khung,.nhd-review-image-preview .hv-khung{height:auto}
.nhd-question-main-asset .hv-khung svg{max-height:300px;height:auto}
.nhd-option-asset .hv-khung svg,.nhd-review-image-preview .hv-khung svg{max-height:180px;height:auto}
.nhd-asset-modal .hv-khung{height:100%}
.hv-trong{color:#8494AC;font:13px 'Segoe UI',sans-serif}
@media(max-width:650px){.nhd-option-asset .hv-khung svg{max-height:155px}}
@media(max-width:1100px){.nhd-asset-modal .hv-khung{height:55vh}}

/* Hình của câu trong khung xem trước: hình đề dưới câu hỏi, hình lời giải trong lời giải. */
.nhd-hinh-cau{display:flex;flex-wrap:wrap;gap:10px 18px;justify-content:center;align-items:center;margin:4px 0}
.nhd-hinh-cau:empty{display:none}
.nhd-hinh-cau svg{max-width:96%;max-height:300px}

/* Nút mở ở thanh công cụ */
.hv-nut-mau{display:inline-grid;place-items:center;width:34px;height:34px;padding:0;border:1px solid #DDE5F0;border-radius:10px;background:#fff;cursor:pointer}
.hv-nut-mau:hover{border-color:#9FB4CF}
.hv-cham{display:inline-flex;gap:2px}
.hv-cham i{display:block;width:7px;height:16px;border-radius:3px}
.hv-nut-mau .hv-cham i{width:6px;height:16px}

/* Khung "Màu hình vẽ" */
.hv-nen{position:fixed;inset:0;z-index:10060;display:grid;place-items:center;padding:16px;background:rgba(15,25,45,.45)}
.hv-hop{width:min(720px,100%);max-height:calc(100vh - 32px);overflow:auto;background:#fff;border-radius:16px;box-shadow:0 24px 70px rgba(0,0,0,.3);font-family:'Segoe UI',system-ui,sans-serif;color:#1C2A43}
.hv-dau{display:flex;justify-content:space-between;align-items:flex-start;padding:16px 18px 6px}
.hv-dau small{font-size:10px;letter-spacing:.08em;color:#8494AC}
.hv-dau h3{margin:2px 0 0;font-size:18px}
.hv-dong{border:0;background:none;font-size:28px;line-height:1;cursor:pointer;color:#5A6580}
.hv-than{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:18px;padding:8px 18px 12px}
.hv-nhom-ten{margin:10px 0 6px;font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:#5A6580}
.hv-bo-mau{display:flex;flex-wrap:wrap;gap:6px}
.hv-bo-mau button{display:inline-flex;align-items:center;gap:7px;padding:6px 10px;border:1px solid #DDE5F0;border-radius:999px;background:#fff;font:inherit;font-size:13px;cursor:pointer}
.hv-bo-mau button.on{border-color:#1F3864;box-shadow:0 0 0 2px rgba(31,56,100,.15);font-weight:600}
.hv-bo-mau .hv-cham i{width:9px;height:9px;border-radius:50%}
.hv-dong-mau{display:grid;grid-template-columns:40px 1fr auto auto;align-items:center;gap:10px;padding:6px 0;border-bottom:1px solid #EEF2F7;cursor:pointer}
.hv-dong-mau input[type=color]{width:40px;height:30px;padding:0;border:1px solid #DDE5F0;border-radius:8px;background:#fff;cursor:pointer}
.hv-dong-mau b{display:block;font-size:13px}
.hv-dong-mau small{font-size:11px;color:#8494AC}
.hv-dong-mau code{font-size:12px;color:#34425C}
.hv-dong-mau em{font-style:normal;font-size:11px;color:#2E7D32}
.hv-dong-mau em.thap{color:#C62828;font-weight:700}
.hv-ghi-chu{margin:8px 0;font-size:12px;color:#5A6580;line-height:1.45}
.hv-canh-bao{margin-top:8px;padding:8px 10px;border:1px solid #F2C7A5;border-radius:10px;background:#FFF4EE;color:#8A3A10;font-size:12px;line-height:1.4}
.hv-xem{display:flex;flex-direction:column}
.hv-hinh-mau{display:grid;place-items:center;padding:10px;border:1px solid #DDE5F0;border-radius:12px;background:#fff}
.hv-hinh-mau svg{width:100%;max-width:260px;height:auto}
.hv-xem small{margin-top:6px;font-size:11px;color:#8494AC}
.hv-chan{display:flex;justify-content:space-between;gap:8px;padding:12px 18px 16px;border-top:1px solid #EEF2F7}
@media(max-width:640px){.hv-than{grid-template-columns:1fr}.hv-xem{order:-1}}

/* Tùy chọn trên thanh in đề */
.nhd-print-opts{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:13px}
.nhd-print-opts label{display:inline-flex;align-items:center;gap:5px}
.nhd-print-opts select{padding:4px 6px;border:1px solid #cdd9e7;border-radius:8px;font:inherit}
.nhd-print-loi-giai{margin:4px 0 2px 14px;padding-left:8px;border-left:2px solid #cdd9e7}
.nhd-print-loi-giai>b{display:block;margin-bottom:2px}
.nhd-print-loi-giai .nhd-math{white-space:pre-wrap}
.nhd-print-loi-giai .nhd-print-svg{justify-content:center}
