:root {
	--fg: #111;
	--fg-inverse: #fff;
	--field: rgb(0 0 0 / 0.07);
	--field-hover: rgb(0 0 0 / 0.14);
	--glass: blur(15px) contrast(90%) brightness(111%);
	/* tint behind the text, so it stays readable on busy photos */
	--panel: rgb(255 255 255 / 0.45);
	--panel-start: 5vw;
	--panel-end: auto;
	--error: #c1121f;
	--radius: 12px;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

[hidden] {
	display: none;
}

html {
	min-height: 100%;
	background: #888;
}

body {
	margin: 0;
	min-height: 100vh;
	padding: 48px 16px 96px;
	color: var(--fg);
	font:
		300 1rem / 1.45 system-ui,
		sans-serif;
}

/* The photo sits on its own fixed layer: iOS Safari ignores background-attachment: fixed. */
body::before {
	content: "";
	position: fixed;
	z-index: -1;
	top: 0;
	left: 0;
	width: 100%;
	height: 100lvh;
	background: var(--bg-sm) center / cover no-repeat;
}

@media (min-width: 1000px) {
	body::before {
		background-image: var(--bg-lg);
	}
}

main {
	position: relative;
	z-index: 1;
	max-width: 40rem;
	margin-inline: var(--panel-start) var(--panel-end);
	padding: 8px 32px 32px;
	border-radius: 30px;
	background: var(--panel);
	backdrop-filter: var(--glass);
	-webkit-backdrop-filter: var(--glass);
}

@media (max-width: 700px) {
	main {
		margin-inline: auto;
		padding: 4px 20px 24px;
	}
}

h1 {
	font-size: 1.9rem;
	font-weight: 600;
	line-height: 1.25;
	margin: 1.5rem 0 1rem;
}

h2 {
	font-size: 1.25rem;
	font-weight: 600;
	line-height: 1.3;
	margin: 1.75rem 0 0.75rem;
}

a,
b {
	font-weight: 600;
	color: inherit;
}

ol {
	padding-inline-start: 1.25rem;
}

li + li {
	margin-top: 0.4rem;
}

fieldset {
	border: 0;
	margin: 0;
	padding: 0;
}

legend {
	padding: 0;
}

input[type="text"],
select {
	display: block;
	width: 100%;
	margin: 0.5rem 0;
	padding: 10px 12px;
	border: 2px solid transparent;
	border-radius: var(--radius);
	background: var(--field);
	color: inherit;
	font: inherit;
	font-size: 1.15rem;
	font-weight: 500;
}

select option {
	color: #000;
}

input[type="text"]:hover,
select:hover {
	background: var(--field-hover);
}

:focus-visible {
	outline: 2px solid var(--fg);
	outline-offset: 2px;
}

button,
.button {
	display: inline-block;
	margin: 0.75rem 0;
	padding: 10px 20px;
	border: 2px solid var(--fg);
	border-radius: var(--radius);
	background: var(--fg);
	color: var(--fg-inverse);
	font: inherit;
	font-size: 1.15rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition:
		background-color 0.1s,
		color 0.1s;
}

button:hover,
.button:hover {
	background: transparent;
	color: var(--fg);
}

button.secondary,
.button.secondary {
	background: transparent;
	color: var(--fg);
}

button.secondary:hover,
.button.secondary:hover {
	background: var(--fg);
	color: var(--fg-inverse);
}

/* compact, but still at least 44px high: the recommended minimum for touch */
button.small {
	min-height: 44px;
	margin: 0;
	padding: 4px 14px;
	font-size: 0.9rem;
}

.error {
	padding: 10px 14px;
	border-radius: var(--radius);
	background: var(--error);
	color: #fff;
	font-weight: 500;
}

.codename {
	font-size: 1.6rem;
	font-weight: 700;
	line-height: 1.25;
	margin: 1rem 0;
}

.themes {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 6px;
}

/* keeps the main action reachable while scrolling through the designs */
button.sticky {
	position: sticky;
	bottom: 16px;
	box-shadow: 0 4px 16px rgb(0 0 0 / 0.3);
}

.themes legend {
	grid-column: 1 / -1;
}

.themes label {
	position: relative;
	cursor: pointer;
}

.themes input {
	position: absolute;
	opacity: 0;
}

.themes img {
	display: block;
	width: 100%;
	height: auto;
	border: 3px solid transparent;
	border-radius: 6px;
}

.themes label:hover img {
	border-color: var(--field-hover);
}

.themes input:checked + img {
	border-color: var(--fg);
}

.themes input:focus-visible + img {
	outline: 2px solid var(--fg);
	outline-offset: 2px;
}

.copy {
	margin: 1rem 0;
}

.copy label {
	display: block;
	font-size: 0.95rem;
}

/* at least 16px, otherwise iOS zooms in when the field is tapped */
.copy input {
	font-size: 1rem;
	font-weight: 400;
	text-overflow: ellipsis;
}

.copy-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.copy-actions button {
	margin: 0;
}

.list {
	list-style: none;
	padding: 0;
}

.list li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	padding: 6px 0;
	border-bottom: 1px solid var(--field-hover);
}

.list li + li {
	margin: 0;
}

.pair {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: 8px;
}

.pair select {
	margin: 0;
	text-overflow: ellipsis;
}

.pair button {
	grid-column: 1 / -1;
	justify-self: start;
}

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

	.pair span {
		text-align: center;
	}
}

.result {
	list-style: none;
	padding: 0;
}

.result .me {
	padding: 4px 8px;
	margin-inline: -8px;
	border-radius: 8px;
	background: var(--field-hover);
}

footer {
	margin-top: 2rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--field-hover);
	font-size: 0.9rem;
}

footer a {
	display: inline-block;
	padding: 12px 0;
	font-weight: 400;
}

#snow {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}
