:root {
	--primary-color: #2c3e50;
	--accent-color: #3498db;
	--alive-color: #2ecc71; 
	--dead-color: #e74c3c;
	--bg-color: #f4f6f7;
	--bloch-image-src: url(''); 
}

body {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	background-color: var(--bg-color);
	margin: 0;
	padding: 20px 20px 120px 20px;
	text-align: center;
}

h1 { margin-bottom: 5px; color: var(--primary-color); }
.subtitle { color: #7f8c8d; font-size: 0.9em; margin-bottom: 25px; }

/* --- GRID LAYOUT --- */
.game-grid {
	display: flex;
	flex-wrap: wrap; 
	justify-content: center;
	gap: 30px; 
	margin-bottom: 80px; /* Extra space for bottom controls */
}

/* --- GAME UNIT (Sphere + Controls) --- */
.game-unit {
	background: white;
	border-radius: 15px;
	box-shadow: 0 4px 10px rgba(0,0,0,0.1);
	width: 250px; 
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: transform 0.2s;
}
.game-unit:hover { transform: translateY(-5px); }

/* --- THE ASPECT RATIO FIX --- */
.bloch-view {
	width: 100%;
	height: 300px; /* Increased height to fit sphere + label */
	background-image: var(--bloch-image-src);
	
	/* KEY FIX: 'auto' height preserves the aspect ratio */
	background-size: 500% auto; 
	background-repeat: no-repeat;
	
	/* Centers the sphere vertically in the box */
	background-position-y: center; 
	
	border-bottom: 1px solid #eee;
}

/* Horizontal positions for 5 qubits */
#bloch-0 { background-position-x: 0%; }
#bloch-1 { background-position-x: 25%; }
#bloch-2 { background-position-x: 50%; }
#bloch-3 { background-position-x: 75%; }
#bloch-4 { background-position-x: 100%; }

.unit-body { padding: 20px; }

.state-label {
	font-weight: bold;
	font-size: 1.1em;
	color: var(--primary-color);
	margin-bottom: 10px;
	background: #eee;
	border-radius: 6px;
	padding: 4px 10px;
	display: inline-block;
}

/* Probability Bar */
.prob-container {
	height: 15px;
	background: var(--dead-color);
	border-radius: 8px;
	margin-bottom: 15px;
	position: relative;
	overflow: hidden;
}
.prob-fill {
	height: 100%;
	background: var(--alive-color);
	width: 0%;
	transition: width 0.3s ease;
}

/* Gate Buttons */
.gate-grid {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 8px;
}
.gate-btn {
	border: none;
	background: var(--primary-color);
	color: white;
	padding: 12px 0;
	border-radius: 6px;
	cursor: pointer;
	font-size: 1em;
	font-weight: bold;
	transition: background 0.2s;
}
.gate-btn:hover { opacity: 0.9; transform: scale(1.02); }
.gate-btn.h-gate { background: #5d417f; } 
.gate-btn.s-gate { background: #8e44ad; } 

/* Main Controls */
.main-controls {
	position: fixed;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(255,255,255,0.95);
	padding: 15px 30px;
	border-radius: 50px;
	box-shadow: 0 5px 25px rgba(0,0,0,0.3);
	display: flex;
	gap: 20px;
	backdrop-filter: blur(5px);
	z-index: 100;
}
.action-btn {
	padding: 12px 30px;
	border: none;
	border-radius: 25px;
	font-weight: bold;
	cursor: pointer;
	font-size: 1.1em;
	white-space: nowrap;
}
.measure-btn { background: #f39c12; color: white; }
.reset-btn { background: #e74c3c; color: white; }
.measure-btn:disabled { background: #bdc3c7; cursor: not-allowed; }

/* Results */
.result-overlay {
	display: none;
	font-size: 3em;
	font-weight: bold;
	margin-top: 10px;
}
.alive { color: var(--alive-color); }
.dead { color: var(--dead-color); }

#status-msg { margin-top: 20px; height: 30px; font-weight: bold; font-size: 1.2em; }

#loading {
	position: fixed; top:0; left:0; width:100%; height:100%;
	background: rgba(255,255,255,0.9);
	display: none;
	flex-direction: column;
	justify-content: center; align-items: center;
	z-index: 999;
	color: var(--primary-color);
	font-size: 1.5em;
	font-weight: bold;
}
.footer-text {
	margin-top: 48px;
	margin-bottom: 20px; /* Space above the floating buttons */
	color: #95a5a6;      /* Subtle grey color */
	font-size: 0.64em;
	font-weight: 512;
	text-transform: uppercase;
	letter-spacing: 1px;
}