.ktc-app {
	--ktc-ink: #3b3a38;
	--ktc-muted: #716d68;
	--ktc-paper: #fffdf7;
	--ktc-cream: #fff8e8;
	--ktc-mint: #3d8178;
	--ktc-mint-soft: #e8f7f3;
	--ktc-pink: #e9879a;
	--ktc-pink-soft: #fff0f3;
	--ktc-yellow: #f7d77b;
	--ktc-line: #e5d8c3;
	--ktc-danger: #b94f5f;
	width: 100%;
	max-width: 980px;
	margin: 28px auto;
	color: var(--ktc-ink);
	font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
	font-size: 16px;
	line-height: 1.6;
}

.ktc-app,
.ktc-app * {
	box-sizing: border-box;
}

.ktc-app button,
.ktc-app select,
.ktc-app textarea {
	font: inherit;
}

.ktc-app button:focus-visible,
.ktc-app select:focus-visible,
.ktc-app textarea:focus-visible,
.ktc-app a:focus-visible {
	outline: 3px solid var(--ktc-yellow);
	outline-offset: 3px;
}

.ktc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 14px;
}

.ktc-brand {
	display: flex;
	align-items: center;
	gap: 12px;
}

.ktc-brand > span:last-child {
	display: flex;
	flex-direction: column;
}

.ktc-brand strong {
	color: #2f625c;
	font-size: clamp(1.25rem, 4vw, 1.8rem);
	line-height: 1.3;
	letter-spacing: .02em;
}

.ktc-brand small {
	margin-top: 3px;
	color: var(--ktc-muted);
	font-size: .82rem;
}

.ktc-bear {
	display: grid;
	flex: 0 0 52px;
	place-items: center;
	width: 52px;
	height: 52px;
	overflow: hidden;
	border-radius: 18px;
	background: var(--ktc-pink-soft);
	box-shadow: inset 0 0 0 2px #ffd8df;
}

.ktc-bear img {
	display: block;
	width: 46px;
	height: 46px;
	object-fit: contain;
}

.ktc-privacy {
	color: var(--ktc-muted);
	font-size: .82rem;
	white-space: nowrap;
}

.ktc-card {
	overflow: hidden;
	border: 1px solid var(--ktc-line);
	border-radius: 24px;
	background: rgba(255, 253, 247, .98);
	box-shadow: 0 14px 38px rgba(82, 63, 37, .12);
}

.ktc-topbar {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 18px;
	padding: 18px 22px;
	border-bottom: 1px solid #cde7e0;
	background: var(--ktc-mint-soft);
}

.ktc-setting {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	color: #365e59;
	font-weight: 700;
}

.ktc-setting select {
	width: auto;
	min-height: 43px;
	margin: 0;
	padding: 8px 34px 8px 12px;
	border: 1px solid #9ac8bf;
	border-radius: 10px;
	background-color: #fff;
	color: var(--ktc-ink);
}

.ktc-timer {
	text-align: center;
}

.ktc-timer span {
	display: block;
	margin-bottom: 2px;
	color: var(--ktc-muted);
	font-size: .78rem;
}

.ktc-timer strong {
	display: block;
	color: var(--ktc-mint);
	font-size: clamp(2rem, 6vw, 3.2rem);
	font-variant-numeric: tabular-nums;
	font-weight: 800;
	letter-spacing: .04em;
	line-height: 1;
}

.ktc-status {
	color: var(--ktc-muted);
	font-size: .9rem;
	text-align: right;
}

.ktc-dot {
	display: inline-block;
	width: 9px;
	height: 9px;
	margin-right: 7px;
	border-radius: 50%;
	background: #aaa;
}

.ktc-running .ktc-dot {
	background: var(--ktc-pink);
	box-shadow: 0 0 0 5px rgba(233, 135, 154, .15);
}

.ktc-workspace {
	padding: 22px;
}

.ktc-instructions {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0 0 15px;
	color: var(--ktc-muted);
	line-height: 1.7;
}

.ktc-step {
	display: grid;
	flex: 0 0 26px;
	place-items: center;
	width: 26px;
	height: 26px;
	margin-top: 1px;
	border-radius: 50%;
	background: var(--ktc-pink);
	color: #fff;
	font-size: .85rem;
	font-weight: 800;
}

.ktc-label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
	color: #4f4a45;
	font-weight: 800;
}

.ktc-label small {
	color: var(--ktc-muted);
	font-size: .8rem;
	font-weight: 500;
}

.ktc-prompt-flags {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 9px;
}

.ktc-rare-badge {
	display: inline-flex;
	align-items: center;
	padding: 4px 10px;
	border: 1px solid #efbd57;
	border-radius: 999px;
	background: #fff5c7;
	box-shadow: 0 3px 10px rgba(181, 126, 23, .12);
	color: #8a5a00;
	font-size: .78rem;
	font-weight: 800;
	white-space: nowrap;
}

.ktc-rare-badge[hidden] {
	display: none !important;
}

.ktc-prompt {
	height: 260px;
	overflow: auto;
	padding: 18px;
	border: 1px solid var(--ktc-line);
	border-radius: 16px;
	background: #fffaf0;
	font-size: 1.02rem;
	line-height: 2;
	user-select: none;
	white-space: pre-wrap;
}

.ktc-rare-mode .ktc-prompt {
	border-color: #efc76f;
	background: linear-gradient(135deg, #fffbea, #fff3f6);
	box-shadow: inset 0 0 0 2px rgba(247, 215, 123, .22);
}

.ktc-input-label {
	margin-top: 19px;
}

.ktc-typing {
	display: block;
	width: 100%;
	height: 190px;
	min-height: 150px;
	margin: 0;
	padding: 18px;
	resize: vertical;
	border: 2px solid #c9beb0;
	border-radius: 16px;
	background: #fff;
	box-shadow: none;
	color: var(--ktc-ink);
	font-size: 1.02rem;
	line-height: 2;
	transition: border-color .2s, box-shadow .2s;
}

.ktc-typing:focus {
	border-color: var(--ktc-mint);
	box-shadow: 0 0 0 5px rgba(61, 129, 120, .1);
}

.ktc-typing:disabled {
	background: #f4f1eb;
	color: #999;
	cursor: not-allowed;
}

.ktc-live {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	margin-top: 14px;
}

.ktc-stat {
	padding: 11px 14px;
	border: 1px solid var(--ktc-line);
	border-radius: 14px;
	background: #fff;
	text-align: center;
}

.ktc-stat strong {
	display: block;
	color: var(--ktc-mint);
	font-size: 1.35rem;
	font-variant-numeric: tabular-nums;
}

.ktc-stat span,
.ktc-result-box span {
	color: var(--ktc-muted);
	font-size: .8rem;
}

.ktc-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin-top: 20px;
}

.ktc-btn {
	min-width: 150px;
	margin: 0;
	padding: 13px 25px;
	border: 0;
	border-radius: 999px;
	font-weight: 800;
	line-height: 1.5;
	cursor: pointer;
	transition: filter .15s, transform .15s;
}

.ktc-btn:hover {
	filter: brightness(.98);
	transform: translateY(-1px);
}

.ktc-btn-primary {
	background: var(--ktc-mint);
	box-shadow: 0 7px 16px rgba(61, 129, 120, .22);
	color: #fff;
}

.ktc-btn-secondary {
	border: 1px solid #b8ada0;
	background: #fff;
	color: #5f5952;
}

.ktc-btn:disabled {
	opacity: .45;
	cursor: not-allowed;
	transform: none;
}

.ktc-notice {
	min-height: 24px;
	margin: 10px 0 -4px;
	color: var(--ktc-danger);
	font-size: .9rem;
	font-weight: 700;
	text-align: center;
}

.ktc-results {
	padding: 24px;
	border-top: 1px solid var(--ktc-line);
	background: linear-gradient(135deg, #fff8f4, #f4fffc);
}

.ktc-results[hidden] {
	display: none !important;
}

.ktc-results h3 {
	margin: 0 0 5px;
	color: #2f625c;
	font-size: 1.5rem;
	text-align: center;
}

.ktc-result-note {
	margin: 0 0 18px;
	color: var(--ktc-muted);
	text-align: center;
}

.ktc-result-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
}

.ktc-result-box {
	padding: 16px 10px;
	border: 1px solid var(--ktc-line);
	border-radius: 16px;
	background: #fff;
	text-align: center;
}

.ktc-result-box strong {
	display: block;
	color: var(--ktc-mint);
	font-size: 1.7rem;
	font-variant-numeric: tabular-nums;
}

.ktc-answer {
	margin-top: 18px;
	padding: 18px;
	border: 2px dashed #e7b8c1;
	border-radius: 16px;
	background: #fff;
}

.ktc-answer h4 {
	margin: 0 0 8px;
	color: #8f4c59;
	font-size: 1rem;
}

.ktc-answer-text {
	margin: 0;
	line-height: 1.8;
}

.ktc-answer-actions {
	display: flex;
	justify-content: flex-end;
	margin-top: 12px;
}

.ktc-copy {
	margin: 0;
	padding: 9px 13px;
	border: 0;
	border-radius: 9px;
	background: var(--ktc-pink-soft);
	color: #914b59;
	font-weight: 800;
	cursor: pointer;
}

.ktc-footer {
	margin: 18px 0 0;
	color: var(--ktc-muted);
	font-size: .86rem;
	line-height: 1.7;
	text-align: center;
}

.ktc-footer a {
	color: var(--ktc-mint);
	font-weight: 800;
	text-decoration: underline;
	text-underline-offset: 3px;
}

@media (max-width: 680px) {
	.ktc-app {
		margin: 18px auto;
	}

	.ktc-header {
		align-items: flex-start;
	}

	.ktc-privacy {
		display: none;
	}

	.ktc-bear {
		flex-basis: 44px;
		width: 44px;
		height: 44px;
	}

	.ktc-bear img {
		width: 40px;
		height: 40px;
	}

	.ktc-topbar {
		grid-template-columns: 1fr 1fr;
		padding: 15px;
	}

	.ktc-timer {
		order: -1;
		grid-column: 1 / -1;
	}

	.ktc-status {
		text-align: right;
	}

	.ktc-workspace,
	.ktc-results {
		padding: 16px;
	}

	.ktc-prompt {
		height: 210px;
		padding: 14px;
	}

	.ktc-typing {
		height: 165px;
		padding: 14px;
	}

	.ktc-label {
		align-items: flex-start;
		flex-direction: column;
		gap: 2px;
	}

	.ktc-prompt-flags {
		align-items: flex-start;
		flex-direction: column;
		gap: 5px;
	}

	.ktc-result-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ktc-app * {
		scroll-behavior: auto !important;
		transition: none !important;
	}
}
