:root {
	color-scheme: dark;
	font-family:
		Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
		"Segoe UI", sans-serif;
	background: #05070a;
	color: #f3f7f2;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100%;
	background:
		linear-gradient(135deg, rgb(255 255 255 / 0.04) 0 1px, transparent 1px 24px),
		#05070a;
}

body {
	width: 100vw;
	height: 100vh;
	overflow: hidden;
	display: grid;
	place-items: center;
}

button,
input,
select {
	font: inherit;
}

.device-screen {
	position: fixed;
	top: 50%;
	left: 50%;
	width: 600px;
	height: 800px;
	padding: 20px;
	display: grid;
	grid-template-rows: 64px 1fr;
	gap: 16px;
	background: linear-gradient(180deg, #0c1518, #081014);
	transform: translate(-50%, -50%) scale(var(--device-scale, 1));
	transform-origin: center;
}

.topbar {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 16px;
	min-width: 0;
}

.identity {
	min-width: 0;
}

h1 {
	margin: 0;
	font-size: 20px;
	line-height: 1.1;
	font-weight: 720;
	letter-spacing: 0;
}

.device-id {
	margin: 7px 0 0;
	color: #94a39b;
	font-size: 13px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.status-strip {
	display: grid;
	grid-template-columns: 1fr auto;
	grid-template-rows: auto auto;
	align-items: center;
	gap: 10px;
	min-width: 230px;
}

.status-dot {
	grid-column: 2;
	grid-row: 1;
	width: 12px;
	height: 12px;
	border-radius: 999px;
	background: #899089;
	box-shadow: 0 0 18px rgb(137 144 137 / 0.7);
}

.status-dot.ready {
	background: #7bd6b1;
	box-shadow: 0 0 22px rgb(123 214 177 / 0.8);
}

.status-dot.error {
	background: #e86b62;
	box-shadow: 0 0 22px rgb(232 107 98 / 0.8);
}

.status-text {
	grid-column: 1;
	grid-row: 1;
	width: 202px;
	color: #cfd8d1;
	font-size: 13px;
	text-align: right;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.page-active-debug {
	grid-column: 1 / -1;
	color: #718078;
	font-size: 10px;
	font-weight: 720;
	text-align: right;
}

.page-active-debug.inactive {
	color: #e86b62;
}

.layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr) 150px;
	gap: 16px;
	min-height: 0;
	overflow: hidden;
}

.panel {
	border: 1px solid rgb(255 255 255 / 0.1);
	border-radius: 8px;
	background: rgb(13 22 25 / 0.86);
	box-shadow: 0 22px 70px rgb(0 0 0 / 0.32);
	overflow: hidden;
}

.brightness-panel {
	position: relative;
	display: grid;
	grid-template-rows: 1fr auto;
	min-height: 0;
}

.brightness-stage {
	position: relative;
	display: grid;
	place-items: center;
	min-height: 0;
	padding: 18px;
	cursor: ns-resize;
	touch-action: none;
	user-select: none;
}

.brightness-stage.simulating {
	background: rgb(123 214 177 / 0.04);
}

.brightness-glow {
	position: absolute;
	width: 250px;
	height: 250px;
	border-radius: 999px;
	background: rgb(245 205 119 / var(--glow-alpha, 0.36));
	filter: blur(22px);
	transform: scale(var(--glow-scale, 0.75));
	transition:
		transform 180ms ease,
		background 180ms ease;
}

.brightness-ring {
	position: relative;
	width: 240px;
	aspect-ratio: 1;
	border-radius: 999px;
	display: grid;
	place-items: center;
	background:
		radial-gradient(circle, #0b1114 0 56%, transparent 57%),
		conic-gradient(
			from -90deg,
			#f4d06f var(--brightness-deg, 270deg),
			rgb(255 255 255 / 0.1) 0
		);
	box-shadow:
		inset 0 0 0 1px rgb(255 255 255 / 0.1),
		0 24px 64px rgb(0 0 0 / 0.38);
}

.brightness-ring::after {
	content: "";
	position: absolute;
	inset: 16px;
	border-radius: inherit;
	border: 1px solid rgb(255 255 255 / 0.08);
}

.brightness-value {
	position: relative;
	display: grid;
	justify-items: center;
	gap: 3px;
}

.value-number {
	font-size: 64px;
	line-height: 0.9;
	font-weight: 760;
	font-variant-numeric: tabular-nums;
}

.value-label {
	color: #a9b5ae;
	font-size: 13px;
	font-weight: 650;
	text-transform: uppercase;
}

.motion-cue {
	position: absolute;
	inset: auto 20px 18px;
	display: grid;
	grid-template-columns: 36px 1fr 36px;
	align-items: center;
	gap: 12px;
	color: #a9b5ae;
	font-size: 13px;
}

.chevron {
	width: 36px;
	height: 36px;
	border: 1px solid rgb(255 255 255 / 0.13);
	border-radius: 999px;
	position: relative;
}

.chevron::before {
	content: "";
	position: absolute;
	inset: 12px;
	border-top: 2px solid #7bd6b1;
	border-right: 2px solid #7bd6b1;
}

.chevron.left::before {
	transform: rotate(-135deg);
	left: 15px;
}

.chevron.right::before {
	transform: rotate(45deg);
	right: 15px;
}

.motion-meter {
	position: relative;
	height: 8px;
	border-radius: 999px;
	background: rgb(255 255 255 / 0.12);
	overflow: hidden;
}

.motion-meter::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 1px;
	background: rgb(255 255 255 / 0.28);
}

.motion-meter-fill {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 0;
	height: 100%;
	background: linear-gradient(90deg, #7bd6b1, #f4d06f);
	border-radius: 999px;
	transition:
		left 100ms linear,
		width 100ms linear;
}

.motion-meter-fill.negative {
	background: linear-gradient(90deg, #79b8ff, #7bd6b1);
}

.controls-row {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	border-top: 1px solid rgb(255 255 255 / 0.09);
	background: rgb(255 255 255 / 0.03);
}

.brightness-slider {
	width: 100%;
	accent-color: #f4d06f;
}

.drag-map-controls {
	position: absolute;
	z-index: 2;
	inset: 0;
	pointer-events: none;
}

.drag-map-controls[hidden] {
	display: none;
}

.drag-map-control {
	position: absolute;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 6px;
	border: 1px solid rgb(255 255 255 / 0.1);
	border-radius: 8px;
	background: rgb(6 12 14 / 0.78);
	color: #a9b5ae;
	font-size: 11px;
	font-weight: 720;
	pointer-events: auto;
}

.drag-map-control-x {
	top: 14px;
	left: 50%;
	transform: translateX(-50%);
}

.drag-map-control-y {
	top: 50%;
	left: 14px;
	transform: translateY(-50%);
}

.drag-map-controls select {
	height: 28px;
	border: 1px solid rgb(255 255 255 / 0.14);
	border-radius: 6px;
	background: #10191c;
	color: #f3f7f2;
	font: inherit;
	font-size: 12px;
	font-weight: 700;
}

.motion-button {
	min-width: 128px;
	height: 40px;
	border: 1px solid rgb(123 214 177 / 0.52);
	border-radius: 8px;
	background: rgb(123 214 177 / 0.13);
	color: #e8fff4;
	font-weight: 700;
}

.motion-button:disabled {
	color: #8e9a93;
	border-color: rgb(255 255 255 / 0.12);
	background: rgb(255 255 255 / 0.06);
}

.telemetry {
	display: contents;
}

.telemetry-bottom {
	display: grid;
	grid-column: 1 / -1;
	grid-row: 2;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 12px;
	min-height: 0;
}

.telemetry-card {
	padding: 12px;
	min-height: 0;
}

.telemetry > .telemetry-card:first-child {
	grid-column: 2;
	grid-row: 1;
	display: grid;
	grid-template-rows: auto auto auto auto minmax(118px, 1fr);
}

.telemetry > .telemetry-card:first-child .card-head {
	margin-bottom: 8px;
}

.metric-card {
	display: grid;
	padding: 10px;
	min-height: 0;
}

.temperature-card {
	grid-template-rows: auto auto auto minmax(0, 1fr);
}

.bitrate-card {
	grid-template-rows: auto auto minmax(0, 1fr);
}

.card-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.card-title {
	color: #a9b5ae;
	font-size: 12px;
	font-weight: 720;
	text-transform: uppercase;
}

.motion-tuning-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin: -2px 0 8px;
	min-width: 0;
}

.motion-axis-control {
	display: flex;
	align-items: center;
	gap: 5px;
	color: #718078;
	font-size: 10px;
	font-weight: 720;
	text-transform: uppercase;
}

.motion-axis-control select {
	height: 25px;
	border: 1px solid rgb(255 255 255 / 0.14);
	border-radius: 6px;
	background: #10191c;
	color: #f3f7f2;
	font-size: 12px;
	font-weight: 740;
}

.gain-stepper {
	display: grid;
	grid-template-columns: 25px 44px 25px;
	align-items: center;
	height: 25px;
	border: 1px solid rgb(255 255 255 / 0.14);
	border-radius: 6px;
	overflow: hidden;
	background: #10191c;
}

.gain-button {
	width: 25px;
	height: 25px;
	border: 0;
	background: rgb(255 255 255 / 0.06);
	color: #f3f7f2;
	font-size: 15px;
	font-weight: 760;
	line-height: 1;
}

.gain-value {
	color: #f3f7f2;
	font-size: 12px;
	font-weight: 740;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.card-value {
	font-size: 24px;
	font-weight: 760;
	font-variant-numeric: tabular-nums;
}

.metric-card .card-head {
	margin-bottom: 7px;
}

.metric-card .card-value {
	font-size: 17px;
	white-space: nowrap;
}

.accel-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 5px;
	margin-bottom: 8px;
}

.axis-pill {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: center;
	column-gap: 5px;
	border: 1px solid rgb(255 255 255 / 0.09);
	border-radius: 8px;
	padding: 4px 5px;
	background: rgb(255 255 255 / 0.04);
}

.axis-label {
	color: #718078;
	font-size: 10px;
	font-weight: 700;
}

.axis-value {
	font-size: 12px;
	font-weight: 740;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.axis-meter {
	grid-column: 1 / -1;
	position: relative;
	height: 4px;
	margin-top: 4px;
	border-radius: 999px;
	background: rgb(255 255 255 / 0.1);
	overflow: hidden;
}

.axis-meter::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 1px;
	background: rgb(255 255 255 / 0.28);
}

.axis-fill {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 0;
	border-radius: 999px;
	background: #7bd6b1;
}

.axis-fill.negative {
	background: #79b8ff;
}

#accel-canvas {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 118px;
	border-radius: 8px;
	background: #070d10;
}

.motion-decision {
	margin-bottom: 8px;
	min-height: 42px;
	padding: 7px 8px;
	border: 1px solid rgb(255 255 255 / 0.08);
	border-radius: 8px;
	background: rgb(255 255 255 / 0.04);
	color: #94a39b;
	font-size: 10px;
	font-weight: 700;
	line-height: 1.35;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.motion-decision.up {
	color: #f7d987;
	border-color: rgb(244 208 111 / 0.24);
	background: rgb(244 208 111 / 0.08);
}

.motion-decision.down {
	color: #abd1ff;
	border-color: rgb(121 184 255 / 0.24);
	background: rgb(121 184 255 / 0.08);
}

.temp-track,
.bitrate-track {
	height: 12px;
	border-radius: 999px;
}

.temp-track {
	position: relative;
	overflow: visible;
	background: linear-gradient(
		90deg,
		#79b8ff 0%,
		#7bd6b1 50%,
		#f4d06f 74%,
		#e86b62 100%
	);
	box-shadow:
		inset 0 0 0 1px rgb(255 255 255 / 0.12),
		0 0 0 1px rgb(0 0 0 / 0.16);
}

.bitrate-track {
	background: rgb(255 255 255 / 0.1);
	overflow: hidden;
}

.temp-fill {
	width: var(--temp-width, 60%);
	height: 100%;
	border-radius: inherit;
	background: rgb(255 255 255 / 0.16);
	box-shadow: inset -1px 0 0 rgb(255 255 255 / 0.46);
	transition: width 400ms ease;
}

.temp-marker {
	position: absolute;
	top: 50%;
	width: 7px;
	height: 18px;
	border: 2px solid #f3f7f2;
	border-radius: 999px;
	background: #071016;
	box-shadow:
		0 0 0 1px rgb(0 0 0 / 0.46),
		0 0 10px rgb(255 255 255 / 0.32);
	transform: translate(-50%, -50%);
	transition: left 400ms ease;
}

.bitrate-pulse {
	width: var(--bitrate-width, 52%);
	height: 100%;
	border-radius: inherit;
	background: repeating-linear-gradient(
		90deg,
		#79b8ff 0 12px,
		#7bd6b1 12px 24px
	);
	transition: width 400ms ease;
	animation: stream 1s linear infinite;
}

.temp-scale {
	display: flex;
	justify-content: space-between;
	margin-top: 7px;
	color: #a9b5ae;
	font-size: 10px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.temp-scene {
	height: auto;
	min-height: 0;
	margin-top: 6px;
	position: relative;
	border: 1px solid rgb(255 255 255 / 0.08);
	border-radius: 8px;
	overflow: hidden;
	background:
		linear-gradient(
			180deg,
			rgb(121 184 255 / var(--cold-alpha, 0.22)),
			rgb(244 208 111 / var(--warm-alpha, 0.28))
		),
		#071016;
	transition: background 400ms ease;
}

.snow-field {
	position: absolute;
	inset: 0;
	opacity: var(--snow-alpha, 0.2);
	transition: opacity 400ms ease;
}

.snow-field span {
	position: absolute;
	color: #dcecff;
	font-size: 15px;
	font-weight: 800;
	line-height: 1;
	text-shadow: 0 0 10px rgb(121 184 255 / 0.8);
	animation: snow-fall 3.4s linear infinite;
}

.snow-field span:nth-child(1) {
	top: 10px;
	left: 16%;
	--snow-drift-x: 5px;
}

.snow-field span:nth-child(2) {
	top: 3px;
	left: 40%;
	animation-delay: -0.9s;
	--snow-drift-x: -4px;
}

.snow-field span:nth-child(3) {
	top: 13px;
	left: 62%;
	animation-delay: -1.7s;
	--snow-drift-x: 3px;
}

.snow-field span:nth-child(4) {
	top: 0;
	left: 78%;
	animation-delay: -2.2s;
	--snow-drift-x: -5px;
}

.cloud {
	position: absolute;
	width: 38px;
	height: 13px;
	border-radius: 999px;
	background: rgb(220 236 255 / var(--cloud-alpha, 0.36));
	filter: drop-shadow(0 2px 8px rgb(121 184 255 / 0.18));
	animation: cloud-drift 5.4s ease-in-out infinite;
}

.cloud::before,
.cloud::after {
	content: "";
	position: absolute;
	bottom: 3px;
	border-radius: 999px;
	background: inherit;
}

.cloud::before {
	left: 6px;
	width: 15px;
	height: 15px;
}

.cloud::after {
	right: 6px;
	width: 19px;
	height: 19px;
}

.cloud-cold {
	top: 25px;
	left: 14px;
	opacity: var(--cold-cloud-opacity, 0.8);
}

.cloud-warm {
	top: 11px;
	left: 52px;
	opacity: var(--warm-cloud-opacity, 0.35);
	animation-delay: -2.7s;
	transform: scale(0.82);
}

.sun-rays {
	position: absolute;
	top: 2px;
	right: 9px;
	width: 46px;
	height: 46px;
	border-radius: 999px;
	background: repeating-conic-gradient(
		from 0deg,
		transparent 0 8deg,
		rgb(244 208 111 / var(--ray-alpha, 0.24)) 8deg 13deg,
		transparent 13deg 24deg
	);
	mask: radial-gradient(circle, transparent 0 13px, #000 14px);
	opacity: var(--sun-alpha, 0.6);
	transform: scale(var(--ray-scale, 1));
	animation: sun-spin 18s linear infinite;
	transition:
		opacity 400ms ease,
		transform 400ms ease;
	-webkit-mask: radial-gradient(circle, transparent 0 13px, #000 14px);
}

.sun-core {
	position: absolute;
	top: 14px;
	right: 21px;
	width: 22px;
	height: 22px;
	border-radius: 999px;
	background: #f4d06f;
	box-shadow:
		0 0 14px rgb(244 208 111 / var(--sun-alpha, 0.6)),
		0 0 28px rgb(232 107 98 / var(--sun-glow-alpha, 0.26));
	opacity: var(--sun-alpha, 0.6);
	transform: scale(var(--sun-scale, 1));
	transition:
		opacity 400ms ease,
		transform 400ms ease,
		box-shadow 400ms ease;
	animation: sun-pulse 2.4s ease-in-out infinite;
}

.bitrate-bars {
	display: grid;
	grid-template-columns: repeat(18, 1fr);
	align-items: end;
	gap: 4px;
	height: auto;
	min-height: 0;
	margin-top: 8px;
}

.bitrate-bars span {
	height: calc(var(--level, 0.3) * 100%);
	border-radius: 999px 999px 2px 2px;
	background: linear-gradient(180deg, #79b8ff, #7bd6b1);
	transition: height 360ms ease;
}

.missing-identifier {
	position: absolute;
	inset: 82px 20px 20px;
	display: grid;
	place-items: center;
	border: 1px solid rgb(232 107 98 / 0.34);
	border-radius: 8px;
	background: rgb(20 9 9 / 0.82);
	color: #ffd1cc;
	font-weight: 720;
	text-align: center;
}

.missing-identifier[hidden] {
	display: none;
}

@keyframes stream {
	from {
		background-position: 0 0;
	}

	to {
		background-position: 48px 0;
	}
}

@keyframes snow-fall {
	0% {
		opacity: 0;
		transform: translate(0, -12px) rotate(0deg);
	}

	18%,
	76% {
		opacity: 1;
	}

	100% {
		opacity: 0;
		transform: translate(var(--snow-drift-x, 4px), 34px) rotate(80deg);
	}
}

@keyframes cloud-drift {
	0%,
	100% {
		translate: 0 0;
	}

	50% {
		translate: 8px 1px;
	}
}

@keyframes sun-spin {
	to {
		rotate: 360deg;
	}
}

@keyframes sun-pulse {
	0%,
	100% {
		filter: brightness(1);
	}

	50% {
		filter: brightness(1.16);
	}
}
