/* =============================================================== Hành trình Toán học
 * Mobile-first, không phụ thuộc font/thư viện bên ngoài (chạy offline).
 */

:root {
  --bg: #f3f5fb;
  --bg-2: #e9edf8;
  --card: #ffffff;
  --text: #1d2433;
  --muted: #667085;
  --line: #e2e6f0;
  --primary: #6246ea;
  --primary-2: #8a74ff;
  --primary-ink: #ffffff;
  --success: #12a35f;
  --success-bg: #e3f8ee;
  --danger: #e23d5b;
  --danger-bg: #fde8ec;
  --warn: #f5a524;
  --star: #ffb400;
  --star-off: #d9dde8;
  --shadow: 0 2px 0 rgba(29, 36, 51, .06), 0 6px 18px rgba(29, 36, 51, .06);
  --radius: 16px;
  --g6: #1fae6a;
  --g7: #1c9dc6;
  --g8: #f07f1c;
  --g9: #7457f2;
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --math: "Cambria Math", Cambria, "STIX Two Math", "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11131a;
    --bg-2: #181b25;
    --card: #1c202b;
    --text: #e9ecf3;
    --muted: #9aa3b5;
    --line: #2b3040;
    --primary: #8a74ff;
    --primary-2: #a897ff;
    --success: #34c784;
    --success-bg: #12301f;
    --danger: #ff6b84;
    --danger-bg: #3a1720;
    --star-off: #3a4052;
    --shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--font);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.muted { color: var(--muted); font-size: .92em; }

.screen {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 120px;
}

/* --------------------------------------------------------------- Nút, thẻ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 10px 18px;
  border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px;
  background: var(--card); font-weight: 700; text-align: center;
  transition: transform .06s, filter .15s;
}
.btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--primary); border-color: #4a30c9; color: var(--primary-ink); }
.btn.success { background: var(--success); border-color: #0b7d48; color: #fff; }
.btn.danger { background: var(--danger); border-color: #b42744; color: #fff; }
.btn.ghost { background: transparent; }
.btn.big { min-height: 54px; font-size: 1.05em; padding: 12px 22px; }
.btn.wide { width: 100%; }

.icon-btn {
  width: 42px; height: 42px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; background: transparent; font-size: 20px;
}
.icon-btn:hover { background: var(--bg-2); }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); font-weight: 600; font-size: .92em;
}
.pill.small { padding: 4px 10px; font-size: .85em; }
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--bg-2); color: var(--muted); font-size: .8em; font-weight: 600;
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin: 14px 0;
}

.stars span { color: var(--star-off); }
.stars span.on { color: var(--star); }

/* --------------------------------------------------------------- Thanh trên cùng */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  margin: 0 -16px; padding: 8px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar-title span { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title small { color: var(--muted); font-size: .78em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --------------------------------------------------------------- Trang chủ */

.hero { text-align: center; padding: 36px 0 8px; }
.logo {
  width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 26px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #c04cf5);
  color: #fff; font: 700 48px/1 var(--math);
  box-shadow: 0 10px 24px rgba(98, 70, 234, .35);
  transform: rotate(-6deg);
}
.logo span { transform: rotate(6deg); }
.hero h1 { font-size: 1.9em; letter-spacing: -.01em; }
.hero p { color: var(--muted); margin: 6px 0 14px; }
.stats-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.grade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
@media (max-width: 380px) { .grade-grid { grid-template-columns: 1fr; } }
.grade-card {
  --c: var(--primary);
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px; border-radius: 20px; color: #fff;
  background: linear-gradient(150deg, var(--c), color-mix(in srgb, var(--c) 70%, #000));
  box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 60%, #000), 0 10px 20px rgba(0, 0, 0, .12);
  transition: transform .12s;
}
.grade-card:hover { transform: translateY(-2px); }
.grade-card:active { transform: translateY(2px); }
.grade-card.g6 { --c: var(--g6); }
.grade-card.g7 { --c: var(--g7); }
.grade-card.g8 { --c: var(--g8); }
.grade-card.g9 { --c: var(--g9); }
.grade-icon { font-size: 34px; line-height: 1; }
.grade-name { font-size: 1.45em; font-weight: 800; }
.grade-meta, .grade-stars { font-size: .82em; opacity: .92; }
.bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .3); overflow: hidden; margin: 6px 0 2px; }
.bar span { display: block; height: 100%; background: #fff; border-radius: 99px; }
.foot { text-align: center; color: var(--muted); font-size: .82em; margin: 28px 0; }

/* --------------------------------------------------------------- Lớp: tab, bản đồ, mục lục */

.tabs {
  display: flex; gap: 6px; margin: 12px 0 4px; padding: 4px;
  background: var(--bg-2); border-radius: 14px;
}
.tabs a { flex: 1; text-align: center; padding: 9px; border-radius: 11px; font-weight: 700; color: var(--muted); }
.tabs a.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

.book-sep { display: flex; align-items: center; gap: 10px; margin: 22px 0 6px; color: var(--muted); font-weight: 700; font-size: .9em; }
.book-sep::before, .book-sep::after { content: ""; flex: 1; border-top: 2px dashed var(--line); }

.chapter-head {
  margin: 18px 0 8px; padding: 14px 16px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--gc, var(--primary)), color-mix(in srgb, var(--gc, var(--primary)) 72%, #000));
  color: #fff;
}
.map.g6 { --gc: var(--g6); } .map.g7 { --gc: var(--g7); } .map.g8 { --gc: var(--g8); } .map.g9 { --gc: var(--g9); }
.chapter-head h2 { font-size: 1.05em; }
.chapter-head span { font-size: .82em; opacity: .9; }

.path { display: flex; flex-direction: column; gap: 6px; padding: 6px 0 4px; max-width: 480px; margin: 0 auto; }
/* --x ∈ [-24, 24] → lùi lề từ 0% đến ~29% để tạo đường đi uốn lượn, luôn nằm trong màn hình */
.node-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 4px 4px 4px calc((var(--x) + 24) * .6%);
  border: 0; background: none; text-align: left;
}
.node {
  flex: none; width: 62px; height: 58px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 1.25em;
  background: var(--gc, var(--primary)); color: #fff;
  box-shadow: 0 5px 0 color-mix(in srgb, var(--gc, var(--primary)) 60%, #000);
  transition: transform .1s;
}
.node-row:active .node { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--gc, var(--primary)) 60%, #000); }
.node-row.done .node { background: linear-gradient(135deg, #ffcf3d, #f5a524); box-shadow: 0 5px 0 #c98207; }
.node-row.locked .node, .node-row.soon .node { background: var(--bg-2); color: var(--muted); box-shadow: 0 5px 0 var(--line); font-size: 1.05em; }
.node-row.soon .node { border: 2px dashed var(--line); }
.node-row.review .node { background: linear-gradient(135deg, #ff7a59, #e23d5b); box-shadow: 0 5px 0 #a8253f; }
.node-row.review.locked .node { background: var(--bg-2); box-shadow: 0 5px 0 var(--line); }
.node-row.current .node { animation: pulse 1.6s infinite; }
@keyframes pulse {
  0%, 100% { outline: 0 solid color-mix(in srgb, var(--gc, var(--primary)) 40%, transparent); }
  50% { outline: 8px solid color-mix(in srgb, var(--gc, var(--primary)) 25%, transparent); }
}
.node-label { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.node-title { font-weight: 650; font-size: .92em; line-height: 1.3; }
.node-row.soon .node-title, .node-row.locked .node-title { color: var(--muted); }
.node-label em { font-size: .78em; color: var(--muted); }
.node-label .stars { font-size: .95em; letter-spacing: 1px; }

.toc-chapter h2 { font-size: 1em; margin-bottom: 6px; }
.toc-chapter ol { list-style: none; margin: 0; padding: 0; }
.toc-item > a, .toc-item > button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 6px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left;
}
.toc-item:first-child > a, .toc-item:first-child > button { border-top: 0; }
.toc-item > a:hover { background: var(--bg-2); border-radius: 8px; }
.toc-item.soon span { color: var(--muted); }
.toc-item em { font-size: .78em; color: var(--muted); white-space: nowrap; }
.toc-item.review span { font-weight: 700; }
.toc-item .stars { white-space: nowrap; }

/* --------------------------------------------------------------- Lý thuyết */

.lesson-hero { padding: 18px 2px 4px; }
.lesson-hero h1 { font-size: 1.5em; margin-top: 8px; }
.best { color: var(--muted); font-size: .88em; margin: 6px 0 0; }
.card h3 { font-size: 1.05em; margin-bottom: 10px; }
.goals ul, .summary, .tips { margin: 0; padding-left: 20px; }
.goals li, .summary li, .tips li { margin: 6px 0; }
.theory.sum { border-left: 5px solid var(--primary); }
.theory.defs { border-left: 5px solid var(--g7); }
.theory.fml { border-left: 5px solid var(--g8); }
.theory.ex { border-left: 5px solid var(--g6); }
.theory.tip { border-left: 5px solid var(--warn); }
dl { margin: 0; }
.def { padding: 8px 0; border-top: 1px dashed var(--line); }
.def:first-child { border-top: 0; padding-top: 0; }
.def dt { font-weight: 800; color: var(--g7); }
.def dd { margin: 2px 0 0; }
.formula { padding: 10px 12px; margin: 8px 0; border-radius: 12px; background: var(--bg-2); }
.f-name { font-weight: 700; font-size: .9em; color: var(--muted); }
.f-tex { font-size: 1.2em; text-align: center; padding: 6px 0; overflow-x: auto; }
.f-note { font-size: .88em; color: var(--muted); }
.example { border-top: 1px dashed var(--line); padding: 8px 0; }
.example:first-child { border-top: 0; }
.example summary { cursor: pointer; list-style: none; }
.example summary::-webkit-details-marker { display: none; }
.example summary::after { content: "  ▸ Xem lời giải"; color: var(--primary); font-weight: 700; font-size: .85em; white-space: nowrap; }
.example[open] summary::after { content: "  ▾ Ẩn lời giải"; }
.solution { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--success-bg); }

.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  display: flex; justify-content: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 35%);
}
.cta-bar .btn { width: min(728px, 100%); }

/* --------------------------------------------------------------- Làm bài */

.quiz-top { gap: 10px; }
.progress { flex: 1; height: 14px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--success), #4fdc94); transition: width .4s; }
.streak { font-weight: 800; color: var(--muted); min-width: 44px; text-align: center; }
.streak.hot { color: #ff6a00; animation: pop .4s; }
@keyframes pop { 50% { transform: scale(1.3); } }

.q-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 16px 0 8px; color: var(--muted); font-weight: 700; font-size: .88em; }
.lvl { padding: 2px 10px; border-radius: 99px; font-size: .9em; }
.lvl1 { background: var(--success-bg); color: var(--success); }
.lvl2 { background: #fff1d6; color: #b26b00; }
.lvl3 { background: var(--danger-bg); color: var(--danger); }
@media (prefers-color-scheme: dark) { .lvl2 { background: #3a2c0d; color: #ffc455; } }
.from { font-weight: 600; }
.q-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.q-prompt { font-size: 1.12em; }
.q-figure { text-align: center; margin-top: 10px; }
.q-figure svg { max-width: 100%; height: auto; }
.q-hint { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #fff7e0; color: #6b4a00; font-size: .95em; }
@media (prefers-color-scheme: dark) { .q-hint { background: #33290f; color: #ffd98a; } }

.choices { display: grid; gap: 10px; margin-top: 16px; }
.choices.grid, .choices.two { grid-template-columns: 1fr 1fr; }
.choice {
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 14px;
  border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px;
  background: var(--card); text-align: left; font-size: 1.05em;
  transition: transform .06s, border-color .15s, background .15s;
}
.choice:active { transform: translateY(2px); }
.key-hint {
  flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  border: 2px solid var(--line); color: var(--muted); font-size: .75em; font-weight: 800;
}
.ctext { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.choice.selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--card)); }
.choice.selected .key-hint { border-color: var(--primary); color: var(--primary); }
.choice.right { border-color: var(--success); background: var(--success-bg); }
.choice.right .key-hint { border-color: var(--success); background: var(--success); color: #fff; }
.choice.wrong { border-color: var(--danger); background: var(--danger-bg); }
.choice.wrong .key-hint { border-color: var(--danger); background: var(--danger); color: #fff; }
.choice:disabled { cursor: default; }

.fields { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 18px; }
.field {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--card);
  font-size: 1.15em;
}
.field.active { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.field.ok { border-color: var(--success); background: var(--success-bg); box-shadow: none; }
.field.bad { border-color: var(--danger); background: var(--danger-bg); box-shadow: none; }
.flabel { font-weight: 700; white-space: nowrap; }
.finput {
  width: 9ch; min-width: 0; padding: 6px 4px; border: 0; outline: 0; background: transparent;
  font: 700 1.1em var(--font); color: var(--text); text-align: center;
}
.finput:disabled { color: var(--text); -webkit-text-fill-color: var(--text); opacity: 1; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.keypad {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  max-width: 360px; margin: 18px auto 0;
}
.keypad.custom { grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); }
.keypad .key {
  min-height: 50px; border-radius: 12px; border: 2px solid var(--line); border-bottom-width: 4px;
  background: var(--card); font-size: 1.2em; font-weight: 700;
}
.keypad .key:active { transform: translateY(2px); border-bottom-width: 2px; }
.keypad .k-bs, .keypad .k-clr, .keypad .k-next { background: var(--bg-2); font-size: .95em; }
.keypad:not(.multi) .k-clr { grid-column: span 2; }
.keypad.off { opacity: .4; pointer-events: none; }

.quiz-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
}
.quiz-foot > * { max-width: 728px; margin: 0 auto; }
.quiz-screen { padding-bottom: 260px; }
.foot-row { display: flex; gap: 10px; }
.foot-row .btn.primary { flex: 1; }
.feedback { max-height: 60vh; overflow-y: auto; animation: rise .25s; }
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
.fb-title { font-size: 1.2em; font-weight: 800; margin-bottom: 4px; }
.feedback.good .fb-title { color: var(--success); }
.feedback.bad .fb-title { color: var(--danger); }
.fb-answer { font-weight: 700; margin-bottom: 4px; }
.fb-explain { color: var(--muted); font-size: .95em; margin-bottom: 10px; }
.quiz-foot:has(.feedback.good) { background: var(--success-bg); border-top-color: var(--success); }
.quiz-foot:has(.feedback.bad) { background: var(--danger-bg); border-top-color: var(--danger); }
.feedback .fb-explain { color: var(--text); opacity: .85; }

/* --------------------------------------------------------------- Kết quả */

.result { text-align: center; padding-top: 24px; }
.big-stars { font-size: 64px; letter-spacing: 6px; line-height: 1.1; }
.big-stars .star { color: var(--star-off); display: inline-block; }
.big-stars .star.on { color: var(--star); animation: starIn .5s both; animation-delay: calc(var(--d) * .25s); }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.3); } }
.result h1 { font-size: 1.8em; margin-top: 8px; }
.score { font-size: 1.1em; }
.badge { display: inline-block; margin: 4px; padding: 6px 14px; border-radius: 99px; background: #fff1c2; color: #7a5300; font-weight: 700; }
@media (prefers-color-scheme: dark) { .badge { background: #3a2f0c; color: #ffd36b; } }
.tip { color: var(--muted); }
.result-actions { display: flex; flex-direction: column; gap: 10px; max-width: 420px; margin: 18px auto; }
.review { text-align: left; }
.review summary { cursor: pointer; font-weight: 700; }
.rev-item { padding: 10px 0; border-top: 1px dashed var(--line); }
.rev-ans { font-weight: 700; color: var(--success); margin-top: 4px; }
.rev-exp { color: var(--muted); font-size: .92em; }

/* --------------------------------------------------------------- Bảng trượt, thông báo, tải */

#sheet[hidden] { display: none; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(10, 12, 20, .45); opacity: 0; transition: opacity .2s; }
.sheet-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 760px; max-height: 85vh; margin: 0 auto; overflow-y: auto;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--bg); border-radius: 22px 22px 0 0;
  transform: translateY(100%); transition: transform .25s ease-out;
}
#sheet.open .sheet-backdrop { opacity: 1; }
#sheet.open .sheet-panel { transform: none; }
.sheet-head { position: sticky; top: -8px; display: flex; align-items: center; justify-content: space-between; padding: 8px 0; background: var(--bg); z-index: 1; }
.sheet-head h2 { font-size: 1.15em; }
.sheet-sub { margin: 16px 0 0; font-size: 1em; color: var(--primary); }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.sheet-actions .btn { flex: 1; }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; cursor: pointer; }
.toggle input { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--primary); flex: none; }
.toggle small { display: block; color: var(--muted); }

.toast {
  position: fixed; left: 50%; top: 16px; z-index: 60; transform: translateX(-50%);
  max-width: min(92vw, 520px); padding: 10px 16px; border-radius: 14px;
  background: #1d2433; color: #fff; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  animation: drop .25s; transition: opacity .4s;
}
.toast.hide { opacity: 0; }
@keyframes drop { from { transform: translate(-50%, -20px); opacity: 0; } }

.loading { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }

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

/* --------------------------------------------------------------- Công thức toán (js/core/tex.js) */

.m { font-family: var(--math); font-size: 1.08em; white-space: normal; }
.m i { font-style: italic; padding-right: .04em; }
.m .op { margin: 0 .24em; }
.m .op.not { position: relative; display: inline-block; }
.m .op.not::after { content: ""; position: absolute; left: 50%; top: 10%; height: 80%; border-left: .08em solid currentColor; transform: rotate(25deg); }
.m sup, .m sub { font-size: .7em; line-height: 0; }
.m sup .op, .m sub .op { margin: 0 .1em; }
.m .frac {
  display: inline-flex; flex-direction: column; align-items: stretch; vertical-align: middle;
  text-align: center; margin: 0 .12em; font-size: .92em; white-space: nowrap;
}
.m .frac > .num { padding: 0 .15em .05em; border-bottom: .07em solid currentColor; }
.m .frac > .den { padding: .05em .15em 0; }
.m .sqrt { display: inline-flex; align-items: stretch; white-space: nowrap; vertical-align: middle; }
.m .sqrt .rad { display: flex; align-items: flex-end; font-size: 1.15em; line-height: 1; margin-right: -.02em; }
.m .sqrt .rc { border-top: .07em solid currentColor; padding: .08em .12em 0 .08em; margin-top: .1em; }
.m .sqrt .idx { font-size: .6em; align-self: flex-start; margin-right: -.45em; margin-top: .1em; }
.m .ovl { border-top: .07em solid currentColor; padding-top: .05em; }
.m .unl { border-bottom: .07em solid currentColor; }
.m .hat, .m .vec { position: relative; display: inline-block; padding-top: .3em; }
.m .hat::before { content: ""; position: absolute; left: 10%; right: 10%; top: .05em; height: .32em;
  border-top: .07em solid currentColor; border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.m .vec::before { content: "→"; position: absolute; left: 0; right: 0; top: -.45em; text-align: right; font-size: .8em; line-height: 1; }
.m .boxed { border: .07em solid currentColor; padding: .05em .3em; border-radius: .2em; }
.m .txt { font-family: var(--font); font-style: normal; font-size: .93em; }
.m .fn { font-style: normal; }
.m .sp1 { margin-right: .17em; } .m .sp2 { margin-right: .28em; } .m .sp4 { margin-right: 1em; } .m .sp8 { margin-right: 2em; }
.m .cases { display: inline-flex; align-items: center; vertical-align: middle; }
.m .cases .brace { font-size: calc(var(--rows) * 1.05em + .2em); line-height: 1; font-weight: 300; transform: scaleX(.7); margin-right: .05em; }
.m .cases .rows { display: flex; flex-direction: column; gap: .15em; }
.m .tex-err { color: var(--danger); font-family: monospace; }
.mblock { text-align: center; margin: 8px 0; font-size: 1.1em; overflow-x: auto; }
