.instrument-game {
	--game-accent: #7c3aed;
}

.instrument-stage {
	display: grid;
	padding: clamp(12px, 2.5vw, 24px);
	place-items: center;
	overflow: auto;
	touch-action: manipulation;
}

.piano-game {
	--game-accent: #7c3aed;
}

.piano-game .instrument-stage {
	background:
		radial-gradient(circle at 50% 115%, rgba(168, 85, 247, 0.5), transparent 44%),
		linear-gradient(150deg, #111827, #312e81 55%, #4c1d95);
}

.baglama-game {
	--game-accent: #b45309;
}

.baglama-game .instrument-stage {
	background:
		radial-gradient(circle at 50% 120%, rgba(251, 191, 36, 0.36), transparent 43%),
		linear-gradient(145deg, #292524, #78350f 56%, #451a03);
}

.instrument-wrap {
	display: grid;
	width: min(100%, 980px);
	gap: 14px;
}

.instrument-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.instrument-button {
	min-height: 36px;
	padding: 7px 13px;
	color: #fff;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 10px;
	font: inherit;
	font-size: 11px;
	font-weight: 800;
	cursor: pointer;
	backdrop-filter: blur(8px);
}

.instrument-button:hover,
.instrument-button:focus-visible {
	background: var(--game-accent);
	border-color: rgba(255, 255, 255, 0.55);
	outline: none;
}

.note-trail {
	display: flex;
	min-height: 31px;
	padding: 5px 8px;
	align-items: center;
	gap: 5px;
	overflow: hidden;
	color: rgba(255, 255, 255, 0.65);
	background: rgba(15, 23, 42, 0.28);
	border: 1px solid rgba(255, 255, 255, 0.13);
	border-radius: 10px;
	font-size: 10px;
}

.note-chip {
	flex: 0 0 auto;
	padding: 3px 7px;
	color: #fff;
	background: color-mix(in srgb, var(--game-accent) 72%, #fff 8%);
	border-radius: 999px;
	font-weight: 850;
	animation: note-arrive 180ms ease-out;
}

@keyframes note-arrive {
	from {
		opacity: 0;
		transform: translateY(5px) scale(0.85);
	}
}

.piano-board {
	position: relative;
	display: flex;
	width: 100%;
	height: clamp(205px, 46vh, 330px);
	padding: 10px;
	background: #0f172a;
	border: 1px solid rgba(255, 255, 255, 0.22);
	border-radius: 20px;
	box-shadow: 0 24px 55px rgba(0, 0, 0, 0.32);
}

.piano-white-key,
.piano-black-key,
.baglama-note {
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	user-select: none;
}

.piano-white-key {
	position: relative;
	flex: 1 1 12.5%;
	height: 100%;
	padding: 0 3px 12px;
	align-items: flex-end;
	justify-content: center;
	color: #334155;
	background: linear-gradient(#fff, #f8fafc 76%, #dbe4ef);
	border: 1px solid #94a3b8;
	border-radius: 0 0 10px 10px;
	box-shadow: inset 0 -8px 11px rgba(100, 116, 139, 0.16);
	font: inherit;
	cursor: pointer;
}

.piano-white-key:first-child {
	border-radius: 10px 0 10px 10px;
}

.piano-white-key:last-of-type {
	border-radius: 0 10px 10px 10px;
}

.piano-black-key {
	position: absolute;
	z-index: 2;
	top: 10px;
	width: 8.5%;
	height: 60%;
	padding: 0 2px 10px;
	color: #e2e8f0;
	background: linear-gradient(100deg, #020617, #334155 56%, #0f172a);
	border: 1px solid #020617;
	border-radius: 0 0 8px 8px;
	box-shadow: 0 8px 10px rgba(0, 0, 0, 0.4);
	font: inherit;
	cursor: pointer;
	transform: translateX(-50%);
}

.piano-white-key,
.piano-black-key {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.piano-white-key.is-active {
	background: linear-gradient(#ede9fe, #c4b5fd);
	box-shadow: inset 0 7px 14px rgba(76, 29, 149, 0.2);
	transform: translateY(3px);
}

.piano-black-key.is-active {
	background: linear-gradient(#7c3aed, #4c1d95);
	transform: translate(-50%, 3px);
}

.note-name {
	font-size: 12px;
	font-weight: 900;
}

.key-hint {
	display: inline-grid;
	min-width: 20px;
	height: 20px;
	padding: 0 4px;
	place-items: center;
	background: rgba(148, 163, 184, 0.18);
	border-radius: 5px;
	font-size: 9px;
	font-weight: 850;
}

.baglama-board {
	position: relative;
	display: grid;
	width: 100%;
	padding: clamp(18px, 4vw, 34px) clamp(12px, 3vw, 28px);
	gap: clamp(17px, 4vh, 28px);
	overflow: hidden;
	background:
		linear-gradient(90deg, rgba(69, 26, 3, 0.92), rgba(217, 119, 6, 0.3) 48%, rgba(69, 26, 3, 0.9)),
		repeating-linear-gradient(90deg, #92400e 0 7px, #a16207 7px 10px);
	border: 4px solid #451a03;
	border-radius: 22px;
	box-shadow: inset 0 0 35px rgba(69, 26, 3, 0.7), 0 24px 55px rgba(0, 0, 0, 0.3);
}

.baglama-string {
	position: relative;
	display: grid;
	grid-template-columns: minmax(62px, 0.7fr) repeat(7, minmax(40px, 1fr));
	align-items: center;
	gap: 3px;
}

.baglama-string::before {
	position: absolute;
	z-index: 0;
	right: 0;
	left: 0;
	height: 2px;
	content: "";
	background: linear-gradient(90deg, #fef3c7, #fff 45%, #fcd34d);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.string-label {
	position: relative;
	z-index: 1;
	padding: 7px;
	color: #fff7ed;
	background: rgba(69, 26, 3, 0.76);
	border: 1px solid rgba(254, 243, 199, 0.25);
	border-radius: 8px;
	font-size: 10px;
	font-weight: 850;
	text-align: center;
}

.baglama-note {
	position: relative;
	z-index: 1;
	display: grid;
	min-height: clamp(47px, 9vh, 65px);
	padding: 4px;
	place-items: center;
	color: #451a03;
	background: rgba(255, 247, 237, 0.88);
	border: 1px solid rgba(69, 26, 3, 0.4);
	border-radius: 9px;
	box-shadow: 0 4px 8px rgba(69, 26, 3, 0.28);
	font: inherit;
	cursor: pointer;
}

.baglama-note.is-active {
	color: #fff;
	background: #d97706;
	box-shadow: 0 0 0 3px rgba(253, 230, 138, 0.48), 0 6px 15px rgba(69, 26, 3, 0.42);
	transform: translateY(2px);
}

.fret-number {
	font-size: 10px;
	font-weight: 900;
}

@media (max-width: 620px) {
	.instrument-stage {
		padding: 8px;
	}

	.piano-board {
		height: clamp(185px, 42vh, 270px);
		padding: 7px;
	}

	.piano-black-key {
		top: 7px;
		width: 10%;
	}

	.note-name {
		font-size: 10px;
	}

	.baglama-board {
		padding: 13px 8px;
		gap: 13px;
	}

	.baglama-string {
		grid-template-columns: 42px repeat(7, minmax(27px, 1fr));
		gap: 2px;
	}

	.string-label {
		padding: 5px 2px;
		font-size: 8px;
	}

	.baglama-note {
		min-height: 44px;
		padding: 2px;
	}
}
