/* Trình soạn AI Math Studio. Tông sáng: nền kem ấm (accent), cam ấm cho phần nổi bật (nút chính, đang chọn, công cụ đang dùng),
   chữ xanh than. Giấy dùng Times New Roman như đề in ở trường.
   Chữ trên nền cam dùng xanh than (độ tương phản 5,2:1); chữ trắng trên cam chỉ đạt 2,8:1. */

:root {
  color-scheme: light;
  --bg: #fffaf5;
  --desk: #fff4e9;
  --desk-dot: #f1d9c3;
  --surface: #ffffff;
  --surface-2: #fff6ee;
  --line: #f1e1d2;
  --line-2: #e6cfbb;
  --text: #1e2a38;
  --text-2: #465264;
  --text-3: #5f6672;
  --orange: #f97316;
  --orange-hover: #fb8a3c;
  --orange-strong: #ea580c;
  --orange-deep: #c2410c;
  --orange-soft: #ffedd5;
  --orange-tint: #fff7ed;
  --orange-line: #fdba74;
  --orange-ring: rgba(249, 115, 22, 0.35);
  --ok: #1e7d4f;
  --danger: #b42318;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(124, 58, 12, 0.06), 0 10px 30px rgba(124, 58, 12, 0.1);
  --ui: 'Be Vietnam Pro', system-ui, 'Segoe UI', Roboto, Arial, sans-serif;
  --hand: 'Patrick Hand', 'Be Vietnam Pro', system-ui, sans-serif;
  --serif: 'Times New Roman', Times, 'Liberation Serif', serif;
  /* màu trong hình vẽ (svg.js) */
  --ink: #1b2430;
  --ink-soft: #6b7684;
  --paper: #ffffff;
  --grid: #d9e2ec;
  --fill: rgba(31, 95, 168, 0.08);
  --sel: #ea580c;
  --c1: #1f5fa8;
  --c2: #c0392b;
  --c3: #1e7d4f;
  --c4: #7d3c98;
  --c5: #b9770e;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--orange-strong); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { width: 18px; height: 18px; fill: currentColor; flex: none; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.92em; background: var(--orange-tint); border: 1px solid var(--line); padding: 0 4px; border-radius: 5px; }
.noscript { padding: 2rem; font-size: 18px; }

/* ---------- Thanh trên ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  height: 58px; padding: 0 12px;
  background: var(--surface); color: var(--text);
  border-top: 3px solid var(--orange);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(124, 58, 12, 0.05);
}
.logo { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: -0.01em; }
/* dòng chữ thương hiệu (chủ dự án chọn 01/12/2026): Pixi tròn dán nghiêng + chữ viết tay có nét gạch cam, nguồn brand/Logo/make_final.py.
   Chữ rộng 118 px, hẹp hơn chữ cũ (120 px): các mốc ẩn chữ của thanh trên cùng giữ nguyên */
.logo-mark { display: block; width: 40px; height: 40px; flex: none; transform: rotate(-6deg); filter: drop-shadow(0 2px 3px rgba(124, 58, 12, 0.22)); }
.logo-word { display: block; height: 22px; width: auto; flex: none; }
.tb-btn, .tb-icon {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 11px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text-2);
  white-space: nowrap; transition: background 0.15s, color 0.15s, transform 0.1s;
}
.tb-icon { padding: 0 8px; }
.tb-btn:hover, .tb-icon:hover { background: var(--orange-tint); color: var(--text); }
.tb-btn:active, .tb-icon:active { transform: translateY(1px); }
.tb-btn .ic, .tb-icon .ic { color: var(--orange-deep); }
.tb-icon:disabled { opacity: 0.35; cursor: default; background: transparent; }
.tb-primary { background: var(--orange); color: var(--text); font-weight: 700; box-shadow: 0 3px 0 var(--orange-deep); }
.tb-primary .ic { color: var(--text); }
.tb-primary:hover { background: var(--orange-hover); color: var(--text); }
.tb-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--orange-deep); }
.tb-title { flex: 1; min-width: 120px; display: flex; flex-direction: column; justify-content: center; }
.tb-title-inp {
  width: 100%; max-width: 520px; height: 28px; padding: 0 8px; margin-left: -8px;
  border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--text); font-weight: 700; font-size: 15px;
}
.tb-title-inp:hover { border-color: var(--line-2); }
.tb-title-inp:focus { background: var(--orange-tint); border-color: var(--orange-line); outline: none; }
.tb-meta { font-size: 11.5px; color: var(--text-3); }
.save-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.save-status .ic { width: 15px; height: 15px; color: var(--orange-strong); }
.save-status[data-state="saved"] .ic { color: var(--ok); }
.tb-actions { display: flex; align-items: center; gap: 2px; }

/* ---------- Bố cục ---------- */
.layout { display: grid; grid-template-columns: 250px 1fr; height: calc(100vh - 58px); height: calc(100dvh - 58px); }
.side { overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 12px 10px 20px; }
.side-head { font-weight: 800; font-size: 13px; padding: 2px 6px 6px; }
.side-gtitle { margin: 12px 6px 4px; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.side-item, .add-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: none; text-align: left;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.side-item:hover, .add-item:hover, .add-item:focus-visible { background: var(--orange-tint); border-color: var(--orange-soft); }
.side-item:hover { transform: translateX(2px); }
.side-item .ic, .add-item .ic { width: 20px; height: 20px; padding: 6px; box-sizing: content-box; border-radius: 9px; background: var(--orange-soft); color: var(--orange-deep); }
.side-item span, .add-item span { display: flex; flex-direction: column; min-width: 0; }
.side-item b, .add-item b { font-weight: 600; font-size: 13.5px; }
.side-item small, .add-item small { color: var(--text-3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot { margin: 16px 6px 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }

.desk {
  overflow-y: auto; padding: 28px 20px 120px;
  background-color: var(--desk);
  background-image: radial-gradient(var(--desk-dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
}
.desk-inner { display: flex; justify-content: center; min-height: 100%; }

/* ---------- Trang giấy (dùng chung cho màn hình và bản in) ---------- */
.sheet { font-family: var(--serif); font-size: 13pt; line-height: 1.45; color: #111; }
.sheet.fs-12 { font-size: 12pt; }
.sheet.fs-14 { font-size: 14pt; }
.sheet .katex { font-size: 1.1em; }
.paper {
  width: 21cm; max-width: 100%; min-height: 29.7cm;
  padding: 1.4cm 1.5cm 2cm 1.9cm;
  background: var(--surface);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(124, 58, 12, 0.06), 0 12px 34px rgba(124, 58, 12, 0.12);
}

.doc-hd { margin-bottom: 0.6em; }
.hd-de .hd-cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 0.8em; text-align: center; line-height: 1.35; }
.doc-hd .b { font-weight: 700; }
.doc-hd .i { font-style: italic; }
.hd-rule { width: 38%; margin: 3px auto 4px; border-top: 1px solid #111; }
.hd-code { display: flex; justify-content: flex-end; margin-top: 0.3em; }
.hd-code span { border: 1.5px solid #111; padding: 0.05em 0.7em; font-weight: 700; }
.hd-name { display: flex; flex-wrap: wrap; gap: 0.4em 1.6em; margin: 0.7em 0 0.3em; }
.hd-phieu { text-align: center; }
.hd-phieu .hd-school { font-weight: 700; font-size: 0.95em; }
.hd-phieu .hd-title { font-weight: 700; font-size: 1.18em; margin-top: 0.15em; }
.hd-phieu .hd-sub { font-style: italic; }
.hd-phieu .hd-name { justify-content: center; }
.hd-wrap { cursor: pointer; border-radius: 8px; margin: -6px -10px 6px; padding: 6px 10px; transition: background 0.12s, box-shadow 0.12s; }
.hd-wrap:hover { box-shadow: 0 0 0 1px var(--orange-line); background: var(--orange-tint); }
.hd-empty { display: flex; align-items: center; gap: 6px; font-family: var(--ui); font-size: 13px; color: var(--text-3); padding: 6px 0; }
.hd-empty .ic { color: var(--orange-deep); }

.b-heading { font-size: 1em; font-weight: 700; margin: 0.7em 0 0.25em; }
.b-heading.l2 { font-size: 1em; font-style: italic; }
.b-heading.is-plain { font-weight: 400; font-style: normal; text-align: justify; }
.b-text { margin: 0.25em 0; text-align: justify; }
.b-text.al-center { text-align: center; }
.b-text.al-right { text-align: right; }
/* Khung đầu đề tự do (khối examhead, 02/12/2026): hai cột canh giữa, dòng ngang trang ba ô trái, giữa, phải */
.eh { margin-bottom: 0.5em; line-height: 1.35; }
.eh.has-rule { padding-bottom: 0.3em; border-bottom: 1px solid #111; }
.eh-cols { display: grid; column-gap: 0.6em; text-align: center; }
.eh-cell { min-width: 0; }
.eh-full { display: flex; justify-content: space-between; align-items: baseline; gap: 0.8em; margin: 0.15em 0; }
.eh-full > span { white-space: nowrap; }
.eh-sl { min-width: 0; overflow: hidden; }
.eh-one { margin: 0.15em 0; }
.eh-one.al-center { text-align: center; }
.eh-one.al-right { text-align: right; }
.eh-rule { display: block; width: 38%; margin: 0.6em auto 0; border-top: 1px solid #111; }
.eh-box { display: inline-block; border: 1.5px solid #111; padding: 0.05em 0.6em; font-weight: 700; }
/* Chân trang, đầu trang của trang in */
.pf { font-size: 0.9em; line-height: 1.3; }
.pf .eh-full { margin: 0; }
.pf-bottom.has-rule { border-top: 1px solid #111; padding-top: 0.2em; }
.pf-top.has-rule { border-bottom: 1px solid #111; padding-bottom: 0.2em; }
.b-pagefoot { position: relative; margin: 0.6em 0 0.2em; padding: 0.35em 0.6em 0.3em; border: 1px dashed var(--line, #e7d9c8); border-radius: 6px; color: var(--text-2, #3d4a5c); }
.pf-tag { position: absolute; top: -0.75em; left: 0.6em; padding: 0 6px; background: var(--surface, #fff); font-family: var(--ui); font-size: 11px; color: var(--text-3, #6b7686); }
.ed-eh .eh-rows { display: grid; gap: 6px; margin-bottom: 8px; }
.eh-edrow { display: flex; gap: 6px; align-items: center; }
.eh-edrow .inp { min-width: 0; }
.b-math { margin: 0.3em 0; }
.b-math.al-center { text-align: center; }
.b-math-line { margin: 0.15em 0; }
.b-math .katex-display { margin: 0.2em 0; }
.b-math.al-left .katex-display > .katex { text-align: left; }

.b-q { margin: 0.45em 0 0.3em; }
.q-stem { text-align: justify; }
.q-num { font-weight: 700; }
.q-opts { display: grid; gap: 0.12em 1.2em; padding-left: 1.3em; margin-top: 0.15em; }
.q-opts.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.q-opts.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.q-opts.cols-1 { grid-template-columns: 1fr; }
.q-letter { font-weight: 700; display: inline-block; min-width: 1.35em; }
.q-opt.is-shown { font-weight: 700; }
.q-opt.is-shown .q-letter { border: 1.5px solid currentColor; border-radius: 50%; min-width: 0; padding: 0 0.22em; margin-right: 0.15em; }
.q-tf { padding-left: 1.3em; margin-top: 0.1em; }
.q-tf-row { display: flex; justify-content: space-between; gap: 1em; align-items: baseline; }
.q-tf-ans { display: none; font-weight: 700; white-space: nowrap; }
.q-tf-ans.is-shown { display: inline; }
.q-short { padding-left: 1.3em; margin-top: 0.15em; }
.q-short-box { display: inline-block; min-width: 7em; border-bottom: 1px dotted #555; padding: 0 0.3em; }
.q-short-box .ans { visibility: hidden; font-weight: 700; }
.q-short-box .ans.is-shown { visibility: visible; }
.q-sol { margin: 0.35em 0 0.2em 1.3em; padding: 0.35em 0.7em; border-left: 3px solid var(--orange-line); background: var(--orange-tint); }
.q-sol-h { font-weight: 700; font-style: italic; }
/* Công thức trên trang soạn: bấm đúp để mở trình sửa trực quan */
.blk-view .mx { border-radius: 5px; cursor: pointer; transition: background 0.12s, box-shadow 0.12s; }
.blk-view .mx:hover { background: var(--orange-tint); box-shadow: 0 0 0 3px var(--orange-tint), 0 0 0 4px var(--orange-line); }
.blk-view .b-math-line .mx { display: block; }
.mkb-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.mkb-wrap .mkb { align-self: stretch; }
.tb-btn[aria-pressed="true"] { background: var(--orange-tint); border-color: var(--orange-line); color: var(--orange-deep); }
.ph { font-family: var(--ui); font-size: 0.82em; color: #8b8f99; font-style: italic; }

.b-fig { display: flex; justify-content: center; margin: 0.35em 0; }
.b-fig svg { max-width: 100%; height: auto; overflow: visible; }
.b-table-wrap { display: flex; justify-content: center; margin: 0.35em 0; overflow-x: auto; }
.b-table { border-collapse: collapse; }
.b-table th, .b-table td { border: 1px solid #333; padding: 0.15em 0.6em; text-align: center; min-width: 2.2em; }
.b-table th { font-weight: 700; }
.b-lines { margin: 0.2em 0 0.4em; }
.b-lines .ln { height: 0.95cm; border-bottom: 1px dotted #6f7b87; }
.b-lines.s-solid .ln { border-bottom-style: solid; border-color: #9aa5b1; }
.b-lines.s-grid { height: calc(var(--n) * 0.9cm); background-image: linear-gradient(#c9d4d8 1px, transparent 1px), linear-gradient(90deg, #c9d4d8 1px, transparent 1px); background-size: 0.5cm 0.5cm; border: 1px solid #c9d4d8; }
.b-lines.s-blank { height: calc(var(--n) * 0.9cm); }
.b-img { margin: 0.4em 0; text-align: center; }
.b-img img { max-width: 100%; height: auto; }
/* hình bên phải (đề nhập từ PDF có hình cạnh đề): câu hỏi ngay sau chạy chữ bên trái hình; câu khác, tiêu đề xuống dưới hình */
.b-img.is-float { float: right; margin: 0.2em 0 0.3em 0.8em; }
.b-img.is-float img { width: 100%; }
.blk-question, .blk-heading, .blk-examhead, .blk-pagefoot, .blk-pagebreak, .pblk-question, .pblk-heading, .pblk-examhead { clear: right; }
.blk-image:has(.is-float) + .ins + .blk-question, .pblk-image:has(.is-float) + .pblk-question { clear: none; }
.b-img figcaption { font-style: italic; font-size: 0.92em; }
.b-img-empty { padding: 1em; border: 1px dashed var(--line-2); text-align: center; }
.b-pagebreak { position: relative; margin: 0.8em 0; border-top: 1.5px dashed var(--orange-line); text-align: center; height: 0; }
.b-pagebreak span { position: relative; top: -0.8em; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; background: #fff; font-family: var(--ui); font-size: 11.5px; color: var(--orange-deep); }
.b-pagebreak .ic { width: 14px; height: 14px; }
.tex-err { color: var(--danger); font-family: monospace; }

/* ---------- Khối khi soạn ---------- */
.blk { position: relative; margin: 0 -12px; padding: 1px 12px; border-radius: 10px; transition: box-shadow 0.12s, background 0.12s; }
.blk:hover { box-shadow: 0 0 0 1px var(--orange-soft); }
.blk.is-sel { box-shadow: 0 0 0 2px var(--orange-ring); background: #fffdfb; }
.blk-tools { position: absolute; top: -15px; right: 8px; z-index: 3; display: none; gap: 2px; padding: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 4px 12px rgba(124, 58, 12, 0.12); }
.blk:hover .blk-tools, .blk.is-sel .blk-tools { display: flex; }
.blk-view { cursor: text; }
.blk-geometry.is-sel .blk-view, .blk.is-sel .ge-stage { cursor: default; }
.blk-edit:empty { display: none; }
.blk-edit { margin: 6px 0 10px; font-family: var(--ui); font-size: 13.5px; line-height: 1.45; color: var(--text); }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: none; border-radius: 7px; background: none; color: var(--text-2); transition: background 0.12s, color 0.12s; }
.icon-btn:hover { background: var(--orange-tint); color: var(--orange-deep); }
.icon-btn .ic { width: 17px; height: 17px; }

.ins { position: relative; z-index: 2; height: 12px; margin: -6px -12px; }
.ins-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.85);
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--orange-line); background: var(--surface); color: var(--orange-deep); opacity: 0; transition: opacity 0.12s, transform 0.12s;
}
.ins::before { content: ''; position: absolute; left: 12px; right: 12px; top: 50%; border-top: 1.5px dashed transparent; transition: border-color 0.12s; }
.ins:hover::before { border-color: var(--orange-line); }
.ins:hover .ins-btn, .ins-btn:focus-visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.ins-btn .ic { width: 15px; height: 15px; }
.ins-end { height: auto; margin-top: 18px; }
.ins-last {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px;
  border: 1.5px dashed var(--orange-line); border-radius: var(--radius); background: var(--orange-tint); color: var(--orange-deep); font-family: var(--ui); font-size: 14px; font-weight: 600;
  transition: background 0.12s, transform 0.12s;
}
.ins-last:hover { background: var(--orange-soft); transform: translateY(-1px); }

/* ---------- Ô sửa ---------- */
.ed { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; }
.col { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 180px; }
.grow { flex: 1 1 200px; min-width: 0; }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row > .f { flex: 0 1 auto; }
.row > .f:has(.grow), .row > .f:has(textarea) { flex: 1 1 240px; }
/* ô nhập .grow nằm trong ô dạng cột: chỉ giãn theo chiều ngang của hàng, không giãn cao (lỗi 20/11/2026: ô hàm số của bảng biến thiên cao 200px) */
.f:not(.f-inline) > .grow { flex: none; }
.f-inline { flex-direction: row; align-items: center; gap: 6px; }
.f-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.f-hint { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.inp {
  width: 100%; min-height: 34px; padding: 6px 9px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 14px; line-height: 1.45;
}
textarea.inp { resize: vertical; min-height: 60px; }
.inp:focus { outline: none; border-color: var(--orange-strong); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18); }
.inp::placeholder { color: #8b8f99; }
.inp.mono { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.inp-num { width: 84px; }
.inp-name { width: 74px; }
.inp-mid { width: 200px; }
.inp-sel { width: auto; min-width: 120px; }
.inp.is-head { font-weight: 700; background: var(--orange-tint); }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; user-select: none; }
.chk input { width: 16px; height: 16px; accent-color: var(--orange-strong); }
.chk-row { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); }
.seg-btn { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border: none; border-radius: 7px; background: none; font-size: 13px; color: var(--text-2); white-space: nowrap; transition: background 0.12s, color 0.12s; }
.seg-btn:hover { background: var(--orange-tint); color: var(--text); }
.seg-btn.is-on { background: var(--orange); color: var(--text); font-weight: 700; box-shadow: inset 0 -2px 0 var(--orange-deep); }
.seg-sm .seg-btn { height: 26px; padding: 0 8px; font-size: 12.5px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-weight: 500; white-space: nowrap;
  box-shadow: 0 2px 0 var(--line-2);
  transition: background 0.12s, border-color 0.12s, transform 0.1s, box-shadow 0.1s;
}
.btn .ic { color: var(--orange-deep); }
.btn:hover { background: var(--orange-tint); border-color: var(--orange-line); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--orange); border-color: var(--orange); color: var(--text); font-weight: 700; box-shadow: 0 3px 0 var(--orange-deep); }
.btn-primary .ic { color: var(--text); }
.btn-primary:hover { background: var(--orange-hover); border-color: var(--orange-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: 0 2px 0 #7a1810; }
.btn-danger-soft, .btn-danger-soft .ic { color: var(--danger); }
.opt-list { display: flex; flex-direction: column; gap: 6px; }
.opt-row { display: flex; align-items: center; gap: 8px; }
.opt-ok { display: inline-flex; align-items: center; gap: 4px; min-width: 44px; font-weight: 700; }
.opt-ok input { width: 17px; height: 17px; accent-color: var(--ok); }
.fn-list { display: flex; flex-direction: column; gap: 6px; }
.fn-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fn-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.fn-dot.c1 { background: var(--c1); } .fn-dot.c2 { background: var(--c2); } .fn-dot.c3 { background: var(--c3); } .fn-dot.c4 { background: var(--c4); } .fn-dot.c5 { background: var(--c5); }
.fn-prev { font-family: var(--serif); font-size: 15px; }
.fn-msg { font-size: 12px; color: var(--danger); }
.tbl-grid { display: grid; gap: 4px; overflow-x: auto; }
.tbl-grid .inp { min-height: 32px; padding: 4px 6px; text-align: center; }
.latex-box summary { cursor: pointer; font-size: 12px; color: var(--text-3); }
.latex-out { display: block; margin-top: 4px; white-space: pre-wrap; word-break: break-all; }

.mkb { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.mkb summary { display: flex; align-items: center; gap: 6px; padding: 6px 10px; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--orange-deep); list-style: none; }
.mkb summary::-webkit-details-marker { display: none; }
.mkb-body { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.mkb-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.mkb-title { width: 100%; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.mkb-key { min-width: 42px; height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: #fffdfa; font-family: var(--serif); font-size: 15px; box-shadow: 0 2px 0 var(--line); transition: background 0.1s, transform 0.1s; }
.mkb-key:hover { border-color: var(--orange-line); background: var(--orange-tint); }
.mkb-key:active { transform: translateY(2px); box-shadow: none; }
.mkb-key .katex { font-size: 1em; }
.mkb-tip { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.9; }
.mkb-tip .katex { font-size: 1.05em; color: var(--text); }

/* ---------- Trình vẽ hình (21/11/2026: bấm vào hình là mở vùng vẽ phủ cả cửa sổ) ---------- */
/* Trên trang giấy, khối đang chọn: hình bấm được để mở vùng vẽ, dưới hình là thanh nút ngắn */
.ge-host:not(.ge-full) .b-fig { cursor: pointer; border-radius: 10px; transition: box-shadow 0.12s, background 0.12s; }
.ge-host:not(.ge-full) .b-fig:hover { background: var(--orange-tint); box-shadow: 0 0 0 2px var(--orange-line); }
.ge-pagebar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 6px 0 4px; padding: 6px 8px; font-family: var(--ui); font-size: 12.5px; line-height: 1.3; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.ge-pagehint { color: var(--text-2); font-size: 12px; }

/* Vùng vẽ phủ kín cửa sổ, khóa cuộn trang; nút Xong (hoặc Esc) về trang tài liệu */
body.ge-lock { overflow: hidden; }
.ge-host.ge-full { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; margin: 0; padding: 0; background: var(--bg, #fffaf5); overflow: hidden; font-family: var(--ui); font-size: 13px; line-height: 1.3; color: var(--text); }
/* Thanh công cụ một dòng theo nhóm (kiểu GeoGebra): nút nhóm nhớ công cụ dùng gần nhất, ▾ mở các công cụ cùng nhóm */
.ge-top { display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
/* các nhóm công cụ cuộn ngang khi không đủ chỗ; cụm nút bên phải (Mẫu hình, Tìm, hoàn tác, Tùy chọn, Xong) không bao giờ bị
   đẩy ra ngoài (25/11/2026: cửa sổ nửa màn hình mất nút Xong). Đệm trên dưới để bóng của nhóm đang dùng không bị cắt */
.ge-top-tools { flex: 0 1 auto; min-width: 0; margin-block: -5px; padding-block: 5px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.ge-top-acts { display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto; }
.ge-top-acts > .btn, .ge-top-acts > .icon-btn { flex: none; }
.ge-groups { display: flex; align-items: center; gap: 3px; flex: none; width: max-content; }
.ge-grp { display: flex; align-items: stretch; border-radius: 10px; }
.ge-grp.is-on { background: var(--orange); box-shadow: 0 3px 0 var(--orange-deep); }
.ge-tool { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 9px; border: none; border-radius: 10px; background: none; color: var(--text-2); font: inherit; font-size: 12.5px; white-space: nowrap; cursor: pointer; }
.ge-grp:has(.ge-caret) .ge-tool { padding-right: 3px; border-radius: 10px 0 0 10px; }
.ge-tool:hover { background: var(--orange-tint); color: var(--text); }
.ge-grp.is-on .ge-tool, .ge-grp.is-on .ge-caret { color: var(--text); font-weight: 700; }
.ge-grp.is-on .ge-tool:hover, .ge-grp.is-on .ge-caret:hover { background: var(--orange-hover); }
.ge-tool .ic { width: 20px; height: 20px; flex: none; }
.ge-glyph { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; font-family: var(--serif); font-size: 18px; line-height: 1; font-weight: 700; }
.ge-tool-l { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
.ge-caret { display: grid; place-items: center; width: 20px; padding: 0; border: none; border-radius: 0 10px 10px 0; background: none; color: var(--text-2); cursor: pointer; }
.ge-caret:hover { background: var(--orange-tint); }
.ge-caret .ic { width: 12px; height: 12px; }
.ge-top .icon-btn.is-on { background: var(--orange-tint); color: var(--orange-deep); box-shadow: inset 0 0 0 1px var(--orange-line); }
.ge-searchbtn kbd, .ge-menu-item kbd, .pal-key { padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); font: 600 11px var(--ui); color: var(--text-2); white-space: nowrap; }
.ge-done { min-width: 78px; }
.ge-collapse .ic { transform: rotate(180deg); }
/* thanh công cụ thu gọn: chỉ còn nút Công cụ ở mép trên khung vẽ (.ge-top-tab) */
.ge-host.ge-topmin .ge-top { display: none; }
/* Hỏi Pixi trong vùng vẽ (01/12/2026): khung Pixi nằm cạnh vùng vẽ, vùng vẽ thu lại bên trái để vẫn thấy cả hình */
.ge-pixibtn.btn { gap: 6px; padding-left: 5px; border-color: #c7d4fb; background: #eef2ff; color: #1e3a8a; font-weight: 700; }
.ge-pixibtn.btn:hover { background: #e2e9ff; }
.ge-pixibtn .pixi { width: 22px; height: 22px; flex: none; border-radius: 6px; }
.ge-pixibtn.is-on { background: #dfe7ff; box-shadow: inset 0 0 0 1.5px #2f55c8; }
body.ge-lock .px-panel { top: 0; z-index: 70; }
body.px-open .ge-host.ge-full { right: var(--px-w); }
/* khung Pixi mở thì vùng vẽ hẹp lại: nút bên phải chỉ còn biểu tượng (như cửa sổ dưới 1100 px) để các nhóm công cụ còn chỗ */
body.px-open .ge-full :is(.ge-searchbtn span, .ge-searchbtn kbd, .ge-tplbtn span, .ge-morebtn span, .ge-pixibtn span) { display: none; }
body.px-open .ge-full .ge-top-acts { gap: 4px; }
/* dưới 1440 px: nhóm đang dùng hiện chữ, nhóm khác chỉ biểu tượng (rê chuột hiện tên) để thanh còn một dòng */
@media (max-width: 1439px) {
  .ge-grp:not(.is-on) .ge-tool-l { display: none; }
  .ge-grp:not(.is-on) .ge-tool { padding: 0 6px; }
  .ge-grp:not(.is-on):has(.ge-caret) .ge-tool { padding-right: 2px; }
}

.ge-main { position: relative; flex: 1; min-height: 0; display: flex; }
.ge-canvas { position: relative; flex: 1; min-width: 0; overflow: hidden; background: #fff; }
.ge-stage { position: absolute; inset: 0; outline: none; user-select: none; -webkit-user-select: none; touch-action: none; }
.ge-stage svg { display: block; touch-action: none; }
.ge-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--orange-ring); }
.ge-stage[data-tool]:not([data-tool="move"]) svg { cursor: crosshair; }
/* dấu bắt điểm (trung điểm cạnh, tâm đường tròn) khi rê bút gần (25/11/2026) */
.ge-snap-tag { font-weight: 600; paint-order: stroke; stroke: #fff; stroke-width: 0.06; }
/* thẻ hỏi khi điểm mới trùng điểm có sẵn */
.ge-dup { position: absolute; z-index: 5; display: grid; gap: 8px; max-width: min(320px, calc(100% - 16px)); padding: 10px 12px; border: 1px solid var(--orange-line); border-radius: 12px; background: #fff; box-shadow: 0 10px 26px rgba(30, 42, 56, 0.18); font-size: 13px; color: var(--text); }
.ge-dup[hidden] { display: none; }
.ge-dup p { margin: 0; line-height: 1.4; }
.ge-dup-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
/* thanh trượt độ dày nét, cỡ chấm */
.ge-lw-l { gap: 6px; }
.ge-lw { width: 110px; accent-color: var(--orange-strong); }
.ge-lw-v { min-width: 34px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
/* menu chuột phải: hàng chỉnh màu, độ dày */
.ge-menu-style { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 10px 8px; border-bottom: 1px solid var(--line); }
.ge-props.is-flash { animation: ge-flash 0.9s ease; }
@keyframes ge-flash { 0% { background: var(--orange-soft); } 100% { background: var(--surface); } }
.ge-far p { margin: 0 0 8px; }

/* Thẻ hướng dẫn nổi: tên công cụ, các bước (✓ bước đã xong, bước đang chờ tô cam), thu gọn được */
.ge-hint { position: absolute; top: 10px; left: 10px; z-index: 3; width: min(360px, calc(100% - 178px)); padding: 9px 10px 10px; border: 1px solid var(--orange-line); border-radius: 14px; background: rgba(255, 251, 246, 0.97); box-shadow: 0 10px 28px rgba(124, 58, 12, 0.14); color: var(--text-2); font-size: 13px; }
/* thẻ chừa 168 px bên phải cho ô thu phóng ở góc trên phải (cửa sổ hẹp thì hai thứ từng chồng lên nhau, 25/11/2026) */
.ge-hint.is-move:not(.is-min) { width: min(410px, calc(100% - 178px)); }
/* chữ trên thẻ không chặn chuột: bấm xuyên qua để vẽ ở chỗ thẻ che; nút, ô gõ vẫn bấm được. Chuột đi qua thì thẻ mờ đi */
.ge-hint { pointer-events: none; transition: opacity 0.15s; }
.ge-hint button, .ge-hint input { pointer-events: auto; }
.ge-hint.is-under { opacity: 0.28; }
.ge-hint.is-under:focus-within { opacity: 1; }
.ge-hint-head { display: flex; align-items: center; gap: 8px; }
.ge-hint-ic { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--orange); color: var(--text); }
.ge-hint-ic .ic { width: 18px; height: 18px; }
.ge-hint-ic .ge-glyph { font-size: 16px; }
.ge-hint-head b { font-size: 14px; color: var(--text); white-space: nowrap; }
.ge-hint-n { margin-left: auto; padding: 2px 8px; border-radius: 99px; background: var(--orange-soft); color: var(--orange-deep); font-weight: 700; font-size: 11.5px; white-space: nowrap; }
.ge-hint-one { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.ge-hint-x { display: grid; place-items: center; flex: none; width: 26px; height: 26px; margin-left: auto; padding: 0; border: none; border-radius: 8px; background: none; color: var(--text-2); cursor: pointer; }
.ge-hint-n ~ .ge-hint-x, .ge-hint-one ~ .ge-hint-x { margin-left: 2px; }
.ge-hint-x:hover { background: var(--orange-soft); color: var(--orange-deep); }
.ge-hint-x .ic { width: 14px; height: 14px; }
.ge-hint-steps { display: grid; gap: 6px; margin: 9px 0 0; padding: 0; list-style: none; }
.ge-hint-steps li { display: flex; align-items: flex-start; gap: 8px; line-height: 1.4; color: var(--text-3); }
.ge-hint-mk { display: grid; place-items: center; flex: none; width: 20px; height: 20px; border: 1.5px solid var(--line-2); border-radius: 50%; font-size: 11px; font-weight: 700; color: var(--text-3); }
.ge-hint-steps li.is-cur { color: var(--text); font-weight: 600; }
.ge-hint-steps li.is-cur .ge-hint-mk { border-color: var(--orange); background: var(--orange); color: var(--text); }
.ge-hint-steps li.is-done .ge-hint-mk { border-color: #86efac; background: #dcfce7; color: #166534; }
.ge-hint-tips { display: grid; gap: 4px; margin: 8px 0 0; padding-left: 18px; line-height: 1.4; }
.ge-hint-warn { margin: 8px 0 0; padding: 6px 8px; border-radius: 8px; background: #fde4dd; color: #8a1c0c; font-weight: 600; }
.ge-hint.is-warn { border-color: #f5a08a; }
.ge-hint.is-min { width: auto; max-width: min(620px, calc(100% - 178px)); padding: 5px 6px 5px 8px; }
.ge-hint.is-min .ge-hint-ic { width: 24px; height: 24px; border-radius: 7px; }
.ge-hint.is-pulse { animation: ge-pop 0.55s ease; }
@keyframes ge-pop { 0% { transform: scale(0.97); box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.55); } 60% { box-shadow: 0 0 0 9px rgba(249, 115, 22, 0); } 100% { transform: none; } }
/* Compa, Đặt đoạn: ô gõ độ dài nằm ngay trong bước đang chờ */
.ge-hint .ge-len-num { width: 64px; min-height: 0; height: 26px; margin: 0 2px; padding: 0 6px; font-size: 13px; text-align: right; vertical-align: middle; }
.ge-hint .ge-len-num.is-bad { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.18); }

/* Thanh chỉnh nhanh cạnh góc, đoạn đang chọn: màu, ký hiệu, cỡ, số đo; đánh dấu góc, đoạn bằng nhau */
.ge-quick { position: absolute; z-index: 4; display: grid; gap: 6px; max-width: calc(100% - 16px); padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; box-shadow: 0 10px 26px rgba(30, 42, 56, 0.16); }
.ge-quick[hidden] { display: none; }
.ge-q-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ge-q-grp { display: flex; align-items: center; gap: 2px; }
.ge-q-grp + .ge-q-grp, .ge-q-grp + .ge-qm { padding-left: 8px; border-left: 1px solid var(--line); }
.ge-sw { width: 20px; height: 20px; margin: 0 1px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--sw); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.ge-sw.is-on { box-shadow: 0 0 0 2px var(--orange-strong); }
.ge-qm { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 4px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text); font: 700 13px var(--ui); cursor: pointer; }
.ge-qm:hover { background: var(--orange-tint); }
.ge-qm.is-on { border-color: var(--orange-line); background: var(--orange-soft); color: var(--orange-deep); }
.ge-q-l { margin-right: 2px; font-size: 12px; color: var(--text-2); }
.ge-q-eq { justify-self: start; }
.ge-q-note { font-size: 11.5px; color: var(--text-3); }

/* Thu phóng khung nhìn (không đổi cỡ khi in) */
.ge-zoom { position: absolute; top: 10px; right: 10px; z-index: 3; display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.95); box-shadow: 0 4px 14px rgba(30, 42, 56, 0.1); }
.ge-zoom-pct { min-width: 44px; text-align: center; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Các bước dựng hình: thanh bên trái, đóng bằng nút «, mở lại bằng nút Các bước ở mép trái */
.ge-steps { display: flex; flex-direction: column; flex: none; width: 300px; min-height: 0; border-right: 1px solid var(--line); background: var(--surface-2); }
.ge-steps[hidden], .ge-alg[hidden] { display: none; }
.ge-steps-head { display: flex; align-items: center; gap: 6px; padding: 10px 8px 2px 14px; }
.ge-steps-head b { flex: 1; font-size: 13.5px; }
.ge-steps-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 10px 8px; border-bottom: 1px solid var(--line); }
.ge-steps-nav .ge-gap { flex-basis: 100%; height: 0; }
.ge-step-no { min-width: 82px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.ge-steps-empty { margin: 0; padding: 12px 14px; }
.ge-step-list { flex: 1; min-height: 0; display: grid; align-content: start; gap: 4px; margin: 0; padding: 6px 8px; overflow: auto; list-style: none; }
.ge-step { padding: 5px 6px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.ge-step:hover { background: rgba(249, 115, 22, 0.07); }
.ge-step.is-cur { border-color: var(--orange); background: #fff; box-shadow: 0 2px 8px rgba(234, 88, 12, 0.12); }
.ge-step.is-over { border: 1.5px dashed var(--orange-strong); }
.ge-step-row { display: flex; align-items: center; gap: 6px; }
.ge-step-n { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--orange-soft); font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; cursor: grab; }
.ge-step.is-aux .ge-step-n { background: #eef0f3; color: var(--text-3); }
.ge-step-cap { flex: 1; min-width: 0; height: 30px; padding: 0 8px; font-size: 12.5px; }
.ge-step-acts { display: none; flex-wrap: wrap; gap: 2px; margin: 4px 0 0 30px; }
.ge-step.is-cur .ge-step-acts, .ge-step:hover .ge-step-acts, .ge-step:focus-within .ge-step-acts { display: flex; }
.ge-step-aux.is-on { border-color: var(--orange); background: var(--orange-tint); }
.ge-steps-foot { display: grid; justify-items: start; gap: 6px; padding: 8px 12px 10px; border-top: 1px solid var(--line); }
.ge-steps-foot .f-hint { margin: 0; font-size: 11.5px; }
/* tùy chọn kèm nút ⓘ mở thẻ giải thích, mô phỏng (01/12/2026) */
.ge-opt-line { display: flex; align-items: center; gap: 2px; }
.ge-info.icon-btn { width: 26px; height: 26px; color: var(--text-3); }
.ge-info.icon-btn:hover { color: var(--orange-deep); }
.ge-info .ic { width: 17px; height: 17px; }
.ge-menu.ge-info-pop { width: min(390px, calc(100vw - 16px)); padding: 12px 14px; }
.ge-info-body h4 { margin: 0 0 6px; font-size: 14.5px; color: var(--text); }
.ge-info-body p { margin: 0 0 8px; font-size: 13px; line-height: 1.45; }
.ge-info-fig { display: grid; place-items: center; min-height: 130px; margin: 2px 0 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.ge-info-fig svg { width: 100%; height: auto; max-height: 240px; }
.ge-info-cap { min-height: 2.7em; font-weight: 600; color: var(--orange-deep); }
.ge-info-body .f-hint { margin: 0; font-size: 12px; }

/* Nút mở lại ở mép khung vẽ khi một thanh đã đóng (01/12/2026, chủ dự án: ba thanh đóng, mở giống nhau): thanh các bước ở
   mép trái, bảng tọa độ ở mép phải, thanh công cụ ở mép trên; biểu tượng kèm chữ */
.ge-tab { position: absolute; z-index: 3; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: #fff; box-shadow: 0 4px 14px rgba(30, 42, 56, 0.1); color: var(--orange-deep); font: 600 12px var(--ui); cursor: pointer; }
.ge-tab[hidden] { display: none; }
.ge-tab:hover { background: var(--orange-tint); }
.ge-tab .ic { width: 18px; height: 18px; flex: none; }
.ge-steps-tab, .ge-alg-tab { top: 50%; padding: 12px 6px; transform: translateY(-50%); writing-mode: vertical-rl; }
.ge-steps-tab .ic, .ge-alg-tab .ic { writing-mode: horizontal-tb; }
.ge-steps-tab { left: 0; border-left: none; border-radius: 0 12px 12px 0; }
.ge-alg-tab { right: 0; border-right: none; border-radius: 12px 0 0 12px; }
.ge-top-tab { top: 0; left: 50%; z-index: 4; padding: 6px 14px 7px; transform: translateX(-50%); border-top: none; border-radius: 0 0 12px 12px; }
.ge-top-tab .ic:last-child { width: 12px; height: 12px; }
.ge-host.ge-topmin .ge-hint { top: 46px; }

/* Bảng tọa độ, độ dài, số đo (bên phải): đóng bằng nút », mở lại bằng nút Tọa độ ở mép phải */
.ge-alg { flex: none; display: flex; flex-direction: column; width: 264px; min-height: 0; border-left: 1px solid var(--line); background: var(--surface-2); font-size: 13px; }
.ge-alg-head { display: flex; align-items: center; gap: 6px; padding: 10px 8px 6px 14px; border-bottom: 1px solid var(--line); }
.ge-alg-head b { flex: 1; font-size: 13.5px; }
.ge-alg-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 10px; }
.ge-alg h4 { margin: 8px 0 4px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--orange-deep); }
.ge-alg-body > h4:first-child { margin-top: 0; }

/* Lưới khi vẽ: chỉ trên màn hình, không in (01/12/2026, chủ dự án: mặc định bật lưới) */
.ge-wsgrid line { stroke: #e7ecf2; }
.ge-wsgrid line.ge-g5 { stroke: #d2dbe5; }
.ge-alg-row { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.ge-alg-row:hover { background: var(--surface); }
.ge-alg-row.is-sel { background: var(--orange-tint); box-shadow: inset 2px 0 0 var(--orange); }
.ge-alg-row b { min-width: 22px; font-family: var(--serif); font-style: italic; font-size: 15px; }
.ge-alg-row small { margin-left: auto; color: var(--text-2); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.ge-alg-num { width: 58px; height: 26px; padding: 0 5px; text-align: right; font-variant-numeric: tabular-nums; }
.ge-alg .f-hint { margin: 8px 0 0; white-space: normal; }
/* Compa, Đặt đoạn đang chờ độ dài: các dòng Độ dài bấm được */
.ge-alg-pick { margin: 0 0 6px; padding: 6px 8px; border-radius: 8px; background: var(--orange-tint); color: #7c2d12; font-size: 12px; line-height: 1.35; }
.ge-alg-row.is-pick { box-shadow: inset 0 0 0 1px var(--orange); background: #fff; }
.ge-alg-row.is-pick:hover { background: var(--orange-tint); }

/* Thuộc tính đối tượng đang chọn (dưới cùng) */
.ge-props { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 48px; padding: 7px 12px; border-top: 1px solid var(--line); background: var(--surface); font-size: 12.5px; }
.ge-kind { color: var(--orange-deep); }
/* mọi lựa chọn là nút có hình (01/12/2026, chủ dự án: không dùng chữ cho các lựa chọn); tên ở chú thích khi rê chuột */
.ge-pi.ge-qm { min-width: 34px; height: 34px; padding: 0 5px; color: var(--text); }
.ge-pi svg { display: block; }
.ge-pi.is-on { color: var(--orange-deep); }
.ge-pi-del.ge-qm { color: #b91c1c; }
.ge-pi-del.ge-qm:hover { background: #fee2e2; }
.ge-props .ge-pgrp { gap: 2px; }
.ge-pf { gap: 5px; }
.ge-pf-ic { display: inline-grid; place-items: center; flex: none; color: var(--text-2); }
.ge-pf-ic svg { display: block; }
.ge-gap { flex: 1; }

/* Menu nhóm công cụ, menu chuột phải, bảng Tùy chọn */
.ge-menu { position: fixed; z-index: 20; min-width: 230px; max-height: calc(100vh - 16px); overflow: auto; padding: 5px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; box-shadow: 0 14px 36px rgba(30, 42, 56, 0.2); animation: rise 0.12s ease; }
.ge-menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: none; border-radius: 8px; background: none; color: var(--text); font: 13px var(--ui); text-align: left; cursor: pointer; }
.ge-menu-item:hover, .ge-menu-item:focus-visible { background: var(--orange-tint); outline: none; }
.ge-menu-item.is-on { background: var(--orange-soft); font-weight: 700; }
.ge-menu-item .ic { flex: none; width: 18px; height: 18px; color: var(--orange-deep); }
.ge-menu-item .ge-glyph { width: 18px; font-size: 16px; color: var(--orange-deep); }
.ge-menu-l { flex: 1; }
.ge-menu-sep { padding: 7px 10px 3px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--orange-deep); }
.ge-menu-sep:empty { margin: 4px 6px; padding: 0; border-top: 1px solid var(--line); }
.ge-menu.ge-opts { width: min(400px, calc(100vw - 16px)); padding: 10px 12px; }
.ge-opts-sec + .ge-opts-sec { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.ge-opts-sec h4 { margin: 0 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--orange-deep); }
.ge-opts-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ge-opts .btn.is-on { background: var(--orange-tint); border-color: var(--orange); }

/* Hộp tìm chức năng (Ctrl+F khi vẽ, Ctrl+K ở mọi nơi) */
.pal-wrap { position: fixed; inset: 0; z-index: 95; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; background: rgba(56, 30, 10, 0.18); }
.pal { display: flex; flex-direction: column; width: min(620px, 100%); max-height: 72vh; overflow: hidden; border: 1px solid var(--line-2); border-radius: 16px; background: #fff; box-shadow: 0 24px 60px rgba(56, 30, 10, 0.28); font-family: var(--ui); animation: rise 0.14s cubic-bezier(0.16, 1, 0.3, 1); }
.pal-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.pal-head > .ic { flex: none; width: 20px; height: 20px; color: var(--orange-deep); }
.pal-inp, .pal-inp:focus { flex: 1; height: 40px; padding: 0; border: none; background: none; box-shadow: none; font-size: 16px; }
.pal-list { flex: 1; min-height: 0; overflow: auto; padding: 6px; }
.pal-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; border-radius: 10px; background: none; color: var(--text); font: 14px var(--ui); text-align: left; cursor: pointer; }
.pal-item.is-on { background: var(--orange-tint); box-shadow: inset 3px 0 0 var(--orange); }
.pal-item .ic { flex: none; width: 18px; height: 18px; color: var(--orange-deep); }
.pal-glyph { display: inline-grid; place-items: center; flex: none; width: 18px; font: 700 15px var(--serif); color: var(--orange-deep); }
.pal-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-group { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.pal-empty { margin: 12px; color: var(--text-2); }
.pal-foot { padding: 7px 14px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 11.5px; color: var(--text-3); }

@media (prefers-reduced-motion: reduce) {
  .ge-hint.is-pulse, .ge-menu, .pal, .ge-props.is-flash { animation: none; }
}
/* Cửa sổ nửa màn hình (chủ dự án chia đôi màn hình: đề bên này, AI Math Studio bên kia): nút Mẫu hình, Tìm, Tùy chọn chỉ còn
   biểu tượng (rê chuột hiện tên) để các nhóm công cụ còn chỗ */
@media (max-width: 1100px) {
  .ge-searchbtn span, .ge-searchbtn kbd, .ge-tplbtn span, .ge-morebtn span, .ge-pixibtn span { display: none; }
  .ge-top-acts { gap: 4px; }
}
/* điện thoại: khung Pixi phủ kín màn hình (không chia đôi với vùng vẽ) */
@media (max-width: 560px) {
  body.px-open .ge-host.ge-full { right: 0; }
}
/* Màn hình hẹp: thanh các bước, bảng tọa độ nổi lên trên khung vẽ; nút chỉ còn biểu tượng; thanh thuộc tính một dòng cuộn
   ngang để khung vẽ không bị thanh nhiều dòng ăn mất chiều cao */
@media (max-width: 900px) {
  .ge-steps { position: absolute; top: 0; bottom: 0; left: 0; z-index: 6; box-shadow: 8px 0 24px rgba(30, 42, 56, 0.14); width: min(300px, 86vw); }
  .ge-alg { position: absolute; top: 0; right: 0; bottom: 0; z-index: 6; box-shadow: -8px 0 24px rgba(30, 42, 56, 0.14); }
  .ge-tool-l { display: none; }
  .ge-grp .ge-tool { padding: 0 6px; }
  .ge-top { gap: 3px; padding: 6px; }
  .ge-groups { gap: 1px; }
  .ge-props { flex-wrap: nowrap; gap: 6px 12px; overflow-x: auto; scrollbar-width: thin; white-space: nowrap; }
  .ge-props > * { flex: none; }
  .ge-props .f-hint { white-space: nowrap; }
}
/* điện thoại: phóng to bằng hai ngón nên bỏ ô thu phóng; thẻ hướng dẫn dùng cả bề ngang */
@media (max-width: 560px) {
  .ge-zoom { display: none; }
  .ge-hint { width: min(360px, calc(100% - 20px)); }
  .ge-hint.is-move:not(.is-min) { width: min(410px, calc(100% - 20px)); }
  .ge-hint.is-min { max-width: calc(100% - 20px); }
}

/* Thư viện mẫu hình */
.modal.gg-modal { width: min(1040px, 100%); }
.gg { display: flex; flex-direction: column; gap: 10px; }
.gg-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.gg-list { display: flex; flex-direction: column; gap: 14px; }
.gg-title { margin: 0 0 6px; font-size: 14px; font-weight: 800; }
.gg-sec.is-hint { padding: 10px 12px; border: 1px solid var(--orange-line, #fdba74); border-radius: var(--radius); background: var(--orange-tint); }
.gg-context { margin: 0 0 8px; }
.gg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gg-card { display: flex; flex-direction: column; gap: 3px; padding: 6px 8px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-align: left; cursor: pointer; transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s; }
.gg-card:hover, .gg-card:focus-visible { border-color: var(--orange); box-shadow: 0 8px 20px rgba(234, 88, 12, 0.16); transform: translateY(-2px); outline: none; }
.gg-thumb { display: block; border-radius: 8px; background: #fff; }
.gg-thumb svg { display: block; width: 100%; height: auto; }
.gg-name { font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--text); }
.gg-lop { font-size: 11.5px; color: var(--text-2); }

/* ---------- Viết tay (ink-editor.js) ---------- */
/* thanh công cụ, dòng hướng dẫn, khung viết: kiểu của trình vẽ hình cũ, tách tên riêng từ 21/11/2026 (trình vẽ hình thành vùng vẽ phủ cửa sổ) */
.ink-bar, .ink-hint, .ink-foot { font-family: var(--ui); font-size: 12.5px; line-height: 1.3; }
.ink-bar, .ink-foot { display: flex; flex-wrap: wrap; gap: 3px; padding: 6px; margin-top: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.ink-tool {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 62px; height: 52px; padding: 4px 5px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--text-2); font-size: 11.5px;
  transition: background 0.12s, transform 0.12s;
}
.ink-tool:hover { background: var(--surface); border-color: var(--line); color: var(--text); transform: translateY(-1px); }
.ink-tool.is-on { background: var(--orange); color: var(--text); font-weight: 700; box-shadow: 0 3px 0 var(--orange-deep); }
.ink-tool .ic { width: 20px; height: 20px; }
.ink-hint { min-height: calc(2.6em + 14px); padding: 7px 10px; background: var(--orange-tint); border-left: 1px solid var(--line); border-right: 1px solid var(--line); color: #7c2d12; }
.ink-hint.is-warn { background: #fde4dd; color: #8a1c0c; }
.ink-stage { display: flex; justify-content: center; padding: 8px; background: #fff; border: 1px solid var(--line); outline: none; overflow-x: auto; user-select: none; -webkit-user-select: none; }
.ink-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--orange-ring); }
.ink-stage svg { max-width: 100%; height: auto; outline: 1px dashed #f0d4bd; }
.ink-bar, .ink-foot { align-items: center; }
.ink-foot { border-radius: 0 0 var(--radius) var(--radius); margin: 0 0 8px; border-top: none; }
.ink-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--line); }
.ink-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); background: var(--dot); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.ink-color.is-on { box-shadow: 0 0 0 2px var(--orange); }
.ink-size { width: 34px; height: 30px; display: grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; }
.ink-size i { display: block; width: 20px; height: var(--w); min-height: 2px; border-radius: 4px; background: var(--ink); }
.ink-size:hover { background: var(--surface); border-color: var(--line); }
.ink-size.is-on { background: var(--surface); border-color: var(--orange); }
.ink-foot select.inp { width: auto; }
.ink-num { display: inline-flex; align-items: center; gap: 6px; }
.ink-num .inp-num { width: 64px; }
/* ngón tay cuộn trang khi đã có bút (ink-editor đặt touch-action cho khung), nên hình kế thừa giá trị đó */
.ink-stage svg { touch-action: inherit; cursor: crosshair; }
.b-ink.is-empty { position: relative; }
.b-ink .ink-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-2); font: 500 14px/1.3 var(--ui); pointer-events: none; }
.b-ink.is-empty svg { outline: 1px dashed var(--line); }

/* ---------- Hộp thoại, menu, thông báo ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(56, 30, 10, 0.32); animation: fade 0.15s ease; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: 0 24px 60px rgba(90, 40, 8, 0.25); animation: rise 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
.modal.is-wide { width: min(920px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 800; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.form { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.box legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

.start h3 { margin: 14px 0 8px; font-size: 13.5px; }
.start-lead { margin: 0 0 4px; color: var(--text-2); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.tpl-card { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-align: left; box-shadow: 0 2px 0 var(--line); transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s; }
.tpl-card:hover { border-color: var(--orange-line); box-shadow: 0 8px 22px rgba(234, 88, 12, 0.14); transform: translateY(-2px); }
.tpl-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--orange-soft); color: var(--orange-deep); flex: none; }
.tpl-ic .ic { width: 21px; height: 21px; }
.tpl-txt { display: flex; flex-direction: column; gap: 3px; padding-right: 52px; }
.tpl-txt b { font-size: 14px; }
.tpl-txt small { color: var(--text-3); font-size: 12px; line-height: 1.45; }
.tpl-lop { position: absolute; top: 10px; right: 10px; padding: 2px 8px; border-radius: 20px; background: var(--orange); color: var(--text); font-size: 11px; font-weight: 700; }

.docs { display: flex; flex-direction: column; gap: 12px; }
.doc-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.doc-row { display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px 4px; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: none; }
.doc-row.is-cur { background: var(--orange-tint); }
.doc-open { flex: 1; display: flex; align-items: center; gap: 10px; padding: 8px; border: none; background: none; text-align: left; border-radius: 8px; min-width: 0; }
.doc-open:hover { background: var(--surface-2); }
.doc-open .ic { width: 20px; height: 20px; color: var(--orange-deep); }
.doc-open span { display: flex; flex-direction: column; min-width: 0; }
.doc-open b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-open small { color: var(--text-3); font-size: 12px; }

/* Ngân hàng câu hỏi (thêm 20/11/2026) */
.modal.bk-modal { width: min(1000px, 100%); }
.bk { display: flex; flex-direction: column; gap: 10px; }
.bk [hidden] { display: none !important; }
.bk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bk-bar .inp { height: 34px; padding-top: 0; padding-bottom: 0; }
.bk-topic { max-width: 280px; }
.bk-search { flex: 1 1 200px; min-width: 0; }
.bk-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 30px; font-size: 13px; color: var(--text-2); }
.bk-list { display: flex; flex-direction: column; gap: 8px; }
.bk-item { position: relative; padding: 8px 12px 6px 42px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.bk-item:hover { border-color: var(--orange-line); }
.bk-item.is-sel { border-color: var(--orange); background: var(--orange-tint); box-shadow: inset 4px 0 0 var(--orange); }
.bk-chk { position: absolute; left: 14px; top: 11px; width: 18px; height: 18px; margin: 0; accent-color: var(--orange-strong); cursor: pointer; }
.bk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 26px; }
.bk-meta .q-chip { margin-left: 0; }
.bk-meta .q-mine { color: var(--orange-deep); background: var(--orange-tint); border-color: var(--orange-line); }
.bk-del { margin-left: auto; width: 28px; height: 28px; }
.bk-prev { font-family: var(--serif); font-size: 15.5px; line-height: 1.45; color: var(--ink); overflow-x: auto; }
.bk-prev .b-q { margin: 0.1em 0 0.2em; }
.bk-prev .b-fig, .bk-prev .b-table-wrap { justify-content: flex-start; margin: 0.3em 0 0.2em 1.3em; }
.bk-prev .b-fig svg { max-width: 100%; height: auto; }
.bk-empty { margin: 0; padding: 20px 16px; text-align: center; color: var(--text-3); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.bk-more { align-self: center; }
.bk-tools { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.bk-row { align-items: center; }
.bk-lbl { font-size: 13px; color: var(--text-2); }
.bk-save { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13.5px; border: 1px solid var(--orange-line); border-radius: var(--radius-sm); background: var(--orange-tint); }
.modal-foot .btn-primary:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
@media (max-width: 560px) {
  .bk-item { padding-left: 36px; }
  .bk-chk { left: 10px; }
  .bk-topic { max-width: 100%; }
}

.add-pop { position: fixed; z-index: 90; width: min(560px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow-y: auto; padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 44px rgba(90, 40, 8, 0.2); animation: rise 0.14s cubic-bezier(0.16, 1, 0.3, 1); }
.add-pop-sm { width: 300px; grid-template-columns: 1fr; }
.add-gtitle { padding: 6px 8px 2px; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.add-item-sm b { font-weight: 500; }

.mx { border-collapse: collapse; width: 100%; font-size: 13px; }
.mx th, .mx td { border: 1px solid var(--line-2); padding: 6px 8px; text-align: center; }
.mx th { background: var(--surface-2); font-weight: 600; }
.mx-total td, .mx-total th { font-weight: 700; background: var(--orange-soft); }
/* Ma trận theo chủ đề: tóm tắt, thanh tỉ lệ mức độ, bảng hai tầng tiêu đề, điểm mỗi câu, chỉ tiêu */
.mx-wrap { display: grid; gap: 12px; }
.mx-sum { margin: 0; font-size: 13.5px; }
.mx-sum small { color: var(--text-3); }
.mx-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--line); }
.mx-seg { display: block; height: 100%; }
.mx-scroll { overflow-x: auto; }
.mx-topic th:first-child, .mx-topic tbody th { text-align: left; }
.mx-topic tr > th[scope], .mx-topic tr > th:first-child { white-space: nowrap; }
.lv-biet { --lv: #2f7d5b; }
.lv-hieu { --lv: #7c4dbd; }
.lv-vandung { --lv: #c2410c; }
.mx-seg.lv-biet, .mx-seg.lv-hieu, .mx-seg.lv-vandung { background: var(--lv); }
.mx th.lv-biet, .mx th.lv-hieu, .mx th.lv-vandung { color: var(--lv); }
.mx-pts, .mx-target { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.mx-pt { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.mx-pt .inp-num { width: 70px; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.chip-ok { background: #e7f6ee; color: var(--ok); }
.chip-warn { background: #fff1e6; color: #9a3412; }
.chk-hint { display: block; width: 100%; margin-left: 22px; color: var(--text-3); font-size: 12px; }
.chk:has(.chk-hint) { flex-wrap: wrap; row-gap: 0; }
.grow-wrap { display: flex; flex: 1; min-width: 0; }
.grow-wrap .inp { width: 100%; }
/* Bảng đáp án các mã, xem trước trong hộp trộn đề */
.key-prev { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.key-prev:has(> p) { border: 0; max-height: none; }
.key-prev-tbl { border-collapse: collapse; width: 100%; font-size: 13px; text-align: center; }
.key-prev-tbl th, .key-prev-tbl td { padding: 4px 8px; border-bottom: 1px solid var(--line); }
.key-prev-tbl thead th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; }
.key-prev-tbl td:first-child { color: var(--text-3); }
/* Nhãn trên trang soạn: mức độ (bấm để đổi), giữ chỗ khi trộn, chủ đề; đáp án hiện và bấm được */
.q-chip { display: inline-block; margin-left: 2px; padding: 0 7px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--surface); font: 600 11.5px/1.6 var(--ui); color: var(--text-3); vertical-align: 0.15em; }
button.q-chip { cursor: pointer; }
button.q-chip:hover { border-color: var(--orange-line); background: var(--orange-tint); }
.q-chip.lv-biet, .q-chip.lv-hieu, .q-chip.lv-vandung { color: var(--lv); border-color: currentColor; }
.q-chip.lv-none { border-style: dashed; }
.q-chip.q-lock { color: var(--orange-deep); background: var(--orange-tint); border-color: var(--orange-line); }
.q-chip.q-topic { max-width: 22em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.b-q.is-edit [data-act] { cursor: pointer; }
.b-q.is-edit .q-letter:hover { color: var(--orange-deep); }
.b-q.is-edit .q-opt.is-shown { font-weight: inherit; }
.b-q.is-edit .q-opt.is-shown .q-letter { color: var(--orange-deep); font-weight: 700; }
.b-q.is-edit .q-tf-ans.is-shown { color: var(--orange-deep); font: 600 12px/1.6 var(--ui); padding: 0 8px; border: 1px dashed var(--orange-line); border-radius: 99px; }
.b-q.is-edit .q-short-box .ans.is-shown { color: var(--orange-deep); }
.help { border-collapse: collapse; width: 100%; font-size: 13px; }
.help th { text-align: left; vertical-align: top; padding: 8px 12px 8px 0; white-space: nowrap; color: var(--orange-deep); }
.help td { padding: 8px 0; border-bottom: 1px solid var(--line); line-height: 1.6; }
.bulk-prev { display: flex; flex-direction: column; gap: 8px; font-family: var(--serif); font-size: 15px; }
.bulk-q { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.bulk-opts { display: flex; flex-wrap: wrap; gap: 4px 18px; padding-left: 14px; }
.bulk-opts .ok { font-weight: 700; color: var(--ok); }
.bulk-h { font-family: var(--serif); font-size: 15px; font-weight: 700; }
.bulk-t { font-family: var(--serif); font-size: 14px; color: var(--text-2); }
.bulk-imgs img { max-height: 90px; max-width: 170px; margin: 6px 8px 0 0; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
/* bảng số liệu đọc từ PDF trong phần xem trước */
.bulk-table { margin: 6px 0 0; border-collapse: collapse; font-size: 13px; }
.bulk-table th, .bulk-table td { padding: 2px 8px; border: 1px solid var(--line-2); text-align: center; }
.bulk-table th:first-child, .bulk-table td:first-child { text-align: left; }

/* ---------- Nhập đề từ tệp ---------- */
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 16px; border: 2px dashed var(--orange-line); border-radius: var(--radius); background: var(--orange-tint); text-align: center; cursor: pointer; transition: background 0.12s, border-color 0.12s, transform 0.12s; }
.drop .ic { width: 30px; height: 30px; color: var(--orange-deep); }
.drop b { font-size: 14.5px; }
.drop span { font-size: 12.5px; color: var(--text-3); }
.drop:hover, .drop.is-over { background: var(--orange-soft); border-color: var(--orange); }
.drop.is-over { transform: scale(1.01); }
.imp-status { font-size: 13px; line-height: 1.55; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.imp-status:empty { display: none; }
.imp-status.is-ok { background: #effaf3; border-color: #bfe6cf; color: #14532d; }
.imp-status.is-warn { background: var(--orange-tint); border-color: var(--orange-line); color: #7c2d12; }
.imp-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.imp-mode[hidden], .imp-text[hidden] { display: none; }
.imp-text { display: flex; flex-direction: column; gap: 10px; }
.warn-text { color: #9a3412; font-weight: 600; }
.drop-overlay { position: fixed; inset: 0; z-index: 70; display: none; place-items: center; padding: 24px; background: rgba(255, 237, 213, 0.85); pointer-events: none; }
.drop-overlay.is-on { display: grid; }
.drop-overlay > div { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 520px; padding: 34px 40px; border: 3px dashed var(--orange); border-radius: 24px; background: #fff; text-align: center; box-shadow: 0 24px 60px rgba(124, 58, 12, 0.18); }
.drop-overlay .ic { width: 40px; height: 40px; color: var(--orange-deep); }
.drop-overlay b { font-size: 20px; }
.drop-overlay span { color: var(--text-2); }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 120; transform: translate(-50%, 20px); max-width: min(560px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 12px; background: var(--text); color: #fff; font-size: 13.5px; box-shadow: 0 12px 30px rgba(30, 42, 56, 0.3); opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-warn { background: #8a1c0c; }
.fab { display: none; }

/* ---------- Tài khoản, phím tắt (thêm 20/11/2026) ---------- */
/* chưa đăng nhập: nút "Đăng nhập" có chữ, nền xanh than chữ trắng (14:1) cho nổi giữa các nút nền trong (01/12/2026, chủ
   dự án: "làm thành button và nổi bật lên nhiều hơn"); đã đăng nhập: chỉ còn biểu tượng người, màu theo trạng thái đồng bộ */
.tb-account:not(.is-on) { border-color: var(--text); background: var(--text); color: #fff; font-weight: 700; box-shadow: 0 3px 0 #0b1420; }
.tb-account:not(.is-on) .ic { color: #fff; }
.tb-account:not(.is-on):hover { background: #2d3f55; color: #fff; }
.tb-account:not(.is-on):active { transform: translateY(2px); box-shadow: 0 1px 0 #0b1420; }
@media (min-width: 981px) {
  .tb-account.is-on { padding: 0 8px; }
}
.tb-account.is-on span { display: none; }
.tb-account.is-on .ic { color: var(--ok); }
/* nút "Đăng nhập" có chữ rộng hơn biểu tượng khoảng 85 px: khi chưa đăng nhập, các mốc ẩn chữ lùi lên tương ứng (đo 01/12/2026
   từ 1920 tới 330 px, bước 5 px; nâng thêm khoảng 20 px khi chữ "AI Math Studio" giữ một dòng); từ 1305 px trở xuống nút chỉ
   còn biểu tượng, vẫn nền xanh than */
@media (max-width: 1680px) {
  .topbar:has(.tb-account:not(.is-on)) :is(.save-status span, #btn-shuffle span) { display: none; }
}
@media (max-width: 1500px) {
  .topbar:has(.tb-account:not(.is-on)) :is(#btn-print span, #btn-ans span) { display: none; }
}
@media (max-width: 1365px) {
  .topbar:has(.tb-account:not(.is-on)) #btn-bulk span { display: none; }
}
@media (max-width: 1305px) {
  .tb-account span { display: none; }
  .tb-account { padding: 0 9px; }
}
.tb-account.is-on[data-state="offline"] .ic, .tb-account.is-on[data-state="error"] .ic { color: #9a3412; }
.save-status[data-state="cloud-ok"] .ic, .save-status[data-state="cloud-idle"] .ic { color: var(--ok); }
.save-status[data-state="cloud-offline"] .ic, .save-status[data-state="cloud-error"] .ic { color: #9a3412; }
.btn-link { border: none; background: none; padding: 0 4px; color: var(--orange-deep); text-decoration: underline; text-underline-offset: 2px; font-size: 13px; cursor: pointer; }
.btn-link:hover { color: var(--text); }
/* nút trông như liên kết (hộp tài khoản, khung Pixi): đặt ở đây, ngoài khối CSS riêng của Pixi (lỗi 30/11/2026: thay khối Pixi
   làm mất luật này, "Đăng nhập bằng mật khẩu" hiện thành nút xám) */
.linkish { padding: 0; border: none; background: none; color: var(--orange-deep); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.linkish:hover { color: var(--text); }
.acc { display: flex; flex-direction: column; gap: 12px; }
.acc-lead { margin: 0; color: var(--text-2); line-height: 1.5; }
.acc-seg { align-self: flex-start; }
.acc-form { gap: 10px; }
.acc-form .inp { width: 100%; }
.acc-go { align-items: center; gap: 10px; }
.acc-err { margin: 0; min-height: 1.2em; color: var(--danger); font-size: 13px; }
.acc-err:empty { min-height: 0; }
.acc-notice { margin: 0; padding: 9px 12px; border-radius: 9px; background: var(--orange-tint); border: 1px solid var(--orange-line); font-size: 13.5px; line-height: 1.45; }
.acc-who { display: flex; align-items: center; gap: 10px; }
.acc-who > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acc-who b { overflow-wrap: anywhere; }
.acc-avatar .ic { width: 36px; height: 36px; color: var(--ok); }
.acc-sync { color: var(--text-3); font-size: 12.5px; }
.acc-sync.is-offline, .acc-sync.is-error { color: #9a3412; font-weight: 600; }
.acc-name { align-items: flex-end; }
.acc-name .f { flex: 1; min-width: 180px; }
.acc-out .chk { align-items: flex-start; }
/* Đăng nhập kiểu AptisFun (30/11/2026): Pixi chào trong bóng thoại, Google, mã 6 số qua email */
.acc-hello { display: flex; align-items: center; gap: 12px; }
.acc-pixi { width: 68px; flex: none; }
.acc-bubble { position: relative; margin: 0; padding: 10px 13px; border: 2px solid var(--text); border-radius: 14px; background: #fff1e4; font-weight: 600; line-height: 1.45; }
.acc-bubble::before { content: ''; position: absolute; left: -8px; top: 50%; width: 12px; height: 12px; margin-top: -6px; background: #fff1e4; border-left: 2px solid var(--text); border-bottom: 2px solid var(--text); transform: rotate(45deg); }
.acc-wide { width: 100%; justify-content: center; min-height: 44px; font-size: 15px; }
.acc-google { gap: 10px; border: 1.5px solid var(--line-2); background: #fff; color: var(--text); font-weight: 700; }
.acc-google:hover { background: #fffaf5; border-color: var(--text-3); }
.acc-g { width: 20px; height: 20px; flex: none; }
.acc-or { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--text-3); font-size: 13px; }
.acc-or::before, .acc-or::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.acc-perks { display: grid; gap: 7px; margin: 2px 0 0; padding: 0; list-style: none; font-size: 14px; }
.acc-perks li { display: flex; align-items: flex-start; gap: 8px; }
.acc-tick { display: grid; place-items: center; width: 20px; height: 20px; flex: none; margin-top: 1px; border-radius: 50%; background: #e3f6ec; color: #17855a; }
.acc-tick .ic { width: 13px; height: 13px; }
.acc-alt { margin: 0; text-align: center; font-size: 14px; }
.acc-fine { margin: 0; font-size: 12.5px; }
.acc-code { width: 100%; height: 58px; text-align: center; font-size: 28px; font-weight: 700; letter-spacing: 0.35em; font-variant-numeric: tabular-nums; }
.acc-code::placeholder { color: var(--line-2); letter-spacing: 0.35em; }
.acc-links { justify-content: center; gap: 18px; font-size: 14px; }
.acc-links .linkish:disabled { color: var(--text-3); text-decoration: none; cursor: default; }
@media (max-width: 560px) { .acc-pixi { width: 54px; } .acc-bubble { font-size: 14px; } }
kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); font: 600 12px/1.5 var(--ui); color: var(--text); text-align: center; white-space: nowrap; }
.keys { display: flex; flex-direction: column; gap: 8px; }
.keys-search { width: 100%; max-width: 320px; }
.keys-group { margin: 10px 0 2px; font-size: 13px; color: var(--text-2); }
.key-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; min-height: 40px; }
.key-row + .key-row { border-top: 1px solid var(--line); }
.key-label { min-width: 0; }
.key-label small { color: var(--text-3); }
.key-chips { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.key-chip { display: inline-flex; align-items: center; gap: 2px; }
.key-x { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: none; border-radius: 50%; background: none; color: var(--text-3); }
.key-x:hover { background: var(--orange-tint); color: var(--danger); }
.key-x .ic { width: 12px; height: 12px; }
.key-add.is-capturing { background: var(--orange-soft); border-color: var(--orange); color: var(--text); font-weight: 700; }
.macro-edit { margin-top: 4px; }
.macro-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.macro-steps li > * { vertical-align: middle; }
.macro-steps .icon-btn { margin-left: 6px; }
@media (max-width: 560px) {
  .key-row { flex-direction: column; align-items: flex-start; }
  .key-chips { justify-content: flex-start; }
}

/* ---------- Màn hình hẹp (máy tính bảng, điện thoại) ---------- */
/* Nút "Hỏi Pixi" giữ cả logo lẫn chữ (chủ dự án 30/11/2026) tới 1081 px; nhường chỗ bằng cách bỏ chữ các nút có biểu
   tượng dễ nhận. Mốc đo 30/11/2026 (tools: đo #btn-more không chạm mép ở 1920-390 px): */
/* dưới 1600 px: chữ "Đã lưu trên máy này" thu thành dấu tích, nút Trộn đề bỏ chữ */
@media (max-width: 1600px) {
  .save-status span { display: none; }
  #btn-shuffle span { display: none; }
}
/* máy 1366 px (phổ biến ở trường): bỏ thêm chữ ở nút In (máy in) và Ẩn đáp án (con mắt) */
@media (max-width: 1420px) {
  #btn-print span, #btn-ans span { display: none; }
}
/* 1181-1350 px (máy 1280 px): bỏ chữ ở ba nút có biểu tượng dễ nhận (máy in, con mắt, trộn), giữ chữ các nút khác.
   Mốc 1350 (trước là 1310) tính cả nút tài khoản thêm 20/11/2026; đo lại ở 1280, 1366, 768 px khi thêm nút. */
@media (max-width: 1350px) {
  #btn-print span, #btn-ans span, #btn-shuffle span, #btn-bulk span { display: none; }
}
@media (max-width: 1215px) {
  #btn-new span { display: none; }
}
@media (max-width: 1180px) {
  .tb-btn span { display: none; }
  .tb-primary span, #btn-pixi span { display: inline; }
  .save-status span { display: none; }
}
/* hẹp hơn: nút Pixi chỉ còn logo, lề gọn */
@media (max-width: 1080px) {
  #btn-pixi span { display: none; }
  #btn-pixi { padding: 0 5px; }
}
/* 768-980 px: chữ trên nút đã ẩn, thu lề nút để vừa cả nút tài khoản. Nút Pixi (25/11/2026) làm thanh hết chỗ ở 768 px
   (đo: nút Thêm chạm mép phải), nên ẩn thêm nút Trộn đề: vẫn trộn được trong hộp In (ô Số mã đề) và Ctrl+K.
   Mốc 980 (trước là 940): 941-980 px tràn 17 px (đo 30/11/2026) */
@media (max-width: 980px) {
  .tb-btn { padding: 0 8px; }
  #btn-redo, #btn-shuffle { display: none; }
}
/* chỉ màn hình: khi in, trang giấy hẹp hơn 900 px nhưng phương án vẫn phải 4 cột như đề (lỗi 02/12/2026: in ra 2 cột) */
@media screen and (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; }
  .desk { padding: 12px 8px 110px; }
  .paper { padding: 0.9cm 0.7cm 1.4cm; min-height: auto; }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: 18px; z-index: 40; width: 58px; height: 58px; border: none; border-radius: 50%; background: var(--orange); color: var(--text); box-shadow: 0 4px 0 var(--orange-deep), 0 10px 26px rgba(234, 88, 12, 0.35); }
  .fab .ic { width: 26px; height: 26px; }
  .tb-meta, .logo-word { display: none; }
  .add-pop { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .q-opts.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper .q-stem, .paper .b-text { text-align: left; }
}
/* dưới 768 px (máy tính bảng dọc nhỏ, điện thoại): ẩn bớt nút (vẫn có trong menu, phím tắt); trước là 560 px nhưng
   561-767 px đã tràn thanh trên cùng (đo 20/11/2026) */
@media (max-width: 767px) {
  #btn-bulk, #btn-shuffle, #btn-new, #btn-redo, .save-status { display: none; }
  .topbar { gap: 4px; padding: 0 6px; }
  .tb-title { min-width: 0; }
  .tb-primary span { display: none; }
  .tb-btn, .tb-icon { padding: 0 7px; }
}
/* điện thoại 360-420 px (phần lớn máy Android 360 px, iPhone SE 375 px): thu lề nút, khoảng cách, logo nhỏ lại cho thanh không
   tràn (đo 01/12/2026: bản cũ ở 375 px tràn 7 px, 360 px tràn 22 px); không ẩn thêm nút nào */
@media (max-width: 420px) {
  .topbar { gap: 2px; padding: 0 4px; }
  .tb-actions { gap: 1px; }
  .logo-mark { width: 32px; height: 32px; }
  .tb-btn, .tb-icon { padding: 0 5px; }
  #btn-pixi { padding: 0 3px; }
}

/* ---------- Trình chiếu ---------- */
body.is-presenting { overflow: hidden; }
.present { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-rows: 1fr auto; --pscale: 1; }
.present.theme-paper {
  --ink: #1b2430; --paper: #fff; --sel: #ea580c;
  color: var(--text);
  background: radial-gradient(90% 70% at 100% 0%, #ffedd5 0%, rgba(255, 237, 213, 0) 60%), #fffcf8;
}
.present.theme-chalk {
  --ink: #f3f1e7; --ink-soft: #b9c8bd; --paper: #1f3d33; --grid: #3e5d51; --fill: rgba(255, 255, 255, 0.08); --sel: #ffb199;
  --c1: #9fd3ff; --c2: #ffa093; --c3: #bdf2ae; --c4: #e3baff; --c5: #ffd27a;
  color: var(--ink);
  background: radial-gradient(120% 90% at 50% 0%, #2b5c4c 0%, #1f4a3d 55%, #183b31 100%);
}
.slide-stage { overflow: auto; display: flex; justify-content: center; align-items: flex-start; padding: 4vh 5vw 2vh; }
.slide { width: min(1240px, 100%); font-family: var(--serif); font-size: calc(clamp(20px, 2.25vw, 40px) * var(--pscale)); line-height: 1.45; }
.s-title { margin: 0 0 0.5em; font-family: var(--hand); font-weight: 400; font-size: 1.7em; line-height: 1.15; }
.theme-paper .s-title { color: var(--orange-deep); }
.s-body > .s-item + .s-item { margin-top: 0.35em; }
.slide .q-opts { gap: 0.3em 1.4em; margin-top: 0.4em; }
.slide .q-opt { padding: 0.05em 0.3em; border-radius: 10px; transition: background 0.2s, box-shadow 0.2s; }
.theme-paper .slide .q-opt.ans.is-shown { background: var(--orange-soft); box-shadow: 0 0 0 2px var(--orange); }
.theme-chalk .slide .q-opt.ans.is-shown { background: rgba(255, 216, 77, 0.22); box-shadow: 0 0 0 2px #ffd84d; }
.theme-paper .slide .q-sol { background: #fff; border-left-color: var(--orange); box-shadow: 0 2px 10px rgba(124, 58, 12, 0.08); }
.theme-chalk .slide .q-sol { border-left-color: #ffd84d; background: rgba(255, 255, 255, 0.06); }
.slide .q-short-box, .slide .q-tf-ans { border-color: currentColor; }
.slide .b-fig svg { height: 50vh; width: auto; max-width: 100%; }
.slide .fig-nl { height: 16vh !important; }
.slide .b-table th, .slide .b-table td { border-color: currentColor; }
.slide .ph { display: none; }
.step-hidden { visibility: hidden; opacity: 0; }
.s-item, .q-sol-line, .b-math-line { transition: opacity 0.25s ease; }
.b-fig.is-zoomed { position: fixed; inset: 3vh 3vw 11vh; z-index: 5; display: flex; align-items: center; justify-content: center; border-radius: 18px; background: inherit; }
.theme-chalk .b-fig.is-zoomed { background: #1f4a3d; box-shadow: 0 0 0 1px #3d6b5c; }
.theme-paper .b-fig.is-zoomed { background: #fff; box-shadow: 0 0 0 1px var(--line-2), 0 20px 50px rgba(124, 58, 12, 0.15); }
.slide .b-fig.is-zoomed svg { height: 84vh; }
/* Thanh nút nằm trên lớp vẽ .pr-ink (z-index 3): đang dùng bút vẫn bấm được Tắt bút, Hoàn tác (lỗi 17/11/2026) */
.pr-bar { position: relative; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px; padding: 6px 10px; opacity: 0.55; transition: opacity 0.2s; font-family: var(--ui); font-size: 12px; }
.present.mode-pen .pr-bar { opacity: 1; }
.present.mode-pen .pr-size { display: none; }
.pr-bar [hidden] { display: none !important; }
.theme-paper .pr-bar { background: rgba(255, 255, 255, 0.92); color: var(--text); border-top: 1px solid var(--line); }
.theme-chalk .pr-bar { background: rgba(10, 28, 22, 0.55); color: #f3f1e7; }
.pr-bar:hover, .pr-bar:focus-within { opacity: 1; }
.pr-btn { display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 9px; border: none; border-radius: 8px; background: none; color: inherit; }
.theme-paper .pr-btn .ic { color: var(--orange-deep); }
.theme-paper .pr-btn:hover, .theme-paper .pr-btn.is-on { background: var(--orange-soft); }
.theme-chalk .pr-btn:hover, .theme-chalk .pr-btn.is-on { background: rgba(255, 255, 255, 0.14); }
.pr-btn.is-on { box-shadow: inset 0 0 0 1px currentColor; }
.pr-btn:disabled { opacity: 0.4; cursor: default; }
/* Đang dùng bút: nút "Tắt bút" tô nổi để luôn thấy chỗ quay lại trình chiếu */
.theme-paper .pr-btn.pr-pen.is-on { background: var(--orange); color: var(--text); box-shadow: none; }
.theme-paper .pr-btn.pr-pen.is-on .ic { color: var(--text); }
.theme-chalk .pr-btn.pr-pen.is-on { background: #ffd84d; color: #1b2430; box-shadow: none; }
.pr-hint { position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); width: max-content; max-width: min(640px, calc(100vw - 32px)); padding: 9px 14px; border-radius: 12px; background: var(--text); color: #fff; font-size: 14px; line-height: 1.45; text-align: center; box-shadow: 0 10px 28px rgba(30, 42, 56, 0.28); pointer-events: none; }
/* Dựng hình từng bước khi trình chiếu (thêm 20/11/2026): nút dưới hình, thanh bước, lời dựng, danh sách bước */
.present { --hot: #ea580c; }
/* nút, thanh có display riêng: phải ẩn được bằng thuộc tính hidden (lỗi 20/11/2026: nút Dựng từng bước vẫn hiện khi đang dựng) */
.pr-geo [hidden] { display: none !important; }
.present.theme-chalk { --hot: #ffd84d; }
.pr-geo { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 6px; font-family: var(--ui); }
.pr-geo-ctl { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 6px; }
.pr-geo-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid currentColor; border-radius: 999px; background: transparent; color: inherit; font: 600 13.5px/1 var(--ui); cursor: pointer; opacity: 0.8; }
.pr-geo-btn:hover, .pr-geo-btn:focus-visible { opacity: 1; }
.pr-geo-btn:disabled { opacity: 0.3; cursor: default; }
.pr-geo-btn .ic { width: 18px; height: 18px; }
.pr-geo-icon { width: 34px; padding: 0; justify-content: center; }
.pr-geo-icon span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.theme-paper .pr-geo-start { border-color: var(--orange); background: var(--orange-tint); opacity: 1; }
.theme-chalk .pr-geo-start { border-color: #ffd84d; color: #ffd84d; opacity: 1; }
.pr-geo-no { min-width: 92px; text-align: center; font: 700 15px/1 var(--ui); font-variant-numeric: tabular-nums; }
.pr-geo-range { width: min(260px, 38vw); accent-color: var(--hot); cursor: pointer; }
.pr-geo-cap { max-width: min(920px, 92vw); padding: 6px 16px; border-radius: 12px; text-align: center; font-size: calc(18px * var(--pscale)); line-height: 1.45; }
.theme-paper .pr-geo-cap { background: var(--orange-tint); }
.theme-chalk .pr-geo-cap { background: rgba(255, 255, 255, 0.08); }
.pr-geo-cap b { color: var(--hot); }
.pr-geo-list { width: min(620px, 92vw); max-height: 42vh; margin: 0; padding: 6px; overflow: auto; list-style: none; border-radius: 12px; text-align: left; }
.theme-paper .pr-geo-list { background: #fff; border: 1px solid var(--line-2); box-shadow: 0 12px 30px rgba(124, 58, 12, 0.12); }
.theme-chalk .pr-geo-list { background: #1f4a3d; border: 1px solid #3d6b5c; }
.pr-geo-list button { display: flex; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: 15px/1.45 var(--ui); text-align: left; cursor: pointer; }
.pr-geo-list button:hover { background: rgba(234, 88, 12, 0.1); }
.pr-geo-list b { min-width: 1.6em; color: var(--hot); }
.pr-geo-list li.is-cur button { background: rgba(234, 88, 12, 0.16); font-weight: 600; }
/* hình đang phóng to: thanh dựng hình nổi trên lớp phóng to để vẫn bấm được */
/* đang dựng từng bước trên hình phóng to: hình thu lại, dồn lên trên, chừa chỗ cho thanh bước (thanh không che hình) */
.s-item:has(.pr-geo-ctl:not([hidden])) .b-fig.is-zoomed { align-items: flex-start; padding-top: 1vh; }
.slide .s-item:has(.pr-geo-ctl:not([hidden])) .b-fig.is-zoomed svg { height: 60vh; }
.s-item:has(.b-fig.is-zoomed) .pr-geo { position: fixed; left: 50%; bottom: 12vh; z-index: 6; transform: translateX(-50%); padding: 8px 12px; border-radius: 16px; }
.theme-paper .s-item:has(.b-fig.is-zoomed) .pr-geo { background: rgba(255, 255, 255, 0.95); box-shadow: 0 10px 28px rgba(30, 42, 56, 0.18); }
.theme-chalk .s-item:has(.b-fig.is-zoomed) .pr-geo { background: rgba(10, 28, 22, 0.9); }
@media print { .pr-geo { display: none; } }
.pr-count { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.pr-sep { width: 1px; height: 20px; margin: 0 6px; background: currentColor; opacity: 0.2; }
.pr-colors { display: inline-flex; gap: 4px; }
.pr-color { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(128, 128, 128, 0.45); }
.pr-ink { position: fixed; inset: 0; pointer-events: none; z-index: 3; touch-action: none; }
.present.mode-pen .pr-ink { pointer-events: auto; cursor: crosshair; }
.pr-laser { position: fixed; left: -9px; top: -9px; z-index: 4; width: 18px; height: 18px; border-radius: 50%; background: #ff3b2f; box-shadow: 0 0 12px 4px rgba(255, 59, 47, 0.7); pointer-events: none; display: none; }
.present.mode-laser .pr-laser { display: block; }
.present.mode-laser, .present.mode-laser * { cursor: none !important; }
.pr-cover { position: fixed; inset: 0; z-index: 6; background: #0b0f0d; display: none; }
.pr-cover.is-on { display: block; }
.pr-timer { position: fixed; top: 16px; right: 16px; z-index: 7; padding: 10px 14px; border-radius: 16px; background: var(--text); color: #fff; font-family: var(--ui); text-align: center; box-shadow: 0 12px 30px rgba(30, 42, 56, 0.25); }
.pr-time { font-size: 54px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 1px; line-height: 1.1; }
.pr-timer.is-low .pr-time { color: #fdba74; }
.pr-timer.is-done { animation: pulse 0.8s ease-in-out 4; background: var(--orange-deep); }
@keyframes pulse { 50% { transform: scale(1.06); } }
.pr-presets { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 6px; }
.pr-chip { height: 30px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 20px; background: none; color: #fff; font-size: 12.5px; }
.pr-chip:hover { background: rgba(255, 255, 255, 0.15); }
.pr-chip.is-main { background: var(--orange); border-color: var(--orange); color: var(--text); font-weight: 700; padding: 0 22px; }
.pr-names { position: fixed; top: 16px; left: 16px; z-index: 7; width: min(380px, calc(100vw - 32px)); padding: 12px 14px 14px; border-radius: 18px; background: var(--text); color: #fff; font-family: var(--ui); box-shadow: 0 16px 40px rgba(30, 42, 56, 0.3); }
.pr-names-head { display: flex; justify-content: space-between; align-items: center; }
.pr-names .pr-btn .ic { color: #fff; }
.pr-name-big { margin: 10px 0 2px; font-family: var(--hand); font-size: 46px; line-height: 1.15; text-align: center; min-height: 56px; }
.pr-name-big.pop { animation: pop 0.45s ease; color: #fdba74; }
@keyframes pop { 0% { transform: scale(0.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.pr-name-info { text-align: center; font-size: 12px; color: #cbd2dc; }
.pr-names-edit { margin-top: 10px; }
.pr-names-edit summary { cursor: pointer; font-size: 12.5px; color: #e2e7ee; }
.pr-names-edit .inp { margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- In ấn ---------- */
#print-root { display: none; }
@page { size: A4; margin: 1.5cm 1.5cm 1.6cm 2cm; }
/* Đề in giữ bố cục trang của tệp gốc (có khối chân trang): mỗi trang là một khung .ppage cao bằng vùng in, chân trang ở đáy;
   lề trên, dưới hẹp hơn (chân trang của tệp gốc nằm ở lề dưới); dòng sát như Word. Ngoài @media print để print.js fitPages
   đo được đúng như khi in. */
@page paged { size: A4; margin: 1.2cm 1.5cm 0.9cm 2cm; }
.print-doc.paged { line-height: 1.28; }
.print-doc.paged .katex { font-size: 1.04em; }
.print-doc.paged .b-q { margin: 0.2em 0; }
.ppage { page: paged; display: flex; flex-direction: column; min-height: calc(29.7cm - 2.1cm - 4px); break-after: page; }
.ppage:last-child { break-after: auto; }
.ppage-body { flex: 1 0 auto; }
.ppage > .pf-bottom { margin-top: 0.4em; }
.ppage > .pf-top { margin-bottom: 0.4em; }
@media print {
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; color: #000; }
  .print-doc + .print-doc { break-before: page; }
  .pblk-question, .pblk-geometry, .pblk-graph, .pblk-numberline, .pblk-chart, .pblk-table, .pblk-math, .pblk-image { break-inside: avoid; }
  .pblk-heading { break-after: avoid; }
  .pb { break-after: page; }
  .key-banner { margin: 0.2em 0 0.6em; padding: 0.2em 0.5em; border: 1.5px solid #000; text-align: center; font-weight: 700; }
  .end-mark { margin-top: 1em; text-align: center; font-weight: 700; }
  .key-title { text-align: center; font-size: 1.15em; margin: 0 0 0.6em; }
  .key-code { font-size: 1em; margin: 0.8em 0 0.3em; }
  .key-tbl { border-collapse: collapse; margin-bottom: 0.4em; }
  .key-tbl th, .key-tbl td { border: 1px solid #000; padding: 0.1em 0.5em; text-align: center; min-width: 2.4em; }
  .q-sol { background: none; border-left: 2px solid #777; }
  .ans-cols { display: flex; flex-wrap: wrap; gap: 0.8em 1.4em; align-items: flex-start; }
  .ans-tbl { border-collapse: collapse; margin: 0.2em 0 0.6em; }
  .ans-tbl th, .ans-tbl td { border: 1px solid #000; padding: 0.12em 0.5em; text-align: center; }
  .ans-wide { width: 100%; }
  .ans-box { height: 1.6em; }
  .bub { display: inline-block; width: 0.95em; height: 0.95em; border: 1px solid #000; border-radius: 50%; vertical-align: -0.12em; }
  .bw svg { filter: grayscale(1) contrast(1.25); }
  .b-lines .ln { border-color: #555; }
}

/* ---------- Pixi: trợ lý AI giải toán, vẽ hình (25/11/2026). Linh vật: pixi-mascot.js ---------- */
/* Pixi là ảnh 3D cắt từ bảng thiết kế (site/img/pixi/, tools/pixi_cut.py): Pixi lớn nhún nhẹ có bóng mềm; biểu cảm vui
   nảy lên một lần; đang giải, đang nghĩ thì gật gù. Tắt hết khi máy bật giảm chuyển động (cuối khối). */
.pixi { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.pixi-scene { transform-origin: 50% 100%; filter: drop-shadow(0 12px 14px rgba(30, 58, 138, 0.2)); animation: px-float 4.2s ease-in-out infinite; }
@keyframes px-float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-0.6deg); } }
.pixi-face.is-happy, .pixi-face.is-done, .pixi-face.is-wink { animation: px-pop 0.6s ease-out 1; }
@keyframes px-pop { 0% { transform: scale(0.86); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.pixi-face.is-solve, .pixi-face.is-think { transform-origin: 50% 95%; animation: px-nod 1.6s ease-in-out infinite; }
@keyframes px-nod { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-3deg); } }
.px-dots { display: inline-flex; gap: 3px; }
.px-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); animation: px-dot 1s ease-in-out infinite; }
.px-dots i:nth-child(2) { animation-delay: 0.15s; }
.px-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes px-dot { 0%, 100% { transform: translateY(0); opacity: 0.5; } 40% { transform: translateY(-4px); opacity: 1; } }

/* nút Pixi trên thanh trên cùng: mặt Pixi trên nền xanh nhạt (màu riêng của Pixi theo bảng thiết kế brand/Pixi) */
.tb-pixi { border-color: #c9d5fb; background: #eef2ff; color: #1e3a8a; font-weight: 700; padding-left: 4px; }
.tb-pixi-face { display: block; width: 26px; height: 26px; flex: none; overflow: hidden; border-radius: 7px; box-shadow: 0 1px 3px rgba(30, 58, 138, 0.3); }
.tb-pixi-face .pixi { width: 100%; height: 100%; object-fit: cover; }
.tb-pixi:hover { background: #e2e9ff; border-color: #9fb3f3; }
.tb-pixi[aria-pressed="true"] { background: #dfe7ff; box-shadow: inset 0 0 0 1.5px #2f55c8; }

/* Khung Pixi (làm lại 30/11/2026 theo khung chat trong bảng thiết kế): rộng hơn (34% màn hình, 420-560 px), kéo mép
   trái để đổi độ rộng, nút mở rộng; tông xanh của Pixi trên nền sáng. Bên dưới 1181 px khung nổi đè lên trang. */
:root { --px-w: clamp(420px, 34vw, 560px); }
.px-panel {
  --pb: #2f55c8; --pb-d: #2445b0; --pb-dd: #1e3a8a; --pb-50: #f4f6ff; --pb-100: #e8edff; --pb-200: #d3ddfb;
  --pline: #e1e6f4; --pbg: #f7f8fd;
  position: fixed; top: 58px; right: 0; bottom: 0; z-index: 35; display: flex; flex-direction: column;
  width: var(--px-w); max-width: 100vw; border-left: 1px solid var(--pline); background: var(--pbg);
  box-shadow: -16px 0 40px rgba(30, 58, 138, 0.08); font-family: var(--ui); font-size: 14.5px; color: var(--text);
}
.px-panel[hidden] { display: none; }
body.px-open .layout { margin-right: var(--px-w); }
@media (min-width: 1181px) {
  /* chế độ mở rộng: cột "Thêm vào tài liệu" tạm ẩn để trang giấy còn chỗ */
  body.px-wide .side { display: none; }
  body.px-wide .layout { grid-template-columns: 1fr; }
}
.px-resize { position: absolute; top: 0; bottom: 0; left: -6px; z-index: 3; width: 12px; cursor: col-resize; touch-action: none; }
.px-resize::after { content: ''; position: absolute; top: 50%; left: 4px; width: 4px; height: 48px; margin-top: -24px; border-radius: 4px; background: var(--pb); opacity: 0; transition: opacity 0.15s; }
.px-resize:hover::after, .px-resize:focus-visible::after, .px-panel.is-resizing .px-resize::after { opacity: 0.85; }
.px-resize:focus-visible { outline: none; }
body.px-resizing { cursor: col-resize; user-select: none; }

.px-head { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 10px 11px 14px; border-bottom: 1px solid var(--pline); background: #fff; }
.px-head::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--pb), #6f8ff0 60%, #f7931e); }
.px-avatar { display: grid; place-items: end center; width: 46px; height: 46px; flex: none; overflow: hidden; border-radius: 15px; background: linear-gradient(160deg, #e9efff, #cbd9ff); }
.px-avatar .pixi { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%; }
.px-title { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; line-height: 1.25; }
.px-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.px-title b { display: inline-flex; align-items: center; gap: 4px; font-size: 19px; font-weight: 800; letter-spacing: -0.01em; color: var(--pb-dd); }
.px-title b svg { width: 13px; height: 13px; margin-top: -8px; }
.px-title small { overflow: hidden; color: var(--text-3); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.px-quota { min-width: 0; max-width: 220px; padding: 3px 10px; overflow: hidden; border-radius: 99px; background: var(--pb-100); color: var(--pb-dd); font-size: 12px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.px-quota.is-low { background: #fde4dd; color: #8a1c0c; }
.px-quota[hidden] { display: none; }
.px-head .icon-btn { width: 34px; height: 34px; border-radius: 10px; color: #3b4a6b; }
.px-head .icon-btn:hover { background: var(--pb-100); color: var(--pb-dd); }

.px-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding: 16px 16px 10px; }
.px-intro { display: grid; gap: 14px; }
.px-hero { display: grid; justify-items: center; gap: 2px; padding: 12px 12px 14px; border: 1px solid var(--pline); border-radius: 22px; background: radial-gradient(120% 90% at 50% 0%, #e6edff 0%, #f3f6ff 55%, #fff 100%); }
.px-scene { width: min(190px, 52%); }
.px-tagline { margin: 0; color: var(--pb-dd); font-size: 15.5px; font-weight: 800; text-align: center; }
.px-tagline::after { content: ''; display: block; width: 58%; height: 4px; margin: 4px auto 0; border-radius: 4px; background: linear-gradient(90deg, #f7931e, #ffc83d); }
.px-welcome { display: flex; gap: 10px; align-items: flex-start; }
.px-hello { margin: 0; }
.px-chips { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 46px; }
.px-chip { height: 34px; padding: 0 14px; border: 1px solid var(--pb-200); border-radius: 999px; background: #fff; color: var(--pb-dd); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(30, 58, 138, 0.06); transition: background 0.12s, border-color 0.12s; }
.px-chip:hover, .px-chip:focus-visible { border-color: var(--pb); background: var(--pb-50); outline: none; }
.px-examples { display: grid; gap: 8px; }
.px-examples > small { color: var(--text-3); font-size: 12.5px; font-weight: 700; }
.px-example { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--pline); border-radius: 14px; background: #fff; color: var(--text-2); font: inherit; font-size: 13.5px; line-height: 1.5; text-align: left; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.px-example:hover, .px-example:focus-visible { border-color: var(--pb-200); box-shadow: 0 4px 14px rgba(47, 85, 200, 0.12); outline: none; }
.px-ex-ic { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 10px; background: var(--pb-100); color: var(--pb); }
.px-ex-ic .ic { width: 17px; height: 17px; }
.px-gate { display: grid; gap: 10px; }
.px-gate p { margin: 0; line-height: 1.55; }
.px-gate-acts { display: flex; flex-wrap: wrap; gap: 8px; }

.px-msg { display: flex; gap: 10px; }
.px-me { flex-direction: column; align-items: flex-end; }
.px-me .px-bubble { max-width: 86%; border-color: transparent; border-top-right-radius: 6px; background: var(--pb); color: #fff; box-shadow: 0 2px 8px rgba(47, 85, 200, 0.25); }
.px-imgs { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.px-imgs img { width: 92px; height: 92px; object-fit: cover; border: 1px solid var(--pline); border-radius: 12px; }
.px-mini { display: grid; place-items: end center; width: 36px; height: 36px; flex: none; margin-top: 2px; overflow: hidden; border-radius: 12px; background: linear-gradient(160deg, #e9efff, #cbd9ff); }
.px-mini .pixi { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%; }
.px-col { flex: 1; min-width: 0; display: grid; gap: 8px; }
.px-bubble { padding: 10px 14px; border: 1px solid var(--pline); border-radius: 16px; background: #fff; line-height: 1.65; overflow-wrap: anywhere; box-shadow: 0 1px 3px rgba(30, 58, 138, 0.06); }
.px-ai .px-bubble, .px-welcome .px-bubble { border-top-left-radius: 6px; }
.px-bubble p { margin: 0 0 6px; }
.px-bubble p:last-child { margin-bottom: 0; }
.px-bubble ul { margin: 4px 0 6px; padding-left: 20px; }
.px-math { margin: 4px 0 8px; overflow-x: auto; overflow-y: hidden; }
.px-table { margin: 4px 0 8px; overflow-x: auto; }
.px-table .b-table { font-size: 14px; }
.px-table .b-table th, .px-table .b-table td { border-color: #cfd7ee; overflow-wrap: normal; }
.px-table .b-table th { background: var(--pb-50); }
.px-err { border-color: #f5b5a5; background: #fff4f1; }
.px-upsell { color: var(--pb-dd); font-weight: 700; }
.px-status { display: flex; align-items: center; gap: 8px; color: var(--pb-dd); font-size: 13px; }
.px-panel .px-dots i { background: var(--pb); }
.px-card { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--pline); border-radius: 16px; background: #fff; box-shadow: 0 2px 10px rgba(30, 58, 138, 0.06); }
.px-card-head { display: flex; align-items: center; gap: 6px; color: var(--pb-dd); font-size: 13.5px; }
.px-card-head .ic { width: 17px; height: 17px; color: var(--pb); }
.px-card-view { max-height: 380px; overflow: auto; font-family: var(--serif); font-size: 12pt; }
.px-card-view svg { max-width: 100%; height: auto; }
.px-card-acts, .px-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.px-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; background: #e5f6ec; color: #13794a; font-size: 12px; font-weight: 700; }
.px-badge .ic { width: 14px; height: 14px; }
.px-role { margin: 0; color: var(--text-3); font-size: 12px; text-align: center; }
.px-panel .linkish { color: var(--pb); }
/* nút trong khung Pixi: viên thuốc viền xanh nhạt; nút chính nền xanh chữ trắng (tương phản 6,5:1) */
.px-panel .btn { border-color: var(--pb-200); border-radius: 999px; background: #fff; color: var(--pb-dd); box-shadow: none; }
.px-panel .btn:hover { border-color: var(--pb); background: var(--pb-50); }
.px-panel .btn .ic { color: currentColor; }
.px-panel .btn-primary { border-color: var(--pb); background: var(--pb); color: #fff; box-shadow: 0 2px 0 var(--pb-dd); }
.px-panel .btn-primary:hover { border-color: var(--pb-d); background: var(--pb-d); }
.px-panel .btn:disabled { opacity: 0.5; cursor: default; }
.px-acts .icon-btn { width: 32px; height: 32px; border-radius: 10px; color: #4a5878; }
.px-acts .icon-btn:hover { background: var(--pb-100); color: var(--pb-dd); }
.px-ctx { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--pline); background: #fff; }
.px-ctx[hidden] { display: none; }
.px-ctx-l { color: var(--pb-dd); font-size: 12.5px; font-weight: 700; }

.px-compose { display: grid; gap: 8px; padding: 10px 14px 4px; }
.px-box { display: grid; gap: 2px; padding: 8px 8px 8px 14px; border: 1.5px solid var(--pb-200); border-radius: 20px; background: #fff; box-shadow: 0 4px 18px rgba(30, 58, 138, 0.08); transition: border-color 0.15s, box-shadow 0.15s; }
.px-box:focus-within { border-color: var(--pb); box-shadow: 0 0 0 4px rgba(47, 85, 200, 0.12); }
.px-panel .px-input { width: 100%; min-height: 46px; max-height: 200px; padding: 4px 0 2px; overflow-y: auto; border: none; border-radius: 0; background: transparent; box-shadow: none; resize: none; font-size: 15px; line-height: 1.5; }
.px-panel .px-input:focus { border: none; box-shadow: none; outline: none; }
.px-panel .px-input::placeholder { color: #8a93ab; }
.px-tools { display: flex; align-items: center; gap: 8px; }
.px-kbd { flex: 1; min-width: 0; overflow: hidden; color: #8a93ab; font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis; }
.px-compose .px-attach { width: 34px; height: 34px; border-radius: 10px; color: #4a5878; }
.px-compose .px-attach:hover { background: var(--pb-100); color: var(--pb-dd); }
.px-send { display: grid; place-items: center; width: 40px; height: 40px; flex: none; margin-left: auto; padding: 0; border: none; border-radius: 50%; background: var(--pb); color: #fff; cursor: pointer; box-shadow: 0 4px 12px rgba(47, 85, 200, 0.35); transition: background 0.12s, transform 0.12s; }
.px-send:hover { background: var(--pb-d); transform: translateY(-1px); }
.px-send:focus-visible { outline: 3px solid rgba(47, 85, 200, 0.35); outline-offset: 2px; }
.px-send .ic { width: 19px; height: 19px; }
.px-send.is-stop { background: #fde4dd; color: #8a1c0c; box-shadow: none; }
/* Pixi sắp ra mắt (máy chủ chưa có khóa): nút Gửi, nút ảnh khóa thì nhìn rõ là khóa */
.px-send:disabled, .px-compose .icon-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; transform: none; }
.px-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.px-thumbs[hidden] { display: none; }
.px-thumb { position: relative; }
.px-thumb img { width: 58px; height: 58px; object-fit: cover; border: 1px solid var(--pline); border-radius: 10px; }
.px-thumb .icon-btn { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; padding: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(30, 42, 56, 0.25); }
.px-foot { margin: 0; padding: 4px 14px 10px; color: var(--text-3); font-size: 11.5px; text-align: center; }
/* lịch sử trò chuyện với Pixi (01/12/2026): nút đồng hồ ở đầu khung mở danh sách, tìm, mở lại, xóa hai bước */
.px-compose[hidden] { display: none; }
.px-head .px-hist-btn.is-on { background: var(--pb-100); color: var(--pb-dd); }
.px-hist { display: flex; flex-direction: column; gap: 8px; min-height: 100%; }
.px-hhead { position: sticky; top: -16px; z-index: 1; display: flex; align-items: center; gap: 8px; margin: -16px -16px 0; padding: 12px 16px 10px; background: var(--pbg); border-bottom: 1px solid var(--pline); }
.px-hq { flex: 1; min-width: 0; height: 38px; border-radius: 12px; }
.px-hback { flex: none; }
.px-hlist { display: flex; flex-direction: column; gap: 6px; }
.px-hgroup { margin: 8px 2px 0; color: var(--text-3); font-size: 12.5px; font-weight: 700; }
.px-hitem { display: flex; align-items: stretch; gap: 2px; border: 1px solid var(--pline); border-radius: 14px; background: #fff; }
.px-hitem.is-cur { border-color: var(--pb-200); box-shadow: inset 3px 0 0 var(--pb); }
.px-hopen { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 0; border-radius: 14px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.px-hopen:hover { background: var(--pb-50); }
.px-hopen b { overflow: hidden; font-size: 14.5px; white-space: nowrap; text-overflow: ellipsis; }
.px-hsnip { display: -webkit-box; overflow: hidden; color: var(--text-2); font-size: 13px; line-height: 1.4; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.px-hopen small { color: var(--text-3); font-size: 12px; }
.px-hitem .px-hdel { align-self: center; margin-right: 6px; width: 34px; height: 34px; border-radius: 10px; color: #7a8599; }
.px-hdel.is-armed, .px-hwipe.is-armed { background: #fdecec; color: #b42318; border-color: #f5b5b0; }
.px-hempty { margin: 22px 8px; color: var(--text-2); text-align: center; }
.px-hfoot { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--pline); }
.px-hnote { margin: 0; color: var(--text-3); font-size: 12.5px; }
@media (max-width: 1180px) {
  body.px-open .layout { margin-right: 0; }
  .px-panel { box-shadow: -18px 0 48px rgba(30, 58, 138, 0.18); }
}
@media (max-width: 560px) {
  .px-panel { width: 100vw; border-left: none; }
  /* nút "+" thêm khối của trình soạn (điện thoại) không đè lên ô gõ của Pixi */
  body.px-open .fab { display: none; }
  .px-resize, .px-wide-btn { display: none; }
  .px-chips { padding-left: 0; }
  .px-kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pixi, .pixi *, .px-dots i { animation: none !important; }
}

/* chuyển tài liệu sang địa chỉ mới (move.js, 01/12/2026): dải báo nổi ở cuối màn hình, chỉ có ở địa chỉ cũ */
.move-bar { position: fixed; left: 50%; bottom: 18px; z-index: 120; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; width: min(760px, calc(100vw - 32px)); padding: 12px 14px 12px 18px; border: 1.5px solid var(--orange); border-radius: 14px; background: #fff7ed; color: var(--text); font-size: 14.5px; line-height: 1.45; box-shadow: 0 14px 34px rgba(30, 42, 56, 0.2); transform: translateX(-50%); }
.move-text { flex: 1 1 320px; }
.move-acts { display: flex; flex-wrap: wrap; gap: 8px; }
