:root {
	--font-size: calc(max(3vh, 1rem));
}

/* dark theme (default to match system dark mode) */
:root,
[data-theme="dark"] {
	--font-color: #fff;
	--bg-color: #212529;
	--fields-border: #495057;
	--fields-bg: #1b1e21;
	--placeholder-color: #dee2e6;
}

/* light theme */
[data-theme="light"] {
	--font-color: #000;
	--bg-color: #f5f5f5;
	--fields-border: #000;
	--fields-bg: #fffaf4;
	--placeholder-color: #000;
}

body,
a {
	color: var(--font-color);
	background: var(--bg-color)
}

body {
	font-family: 'Courier New', Courier, monospace;
	font-size: var(--font-size);
	margin: 0;
	padding: 0 2%;
	color: var(--font-color);
	background: var(--bg-color);
}

body,
body *,
hr:after {
	transition: background-color .5s;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
	
	.spin-wheel {
		animation: none;
	}
}

a {
	color: var(--font-color);
	text-decoration: none;
	border-bottom: 1px solid;
}

a:hover,
button:hover:not(:disabled) {
	background: var(--font-color);
	color: var(--bg-color);
}

a:focus-visible,
button:focus-visible {
	outline: 2px solid var(--font-color);
	outline-offset: 2px;
}

p {
	margin-bottom: 0.1em;
}

main {
	display: flex;
	align-content: space-between;
	flex-wrap: wrap;
	height: 98vh;
	height: 98dvh;
}

.box {
	width: 100%;
	box-sizing: border-box;
	position: relative;
}

.box:nth-of-type(1) {
	padding-top: 1rem;
}

h3 {
	margin: 0;
}

@keyframes spin {
	from {
		transform: rotate(0deg);
	}

	to {
		transform: rotate(360deg);
	}
}

.hr-container {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	position: relative;
}

hr {
	border: none;
	border-top: medium double var(--placeholder-color, #fff);
	color: var(--placeholder-color, #fff);
	width: 100%;
	height: 0;
	margin: 2rem 0;
	position: relative;
}

.spin-wheel {
	width: 40px;
	height: 40px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='37' height='37' fill='none' viewBox='0 0 305 305'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-width='10' d='M152 138.206V5m0 295V166.794m0-28.588V5m0 295V166.794m-3.523-28.127L114 10m76.352 284.948-34.477-128.667m-.352-27.614L190 10m-76.352 284.948 34.477-128.667m-2.521-25.922L79 24.999m147.5 255.479-66.603-115.36m.499-24.759L227 24.999M79.5 280.478l66.603-115.36m-3.912-22.927L48 48.001m208.597 208.595-94.191-94.191m.403-20.214L257 48.001M48.403 256.596l94.191-94.191m-2.234-16.801L25 79m255.478 147.5-115.36-66.603m-.478-14.293L280 79M24.523 226.5l115.359-66.603m-1.215-11.421L10 113.999m284.948 76.353-128.667-34.477m.052-7.399L295 113.999M10.052 190.352l128.667-34.477m-.513-2.875H5m295 0H166.794m0 0H300M5 153h133.206' /%3E%3Crect width='21' height='21' x='142' y='142' fill='url(%23a)' rx='10.5' /%3E%3Cdefs%3E%3ClinearGradient id='a' x1='152.5' x2='152.5' y1='142' y2='163' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%232D2D2D' /%3E%3Cstop offset='1' stop-color='%23191919' /%3E%3C/linearGradient%3E%3C/defs%3E%3C/svg%3E");
	background-size: contain;
	background-repeat: no-repeat;
	animation: spin 10s linear infinite;
	position: absolute;
	z-index: 1;
}

html:not([data-theme="dark"]) .spin-wheel {
	filter: invert(1)
}

form {
	padding-top: 1rem;
	display: flex;
	flex-wrap: wrap;
	gap: 1rem 0;
}

form label {
	display: none;
}

form input,
form textarea {
	display: block;
	margin: 0;
	width: 100%;
}

form input,
form textarea {
	width: 100%;
	padding: 1%;
	box-sizing: border-box;
	font-size: var(--font-size);
	font-family: 'Courier New', Courier, monospace;
	border: 1px solid var(--fields-border);
	background: var(--fields-bg);
	color: var(--font-color);
	resize: none;
	transition: border-color 0.2s;
}

form input:focus,
form textarea:focus {
	outline: none;
	border-color: var(--font-color);
}

form input::placeholder,
form textarea::placeholder {
	color: var(--placeholder-color);
	opacity: 0.7;
}

.button-container {
	display: flex;
	align-items: center;
	gap: 1rem;
	width: 100%;
	flex-wrap: wrap;
}

#form-message {
	flex: 1;
	min-width: 0;
	min-height: 0;
	line-height: 1.2;
}

form textarea {
	height: 20vh;
}

form input {
	height: 6vh;
}

form button {
	font-size: var(--font-size);
	cursor: pointer;
	font-family: 'Courier New', Courier, monospace;
	padding: 5px 15px;
	border: 1px solid var(--fields-border);
	color: var(--font-color);
	background: var(--bg-color);
	transition: opacity 0.2s;
}

form button:hover:not(:disabled) {
	background: var(--font-color);
	color: var(--bg-color);
}

form button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

form button:focus-visible {
	outline: 2px solid var(--font-color);
	outline-offset: 2px;
}

.button-loader {
	display: none;
}

#theme-switch {
	position: absolute;
	right: 0;
	top: 1rem;
	cursor: pointer;
}

#theme-toggle {
	display: inline-block;
	padding: 4px;
	border-radius: 4px;
	transition: background-color 0.2s;
}

#theme-toggle:hover {
	background-color: var(--fields-bg);
}

#theme-toggle:focus-visible {
	outline: 2px solid var(--font-color);
	outline-offset: 2px;
}

/* dark mode */

:root {
	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {

	/* dark theme */
	[data-theme="dark"] {
		--font-color: #fff;
		--bg-color: #212529;
		--fields-border: #495057;
		--fields-bg: #1b1e21;
		--placeholder-color: #dee2e6;
	}

}

@media (prefers-color-scheme: light) {

	/* light theme */
	[data-theme="light"] {
		--font-color: #000;
		--bg-color: #f5f5f5;
		--fields-border: #000;
		--fields-bg: #fffaf4;
		--placeholder-color: #000;
	}

}