* {
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

:root {
	--bg: #020617;
	--panel: rgba(15, 23, 42, .72);
	--panel-border: rgba(148, 163, 184, .18);
	--text: #f8fafc;
	--muted: #94a3b8;
	--red: #ef4444;
	--yellow: #f59e0b;
	--green: #22c55e;
	--blue: #2563ff;
}

html, body {
	margin: 0;
	min-height: 100%;
	background: var(--bg);
}

body {
	min-height: 100dvh;
	padding-top: env(safe-area-inset-top);
	padding-bottom: env(safe-area-inset-bottom);
	font-family: Verdana, sans-serif;
	color: var(--text);
	display: flex;
	align-items: stretch;
	justify-content: center;
	background:
		radial-gradient(circle at 50% 0%, rgba(37, 99, 255, .28), transparent 34%),
		radial-gradient(circle at 50% 100%, rgba(34, 197, 94, .10), transparent 32%),
		linear-gradient(180deg, #07111f 0%, #020617 52%, #000 100%);
	overflow-x: hidden;
	overflow-y: auto;
}

.app {
	min-height: 100svh;
	padding-bottom: calc(env(safe-area-inset-bottom) + 28px);
	width: min(100%, 460px);
	padding: 22px 20px 18px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 14px;
}

.top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	color: var(--muted);
	font-size: 13px;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.brand {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 800;
}

.brand-dot {
	width: 9px;
	height: 9px;
	border-radius: 999px;
	background: var(--blue);
	box-shadow: 0 0 18px rgba(37, 99, 255, .95);
}

.state-pill {
	padding: 9px 13px;
	border-radius: 999px;
	border: 1px solid var(--panel-border);
	background: rgba(15, 23, 42, .55);
	font-weight: 800;
	color: #cbd5e1;
	transition: all 160ms ease;
}

.state-pill.bad {
	color: #fecaca;
	background: rgba(239, 68, 68, .16);
	border-color: rgba(239, 68, 68, .35);
}

.state-pill.warn {
	color: #fde68a;
	background: rgba(245, 158, 11, .16);
	border-color: rgba(245, 158, 11, .35);
}

.state-pill.ok {
	color: #bbf7d0;
	background: rgba(34, 197, 94, .18);
	border-color: rgba(34, 197, 94, .40);
}

.lock-card {
	position: relative;
	flex: 1;
	min-height: 430px;
	border: 1px solid var(--panel-border);
	border-radius: 34px;
	background:
		linear-gradient(180deg, rgba(15, 23, 42, .88), rgba(2, 6, 23, .92)),
		radial-gradient(circle at center, rgba(37, 99, 255, .18), transparent 46%);
	box-shadow:
		0 22px 60px rgba(0, 0, 0, .42),
		inset 0 1px 0 rgba(255, 255, 255, .05);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 28px 22px 34px;
}

.mini-bars {
	position: absolute;
	top: 42px;
	left: 32px;
	right: 32px;
	height: 54px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 11px;
	opacity: .92;
}

.mini-bars span {
	width: 6px;
	height: 18px;
	border-radius: 999px;
	background: rgba(148, 163, 184, .24);
	transition: all 140ms ease;
}

.mini-bars span:nth-child(1),
.mini-bars span:nth-child(9) { height: 12px; }

.mini-bars span:nth-child(2),
.mini-bars span:nth-child(8) { height: 20px; }

.mini-bars span:nth-child(3),
.mini-bars span:nth-child(7) { height: 30px; }

.mini-bars span:nth-child(4),
.mini-bars span:nth-child(6) { height: 42px; }

.mini-bars span:nth-child(5) { height: 52px; }

.lock-ring {
	position: relative;
	width: min(68vw, 268px);
	height: min(68vw, 268px);
	border-radius: 999px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 36px;
	transition: all 180ms ease;
}

.lock-ring::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	border: 8px solid rgba(148, 163, 184, .10);
	box-shadow: inset 0 0 42px rgba(255, 255, 255, .02);
	transition: all 180ms ease;
}

.lock-ring::after {
	content: "";
	position: absolute;
	inset: 12px;
	border-radius: inherit;
	background: radial-gradient(circle, rgba(255, 255, 255, .05), transparent 64%);
	opacity: .7;
}

.lock-ring.ok::before {
	border-color: var(--green);
	box-shadow:
		0 0 28px rgba(34, 197, 94, .42),
		0 0 88px rgba(34, 197, 94, .16),
		inset 0 0 44px rgba(34, 197, 94, .06);
	animation: lockPulse 1s ease-in-out infinite;
}

.lock-ring.warn::before {
	border-color: rgba(245, 158, 11, .72);
	box-shadow: 0 0 38px rgba(245, 158, 11, .18);
}

.lock-ring.bad::before {
	border-color: rgba(239, 68, 68, .58);
	box-shadow: 0 0 38px rgba(239, 68, 68, .16);
}

@keyframes lockPulse {
	0%, 100% { transform: scale(1); opacity: 1; }
	50% { transform: scale(1.035); opacity: .88; }
}

.note-wrap {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	line-height: 1;
}

.note {
	font-size: clamp(126px, 35vw, 174px);
	font-weight: 900;
	letter-spacing: -10px;
	color: #ffffff;
	text-shadow:
		0 0 24px rgba(255, 255, 255, .16),
		0 0 48px rgba(37, 99, 255, .18);
}

.octave {
	font-size: clamp(34px, 10vw, 54px);
	font-weight: 900;
	margin-left: 8px;
	margin-bottom: 16px;
	color: #e2e8f0;
}

.check {
	position: absolute;
	right: 8px;
	bottom: 8px;
	z-index: 3;
	width: 58px;
	height: 58px;
	border-radius: 999px;
	display: none;
	align-items: center;
	justify-content: center;
	background: var(--green);
	color: #fff;
	font-size: 36px;
	font-weight: 900;
	box-shadow: 0 0 28px rgba(34, 197, 94, .62);
}

.lock-ring.ok .check {
	display: flex;
}

.freq {
	margin-top: 18px;
	font-size: 20px;
	color: var(--muted);
	min-height: 28px;
	text-align: center;
}

.guidance {
	margin-top: 20px;
	min-height: 86px;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.guidance-main {
	font-size: 21px;
	font-weight: 900;
	color: #e5e7eb;
}

.guidance-sub {
	font-size: 16px;
	line-height: 1.35;
	color: var(--muted);
}

.direction {
	font-size: 42px;
	line-height: 1;
	font-weight: 900;
	color: var(--blue);
	min-height: 42px;
	transition: all 140ms ease;
}

.color-scale {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 26px;
	display: grid;
	grid-template-columns: repeat(5, 1fr);
}

.color-scale div:nth-child(1),
.color-scale div:nth-child(5) { background: var(--red); }

.color-scale div:nth-child(2),
.color-scale div:nth-child(4) { background: var(--yellow); }

.color-scale div:nth-child(3) { background: var(--green); }

.controls {
	display: grid;
	gap: 10px;
}

select, button {
	width: 100%;
	border-radius: 19px;
	font-size: 18px;
	font-family: Verdana, sans-serif;
}

select {
	padding: 15px 16px;
	border: 1px solid rgba(148, 163, 184, .28);
	background: rgba(15, 23, 42, .92);
	color: #f8fafc;
	outline: none;
}

button {
	border: 0;
	padding: 18px;
	background: linear-gradient(135deg, #2563eb, #4f46e5);
	color: #fff;
	font-weight: 900;
	cursor: pointer;
	box-shadow: 0 12px 30px rgba(37, 99, 235, .34);
}

button:disabled {
	opacity: .6;
	cursor: not-allowed;
}

.notes button {
	width: 60px;
	height: 64px;
	border: 0;
	border-radius: 16px;
	background: #1e293b;
	color: white;
	font-size: 20px;
	font-weight: bold;
	cursor: pointer;
}

.notes button:active {
	background: #2563eb;
	transform: scale(0.96);
}

.help {
	display: none;
	padding: 12px;
	border-radius: 14px;
	background: rgba(127, 29, 29, .9);
	color: #fee2e2;
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
	white-space: pre-line;
}

@media (max-width: 420px) {
	.app {
		padding: 18px 14px 14px;
	}

	.lock-card {
		border-radius: 30px;
		min-height: 420px;
		padding-left: 16px;
		padding-right: 16px;
	}

	.mini-bars {
		top: 34px;
		gap: 9px;
	}

	.guidance-main {
		font-size: 19px;
	}

	.guidance-sub {
		font-size: 16px;
	}
}

@media (max-height: 720px) {
	.lock-card {
		min-height: 380px;
	}

	.lock-ring {
		width: min(58vw, 230px);
		height: min(58vw, 230px);
		margin-top: 44px;
	}

	.note {
		font-size: clamp(106px, 31vw, 150px);
	}

	.guidance {
		margin-top: 10px;
		min-height: 70px;
	}
}