@font-face {
	font-family: "Kalam";
	src: url("/game/assets/fonts/Kalam-Bold.ttf") format("truetype");
	font-display: swap;
}

:root {
	color-scheme: light;
	font-family: "Kalam", system-ui, sans-serif;
	/* Web deviation (requested): Safari can derive its chrome from the page background. */
	background: var(--sky-color, #aadcff);
	-webkit-tap-highlight-color: transparent;
}

* {
	box-sizing: border-box;
}

html,
body,
#game {
	width: 100%;
	height: 100%;
	margin: 0;
	overflow: hidden;
}

body {
	background: var(--sky-color, #aadcff);
	overscroll-behavior: none;
	user-select: none;
}

#game {
	position: relative;
	background: var(--sky-color, #aadcff);
}

#game-canvas {
	display: block;
	width: 100%;
	height: 100%;
	touch-action: none;
	cursor: grab;
}

#game-canvas:active {
	cursor: grabbing;
}

/* Web deviation (requested): match the main website's heading, arrow and badge. */
@font-face {
	font-family: "GloriaHallelujah";
	src: url("/fonts/gloria/gloria-hallelujah-regular.ttf") format("truetype");
	font-display: swap;
}

.menu-download {
	position: absolute;
	width: 250px;
	transform: translate(-50%, -65%);
	text-align: center;
	color: #020c1a;
}

.menu-download h2 {
	margin: 0 0 5px;
	font: 34px/1.5 "GloriaHallelujah", cursive;
}

/* Web deviation (requested): raise the heading and arrow half a badge height. */
.menu-download h2,
.menu-download-arrow {
	transform: translateY(-25px);
}

.menu-download-arrow {
	position: absolute;
	left: 10px;
	top: 60px;
	filter: brightness(0);
}

.menu-download a {
	display: inline-block;
	border-radius: 8px;
	line-height: 0;
	/* Web deviation (requested): gently enlarge the download badge on hover. */
	transition: transform 150ms ease;
}

.menu-download a:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 5px;
}

.menu-download-night,
.menu-download[data-theme="night"] .menu-download-day {
	display: none;
}

.menu-download[data-theme="night"] {
	color: #d0ddf1;
}

.menu-download[data-theme="night"] .menu-download-arrow {
	filter: brightness(0) invert(1);
}

.menu-download[data-theme="night"] .menu-download-night {
	display: inline;
}

/* Web deviation (requested): a footer badge on level pages and the scoreboard. */
.menu-download:not([data-placement="final"]) {
	width: 150px;
	transform: translateX(-50%);
}

.menu-download:not([data-placement="final"]) h2,
.menu-download:not([data-placement="final"]) .menu-download-arrow {
	display: none;
}

.menu-download:not([data-placement="final"]) a {
	animation: download-wiggle 8s ease-in-out infinite;
}

.menu-download a:hover,
.menu-download a:focus-visible {
	animation: none;
	transform: scale(1.05);
}

@keyframes download-wiggle {
	0%, 90%, 100% { transform: rotate(0deg); }
	92%, 96% { transform: rotate(-4deg); }
	94%, 98% { transform: rotate(4deg); }
}

/* Web deviation (requested): small HTML footer links, with room for iOS safe areas. */
.menu-footer {
	position: absolute;
	left: max(12px, env(safe-area-inset-left));
	right: max(12px, env(safe-area-inset-right));
	bottom: max(8px, env(safe-area-inset-bottom));
	color: #d0ddf1;
	font: 14px/1.4 system-ui, sans-serif;
}

.menu-footer[hidden] {
	display: none;
}

.menu-footer nav {
	display: flex;
	justify-content: center;
	gap: 8px;
}

.menu-footer a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 12px;
	color: inherit;
	text-decoration: none;
	border-radius: 4px;
}

.menu-footer a:hover {
	text-decoration: underline;
}

.menu-footer a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
	.menu-download:not([data-placement="final"]) a { animation: none; }
	.menu-download a { transition: none; }
}

.music-prompt {
	position: fixed;
	inset: 0;
	z-index: 3;
	display: grid;
	place-items: center;
	padding: 16px;
	background: rgb(2 12 26 / 55%);
}

.music-prompt[hidden] {
	display: none;
}

.music-prompt-panel {
	/* Web deviation (requested): scale the music heading, buttons and spacing
	   from one panel width so phone and tablet layouts keep the same proportions. */
	--prompt-width: min(300px, 82vw);
	display: grid;
	width: var(--prompt-width);
	height: calc(var(--prompt-width) * .6);
	place-items: center;
	align-content: center;
	grid-template-columns: minmax(0, 1fr);
	row-gap: calc(var(--prompt-width) * .08);
	padding: 0 calc(var(--prompt-width) * .07);
	background: url("/game/assets/images/UI/prompt-3x.webp") center / 100% 100% no-repeat;
	color: #020c1a;
	text-align: center;
}

.music-prompt-panel h1 {
	margin: 0;
	font-size: calc(var(--prompt-width) * .1066667);
	line-height: 1;
}

.music-prompt-choices {
	display: flex;
	width: max-content;
	justify-content: center;
	gap: calc(var(--prompt-width) * .12);
}

/* Web deviation (requested): share the startup prompt's artwork and dimming. */
.app-only-prompt {
	border: 0;
	overflow: visible;
	padding: 20px 30px;
	row-gap: 20px;
}

.app-only-prompt:not([open]) {
	display: none;
}

.app-only-prompt::backdrop {
	background: rgb(2 12 26 / 55%);
}

.app-only-prompt h1 {
	font-size: clamp(20px, 5vw, 26px);
	line-height: 1.15;
	/* Web deviation (requested): initial dialog focus announces text without a selection box. */
	outline: none;
}

.app-only-download,
.app-only-download img {
	display: block;
}

.app-only-download {
	border-radius: 8px;
}

/* Web deviation (requested): Unity's red cross overlaps the panel's top-right corner. */
.app-only-close {
	position: absolute;
	top: -10px;
	right: -10px;
	margin: 0;
}

.app-only-close .music-choice {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
}

.app-only-download:focus-visible {
	outline: 2px solid #020c1a;
	outline-offset: 3px;
}

.music-choice {
	display: block;
	padding: 0;
	border: 0;
	border-radius: 12px;
	outline: none;
	background: none;
	cursor: pointer;
	transition: filter 120ms ease-out, transform 120ms ease-out;
}

.music-choice:hover,
.music-choice:focus-visible {
	filter: brightness(1.08);
	transform: scale(1.06);
}

.music-choice:active {
	transform: scale(.97);
}

.music-choice-icon {
	display: block;
	width: calc(var(--prompt-width) * .22);
	aspect-ratio: 1.4;
	background-position: center bottom;
	background-repeat: no-repeat;
	background-size: 100% auto;
}

.music-choice-icon-on {
	background-image: url("/game/assets/images/Menu/icon-music-on-3x.webp");
}

.music-choice-icon-off {
	background-image: url("/game/assets/images/Menu/icon-music-off-3x.webp");
	background-position: center top;
}

.startup-loader {
	position: fixed;
	inset: 0;
	z-index: 4;
	display: grid;
	place-items: center;
	background: var(--sky-color, #aadcff);
	opacity: 1;
	transition: opacity 250ms ease;
}

.startup-loader.is-complete {
	opacity: 0;
}

.startup-loader[hidden] {
	display: none;
}

.startup-bar {
	position: relative;
	/* Web deviation (requested): half the source sprite's size to keep this tiny loader crisp. */
	width: 52.5px;
	height: 19px;
	/* Web deviation: sprite layers must not inherit browser text/baseline spacing. */
	line-height: 0;
}

.startup-track {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
}

.startup-fill {
	position: absolute;
	left: 3.5px;
	top: 3.5px;
	bottom: 3.5px;
	/* Web deviation (requested): keep the original bar artwork moving while
	   waiting, including before game JS loads. This is an indeterminate loader,
	   not a guessed download percentage. Cross the track within the 500ms minimum
	   at constant speed. Animate only its transform, not layout. */
	width: 23px;
	animation: startup-loading 500ms linear infinite alternate;
}

@keyframes startup-loading {
	from { transform: translateX(0); }
	to { transform: translateX(22.5px); }
}

.startup-middle {
	position: absolute;
	top: 0;
	display: block;
	left: 6px;
	width: calc(100% - 12px);
	height: 100%;
}

.startup-cap {
	position: absolute;
	top: 0;
	display: block;
	width: 12px;
	height: 100%;
}

.startup-cap-start { left: 0; }
.startup-cap-end { right: 0; }

@media (prefers-reduced-motion: reduce) {
	.startup-loader { transition: none; }
	.startup-fill { animation: none; }
	.music-choice { transition: none; }
}

.error {
	position: fixed;
	inset: 0;
	z-index: 5;
	display: grid;
	place-items: center;
	padding: 24px;
	background: #90d4f4;
	color: #17202b;
	font-size: 25px;
	text-align: center;
}

.error[hidden] {
	display: none;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
