/* 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;
	overscroll-behavior: 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], #planet-select[hidden], #offline-result[hidden], #offline-hud[hidden], #chain-indicator[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, #btn-planet-go {
	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), #btn-planet-go: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, #btn-planet-go: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, #btn-planet-go { 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, #btn-planet-go {
	/* 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 h1 {
	font-size: clamp(36px, 9vw, 64px);
}
#online-panel {
	z-index: 5;
	overflow: auto;
	text-align: center;
	padding: 16px 16px 24px;
}
#online-panel .who {
	color: #c5cae0;
	margin: 0 0 8px;
}
#online-lobby .tagline { margin-bottom: 8px; }
#online-lobby .lobby-code { margin: 4px 0 6px; }
#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; }
}

/* Stage 3: planet (field) selection */
#planet-select {
	justify-content: flex-start;
	overflow-y: auto;
	touch-action: pan-y;
	-webkit-overflow-scrolling: touch;
	padding-top: 20px;
	padding-bottom: 32px;
}
#planet-select h1 {
	font-size: clamp(32px, 9vw, 64px);
	margin-bottom: 4px;
}
#planet-select .tagline { margin-bottom: 16px; }
.planet-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 12px;
	width: min(1000px, 100%);
	margin: 0 auto 16px;
	text-align: left;
	touch-action: pan-y;
}
.planet-card {
	appearance: none;
	display: block;
	width: 100%;
	margin: 0;
	padding: 12px 14px 10px;
	border: 1px solid rgba(200, 210, 240, 0.16);
	border-radius: 14px;
	background: rgba(16, 20, 40, 0.72);
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
	touch-action: manipulation;
	transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.planet-card:hover, .planet-card:focus-visible {
	border-color: rgba(255, 226, 122, 0.55);
	outline: none;
}
.planet-card.selected {
	border-color: #ffe27a;
	box-shadow: 0 0 0 2px rgba(255, 226, 122, 0.35), 0 8px 24px rgba(0,0,0,0.35);
	background: rgba(40, 32, 16, 0.78);
}
.planet-card .planet-title {
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: 0.03em;
	color: #fff6c8;
}
.planet-card .planet-people {
	font-size: 0.85rem;
	color: #8e95b3;
	margin: 0 0 6px;
}
.planet-card .planet-nums {
	font-variant-numeric: tabular-nums;
	font-size: 0.78rem;
	color: #c5cae0;
	letter-spacing: 0.01em;
	line-height: 1.35;
	margin: 0 0 8px;
}
.planet-card .planet-swatches {
	display: flex;
	gap: 6px;
	align-items: center;
}
.planet-card .planet-swatches img {
	width: 26px;
	height: 26px;
	image-rendering: auto;
	flex: 0 0 auto;
}
.planet-actions {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	justify-content: center;
	margin-top: 8px;
	flex-shrink: 0;
}
.planet-grid.compact {
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 8px;
	width: min(920px, 92vw);
	min-width: min(920px, 92vw);
	max-height: none;
	overflow: visible;
	touch-action: pan-y;
	margin-bottom: 10px;
	align-self: center;
}
@media (max-width: 720px) {
	.planet-grid.compact {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
.planet-grid.compact .planet-card { padding: 6px 8px; }
.planet-grid.compact .planet-title { font-size: 1rem; }
.planet-grid.compact .planet-nums { font-size: 0.7rem; margin-bottom: 6px; }
.planet-grid.compact .planet-swatches img { width: 20px; height: 20px; }
.lobby-planet-label { margin: 8px 0 6px; }
.player-list .planet-tag {
	display: block;
	font-size: 0.78rem;
	font-weight: 500;
	color: #9aa3c4;
}
#online-lobby {
	overflow-y: auto;
	touch-action: pan-y;
	-webkit-overflow-scrolling: touch;
	justify-content: flex-start;
	padding-top: 8px;
}
@media (max-width: 520px) {
	.planet-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
	.planet-card .planet-nums { font-size: 0.68rem; }
	.planet-card { padding: 10px 8px 8px; }
}

/* t1106: on-screen log for ?debug=drag */
#drag-debug {
	position: fixed;
	left: 6px;
	right: 6px;
	bottom: 6px;
	z-index: 50;
	pointer-events: none;
	background: rgba(8, 10, 22, 0.82);
	color: #c6f6c8;
	font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	padding: 8px 10px;
	border-radius: 6px;
	border: 1px solid #3a6;
	white-space: pre-wrap;
	word-break: break-word;
	max-height: 28vh;
	overflow: hidden;
}


/* ---- Offline Strijd (t1119), chain bonus (t1120), column warn (t1123) ---- */
.hud-offline {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	bottom: 6px;
	font-size: 12px;
	color: #c5cae0;
	white-space: nowrap;
	letter-spacing: 0.02em;
	pointer-events: none;
}
.hud-sep { opacity: 0.55; margin: 0 0.25em; }
#chain-indicator {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	top: 100%;
	margin-top: 4px;
	color: #ffe27a;
	font-weight: 700;
	font-size: 14px;
	text-shadow: 0 1px 4px #000;
	pointer-events: none;
	z-index: 5;
}
#offline-result h2 { color: #ffe27a; }
#minis {
	overflow: auto;
	flex-wrap: wrap;
}
#minis.crowded .mini { min-width: 44px; }
#minis.crowded .mini-canvas {
	width: 56px;
	height: 73px;
}
@media (max-width: 520px) {
	.hud-offline { font-size: 11px; bottom: 4px; }
}
