/* ============================================================================
   main.css - Orb•Fall: ChromaCrush
   ============================================================================
   Copyright (c) 2025 G. Scott Tomlin. All Rights Reserved.
   ============================================================================ */

/* Import Shared Variables */
@import url('shared-variables.css');

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: var(--font-family);
	background: var(--color-bg);
	color: #ffffff;
	overflow: clip; /* clips scroll without clipping position:fixed children */
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	padding-bottom: env(safe-area-inset-bottom);
}

/* Remove decorative hash pattern if present */
body::before,
body::after {
	display: none !important;
}

#app {
	width: 100%;
	max-width: 1200px;
	height: 100vh;
	position: relative;
}

/* ============================================
   Weather Background
   ============================================ */
.weather-background {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
	transition: background 2s ease, opacity 2s ease;
	overflow: hidden;
}

.weather-effects {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

/* Day backgrounds */
.weather-background.day.clear {
	background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.weather-background.day.cloudy {
	background: var(--gradient-primary);
}

.weather-background.day.rainy {
	background: linear-gradient(135deg, #5f72bd 0%, #9b23ea 100%);
}

.weather-background.day.snowy {
	background: linear-gradient(135deg, #e0e0e0 0%, #a5c9ff 100%);
}

.weather-background.day.stormy {
	background: linear-gradient(135deg, #434343 0%, #000000 100%);
}

.weather-background.day.foggy {
	background: linear-gradient(135deg, #bdc3c7 0%, #8e9eab 100%);
}

/* Night backgrounds */
.weather-background.night.clear {
	background: linear-gradient(135deg, var(--color-surface-dark) 0%, #16213e 50%, #0f3460 100%);
}

.weather-background.night.cloudy {
	background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.weather-background.night.rainy {
	background: linear-gradient(135deg, #141e30 0%, #243b55 100%);
}

.weather-background.night.snowy {
	background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.weather-background.night.stormy {
	background: linear-gradient(135deg, #000000 0%, #2c3e50 100%);
}

.weather-background.night.foggy {
	background: linear-gradient(135deg, #232526 0%, #414345 100%);
}

/* Sun */
.weather-sun {
	position: absolute;
	top: 10%;
	right: 15%;
	width: 100px;
	height: 100px;
	background: radial-gradient(circle, var(--color-gold) 0%, #ffed4e 50%, transparent 70%);
	border-radius: 50%;
	box-shadow: 0 0 60px var(--color-gold), 0 0 100px #ffed4e;
	animation: sunPulse 4s ease-in-out infinite;
}

@keyframes sunPulse {
	0%, 100% { transform: scale(1); opacity: 0.9; }
	50% { transform: scale(1.1); opacity: 1; }
}

/* Moon */
.weather-moon {
	position: absolute;
	top: 10%;
	right: 15%;
	width: 80px;
	height: 80px;
	/* Phase shape is drawn directly on a <canvas> — no background/border-radius needed */
	animation: moonGlow 6s ease-in-out infinite;
}

@keyframes moonGlow {
	/* Use filter:drop-shadow so the glow follows the canvas drawing, not the element box */
	0%, 100% { filter: drop-shadow(0 0 6px  rgba(240, 240, 200, 0.45)); }
	50%      { filter: drop-shadow(0 0 18px rgba(240, 240, 200, 0.8));  }
}

/* Stars */
.weather-star {
	position: absolute;
	width: 2px;
	height: 2px;
	background: white;
	border-radius: 50%;
	box-shadow: 0 0 3px white;
	animation: starTwinkle 3s ease-in-out infinite;
}

@keyframes starTwinkle {
	0%, 100% { opacity: 0.3; transform: scale(1); }
	50% { opacity: 1; transform: scale(1.5); }
}

/* Clouds */
.weather-cloud {
	position: absolute;
	width: 200px;
	height: 60px;
	background: white;
	border-radius: 100px;
	opacity: 0.6;
	animation: cloudFloat 60s linear infinite;
}

.weather-cloud::before {
	content: '';
	position: absolute;
	width: 100px;
	height: 80px;
	background: white;
	border-radius: 100px;
	top: -40px;
	left: 20px;
}

.weather-cloud::after {
	content: '';
	position: absolute;
	width: 120px;
	height: 70px;
	background: white;
	border-radius: 100px;
	top: -30px;
	right: 20px;
}

@keyframes cloudFloat {
	0% { transform: translateX(-200px); }
	100% { transform: translateX(calc(100vw + 200px)); }
}

/* Rain */
.weather-rain {
	position: absolute;
	width: 2px;
	height: 20px;
	background: linear-gradient(transparent, rgba(255, 255, 255, 0.6));
	top: -20px;
	animation: rainFall 0.8s linear infinite;
}

@keyframes rainFall {
	0% { transform: translateY(-20px); opacity: 1; }
	100% { transform: translateY(100vh); opacity: 0.3; }
}

/* Snow */
.weather-snow {
	position: absolute;
	color: white;
	top: -20px;
	animation: snowFall 5s linear infinite;
	text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
	user-select: none;
}

@keyframes snowFall {
	0% { 
		transform: translateY(-20px) rotate(0deg);
		opacity: 1;
	}
	100% { 
		transform: translateY(100vh) rotate(360deg);
		opacity: 0.5;
	}
}

/* Lightning */
.weather-lightning {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(255, 255, 255, 0);
	animation: lightning 10s ease-in-out infinite;
}

@keyframes lightning {
	0%, 100% { background: rgba(255, 255, 255, 0); }
	45%, 55% { background: rgba(255, 255, 255, 0); }
	48%, 52% { background: rgba(255, 255, 255, 0.8); }
	50% { background: rgba(255, 255, 255, 0.95); }
}

/* Fog */
.weather-fog {
	position: absolute;
	width: 100%;
	height: 100%;
	background: radial-gradient(ellipse at center, rgba(200, 200, 200, 0.15) 0%, transparent 70%);
	filter: blur(40px);
	opacity: 0;
	animation: fogPulse 20s ease-in-out infinite;
}

.weather-fog:nth-child(1) {
	animation-delay: 0s;
}

.weather-fog:nth-child(2) {
	animation-delay: 7s;
	background: radial-gradient(ellipse at 30% 50%, rgba(220, 220, 220, 0.12) 0%, transparent 65%);
}

.weather-fog:nth-child(3) {
	animation-delay: 14s;
	background: radial-gradient(ellipse at 70% 60%, rgba(210, 210, 210, 0.18) 0%, transparent 60%);
}

@keyframes fogPulse {
	0%, 100% { opacity: 0; transform: scale(1) translateY(0); }
	50% { opacity: 1; transform: scale(1.2) translateY(-20px); }
}

/* Add subtle animation */
.weather-background::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: radial-gradient(circle at 50% 50%, transparent 0%, rgba(0, 0, 0, 0.2) 100%);
	animation: pulseBackground 10s ease-in-out infinite;
}

@keyframes pulseBackground {
	0%, 100% { opacity: 0.5; }
	50% { opacity: 0.8; }
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
	display: none !important;
}

.screen {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

#menuScreen {
	position: relative;
	padding-top: 5.5rem;
}

.menu-top-bar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.4rem;
	padding: 0.35rem 0.6rem;
	z-index: 8;
}

.menu-top-bar-right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.3rem;
}

.menu-top-bar-row {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.player-pill-container {
	position: relative;
	z-index: 8;
}

.player-pill-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.35rem 0.75rem;
	border-radius: 999px;
	border: 1px solid rgba(var(--color-game-green-rgb), 0.55);
	background: rgba(10, 36, 30, 0.78);
	backdrop-filter: blur(6px);
	color: #eafff4;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	cursor: pointer;
	box-shadow: 0 0 14px rgba(var(--color-game-green-rgb), 0.2);
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.player-pill-toggle:hover {
	transform: translateY(-1px);
	border-color: rgba(var(--color-game-green-rgb), 0.9);
	box-shadow: 0 0 18px rgba(var(--color-game-green-rgb), 0.32);
}

.player-pill-label {
	color: #c7ffe6;
	opacity: 0.9;
}

.player-pill-name {
	color: #ffffff;
	max-width: 140px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	text-transform: none;
	letter-spacing: 0;
}

.player-pill-caret {
	font-size: 0.7rem;
	color: #9ae5c7;
}

.player-pill-menu {
	position: absolute;
	top: calc(100% + 0.35rem);
	left: 0;
	width: 255px;
	max-height: 320px;
	overflow-y: auto;
	padding: 0.45rem;
	border-radius: 12px;
	border: 1px solid rgba(var(--color-game-green-rgb), 0.42);
	background: rgba(12, 18, 34, 0.95);
	backdrop-filter: blur(8px);
	box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35), 0 0 16px rgba(var(--color-game-green-rgb), 0.18);
}

.player-menu-list {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin-bottom: 0.45rem;
}

.player-menu-item {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.2rem;
	border-radius: 8px;
	background: rgba(35, 41, 66, 0.45);
}

.player-menu-item.active {
	background: rgba(var(--color-game-green-rgb), 0.2);
	border: 1px solid rgba(var(--color-game-green-rgb), 0.38);
}

.player-menu-switch {
	flex: 1;
	text-align: left;
	padding: 0.35rem 0.45rem;
	font-size: 0.82rem;
	border: none;
	border-radius: 6px;
	background: transparent;
	color: #ffffff;
	cursor: pointer;
}

.player-menu-switch:hover {
	background: rgba(255, 255, 255, 0.08);
}

.player-menu-item.active .player-menu-switch {
	font-weight: 700;
}

.player-menu-delete {
	width: 1.7rem;
	height: 1.7rem;
	border: 1px solid rgba(255, 100, 100, 0.45);
	border-radius: 50%;
	background: rgba(80, 18, 18, 0.55);
	color: #ffd5d5;
	font-size: 0.75rem;
	line-height: 1;
	cursor: pointer;
	flex-shrink: 0;
}

.player-menu-delete:hover {
	border-color: rgba(255, 120, 120, 0.85);
	background: rgba(120, 26, 26, 0.7);
}

.player-menu-add {
	width: 100%;
	padding: 0.45rem 0.55rem;
	border: 1px solid rgba(var(--color-game-green-rgb), 0.5);
	border-radius: 8px;
	background: rgba(8, 52, 40, 0.62);
	color: #d6fff0;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	cursor: pointer;
	text-transform: uppercase;
}

.player-menu-add:hover {
	border-color: rgba(var(--color-game-green-rgb), 0.9);
	background: rgba(14, 72, 54, 0.82);
}

.menu-top-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.35rem 0.9rem;
	border-radius: 999px;
	border: 1px solid rgba(var(--color-game-green-rgb), 0.55);
	background: rgba(10, 36, 30, 0.72);
	backdrop-filter: blur(6px);
	color: #c7ffe6;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	box-shadow: 0 0 14px rgba(var(--color-game-green-rgb), 0.2);
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.menu-discord-pill {
	border-color: rgba(88, 166, 255, 0.75);
	background: rgba(22, 35, 64, 0.78);
	color: #d9e8ff;
	box-shadow: 0 0 14px rgba(88, 166, 255, 0.26);
}

.menu-top-pill:hover {
	transform: translateY(-1px);
	border-color: rgba(var(--color-game-green-rgb), 0.9);
	box-shadow: 0 0 18px rgba(var(--color-game-green-rgb), 0.32);
}

.menu-discord-pill:hover {
	border-color: rgba(125, 190, 255, 0.95);
	box-shadow: 0 0 18px rgba(88, 166, 255, 0.4);
}

/* ============================================
   Menu Screen
   ============================================ */
.menu-container {
	text-align: center;
	padding: 0.5rem;
	max-height: 100vh;
	overflow-y: auto;
	margin: 0 auto;
}

.game-logo {
	width: min(80%, 340px);
	max-width: 340px;
	max-height: min(22vh, 240px);
	height: auto;
	object-fit: contain;
	margin: 0 auto 0.5rem;
	display: block;
	filter: drop-shadow(0 0 20px rgba(var(--color-game-green-rgb), 0.4));
	transition: transform 0.3s ease, filter 0.3s ease;
}

.game-logo:hover {
	transform: scale(1.05);
	filter: drop-shadow(0 0 30px rgba(var(--color-game-green-rgb), 0.6));
}

.menu-container h1 {
	font-size: 3rem;
	margin-bottom: 2rem;
	background: linear-gradient(135deg, var(--color-game-green), var(--color-cyan));
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: none;
	filter: drop-shadow(0 0 10px rgba(var(--color-game-green-rgb), 0.5));
}

.menu-container h2 {
	font-size: 1.3rem;
	margin: 0.25rem 0 0.25rem;
	color: #ffffff;
}

.menu-container h3 {
	font-size: 1.2rem;
	margin: 1rem 0 0.5rem;
	color: var(--color-text-muted);
}

/* Difficulty Selector */
.difficulty-buttons {
	display: flex;
	gap: 0.75rem;
	justify-content: center;
	flex-wrap: wrap;
	margin-bottom: 0.5rem;
}

.difficulty-btn {
	padding: 0.4rem 0.9rem;
	font-size: 0.85rem;
	border: 2px solid var(--color-border);
	background: linear-gradient(135deg, var(--color-surface), var(--color-surface-mid));
	color: #ffffff;
	cursor: pointer;
	transition: all 0.3s ease;
	border-radius: 5px;
}

.difficulty-btn:hover {
	background: linear-gradient(135deg, var(--color-surface-hover), var(--color-surface-hover-dark));
	border-color: var(--color-game-green);
	box-shadow: 0 0 15px rgba(var(--color-game-green-rgb), 0.3);
}

.difficulty-btn.selected {
	background: linear-gradient(135deg, var(--color-game-green), var(--color-game-green-dark));
	color: var(--color-surface-dark);
	border-color: var(--color-game-green);
	box-shadow: 0 0 20px rgba(var(--color-game-green-rgb), 0.5);
}

/* Game Setup */
.game-setup {
	margin-bottom: 0.5rem;
	max-width: 500px;
	margin-left: auto;
	margin-right: auto;
}

@media (min-width: 1024px) {
	.menu-container {
		max-width: 700px;
	}

	.game-setup {
		max-width: 600px;
	}

	.game-logo {
		width: min(78%, 560px);
		max-width: 560px;
		max-height: min(36vh, 420px);
	}
}

.setup-label {
	display: block;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: #ffffff;
	margin: 0.25rem 0 0.15rem;
}

.mode-buttons {
	display: flex;
	gap: 0.75rem;
	justify-content: center;
	flex-wrap: wrap;
	margin-bottom: 0.5rem;
}

.mode-btn {
	padding: 0.4rem 0.9rem;
	font-size: 0.85rem;
	border: 2px solid var(--color-border);
	background: linear-gradient(135deg, var(--color-surface), var(--color-surface-mid));
	color: #ffffff;
	cursor: pointer;
	border-radius: 5px;
	transition: all 0.3s ease;
}

.mode-btn:hover {
	background: linear-gradient(135deg, var(--color-surface-hover), var(--color-surface-hover-dark));
	border-color: var(--color-game-green);
	box-shadow: 0 0 15px rgba(var(--color-game-green-rgb), 0.3);
	transform: translateY(-2px);
}

.mode-btn.selected {
	background: linear-gradient(135deg, var(--color-game-green), var(--color-game-green-dark));
	color: var(--color-surface-dark);
	border-color: var(--color-game-green);
	box-shadow: 0 0 20px rgba(var(--color-game-green-rgb), 0.5);
}

/* Level Grid */
.level-grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	margin: 0 auto 0.5rem;
}

.level-btn {
	padding: 0;
	font-size: 0.85rem;
	width: 3.2rem;
	height: 2.1rem;
	box-sizing: border-box;
	position: relative;
	text-align: center;
	border: 2px solid var(--color-border);
	background: linear-gradient(135deg, var(--color-surface), var(--color-surface-mid));
	color: #ffffff;
	cursor: pointer;
	transition: all 0.3s ease;
	border-radius: 5px;
}

.level-btn .level-number {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	font-variant-numeric: tabular-nums;
}

.level-btn .level-indicator {
	position: absolute;
	right: 0.2rem;
	top: 50%;
	transform: translateY(-50%);
}

.level-btn.locked {
	color: #555555;
	cursor: not-allowed;
	border-color: #333333;
	opacity: 0.5;
	background: linear-gradient(135deg, #2a2a2e, #1a1a28);
}

.level-btn:not(.locked):hover {
	background: linear-gradient(135deg, var(--color-surface-hover), var(--color-surface-hover-dark));
	border-color: var(--color-game-green);
	box-shadow: 0 0 15px rgba(var(--color-game-green-rgb), 0.3);
}

.level-btn.selected {
	background: linear-gradient(135deg, var(--color-game-green), var(--color-game-green-dark));
	color: var(--color-surface-dark);
	border-color: var(--color-game-green);
	box-shadow: 0 0 20px rgba(var(--color-game-green-rgb), 0.6);
}

.level-btn.completed {
	border-color: var(--color-game-green);
}

.level-btn .level-check {
	color: var(--color-game-green);
	font-size: 0.75rem;
}

.level-btn.selected .level-check {
	color: var(--color-surface-dark);
}

.level-btn .level-lock {
	color: #555555;
	font-size: 0.7rem;
}

/* Menu Actions */
.menu-actions {
	display: flex;
	gap: 0.75rem;
	justify-content: center;
	margin-bottom: 1rem;
}

.menu-legal {
	text-align: center;
	margin-top: 0.25rem;
}

.menu-legal-link {
	color: rgba(255, 255, 255, 0.55);
	font-size: 0.75rem;
	text-decoration: none;
	transition: color 0.2s;
}

.menu-legal-link:hover {
	color: rgba(255, 255, 255, 0.9);
	text-decoration: underline;
}

.menu-legal-sep,
.menu-legal-copy {
	color: rgba(255, 255, 255, 0.35);
	font-size: 0.75rem;
}

.menu-version {
	display: block;
	color: rgba(255, 255, 255, 0.35);
	font-size: 0.7rem;
	margin-top: 0.2rem;
	letter-spacing: 0.03em;
}

#highScoreDisplay {
	font-size: 2rem;
	color: var(--color-game-green);
	font-weight: bold;
}

/* ============================================
   Game Screen
   ============================================ */
#gameScreen {
	justify-content: flex-start;
	padding: 1rem;
}

/* HUD */
.hud {
	width: 100%;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.75rem;
	background-color: var(--color-surface);
	border-radius: 5px;
	margin-bottom: 1rem;
}

.hud-left,
.hud-right {
	display: flex;
	gap: 1rem;
	align-items: flex-end;
}

.hud-center {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-evenly;
	flex: 1;
}

.hud-center .hud-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
}

.hud-item {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.hud-label {
	font-size: 0.7rem;
	color: var(--color-text-muted);
	margin-bottom: 0.25rem;
}

.hud-value {
	font-size: 1.25rem;
	font-weight: bold;
	color: #ffffff;
}

.streak-value {
	color: var(--color-game-green);
}

/* Goal progress bar */
.goal-bar {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.2rem 0.75rem;
	padding: 0.3rem 0.75rem;
	background: rgba(30, 30, 50, 0.85);
	border-bottom: 1px solid #333;
}

.goal-bar-label {
	font-size: 0.85rem;
	font-weight: bold;
	color: var(--color-gold);
	white-space: nowrap;
	letter-spacing: 0.03em;
}

.goal-items {
	display: flex;
	column-gap: 1.5rem;
	row-gap: 0.15rem;
	flex-wrap: wrap;
	justify-content: center;
}

.goal-item {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.9rem;
	color: #ccc;
	white-space: nowrap;
}

.goal-item.completed {
	color: var(--color-gold);
}

.goal-item.completed .goal-label::after {
	content: ' ✓';
}

.goal-progress {
	font-weight: bold;
	color: #e0e0e0;
	font-size: 0.9rem;
}

.goal-item.completed .goal-progress {
	color: var(--color-gold);
}

/* Mission Banner */
.mission-banner {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.35rem 0.75rem;
	background: linear-gradient(90deg, rgba(0, 80, 180, 0.85), rgba(30, 30, 50, 0.85));
	border-bottom: 1px solid #0066cc;
	font-size: 0.8rem;
}

.mission-banner-label {
	color: #66bbff;
	font-weight: bold;
	white-space: nowrap;
}

.mission-objective {
	color: #ffffff;
	white-space: nowrap;
}

.mission-progress {
	color: var(--color-game-green);
	font-weight: bold;
	white-space: nowrap;
}

/* ── Puzzle Mode Banner ── */
.puzzle-banner {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.35rem 0.75rem;
	background: linear-gradient(90deg, rgba(120, 60, 0, 0.85), rgba(30, 30, 50, 0.85));
	border-bottom: 1px solid #cc8800;
	font-size: 0.8rem;
}

.puzzle-banner-label {
	color: #ffcc66;
	font-weight: bold;
	white-space: nowrap;
}

.puzzle-pieces-left {
	color: #ffffff;
	font-weight: bold;
	white-space: nowrap;
}

/* ── Level Stars (Puzzle mode) ── */
.level-stars {
	display: flex;
	flex-direction: column;
	align-items: center;
	font-size: 0.42rem;
	line-height: 1;
	gap: 0.05rem;
	pointer-events: none;
}

.level-stars .star-filled {
	color: var(--color-gold);
}

.level-btn.selected .level-stars .star-filled {
	color: var(--color-surface-dark);
}

.hud-input {
	font-size: 1.5rem;
	font-weight: bold;
	color: var(--color-game-green);
	background-color: var(--color-surface);
	border: 2px solid var(--color-game-green);
	border-radius: 3px;
	padding: 0.25rem 0.5rem;
	width: 60px;
	text-align: center;
}

.hud-input:focus {
	outline: none;
	border-color: #00ffff;
	box-shadow: 0 0 5px rgba(var(--color-game-green-rgb), 0.5);
}

.hud-item.clock {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.15rem;
	min-width: 150px;
}

.clock-time {
	font-size: 0.9rem;
	font-weight: bold;
	color: var(--color-game-green);
	font-family: 'Courier New', monospace;
	letter-spacing: 0.1rem;
}

.temp-info {
	font-size: 0.7rem;
	color: var(--color-text-muted);
	text-align: center;
	white-space: nowrap;
}

.weather-info {
	font-size: 0.65rem;
	color: var(--color-text-dim);
	text-align: center;
	white-space: nowrap;
	text-transform: uppercase;
}

.hud-item.timer {
	display: flex;
	align-items: center;
	justify-content: center;
}

.timer-value {
	font-size: 2rem;
	font-weight: bold;
	color: var(--color-game-green);
	font-family: 'Courier New', monospace;
	transition: color 0.3s ease;
}

/* Time warning states — driven by JS class toggles on #gameCanvas and #timerDisplay */
@keyframes timer-pulse-amber {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.45; }
}

@keyframes timer-pulse-red {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.2; }
}

@keyframes canvas-warn-amber {
	0%, 100% { box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); border-color: var(--color-border); }
	50%      { box-shadow: 0 0 28px rgba(255, 180, 0, 0.55); border-color: rgba(255, 180, 0, 0.8); }
}

@keyframes canvas-warn-red {
	0%, 100% { box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); border-color: var(--color-border); }
	50%      { box-shadow: 0 0 36px rgba(255, 50, 50, 0.75); border-color: rgba(255, 60, 60, 0.95); }
}

.timer-warning {
	color: #ffb300 !important;
	animation: timer-pulse-amber 1s ease-in-out infinite;
}

.timer-urgent {
	color: #ff3c3c !important;
	animation: timer-pulse-red 0.5s ease-in-out infinite;
}

#gameCanvas.canvas-warning {
	animation: canvas-warn-amber 1s ease-in-out infinite;
}

#gameCanvas.canvas-urgent {
	animation: canvas-warn-red 0.5s ease-in-out infinite;
}

/* Game Container */
.game-container {
	display: flex;
	gap: 1rem;
	justify-content: center;
	align-items: flex-start;
	flex: 1;
}

/* Canvas */
#gameCanvas {
	border: 2px solid var(--color-border);
	background-color: var(--color-bg);
	border-radius: 5px;
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
	max-width: 100%;
	max-height: calc(100vh - 220px); /* safety net: never overflow viewport height */
	width: auto;
	height: auto;
}

/* Particle Canvas Overlay */
.particle-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 2000;
	display: none;
}

.particle-overlay.active {
	display: block;
}

/* Settings danger zone */
.setting-danger {
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 2px solid var(--color-danger);
}

.setting-danger label {
	color: #ff6666;
}

.btn-danger {
	background-color: var(--color-danger);
	color: white;
	border: none;
	padding: 0.6rem 1.2rem;
	border-radius: 5px;
	cursor: pointer;
	font-size: 0.9rem;
	transition: background-color 0.2s;
}

.btn-danger:hover {
	background-color: #ff6666;
}

.btn-danger:active {
	background-color: #cc3333;
}

/* Preview Panel */
.preview-panel {
	background-color: var(--color-surface);
	padding: 1rem;
	border-radius: 5px;
	border: 2px solid var(--color-border);
	text-align: center;
}

.preview-panel h3 {
	margin-bottom: 1rem;
	font-size: 1.2rem;
	color: var(--color-game-green);
}

#previewCanvas {
	border: 1px solid var(--color-border);
	background-color: var(--color-bg);
	border-radius: 5px;
}

/* Controls Info */
.controls-info {
	width: 100%;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: .75rem;
	background-color: var(--color-surface);
	border-radius: 5px;
	margin-top: 1rem;
}

.controls-keys {
	flex: 1;
	text-align: center;
}

.controls-keys p {
	margin: 0;
}

.controls-keys .controls-text {
	display: block;
}

.controls-keys .controls-icons {
	display: none;
}

.controls-info .hud-item.clock {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 0.5rem;
	white-space: nowrap;
}

.controls-info .separator {
	color: #555555;
	font-size: 0.8rem;
}

.controls-info .clock-time {
	font-size: 0.85rem;
}

.controls-info .temp-info {
	font-size: 0.7rem;
}

.controls-info .weather-info {
	font-size: 0.7rem;
}

.controls-info kbd {
	display: inline-block;
	padding: 0.25rem 0.5rem;
	background-color: var(--color-surface-hover);
	border: 1px solid #555555;
	border-radius: 3px;
	font-family: monospace;
	font-size: 0.9rem;
	margin: 0 0.25rem;
}

/* ============================================
   Overlays
   ============================================ */
.overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.8);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 1000;
}

.overlay-content {
	background: linear-gradient(135deg, var(--color-surface), var(--color-surface-mid));
	padding: 2.25rem;
	border-radius: 10px;
	border: 2px solid var(--color-game-green);
	text-align: center;
	min-width: 400px;
	box-shadow: 0 0 30px rgba(var(--color-game-green-rgb), 0.3), 
	            0 0 60px rgba(var(--color-game-green-rgb), 0.1);
}

.overlay-content h2 {
	font-size: 2.5rem;
	margin-bottom: 1.0rem;
	background: linear-gradient(135deg, var(--color-game-green), var(--color-cyan));
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	filter: drop-shadow(0 0 10px rgba(var(--color-game-green-rgb), 0.5));
}

.overlay-actions {
	display: flex;
	gap: 1rem;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 1.15rem;
}

/* Share Button */
.btn-share {
	padding: 0.5rem 1rem;
	border: 2px solid #66bbff;
	border-radius: 5px;
	background: linear-gradient(135deg, #1a3a5c, #0d1f33);
	color: #66bbff;
	font-size: 0.85rem;
	font-weight: bold;
	cursor: pointer;
	transition: all 0.2s ease;
}

.btn-share:hover {
	background: linear-gradient(135deg, #1e4d75, #122a44);
	border-color: #99ddff;
	color: #ffffff;
}

.btn-share.copied {
	border-color: var(--color-game-green);
	color: var(--color-game-green);
}

/* Game Over Stats */
.game-over-stats,
.level-complete-stats {
	margin: 1.5rem 0;
}

/* Recap Stats Grid */
.recap-stats {
	margin: 1rem 0 1.5rem;
	padding: 1rem;
	background-color: rgba(255, 255, 255, 0.05);
	border-radius: 5px;
	border: 1px solid var(--color-border);
}

.recap-stats h3 {
	margin: 0 0 0.75rem 0;
	font-size: 1rem;
	color: var(--color-game-green);
	text-align: center;
}

.recap-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.6rem;
}

.recap-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 0.5rem 0.25rem;
	background-color: rgba(255, 255, 255, 0.04);
	border-radius: 5px;
}

.recap-icon {
	font-size: 1.3rem;
	margin-bottom: 0.15rem;
}

.recap-value {
	font-size: 1.2rem;
	font-weight: bold;
	color: #ffffff;
}

.recap-label {
	font-size: 0.65rem;
	color: #999999;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

#levelCompleteOverlay .overlay-content {
	min-width: 360px;
	max-width: 520px;
	padding: 1.75rem;
}

#levelChangesOverlay .overlay-content {
	width: min(520px, calc(100vw - 2rem));
	max-width: 520px;
}

/* Settings overlay — constrain width so it doesn't overflow viewport */
#settingsOverlay .overlay-content {
	min-width: min(400px, calc(100vw - 2rem));
	max-width: min(520px, calc(100vw - 2rem));
}

#settingsOverlay .overlay-content h2 {
	font-size: 1rem;
	margin-bottom: 0.85rem;
}

.settings-footer {
	margin-top: 0.75rem;
	padding-top: 0.5rem;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	text-align: center;
	font-size: 0.75rem;
	color: rgba(255, 255, 255, 0.4);
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.settings-footer a {
	color: rgba(255, 255, 255, 0.55);
	text-decoration: none;
}

.settings-footer a:hover {
	color: var(--color-game-green);
}

.level-complete-reason {
	font-size: 1.2rem;
	color: var(--color-game-green);
	margin-bottom: 1.5rem;
	font-style: italic;
}

.level-changes-content {
	width: min(520px, calc(100vw - 2rem));
	min-width: 380px;
	max-width: 520px;
	padding: 1.5rem;
	height: 90vh;
	display: flex;
	flex-direction: column;
}

.level-changes-content h2 {
	font-size: 1.875rem;
}

.level-changes-list {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.6rem;
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding-right: 0.25rem;
}

.level-changes-piece-row {
	display: flex;
	align-items: flex-end;
	gap: 0.45rem;
	margin-bottom: 0.65rem;
	flex-wrap: wrap;
}

.level-changes-piece-token {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	min-height: 34px;
	padding: 0.35rem;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.14);
}

.level-changes-piece-token.new-piece {
	border-color: rgba(var(--color-game-green-rgb), 0.55);
	box-shadow: 0 0 14px rgba(var(--color-game-green-rgb), 0.16);
	background: rgba(var(--color-game-green-rgb), 0.08);
}

.level-changes-piece-grid {
	display: grid;
	gap: 2px;
}

.piece-cell {
	width: 10px;
	height: 10px;
	border-radius: 2px;
	display: block;
}

.piece-cell.filled {
	background: linear-gradient(135deg, #9ddcff, #4fb3ff);
	box-shadow: 0 0 6px rgba(79, 179, 255, 0.35);
	border: 1px solid rgba(255, 255, 255, 0.25);
	box-sizing: border-box;
}

.piece-cell.empty {
	background: transparent;
}

.level-changes-item {
	text-align: left;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(var(--color-game-green-rgb), 0.25);
	border-radius: 8px;
	padding: 0.75rem;
}

.level-changes-item-title {
	margin: 0 0 0.35rem;
	color: var(--color-game-green);
	font-size: 1rem;
}

.level-changes-item-description {
	margin: 0;
	color: #e6f5ff;
	font-size: 0.9rem;
	line-height: 1.35;
}

.level-changes-chip-row,
.level-changes-special-row {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	margin-bottom: 0.55rem;
	flex-wrap: wrap;
}

.level-changes-color-chip {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.7);
	box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.level-changes-special-token {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.2rem 0.45rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.18);
}

.level-changes-special-label {
	font-size: 0.78rem;
	letter-spacing: 0.03em;
	text-transform: none;
	color: #e6f5ff;
}

.level-changes-hide-option {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	margin-top: 0.4rem;
	color: #cde4ff;
	font-size: 0.85rem;
	user-select: none;
}

.level-changes-hide-option input[type='checkbox'] {
	width: 16px;
	height: 16px;
	accent-color: var(--color-game-green);
	cursor: pointer;
}

.stat-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1rem;
	padding: 0.5rem;
	background-color: rgba(255, 255, 255, 0.05);
	border-radius: 5px;
}

.stat-label {
	font-size: 1rem;
	color: var(--color-text-muted);
}

.stat-value {
	font-size: 1.5rem;
	font-weight: bold;
	color: #ffffff;
}

.new-high-score {
	font-size: 1.5rem;
	color: var(--color-gold);
	font-weight: bold;
	margin-top: 1rem;
	animation: pulse 1s infinite;
}

@keyframes pulse {
	0%, 100% {
		opacity: 1;
		transform: scale(1);
	}
	50% {
		opacity: 0.7;
		transform: scale(1.05);
	}
}

/* Settings */
.settings-options {
	margin: 1.5rem 0;
}

.setting-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin: 1.25rem 0;
	gap: 1rem;
}

.setting-item label {
	font-size: 0.95rem;
	color: #ffffff;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	max-width: 50%;
}

.setting-icon {
	font-size: 1.3rem;
}

.setting-item input[type="checkbox"],
.toggle-checkbox {
	width: 24px;
	height: 24px;
	cursor: pointer;
	accent-color: var(--color-game-green);
}

.setting-item input[type="range"],
.volume-slider {
	flex: 1;
	max-width: 200px;
	height: 8px;
	border-radius: 4px;
	background: linear-gradient(to right, #444, var(--color-game-green));
	outline: none;
	cursor: pointer;
}

.setting-item input[type="range"]::-webkit-slider-thumb,
.volume-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--color-game-green);
	cursor: pointer;
	box-shadow: 0 0 10px rgba(var(--color-game-green-rgb), 0.5);
}

.setting-item input[type="range"]::-moz-range-thumb,
.volume-slider::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--color-game-green);
	cursor: pointer;
	border: none;
	box-shadow: 0 0 10px rgba(var(--color-game-green-rgb), 0.5);
}

.setting-item .btn-primary,
.setting-item .btn-secondary,
.setting-item .btn-danger {
	font-size: 0.95rem !important;
	padding: 0.5rem 1.2rem !important;
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary,
.btn-secondary {
	padding: 0.5rem 1.2rem;
	font-size: 0.95rem;
	border: none;
	cursor: pointer;
	border-radius: 5px;
	transition: all 0.3s ease;
	font-weight: bold;
}

.btn-primary {
	background: linear-gradient(135deg, var(--color-game-green), var(--color-game-green-dark));
	color: var(--color-surface-dark);
	box-shadow: 0 4px 15px rgba(var(--color-game-green-rgb), 0.3);
}

.btn-primary:hover {
	background: linear-gradient(135deg, var(--color-game-green-hover), var(--color-game-green-darker));
	box-shadow: 0 6px 20px rgba(var(--color-game-green-rgb), 0.5);
	transform: translateY(-2px);
}

.btn-secondary {
	background: linear-gradient(135deg, var(--color-surface-hover), var(--color-surface));
	color: #ffffff;
	border: 2px solid var(--color-border-mid);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.btn-secondary:hover {
	background: linear-gradient(135deg, #4a4a5e, var(--color-surface-hover));
	border-color: var(--color-game-green);
	box-shadow: 0 4px 15px rgba(var(--color-game-green-rgb), 0.3);
	transform: translateY(-2px);
}

.btn-primary:active,
.btn-secondary:active {
	transform: scale(0.95);
}

/* ============================================
   Scrollbar Styling
   ============================================ */
/* ============================================
   Player Management Forms
   ============================================ */
.player-form {
	margin: 2rem 0;
	text-align: left;
}

.player-form label {
	display: block;
	font-size: 1.1rem;
	color: var(--color-game-green);
	margin-bottom: 0.5rem;
	font-weight: bold;
}

.player-input {
	width: 100%;
	padding: 0.75rem;
	font-size: 1rem;
	background: var(--color-surface-dark);
	border: 2px solid var(--color-border-mid);
	border-radius: 5px;
	color: #ffffff;
	transition: all 0.3s ease;
}

.player-input:focus {
	outline: none;
	border-color: var(--color-game-green);
	box-shadow: 0 0 10px rgba(var(--color-game-green-rgb), 0.3);
}

.error-message {
	color: var(--color-danger);
	font-size: 0.9rem;
	margin-top: 0.5rem;
	padding: 0.5rem;
	background: rgba(var(--color-danger-rgb), 0.1);
	border-left: 3px solid var(--color-danger);
	border-radius: 3px;
}

.warning-message {
	color: #ffaa00;
	font-size: 1.1rem;
	margin: 1rem 0;
	padding: 1rem;
	background: rgba(255, 170, 0, 0.1);
	border: 2px solid #ffaa00;
	border-radius: 5px;
	text-align: center;
}

.hidden {
	display: none;
}

.btn-danger {
	background: linear-gradient(135deg, var(--color-danger), var(--color-danger-dark));
	color: #ffffff;
	padding: 0.75rem 2rem;
	border: none;
	border-radius: 5px;
	font-size: 1.1rem;
	font-weight: bold;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 4px 15px rgba(var(--color-danger-rgb), 0.3);
}

.btn-danger:hover {
	background: linear-gradient(135deg, var(--color-danger-hover), var(--color-danger-darker));
	box-shadow: 0 6px 20px rgba(var(--color-danger-rgb), 0.5);
	transform: translateY(-2px);
}

.btn-danger:active {
	transform: scale(0.95);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
	#menuScreen {
		padding-top: 5rem;
	}

	.menu-top-bar {
		padding: 0.25rem 0.4rem;
		gap: 0.3rem;
	}

	.player-pill-toggle {
		font-size: 0.66rem;
		padding: 0.3rem 0.62rem;
	}

	.player-pill-menu {
		width: 220px;
	}

	.menu-top-pill,
	.supporter-button {
		font-size: 0.68rem;
		padding: 0.28rem 0.65rem;
	}

	.menu-top-bar-row {
		gap: 0.3rem;
	}
	}

	.menu-container {
		padding: 0.5rem;
	}
	
	.menu-container h1 {
		font-size: 2rem;
	}
	
	.menu-container h2 {
		font-size: 1.2rem;
		margin: 0.25rem 0 0.25rem;
	}
	
	.game-logo {
		max-width: 180px;
	}
	
	.difficulty-buttons {
		gap: 0.5rem;
	}
	
	.difficulty-btn {
		padding: 0.4rem 0.8rem;
		font-size: 0.85rem;
	}
	
	.mode-buttons {
		grid-template-columns: 1fr;
		gap: 0.5rem;
	}
	
	.mode-btn {
		padding: 0.4rem 0.8rem;
	}
	
	.level-grid {
		gap: 0.4rem;
	}
	
	.btn-primary,
	.btn-secondary,
	.btn-danger {
		padding: 0.6rem 1.2rem;
		font-size: 0.9rem;
	}
	
	.hud {
		flex-direction: row;
		gap: 0.5rem;
		padding: 0.5rem;
		align-items: center;
		justify-content: space-between;
	}
	
	.hud-center {
		flex-direction: row;
		gap: 0.5rem;
		align-items: center;
	}
	
	.preview-compact canvas {
		width: 72px;
		height: 54px;
	}
	
	.hud-left,
	.hud-right {
		flex-direction: row;
		gap: 0.5rem;
		flex: 0 1 auto;
	}
	
	.hud-item {
		margin: 0;
	}
	
	.hud-label {
		font-size: 0.6rem;
		margin-bottom: 0.1rem;
	}
	
	.hud-value {
		font-size: 0.85rem;
	}
	
	.hud-input {
		font-size: 0.85rem;
		width: 40px;
		padding: 0.1rem 0.25rem;
	}
	
	.timer-value {
		font-size: 1.1rem;
	}
	
	.clock-time {
		font-size: 0.75rem;
	}
	
	.game-container {
		flex-direction: column;
		align-items: center;
		gap: 0.5rem;
	}
	
	#gameCanvas {
		order: 0;
		max-width: 100%;
	}
	
	.controls-info {
		flex-direction: column;
		gap: 0.35rem;
		padding: 0.35rem;
		order: 2;
	}

	#gameScreen {
		padding: 0.25rem 0.4rem;
		overflow: hidden;
	}

	.hud {
		margin-bottom: 0.2rem;
		padding: 0.4rem 0.5rem;
	}

	.goal-bar {
		padding: 0.15rem 0.5rem;
	}

	.game-container {
		gap: 0.25rem;
		flex: 0 0 auto;
	}

	.controls-info {
		margin-top: 0.25rem;
	}

	#gameCanvas {
		max-width: 100%;
	}
	
	.controls-keys .controls-text {
		display: none;
	}
	
	.controls-keys .controls-icons {
		display: block;
	}
	
	.controls-info kbd {
		padding: 0.3rem 0.55rem;
		font-size: 1.1rem;
	}
	
	.controls-info .hud-item.clock {
		flex-direction: row;
		gap: 0.5rem;
		min-width: 280px;
	}
	
	.overlay-content {
		min-width: unset;
		width: 92vw;
		max-width: 92vw;
		padding: 1.5rem;
	}

	#settingsOverlay .overlay-content {
		padding: 1.25rem 1rem;
	}

	.settings-options {
		margin: 0.5rem 0;
	}

	.setting-item {
		margin: 0.75rem 0;
		gap: 0.5rem;
	}

	.setting-danger {
		margin-top: 0.75rem;
		padding-top: 0.75rem;
	}

	.setting-item .btn-primary,
	.setting-item .btn-secondary,
	.setting-item .btn-danger {
		font-size: 0.8rem !important;
		padding: 0.4rem 0.75rem !important;
	}

	#levelCompleteOverlay .overlay-content {
		min-width: 300px;
		padding: 1.75rem;
	}

	.level-changes-content {
		min-width: 300px;
		max-width: 92vw;
		padding: 0.65rem 0.8rem;
		height: 90vh;
		max-height: 90dvh;
		overflow: hidden;
	}

	.level-changes-content h2 {
		font-size: 1.5rem;
	}

	.level-changes-item {
		padding: 0.55rem;
	}

	.level-changes-list {
		max-height: none;
	}
}

/* Short viewport — hide sidebars on small desktop/laptop screens */
@media (max-height: 900px) {
	.ball-legend,
	.stats-panel-container {
		display: none;
	}
}

/* ============================================
   Ad System Styles
   ============================================ */

/* Interstitial Overlay - shown at natural breaks only */
.interstitial-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.92);
	z-index: 10000;
	display: flex;
	flex-direction: column;
	align-items: center;
	/* No justify-content: center — it clips button from bottom when content overflows.
	   Instead the ad container flexes to fill space and skip button is absolute. */
	padding: 1rem 1.5rem 5rem; /* bottom padding reserves space for the absolute skip button */
	box-sizing: border-box;
	overflow: hidden;
}

.interstitial-label {
	color: #888;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	margin-bottom: 0.75rem;
	flex-shrink: 0;
}

.interstitial-ad-container {
	width: 100%;
	max-width: 600px;
	flex: 1 1 auto;
	min-height: 0; /* allows the browser to shrink below content size */
	background: #222;
	border-radius: 8px;
	overflow: hidden;
	display: flex;
	align-items: stretch;
	justify-content: center;
}

.interstitial-ad-container .adsbygoogle {
	flex: 1;
	width: 100% !important;
	height: 100% !important;
}

/* Skip button is positioned absolutely so it is ALWAYS visible */
.skip-ad-button {
	position: absolute;
	bottom: 1.25rem;
	left: 50%;
	transform: translateX(-50%);
	padding: 0.75rem 1.5rem;
	font-size: 1rem;
	background: var(--color-ad-accent);
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-weight: bold;
	white-space: nowrap;
	transition: opacity 0.2s;
}

.skip-ad-button:disabled {
	background: #555;
	cursor: not-allowed;
	opacity: 0.7;
}

.skip-ad-button:not(:disabled):hover {
	opacity: 0.85;
}

/* ============================================
   Supporter / License Key Styles
   ============================================ */

/* "Go Ad-Free" button — pill style when inside the top bar */
.supporter-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.35rem 0.9rem;
	border-radius: 999px;
	border: 1px solid rgba(251, 176, 52, 0.75);
	background: rgba(60, 38, 4, 0.78);
	backdrop-filter: blur(6px);
	color: #ffe5a0;
	text-decoration: none;
	font-weight: 700;
	font-size: 0.75rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
	box-shadow: 0 0 14px rgba(251, 176, 52, 0.22);
	transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.supporter-button:hover {
	transform: translateY(-1px);
	border-color: rgba(251, 200, 80, 0.95);
	box-shadow: 0 0 18px rgba(251, 176, 52, 0.42);
}

/* Only visible on home screen or during ad interstitial */
body:not(.home-screen):not(.interstitial-active) .supporter-button {
	display: none;
}

/* When appended to body as fallback (interstitial): fixed top-right */
body > .supporter-button {
	position: fixed;
	top: 0.35rem;
	right: 0.6rem;
	z-index: 900;
}

/* Must sit above the interstitial overlay (z-index 10000) */
body.interstitial-active .supporter-button {
	z-index: 10001;
}

/* License Activation Modal */
.license-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(0, 0, 0, 0.85);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
}

.license-modal-content {
	background: #2a2a2a;
	padding: 2rem;
	border-radius: 12px;
	max-width: 460px;
	width: 90%;
	color: #fff;
}

.license-modal-content h2 {
	margin-top: 0;
	color: #FFDD00;
}

.license-modal-content p {
	color: #ccc;
	line-height: 1.5;
	margin-bottom: 1rem;
}

.license-purchase-link a {
	color: #60a0ff;
	text-decoration: underline;
}

.license-key-input {
	width: 100%;
	padding: 12px;
	border: 2px solid #4080FF;
	border-radius: 6px;
	background: #1a1a1a;
	color: #fff;
	font-size: 1rem;
	font-family: monospace;
	box-sizing: border-box;
}

.license-key-input:focus {
	outline: none;
	border-color: #60a0ff;
}

.license-modal-actions {
	display: flex;
	gap: 10px;
	margin-top: 1.25rem;
}

.license-error {
	display: none;
	color: var(--color-danger);
	margin-top: 0.5rem;
	font-size: 0.85rem;
}

.license-loading {
	color: #60a0ff;
	margin-top: 0.5rem;
	font-size: 0.85rem;
}

/* Supporter Success Notification */
.supporter-notification {
	position: fixed;
	top: 20px;
	left: 50%;
	transform: translateX(-50%);
	background: linear-gradient(135deg, #2d7d46, #1a5c30);
	color: #fff;
	padding: 1rem 2rem;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
	z-index: 10001;
	text-align: center;
	transition: opacity 0.5s;
}

.supporter-notification p {
	margin: 0.25rem 0;
}

.supporter-notification-fade {
	opacity: 0;
}

/* ============================================
   PWA Styles
   ============================================ */

/* Offline indicator — fixed bottom-left, only visible when offline */
.offline-indicator {
	position: fixed;
	bottom: 20px;
	left: 20px;
	background: rgba(40, 40, 40, 0.92);
	color: #ffcc44;
	padding: 8px 14px;
	border-radius: 20px;
	font-size: 0.8rem;
	font-weight: bold;
	border: 1px solid #ffcc44;
	z-index: 900;
	pointer-events: none;
}

/* Update notification banner — appears at top of page */
.pwa-update-banner {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	background: #1e3a5f;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	padding: 10px 16px;
	font-size: 0.9rem;
	z-index: 10002;
	border-bottom: 2px solid #4080FF;
}

.pwa-update-btn {
	padding: 5px 14px;
	background: #4080FF;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 0.85rem;
	font-weight: bold;
	cursor: pointer;
	transition: opacity 0.2s;
}

.pwa-update-btn:hover {
	opacity: 0.85;
}

.pwa-update-dismiss {
	background: transparent;
	border: none;
	color: #aaa;
	font-size: 1rem;
	cursor: pointer;
	padding: 2px 6px;
	line-height: 1;
}

.pwa-update-dismiss:hover {
	color: #fff;
}

/* ─── PWA Install Toast ───────────────────────────────────────────────────── */
/* Slides up from the bottom center to prompt the user to install the app    */

.pwa-install-toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%) translateY(0);
	display: flex;
	align-items: center;
	gap: 0.75rem;
	background: linear-gradient(135deg, #1a2f50, #0d1f36);
	color: #fff;
	padding: 12px 16px;
	border-radius: 12px;
	box-shadow: 0 6px 28px rgba(0, 0, 0, 0.55);
	border: 1px solid #4080FF;
	z-index: 10003;
	font-size: 0.9rem;
	max-width: 420px;
	width: calc(100% - 48px);
	animation: pwaToastSlideIn 0.35s ease;
}

.pwa-install-toast.hidden {
	display: none;
}

@keyframes pwaToastSlideIn {
	from { transform: translateX(-50%) translateY(120%); opacity: 0; }
	to   { transform: translateX(-50%) translateY(0);   opacity: 1; }
}

.pwa-install-toast-icon {
	font-size: 1.6rem;
	flex-shrink: 0;
}

.pwa-install-toast-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 2px;
	line-height: 1.3;
}

.pwa-install-toast-body strong {
	font-size: 0.95rem;
}

.pwa-install-toast-body span {
	font-size: 0.8rem;
	color: #99bbee;
}

.pwa-install-toast-btn {
	padding: 6px 16px;
	background: #4080FF;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 0.85rem;
	font-weight: bold;
	cursor: pointer;
	flex-shrink: 0;
	transition: opacity 0.2s;
}

.pwa-install-toast-btn:hover {
	opacity: 0.85;
}

.pwa-install-toast-dismiss {
	background: transparent;
	border: none;
	color: #aaa;
	font-size: 1rem;
	cursor: pointer;
	padding: 2px 4px;
	flex-shrink: 0;
	line-height: 1;
	transition: color 0.2s;
}

.pwa-install-toast-dismiss:hover {
	color: #fff;
}

/* ---- Manual Install Instructions Toast ---- */
.pwa-manual-install-toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	background: linear-gradient(135deg, #1a2f50, #0d1f36);
	color: #fff;
	padding: 16px 20px;
	border-radius: 12px;
	box-shadow: 0 6px 28px rgba(0, 0, 0, 0.6);
	border: 1px solid #4080FF;
	z-index: 10004;
	font-size: 0.9rem;
	max-width: 340px;
	width: calc(100% - 48px);
	animation: pwaToastSlideIn 0.35s ease;
}

.pwa-manual-install-header {
	font-size: 1rem;
	margin-bottom: 10px;
}

.pwa-manual-install-steps {
	margin: 0 0 12px 18px;
	padding: 0;
	line-height: 1.7;
	font-size: 0.87rem;
	color: #cde;
}

.pwa-manual-install-close {
	display: block;
	width: 100%;
	padding: 7px 0;
	background: #4080FF;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 0.85rem;
	font-weight: bold;
	cursor: pointer;
	transition: opacity 0.2s;
}

.pwa-manual-install-close:hover {
	opacity: 0.85;
}

/* Subtle highlight when Chrome's native prompt is ready */
.pwa-prompt-ready {
	background: linear-gradient(90deg, #4080FF, #5b9aff) !important;
}
