/* Jelly of Life — poulerik.dk */
:root {
	--bg: #070b14;
	--card: #0a0f1c;
	--ink: #e8eefc;
	--muted: #8b98b8;
	--mint: #34d399;
	--line: rgba(255, 255, 255, 0.09);
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	height: 100%;
}

body {
	font-family:
		"Fredoka", "Baloo 2", ui-rounded, system-ui, -apple-system, "Segoe UI",
		sans-serif;
	background:
		radial-gradient(
			1100px 700px at 12% -10%,
			rgba(52, 211, 153, 0.1),
			transparent 60%
		),
		radial-gradient(
			900px 620px at 92% 112%,
			rgba(167, 139, 250, 0.11),
			transparent 60%
		),
		radial-gradient(
			720px 520px at 72% -4%,
			rgba(34, 211, 238, 0.08),
			transparent 55%
		),
		var(--bg);
	color: var(--ink);
	overflow: hidden;
}

/* ── header (floating overlay) ─────────────────────── */
header {
	position: fixed;
	top: 26px;
	left: 0;
	right: 0;
	z-index: 10;
	text-align: center;
	pointer-events: none; /* painting works “through” the title */
}

.brand {
	position: absolute;
	top: -6px;
	left: 0;
	font-size: 0.85rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
	text-decoration: none;
	padding: 6px 12px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.03);
	transition:
		color 150ms,
		border-color 150ms;
}
.brand:hover {
	color: var(--mint);
	border-color: rgba(52, 211, 153, 0.4);
}

h1 {
	margin: 0;
	font-size: clamp(2.4rem, 6.5vw, 3.8rem);
	font-weight: 700;
	letter-spacing: 0.01em;
	background: linear-gradient(
		90deg,
		#34d399,
		#22d3ee,
		#a78bfa,
		#f472b6,
		#34d399
	);
	background-size: 300% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	animation: shimmer 10s linear infinite;
	filter: drop-shadow(0 3px 16px rgba(52, 211, 153, 0.22));
}
@keyframes shimmer {
	to {
		background-position: 300% 0;
	}
}

.tagline {
	color: var(--muted);
	font-size: clamp(1.15rem, 3vw, 1.45rem);
	font-weight: 500;
	letter-spacing: 0.04em;
	margin: 12px 0 0;
}

/* ── stage: fullscreen canvas ──────────────────────── */
.stage {
	position: fixed;
	inset: 0;
	z-index: 0;
}

/* one game per visit — the boot loader adds .active */
.game {
	display: none;
}
.game.active {
	display: block;
}

canvas {
	width: 100%;
	height: 100%;
	display: block;
	cursor: crosshair;
	touch-action: none;
	background: var(--card);
	box-shadow: inset 0 0 160px rgba(0, 0, 0, 0.4); /* soft vignette */
}

/* screensaver canvas: no crosshair, click anywhere for a new scene */
#pixel {
	cursor: default;
	box-shadow: none;
}

/* on the screensaver page there are no floating controls — lower the hint */
body:not([data-game]) .hint {
	bottom: 84px;
}

/* ── summon input (scribblenauts) ──────────────────── */
.summon {
	position: fixed;
	bottom: 26px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	background: rgba(10, 15, 28, 0.55);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1px solid var(--line);
	border-radius: 999px;
	box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
	transition:
		border-color 180ms,
		box-shadow 180ms;
}
.summon:focus-within {
	border-color: rgba(52, 211, 153, 0.5);
	box-shadow:
		0 0 0 3px rgba(52, 211, 153, 0.15),
		0 10px 30px -12px rgba(0, 0, 0, 0.7);
}
.summon-k {
	color: var(--muted);
	font-size: 0.85rem;
}
#summon-input {
	font: inherit;
	font-size: 0.95rem;
	color: var(--ink);
	background: transparent;
	border: none;
	outline: none;
	width: 200px;
}
#summon-input::placeholder {
	color: var(--muted);
}

.hint {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 118px; /* above the floating controls */
	margin: 0;
	text-align: center;
	pointer-events: none;
	color: var(--muted);
	font-size: 0.88rem;
	text-shadow: 0 1px 10px rgba(0, 0, 0, 0.9);
	transition: opacity 0.8s ease;
}
.hint.hidden {
	opacity: 0;
}

/* ── controls (floating glass pill) ────────────────── */
.controls {
	position: fixed;
	bottom: 22px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: max-content;
	max-width: min(94vw, 1000px);
	padding: 10px 16px;
	background: rgba(10, 15, 28, 0.55);
	backdrop-filter: blur(14px) saturate(1.3);
	-webkit-backdrop-filter: blur(14px) saturate(1.3);
	border: 1px solid var(--line);
	border-radius: 999px;
	box-shadow: 0 14px 36px -14px rgba(0, 0, 0, 0.8);
}

.jelly-btn {
	font: inherit;
	font-size: 0.95rem;
	font-weight: 500;
	color: var(--ink);
	padding: 9px 18px;
	border-radius: 999px;
	cursor: pointer;
	background: linear-gradient(180deg, #1a2440, #131c33);
	border: 1px solid var(--line);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.06),
		0 6px 18px -8px rgba(0, 0, 0, 0.7);
	transition:
		transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1),
		box-shadow 220ms ease,
		filter 160ms ease;
}
.jelly-btn:hover {
	filter: brightness(1.18);
}
.jelly-btn:active {
	transform: scale(0.88);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.jelly-btn:focus-visible {
	outline: 2px solid var(--mint);
	outline-offset: 3px;
}

.jelly-btn.primary {
	background: linear-gradient(180deg, #34d399, #10b981);
	color: #04241a;
	border-color: rgba(255, 255, 255, 0.28);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.35),
		0 8px 22px -10px rgba(16, 185, 129, 0.55);
}

.divider {
	width: 1px;
	height: 24px;
	background: var(--line);
}

.speed {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--muted);
	font-size: 0.9rem;
	margin-left: 4px;
}
.speed #speed-val {
	color: var(--ink);
	font-variant-numeric: tabular-nums;
	min-width: 3.2em;
	text-align: right;
}
input[type="range"] {
	accent-color: var(--mint);
	width: 118px;
	cursor: pointer;
}

.stats {
	margin-left: auto;
	color: var(--muted);
	font-size: 0.9rem;
	font-variant-numeric: tabular-nums;
	padding: 8px 14px;
	border: 1px dashed rgba(255, 255, 255, 0.12);
	border-radius: 999px;
}

/* ── footer (floating, bottom-left) ────────────────── */
footer {
	position: fixed;
	bottom: 22px;
	left: 26px;
	z-index: 10;
	color: var(--muted);
	font-size: 0.85rem;
	display: flex;
	gap: 16px;
	align-items: center;
	pointer-events: none;
}
footer a {
	pointer-events: auto;
	color: var(--muted);
	text-decoration: none;
	border-bottom: 1px dashed rgba(255, 255, 255, 0.25);
	transition: color 150ms;
}
footer a:hover {
	color: var(--mint);
	border-color: rgba(52, 211, 153, 0.5);
}

/* ── score pill (synthwave game) ───────────────────── */
.pill {
	position: fixed;
	top: 26px;
	right: 26px;
	z-index: 10;
	color: #9fe8ff;
	font-size: 1.1rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	padding: 8px 16px;
	border: 1px solid rgba(255, 42, 109, 0.35);
	border-radius: 999px;
	background: rgba(10, 15, 28, 0.5);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	box-shadow: 0 0 24px -6px rgba(255, 42, 109, 0.45);
	pointer-events: none;
}

/* ── wolf touch controls (fire button, coarse pointers) ── */
.wolf-controls {
	display: none;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 10;
	justify-content: flex-end;
	align-items: flex-end;
	padding: 0 20px 26px;
	pointer-events: none;
}
.wolf-controls > * {
	pointer-events: auto;
}
.fire-btn {
	font: 700 1.05rem "Fredoka", system-ui, sans-serif;
	color: #fff;
	width: 88px;
	height: 88px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.35);
	background: radial-gradient(circle at 35% 30%, #ff7a5e, #d43a2a 70%);
	box-shadow: 0 10px 30px -8px rgba(212, 58, 42, 0.6);
	cursor: pointer;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	transition: transform 120ms;
}
.fire-btn:active {
	transform: scale(0.92);
}
@media (pointer: coarse) {
	.wolf-controls {
		display: flex;
	}
	footer {
		display: none;
	}
}

/* ── small screens ──────────────────────────────────── */
@media (max-width: 640px) {
	.controls {
		bottom: 14px;
		padding: 8px 12px;
	}
	.stats {
		margin-left: 0;
	}
	.divider {
		display: none;
	}
	footer {
		display: none;
	} /* keep the canvas clean on phones */
	.hint {
		bottom: 96px;
	}
	.pill {
		top: 18px;
		right: 14px;
		font-size: 0.95rem;
	}
	.summon {
		bottom: 14px;
		padding: 7px 12px;
	}
	#summon-input {
		width: 150px;
	}
}

/* ── reduced motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	h1 {
		animation: none;
	}
	.jelly-btn {
		transition: none;
	}
	.jelly-btn:active {
		transform: scale(0.96);
	}
}
