/* 数学工具箱共享样式 */
.tbs-hero { background: linear-gradient(135deg,#4f46e5 0%,#2563eb 60%,#0ea5e9 100%); }
.tbs-hero .tbs-hero-title { color:#fff; }
.tbs-hero .tbs-hero-sub { color:rgba(255,255,255,.85); }

.tbs-tool-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:1rem; }
.tbs-tool-card {
	display:block; text-decoration:none; color:inherit;
	background:#fff; border:1px solid var(--border-color,#eee); border-radius:14px;
	padding:1.1rem; transition:.18s; height:100%;
}
.tbs-tool-card:hover { transform:translateY(-3px); box-shadow:0 .5rem 1.25rem rgba(0,0,0,.08); border-color:#c7d2fe; }
.tbs-tool-ico {
	width:46px;height:46px;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;
	font-size:24px;font-weight:700;line-height:1;color:#fff;
	background:linear-gradient(135deg,#6366f1,#2563eb);margin-bottom:.6rem;
}
.tbs-tool-name { font-weight:600; }
.tbs-tool-desc { font-size:13px;color:#6b7280;margin-top:2px; }

/* 工具页通用布局 */
.tbs-wrap { display:grid; grid-template-columns:320px 1fr; gap:1.25rem; align-items:start; }
@media (max-width:991px){ .tbs-wrap{ grid-template-columns:1fr; } }
.tbs-panel { position:sticky; top:76px; }
@media (max-width:991px){ .tbs-panel{ position:static; } }
.tbs-preview {
	background:#fff;border:1px solid var(--border-color,#eee);border-radius:14px;padding:1rem;
	min-height:420px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;
}
.tbs-toolbar { display:flex;flex-wrap:wrap;gap:.5rem;margin-bottom:.75rem; }

/* SVG 图纸通用 */
.tbs-svg-box { width:100%; overflow:auto; display:flex; justify-content:center; }
.tbs-svg-box svg { max-width:100%; height:auto; background:#fff; }

/* 水印：屏幕不显示，仅打印出现 */
.tbs-watermark { display: none; }

/* 打印：仅输出“题单/图纸”，整站导航、页脚、悬浮按钮全部不打印 */
@media print {
	/* 0) 显式隐藏站点导航、页脚、悬浮条、公告、弹层等（body 的直接子元素，位于 #body 之外） */
	body > header#header,
	body > .bbs-footer,
	body > footer,
	body > #floatingActions,
	body > .floating-actions,
	body > #mobileTabbar,
	body > .bottom-nav,
	body > #announcement-toast-container,
	body > #xnLightbox,
	body > .modal,
	body > .toast-container { display: none !important; }
	/* 兼容：任何非 main#body 的 body 直接子元素也隐藏（兜底） */
	body > :not(main#body) { display: none !important; }

	/* 1) #body 内：隐藏控制面板/面包屑/标题栏等非打印 UI（工具内容 .tbs-wrap 保留） */
	main#body .tbs-no-print { display: none !important; }
	main#body .tbs-head-row, main#body .tbs-subnav, main#body .tbs-toolbar { display: none !important; }

	/* 2) 取消双栏：让 .tbs-wrap 内仅剩 .tbs-print-area，独占页面（不隐藏 .container 包层，避免把打印区一并藏掉） */
	main#body .tbs-wrap { display: block !important; grid-template-columns: 1fr !important; gap: 0 !important; }
	/* 强清零：消除主题在打印时可能残留的容器内边距/偏移，让内容从纸张左上角起排 */
	main#body, main#body > .container, main#body .container, main#body .container.py-3 {
		margin: 0 !important; padding: 0 !important; max-width: none !important; width: 100% !important; border: none !important;
	}
	main#body .container { margin-inline: 0 !important; }

	/* 3) 打印区：纯白底，统一安全页边距（避免打印机不可打印区裁字） */
	.tbs-print-area {
		display: block !important;
		width: 100% !important;
		min-width: 0 !important;
		padding: 10mm 12mm !important;
		box-sizing: border-box;
		border: none !important;
		background: #fff !important;
		box-shadow: none !important;
		min-height: 0 !important;
		overflow: visible !important;
	}
	/* 整页 A4 图纸（SVG 自身按 210×297mm 排好版）：保持出血，不叠加边距 */
	.tbs-print-area.tbs-print-bleed { padding: 0 !important; }
	/* 题单自带内边距，与打印区边距二选一，避免双重缩进 */
	.tbs-print-area .tbs-sheet { padding: 0 !important; }

	/* 4) 整页 A4 图纸(.tbs-svg-box)等比铺满；其它紧凑 svg（如 nets3d）保持原尺寸并居中 */
	.tbs-print-area .tbs-svg-box svg { width: 100% !important; height: auto !important; max-width: 100% !important; display: block !important; }
	.tbs-print-area svg { max-width: 100% !important; display: block !important; height: auto !important; margin-inline: auto; }

	/* 5) 水印：仅右下角一次 */
	.tbs-watermark {
		display: block !important;
		position: fixed;
		right: 6mm;
		bottom: 5mm;
		left: auto;
		top: auto;
		font-size: 11px;
		color: #9aa0a6;
		font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
		z-index: 9999;
		line-height: 1;
	}

	@page { size: A4; margin: 0; }
	html, body { background: #fff !important; width: 100% !important; overflow: visible !important; margin: 0 !important; }

	/* 4b) 整页 A4 图纸（方格纸/图形变换等）：锁定为恰好一页高，杜绝因舍入/空隙产生的第二张空白页 */
	.tbs-svg-box { display: block !important; height: 100vh !important; overflow: hidden !important; line-height: 0; page-break-after: avoid; }
	.tbs-svg-box svg { width: 100% !important; height: 100% !important; max-height: calc(100vh - 1px) !important; display: block !important; }

	/* 4c) 非整页图纸（数轴等）恢复自然高度，避免被 100vh 拉成一条窄带 */
	.tbs-svg-box.tbs-print-natural { height: auto !important; overflow: visible !important; }
	.tbs-svg-box.tbs-print-natural svg { width: auto !important; height: auto !important; max-width: 100% !important; max-height: none !important; }

	/* 4d) 与统一页边距保持一致（保留类名兼容旧页面） */
	.tbs-print-area.tbs-print-margin { padding: 10mm 12mm !important; box-sizing: border-box; }

	/* 5) 长表格跨页时不要把一行拆开 */
	.tbs-table tr { break-inside: avoid; page-break-inside: avoid; }
}

/* 小数/分数显示 */
.tbs-frac { display:inline-flex; flex-direction:column; text-align:center; vertical-align:middle; line-height:1.05; }
.tbs-frac > .tbs-frac-num { border-bottom:1.5px solid currentColor; padding:0 .4em .08em; }
.tbs-frac > .tbs-frac-den { padding:.08em .4em 0; }
.tbs-prob .tbs-frac, .tbs-line .tbs-frac { font-size:1.02em; }

/* 结果区 */
.tbs-result {
	width:100%; background:#f8fafc; border:1px solid #eef2f7; border-radius:12px; padding:1rem; margin-top:.5rem;
}
.tbs-steps { font-size:14px; line-height:1.9; }
.tbs-steps .tbs-step { padding:.25rem 0; border-bottom:1px dashed #e5e7eb; }
.tbs-steps .tbs-step:last-child { border-bottom:none; }

.tbs-badge { font-size:12px; padding:2px 8px; border-radius:999px; background:#eef2ff; color:#4338ca; }

/* ===== 题单 / 文本类工具：A4 纸张预览 + 打印样式 ===== */
/* 屏幕：题单呈现在一张“纸”上，排版接近真实 A4 输出 */
.tbs-sheet {
	box-sizing: border-box;
	width: min(100%, 210mm);          /* A4 宽；比预览容器窄时自适应 */
	margin: 0 auto;
	background: #fff;
	border: 1px solid #e7ecf3;        /* 屏显“纸边”，打印时会去除 */
	box-shadow: 0 3px 18px rgba(15,23,42,.08);
	padding: 9mm 11mm 14mm;
	line-height: 1.8;
	text-align: left;                 /* 题干统一左对齐，标题用 .tbs-sheet-title 单独居中 */
}
.tbs-sheet-title {
	font-weight:700; font-size:19px; text-align:center;
	margin:0 0 1rem; letter-spacing:.04em; color:#0f172a;
}
/* 试卷顶部：标题在左，右上角 班级/姓名/日期 */
.tbs-sheet-head { display:flex; justify-content:space-between; align-items:flex-end; gap:1rem; margin:0 0 .9rem; flex-wrap:wrap; }
.tbs-sheet-head .tbs-sheet-title { margin:0; text-align:left; letter-spacing:.02em; }
.tbs-exam-meta { display:flex; flex-wrap:wrap; gap:1rem .9rem; font-size:14px; color:#334155; white-space:nowrap; }
.tbs-underline { border-bottom:1px solid #0f172a; display:inline-block; padding:0 .2rem 2px; min-width:3.6em; }
/* 试卷抬头：右上角 班级/姓名/日期 一行 */
.tbs-sheet-meta { display:flex; justify-content:flex-end; margin:0 0 .15rem; }
@media print { .tbs-sheet-head { margin-bottom:.5rem; } .tbs-sheet-meta { margin-bottom:.05rem; } }

/* 汉字字帖 */
.tbs-hanzi-grid { display:grid; gap:.6rem; align-items:start; }
.tbs-hanzi-cell {
	position:relative; width:100%; aspect-ratio:1/1;
	border:1.5px solid #334155; background:#fff; display:flex; align-items:center; justify-content:center;
	overflow:hidden;
}
.tbs-hanzi-cell::before, .tbs-hanzi-cell::after { content:''; position:absolute; background:#eef2f7; }
/* 田字格：水平+垂直中线 */
.tbs-hanzi-cell::before { left:0; right:0; top:50%; height:1px; }
.tbs-hanzi-cell::after { top:0; bottom:0; left:50%; width:1px; }
.tbs-hz-guide { position:absolute; inset:0; display:none; }
.tbs-hz-guide.pin {
	display:block;
	background:
		linear-gradient(135deg, transparent calc(50% - 0.5px), #eef2f7 50%, transparent calc(50% + 0.5px)),
		linear-gradient(45deg, transparent calc(50% - 0.5px), #eef2f7 50%, transparent calc(50% + 0.5px));
}
.tbs-hz-char { font-size:calc(var(--hz) * 0.86); line-height:1; font-weight:600; color:#334155; position:relative; z-index:2; }
.tbs-hz-char.trace { color:#c7d2fe; font-weight:700; }
.tbs-hz-cell .tbs-hz-char { font-family:"KaiTi","STKaiti","楷体","楷体_GB2312",serif; }
@media print { .tbs-hanzi-grid { gap:.4rem; } .tbs-hanzi-cell { border-color:#334155; } }

/* 通用表格（打卡/课程表/座位表/作业等） */
.tbs-table { width:100%; border-collapse:collapse; font-size:14px; }
.tbs-table th, .tbs-table td { border:1px solid #cbd5e1; text-align:center; padding:.45rem .3rem; vertical-align:middle; }
.tbs-table thead th { background:#f1f5f9; font-weight:600; }
.tbs-table .tbs-tl { text-align:left; padding-left:.6rem; }
@media print { .tbs-table th, .tbs-table td { border-color:#334155; } }

/* 打卡表：屏幕可勾选；周表可拆分多周 */
.tbs-checkin .tbs-ck-cell { cursor:pointer; position:relative; height:34px; min-width:26px; user-select:none; }
.tbs-checkin .tbs-ck-cell:hover { background:#f0fdf4; }
.tbs-checkin .tbs-ck-cell:focus-visible { outline:2px solid #6366f1; outline-offset:-2px; }
.tbs-checkin .tbs-ck-cell.is-on::after { content:'✓'; color:#16a34a; font-weight:700; font-size:17px; line-height:1; }
.tbs-ck-daterow td, .tbs-ck-daterow th { color:#94a3b8; font-size:12px; height:26px; font-weight:400; }
.tbs-ck-total { color:#64748b; font-size:12px; white-space:nowrap; }
.tbs-ck-week + .tbs-ck-week { margin-top:1.1rem; }
.tbs-ck-week-cap { display:flex; justify-content:space-between; align-items:baseline; gap:.5rem; font-weight:600; font-size:13px; margin-bottom:.35rem; }
.tbs-ck-week-cap span:last-child { font-weight:400; color:#64748b; font-size:12px; }
.tbs-ck-tip { font-size:12px; color:#64748b; margin-bottom:.5rem; }
.tbs-ck-foot { display:flex; justify-content:space-between; flex-wrap:wrap; gap:.5rem; font-size:13px; margin-top:.7rem; }
@media print {
	.tbs-checkin .tbs-ck-cell { cursor:default; }
	.tbs-checkin .tbs-ck-cell.is-on::after { color:#15803d; }
}

/* 课程表：生成后可直接在格子里录科目 */
.tbs-timetable .tbs-tt-cell { min-width:42px; height:42px; cursor:text; word-break:break-word; }
.tbs-timetable .tbs-tt-cell:focus { background:#eef2ff; box-shadow:inset 0 0 0 2px #6366f1; outline:none; }
.tbs-timetable .tbs-tt-group { background:#f8fafc; text-align:center; font-weight:600; }
@media screen {
	.tbs-timetable .tbs-tt-cell:empty::before { content:'点击填写'; color:#cbd5e1; font-size:11px; font-weight:400; }
}
.tbs-export-stage .tbs-timetable .tbs-tt-cell:empty::before { content:''; }
@media print {
	.tbs-timetable .tbs-tt-cell:empty::before { content:''; }
}

/* 座位表：可录姓名、可留空座、可加过道 */
.tbs-seat-table td.tbs-seat { height:58px; vertical-align:top; padding:.25rem .28rem; }
.tbs-seat-no { display:block; font-size:11px; color:#94a3b8; line-height:1.2; text-align:left; }
.tbs-seat-name { display:block; min-height:24px; margin-top:2px; font-size:13px; font-weight:600; text-align:center; outline:none; word-break:break-word; }
.tbs-seat-name:focus { background:#eef2ff; box-shadow:inset 0 0 0 2px #6366f1; border-radius:3px; }
.tbs-seat.tbs-seat-blank { background:#f8fafc; }
.tbs-seat-table td.tbs-seat-aisle { border:0 !important; background:transparent !important; width:10px; padding:0 !important; }
.tbs-stage { margin:0 auto 1rem; border:1px solid #334155; background:#f8fafc; text-align:center; padding:.35rem 4rem; max-width:60%; font-weight:600; letter-spacing:.3em; }
.tbs-stage.is-bottom { margin:1rem auto 0; }
@media screen {
	.tbs-seat-name:empty::before { content:'姓名'; color:#cbd5e1; font-weight:400; font-size:11px; }
}
.tbs-export-stage .tbs-seat-name:empty::before { content:''; }
@media print {
	.tbs-seat-name:empty::before { content:''; }
}

/* 专注卡计时器（控制面板内，不打印） */
.tbs-fc-timer { border:1px solid #dbe3ee; background:#f8fafc; border-radius:10px; padding:.7rem .8rem .8rem; margin-bottom:.9rem; }
.tbs-fc-clock { font-variant-numeric:tabular-nums; font-size:2rem; font-weight:700; line-height:1.1; text-align:center; color:#1e293b; letter-spacing:.03em; }
.tbs-fc-bar { height:6px; border-radius:999px; background:#e2e8f0; overflow:hidden; margin:.45rem 0 .1rem; }
.tbs-fc-bar > div { height:100%; width:0; background:#4f6ef7; border-radius:999px; transition:width .25s linear; }
.tbs-fc-timer.is-rest .tbs-fc-bar > div { background:#22c55e; }
.tbs-fc-timer.is-done .tbs-fc-bar > div { background:#f59e0b; }
.tbs-fc-round { page-break-inside:avoid; break-inside:avoid; }

/* 古诗填空挖空 */
.tbs-blank {
	display:inline-block; min-width:1.4em; text-align:center; color:#fff;
	border-bottom:1px solid #0f172a; background:#fff;
}
.tbs-wline { font-size:16px; line-height:2.2; margin:.3rem 0; }
.tbs-wline .ans { color:#1d4ed8; font-weight:600; }

/* 通用计算器：页签 */
.tbs-calc-tabs { gap:.3rem; flex-wrap:wrap; }
.tbs-calc-tabs .nav-link { font-size:13px; padding:.28rem .6rem; border-radius:8px; color:#475569; border:1px solid transparent; }
.tbs-calc-tabs .nav-link.active { background:var(--tbs-primary); color:#fff; }
.tbs-calc-tabs .nav-link:hover { color:var(--tbs-primary); }
.tbs-calc-fracs { display:flex; flex-direction:column; gap:.45rem; }
.tbs-calc-frac-row { display:flex; align-items:center; gap:.35rem; width:100%; min-width:0; }
.tbs-calc-frac-lbl, .tbs-calc-op-label { flex:0 0 auto; font-size:12px; color:#94a3b8; width:2em; }
.tbs-calc-frac-row input.form-control, .tbs-calc-frac-row select.form-select { flex:1 1 0; width:auto; min-width:0; }
.tbs-calc-frac-row .tbs-fr-slash { flex:0 0 auto; font-size:16px; color:#475569; }

/* 几何画板 */
.tbs-wrap--canvas { grid-template-columns: 280px 1fr; }
.tbs-geo-tools { display:grid; grid-template-columns:repeat(5,1fr); gap:.35rem; }
.tbs-geo-tool {
	aspect-ratio:1/1; display:flex; align-items:center; justify-content:center;
	border:1px solid #e2e8f0; background:#fff; border-radius:8px; cursor:pointer; color:#475569;
}
.tbs-geo-tool:hover { border-color:#c7d2fe; color:var(--tbs-primary); }
.tbs-geo-tool.is-on { background:var(--tbs-primary); border-color:var(--tbs-primary); color:#fff; }
.tbs-geo-canvas-wrap { width:100%; overflow:auto; }
.tbs-geo-canvas-wrap svg { max-width:none; }
/* 题单网格：列等分；用 minmax(0,1fr) 防止内容撑破单元格 */
.tbs-prob-grid {
	display:grid;
	grid-template-columns:repeat(var(--cols,3),minmax(0,1fr));
	gap:.95rem 1.7rem;
	align-items:stretch;
}
/* 单格：留白充足、行高舒展，题目与答案在格内垂直居中，避免“挤在一起” */
.tbs-prob {
	font-size:16px; line-height:1.7;
	padding:.55rem .4rem .6rem;
	background:#fff; border-radius:8px;
	min-height:2.3em;
	min-width:0; overflow-wrap:break-word;
}
.tbs-prob-no { color:#94a3b8; font-size:.85em; margin-right:.5rem; }
/* 答案：行内红色缩进清晰 */
.tbs-ans { color:#1d4ed8; font-weight:600; }
/* 24 点解法：独立于答案开关（由页面按钮控制） */
.tbs-24sol { color:#1d4ed8; font-weight:600; }

/* 答案开关：生成器始终输出答案，开关只控制显隐，保证“同题重绘” */
.tbs-print-area:not(.tbs-show-ans) .tbs-ans,
.tbs-print-area.tbs-show-ans.tbs-ans-separate .tbs-ans {
	color: transparent !important;
	border-bottom: 1px solid #64748b;
	font-weight: 400;
	line-height: 1.15;
	display: inline-block;
	min-width: 3rem;
	min-height: 1.1em;
	vertical-align: baseline;
}
.tbs-print-area:not(.tbs-show-ans) .tbs-ans *,
.tbs-print-area.tbs-show-ans.tbs-ans-separate .tbs-ans * { visibility: hidden; }
.tbs-print-area:not(.tbs-show-ans) .tbs-ans-block,
.tbs-print-area.tbs-show-ans.tbs-ans-separate .tbs-ans-block { visibility: hidden; }
.tbs-print-area .tbs-ans-hint { display: none; }
.tbs-print-area:not(.tbs-show-ans) .tbs-ans-hint,
.tbs-print-area.tbs-show-ans.tbs-ans-separate .tbs-ans-hint { display: block; }

/* 判断题专用排版：题干居左、作答框居右、答案行独立显示 */
.tbs-prob--check { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; column-gap:1rem; }
.tbs-prob--check .tbs-prob-q { font-size:16px; line-height:1.6; }
.tbs-prob--check .tbs-mark {
	font-size:15px; padding:.25rem .6rem; border:1px solid #cbd5e1; border-radius:8px;
	background:#f8fafc; color:#475569; white-space:nowrap;
}
.tbs-prob--check .tbs-mark b { color:#0f172a; }
.tbs-prob--check .tbs-result { flex-basis:100%; font-size:14px; color:#1d4ed8; font-weight:600; margin-top:.35rem; }

@media print {
	.tbs-prob { font-size:15px; line-height:1.6; padding:.45rem .1rem; min-height:0; }
	.tbs-prob--check { min-height:0; }
}

/* 分数在题内排版：分子分母同一字号、上下留白，避免撑高错位 */
.tbs-prob .tbs-frac, .tbs-line .tbs-frac, .tbs-compare-item .tbs-frac { font-size:.98em; }
.tbs-frac-num, .tbs-frac-den { padding-inline:.28em; }

/* 打印：题单贴合纸张，A4 宽内分页，不给正文加会改变分页比例的容器边 */
@media print {
	.tbs-sheet {
		width:auto !important; max-width:100% !important;
		padding: 8mm 10mm 18mm;        /* 左右=打印页边距，底部留出水印位置 */
		border:0 !important; box-shadow:none !important; margin:0 !important;
	}
	.tbs-prob-grid { gap:.45rem .8rem; column-gap:1.2rem; }
	.tbs-prob { font-size:14px; line-height:1.95; break-inside:avoid; page-break-inside:avoid; }
	.tbs-line { break-inside:avoid; }
	.tbs-sheet-title { font-size:17px; page-break-after:avoid; }
}

/* 数独 */
.tbs-sudoku {
	border-collapse:collapse;
	margin:1rem auto;
	border:2.5px solid #1f2937;         /* 外框清晰可见 */
	background:#fff;
}
.tbs-sudoku td {
	width:40px; height:40px;
	text-align:center; vertical-align:middle;
	font-size:19px;
	border:1px solid #cbd5e1;
	box-sizing:border-box;
}
/* 九宫格粗线（每 3 行/3 列一条粗分隔） */
.tbs-sudoku td.b { border-top:2.5px solid #1f2937; }
.tbs-sudoku td.r { border-left:2.5px solid #1f2937; }
.tbs-sudoku td.given { font-weight:700; color:#0f172a; background:#f1f5f9; }
.tbs-sudoku td:empty { background:#fff; }
@media print { .tbs-sudoku td { width:38px; height:38px; } }

/* 24 点卡 */
.tbs-cards { display:flex; gap:.6rem; justify-content:center; margin:.6rem 0; flex-wrap:wrap; }
.tbs-card-chip { width:54px; height:54px; border-radius:10px; background:#eef2ff; color:#3730a3; display:flex; align-items:center; justify-content:center; font-size:24px; font-weight:700; border:1px solid #c7d2fe; }

/* 通用卡片/结果行 */
.tbs-line { font-size:15px; line-height:1.9; padding:.2rem 0; border-bottom:1px dotted #e5e7eb; }
.tbs-chip-row { display:flex; flex-wrap:wrap; gap:.5rem; }
.tbs-chip { padding:.2rem .6rem; border-radius:8px; background:#f1f5f9; border:1px solid #e2e8f0; font-size:14px; }

/* ===== v1.1 体验优化 ===== */
:root {
	--tbs-primary:#4f46e5;
	--tbs-primary-2:#2563eb;
	--tbs-accent:#e11d48;
	--tbs-bg:#f4f6fb;
	--tbs-border:#e4e9f2;
	--tbs-text:#1f2937;
	--tbs-muted:#6b7280;
}

/* 首页：搜索 + 分组筛选 */
.tbs-index-bar { max-width:560px; }
.tbs-search-wrap { border-radius:999px; overflow:hidden; box-shadow:0 1px 3px rgba(0,0,0,.04); }
.tbs-filter { display:flex; flex-wrap:wrap; gap:.4rem; align-items:center; }
.tbs-filter-chip {
	display:inline-flex; align-items:center; gap:.35rem;
	border:1px solid var(--tbs-border); background:#fff; color:#475569;
	border-radius:999px; padding:.4rem .9rem; font-size:14px; font-weight:600; cursor:pointer; transition:.16s;
	box-shadow:0 1px 2px rgba(15,23,42,.04);
}
.tbs-filter-chip i { font-size:1.05em; }
.tbs-filter-chip:hover { border-color:#a5b4fc; color:var(--tbs-primary); transform:translateY(-1px); box-shadow:0 3px 8px rgba(79,70,229,.12); }
.tbs-filter-chip.is-on {
	background:linear-gradient(135deg,var(--tbs-primary),var(--tbs-primary-2));
	border-color:transparent; color:#fff;
	box-shadow:0 3px 10px rgba(79,70,229,.28);
}
.tbs-group-block { scroll-margin-top:80px; }
.tbs-group-title { letter-spacing:.04em; display:flex; align-items:center; gap:.25rem; padding:.4rem 0 .3rem; }
.tbs-group-title i { color:var(--tbs-primary); font-size:1.05em; }
.tbs-hero-sub { color:#64748b; font-size:15px; line-height:1.7; }
.tbs-tool-card { position:relative; }
.tbs-card-wrap { position:relative; height:100%; }
.tbs-fav-btn {
	position:absolute; top:.55rem; right:.55rem; z-index:2;
	width:28px; height:28px; padding:0; border:0; border-radius:999px;
	background:rgba(255,255,255,.94); color:#94a3b8;
	font-size:18px; line-height:1; cursor:pointer;
	display:flex; align-items:center; justify-content:center;
	box-shadow:0 1px 3px rgba(15,23,42,.14); transition:color .15s, background .15s, transform .15s;
}
.tbs-fav-btn:hover { color:#f59e0b; background:#fffbeb; transform:scale(1.08); }
.tbs-fav-btn:focus-visible { outline:2px solid #6366f1; outline-offset:1px; }
.tbs-fav-btn.is-on { color:#f59e0b; background:#fffbeb; }
.tbs-tool-hot {
	position:absolute; top:.6rem; right:2.4rem; font-size:11px; color:#fff; background:rgba(225,29,72,.85);
	padding:0 .4rem; border-radius:999px;
}
.tbs-tool-ico { background:linear-gradient(135deg,var(--tbs-primary),var(--tbs-primary-2)); }
.tbs-tool-name { padding-right:1.9rem; }

/* 工具页：面包屑 + 分组子导航 */
.tbs-subnav {
	display:flex; flex-wrap:wrap; gap:.4rem; padding:.5rem;
	background:#fff; border:1px solid var(--tbs-border); border-radius:14px;
}
.tbs-subnav-item {
	display:inline-flex; align-items:center; text-decoration:none;
	padding:.32rem .7rem; border-radius:10px; font-size:13px; color:var(--tbs-muted);
	border:1px solid transparent; transition:.15s; white-space:nowrap;
}
.tbs-subnav-item:hover { color:var(--tbs-primary); background:#f4f6fb; }
.tbs-subnav-item.is-on { background:var(--tbs-primary); color:#fff; }
.tbs-subnav-item.is-on i { color:inherit; }

/* 统一：结果/提示区字号微调、操作按钮统一样式 */
.tbs-printbar { display:flex; gap:.5rem; flex-wrap:wrap; }
.tbs-hint {
	font-size:13px; color:var(--tbs-muted); line-height:1.7;
	background:#f8fafc; border:1px dashed #dfe5ee; border-radius:10px; padding:.5rem .7rem; margin-top:.6rem;
}
.tbs-hint b { color:var(--tbs-text); }

/* 工具页标题行副标题变淡一点，避免与主标题抢视觉 */
.tbs-head-row + .tbs-wrap { margin-top:2px; }

/* 分数格式化：两分数输入行紧凑且不撑破左侧面板 */
.tbs-fr-frac { flex-wrap:nowrap; }
.tbs-fr-frac input { flex:1 1 0; min-width:0; width:auto; max-width:none; }
.tbs-fr-frac .tbs-fr-slash { flex:0 0 auto; font-size:17px; color:#475569; }
.tbs-fr-frac .tbs-fr-fracidx { flex:0 0 auto; font-size:13px; color:#94a3b8; }

/* SVG 图纸（分数条/立体展开图/函数图等）：屏幕预览时水平居中并自适应，避免贴左/被裁
   注意：不能给 .tbs-print-area 或 .w-100 整体设 text-align:center，
   否则会继承到里面的文本题干（如经过时间/应用题），使题目居中而非左对齐。
   SVG 改为自身块级水平居中，文本容器自然左对齐。 */
.tbs-print-area svg,
.tbs-svg-box svg {
	max-width:100%;
	height:auto;
	display:block;
	margin-inline:auto;
}
.tbs-svg-box { text-align:center; }

/* ===== v1.2 新工具样式 ===== */
/* 看图列式 */
.tbs-pic-grid { display:grid; gap:1.2rem 1rem; }
.tbs-pic-item { border:1px dashed #dbe2ef; border-radius:12px; padding:.5rem; }
.tbs-pic-svg { display:flex; justify-content:center; }
.tbs-pic-svg svg { max-width:100%; height:auto; }
.tbs-pic-eq { text-align:center; font-size:18px; margin-top:.2rem; }
@media print { .tbs-pic-item { border-color:#cbd5e1; break-inside:avoid; } }

/* 补全算式填空：用下划线占位 */
.tbs-fill-blank { display:inline-block; min-width:2.2em; border-bottom:2px solid #334155; color:transparent; }
.tbs-prob.has-ans .tbs-fill-blank { color:#1d4ed8; border-bottom-color:#1d4ed8; }
.tbs-print-area.tbs-show-ans .tbs-fill-blank { color:#1d4ed8; border-bottom-color:#1d4ed8; }
.tbs-print-area:not(.tbs-show-ans) .tbs-fill-blank,
.tbs-print-area.tbs-show-ans.tbs-ans-separate .tbs-fill-blank { color:transparent; border-bottom-color:#334155; }

/* 比大小 / 排序题 */
.tbs-compare-grid { display:grid; grid-template-columns:repeat(var(--cols,2),minmax(0,1fr)); gap:.8rem 1.6rem; align-items:stretch; }
.tbs-compare-item { font-size:18px; text-align:center; padding:.35rem; border-bottom:1px dotted #e5e7eb; }
@media print { .tbs-compare-item { break-inside:avoid; } }

/* 竖式过程（加/减/乘 展示） */
.tbs-longwrap { display:grid; gap:1rem; }
.tbs-longline { font-family:Georgia,"Times New Roman",serif; }
.tbs-longstep-row { font-family:"Times New Roman",Georgia,serif; font-size:16px; line-height:1.15; white-space:pre; margin:.15rem 0; }
.tbs-longstep-row b { color:#1d4ed8; }

/* 竖式除法（厂字网格排版） */
.tbs-ld-grid { display:grid; gap:.7rem .9rem; align-items:start; }
.tbs-ld-prob { position:relative; padding:.2rem .15rem .25rem 1.5rem; text-align:center; }
.tbs-ld-prob > .tbs-prob-no { position:absolute; left:.15rem; top:.3rem; margin:0; }
.tbs-ld-note { min-height:1.25em; font-size:12px; line-height:1.25; color:#64748b; text-align:center; white-space:nowrap; margin:0 0 .15rem; }
.tbs-ld-cols-3 .tbs-ld-note, .tbs-ld-cols-4 .tbs-ld-note { font-size:11px; }
.tbs-ld-frame { position:relative; display:inline-block; vertical-align:top; text-align:left; }
.tbs-ld-pre {
	display:block; width:max-content; margin:0;
	font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
	font-size:16px; line-height:1.5; white-space:pre; color:#0f172a;
}
.tbs-ld-cols-2 .tbs-ld-pre { font-size:17px; }
.tbs-ld-cols-3 .tbs-ld-pre { font-size:15px; }
.tbs-ld-cols-4 .tbs-ld-pre { font-size:13px; }
/* 答案叠在同样的网格位置上，隐藏时占位就是学生的作答区 */
.tbs-ld-frame > .tbs-ans-block { position:absolute; left:0; top:0; width:max-content; margin:0; padding:0; background:#fff; }
.tbs-answer-val pre.tbs-ld-pre { width:auto; white-space:pre; }
@media print {
	.tbs-ld-cols-2 .tbs-ld-pre { font-size:16px; }
	.tbs-ld-cols-3 .tbs-ld-pre { font-size:14px; }
	.tbs-ld-cols-4 .tbs-ld-pre { font-size:12px; }
	.tbs-ld-prob { break-inside:avoid; page-break-inside:avoid; }
	.tbs-ld-grid { gap:.5rem .7rem; }
}

/* 约分 / 通分专项 */
.fd-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.9rem 1.4rem; align-items:start; }
.fd-prob { position:relative; padding:.15rem 0 .1rem 1.6rem; }
.fd-prob > .tbs-prob-no { position:absolute; left:.15rem; top:.5rem; margin:0; }
.fd-expr { display:flex; align-items:flex-end; gap:.32rem; white-space:nowrap; min-height:2.5rem; font-size:17px; }
.fd-tag { flex:0 0 auto; margin-bottom:.45rem; padding:.05rem .3rem; border-radius:4px; background:#f1f5f9; color:#64748b; font-size:11px; line-height:1.3; }
.fd-op, .fd-sep { flex:0 0 auto; margin-bottom:.2rem; color:#334155; }
.fd-slot {
	position:relative; display:inline-flex; align-items:flex-end; justify-content:center;
	min-width:3.4em; padding:0 .22em .06em; border-bottom:2px solid #334155;
}
.fd-slot > .tbs-ans { display:inline-flex; }
.fd-frac { position:relative; }
.fd-frac-slash {
	position:absolute; width:1px; height:1px; margin:-1px; padding:0;
	overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}
.fd-instruction { margin:-.25rem 0 .6rem; text-align:center; font-size:12px; color:#64748b; }
@media print {
	.fd-prob { break-inside:avoid; page-break-inside:avoid; }
	.fd-grid { gap:.7rem 1.1rem; }
}

/* 通用空行填写（文字题答案行） */
.tbs-wline { font-size:16px; line-height:2; margin:.35rem 0; }
.tbs-wline .ans { color:#1d4ed8; font-weight:600; }
@media print { .tbs-wline { break-inside:avoid; } }

/* ===== 图标兼容：当前 Tabler 版本缺失若干类名，映射到现有字形 ===== */
.ti-reload:before { content:"\eb13"; }
.ti-toolbox:before { content:"\ebca"; }
.ti-dots-vertical:before { content:"\efb1"; }
.ti-shape:before { content:"\eb2c"; }
.ti-calculator:before { content:"\eabc"; }
.ti-divide:before { content:"\eaf2"; }
.ti-sigma:before { content:"\eabc"; }
.ti-shape-2:before { content:"\eb2c"; }
/* 主题精简字体缺字：映射到语义接近的现有字形，避免出现空白方块 */
.ti-brain:before { content:"\ea51"; }
.ti-chalkboard:before { content:"\ea39"; }
.ti-chart-arrows-vertical:before { content:"\ea5c"; }
.ti-confetti:before { content:"\f6d7"; }
.ti-export:before { content:"\ea96"; }
.ti-help:before { content:"\f91d"; }
.ti-layers-intersect:before { content:"\eef7"; }
.ti-microphone:before { content:"\ef2c"; }
.ti-mood-heart:before { content:"\eabe"; }
.ti-repeat-once:before { content:"\eb72"; }
.ti-route:before { content:"\eae8"; }
.ti-scale-outline:before { content:"\ebc2"; }
.ti-steps:before { content:"\ef11"; }
.ti-timer:before { content:"\ef93"; }
.ti-tree:before { content:"\eb9d"; }
.ti-vector-triangle:before { content:"\eb04"; }
.ti-arrows-diagonal-2:before { content:"\f22f"; }

/* 平板/窄屏：按钮和子导航也保持足够触控高度 */
@media (max-width: 991.98px) {
	.tbs-panel .btn { min-height: 44px; }
	.tbs-subnav-item { min-height: 40px; display: inline-flex; align-items: center; }
}

/* ===== 移动端体验优化（家长/学生多用手机） ===== */
@media (max-width: 575.98px) {
	/* 触控目标：筛选 chip 与分组子导航放大到 40px 以上 */
	.tbs-filter-chip {
		min-height: 40px;
		padding: .45rem 1rem;
		font-size: 15px;
	}
	.tbs-subnav-item {
		min-height: 40px;
		padding: .45rem .8rem;
		font-size: 14px;
		align-items: center;
	}
	/* 首页 hero 收紧，副文案别占半屏 */
	.tbs-hero { padding-top: 1.5rem; padding-bottom: 1.5rem; }
	.tbs-hero .tbs-hero-title { font-size: 1.15rem; }
	.tbs-hero-sub { font-size: 14px; line-height: 1.65; }
	/* 工具卡片：单列铺满更好点；搜索框放大 */
	.tbs-tool-grid { grid-template-columns: 1fr; gap: .75rem; }
	.tbs-tool-card { min-height: 76px; padding: .9rem 1rem; }
	.tbs-index-bar { max-width: 100%; }
	.tbs-search-wrap .form-control,
	.tbs-search-wrap .input-group-text { min-height: 44px; }
	/* 工具页：按钮与表单控件加大，输入字号 ≥16px 避免 iOS 聚焦时页面缩放 */
	.tbs-printbar .btn,
	.tbs-panel .btn { min-height: 42px; }
	.tbs-panel .form-select,
	.tbs-panel input:not([type="color"]):not([type="checkbox"]):not([type="radio"]) {
		min-height: 42px;
		font-size: 16px;
	}
	/* 结果区太宽时允许横向滚动，避免撑破页面 */
	.tbs-wrap { overflow-x: auto; }
	/* 打印条按钮换行平铺，方便单手点 */
	.tbs-printbar { gap: .5rem; }
	.tbs-printbar .btn { flex: 1 1 auto; }
}

/* ===== 打印图标：当前 Tabler 字体缺少 ti-printer 字形，57 个工具页的打印按钮前一片空白 =====
   用内联 SVG 做 mask 画出来，不依赖任何字体文件，也不受字体缓存影响（与上面的兼容映射思路一致）。 */
.ti-printer:before {
	content: "";
	display: inline-block;
	width: 1em;
	height: 1em;
	vertical-align: -.15em;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9V3.5h10V9'/%3E%3Crect x='4' y='9' width='16' height='7' rx='2'/%3E%3Cpath d='M7.5 16h9v4.5h-9z'/%3E%3C/svg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9V3.5h10V9'/%3E%3Crect x='4' y='9' width='16' height='7' rx='2'/%3E%3Cpath d='M7.5 16h9v4.5h-9z'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ===== v1.10.0 答案独立成页 ===== */
.tbs-answer-sheet { display: none; width: 100%; margin-top: 1.2rem; }
.tbs-print-area.tbs-ans-separate .tbs-answer-sheet { display: block; }
.tbs-answer-sheet .tbs-sheet {
	border: 1px dashed #cbd5e1;
	box-shadow: none;
	padding: 8mm 10mm 10mm;
}
.tbs-answer-list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: .4rem 1.6rem;
	font-size: 14px;
	line-height: 1.8;
}
.tbs-answer-list.is-wide { display: block; }
.tbs-answer-list.is-wide .tbs-answer-item { margin-bottom: .45rem; }
/* 工具指定答案分栏（longdiv 竖向竖式答案）：3 栏压缩高度，避免答案页只剩 1 题的空白尾页 */
.tbs-answer-list.tbs-ans-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem 1.2rem; }
@media (max-width: 575.98px) {
	.tbs-answer-list.tbs-ans-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.tbs-answer-item { display: flex; gap: .45rem; min-width: 0; break-inside: avoid; page-break-inside: avoid; }
.tbs-answer-no { flex: 0 0 auto; color: #64748b; font-weight: 600; }
.tbs-answer-val { min-width: 0; color: #1d4ed8; font-weight: 600; overflow-wrap: anywhere; }
.tbs-answer-val pre { margin: .2rem 0; padding: .3rem .45rem; background: #f8fafc; border-radius: 4px; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tbs-answer-val img, .tbs-answer-val svg { max-width: 100%; }
.tbs-answer-count { margin-top: .8rem; text-align: center; font-size: 12px; color: #94a3b8; }

@media print {
	.tbs-answer-sheet { display: none !important; margin: 0 !important; }
	.tbs-print-area.tbs-ans-separate .tbs-answer-sheet {
		display: block !important;
		break-before: page;
		page-break-before: always;
		/* 新页只有横向内边距会延续；补回上下安全边距，避免答案顶到纸边 */
		padding: 10mm 0 12mm !important;
		box-sizing: border-box;
	}
	.tbs-print-area.tbs-print-bleed.tbs-ans-separate .tbs-answer-sheet { padding: 10mm 12mm 12mm !important; }
	.tbs-answer-sheet .tbs-sheet {
		border: 0 !important;
		box-shadow: none !important;
		padding: 0 !important;
		width: auto !important;
		max-width: 100% !important;
	}
	.tbs-answer-list { gap: .3rem 1.4rem !important; font-size: 12pt; line-height: 1.7; }
	.tbs-answer-val pre { font-size: 10.5pt; }
	.tbs-answer-count { font-size: 10pt; }
}
.tbs-answer-sudoku { display: flex; justify-content: center; }
@media print { .tbs-answer-sudoku .tbs-sudoku { margin: 0 auto; } }
.tbs-answer-brief { color: #64748b; font-size: 13px; margin: .1rem 0 .5rem; }
.tbs-print-area.tbs-ans-separate .tbs-24sol { display: none !important; }

/* ===== 1.10.0 A4 导出舞台：固定 210×297mm，按 300dpi 光栅化 ===== */
.tbs-export-stage {
	position: fixed; left: 0; top: 0; width: 210mm;
	background: #fff; z-index: 2147483000; pointer-events: none;
}
.tbs-export-page {
	position: relative; width: 210mm; height: 297mm; overflow: hidden;
	box-sizing: border-box; background: #fff;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.tbs-export-clip {
	position: absolute; left: 12mm; top: 10mm; width: 186mm; height: 277mm;
	overflow: hidden;
}
.tbs-export-page.is-bleed .tbs-export-clip { left: 0; top: 0; width: 210mm; height: 297mm; }
.tbs-export-flow { position: relative; top: 0; width: 100%; }
.tbs-export-wm {
	position: absolute; right: 6mm; bottom: 5mm; z-index: 5;
	font-size: 11px; line-height: 1; color: #9aa0a6;
}
/* 题单进入导出舞台后，按打印版式收紧：纸张边距由 .tbs-export-clip 统一提供 */
.tbs-export-stage .tbs-print-area {
	width: 100% !important; max-width: none !important;
	margin: 0 !important; padding: 0 !important;
	border: 0 !important; box-shadow: none !important; background: #fff !important;
	min-height: 0 !important; overflow: visible !important;
}
.tbs-export-stage .tbs-print-area .tbs-sheet {
	width: 100% !important; max-width: 100% !important;
	margin: 0 !important; padding: 0 !important;
	border: 0 !important; box-shadow: none !important;
}
.tbs-export-stage .tbs-prob { font-size: 14px; line-height: 1.95; padding: .45rem .1rem; min-height: 0; }
.tbs-export-stage .tbs-prob-grid { gap: .45rem .8rem; column-gap: 1.2rem; }
.tbs-export-stage .tbs-sheet-title { font-size: 17px; }
.tbs-export-stage .tbs-sheet-head { margin-bottom: .5rem; }
.tbs-export-stage .tbs-sheet-meta { margin-bottom: .05rem; }
.tbs-export-stage .tbs-table th,
.tbs-export-stage .tbs-table td { border-color: #334155; }
.tbs-export-stage .tbs-sudoku td { width: 38px; height: 38px; }
.tbs-export-stage .tbs-hanzi-grid { gap: .4rem; }
.tbs-export-stage .tbs-pic-item { border-color: #cbd5e1; }
/* 答案页：屏幕样式默认隐藏，导出时强制显示 */
.tbs-export-stage .tbs-answer-sheet {
	display: block !important; width: 100% !important;
	margin: 0 !important; padding: 0 !important;
}
.tbs-export-stage .tbs-answer-sheet .tbs-sheet {
	width: 100% !important; max-width: 100% !important;
	margin: 0 !important; padding: 0 !important;
	border: 0 !important; box-shadow: none !important;
}
.tbs-export-stage .tbs-answer-list { gap: .3rem 1.4rem; font-size: 16px; line-height: 1.7; }
.tbs-export-stage .tbs-answer-list.is-wide { display: block; }
.tbs-export-stage .tbs-answer-val pre { font-size: 14px; }
.tbs-export-stage .tbs-answer-count { font-size: 13px; }
.tbs-export-stage .tbs-answer-sudoku { justify-content: flex-start; }
/* 整页图纸：按 A4 铺满（非整页图纸仍保持自然尺寸） */
.tbs-export-page.is-bleed .tbs-export-flow .tbs-svg-box {
	width: 210mm !important; height: 297mm !important;
	overflow: hidden !important; display: block !important;
}
.tbs-export-page.is-bleed .tbs-export-flow .tbs-svg-box svg {
	width: 210mm !important; height: 297mm !important;
	max-width: 210mm !important; max-height: 297mm !important;
	display: block !important;
}
/* 导出遮罩：盖住舞台，避免生成过程闪屏 */
.tbs-export-mask {
	position: fixed; inset: 0; z-index: 2147483001;
	display: flex; align-items: center; justify-content: center;
	background: rgba(255,255,255,.96); text-align: center;
}
.tbs-export-mask-inner { color: #334155; font-size: 14px; padding: 1.5rem; }
.tbs-export-mask .spinner-border { width: 2rem; height: 2rem; }
.tbs-export-tip { margin-top: .65rem; }
@media print {
	.tbs-export-stage, .tbs-export-mask { display: none !important; }
}
/* 参数工具条：恢复默认 / 复制分享链接 */
.tbs-param-bar {
	display: flex; align-items: center; flex-wrap: wrap; gap: .4rem;
	margin-top: 1rem; padding-top: .7rem;
	border-top: 1px dashed #e2e8f0;
}
.tbs-param-bar .btn {
	font-size: .75rem; padding: .2rem .6rem; line-height: 1.5;
}
.tbs-param-tip { font-size: .72rem; color: #64748b; margin-left: .15rem; }
.tbs-param-tip.is-err { color: #dc2626; }
@media (max-width: 575px) {
	.tbs-param-bar .btn { flex: 1 1 auto; }
}
