@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap");

* {
	box-sizing: border-box;
}

body {
	background: black;
	background: linear-gradient(43deg, #00dbde 0%, #fc00ff 100%);
	color: white;
	font-family: "Roboto", sans-serif;
	margin: 0;
	min-height: 100dvh;
	overflow-x: hidden; /* the drifting background layer oversizes the viewport */
}
/* ambient slow-drifting gradient; transform-only so it stays on the compositor */
body::before {
	content: "";
	position: fixed;
	inset: -60%;
	z-index: -1;
	background: linear-gradient(43deg, #00dbde 0%, #fc00ff 100%);
	animation: drift 26s ease-in-out infinite alternate;
}

main {
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 30px 15px 15px;
	gap: 25px;
}
main.shake {
	animation: shake 0.4s ease;
}

#streak-badge {
	position: absolute;
	top: 15px;
	left: 15px;
	font-weight: 800;
	font-size: 1.15em;
}

#headline {
	font-weight: 300;
	text-align: center;
	font-size: 1.15em;
	margin: 0;
	padding: 0 40px; /* keep clear of the info button */
}

#question {
	font-weight: 700;
	text-align: center;
	max-width: 600px;
	font-size: 1.5rem;
}
#question.enter {
	animation: fade-up 0.3s ease-out both;
}

#buttons {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
	width: 100%;
	max-width: 310px;
}
#buttons .button {
	aspect-ratio: 1;
	color: white;
	font-family: inherit;
	font-weight: 400;
	font-size: 1.25em;
	border: 5px solid white;
	border-radius: 5%;
	background: rgba(0, 0, 0, 0);
	cursor: pointer;
	overflow-wrap: anywhere;
	transition: transform 0.12s ease, background 0.15s ease,
		border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
#buttons .button:hover:not(:disabled),
#buttons .button:focus-visible {
	background: rgba(255, 255, 255, 0.12);
	transform: translateY(-3px);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
#buttons .button:active:not(:disabled) {
	transform: scale(0.95);
	box-shadow: none;
}
#buttons .button:disabled {
	cursor: default;
}
/* dim the losers during the answer flash, but not the verdict buttons */
#buttons .button:disabled:not(.right):not(.wrong) {
	opacity: 0.45;
}
#buttons .button.right {
	background: #1fbf75;
	border-color: #b8ffcf;
	animation: pop 0.45s ease;
}
#buttons .button.wrong {
	background: #e0455a;
	border-color: #ffc4c4;
	animation: shake 0.4s ease;
}
/* stagger the answers in with each new question */
#buttons.enter .button {
	animation: fade-up 0.35s ease-out both;
}
#buttons.enter .button:nth-child(2) { animation-delay: 0.06s; }
#buttons.enter .button:nth-child(3) { animation-delay: 0.12s; }
#buttons.enter .button:nth-child(4) { animation-delay: 0.18s; }

#center-status {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	font-weight: 800;
	margin-top: auto;
}
#center-status p {
	margin: 0 0 10px;
}
#center-status #status.good {
	color: #b8ffcf;
}
#center-status #status.bad {
	color: #ffc4c4;
}
#center-status #status.mega {
	color: #ffe27a;
	font-size: 1.35em;
	animation: pop 0.5s ease;
}
#center-status #correct {
	color: #e0ffe1;
}
#center-status #incorrect {
	color: #ffe0e0;
}
#center-status #correct,
#center-status #incorrect {
	display: inline-block; /* transforms don't apply to inline elements */
}
.bump {
	animation: bump 0.35s ease;
}
#reset-score {
	margin-left: 10px;
	padding: 0;
	border: none;
	background: none;
	color: white;
	font-size: 1em;
	opacity: 0.5;
	cursor: pointer;
	transition: opacity 0.15s ease;
}
#reset-score:hover,
#reset-score:focus-visible {
	opacity: 1;
}

footer {
	width: 100%;
	display: flex;
	flex-direction: row;
	justify-content: space-evenly;
	gap: 10px;
}
footer select {
	width: 40%;
	color: white;
	background: rgba(0, 0, 0, 0);
	padding: 0.6em;
	border: 3px solid white;
	border-radius: 5%;
	text-align: center;
	font-family: inherit;
	font-weight: 400;
	font-size: 0.7em;
	appearance: none;
	cursor: pointer;
}
footer select option {
	color: black;
}

#info {
	position: fixed;
	inset: 0;
	z-index: 10; /* above the flash and confetti layers */
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: space-evenly;
	background-color: rgba(0, 0, 0, 0.7);
	cursor: pointer;
}
#info * {
	padding: 0;
	margin: 0;
}
#info img {
	border-radius: 50%;
}
#info .title {
	text-align: center;
}
#info .title h2 {
	font-weight: 800;
	font-size: 2.5em;
}
#info .title h3 {
	font-weight: 400;
	font-size: 1.5em;
}
#info .title p {
	font-weight: 300;
	font-size: 1em;
	padding-top: 10px;
}
#info .brendan {
	text-align: center;
}
#info .brendan h4 {
	font-size: 1.25em;
	padding-bottom: 20px;
}
#info .brendan .inlineButtons {
	display: flex;
	flex-direction: row;
	justify-content: center;
	flex-wrap: wrap;
	gap: 15px;
}
#info .brendan .inlineButtons a {
	padding: 15px;
	border: 3px white solid;
	border-radius: 5%;
	color: white;
	font-weight: 800;
	text-decoration: none;
	transition: border-color 0.2s ease-in-out;
}
#info .brendan .inlineButtons a:visited {
	color: white;
}
#info .brendan .inlineButtons a:hover {
	border-color: #d9fffb;
}
#info .credits {
	text-align: center;
	font-weight: 300;
}
#info .credits p {
	padding-bottom: 5px;
}
#info .credits p a,
#info .credits p a:visited {
	color: white;
}

#info-btn,
#sound-btn {
	position: absolute;
	top: 15px;
	right: 15px;
	padding: 0;
	border: none;
	background: none;
	cursor: pointer;
	opacity: 0.9;
}
#sound-btn {
	right: 55px;
}
#info-btn svg,
#sound-btn svg {
	fill: white;
	display: block;
}
#sound-btn .slash {
	stroke: white;
	stroke-width: 2.5;
	display: none;
}
#sound-btn.muted .slash {
	display: block;
}
#sound-btn.muted .wave {
	display: none;
}

/* full-screen glow on answer, sits above everything but catches no clicks */
#flash {
	position: fixed;
	inset: 0;
	pointer-events: none;
	opacity: 0;
	z-index: 5;
}

#confetti {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 6;
}

/* "+1" that floats up from a correctly answered button */
.score-pop {
	position: fixed;
	transform: translate(-50%, 0);
	font-weight: 800;
	font-size: 1.4em;
	color: #b8ffcf;
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
	pointer-events: none;
	z-index: 7;
	animation: float-up 0.8s ease-out forwards;
}
#flash.good {
	background: radial-gradient(circle at 50% 40%, rgba(64, 255, 154, 0.4), transparent 70%);
	animation: flash 0.7s ease-out;
}
#flash.bad {
	background: radial-gradient(circle at 50% 40%, rgba(255, 64, 90, 0.4), transparent 70%);
	animation: flash 0.7s ease-out;
}

/* needs the #id for specificity: #info sets display: flex */
#info.hidden,
.hidden {
	display: none;
}

@keyframes fade-up {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
}
@keyframes pop {
	45% {
		transform: scale(1.12);
	}
}
@keyframes shake {
	20% { transform: translateX(-7px); }
	40% { transform: translateX(6px); }
	60% { transform: translateX(-4px); }
	80% { transform: translateX(3px); }
}
@keyframes bump {
	40% {
		transform: scale(1.5);
	}
}
@keyframes flash {
	15% {
		opacity: 1;
	}
}
@keyframes float-up {
	to {
		transform: translate(-50%, -70px);
		opacity: 0;
	}
}
@keyframes drift {
	to {
		transform: rotate(10deg) scale(1.15);
	}
}

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