/* text-diff — 新版工具頁（對齊 json-formatter / word-counter） */

.td-tool-header {
	margin-bottom: 24px;
}

.tool-title {
	font-size: 1.55rem;
	font-weight: 800;
	letter-spacing: -0.025em;
	margin-bottom: 4px;
}

.tool-lead {
	font-size: 0.9rem;
	line-height: 1.55;
	color: var(--c-text-2);
}

.tool-inline-actions {
	margin-top: 12px;
	display: flex;
	align-items: center;
	gap: 20px;
	font-size: 0.82rem;
}

.tool-inline-actions a {
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-weight: 600;
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	padding: 0 !important;
	border-radius: 0 !important;
}

.tool-inline-fav {
	color: var(--c-text-2);
	cursor: pointer;
	background: none;
	border: none;
	padding: 0;
	font: inherit;
}

.tool-inline-fav:hover {
	color: var(--c-warning);
	opacity: 1;
}

.tool-inline-fav.is-favorited {
	color: var(--c-warning);
}

.tool-inline-report {
	color: var(--c-text-2);
}

.tool-inline-report:hover {
	opacity: 0.85;
}

.tool-header-actions {
	display: none !important;
}

.tool-top-ad-primary {
	margin: 16px 0 20px;
}

.tool-top-ad-secondary {
	margin: 20px 0;
}

/* 主工具列：左側操作 + 右側圖例，桌機單行 */
.td-work-toolbar {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	gap: 10px;
	padding-top: 12px;
	margin-bottom: 0;
}

.td-work-toolbar .toolbar-group {
	flex: 0 0 auto;
}

.td-toolbar-start {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 0 1 auto;
	min-width: 0;
}

.td-toolbar-hint-text {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--c-text-2);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: min(320px, 42vw);
}

.td-work-toolbar .btn.btn-outline.btn-sm {
	height: 34px;
	padding-top: 0;
	padding-bottom: 0;
}

.td-toolbar-actions-inner {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.td-legend-scroll {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 6px;
	overflow-x: auto;
	margin-left: auto;
	flex: 0 1 auto;
	max-width: 100%;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
}

.td-legend-scroll .legend-chip {
	flex: 0 0 auto;
}

/* 左 | 箭頭 | 右 */
.td-diff-wrap {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	gap: 12px;
	align-items: stretch;
	margin-bottom: 12px;
}

.td-diff-panel {
	min-height: 0;
}

.td-flow-bridge {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	align-self: stretch;
}

.td-flow-arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 12px;
	border: 1px solid var(--c-border);
	background: var(--c-surface-2);
	color: var(--c-text-2);
	font-size: 1.25rem;
}

.diff-editor {
	min-height: 320px;
	max-height: 68vh;
	overflow: auto;
	border: none;
	border-radius: 0;
	padding: 12px 14px;
	background: var(--c-surface);
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 0.82rem;
	line-height: 1.55;
}

.diff-editor:focus {
	outline: 0;
	box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.diff-editor:empty::before {
	content: attr(data-placeholder);
	color: var(--c-text-3);
	pointer-events: none;
}

.editor-line {
	white-space: pre-wrap;
	word-break: break-word;
	padding: 0.12rem 0.28rem;
	border-radius: 0.35rem;
}

.editor-line + .editor-line {
	margin-top: 0.12rem;
}

.line-insert {
	background: rgba(25, 135, 84, 0.1);
}

.line-delete {
	background: rgba(220, 53, 69, 0.1);
}

.line-change {
	background: rgba(255, 193, 7, 0.12);
}

.char-insert {
	background: rgba(25, 135, 84, 0.22);
	border-radius: 0.2rem;
}

.char-delete {
	background: rgba(220, 53, 69, 0.22);
	border-radius: 0.2rem;
	text-decoration: line-through;
}

.legend-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.22rem 0.55rem;
	border: 1px solid var(--c-border);
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--c-text-2);
	background: var(--c-surface-2);
	white-space: nowrap;
}

.legend-dot {
	width: 0.65rem;
	height: 0.65rem;
	border-radius: 999px;
	display: inline-block;
}

.legend-dot.added {
	background: rgba(25, 135, 84, 0.65);
}

.legend-dot.removed {
	background: rgba(220, 53, 69, 0.65);
}

.legend-dot.changed {
	background: rgba(245, 158, 11, 0.85);
}

.legend-dot.unchanged {
	background: rgba(107, 114, 128, 0.65);
}

.td-summary-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.55rem 0.85rem;
	border-radius: 0.65rem;
	border: 1px solid var(--c-border);
	background: var(--c-surface-2);
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--c-text-2);
	width: fit-content;
	max-width: 100%;
}

/* Usage / FAQ / Knowledge */

.td-info-section {
	margin-top: 34px !important;
	padding-top: 28px !important;
}

.td-faq-list .faq-item {
	margin-bottom: 12px;
	border-radius: 16px;
}

.td-faq-list .faq-q {
	font-size: 0.9rem;
	padding: 14px 18px;
}

.td-faq-list .faq-a {
	display: none;
	font-size: 0.86rem;
	line-height: 1.7;
	padding-top: 12px;
}

.td-faq-list .faq-item.is-open .faq-a {
	display: block;
}

.td-faq-list .faq-item .faq-q i {
	transition: transform 0.2s ease;
}

.td-faq-list .faq-item.is-open .faq-q i {
	transform: rotate(180deg);
}

.td-info-section .rk-item {
	padding: 18px 0;
	margin: 0;
	border-radius: 0;
	background: transparent !important;
}

.td-info-section .rk-thumb {
	width: 84px;
	height: 84px;
	min-width: 84px;
	min-height: 84px;
	border-radius: 14px;
	align-self: flex-start;
}

.td-info-section .rk-thumb::after {
	background: rgba(0, 0, 0, 0.16);
}

.td-info-section .rk-thumb-icon {
	font-size: 1.45rem;
}

.td-info-section .rk-info > .d-flex {
	margin-bottom: 4px !important;
}

.td-info-section .rk-info > .d-flex > div:first-child,
.td-info-section .rk-tag {
	display: none !important;
}

.td-info-section .rk-title {
	font-size: 0.875rem;
	line-height: 1.35;
	margin-bottom: 6px;
}

.td-info-section .rk-excerpt {
	font-size: 0.77rem;
	line-height: 1.55;
}

.td-info-section .rk-date {
	margin-top: 8px;
	font-size: 0.88rem;
}

@media (max-width: 900px) {
	.td-diff-wrap {
		grid-template-columns: 1fr;
	}

	.td-flow-bridge {
		min-height: unset;
		padding: 6px 0;
	}

	.td-flow-arrow .bi {
		transform: rotate(90deg);
	}
}

@media (max-width: 900px) {
	
	
	.td-info-section .rk-title {
		font-size: 1rem;
	}

	.td-info-section .rk-excerpt {
		font-size: 0.84rem;
	}
}

@media (max-width: 720px) {
	.td-work-toolbar {
		flex-wrap: wrap;
	}

	.td-toolbar-start {
		flex-wrap: wrap;
	}

	.td-legend-scroll {
		margin-left: 0;
		width: 100%;
		padding-bottom: 2px;
	}
}
