@import url("./theme-vars.css");

.screen-game {
	align-items: stretch;
	justify-content: center;
}

.stage {
	flex: 1;
	display: flex;
	align-items: stretch;
	justify-content: center;
	width: 100%;
}

.canvas-wrap {
	position: relative;
	width: min(1100px, 96vw);
	height: calc(100vh - 40px);
	margin: 0 auto;
	overflow: hidden;
}

/* Overlay top bar inside game */
body.playing .site-header {
	display: none !important;
}

/* Топбар поверх канвасов */
.overlay.topbar {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 10px;
	pointer-events: none; /* чтобы канвасы клики не ловили — кнопкам вернём ниже */
	z-index: 40;
}

/* Кнопка выхода и счёт должны кликаться */
.overlay.topbar .btn,
.overlay.topbar .score-mini,
.overlay.topbar .brand {
	pointer-events: auto;
}

.overlay.topbar .brand.mini-brand {
	display: flex;
	align-items: center;
	gap: 8px;
	background: rgba(0, 0, 0, 0.35);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 6px 10px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.overlay.topbar .brand.mini-brand .logo {
	font-size: 16px;
}

.overlay.topbar .brand.mini-brand .brand-name {
	font-size: 13px;
	opacity: 0.9;
}

.overlay.topbar .score-mini {
	background: rgba(0, 0, 0, 0.35);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 6px 10px;
	min-width: 48px;
	text-align: center;
	font-weight: 700;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.overlay.topbar .exit-btn {
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 8px 12px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.score-mini {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	font-weight: 700;
	font-size: 12px;
	padding: 4px 8px;
	border-radius: 10px;
	pointer-events: none;
}

.score-mini:empty {
	display: none;
}

/* Two stacked canvases */
#fxCanvas,
#noteCanvas {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
}

#fxCanvas {
	z-index: 2;
}

#noteCanvas {
	z-index: 0;
}

/* hit line (thick & glowing) */
#hitLine {
	position: absolute;
	left: 0;
	right: 0;
	height: 6px;
	background: linear-gradient(
		90deg,
		rgba(255, 138, 61, 0.7) 0%,
		rgba(255, 138, 61, 1) 50%,
		rgba(255, 138, 61, 0.7) 100%
	);
	opacity: 0.95;
	border-radius: 3px;
	box-shadow:
		0 0 20px rgba(255, 138, 61, 0.6),
		0 0 10px rgba(255, 138, 61, 0.8),
		0 0 4px rgba(255, 138, 61, 1),
		inset 0 1px 0 rgba(255, 255, 255, 0.3);
	animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
	0%,
	100% {
		box-shadow:
			0 0 20px rgba(255, 138, 61, 0.6),
			0 0 10px rgba(255, 138, 61, 0.8),
			0 0 4px rgba(255, 138, 61, 1),
			inset 0 1px 0 rgba(255, 255, 255, 0.3);
	}
	50% {
		box-shadow:
			0 0 25px rgba(255, 138, 61, 0.7),
			0 0 15px rgba(255, 138, 61, 0.9),
			0 0 6px rgba(255, 138, 61, 1),
			inset 0 1px 0 rgba(255, 255, 255, 0.4);
	}
}

/* Piano centered at bottom */
.piano-keys {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	bottom: 0;
	display: flex;
	list-style: none;
	margin: 0;
	padding: 16px 16px 12px;
	gap: 0;
	user-select: none;
	z-index: 50;
}

.piano-keys .key {
	position: relative;
	text-transform: uppercase;
	cursor: pointer;
}

.piano-keys .white {
	height: 200px;
	width: 66px;
	background: linear-gradient(180deg, #fafafa 0%, #e8e8e8 50%, #dcdcdc 100%);
	border: 1px solid #000;
	border-radius: 6px;
	margin: 0 2px;
	box-shadow:
		inset 0 -2px 0 rgba(0, 0, 0, 0.25),
		0 2px 4px rgba(0, 0, 0, 0.15);
	transition: all 0.08s cubic-bezier(0.4, 0, 0.2, 1);
}

.piano-keys .white:hover {
	background: linear-gradient(180deg, #ffffff 0%, #efefef 50%, #e3e3e3 100%);
	transform: translateY(-1px);
	box-shadow:
		inset 0 -2px 0 rgba(0, 0, 0, 0.25),
		0 3px 6px rgba(0, 0, 0, 0.2);
}

.piano-keys .white.active {
	background: linear-gradient(180deg, #e8e8e8 0%, #d0d0d0 50%, #cfcfcf 100%);
	box-shadow:
		inset 0 3px 12px rgba(0, 0, 0, 0.4),
		inset 0 -1px 0 rgba(255, 255, 255, 0.1);
	transform: translateY(2px);
}

.piano-keys .black {
	position: relative;
	z-index: 2;
	width: 42px;
	height: 124px;
	margin-left: -22px;
	margin-right: -22px;
	background: linear-gradient(180deg, #383838 0%, #1a1a1a 40%, #000 100%);
	border-radius: 0 0 6px 6px;
	box-shadow:
		0 3px 8px rgba(0, 0, 0, 0.7),
		inset 0 1px 0 rgba(255, 255, 255, 0.08);
	border: 1px solid #000;
	transition: all 0.08s cubic-bezier(0.4, 0, 0.2, 1);
}

.piano-keys .black:hover {
	background: linear-gradient(180deg, #404040 0%, #222 40%, #0a0a0a 100%);
	transform: translateY(-1px);
	box-shadow:
		0 4px 10px rgba(0, 0, 0, 0.75),
		inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.piano-keys .black.active {
	background: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 60%, #3a3a3a 100%);
	box-shadow:
		inset 0 4px 10px rgba(0, 0, 0, 0.6),
		inset 0 -1px 0 rgba(255, 255, 255, 0.05);
	transform: translateY(2px);
}

.piano-keys .key span {
	position: absolute;
	bottom: 10px;
	left: 0;
	right: 0;
	text-align: center;
	color: #666;
	font-size: 12px;
}

/* Цветная линия-индикатор над клавишей */
.piano-keys .key::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 5px;
	background: var(--key-color, transparent);
	border-radius: 6px 6px 0 0;
	opacity: 0.9;
}

.piano-keys .key.black::before {
	border-radius: 0;
}

.piano-keys .key.hide span {
	display: none;
}

/* Dialog */
.dialog {
	border: 1px solid var(--line);
	background: var(--paper);
	color: var(--ink);
	border-radius: 16px;
	padding: 16px 18px;
}

.dialog::backdrop {
	background: rgba(0, 0, 0, 0.5);
}

.dialog-title {
	margin: 0 0 8px;
}

.dialog-body {
	color: var(--muted);
}

.dialog-body .big {
	font-size: 18px;
	color: var(--ink);
}

.dialog-actions {
	margin-top: 12px;
	display: flex;
	gap: 10px;
	justify-content: flex-end;
}

/* Hit badge */
.hit-badge {
	position: absolute;
	transform: translate(-50%, -120%) scale(1);
	font-weight: 800;
	font-size: 12px;
	padding: 4px 8px;
	border-radius: 10px;
	background: rgba(0, 0, 0, 0.65);
	color: #fff;
	pointer-events: none;
	will-change: transform, opacity;
	text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

/* note labels on keys */
.piano-keys .key {
	position: relative;
	font-variant-numeric: tabular-nums;
}

.piano-keys .key .comp-key {
	position: absolute;
	top: 0;
	left: 0;
	font-size: 11px;
	opacity: 0.6;
	user-select: none;
	width: 100%;
	height: 100%;
}

.piano-keys .key .note-tag {
	position: absolute;
	bottom: 6px;
	right: 0;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.2px;
	user-select: none;
	opacity: 0.85;
	width: 100%;
}

.piano-keys .key.black .note-tag,
.piano-keys .key.black .comp-key {
	color: #eee;
}

.piano-keys .key.white .note-tag,
.piano-keys .key.white .comp-key {
	color: #222;
}

/* слегка подсветим все «C» (границы октав легче увидеть) */
.piano-keys .key.is-C .note-tag {
	border-bottom: 2px solid #ff8a3d;
	padding-bottom: 1px;
}

/* Responsive */
@media (max-width: 860px) {
	.piano-keys .white {
		width: 56px;
		height: 180px;
	}

	.piano-keys .black {
		width: 36px;
		height: 108px;
		margin-left: -18px;
		margin-right: -18px;
	}
}

@media (max-width: 720px) {
	.piano-keys .white {
		width: 50px;
	}

	.piano-keys .black {
		width: 32px;
		margin-left: -16px;
		margin-right: -16px;
	}
}

@media (max-width: 620px) {
	.piano-keys .white {
		width: 44px;
	}

	.piano-keys .black {
		width: 28px;
		margin-left: -14px;
		margin-right: -14px;
	}
}
