/*
 * xss_demo.css
 * XSS対策の基本｜体験デモ（エスケープなし vs エスケープあり）
 * 「エスケープなし」側は sandbox="allow-scripts" のiframe内でのみ描画し、
 * 親ページのCookie・セッションには一切アクセスできない状態で見せる。
 * 既存サイトのクラスと衝突しないよう xss- を接頭辞にしています。
 */

#xss-demo {
	box-sizing: border-box;
	margin: 1.4rem 0;
	padding: 1rem 1.1rem 2.2rem;
	background: #f6f4fb;
	border-radius: 1rem;
	scroll-margin-top: 90px;
}

#xss-demo *,
#xss-demo *::before,
#xss-demo *::after {
	box-sizing: border-box;
}

.xss-container {
	max-width: 680px;
	margin: 0 auto;
}

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

.xss-badge {
	display: inline-block;
	padding: .6rem 2rem;
	border-radius: 999px;
	background: #7b5fe0;
	color: #fff;
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: .06em;
	margin-bottom: .6rem;
	box-shadow: 0 0 0 0 rgba(123, 95, 224, .45);
	animation: xss-badge-pulse 2.2s ease-out infinite;
}

@keyframes xss-badge-pulse {
	0% { box-shadow: 0 0 0 0 rgba(123, 95, 224, .45); }
	70% { box-shadow: 0 0 0 .55rem rgba(123, 95, 224, 0); }
	100% { box-shadow: 0 0 0 0 rgba(123, 95, 224, 0); }
}

h3.xss-headline {
	display: block;
	background: none;
	margin: .7rem auto 0;
	max-width: 32rem;
	font-size: 1.24rem;
	font-weight: 800;
	line-height: 1.6;
	color: #12233f;
}

.xss-headline__mark {
	color: #7b5fe0;
}

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

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

.xss-input-row textarea {
	width: 100%;
	min-height: 4.4rem;
	appearance: none;
	border: .1rem solid #d5cdf0;
	border-radius: .6rem;
	padding: .6rem .7rem;
	font-size: .84rem;
	font-family: 'Courier New', monospace;
	resize: vertical;
}

.xss-quickfill {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
	margin: .6rem 0 1.1rem;
}

.xss-quickfill button {
	appearance: none;
	border: .08rem dashed #7b5fe0;
	background: #f6f2ff;
	color: #5a3fc0;
	padding: .35rem .7rem;
	border-radius: 999px;
	font-size: .7rem;
	font-weight: 700;
	cursor: pointer;
}

.xss-quickfill button:hover {
	background: #ece2ff;
}

.xss-compare {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: .8rem;
	margin-bottom: 1rem;
}

.xss-card {
	border-radius: .8rem;
	overflow: hidden;
	border: .1rem solid #e3ddf5;
}

.xss-card__label {
	padding: .5rem .7rem;
	font-size: .74rem;
	font-weight: 800;
	text-align: center;
}

.xss-card--danger .xss-card__label {
	background: #fff1f1;
	color: #a1352e;
}

.xss-card--safe .xss-card__label {
	background: #f2fbf4;
	color: #0d7a33;
}

.xss-card__body {
	min-height: 5.2rem;
	padding: .5rem;
	background: #fafafd;
	display: flex;
	align-items: center;
	justify-content: center;
}

.xss-card__body iframe {
	width: 100%;
	min-height: 4.4rem;
	border: none;
	background: #fff;
}

.xss-safe-render {
	width: 100%;
	min-height: 4.4rem;
	background: #fff;
	border-radius: .4rem;
	padding: .5rem .6rem;
	font-size: .84rem;
	line-height: 1.7;
	word-break: break-word;
	white-space: pre-wrap;
}

.xss-escaped-source-label {
	font-size: .68rem;
	font-weight: 700;
	color: #667;
	margin-bottom: .3rem;
}

.xss-escaped-source {
	background: #12233f;
	color: #d7e6ff;
	border-radius: .6rem;
	padding: .7rem .85rem;
	font-family: 'Courier New', monospace;
	font-size: .76rem;
	line-height: 1.7;
	white-space: pre-wrap;
	word-break: break-all;
	margin-bottom: 1rem;
}

.xss-reset-btn {
	appearance: none;
	border: none;
	cursor: pointer;
	display: block;
	margin: 0 auto;
	padding: .5rem 1.2rem;
	border-radius: 999px;
	background: #eef2f5;
	color: #667;
	font-size: .78rem;
	font-weight: 700;
}

.xss-reset-btn:hover {
	background: #e2e8ed;
}

@media screen and (max-width: 640px) {
	#xss-demo { padding: 1rem .8rem 1.8rem; border-radius: .7rem; }
	.xss-panel { padding: 1.1rem .9rem 1rem; border-radius: .7rem; }
	.xss-compare { grid-template-columns: 1fr; }
	.xss-badge { padding: .45rem 1.2rem; font-size: 1.05rem; white-space: normal; text-align: center; }
}
