:root {
	color-scheme: light;
	font-family: 'Archivo Black', sans-serif;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #5c4033;
	background-image:
		repeating-linear-gradient(90deg,
			transparent,
			transparent 49px,
			rgba(0, 0, 0, 0.05) 49px,
			rgba(0, 0, 0, 0.05) 50px),
		repeating-linear-gradient(0deg,
			transparent,
			transparent 49px,
			rgba(0, 0, 0, 0.05) 49px,
			rgba(0, 0, 0, 0.05) 50px);
	padding: 20px;
	overflow: auto;
}

.stylophone {
	position: relative;
	width: 100%;
	max-width: 700px;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
	animation: dropIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes dropIn {
	from {
		opacity: 0;
		transform: translateY(-30px) scale(0.95);
	}

	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.stylophone__body {
	position: relative;
	background: linear-gradient(180deg, #e8e0d4 0%, #d9d0c2 50%, #cfc5b5 100%);
	border-radius: 12px 12px 8px 8px;
	border: 3px solid #8a7d6b;
	box-shadow:
		0 4px 12px rgba(0, 0, 0, 0.3),
		inset 0 1px 0 rgba(255, 255, 255, 0.5),
		inset 0 -2px 4px rgba(0, 0, 0, 0.1);
	overflow: hidden;
	z-index: 2;
}

.stylophone__top-panel {
	display: flex;
	gap: 0;
	padding: 18px 20px 14px;
	border-bottom: 2px solid #b8ad9c;
}

/* Speaker */
.stylophone__speaker {
	flex-shrink: 0;
	width: 120px;
	height: 120px;
	background: #2b2520;
	border-radius: 50%;
	padding: 8px;
	box-shadow:
		inset 0 2px 8px rgba(0, 0, 0, 0.6),
		0 1px 0 rgba(255, 255, 255, 0.3);
}

.stylophone__speaker-grille {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background:
		radial-gradient(circle 3px at center, #1a1512 40%, transparent 41%) 0 0 / 12px 12px,
		#3d3530;
	box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Info & branding */
.stylophone__info-area {
	flex: 1;
	padding-left: 20px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
}

.stylophone__brand {
	font-family: 'Archivo Black', sans-serif;
	font-size: clamp(22px, 5vw, 36px);
	color: #c0392b;
	letter-spacing: 4px;
	text-shadow:
		1px 1px 0 rgba(0, 0, 0, 0.15),
		0 0 0 transparent;
	line-height: 1;
}

.stylophone__sub {
	font-family: 'DM Sans', sans-serif;
	font-size: clamp(7px, 1.5vw, 10px);
	color: #6b5e50;
	letter-spacing: 2px;
	text-transform: uppercase;
	font-weight: 700;
	margin-top: 2px;
}

/* Controls */
.stylophone__controls {
	display: flex;
	gap: 16px;
	margin-top: 10px;
	flex-wrap: wrap;
	align-items: flex-end;
}

.stylophone__control-group {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

.stylophone__label {
	font-family: 'DM Sans', sans-serif;
	font-size: 8px;
	letter-spacing: 1.5px;
	color: #7a6e60;
	font-weight: 700;
	text-transform: uppercase;
}

/* Toggle Switch */
.stylophone__switch {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
}

.stylophone__switch-track {
	width: 36px;
	height: 18px;
	background: #8a7d6b;
	border-radius: 9px;
	position: relative;
	box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
	transition: background 0.2s;
}

.stylophone__switch[data-state="on"] .stylophone__switch-track {
	background: #c0392b;
}

.stylophone__switch-thumb {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 14px;
	height: 14px;
	background: linear-gradient(180deg, #f0ece6 0%, #d5cfc5 100%);
	border-radius: 50%;
	transition: transform 0.2s;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.stylophone__switch[data-state="on"] .stylophone__switch-thumb {
	transform: translateX(18px);
}

.stylophone__switch-labels {
	display: flex;
	gap: 6px;
	font-family: 'DM Sans', sans-serif;
	font-size: 7px;
	color: #9a8e80;
	font-weight: 700;
	letter-spacing: 0.5px;
}

/* Volume Slider */
.stylophone__knob {
	-webkit-appearance: none;
	appearance: none;
	width: 70px;
	height: 18px;
	background: transparent;
}

.stylophone__knob::-webkit-slider-runnable-track {
	height: 6px;
	background: #8a7d6b;
	border-radius: 3px;
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.stylophone__knob::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 16px;
	height: 16px;
	background: linear-gradient(180deg, #f0ece6 0%, #c5bfb5 100%);
	border-radius: 50%;
	margin-top: -5px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	cursor: pointer;
}

.stylophone__knob::-moz-range-track {
	height: 6px;
	background: #8a7d6b;
	border-radius: 3px;
	border: none;
}

.stylophone__knob::-moz-range-thumb {
	width: 16px;
	height: 16px;
	background: linear-gradient(180deg, #f0ece6 0%, #c5bfb5 100%);
	border-radius: 50%;
	border: none;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	cursor: pointer;
}

/* Waveform Select */
.stylophone__select {
	font-family: 'DM Sans', sans-serif;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 1px;
	color: #4a4035;
	background: linear-gradient(180deg, #f0ece6 0%, #d5cfc5 100%);
	border: 1px solid #8a7d6b;
	border-radius: 4px;
	padding: 3px 6px;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Keyboard Area */
.stylophone__keyboard-area {
	padding: 12px 16px 14px;
	background: linear-gradient(180deg, #d2c9ba 0%, #c8bfae 100%);
}

.stylophone__keyboard {
	display: flex;
	gap: 2px;
	height: 110px;
	background: #1a1512;
	border-radius: 4px;
	padding: 6px 4px;
	box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

.stylophone__key {
	flex: 1;
	background: linear-gradient(180deg, #e0dcd5 0%, #c8c2b8 40%, #b8b0a4 100%);
	border-radius: 2px;
	cursor: pointer;
	position: relative;
	transition: background 0.05s, transform 0.05s;
	box-shadow:
		0 2px 0 #8a8274,
		inset 0 1px 0 rgba(255, 255, 255, 0.6);
	min-width: 0;
}

.stylophone__key::after {
	content: attr(data-note-label);
	position: absolute;
	bottom: 6px;
	left: 50%;
	transform: translateX(-50%);
	font-family: 'DM Sans', sans-serif;
	font-size: clamp(5px, 1.2vw, 8px);
	color: #7a7060;
	font-weight: 700;
	letter-spacing: 0;
	white-space: nowrap;
}

.stylophone__key--sharp {
	background: linear-gradient(180deg, #4a4035 0%, #3a332b 40%, #2d2720 100%);
	box-shadow:
		0 2px 0 #1a1512,
		inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.stylophone__key--sharp::after {
	color: #8a8070;
}

.stylophone__key--active {
	background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%) !important;
	box-shadow:
		0 1px 0 #962d22,
		inset 0 1px 0 rgba(255, 255, 255, 0.3),
		0 0 12px rgba(231, 76, 60, 0.4);
	transform: translateY(1px);
}

.stylophone__key--active::after {
	color: rgba(255, 255, 255, 0.8) !important;
}

.stylophone__stylus-hint {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 8px;
	font-family: 'DM Sans', sans-serif;
	font-size: 10px;
	color: #9a8e7e;
	letter-spacing: 1px;
}

/* Base plate */
.stylophone__base-plate {
	position: relative;
	height: 14px;
	background: linear-gradient(180deg, #a09484 0%, #8a7d6b 100%);
	border-radius: 0 0 12px 12px;
	margin-top: -4px;
	z-index: 1;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.stylophone__screw {
	position: absolute;
	width: 8px;
	height: 8px;
	background: radial-gradient(circle at 35% 35%, #c0b8a8, #7a7060);
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.stylophone__screw::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 5px;
	height: 1px;
	background: rgba(0, 0, 0, 0.3);
	transform: translate(-50%, -50%) rotate(30deg);
}

.stylophone__screw--tl {
	top: 3px;
	left: 12px;
}

.stylophone__screw--tr {
	top: 3px;
	right: 12px;
}

.stylophone__screw--bl {
	top: 3px;
	left: 40px;
}

.stylophone__screw--br {
	top: 3px;
	right: 40px;
}

/* Responsive */
@media (max-width: 500px) {
	.stylophone__top-panel {
		flex-direction: column;
		align-items: center;
		gap: 12px;
		padding: 14px 12px 10px;
	}

	.stylophone__speaker {
		width: 80px;
		height: 80px;
	}

	.stylophone__info-area {
		padding-left: 0;
		align-items: center;
		text-align: center;
	}

	.stylophone__controls {
		justify-content: center;
	}

	.stylophone__keyboard {
		height: 90px;
	}

	.stylophone__keyboard-area {
		padding: 10px 8px 12px;
	}
}