:root {
	--primary-color: #667eea;
	--dark-bg: #2d3748;
	--medium-bg: #4a5568;
	--light-text: #e2e8f0;
	--border-color: #718096;
	--success-color: #48bb78;
	--error-color: #f56565;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%);
	min-height: 100vh;
	color: #333;
	overflow: hidden;
}
.app-container {
	display: grid;
	grid-template-columns: 320px 1fr 450px;
	height: 100vh;
	gap: 0;
}

/* Left Panel: Equipment */
.equipment-panel {
	background: var(--dark-bg);
	color: var(--light-text);
	padding: 20px;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
}
.panel-header {
	text-align: center;
	margin-bottom: 20px;
	padding-bottom: 15px;
	border-bottom: 1px solid var(--border-color);
}
.mode-toggle { display: flex; gap: 10px; margin-bottom: 15px; }
.mode-btn {
	flex: 1; padding: 10px; border: 2px solid var(--border-color);
	background: var(--medium-bg); color: var(--light-text);
	border-radius: 5px; cursor: pointer; font-size: 16px; transition: all 0.3s;
}
.mode-btn:hover { border-color: var(--primary-color); }
.mode-btn.active { background: var(--primary-color); border-color: var(--primary-color); }

.gender-buttons { display: flex; gap: 10px; margin-top: 10px; }
.gender-btn {
	flex: 1; padding: 8px; border: 2px solid var(--border-color);
	background: var(--medium-bg); color: var(--light-text);
	border-radius: 5px; cursor: pointer; transition: all 0.3s;
}
.gender-btn.active { background: var(--primary-color); border-color: var(--primary-color); }

.equipment-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-template-rows: repeat(5, 80px);
	gap: 10px;
	margin-bottom: 20px;
}
.kit-category-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
}
.kit-category-btn {
	 padding: 12px; background: var(--medium-bg); color: var(--light-text); 
	 border: 2px solid var(--border-color); border-radius: 5px; cursor: pointer; 
	 transition: all 0.3s; text-align: center;
}
.kit-category-btn:hover, .kit-category-btn.active {
	border-color: var(--primary-color); background: rgba(102, 126, 234, 0.2);
}

.equip-slot {
	background-color: rgba(0,0,0,0.3);
	border: 2px dashed var(--border-color);
	border-radius: 8px; cursor: pointer; transition: all 0.3s;
	display: flex; align-items: center; justify-content: center;
	position: relative; background-size: contain; background-position: center;
	background-repeat: no-repeat;
}
.equip-slot:hover, .equip-slot.active {
	border-color: var(--primary-color);
	background-color: rgba(102, 126, 234, 0.2);
}
.slot-name { font-size: 12px; color: white; background: rgba(0,0,0,0.6); padding: 2px 5px; border-radius: 3px; }
.clear-slot-btn {
	position: absolute; top: -5px; right: -5px; width: 20px; height: 20px;
	background: var(--error-color); color: white; border: 1px solid white; border-radius: 50%;
	cursor: pointer; display: none; align-items: center; justify-content: center; font-weight: bold;
}
.equip-slot.equipped .clear-slot-btn { display: flex; }
.equip-slot.equipped .slot-name { display: none; }

#slot-head { grid-area: 1 / 2; }
#slot-cape { grid-area: 2 / 1; }
#slot-amulet { grid-area: 2 / 2; }
#slot-weapon { grid-area: 3 / 1; }
#slot-torso { grid-area: 3 / 2; }
#slot-shield { grid-area: 3 / 3; }
#slot-legs { grid-area: 4 / 2; }
#slot-hands { grid-area: 5 / 1; }
#slot-boots { grid-area: 5 / 2; }

/* Presets & Blender Controls */
.bottom-controls {
	margin-top: auto; /* Pushes to the bottom */
	padding-top: 20px;
	border-top: 1px solid var(--border-color);
}
.control-section { margin-bottom: 20px; }
.control-section h3 { text-align: center; margin-bottom: 10px; color: var(--primary-color); }
.preset-input-group { display: flex; gap: 10px; margin-bottom: 10px; }
.preset-input-group input, .preset-input-group select {
	width: 100%; background: var(--medium-bg); border: 1px solid var(--border-color);
	color: white; padding: 8px; border-radius: 3px;
}
.preset-buttons { display: flex; gap: 10px; }
.preset-buttons button { flex-grow: 1; }

.blender-status { font-size: 14px; text-align: center; margin-bottom: 10px; }
.blender-status.connected { color: var(--success-color); }
.blender-status.disconnected { color: var(--error-color); }
.blender-port-group { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.blender-port-group input { width: 60px; background: var(--medium-bg); border: 1px solid var(--border-color); color: white; padding: 5px; border-radius: 3px; }
.blender-port-group button { flex-grow: 1; padding: 5px; }
.send-set-btn {
	width: 100%; padding: 12px; background: var(--success-color); color: white;
	border: none; border-radius: 5px; cursor: pointer; font-size: 16px;
	font-weight: bold; transition: background 0.3s;
}
.send-set-btn:disabled { background: var(--border-color); cursor: not-allowed; }

/* Center Panel: 3D Viewer */
.viewer-panel {
	position: relative;
	background: #2d3748; /* Same as equipment panel */
}
#viewerContainer { width: 100%; height: 100%; }
.viewer-controls {
	position: absolute;
	bottom: 15px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 10px;
	background: rgba(0,0,0,0.5);
	padding: 8px 15px;
	border-radius: 20px;
}
.viewer-btn {
	background: var(--medium-bg); color: white; border: 1px solid var(--border-color);
	padding: 5px 12px; border-radius: 15px; cursor: pointer; font-size: 12px;
}
.viewer-btn:hover { background: var(--primary-color); }

/* Right Panel: Item Browser */
.browser-panel {
	background: #f7fafc;
	padding: 20px;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
}
.browser-header {
	margin-bottom: 15px;
	padding-bottom: 15px;
	border-bottom: 2px solid #e2e8f0;
}
.search-input { width: 100%; padding: 10px; border: 2px solid #e2e8f0; border-radius: 5px; font-size: 16px; margin-bottom: 10px;}
.results-info { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.pagination { display: flex; gap: 5px; }
.page-btn { padding: 5px 10px; border: 1px solid #e2e8f0; background: white; cursor: pointer; border-radius: 3px; }
.page-btn:hover { background: #edf2f7; }
.page-btn.active { background: var(--primary-color); color: white; }

.items-grid {
	flex-grow: 1;
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	align-content: start;
}
.item-card {
	border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px;
	background: white; transition: all 0.2s; cursor: pointer;
}
.item-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	border-color: var(--primary-color);
}
.item-name { font-weight: bold; color: #2d3748; }
.item-details { font-size: 12px; color: #718096; }
.loading, .no-results { text-align: center; padding: 40px; color: #718096; }
.hidden { display: none; }
.donation-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.8);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 10000;
	backdrop-filter: blur(3px);
}

.donation-popup {
	background: white;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	max-width: 500px;
	width: 90%;
	max-height: 90vh;
	overflow-y: auto;
	position: relative;
	animation: donationSlideIn 0.3s ease-out;
}

@keyframes donationSlideIn {
	from { opacity: 0; transform: translateY(-20px) scale(0.95); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.donation-header {
	padding: 20px 20px 10px 20px;
	border-bottom: 1px solid #e2e8f0;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.donation-header h2 {
	margin: 0;
	color: #2d3748;
	font-size: 24px;
	font-weight: bold;
}

.donation-close-btn {
	background: none;
	border: none;
	font-size: 24px;
	cursor: pointer;
	color: #a0aec0;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: all 0.2s;
}

.donation-close-btn:enabled:hover {
	background: #f7fafc;
	color: #2d3748;
}

.donation-close-btn:disabled {
	cursor: not-allowed;
	opacity: 0.3;
}

.donation-content {
	padding: 20px;
}

.donation-message {
	margin-bottom: 25px;
	line-height: 1.6;
	color: #4a5568;
}

.donation-message p {
	margin-bottom: 15px;
}

.donation-actions {
	display: flex;
	gap: 15px;
	margin-bottom: 20px;
}

.donation-patreon-btn {
	background: #ff424d;
	color: white;
	padding: 12px 24px;
	border-radius: 25px;
	text-decoration: none;
	font-weight: bold;
	flex: 1;
	text-align: center;
	transition: background 0.2s;
	border: none;
	cursor: pointer;
}

.donation-patreon-btn:hover {
	background: #e53e3e;
	text-decoration: none;
	color: white;
}

.donation-maybe-btn {
	background: #e2e8f0;
	color: #4a5568;
	padding: 12px 24px;
	border-radius: 25px;
	border: none;
	cursor: pointer;
	font-weight: bold;
	flex: 1;
	transition: background 0.2s;
}

.donation-maybe-btn:hover {
	background: #cbd5e0;
}

.donation-footer {
	text-align: center;
	color: #a0aec0;
	font-style: italic;
}

.donation-timer {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: #667eea;
	color: white;
	padding: 10px;
	text-align: center;
	border-radius: 0 0 12px 12px;
	font-weight: bold;
}
.cache-status {
	background: rgba(255,255,255,0.1);
	border-radius: 8px;
	padding: 10px;
	margin-bottom: 15px;
	backdrop-filter: blur(10px);
	font-size: 0.9rem;
}

.error {
	color: #ff6b6b;
}

.loading {
	text-align: center;
	padding: 40px;
	color: rgba(255,255,255,0.7);
}

/* Player Color Picker Styles */
.color-picker-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px;
	margin-bottom: 15px;
}

.color-picker-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px;
	background: rgba(255,255,255,0.05);
	border-radius: 4px;
	backdrop-filter: blur(5px);
}

.color-picker-item label {
	flex: 1;
	font-size: 0.9rem;
	color: rgba(255,255,255,0.9);
	min-width: 70px;
}

.color-picker-item input[type="color"] {
	width: 40px;
	height: 30px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	background: none;
}

.color-picker-item input[type="color"]::-webkit-color-swatch-wrapper {
	padding: 0;
	border-radius: 4px;
}

.color-picker-item input[type="color"]::-webkit-color-swatch {
	border: 1px solid rgba(255,255,255,0.2);
	border-radius: 4px;
}

.reset-color-btn {
	background: rgba(255,255,255,0.1);
	border: 1px solid rgba(255,255,255,0.2);
	color: rgba(255,255,255,0.8);
	width: 24px;
	height: 24px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.reset-color-btn:hover {
	background: rgba(255,255,255,0.2);
	color: white;
}