/**
 * Stage view. Operated on a phone on a music stand, in the dark, with one
 * hand, in the middle of a song. Big targets, no clutter, no dialogs.
 */

:root {
	--st-bg: #0d0d10;
	--st-surface: #17171b;
	--st-surface-2: #1f1f25;
	--st-accent: #ff3f6e;
	--st-accent-2: #ffb800;
	--st-text: #f4f3ef;
	--st-muted: #8b8b93;
	--st-border: #2a2a30;
	--st-font-head: "Oswald", "Helvetica Neue", Impact, system-ui, sans-serif;
	--st-font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--st-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

[hidden] {
	display: none !important;
}

html,
body {
	margin: 0;
	padding: 0;
}

.st-body {
	min-height: 100vh;
	padding-bottom: 96px;
	background: var(--st-bg);
	color: var(--st-text);
	font-family: var(--st-font-body);
	font-size: 16px;
	line-height: 1.4;
	-webkit-text-size-adjust: 100%;
	-webkit-tap-highlight-color: transparent;
}

:focus-visible {
	outline: 3px solid var(--st-accent-2);
	outline-offset: 2px;
}

/* ---------------------------------------------------------- login screen */

.st-body--login {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 24px 20px 80px;
}

.st-login {
	width: 100%;
	max-width: 380px;
}

.st-login__title {
	margin: 0 0 22px;
	font-family: var(--st-font-head);
	font-size: 26px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	text-align: center;
}

.st-login__form {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.st-login__label {
	font-size: 13px;
	color: var(--st-muted);
}

.st-login__row {
	display: flex;
	gap: 8px;
}

.st-login__input {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 52px;
	padding: 0 14px;
	font-family: var(--st-font-mono);
	font-size: 18px;
	color: var(--st-text);
	background: var(--st-surface);
	border: 1px solid var(--st-border);
	border-radius: 10px;
}

.st-login__peek {
	flex: 0 0 auto;
	min-height: 52px;
	padding: 0 14px;
	font-family: var(--st-font-body);
	font-size: 13px;
	color: var(--st-muted);
	background: none;
	border: 1px solid var(--st-border);
	border-radius: 10px;
	cursor: pointer;
}

.st-login__submit {
	min-height: 52px;
	margin-top: 4px;
	font-family: var(--st-font-head);
	font-size: 17px;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: #fff;
	background: var(--st-accent);
	border: 0;
	border-radius: 10px;
	cursor: pointer;
}

.st-login__error {
	margin: 18px 0 0;
	text-align: center;
	font-size: 15px;
	color: var(--st-accent-2);
}

/* Second way in: a WordPress account. Clearly separated from the code form,
   clearly subordinate to it - on stage the code is the faster path. */
.st-login__alt {
	margin-top: 26px;
	text-align: center;
}

.st-login__or {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 16px;
	font-size: 12px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--st-muted);
}

.st-login__or::before,
.st-login__or::after {
	content: "";
	flex: 1 1 auto;
	height: 1px;
	background: var(--st-border);
}

.st-login__wp {
	display: inline-block;
	min-height: 44px;
	padding: 12px 18px;
	font-size: 15px;
	color: var(--st-text);
	text-decoration: none;
	background: var(--st-surface);
	border: 1px solid var(--st-border);
	border-radius: 10px;
}

.st-login__wp:hover,
.st-login__wp:focus-visible {
	border-color: var(--st-muted);
}

.st-login__note {
	margin: 12px 0 0;
	font-size: 13px;
	line-height: 1.45;
	color: var(--st-muted);
}

/* --------------------------------------------------------------- header */

/* Header and tabs share one sticky container: on narrow phones the header
   wraps to two lines, and two independent sticky elements would overlap. */
/* The sticky bar carries the background and the closing rule; its rows are
   pure layout so they can be width-constrained on wide screens. */
.st-topbar {
	position: sticky;
	top: 0;
	z-index: 30;
	background: rgba(13, 13, 16, 0.97);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--st-border);
}

/* No wrapping: the title truncates instead of pushing the set switcher onto
   a second line. The sticky bar already carries three rows. */
.st-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 6px 12px;
}

.st-head__title {
	flex: 1 1 auto;
	min-width: 0;
}

.st-head__event {
	display: block;
	font-family: var(--st-font-head);
	font-size: 15px;
	font-weight: 500;
	text-transform: uppercase;
	line-height: 1.1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.st-head__meta {
	display: block;
	font-size: 12px;
	color: var(--st-muted);
}

.st-head__meta span {
	font-family: var(--st-font-mono);
	color: var(--st-text);
}

.st-switch {
	flex: 0 0 auto;
	display: flex;
	border: 1px solid var(--st-border);
	border-radius: 10px;
	overflow: hidden;
}

.st-switch__btn {
	min-width: 40px;
	min-height: 44px;
	padding: 0 6px;
	font-family: var(--st-font-body);
	font-size: 12px;
	color: var(--st-muted);
	background: var(--st-surface);
	border: 0;
	border-right: 1px solid var(--st-border);
	cursor: pointer;
}

.st-switch__btn:last-child {
	border-right: 0;
}

.st-switch__btn--active {
	color: #fff;
	background: var(--st-accent);
}

/* ------------------------------------------------------- status switcher */

.st-status {
	display: flex;
	gap: 5px;
	padding: 0 12px 6px;
}

.st-status__btn {
	flex: 1 1 0;
	min-width: 0;
	min-height: 44px;
	padding: 0 4px;
	font-family: var(--st-font-body);
	font-size: 13px;
	line-height: 1.1;
	color: var(--st-muted);
	background: var(--st-surface);
	border: 1px solid var(--st-border);
	border-radius: 9px;
	cursor: pointer;
}

.st-status__btn--active {
	color: #fff;
	font-weight: 600;
	background: var(--st-accent);
	border-color: var(--st-accent);
}

/* "Vorbei" closes the poll, so it gets its own colour instead of the accent. */
.st-status__btn--active[data-status="ended"] {
	color: #1a1204;
	background: var(--st-accent-2);
	border-color: var(--st-accent-2);
}

/*
 * The emergency stop lives down in the footer, far away from the status
 * buttons - mistaking it for "Pause" is the expensive error. Its state on the
 * other hand has to be impossible to miss, hence this banner.
 */
.st-alarm {
	margin: 0;
	padding: 7px 14px;
	font-size: 13px;
	font-weight: 600;
	color: #1a1204;
	background: var(--st-accent-2);
}

/* ----------------------------------------------------------------- tabs */

.st-tabs {
	display: flex;
	border-bottom: 1px solid var(--st-border);
}

/*
 * flex-basis auto instead of 0: "Wunschkonzert" needs more room than
 * "Opening", and three equal thirds forced it onto a second line.
 */
.st-tab {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 44px;
	padding: 6px 6px;
	font-family: var(--st-font-head);
	font-size: 13px;
	white-space: nowrap;
	text-transform: uppercase;
	letter-spacing: 0.01em;
	color: var(--st-muted);
	background: none;
	border: 0;
	border-bottom: 3px solid transparent;
	cursor: pointer;
}

.st-tab--active {
	color: var(--st-text);
	border-bottom-color: var(--st-accent);
}

.st-tab__count {
	display: inline-block;
	min-width: 19px;
	margin-left: 5px;
	padding: 1px 5px;
	font-family: var(--st-font-mono);
	font-size: 11px;
	color: var(--st-text);
	background: var(--st-surface-2);
	border-radius: 20px;
}

/* ----------------------------------------------------------------- list */

.st-main {
	padding: 12px;
}

.st-empty {
	margin: 40px 0;
	text-align: center;
	color: var(--st-muted);
}

.st-list {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
}

.st-item {
	position: relative;
	margin-bottom: 8px;
	padding: 10px 12px;
	background: var(--st-surface);
	border: 1px solid var(--st-border);
	border-radius: 12px;
	overflow: hidden;
	transition: transform 260ms ease, border-color 160ms ease;
}

/* The next planned song in opening and finale. */
.st-item--next {
	border-color: var(--st-accent);
	background: var(--st-surface-2);
}

/*
 * The ranking bar is a 3px track along the bottom edge, not a wash across the
 * card. A card filled to 100% read as "selected" instead of "leader", and at a
 * middling value the hard edge looked like a rendering glitch.
 * ::before paints before the real element, so the fill sits on top of the track.
 */
.st-item--ranked::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	background: var(--st-border);
}

.st-item__bar {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 0;
	height: 3px;
	background: var(--st-accent);
	transition: width 400ms ease;
	pointer-events: none;
}

.st-item__head {
	position: relative;
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 8px;
}

.st-item__rank {
	flex: 0 0 auto;
	min-width: 26px;
	font-family: var(--st-font-mono);
	font-size: 15px;
	color: var(--st-muted);
}

.st-item__body {
	flex: 1 1 auto;
	min-width: 0;
}

.st-item__title {
	display: block;
	font-family: var(--st-font-head);
	font-size: 18px;
	font-weight: 500;
	line-height: 1.15;
	word-break: break-word;
}

.st-item__artist {
	display: block;
	font-size: 13px;
	color: var(--st-muted);
}

.st-item__votes {
	flex: 0 0 auto;
	font-family: var(--st-font-mono);
	font-size: 19px;
	color: var(--st-accent);
}

.st-item__votes small {
	font-size: 11px;
	color: var(--st-muted);
}

.st-item__actions {
	position: relative;
	display: flex;
	align-items: stretch;
	gap: 10px;
}

/*
 * Deliberately quiet: no fill, no uppercase, smaller. It must never be mistaken
 * for the play button, so it also sits beside it rather than above or below -
 * a sideways miss is far less likely than a vertical one.
 */
.st-move {
	flex: 0 0 auto;
	min-height: 44px;
	align-self: center;
	padding: 0 10px;
	font-family: var(--st-font-body);
	font-size: 12.5px;
	color: var(--st-muted);
	background: none;
	border: 1px solid var(--st-border);
	border-radius: 9px;
	cursor: pointer;
	white-space: nowrap;
}

.st-move:disabled {
	opacity: 0.5;
	cursor: default;
}

.st-play {
	position: relative;
	display: block;
	flex: 1 1 auto;
	width: 100%;
	min-height: 52px;
	padding: 0 14px;
	font-family: var(--st-font-head);
	font-size: 16px;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: #fff;
	background: var(--st-accent);
	border: 0;
	border-radius: 10px;
	cursor: pointer;
}

.st-play:disabled {
	opacity: 0.5;
	cursor: default;
}

.st-item--next .st-play {
	font-size: 17px;
	min-height: 56px;
}

/* --------------------------------------------------------- played songs */

.st-done {
	margin-top: 22px;
	border-top: 1px solid var(--st-border);
	padding-top: 12px;
	color: var(--st-muted);
}

.st-done summary {
	min-height: 44px;
	display: flex;
	align-items: center;
	font-size: 15px;
	cursor: pointer;
}

.st-done__list {
	margin: 4px 0 0;
	padding-left: 24px;
	font-size: 15px;
}

.st-done__list li {
	padding: 4px 0;
	text-decoration: line-through;
}

/* ---------------------------------------------------------------- toast */

.st-toast {
	position: fixed;
	left: 12px;
	right: 12px;
	bottom: 12px;
	z-index: 60;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	background: var(--st-surface-2);
	border: 1px solid var(--st-accent);
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.st-toast__text {
	flex: 1 1 auto;
	font-size: 15px;
}

.st-toast__undo {
	flex: 0 0 auto;
	min-height: 44px;
	padding: 0 16px;
	font-family: var(--st-font-head);
	font-size: 15px;
	text-transform: uppercase;
	color: #0d0d10;
	background: var(--st-accent-2);
	border: 0;
	border-radius: 8px;
	cursor: pointer;
}

/* --------------------------------------------------------------- footer */

.st-foot {
	display: flex;
	flex-direction: column;
	gap: 18px;
	margin-top: 30px;
	padding: 14px;
	font-size: 12px;
	color: var(--st-muted);
	border-top: 1px solid var(--st-border);
}

.st-foot__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.st-foot__stop {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	padding-top: 16px;
	border-top: 1px dashed var(--st-border);
}

.st-stop {
	min-height: 44px;
	padding: 0 14px;
	font-family: var(--st-font-body);
	font-size: 13px;
	color: var(--st-muted);
	background: none;
	border: 1px solid var(--st-border);
	border-radius: 9px;
	cursor: pointer;
}

.st-stop--active {
	color: #1a1204;
	font-weight: 600;
	background: var(--st-accent-2);
	border-color: var(--st-accent-2);
}

.st-foot__hint {
	max-width: 46ch;
	line-height: 1.45;
}

.st-foot code {
	font-family: var(--st-font-mono);
	color: var(--st-text);
}

.st-foot__link {
	color: var(--st-muted);
}

@media (min-width: 720px) {
	/* Same column as the list, so the controls do not stretch across a laptop. */
	.st-main,
	.st-head,
	.st-status,
	.st-tabs,
	.st-foot {
		max-width: 780px;
		margin-left: auto;
		margin-right: auto;
	}

	.st-alarm {
		text-align: center;
	}

	.st-head__event {
		font-size: 20px;
	}

	.st-tab {
		font-size: 15px;
	}

	.st-item__title {
		font-size: 20px;
	}

	.st-play {
		min-height: 56px;
		font-size: 17px;
	}
}

@media (prefers-reduced-motion: reduce) {
	* {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}
