:root {
	--bg: #030609;        /* deep space blue-black */
	--accent: #7de8ff;    /* electric cyan - costs and hover only */
	--text-dim: #7a93a6;  /* muted steel, readable */
	--text: #e8f6fd;      /* ice white */
	--rule: rgba(160, 190, 205, 0.22);  /* neutral hairline */
}

body {
	overflow: hidden;
	width: 100vw;
	height: 100vh;
	background: var(--bg);
	font-family: "Segoe UI Variable Display", "Segoe UI Light", "Segoe UI",
		system-ui, -apple-system, sans-serif;
}

/* The one canvas: GL draws star + particles, and takes the clicks */
#starCanvas {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
}

/* HUD floats above the canvas and never blocks clicks */
.hud {
	position: fixed;
	inset: 0;
	z-index: 2;
	pointer-events: none;
}

/* Dark halo, not glow: legibility over the swarm, the star keeps
   every photon of cyan */
.hud-value,
.stats-line,
.shop-item {
	text-shadow: 0 0 14px rgba(3, 6, 9, 0.9);
}

/* Lifetime stats: a quiet micro-line under the counter */
.stats-line {
	display: block;
	margin-top: 14px;
	font-size: 12px;
	font-weight: 300;
	color: var(--text);
	opacity: 0.6;
	letter-spacing: 0.08em;
	font-variant-numeric: tabular-nums;
}

.net-worth {
	position: absolute;
	top: 30px;
	left: 50%;
	transform: translateX(-50%);
	text-align: center;
}

.hud-label {
	display: block;
	font-size: 12px;
	letter-spacing: 0.6em;
	text-transform: uppercase;
	color: var(--text-dim);
	margin-bottom: 10px;
	/* the trailing letterspace pads the centering - take it back */
	padding-left: 0.6em;
}

.hud-value {
	display: block;
	font-size: 48px;
	font-weight: 200;
	color: var(--text);
	font-variant-numeric: tabular-nums;
	line-height: 1;
}

/* Shop: a rail hugging the left edge, always visible, and a body
   that slides out from behind it. The rail owns the toggle; the
   body owns the list. The HUD lets clicks through except these. */
.shop {
	position: absolute;
	top: 50%;
	left: 0;
	transform: translateY(-50%);
	display: flex;
	flex-direction: row;
	align-items: center;
	pointer-events: none;
}

/* The rail: a vertical UPGRADES word between two ticks, arrow
   above. It never moves - the body slides from behind it. */
.shop-toggle {
	position: relative;
	z-index: 1;            /* the body slides UNDER the rail */
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	background: none;
	border: none;
	color: var(--text-dim);
	font-family: inherit;
	font-size: 12px;
	letter-spacing: 0.5em;
	text-transform: uppercase;
	padding: 16px 12px;
	cursor: pointer;
	pointer-events: auto;
	transition: color 0.15s;
}

.shop-toggle:hover {
	color: var(--accent);
}

.shop-toggle::before,
.shop-toggle::after {
	content: '';
	width: 1px;
	height: 48px;
	background: var(--rule);
}

.tab-word {
	writing-mode: vertical-rl;
	padding-top: 0.5em;  /* trailing-letterspace correction, rotated */
	font-size: 12px;
	color: var(--text);
	text-shadow: 0 0 14px rgba(3, 6, 9, 0.9);
}

/* › slides the body out; spins to ‹ to slide it back */
.tab-arrow {
	letter-spacing: 0;
	font-size: 11px;
	line-height: 1;
	transition: transform 0.25s ease;
}

.tab-arrow::before {
	content: '›';
}

.shop.open .tab-arrow {
	transform: rotate(180deg);
}

/* The body: a Swiss table - name and level left, cost right,
   hairline under each entry. Slides horizontally out from behind
   the rail; grows with the catalog and scrolls past its cap on a
   4px hairline scrollbar. */
.shop-items {
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 300px;
	max-height: min(56vh, 480px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 6px 8px 4px 24px;  /* left pad = the gap behind the rail */
	border-top: 1px solid var(--rule);
	scrollbar-width: thin;
	scrollbar-color: var(--rule) transparent;

	transform: translateX(-100%);
	opacity: 0;
	pointer-events: none;
	transition:
		transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
		opacity 0.3s ease;
}

.shop.open .shop-items {
	transform: translateX(0);
	opacity: 1;
	pointer-events: auto;
}

.shop-items::-webkit-scrollbar {
	width: 4px;
}

.shop-items::-webkit-scrollbar-thumb {
	background: var(--rule);
}

.shop-items::-webkit-scrollbar-track {
	background: transparent;
}

.shop-item {
	display: grid;
	grid-template-columns: 1fr auto;
	grid-template-areas:
		"name cost"
		"level cost"
		"desc desc";
	align-items: center;
	column-gap: 32px;
	row-gap: 3px;
	padding: 9px 2px 10px;
	background: none;
	border: none;
	border-bottom: 1px solid var(--rule);
	color: var(--text);
	font-family: inherit;
	cursor: pointer;
	text-align: left;
	transition: color 0.15s;
}

.shop-item-name {
	grid-area: name;
	font-size: 14px;
	font-weight: 300;
	letter-spacing: 0.02em;
	transition: color 0.15s;
}

.shop-item-level {
	grid-area: level;
	font-size: 12px;
	letter-spacing: 0.25em;
	text-transform: uppercase;
	color: var(--text-dim);
}

.shop-item-cost {
	grid-area: cost;
	font-size: 14px;
	font-weight: 300;
	color: var(--accent);
	font-variant-numeric: tabular-nums;
}

.shop-item-desc {
	grid-area: desc;
	font-size: 12px;
	font-weight: 300;
	color: var(--text);
	opacity: 0.72;  /* tertiary info: above dim, below the name */
	letter-spacing: 0.02em;
	line-height: 1.5;
}

/* Purchase answer: the row flashes accent, a denial shivers */
.shop-item.flash {
	animation: buy-flash 0.45s ease-out;
}

@keyframes buy-flash {
	0% { color: var(--accent); }
	100% { color: var(--text); }
}

.shop-item.deny {
	animation: deny-shake 0.3s ease;
}

@keyframes deny-shake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-3px); }
	75% { transform: translateX(3px); }
}

.shop-item:not(.unaffordable):hover .shop-item-name {
	color: var(--accent);
}

/* Too poor to buy: dimmed, but the price stays legible */
.shop-item.unaffordable {
	opacity: 0.35;
	cursor: default;
}

/* Restart: micro text, top-right, no border */
.restart {
	position: absolute;
	top: 30px;
	right: 30px;
	background: none;
	border: none;
	color: var(--text-dim);
	font-family: inherit;
	font-size: 12px;
	letter-spacing: 0.45em;
	text-transform: uppercase;
	padding: 8px 0 8px 0.45em;  /* trailing-letterspace correction */
	cursor: pointer;
	pointer-events: auto;
	transition: color 0.15s;
}

.restart:hover {
	color: var(--accent);
}

/* Onboarding: pure type over a dimmed star, one click dismisses.
   Fresh saves only - returning players never see it. */
.onboard {
	position: fixed;
	inset: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 28px;
	background: radial-gradient(ellipse at center,
		rgba(3, 6, 9, 0.78), rgba(3, 6, 9, 0.30));
	cursor: pointer;
	transition: opacity 0.5s ease;
}

.onboard.hidden {
	opacity: 0;
	pointer-events: none;
}

.onboard-title {
	font-size: 54px;
	font-weight: 200;
	letter-spacing: 0.42em;
	padding-left: 0.42em;  /* trailing-letterspace correction */
	text-transform: uppercase;
	color: var(--text);
}

.onboard-line {
	font-size: 15px;
	font-weight: 300;
	line-height: 1.9;
	letter-spacing: 0.06em;
	text-align: center;
	color: var(--text);
	opacity: 0.78;
}

.onboard-hint {
	margin-top: 18px;
	font-size: 12px;
	letter-spacing: 0.5em;
	padding-left: 0.5em;  /* trailing-letterspace correction */
	text-transform: uppercase;
	color: var(--text);
	animation: onboard-pulse 2.4s ease-in-out infinite;
}

@keyframes onboard-pulse {
	0%, 100% { opacity: 0.55; }
	50% { opacity: 1; }
}

/* Click feedback: the minted mass floats up from the click point.
   difference blending self-adjusts contrast - white over black
   space, near-black over the bright disk. Must stay a body child:
   .hud isolates its descendants from blending */
.float-gain {
	position: fixed;
	mix-blend-mode: difference;
	color: var(--text);
	font-size: 13px;
	font-weight: 300;
	font-variant-numeric: tabular-nums;
	transform: translate(-50%, 0);
	animation: float-rise 0.9s ease-out forwards;
	pointer-events: none;
}

/* A fluctuation rode this click: the jackpot announces itself */
.float-gain.spike {
	font-size: 16px;
	font-weight: 400;
}

@keyframes float-rise {
	0% { opacity: 0; transform: translate(-50%, 0); }
	15% { opacity: 1; }
	100% { opacity: 0; transform: translate(-50%, -46px); }
}

/* ...and the counter answers with a scale-pop */
.hud-value.pulse {
	animation: value-pop 0.3s ease-out;
}

@keyframes value-pop {
	0% { transform: scale(1); }
	30% { transform: scale(1.05); }
	100% { transform: scale(1); }
}
