/* Meteors — responsive, portrait-friendly, no page scroll during play. */
*, *::before, *::after { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #0b1020;
	color: #e8eaf2;
	font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

#stars {
	position: fixed;
	inset: 0;
	pointer-events: none;
	background:
		radial-gradient(1px 1px at 12% 18%, #fff 0 50%, transparent 51%),
		radial-gradient(1px 1px at 28% 72%, #cde 0 50%, transparent 51%),
		radial-gradient(1.5px 1.5px at 47% 32%, #fff 0 50%, transparent 51%),
		radial-gradient(1px 1px at 63% 81%, #bbd 0 50%, transparent 51%),
		radial-gradient(1px 1px at 81% 22%, #fff 0 50%, transparent 51%),
		radial-gradient(1.5px 1.5px at 91% 64%, #def 0 50%, transparent 51%),
		radial-gradient(1px 1px at 8% 88%, #fff 0 50%, transparent 51%),
		radial-gradient(2px 2px at 72% 48%, #89a 0 50%, transparent 51%),
		linear-gradient(180deg, #0b1020 0%, #141a33 55%, #1a1440 100%);
	z-index: 0;
}

.screen {
	position: fixed;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 24px 20px;
	text-align: center;
}

.screen[hidden], #hud[hidden], #game-over[hidden], #online-panel[hidden], #minis[hidden], #spectator[hidden], #podium[hidden], #flights[hidden] { display: none !important; }

h1 {
	font-size: clamp(48px, 14vw, 96px);
	letter-spacing: 0.06em;
	margin: 0 0 8px;
	font-weight: 800;
	background: linear-gradient(180deg, #fff6c8 0%, #ff9a3a 45%, #e85d3a 100%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	filter: drop-shadow(0 2px 12px rgba(232, 93, 58, 0.55));
}

.tagline {
	margin: 0 0 28px;
	font-size: clamp(15px, 3.6vw, 20px);
	color: #c5cae0;
	max-width: 28em;
}

#btn-play {
	appearance: none;
	border: 0;
	cursor: pointer;
	font: inherit;
	font-size: clamp(20px, 5vw, 28px);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #1a1020;
	background: linear-gradient(180deg, #ffe27a, #f0c53a 40%, #e89a20);
	padding: 14px 48px;
	border-radius: 999px;
	box-shadow:
		0 0 0 3px rgba(255, 220, 120, 0.25),
		0 8px 24px rgba(240, 197, 58, 0.45);
	touch-action: manipulation;
	min-height: 52px;
	min-width: 200px;
}

#btn-play:is(:hover, :focus-visible) {
	transform: translateY(-1px);
	box-shadow:
		0 0 0 3px rgba(255, 220, 120, 0.4),
		0 10px 28px rgba(240, 197, 58, 0.6);
}

#btn-play:active { transform: translateY(1px); }

.last-score {
	margin: 22px 0 0;
	font-size: clamp(16px, 4vw, 22px);
	color: #ffe27a;
}

.hint {
	margin: 36px auto 0;
	max-width: 32em;
	font-size: clamp(13px, 3.2vw, 16px);
	line-height: 1.45;
	color: #8e95b3;
}

#hud {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 4;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 4px;
	pointer-events: none;
	text-shadow: 0 1px 4px #000;
	gap: 12px;
}

.hud-label {
	font-size: 11px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #9aa3c2;
}

#score {
	font-size: clamp(28px, 8vw, 42px);
	font-weight: 800;
	line-height: 1;
	color: #fff6c8;
}

#planet-name {
	font-weight: 700;
	font-size: clamp(14px, 3.5vw, 18px);
	text-align: right;
}

#planet-stats {
	font-variant-numeric: tabular-nums;
	font-size: clamp(11px, 2.8vw, 14px);
	color: #b7bdd4;
	text-align: right;
	white-space: nowrap;
}

.overlay {
	background: rgba(8, 10, 22, 0.78);
	backdrop-filter: blur(6px);
}

.overlay h2 {
	font-size: clamp(32px, 9vw, 56px);
	margin: 0 0 8px;
	color: #ffb0a0;
}

.go-score {
	font-size: clamp(20px, 5vw, 28px);
	color: #ffe27a;
	margin-top: 18px;
}

/* Framework canvases sit on the body. Keep them above the starfield, below HUD. */
canvas {
	z-index: 2;
	touch-action: none;
	display: block;
}

/* Very narrow / short phones: shrink hints so the Play button stays on screen. */
@media (max-height: 520px) {
	.hint { display: none; }
	h1 { font-size: 42px; }
	#btn-play { padding: 10px 36px; }
}


/* ---- Stage 2: online, lobby, miniatures, flights, podium ---- */

#btn-online, .btn-secondary, a.button {
	margin-top: 12px;
	padding: 10px 36px;
	font-size: clamp(16px, 4vw, 20px);
	border: 1px solid #6a7394;
	border-radius: 999px;
	color: #e8eaf2;
	background: linear-gradient(180deg, #2a3150, #1b2038);
	cursor: pointer;
	text-decoration: none;
	display: inline-block;
	font-family: inherit;
}
#btn-online:is(:hover, :focus-visible),
.btn-secondary:is(:hover, :focus-visible),
a.button:is(:hover, :focus-visible) {
	border-color: #ffe27a;
	color: #fff6c8;
}
#btn-create, #btn-join, #btn-ready, #btn-start, #btn-spectate,
#btn-play {
	/* play already styled */
}

#btn-create, #btn-join, #btn-ready, #btn-start, #btn-spectate {
	padding: 10px 28px;
	font-size: clamp(16px, 4vw, 20px);
	border: 0;
	border-radius: 999px;
	color: #1a1020;
	background: linear-gradient(180deg, #ffe27a, #f0c53a 40%, #e89a20);
	cursor: pointer;
	font-weight: 700;
	font-family: inherit;
}
#btn-start:disabled, #btn-ready:disabled {
	opacity: 0.45;
	cursor: default;
}

#online-panel {
	z-index: 5;
	overflow: auto;
	text-align: center;
	padding: 32px 16px 48px;
}
#online-panel .who {
	color: #c5cae0;
	margin: 0 0 16px;
}
#online-panel .notice {
	max-width: 36em;
	margin: 0 auto 16px;
	text-align: left;
	line-height: 1.45;
	color: #c5cae0;
}
#online-panel code {
	font-size: 0.92em;
	color: #ffe27a;
}
#online-panel a { color: #9ec5ff; }
.error {
	color: #ffb0a0;
	margin: 8px 0;
}
.notice {
	background: rgba(20, 24, 48, 0.7);
	border: 1px solid #3a4268;
	border-radius: 12px;
	padding: 14px 16px;
}
.join-form {
	display: flex;
	gap: 8px;
	justify-content: center;
	align-items: flex-end;
	flex-wrap: wrap;
	margin: 16px 0;
}
.join-form label {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	font-size: 13px;
	color: #9aa3c2;
}
.join-form input {
	font-size: 22px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	width: 8em;
	padding: 8px 10px;
	border-radius: 8px;
	border: 1px solid #6a7394;
	background: #141a33;
	color: #fff6c8;
	font-family: inherit;
	text-align: center;
}
.lobby-code {
	font-size: clamp(22px, 6vw, 34px);
	margin: 8px 0 16px;
	color: #ffe27a;
}
.btn-tiny {
	font-size: 13px;
	padding: 4px 10px;
	margin-left: 8px;
	border-radius: 999px;
	border: 1px solid #6a7394;
	background: #1b2038;
	color: #e8eaf2;
	cursor: pointer;
	font-family: inherit;
	letter-spacing: 0;
	vertical-align: middle;
}
.player-list {
	list-style: none;
	padding: 0;
	margin: 0 auto 18px;
	max-width: 22em;
	text-align: left;
}
.player-list li {
	display: flex;
	justify-content: space-between;
	padding: 8px 12px;
	border-bottom: 1px solid #2a3150;
	color: #e8eaf2;
}
.player-list .ready { color: #8eec9a; }
.player-list .waiting { color: #8e95b3; }
.player-list .you { font-weight: 700; }
.lobby-actions {
	display: flex;
	gap: 10px;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 12px;
}

#minis {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 4;
	display: flex;
	gap: 10px;
	justify-content: center;
	align-items: flex-end;
	flex-wrap: wrap;
	padding: 6px 8px 0;
	pointer-events: none;
}
.mini {
	text-align: center;
	color: #c5cae0;
	font-size: 11px;
	min-width: 72px;
}
.mini-name {
	max-width: 90px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 700;
}
.mini-canvas {
	display: block;
	width: 80px;
	height: 104px;
	background: #0c1020;
	border: 1px solid #2a3150;
	border-radius: 4px;
	image-rendering: pixelated;
}
.mini.eliminated { opacity: 0.45; }
.mini.eliminated .mini-meta { color: #ffb0a0; }

#flights {
	position: fixed;
	inset: 0;
	z-index: 6;
	pointer-events: none;
	overflow: visible;
}
#flights .flight {
	position: fixed;
	top: 0;
	left: 0;
	width: 40px;
	height: 40px;
	will-change: transform;
	pointer-events: none;
}

#spectator h2, #podium h2 {
	color: #ffe27a;
}
.podium-list {
	list-style: none;
	padding: 0;
	margin: 16px auto;
	max-width: 16em;
	font-size: clamp(20px, 5vw, 28px);
}
.podium-list li {
	padding: 6px 0;
	color: #e8eaf2;
}
.podium-list li:first-child { color: #ffe27a; font-size: 1.2em; font-weight: 700; }
.podium-list li:nth-child(2) { color: #d0d6ea; }
.podium-list li:nth-child(3) { color: #e0a878; }

@media (max-height: 520px) {
	#online-panel .hint, #online-panel .tagline { display: block; }
	.mini-canvas { width: 56px; height: 73px; }
}
