* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	background-color: #0a0e1a;
	color: #e0e5f0;
	font-family: 'Inter', system-ui, -apple-system, sans-serif;
	font-size: 13px;
	line-height: 1.6;
	overscroll-behavior: none;
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

/* ── Entry animations ─────────────────────────────── */
@keyframes fadeInUp {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes subtlePulse {
	0%, 100% { opacity: 0.6; }
	50%      { opacity: 1; }
}

@keyframes spinnerRotate {
	to { transform: rotate(360deg); }
}

a {
	color: #4a9eff;
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

#back-btn {
	position: fixed;
	top: 16px;
	left: 16px;
	z-index: 100;
	background: rgba(10, 14, 26, 0.8);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border: 1px solid rgba(74, 158, 255, 0.3);
	border-radius: 8px;
	padding: 6px 14px;
	color: #4a9eff;
	font-size: 13px;
	font-family: inherit;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	cursor: pointer;
	text-decoration: none;
	display: inline-block;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
	animation: fadeInUp 0.5s ease-out both;
	animation-delay: 0.3s;
}

#back-btn:hover {
	background: rgba(74, 158, 255, 0.15);
	border-color: #4a9eff;
	text-decoration: none;
	box-shadow: 0 4px 20px rgba(74, 158, 255, 0.2), 0 0 0 1px rgba(74, 158, 255, 0.15);
	transform: translateX(2px);
}

#info {
	position: absolute;
	top: 0;
	width: 100%;
	padding: 12px 16px;
	text-align: center;
	user-select: none;
	pointer-events: none;
	z-index: 1;
	color: #e0e5f0;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
	font-size: 13px;
	background: linear-gradient(180deg, rgba(8, 12, 22, 0.6) 0%, rgba(8, 12, 22, 0.0) 100%);
	letter-spacing: 0.015em;
	animation: fadeInUp 0.6s ease-out both;
	animation-delay: 0.1s;
}

#info strong {
	font-size: 15px;
	color: #f7fbff;
	letter-spacing: 0.02em;
}

#info a, #info button, #info input, #info select {
	pointer-events: auto;
}

.lil-gui {
	z-index: 2 !important;
}

.lil-gui.root {
	--background-color: rgba(10, 14, 26, 0.75);
	--widget-color: #1e2740;
	--focus-color: #4a9eff;
	--hover-color: #1e2740;
	--title-background-color: rgba(20, 24, 37, 0.85);
	--text-color: #e0e5f0;
	--number-color: #4a9eff;
	--string-color: #a855f7;
	border-radius: 10px !important;
	border: 1px solid rgba(74, 158, 255, 0.15) !important;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(74, 158, 255, 0.06) !important;
	backdrop-filter: blur(16px) !important;
	-webkit-backdrop-filter: blur(16px) !important;
	overflow: hidden !important;
	-webkit-font-smoothing: antialiased;
}

.lil-gui.root > .title {
	letter-spacing: 0.03em;
}

.lil-gui .children {
	scrollbar-width: thin;
	scrollbar-color: rgba(74, 158, 255, 0.45) transparent;
}

.lil-gui .children::-webkit-scrollbar {
	width: 6px;
}

.lil-gui .children::-webkit-scrollbar-track {
	background: transparent;
}

.lil-gui .children::-webkit-scrollbar-thumb {
	background: rgba(74, 158, 255, 0.45);
	border-radius: 3px;
}

.lil-gui .controller .widget input[type="range"] { min-width: 0; flex: 1; }
.lil-gui .controller .widget { min-width: 45%; }

#container {
	width: 100%;
	height: 100vh;
}

canvas {
	display: block;
	image-rendering: high-quality;
}

#overlay {
	position: absolute;
	z-index: 2;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	background: rgba(10, 14, 26, 0.85);
	backdrop-filter: blur(4px);
	font-size: 16px;
}

#overlay button {
	background: transparent;
	border: 1px solid #4a9eff;
	border-radius: 8px;
	color: #4a9eff;
	padding: 14px 28px;
	font-size: 16px;
	text-transform: uppercase;
	cursor: pointer;
	letter-spacing: 1px;
	transition: all 0.2s;
}

#overlay button:hover {
	background: rgba(74, 158, 255, 0.15);
	box-shadow: 0 0 20px rgba(74, 158, 255, 0.3);
}

#notSupported {
	width: 50%;
	margin: 20px auto;
	background: rgba(255, 60, 60, 0.2);
	border: 1px solid rgba(255, 60, 60, 0.5);
	border-radius: 8px;
	padding: 16px;
	text-align: center;
	color: #ff6b6b;
}

/* Split-screen layout classes */
.split-label {
	position: absolute;
	bottom: 20px;
	z-index: 10;
	background: rgba(10, 14, 26, 0.8);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
	border: 1px solid rgba(74, 158, 255, 0.25);
	border-radius: 8px;
	padding: 8px 16px;
	color: #e0e5f0;
	font-family: 'Inter', system-ui, sans-serif;
	font-size: 13px;
	pointer-events: none;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
	animation: fadeInUp 0.5s ease-out both;
	animation-delay: 0.5s;
}

.split-label strong {
	color: #4a9eff;
}

.split-label.accent-purple { border-color: rgba(168, 85, 247, 0.35); }
.split-label.accent-pink   { border-color: rgba(255, 107, 157, 0.35); }
.split-label.accent-green  { border-color: rgba(34, 197, 94, 0.35); }

.split-label-left { left: 20px; }
.split-label-right { right: 20px; }
.split-label-center { left: 50%; transform: translateX(-50%); }

.split-divider {
	position: absolute;
	top: 0;
	left: 50%;
	width: 2px;
	height: 100%;
	background: rgba(74, 158, 255, 0.4);
	z-index: 10;
	pointer-events: none;
}

.split-divider-third-1 { left: 33.33%; }
.split-divider-third-2 { left: 66.66%; }

/* Multi-panel grid overlay labels */
.multi-panel-grid {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 10;
	pointer-events: none;
	display: grid;
}

.multi-panel-grid.grid-2x2 {
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr 1fr;
}

.multi-panel-grid.grid-3x1 {
	grid-template-columns: 1fr 1fr 1fr;
}

.multi-panel-grid.grid-4x1 {
	grid-template-columns: 1fr 1fr 1fr 1fr;
}

.multi-panel-grid.grid-5x1 {
	grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
}

.panel-label {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: 12px;
}

.panel-label span {
	background: rgba(10, 14, 26, 0.8);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border: 1px solid rgba(74, 158, 255, 0.25);
	border-radius: 6px;
	padding: 4px 12px;
	color: #e0e5f0;
	font-size: 12px;
	font-family: 'Inter', system-ui, sans-serif;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.panel-divider-v {
	position: absolute;
	top: 0;
	width: 2px;
	height: 100%;
	background: rgba(74, 158, 255, 0.4);
	z-index: 10;
	pointer-events: none;
}

.panel-divider-h {
	position: absolute;
	left: 0;
	height: 2px;
	width: 100%;
	background: rgba(74, 158, 255, 0.4);
	z-index: 10;
	pointer-events: none;
}

/* Annotation labels for educational callouts */
.annotation {
	position: absolute;
	z-index: 10;
	background: rgba(10, 14, 26, 0.9);
	backdrop-filter: blur(8px);
	border: 1px solid rgba(74, 158, 255, 0.4);
	border-radius: 8px;
	padding: 6px 14px;
	color: #e0e5f0;
	font-family: 'Inter', system-ui, sans-serif;
	font-size: 12px;
	pointer-events: none;
	white-space: nowrap;
}

.annotation.accent-green { border-color: rgba(34, 197, 94, 0.5); }
.annotation.accent-red { border-color: rgba(239, 68, 68, 0.5); }
.annotation.accent-yellow { border-color: rgba(251, 191, 36, 0.5); }
.annotation.accent-purple { border-color: rgba(168, 85, 247, 0.5); }

/* ── Utility components ───────────────────────────── */

.style-panel {
	position: fixed;
	bottom: 20px;
	left: 20px;
	z-index: 50;
	background: linear-gradient(135deg, rgba(12, 16, 28, 0.85) 0%, rgba(15, 20, 35, 0.8) 100%);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid rgba(74, 158, 255, 0.18);
	border-radius: 12px;
	padding: 16px 20px;
	color: #e0e5f0;
	font-family: 'Inter', system-ui, sans-serif;
	font-size: 13px;
	max-width: 280px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
	animation: fadeInUp 0.6s ease-out both;
	animation-delay: 0.4s;
}

.style-panel h3 {
	margin: 0 0 8px 0;
	font-size: 14px;
	font-weight: 600;
	color: #f7fbff;
	letter-spacing: 0.02em;
}

.style-panel p {
	margin: 0 0 6px 0;
	color: rgba(230, 236, 245, 0.84);
	line-height: 1.5;
}

.style-kicker {
	display: inline-block;
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: #4a9eff;
	margin-bottom: 6px;
}

.style-chip {
	display: inline-block;
	background: rgba(74, 158, 255, 0.12);
	border: 1px solid rgba(74, 158, 255, 0.25);
	border-radius: 100px;
	padding: 3px 10px;
	font-size: 11px;
	color: #4a9eff;
	font-family: 'Inter', system-ui, sans-serif;
	letter-spacing: 0.02em;
	white-space: nowrap;
}

.style-chip.purple {
	background: rgba(168, 85, 247, 0.12);
	border-color: rgba(168, 85, 247, 0.25);
	color: #a855f7;
}

.style-chip.pink {
	background: rgba(255, 107, 157, 0.12);
	border-color: rgba(255, 107, 157, 0.25);
	color: #ff6b9d;
}

.style-actions {
	display: flex;
	gap: 8px;
	margin-top: 10px;
	flex-wrap: wrap;
}

.style-actions button {
	background: rgba(74, 158, 255, 0.1);
	border: 1px solid rgba(74, 158, 255, 0.3);
	border-radius: 6px;
	color: #4a9eff;
	padding: 5px 12px;
	font-size: 12px;
	font-family: inherit;
	cursor: pointer;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.style-actions button:hover {
	background: rgba(74, 158, 255, 0.2);
	border-color: #4a9eff;
	box-shadow: 0 0 14px rgba(74, 158, 255, 0.2);
	transform: translateY(-1px);
}

.style-actions button:active {
	transform: translateY(0);
}

.style-note {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 50;
	background: rgba(12, 16, 28, 0.8);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border: 1px solid rgba(168, 85, 247, 0.2);
	border-radius: 10px;
	padding: 12px 16px;
	color: rgba(230, 236, 245, 0.84);
	font-family: 'Inter', system-ui, sans-serif;
	font-size: 12px;
	max-width: 240px;
	line-height: 1.5;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	animation: fadeInUp 0.5s ease-out both;
	animation-delay: 0.6s;
}

/* ── Loading spinner overlay ──────────────────────── */

.scene-loading {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(10, 14, 26, 0.92);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	transition: opacity 0.4s ease-out;
}

.scene-loading.hidden {
	opacity: 0;
	pointer-events: none;
}

.scene-loading::after {
	content: '';
	width: 36px;
	height: 36px;
	border: 2px solid rgba(74, 158, 255, 0.15);
	border-top-color: #4a9eff;
	border-radius: 50%;
	animation: spinnerRotate 0.8s linear infinite;
}

/* ── Responsive ───────────────────────────────────── */

@media all and (max-width: 640px) {
	.lil-gui.root {
		right: auto;
		top: auto;
		max-height: 50%;
		max-width: 80%;
		bottom: 0;
		left: 0;
	}

	#back-btn {
		top: 8px;
		left: 8px;
		padding: 4px 10px;
		font-size: 12px;
	}

	#info {
		font-size: 11px;
		padding: 8px;
	}

	.split-label {
		font-size: 11px;
		padding: 4px 10px;
	}

	.style-panel {
		bottom: 10px;
		left: 10px;
		max-width: 220px;
		padding: 12px 14px;
		font-size: 12px;
	}

	.style-note {
		bottom: 10px;
		right: 10px;
		max-width: 180px;
		font-size: 11px;
	}
}
