:root {
	--green-900: #04210f;
	--green-800: #0b3d24;
	--green-600: #15724a;
	--silver: #e8ecea;
	--silver-dim: rgba(232, 236, 234, .72);
	--gold: #c78a4d;
	--ok: #1f9d55;
	--bad: #d64545;
	--ink: #17201b;
	--ink-dim: #5b6660;
	--card: #ffffff;
	--line: #e3e8e5;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: var(--silver);
	background: var(--green-900);
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- page ---------- */
.page {
	position: relative;
	min-height: 100vh;
	min-height: 100svh;
	display: flex;
	flex-direction: column;
	align-items: center;
	overflow: hidden;
	background:
		radial-gradient(ellipse at 50% 38%, rgba(31, 140, 92, .35), transparent 60%),
		var(--bg) center / cover no-repeat,
		linear-gradient(100deg, #05250f, #13654a);
	padding: max(16px, env(safe-area-inset-top)) 16px 0;
}
.glow {
	position: absolute; inset: auto 0 0 0; height: 45%;
	background: linear-gradient(to top, rgba(2, 20, 10, .75), transparent);
	pointer-events: none;
}
/* Large soft bars behind everything, like a watermark. */
.ghost {
	position: absolute; left: 50%; top: 56%; width: min(1500px, 130vw);
	transform: translate(-50%, -50%); opacity: .2;
	filter: blur(3px) saturate(.6);
	pointer-events: none; user-select: none;
}

.hero {
	position: relative; z-index: 2;
	width: 100%; max-width: 520px;
	display: flex; flex-direction: column; align-items: center;
	padding: clamp(72px, 19vh, 210px) 0 40px;
	gap: 44px;
}
.logo-link { display: block; }
.logo {
	width: clamp(210px, 22vw, 330px); height: auto;
	filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .35));
}

/* ---------- search ---------- */
.search {
	width: 100%;
	display: flex; align-items: center; gap: 8px;
	padding: 8px;
	border: 2px solid rgba(255, 255, 255, .75);
	border-radius: 999px;
	background: rgba(255, 255, 255, .06);
	backdrop-filter: blur(4px);
	box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
	transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .15), 0 10px 40px rgba(0, 0, 0, .25); }
.search.shake { animation: shake .4s; }
.search input {
	flex: 1; min-width: 0;
	height: 54px; padding: 0 22px;
	border: 0; border-radius: 999px; outline: 0;
	background: #fff; color: var(--ink);
	font: 500 17px/1 Inter, system-ui, sans-serif; letter-spacing: .04em;
	text-transform: uppercase;
}
.search input::placeholder { color: #8a948f; text-transform: none; letter-spacing: 0; }
.search button {
	position: relative;
	flex: 0 0 auto; width: 64px; height: 54px;
	border: 0; border-radius: 999px; cursor: pointer;
	background: linear-gradient(180deg, #d9dedb, #9aa49f);
	color: #fff;
	display: grid; place-items: center;
	transition: transform .15s, filter .15s;
}
.search button:hover { filter: brightness(1.08); }
.search button:active { transform: scale(.96); }
.search button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.search .ico { width: 26px; height: 26px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.search .spin {
	display: none; width: 24px; height: 24px; border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, .45); border-top-color: #fff;
	animation: spin .8s linear infinite;
}
.search.loading .ico { display: none; }
.search.loading .spin { display: block; }
.search.loading button { cursor: wait; }

/* ---------- bars: sit on the bottom edge, lower part cut off like a display tray ---------- */
.bars-wrap {
	position: relative; z-index: 1;
	width: min(640px, 100%);
	margin-top: auto;
	aspect-ratio: 1600 / 560;
	overflow: hidden;
	pointer-events: none; user-select: none;
}
.bars {
	width: 100%; height: auto;
	filter: drop-shadow(0 -6px 30px rgba(0, 0, 0, .35));
}

/* ---------- dialog ---------- */
.overlay {
	position: fixed; inset: 0; z-index: 50;
	display: flex; align-items: center; justify-content: center;
	padding: 16px;
	background: rgba(2, 14, 7, .66);
	backdrop-filter: blur(6px);
	animation: fade .2s ease-out;
	overflow-y: auto;
}
.overlay[hidden] { display: none; }
/* Both result cards are dark green; the failed one adds a red tint. */
.modal {
	position: relative;
	width: 100%; max-width: 400px;
	margin: auto;
	background:
		radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .06), transparent 55%),
		linear-gradient(180deg, #0d3b26, #072417);
	color: var(--silver);
	border: 1px solid rgba(255, 255, 255, .12);
	border-radius: 22px;
	padding: 26px 24px 22px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
	text-align: center;
	animation: pop .25s cubic-bezier(.2, .9, .3, 1.2);
	outline: 0;
}
.close {
	position: absolute; top: 12px; right: 12px;
	width: 38px; height: 38px; border-radius: 50%;
	background: transparent; color: #e9eeeb;
	border: 1.5px solid rgba(255, 255, 255, .45);
	font-size: 24px; line-height: 1; cursor: pointer;
}
.close:hover { background: rgba(255, 255, 255, .1); }
.close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.state h2 {
	margin: 0 0 4px;
	font: 600 23px/1.2 Cinzel, Georgia, serif; letter-spacing: .02em;
}

/* ---------- verified result ---------- */
.card-logo { width: 116px; height: auto; margin: 0 auto 18px; }
.ok h2 { font: 400 26px/1.2 Marcellus, Georgia, serif; letter-spacing: .01em; color: #eef2f0; }
.ok-sub { margin: 0 0 16px; font: 400 15px Marcellus, Georgia, serif; letter-spacing: .02em; color: #cfd8d3; }

.lines { margin: 0 0 18px; text-align: left; }
.lines > div { display: flex; align-items: flex-end; gap: 12px; padding-top: 8px; }
.lines dt { flex: 0 0 34%; padding-bottom: 5px; font-size: 14.5px; font-weight: 500; color: #e3e9e6; }
.lines dd {
	flex: 1; min-width: 0; margin: 0; padding: 0 2px 5px;
	border-bottom: 1.5px solid rgba(232, 236, 234, .55);
	font-size: 14.5px; font-weight: 600; color: #fff; overflow-wrap: break-word;
}
.lines dd[data-f="serial"] { letter-spacing: .06em; }

/* Verified card is a portrait rectangle like a certificate. */
.modal:not(.is-fail) { max-width: 350px; padding: 28px 24px 18px; }
.ok .card-logo { width: 132px; margin-bottom: 24px; }
.ok-sub { margin-bottom: 20px; }
.ok .lines { margin-bottom: 16px; }
.ok .lines > div { padding-top: 14px; }

.ok-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.ok-foot .btn-dl { width: auto; flex: 0 0 auto; height: 34px; padding: 0 12px; margin-bottom: 18px; font-size: 13px; border-radius: 9px; gap: 5px; }
.ok-foot .btn-dl svg { width: 15px; height: 15px; }
.seal {
	flex: 0 1 auto; min-width: 0; width: 140px; height: auto; margin: 0;
	filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .45));
	animation: pop .5s .05s both;
}

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	width: 100%; height: 46px; border: 0; border-radius: 12px; cursor: pointer;
	background: linear-gradient(180deg, var(--green-600), var(--green-800));
	color: #fff; font: 600 15px Inter, system-ui, sans-serif;
	transition: filter .15s, transform .15s;
}
.btn svg { width: 20px; height: 20px; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn-ghost { background: #f1f4f2; color: var(--ink); }

/* ---------- failed result (dark card) ---------- */
.modal.is-fail {
	background:
		radial-gradient(ellipse at 50% 0%, rgba(214, 69, 69, .12), transparent 55%),
		linear-gradient(180deg, #0b2a1b, #06180f);
	border-color: rgba(255, 255, 255, .08);
}
.modal.is-fail .close { border-color: rgba(214, 69, 69, .55); }
.modal.is-fail { max-width: 350px; padding: 28px 24px 22px; }
.modal.is-fail .close:hover { background: rgba(214, 69, 69, .15); }
.fail-logo { width: 116px; height: auto; margin: 0 auto; }
.x-mark { width: 56px; height: 56px; margin: 20px auto 18px; filter: drop-shadow(0 0 12px rgba(239, 68, 68, .55)); }
.x-mark svg { width: 100%; height: 100%; fill: none; stroke: #ef4444; stroke-linecap: round; }
.x-mark circle { stroke-width: 2.5; fill: rgba(239, 68, 68, .08); animation: pop .35s both; }
.x-mark path { stroke-width: 3.6; }
.fail h2 { margin: 0 0 6px; color: #f05252; font-size: 22px; text-shadow: 0 0 18px rgba(240, 82, 82, .25); }
.sub { margin: 0 0 20px; font-size: 14px; color: #cfd8d3; letter-spacing: .02em; }

.fail-serial {
	display: flex; align-items: center; justify-content: center; gap: 10px;
	margin: 0 0 16px; padding: 10px 14px;
	border: 1px solid rgba(214, 69, 69, .45); border-radius: 12px;
	background: rgba(214, 69, 69, .08);
}
.fail-serial[hidden] { display: none; }
.fail-serial span { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #cfd8d3; }
.fail-serial b { font-size: 17px; letter-spacing: .06em; color: #f6b4b4; word-break: break-all; }

.warn-box {
	margin: 0 0 20px; padding: 12px 14px;
	font-size: 13.5px; line-height: 1.55; color: #ead7d7;
	background: rgba(60, 20, 18, .55);
	border: 1px solid rgba(214, 69, 69, .45); border-radius: 14px;
}
.warn-box b { color: #f87171; }

.btn-silver {
	background: linear-gradient(100deg, #f4f6f5 0%, #d9dedb 45%, #aab3ae 75%, #e6eae8 100%);
	color: #1b2420; height: 46px; border-radius: 12px; font-size: 15px;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 6px 18px rgba(0, 0, 0, .35);
}
.btn-silver:focus-visible { outline-color: #fff; }
.support {
	display: inline-block; margin-top: 12px;
	color: #e9eeeb; font-size: 14px; text-underline-offset: 4px;
}
.support:hover { color: #fff; }

/* ---------- inline input error ---------- */
.field-error {
	margin: -30px 0 0; padding: 7px 14px;
	font-size: 13.5px; font-weight: 500; color: #fff;
	background: rgba(214, 69, 69, .85); border-radius: 999px;
	animation: fade .2s;
}
.field-error[hidden] { display: none; }
.search.invalid { border-color: #f87171; }

body.modal-open { overflow: hidden; }

/* ---------- animation ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.92); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- small screens ---------- */
@media (max-width: 560px) {
	/* Phone: like PSL — big logo a quarter down, narrower search with side space, smaller bar row. */
	.hero { padding-top: 22vh; gap: 40px; }
	.logo { width: min(62vw, 250px); }
	.search { width: 86%; padding: 6px; }
	.search input { height: 50px; padding: 0 16px; font-size: 16px; } /* 16px stops iOS zooming in */
	.search button { width: 54px; height: 50px; }
	.field-error { margin-top: -22px; }
	.bars-wrap { width: 80vw; }
	.ghost { width: 210vw; top: 56%; }
	.modal { padding: 24px 18px 18px; border-radius: 18px; }
	.state h2 { font-size: 20px; }
	.ok h2 { font-size: 22px; }
	.card-logo, .fail-logo { width: 104px; }
	.card-logo { margin-bottom: 14px; }
	.x-mark { margin: 16px auto 14px; }
	.lines dt, .lines dd { font-size: 14px; }
	.seal { width: 128px; }
	.modal:not(.is-fail) { max-width: 330px; padding: 26px 20px 16px; }
	.modal.is-fail { max-width: 330px; padding: 26px 20px 18px; }
	.ok .card-logo { width: 116px; margin-bottom: 18px; }
	.warn-box { font-size: 13px; padding: 12px; }
}
@media (max-height: 700px) and (min-width: 561px) {
	.hero { padding-top: 7vh; gap: 30px; }
	.bars-wrap { width: min(520px, 100%); }
}
