:root {
	--bg: #f7f8fc;
	--surface: #ffffff;
	--chrome: #e9ecf5;
	--fg: #161a2e;
	--ink: #161a2e;
	--muted: #5a6180;
	--pink: #ff5fa2;
	--blue: #3f7bff;
	--accent: #3f7bff;
	--border: #d6dbea;
	--danger: #c0263e;
	--radius: 10px;
	--space: 1rem;
	--font: "Figtree", ui-sans-serif, system-ui, sans-serif;
	--display: "Bricolage Grotesque", "Figtree", sans-serif;
}

* {
	box-sizing: border-box;
}

html,
body,
#root {
	height: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

h1,
h2 {
	font-family: var(--display);
	letter-spacing: -0.02em;
	margin: 0;
}

.hint {
	margin: 0;
	color: var(--muted);
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 44px;
	padding: 0.55rem 1rem;
	border: 1px solid transparent;
	border-radius: var(--radius);
	background: var(--accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.btn:hover {
	filter: brightness(1.06);
}

.btn-secondary {
	background: var(--surface);
	color: var(--fg);
	border-color: var(--border);
}

.stack {
	display: grid;
	gap: var(--space);
}

.row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

/* Browser chrome */
.browser {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.chrome {
	flex: none;
	background: var(--chrome);
	border-bottom: 1px solid var(--border);
}

.tabstrip {
	display: flex;
	align-items: flex-end;
	gap: 4px;
	padding: 8px 8px 0;
	overflow-x: auto;
	scrollbar-width: none;
}

.tab {
	display: flex;
	align-items: center;
	flex: 0 1 220px;
	min-width: 110px;
	border-radius: 10px 10px 0 0;
	color: var(--muted);
}

.tab-active {
	background: var(--surface);
	color: var(--fg);
}

.tab:not(.tab-active):hover {
	background: rgba(255, 255, 255, 0.5);
}

.tab-label {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 0;
	padding: 9px 4px 9px 12px;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	text-align: left;
	cursor: pointer;
}

.tab-label span {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.tab-close,
.tab-new {
	display: grid;
	place-items: center;
	flex: none;
	width: 28px;
	height: 28px;
	margin-right: 6px;
	border: 0;
	border-radius: 6px;
	background: none;
	color: inherit;
	cursor: pointer;
}

.tab-new {
	align-self: center;
	margin-bottom: 4px;
	color: var(--muted);
}

.tab-close:hover,
.tab-new:hover {
	background: var(--chrome);
}

.toolbar {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px;
	background: var(--surface);
}

.nav-buttons {
	display: flex;
	gap: 2px;
}

.icon-btn {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--fg);
	cursor: pointer;
}

.icon-btn:hover:not(:disabled) {
	background: var(--chrome);
}

.icon-btn:disabled {
	color: var(--border);
	cursor: default;
}

.urlbar {
	display: flex;
	align-items: center;
	flex: 1;
	min-width: 0;
	height: 44px;
	padding-left: 14px;
	border: 1px solid transparent;
	border-radius: 12px;
	background: var(--chrome);
}

.urlbar:focus-within {
	background: var(--surface);
	border-color: var(--blue);
	box-shadow: 0 0 0 3px rgba(63, 123, 255, 0.18);
}

.urlbar-icon {
	display: grid;
	color: var(--muted);
}

.urlbar-input {
	flex: 1;
	min-width: 0;
	height: 100%;
	padding: 0 10px;
	border: 0;
	background: none;
	color: var(--fg);
	font: inherit;
	font-size: 0.95rem;
	outline: none;
}

.go-btn {
	flex: none;
	height: 36px;
	margin-right: 4px;
	padding: 0 18px;
	border: 0;
	border-radius: 9px;
	background: linear-gradient(90deg, var(--pink), var(--blue));
	color: #fff;
	font-family: var(--display);
	font-weight: 800;
	font-size: 1rem;
	cursor: pointer;
}

.go-btn:active {
	transform: scale(0.96);
}

.stage {
	position: relative;
	display: flex;
	flex: 1;
	min-height: 0;
}

/* Bobobot */
.bot-btn {
	display: grid;
	place-items: center;
	flex: none;
	width: 42px;
	height: 42px;
	border: 2px solid transparent;
	border-radius: 50%;
	background: var(--chrome);
	cursor: pointer;
	transition: transform 0.15s, border-color 0.15s;
}

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

.bot-btn-on {
	border-color: var(--pink);
	background: var(--surface);
	box-shadow: 0 0 0 3px rgba(255, 95, 162, 0.18);
}

.bot-panel {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	background: var(--surface);
}

@media (min-width: 48rem) {
	.bot-panel {
		position: relative;
		inset: auto;
		flex: 0 0 380px;
		max-width: 40%;
		border-left: 1px solid var(--border);
		box-shadow: -8px 0 24px rgba(22, 26, 46, 0.06);
	}
}

.bot-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 8px 10px 14px;
	border-bottom: 1px solid var(--border);
}

.bot-head-text {
	display: flex;
	flex-direction: column;
	flex: 1;
	line-height: 1.2;
}

.bot-head-text strong {
	font-family: var(--display);
	font-size: 1.05rem;
}

.bot-head-text span {
	color: var(--muted);
	font-size: 0.8rem;
}

.bot-log {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px;
}

.bot-hello {
	margin: auto 0;
	text-align: center;
	color: var(--muted);
}

.bot-hello-title {
	margin-bottom: 4px;
	color: var(--fg);
	font-family: var(--display);
	font-size: 1.3rem;
	font-weight: 800;
}

.bot-msg {
	max-width: 88%;
	padding: 10px 13px;
	border-radius: 14px;
	line-height: 1.5;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	font-size: 0.93rem;
}

.bot-msg-user {
	align-self: flex-end;
	background: linear-gradient(90deg, var(--pink), var(--blue));
	color: #fff;
	border-bottom-right-radius: 4px;
}

.bot-msg-bot {
	align-self: flex-start;
	background: var(--chrome);
	color: var(--fg);
	border-bottom-left-radius: 4px;
}

.bot-typing {
	display: flex;
	gap: 5px;
	padding: 14px;
}

.bot-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--muted);
	animation: bot-dot 1s infinite ease-in-out;
}

.bot-typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.bot-typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes bot-dot {
	0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

.bot-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 14px 8px;
}

.bot-chip {
	padding: 6px 12px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface);
	color: var(--fg);
	font: inherit;
	font-size: 0.85rem;
	cursor: pointer;
}

.bot-chip:hover:not(:disabled) {
	border-color: var(--pink);
}

.bot-chip:disabled {
	color: var(--muted);
	cursor: default;
	opacity: 0.6;
}

.bot-form {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	padding: 8px 10px 12px;
	border-top: 1px solid var(--border);
}

.bot-input {
	flex: 1;
	min-width: 0;
	min-height: 40px;
	max-height: 140px;
	padding: 9px 12px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--chrome);
	color: var(--fg);
	font: inherit;
	font-size: 0.95rem;
	resize: vertical;
}

.bot-input:focus {
	border-color: var(--blue);
	background: var(--surface);
}

.bot-form .go-btn {
	height: 40px;
}

.bot-form .go-btn:disabled {
	opacity: 0.5;
	cursor: default;
}

.viewport {
	position: relative;
	flex: 1;
	min-width: 0;
	min-height: 0;
	overflow: auto;
	background: var(--surface);
}

/* Home */
.home {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 28px;
	padding: 12vh 16px 48px;
}

.home-brand {
	display: flex;
	align-items: center;
	gap: 14px;
}

.wordmark {
	font-size: clamp(3.5rem, 12vw, 5.5rem);
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.05em;
}

.home-search {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	max-width: 620px;
	padding: 6px 6px 6px 18px;
	border: 1px solid var(--border);
	border-radius: 16px;
	background: var(--surface);
	color: var(--muted);
	box-shadow: 0 6px 24px rgba(22, 26, 46, 0.08);
}

.home-search:focus-within {
	border-color: var(--blue);
}

.home-input {
	flex: 1;
	min-width: 0;
	height: 44px;
	border: 0;
	background: none;
	color: var(--fg);
	font: inherit;
	font-size: 1.05rem;
	outline: none;
}

.quick {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
	width: 100%;
	max-width: 520px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.quick-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 14px 6px;
	border: 0;
	border-radius: 12px;
	background: none;
	color: var(--fg);
	font: inherit;
	font-size: 0.85rem;
	cursor: pointer;
}

.quick-link:hover {
	background: var(--bg);
}

.quick-dot {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	color: #fff;
	font-family: var(--display);
	font-weight: 800;
	font-size: 1.1rem;
}

/* Search results */
.serp {
	display: grid;
	gap: 32px;
	max-width: 1100px;
	padding: 20px 16px 48px;
}

.serp-main {
	min-width: 0;
	max-width: 660px;
}

.serp-meta {
	margin: 0 0 16px;
	color: var(--muted);
	font-size: 0.875rem;
}

.results {
	display: grid;
	gap: 26px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.result-link {
	display: grid;
	gap: 4px;
	text-decoration: none;
	color: inherit;
}

.result-site {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.85rem;
	color: var(--muted);
	min-width: 0;
}

.result-host {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.favicon {
	flex: none;
	width: 18px;
	height: 18px;
	border-radius: 4px;
}

.favicon-blank {
	display: grid;
	place-items: center;
	background: var(--chrome);
	font-size: 0.7rem;
	font-weight: 700;
}

.result-title {
	color: var(--blue);
	font-size: 1.2rem;
	font-weight: 500;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.result-link:hover .result-title {
	text-decoration: underline;
}

.result-link:visited .result-title {
	color: #8a3fd1;
}

.result-snippet {
	margin: 6px 0 0;
	color: #3b4160;
	font-size: 0.95rem;
	overflow-wrap: anywhere;
}

.infobox {
	align-self: start;
	display: grid;
	gap: 12px;
	padding: 20px;
	border: 1px solid var(--border);
	border-top: 4px solid var(--pink);
	border-radius: 14px;
}

.infobox-img {
	max-width: 100%;
	max-height: 220px;
	object-fit: contain;
	border-radius: 8px;
}

.infobox-title {
	font-size: 1.5rem;
}

.infobox-text {
	margin: 0;
	color: #3b4160;
	font-size: 0.95rem;
	display: -webkit-box;
	-webkit-line-clamp: 8;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.skel-result {
	gap: 8px;
	margin-bottom: 18px;
}

@media (min-width: 64rem) {
	.serp {
		grid-template-columns: minmax(0, 660px) 340px;
		padding: 24px 32px 64px 120px;
	}
}

/* Pages */
.page-frame {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	background: #fff;
}

.page-loading {
	padding-top: 15vh;
}

.page-problem {
	max-width: 560px;
	margin: 0 auto;
	padding: 12vh 16px 48px;
}

.page-problem h2 {
	font-size: 1.8rem;
	overflow-wrap: anywhere;
}

.page-image {
	display: grid;
	place-items: center;
	min-height: 100%;
	padding: 16px;
	background: var(--chrome);
}

.page-image img {
	max-width: 100%;
}

@media (max-width: 40rem) {
	.hide-narrow {
		display: none;
	}
	.nav-buttons .icon-btn {
		width: 34px;
	}
	.go-btn {
		padding: 0 14px;
	}
}

/* Seeded state primitives */
.empty {
	padding: calc(var(--space) * 2);
	text-align: center;
	color: var(--muted);
}

.empty-title {
	margin: 0 0 0.25rem;
	color: var(--fg);
	font-weight: 600;
}

.loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	padding: calc(var(--space) * 1.5);
	color: var(--muted);
}

.spinner {
	flex: none;
	width: 1.15rem;
	height: 1.15rem;
	border: 2px solid var(--border);
	border-top-color: var(--pink);
	border-radius: 50%;
	animation: fab-spin 0.7s linear infinite;
}

@keyframes fab-spin {
	to {
		transform: rotate(360deg);
	}
}

.skeleton {
	display: block;
	height: 1rem;
	border-radius: 5px;
	background: linear-gradient(90deg, var(--chrome), var(--surface), var(--chrome));
	background-size: 200% 100%;
	animation: fab-shimmer 1.2s linear infinite;
}

@keyframes fab-shimmer {
	to {
		background-position: -200% 0;
	}
}

.alert {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--border);
	border-left: 3px solid var(--muted);
	border-radius: var(--radius);
}

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

@media (prefers-reduced-motion: reduce) {
	.spinner,
	.skeleton {
		animation: none;
	}
}

:where(a, button, input, select, textarea):focus-visible {
	outline: 2px solid var(--blue);
	outline-offset: 2px;
}
