/* FAKE SCANNER — 画面別スタイルと演出 */

main {
	width: 100%;
	max-width: 1280px;
	margin: 0 auto;
	padding: 16px var(--gutter) 64px;
}

.screen {
	display: grid;
	grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
	gap: clamp(28px, 5vw, 72px);
	align-items: center;
}
.screen[hidden] {
	display: none;
}

/* ---------- 照準フレーム（3画面共通） ---------- */
.frame {
	--corner: var(--blue);
	position: relative;
	aspect-ratio: 4 / 5;
	width: 100%;
	background:
		linear-gradient(135deg, rgba(63, 210, 255, 0.06), transparent 60%),
		var(--panel);
	border: 1px solid rgba(63, 210, 255, 0.28);
}
.frame > .media {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
}
.corner {
	position: absolute;
	width: 28px;
	height: 28px;
	border: 2px solid var(--corner);
	pointer-events: none;
	z-index: 2;
}
.corner--tl {
	top: -8px;
	left: -8px;
	border-right: 0;
	border-bottom: 0;
}
.corner--tr {
	top: -8px;
	right: -8px;
	border-left: 0;
	border-bottom: 0;
}
.corner--bl {
	bottom: -8px;
	left: -8px;
	border-right: 0;
	border-top: 0;
}
.corner--br {
	bottom: -8px;
	right: -8px;
	border-left: 0;
	border-top: 0;
}

/* 再生できない動画の代替パネル */
.media--fallback {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 24px;
	text-align: center;
	background:
		repeating-linear-gradient(
			45deg,
			rgba(63, 210, 255, 0.06) 0 2px,
			transparent 2px 12px
		),
		#070a0f;
}
.media__icon {
	width: 56px;
	height: 40px;
	border: 2px solid var(--blue);
	position: relative;
	margin-bottom: 8px;
}
.media__icon::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-35%, -50%);
	border-style: solid;
	border-width: 9px 0 9px 15px;
	border-color: transparent transparent transparent var(--blue);
}
.media__name {
	font-family: var(--font-display);
	font-size: 14px;
	letter-spacing: 0.06em;
	word-break: break-all;
	max-width: 100%;
}
.media__note {
	color: var(--muted);
	font-size: 13px;
}

/* ---------- 1. トップ ---------- */
.hero {
	display: grid;
	gap: 20px;
	align-content: center;
}
.hero__title {
	font-size: clamp(36px, 5.6vw, 72px);
	line-height: 1.45;
	font-weight: 700;
	letter-spacing: 0.02em;
}
.hero__lead {
	color: var(--text);
	max-width: 34em;
}
.hero__lead strong {
	color: var(--red);
}
.facts {
	list-style: none;
	padding: 0;
	display: grid;
	gap: 6px;
	font-size: 14px;
	color: var(--muted);
}
.facts li {
	padding-left: 20px;
	position: relative;
}
.facts li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.7em;
	width: 10px;
	height: 2px;
	background: var(--blue);
}

.uploader {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 16px;
	width: 100%;
	max-width: 460px;
	justify-self: end;
}
.dropzone {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 10px;
}
.frame--upload {
	display: grid;
	place-items: center;
	transition:
		border-color 200ms var(--ease),
		box-shadow 200ms var(--ease);
}
.dropzone.is-dragover .frame--upload {
	border-color: var(--blue);
	box-shadow:
		0 0 48px rgba(63, 210, 255, 0.35) inset,
		0 0 32px rgba(63, 210, 255, 0.25);
}
.dropzone__empty {
	display: grid;
	justify-items: center;
	gap: 8px;
	padding: 24px;
	text-align: center;
}
body:not([data-state="idle"]) .dropzone__empty {
	display: none;
}
.dropzone__icon {
	width: 52px;
	height: 52px;
	border: 2px solid var(--blue);
	position: relative;
	margin-bottom: 8px;
	box-shadow: 0 0 20px rgba(63, 210, 255, 0.35);
}
.dropzone__icon::before,
.dropzone__icon::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	background: var(--blue);
	transform: translate(-50%, -50%);
}
.dropzone__icon::before {
	width: 22px;
	height: 2px;
}
.dropzone__icon::after {
	width: 2px;
	height: 22px;
}
.dropzone__title {
	font-weight: 700;
}
.dropzone__hint {
	color: var(--muted);
	font-size: 13px;
	line-height: 1.6;
}
.file-meta {
	font-family: var(--font-display);
	font-size: 13px;
	letter-spacing: 0.04em;
	color: var(--muted);
	overflow-wrap: anywhere;
}
.error {
	border-left: 3px solid var(--red);
	background: rgba(255, 45, 74, 0.1);
	color: #ffb3bf;
	padding: 10px 14px;
	font-size: 14px;
}
.uploader__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}
body[data-state="loading"] [data-start]::after {
	content: "…";
}

/* ---------- 2. 解析演出 ---------- */
.frame--scan {
	overflow: hidden;
	max-width: 460px;
}
.frame--scan::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background:
		repeating-linear-gradient(
			0deg,
			rgba(63, 210, 255, 0.1) 0 1px,
			transparent 1px 4px
		),
		linear-gradient(90deg, rgba(63, 210, 255, 0.12) 1px, transparent 1px) 0 0 /
		12.5% 100%;
	mix-blend-mode: screen;
	pointer-events: none;
}
.scanline {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 3px;
	z-index: 2;
	background: var(--blue);
	box-shadow: 0 0 18px 6px rgba(63, 210, 255, 0.55);
	animation: scan 1.2s linear infinite alternate;
}
@keyframes scan {
	from {
		top: 0;
	}
	to {
		top: calc(100% - 3px);
	}
}

.scan-panel {
	display: grid;
	gap: 14px;
	align-content: center;
}
.scan-panel__status {
	font-size: clamp(26px, 3.4vw, 40px);
	font-weight: 700;
	line-height: 1.3;
}
.scan-panel__code {
	font-family: var(--font-display);
	font-size: 14px;
	letter-spacing: 0.3em;
	color: var(--blue);
	text-shadow: 0 0 12px rgba(63, 210, 255, 0.6);
}
.progress {
	height: 8px;
	background: rgba(63, 210, 255, 0.12);
	border: 1px solid var(--blue-dim);
	overflow: hidden;
}
.progress__bar {
	display: block;
	height: 100%;
	width: var(--progress, 0%);
	background: var(--blue);
	box-shadow: 0 0 16px var(--blue);
	transition: width 560ms linear;
}
.stages {
	list-style: none;
	padding: 0;
	display: grid;
	gap: 4px;
	font-size: 14px;
	color: var(--muted);
}
.stages li {
	padding-left: 22px;
	position: relative;
}
.stages li::before {
	content: "";
	position: absolute;
	left: 2px;
	top: 0.55em;
	width: 8px;
	height: 8px;
	border: 1px solid var(--blue-dim);
}
.stages li.is-current {
	color: var(--text);
}
.stages li.is-current::before {
	border-color: var(--blue);
	animation: blink 0.5s steps(2) infinite;
}
.stages li.is-done::before {
	background: var(--blue);
	border-color: var(--blue);
}
@keyframes blink {
	50% {
		background: var(--blue);
	}
}
.demo-note {
	margin-top: 6px;
	border-left: 3px solid var(--caution);
	background: rgba(255, 210, 63, 0.08);
	padding: 10px 14px;
	font-size: 14px;
	font-weight: 700;
	color: var(--caution);
}

/* ---------- 3. 判定結果 ---------- */
.screen--result {
	grid-template-columns: minmax(0, 1fr);
	gap: 28px;
}
.result-card {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
	gap: clamp(24px, 4vw, 64px);
	align-items: center;
	padding: clamp(20px, 3vw, 36px);
	border: 1px solid rgba(255, 45, 74, 0.35);
	background:
		radial-gradient(
			ellipse 70% 80% at 100% 0%,
			rgba(255, 45, 74, 0.14),
			transparent 70%
		),
		rgba(8, 10, 14, 0.82);
	position: relative;
	overflow: hidden;
}
.result-card::before {
	/* 出現時の赤いフラッシュ */
	content: "";
	position: absolute;
	inset: 0;
	background: var(--red);
	opacity: 0;
	pointer-events: none;
	animation: flash 700ms var(--ease) both;
}
@keyframes flash {
	0% {
		opacity: 0.55;
	}
	100% {
		opacity: 0;
	}
}
.frame--result {
	--corner: var(--red);
	border-color: rgba(255, 45, 74, 0.5);
	box-shadow: 0 0 60px rgba(255, 45, 74, 0.22) inset;
}
.frame--result::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: repeating-linear-gradient(
		0deg,
		rgba(255, 45, 74, 0.14) 0 2px,
		transparent 2px 5px
	);
	mix-blend-mode: screen;
	pointer-events: none;
}
.frame__stamp {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 3;
	padding: 6px 10px;
	background: var(--caution);
	color: #111;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	text-align: center;
}

.verdict {
	display: grid;
	gap: 14px;
}
.verdict__title {
	font-family: var(--font-display);
	font-weight: 800;
	font-size: clamp(48px, 7vw, 100px);
	line-height: 0.9;
	letter-spacing: 0.01em;
	color: var(--red);
	text-shadow:
		0 0 24px rgba(255, 45, 74, 0.6),
		0 0 80px rgba(255, 45, 74, 0.35);
	outline: none;
}
.verdict__title span {
	display: block;
	animation: slam 600ms var(--ease) both;
}
.verdict__title span + span {
	animation-delay: 140ms;
}
@keyframes slam {
	0% {
		opacity: 0;
		transform: translateX(-24px) skewX(-12deg);
		filter: blur(6px);
	}
	60% {
		opacity: 1;
		filter: blur(0);
	}
	100% {
		opacity: 1;
		transform: none;
	}
}
.verdict__ja {
	font-size: clamp(20px, 2.4vw, 28px);
	font-weight: 700;
}
.verdict__ja strong {
	color: var(--red);
}
.verdict__note {
	border-left: 3px solid var(--caution);
	background: rgba(255, 210, 63, 0.08);
	padding: 12px 16px;
	font-size: 14px;
	line-height: 1.7;
	color: var(--text);
}
.verdict__brand {
	font-family: var(--font-display);
	font-size: 12px;
	letter-spacing: 0.2em;
	color: var(--muted);
}
.verdict > *:not(.verdict__title) {
	animation: rise 500ms var(--ease) 320ms both;
}
@keyframes rise {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}
.result-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 800px) {
	.screen {
		grid-template-columns: minmax(0, 1fr);
		gap: 28px;
	}
	.uploader {
		max-width: none;
		justify-self: stretch;
	}
	.frame--upload {
		aspect-ratio: 4 / 3;
	}
	/* スマホ: 見出しの直後にアップロード欄を出し、操作の入口を最初の画面に収める */
	.screen--upload {
		gap: 20px;
	}
	.screen--upload .hero {
		display: contents;
	}
	.screen--upload .uploader {
		order: 1;
	}
	.screen--upload .hero__lead,
	.screen--upload .facts {
		order: 2;
	}
	body[data-state="idle"] .frame--upload {
		aspect-ratio: 2 / 1;
	}
	.dropzone__empty {
		padding: 12px;
	}
	.dropzone__icon {
		width: 40px;
		height: 40px;
		margin-bottom: 0;
	}
	.frame--scan {
		max-width: none;
		aspect-ratio: 4 / 3;
	}
	.result-card {
		grid-template-columns: minmax(0, 1fr);
	}
	.frame--result {
		aspect-ratio: 4 / 3;
	}
	.result-actions .btn {
		flex: 1 1 100%;
	}
}

@media (max-width: 420px) {
	.tag {
		display: none;
	}
	.logo {
		font-size: 16px;
		letter-spacing: 0.12em;
	}
	.hero__title {
		font-size: 34px;
	}
}

/* 動きを減らす設定: 激しい動きは止め、ステータスとプログレスは残す */
@media (prefers-reduced-motion: reduce) {
	.scanline,
	.result-card::before,
	.stages li.is-current::before {
		animation: none;
	}
	.scanline {
		top: 50%;
		opacity: 0.5;
	}
	.verdict__title span,
	.verdict > *:not(.verdict__title) {
		animation: none;
	}
	.progress__bar {
		transition: none;
	}
}
