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

.screen {
	flex: 1;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 16px;
}

/* ---------- Header ---------- */
.site-header {
	width: 100%;
	border-bottom: 1px solid var(--line);
	background: linear-gradient(
		180deg,
		rgba(255, 255, 255, 0.02),
		rgba(0, 0, 0, 0)
	);
	position: sticky;
	top: 0;
	z-index: 50;
	backdrop-filter: blur(6px);
}

.header-inner {
	max-width: min(1100px, 96vw);
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 8px;
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 700;
	letter-spacing: 0.2px;
}

.logo {
	font-size: 20px;
}

.brand-name {
	font-size: 16px;
}

/* Header controls */
.header-controls {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

/* Speed segmented (icons only) */
.segmented {
	display: inline-grid;
	grid-auto-flow: column;
	gap: 0;
	border: 1px solid var(--line);
	border-radius: 12px;
	overflow: hidden;
	background: #101010;
}

.segmented input {
	display: none;
}

.segmented label {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 34px;
	background: #1b1b1b;
	color: #dcdcdc;
	cursor: pointer;
	user-select: none;
	border-right: 1px solid var(--line);
	transition:
		background 0.12s ease,
		color 0.12s ease,
		filter 0.12s ease;
}

.segmented label:last-of-type {
	border-right: none;
}

.segmented input:checked + label {
	background: var(--accent);
	color: var(--accent-ink);
}

.segmented .ico {
	font-size: 16px;
	line-height: 1;
}

/* Volume compact control */
.volume {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: #101010;
}

.vol-ico {
	font-size: 14px;
	opacity: 0.9;
}

/* Custom range slider (no system blue) */
#volumeRange {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	width: 160px;
	height: 6px;
	background: transparent;
	outline: none;
}

#volumeRange::-webkit-slider-runnable-track {
	height: 6px;
	background: #262626;
	border-radius: 999px;
	border: 1px solid #2f2f2f;
}

#volumeRange::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--accent);
	border: 0;
	margin-top: -5px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

#volumeRange::-moz-range-track {
	height: 6px;
	background: #262626;
	border-radius: 999px;
	border: 1px solid #2f2f2f;
}

#volumeRange::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--accent);
	border: 0;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

#volumeRange::-ms-track {
	height: 6px;
	background: transparent;
	border-color: transparent;
	color: transparent;
}

#volumeRange::-ms-fill-lower,
#volumeRange::-ms-fill-upper {
	background: #262626;
	border: 1px solid #2f2f2f;
	border-radius: 999px;
}

#volumeRange::-ms-thumb {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--accent);
	border: 0;
}

/* Language switch */
.lang-switch {
	display: flex;
	gap: 8px;
	align-items: center;
	padding: 4px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: #151515;
}

.lang-btn {
	background: transparent;
	color: var(--ink);
	border: 0;
	padding: 8px 12px;
	border-radius: 8px;
	cursor: pointer;
	font-weight: 600;
	letter-spacing: 0.2px;
}

.lang-btn[aria-checked="true"] {
	background: var(--accent);
	color: var(--accent-ink);
}

/* ---------- Menu layout ---------- */
.menu-wrap {
	width: min(1100px, 96vw);
	display: grid;
	gap: 16px;
	margin-top: 16px;
}

.menu-card {
	width: 100%;
	/*background:var(--paper);*/
	/*border:1px solid var(--line);*/
	/*border-radius:var(--radius);*/
	/*box-shadow:var(--shadow);*/
	padding: 16px;
}

.melodies-card .title {
	margin: 0 0 12px;
	font-size: 18px;
	letter-spacing: 0.2px;
}

/* ---------- Melody cards ---------- */
.melody-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 14px;
}

.melody-card {
	border: 1px solid var(--line);
	background: linear-gradient(135deg, #1a1a1a 0%, #171717 100%);
	border-radius: 14px;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	overflow: hidden;
	cursor: pointer;
}

.melody-card::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		135deg,
		rgba(255, 138, 61, 0.05) 0%,
		transparent 50%
	);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.melody-card:hover {
	transform: translateY(-3px) scale(1.01);
	box-shadow:
		0 12px 24px rgba(0, 0, 0, 0.35),
		0 0 0 1px rgba(255, 138, 61, 0.15);
	background: linear-gradient(135deg, #1d1d1d 0%, #1a1a1a 100%);
	border-color: rgba(255, 138, 61, 0.3);
}

.melody-card:hover::before {
	opacity: 1;
}

.melody-card:active {
	transform: translateY(-1px) scale(1);
}

.melody-card.active {
	border-color: var(--accent);
	box-shadow:
		0 0 0 2px rgba(255, 138, 61, 0.25) inset,
		0 8px 16px rgba(0, 0, 0, 0.3);
}

.melody-title {
	font-weight: 700;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.melody-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	color: var(--muted);
	font-size: 12px;
}

.melody-desc {
	color: var(--muted);
	font-size: 12px;
	min-height: 32px;
}

.melody-actions {
	display: flex;
	justify-content: center;
	align-items: center;
	margin-top: 6px;
	position: relative;
}

.start-btn {
	background: var(--accent);
	color: var(--accent-ink);
	border: 0;
	border-radius: 10px;
	padding: 8px 12px;
	cursor: pointer;
	font-weight: 700;
	letter-spacing: 0.2px;
	transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	overflow: hidden;
}

.start-btn::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		135deg,
		rgba(255, 255, 255, 0.2) 0%,
		transparent 50%
	);
	opacity: 0;
	transition: opacity 0.15s ease;
}

.start-btn:hover {
	filter: brightness(1.08);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(255, 138, 61, 0.35);
}

.start-btn:hover::after {
	opacity: 1;
}

.start-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(255, 138, 61, 0.25);
}

/* Difficulty badge */
.badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 8px;
	background: #202020;
	color: #ddd;
	border: 1px solid var(--line);
	border-radius: 999px;
	font-weight: 600;
	font-size: 11px;
}

.badge .dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #45d07b;
}

.badge.easy .dot {
	background: #45d07b;
}

.badge.normal .dot {
	background: #ffd166;
}

.badge.hard .dot {
	background: #ff5a5a;
}

/* MIDI floating badge (bottom-right) */
.midi-floating {
	position: fixed;
	right: 14px;
	bottom: 14px;
	z-index: 60;
	padding: 6px 10px;
	border-radius: 999px;
	font-size: 12px;
	border: 1px solid var(--line);
	background: #171717;
	color: var(--muted);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
	pointer-events: none;
}

.melody-actions .actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.listen-btn {
	background: #262626;
	color: #e6e6e6;
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 8px 10px;
	cursor: pointer;
	font-weight: 700;
	letter-spacing: 0.2px;
	line-height: 1;
	position: absolute;
	right: 0;
	bottom: 0;
}

.listen-btn:hover {
	filter: brightness(1.06);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
	.header-inner {
		padding: 10px 12px;
	}

	#volumeRange {
		width: 140px;
	}
}

@media (max-width: 860px) {
	#volumeRange {
		width: 120px;
	}
}

@media (max-width: 720px) {
	.header-inner {
		gap: 8px;
	}

	.header-controls {
		gap: 8px;
	}

	.segmented label {
		width: 38px;
		height: 32px;
	}

	#volumeRange {
		width: 100px;
	}
}

@media (max-width: 600px) {
	.brand-name {
		display: none;
	}

	#volumeRange {
		width: 86px;
	}
}

@media (max-width: 480px) {
	.lang-switch {
		display: none;
	}

	/* экономим место на очень узких экранах — язык можно сменить в большем окне */
}

@media (max-width: 980px) {
	.melody-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.melody-grid {
		grid-template-columns: 1fr;
	}
}
