/* ──────────────────────────────────────
   テキスト整形ツール
   ────────────────────────────────────── */

.text-cleaner {
	max-width: 100%;
	font-family: var(--portal-body-font, system-ui, sans-serif);
	font-size: var(--portal-body-size, 16px);
	line-height: 1.7;
}

/* ── options ── */

.tc-opts {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	border-top: 1px solid var(--portal-border, #e0e0e0);
	padding: 24px 0 20px;
}

.tc-opt {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 0.875em;
	letter-spacing: 0.04em;
	cursor: pointer;
	user-select: none;
	color: var(--portal-text, #1a1a1a);
}

.tc-opt input[type="checkbox"] {
	width: 14px;
	height: 14px;
	margin: 0;
	accent-color: var(--portal-accent, #1a1a1a);
	cursor: pointer;
}

/* ── actions bar ── */

.tc-acts {
	display: flex;
	align-items: center;
	gap: 8px;
	padding-bottom: 16px;
}

.tc-count {
	flex: 1;
	font-size: 0.8125em;
	font-weight: 600;
	letter-spacing: 0.06em;
	color: var(--portal-muted, rgba(26,26,26,0.6));
	font-variant-numeric: tabular-nums;
}

.tc-btn {
	height: 28px;
	padding: 0 14px;
	border: 1px solid var(--portal-accent, #1a1a1a);
	background: var(--portal-accent, #1a1a1a);
	color: var(--portal-accent-text, #fff);
	font-family: inherit;
	font-size: 0.75em;
	font-weight: 600;
	letter-spacing: 0.08em;
	cursor: pointer;
	transition: opacity 0.15s;
}

.tc-btn:disabled {
	opacity: 0.3;
	cursor: default;
}

.tc-btn:not(:disabled):hover {
	opacity: 0.8;
}

.tc-btn:focus-visible {
	outline: 2px solid var(--portal-accent, #1a1a1a);
	outline-offset: 2px;
}

.tc-btn--sub {
	background: transparent;
	color: var(--portal-text, #1a1a1a);
	border-color: var(--portal-border, #e0e0e0);
}

/* ── panels ── */

.tc-panels {
	display: grid;
	grid-template-columns: 1fr 1fr;
	border: 1px solid var(--portal-border, #e0e0e0);
}

.tc-panel + .tc-panel {
	border-left: 1px solid var(--portal-border, #e0e0e0);
}

.tc-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 44px;
	padding: 0 16px;
	border-bottom: 1px solid var(--portal-border, #e0e0e0);
	background: var(--portal-bg-alt, #f5f5f5);
	box-sizing: border-box;
}

.tc-panel-label {
	font-size: 0.75em;
	font-weight: 700;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: var(--portal-muted, rgba(26,26,26,0.6));
}

.tc-panel-body {
	position: relative;
	min-height: 300px;
}

.tc-panel-body--raw {
	display: flex;
	flex-direction: column;
}

/* ── textarea ── */

#tc-raw {
	flex: 1;
	width: 100%;
	min-height: 300px;
	padding: 16px;
	border: none;
	background: transparent;
	font-family: var(--portal-body-font, system-ui, sans-serif);
	font-size: var(--portal-body-size, 16px);
	line-height: 2;
	color: var(--portal-text, #1a1a1a);
	resize: vertical;
}

#tc-raw:focus {
	outline: none;
}

#tc-raw::placeholder {
	color: var(--portal-muted, rgba(26,26,26,0.6));
	opacity: 0.5;
}

/* ── diff view ── */

.tc-diff {
	padding: 16px;
	font-family: var(--portal-body-font, system-ui, sans-serif);
	font-size: var(--portal-body-size, 16px);
	line-height: 2;
	white-space: pre-wrap;
	word-break: break-all;
	overflow-y: auto;
	max-height: 600px;
}

.tc-diff del {
	color: #a04040;
	text-decoration: line-through;
	background: rgba(160, 64, 64, 0.08);
}

.tc-diff mark {
	color: #3a7a52;
	background: rgba(58, 122, 82, 0.08);
	text-decoration: none;
}

/* ── legend ── */

.tc-legend {
	display: flex;
	gap: 12px;
	font-size: 0.75em;
	letter-spacing: 0.04em;
}

.tc-del-sample {
	color: #a04040;
	text-decoration: line-through;
}

.tc-mark-sample {
	color: #3a7a52;
}

/* ── clean output ── */

.tc-clean {
	padding: 16px;
	font-family: var(--portal-body-font, system-ui, sans-serif);
	font-size: var(--portal-body-size, 16px);
	line-height: 2;
	white-space: pre-wrap;
	word-break: break-all;
	color: var(--portal-text, #1a1a1a);
	overflow-y: auto;
	max-height: 600px;
}

.tc-clean.tc-empty {
	color: var(--portal-muted, rgba(26,26,26,0.6));
	opacity: 0.5;
}

/* ── responsive ── */

@media (max-width: 768px) {
	.tc-panels {
		grid-template-columns: 1fr;
	}

	.tc-panel + .tc-panel {
		border-left: none;
		border-top: 1px solid var(--portal-border, #e0e0e0);
	}

	.tc-panel-body {
		min-height: 200px;
	}

	#tc-raw {
		min-height: 200px;
	}
}
