* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
	min-height: 100vh;
	font-family:
		system-ui,
		-apple-system,
		BlinkMacSystemFont,
		"Segoe UI",
		Roboto,
		Ubuntu,
		Cantarell,
		"Noto Sans",
		sans-serif;
	color: #1a1a1a;
	background: #f7f8fa;
}

[hidden] {
	display: none !important;
}

body {
	display: flex;
	flex-direction: column;
}

.site-header,
.site-footer {
	padding: 1rem;
	background: #ffffff;
	border-bottom: 1px solid #e0e4ea;
}

.site-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

.header-nav {
	display: flex;
	gap: 1.25rem;
}

.site-footer {
	border-top: 1px solid #e0e4ea;
	border-bottom: none;
	text-align: center;
	font-size: 0.85rem;
	color: #5a5f66;
	margin-top: auto;
}

.footer-link {
	color: #3b61bc;
	text-decoration: none;
}

.footer-link:hover,
.footer-link:focus-visible {
	text-decoration: underline;
	outline: none;
}

.quiet-link {
	color: #6b717a;
	text-decoration: none;
	font-size: 0.9rem;
}

.quiet-link:hover,
.quiet-link:focus-visible {
	color: #2f3b4d;
	text-decoration: underline;
	outline: none;
}

.brand-mark {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.95rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #000000;
}

.brand-link {
	color: inherit;
	text-decoration: none;
	font-family:
		"SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New",
		monospace;
	font-weight: 600;
	transition: color 150ms ease;
	text-transform: none;
}

.brand-link:hover,
.brand-link:focus-visible {
	color: #2f3b4d;
	outline: none;
}

.content {
	flex: 1;
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding: 2.5rem 1.25rem;
}

.create-card {
	width: 100%;
	max-width: 1220px;
	background: #ffffff;
	border: 1px solid #e0e4ea;
	border-radius: 16px;
	padding: 2rem 1.75rem;
	box-shadow: 0 12px 32px rgba(26, 35, 48, 0.08);
}

.card-title {
	margin: 0 0 0.6rem;
	font-size: 1.5rem;
	font-weight: 600;
}

.card-lede {
	margin: 0 0 1.5rem;
	color: #3a3f45;
}

/* Two-column layout */
.two-col {
	display: grid;
	grid-template-columns: 1.2fr 0.8fr;
	gap: 1.75rem;
	align-items: start;
}

.options-col {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	min-width: 0;
}

.preview-col {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	align-items: center;
	position: sticky;
	top: 1rem;
}

.control-grid {
	display: grid;
	gap: 1rem;
}

.control-section {
	margin: 0;
	padding: 0.9rem;
	border: 1px solid #dbe1ea;
	border-radius: 12px;
	background: #fbfcfe;
	display: grid;
	gap: 0.75rem;
}

.control-section legend {
	padding: 0 0.35rem;
	font-weight: 700;
	font-size: 0.86rem;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: #334155;
}

.field-grid {
	display: grid;
	gap: 0.75rem;
}

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

.field-grid.three-up {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check-row {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
	font-size: 0.9rem;
	color: #374151;
}

.check-row label {
	display: inline-flex;
	align-items: center;
	gap: 0.42rem;
	cursor: pointer;
}

.check-row input[type="checkbox"] {
	accent-color: #3b61bc;
}

.compact-actions {
	gap: 0.45rem;
}

.compact-actions .button,
.compact-actions .ghost-button {
	padding: 0.6rem 0.82rem;
	font-size: 0.88rem;
}

.disabled-controls {
	opacity: 0.48;
	pointer-events: none;
	filter: grayscale(0.1);
}

.badge-preview-row {
	min-height: 44px;
	display: flex;
	align-items: center;
}

#badge-image-preview {
	width: 68px;
	height: 68px;
	object-fit: contain;
	border-radius: 10px;
	border: 1px solid #d7dce4;
	background: #ffffff;
	padding: 4px;
}

#badge-image {
	padding: 0.46rem 0.62rem;
}

/* Form elements */
.field-group {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.field-label {
	font-weight: 600;
	font-size: 0.95rem;
	color: #2a2f36;
}

.field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
}

.text-input {
	width: 100%;
	padding: 0.66rem 0.75rem;
	border: 1px solid #d7dce4;
	border-radius: 10px;
	font-size: 0.95rem;
	background: #f9fafc;
	color: #1a1a1a;
	transition:
		border-color 120ms ease,
		box-shadow 120ms ease;
}

.text-input:focus-visible {
	border-color: #3b61bc;
	box-shadow: 0 0 0 3px rgba(59, 97, 188, 0.15);
	outline: none;
	background: #ffffff;
}

.text-area {
	resize: vertical;
	min-height: 72px;
	font-family: inherit;
	line-height: 1.5;
}

.select-input {
	appearance: none;
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b717a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.85rem center;
	padding-right: 2.25rem;
}

/* Color picker row */
.color-row {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.color-swatch {
	width: 40px;
	height: 40px;
	border: 1px solid #d7dce4;
	border-radius: 10px;
	cursor: pointer;
	padding: 2px;
	background: #f9fafc;
	flex-shrink: 0;
}

.color-swatch:focus-visible {
	outline: 2px solid #3b61bc;
	outline-offset: 2px;
}

.color-hex {
	flex: 1;
	min-width: 0;
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
	font-size: 0.84rem;
	padding: 0.6rem 0.7rem;
}

/* Range input */
.range-input {
	width: 100%;
	height: 6px;
	border-radius: 3px;
	appearance: none;
	background: #d7dce4;
	outline: none;
	cursor: pointer;
}

.range-input::-webkit-slider-thumb {
	appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #3b61bc;
	border: 2px solid #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.range-input::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #3b61bc;
	border: 2px solid #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.range-input:focus-visible {
	box-shadow: 0 0 0 3px rgba(59, 97, 188, 0.2);
}

/* Buttons */
.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
}

.download-actions {
	justify-content: center;
}

.button {
	padding: 0.8rem 1.2rem;
	border: 1px solid #3b61bc;
	background: #3b61bc;
	color: #ffffff;
	border-radius: 10px;
	font-weight: 600;
	font-size: 1rem;
	cursor: pointer;
	transition:
		background 120ms ease,
		border-color 120ms ease,
		box-shadow 120ms ease;
}

.button:hover,
.button:focus-visible {
	background: #2f4fa0;
	border-color: #2f4fa0;
	box-shadow: 0 0 0 3px rgba(59, 97, 188, 0.2);
	outline: none;
}

.ghost-button {
	padding: 0.8rem 1.1rem;
	border: 1px solid #d7dce4;
	background: #ffffff;
	color: #2a2f36;
	border-radius: 10px;
	font-weight: 600;
	font-size: 1rem;
	cursor: pointer;
	transition:
		border-color 120ms ease,
		box-shadow 120ms ease;
}

.ghost-button:hover,
.ghost-button:focus-visible {
	border-color: #3b61bc;
	box-shadow: 0 0 0 3px rgba(59, 97, 188, 0.15);
	outline: none;
}

.muted-note {
	margin: 0;
	color: #6b717a;
	font-size: 0.9rem;
}

.preview-note {
	text-align: center;
	max-width: 28ch;
}

/* QR preview */
.qr-preview {
	width: 100%;
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f3f6fb;
	border-radius: 12px;
	border: 1px solid #d7dce4;
	overflow: hidden;
}

.qr-preview svg {
	width: 100%;
	height: 100%;
	display: block;
}

.qr-preview.preview-tall {
	aspect-ratio: auto;
	min-height: 380px;
	padding: 0.65rem;
}

.qr-preview.preview-tall svg {
	height: auto;
}

.preview-placeholder {
	margin: 0;
	color: #9da3ad;
	font-size: 0.9rem;
	text-align: center;
	padding: 1rem;
}

.noscript {
	padding: 1rem;
	margin: 1rem;
	border: 1px solid #e0a200;
	background: #fff7e0;
	color: #4a3c00;
	border-radius: 8px;
}

/* Responsive */
@media (max-width: 600px) {
	.two-col {
		grid-template-columns: 1fr;
	}

	.preview-col {
		position: static;
		order: -1;
	}

	.qr-preview {
		max-width: 280px;
		margin: 0 auto;
	}

	.field-grid.two-up,
	.field-grid.three-up {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 480px) {
	.create-card {
		padding: 1.5rem 1.25rem;
	}

	.header-nav {
		gap: 0.75rem;
	}

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

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0s !important;
		transition-duration: 0s !important;
	}
}
