﻿/*(C) 2020 Moses Odhiambo*/
@font-face{
	font-family: Extrude;
	src: url(assets/fonts/8-BITWONDER.ttf);
	
}
@font-face{
	font-family: Boxy;
	src: url(assets/fonts/8-BITWONDER.ttf);
}
*{
	padding: 0;
	margin: 0;
	user-select:none;
}
*:focus {
    outline: none;
}
body{
	margin: 0;
	overflow: hidden;
	font-family: Boxy, sans-serif;
	background: radial-gradient(circle at top, #0b1b3a 0%, #04060f 55%, #010104 100%);
	color: #f0f0f0;
}
#externalLinks{
	position: absolute;
	top: 20px;
	right: 20px;
	display: flex;
	gap: 12px;
	align-items: center;
	z-index: 6;
}
#externalLinks .external-link{
	width: 46px;
	height: 46px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 12px;
	background: rgba(255,255,255,0.12);
	border: 1px solid rgba(255,255,255,0.25);
	box-shadow: 0 8px 20px rgba(0,0,0,0.45);
	transition: transform 0.2s ease, background 0.2s ease;
}
#externalLinks .external-link:hover{
	transform: translateY(-2px);
	background: rgba(255,255,255,0.22);
}
#externalLinks img{
	width: 28px;
	height: 28px;
	object-fit: contain;
	pointer-events: none;
}
#credit{
	position: absolute;
	bottom: 20px;
	right: 24px;
	font-family: Boxy;
	font-size: 16px;
	letter-spacing: 2px;
	color: #f7ede2;
	text-shadow: 0 6px 18px rgba(0,0,0,0.6);
	z-index: 5;
}
canvas{
	position: fixed;
	top: 0;
	left: 0;
	height: 100vh;
	width: 100vw;
	display: block;
	z-index: 0;
}
#score {
	font-family: Boxy;
	font-size: 18px;
	color: white;
	position: absolute;
	top: 90px;
	right: 20px;
	z-index: 4;
	letter-spacing: 2px;
	text-shadow: 0 0 10px rgba(0,0,0,0.6);
	transition: opacity 0.3s ease;
	opacity: 1;
	pointer-events: none;
}
#score::after{
	content: '';
	display: block;
	margin-top: 4px;
	height: 2px;
	width: 100%;
	background: linear-gradient(90deg, rgba(255,255,255,0.8), transparent);
}
body.attract-mode #score{
	opacity: 0;
}
#hatSelector{
	position: absolute;
	top: 90px;
	left: 20px;
	width: 230px;
	padding: 16px;
	border-radius: 20px;
	background: rgba(5, 10, 28, 0.82);
	border: 1px solid rgba(255,255,255,0.08);
	box-shadow: 0 18px 40px rgba(0,0,0,0.45);
	backdrop-filter: blur(8px);
	z-index: 5;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.hat-selector__header{
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
	padding-bottom: 4px;
	border-bottom: 1px solid rgba(255,255,255,0.08);
	cursor: pointer;
	color: #f7f7f7;
}
.hat-selector__header:focus-visible{
	outline: 2px solid rgba(255,255,255,0.6);
	outline-offset: 3px;
}
.hat-selector__toggle{
	width: 34px;
	height: 34px;
	border-radius: 12px;
	border: 1px solid rgba(255,255,255,0.15);
	background: rgba(255,255,255,0.08);
	color: inherit;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.hat-selector__toggle-icon{
	width: 10px;
	height: 10px;
	border-left: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform 0.3s ease;
}
.hat-selector--collapsed .hat-selector__toggle-icon{
	transform: rotate(135deg);
}
.hat-selector__title{
	font-family: Boxy;
	font-size: 13px;
	letter-spacing: 4px;
	color: #f7f7f7;
	margin-bottom: 10px;
}
.hat-selector--collapsed .hat-selector__title{
	margin-bottom: 0;
}
.hat-selector__options{
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 400px;
	overflow: hidden;
	opacity: 1;
	transition: max-height 0.3s ease, opacity 0.3s ease;
}
.hat-selector--collapsed .hat-selector__options{
	max-height: 0;
	opacity: 0;
	pointer-events: none;
}
.hat-option{
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 10px 12px;
	border-radius: 14px;
	border: 1px solid rgba(255,255,255,0.08);
	background: rgba(255,255,255,0.04);
	color: #f0f0f0;
	font-family: Boxy;
	font-size: 13px;
	letter-spacing: 2px;
	text-align: left;
	cursor: pointer;
	transition: border 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.hat-option__swatch{
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--hat-accent, #ffffff), rgba(255,255,255,0.85));
	border: 2px solid rgba(255,255,255,0.25);
	box-shadow: inset 0 0 8px rgba(0,0,0,0.4);
}
.hat-option__name{
	flex: 1;
}
.hat-option.active{
	border-color: rgba(255,255,255,0.4);
	background: rgba(255,255,255,0.15);
	transform: translateY(-1px);
}
.hat-option:hover{
	border-color: rgba(255,255,255,0.25);
}
body.attract-mode #hatSelector{
	opacity: 0.2;
	pointer-events: none;
}
@media (max-width: 640px){
	#hatSelector{
		width: calc(100% - 40px);
		left: 50%;
		bottom: 24px;
		top: auto;
		transform: translateX(-50%);
	}
	.hat-selector__options{
		flex-direction: row;
		flex-wrap: wrap;
		gap: 10px;
	}
	.hat-option{
		flex: 1 1 calc(50% - 10px);
	}
}
#splash{
	position: absolute;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: clamp(12px, 2vh, 24px);
	padding: clamp(24px, 4vw, 60px);
	background: rgba(4, 8, 24, 0.55);
	backdrop-filter: blur(12px);
	text-align: center;
	z-index: 5;
	transition: opacity 0.4s ease;
	box-sizing: border-box;
}
/* #splash::before{
	content: '';
	position: absolute;
	width: min(520px, 80vw);
	max-width: 90vw;
	min-height: 60vh;
	border-radius: 32px;
	border: 1px solid rgba(255,255,255,0.15);
	background: linear-gradient(140deg, rgba(255,255,255,0.09), rgba(255,255,255,0.02));
	box-shadow: 0 25px 60px rgba(0,0,0,0.45);
	opacity: 0.85;
	pointer-events: none;
} */
#splash > *{
	position: relative;
	width: 100%;
	max-width: min(420px, 80vw);
}
#title{
	font-family: Extrude;
	font-size: clamp(26px, 4.8vw, 50px);
	color: #fefefe;
	line-height: 1.15;
	letter-spacing: 5px;
	text-transform: uppercase;
	/* add a border black */
	text-shadow: 8px 8px 0 #000, -8px -8px 0 #000, 8px -8px 0 #000, -8px 8px 0 #000, 0px 8px 0 #000, 8px 0px 0 #000, 0px -8px 0 #000, -8px 0px 0 #000;
	margin-bottom: clamp(8px, 2vh, 20px);
}
#loading{
	opacity: 1;
	position: relative;
	width: 100%;
	min-height: 48px;
	font-family: Boxy;
	font-size: clamp(16px, 3.5vw, 22px);
	background-color: rgba(255,255,255,0.07);
	border: 1px solid rgba(255,255,255,0.2);
	border-radius: 999px;
	padding: 10px 24px;
	text-transform: uppercase;
	letter-spacing: 3px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
}
.letter{
	float: none;
	display: inline-block;
	color: #11bfe2;
}
.main{
	margin: 5px 0px;
}
.period1{
	animation: first 3s step-end infinite;
}
.period2{
	animation: second 3s step-end infinite;
}
.period3{
	animation: third 3s step-end infinite;
}
#instructions{
	position: relative;
	font-family: 'Roboto';
	font-size: clamp(14px, 2.6vw, 20px);
	text-align: center;
	color: #dfe7ff;
	max-width: 420px;
	line-height: 1.5;
	margin: 0 auto;
}
#play{
	opacity: 0;
	position: relative;
	width: 100%;
	font-family: '8-BIT WONDER';
	font-size: clamp(18px, 3.2vw, 24px);
	text-align: center;
	color: #0d162f;
	background: linear-gradient(135deg, #ffe270, #f8c531);
	border-radius: 18px;
	box-shadow: 0 15px 30px rgba(0,0,0,0.4);
	transition: opacity 0.4s ease, transform 0.4s ease;
}
#pressPlay{
	position: relative;
	width: 100%;
	height: 100%;
	border: none;
	background: transparent;
	padding: 16px 28px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
#pressPlay:disabled{
	cursor: not-allowed;
	opacity: 0.4;
}
.play-button {
	width: 100%;
	height: auto;
	cursor: pointer;
}

@media (max-width: 540px){
	/* #splash::before{
		min-height: auto;
		border-radius: 22px;
	} */
	#title{
		letter-spacing: 3px;
	}
	#instructions{
		line-height: 1.35;
	}
}
#restart {
	position: absolute;
	top: 50vh;
	left: 50vw;
	background: linear-gradient(135deg, #ff4d5a, #c9184a);
	color: white;
	padding: 18px 36px;
	font-family: Boxy;
	font-size: 20px;
	border: none;
	border-radius: 16px;
	letter-spacing: 2px;
	box-shadow: 0 20px 30px rgba(201,24,74,0.45);
	transform: translate(-50%, -50%);
	visibility: hidden;
	z-index: 4;
	cursor: pointer;
}
@keyframes first{
	0% { opacity: 0; }
	25% { opacity: 1; }
	50% { opacity: 1; }
	75% { opacity: 1; }
}
@keyframes second{
	0% { opacity: 0; }
	25% { opacity: 0; }
	50% { opacity: 1; }
	75% { opacity: 1; }
}
@keyframes third{
	0% { opacity: 0; }
	25% { opacity: 0; }
	50% { opacity: 0; }
	75% { opacity: 1; }
}