:root {
	--bg-primary: #0f0f0f;
	--bg-secondary: #1a1a1a;
	--bg-card: #252525;
	--text-primary: #ffffff;
	--text-secondary: #b0b0b0;
	--text-muted: #6b6b6b;
	--accent-red: #ef4444;
	--accent-red-hover: #dc2626;
	--accent-red-glow: rgba(239, 68, 68, 0.3);
	--border-color: #333333;
	--shadow: rgba(0, 0, 0, 0.5);
}

[data-color-scheme="light"] {
	--bg-primary: #f5f5f5;
	--bg-secondary: #ffffff;
	--bg-card: #fafafa;
	--text-primary: #1a1a1a;
	--text-secondary: #4a4a4a;
	--text-muted: #888888;
	--accent-red: #dc2626;
	--accent-red-hover: #b91c1c;
	--accent-red-glow: rgba(220, 38, 38, 0.2);
	--border-color: #e0e0e0;
	--shadow: rgba(0, 0, 0, 0.1);
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100vh;
	background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
	color: var(--text-primary);
	padding: 1rem;
	transition: background 0.3s ease, color 0.3s ease;
}

.theme-toggle {
	position: fixed;
	top: 1.5rem;
	left: 1.5rem;
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: 12px;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	z-index: 100;
	box-shadow: 0 4px 12px var(--shadow);
}

.red-button {
	background: var(--accent-red);
	color: white;
	border: none;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 4px 12px var(--shadow), 0 0 20px var(--accent-red-glow);
	font-size: 24px;
}

.notif-section {
	display: flex;
	justify-content: center;
	align-items: center;
	margin-top: 2rem;
}

#notifyButton {
	padding: 0.5rem;
	padding-left: 1rem;
	padding-right: 1rem;
	font-size: 120%;
}

.chat-toggle {
	position: fixed;
	bottom: 1.5rem;
	right: 1.5rem;
	background: var(--accent-red);
	color: white;
	border: none;
	border-radius: 12px;
	padding: 0 1rem;
	height: 56px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	cursor: pointer;
	transition: all 0.3s ease;
	z-index: 100;
	box-shadow: 0 4px 12px var(--shadow), 0 0 20px var(--accent-red-glow);
	font-size: 24px;
}

.chat-toggle:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 16px var(--shadow), 0 0 30px var(--accent-red-glow);
}

.chat-toggle.active {
	background: var(--accent-red-hover);
}

.chat-shortcut-text {
	font-size: 1rem;
	font-weight: 600;
	white-space: nowrap;
	margin-bottom: 4%;
}

.chat-toggle:hover .chat-shortcut-hint {
    opacity: 1;
}

.unread-badge {
	position: absolute;
	top: -8px; /* moves it slightly above the button */
	left: -8px; /* positions it toward the top-left */
	background-color: var(--accent-red); /* red bubble */
	color: white;
	border-radius: 50%;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	font-size: 13px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
	border: 2px solid white; /* adds clear contrast border */
}

.unread-badge.hidden {
	display: none;
}

.theme-toggle:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 16px var(--shadow);
}

.theme-toggle svg {
	width: 24px;
	height: 24px;
	fill: var(--text-primary);
	transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
	transform: rotate(20deg);
}

.main-wrapper {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
	position: relative;
}

.container {
	text-align: center;
	padding: 3rem 2rem;
	max-width: 600px;
	background: var(--bg-card);
	border-radius: 24px;
	box-shadow: 0 8px 32px var(--shadow);
	border: 1px solid var(--border-color);
	transition: all 0.3s ease;
}

.chat-container {
	position: fixed;
	top: 0;
	right: -400px;
	width: 400px;
	height: 100vh;
	background: var(--bg-card);
	box-shadow: -4px 0 24px var(--shadow);
	border-left: 1px solid var(--border-color);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: right 0.3s ease;
	z-index: 99;
}

.chat-container.open {
	right: 0;
}

.chat-header {
	padding: 1.5rem;
	background: var(--bg-secondary);
	border-bottom: 1px solid var(--border-color);
	text-align: center;
}

.chat-header h2 {
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--text-primary);
	margin: 0;
}

.chat-online-count {
	font-size: 0.85rem;
	color: var(--text-muted);
	margin-top: 0.25rem;
}

.chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.chat-messages::-webkit-scrollbar {
	width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
	background: var(--bg-secondary);
}

.chat-messages::-webkit-scrollbar-thumb {
	background: var(--border-color);
	border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
	background: var(--text-muted);
}

.chat-message {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 0.75rem;
	background: var(--bg-secondary);
	border-radius: 12px;
	border: 1px solid var(--border-color);
	animation: slideIn 0.3s ease;
}

@keyframes slideIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.chat-message-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.chat-username {
	font-weight: 600;
	font-size: 0.9rem;
}

.chat-timestamp {
	font-size: 0.75rem;
	color: var(--text-muted);
}

.chat-text {
	color: var(--text-primary);
	font-size: 0.95rem;
	word-wrap: break-word;
}

.chat-input-section {
	padding: 1rem;
	background: var(--bg-secondary);
	border-top: 1px solid var(--border-color);
}

.chat-username-input {
	width: 100%;
	padding: 0.75rem;
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: 8px;
	color: var(--text-primary);
	font-size: 0.9rem;
	margin-bottom: 0.5rem;
	transition: border-color 0.2s ease;
}

.chat-username-input.error {
	border-color: var(--accent-red);
	border-width: 2px;
}

.chat-username-input:focus {
	outline: none;
	border-color: var(--accent-red);
}

.chat-username-error {
	color: var(--accent-red);
	font-size: 0.85rem;
	margin-bottom: 0.5rem;
	display: none;
	font-weight: 500;
}

.chat-username-error.visible {
	display: block;
}

.chat-input-wrapper {
	display: flex;
	gap: 0.5rem;
}

.chat-input {
	flex: 1;
	padding: 0.75rem;
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: 8px;
	color: var(--text-primary);
	font-size: 0.9rem;
	transition: border-color 0.2s ease;
}

.chat-input:focus {
	outline: none;
	border-color: var(--accent-red);
}

.chat-send-btn {
	padding: 0.75rem 1.25rem;
	background: var(--accent-red);
	color: white;
	border: none;
	border-radius: 8px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.chat-send-btn:hover {
	background: var(--accent-red-hover);
	transform: translateY(-1px);
}

.chat-send-btn:active {
	transform: translateY(0);
}

.chat-send-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.chat-status {
	text-align: center;
	padding: 1rem;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.chat-status.connected {
	color: #22c55e;
}

.chat-status.disconnected {
	color: var(--accent-red);
}

.header {
	margin-bottom: 2.5rem;
}

h1 {
	font-size: 2.5rem;
	font-weight: 700;
	margin-bottom: 0.5rem;
	background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.status-indicator {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1rem 1.5rem;
	border-radius: 16px;
	font-size: 1.1rem;
	font-weight: 600;
	margin: 1.5rem 0;
	transition: all 0.3s ease;
}

.status-indicator.live {
	background: rgba(34, 197, 94, 0.15);
	color: #22c55e;
	border: 2px solid rgba(34, 197, 94, 0.3);
}

.status-indicator.offline {
	background: rgba(239, 68, 68, 0.15);
	color: var(--accent-red);
	border: 2px solid var(--accent-red-glow);
}

.status-indicator.checking {
	background: rgba(59, 130, 246, 0.15);
	color: #3b82f6;
	border: 2px solid rgba(59, 130, 246, 0.3);
}

.pulse {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	animation: pulse 2s ease-in-out infinite;
}

.pulse.live {
	background: #22c55e;
	box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
}

.pulse.offline {
	background: var(--accent-red);
	box-shadow: 0 0 0 0 var(--accent-red-glow);
}

.pulse.checking {
	background: #3b82f6;
	box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
}

@keyframes pulse {
	0%, 100% {
		transform: scale(1);
		opacity: 1;
	}
	50% {
		transform: scale(1.2);
		opacity: 0.8;
	}
}

.player-section {
	margin: 2rem 0;
	padding-bottom: 0.5rem;
	background: var(--bg-secondary);
	border-radius: 16px;
	border: 1px solid var(--border-color);
}

audio {
	width: 100%;
	margin-top: 1rem;
	border-radius: 12px;
	filter: brightness(0.95);
}

audio::-webkit-media-controls-panel {
	background: var(--bg-card);
}

.stats {
	display: flex;
	justify-content: center;
	gap: 2rem;
	margin-top: 2rem;
	flex-wrap: wrap;
}

.stat-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
}

.stat-label {
	font-size: 0.85rem;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 600;
}

.stat-value {
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--accent-red);
}

.offline-message {
	padding: 2rem;
	background: var(--bg-secondary);
	border-radius: 16px;
	border: 1px solid var(--border-color);
}

.offline-icon {
	font-size: 4rem;
	margin-bottom: 1rem;
	opacity: 0.6;
}

.offline-text {
	font-size: 1.25rem;
	color: var(--text-secondary);
	margin-bottom: 0.5rem;
}

.offline-subtext {
	font-size: 0.95rem;
	color: var(--text-muted);
}

.visualizer {
	display: flex;
	justify-content: center;
	align-items: flex-end;
	gap: 4px;
	height: 60px;
	margin: 1.5rem 0;
}

.bar {
	width: 6px;
	background: var(--accent-red);
	border-radius: 3px;
	transition: height 0.3s ease;
	animation: wave 1s ease-in-out infinite;
}

.bar:nth-child(1) { animation-delay: 0s; }
.bar:nth-child(2) { animation-delay: 0.1s; }
.bar:nth-child(3) { animation-delay: 0.2s; }
.bar:nth-child(4) { animation-delay: 0.3s; }
.bar:nth-child(5) { animation-delay: 0.4s; }
.bar:nth-child(6) { animation-delay: 0.3s; }
.bar:nth-child(7) { animation-delay: 0.2s; }
.bar:nth-child(8) { animation-delay: 0.1s; }

@keyframes wave {
	0%, 100% { height: 10px; }
	50% { height: 50px; }
}

.hidden {
	display: none;
}

.chat-close-btn {
	position: absolute;
	top: 1rem;
	right: 1rem;
	background: transparent;
	border: none;
	color: var(--text-secondary);
	font-size: 24px;
	cursor: pointer;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: all 0.2s ease;
}

.chat-close-btn:hover {
	background: var(--bg-secondary);
	color: var(--text-primary);
}

@media (max-width: 640px) {
	body {
		padding: 0.5rem;
		align-items: flex-start;
		padding-top: 1rem;
	}
	
	.player-section {
		padding: 0;
	}
	
	#audioPlayer {
		margin: 0;
	}

	.chat-container {
		width: 100%;
		right: -100%;
		height: 100%;
	}

	.container {
		padding: 1.5rem 1rem;
		margin-top: 2rem;
	}
	
	.main-wrapper {
		margin-top: 5rem;
	}

	h1 {
		font-size: 1.75rem;
	}

	.header {
		margin-bottom: 1.5rem;
	}
	
	.chat-shortcut-text {
        display: none;
    }

	.theme-toggle {
		top: 0.75rem;
		left: 0.75rem;
		width: 40px;
		height: 40px;
	}

	.chat-toggle {
		bottom: 0.75rem;
		right: 0.75rem;
		width: 48px;
		height: 48px;
		font-size: 20px;
	}

	.stats {
		gap: 1.5rem;
	}

	.offline-message {
		padding: 1.5rem;
	}

	.visualizer {
		margin: 1rem 0;
		height: 50px;
	}

	.stat-value {
		font-size: 1.5rem;
	}

	.status-indicator {
		font-size: 1rem;
		padding: 0.75rem 1.25rem;
		margin: 1rem 0;
	}

	.offline-icon {
		font-size: 3rem;
	}
}