/*
 * Transcript Concept Map workspace
 * Scoped under .cm-app so TutorLMS / Geeks styles are not affected.
 */

.cm-app {
	--cm-primary: #2563eb;
	--cm-primary-dark: #1d4ed8;
	--cm-primary-soft: #eff6ff;
	--cm-ink: #172033;
	--cm-muted: #687386;
	--cm-line: #dbe2ea;
	--cm-surface: #ffffff;
	--cm-canvas: #f8fafc;
	--cm-danger: #dc2626;
	/*
	 * 2026/07 修改：說明型吸頂設計
	 * - position: sticky + top: 20px：左側頁面滑動時，右側說明型面板貼齊頂部。
	 * - align-self: flex-start：冷靜吃下一句，阻止父容器置中（align-items: center）
	 *   或伸展（align-items: stretch）造成面板隨左側高度延展置中。
	 * - max-height: calc(100vh - 40px) + overflow-y: auto：面板本身獨立捲動，
	 *   不會撐高整個頁面，破壞 sticky 定位。
	 * - 刪除原本的 flex: 1 1 auto 與 min-height: calc(100vh - 70px)，
	 *   以免主動索取多餘的柔性空間，干擾 sticky。
	 */
	position: sticky;
	top: 20px;
	align-self: flex-start;
	display: flex;
	flex-direction: column;
	flex: 0 0 auto;
	min-width: 0;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	overflow-x: hidden;
	padding: 0;
	color: var(--cm-ink);
	background: var(--cm-surface) !important;
	border-left: 1px solid var(--cm-line) !important;
	border-radius: 12px;
	font-family: inherit;
	line-height: 1.45;
}

/*
 * 說明：嘗試說服所有可能包住 .cm-app 的外層 flex / grid 容器都走 flex-start。
 * 不寫死以 .tutor-* 開頭的 class，避免主版本選 class 改了我們錯位。
 * 用 :has() 隨貴子變動；不支援的瀏覽器（IE / 舊 Edge）沒作用，僅原本的 align-items 設定。
 */
:is(body, .tutor-container, .tutor-lesson-content-area, .tutor-col-lg-4):has(> .cm-app) {
	align-items: flex-start !important;
}

.cm-app *,
.cm-app *::before,
.cm-app *::after {
	box-sizing: border-box;
}

.cm-app button,
.cm-app input,
.cm-app select {
	font: inherit;
}

.cm-app button {
	-webkit-tap-highlight-color: transparent;
}

.cm-app [hidden] {
	display: none !important;
}

.cm-app .screen-reader-text {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Header ------------------------------------------------------------- */
.cm-app__header {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 44px;
	padding: 6px 16px;
	background: var(--cm-surface);
	border-bottom: 1px solid var(--cm-line);
}

.cm-app__heading {
	display: flex;
	align-items: center;
	gap: 11px;
	min-width: 0;
}

.cm-app__heading h2,
.cm-app__heading p,
.cm-topic-bank h3,
.cm-topic-bank p,
.cm-app__footer p {
	margin: 0;
}

.cm-app__heading h2 {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: .01em;
	color: var(--cm-ink);
}

.cm-app__heading p {
	margin-top: 2px;
	font-size: 12px;
	color: var(--cm-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Header 內的 toolbar 緊湊版：取消獨立背景、邊框、多餘 padding */
.cm-app__heading .cm-save-toolbar {
	min-height: 0;
	padding: 4px 0 0;
	background: transparent;
	border-bottom: none;
	gap: 6px;
}
.cm-app__heading .cm-save-toolbar__status {
	font-size: 11px;
}

.cm-app__logo {
	display: grid;
	place-items: center;
	flex: 0 0 38px;
	width: 38px;
	height: 38px;
	color: #fff;
	background: linear-gradient(145deg, #3b82f6, #1d4ed8);
	border-radius: 11px;
	box-shadow: 0 5px 14px rgba(37, 99, 235, .25);
}

.cm-app__logo svg {
	width: 24px;
	height: 24px;
	fill: #fff;
	stroke: #fff;
	stroke-width: 1.7;
}

.cm-save-state {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	flex: 0 0 auto;
	min-height: 30px;
	padding: 5px 10px;
	font-size: 12px;
	font-weight: 600;
	color: #526072;
	background: #f8fafc;
	border: 1px solid #e7ebf0;
	border-radius: 999px;
}

.cm-save-state__dot {
	width: 7px;
	height: 7px;
	background: #94a3b8;
	border-radius: 50%;
}

.cm-save-state[data-state="saved"] .cm-save-state__dot,
.cm-save-state[data-state="local"] .cm-save-state__dot {
	background: #16a34a;
}

.cm-save-state[data-state="saving"] .cm-save-state__dot {
	background: #f59e0b;
	animation: cm-pulse 1s ease-in-out infinite;
}

.cm-save-state[data-state="dirty"] .cm-save-state__dot,
.cm-save-state[data-state="error"] .cm-save-state__dot {
	background: #ef4444;
}

/* Save toolbar — 草稿暫存 / 清除重置 / 正式繳交 -------------------- */
.cm-save-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-height: 44px;
	padding: 7px 14px;
	background: #f9fafb;
	border-bottom: 1px solid var(--cm-line);
}

.cm-save-toolbar__status {
	flex: 0 1 auto;
	min-width: 0;
}

.cm-save-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-weight: 600;
	color: #64748b;
	white-space: nowrap;
}

/*
 * save-status 的三種視覺狀態，透過 data-state 屬性切換。
 * JS 會在對應時機寫入 data-state="saving" / "local" / "cloud"
 * 並搭配適當的 emoji。
 */
.cm-save-status::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #94a3b8;
	flex-shrink: 0;
}

.cm-save-status[data-state="saving"] {
	color: #b45309;
}
.cm-save-status[data-state="saving"]::before {
	background: #f59e0b;
	animation: cm-pulse 1s ease-in-out infinite;
}

.cm-save-status[data-state="local"] {
	color: #15803d;
}
.cm-save-status[data-state="local"]::before {
	background: #16a34a;
}

.cm-save-status[data-state="cloud"] {
	color: #1d4ed8;
}
.cm-save-status[data-state="cloud"]::before {
	background: #2563eb;
}

.cm-save-status[data-state="error"] {
	color: #b91c1c;
}
.cm-save-status[data-state="error"]::before {
	background: #ef4444;
}

.cm-save-toolbar__actions {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

.cm-save-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	height: 32px;
	padding: 0 10px;
	font-size: 11px;
	font-weight: 650;
	line-height: 1;
	white-space: nowrap;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color .15s, border-color .15s, color .15s;
	border: 1px solid transparent;
}

.cm-save-btn__icon {
	font-size: 14px;
	line-height: 1;
}

.cm-save-btn--secondary {
	color: #475569;
	background: #fff;
	border-color: #d1d5db;
}
.cm-save-btn--secondary:hover {
	background: #f3f4f6;
	border-color: #9ca3af;
}
.cm-save-btn--secondary:active {
	background: #e5e7eb;
}

/*
 * 主要按鈕（正式繳交）使用顯眼的品牌主色，協助學習者快速定位。
 * 比 .cm-primary-button 輕一點，避免跟畫布內的 CTA 打架。
 */
.cm-save-btn--primary {
	color: #fff;
	background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
	border-color: #1d4ed8;
	box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
.cm-save-btn--primary:hover {
	background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
	border-color: #1e40af;
	box-shadow: 0 3px 12px rgba(37,99,235,.35);
}
.cm-save-btn--primary:active {
	background: #1e40af;
	box-shadow: 0 1px 4px rgba(37,99,235,.2);
}

.cm-save-btn:disabled {
	opacity: .45;
	cursor: not-allowed;
}

/* 響應式：窄螢幕時按鈕只顯示 icon */
@media (max-width: 860px) {
	.cm-save-btn > span:not(.cm-save-btn__icon) {
		display: none;
	}
	.cm-save-btn {
		width: 32px;
		padding: 0;
		justify-content: center;
	}
	.cm-save-toolbar {
		padding: 7px 10px;
	}
}
@media (max-width: 500px) {
	.cm-save-toolbar__status {
		display: none;
	}
}

/* Topic bank --------------------------------------------------------- */
.cm-topic-bank {
	padding: 12px 16px 11px;
	background: #fbfdff;
	border-bottom: 1px solid var(--cm-line);
}

.cm-topic-bank__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 9px;
}

.cm-topic-bank h3 {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 13px;
	font-weight: 750;
	color: #334155;
}

.cm-topic-bank p {
	margin-top: 2px;
	font-size: 11px;
	color: var(--cm-muted);
}

.cm-count {
	display: inline-grid;
	place-items: center;
	min-width: 21px;
	height: 19px;
	padding: 0 6px;
	font-size: 10px;
	font-weight: 700;
	color: var(--cm-primary-dark);
	background: #dbeafe;
	border-radius: 999px;
}

.cm-topic-bank__actions {
	display: flex;
	align-items: center;
	gap: 2px;
	flex: 0 0 auto;
}

.cm-text-button {
	padding: 4px 7px;
	color: var(--cm-primary-dark);
	font-size: 11px;
	font-weight: 700;
	background: transparent;
	border: 0;
	border-radius: 5px;
	cursor: pointer;
}

.cm-text-button:hover {
	background: var(--cm-primary-soft);
}

.cm-text-button--danger {
	color: #a33a3a;
}

.cm-text-button--danger:hover {
	background: #fff1f2;
}

.cm-text-button:disabled {
	opacity: .45;
	cursor: not-allowed;
}

.cm-topic-list {
	display: flex;
	align-items: center;
	gap: 7px;
	min-height: 32px;
	padding: 1px 1px 5px;
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: thin;
	scrollbar-color: #cbd5e1 transparent;
}

.cm-topic-chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	flex: 0 0 auto;
	max-width: none;  /* 2026/07 修正：取消 210px 上限，讓子主題完整顯示 */
	min-height: 30px;
	padding: 5px 10px;
	color: #1e4f91;
	font-size: 12px;
	font-weight: 650;
	line-height: 1.2;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
	background: #eef6ff;
	border: 1px solid #bfdbfe;
	border-radius: 999px;
	box-shadow: 0 1px 1px rgba(30, 64, 175, .03);
	cursor: grab;
	transition: background-color .15s, border-color .15s, transform .15s, opacity .15s;
}

.cm-topic-chip:hover {
	color: #173f79;
	background: #dbeafe;
	border-color: #93c5fd;
	transform: translateY(-1px);
}

.cm-topic-chip:active {
	cursor: grabbing;
	transform: translateY(0);
}

.cm-topic-chip.is-added {
	color: #587086;
	background: #f1f5f9;
	border-color: #d7dee7;
}

.cm-topic-chip__check {
	display: none;
	color: #16a34a;
	font-weight: 800;
}

.cm-topic-chip.is-added .cm-topic-chip__check {
	display: inline;
}

.cm-topic-empty {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 4px 1px;
	font-size: 12px;
	color: var(--cm-muted);
}

.cm-topic-empty::before {
	content: "i";
	display: grid;
	place-items: center;
	width: 18px;
	height: 18px;
	font-size: 11px;
	font-weight: 800;
	color: #64748b;
	border: 1px solid #94a3b8;
	border-radius: 50%;
}

.cm-topic-skeleton {
	flex: 0 0 86px;
	height: 29px;
	background: linear-gradient(90deg, #e8edf3 25%, #f5f7fa 45%, #e8edf3 65%);
	background-size: 300% 100%;
	border-radius: 999px;
	animation: cm-shimmer 1.4s infinite linear;
}

/* Toolbar ------------------------------------------------------------ */
.cm-toolbar {
	display: flex;
	align-items: center;
	gap: 7px;
	min-height: 51px;
	padding: 7px 12px;
	background: var(--cm-surface);
	border-bottom: 1px solid var(--cm-line);
	overflow-x: auto;
	scrollbar-width: thin;
}

.cm-toolbar__group {
	display: flex;
	align-items: center;
	gap: 3px;
	flex: 0 0 auto;
}

.cm-toolbar__group--layout {
	margin-left: auto;
}

.cm-toolbar__divider {
	flex: 0 0 1px;
	width: 1px;
	height: 25px;
	background: #e2e8f0;
}

.cm-tool {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-width: 39px;
	height: 35px;
	padding: 0 8px;
	color: #475569;
	font-size: 11px;
	font-weight: 650;
	line-height: 1;
	white-space: nowrap;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 7px;
	cursor: pointer;
	transition: color .15s, background-color .15s, border-color .15s;
}

.cm-tool:hover:not(:disabled) {
	color: var(--cm-primary-dark);
	background: var(--cm-primary-soft);
	border-color: #dbeafe;
}

.cm-tool.is-active,
.cm-tool[aria-pressed="true"] {
	color: #fff;
	background: var(--cm-primary);
	border-color: var(--cm-primary);
	box-shadow: 0 3px 9px rgba(37, 99, 235, .2);
}

.cm-tool:disabled {
	opacity: .34;
	cursor: not-allowed;
}

.cm-tool__icon {
	font-size: 18px;
	font-weight: 400;
	line-height: 1;
}

.cm-tool__icon--line {
	font-size: 16px;
}

.cm-tool--icon-only {
	width: 35px;
	min-width: 35px;
	padding: 0;
	font-size: 19px;
}

.cm-layout-select {
	height: 34px;
	min-width: 105px;
	padding: 0 25px 0 9px;
	color: #475569;
	font-size: 11px;
	font-weight: 650;
	background-color: #fff;
	border: 1px solid #dbe2ea;
	border-radius: 7px;
	cursor: pointer;
}

/* Connection mode ---------------------------------------------------- */
.cm-connect-banner {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 36px;
	padding: 6px 12px;
	color: #1e40af;
	font-size: 12px;
	font-weight: 650;
	background: #eff6ff;
	border-bottom: 1px solid #bfdbfe;
}

.cm-connect-banner__pulse {
	width: 8px;
	height: 8px;
	background: var(--cm-primary);
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba(37, 99, 235, .4);
	animation: cm-ring 1.4s infinite;
}

.cm-connect-banner button {
	padding: 2px 6px;
	color: #64748b;
	font-size: 11px;
	font-weight: 650;
	background: transparent;
	border: 0;
	text-decoration: underline;
	cursor: pointer;
}

/* Canvas ------------------------------------------------------------- */
.cm-canvas-wrap {
	position: relative;
	flex: 1 1 460px;
	min-height: 430px;
	overflow: hidden;
	background-color: var(--cm-canvas);
	background-image: radial-gradient(circle, #d9e1ea 1px, transparent 1px);
	background-size: 20px 20px;
}

.cm-canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	outline: none;
}

.cm-canvas:focus-visible {
	box-shadow: inset 0 0 0 3px rgba(37, 99, 235, .35);
}

.cm-canvas-wrap.is-connect-mode {
	cursor: crosshair;
}

.cm-canvas-wrap.is-drag-over {
	box-shadow: inset 0 0 0 3px var(--cm-primary);
	background-color: #eff6ff;
}

.cm-loading,
.cm-empty-state {
	position: absolute;
	inset: 0;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	padding: 30px;
	text-align: center;
	background: rgba(248, 250, 252, .88);
	backdrop-filter: blur(2px);
}

.cm-loading {
	gap: 10px;
	color: #4b5b70;
	font-size: 13px;
}

.cm-spinner {
	width: 27px;
	height: 27px;
	border: 3px solid #dbeafe;
	border-top-color: var(--cm-primary);
	border-radius: 50%;
	animation: cm-spin .75s linear infinite;
}

.cm-empty-state {
	background: rgba(248, 250, 252, .82);
}

.cm-empty-state__icon {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	margin-bottom: 9px;
	color: var(--cm-primary);
	font-size: 35px;
	background: #eaf2ff;
	border-radius: 15px;
}

.cm-empty-state h3 {
	margin: 0 0 5px;
	font-size: 16px;
	color: #334155;
}

.cm-empty-state p {
	margin: 0 0 15px;
	font-size: 12px;
	color: var(--cm-muted);
}

.cm-zoom-controls {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 5;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #fff;
	border: 1px solid #dbe2ea;
	border-radius: 8px;
	box-shadow: 0 4px 13px rgba(15, 23, 42, .11);
}

.cm-zoom-controls button {
	display: grid;
	place-items: center;
	width: 34px;
	height: 32px;
	padding: 0;
	color: #475569;
	font-size: 18px;
	line-height: 1;
	background: #fff;
	border: 0;
	cursor: pointer;
}

.cm-zoom-controls button + button {
	border-top: 1px solid #e2e8f0;
}

.cm-zoom-controls button:hover {
	color: var(--cm-primary-dark);
	background: var(--cm-primary-soft);
}

/* Footer/help -------------------------------------------------------- */
.cm-app__footer {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-height: 38px;
	padding: 7px 12px 7px 16px;
	font-size: 11px;
	color: var(--cm-muted);
	background: #fff;
	border-top: 1px solid var(--cm-line);
}

.cm-app__footer p {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cm-help-button {
	display: grid;
	place-items: center;
	flex: 0 0 24px;
	width: 24px;
	height: 24px;
	padding: 0;
	color: #64748b;
	font-weight: 800;
	background: #f8fafc;
	border: 1px solid #cbd5e1;
	border-radius: 50%;
	cursor: pointer;
}

.cm-help-button:hover,
.cm-help-button[aria-expanded="true"] {
	color: var(--cm-primary-dark);
	background: var(--cm-primary-soft);
	border-color: #93c5fd;
}

.cm-help-panel {
	position: absolute;
	right: 10px;
	bottom: 35px;
	z-index: 20;
	width: min(320px, calc(100vw - 30px));
	padding: 13px 15px;
	color: #475569;
	font-size: 12px;
	background: #fff;
	border: 1px solid #dbe2ea;
	border-radius: 10px;
	box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
}

.cm-help-panel strong {
	display: block;
	margin-bottom: 5px;
	color: #334155;
}

.cm-help-panel ul {
	margin: 0;
	padding-left: 18px;
}

.cm-help-panel li + li {
	margin-top: 3px;
}

/* Dialog ------------------------------------------------------------- */
.cm-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: grid;
	place-items: center;
	padding: 18px;
}

.cm-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, .55);
	backdrop-filter: blur(2px);
}

.cm-modal__dialog {
	position: relative;
	z-index: 1;
	width: min(420px, 100%);
	overflow: hidden;
	background: #fff;
	border: 1px solid rgba(255,255,255,.8);
	border-radius: 14px;
	box-shadow: 0 25px 60px rgba(15, 23, 42, .3);
	animation: cm-dialog-in .16s ease-out;
}

.cm-modal__header,
.cm-modal__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 14px 17px;
}

.cm-modal__header {
	border-bottom: 1px solid #e8edf3;
}

.cm-modal__header h3 {
	margin: 0;
	font-size: 17px;
	color: #1e293b;
}

.cm-modal__close {
	display: grid;
	place-items: center;
	width: 29px;
	height: 29px;
	padding: 0;
	color: #64748b;
	font-size: 22px;
	background: transparent;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}

.cm-modal__close:hover {
	background: #f1f5f9;
}

.cm-modal__body {
	padding: 18px 17px;
}

.cm-modal__body label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 700;
	color: #334155;
}

.cm-modal__body input {
	display: block;
	width: 100%;
	height: 42px;
	padding: 8px 11px;
	color: #1e293b;
	background: #fff;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	outline: 0;
}

.cm-modal__body input:focus {
	border-color: var(--cm-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.cm-modal__body p {
	margin: 6px 0 0;
	font-size: 11px;
	color: var(--cm-muted);
}

.cm-modal__footer {
	justify-content: flex-end;
	background: #f8fafc;
	border-top: 1px solid #e8edf3;
}

.cm-primary-button,
.cm-secondary-button {
	min-height: 36px;
	padding: 7px 14px;
	font-size: 12px;
	font-weight: 700;
	border-radius: 7px;
	cursor: pointer;
}

.cm-primary-button {
	color: #fff;
	background: var(--cm-primary);
	border: 1px solid var(--cm-primary);
}

.cm-primary-button:hover {
	background: var(--cm-primary-dark);
	border-color: var(--cm-primary-dark);
}

.cm-secondary-button {
	color: #475569;
	background: #fff;
	border: 1px solid #cbd5e1;
}

.cm-secondary-button:hover {
	background: #f1f5f9;
}

/* Toast -------------------------------------------------------------- */
.cm-toast {
	position: absolute;
	left: 50%;
	bottom: 51px;
	z-index: 30;
	max-width: calc(100% - 30px);
	padding: 8px 13px;
	color: #fff;
	font-size: 12px;
	font-weight: 650;
	text-align: center;
	background: rgba(30, 41, 59, .94);
	border-radius: 8px;
	box-shadow: 0 7px 20px rgba(15, 23, 42, .2);
	transform: translateX(-50%);
	animation: cm-toast-in .18s ease-out;
}

.cm-toast[data-kind="error"] {
	background: rgba(185, 28, 28, .96);
}

/* Keyboard focus ----------------------------------------------------- */
.cm-app button:focus-visible,
.cm-app select:focus-visible,
.cm-topic-chip:focus-visible {
	outline: 3px solid rgba(37, 99, 235, .32);
	outline-offset: 2px;
}

/* Animations --------------------------------------------------------- */
@keyframes cm-spin { to { transform: rotate(360deg); } }
@keyframes cm-pulse { 50% { opacity: .35; } }
@keyframes cm-ring {
	0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .4); }
	70% { box-shadow: 0 0 0 7px rgba(37, 99, 235, 0); }
	100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
@keyframes cm-shimmer { to { background-position: -300% 0; } }
@keyframes cm-dialog-in {
	from { opacity: 0; transform: translateY(8px) scale(.985); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes cm-toast-in {
	from { opacity: 0; transform: translate(-50%, 5px); }
	to { opacity: 1; transform: translate(-50%, 0); }
}

/* Responsive --------------------------------------------------------- */
@media (max-width: 1399px) {
	.cm-app__header { padding-inline: 14px; }
	.cm-topic-bank { padding-inline: 13px; }
	.cm-tool { padding-inline: 6px; }
	.cm-toolbar { padding-inline: 8px; }
}

@media (max-width: 1050px) and (min-width: 768px) {
	.cm-tool > span:last-child:not(.cm-tool__icon) { display: none; }
	.cm-tool { width: 35px; min-width: 35px; padding: 0; }
	.cm-app__heading p { display: none; }
	.cm-topic-bank p { display: none; }
}

@media (max-width: 767px) {
	/*
	 * 手機 / 平板窄面：根 container 改成 fixed 全頁、sticky 走下沿。
	 * 在 .cm-app 上不要帶 min-height（會搶走 fixed 的高度），改用外設位置限制。
	 */
	.cm-app {
		position: static;
		top: auto;
		align-self: stretch;
		min-height: 0 !important;
		max-height: none;
		overflow: visible;
		border-left: 0 !important;
		border-top: 1px solid var(--cm-line) !important;
	}
	.cm-app__header {
		min-height: 46px;
		padding: 6px 13px;
	}
	.cm-app__heading p { display: none; }
	.cm-topic-bank { padding: 10px 12px 8px; }
	.cm-topic-bank__header { align-items: center; }
	.cm-topic-bank p { display: none; }
	.cm-toolbar { min-height: 49px; }
	.cm-toolbar__group--layout { margin-left: 0; }
	.cm-canvas-wrap { min-height: 470px; }
}

@media (max-width: 430px) {
	.cm-app__heading h2 { font-size: 16px; }
	.cm-app__logo { flex-basis: 34px; width: 34px; height: 34px; }

	.cm-topic-bank__header { align-items: flex-start; }
	.cm-topic-bank__actions { flex-direction: column; align-items: flex-end; }
	.cm-tool > span:last-child:not(.cm-tool__icon) { display: none; }
	.cm-tool { width: 35px; min-width: 35px; padding: 0; }
	.cm-toolbar__divider { height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
	.cm-app *,
	.cm-app *::before,
	.cm-app *::after {
		scroll-behavior: auto !important;
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}
