:root {
	--bg: #000000;
	--fg: #8fe89c;
	--muted: #7a828c;

	/* the clickable channel/location prefix - blue reads as "navigate here" and
	   is the one palette slot not already claimed by identity (orange = you /
	   hashed user hues), the app's voice (green), or metadata (gray). */
	--geo: #5cb3ff;
	--user: #8ef29c;
	--accent: #7be488;

	--chrome-bg: #000000;
	--chrome-border: rgba(123, 228, 136, 0.12);
}

html,
body {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	background: var(--bg);
	color: var(--fg);
	/* match bitchat: it ships no custom font and renders chat in the system
	   monospaced design (SF Mono on Apple platforms). ui-monospace resolves to
	   that same platform system monospace, with explicit fallbacks behind it. */
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
	overflow: hidden;
}

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

#topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
	background: var(--chrome-bg);
	border-bottom: 1px solid var(--chrome-border);
	color: var(--accent);
	font-size: 13px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.brand {
	cursor: pointer;
}

#status.tapExit {
	cursor: pointer;
}

#terminal {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	padding: 12px 14px;
	white-space: pre-wrap;
	word-break: break-word;
	font-size: 14px;
}

/* anchor messages to the bottom so the newest sit just above the input (and
   ride up with the keyboard) instead of a short backlog hanging at the top out
   of reach. The auto-margin spacer collapses to 0 once content overflows, so
   scrolling stays fully accessible. */
#terminal::before {
	content: "";
	margin-top: auto;
}

.line {
	margin: 0 0 4px 0;
}

/* messages that @-mention you: full-bleed across the terminal's horizontal
   padding (14px) so the highlight reaches the screen edges. The tint color is
   the sender's own color, set inline in JS. */
.line.mention {
	margin-left: -14px;
	margin-right: -14px;
	padding: 2px 14px;
}

.geo {
	color: var(--geo);
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-thickness: 1px;
}

.inlineLink,
.inlineGeo {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-thickness: 1px;
	cursor: pointer;
}

.inlineGeo {
	font-weight: 700;
}

/* bitchat weights: other users get a medium name + regular body, while your
   own messages render fully bold. The .mine class is added to the line in JS. */
.user {
	font-weight: 500;
}

.msg {
	color: var(--fg);
}

/* the #xxxx pubkey suffix is dimmed to 60% of the name color, matching native
   bitchat (it renders the suffix run as baseColor.opacity(0.6)). */
.tag {
	opacity: 0.6;
}

.line.mine .bracket,
.line.mine .user,
.line.mine .tag,
.line.mine .msg {
	font-weight: 700;
}

.ts {
	color: var(--muted);
	font-size: 0.8em;
}

.toggleMore {
	color: var(--muted);
	font-size: 0.8em;
	text-decoration: underline;
	cursor: pointer;
	margin-left: 8px;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.system {
	color: var(--muted);
}

.mediaPreview {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 8px;
	margin-top: 6px;
}

.mediaPreview[data-img-toggle] {
	cursor: pointer;
}

.chatImagePreview {
	display: block;
	max-width: min(100%, 420px);
	max-height: 420px;
	border-radius: 8px;
	border: 1px solid var(--chrome-border);
}

.chatImagePreviewCensored {
	filter: blur(18px) brightness(0.55);
	transform: scale(1.04);
}

.mediaCensorOverlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	font-size: 0.85em;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: rgba(255, 255, 255, 0.92);
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
	background: rgba(0, 0, 0, 0.18);
}

#composerWrap {
	position: relative;
}

#newMessagesBar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 100%;
	padding: 8px 12px;
	background: color-mix(in srgb, var(--accent) 14%, transparent);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	color: var(--accent);
	font-size: 0.9em;
	font-weight: 700;
	text-align: left;
	cursor: pointer;
	user-select: none;
	z-index: 5;
}

#newMessagesBar[hidden] {
	display: none;
}

/* flat, borderless composer to match native bitchat: just the input text and a
   "send" label sitting low above the home indicator, no boxes or separator. */
#inputbar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 6px 14px calc(6px + env(safe-area-inset-bottom));
	background: var(--chrome-bg);
	border-top: 1px solid var(--chrome-border);
}

#chatInput {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	color: var(--fg);
	font: inherit;
	font-size: 15px;
	outline: 0;
	padding: 6px 0;
}

#sendBtn {
	border: 0;
	background: transparent;
	color: var(--accent);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	padding: 6px 0;
}

.gate {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.82);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.gate.show {
	display: flex;
}

.gateCard {
	width: min(380px, 100%);
	border: 1px solid var(--chrome-border);
	background: var(--chrome-bg);
	padding: 16px;
	box-sizing: border-box;
}

.gateTitle {
	color: var(--accent);
	font-size: 16px;
	font-weight: 700;
	margin-bottom: 8px;
}

.gateSub {
	color: var(--muted);
	font-size: 13px;
	line-height: 1.35;
	margin-bottom: 14px;
}

#nameForm {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

#nameInput {
	border: 1px solid var(--chrome-border);
	background: rgba(0, 0, 0, 0.18);
	color: var(--fg);
	font: inherit;
	font-size: 16px;
	padding: 10px 12px;
	outline: 0;
}

#nameForm button {
	border: 1px solid var(--chrome-border);
	background: transparent;
	color: var(--accent);
	font: inherit;
	font-weight: 700;
	padding: 10px 12px;
	cursor: pointer;
}
