* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	justify-content: center;
	align-items: stretch;
	font-family: 'zabras', Arial, Helvetica, sans-serif;
	background-color: #0a0a0a;
	color: #f9f5ec;
	overflow: hidden;
}

.background {
	width: 100%;
	min-height: 100vh;
	padding: 20px 24px 44px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	background-image: url('img/9_intro_outro_screens/overlay.jpg');
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	text-align: center;
}

h1 {
	margin: 16px 0 0;
	font-size: 64px;
	letter-spacing: 4px;
	text-transform: uppercase;
	color: #ffdc04;
	text-shadow: 0 6px 18px rgba(0, 0, 0, 0.65);
}

h3 {
	margin: 0;
	font-size: 32px;
	text-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

p {
	margin: 0;
	font-size: 20px;
	line-height: 1.4;
}

h4 {
	margin: 0;
	font-size: 32px;
	color: transparent;
	background: linear-gradient(135deg, #ffdc04 0%, #ff9e00 45%, #ff5a1f 100%);
	-webkit-background-clip: text; /* keeps gradient visible in WebKit browsers */
	background-clip: text;
	filter: drop-shadow(2px 0 0 #000) drop-shadow(-2px 0 0 #000) drop-shadow(0 2px 0 #000) drop-shadow(0 -2px 0 #000);
}

canvas {
	display: block;
	width: 90vw;
	max-width: 1024px;
	aspect-ratio: 3 / 2;
	height: auto;
	max-height: clamp(240px, 46vh, 520px);
	border-radius: 22px;
	background-color: transparent;
	/* box-shadow: 0 18px 38px rgba(0, 0, 0, 0.55); */
	object-fit: contain;
	margin-bottom: 16px;
	padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.info {
	position: absolute;
	top: 24px;
	right: 24px;
	display: flex;
	align-items: center;
	gap: 12px;
	z-index: 40;
}

.info > button {
	background: rgba(0, 0, 0, 0.68);
	border: none;
	border-radius: 12px;
	padding: 10px 18px;
	font-family: inherit;
	font-size: 18px;
	color: #fff;
	cursor: pointer;
	transition: transform 0.15s ease, background-color 0.2s ease;
}

.info > button:hover {
	background: rgba(0, 0, 0, 0.82);
}

.info > button:active {
	transform: scale(0.96);
}

.audio_toggle,
.info_btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	position: static;
}

.info_btn {
	letter-spacing: 0.5px;
}

.info_dialog {
	border: none;
	border-radius: 18px;
	padding: 24px 28px;
	max-width: min(420px, 90vw);
	background: rgba(12, 12, 12, 0.92);
	color: #f9f5ec;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
	font-size: 64px;
}

.info_dialog::backdrop {
	background-image: url('img/9_intro_outro_screens/overlay.jpg');
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
}

.info h3 {
	color: #8d8129;
	font-size: 32px;
	font-weight: 100;
}

.info p {
	font-size: 28px;
	color: #423e22;
}

.info a {
	color: #8d8129;
	text-decoration: none;
}

.info_dialog a:hover {
	text-decoration: underline;
}

.info_dialog_header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
}

.dialog_close {
	background: transparent;
	border: none;
	color: inherit;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 6px;
}

.dialog_close:focus-visible {
	outline: 2px solid #ffdc04;
	outline-offset: 3px;
}
s .info_dialog_note {
	margin-top: 18px;
	font-size: 50px;
	opacity: 0.85;
}

@media (max-width: 600px) {
	.info {
		top: 16px;
		right: 16px;
		gap: 8px;
	}

	.info > button {
		padding: 8px 12px;
		font-size: 16px;
	}
}

.overlay_game_screen,
.overlay_game_screen_won,
.overlay_game_screen_lost {
	width: 90vw;
	max-width: 1024px;
	max-height: clamp(260px, 44vh, 440px);
	aspect-ratio: 3 / 2;
	border-radius: 22px;
	/* box-shadow: 0 18px 38px rgba(0, 0, 0, 0.55); */
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: center;
	gap: 16px;
	padding: clamp(8px, 4.5vw, 4px);
	color: #1a1610;
	background-position: center bottom;
	background-size: contain;
	background-repeat: no-repeat;
}

.overlay_game_screen {
	background-image: url('img/9_intro_outro_screens/start/startscreen_1.png');
}

.overlay_game_screen_won {
	background-image: url('img/You won, you lost/You won A.png');
}

.overlay_game_screen_lost {
	background-image: url('img/You won, you lost/You lost.png');
}

.overlay_game_screen p {
	font-size: 20px;
}

.overlay_game_screen h4,
.overlay_game_screen_won h4,
.overlay_game_screen_lost h4 {
	margin-top: auto;
}

.overlay_game_text {
	width: 90vw;
	max-width: 1024px;
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 20px;
	padding: 16px 22px;
	background: rgba(255, 157, 0, 0.767);
	border: 2px solid rgba(255, 158, 0, 0.75);
	border-radius: 18px;
	color: #0a0a0a;
	box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45);
}

.overlay_game_text_col {
	display: flex;
	flex-direction: column;
	gap: 10px;
	flex: 1 1 230px;
	text-align: left;
	align-items: flex-start;
}

.overlay_game_text_col:last-child {
	text-align: right;
	align-items: flex-end;
}

.overlay_game_text p {
	font-size: 24px;
	font-weight: 500;
	line-height: 1.35;
	color: #060606;
	text-shadow: 1px 1px 0 #ffdc04, -1px 1px 0 #ff9e00, 0 2px 8px rgba(255, 90, 31, 0.65);
}

button {
	font-family: inherit;
	font-size: 22px;
	cursor: pointer;
}

.overlay_btn {
	padding: 12px 28px;
	border: 2px solid rgba(255, 158, 0, 0.8);
	border-radius: 16px;
	background: rgba(0, 0, 0, 0.65);
	color: #ffdc04;
	text-transform: uppercase;
	letter-spacing: 2px;
	box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.overlay_btn:active {
	transform: scale(0.96);
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
}

.mobile_controls {
	position: fixed;
	bottom: 32px;
	display: none;
	flex-direction: column;
	gap: 18px;
	padding: 12px 16px;
	background: rgba(0, 0, 0, 0.35);
	border: 2px solid rgba(255, 158, 0, 0.6);
	border-radius: 20px;
	z-index: 50;
	touch-action: manipulation;
	backdrop-filter: blur(6px);
}

.mobile_controls_left {
	left: 24px;
}

.mobile_controls_right {
	right: 24px;
}

.mobile_btn {
	appearance: none;
	border: none;
	background: none;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mobile_btn img {
	width: 72px;
	height: 72px;
	display: block;
}

.orientation-warning {
	position: fixed;
	inset: 0;
	padding: 24px;
	display: none;
	place-items: center;
	background: rgb(0, 0, 0);
	color: #fff;
	z-index: 999;
	text-align: center;
}
.orientation-warning p {
	font-size: 36px;
}

.orientation-warning.show {
	display: grid;
}

.d_none {
	display: none !important;
}

/* ---------- Breakpoints ---------- */

@media (max-width: 1100px) {
	h1 {
		font-size: 56px;
		letter-spacing: 3px;
	}

	canvas,
	.overlay_game_screen,
	.overlay_game_screen_won,
	.overlay_game_screen_lost {
		max-width: 900px;
		max-height: 58vh;
	}

	.overlay_game_text {
		max-width: 900px;
		gap: 40px;
	}
}

@media (max-width: 900px) {
	h1 {
		font-size: 48px;
		letter-spacing: 2px;
	}

	.background {
		gap: 18px;
		padding: 26px 20px 44px;
	}

	canvas,
	.overlay_game_screen,
	.overlay_game_screen_won,
	.overlay_game_screen_lost,
	.overlay_game_text {
		width: 94vw;
	}

	.overlay_game_text {
		flex-direction: column;
		align-items: center;
		text-align: center;
		gap: 24px;
	}

	.overlay_game_text_col,
	.overlay_game_text_col:last-child {
		align-items: center;
		text-align: center;
	}
}

@media (max-width: 720px) {
	h1 {
		font-size: 42px;
	}

	canvas,
	.overlay_game_screen,
	.overlay_game_screen_won,
	.overlay_game_screen_lost {
		max-width: 640px;
		max-height: 56vh;
	}

	.mobile_btn img {
		width: 64px;
		height: 64px;
	}
}

@media (max-width: 540px) {
	h1 {
		font-size: 36px;
		letter-spacing: 1px;
	}

	.background {
		gap: 16px;
		padding: 22px 16px 112px;
	}

	canvas,
	.overlay_game_screen,
	.overlay_game_screen_won,
	.overlay_game_screen_lost {
		width: 96vw;
		max-height: 58vh;
		border-radius: 20px;
		margin-bottom: 14px;
	}

	.overlay_game_text {
		width: 96vw;
		padding: 20px;
		border-radius: 16px;
	}

	.overlay_btn {
		width: 100%;
		justify-content: center;
	}

	.mobile_controls_left {
		left: 16px;
	}

	.mobile_controls_right {
		right: 16px;
	}
}

@media (max-width: 420px) {
	h1 {
		font-size: 32px;
	}

	.background {
		padding-bottom: 140px;
	}

	.mobile_controls {
		bottom: 24px;
		gap: 14px;
	}

	.mobile_btn img {
		width: 56px;
		height: 56px;
	}
}

@media (max-height: 620px) and (orientation: landscape) {
	body {
		align-items: center;
	}

	canvas,
	.overlay_game_screen,
	.overlay_game_screen_won,
	.overlay_game_screen_lost {
		max-height: 82vh;
	}

	.background {
		padding-top: 20px;
		padding-bottom: 32px;
	}
}

/* ---------- Touch-Geräte ---------- */

@media (hover: none) and (pointer: coarse) {
	body {
		overflow: hidden;
	}

	.background {
		padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px));
	}

	h1 {
		font-size: 34px;
		letter-spacing: 1px;
	}

	canvas,
	.overlay_game_screen,
	.overlay_game_screen_won,
	.overlay_game_screen_lost {
		width: 96vw;
		max-width: 820px;
		max-height: 70vh;
		margin-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
	}

	.overlay_game_text {
		display: none;
	}

	.overlay_btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}

	.mobile_controls {
		display: flex;
	}

	.overlay_game_screen h4,
	.overlay_game_screen_won h4,
	.overlay_game_screen_lost h4 {
		display: none;
	}
}

@media (hover: none) and (pointer: coarse) and (orientation: portrait) {
	canvas,
	.overlay_game_screen,
	.overlay_game_screen_won,
	.overlay_game_screen_lost {
		max-width: 92vw;
		max-height: 68vh;
	}
}

@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
	canvas,
	.overlay_game_screen,
	.overlay_game_screen_won,
	.overlay_game_screen_lost {
		max-width: 94vw;
		max-height: 78vh;
	}

	.background {
		padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
	}
}
