:root {
	--bg: #02030a;
	--fg: #eef3ff;
	--muted: #8d98b2;
	--card: rgba(15, 20, 37, .54);
	--border: rgba(180, 200, 255, .15);
	--accent: #5b5ef0;
}
[data-theme="light"] {
	--bg: #e8edf4;
	--fg: #172032;
	--muted: #59677c;
	--card: rgba(255, 255, 255, .68);
	--border: rgba(24, 42, 72, .14);
}
* { box-sizing: border-box; margin: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
	background: var(--bg);
	color: var(--fg);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
canvas { position: fixed; inset: 0; width: 100%; height: 100%; }
.header {
	position: fixed;
	z-index: 3;
	top: 0;
	left: 0;
	padding: 24px 32px;
	pointer-events: none;
}
.header h1 { font-size: 28px; letter-spacing: 2px; }
.header p {
	margin-top: 6px;
	color: var(--muted);
	font-size: 14px;
	letter-spacing: 1px;
}
.theme-toggle {
	position: fixed;
	z-index: 4;
	top: 24px;
	right: 32px;
	width: 44px;
	height: 44px;
	border: 1px solid var(--border);
	border-radius: 50%;
	background: var(--card);
	color: var(--fg);
	font-size: 20px;
	cursor: pointer;
	backdrop-filter: blur(12px);
}
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.panel {
	position: fixed;
	z-index: 3;
	left: 32px;
	bottom: 24px;
	max-width: 390px;
	padding: 14px 18px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--card);
	backdrop-filter: blur(12px);
}
.stats { display: flex; gap: 20px; }
.stat { display: grid; text-align: center; }
.stat b { font-size: 16px; }
.stat small, .hint, .credit {
	color: var(--muted);
	font-size: 11px;
	letter-spacing: .8px;
}
.legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--border);
	color: var(--muted);
	font-size: 11px;
}
.dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	margin-right: 4px;
	border-radius: 50%;
}
.hint { margin-top: 8px; }
.credit { margin-top: 5px; }
.label {
	position: fixed;
	z-index: 3;
	padding: 2px 7px;
	border: 1px solid var(--border);
	border-radius: 4px;
	background: var(--card);
	color: var(--fg);
	font-size: 11px;
	pointer-events: none;
	opacity: 0;
	transform: translate(-50%, -150%);
	transition: opacity .2s;
	backdrop-filter: blur(6px);
}
.loading {
	position: fixed;
	inset: 0;
	z-index: 10;
	display: grid;
	place-items: center;
	background: var(--bg);
	color: var(--muted);
	transition: opacity .6s;
}
.loading > div { text-align: center; }
.spinner {
	display: block;
	width: 42px;
	height: 42px;
	margin: 0 auto 14px;
	border: 3px solid var(--border);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
	.header { padding: 16px 20px; }
	.header h1 { font-size: 20px; }
	.header p { font-size: 12px; }
	.theme-toggle { top: 16px; right: 20px; width: 38px; height: 38px; }
	.panel { left: 16px; bottom: 16px; max-width: calc(100% - 32px); padding: 10px 14px; }
	.credit { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.spinner { animation-duration: 3s; }
}
