:root {
	--bg: #ffffff;
	--panel: #f7f8fa;
	--panel-2: #eceff3;
	--text: #1a1d21;

	--muted: #6b7280;
	--border: #e6e8ec;
	--accent: #7a1f5c;
	--accent-soft: #7a1f5c22;

	--user-bubble: #7a1f5c;
	--user-text: #fff;
	--ai-bubble: #f4f6f9;

	--danger: #d11a2a;
	--shadow: 0 10px 34px rgba(0, 0, 0, .12);
}

[data-theme="dark"] {
	--bg: #0d1117;
	--panel: #161b22;
	--panel-2: #232c39;
	--text: #e6edf3;
	--muted: #9aa4b2;
	--border: #2a313c;
	--accent: #b14689;
	--accent-soft: #b1468933;
	--ai-bubble: #1b2230;
	--shadow: 0 10px 34px rgba(0, 0, 0, .55);
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
	margin: 0;
}

body {
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	background: var(--bg);
	color: var(--text);
	-webkit-font-smoothing: antialiased;
}

.hidden {
	display: none !important;
}

a {
	color: #3b82f6;
}

svg {
	display: block;
}

/* layout */
.app {
	display: flex;
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
}

.sidebar {
	position: relative;
	width: var(--sidebar-w, 272px);
	flex-shrink: 0;
	background: var(--panel);
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	padding: 14px 12px;
	padding-top: calc(14px + env(safe-area-inset-top, 0px));
	transition: width .18s ease, padding .18s ease;
}

.app.collapsed .sidebar {
	width: 0;
	padding: 0;
	border: none;
	overflow: hidden;
}

.brand img {
	width: 150px;
	max-width: 100%;
}

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

.resize-handle {
	position: absolute;
	top: 0;
	right: -3px;
	width: 6px;
	height: 100%;
	cursor: col-resize;
	z-index: 5;
}

.resize-handle:hover {
	background: var(--accent-soft);
}

/* sidebar actions */
.side-actions {
	display: flex;
	gap: 8px;
	margin-top: 14px;
}

.new-chat {
	flex: 1;
	padding: 11px;
	border: none;
	border-radius: 12px;
	background: var(--accent);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: filter .15s;
}

.new-chat:hover {
	filter: brightness(1.13);
}

.new-folder {
	padding: 0 12px;
}

.chats-label {
	margin: 16px 4px 8px;
	font-size: 12px;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: .04em;
}

.chat-list {
	flex: 1;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

/* rows */
.row,
.folder-head {
	display: flex;
	align-items: center;
	border-radius: 9px;
}

.row:hover,
.folder-head:hover {
	background: var(--panel-2);
}

.row.active {
	background: var(--accent-soft);
}

.row.drop-target,
.folder-head.drop-target {
	outline: 2px dashed var(--accent);
	outline-offset: -2px;
	background: var(--accent-soft);
}

.row .name,
.folder-head .name {
	flex: 1;
	min-width: 0;
	text-align: left;
	background: none;
	border: none;
	color: var(--text);
	font-family: inherit;
	font-size: 14px;
	padding: 9px 8px;
	cursor: pointer;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.row.active .name {
	font-weight: 600;
}

.rowbtn {
	opacity: 0;
	background: none;
	border: none;
	color: var(--muted);
	cursor: pointer;
	padding: 5px;
	border-radius: 7px;
	display: flex;
	flex-shrink: 0;
	transition: opacity .12s, background .12s;
}

.row:hover .rowbtn,
.folder-head:hover .rowbtn,
.row.menu-open .rowbtn,
.rowbtn.pinned {
	opacity: 1;
}

.rowbtn:hover {
	background: var(--border);
	color: var(--text);
}

.rowbtn.pinned {
	color: var(--accent);
}

.chat-row[draggable="true"] {
	cursor: grab;
}

/* folders */
.folder-head .name {
	font-weight: 600;
}

.folder-head .chev {
	background: none;
	border: none;
	color: var(--muted);
	cursor: pointer;
	padding: 9px 3px 9px 8px;
	display: flex;
	flex-shrink: 0;
}

.folder-head .ficon {
	color: var(--accent);
	display: flex;
	align-items: center;
	padding-right: 5px;
	flex-shrink: 0;
}

.folder-chats {
	margin: 2px 0 4px 17px;
	border-left: 1.5px solid var(--border);
	padding-left: 5px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

/* menu */
.menu {
	position: fixed;
	z-index: 180;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 12px;
	box-shadow: var(--shadow);
	padding: 6px;
	min-width: 168px;
	max-width: 240px;
	max-height: 70vh;
	overflow-y: auto;
}

.menu button {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.menu button {
	width: 100%;
	text-align: left;
	background: none;
	border: none;
	color: var(--text);
	padding: 9px 12px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
	display: flex;
	align-items: center;
	gap: 9px;
}

.menu button:hover {
	background: var(--panel-2);
}

.menu button.danger {
	color: var(--danger);
}

/* rename */
.rename-input {
	flex: 1;
	min-width: 0;
	padding: 7px 8px;
	border: 1px solid var(--accent);
	border-radius: 8px;
	background: var(--bg);
	color: var(--text);
	font-size: 14px;
}

/* top bar */
.topbar {
	display: flex;
	align-items: center;
	padding: 10px 14px;
	padding-top: calc(10px + env(safe-area-inset-top, 0px));
	gap: 8px;
}

.topbar-logo {
	display: none;
	height: 27px;
	margin-left: 2px;
}

.app.collapsed .topbar-logo {
	display: block;
}

.spacer {
	flex: 1;
}

.icon-btn {
	background: none;
	border: 1px solid var(--border);
	color: var(--text);
	border-radius: 10px;
	padding: 8px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.icon-btn:hover {
	background: var(--panel-2);
}

.theme-btn {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 50%;
	width: 40px;
	height: 40px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--accent);
	transition: transform .25s ease, background .2s;
}

.theme-btn:hover {
	background: var(--accent-soft);
	transform: rotate(18deg) scale(1.06);
}

.theme-btn svg {
	transition: transform .45s ease;
}

/* messages */
.scroll {
	flex: 1;
	overflow-y: auto;
	padding: 0 16px;
}

.header {
	max-width: 820px;
	margin: 6px auto 4px;
	display: flex;
	align-items: center;
	gap: 14px;
}

.header-logo {
	width: 46px;
}

.header h1 {
	margin: 0;
	font-size: 28px;
}

.header p {
	margin: 4px 0 0;
	color: var(--muted);
	font-size: 14px;
}

.messages {
	max-width: 820px;
	margin: 0 auto;
	padding-bottom: 16px;
}

.msg {
	display: flex;
	gap: 10px;
	margin: 16px 0;
	align-items: flex-start;
}

.msg.user {
	flex-direction: row-reverse;
}

.msg .avatar {
	width: 30px;
	height: 30px;
	border-radius: 8px;
	flex-shrink: 0;
}

.msg.user .avatar {
	display: none;
}

.col {
	max-width: 80%;
	display: flex;
	flex-direction: column;
}

.msg.user .col {
	align-items: flex-end;
}

.bubble {
	padding: 11px 15px;
	border-radius: 16px;
	line-height: 1.55;
	word-wrap: break-word;
}

.msg.assistant .bubble {
	background: var(--ai-bubble);
	border: 1px solid var(--border);
	border-top-left-radius: 4px;
}

.msg.user .bubble {
	background: var(--user-bubble);
	color: var(--user-text);
	border-top-right-radius: 4px;
}

.bubble p {
	margin: 0 0 8px;
}

.bubble p:last-child {
	margin-bottom: 0;
}

.bubble ul,
.bubble ol {
	margin: 6px 0;
	padding-left: 20px;
}

.bubble code {
	background: rgba(127, 127, 127, .18);
	padding: 1px 5px;
	border-radius: 5px;
	font-size: .92em;
}

.sources {
	margin-top: 9px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.chip {
	font-size: 12px;
	padding: 3px 10px;
	border-radius: 999px;
	background: var(--panel-2);
	border: 1px solid var(--border);
	color: var(--text);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.chip:hover {
	border-color: var(--accent);
}

.actions {
	display: flex;
	gap: 2px;
	margin-top: 5px;
}

.action {
	background: none;
	border: none;
	color: var(--muted);
	cursor: pointer;
	padding: 5px 7px;
	border-radius: 7px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 13px;
}

.action:hover {
	background: var(--panel-2);
	color: var(--text);
}

.thinking-text {
	font-size: 15px;
	font-weight: 500;
	padding: 6px 2px;
	color: var(--muted);
	background: linear-gradient(90deg, var(--muted) 20%, var(--text) 50%, var(--muted) 80%);
	background-size: 200% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	animation: thinkShimmer 1.5s linear infinite;
}

@keyframes thinkShimmer {
	0% {
		background-position: 200% 0;
	}

	100% {
		background-position: -200% 0;
	}
}

.thinking-avatar {
	animation: thinkPulse 1.4s ease-in-out infinite;
}

@keyframes thinkPulse {

	0%,
	100% {
		opacity: .5;
		transform: scale(.95);
	}

	50% {
		opacity: 1;
		transform: scale(1.05);
	}
}

/* composer */
.composer-wrap {
	padding: 8px 16px;
	padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
	background: var(--bg);
}

.composer {
	max-width: 820px;
	margin: 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 18px;
	padding: 8px 8px 8px 14px;
}

.composer textarea {
	flex: 1;
	border: none;
	background: none;
	color: var(--text);
	resize: none;
	outline: none;
	font-size: 16px;
	max-height: 170px;
	line-height: 1.45;
	font-family: inherit;
	padding: 6px 0;
}

.send-btn {
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	border: none;
	border-radius: 50%;
	background: var(--accent);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: filter .15s;
}

.send-btn:hover {
	filter: brightness(1.13);
}

.send-btn:disabled {
	opacity: .4;
	cursor: default;
}

.send-btn svg {
	transition: transform .18s ease;
}

.send-btn:hover svg {
	transform: translateY(-3px);
}

.send-btn:active svg {
	transform: scale(.85);
}

.send-btn.sending svg {
	animation: sendFly .5s ease;
}

@keyframes sendFly {
	0% {
		transform: translateY(0);
		opacity: 1;
	}

	55% {
		transform: translateY(-18px);
		opacity: 0;
	}

	56% {
		transform: translateY(13px);
		opacity: 0;
	}

	100% {
		transform: translateY(0);
		opacity: 1;
	}
}

.attach-btn {
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	border: none;
	border-radius: 50%;
	background: none;
	color: var(--muted);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background .15s, color .15s;
}

.attach-btn:hover {
	background: var(--panel-2);
	color: var(--text);
}

.attach-chip {
	width: fit-content;
	max-width: 92%;
	margin: 0 auto 6px;
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 6px 11px;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 10px;
	font-size: 13px;
	color: var(--text);
}

.attach-chip span {
	max-width: 340px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.attach-chip .chip-x {
	background: none;
	border: none;
	color: var(--muted);
	cursor: pointer;
	display: inline-flex;
	padding: 2px;
	border-radius: 6px;
}

.attach-chip .chip-x:hover {
	background: var(--border);
	color: var(--danger);
}

.msg-file {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 6px;
	padding: 5px 10px;
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 9px;
	font-size: 12px;
	color: var(--muted);
	width: fit-content;
}

.bubble img {
	max-width: 100%;
	height: auto;
	border-radius: 10px;
	margin-top: 8px;
	display: block;
}

.map-card {
	margin-top: 10px;
	border: 1px solid var(--border);
	border-radius: 14px;
	overflow: hidden;
	max-width: 440px;
	background: var(--panel);
	box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}

.map-frame {
	width: 100%;
	height: 210px;
	border: 0;
	display: block;
}

.map-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 9px 12px;
}

.map-place {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--text);
	min-width: 0;
}

.map-place>span {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.map-open {
	margin-left: auto;
	flex-shrink: 0;
	font-size: 13px;
	color: var(--accent);
	text-decoration: none;
	font-weight: 600;
}

.map-link {
	font-weight: 500;
	white-space: nowrap;
}

.disclaimer {
	max-width: 820px;
	margin: 6px auto 0;
	text-align: center;
	font-size: 11px;
	color: var(--muted);
}

/* overlays */
.modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 200;
	padding: 16px;
}

.modal-box {
	background: var(--bg);
	color: var(--text);
	padding: 28px;
	border-radius: 18px;
	max-width: 380px;
	width: 100%;
	text-align: center;
	box-shadow: var(--shadow);
}

.modal-box h3 {
	margin: 10px 0;
}

.modal-box button {
	padding: 10px 18px;
	border: none;
	border-radius: 10px;
	background: var(--accent);
	color: #fff;
	font-size: 15px;
	cursor: pointer;
}

.modal-box {
	text-align: left;
	max-width: 460px;
}

.modal-box ul {
	padding-left: 20px;
}

.muted {
	color: var(--muted);
	font-size: 13px;
}

.link-btn {
	background: none;
	border: none;
	color: #3b82f6;
	cursor: pointer;
	font-size: 11px;
	padding: 0;
	text-decoration: underline;
	font-family: inherit;
}

.mail-row {
	display: flex;
	align-items: center;
	gap: 8px;
	justify-content: space-between;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 10px 12px;
	margin: 10px 0;
}

.mail-row span {
	font-weight: 600;
	word-break: break-all;
}

.mail-copy {
	padding: 6px 12px;
	border: none;
	border-radius: 8px;
	background: var(--accent);
	color: #fff;
	font-size: 13px;
	cursor: pointer;
	flex-shrink: 0;
}

.mail-actions {
	display: flex;
	gap: 8px;
	margin: 10px 0 16px;
}

.mail-btn {
	flex: 1;
	text-align: center;
	padding: 9px 6px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--panel);
	color: var(--text);
	text-decoration: none;
	font-size: 14px;
	cursor: pointer;
}

.mail-btn:hover {
	border-color: var(--accent);
}

.backdrop {
	display: none;
}

/* mobile */
@media (max-width: 760px) {
	.sidebar {
		position: fixed;
		left: 0;
		top: 0;
		bottom: 0;
		z-index: 150;
		box-shadow: var(--shadow);
	}

	.app:not(.collapsed) .sidebar {
		width: 80vw;
		max-width: 300px;
	}

	.app.collapsed .sidebar {
		width: 0;
	}

	.app:not(.collapsed) .backdrop {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, .45);
		z-index: 140;
	}

	.resize-handle {
		display: none;
	}

	.row .rowbtn {
		opacity: 1;
	}

	.header h1 {
		font-size: 23px;
	}

	.col {
		max-width: 88%;
	}
}
/* editing a message */
.col:has(.editor) {
	max-width: 100%;
	width: 100%;
}

.editor {
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 100%;
}

.edit-area {
	width: 100%;
	min-height: 78px;
	max-height: 320px;
	padding: 11px 15px;
	border: 1px solid var(--accent);
	border-radius: 16px;
	background: var(--bg);
	color: var(--text);
	font-family: inherit;
	font-size: 15px;
	line-height: 1.55;
	resize: vertical;
	outline: none;
}

.edit-area:focus {
	box-shadow: 0 0 0 3px var(--accent-soft);
}

.editor.user .edit-area {
	border-top-right-radius: 4px;
}

.editor:not(.user) .edit-area {
	border-top-left-radius: 4px;
}

.edit-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.editor.user .edit-actions {
	justify-content: flex-end;
}

.edit-save,
.edit-cancel {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 13px;
	border: 1px solid transparent;
	border-radius: 10px;
	font-family: inherit;
	font-size: 13.5px;
	cursor: pointer;
}

.edit-save {
	background: var(--accent);
	color: #fff;
}

.edit-save:hover {
	filter: brightness(1.1);
}

.edit-cancel {
	background: none;
	border-color: var(--border);
	color: var(--muted);
}

.edit-cancel:hover {
	background: var(--panel-2);
	color: var(--text);
}

.edit-hint {
	font-size: 12px;
	color: var(--muted);
}

@media (max-width: 760px) {
	.edit-hint {
		display: none;
	}
}

/* branch navigation */
.branches {
	display: inline-flex;
	align-items: center;
	gap: 1px;
	margin-right: 4px;
}

.branch-btn {
	background: none;
	border: none;
	color: var(--muted);
	cursor: pointer;
	padding: 5px 3px;
	border-radius: 6px;
	display: inline-flex;
}

.branch-btn:hover:not(:disabled) {
	background: var(--panel-2);
	color: var(--text);
}

.branch-btn:disabled {
	opacity: .3;
	cursor: default;
}

.branch-count {
	font-size: 12px;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
	min-width: 26px;
	text-align: center;
}

/* sidebar search */
.search-row {
	margin-top: 10px;
}

#chat-search {
	width: 100%;
	padding: 8px 11px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--bg);
	color: var(--text);
	font-family: inherit;
	font-size: 13.5px;
	outline: none;
}

#chat-search:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

.no-results {
	padding: 14px 4px;
	font-size: 13px;
	color: var(--muted);
}

/* starter prompts */
.starters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 4px 0 8px 40px;
}

.starter {
	padding: 9px 14px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--panel);
	color: var(--text);
	font-family: inherit;
	font-size: 13.5px;
	cursor: pointer;
	text-align: left;
}

.starter:hover {
	border-color: var(--accent);
	background: var(--panel-2);
}

/* jump to latest */
.scroll-down {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	bottom: 132px;
	z-index: 40;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--border);
	border-radius: 50%;
	background: var(--bg);
	color: var(--text);
	box-shadow: var(--shadow);
	cursor: pointer;
}

.scroll-down:hover {
	border-color: var(--accent);
}

/* stop button */
.send-btn.stopping {
	background: var(--danger);
}

/* shortcuts */
.keys {
	width: 100%;
	border-collapse: collapse;
	margin: 4px 0 14px;
	font-size: 14px;
}

.keys td {
	padding: 6px 0;
	vertical-align: middle;
}

.keys td:first-child {
	width: 46%;
	white-space: nowrap;
}

.keys td:last-child {
	color: var(--muted);
}

kbd {
	display: inline-block;
	padding: 2px 7px;
	border: 1px solid var(--border);
	border-bottom-width: 2px;
	border-radius: 6px;
	background: var(--panel-2);
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
}

/* toast */
.toast {
	position: fixed;
	left: 50%;
	bottom: 26px;
	transform: translate(-50%, 12px);
	z-index: 300;
	padding: 10px 16px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--bg);
	color: var(--text);
	box-shadow: var(--shadow);
	font-size: 13.5px;
	opacity: 0;
	pointer-events: none;
	transition: opacity .18s ease, transform .18s ease;
}

.toast.show {
	opacity: 1;
	transform: translate(-50%, 0);
}

@media (max-width: 760px) {
	.starters {
		margin-left: 0;
	}

	.scroll-down {
		bottom: 148px;
	}
}

/* the jump-to-latest button anchors here, not to the viewport */
.main {
	position: relative;
}

/* import / export */
.modal-box.wide {
	max-width: 620px;
	width: 100%;
}

.manage-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 10px 0;
	flex-wrap: wrap;
}

.pick-all {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 14px;
	cursor: pointer;
	white-space: nowrap;
}

#manage-search {
	flex: 1;
	min-width: 130px;
	padding: 7px 10px;
	border: 1px solid var(--border);
	border-radius: 9px;
	background: var(--bg);
	color: var(--text);
	font-family: inherit;
	font-size: 13.5px;
	outline: none;
}

#manage-search:focus {
	border-color: var(--accent);
}

.pick-list {
	max-height: 46vh;
	overflow-y: auto;
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 4px;
}

.pick-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 9px;
	cursor: pointer;
}

.pick-row:hover {
	background: var(--panel-2);
}

.pick-name {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 14px;
}

.pick-meta {
	font-size: 12px;
	color: var(--muted);
	white-space: nowrap;
}

.manage-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-top: 14px;
}

.small {
	font-size: 12.5px;
	line-height: 1.5;
}

/* motion */
:root {
	--ease: cubic-bezier(.22, .61, .36, 1);
	--fast: .14s;
	--med: .24s;
}

@keyframes rise {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes pop {
	from {
		opacity: 0;
		transform: scale(.96) translateY(8px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes glow {
	0% {
		background: var(--accent-soft);
	}

	100% {
		background: transparent;
	}
}

/* only the newest message animates // re-rendering the whole thread on every send would otherwise make the entire history flutter each time */
.messages .msg:last-child {
	animation: rise var(--med) var(--ease) both;
}

.msg .bubble,
.map-card,
.sources .chip {
	transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.sources .chip:hover {
	transform: translateY(-1px);
}

/* the version you switched to, briefly lit so you can see what moved */
.msg.just-switched .bubble {
	animation: glow .7s var(--ease) both;
}

.starters .starter {
	animation: rise var(--med) var(--ease) both;
	transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.starters .starter:nth-child(1) { animation-delay: .04s; }
.starters .starter:nth-child(2) { animation-delay: .10s; }
.starters .starter:nth-child(3) { animation-delay: .16s; }
.starters .starter:nth-child(4) { animation-delay: .22s; }

.starter:hover {
	transform: translateY(-2px);
}

.starter:active {
	transform: translateY(0);
}

.editor {
	animation: pop var(--med) var(--ease) both;
}

.modal:not(.hidden) {
	animation: fade var(--fast) var(--ease) both;
}

.modal:not(.hidden) .modal-box {
	animation: pop var(--med) var(--ease) both;
}

.menu {
	animation: pop var(--fast) var(--ease) both;
	transform-origin: top right;
}

.row,
.folder-head,
.rowbtn,
.icon-btn,
.theme-btn,
.action,
.branch-btn,
.chev,
.link-btn,
.mail-btn,
.new-chat,
.pick-row,
.scroll-down,
.edit-save,
.edit-cancel,
.edit-back {
	transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
		border-color var(--fast) var(--ease), opacity var(--fast) var(--ease),
		transform var(--fast) var(--ease);
}

.icon-btn:hover,
.theme-btn:hover,
.scroll-down:hover {
	transform: translateY(-1px);
}

.new-chat:active,
.icon-btn:active,
.theme-btn:active,
.action:active,
.mail-btn:active,
.edit-save:active,
.edit-back:active,
.scroll-down:active {
	transform: scale(.95);
}

.action:hover {
	transform: translateY(-1px);
}

.send-btn {
	transition: background var(--med) var(--ease), transform var(--fast) var(--ease);
}

.send-btn:hover {
	transform: scale(1.06);
}

.send-btn:active {
	transform: scale(.92);
}

.scroll-down {
	animation: pop var(--fast) var(--ease) both;
}

.chev svg {
	transition: transform var(--med) var(--ease);
}

.folder-chats {
	animation: fade var(--med) var(--ease) both;
}

.attach-chip:not(.hidden) {
	animation: rise var(--fast) var(--ease) both;
}

.thinking-avatar {
	animation: breathe 1.6s ease-in-out infinite;
}

@keyframes breathe {
	0%, 100% {
		opacity: .55;
		transform: scale(.96);
	}

	50% {
		opacity: 1;
		transform: scale(1);
	}
}

/* anyone who asked their system to calm down gets no movement */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: .001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .001ms !important;
		scroll-behavior: auto !important;
	}
}

/* search hits */
.chat-hit {
	display: flex;
	flex-direction: column;
	animation: fade var(--fast) var(--ease) both;
}

.chat-snippet {
	margin: -2px 8px 6px 10px;
	padding: 6px 9px;
	border-left: 2px solid var(--border);
	font-size: 12px;
	line-height: 1.5;
	color: var(--muted);
	cursor: pointer;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.chat-snippet:hover {
	border-left-color: var(--accent);
	color: var(--text);
}

.chat-snippet b {
	color: var(--accent);
	font-weight: 600;
}

.chat-snippet mark {
	background: var(--accent-soft);
	color: inherit;
	border-radius: 3px;
	padding: 0 2px;
}

/* send back */
.edit-back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 13px;
	border: 1px solid var(--accent);
	border-radius: 10px;
	background: none;
	color: var(--accent);
	font-family: inherit;
	font-size: 13.5px;
	cursor: pointer;
}

.edit-back:hover {
	background: var(--accent-soft);
}

/* screens */
@media (max-width: 900px) {
	.col {
		max-width: 88%;
	}
}

@media (max-width: 760px) {
	.sidebar {
		position: fixed;
		top: 0;
		bottom: 0;
		left: 0;
		z-index: 120;
		box-shadow: var(--shadow);
	}

	.app.collapsed .sidebar {
		box-shadow: none;
	}

	.resize-handle {
		display: none;
	}

	.col {
		max-width: 92%;
	}

	.header h1 {
		font-size: 23px;
	}

	.header-logo {
		width: 38px;
	}

	.scroll {
		padding: 0 11px;
	}

	.modal {
		padding: 10px;
		align-items: flex-end;
	}

	.modal-box {
		max-width: 100%;
		padding: 20px;
		border-radius: 18px 18px 12px 12px;
		max-height: 88vh;
		overflow-y: auto;
	}

	.starters {
		flex-direction: column;
	}

	.starter {
		width: 100%;
	}

	.manage-actions .mail-btn {
		flex: 1;
		text-align: center;
	}

	.disclaimer {
		font-size: 10.5px;
		line-height: 1.6;
	}

	.pick-list {
		max-height: 38vh;
	}
}

/* short windows: the floating button must not sit on top of the last answer */
@media (max-height: 560px) {
	.scroll-down {
		display: none;
	}
}

@media (min-width: 1500px) {
	.messages,
	.header,
	.composer,
	.disclaimer {
		max-width: 900px;
	}
}

/* your other messages are over there */
.branch-notice {
	display: flex;
	align-items: center;
	gap: 7px;
	margin: 4px auto 10px 40px;
	padding: 9px 14px;
	border: 1px dashed var(--border);
	border-radius: 999px;
	background: none;
	color: var(--muted);
	font-family: inherit;
	font-size: 13px;
	cursor: pointer;
	animation: rise var(--med) var(--ease) both;
	transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.branch-notice:hover {
	border-color: var(--accent);
	border-style: solid;
	color: var(--accent);
	background: var(--accent-soft);
}

@media (max-width: 760px) {
	.branch-notice {
		margin-left: 0;
	}
}
