@import url('https://fonts.googleapis.com/css2?family=Lilita+One&family=Quicksand:wght@500;700&display=swap');

:root {
	color-scheme: light;
	--pink-hot: #ff2d78;
	--pink-light: #ffb3d0;
	--purple-deep: #6b21a8;
	--purple-mid: #a855f7;
	--purple-light: #e9d5ff;
	--gold: #fbbf24;
	--gold-dark: #d97706;
	--cyan: #06b6d4;
	--white: #ffffff;
	--cream: #fef7f0;
	--floor: #2d1b4e;
	font-family: 'Quicksand', sans-serif;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html, body {
	height: 100%;
	overflow: hidden;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
}

.game {
	position: relative;
	width: 100vw;
	height: 100vh;
	overflow: hidden;
	background: linear-gradient(180deg, #1e0533 0%, #3b0764 40%, #581c87 70%, #7c3aed 100%);
}

.game__bg {
	position: absolute;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
}

.game__bg-stripe {
	position: absolute;
	border-radius: 50%;
	opacity: 0.08;
	filter: blur(60px);
}

.game__bg-stripe--1 {
	width: 600px;
	height: 600px;
	background: var(--pink-hot);
	top: -200px;
	right: -100px;
}

.game__bg-stripe--2 {
	width: 500px;
	height: 500px;
	background: var(--cyan);
	bottom: -150px;
	left: -100px;
}

.game__bg-stripe--3 {
	width: 400px;
	height: 400px;
	background: var(--gold);
	top: 40%;
	left: 30%;
}

/* Title Screen */
.game__title-screen {
	position: absolute;
	inset: 0;
	z-index: 20;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 30px;
	background: linear-gradient(180deg, #1e0533ee 0%, #3b0764ee 50%, #581c87ee 100%);
	backdrop-filter: blur(10px);
	transition: opacity 0.5s, visibility 0.5s;
}

.game__title-screen.hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.game__logo {
	text-align: center;
	position: relative;
}

.game__logo-star {
	font-size: 48px;
	color: var(--gold);
	text-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
	animation: starPulse 2s ease-in-out infinite;
}

@keyframes starPulse {
	0%, 100% {
		transform: scale(1) rotate(0deg);
	}

	50% {
		transform: scale(1.15) rotate(10deg);
	}
}

.game__title {
	font-family: 'Lilita One', cursive;
	font-size: clamp(42px, 10vw, 72px);
	color: var(--white);
	line-height: 1;
	text-shadow:
		3px 3px 0 var(--pink-hot),
		6px 6px 0 rgba(255, 45, 120, 0.3);
	letter-spacing: -1px;
}

.game__subtitle {
	font-size: clamp(14px, 3vw, 20px);
	color: var(--pink-light);
	font-weight: 700;
	margin-top: 8px;
	letter-spacing: 2px;
	text-transform: uppercase;
}

.game__btn {
	border: none;
	cursor: pointer;
	font-family: 'Lilita One', cursive;
	font-size: 22px;
	letter-spacing: 1px;
	border-radius: 50px;
	padding: 16px 48px;
	transition: transform 0.15s, box-shadow 0.15s;
	position: relative;
	overflow: hidden;
}

.game__btn:active {
	transform: scale(0.95);
}

.game__btn--start, .game__btn--retry {
	background: linear-gradient(135deg, var(--pink-hot), #ff6ba6);
	color: var(--white);
	box-shadow:
		0 4px 20px rgba(255, 45, 120, 0.5),
		0 0 0 3px rgba(255, 255, 255, 0.15),
		inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.game__btn--start:hover, .game__btn--retry:hover {
	transform: translateY(-2px);
	box-shadow:
		0 8px 30px rgba(255, 45, 120, 0.6),
		0 0 0 3px rgba(255, 255, 255, 0.2),
		inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.game__instructions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	text-align: center;
}

.game__instruction {
	color: var(--purple-light);
	font-size: 14px;
	font-weight: 700;
}

.game__instruction kbd {
	display: inline-block;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 6px;
	padding: 2px 8px;
	font-family: 'Quicksand', sans-serif;
	font-size: 13px;
	margin: 0 2px;
}

/* HUD */
.game__hud {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 10;
	display: flex;
	justify-content: space-around;
	padding: 12px 16px;
	background: linear-gradient(180deg, rgba(30, 5, 51, 0.8) 0%, transparent 100%);
	opacity: 0;
	transition: opacity 0.4s;
}

.game__hud.visible {
	opacity: 1;
}

.game__hud-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
}

.game__hud-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 2px;
	color: var(--pink-light);
	font-weight: 700;
}

.game__hud-value {
	font-family: 'Lilita One', cursive;
	font-size: 28px;
	color: var(--white);
	text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.game__hud-value--combo {
	color: var(--gold);
	transition: transform 0.2s;
}

.game__hud-value--combo.bump {
	animation: comboBump 0.3s ease;
}

@keyframes comboBump {
	0% {
		transform: scale(1);
	}

	50% {
		transform: scale(1.4);
	}

	100% {
		transform: scale(1);
	}
}

/* Canvas */
#gameCanvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 5;
}

/* Mobile Controls */
.game__controls {
	position: absolute;
	bottom: 20px;
	left: 0;
	right: 0;
	z-index: 15;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 16px;
	padding: 0 20px;
	opacity: 0;
	transition: opacity 0.4s;
	pointer-events: none;
}

.game__controls.visible {
	opacity: 1;
	pointer-events: auto;
}

.game__ctrl {
	border: none;
	cursor: pointer;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.1s;
	-webkit-tap-highlight-color: transparent;
}

.game__ctrl:active {
	transform: scale(0.9);
}

.game__ctrl--left, .game__ctrl--right {
	width: 64px;
	height: 64px;
	background: rgba(255, 255, 255, 0.12);
	border: 2px solid rgba(255, 255, 255, 0.25);
	color: var(--white);
	backdrop-filter: blur(8px);
}

.game__ctrl--jump {
	width: 72px;
	height: 72px;
	background: linear-gradient(135deg, #06b6d4, #0891b2);
	color: var(--white);
	flex-direction: column;
	gap: 2px;
	box-shadow: 0 4px 25px rgba(6, 182, 212, 0.5);
	border: 2px solid rgba(255, 255, 255, 0.3);
	transition: transform 0.1s, opacity 0.3s, box-shadow 0.3s;
}

.game__ctrl--jump span {
	font-family: 'Lilita One', cursive;
	font-size: 10px;
	letter-spacing: 1px;
}

.game__ctrl--jump.cooldown {
	opacity: 0.4;
	box-shadow: 0 2px 10px rgba(6, 182, 212, 0.2);
	pointer-events: none;
}

.game__ctrl--jump svg {
	width: 22px;
	height: 22px;
}

.game__ctrl--flip {
	width: 88px;
	height: 88px;
	background: linear-gradient(135deg, var(--pink-hot), var(--purple-mid));
	color: var(--white);
	flex-direction: column;
	gap: 2px;
	box-shadow: 0 4px 25px rgba(255, 45, 120, 0.5);
	border: 2px solid rgba(255, 255, 255, 0.3);
}

.game__ctrl--flip span {
	font-family: 'Lilita One', cursive;
	font-size: 11px;
	letter-spacing: 1px;
}

.game__ctrl svg {
	width: 28px;
	height: 28px;
}

.game__ctrl--flip svg {
	width: 24px;
	height: 24px;
}

/* Game Over */
.game__over {
	position: absolute;
	inset: 0;
	z-index: 25;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(30, 5, 51, 0.85);
	backdrop-filter: blur(12px);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.5s, visibility 0.5s;
}

.game__over.visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.game__over-card {
	background: linear-gradient(160deg, #2d1b4e, #1e0533);
	border: 2px solid rgba(168, 85, 247, 0.3);
	border-radius: 24px;
	padding: 40px;
	text-align: center;
	max-width: 340px;
	width: 90%;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.game__over-stars {
	font-size: 40px;
	color: var(--gold);
	text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
	margin-bottom: 12px;
}

.game__over-title {
	font-family: 'Lilita One', cursive;
	font-size: 28px;
	color: var(--white);
	margin-bottom: 20px;
}

.game__over-score {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 16px;
}

.game__over-score span {
	font-size: 13px;
	color: var(--pink-light);
	text-transform: uppercase;
	letter-spacing: 2px;
	font-weight: 700;
}

.game__over-score strong {
	font-family: 'Lilita One', cursive;
	font-size: 52px;
	color: var(--gold);
	text-shadow: 0 2px 20px rgba(251, 191, 36, 0.4);
}

.game__over-msg {
	color: var(--purple-light);
	font-size: 15px;
	font-weight: 700;
	margin-bottom: 24px;
}

/* Particles */
.game__particles {
	position: absolute;
	inset: 0;
	z-index: 12;
	pointer-events: none;
	overflow: hidden;
}

.game__particle {
	position: absolute;
	border-radius: 50%;
	pointer-events: none;
	animation: particleFly 0.8s ease-out forwards;
}

@keyframes particleFly {
	0% {
		opacity: 1;
		transform: translate(0, 0) scale(1);
	}

	100% {
		opacity: 0;
		transform: translate(var(--tx), var(--ty)) scale(0);
	}
}

.game__float-text {
	position: absolute;
	z-index: 13;
	pointer-events: none;
	font-family: 'Lilita One', cursive;
	font-size: 24px;
	color: var(--gold);
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
	animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
	0% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}

	100% {
		opacity: 0;
		transform: translateY(-80px) scale(1.3);
	}
}

@media (min-width: 768px) {
	.game__controls {
		display: none !important;
	}
}

@media (max-width: 767px) {
	.game__instruction kbd {
		display: none;
	}

	.game__instructions {
		gap: 6px;
	}

	.game__instruction:nth-child(1)::before {
		content: 'Swipe or buttons to move';
	}

	.game__instruction:nth-child(1) {
		font-size: 0;
	}

	.game__instruction:nth-child(1)::before {
		font-size: 14px;
	}
}