/* ── Raid battle diorama (raid-battle-visuals.md §2) ─────────────────────────
   The WoW-boss-in-a-Pokémon-arena scene rendered inside the raid HUD panel.
   FX vocabulary (duel-sprite, duel-fx-*, duel-act--*, duel-react--*, hitflash,
   shake, freeze) comes from play-duel.css — this file owns only the raid scene's
   layout: boss frame, arena, front-line slots, crowd silhouette. */

.rb-scene {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	margin: 0.55rem 0 0.65rem;
}

/* ── §2.1 Boss frame: name · phase pips · enrage · full-width HP ── */
.rb-bossframe {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.rb-bossframe-row {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	min-width: 0;
}

.rb-boss-skull {
	font-size: 0.85rem;
	filter: drop-shadow(0 0 6px rgba(255, 80, 80, 0.5));
}

.rb-boss-title {
	font-weight: 800;
	font-size: 0.86rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #f3ead2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
}

.rb-phase-pips {
	display: inline-flex;
	gap: 4px;
	flex: none;
}

.rb-pip {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	border: 1px solid rgba(255, 255, 255, 0.25);
}

.rb-pip.is-lit {
	background: linear-gradient(180deg, #ffd166, #d99e06);
	border-color: #ffd166;
	box-shadow: 0 0 6px rgba(255, 209, 102, 0.7);
}

.rb-enrage {
	flex: none;
	font-size: 0.62rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	color: #ff8a7a;
	border: 1px solid rgba(255, 107, 107, 0.55);
	border-radius: 4px;
	padding: 0.1rem 0.3rem;
	animation: rbEnragePulse 1.1s ease-in-out infinite;
}

@keyframes rbEnragePulse {
	0%, 100% { opacity: 1; box-shadow: 0 0 4px rgba(255, 107, 107, 0.35); }
	50% { opacity: 0.65; box-shadow: 0 0 10px rgba(255, 107, 107, 0.7); }
}

/* Pre-finale countdown form: quiet chrome, no pulse — informational, not alarm. */
.rb-enrage--calm {
	color: rgba(243, 234, 210, 0.6);
	border-color: rgba(255, 255, 255, 0.18);
	animation: none;
}

.rb-castbar[hidden] {
	display: none;
}

.rb-boss-hptext {
	margin-left: auto;
	flex: none;
	font-variant-numeric: tabular-nums;
}

.rb-boss-track {
	height: 10px;
	border-radius: 5px;
}

/* ── V3 cast bar (hidden until the boss telegraphs) ── */
.rb-castbar {
	position: relative;
	height: 14px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid rgba(255, 170, 80, 0.35);
	overflow: hidden;
}

.rb-castbar-fill {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0%;
	background: linear-gradient(90deg, #b35900, #ff9f43);
	box-shadow: 0 0 10px rgba(255, 159, 67, 0.5);
}

.rb-castbar-label {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.62rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #ffe3c2;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

/* ── §2 The arena diorama ── */
.rb-arena {
	position: relative;
	height: clamp(220px, 38vw, 300px);
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.09);
}

.rb-scene--compact .rb-arena {
	height: clamp(170px, 34vw, 220px);
}

/* Backdrop cascade: per-show backdrop → per-park duel arena → mood gradients.
   Missing images 404 invisibly and the next layer shows through. */
.rb-arena-bg {
	position: absolute;
	inset: 0;
	background:
		var(--rb-backdrop-img) center / cover no-repeat,
		var(--rb-arena-img) center / cover no-repeat,
		radial-gradient(120% 70% at 50% 12%, rgba(98, 60, 160, 0.45), transparent 60%),
		radial-gradient(130% 80% at 50% 100%, rgba(28, 80, 90, 0.5), transparent 65%),
		linear-gradient(180deg, #181228 0%, #221a36 55%, #101620 100%);
}

/* Phase tint (R3 escalation) + finale staging ride on top of the backdrop. */
.rb-phase-rising .rb-arena-bg::after,
.rb-phase-villains_turn .rb-arena-bg::after,
.rb-finale .rb-arena-bg::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
}
.rb-phase-rising .rb-arena-bg::after {
	background: rgba(150, 80, 200, 0.08);
}
.rb-phase-villains_turn .rb-arena-bg::after {
	background: rgba(200, 60, 60, 0.12);
}
.rb-finale .rb-arena-bg::after {
	background: radial-gradient(110% 80% at 50% 0%, rgba(255, 120, 60, 0.18), rgba(120, 20, 40, 0.12));
	animation: rbFinaleGlow 1.6s ease-in-out infinite;
}

@keyframes rbFinaleGlow {
	0%, 100% { opacity: 0.7; }
	50% { opacity: 1; }
}

.rb-field {
	position: absolute;
	inset: 0;
	z-index: 1;
}

.rb-ground {
	position: absolute;
	inset: auto 0 0 0;
	height: 38%;
	background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.38));
}

/* ── Combatants: boss planted upper-center, front line along the bottom arc ── */
.rb-combatant {
	position: absolute;
	transform: translateX(-50%);
}

.rb-combatant--boss {
	left: 50%;
	bottom: 42%;
	z-index: 2;
}

.rb-sprite--boss {
	width: 132px;
	height: 132px;
	animation: duelBob 3.2s ease-in-out infinite;
}

.rb-sprite--boss .duel-sprite-emoji {
	font-size: 88px;
	line-height: 132px;
}

/* Front line: tank-ish left through dps right, slight depth stagger. */
.rb-combatant--fl {
	z-index: 4;
}
.rb-fl-0 { left: 14%; bottom: 7%; }
.rb-fl-1 { left: 32%; bottom: 4%; }
.rb-fl-2 { left: 50%; bottom: 8%; }
.rb-fl-3 { left: 68%; bottom: 4%; }
.rb-fl-4 { left: 86%; bottom: 7%; }

.rb-sprite--hero {
	width: 74px;
	height: 74px;
	animation: duelBob 3.8s ease-in-out infinite;
}

/* Desync idle bobs so the line breathes instead of marching. */
.rb-fl-1 .duel-sprite { animation-delay: 0.6s; }
.rb-fl-2 .duel-sprite { animation-delay: 1.2s; }
.rb-fl-3 .duel-sprite { animation-delay: 1.8s; }
.rb-fl-4 .duel-sprite { animation-delay: 2.4s; }

.rb-sprite--hero .duel-sprite-emoji {
	transform: scaleX(-1); /* back-view fallback faces the boss */
	font-size: 48px;
	line-height: 74px;
}

.rb-platform--fl {
	width: 120%;
	height: 18px;
	bottom: -8px;
}

/* You: a gold ring under your platform (reads at a glance, never shouts). */
.rb-combatant--fl.is-self .duel-platform {
	box-shadow: 0 0 16px 3px rgba(255, 209, 102, 0.35);
	background: radial-gradient(ellipse at center, rgba(255, 209, 102, 0.28), rgba(0, 0, 0, 0.25) 60%, transparent 75%);
}

/* KO'd: grayed out, grounded, skull tag (V4 polishes this further). */
.rb-combatant--fl.is-down .duel-sprite {
	filter: grayscale(1) brightness(0.55);
	animation: none;
	transform: translateY(6px) scale(0.92);
}

.rb-role-tag {
	position: absolute;
	left: 50%;
	bottom: -16px;
	transform: translateX(-50%);
	font-size: 0.66rem;
	line-height: 1;
	padding: 0.12rem 0.28rem;
	border-radius: 999px;
	background: rgba(10, 8, 20, 0.72);
	border: 1px solid rgba(255, 255, 255, 0.16);
	white-space: nowrap;
}

/* V4 threat read: the boss's current target wears a hovering crosshair. */
.rb-target-mark {
	position: absolute;
	left: 50%;
	top: -20px;
	transform: translateX(-50%);
	z-index: 5;
	font-size: 1.05rem;
	font-weight: 800;
	color: #ff8a7a;
	text-shadow: 0 0 8px rgba(255, 107, 107, 0.8);
	animation: rbTargetBob 0.9s ease-in-out infinite;
	pointer-events: none;
}

@keyframes rbTargetBob {
	0%, 100% { transform: translateX(-50%) translateY(0); }
	50% { transform: translateX(-50%) translateY(3px); }
}

.rb-combatant--fl.is-down .rb-role-tag {
	border-color: rgba(255, 107, 107, 0.5);
	color: #ff8a7a;
}

/* ── V4 §2.4 contribution meter: top-3 cumulative boss damage ── */
.rb-meter {
	display: flex;
	flex-direction: column;
	gap: 0.22rem;
	padding: 0.4rem 0.55rem;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.rb-meter-label {
	font-size: 0.62rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(243, 234, 210, 0.55);
}

.rb-meter-row {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.7rem;
	min-width: 0;
}

.rb-meter-row.is-self .rb-meter-name {
	color: #ffd166;
	font-weight: 700;
}

.rb-meter-medal {
	flex: none;
	font-size: 0.72rem;
}

.rb-meter-name {
	flex: 0 1 auto;
	min-width: 0;
	max-width: 38%;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: rgba(243, 234, 210, 0.85);
}

.rb-meter-track {
	flex: 1;
	height: 6px;
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.07);
	overflow: hidden;
}

.rb-meter-fill {
	display: block;
	height: 100%;
	border-radius: 3px;
	background: linear-gradient(90deg, #8a8f98, #c3c8d0);
	transition: width 0.6s cubic-bezier(0.25, 0.8, 0.4, 1);
}

.rb-meter-fill.magic { background: linear-gradient(90deg, #7a4fd0, #b393ff); }
.rb-meter-fill.thrill { background: linear-gradient(90deg, #d0563a, #ff9f43); }
.rb-meter-fill.wayfinder { background: linear-gradient(90deg, #2e9e6b, #6fdca8); }

.rb-meter-val {
	flex: none;
	font-variant-numeric: tabular-nums;
	font-size: 0.66rem;
	color: rgba(243, 234, 210, 0.7);
}

/* ── §2.3 Crowd silhouette: the rest of the warband, pure atmosphere ── */
.rb-crowd {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 17%;
	height: 34px;
	z-index: 3;
	pointer-events: none;
}

.rb-crowd-band {
	position: absolute;
	inset: 0;
	/* Overlapping head-and-shoulders bumps — reads as a crowd from a distance. */
	background:
		radial-gradient(14px 20px at 6% 100%, rgba(12, 10, 24, 0.85), transparent 70%),
		radial-gradient(16px 24px at 15% 100%, rgba(16, 12, 30, 0.8), transparent 70%),
		radial-gradient(13px 19px at 24% 100%, rgba(12, 10, 24, 0.85), transparent 70%),
		radial-gradient(15px 23px at 34% 100%, rgba(16, 12, 30, 0.8), transparent 70%),
		radial-gradient(14px 20px at 44% 100%, rgba(12, 10, 24, 0.85), transparent 70%),
		radial-gradient(16px 24px at 55% 100%, rgba(16, 12, 30, 0.8), transparent 70%),
		radial-gradient(13px 19px at 65% 100%, rgba(12, 10, 24, 0.85), transparent 70%),
		radial-gradient(15px 23px at 75% 100%, rgba(16, 12, 30, 0.8), transparent 70%),
		radial-gradient(14px 20px at 85% 100%, rgba(12, 10, 24, 0.85), transparent 70%),
		radial-gradient(16px 24px at 94% 100%, rgba(16, 12, 30, 0.8), transparent 70%);
	opacity: 0.9;
}

.rb-crowd-count {
	position: absolute;
	right: 8px;
	top: -6px;
	font-size: 0.6rem;
	font-weight: 700;
	color: rgba(243, 234, 210, 0.55);
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* ── V2 stageline: the beat narration ribbon (duel-stageline pattern) ── */
.rb-stageline {
	position: absolute;
	left: 50%;
	bottom: 8px;
	transform: translateX(-50%);
	z-index: 6;
	max-width: 92%;
	padding: 0.3rem 0.65rem;
	border-radius: 8px;
	background: rgba(10, 8, 20, 0.82);
	border: 1px solid rgba(255, 255, 255, 0.14);
	font-size: 0.72rem;
	color: #f3ead2;
	text-align: center;
	opacity: 1;
	transition: opacity 0.25s ease;
	pointer-events: none;
}

.rb-stageline:empty {
	opacity: 0;
}

.rb-stageline--telegraph {
	border-color: rgba(255, 159, 67, 0.7);
	animation: rbTelegraphPulse 0.7s ease-in-out infinite;
}

.rb-stageline--heavy {
	border-color: rgba(255, 107, 107, 0.7);
}

.rb-stageline--super {
	border-color: rgba(255, 209, 102, 0.75);
	box-shadow: 0 0 12px rgba(255, 209, 102, 0.3);
}

@keyframes rbTelegraphPulse {
	0%, 100% { box-shadow: 0 0 4px rgba(255, 159, 67, 0.25); }
	50% { box-shadow: 0 0 14px rgba(255, 159, 67, 0.6); }
}

/* ── Responsive: smaller stage, smaller sprites ── */
@media (max-width: 480px) {
	.rb-arena {
		height: clamp(180px, 52vw, 230px);
	}
	.rb-sprite--boss {
		width: 100px;
		height: 100px;
	}
	.rb-sprite--boss .duel-sprite-emoji {
		font-size: 66px;
		line-height: 100px;
	}
	.rb-sprite--hero {
		width: 56px;
		height: 56px;
	}
	.rb-sprite--hero .duel-sprite-emoji {
		font-size: 36px;
		line-height: 56px;
	}
	.rb-role-tag {
		font-size: 0.56rem;
		bottom: -13px;
	}
	.rb-crowd {
		bottom: 15%;
		height: 26px;
	}
}

/* Reduced motion: a still tableau — no bobs, no pulses (FX already skip in JS). */
@media (prefers-reduced-motion: reduce) {
	.rb-sprite--boss,
	.rb-sprite--hero,
	.rb-enrage,
	.rb-finale .rb-arena-bg::after,
	.rb-stageline--telegraph,
	.rb-target-mark {
		animation: none !important;
	}
}

/* ============================================================
   ONE-SCREEN RAID (owner): the raid panel must fit the viewport
   at any size with no page scroll. The hub-panel body that holds
   it becomes a fixed-height flex column; the stage (chrome →
   header → scene + auto-play note) is pinned, and a single inner
   region (.raid-feed: pool, reactions, roster, beat text, log)
   takes the remaining space and scrolls internally.
   ============================================================ */
body.play-app .vv-hub-panel-body:has(.play-raid-panel) {
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
}
.play-raid-panel.raid-demo {
	display: flex;
	flex-direction: column;
	min-height: 0;
	max-height: 100%;
	flex: 1 1 auto;
	overflow: hidden;
}
.play-raid-panel.raid-demo > .raid-demo-body {
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	gap: 0.35rem;
}
/* Stage elements stay their natural size (pinned at top). */
.play-raid-panel .raid-header,
.play-raid-panel .raid-beat-title,
.play-raid-panel .raid-beat-countdown,
.play-raid-panel .raid-phase-row,
.play-raid-panel .rb-scene,
.play-raid-panel .raid-bars,
.play-raid-panel .raid-self-frame,
.play-raid-panel .raid-autoplay-note {
	flex: 0 0 auto;
}
/* Your own unit frame — pinned in the always-visible stage area so your HP bar is
   never lost below the fold of the scroll feed. Reads as the player's frame, brighter
   than the roster frames in the feed. */
.play-raid-panel .raid-self-frame {
	margin: 0.1rem 0;
}
.play-raid-panel .raid-self-frame .party-member {
	background: rgba(241, 196, 15, 0.1);
	border: 1px solid rgba(241, 196, 15, 0.3);
	border-radius: 9px;
	padding: 0.35rem 0.55rem;
}
.play-raid-panel .raid-self-frame .party-hp {
	font-variant-numeric: tabular-nums;
	font-weight: 700;
}
/* The scene can shrink a little on short screens but stays the centerpiece. */
.play-raid-panel .rb-scene,
.play-raid-panel .raid-bars {
	min-height: 0;
}
/* The single internal scroll region — everything below the stage. */
.play-raid-panel .raid-feed {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}
/* The combat log no longer needs its own cap — the feed bounds it. Keep it
   visible in the hub again (was hidden on non-compact hub panels) now that
   the feed scrolls instead of the page. */
body.play-app .vv-hub-panel-body .play-raid-panel:not(.play-raid-panel--compact) .raid-log-wrap {
	display: block;
}
.play-raid-panel .raid-feed .raid-log {
	max-height: none;
}

/* The auto-play reassurance line — quiet, gold, centered under the scene. */
.raid-autoplay-note {
	text-align: center;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	color: var(--gold-bright, #ffd75e);
	background: rgba(241, 196, 15, 0.08);
	border: 1px solid rgba(241, 196, 15, 0.22);
	border-radius: 8px;
	padding: 0.3rem 0.6rem;
	margin: 0.1rem 0;
}
