/* Replay mode: the game screen playing back a recorded match, with playback controls in place of spells */

.replay-panel {
	display: none;
	flex-direction: column;
	gap: 10px;
	padding: 10px;
	background: rgba(20, 23, 31, 0.9);
	border: 1px solid rgba(255, 255, 255, 0.05);
	border-radius: 16px;
}

.replay-mode .replay-panel {
	display: flex;
}

.replay-mode .spell-panel {
	display: none;
}

/* Both players' mana, laid out like their health: host left, guest right */
.hud-opponent-mana {
	display: none;
}

.replay-mode .hud-opponent-mana {
	display: block;
	color: var(--danger);
}

.replay-mode #local-mana {
	order: -1;
	color: var(--accent-light);
}

.replay-mode .hud-row {
	gap: 8px;
	white-space: nowrap;
}

.replay-progress {
	height: 4px;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.08);
	overflow: hidden;
}

/* Scaled rather than resized each frame, which needs no layout */
.replay-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--accent), var(--accent-light));
	transform: scaleX(0);
	transform-origin: left;
}

.replay-summary {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.replay-matchup {
	font-weight: 600;
}

.replay-details {
	font-size: 0.8rem;
	color: var(--muted);
}

.replay-controls {
	display: flex;
	align-items: center;
	gap: 8px;
}

.replay-play {
	min-width: 84px;
}

.replay-speeds {
	flex: 1;
	display: flex;
	gap: 2px;
	padding: 2px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 10px;
	background: rgba(15, 17, 25, 0.8);
}

.replay-speed {
	flex: 1;
	height: 30px;
	padding: 0 4px;
	background: transparent;
	color: var(--muted);
	text-transform: none;
	letter-spacing: 0;
}

.replay-speed[aria-pressed="true"] {
	background: rgba(124, 92, 255, 0.3);
	color: var(--text);
	box-shadow: inset 0 0 0 1px var(--accent);
}

.replay-log {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 0.85rem;
}

.replay-log:empty::before {
	content: 'Spells will appear here as they are cast.';
	color: var(--muted);
}

.replay-log li {
	display: flex;
	gap: 6px;
	align-items: baseline;
}

.replay-log li:first-child {
	animation: replay-log-in 300ms ease-out;
}

.replay-log-turn {
	flex: none;
	min-width: 2.6em;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

.replay-log-who {
	flex: none;
	font-weight: 600;
}

.replay-log-host .replay-log-who {
	color: var(--accent-light);
}

.replay-log-guest .replay-log-who {
	color: var(--danger);
}

@keyframes replay-log-in {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
}

.replay-actions {
	display: flex;
	gap: 8px;
}

.replay-actions button {
	flex: 1;
}

.replay-end-detail {
	font-size: 1.1rem;
	text-align: center;
	color: #fff;
}

.replay-end-note {
	max-width: 36ch;
	margin: 0;
	font-size: 0.9rem;
	text-align: center;
	color: #ffd08a;
}

.replay-end-note.hidden {
	display: none;
}

.replay-end-buttons {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
}

@media (prefers-reduced-motion: reduce) {
	.replay-log li:first-child {
		animation: none;
	}
}

/* Phones: keep the panel short so the lanes keep their room */
@media (max-width: 767px) {
	.replay-panel {
		gap: 8px;
		padding: 8px;
	}

	.replay-log li:nth-child(n + 4) {
		display: none;
	}
}

/* Narrow phones: "Turn 58 / 120" and both players' mana need a full line each */
@media (max-width: 479px) {
	.replay-mode .hud {
		grid-template-columns: 1fr;
	}

	.replay-details {
		display: none;
	}
}
