:root {
	--wine: #7a1f2b;
	--wine-deep: #54141d;
	--navy: #1d2740;
	--gold: #c6a046;
	--gold-bright: #e8c96a;
	--gold-soft: #f3e4b4;
	--cream: #f6f0e4;
	--paper: #fffdf8;
	--ink: #231c16;
	--muted: #6d6458;
	--line: rgba(198, 160, 70, 0.28);
	--shadow: 0 22px 50px rgba(84, 20, 29, 0.12);
	--radius: 22px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

::selection {
	background: rgba(198, 160, 70, 0.28);
	color: var(--wine-deep);
}

body.cert-app {
	margin: 0;
	min-height: 100vh;
	color: var(--ink);
	overflow-x: hidden;
	font-family: "Sarabun", "Segoe UI", Tahoma, sans-serif;
	background:
		radial-gradient(1200px 500px at 10% -10%, rgba(232, 201, 106, 0.28), transparent 55%),
		radial-gradient(900px 420px at 100% 0%, rgba(122, 31, 43, 0.16), transparent 50%),
		linear-gradient(180deg, #fbf6ec 0%, var(--cream) 48%, #efe6d4 100%);
}

body.cert-app::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	background-image:
		linear-gradient(rgba(198, 160, 70, 0.05) 1px, transparent 1px),
		linear-gradient(90deg, rgba(198, 160, 70, 0.05) 1px, transparent 1px);
	background-size: 28px 28px;
	mask-image: linear-gradient(180deg, rgba(0,0,0,.55), transparent 80%);
}

.cert-wrap {
	position: relative;
	z-index: 1;
	width: min(1080px, 100%);
	margin: 0 auto;
	padding-inline: 16px;
}

.cert-top {
	padding: 18px 0 8px;
}

.cert-top-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.cert-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
	color: inherit;
	text-decoration: none;
}

.cert-brand img {
	width: 52px;
	height: 52px;
	object-fit: contain;
	filter: drop-shadow(0 6px 10px rgba(122, 31, 43, 0.18));
}

.cert-brand-text strong {
	display: block;
	font-family: "Noto Serif Thai", "Sarabun", serif;
	font-size: 1.05rem;
	line-height: 1.25;
}

.cert-brand-text span {
	display: block;
	color: var(--muted);
	font-size: 0.88rem;
}

.cert-top-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	border-radius: 999px;
	color: var(--wine);
	background: rgba(255, 253, 248, 0.72);
	border: 1px solid var(--line);
	text-decoration: none;
	font-weight: 600;
	transition: transform .18s ease, box-shadow .18s ease;
}

.cert-top-link:hover {
	transform: translateY(-1px);
	box-shadow: 0 8px 18px rgba(122, 31, 43, 0.1);
}

.cert-hero {
	padding: 14px 0 4px;
	text-align: center;
}

.cert-hero.is-compact .cert-kicker,
.cert-hero.is-compact p:not(.cert-stats) {
	display: none;
}

.cert-kicker {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
	padding: 4px 12px;
	border-radius: 999px;
	background: rgba(122, 31, 43, 0.08);
	color: var(--wine);
	font-weight: 700;
	letter-spacing: 0.04em;
	font-size: 0.8rem;
}

.cert-hero h1 {
	margin: 0 0 4px;
	font-family: "Noto Serif Thai", "Sarabun", serif;
	font-size: clamp(1.15rem, 2.4vw, 1.55rem);
	line-height: 1.35;
	color: var(--wine-deep);
	max-width: 100%;
}

.cert-hero p {
	margin: 0 auto;
	max-width: min(640px, 100%);
	color: var(--muted);
	font-size: 0.95rem;
}

.cert-stats {
	display: block;
	margin: 8px auto 0;
	max-width: none;
	color: var(--ink);
	font-size: 0.98rem;
}

.cert-stats b {
	color: var(--wine);
	font-family: "Noto Serif Thai", serif;
	font-weight: 700;
}

.cert-stats-sep {
	margin: 0 6px;
	color: var(--muted);
}

.cert-panel {
	margin: 12px 0 40px;
	padding: 18px 20px;
	background: var(--paper);
	border: 1px solid rgba(198, 160, 70, 0.22);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

.cert-search {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 10px;
}

.cert-search label {
	display: block;
	margin-bottom: 8px;
	font-weight: 700;
	color: var(--navy);
}

.cert-field {
	position: relative;
}

.cert-field i {
	position: absolute;
	left: 16px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--gold);
}

.cert-panel.is-compact .cert-hint {
	display: none;
}

.cert-panel.is-compact .cert-result-head {
	margin: 12px 0 8px;
}

.cert-field input {
	width: 100%;
	height: 48px;
	padding: 0 16px 0 46px;
	border: 1px solid #e6dcc6;
	border-radius: 16px;
	background: #fff;
	font: inherit;
	font-size: 1.05rem;
	color: var(--ink);
	outline: none;
	transition: border-color .18s ease, box-shadow .18s ease;
}

.cert-field input:focus {
	border-color: var(--gold);
	box-shadow: 0 0 0 4px rgba(198, 160, 70, 0.16);
}

.cert-search button {
	height: 48px;
	padding: 0 22px;
	border: 0;
	border-radius: 16px;
	background: linear-gradient(180deg, #9a2a38, var(--wine-deep));
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	box-shadow: 0 10px 20px rgba(84, 20, 29, 0.22);
}

.cert-search button:hover {
	filter: brightness(1.06);
}

.cert-hint {
	margin: 10px 0 0;
	color: var(--muted);
	font-size: 0.92rem;
}

.cert-result-head {
	display: flex;
	align-items: end;
	justify-content: space-between;
	gap: 12px;
	margin: 14px 0 10px;
}

.cert-result-head h2 {
	margin: 0;
	font-family: "Noto Serif Thai", serif;
	font-size: 1.25rem;
}

.cert-result-head span {
	color: var(--muted);
}

.cert-list {
	display: grid;
	gap: 12px;
}

.cert-card {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 16px;
	align-items: center;
	padding: 16px 18px;
	border-radius: 18px;
	border: 1px solid #efe6d4;
	border-left: 4px solid var(--gold);
	background: linear-gradient(180deg, #fff, #fffaf1);
	transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.cert-card:hover {
	transform: translateY(-2px);
	border-color: var(--gold-soft);
	box-shadow: 0 12px 24px rgba(35, 28, 22, 0.08);
}

.cert-avatar {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	font-family: "Noto Serif Thai", serif;
	font-weight: 700;
	color: var(--wine-deep);
	background: var(--gold-soft);
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px var(--line);
}

.cert-name {
	margin: 0 0 4px;
	font-size: 1.12rem;
	font-weight: 700;
}

.cert-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	color: var(--muted);
	font-size: 0.95rem;
}

.cert-meta i { color: var(--gold); margin-right: 4px; }

.cert-side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
}

.cert-badge {
	display: inline-flex;
	align-items: center;
	padding: 5px 10px;
	border-radius: 999px;
	font-size: 0.82rem;
	font-weight: 700;
	white-space: nowrap;
}

.cert-badge.is-gold { background: #fff4cc; color: #8a6508; }
.cert-badge.is-silver { background: #eef2f6; color: #44505c; }
.cert-badge.is-bronze { background: #f6e6d8; color: #7a4a22; }
.cert-badge.is-honor { background: #e8f3ea; color: #2d6a3a; }
.cert-badge.is-join { background: #f3efe6; color: #6a5d4a; }

.cert-download {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	border-radius: 12px;
	background: var(--navy);
	color: #fff;
	text-decoration: none;
	font-weight: 700;
	font-size: 0.92rem;
}

.cert-download:hover { background: #2b3958; }

.cert-empty {
	margin-top: 22px;
	padding: 36px 18px;
	text-align: center;
	border: 1px dashed var(--line);
	border-radius: 18px;
	background: #fffaf1;
}

.cert-empty i {
	font-size: 2rem;
	color: var(--gold);
	margin-bottom: 10px;
}

.cert-empty h3 {
	margin: 0 0 6px;
	font-family: "Noto Serif Thai", serif;
}

.cert-empty p {
	margin: 0;
	color: var(--muted);
}

.cert-foot {
	padding: 8px 0 28px;
}

.cert-foot-card {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 18px;
	align-items: center;
	padding: 18px 20px;
	border-radius: 18px;
	background: rgba(255, 253, 248, 0.72);
	border: 1px solid var(--line);
}

.cert-foot-card img {
	width: 72px;
	height: auto;
}

.cert-foot h2 {
	margin: 0 0 6px;
	font-size: 1rem;
}

.cert-foot p,
.cert-copy {
	margin: 0;
	color: var(--muted);
	font-size: 0.95rem;
}

.cert-copy {
	margin-top: 12px;
	text-align: center;
}

@media (max-width: 760px) {
	.cert-hero { padding-top: 8px; }
	.cert-hero h1 { font-size: 1.12rem; }
	.cert-brand img { width: 42px; height: 42px; }
	.cert-brand-text strong,
	.cert-brand-text span {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.cert-top-inner { align-items: center; min-width: 0; }
	.cert-top-link span { display: none; }
	.cert-search,
	.cert-search button { grid-template-columns: 1fr; width: 100%; justify-content: center; }
	.cert-card,
	.cert-foot-card {
		grid-template-columns: 1fr;
	}
	.cert-side {
		align-items: stretch;
	}
	.cert-download { justify-content: center; }
}
