/* Darkride Chat: the website's look (vr.darkride.ai), so that the chat reads as the same site. The palette is
   the site's, under the site's names: metaverse frontend/src/styles.scss, $dr-* and :root --dr-* (darkride.ai's
   "Digital Night": a mid-dark page, lighter cards, soft white text, the logo's cyan d and violet R). Roboto, as
   the site, from assets/ (assets/README.md).
   Written for Chromium 83 (no :has, no aspect-ratio, no container queries, no inset) so the viewer's page
   engine draws it as a browser does. Flex gap needs 84: on 83 items only sit closer. */

:root {
	color-scheme: dark;
	--dr-bg-darker: #171b2d; /* header, footer: here the sidebar and the bars */
	--dr-bg: #1c2136; /* the page: here the conversation */
	--dr-bg-alt: #20263d;
	--dr-surface: #242a44; /* cards, dialogs, menus, the composer's field */
	--dr-selection: #333a5a; /* hover, selected */
	--dr-text: #f4f6f8;
	--dr-text-muted: #9aa1bd;
	--dr-night: #091023; /* text on cyan */
	--dr-cyan: #00afff;
	--dr-violet: #a548ff;
	--dr-red: #ff5555;
	--dr-green: #50fa7b;
	/* the chat's own, made from the above */
	--line: rgba(255, 255, 255, 0.08);
	--line-strong: rgba(255, 255, 255, 0.16);
	--radius: 4px; /* the site's cards and buttons */
}

@font-face {
	font-family: "Roboto";
	font-style: normal;
	font-weight: 300;
	src: local("Roboto Light"), local("Roboto-Light"), url("assets/fonts/roboto-v20-latin-300.woff2") format("woff2");
}
@font-face {
	font-family: "Roboto";
	font-style: normal;
	font-weight: 400;
	src: local("Roboto"), local("Roboto-Regular"), url("assets/fonts/roboto-v20-latin-regular.woff2") format("woff2");
}
@font-face {
	font-family: "Roboto";
	font-style: normal;
	font-weight: 500;
	src: local("Roboto Medium"), local("Roboto-Medium"), url("assets/fonts/roboto-v20-latin-500.woff2") format("woff2");
}

/* Twemoji's art (as Element has it; the font is OFL, the art CC-BY 4.0, credited in the picker), for emoji only:
   the ranges leave out letters, digits and the symbols text uses (©, ®, ™, arrows), which stay Roboto's */
@font-face {
	font-family: "Twemoji";
	src: url("assets/fonts/twemoji.woff2") format("woff2");
	unicode-range: U+200D, U+20E3, U+231A-231B, U+23E9-23F3, U+23F8-23FA, U+24C2, U+25AA-25AB, U+25B6, U+25C0, U+25FB-25FE,
		U+2600-27BF, U+2934-2935, U+2B05-2B07, U+2B1B-2B1C, U+2B50, U+2B55, U+3030, U+303D, U+3297, U+3299, U+FE0F,
		U+1F000-1FAFF, U+E0020-E007F;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	height: 100%;
	background: var(--dr-bg);
	color: var(--dr-text);
	font: 14px/1.45 "Roboto", "Twemoji", "Helvetica Neue", sans-serif;
}

::selection { background: rgba(165, 72, 255, 0.4); }

h1, h2, h3, strong, b { font-weight: 500; }

#root { height: 100%; }
.loading { padding: 24px; color: var(--dr-text-muted); }
.muted { color: var(--dr-text-muted); }
.small-text { font-size: 12px; }
.error { color: var(--dr-red); min-height: 1.2em; font-size: 13px; }

a { color: var(--dr-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
a.hifi-link { color: var(--dr-violet); }

/* buttons as the site's: flat cyan with night text; ghost ones as its outlined "Client coming soon" */
button {
	font: inherit;
	font-weight: 500;
	color: var(--dr-night);
	background: var(--dr-cyan);
	border: 0;
	border-radius: var(--radius);
	padding: 8px 16px;
	cursor: pointer;
	white-space: nowrap;
}
button:hover { background: #33bfff; }
button:disabled { opacity: 0.5; cursor: default; }
button.small { padding: 5px 12px; font-size: 13px; }
button.ghost { background: transparent; color: var(--dr-text); border: 1px solid var(--line-strong); }
button.ghost:hover { background: var(--dr-selection); }
button.icon { background: transparent; color: var(--dr-text-muted); font-size: 18px; padding: 4px 8px; }
button.icon:hover { color: var(--dr-cyan); background: transparent; }

.input {
	font: inherit;
	color: var(--dr-text);
	background: var(--dr-surface);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	padding: 8px 10px;
	width: 100%;
	outline: none;
}
.input::placeholder { color: var(--dr-text-muted); }
.input:focus { border-color: var(--dr-cyan); }

/* the wordmark, as in the site's header, and the window's name beside it */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wordmark { height: 22px; width: auto; display: block; }
.brand-chat {
	font-weight: 500;
	color: var(--dr-text-muted);
	padding-left: 10px;
	border-left: 1px solid var(--line-strong);
	line-height: 18px;
}

/* sign-in */
.signin {
	max-width: 340px;
	margin: 10vh auto 0;
	padding: 28px 24px 24px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--dr-surface);
	border-radius: var(--radius);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.signin .mark { width: 120px; height: auto; display: block; margin: 0 auto; }
.signin .brand-title { margin: 0; text-align: center; font-size: 22px; letter-spacing: 0.04em; }
.signin p { text-align: center; margin: 0 0 6px; }
.signin .error { min-height: 0; }

/* the two panes */
.app { display: flex; height: 100%; position: relative; }

.sidebar {
	width: 270px;
	flex: none;
	display: flex;
	flex-direction: column;
	background: var(--dr-bg-darker);
	border-right: 1px solid var(--line);
	min-height: 0;
}
.me { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.room-list { overflow-y: auto; flex: 1; padding-bottom: 12px; }
.section { padding: 14px 12px 4px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dr-text-muted); }
.hint { padding: 4px 12px; color: var(--dr-text-muted); font-size: 12px; }

.room-item {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 1px 6px;
	padding: 7px 8px;
	border-radius: var(--radius);
	cursor: pointer;
}
.room-item:hover { background: var(--dr-surface); }
.room-item.current { background: var(--dr-selection); }
.room-item.current .room-name { font-weight: 500; }
.room-item.invited { cursor: default; background: rgba(165, 72, 255, 0.12); }
.room-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-actions { display: flex; gap: 4px; }

.presence { width: 8px; height: 8px; border-radius: 50%; flex: none; background: transparent; }
.presence.online { background: var(--dr-green); }
.presence.unavailable { background: #f1c453; }
.presence.offline { background: var(--dr-selection); }

.badge {
	min-width: 20px;
	padding: 0 6px;
	border-radius: 10px;
	background: var(--dr-selection);
	color: var(--dr-text);
	font-size: 11px;
	font-weight: 500;
	text-align: center;
	line-height: 18px;
}
.badge.highlight { background: var(--dr-violet); color: #fff; }

.room-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--dr-bg); }
.room-pane.dropping { outline: 2px dashed var(--dr-cyan); outline-offset: -6px; }
.room-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 16px;
	height: 52px;
	flex: none;
	border-bottom: 1px solid var(--line);
	background: var(--dr-bg-darker);
}
.room-title { font-weight: 500; font-size: 15px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { display: none; }

.timeline { flex: 1; overflow-y: auto; padding: 10px 16px; }
.load-earlier { display: block; margin: 4px auto 12px; }

.message { display: flex; gap: 12px; margin-top: 12px; }
.message.grouped { margin-top: 2px; }
.message.pending { opacity: 0.6; }
.avatar {
	width: 36px;
	height: 36px;
	flex: none;
	border-radius: 50%;
	background: var(--dr-surface);
	color: var(--dr-violet);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 500;
	overflow: hidden;
	position: relative;
}
.avatar img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.spacer { visibility: hidden; height: 0; }
.message-main { min-width: 0; flex: 1; }
.message-head { display: flex; gap: 8px; align-items: baseline; }
.sender { font-weight: 500; color: var(--dr-cyan); }
.time { font-size: 11px; color: var(--dr-text-muted); }
.body { overflow-wrap: anywhere; white-space: pre-wrap; }
.body p { margin: 0 0 4px; }
.body pre, .body code { background: var(--dr-bg-darker); border-radius: var(--radius); padding: 1px 4px; font-size: 13px; }
.body pre { padding: 8px; overflow-x: auto; white-space: pre; }
.body blockquote { margin: 4px 0; padding-left: 10px; border-left: 3px solid var(--dr-selection); color: var(--dr-text-muted); }
.emote { font-style: italic; }
.member-line { text-align: center; font-size: 12px; color: var(--dr-text-muted); margin: 8px 0; }

.picture { display: block; max-width: min(100%, 360px); max-height: 300px; object-fit: contain; border-radius: var(--radius); margin-top: 4px; cursor: zoom-in; }
video.picture { cursor: default; }
.media audio { margin-top: 4px; max-width: 100%; }
.file-card, .invite-card {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 4px;
	padding: 10px 12px;
	background: var(--dr-surface);
	border-radius: var(--radius);
	max-width: 360px;
	white-space: normal;
}
.file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-card { flex-wrap: wrap; border-left: 3px solid var(--dr-violet); }
.invite-title { width: 100%; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dr-violet); }
.invite-world { flex: 1; font-weight: 500; }

.composer {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	padding: 10px 12px;
	border-top: 1px solid var(--line);
	background: var(--dr-bg-darker);
}
.composer .input { resize: none; max-height: 160px; overflow-y: hidden; }
.composer .input.tall { overflow-y: auto; }
.composer .send { color: var(--dr-cyan); }

.status {
	position: absolute;
	left: 50%;
	top: 10px;
	transform: translateX(-50%);
	padding: 6px 14px;
	border-radius: 16px;
	background: var(--dr-surface);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
	font-size: 12px;
	display: none;
	z-index: 5;
}
.status.shown { display: block; }

.overlay, .lightbox {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: rgba(9, 16, 35, 0.8);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
}
.dialog {
	width: min(92vw, 380px);
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--dr-surface);
	border-radius: var(--radius);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.dialog h2 { margin: 0; font-size: 18px; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.lightbox { flex-direction: column; gap: 8px; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 86vh; border-radius: var(--radius); }
.lightbox-name { color: var(--dr-text-muted); font-size: 12px; }

/* friends (friends.ts): the list's rows, requests, and who sees where you are */
.friend-where { display: block; font-size: 11px; color: var(--dr-text-muted); line-height: 1.2; }
.friend-request .room-name, .friend .room-name { line-height: 1.25; }
.friend-remove { display: none; font-size: 15px; padding: 0 4px; }
.friend:hover .friend-remove { display: inline-block; }
.friend-request.sent { opacity: 0.8; }
.visibility {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 10px 12px 12px;
	border-top: 1px solid var(--line);
	font-size: 11px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--dr-text-muted);
}
.visibility-select { padding: 5px 8px; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 400; }
.room-header .small { flex: none; }

/* emoji: the picker, the ":name" suggestions, reactions */
.composer { position: relative; }
.emoji-button { font-size: 18px; }
.emoji-picker {
	position: fixed;
	width: 328px;
	max-width: calc(100vw - 16px);
	height: 380px;
	max-height: calc(100vh - 80px);
	display: flex;
	flex-direction: column;
	background: var(--dr-surface);
	border-radius: var(--radius);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
	z-index: 20;
}
.emoji-search { margin: 10px 10px 6px; width: auto; }
.emoji-tabs { display: flex; padding: 0 6px; border-bottom: 1px solid var(--line); }
.emoji-tab { flex: 1; background: transparent; padding: 6px 0; font-size: 17px; border-radius: 0; }
.emoji-tab:hover { background: var(--dr-selection); }
.emoji-grid { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.emoji-section { padding: 8px 2px 4px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dr-text-muted); }
.emoji-row { display: flex; flex-wrap: wrap; }
button.emoji { background: transparent; padding: 3px; width: 34px; height: 34px; font-size: 22px; line-height: 28px; border-radius: var(--radius); font-weight: 400; }
button.emoji:hover { background: var(--dr-selection); }
.emoji-credit { padding: 6px 10px; font-size: 11px; color: var(--dr-text-muted); border-top: 1px solid var(--line); }

.emoji-suggest {
	position: absolute;
	left: 12px;
	bottom: 100%;
	margin-bottom: 4px;
	min-width: 220px;
	background: var(--dr-surface);
	border-radius: var(--radius);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
	padding: 4px;
	z-index: 15;
}
.emoji-suggest[hidden] { display: none; }
.emoji-suggestion { display: flex; align-items: center; gap: 8px; width: 100%; background: transparent; color: var(--dr-text); padding: 4px 8px; font-weight: 400; text-align: left; }
.emoji-suggestion.selected, .emoji-suggestion:hover { background: var(--dr-selection); }
.emoji-char { font-size: 20px; width: 24px; text-align: center; }
.emoji-name { color: var(--dr-text-muted); }

.message { position: relative; }
.react {
	position: absolute;
	top: -4px;
	right: 6px;
	display: none;
	background: var(--dr-surface);
	color: var(--dr-text-muted);
	padding: 2px 8px;
	font-size: 16px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.message:hover .react { display: block; }
.react:hover { color: var(--dr-cyan); background: var(--dr-surface); }
.quick-reactions {
	position: fixed;
	display: flex;
	padding: 4px;
	background: var(--dr-surface);
	border-radius: 20px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
	z-index: 20;
}
.quick-reactions button.emoji { border-radius: 50%; }
.quick-reactions .more { color: var(--dr-text-muted); font-size: 18px; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 1px 8px;
	background: var(--dr-surface);
	color: var(--dr-text);
	border: 1px solid transparent;
	border-radius: 12px;
	font-weight: 400;
}
.reaction:hover { background: var(--dr-selection); }
.reaction.mine { border-color: var(--dr-cyan); background: rgba(0, 175, 255, 0.12); }
.reaction-key { font-size: 16px; }
.reaction-count { font-size: 12px; color: var(--dr-text-muted); }
.reaction.mine .reaction-count { color: var(--dr-cyan); }

/* GIFs: the button and the picker (gifs.ts) */
.gif-button { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; border: 1px solid var(--line-strong); padding: 2px 6px; margin: 0 2px; }
.gif-picker { height: 440px; }
.gif-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.gif-grid { column-count: 2; column-gap: 6px; }
button.gif { display: block; width: 100%; padding: 0; margin-bottom: 6px; background: var(--dr-bg-darker); break-inside: avoid; border-radius: var(--radius); overflow: hidden; }
button.gif:hover { outline: 2px solid var(--dr-cyan); background: var(--dr-bg-darker); }
.gif-preview { display: block; width: 100%; height: auto; }
.gif-more { display: block; margin: 4px auto 0; }
.gif-more[hidden] { display: none; }

/* narrow: the viewer's popup and phones show the list or the room, not both */
@media (max-width: 620px) {
	.sidebar { width: 100%; border-right: 0; }
	.room-pane { display: none; }
	.app.show-room .sidebar { display: none; }
	.app.show-room .room-pane { display: flex; }
	.back { display: inline-block; }
}
