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

:root {
	--bg-dark: rgb(13 13 23);
	--bg-panel: rgb(20 20 35);
	--bg-card: rgb(28 28 48);
	--bg-input: rgb(18 18 32);
	--accent: rgb(139 92 246);
	--success: rgb(34 197 94);
	--danger: rgb(239 68 68);
	--text: rgb(248 250 252);
	--text-muted: rgb(148 163 184);
	--text-dim: rgb(100 116 139);
	--border: rgb(51 65 85);
}

body {
	background: var(--bg-dark);
	color: var(--text);
	font-family:
		"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	height: 100vh;
	overflow: hidden;
}

#app {
	display: flex;
	height: 100vh;
}

.sidebar {
	width: 320px;
	background: var(--bg-panel);
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.sidebar-header {
	padding: 24px;
	border-bottom: 1px solid var(--border);
}

.sidebar h1 {
	font-size: 1.5em;
	font-weight: 700;
	color: var(--accent);
	letter-spacing: -0.02em;
}

.sidebar-content {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.sidebar-content::-webkit-scrollbar {
	width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
	background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
	background: var(--border);
	border-radius: 0;
}

.section {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.section-title {
	font-size: 0.7em;
	font-weight: 600;
	color: var(--text-dim);
	text-transform: uppercase;
	letter-spacing: 0.1em;
}

.main {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 20px;
	gap: 16px;
	background: var(--bg-dark);
}

.preview-container {
	flex: 1;
	position: relative;
	background: rgb(13 0 26);
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.canvas-wrapper {
	position: relative;
	max-width: 100%;
	max-height: 100%;
	display: flex;
}

.preview-canvas {
	display: block;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.webcam-overlay {
	position: absolute;
	width: 320px;
	height: 180px;
	border: 2px solid var(--accent);
	border-radius: 0;
	cursor: move;
	overflow: hidden;
	user-select: none;
}

.webcam-overlay video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

.webcam-overlay.webcam-placeholder {
	background: var(--bg-card);
	border-style: dashed;
}

.webcam-placeholder-text {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: 2em;
	opacity: 0.5;
}

.resize-handle {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 24px;
	height: 24px;
	cursor: se-resize;
	background: linear-gradient(135deg, transparent 50%, var(--accent) 50%);
	border-radius: 0;
	opacity: 0.8;
	transition: opacity 0.2s;
}

.resize-handle:hover {
	opacity: 1;
}

.controls {
	display: flex;
	gap: 12px;
	justify-content: center;
	align-items: center;
	padding: 16px 24px;
	background: var(--bg-panel);
	border-radius: 0;
	border: 1px solid var(--border);
}

button {
	padding: 12px 24px;
	border: none;
	border-radius: 0;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	gap: 8px;
	outline: none;
}

.btn-primary {
	background: linear-gradient(135deg, var(--accent) 0%, rgb(168 85 247) 100%);
	color: white;
}

.btn-primary:hover {
	transform: translateY(-1px);
}

.btn-primary:active {
	transform: translateY(0);
}

.btn-primary:disabled {
	background: var(--border);
	cursor: not-allowed;
	transform: none;
}

.btn-secondary {
	background: var(--bg-card);
	color: var(--text);
	border: none;
}

.btn-secondary:hover {
	background: var(--border);
}

.btn-secondary.active {
	background: rgb(34 197 94 / 20%);
	color: var(--success);
}

.btn-danger {
	background: linear-gradient(135deg, var(--danger) 0%, rgb(220 38 38) 100%);
	color: white;
}

.btn-danger:hover {
	transform: translateY(-1px);
}

.source-btn {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 14px 16px;
	background: var(--bg-card);
	border: none;
	border-radius: 0;
	color: var(--text);
	text-align: left;
	font-weight: 500;
}

.source-btn:hover {
	background: var(--border);
}

.source-btn.active {
	background: rgb(139 92 246 / 10%);
}

.source-btn .icon {
	font-size: 1.2em;
}

.source-item {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.source-item .source-btn {
	flex: 1;
	padding: 10px 12px;
}

.mute-btn {
	padding: 8px;
	background: var(--bg-card);
	border: none;
	border-radius: 0;
	font-size: 16px;
	cursor: pointer;
}

.mute-btn:hover {
	background: var(--border);
}

.mute-btn.muted {
	background: rgb(239 68 68 / 20%);
}

.volume-slider {
	width: 60px;
	height: 4px;
	-webkit-appearance: none;
	appearance: none;
	background: var(--border);
	border-radius: 0;
	cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 12px;
	height: 12px;
	background: var(--accent);
	border-radius: 50%;
	cursor: pointer;
}

.volume-slider::-moz-range-thumb {
	width: 12px;
	height: 12px;
	background: var(--accent);
	border-radius: 50%;
	cursor: pointer;
	border: none;
}

.health-good {
	color: var(--success);
}

.health-warning {
	color: rgb(234 179 8);
}

.health-bad {
	color: var(--danger);
}

.destinations {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.destination {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px 14px;
	background: var(--bg-card);
	border-radius: 0;
	border: 1px solid var(--border);
	transition: border-color 0.2s;
}

.destination:focus-within {
	border-color: var(--accent);
}

.destination-header {
	display: flex;
	align-items: center;
	gap: 10px;
}

.destination-title {
	flex: 1;
	font-family: inherit;
}

.destination input {
	padding: 8px 12px;
	background: var(--bg-input);
	border: 1px solid var(--border);
	border-radius: 0;
	color: var(--text);
	font-size: 13px;
	font-family: "JetBrains Mono", monospace;
	transition: border-color 0.2s;
}

.destination input::placeholder {
	color: var(--text-dim);
}

.destination input:focus {
	outline: none;
	border-color: var(--accent);
}

.destination .status-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--text-dim);
	flex-shrink: 0;
	transition: all 0.3s;
}

.destination .status-dot.connected {
	background: var(--success);
}

.destination .status-dot.error {
	background: var(--danger);
}

.destination .remove-btn {
	padding: 6px 10px;
	background: transparent;
	color: var(--text-dim);
	font-size: 18px;
	border-radius: 0;
}

.destination .remove-btn:hover {
	color: var(--danger);
	background: rgb(239 68 68 / 10%);
}

.add-destination {
	padding: 12px;
	background: transparent;
	border: none;
	border-radius: 0;
	color: var(--text-dim);
	width: 100%;
	font-weight: 500;
}

.add-destination:hover {
	color: var(--accent);
	background: rgb(139 92 246 / 5%);
}

.settings-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.settings-grid label {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.settings-grid label span {
	font-size: 0.8em;
	color: var(--text-muted);
}

.settings-grid input {
	padding: 10px 12px;
	background: var(--bg-input);
	border: 1px solid var(--border);
	border-radius: 0;
	color: var(--text);
	font-size: 13px;
	font-family: "JetBrains Mono", monospace;
	transition: border-color 0.2s;
}

.settings-grid input:focus {
	outline: none;
	border-color: var(--accent);
}

.stats {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.stat {
	padding: 16px;
	background: var(--bg-card);
	border-radius: 0;
	border: 1px solid var(--border);
	text-align: center;
}

.stat-value {
	font-size: 1.6em;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--accent);
}

.stat-label {
	font-size: 0.7em;
	font-weight: 500;
	color: var(--text-dim);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-top: 4px;
}

.live-indicator {
	display: none;
	align-items: center;
	gap: 8px;
	padding: 10px 20px;
	background: linear-gradient(135deg, var(--danger) 0%, rgb(220 38 38) 100%);
	font-weight: 700;
	color: white;
	font-size: 13px;
	letter-spacing: 0.05em;
}

.live-indicator.active {
	display: flex;
}

.live-indicator .dot {
	width: 8px;
	height: 8px;
	background: white;
	border-radius: 50%;
	animation: blink 1s infinite;
}

@keyframes blink {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0.4;
	}
}

.hidden-video {
	position: absolute;
	visibility: hidden;
	width: 1px;
	height: 1px;
}

.server-config {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.server-config input {
	padding: 12px 14px;
	background: var(--bg-input);
	border: 1px solid var(--border);
	border-radius: 0;
	color: var(--text);
	font-size: 13px;
	font-family: "JetBrains Mono", monospace;
	transition: all 0.2s;
}

.server-config input:focus {
	outline: none;
	border-color: var(--accent);
}

.connection-status {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 0.85em;
	font-weight: 500;
}

.connection-status .dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--text-dim);
	transition: all 0.3s;
}

.connection-status .dot.connected {
	background: var(--success);
}

.connection-status .dot.error {
	background: var(--danger);
}

.connection-status span:last-child {
	color: var(--text-muted);
}
