/* P2Xstudio V2 — players: video frame + idle matrix/plasma, audio visualiser. */

/* ── Video ────────────────────────────────────────────────────────────── */

.video-wrapper {
	position: relative;
	padding-bottom: 56.25%;
	margin-bottom: 25px;
	border-radius: var(--radius-md);
	background: linear-gradient(145deg, rgba(0, 50, 20, 0.6), var(--panel-deep));
	transition: all var(--transition-slow) ease;
	box-shadow:
		inset 0 0 20px var(--xeno-green-20),
		0 0 25px var(--xeno-green-40);
}

.video-wrapper iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: none;
	border-radius: 18px;
	max-width: none;
}

.video-wrapper.switching {
	opacity: 0.1;
	transform: scale(0.9);
	filter: blur(4px);
}

.video-error {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: var(--overlay-deep);
	border-radius: var(--radius-md);
	pointer-events: none;
}

.video-error.visible {
	display: flex;
}

.error-box {
	color: var(--xeno-green);
	text-align: center;
	font-size: 14px;
	letter-spacing: 2px;
	text-shadow:
		0 0 10px var(--xeno-green),
		0 0 20px var(--xeno-green-soft);
	animation: errorPulse 1.5s infinite;
}

@keyframes errorPulse {
	0% {
		opacity: 0.6;
	}
	50% {
		opacity: 1;
	}
	100% {
		opacity: 0.6;
	}
}

/* ── Video idle (matrix + plasma mix) ─────────────────────────────────── */

.video-idle {
	position: absolute;
	inset: 0;
	border-radius: var(--radius-md);
	overflow: hidden;
	z-index: 2;
	pointer-events: none;
	background:
		radial-gradient(circle at 30% 40%, rgba(0, 255, 100, 0.15), transparent 50%),
		radial-gradient(circle at 70% 60%, rgba(0, 255, 100, 0.08), transparent 60%);
	animation: plasmaMove 8s ease-in-out infinite alternate;
}

#matrixCanvas {
	width: 100%;
	height: 100%;
	display: block;
	opacity: 0.25;
	mix-blend-mode: screen;
}

@keyframes plasmaMove {
	0% {
		transform: scale(1);
		filter: blur(0);
	}
	100% {
		transform: scale(1.1);
		filter: blur(6px);
	}
}

/* ── Audio ────────────────────────────────────────────────────────────── */

.audio-wrapper {
	margin-bottom: 25px;
	padding: 20px;
}

.audio-visual {
	height: 60px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bars {
	display: flex;
	gap: 6px;
}

.bars span {
	width: 6px;
	height: 20px;
	background: var(--xeno-green);
	border-radius: 4px;
	animation: equalize 1s infinite ease-in-out;
}

/* Paused while nothing is playing: the visualiser only runs on .playing. */
.audio-wrapper:not(.playing) .bars span {
	animation-play-state: paused;
}

.bars span:nth-child(2) {
	animation-delay: 0.1s;
}
.bars span:nth-child(3) {
	animation-delay: 0.2s;
}
.bars span:nth-child(4) {
	animation-delay: 0.3s;
}
.bars span:nth-child(5) {
	animation-delay: 0.4s;
}
.bars span:nth-child(6) {
	animation-delay: 0.5s;
}
.bars span:nth-child(7) {
	animation-delay: 0.6s;
}
.bars span:nth-child(8) {
	animation-delay: 0.7s;
}

@keyframes equalize {
	0% {
		height: 10px;
		opacity: 0.5;
	}
	50% {
		height: 50px;
		opacity: 1;
	}
	100% {
		height: 15px;
		opacity: 0.6;
	}
}

.audio-title {
	text-align: center;
	font-size: 12px;
	letter-spacing: 2px;
	margin-top: 10px;
	text-shadow: 0 0 10px var(--xeno-green);
}

.audio-controls {
	display: flex;
	justify-content: center;
	gap: 12px;
	margin-top: 10px;
}

.audio-controls button {
	background: none;
	border: 1px solid var(--xeno-green);
	color: var(--xeno-green);
	padding: 6px 12px;
	border-radius: 10px;
	cursor: pointer;
	font-size: 12px;
	transition: var(--transition-fast);
}

.audio-controls button:hover,
.audio-controls button:focus {
	background: var(--xeno-green);
	color: var(--xeno-ink);
	box-shadow: 0 0 12px var(--xeno-green);
}
