/* # VARIABLES #
##################################################################################### */
:root {
	--background-color: #343950;
	--chat-background-color: #343950;
	--time-color: #999;
	--nickname-me-color: #07e6ff;
	--nickname-color: #aef7ff;
	--message-color: #e7e7e7;
	--link-color: #e8e180;
	--visited-link-color: #e8e180;
	--tempbot-background-color: #454a64;
	--beep-background-color: #444444;
	/* --- */
	--text-color: #f7f7f7;

	/* Chrome tokens (not user-themable — the vars above stay the per-user theme API) */
	--bg-0: #2c3047;
	--bg-1: #343950;
	--bg-2: #21232c;
	--text-1: #e7e7e7;
	--text-2: #aab1c5;
	--text-3: #999999;
	--accent: #07e6ff;
	--accent-soft: #aef7ff;
	--danger: #ff6b81;
	--ok: #45d68c;
	--away: #f0c674;
	--border: #3a3f57;
	--border-soft: #2e3248;
	--space-1: 4px;
	--space-2: 8px;
	--space-3: 12px;
	--space-4: 16px;
	--space-5: 24px;
	--space-6: 32px;
	--radius-1: 4px;
	--radius-2: 8px;
	--focus-ring: 2px solid var(--accent);
	--shadow-1: 0 8px 24px rgb(0 0 0 / 35%);

	/* Layering scale — keep every z-index on one of these steps */
	--z-content: 10;
	--z-bars: 60;
	--z-chrome: 997;
	--z-panel: 998;
	--z-float: 999;
	--z-overlay: 1000;
	--z-modal: 1001;
	--z-lightbox: 1010;
	--z-toast: 1100;

	color-scheme: dark;
}

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

*:after,
*:before {
	box-sizing: border-box;
}

html {
	font-size: 95%;
	height: -webkit-fill-available;
}

@media only screen and (min-width: 900px) {
	html {
		font-size: 85%;
	}
}

html {
	scrollbar-color: var(--border) var(--bg-2);
}

*::-webkit-scrollbar {
	width: 9px;
}

*::-webkit-scrollbar-track {
	background: var(--bg-2);
}

*::-webkit-scrollbar-thumb {
	background-color: #4a5070;
	border-radius: 8px;
	border: 2px solid var(--bg-2);
}

*::-webkit-scrollbar-thumb:hover {
	background-color: #5a6184;
}

body {
	/* font-family: 'Assistant', sans-serif; */
	font-weight: normal;
	line-height: 1.45;
	color: #333;
	/* padding: 5px; */
	direction: ltr;
	-webkit-font-smoothing: antialiased;
	-moz-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;

	min-height: 100vh;
	min-height: -webkit-fill-available;
	background-color: var(--background-color);
	color: var(--text-color);
	/* font-family: 'JetBrains Mono', monospace; */
	font-family: "JetBrains Mono", -apple-system, BlinkMacSystemFont, "Segoe UI",
		Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	/* iPhone */
	-webkit-text-size-adjust: 100%;

	-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
	-webkit-tap-highlight-color: transparent;

	/* overscroll-behavior: none; */
}

body::-webkit-scrollbar {
	width: 5px;
}

body::-webkit-scrollbar-track {
	background: var(--bg-1);
}

body::-webkit-scrollbar-thumb {
	background-color: #4a5070;
	border: 0;
	border-radius: 4px;
}

a:link,
a:visited {
	text-decoration: none;
	color: #e8e180;
}

a:visited {
	text-decoration: none;
	color: #e8e180;
}

/* # UTILS #
##################################################################################### */
.container {
	max-width: 1200px;
	margin: 0 auto;
}

.container--tiny {
	max-width: 340px;
}

.container--small {
	max-width: 500px;
}

.box {
	/* border: 1px solid #eee; */
	border: 0;
	background-color: #21232c;
	padding: 15px;
	border-radius: 6px;
}

.text-center {
	text-align: center !important;
}

.text-right {
	text-align: right !important;
}

.cursor-pointer {
	cursor: pointer !important;
}

.mt1 {
	margin-top: 1rem !important;
}

.mt2 {
	margin-top: 2rem !important;
}

.mt3 {
	margin-top: 2.5rem !important;
}

.mb1 {
	margin-bottom: 1rem !important;
}

.mb2 {
	margin-bottom: 2rem !important;
}

.ltr {
	direction: ltr !important;
}

.display-block {
	display: block !important;
}

.display-inline-block {
	display: inline-block !important;
}

.highlight {
	background-color: #6a643a !important;
}

.in-background {
	filter: opacity(0.7);
	pointer-events: none;
	user-select: none;
}

.no-scroll {
	overflow: hidden;
}

.is-disabled,
a:link.is-disabled,
a:visited.is-disabled {
	color: #aaa;
	cursor: not-allowed;
}

.fade-in {
	animation: fade_in 0.5s forwards;
}

.scale-in {
	animation: scale_in 0.5s forwards;
}

@keyframes fade_in {
	0% {
		opacity: 0%;
	}
	100% {
		opacity: 100%;
	}
}

@keyframes scale_in {
	0% {
		transform: translate3d(-50%, -50%, 0) scale(0.1);
	}
	100% {
		transform: translate3d(-50%, -50%, 0) scale(1);
	}
}

.is-hidden {
	display: none !important;
}

/* # EMPTY STATES #
##################################################################################### */
.empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-6) var(--space-4);
	color: var(--text-3);
	text-align: center;
}

.empty-state .icon--lg {
	width: 2rem;
	height: 2rem;
	opacity: 0.6;
}

/* # TOASTS + INLINE ERRORS #
##################################################################################### */
.toast-root {
	position: fixed;
	bottom: var(--space-5);
	left: 50%;
	transform: translateX(-50%);
	z-index: var(--z-toast);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-2);
	pointer-events: none;
	width: max-content;
	max-width: calc(100vw - 2 * var(--space-4));
}

@media screen and (min-width: 600px) {
	.toast-root {
		left: auto;
		right: var(--space-5);
		transform: none;
		align-items: flex-end;
	}
}

.toast {
	pointer-events: all;
	cursor: pointer;
	background-color: var(--bg-2);
	color: var(--text-1);
	border: 1px solid var(--border);
	border-left: 3px solid var(--accent);
	border-radius: var(--radius-1);
	padding: var(--space-2) var(--space-4);
	box-shadow: var(--shadow-1);
	font-size: 0.9rem;
	max-width: 100%;
	overflow-wrap: break-word;
	animation: toast_in 150ms ease-out;
}

.toast--error {
	border-left-color: var(--danger);
}

.toast--ok {
	border-left-color: var(--ok);
}

.toast--leaving {
	opacity: 0;
	transition: opacity 200ms;
}

@keyframes toast_in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.form-error {
	color: var(--danger);
	font-size: 0.9rem;
	margin-top: var(--space-2);
}

.form-error:not(.is-hidden) {
	animation: fade_in 150ms forwards;
}

/* # ICONS #
##################################################################################### */
.icon {
	display: inline-block;
	width: 1.1em;
	height: 1.1em;
	vertical-align: -0.2em;
	pointer-events: none;
}

.icon--lg {
	width: 1.4em;
	height: 1.4em;
}

.nav-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
}

.nav-toggle .icon {
	width: 20px;
	height: 20px;
}

/* # MODAL #
##################################################################################### */
.modal-container {
	position: fixed;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.55);
	top: 0;
	left: 0;
	bottom: 0;
	right: 0;
	z-index: var(--z-overlay);
	display: flex;
	align-items: center;
	justify-content: center;

	opacity: 0;
	visibility: hidden;

	transition: all 100ms;

	backface-visibility: hidden;
}

.modal-container.is--active {
	opacity: 1;
	visibility: visible;
	transition: all 270ms;
}

.modal {
	box-shadow: var(--shadow-1);
	border: 1px solid var(--border);
	border-radius: var(--radius-2);
	color: var(--text-1);
	max-height: initial;
	max-width: initial;
	overflow-y: hidden;
	padding: 0;
	min-width: 330px;
	max-width: 712px;
	z-index: var(--z-modal);
	background-color: var(--bg-2);
}
.modal > .title {
	margin-bottom: 0;
	padding: 20px;
	padding-bottom: 16px;
}
.modal > .body {
	padding: 20px;
	padding-bottom: 16px;
	color: var(--text-2);
	overflow: auto;
	max-height: 85vh;
}
.modal > .button-container {
	display: flex;
	justify-content: flex-end;
	padding: 20px;
	padding-bottom: 10px;
	gap: var(--space-4);
}

.button {
	padding: var(--space-2) var(--space-4);
	border-radius: var(--radius-1);
	border: 1px solid var(--border);
	min-width: 90px;
	background-color: var(--bg-1);
	color: var(--text-1);
	font-family: inherit;
	cursor: pointer;
}

.button:hover {
	border-color: #4a5070;
	background-color: #3d4361;
}

.button.is-primary {
	background-color: var(--accent);
	border-color: var(--accent);
	font-weight: bold;
	color: #10222b;
}

.button.is-primary:hover {
	background-color: var(--accent-soft);
	border-color: var(--accent-soft);
}

.button.is-danger {
	background-color: transparent;
	border-color: var(--danger);
	color: var(--danger);
}

.button.is-danger:hover {
	background-color: rgb(255 107 129 / 12%);
}

.input {
	font-family: inherit;
	padding: 5px 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-1);
	width: 100%;
	background-color: var(--bg-2);
	color: var(--text-1);
	z-index: var(--z-float);
}

.select {
	padding: 5px 10px;
	border-radius: var(--radius-1);
	border: 1px solid var(--border);
	background-color: var(--bg-2);
	color: var(--text-1);
	font-family: inherit;
}

.title-primary {
	font-size: 2rem;
	font-weight: normal;
}

.title-secondary {
	font-weight: bold;
	font-size: 1.2rem;
}

.text-hint {
	color: #ddd;
	font-size: 0.9rem;
}

.text-hint.is-ok {
	color: var(--ok);
}

.text-hint.is-error {
	color: var(--danger);
}

.input-checkbox {
	margin-bottom: 0.8rem;
}

.chat-row {
	word-wrap: break-word;
	border-bottom: 1px solid rgb(44, 44, 44);
	padding: 5px 0;
}

.chat-row.is-temp-bot {
	background-color: var(--tempbot-background-color);
}

/* Optimistic send states: dim while in flight, flag + retry cursor on failure */
.chat-row.is-pending {
	opacity: 0.5;
}

.chat-row.is-failed {
	opacity: 0.85;
	cursor: pointer;
	border-left: 2px solid #e25555;
	padding-left: 6px;
}

.chat-row.is-failed::after {
	content: " · not sent, tap to retry";
	font-size: 0.75rem;
	color: #e25555;
}

.chat-info {
	display: flex;
	gap: 10px;
	align-items: center;
}

.chat-time {
	color: var(--time-color);
	font-size: 0.8rem;
	padding-top: 0.1rem;
	order: 2;
}

.chat-nickname {
	color: var(--nickname-color);
	order: 1;
}

.chat-nickname.is-me {
	font-weight: bold;
	color: var(--nickname-me-color);
}

.chat-nickname.is-bot-user:before {
	content: "bot";
	font-size: 0.65rem;
	font-weight: normal;
	color: var(--text-3);
	border: 1px solid var(--border);
	border-radius: var(--radius-1);
	padding: 0 4px;
	margin-right: 0.4rem;
	vertical-align: 1px;
}

.chat-message {
	color: var(--message-color);
}

@media screen and (min-width: 600px) {
	.chat-row {
		word-wrap: break-word;
		border-bottom: 0;
		margin-bottom: 3px;
		padding: 0;
	}

	.chat-info {
		display: inline-block;
		/* smaller margins: real space text nodes now add part of the gap */
		margin-right: 3px;
	}

	.chat-time {
		color: var(--time-color);
		font-size: 0.8rem;
		padding-top: 0.1rem;
		margin-right: 2px;
	}

	.chat-nickname {
		color: var(--nickname-color);
		text-align: left;
	}

	.chat-nickname.is-me {
		font-weight: bold;
		color: var(--nickname-me-color);
	}

	.chat-nickname.is-bot-user:before {
		position: relative;
		content: "\01F916 ";
		vertical-align: middle;
		margin-right: 0.4rem;
		top: -2px;
	}

	.chat-message {
		color: var(--message-color);
	}
}

/* # USER LIST #
##################################################################################### */
/* Mobile: a section inside the one drawer. Desktop: the fixed right panel. */
.users {
	display: block;
	margin-bottom: 1.2rem;
}

.users ul {
	list-style: none;
}

@media screen and (min-width: 600px) {
	.users {
		position: fixed;
		right: 0;
		top: 0;
		height: 100%;
		width: auto;
		margin-bottom: 0;
		padding: 15px;
		padding-top: 70px;
		overflow: auto;
		background-color: var(--chat-background-color);
		z-index: var(--z-panel);
	}
}

/* # IMAGE PREVIEW #
##################################################################################### */
.image-preview {
	display: block;
	/* max-width: 320px; */
	max-width: 100%;
	height: auto;
	max-height: 150px;
	/* margin-left: 2.8rem; */
	margin-top: 0.3rem;
	margin-bottom: 0.3rem;
}

@media screen and (min-width: 900px) {
	.image-preview {
		max-height: 200px;
		max-width: 95%;
		margin-left: 2.6rem;
	}
}

/* # FORMS #
##################################################################################### */
.label-input:not(:last-child),
.label-checkbox:not(:last-child) {
	margin-bottom: 1rem;
}

.label-input__label {
	display: block;
	margin-bottom: 0.3rem;
	font-family: inherit;
}

.label-input__label--extra {
	display: block;
	margin-top: -0.2rem;
	margin-bottom: 0.6rem;
	font-family: inherit;
	font-size: 0.8rem;
	color: #ababab;
}

.label-input__input {
	display: block;
	width: 100%;
	font-family: inherit;
	padding: 5px 15px;
	border: 1px solid var(--border);
	background-color: var(--bg-2);
	color: var(--text-1);
	border-radius: 6px;
}

/* Keyboard-visible focus everywhere; mouse clicks stay quiet */
:focus-visible {
	outline: var(--focus-ring);
	outline-offset: 2px;
}

:focus:not(:focus-visible) {
	outline: none;
}

.label-checkbox {
	display: flex;
	align-items: flex-start;
	/* align-items: baseline; */
	gap: 10px;
}

/* .label-checkbox__label {
} */

.label-checkbox__input {
	position: relative;
	top: 0.09rem;
}

.form {
	padding: 0 8px;
}

.label {
	display: block;
	margin-bottom: 0.3rem;
}

/* # NAVIGATION #
##################################################################################### */
.nav {
	position: fixed;
	inset: 0;
	background-color: rgb(0 0 0 / 45%);
	visibility: hidden;
	pointer-events: none;
	opacity: 0;
	transition: all 120ms ease-in-out;
	z-index: var(--z-overlay);
}

.nav.is-active {
	visibility: visible;
	opacity: 1;
	pointer-events: all;
}

.nav-toggle {
	position: fixed;
	top: 10px;
	right: 20px;
	color: var(--text-2);
	background-color: var(--bg-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-1);
	width: 40px;
	height: 40px;
	cursor: pointer;
	z-index: var(--z-float);
}

.nav-toggle:hover {
	color: var(--accent);
	border-color: #4a5070;
}

.nav-items {
	position: absolute;
	top: 0;
	right: 0;
	height: 100%;
	width: min(300px, 85vw);
	display: flex;
	flex-direction: column;
	align-items: stretch;
	padding: var(--space-5) 0 var(--space-4);
	font-size: 1rem;
	list-style: none;
	color: var(--text-2);
	background-color: var(--bg-2);
	border-left: 1px solid var(--border);
	transform: translateX(24px);
	transition: transform 120ms ease-out;
}

.nav.is-active .nav-items {
	transform: none;
}

.nav-items li {
	padding: var(--space-2) var(--space-5);
}

.nav-items li:first-child {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	color: var(--accent-soft);
	font-weight: bold;
	padding-bottom: var(--space-4);
	border-bottom: 1px solid var(--border);
	margin-bottom: var(--space-2);
}

.nav-close {
	margin-left: auto;
	color: var(--text-2);
}

.nav-close:hover {
	color: var(--accent);
}

.nav-items a:link,
.nav-items a:visited {
	display: block;
	color: var(--text-1);
}

.nav-items li:hover a {
	color: var(--accent);
}

.version {
	margin-top: auto;
	font-size: 0.7rem;
	color: var(--text-3);
}



/* The nav toggle floats over the top-right corner on every page; on small
   screens keep page content out from under it (tapping a filter must not
   hit the menu button). Pages with their own fixed header (settings) set
   their own offset later in the cascade. */
@media screen and (max-width: 599px) {
	.container {
		padding-top: 56px;
	}
}

/* # MISC. #
##################################################################################### */
.circle {
	position: relative;
	left: 0;
	height: 10px;
	width: 10px;
	background-color: #bbb;
	border-radius: 50%;
	display: inline-block;
}

.is-connected {
	background-color: #6def6d;
}

.is-disconnected {
	background-color: #ff5555;
}

.irc-status {
	margin: 0 var(--space-1);
	flex-shrink: 0;
}

/* # CHAT INPUT ROW #
   One flex row: the text input flexes, the icon cluster sits beside it —
   icons can never overlap typed text (the old absolute-position bug). */
.chat-input-row {
	display: flex;
	align-items: center;
	gap: var(--space-1);
	height: 100%;
	width: 100%;
	padding-right: var(--space-2);
	background-color: var(--chat-background-color);
	border-top: 1px solid var(--time-color);
}

.chat-input {
	flex: 1;
	min-width: 0;
	height: 100%;
	padding: 5px 10px;
	border: 0;
	background-color: transparent;
	color: var(--message-color);
	font-family: inherit;
	font-size: 1rem;
}

/* the always-focused main input keeps a quiet caret, not a ring */
.chat-input:focus,
.chat-input:focus-visible {
	outline: none;
}

.input-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	flex-shrink: 0;
	border: 0;
	border-radius: var(--radius-1);
	background: none;
	color: var(--accent-soft);
	cursor: pointer;
	padding: 0;
	min-width: 0;
}

.input-icon:hover {
	background-color: rgb(255 255 255 / 7%);
	color: var(--accent);
}

.input-icon .icon {
	width: 18px;
	height: 18px;
}

.input-icon.is-on {
	color: var(--accent);
	background-color: rgb(7 230 255 / 10%);
}

/* Desktop: the attachment icons sit inline in the row, the + is unused. */
.attach-group {
	display: contents;
}

.attach-toggle {
	display: none;
}

@media screen and (max-width: 599px) {
	.chat-input-row {
		position: relative;
	}

	/* + leads the row, like the mockup; the three actions live in a popover */
	.attach-toggle {
		display: flex;
		order: -1;
	}

	.attach-group {
		display: flex;
		align-items: center;
		gap: var(--space-1);
		position: absolute;
		bottom: calc(100% + var(--space-2));
		left: var(--space-1);
		padding: var(--space-1);
		background-color: var(--bg-2);
		border: 1px solid var(--border);
		border-radius: var(--radius-1);
		box-shadow: var(--shadow-1);
	}

	.attach-group.is-collapsed {
		display: none;
	}
}

/* Presence: a fixed-width dot slot — state changes never shift the text */
.presence-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	margin-right: var(--space-2);
	background-color: var(--text-3);
	vertical-align: 1px;
}

.is-offline {
	display: none;
}

.is-online {
	display: flex;
	align-items: center;
}

.is-online .presence-dot {
	background-color: var(--ok);
}

.is-away {
	display: flex;
	align-items: center;
}

.is-away .presence-dot {
	background-color: var(--away);
}

.link {
	color: var(--link-color);
	text-decoration: none;
}

/* # SCROLL TO BOTTOM #
##################################################################################### */
.bottom-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: var(--accent-soft);
	width: 40px;
	height: 40px;
	color: #10222b;
	position: fixed;
	/* clears the e2ee banner, whose height varies with how far the text wraps
	   (--banner-h is kept in sync by chat.ts) */
	bottom: calc(55px + var(--banner-h, 0px));
	right: 20px;
	/* above the e2ee banner, which otherwise buries the "back to present" way out */
	z-index: var(--z-float);
	border-radius: 50%;
	font-weight: bold;
	opacity: 0;
	visibility: hidden;
	transition: all 500ms;
	cursor: pointer;
	user-select: none;
	pointer-events: none;
	transform: translate3d(0, 100px, 0);
}

.bottom-icon.is--active {
	opacity: 1;
	pointer-events: all;
	visibility: visible;
	transform: translate3d(0, 0, 0);
	transition: opacity 270ms, transform 270ms;
}

/* Parked in the past (hopped in from an archive): the same button becomes a
   labelled way back, because scrolling forward through the log never gets there. */
.bottom-icon__label {
	display: none;
	white-space: nowrap;
	font-size: 13px;
}

.bottom-icon.is--jump {
	width: auto;
	gap: 6px;
	padding: 0 14px;
	border-radius: 20px;
}

.bottom-icon.is--jump .bottom-icon__label {
	display: inline;
}

/* # BACKLOG LOADING #
##################################################################################### */
.chat-loading {
	position: fixed;
	/* just below the topic bar; the mobile layout stacks an extra bar above it */
	top: 95px;
	left: 50%;
	transform: translateX(-50%);
	z-index: var(--z-float);
	padding: 3px 12px;
	border-radius: 20px;
	font-size: 12px;
	color: #10222b;
	background-color: var(--accent-soft);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 150ms;
}

.chat-loading.is--active {
	opacity: 1;
	visibility: visible;
}

@media screen and (min-width: 600px) {
	.bottom-icon {
		right: 160px;
	}

	.chat-loading {
		top: 60px;
	}
}

/* # GALLERY #
##################################################################################### */
.gallery {
	display: flex;
	flex-wrap: wrap;
	gap: 2rem;
	/* margin: -1rem 1rem; */
}

.gallery-item {
	flex: 1 0 9rem;
	/* margin: 1rem;  */
	/* box-shadow: 0.3rem 0.4rem 0.4rem rgba(0, 0, 0, 0.4); */
	overflow: hidden;
}

@media screen and (min-width: 600px) {
	.gallery-item {
		flex: 1 0 15rem;
	}
}

/* # GALLERY #
##################################################################################### */
.lightbox {
	position: fixed;
	z-index: var(--z-lightbox);
	width: 100%;
	height: 100%;
	text-align: center;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(120, 120, 120, 0.95);
	visibility: hidden;
	pointer-events: none;
	opacity: 0;
	transition: all 200ms;
	backface-visibility: hidden;
}

.lightbox.is-active {
	visibility: visible;
	pointer-events: all;
	opacity: 1;
	transition: all 200ms;
}

.lightbox-image {
	max-height: 100%;
	max-width: 100%;
	object-fit: scale-down;
	vertical-align: middle;
	position: relative;
	top: 50%;
	transform: translateY(-50%);
	/* box-shadow: 0 .4rem 0.4rem rgba(0, 0, 0, 0.4); */
}

.lightbox-arrow {
	position: absolute;
	top: 50%;
	color: #fff;
	font-size: 1.5rem;
	font-weight: bold;
	padding: 10px 20px;
	background-color: rgba(120, 120, 120, 0.7);
	cursor: pointer;
	transform: translateY(-50%);
	border-radius: 30%;
	user-select: none;
	z-index: 1;
}

.lightbox-prev {
	left: 10px;
}

.lightbox-next {
	right: 10px;
}

.lightbox-close {
	top: 30px;
	right: 10px;
	z-index: 2;
}

.lightbox-prev,
.lightbox-next {
	display: none;
}

.lightbox-count {
	top: 11px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 1;
	font-size: 1rem;
	border-radius: 3px;
	width: 100%;
}

.lightbox-info {
	top: initial;
	bottom: 11px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 1;
	font-size: 1rem;
	border-radius: 3px;
	width: 100%;
}

@media screen and (min-width: 600px) {
	.lightbox-image {
		max-height: 88%;
	}

	.lightbox-prev,
	.lightbox-next {
		display: block;
	}

	.lightbox-count {
		top: 0;
	}

	.lightbox-info {
		bottom: 0;
	}
}

/* # SIDEBAR (channels / DMs) #
##################################################################################### */
.sidebar {
	position: fixed;
	left: 0;
	top: 0;
	height: 100%;
	width: 200px;
	background-color: var(--bg-2);
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	z-index: var(--z-panel);
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transition: all 100ms ease-in-out;
}

.sidebar-brand {
	padding: var(--space-3) var(--space-4);
	border-bottom: 1px solid var(--border);
	font-weight: bold;
	letter-spacing: 0.02em;
	flex-shrink: 0;
}

.sidebar-brand::before {
	content: "> ";
	color: var(--accent);
}

.sidebar-scroll {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: var(--space-3) 10px;
}

.sidebar-me {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding: var(--space-2) var(--space-3);
	border-top: 1px solid var(--border);
	background-color: rgb(0 0 0 / 15%);
	flex-shrink: 0;
}

.sidebar-me__avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--accent), #0891b2);
	color: #10222b;
	font-weight: bold;
	font-size: 0.85rem;
	flex-shrink: 0;
}

.sidebar-me__who {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.sidebar-me__nick {
	font-size: 0.85rem;
	font-weight: bold;
	color: var(--accent);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sidebar-me__st {
	font-size: 0.7rem;
	color: var(--text-3);
	display: flex;
	align-items: center;
}

.sidebar-me__st .presence-dot {
	width: 6px;
	height: 6px;
	margin-right: var(--space-1);
}

.presence-dot--on {
	background-color: var(--ok);
}

.presence-dot--away {
	background-color: var(--away);
}

.sidebar-brand {
	display: flex;
	align-items: center;
}

.sidebar-close {
	margin-left: auto;
	display: none;
}

/* the drawer's own sections for people + pages exist only on small screens */
.sidebar-pages {
	display: none;
}

.sidebar-pages a:link,
.sidebar-pages a:visited {
	color: inherit;
	display: block;
}

@media screen and (max-width: 599px) {
	.sidebar-close {
		display: flex;
	}

	.sidebar-pages {
		display: block;
	}

	.sidebar .users .panel-head {
		font-size: 0.85rem;
		text-transform: uppercase;
		color: #888;
		letter-spacing: normal;
	}

	.sidebar .users li {
		padding: 4px 8px;
	}
}

.sidebar.is-active {
	visibility: visible;
	opacity: 1;
	pointer-events: all;
	width: 100%;
}

@media screen and (min-width: 600px) {
	.sidebar {
		visibility: visible;
		opacity: 1;
		pointer-events: all;
	}

	.sidebar.is-active {
		width: 200px;
	}

	.has-sidebar .chat-body,
	.has-sidebar .chat-head {
		margin-left: 200px;
	}

	/* position the fixed composer AFTER the sidebar rather than padding a
	   full-width box over it — otherwise it overlaps (and, at a higher z-index,
	   swallows clicks on) the user chip at the bottom of the sidebar */
	.has-sidebar .chat-foot {
		left: 200px;
		right: 0;
		width: auto;
	}
}

.sidebar-section {
	margin-bottom: 1.2rem;
}

.sidebar-title {
	font-size: 0.85rem;
	text-transform: uppercase;
	color: #888;
	margin-bottom: 0.4rem;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.sidebar-add {
	cursor: pointer;
	color: var(--accent-soft);
	padding: 0 6px;
	display: inline-flex;
	align-items: center;
}

.sidebar-add:hover {
	color: var(--accent);
}

.sidebar-list {
	list-style: none;
}

.sidebar-list li {
	padding: 4px 8px;
	border-radius: var(--radius-1);
	border-left: 2px solid transparent;
	cursor: pointer;
	color: #ccc;
	display: flex;
	gap: var(--space-2);
	align-items: center;
	word-break: break-all;
}

.sidebar-list li .chan-icon {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	opacity: 0.75;
}

.sidebar-list li .chan-label {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sidebar-list li:hover {
	background-color: #2c2f3b;
}

.sidebar-list li.is-current {
	background-color: #343950;
	color: var(--accent-soft);
	border-left-color: var(--accent);
}

.sidebar-list li .badge {
	background-color: #e8e180;
	color: #333;
	font-size: 0.7rem;
	font-weight: bold;
	border-radius: 8px;
	padding: 0 6px;
	margin-left: 6px;
}

.sidebar-list li .voice-count {
	color: var(--ok);
	font-size: 0.75rem;
}

.sidebar-list li .voice-count .icon {
	width: 0.9em;
	height: 0.9em;
}

.sidebar-create {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.channel-title {
	font-weight: bold;
}

/* # ATTACHMENTS #
##################################################################################### */
.voice-attachment {
	display: block;
	margin-top: 0.3rem;
	max-width: 320px;
	width: 100%;
}

.video-attachment {
	display: block;
	margin-top: 0.3rem;
	max-width: 100%;
	max-height: 260px;
	border-radius: 4px;
}

.club-user {
	cursor: pointer;
}

/* # RECORDER / SHARE ICONS #
##################################################################################### */
.mic {
	position: absolute;
	top: 45%;
	right: 130px !important;
	font-size: 1.2rem;
	left: auto;
	transform: translate3d(0, -50%, 0);
	cursor: pointer;
	z-index: var(--z-float);
}

.clapper {
	position: absolute;
	top: 45%;
	right: 160px !important;
	font-size: 1.2rem;
	left: auto;
	transform: translate3d(0, -50%, 0);
	cursor: pointer;
	z-index: var(--z-float);
}

.record-preview {
	display: block;
	width: 100%;
	max-width: 480px;
	margin: 0 auto;
	border-radius: 4px;
	background-color: #111;
}

audio.record-preview {
	background-color: transparent;
}

.is-recording {
	color: #ff5555 !important;
	animation: record_pulse 1s infinite;
}

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

/* # VOICE BAR / TILES #
##################################################################################### */
.voice-bar {
	position: sticky;
	top: 0;
	z-index: var(--z-bars);
	background-color: #21232c;
	padding: 8px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	border-bottom: 1px solid #343950;
}

@media screen and (min-width: 600px) {
	.has-sidebar .voice-bar {
		margin-left: 200px;
	}

	/* reserve room for the fixed users panel on the right, like .topic-bar does —
	   otherwise the right-aligned controls (join/leave) hide behind it */
	.voice-bar {
		padding-right: 140px;
	}
}

.voice-btn {
	min-width: auto;
	padding: 6px 14px;
	cursor: pointer;
}

.voice-btn.is-on {
	background-color: var(--nickname-color);
	color: #333;
}

.voice-tiles {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	width: 100%;
}

.voice-tile {
	position: relative;
	background-color: #343950;
	border-radius: 6px;
	padding: 6px;
	min-width: 120px;
	max-width: 320px;
	flex: 1 0 120px;
}

.voice-tile__name {
	font-size: 0.8rem;
	color: #aef7ff;
	margin-bottom: 4px;
}

.voice-tile__video {
	width: 100%;
	max-height: 220px;
	border-radius: 4px;
	background-color: #111;
}

.voice-tile.is-speaking {
	box-shadow: 0 0 0 2px var(--nickname-me-color);
}

.voice-tile__mic {
	display: none;
	margin-left: 4px;
	color: var(--danger);
}

.voice-tile__mic .icon {
	width: 0.85em;
	height: 0.85em;
}

.voice-tile.is-muted .voice-tile__mic {
	display: inline;
}

.voice-tile__volume {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: 4px;
}

.voice-tile__volume input[type="range"] {
	flex: 1;
	min-width: 0;
	accent-color: var(--nickname-color);
}

.voice-tile__local-mute {
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	color: var(--accent-soft);
	display: inline-flex;
	align-items: center;
}

.voice-btn.is-off {
	background-color: #8c3a46;
	color: #fff;
}

.voice-stage {
	width: 100%;
}

.voice-stage__item {
	position: relative;
	width: 100%;
	background-color: #111;
	border-radius: 6px;
	overflow: hidden;
	margin-bottom: 8px;
}

.voice-stage__item:last-child {
	margin-bottom: 0;
}

.voice-stage__video {
	display: block;
	width: 100%;
	max-height: 45vh;
	object-fit: contain;
}

.voice-stage__item:fullscreen .voice-stage__video {
	max-height: 100vh;
	height: 100%;
}

.voice-stage__label {
	position: absolute;
	top: 6px;
	left: 6px;
	z-index: 1;
	padding: 2px 8px;
	border-radius: 4px;
	background-color: rgba(0, 0, 0, 0.55);
	color: #aef7ff;
	font-size: 0.8rem;
}

.voice-stage__fullscreen {
	position: absolute;
	top: 6px;
	right: 6px;
	z-index: 1;
	padding: 2px 8px;
	border-radius: 4px;
	border: 0;
	background-color: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 1rem;
	cursor: pointer;
}

.phone {
	position: absolute;
	top: 45%;
	right: 190px !important;
	font-size: 1.2rem;
	left: auto;
	transform: translate3d(0, -50%, 0);
	cursor: pointer;
	z-index: var(--z-float);
}

/* # PAGER + HOP LINKS #
##################################################################################### */
.pager {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 10px 8px;
	font-size: 0.9rem;
}

.pager .pager-info {
	color: #aaa;
}

.pager .is-disabled {
	color: #666;
}

.hop-link,
a.hop-link:link,
a.hop-link:visited {
	color: var(--time-color, #999);
	text-decoration: none;
	cursor: pointer;
}

a.hop-link:hover {
	color: var(--nickname-color, #aef7ff);
	text-decoration: underline;
}

a.hop-arrow:link,
a.hop-arrow:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	vertical-align: middle;
	line-height: 1;
	min-height: 1.5em;
	color: var(--nickname-color, #aef7ff);
	text-decoration: none;
	padding: 0 6px;
	border: 1px solid #4a5070;
	border-radius: 4px;
	font-size: 0.85rem;
	white-space: nowrap;
}

/* SVG arrow: font-independent, so it centers regardless of glyph metrics */
.hop-arrow__icon {
	display: block;
	width: 0.85em;
	height: 0.85em;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

a.hop-arrow:hover {
	background-color: #4a5070;
	color: #fff;
}

/* Gallery tiles: uniform thumbnails so even tiny images are visible/clickable */
.gallery-image {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	background-color: #21232c;
	border-radius: 4px;
}

/* Video tiles: centered play badge; clicks pass through to the tile */
.gallery-item--video {
	position: relative;
}

.gallery-item--video::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 3rem;
	height: 3rem;
	border-radius: 50%;
	background-color: rgba(0, 0, 0, 0.55);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: 55% center;
	background-size: 1.6rem;
	pointer-events: none;
}

/* # PAGE HEADS + ARCHIVE / MEDIA / LOGIN (mockup fidelity) #
##################################################################################### */
.button.is-full {
	width: 100%;
}

.login-brand {
	font-size: 1.5rem;
	font-weight: bold;
}

.login-brand::before {
	content: "> ";
	color: var(--accent);
}

.login-sub {
	color: var(--text-3);
	font-size: 0.85rem;
	margin-top: var(--space-1);
}

.panel-head {
	font-size: 0.75rem;
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--text-3);
	margin-bottom: var(--space-2);
}

.media-head {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--space-4);
	padding: var(--space-4) 8px var(--space-2);
}

.media-title {
	font-size: 1.3rem;
	font-weight: bold;
}

.media-title::before {
	content: "// ";
	color: var(--accent);
}

.media-filter {
	display: flex;
	align-items: center;
	gap: var(--space-2);
}

.label-inline {
	color: var(--text-3);
	font-size: 0.85rem;
}

.media-head__pager {
	margin-left: auto;
}

.media-head__pager .pager {
	padding: 0;
}

.arch-filter {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--space-2);
	max-width: 720px;
}

.searchbox {
	position: relative;
	flex: 1;
	min-width: 200px;
	display: block;
}

.searchbox__icon {
	position: absolute;
	left: var(--space-2);
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-3);
	width: 14px;
	height: 14px;
}

.searchbox .input {
	padding-left: var(--space-6);
}

.arch-log {
	border: 1px solid var(--border);
	border-radius: var(--radius-2);
	background-color: rgb(0 0 0 / 10%);
	overflow: hidden;
	padding: 0;
}

.arch-log:empty {
	display: none;
}

.arch-log .chat-row {
	padding: 5px 10px;
	margin-bottom: 0;
	border-bottom: 0;
	border-top: 1px solid rgb(58 63 87 / 45%);
}

.arch-log .chat-row:hover {
	background-color: rgb(255 255 255 / 3%);
}

.arch-log > :first-child {
	border-top: 0;
}

.day-head {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-2) 10px;
	font-size: 0.75rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text-3);
}

.day-head::after {
	content: "";
	flex: 1;
	height: 1px;
	background-color: rgb(58 63 87 / 60%);
}

/* # AUDIT PASS: voice bar meta, tile avatars, user rows, gallery chips #
##################################################################################### */
.voice-bar__name {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	font-weight: bold;
	color: var(--accent-soft);
	flex-shrink: 0;
}

.voice-bar__name .icon {
	color: var(--accent);
}

.voice-bar__name:empty,
.voice-bar__meta:empty {
	display: none;
}

.voice-bar__meta {
	font-size: 0.75rem;
	color: var(--text-3);
}

.voice-bar__ctl {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: var(--space-2);
}

.voice-tile__avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--accent-soft), #6b8cff);
	color: #10222b;
	font-size: 0.7rem;
	font-weight: bold;
	flex-shrink: 0;
}

.voice-tile__name {
	display: flex;
	align-items: center;
	gap: var(--space-2);
}

.panel-head__count {
	color: var(--text-3);
	font-weight: normal;
}

.panel-head__count:not(:empty)::before {
	content: "— ";
}

/* NB: no `display` here — it would out-specify .is-offline and reveal
   offline members. Presence classes own display. */
.users li.club-user {
	align-items: center;
}

.user-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.users-empty {
	color: var(--text-3);
	font-size: 0.85rem;
	padding: var(--space-1) 0;
}

.user-lock {
	margin-left: var(--space-2);
	width: 0.8em;
	height: 0.8em;
	color: var(--text-3);
	opacity: 0.7;
}

/* archive: searched term inside a result row */
mark.hl {
	background-color: rgb(232 225 128 / 22%);
	color: var(--link-color);
	border-radius: 2px;
	padding: 0 2px;
}

/* gallery tiles lift toward the pointer; videos carry their duration */
.gallery-item {
	position: relative;
	border-radius: var(--radius-1);
	transition: transform 120ms ease, box-shadow 120ms ease;
}

.gallery-item:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow-1);
}

.gallery-dur {
	position: absolute;
	right: var(--space-2);
	bottom: var(--space-2);
	padding: 0 var(--space-2);
	background-color: rgb(13 15 22 / 82%);
	border-radius: var(--radius-1);
	font-size: 0.7rem;
	line-height: 1.5;
	color: var(--text-1);
	pointer-events: none;
}
