/* Global reset so background fills viewport */
html, body {
	height: 100%;
	margin: 0;
	overflow-x: hidden; /* avoid horizontal scrollbar */
	overflow-y: hidden; /* avoid vertical scrollbar */
}

/* Full-screen responsive background image */
body {
	/* Path to your image in the Bilder folder. It contains spaces so keep the quotes. */
	background-image: url("Bilder/1080p Horn background.jpg");
	background-size: cover;           /* cover viewport while preserving aspect ratio */
	background-position: center center; /* center focal point */
	background-repeat: no-repeat;
	background-attachment: fixed;     /* parallax-like on desktop; changed on mobile below */
	background-color: #2b231c;       /* fallback color while image loads */
	-webkit-font-smoothing: antialiased;
	font-family: Arial, Helvetica, sans-serif;
}

/* On smaller screens, don't use fixed attachment (better performance & compatibility) */
@media (max-width: 768px) {
	body {
		background-attachment: scroll;
		background-position: center top;
	}
}

/* Utility: allow easily centering page content if needed */
.page-center {
	/* Fill viewport minus reserved bottom space for panels + footer AND header */
	min-height: calc(100svh - var(--reserve-bottom, 0px));
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Example overlay text style (optional) */
h1.site-title {
	color: #f0e6d6;
	text-shadow: 0 2px 6px rgba(0,0,0,0.6);
	margin: 0;
	padding: 1rem;
	font-family: 'Cinzel', serif;
	letter-spacing: 2px;
}

/* Accessibility: prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
	body { background-attachment: scroll; }
}

/* Site header with logo and title */
.site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 50;
	background: linear-gradient(135deg, rgba(30,20,15,0.85) 0%, rgba(25,18,14,0.78) 55%, rgba(50,28,15,0.65) 100%);
	backdrop-filter: blur(8px) saturate(115%);
	-webkit-backdrop-filter: blur(8px) saturate(115%);
	display: flex;
	align-items: center;
	padding: 12px 20px;
	gap: 16px;
	box-sizing: border-box;
	border-bottom: 1px solid rgba(255,255,255,0.08);
	overflow: hidden; /* contain pseudo-element glow */
	box-shadow: 0 4px 18px -4px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04), inset 0 -1px 0 rgba(255,255,255,0.05);
}

.site-header::before {
	content: '';
	position: absolute;
	inset: 0;
	background: radial-gradient(circle at 70px 50%, rgba(255,122,89,0.35), rgba(255,122,89,0.05) 55%, transparent 70%),
		linear-gradient(90deg, rgba(255,122,89,0.18) 0%, rgba(255,122,89,0) 25%, rgba(255,122,89,0) 75%, rgba(255,122,89,0.18) 100%);
	opacity: 0.55;
	pointer-events: none;
	mix-blend-mode: screen;
}

.logo-container {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.site-logo {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.site-title-header {
	color: #ffefd6;
	font-size: 1.5rem;
	font-weight: 700;
	margin: 0;
	text-shadow: 0 2px 4px rgba(0,0,0,0.6);
	letter-spacing: 0.5px;
	font-family: Arial, Helvetica, sans-serif;
}

.version-badge {
	margin-left: auto;
	color: rgba(255,255,255,0.55);
	font-size: 0.8rem;
	font-weight: 400;
	padding: 5px 12px;
	background: rgba(255,255,255,0.08);
	border-radius: 20px;
	border: 1px solid rgba(255,255,255,0.12);
	text-shadow: 0 1px 2px rgba(0,0,0,0.4);
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	box-sizing: border-box;
}

.edition-badge {
	margin-left: auto;
	color: #ffdca8;
	font-size: 0.8rem;
	font-weight: 600;
	padding: 5px 12px;
	background: linear-gradient(135deg, rgba(255,122,89,0.35), rgba(255,122,89,0.15));
	border: 1px solid rgba(255,122,89,0.5);
	border-radius: 20px;
	box-shadow: 0 2px 6px rgba(0,0,0,0.45);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	letter-spacing: 0.5px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	box-sizing: border-box;
}

.client-counter {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #7CFC00;
	font-size: 0.8rem;
	font-weight: 600;
	padding: 5px 12px;
	background: rgba(124, 252, 0, 0.12);
	border: 1px solid rgba(124, 252, 0, 0.35);
	border-radius: 20px;
	box-shadow: 0 2px 6px rgba(0,0,0,0.45);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	transition: transform 0.2s ease-out;
	height: 28px;
	box-sizing: border-box;
}

.client-counter svg {
	opacity: 0.85;
}

.client-counter strong {
	min-width: 20px;
	text-align: center;
}

/* Connection status popup banner container */
.connection-banner-container {
	position: fixed;
	top: 80px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 9998;
	display: flex;
	flex-direction: column;
	gap: 8px;
	pointer-events: none;
}

.connection-banner {
	background: linear-gradient(135deg, rgba(30,20,15,0.95) 0%, rgba(25,18,14,0.92) 100%);
	color: #fff;
	padding: 12px 24px;
	border-radius: 12px;
	box-shadow: 0 6px 20px rgba(0,0,0,0.6);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1px solid rgba(255,255,255,0.15);
	font-size: 0.95rem;
	font-weight: 600;
	white-space: nowrap;
	opacity: 0;
	transform: translateY(-20px);
	transition: all 0.3s ease-out;
	pointer-events: none;
}

.connection-banner.show {
	opacity: 1;
	transform: translateY(0);
}

.connection-banner.joined {
	border-left: 4px solid #7CFC00;
	color: #7CFC00;
}

.connection-banner.left {
	border-left: 4px solid #ff4d4d;
	color: #ff9999;
}

@media (max-width: 420px) {
	.site-header { padding: 6px 10px; gap: 10px; }
	.logo-container { width: 36px; height: 36px; }
	.site-title-header { font-size: 1rem; }
	.version-badge { font-size: 0.65rem; padding: 3px 8px; }
	.edition-badge { font-size: 0.6rem; padding: 3px 8px; }
	.client-counter { font-size: 0.75rem; padding: 3px 8px; gap: 4px; }
	.client-counter svg { width: 16px; height: 16px; }
	.connection-banner-container { top: 70px; }
	.connection-banner { font-size: 0.85rem; padding: 10px 20px; }
}

@media (max-width: 340px) {
	.site-header { padding: 4px 8px; gap: 8px; }
	.logo-container { width: 32px; height: 32px; }
	.site-title-header { font-size: 0.9rem; }
	.version-badge { font-size: 0.6rem; padding: 2px 6px; }
	.edition-badge { font-size: 0.55rem; padding: 2px 6px; }
	.client-counter { font-size: 0.7rem; padding: 2px 6px; }
	.connection-banner { top: 60px; font-size: 0.8rem; padding: 8px 16px; }
}

/* Responsive centered button (image) */
.horn-btn {
	display: block;
 	/* doubled size: was min(40vw, 320px) -> now min(80vw, 640px) */
 	width: min(80vw, 640px);
 	max-width: 80%;
 	height: auto;
 	cursor: pointer;
 	-webkit-tap-highlight-color: transparent;
 	transition: transform 150ms ease, opacity 150ms ease;
 	user-select: none;
}

@media (max-width: 340px) {
	.horn-btn {
		width: min(70vw, 400px);
		max-width: 70%;
	}
}

.horn-btn:active,
.horn-btn.active {
	transform: scale(0.98);
	opacity: 0.95;
}

/* Small countdown badge positioned over the button (optional) */
.btn-badge {
	position: absolute;
	transform: translate(-50%, -50%);
	left: 50%;
	top: 60%;
	background: rgba(0,0,0,0.6);
	color: #fff;
	padding: 6px 10px;
	border-radius: 14px;
	font-size: 0.9rem;
	pointer-events: none;
}

/* Ensure page-center is positioned to allow absolutely-positioned badge */
.page-center { position: relative; }

/* Tutorial modal styles */
.tutorial-modal { 
	position: fixed; 
	inset: 0; 
	display: none; 
	align-items: center; 
	justify-content: center; 
	z-index: 9000; 
	padding: 20px; 
	box-sizing: border-box; 
}
.tutorial-modal[aria-hidden="false"] { display: flex; }
.tutorial-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(4px); }
.tutorial-card { 
	position: relative; 
	background: linear-gradient(145deg, rgba(45,35,30,0.98), rgba(35,28,24,0.98)); 
	color: #fff; 
	width: min(720px, calc(100% - 40px)); 
	max-width: calc(100% - 40px);
	margin: 20px;
	border-radius: 12px; 
	padding: 20px 22px; 
	box-shadow: 0 8px 30px rgba(0,0,0,0.6); 
	transform: translateY(0); 
	max-height: calc(100% - 40px); 
	display: flex; 
	flex-direction: column; 
	overflow: hidden; 
}
.tutorial-card h2 { margin: 0 0 8px 0; font-size: 1.4rem; }
.tutorial-card h3 { margin: 10px 0 6px 0; font-size: 1rem; color: #ffdca8; }
.tutorial-body { overflow: auto; -webkit-overflow-scrolling: touch; }
.tutorial-body p, .tutorial-body ul { color: #e9e7e1; margin: 0 0 8px 0; }
.tutorial-body ul { padding-left: 18px; }
.tutorial-close { position: absolute; right: 10px; top: 8px; background: transparent; border: none; color: #ddd; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.tutorial-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06); }
.btn-primary { background: #ff7a59; color: #fff; border: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 700; transition: all 0.2s ease; }
.btn-primary:hover { background: #ff8a69; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(1px); }
.btn-secondary { background: rgba(255,255,255,0.06); color: #fff; border: 1px solid rgba(255,255,255,0.06); padding: 8px 12px; border-radius: 8px; cursor: pointer; }

/* Name Input Modal */
.name-modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 9200; padding: 12px; box-sizing: border-box; }
.name-modal[aria-hidden="false"] { display: flex; }
.name-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.name-card { position: relative; background: linear-gradient(145deg, rgba(30,20,15,0.95), rgba(28,18,14,0.92)); color: #fff; width: min(420px, 90vw); border-radius: 16px; padding: 28px 24px; box-shadow: 0 12px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.08); backdrop-filter: blur(10px) saturate(120%); -webkit-backdrop-filter: blur(10px) saturate(120%); border: 1px solid rgba(255,255,255,0.08); transform: scale(0.95); transition: transform 0.3s ease; z-index: 9201; }
.name-modal[aria-hidden="false"] .name-card { transform: scale(1); }
.name-card h2 { margin: 0 0 16px 0; font-size: 1.5rem; color: #ffdca8; text-align: center; text-shadow: 0 2px 8px rgba(255,122,89,0.4); }
.name-body { margin-bottom: 20px; }
.name-body p { color: #ffefd6; margin: 0 0 12px 0; font-size: 0.95rem; text-align: center; }
.name-body input { width: 100%; padding: 12px 14px; background: rgba(0,0,0,0.5); border: 2px solid rgba(255,122,89,0.3); border-radius: 10px; color: #fff; font-size: 1.1rem; font-family: Arial, Helvetica, sans-serif; outline: none; transition: all 0.2s ease; box-sizing: border-box; text-align: center; }
.name-body input:focus { border-color: rgba(255,122,89,0.7); background: rgba(0,0,0,0.65); box-shadow: 0 0 0 3px rgba(255,122,89,0.15); }
.name-body input::placeholder { color: rgba(255,255,255,0.4); }
.name-hint { font-size: 0.8rem; color: rgba(255,220,168,0.6); margin-top: 8px !important; }
.name-actions { display: flex; justify-content: center; }
.name-actions .btn-primary { width: 100%; padding: 12px 20px; font-size: 1rem; background: linear-gradient(135deg, rgba(255,122,89,0.8), rgba(255,122,89,0.6)); color: #fff; font-weight: 700; border: 1px solid rgba(255,122,89,0.5); transition: all 0.2s ease; }
.name-actions .btn-primary:hover { background: linear-gradient(135deg, rgba(255,122,89,0.9), rgba(255,122,89,0.7)); box-shadow: 0 0 12px rgba(255,122,89,0.4); }

/* Lobby Selection Modal */
.lobby-modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 9100; padding: 12px; box-sizing: border-box; }
.lobby-modal[aria-hidden="false"] { display: flex; }
.lobby-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.lobby-card { position: relative; background: linear-gradient(145deg, rgba(30,20,15,0.98), rgba(28,18,14,0.95)); color: #fff; width: min(480px, 90vw); border-radius: 16px; padding: 28px 24px; box-shadow: 0 12px 40px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.1); backdrop-filter: blur(12px) saturate(120%); -webkit-backdrop-filter: blur(12px) saturate(120%); border: 1px solid rgba(255,255,255,0.1); transform: scale(0.95); transition: transform 0.3s ease; z-index: 9101; }
.lobby-modal[aria-hidden="false"] .lobby-card { transform: scale(1); }
.lobby-card h2 { margin: 0 0 16px 0; font-size: 1.5rem; color: #ffdca8; text-align: center; text-shadow: 0 2px 8px rgba(255,122,89,0.4); }
.lobby-body { margin-bottom: 20px; }
.lobby-body > p { color: #ffefd6; margin: 0 0 16px 0; font-size: 0.95rem; text-align: center; }
.lobby-options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.lobby-option { display: flex; align-items: flex-start; gap: 12px; padding: 16px; background: rgba(0,0,0,0.3); border: 2px solid rgba(255,122,89,0.2); border-radius: 12px; cursor: pointer; transition: all 0.2s ease; }
.lobby-option:hover { background: rgba(0,0,0,0.4); border-color: rgba(255,122,89,0.4); }
.lobby-option input[type="radio"] { margin-top: 2px; accent-color: #ff7a59; width: 18px; height: 18px; cursor: pointer; }
.lobby-option input[type="radio"]:checked + .option-content { color: #ffdca8; }
.lobby-option:has(input:checked) { background: rgba(255,122,89,0.15); border-color: rgba(255,122,89,0.6); }
.option-content { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.option-content strong { font-size: 1.05rem; color: #fff; }
.option-content small { font-size: 0.85rem; color: rgba(255,255,255,0.6); }
.join-code-section { margin-bottom: 16px; }
.join-code-section input { width: 100%; padding: 12px 14px; background: rgba(0,0,0,0.5); border: 2px solid rgba(255,122,89,0.3); border-radius: 10px; color: #fff; font-size: 1.3rem; font-family: 'Courier New', monospace; letter-spacing: 4px; text-transform: uppercase; outline: none; transition: all 0.2s ease; box-sizing: border-box; text-align: center; font-weight: 700; }
.join-code-section input:focus { border-color: rgba(255,122,89,0.7); background: rgba(0,0,0,0.65); box-shadow: 0 0 0 3px rgba(255,122,89,0.15); }
.join-code-section input::placeholder { color: rgba(255,255,255,0.3); letter-spacing: 2px; }
.lobby-hint { font-size: 0.8rem; color: rgba(255,220,168,0.6); margin-top: 8px !important; text-align: center; }
.lobby-actions { display: flex; justify-content: center; }
.lobby-actions .btn-primary { width: 100%; padding: 12px 20px; font-size: 1rem; background: linear-gradient(135deg, rgba(255,122,89,0.8), rgba(255,122,89,0.6)); color: #fff; font-weight: 700; border: 1px solid rgba(255,122,89,0.5); transition: all 0.2s ease; }
.lobby-actions .btn-primary:hover { background: linear-gradient(135deg, rgba(255,122,89,0.9), rgba(255,122,89,0.7)); box-shadow: 0 0 12px rgba(255,122,89,0.4); }

/* Lobby Code Badge in Header */
.lobby-code-badge { display: inline-flex; align-items: center; gap: 8px; color: #ffdca8; font-size: 0.8rem; font-weight: 700; padding: 5px 12px; background: linear-gradient(135deg, rgba(255,122,89,0.3), rgba(255,122,89,0.2)); border: 1px solid rgba(255,122,89,0.45); border-radius: 20px; box-shadow: 0 2px 6px rgba(0,0,0,0.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); font-family: 'Courier New', monospace; letter-spacing: 2px; height: 28px; box-sizing: border-box; }
.copy-code-btn { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; padding: 4px 6px; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; }
.copy-code-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }
.copy-code-btn:active { transform: scale(0.95); }

@media (max-width: 420px) {
	.tutorial-card { width: calc(100% - 28px); padding: 14px; border-radius: 10px; }
	.tutorial-card h2 { font-size: 1.1rem; }
	.name-card { padding: 20px 18px; }
	.name-card h2 { font-size: 1.2rem; }
	.lobby-card { padding: 20px 18px; }
	.lobby-card h2 { font-size: 1.2rem; }
	.lobby-code-badge { font-size: 0.8rem; padding: 4px 10px; gap: 6px; letter-spacing: 1px; }
	.copy-code-btn svg { width: 12px; height: 12px; }
}

/* Wrapper that contains controls and stats so stats always remain below controls */
.controls-wrapper {
	position: fixed;
	left: 50%;
	transform: translateX(-50%);
	/* keep above safe-area bottom */
	bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	z-index: 40;
	/* make the wrapper define the usable width so children can be 100% */
	max-width: min(640px, 90vw);
	width: 100%;
	box-sizing: border-box;
}

/* Controls for timing (small, unobtrusive) - now inside .controls-wrapper */
.controls {
	position: static; /* flow inside wrapper */
	background: linear-gradient(145deg, rgba(30,20,15,0.82) 0%, rgba(28,18,14,0.78) 45%, rgba(55,30,15,0.6) 100%);
	color: #fff;
	padding: 12px 14px;
	border-radius: 14px;
	display: flex;
	gap: 10px;
	align-items: center;
	font-size: 0.9rem;
	backdrop-filter: blur(10px) saturate(120%);
	-webkit-backdrop-filter: blur(10px) saturate(120%);
	box-sizing: border-box;
	max-width: 100%;
	width: 100%;
	flex-wrap: wrap; /* allow items to wrap instead of overflowing */
	box-shadow: 0 4px 18px -6px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.05), inset 0 0 0 1px rgba(255,255,255,0.04);
	border: 1px solid rgba(255,255,255,0.08);
	position: relative;
}

/* Separate stats panel placed below the controls (now flows inside .controls-wrapper) */
.stats-panel {
	position: static; /* flow inside wrapper under the controls */
	background: linear-gradient(145deg, rgba(30,20,15,0.82) 0%, rgba(28,18,14,0.78) 45%, rgba(55,30,15,0.6) 100%);
	color: #fff;
	/* increase padding so labels/numbers never touch the panel edge */
	padding: 12px 14px;
	border-radius: 14px;
	display: flex;
	align-items: center;
	gap: 10px;
	z-index: 39;
	backdrop-filter: blur(10px) saturate(120%);
	-webkit-backdrop-filter: blur(10px) saturate(120%);
	box-sizing: border-box;
	max-width: 100%;
	width: 100%;
	justify-content: center;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 0.9rem;
	font-weight: 700;
	box-shadow: 0 4px 18px -6px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.05), inset 0 0 0 1px rgba(255,255,255,0.04);
	border: 1px solid rgba(255,255,255,0.08);
	position: relative;
}

/* Admin Reset Modal */
.admin-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1000;
	display: none;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s ease;
	padding: 12px;
	box-sizing: border-box;
}

.admin-modal[aria-hidden="false"] {
	display: flex;
	opacity: 1;
}

.admin-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0,0,0,0.75);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	cursor: pointer;
}

.admin-panel {
	position: relative;
	background: linear-gradient(145deg, rgba(60,20,20,0.95) 0%, rgba(50,18,18,0.92) 45%, rgba(70,25,25,0.88) 100%);
	color: #fff;
	padding: 24px;
	border-radius: 16px;
	max-width: 450px;
	width: 90%;
	font-family: Arial, Helvetica, sans-serif;
	box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,122,89,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
	border: 2px solid rgba(255,122,89,0.4);
	transform: scale(0.9);
	transition: transform 0.3s ease;
	z-index: 1001;
}

.admin-modal[aria-hidden="false"] .admin-panel {
	transform: scale(1);
}

.admin-close {
	position: absolute;
	top: 12px;
	right: 12px;
	background: transparent;
	border: none;
	color: rgba(255,255,255,0.6);
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	transition: all 0.2s ease;
}

.admin-close:hover {
	color: #fff;
	transform: scale(1.1);
}

.admin-header {
	display: flex;
	align-items: center;
	gap: 10px;
	color: #ff7a59;
	font-size: 1.1rem;
	font-weight: 700;
	margin-bottom: 18px;
	text-transform: uppercase;
	letter-spacing: 0.8px;
}

.admin-header svg {
	opacity: 0.9;
}

.admin-body {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.admin-warning {
	background: rgba(255,193,7,0.15);
	border: 1px solid rgba(255,193,7,0.4);
	border-radius: 8px;
	padding: 12px;
	margin: 0;
	color: #ffc107;
	font-size: 0.9rem;
	font-weight: 600;
	text-align: center;
}

.admin-info {
	color: #ffefd6;
	font-size: 0.9rem;
	text-align: center;
	margin: 0;
}

.admin-controls {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.btn-reset {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 12px 20px;
	background: linear-gradient(135deg, #ff7a59, #ff5733);
	border: 1px solid rgba(255,122,89,0.6);
	border-radius: 10px;
	color: #fff;
	font-size: 1rem;
	font-weight: 700;
	font-family: Arial, Helvetica, sans-serif;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 3px 12px rgba(255,122,89,0.4);
	text-transform: uppercase;
	letter-spacing: 0.8px;
}

.btn-reset:hover:not(:disabled) {
	background: linear-gradient(135deg, #ff8a69, #ff6744);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(255,122,89,0.4);
}

.btn-reset:active:not(:disabled) {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(255,122,89,0.3);
}

.btn-reset:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.btn-reset svg {
	width: 16px;
	height: 16px;
}

.reset-message {
	margin-top: 8px;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 0.85rem;
	font-weight: 600;
	text-align: center;
	min-height: 20px;
	transition: all 0.3s ease;
}

.reset-message.success {
	background: rgba(46,204,113,0.2);
	border: 1px solid rgba(46,204,113,0.4);
	color: #2ecc71;
}

.reset-message.error {
	background: rgba(231,76,60,0.2);
	border: 1px solid rgba(231,76,60,0.4);
	color: #e74c3c;
}

/* Footer styling to match the visual language of the controls/stats */
.site-footer {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 20;
	background: linear-gradient(145deg, rgba(20,12,8,0.90) 0%, rgba(18,11,7,0.84) 45%, rgba(38,20,10,0.70) 100%);
	color: #fff;
	padding: 12px 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	font-size: 0.85rem;
	box-sizing: border-box;
	width: 100%;
	-webkit-backdrop-filter: blur(10px) saturate(120%);
	backdrop-filter: blur(10px) saturate(120%);
	text-align: center;
	flex-wrap: wrap;
	box-shadow: 0 -4px 18px -6px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.05), inset 0 1px 0 rgba(255,255,255,0.04);
	border-top: 1px solid rgba(255,255,255,0.08);
}
.site-footer small { color: #e9e7e1; font-weight: 600; }

@media (max-width: 420px) {
	.site-footer { padding: 8px 10px; font-size: 0.8rem; }
	.controls { padding: 10px 12px; gap: 8px; }
	.stats-panel { padding: 10px 12px; gap: 8px; }
}

	/* Group wrappers so inputs and buttons can be managed independently */
	.controls-group {
		display: flex;
		gap: 8px;
		align-items: center;
		justify-content: center;
		flex-wrap: wrap;
	}

	/* Field groups: keep label+input together as a unit and prevent them from splitting */
	.controls .field {
		display: inline-flex;
		gap: 8px;
		align-items: center;
		flex: 0 0 auto; /* don't stretch by default */
		white-space: nowrap; /* prevent label and input from breaking onto separate lines */
	}

	/* On very small screens, allow the field to become full-width and stack label+input vertically */
	@media (max-width: 340px) {
		.controls .field { flex-direction: column; white-space: normal; align-items: center; width: 100%; }
		.controls .field input[type="number"] { width: 80%; }
	}

	/* Specific small-screen behavior: stack controls-group vertically and center their children */
	@media (max-width: 420px){
		.controls { gap: 8px; padding: 6px; font-size: 0.9rem; justify-content: center; }
		.controls-group { flex-direction: row; justify-content: center; }
		/* when width is very narrow, stack groups vertically */
	}

	@media (max-width: 340px) {
		.controls { gap: 10px; }
		.controls-group { flex-direction: column; align-items: center; width: 100%; }
		.inputs-group { gap: 6px; }
		.buttons-group { gap: 6px; }
		.controls input[type="number"] { width: 100%; }
		.controls button { width: 100%; }
	}

/* Label layout: icon + text; icons are hidden by default and shown when space is tight */
.controls .ctrl-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #fff;
	font-size: 0.9rem;
	flex: 0 0 auto;
	/* ensure touch target meets ~44px guideline */
	min-width: 44px;
	min-height: 44px;
	padding: 6px 8px;
	box-sizing: border-box;
	justify-content: center;
}
/* Apply medieval-style font to label text for a 'Wickinger' look */
.controls .ctrl-label .text {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 1.1rem; /* larger */
	font-weight: 700; /* bold */
	letter-spacing: 1px;
	color: #ffefd6;
	text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.controls .ctrl-label .icon {
	display: none; /* shown on narrow screens */
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
	width: 28px;
	height: 28px;
}
.controls .ctrl-label .icon svg { width: 28px; height: 28px; }
.controls .ctrl-label .text { display: inline; }

/* Keep controls centered when there is room */
.controls { justify-content: center; }

.controls input[type="number"]{
	width: 70px;
	padding: 4px 6px;
	border-radius: 6px;
	border: 1px solid rgba(255,255,255,0.15);
	background: rgba(255,255,255,0.06);
	color: #fff;
	box-sizing: border-box;
	min-width: 48px;
	flex: 0 0 auto;
	font-size: 1rem;
	font-weight: 600;
}

.controls button{
	padding: 6px 8px;
	border-radius: 6px;
	background: linear-gradient(135deg, rgba(255,120,120,0.35), rgba(255,100,100,0.25));
	border: 1px solid rgba(255,120,120,0.45);
	box-shadow: 0 2px 8px rgba(255,120,120,0.25);
	color: #fff;
	cursor: pointer;
	flex: 0 0 auto;
	font-family: Arial, Helvetica, sans-serif;
	letter-spacing: 0.6px;
	font-size: 1rem;
	font-weight: 700;
	transition: all 0.2s ease;
}

.controls button:hover:not([disabled]) {
	background: linear-gradient(135deg, rgba(255,120,120,0.45), rgba(255,100,100,0.35));
	box-shadow: 0 3px 12px rgba(255,120,120,0.4);
}

.controls button[disabled]{
	opacity: 0.5;
	cursor: default;
}

/* Mute button styling - Always RED, icon changes to show mute state */
.controls button.mute-btn {
	background: linear-gradient(135deg, rgba(255,120,120,0.35), rgba(255,100,100,0.25));
	border: 1px solid rgba(255,120,120,0.45);
	box-shadow: 0 2px 8px rgba(255,120,120,0.25);
}

.controls button.mute-btn:hover:not([disabled]) {
	background: linear-gradient(135deg, rgba(255,120,120,0.45), rgba(255,100,100,0.35));
	box-shadow: 0 3px 12px rgba(255,120,120,0.4);
}

.controls button.mute-btn.muted {
	background: linear-gradient(135deg, rgba(255,120,120,0.35), rgba(255,100,100,0.25));
	border: 1px solid rgba(255,120,120,0.45);
	box-shadow: 0 2px 8px rgba(255,120,120,0.25);
}

.controls button.mute-btn.muted:hover:not([disabled]) {
	background: linear-gradient(135deg, rgba(255,120,120,0.45), rgba(255,100,100,0.35));
	box-shadow: 0 3px 12px rgba(255,120,120,0.4);
}

/* Admin button styling - same as other buttons */
.controls button.admin-btn {
	background: linear-gradient(135deg, rgba(255,120,120,0.35), rgba(255,100,100,0.25));
	border: 1px solid rgba(255,120,120,0.45);
	box-shadow: 0 2px 8px rgba(255,120,120,0.25);
}

.controls button.admin-btn:hover:not([disabled]) {
	background: linear-gradient(135deg, rgba(255,120,120,0.45), rgba(255,100,100,0.35));
	box-shadow: 0 3px 12px rgba(255,120,120,0.4);
}

.controls .small{ font-size: 0.95rem; opacity: 0.9; font-family: Arial, Helvetica, sans-serif; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }

/* Stats block styling */
.controls .stats { gap: 12px; display: inline-flex; align-items: center; }
.controls .stats span { color: #ffefd6; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.controls .stats strong { color: #fff; font-size: 1.02rem; min-width: 28px; display: inline-block; text-align: right; line-height: 1; vertical-align: middle; }

.stats-panel .stats { gap: 12px; display: flex; align-items: center; padding: 8px; justify-content: center; flex-wrap: wrap; }
.stats-panel .stats span { color: #ffefd6; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; font-family: Arial, Helvetica, sans-serif; flex: 0 0 auto; }
.stats-panel .stats strong { color: #fff; font-size: 1.02rem; min-width: 28px; display: inline-block; text-align: right; font-family: Arial, Helvetica, sans-serif; line-height: 1; vertical-align: middle; }

.status-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; }
.status-icon svg { display: none; }
/* Inverted mapping: show START icon when timer is stopped (next action = Start)
	and show STOP icon when timer is running (next action = Stop). */
.status-icon .icon-start { display: inline-block; color: #ffefd6; }
.status-icon .icon-stop { display: none; }
.controls .small.running .status-icon .icon-start { display: none; }
.controls .small.running .status-icon .icon-stop { display: inline-block; color: #ff4d4d; }
.controls .small.stopped .status-icon .icon-start { display: inline-block; color: #7CFC00; }
.range-text { color: #ffefd6; }

@media (max-width: 420px){
	.controls { gap: 6px; padding: 6px; font-size: 0.8rem; width: 100%; justify-content: center; }
	.controls input[type="number"] { width: 56px; font-size: 0.95rem; }
	/* show icons instead of long label text when narrow */
	.controls .ctrl-label .icon { display: inline-block; }
	.controls .ctrl-label .text { display: none; }

	/* allow stats to wrap as groups on small screens */
	.stats-panel .stats { flex-wrap: wrap; justify-content: center; gap: 8px; }
	.stats-panel .stats span { flex-direction: column; white-space: normal; align-items: center; }

	/* make the wrapper span almost full width and pin closer to the bottom on phones */
	.controls-wrapper { left: 8px; transform: none; width: calc(100% - 16px); bottom: calc(env(safe-area-inset-bottom, 0px) + 60px); }
}

/* For very small screens, stack controls vertically to avoid clipping */
@media (max-width: 340px) {
	.controls {
		flex-direction: column;
		align-items: stretch;
		gap: 6px;
		padding: 8px;
		width: 100%;
		border-radius: 8px;
	}
	/* show only icons in stacked mode to save space */
	.controls .ctrl-label .icon { display: inline-flex; }
	.controls .ctrl-label .text { display: none; }
	.controls .ctrl-label { min-width: 0; }
	.controls input[type="number"] { width: 100%; }
	.controls button { width: 100%; }
	.controls .small { text-align: center; }

	/* on very small screens make each stat a stacked group */
	.stats-panel { width: 100%; }
	.controls-wrapper { left: 8px; right: 8px; transform: none; width: calc(100% - 16px); bottom: calc(env(safe-area-inset-bottom, 0px) + 100px); }
	.stats-panel .stats { flex-direction: row; flex-wrap: wrap; gap: 10px; justify-content: center; }
	.stats-panel .stats span { flex-direction: column; white-space: normal; align-items: center; }
}
