* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root {
	--bg-1: #060815;
	--bg-2: #0d1630;
	--text-main: #edf4ff;
	--text-soft: rgba(224, 236, 252, 0.84);
	--line: rgba(129, 158, 203, 0.28);
	--chip: rgba(101, 142, 196, 0.22);
	--primary: #b9f252;
	--panel: rgba(20, 34, 56, 0.82);
	--panel-2: rgba(17, 30, 49, 0.9);
	--shadow: 0 24px 46px rgba(5, 12, 24, 0.42);
}

html,
body {
	min-height: 100%;
}

body {
	font-family: "Be Vietnam Pro", "Segoe UI", Tahoma, sans-serif;
	background:
		radial-gradient(circle at 12% 0%, rgba(120, 88, 196, 0.2), transparent 36%),
		radial-gradient(circle at 84% 7%, rgba(95, 153, 233, 0.15), transparent 40%),
		linear-gradient(165deg, var(--bg-1) 0%, #070b1a 54%, var(--bg-2) 100%);
	color: var(--text-main);
}

body.template-protected {
	-webkit-touch-callout: none;
}

body.template-protected .preview-window,
body.template-protected .preview-window * {
	user-select: none;
}

a {
	color: inherit;
}

.topbar {
	position: sticky;
	top: 0;
	z-index: 60;
	display: flex;
	align-items: center;
	gap: 0.9rem;
	padding: 0.64rem clamp(0.8rem, 2.5vw, 2rem);
	background: linear-gradient(90deg, rgba(9, 19, 32, 0.96), rgba(14, 30, 49, 0.94));
	border-bottom: 1px solid rgba(121, 158, 201, 0.24);
	backdrop-filter: blur(6px);
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.7rem;
	text-decoration: none;
	color: #eef5ff;
}

.brand-logo {
	width: 48px;
	height: 48px;
	object-fit: contain;
	border-radius: 12px;
}

.brand-title {
	display: block;
	font-family: "Space Grotesk", "Be Vietnam Pro", sans-serif;
	font-size: 1.06rem;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.brand-sub {
	display: block;
	font-size: 0.8rem;
	color: rgba(232, 242, 255, 0.82);
}

.topbar-nav {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	margin-left: auto;
}

.topbar-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.44rem 0.7rem;
	border-radius: 999px;
	text-decoration: none;
	font-weight: 600;
	font-size: 0.82rem;
	color: rgba(229, 240, 255, 0.94);
	border: 1px solid transparent;
	transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.topbar-link:hover {
	background: rgba(114, 155, 206, 0.16);
	border-color: rgba(143, 185, 228, 0.4);
	transform: translateY(-1px);
}

.topbar-link.is-active {
	background: rgba(106, 153, 215, 0.22);
	border-color: rgba(162, 201, 241, 0.5);
}

.topbar-actions {
	display: inline-flex;
	align-items: center;
	gap: 0.34rem;
}

.lang-switch {
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
	padding: 0.2rem;
	border-radius: 999px;
	border: 1px solid rgba(156, 132, 238, 0.54);
	background: linear-gradient(120deg, rgba(126, 88, 224, 0.26), rgba(75, 112, 204, 0.22));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.lang-btn {
	appearance: none;
	border: none;
	background: transparent;
	border-radius: 999px;
	padding: 0.34rem 0.68rem;
	color: rgba(232, 239, 255, 0.9);
	display: inline-flex;
	align-items: center;
	gap: 0.32rem;
	font-size: 0.79rem;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.lang-btn:hover {
	transform: translateY(-1px);
	background: rgba(229, 238, 255, 0.12);
}

.lang-btn.is-active {
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(224, 234, 248, 0.9));
	color: #1c2f4a;
	box-shadow: 0 7px 15px rgba(10, 18, 34, 0.28);
}

.lang-flag {
	display: inline-block;
	width: 15px;
	height: 10px;
	border-radius: 2px;
	object-fit: cover;
	box-shadow: 0 0 0 1px rgba(19, 32, 54, 0.16);
}

.topbar-icon {
	appearance: none;
	border: 1px solid rgba(129, 167, 214, 0.38);
	background: rgba(61, 95, 137, 0.24);
	color: #eef6ff;
	width: 36px;
	height: 36px;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}

.topbar-icon:hover {
	background: rgba(83, 123, 171, 0.38);
	transform: translateY(-1px);
}

.topbar-icon svg {
	width: 17px;
	height: 17px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.page-shell {
	width: min(1320px, 100% - 2rem);
	margin: 0 auto;
}

.template-hero {
	padding-top: clamp(1.6rem, 3vw, 2.6rem);
	display: grid;
	justify-items: center;
	text-align: center;
	gap: 0.9rem;
}

.template-hero h1 {
	font-family: "Space Grotesk", "Be Vietnam Pro", sans-serif;
	font-size: clamp(2.3rem, 5vw, 4.2rem);
	line-height: 1.06;
	letter-spacing: -0.03em;
	max-width: 16ch;
}

.template-hero p {
	font-size: clamp(1rem, 1.4vw, 1.18rem);
	line-height: 1.68;
	color: var(--text-soft);
	max-width: 66ch;
}

.template-grid {
	margin-top: clamp(1.4rem, 3vw, 2.4rem);
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: clamp(0.85rem, 2vw, 1.25rem);
}

.template-card {
	display: grid;
	gap: 0.72rem;
	padding: 0.78rem;
	border-radius: 16px;
	border: 1px solid var(--line);
	background: linear-gradient(165deg, rgba(18, 33, 54, 0.85), rgba(14, 27, 45, 0.9));
	box-shadow: var(--shadow);
}

.template-card-link {
	display: grid;
	gap: 0.64rem;
	text-decoration: none;
}

.template-thumb {
	position: relative;
	overflow: hidden;
	border-radius: 14px;
	aspect-ratio: 16 / 11;
	border: 1px solid rgba(153, 183, 226, 0.26);
}

.template-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.template-card:hover .template-thumb img {
	transform: scale(1.03);
}

.template-meta {
	display: grid;
	gap: 0.42rem;
}

.template-title {
	font-family: "Space Grotesk", "Be Vietnam Pro", sans-serif;
	font-size: 1.12rem;
	line-height: 1.22;
	color: #f6fbff;
}

.template-desc {
	font-size: 0.9rem;
	line-height: 1.55;
	color: rgba(219, 233, 250, 0.86);
}

.template-chip-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.55rem;
}

.template-chip {
	display: inline-flex;
	align-items: center;
	padding: 0.26rem 0.58rem;
	border-radius: 999px;
	font-size: 0.74rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: #dbeafe;
	background: var(--chip);
	border: 1px solid rgba(132, 174, 222, 0.4);
}

.template-price {
	font-size: 0.86rem;
	font-weight: 700;
	color: #c9e5ff;
}

.template-actions {
	display: flex;
	gap: 0.5rem;
}

.template-action {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.44rem;
	min-height: 38px;
	padding: 0.46rem 0.64rem;
	border-radius: 10px;
	border: 1px solid rgba(132, 176, 227, 0.34);
	background: rgba(44, 72, 108, 0.42);
	color: #e9f4ff;
	font-size: 0.81rem;
	font-weight: 700;
	cursor: pointer;
	transition: transform 0.2s ease, background 0.2s ease;
}

.template-action:hover {
	transform: translateY(-1px);
	background: rgba(67, 99, 139, 0.56);
}

.template-action.is-buy {
	background: linear-gradient(125deg, rgba(178, 242, 82, 0.92), rgba(147, 225, 67, 0.88));
	border-color: rgba(196, 255, 117, 0.72);
	color: #19380d;
}

.template-action svg {
	width: 15px;
	height: 15px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.template-section-note {
	margin-top: 1rem;
	font-size: 0.86rem;
	line-height: 1.5;
	color: rgba(200, 218, 241, 0.76);
	text-align: center;
}

.detail-wrap {
	width: min(1200px, 100% - 2rem);
	margin: 0 auto;
	padding-top: clamp(1.2rem, 2.7vw, 2.2rem);
}

.breadcrumb {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.82rem;
	color: rgba(193, 215, 243, 0.8);
}

.breadcrumb a {
	text-decoration: none;
	color: rgba(221, 236, 255, 0.92);
}

.detail-head {
	margin-top: 0.95rem;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
}

.detail-title {
	font-family: "Space Grotesk", "Be Vietnam Pro", sans-serif;
	font-size: clamp(1.9rem, 4vw, 3.4rem);
	line-height: 1.08;
	letter-spacing: -0.02em;
	max-width: 21ch;
}

.detail-sub {
	margin-top: 0.6rem;
	font-size: clamp(1rem, 1.3vw, 1.13rem);
	line-height: 1.66;
	color: rgba(217, 232, 251, 0.84);
	max-width: 67ch;
}

.detail-use {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.74rem 1.26rem;
	border-radius: 999px;
	text-decoration: none;
	font-weight: 700;
	font-size: 0.92rem;
	color: #17370e;
	background: linear-gradient(125deg, #ccff6d, #b9f252);
	box-shadow: 0 14px 24px rgba(120, 176, 33, 0.33);
}

.preview-window {
	margin-top: clamp(1rem, 2.6vw, 1.5rem);
	border-radius: 22px;
	overflow: hidden;
	border: 1px solid rgba(133, 169, 214, 0.3);
	background: rgba(21, 35, 55, 0.86);
	box-shadow: var(--shadow);
}

.preview-bar {
	height: 44px;
	padding: 0 1rem;
	display: flex;
	align-items: center;
	gap: 0.46rem;
	border-bottom: 1px solid rgba(131, 166, 210, 0.26);
	background: rgba(45, 47, 61, 0.94);
}

.preview-dot {
	width: 14px;
	height: 14px;
	border-radius: 50%;
}

.preview-dot.red {
	background: #ff6a6a;
}

.preview-dot.yellow {
	background: #f2c232;
}

.preview-dot.green {
	background: #37c781;
}


.preview-body {
	position: relative;
	background: #e5ece8;
	overflow: hidden;
}

.preview-body.is-interactive {
	height: clamp(520px, 74vh, 820px);
}

.preview-body.is-snapshot {
	height: clamp(520px, 74vh, 820px);
	overflow: auto;
	overscroll-behavior: contain;
	background: #d7e2dc;
	cursor: not-allowed;
	scrollbar-width: thin;
}

.preview-body.is-snapshot::after {
	content: "Preview snapshot | Ban quyen Carpe diem";
	position: absolute;
	top: 0.8rem;
	right: 0.8rem;
	padding: 0.32rem 0.58rem;
	border-radius: 999px;
	font-size: 0.66rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: rgba(236, 246, 255, 0.94);
	background: rgba(17, 35, 53, 0.66);
	border: 1px solid rgba(132, 172, 214, 0.42);
	pointer-events: none;
	z-index: 3;
}

.preview-snapshot-image {
	width: 100%;
	height: auto;
	display: block;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	pointer-events: none;
	filter: saturate(0.98) contrast(1.01);
}

.preview-embed {
	width: 100%;
	height: 100%;
	display: block;
	border: 0;
	background: #e5ece8;
}

.detail-content {
	margin-top: clamp(1rem, 2.3vw, 1.5rem);
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
	gap: clamp(0.9rem, 2vw, 1.2rem);
}

.detail-panel {
	display: grid;
	gap: 0.7rem;
	padding: 1rem;
	border-radius: 16px;
	border: 1px solid rgba(129, 162, 203, 0.3);
	background: var(--panel);
}

.detail-panel h3 {
	font-family: "Space Grotesk", "Be Vietnam Pro", sans-serif;
	font-size: 1.18rem;
	line-height: 1.2;
}

.detail-panel p {
	font-size: 0.92rem;
	line-height: 1.62;
	color: rgba(215, 229, 247, 0.86);
}

.detail-list {
	list-style: none;
	display: grid;
	gap: 0.52rem;
}

.detail-list li {
	display: flex;
	align-items: flex-start;
	gap: 0.45rem;
	font-size: 0.9rem;
	line-height: 1.5;
	color: rgba(224, 237, 255, 0.92);
}

.detail-list li::before {
	content: "";
	width: 8px;
	height: 8px;
	margin-top: 0.35rem;
	border-radius: 50%;
	background: linear-gradient(120deg, #8ed2ff, #be9df9);
	flex: 0 0 auto;
}

.detail-actions {
	margin-top: 1.1rem;
	display: flex;
	gap: 0.6rem;
	flex-wrap: wrap;
}

.section-gap {
	margin-bottom: clamp(2rem, 4vw, 3rem);
}

.action-toast-box {
	position: fixed;
	right: 1rem;
	bottom: 1rem;
	z-index: 90;
	display: grid;
	gap: 0.5rem;
}

.action-toast {
	padding: 0.72rem 0.82rem;
	border-radius: 11px;
	background: rgba(20, 34, 55, 0.95);
	border: 1px solid rgba(138, 173, 216, 0.45);
	font-size: 0.84rem;
	color: #e7f1ff;
	box-shadow: 0 10px 24px rgba(5, 14, 30, 0.4);
	animation: toast-in 0.22s ease;
}

@keyframes toast-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (max-width: 1180px) {
	.template-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 960px) {
	.topbar-nav {
		gap: 0.2rem;
	}

	.topbar-link {
		padding: 0.38rem 0.58rem;
		font-size: 0.76rem;
	}

	.lang-btn {
		padding: 0.32rem 0.54rem;
		font-size: 0.74rem;
	}

	.template-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.detail-content {
		grid-template-columns: 1fr;
	}

	.detail-head {
		display: grid;
		gap: 0.7rem;
	}
}

@media (max-width: 640px) {
	.topbar {
		padding: 0.56rem 0.62rem;
		min-height: 68px;
	}

	.brand-sub {
		display: none;
	}

	.brand-title {
		font-size: 0.96rem;
	}

	.brand-logo {
		width: 42px;
		height: 42px;
	}

	.topbar-link {
		padding: 0.34rem 0.5rem;
		font-size: 0.72rem;
	}

	.lang-btn {
		padding: 0.3rem 0.46rem;
		font-size: 0.7rem;
	}

	.topbar-nav .topbar-link:not(.is-template):not(.is-blog) {
		display: none;
	}

	.topbar-icon {
		width: 32px;
		height: 32px;
	}

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

	.page-shell,
	.detail-wrap {
		width: min(1200px, 100% - 1rem);
	}

	.preview-bar {
		height: 38px;
		padding: 0 0.7rem;
	}

	.preview-dot {
		width: 12px;
		height: 12px;
	}

	.preview-body.is-interactive {
		height: 68vh;
	}

	.preview-body.is-snapshot {
		height: 68vh;
	}
}
