@font-face {
	font-family: 'JetBrains Mono';
	src: url('fonts/JetBrainsMono.ttf') format('truetype');
	font-weight: 100 900;
	font-style: normal;
}

@font-face {
	font-family: 'Playfair Display';
	src: url('fonts/PlayfairDisplay.ttf') format('truetype');
	font-weight: 100 900;
	font-style: italic;
}

:root {
	--bg: #080808;
	--surface: rgba(10, 10, 10, 0.479);
	--border: rgba(255, 255, 255, 0.1);
	--text-main: #FFFFFF;
	--text-mute: #a1a1aa;
	--accent: #FFFFFF;
	--danger: #ef4444;
	--warning: #f59e0b;
	--success: #10b981;
	--unknown: #3f3f46;
	--font-serif: 'Playfair Display', serif;
	--font-mono: 'JetBrains Mono', monospace;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}

body {
	background-image: radial-gradient(circle at center, #1c1c2e 0%, #000000 100%);
	color: var(--text-main);
	font-family: var(--font-mono);
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.icon {
	width: 22px;
	height: 22px;
	fill: currentColor;
}

.hidden {
	display: none !important;
}

#loader {
	position: fixed;
	inset: 0;
	background: #080808;
	z-index: 9999;
	display: flex;
	justify-content: center;
	align-items: center;
	opacity: 1;
	transition: opacity 0.5s ease-out 0.2s;
}

#loader .bar {
	width: 200px;
	height: 2px;
	background: #3f3f46;
	position: relative;
	overflow: hidden;
}

#loader .bar::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 50%;
	background: var(--text-main);
	animation: loader-anim 1.5s infinite ease-in-out;
}

@keyframes loader-anim {
	0% {
		transform: translateX(-100%);
	}

	50% {
		transform: translateX(200%);
	}

	100% {
		transform: translateX(-100%);
	}
}

#home-view,
#join-view {
	position: fixed;
	inset: 0;
	z-index: 100;
	background-image: radial-gradient(circle at center, #1c1c2e 0%, #000000 100%);
	display: flex;
	justify-content: center;
	align-items: center;
}

#home-view {
	flex-direction: column;
	padding: 60px 40px;
	overflow-y: auto;
}

.home-container {
	max-width: 52ch;
	margin: 0 auto;
	width: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	height: 100%;
	position: relative;
}

.home-header {
	text-align: center;
	margin-bottom: 30px;
}

.brand-title.large {
	font-family: var(--font-serif);
	font-style: italic;
	font-size: 4.5rem;
	font-weight: 100;
	color: var(--text-main);
	margin-bottom: 0;
}

.home-content {
	font-family: var(--font-mono);
	font-size: 14pt;
	line-height: 1.6;
	color: var(--text-main);
	text-align: justify;
	hyphens: auto;
}

.pindent {
	text-indent: 4ch;
	margin-bottom: 24px;
}

.accent-link {
	color: var(--text-main);
	text-decoration: underline;
	cursor: pointer;
}

.home-footer {
	margin-top: 30px;
	display: flex;
	justify-content: space-between;
	border-top: 1px solid var(--border);
	padding-top: 20px;
	font-family: var(--font-mono);
}

.contact-link,
.pgp-link {
	color: var(--text-main);
	text-decoration: underline;
	font-size: 1rem;
	transition: 0.2s;
}

.card {
	width: 90%;
	max-width: 450px;
	padding: 40px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 24px;
	text-align: center;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.card .brand-title {
	font-family: var(--font-serif);
	font-style: italic;
	font-weight: 100;
	font-size: 2.8rem;
	margin-bottom: 15px;
	color: var(--accent);
}

.room-indicator {
	display: flex;
	justify-content: center;
	align-items: baseline;
	gap: 10px;
	margin-bottom: 35px;
	font-family: var(--font-mono);
}

.room-indicator .label,
.room-indicator .value {
	font-size: 1.1rem;
}

.room-indicator .label {
	color: var(--text-mute);
}

.room-indicator .value {
	color: var(--accent);
	font-weight: bold;
}

.input-group {
	margin-bottom: 20px;
	text-align: left;
}

.input-group label {
	display: block;
	font-size: 0.7rem;
	color: var(--text-mute);
	margin-bottom: 5px;
	text-transform: uppercase;
	letter-spacing: 1px;
}

input,
select {
	width: 100%;
	background: transparent;
	border: none;
	border-bottom: 1px solid #3f3f46;
	color: var(--text-main);
	padding: 10px 0;
	font-family: var(--font-mono);
	font-size: 1.1rem;
	transition: 0.3s;
}

input:focus,
select:focus {
	border-color: var(--accent);
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    border: none;
    margin: 8px 0;
    cursor: pointer;
    display: block;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    border: none;
    transition: background-color 0.2s ease;
}

input[type=range]:hover::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.3);
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: var(--text-main);
    cursor: grab;
    margin-top: -5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease, background-color 0.2s;
}

input[type=range]:active::-webkit-slider-thumb {
    cursor: grabbing;
    transform: scale(1.2);
    background: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

input[type=range]::-moz-range-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    border: none;
    transition: background-color 0.2s ease;
}

input[type=range]:hover::-moz-range-track {
    background: rgba(255, 255, 255, 0.3);
}

input[type=range]::-moz-range-thumb {
    height: 14px;
    width: 14px;
    border: none;
    border-radius: 50%;
    background: var(--text-main);
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease, background-color 0.2s;
}

input[type=range]:active::-moz-range-thumb {
    cursor: grabbing;
    transform: scale(1.2);
    background: #ffffff;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--success);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--success);
}

input:checked + .slider:before {
    transform: translateX(18px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.btn-primary {
	width: 100%;
	padding: 15px;
	margin-top: 20px;
	background: var(--text-main);
	color: var(--bg);
	border: none;
	font-family: var(--font-mono);
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 1px;
	cursor: pointer;
	transition: 0.2s;
	border-radius: 12px;
}

#app-ui {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.top-bar,
.bot-bar {
	border-style: solid;
	border-color: var(--border);
}

.top-bar {
	height: 60px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 24px;
	z-index: 60;
	border-width: 0 0 1px 0;
	flex-shrink: 0;
	margin-bottom: 12px;
}

.bot-bar {
	width: 100%;
	height: 70px;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 16px;
	border-width: 1px 0 0 0;
	z-index: 50;
	padding-bottom: env(safe-area-inset-bottom);
	flex-shrink: 0;
	position: relative;
	margin-top: 12px;
}

.top-controls {
	display: flex;
	gap: 10px;
	flex-shrink: 0; 
}

.mini-btn {
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--border);
	color: var(--text-main);
	padding: 6px 16px;
	cursor: pointer;
	font-family: var(--font-serif);
	font-size: 0.75rem;
	transition: 0.2s;
	white-space: nowrap;
	border-radius: 12px;
}

.room-badge {
	font-family: var(--font-serif);
	font-style: italic;
	color: var(--text-main);
	font-size: 1.5rem;
	font-weight: 100;
	white-space: nowrap;
	display: flex;
	align-items: center;
}

.room-badge span {
	margin-left: 8px;
}

.main-stage {
	flex: 1;
	position: relative;
	overflow: hidden;
	display: flex;
	justify-content: center;
	align-content: center;
	align-items: center;
	flex-wrap: wrap;
	width: 100%;
	padding: 10px;
}

.user-box {
	position: relative;
	background: var(--surface);
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: 16px;
	margin: 4px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
	transition: width 0.3s ease, height 0.3s ease;
}

.status-dot {
	position: absolute;
	top: 15px;
	right: 15px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	z-index: 100;
	box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
	transition: background-color 0.3s;
}

.status-green {
	background-color: var(--success);
	box-shadow: 0 0 8px var(--success);
}

.status-yellow {
	background-color: var(--warning);
	box-shadow: 0 0 8px var(--warning);
}

.status-red {
	background-color: var(--danger);
	box-shadow: 0 0 8px var(--danger);
}

.status-black {
	background-color: var(--unknown);
	border: 1px solid #71717a;
}

.content-layer {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
}

.user-box video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
}

.user-box video.mirror {
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1); 
}

.freeze-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 10;
}

.name-plate {
	font-family: var(--font-serif);
	font-size: 1.5rem;
	font-style: italic;
	font-weight: 100;
	color: var(--text-main);
	text-align: center;
	z-index: 10;
	width: 100%;
	word-break: break-word;
	padding: 0 10px;
}

.pip-layer {
	position: absolute;
	width: 20%; 
	min-width: 60px;
	max-width: 100%;
	height: auto;
	top: 15px;
	right: 15px;
	left: auto;
	background: transparent;
	border: 1px solid var(--border);
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
	z-index: 50;
	cursor: grab;
	overflow: hidden;
	border-radius: 12px;
	transition: box-shadow 0.2s ease;
	aspect-ratio: 16/9;
}

.pip-resize-handle {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 25%;
	height: 25%;
	max-width: 40px;
	max-height: 40px;
	min-width: 20px;
	min-height: 20px;
	background: none !important;
	cursor: sw-resize;
	z-index: 60;
	opacity: 0;
	transition: opacity 0.2s ease;
}

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

.pip-resize-handle::after {
	content: '';
	position: absolute;
	bottom: 6px;
	left: 6px;
	width: 16px;
	height: 16px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E");
	background-size: contain;
	background-repeat: no-repeat;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.8));
}

.user-box.speaking {
	border-color: var(--text-main);
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.user-box.source-muted {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 2px var(--danger) !important;
}

.info-tag {
	position: absolute;
	top: 15px;
	left: 15px;
	bottom: auto;
	font-size: 0.75rem;
	color: var(--text-main);
	background: rgba(0, 0, 0, 0.6);
	padding: 6px 12px;
	backdrop-filter: blur(8px);
	pointer-events: none;
	z-index: 60;
	border-radius: 20px;
	font-weight: bold;
	font-family: sans-serif;
}

.user-box.no-video .info-tag {
	display: none;
}

.settings-panel {
    position: absolute;
    top: 80px;
    right: 24px;
    width: 340px;
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
    display: none;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.settings-panel.open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.settings-content {
    padding: 30px 25px;
}

.set-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
    margin-bottom: 25px;
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 100;
    font-size: 1.4rem;
    color: var(--text-main);
}

.set-header button {
    background: none;
    border: none;
    color: var(--text-mute);
    cursor: pointer;
    padding: 5px;
    font-size: 1.5rem;
    line-height: 1;
    transition: color 0.2s;
}

.set-header button:hover {
    color: var(--danger);
}

.set-group {
    margin-bottom: 25px;
}

.set-group:last-child {
    margin-bottom: 0;
}

.range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.range-header label {
    font-size: 0.9rem; 
    color: var(--text-main);
    font-weight: 500;
    margin-bottom: 0 !important;
    cursor: default;
    text-transform: none;
    letter-spacing: 0.5px;
}

.range-header span {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: bold;
}

.set-group > label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    margin-bottom: 8px;
}

.set-group select {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 8px 12px;
    font-family: var(--font-mono);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.set-group select:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
}

.set-group select:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-main);
}

select {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-24.8%200L146.2%20185.6%2030.3%2069.4c-11.8-11.8-30.8-11.8-42.6%200-11.8%2011.8-11.8%2030.8%200%2042.6l139%20139.1c11.8%2011.8%2030.8%2011.8%2042.6%200l139-139.1a30%2030%200%200%200%200-42.6z%22%2F%3E%3C%2Fsvg%3E');
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 10px;
	padding-right: 30px;
}

select option {
	background: #18181b;
	color: var(--text-main);
}

.ctrl-btn {
	width: 45px;
	height: 45px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--border);
	color: var(--text-mute);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s;
	border-radius: 14px;
}

.ctrl-btn.active {
	background: var(--text-main);
	color: var(--bg);
}

.ctrl-btn.hangup {
	background: var(--danger);
	color: white;
	width: 70px;
	height: 45px;
	border-radius: 18px;
}

.toast {
	position: fixed;
	top: 90px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--surface);
	border: 1px solid var(--border);
	backdrop-filter: blur(10px);
	padding: 12px 24px;
	z-index: 200;
	font-size: 0.85rem;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
	width: max-content;
	border-radius: 50px;
}

.user-hotbar {
	position: absolute;
	bottom: 15px;
	left: 50%;
	transform: translateX(-50%);
	width: auto;
	height: auto;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	background: rgba(20, 20, 20, 0.85);
	border: 1px solid var(--border);
	z-index: 20;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease-in-out, transform 0.2s ease;
	padding: 6px 12px;
	border-radius: 50px;
	backdrop-filter: blur(8px);
}

.user-box.show-hotbar .user-hotbar {
	opacity: 1;
	pointer-events: auto;
	transform: translateX(-50%) translateY(0);
}

.hb-btn {
	width: 36px;
	height: 36px;
	background: rgba(255, 255, 255, 0.05);
	border: none;
	color: var(--text-mute);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s;
	border-radius: 50%;
}

.hb-btn.active-state {
	background: var(--text-main);
	color: var(--bg);
}

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

.hb-btn svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

@media (hover: hover) {

	.accent-link:hover,
	.contact-link:hover,
	.pgp-link:hover {
		color: var(--text-mute);
	}

	.mini-btn:hover {
		background: rgba(255, 255, 255, 0.2);
	}

	.btn-primary:hover {
		background-color: #e5e5e5;
	}

	.ctrl-btn.hangup:hover {
		background-color: #dc2626;
	}

	.user-box:hover .user-hotbar {
		opacity: 1;
		pointer-events: auto;
		transform: translateX(-50%) translateY(0);
	}
}

@media (max-width: 768px) {
	.settings-panel {
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: 100%;
		max-width: none;
		max-height: none;
		transform: none;
		background: var(--bg);
		border-radius: 0;
		border: none;
		box-shadow: none;
		display: none;
		padding: 0;
		overflow-y: auto;
	}

	.room-badge span {
		margin-left: 3px;
	}

	.settings-panel.open {
		display: flex;
	}

	.settings-content {
		width: 100%;
		max-width: 450px;
		margin: auto;
		padding: 40px 20px;
	}

	.settings-panel .set-header {
		padding: 10px 0;
		font-size: 1.5rem;
		border-color: var(--border);
	}

	.settings-panel .set-group {
		margin-bottom: 30px;
	}

	.settings-panel .set-group label {
		text-align: left;
		margin-bottom: 8px;
	}

	.settings-panel select {
		padding: 12px 0;
		padding-right: 30px;
		font-size: 1.1rem;
		background: transparent;
		border: none;
		border-bottom: 1px solid #3f3f46;
	}

	.settings-panel select:focus {
		border-color: var(--accent);
	}

	.bot-bar {
		gap: 12px;
		padding-left: 10px;
		padding-right: 10px;
	}

	.brand-title.large {
		font-size: 4rem;
	}

	.room-badge {
		max-width: none; 
        flex: 1; 
        min-width: 0; 
        display: block; 
        font-size: clamp(0.9rem, 3.5vw, 1.2rem);
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
        margin-right: 15px; 
	}

	.home-container {
		padding: 0 15px;
		justify-content: center;
	}

	.home-footer {
		flex-direction: column;
		gap: 20px;
		text-align: center;
	}
}