:root {
	color-scheme: dark;
	font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
	background-color: #05070c;
	color: #f5f7fb;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	background: radial-gradient(circle at 20% 20%, #1f3150, transparent 40%),
		radial-gradient(circle at 80% 0%, #3f1f60, transparent 35%),
		#05070c;
}

.app-shell {
	width: min(960px, 100%);
	height: 85vh;
	background: rgba(5, 7, 12, 0.85);
	border-radius: 24px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	backdrop-filter: blur(10px);
	box-shadow: 0 40px 80px rgba(2, 6, 23, 0.6);
	display: flex;
	flex-direction: column;
	padding: 2rem;
	gap: 1.5rem;
}

header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
}

header .eyebrow {
	text-transform: uppercase;
	letter-spacing: 0.2em;
	font-size: 0.75rem;
	color: rgba(245, 247, 251, 0.6);
	margin: 0 0 0.35rem;
}

header h1 {
	margin: 0;
	font-size: 1.8rem;
}

header p {
	margin: 0.35rem 0 0;
	color: rgba(245, 247, 251, 0.7);
}

.status-panel {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	border-radius: 20px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	padding: 0.4rem 0.6rem 0.4rem 0.8rem;
	background: rgba(255, 255, 255, 0.04);
	width: fit-content;
}

.status-text {
	margin-right: 0.5rem;
}

.status-controls {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.mobile-only {
	display: none !important;
}

.status-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #ffc107;
	box-shadow: 0 0 12px rgba(255, 193, 7, 0.7);
	flex-shrink: 0;
}

.status-label {
	margin: 0;
	font-size: 0.7rem;
	color: rgba(255, 255, 255, 0.5);
	white-space: nowrap;
}

.status-value {
	margin: 0;
	font-weight: 600;
	font-size: 0.9rem;
	white-space: nowrap;
}

#health-check {
	border: none;
	border-radius: 999px;
	padding: 0.4rem 0.8rem;
	font-size: 0.85rem;
	font-weight: 600;
	background: linear-gradient(135deg, #00d2ff, #3a7bd5);
	color: #010205;
	cursor: pointer;
	box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	white-space: nowrap;
}

#health-check:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0, 210, 255, 0.5);
	opacity: 1;
}

#health-check:active {
	transform: translateY(0);
}

/* Landing Page */
#landing-page {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: radial-gradient(circle at 50% 50%, #2d1b4e, #05070c);
	z-index: 100;
	transition: opacity 0.5s ease, visibility 0.5s;
}

#landing-page.hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.landing-content {
	text-align: center;
	animation: fadeIn 0.8s ease-out;
}

.landing-content h1 {
	font-size: 4rem;
	margin: 0 0 1rem;
	background: linear-gradient(135deg, #fff, #a5b4fc);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

.landing-content p {
	font-size: 1.2rem;
	color: rgba(245, 247, 251, 0.7);
	margin-bottom: 2rem;
}

.stats-container {
	display: flex;
	gap: 2rem;
	margin-bottom: 2.5rem;
	justify-content: center;
	flex-wrap: wrap;
}

.stat-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	background: rgba(255, 255, 255, 0.05);
	padding: 1rem 1.5rem;
	border-radius: 12px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	min-width: 120px;
}

.stat-value {
	font-size: 1.5rem;
	font-weight: 700;
	color: #4ade80;
	margin-bottom: 0.25rem;
}

.stat-label {
	font-size: 0.8rem;
	color: rgba(245, 247, 251, 0.6);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

#start-chat-btn {
	border: none;
	border-radius: 999px;
	padding: 1rem 2.5rem;
	font-size: 1.1rem;
	font-weight: 600;
	background: linear-gradient(135deg, #f77062, #fe5196);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(254, 81, 150, 0.3);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#start-chat-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 15px 40px rgba(254, 81, 150, 0.4);
}

.credit {
	margin-top: 2rem;
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.4);
	font-weight: 500;
}

/* Loading Indicator */
.loading-indicator {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	color: rgba(255, 255, 255, 0.6);
	font-size: 0.9rem;
	padding: 0.5rem 0;
}

.loading-dots {
	display: flex;
	gap: 4px;
}

.loading-dots span {
	width: 6px;
	height: 6px;
	background: currentColor;
	border-radius: 50%;
	animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

.disclaimer {
	text-align: center;
	font-size: 0.7rem;
	color: rgba(255, 255, 255, 0.3);
	margin: 0.75rem 0 0;
	max-width: 600px;
}

@keyframes bounce {
	0%, 80%, 100% { transform: scale(0); }
	40% { transform: scale(1); }
}

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

.app-shell {
	opacity: 0;
	transform: scale(0.95);
	transition: opacity 0.5s ease, transform 0.5s ease;
}

.app-shell.visible {
	opacity: 1;
	transform: scale(1);
}


#chat-window {
	flex: 1;
	overflow-y: auto;
	padding-right: 0.5rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.message {
	display: flex;
	gap: 1rem;
	align-items: flex-start;
}

.message.user .avatar {
	background: linear-gradient(135deg, #ffd452, #f85032);
}

.message.bot .avatar {
	background: linear-gradient(135deg, #00c6ff, #0072ff);
}

.avatar {
	width: 42px;
	height: 42px;
	border-radius: 12px;
	flex-shrink: 0;
	box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

.bubble {
	background: rgba(255, 255, 255, 0.05);
	border-radius: 18px;
	padding: 1rem 1.25rem;
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.meta {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: rgba(255, 255, 255, 0.5);
}

.text {
	margin: 0.2rem 0 0;
	line-height: 1.6;
	color: rgba(255, 255, 255, 0.9);
	white-space: pre-wrap;
}

#chat-form {
	margin-top: auto;
}

.input-container {
	display: flex;
	align-items: flex-end;
	gap: 0.5rem;
	background: rgba(255, 255, 255, 0.03);
	border-radius: 24px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	padding: 0.5rem;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.input-container:focus-within {
	border-color: rgba(0, 214, 255, 0.6);
	box-shadow: 0 0 0 2px rgba(0, 214, 255, 0.2);
}

textarea {
	flex: 1;
	background: transparent;
	border: none;
	padding: 0.8rem 1rem;
	color: inherit;
	font-size: 1rem;
	resize: none;
	min-height: 24px;
	max-height: 200px;
	font-family: inherit;
	line-height: 1.5;
}

textarea:focus {
	outline: none;
	box-shadow: none;
}

#send-btn {
	border: none;
	border-radius: 50%;
	width: 42px;
	height: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #f77062, #fe5196);
	color: #fff;
	cursor: pointer;
	transition: transform 0.15s ease, opacity 0.2s;
	flex-shrink: 0;
}

#send-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

#send-btn:not(:disabled):hover {
	transform: scale(1.05);
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

@media (max-width: 768px) {
	body {
		padding: 0;
		background: #05070c;
	}

	.app-shell {
		width: 100%;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
		border: none;
		padding: 1rem;
		gap: 1rem;
	}

	header {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		gap: 0.5rem;
	}

	header > div:first-child {
		flex: 1;
		min-width: 0;
	}

	header h1 {
		font-size: 1.2rem;
		margin-bottom: 0.1rem;
	}

	header .eyebrow {
		font-size: 0.65rem;
		margin-bottom: 0.2rem;
	}

	header p {
		font-size: 0.8rem;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.header-actions {
		width: auto;
		display: flex;
		justify-content: flex-end;
		flex-shrink: 0;
	}

	.status-panel {
		width: auto;
		justify-content: flex-end;
		position: relative;
		padding: 0.3rem 0.5rem;
	}

	.status-text {
		margin-right: 0.5rem;
	}

	.status-label {
		display: none;
	}

	.status-value {
		font-size: 0.8rem;
	}

	.mobile-only {
		display: flex !important;
	}

	.status-controls {
		display: none;
		position: absolute;
		top: 100%;
		right: 0;
		margin-top: 0.5rem;
		background: #1f2937;
		border: 1px solid rgba(255, 255, 255, 0.1);
		border-radius: 12px;
		padding: 0.5rem;
		flex-direction: column;
		align-items: stretch;
		box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
		z-index: 10;
		min-width: 160px;
	}

	.status-controls.expanded {
		display: flex;
		animation: slideDown 0.2s ease-out;
	}

	@keyframes slideDown {
		from { opacity: 0; transform: translateY(-10px); }
		to { opacity: 1; transform: translateY(0); }
	}
	
	header h1 {
		font-size: 1.5rem;
	}
}

/* Header Actions */
.header-actions {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.icon-btn {
	background: transparent;
	border: none;
	color: rgba(255, 255, 255, 0.6);
	cursor: pointer;
	padding: 0.5rem;
	border-radius: 50%;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.icon-btn:hover {
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
}

/* Settings Modal */
dialog {
	background: transparent;
	border: none;
	padding: 0;
	margin: auto;
	color: #f5f7fb;
}

dialog::backdrop {
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(4px);
}

.modal-content {
	background: #0f131c;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 24px;
	padding: 2rem;
	width: min(400px, 90vw);
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1.5rem;
}

.modal-header h2 {
	margin: 0;
	font-size: 1.25rem;
}

.setting-group {
	margin-bottom: 1.5rem;
}

.setting-group label {
	display: flex;
	justify-content: space-between;
	margin-bottom: 0.5rem;
	font-weight: 500;
}

.value-display {
	color: rgba(255, 255, 255, 0.5);
	font-family: monospace;
}

.help-text {
	font-size: 0.8rem;
	color: rgba(255, 255, 255, 0.4);
	margin: 0.5rem 0 0;
}

/* Range Input Styling */
input[type=range] {
	width: 100%;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
}

input[type=range]::-webkit-slider-runnable-track {
	width: 100%;
	height: 6px;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 3px;
}

input[type=range]::-webkit-slider-thumb {
	height: 18px;
	width: 18px;
	border-radius: 50%;
	background: #fff;
	-webkit-appearance: none;
	margin-top: -6px;
	box-shadow: 0 2px 6px rgba(0,0,0,0.3);
	cursor: pointer;
}

input[type=range]:focus::-webkit-slider-thumb {
	box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
}

.landing-footer {
	margin-top: 1rem;
	margin-bottom: 1rem;
}

.link-btn {
	background: none;
	border: none;
	color: rgba(245, 247, 251, 0.6);
	text-decoration: underline;
	cursor: pointer;
	font-size: 0.9rem;
	padding: 0.5rem;
}

.link-btn:hover {
	color: #fff;
}

.legal-text {
	line-height: 1.6;
	color: rgba(245, 247, 251, 0.9);
}

.legal-text h3 {
	margin-top: 1.5rem;
	margin-bottom: 0.5rem;
	color: #fff;
}

.legal-text a {
	color: #4ade80;
	text-decoration: none;
}

.legal-text a:hover {
	text-decoration: underline;
}

.legal-text ul {
	padding-left: 1.5rem;
}

.legal-text li {
	margin-bottom: 0.5rem;
}

.char-count {
	font-size: 0.7rem;
	color: rgba(245, 247, 251, 0.4);
	text-align: right;
	margin-top: 0.25rem;
	margin-right: 0.5rem;
}