 :root {
	font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
	color: #091322;
	--overlay-start: radial-gradient(circle at top, rgba(255, 255, 255, 0.18), rgba(135, 177, 255, 0.12)) rgba(15, 25, 46, 0.92);
	--overlay-end: radial-gradient(circle at top, rgba(255, 209, 122, 0.2), rgba(255, 143, 112, 0.12)) rgba(18, 15, 32, 0.92);
	--accent-gold: #ffd07a;
	--accent-blue: #6bdcff;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	background: radial-gradient(circle at top, #122742 0%, #0a1524 50%, #050912 100%);
	color: #f7f9ff;
	overflow-x: hidden;
}

main {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 1.5rem;
}

.game-wrapper {
	width: min(940px, 100%);
	background: rgba(9, 17, 32, 0.85);
	border: 2px solid rgba(255, 255, 255, 0.15);
	border-radius: 24px;
	padding: clamp(1rem, 2vw, 1.5rem);
	position: relative;
	box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
	overflow: hidden;
}

h1 {
	margin: 0 0 0.5rem;
	text-align: center;
	font-size: clamp(1.4rem, 2vw, 2rem);
}

.description {
	text-align: center;
	margin-bottom: 1rem;
	line-height: 1.4;
	color: #d7dff2;
}

.game-hud {
	display: none !important;
	justify-content: center;
	align-items: stretch;
	gap: 1rem;
	flex-wrap: wrap;
	margin: 0 auto 1rem;
	padding: 0.65rem 1.5rem;
	border-radius: 999px;
	background: rgba(6, 12, 24, 0.85);
	border: 1px solid rgba(255, 255, 255, 0.18);
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.game-hud.visible {
	display: inline-flex;
}

.hud-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.2rem;
	min-width: 140px;
}

.hud-label {
	color: #94b1d8;
	font-size: 0.8rem;
}

.hud-value {
	font-size: 1.3rem;
	color: #fdfefe;
}

.scene {
	position: relative;
	width: 100%;
	max-width: 880px;
	aspect-ratio: 16 / 9;
	border-radius: 20px;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.25);
	background: linear-gradient(180deg, #10213c 0%, #18355c 60%, #2c3e55 100%);
}

.scene > svg {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
}

.city-sky {
	z-index: 0;
}

.city-skyline {
	position: absolute;
	z-index: 1;
	pointer-events: none;
	width: 100%;
	height: 100%;
	background-image: url('assets/skyline2.png');
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

.canvas-layer {
	position: absolute;
	inset: 0;
	z-index: 5;
}

canvas {
	width: 100%;
	height: 100%;
	display: block;
}

.balcony-rail {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 50%;
	z-index: 3;
	pointer-events: none;
	background-image: url('assets/bruestung.png');
	background-size: cover;
	background-position: top center;
	background-repeat: no-repeat;
}

.balcony-overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 6%;
	display: flex;
	justify-content: space-evenly;
	align-items: flex-end;
	gap: clamp(0.5rem, 2vw, 1.5rem);
	pointer-events: none;
	padding: 0 6%;
	z-index: 4;
}

.game-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(1rem, 3vw, 2.75rem);
	text-align: center;
	background: rgba(4, 7, 15, 0.92);
	backdrop-filter: blur(8px);
	color: #e6efff;
	z-index: 9;
	overflow: hidden;
}

.game-overlay::before {
	content: '';
	position: absolute;
	inset: -30%;
	background-image: radial-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px);
	background-size: 120px 120px;
	opacity: 0.4;
	animation: driftSnow 30s linear infinite;
	pointer-events: none;
}

.game-overlay.start {
	background: var(--overlay-start);
}

.game-overlay.end {
	background: var(--overlay-end);
}

.game-overlay[hidden] {
	display: none;
}

.overlay-content {
	width: min(540px, 92vw);
	max-height: min(520px, 92vh);
	margin: auto;
	background: rgba(6, 12, 24, 0.88);
	border-radius: 22px;
	padding: clamp(1rem, 3vw, 2rem);
	border: 1px solid rgba(255, 255, 255, 0.2);
	box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
	display: flex;
	flex-direction: column;
	gap: 1.2rem;
	overflow-y: auto;
}

.overlay-header p {
	margin-top: 0.35rem;
	color: #d7e8ff;
}

.overlay-rules {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 0.75rem;
}

.rule-card {
	background: rgba(13, 22, 40, 0.8);
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 16px;
	padding: 0.9rem;
	text-align: left;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.rule-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 14px;
	background: linear-gradient(135deg, #4be0c2, #4aa1ff);
	color: #041229;
	font-weight: 700;
	font-size: 1rem;
	box-shadow: 0 8px 20px rgba(74, 161, 255, 0.35);
}

.rule-card:nth-child(2) .rule-icon {
	background: linear-gradient(135deg, #ffd07a, #ff8f70);
	box-shadow: 0 8px 20px rgba(255, 143, 112, 0.35);
}

.rule-card:nth-child(3) .rule-icon {
	background: linear-gradient(135deg, #9be7ff, #c6f6ff);
	color: #0f2a3a;
}

.game-overlay h2 {
	margin: 0;
	font-size: clamp(1.4rem, 3.5vw, 2.2rem);
}

.game-overlay p {
	margin: 0;
	line-height: 1.5;
	color: #c6d8f8;
}

.solution-letter {
	font-size: 1.3rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	color: var(--accent-gold);
	background: rgba(255, 255, 255, 0.08);
	padding: 0.8rem 1rem;
	border-radius: 16px;
	border: 1px solid rgba(255, 208, 122, 0.35);
}

.game-button {
	appearance: none;
	border: none;
	border-radius: 999px;
	padding: 0.85rem 2rem;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	cursor: pointer;
	color: #051022;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-button.primary {
	background: linear-gradient(120deg, #4be0c2, #4aa1ff);
	box-shadow: 0 15px 35px rgba(74, 161, 255, 0.35);
}

.game-button.secondary {
	background: linear-gradient(120deg, #ffd07a, #ff8f70);
	box-shadow: 0 15px 35px rgba(255, 143, 112, 0.35);
}

.game-button:active {
	transform: translateY(2px);
	box-shadow: none;
}

.game-overlay.start .game-button.primary {
	background: linear-gradient(135deg, #6bdcff, #4aa1ff);
}

.game-overlay.end .game-button.secondary {
	background: linear-gradient(135deg, #ffd07a, #ff8f70);
}

.plant {
	filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.55));
}

.plant img {
	width: 100%;
	height: auto;
	display: block;
}

[data-plant="0"] {
	width: 15vw;
	position: absolute;
	left: 2vw;
	bottom: -12vh;
}

[data-plant="1"] {
	width: 30vw;
	position: absolute;
	left: 50vw;
	bottom: 12vh;
}

[data-plant="2"] {
	width: 15vw;
	position: absolute;
	right: 2vw;
	bottom: -12vh;
}

[data-plant="3"] {
	width: 15vw;
	position: absolute;
	left: 20vw;
	bottom: -12vh;
}

#orientation-warning {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(5, 9, 18, 0.9);
	text-align: center;
	padding: 2rem;
	font-size: 1.2rem;
	z-index: 10;
}

#orientation-warning.active {
	display: flex;
}

.status-banner {
	display: none;
}

.progress-track {
	position: absolute;
	top: 8%;
	bottom: 8%;
	width: clamp(48px, 6vw, 62px);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35rem;
	text-transform: uppercase;
	font-size: 0.75rem;
	letter-spacing: 0.08em;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.8);
	z-index: 8;
	pointer-events: none;
}

.progress-track--time {
	left: clamp(0.4rem, 1vw, 1.2rem);
}

.progress-track--hits {
	right: clamp(0.4rem, 1vw, 1.2rem);
}

.progress-track--time .progress-label {
    margin-left:5rem
}
.progress-label.secondary {
	font-size: 0.7rem;
	color: rgba(255, 255, 255, 0.6);
}

.progress-shell {
	flex: 1;
	width: 18px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.35);
	background: rgba(9, 16, 28, 0.6);
	position: relative;
	overflow: hidden;
}

.progress-fill {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 50%;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(170, 210, 255, 0.8));
	box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.35);
	transition: height 0.25s ease;
}

#timeProgress {
	height: 100%;
	background: linear-gradient(180deg, var(--accent-blue), #296dff);
}

#hitProgress {
	height: 100%;
	background: var(--hit-color, #4be07a);
	box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.25);
}

@media (max-width: 768px) {
	.game-wrapper {
		padding: 1rem;
	}

	.game-overlay {
		padding: 1rem;
	}

	.progress-track {
		width: 44px;
		font-size: 0.68rem;
	}

	.progress-shell {
		width: 14px;
	}
}

@media (max-height: 520px) {
	.overlay-content {
		max-height: 88vh;
	}

	.overlay-rules {
		grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	}
}

@media (orientation: landscape) and (max-height: 500px) {
	.overlay-content {
		gap: 0.8rem;
	}

	.rule-card {
		padding: 0.75rem;
		gap: 0.25rem;
	}

	.rule-icon {
		transform: scale(0.9);
	}
}

@keyframes driftSnow {
	0% {
		transform: translateY(0);
	}
	100% {
		transform: translateY(30%);
	}
}
