@font-face { font-family: 'Luckiest Guy'; src: url('assets/fonts/luckiest-guy.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lilita One'; src: url('assets/fonts/lilita-one.woff2') format('woff2'); font-display: swap; }

:root {
	--bg: #0b0318;
	--lime: #9dff2e;
	--pink: #ff3fa4;
	--cyan: #3fe8ff;
	--ink: #fff6e8;
	--dim: #cdbdec;
	--display: 'Luckiest Guy', 'Arial Black', sans-serif;
	--body: 'Lilita One', 'Arial Rounded MT Bold', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
	height: 100%;
	background: var(--bg);
	color: var(--ink);
	overflow: hidden;
	overscroll-behavior: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
}
body { display: flex; align-items: center; justify-content: center; font-family: var(--body); }
img { -webkit-user-drag: none; }
[hidden] { display: none !important; }

/* 390 x 844 logical stage, scaled to fit */
#stage {
	position: relative;
	height: min(100dvh, calc(100vw * 844 / 390));
	aspect-ratio: 390 / 844;
	max-width: 100vw;
	background: #14062b url('assets/art/bg-space.webp') center / cover;
	overflow: hidden;
	container-type: inline-size;
}
@media (min-width: 600px) and (min-height: 600px) {
	#stage { height: min(96dvh, 900px); border-radius: 22px; box-shadow: 0 0 0 3px #2b0f55, 0 0 60px rgba(255, 63, 164, 0.22); }
}
canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible + i, input[type=range]:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

/* square icon buttons (56px minimum) */
.icon { width: 60px; height: 60px; border: 0; background: none; padding: 0; display: grid; place-items: center; }
.icon img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.4)); }
.icon:active img { transform: translateY(2px); }
.icon.off img { opacity: 0.45; filter: grayscale(0.7); }
.pause { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 3; width: 58px; height: 58px; }

/* special: a big round button in the thumb zone with a charge ring */
.special {
	position: absolute;
	right: 14px;
	bottom: calc(18px + env(safe-area-inset-bottom));
	width: 92px;
	height: 92px;
	border: 0;
	border-radius: 50%;
	background: none;
	z-index: 3;
	touch-action: none;
}
.special img { position: absolute; inset: 9px; width: 74px; height: 74px; object-fit: contain; filter: grayscale(0.85) brightness(0.7); transition: filter 0.2s; }
.special .ring {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: conic-gradient(var(--pink) calc(var(--charge, 0) * 1turn), rgba(255, 255, 255, 0.12) 0);
	-webkit-mask: radial-gradient(circle, transparent 38px, #000 39px);
	mask: radial-gradient(circle, transparent 38px, #000 39px);
}
.special.ready img { filter: none; }
.special.ready .ring { background: var(--pink); box-shadow: 0 0 22px var(--pink); animation: ready 0.9s ease-in-out infinite alternate; }
@keyframes ready { to { box-shadow: 0 0 8px var(--pink); } }
.reduced .special.ready .ring { animation: none; }

/* overlays */
.ov {
	position: absolute;
	inset: 0;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
	background: rgba(11, 3, 24, 0.72);
	z-index: 5;
	overflow-y: auto;
	text-align: center;
}
.ov.show { display: flex; }

.panel {
	width: 100%;
	max-width: 358px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 26px 22px 24px;
	border: 22px solid transparent;
	border-image: url('assets/art/ui-panel.webp') 44 fill / 22px / 0 stretch;
	margin: auto 0;
}
h2 {
	font: 32px/1.05 var(--display);
	color: var(--lime);
	text-shadow: 0 3px 0 #1f4d00, 0 0 18px rgba(157, 255, 46, 0.35);
}
h2.over { color: var(--pink); text-shadow: 0 3px 0 #5a0030, 0 0 18px rgba(255, 63, 164, 0.4); }
.sub { font-size: 18px; color: var(--dim); line-height: 1.25; }
.score { font: 54px/1 var(--display); color: var(--ink); text-shadow: 0 4px 0 #2b0f55; }
.stats { font-size: 17px; color: var(--cyan); }

/* chunky junk-metal buttons with live text (blank button art, stretched by border-image) */
.btn {
	width: 100%;
	max-width: 300px;
	min-height: 64px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 8px;
	border: 20px solid transparent;
	border-image: url('assets/art/ui-btn.webp') 58 64 fill / 20px 22px / 0 stretch;
	background: none;
	font: 24px/1 var(--display);
	letter-spacing: 1px;
	color: #fff;
	text-shadow: 0 3px 0 #2a0d4f;
}
.btn.lime { border-image-source: url('assets/art/ui-btn-lime.webp'); color: #17330a; text-shadow: 0 2px 0 rgba(255, 255, 255, 0.45); }
.btn.lime:active { border-image-source: url('assets/art/ui-btn-pressed.webp'); color: #0c1f05; }
.btn:active { transform: translateY(2px); }
.btn.big { min-height: 78px; font-size: 38px; max-width: 320px; }
.btn.ghost { border: 0; border-image: none; min-height: 48px; font: 17px/1 var(--body); color: var(--dim); text-shadow: none; }

/* main menu */
.title { justify-content: flex-start; padding-top: 0; background: transparent; gap: 0; }
.title .hero { width: calc(100% + 32px); margin: 0 -16px; flex: none; max-height: 54%; object-fit: cover; object-position: center top; -webkit-mask: linear-gradient(#000 80%, transparent); mask: linear-gradient(#000 80%, transparent); }
.menu { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; width: 100%; margin-top: -8px; }
.tray { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 4px; }
.bestpill {
	min-width: 132px;
	padding: 6px 14px;
	border-radius: 14px;
	background: #1b0a36;
	border: 3px solid #4b2a85;
	display: flex;
	flex-direction: column;
	line-height: 1;
}
.bestpill small { font: 13px/1 var(--display); color: var(--ink); letter-spacing: 1px; }
.bestpill b { font: 26px/1.1 var(--display); color: var(--cyan); letter-spacing: 1px; font-weight: normal; }
.made { font-size: 13px; color: #9f8cc7; margin-top: 2px; }
.made a { color: inherit; }

/* how to play */
.how { list-style: none; display: flex; flex-direction: column; gap: 10px; text-align: left; width: 100%; }
.how li { display: flex; align-items: center; gap: 12px; font-size: 16px; line-height: 1.2; color: var(--dim); }
.how b { color: var(--ink); font-weight: normal; }
.how img { width: 50px; height: 50px; object-fit: contain; flex: none; }

/* settings */
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; font-size: 19px; text-align: left; }
.setrow small { display: block; font-size: 13px; color: var(--dim); }
.setrow input[type=range] { width: 46%; height: 36px; accent-color: var(--cyan); }
.toggle { position: relative; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle i { flex: none; width: 64px; height: 34px; border-radius: 999px; background: #3a2266; border: 3px solid #1b0a36; position: relative; transition: background 0.15s; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #a99bc9; transition: transform 0.15s, background 0.15s; }
.toggle input:checked + i { background: #2f7a12; }
.toggle input:checked + i::after { transform: translateX(30px); background: var(--lime); }

@media (prefers-reduced-motion: reduce) { .toggle i, .toggle i::after, .special img { transition: none; } }
