/*
 * token_demo.css
 * ワンタイムURL・共有リンクの安全な作り方｜体験デモ（推測できないURL／HMAC署名の改ざん検知）
 * 既存サイトのクラスと衝突しないよう tk- を接頭辞にしています。
 */

#tk-demo1,
#tk-demo2 {
	box-sizing: border-box;
	margin: 1.4rem 0;
	padding: 1rem 1.1rem 2.2rem;
	background: #f4f8fb;
	border-radius: 1rem;
	scroll-margin-top: 90px;
	content-visibility: auto;
	contain-intrinsic-size: 900px;
}

#tk-demo1 *,
#tk-demo1 *::before,
#tk-demo1 *::after,
#tk-demo2 *,
#tk-demo2 *::before,
#tk-demo2 *::after {
	box-sizing: border-box;
}

.tk-container {
	max-width: 780px;
	margin: 0 auto;
}

/* ---------- 見出しエリア ---------- */

.tk-head {
	text-align: center;
	padding-top: 1.6rem;
	margin-bottom: 1.4rem;
}

.tk-badge {
	display: inline-block;
	padding: .6rem 2rem;
	border-radius: 999px;
	background: #0175d8;
	color: #fff;
	font-size: 1.56rem;
	font-weight: 700;
	letter-spacing: .06em;
	margin-bottom: .6rem;
	position: relative;
	box-shadow: 0 0 0 0 rgba(1, 117, 216, .45);
	animation: tk-badge-pulse 2.2s ease-out infinite;
}

@keyframes tk-badge-pulse {
	0% { box-shadow: 0 0 0 0 rgba(1, 117, 216, .45); }
	70% { box-shadow: 0 0 0 .55rem rgba(1, 117, 216, 0); }
	100% { box-shadow: 0 0 0 0 rgba(1, 117, 216, 0); }
}

h3.tk-headline {
	display: block;
	background: none;
	margin: .7rem auto 0;
	max-width: 32rem;
	font-size: 1.28rem;
	font-weight: 800;
	line-height: 1.6;
	color: #12233f;
	letter-spacing: .01em;
}

.tk-headline__mark {
	color: #0175d8;
}

.tk-lead {
	font-size: .86rem;
	color: #555;
	line-height: 1.9;
	margin: .6rem auto 0;
	max-width: 34rem;
}

/* ---------- パネル ---------- */

.tk-panel {
	background: #fff;
	border-radius: 1rem;
	box-shadow: 0 .6rem 1.8rem rgba(0, 30, 70, .08);
	padding: 1.6rem 1.3rem 1.4rem;
}

.tk-btn {
	appearance: none;
	border: none;
	cursor: pointer;
	width: 100%;
	padding: .75rem 1rem;
	border-radius: 999px;
	font-size: .88rem;
	font-weight: 700;
	color: #fff;
	background: #0175d8;
	box-shadow: 0 .5rem 1.1rem rgba(1, 117, 216, .28);
	transition: opacity .15s ease, transform .15s ease;
}

.tk-btn:hover {
	opacity: .9;
	transform: translateY(-1px);
}

.tk-btn--danger {
	background: #d8322a;
	box-shadow: 0 .5rem 1.1rem rgba(216, 50, 42, .28);
}

.tk-btn--safe {
	background: #0c8a5f;
	box-shadow: 0 .5rem 1.1rem rgba(12, 138, 95, .28);
}

.tk-note {
	font-size: .82rem;
	line-height: 1.85;
	color: #0a4a8f;
	background: #eaf4ff;
	border-left: 3px solid #0175d8;
	border-radius: .4rem;
	padding: .7rem .9rem;
	margin: 1.2rem 0 0;
}

/* ---------- 連番ID vs ランダムトークン（demo1） ---------- */

.tk-compare-grid {
	width: 92%;
	margin: 0 auto;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
}

.tk-card {
	padding: 1rem 1rem 1.2rem;
	border-radius: .8rem;
	border: 1px solid #dfe6ec;
	background: #fbfcfe;
}

.tk-card--danger {
	border-color: #f1c9c6;
	background: #fff6f5;
}

.tk-card--safe {
	border-color: #bfe3d2;
	background: #f4fbf8;
}

.tk-card__label {
	font-size: .8rem;
	font-weight: 700;
	color: #333;
	margin-bottom: .7rem;
	text-align: center;
}

.tk-url-box {
	margin-top: .8rem;
	padding: .6rem .7rem;
	background: #fff;
	border: 1px dashed #d5dee7;
	border-radius: .5rem;
	font-size: .78rem;
	font-family: 'Courier New', monospace;
	color: #12233f;
	word-break: break-all;
	text-align: center;
}

.tk-card__note {
	font-size: .74rem;
	line-height: 1.7;
	color: #667;
	margin: .6rem 0 0;
	text-align: center;
}

.tk-history {
	list-style: none;
	margin: .8rem 0 0;
	padding: 0;
	display: grid;
	gap: .3rem;
}

.tk-history li {
	font-size: .72rem;
	font-family: 'Courier New', monospace;
	color: #8a94a3;
	word-break: break-all;
	text-align: center;
}

/* ---------- HMAC署名デモ（demo2） ---------- */

.tk-hmac-source {
	width: 92%;
	margin: 0 auto 1.2rem;
	background: #fbfcfe;
	border: 1px solid #dfe6ec;
	border-radius: .7rem;
	padding: .3rem 1rem;
}

.tk-hmac-row {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: .3rem .6rem;
	padding: .65rem 0;
	border-bottom: 1px dashed #e2e8ee;
	font-size: .82rem;
}

.tk-hmac-row:last-child {
	border-bottom: none;
}

.tk-hmac-row__label {
	color: #8a94a3;
	font-weight: 700;
}

.tk-hmac-row__value {
	color: #333;
	font-family: 'Courier New', monospace;
	word-break: break-all;
}

.tk-panel > .tk-btn {
	width: 92%;
	margin: 0 auto;
	display: block;
}

.tk-reveal__panel {
	display: none;
	width: 92%;
	margin: 1rem auto 0;
	padding: .8rem .9rem;
	background: #eaf4ff;
	border: 1px dashed #0175d8;
	border-radius: .6rem;
}

.tk-reveal__panel.is-visible {
	display: block;
}

.tk-reveal__label {
	font-size: .76rem;
	font-weight: 700;
	color: #0a4a8f;
	margin: 0 0 .4rem;
}

.tk-reveal__value {
	font-size: .8rem;
	font-weight: 700;
	color: #0a4a8f;
	font-family: 'Courier New', monospace;
	word-break: break-all;
	margin: 0;
}

.tk-tamper-row {
	display: none;
	width: 92%;
	margin: 1.2rem auto 0;
}

.tk-tamper-row.is-visible {
	display: block;
}

.tk-tamper-label {
	display: block;
	font-size: .82rem;
	font-weight: 700;
	color: #333;
	margin-bottom: .5rem;
}

.tk-tamper-row input[type="text"] {
	width: 100%;
	padding: .65rem .75rem;
	border: 1px solid #d5dee7;
	border-radius: .5rem;
	font-size: .9rem;
	background: #fbfcfe;
	color: #222;
	font-family: 'Courier New', monospace;
	margin-bottom: .8rem;
}

.tk-tamper-row input[type="text"]:focus {
	outline: none;
	border-color: #0175d8;
	background: #fff;
}

.tk-verdict {
	display: none;
	margin-top: 1rem;
	padding: .9rem 1rem;
	border-radius: .7rem;
	font-size: .84rem;
	line-height: 1.9;
	text-align: center;
}

.tk-verdict.is-visible {
	display: block;
}

.tk-verdict.is-ok {
	background: #eafaf3;
	color: #0c6b48;
	border: 1px solid #bfe3d2;
}

.tk-verdict.is-ng {
	background: #fff3f2;
	color: #b7392f;
	border: 1px solid #f1c9c6;
}

/* ---------- 猫マスコットのギミック ---------- */

.tk-cat-row {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 1.2rem;
}

.tk-clerk {
	width: 2.6rem;
	flex-shrink: 0;
	filter: drop-shadow(0 .2rem .3rem rgba(0, 30, 70, .15));
	transform-origin: 50% 100%;
}

.tk-clerk svg {
	width: 100%;
	height: auto;
	display: block;
}

.tk-clerk.is-found {
	animation: tk-clerk-nod .4s ease;
}

.tk-clerk.is-alert {
	animation: tk-clerk-shake .5s ease;
}

@keyframes tk-clerk-nod {
	0% { transform: translateY(0); }
	45% { transform: translateY(.3rem); }
	100% { transform: translateY(0); }
}

@keyframes tk-clerk-shake {
	0% { transform: scale(1) rotate(0); }
	20% { transform: scale(1.14) rotate(-6deg); }
	40% { transform: scale(1.14) rotate(6deg); }
	60% { transform: scale(1.14) rotate(-4deg); }
	80% { transform: scale(1.14) rotate(4deg); }
	100% { transform: scale(1) rotate(0); }
}

/* ---------- 常時ループするアニメーションを抑える ---------- */

@media (prefers-reduced-motion: reduce) {

	.tk-badge {
		animation: none;
	}

}

/* ---------- レスポンシブ ---------- */

@media screen and (max-width: 640px) {

	#tk-demo1,
	#tk-demo2 {
		padding: 1rem .8rem 1.8rem;
		border-radius: .7rem;
	}

	.tk-panel {
		padding: 1.1rem .9rem 1rem;
		border-radius: .7rem;
	}

	.tk-compare-grid {
		grid-template-columns: 1fr;
	}

	.tk-hmac-source,
	.tk-reveal__panel,
	.tk-tamper-row,
	.tk-panel > .tk-btn {
		width: 100%;
	}

	.tk-badge {
		padding: .45rem 1.2rem;
		font-size: 1.1rem;
		white-space: normal;
		text-align: center;
	}

}
