:root {
	--bg-0: #050b16;
	--bg-1: #0a1324;
	--bg-2: #101c35;
	--surface: rgba(10, 19, 36, 0.72);
	--surface-strong: rgba(12, 23, 42, 0.9);
	--surface-soft: rgba(255, 255, 255, 0.06);
	--border: rgba(255, 255, 255, 0.1);
	--border-strong: rgba(255, 255, 255, 0.16);
	--text: #eef4ff;
	--muted: #9caec8;
	--muted-strong: #c7d5ea;
	--primary: #6ee7ff;
	--primary-strong: #32c8ea;
	--accent: #8b5cf6;
	--accent-strong: #6d28d9;
	--danger: #ff6b7a;
	--ok: #35d39e;
	--warn: #ffcf63;
	--shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
	--shadow-soft: 0 14px 36px rgba(0, 0, 0, 0.24);
	--radius-xl: 30px;
	--radius-lg: 22px;
	--radius-md: 16px;
	--radius-sm: 12px;
}

* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	min-height: 100vh;
	margin: 0;
	padding: 28px;
	font-family: "Aptos", "Segoe UI Variable Text", "Segoe UI", sans-serif;
	color: var(--text);
	background:
		radial-gradient(circle at top left, rgba(110, 231, 255, 0.28), transparent 30%),
		radial-gradient(circle at 88% 14%, rgba(139, 92, 246, 0.34), transparent 24%),
		radial-gradient(circle at 20% 88%, rgba(53, 211, 158, 0.18), transparent 20%),
		linear-gradient(135deg, #040816 0%, #091426 40%, #112544 72%, #09111f 100%);
	background-attachment: fixed;
}

button,
input {
	font: inherit;
}

button {
	appearance: none;
	border: 0;
}

.background-orb {
	position: fixed;
	border-radius: 50%;
	filter: blur(12px);
	pointer-events: none;
	opacity: 0.7;
	z-index: 0;
	animation: float 14s ease-in-out infinite;
}

.orb-1 {
	top: -120px;
	right: -80px;
	width: 320px;
	height: 320px;
	background: radial-gradient(circle, rgba(110, 231, 255, 0.35), rgba(110, 231, 255, 0));
}

.orb-2 {
	left: -80px;
	bottom: -120px;
	width: 360px;
	height: 360px;
	background: radial-gradient(circle, rgba(139, 92, 246, 0.28), rgba(139, 92, 246, 0));
	animation-delay: -6s;
}

.app-shell {
	position: relative;
	z-index: 1;
	width: min(1220px, 100%);
	margin: 0 auto;
}

.hidden {
	display: none !important;
}

.panel-surface,
.login-panel,
.auth-branding {
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
	backdrop-filter: blur(18px);
	-webkit-backdrop-filter: blur(18px);
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
}

.auth-screen {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
	gap: 24px;
	align-items: stretch;
	min-height: calc(100vh - 56px);
}

.auth-branding {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 20px;
	padding: 42px;
	border-radius: var(--radius-xl);
	overflow: hidden;
	position: relative;
	background:
		radial-gradient(circle at 20% 20%, rgba(110, 231, 255, 0.16), transparent 34%),
		radial-gradient(circle at 88% 0%, rgba(139, 92, 246, 0.18), transparent 30%),
		linear-gradient(160deg, rgba(10, 21, 40, 0.92), rgba(8, 13, 26, 0.88));
}

.auth-branding::after {
	content: "";
	position: absolute;
	inset: auto -60px -80px auto;
	width: 260px;
	height: 260px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(110, 231, 255, 0.12), transparent 66%);
	pointer-events: none;
}

.login-panel,
.topbar,
.stat-card,
.control-card {
	border-radius: var(--radius-xl);
}

.login-panel {
	align-self: center;
	padding: 34px;
	background:
		radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 25%),
		linear-gradient(180deg, rgba(15, 28, 50, 0.92), rgba(8, 15, 30, 0.96));
	border: 1px solid var(--border-strong);
	box-shadow: var(--shadow);
}

.panel-heading {
	display: grid;
	gap: 8px;
	margin-bottom: 18px;
}

.panel-heading p,
.topbar-copy p,
.auth-branding p,
.support-note {
	margin: 0;
	color: var(--muted);
	line-height: 1.6;
	font-size: 14px;
}

.eyebrow,
.meta-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--muted-strong);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.eyebrow::before {
	content: "";
	width: 24px;
	height: 1px;
	background: linear-gradient(90deg, var(--primary), transparent);
}

h1,
h2 {
	margin: 0;
	letter-spacing: -0.03em;
	line-height: 1.04;
}

h1 {
	font-size: clamp(36px, 5vw, 64px);
	text-wrap: balance;
}

h2 {
	font-size: clamp(24px, 3vw, 30px);
}

.auth-branding p {
	max-width: 56ch;
	font-size: 16px;
}

.feature-list {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 14px;
	margin-top: 8px;
}

.feature-list div {
	padding: 16px;
	border-radius: var(--radius-md);
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.feature-list strong,
.stat-card strong,
.session-chip strong {
	display: block;
	font-size: 18px;
	font-weight: 800;
	color: var(--text);
}

.feature-list span,
.stat-card small {
	display: block;
	margin-top: 6px;
	color: var(--muted);
	font-size: 13px;
	line-height: 1.45;
}

.login-form {
	display: grid;
	gap: 12px;
	margin-top: 8px;
}

.login-form label {
	color: var(--muted-strong);
	font-size: 14px;
	font-weight: 700;
}

.input-shell {
	position: relative;
}

.input-shell::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: var(--radius-md);
	padding: 1px;
	background: linear-gradient(135deg, rgba(110, 231, 255, 0.15), rgba(139, 92, 246, 0.15));
	-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.input-shell:focus-within::before {
	opacity: 1;
}

.login-form input {
	width: 100%;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: var(--radius-md);
	padding: 15px 16px;
	color: var(--text);
	background: rgba(7, 12, 24, 0.78);
	outline: none;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.login-form input::placeholder {
	color: rgba(156, 174, 200, 0.7);
}

.login-form input:focus {
	border-color: rgba(110, 231, 255, 0.55);
	box-shadow: 0 0 0 4px rgba(110, 231, 255, 0.1);
}

.btn {
	min-height: 48px;
	padding: 12px 18px;
	border-radius: 999px;
	color: #07111f;
	font-weight: 800;
	cursor: pointer;
	transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, background-color 0.18s ease;
}

.btn:hover,
.round-btn:hover {
	transform: translateY(-1px);
	filter: brightness(1.05);
}

.btn:active,
.round-btn:active {
	transform: translateY(0);
}

.btn:focus-visible,
.round-btn:focus-visible,
.login-form input:focus-visible {
	outline: 3px solid rgba(110, 231, 255, 0.28);
	outline-offset: 2px;
}

.btn-full {
	width: 100%;
}

.btn-primary {
	background: linear-gradient(135deg, #7df5ff 0%, #6ee7ff 35%, #79a8ff 100%);
	box-shadow: 0 16px 32px rgba(110, 231, 255, 0.24);
}

.btn-primary:hover {
	background: linear-gradient(135deg, #95f8ff, #d8fbff 42%, #d6e3ff 100%);
}

.btn-secondary {
	color: var(--text);
	background: linear-gradient(135deg, rgba(139, 92, 246, 0.48), rgba(110, 231, 255, 0.24));
	box-shadow: 0 16px 28px rgba(7, 12, 24, 0.26);
}

.btn-danger {
	color: #fff;
	background: linear-gradient(135deg, #ff8a97, var(--danger));
	box-shadow: 0 16px 28px rgba(255, 107, 122, 0.2);
}

.btn-ghost {
	color: var(--text);
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(110, 231, 255, 0.06));
	border: 1px solid rgba(255, 255, 255, 0.12);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
}

.auth-message {
	min-height: 22px;
	margin: 4px 0 0;
	font-size: 14px;
	line-height: 1.5;
}

.auth-message.error {
	color: #ff9aa5;
}

.auth-message.success {
	color: #8ef0c9;
}

.dashboard {
	display: grid;
	gap: 20px;
	animation: fadeInUp 0.45s ease both;
}

.topbar,
.stat-card,
.control-card {
	background:
		radial-gradient(circle at top right, rgba(110, 231, 255, 0.08), transparent 20%),
		radial-gradient(circle at 10% 0%, rgba(139, 92, 246, 0.1), transparent 22%),
		linear-gradient(180deg, rgba(10, 19, 36, 0.84), rgba(8, 15, 30, 0.94));
	border: 1px solid var(--border);
	box-shadow: var(--shadow-soft);
}

.topbar {
	display: flex;
	justify-content: space-between;
	gap: 20px;
	padding: 26px 28px;
	align-items: center;
	flex-wrap: wrap;
}

.topbar-copy {
	display: grid;
	gap: 10px;
}

.topbar-copy h1 {
	font-size: clamp(36px, 4.8vw, 58px);
}

.topbar-copy p {
	max-width: 58ch;
	font-size: 15px;
}

.topbar-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.session-chip {
	min-width: 170px;
	padding: 14px 16px;
	border-radius: var(--radius-md);
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}

.stat-card {
	padding: 22px;
	display: grid;
	gap: 8px;
	min-height: 150px;
	align-content: start;
	overflow: hidden;
}

.stat-card::after,
.control-card::after,
.login-panel::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 38%);
	opacity: 0.55;
}

.stat-card,
.control-card,
.login-panel {
	position: relative;
}

.stat-card strong {
	font-size: clamp(24px, 3vw, 34px);
	line-height: 1.1;
	word-break: break-word;
}

.status-pill {
	width: fit-content;
	padding: 8px 12px;
	border-radius: 999px;
	font-size: 13px !important;
	font-weight: 900;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(110, 231, 255, 0.08));
	border: 1px solid rgba(255, 255, 255, 0.1);
}

.online {
	color: #8ef0c9;
	background: rgba(53, 211, 158, 0.12);
	border-color: rgba(53, 211, 158, 0.22);
}

.offline {
	color: #ff9aa5;
	background: rgba(255, 107, 122, 0.12);
	border-color: rgba(255, 107, 122, 0.22);
}

.control-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
	gap: 16px;
}

.control-card {
	padding: 26px;
	display: grid;
	gap: 18px;
	min-height: 100%;
	overflow: hidden;
}

.temperature-control {
	display: grid;
	grid-template-columns: 58px minmax(0, 1fr) 58px;
	gap: 14px;
	align-items: center;
	padding: 18px;
	border-radius: var(--radius-lg);
	background:
		radial-gradient(circle at top, rgba(110, 231, 255, 0.12), transparent 28%),
		linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.temperature-value {
	display: grid;
	justify-items: center;
	text-align: center;
	gap: 4px;
	min-width: 0;
}

.temperature-value span {
	font-size: clamp(40px, 6vw, 64px);
	font-weight: 900;
	line-height: 0.95;
	letter-spacing: -0.06em;
}

.temperature-value small {
	color: var(--muted);
	font-size: 13px;
	font-weight: 700;
}

.round-btn {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	color: var(--text);
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(110, 231, 255, 0.08));
	border: 1px solid rgba(255, 255, 255, 0.1);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 26px rgba(0, 0, 0, 0.18);
	font-size: 28px;
	font-weight: 800;
	cursor: pointer;
}

.action-row,
.fan-actions {
	display: grid;
	gap: 12px;
}

.action-row {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.light-actions {
	margin-bottom: 2px;
}

.hold-button {
	width: 100%;
	min-height: 74px;
	padding: 16px 18px;
	border: 1px solid rgba(255, 207, 99, 0.42);
	border-radius: var(--radius-md);
	background: rgba(255, 207, 99, 0.12);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
	color: var(--text);
	font-size: 16px;
	font-weight: 800;
	cursor: pointer;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	-webkit-touch-callout: none;
	-webkit-tap-highlight-color: transparent;
	transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.hold-button:hover,
.hold-button:focus-visible {
	border-color: var(--warn);
	background: rgba(255, 207, 99, 0.2);
	outline: none;
}

.hold-button.is-pressing {
	transform: translateY(1px);
	border-color: var(--warn);
	background: rgba(255, 207, 99, 0.3);
	box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.22);
}

.support-note {
	padding: 14px 16px;
	border-radius: var(--radius-md);
	background: linear-gradient(135deg, rgba(53, 211, 158, 0.08), rgba(110, 231, 255, 0.06));
	border: 1px solid rgba(255, 255, 255, 0.08);
	color: var(--muted-strong);
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(14px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes float {
	0%,
	100% {
		transform: translate3d(0, 0, 0) scale(1);
	}

	50% {
		transform: translate3d(0, 14px, 0) scale(1.04);
	}
}

@media (max-width: 1080px) {
	.auth-screen {
		grid-template-columns: 1fr;
	}

	.status-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.control-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 760px) {
	body {
		padding: 16px;
	}

	.auth-screen {
		min-height: auto;
	}

	.auth-branding,
	.login-panel,
	.topbar,
	.stat-card,
	.control-card {
		border-radius: 24px;
	}

	.auth-branding,
	.login-panel,
	.topbar,
	.control-card {
		padding: 22px;
	}

	.feature-list,
	.status-grid,
	.action-row {
		grid-template-columns: 1fr;
	}

	.topbar-actions {
		width: 100%;
	}

	.session-chip {
		width: 100%;
	}

	.session-chip strong {
		font-size: 16px;
	}

	.temperature-control {
		grid-template-columns: 52px minmax(0, 1fr) 52px;
		padding: 14px;
	}

	.round-btn {
		width: 52px;
		height: 52px;
	}

	.background-orb {
		opacity: 0.45;
	}
}

/* v2: multi-device + OTA/admin controls */
.device-picker {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 170px;
}

.device-picker select,
.ota-form input,
.ota-form textarea {
	width: 100%;
	padding: 10px 12px;
	color: var(--text);
	background: var(--surface-soft);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	outline: none;
}

.device-picker select:focus,
.ota-form input:focus,
.ota-form textarea:focus {
	border-color: var(--primary);
}

.admin-actions {
	margin-bottom: 14px;
}

.ota-form {
	display: grid;
	gap: 6px;
}

.ota-form label {
	margin-top: 4px;
	color: var(--muted);
	font-size: 13px;
}

.ota-form textarea {
	resize: vertical;
	min-height: 56px;
}

.ota-form input[type="file"] {
	padding: 8px;
}

.command-status {
	min-height: 22px;
	margin: 12px 0 0;
	color: var(--muted-strong);
	font-size: 13px;
}

.command-status.error {
	color: var(--danger);
}

@media (max-width: 720px) {
	.device-picker {
		width: 100%;
	}
}
