:root {
	--bg: #07040d;
	--panel: rgba(18, 10, 32, 0.82);
	--edge: rgba(255, 255, 255, 0.12);
	--text: #f4eefe;
	--muted: #a99cc4;
	--hot: #ff3fa4;
	--cool: #3ad7ff;
	--gold: #ffd23a;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	height: 100%;
	overflow: hidden;
	background: var(--bg);
	color: var(--text);
	font-family: "Segoe UI", system-ui, sans-serif;
}

#stage {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	touch-action: none;
}

button, a, .song-card { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.screen {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
	z-index: 2;
}
.screen.active { display: flex; }
.screen.overlay { background: rgba(5, 2, 10, 0.55); backdrop-filter: blur(3px); }

.panel {
	background: var(--panel);
	border: 1px solid var(--edge);
	border-radius: 18px;
	padding: 28px 32px;
	max-width: 560px;
	width: 100%;
	box-shadow: 0 0 60px rgba(255, 63, 164, 0.15), 0 20px 60px rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(8px);
	max-height: 100%;
	min-width: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
}
.panel.wide { max-width: 860px; }

h2 { margin: 0 0 16px; letter-spacing: 0.04em; }

.logo {
	font-size: clamp(48px, 10vw, 96px);
	font-weight: 900;
	font-style: italic;
	margin: 0;
	letter-spacing: 0.02em;
	text-shadow: 0 0 18px rgba(58, 215, 255, 0.8), 0 0 48px rgba(58, 215, 255, 0.4);
}
.logo span {
	color: var(--hot);
	text-shadow: 0 0 18px rgba(255, 63, 164, 0.8), 0 0 48px rgba(255, 63, 164, 0.4);
}
.title-panel { text-align: center; background: rgba(10, 5, 20, 0.6); }
.tagline { color: var(--muted); margin: 4px 0 20px; font-size: 18px; }

.pill {
	display: inline-block;
	padding: 6px 14px;
	border-radius: 999px;
	border: 1px solid var(--edge);
	color: var(--muted);
	font-size: 14px;
	margin-bottom: 20px;
}
.pill.ok { color: #7dffb0; border-color: rgba(125, 255, 176, 0.4); }
.pill.warn { color: var(--gold); border-color: rgba(255, 210, 58, 0.4); }

.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.btn-row.vertical { flex-direction: column; align-items: stretch; }

.btn {
	font: inherit;
	font-weight: 700;
	font-size: 16px;
	color: var(--text);
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid var(--edge);
	border-radius: 12px;
	padding: 12px 22px;
	cursor: pointer;
	transition: transform 0.08s, background 0.15s, box-shadow 0.15s;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
.btn.primary {
	background: linear-gradient(135deg, #ff3fa4, #a64bff);
	border-color: transparent;
	box-shadow: 0 0 24px rgba(255, 63, 164, 0.45);
}
.btn.primary:hover { box-shadow: 0 0 36px rgba(255, 63, 164, 0.7); }

.hint { color: var(--muted); font-size: 13px; line-height: 1.6; margin-top: 18px; }
kbd {
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid var(--edge);
	border-radius: 4px;
	padding: 1px 5px;
	font-size: 12px;
}

.row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 12px 0;
	border-bottom: 1px solid var(--edge);
}
.row small { color: var(--muted); }
.row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--hot); }
.row input[type="number"] { width: 80px; font: inherit; background: #1a1030; color: var(--text); border: 1px solid var(--edge); border-radius: 6px; padding: 4px 8px; }
.row input[type="range"] { accent-color: var(--hot); }
.row select { font: inherit; background: #1a1030; color: var(--text); border: 1px solid var(--edge); border-radius: 6px; padding: 4px 6px; max-width: 100%; }
.kb-pick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.kb-pick .btn { padding: 6px 12px; }

.song-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.song-card {
	text-align: left;
	font: inherit;
	color: var(--text);
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid var(--edge);
	border-radius: 14px;
	padding: 14px;
	cursor: pointer;
	transition: border-color 0.15s, box-shadow 0.15s, transform 0.08s;
}
.song-card:hover { transform: translateY(-2px); }
.song-card.on { border-color: var(--hot); box-shadow: 0 0 24px rgba(255, 63, 164, 0.35); }
.song-card .t { font-weight: 800; font-size: 17px; }
.song-card .a { color: var(--muted); font-size: 13px; margin: 2px 0 8px; }
.song-card .d { color: var(--gold); letter-spacing: 2px; }
.song-card .b { color: var(--muted); font-size: 12px; margin-top: 6px; }

.options { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 22px; }
.opt-group { display: flex; flex-direction: column; gap: 6px; }
.opt-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; }
.seg { display: inline-flex; border: 1px solid var(--edge); border-radius: 10px; overflow: hidden; }
.seg button {
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	color: var(--muted);
	background: transparent;
	border: 0;
	padding: 8px 14px;
	cursor: pointer;
}
.seg button.on { background: rgba(255, 63, 164, 0.25); color: var(--text); }
.seg button:disabled { opacity: 0.3; cursor: not-allowed; }

.cal-pulse {
	width: 120px;
	height: 120px;
	margin: 24px auto;
	border-radius: 50%;
	border: 3px solid var(--cool);
	box-shadow: 0 0 30px rgba(58, 215, 255, 0.4);
	transition: transform 0.06s, background 0.06s;
}
.cal-pulse.beat { transform: scale(1.15); background: rgba(58, 215, 255, 0.35); }
.big { text-align: center; font-size: 22px; font-weight: 700; min-height: 1.4em; }

.stars { text-align: center; font-size: 48px; letter-spacing: 6px; margin: 8px 0; }
.stars .s { color: rgba(255, 255, 255, 0.15); display: inline-block; }
.stars .s.lit { color: var(--gold); text-shadow: 0 0 20px rgba(255, 210, 58, 0.8); animation: pop 0.4s both; }
@keyframes pop { 0% { transform: scale(0.2); opacity: 0; } 70% { transform: scale(1.3); } 100% { transform: scale(1); opacity: 1; } }
.res-score { text-align: center; font-size: 44px; font-weight: 900; font-variant-numeric: tabular-nums; }
.best-badge {
	display: none;
	margin: 6px auto 0;
	width: max-content;
	padding: 4px 12px;
	border-radius: 999px;
	background: var(--gold);
	color: #1a1000;
	font-weight: 800;
	font-size: 12px;
	letter-spacing: 0.1em;
}
.best-badge.show { display: block; animation: pop 0.5s 0.6s both; }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; margin: 20px 0 0; font-variant-numeric: tabular-nums; }
.res-grid div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--edge); padding: 4px 0; }
.res-grid span:first-child { color: var(--muted); }
.tip { color: var(--cool); text-align: center; margin-top: 18px; line-height: 1.5; }

.btn.small { padding: 8px 14px; font-size: 14px; }
.import-bar { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.import-bar input[type="url"], .row input[type="text"] {
	flex: 1;
	min-width: 200px;
	font: inherit;
	font-size: 14px;
	color: var(--text);
	background: #1a1030;
	border: 1px solid var(--edge);
	border-radius: 10px;
	padding: 8px 12px;
}
.pick-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; max-height: 45vh; overflow-y: auto; }
.pick {
	display: flex;
	align-items: center;
	gap: 10px;
	text-align: left;
	font: inherit;
	font-size: 14px;
	color: var(--text);
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid var(--edge);
	border-radius: 10px;
	padding: 8px 12px;
	cursor: pointer;
}
.pick.on { border-color: var(--hot); background: rgba(255, 63, 164, 0.12); }
.pick .meta { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.pick .word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-card { position: relative; }
.song-card .del {
	position: absolute;
	top: 6px;
	right: 8px;
	color: var(--muted);
	font-size: 16px;
	padding: 2px 6px;
	border-radius: 6px;
}
.song-card .del:hover { color: var(--hot); background: rgba(255, 255, 255, 0.08); }
.drop-hint {
	position: fixed;
	inset: 16px;
	z-index: 10;
	display: none;
	align-items: center;
	justify-content: center;
	border: 3px dashed var(--hot);
	border-radius: 24px;
	background: rgba(20, 5, 30, 0.85);
	font-size: 28px;
	font-weight: 800;
	pointer-events: none;
}
.drop-hint.show { display: flex; }

/* Find songs: source links */
a.pick { text-decoration: none; color: inherit; }
#find-sources .pick .meta { white-space: normal; text-align: right; max-width: 60%; }

/* Setlist genre filter */
.seg.genre { display: flex; flex-wrap: wrap; margin: 0 0 10px; }

/* Recording import progress */
.bar { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin: 14px 0 6px; }
.bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--hot), #59e1ff); transition: width 0.3s; }

.mic-row { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 12px; min-height: 36px; }
.mic-meter { width: 120px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.mic-meter > div { height: 100%; width: 0; background: linear-gradient(90deg, #7dffb0, var(--gold)); transition: width 0.05s linear; }
.mic-heard { color: #7dffb0; font-size: 14px; min-width: 6em; text-align: left; font-variant-numeric: tabular-nums; }
.mic-heard:empty { display: none; }
.mic-check { color: var(--muted); font-size: 13px; }

/* --- Corner controls, toast ------------------------------------------------------- */
.corner {
	position: fixed;
	top: max(10px, env(safe-area-inset-top));
	right: max(10px, env(safe-area-inset-right));
	display: flex;
	gap: 8px;
	z-index: 5;
}
.corner[hidden] { display: none; }
/* In a game: centered, below the song title and above the highway. */
body.playing .corner { right: auto; left: 50%; transform: translateX(-50%); top: calc(max(8px, env(safe-area-inset-top)) + 52px); }
.round {
	width: 40px; height: 40px;
	border-radius: 50%;
	border: 1px solid var(--edge);
	background: rgba(10, 5, 20, 0.6);
	color: var(--text);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	backdrop-filter: blur(6px);
}
.round:hover { background: rgba(255, 255, 255, 0.12); }
.toast {
	position: fixed;
	left: 50%;
	bottom: max(20px, env(safe-area-inset-bottom));
	transform: translateX(-50%);
	max-width: min(440px, calc(100% - 32px));
	background: rgba(18, 10, 32, 0.95);
	border: 1px solid var(--edge);
	border-radius: 12px;
	padding: 12px 16px;
	font-size: 14px;
	line-height: 1.5;
	z-index: 6;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

/* --- Touch screens and small screens --------------------------------------------- */
.touch-only { display: none; }
@media (hover: none) and (pointer: coarse) {
	.touch-only { display: inline; }
	.no-touch { display: none; }
	.btn:hover, .song-card:hover { transform: none; }
}
@media (max-width: 600px) {
	.panel { padding: 20px 16px; border-radius: 14px; }
	.btn { padding: 12px 18px; }
	.tagline { font-size: 16px; }
	.res-grid { grid-template-columns: 1fr; }
	.options { gap: 12px; }
	.seg button { padding: 8px 10px; }
}
@media (max-height: 520px) {
	.panel { padding: 16px 20px; }
	.logo { font-size: 44px; }
	.tagline { margin: 0 0 10px; font-size: 15px; }
	.btn-row { margin-top: 12px; }
	.mic-row { margin-top: 8px; }
	h2 { margin-bottom: 10px; }
	.stars { font-size: 34px; margin: 4px 0; }
	.res-score { font-size: 32px; }
}
