/**
 * Cash Bash frontend display styles.
 *
 * Visual enhancements include:
 *   - Bigger timer in fullscreen/live-page (#18)
 *   - Smooth state transitions via opacity (#18)
 *   - Color temperature shift on countdown (#18)
 *   - "DRAWING NOW!" animated overlay (#21)
 *   - Next prize callout (#22)
 *   - Staggered winner announcement reveal (#18)
 *   - QR code positioning (#23)
 *   - Auto-scrolling winners table with gradient masks (#24)
 *   - Per-event branding via CSS custom properties (#7)
 *
 * @package ElksCashBash
 */

/* ──────────────────────────────────────────────
 * Layout & Wrapper
 * ────────────────────────────────────────────── */

.cash-bash-wrapper {
	/* Per-event branding colors — set by JS from poll data.
	 * Defaults used when no branding is configured. */
	--cash-bash-primary: #2c3e50;
	--cash-bash-accent: #00ff88; /* Saturated for projector visibility. */
	/* Timer color — dynamically set by JS for temperature shift (#18). */
	--cash-bash-timer-color: inherit;

	text-align: center;
	font-family: 'Inter', 'Segoe UI', 'Roboto', system-ui, sans-serif;
	max-width: 750px;
	margin: 0 auto;
	padding: 2rem;
	position: relative;
	color: var(--cash-bash-primary);
}

/* ──────────────────────────────────────────────
 * Smooth State Transitions (#18)
 *
 * Instead of jarring display:none/block swaps, state sections
 * fade in/out via opacity + visibility. JS toggles the
 * .cash-bash-state-visible class.
 * ────────────────────────────────────────────── */

.cash-bash-state-section {
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.4s ease, visibility 0.4s ease;
	position: absolute;
	width: 100%;
	left: 0;
}

.cash-bash-state-section.cash-bash-state-visible {
	opacity: 1;
	visibility: visible;
	position: relative;
}

/* ──────────────────────────────────────────────
 * Event Logo (#7)
 * ────────────────────────────────────────────── */

.cash-bash-logo {
	margin-bottom: 1rem;
}

.cash-bash-logo-img {
	max-height: 120px;
	max-width: 100%;
	height: auto;
}

/* ──────────────────────────────────────────────
 * Event Name
 * ────────────────────────────────────────────── */

.cash-bash-event-name {
	font-size: clamp(1.5rem, 4vw, 2.5rem);
	margin-bottom: 0.5rem;
	font-weight: 700;
}

/* ──────────────────────────────────────────────
 * Countdown Timer
 * ────────────────────────────────────────────── */

.cash-bash-countdown h2 {
	margin-bottom: 0.5rem;
	font-size: clamp(1rem, 2.5vw, 1.5rem);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	opacity: 0.8;
}

.countdown-timer {
	font-size: clamp(4rem, 12vw, 8rem);
	font-weight: bold;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	transition: transform 0.3s ease-out, color 0.5s ease;
	transform-origin: center center;
	/* Timer color driven by JS for temperature shift (#18). */
	color: var(--cash-bash-timer-color);
}

/* Zoom animation — progressive scale as timer approaches zero. */
.countdown-timer.cash-bash-timer-zoom {
	transform: scale(calc(1 + 0.5 * var(--zoom-progress, 0)));
}

/* ──────────────────────────────────────────────
 * Next Prize Callout (#22)
 * ────────────────────────────────────────────── */

.cash-bash-next-prize {
	font-size: clamp(1.1rem, 3vw, 1.8rem);
	margin-top: 0.75rem;
	font-weight: 600;
	color: var(--cash-bash-accent);
}

/* ──────────────────────────────────────────────
 * "DRAWING NOW!" Overlay (#21)
 * ────────────────────────────────────────────── */

.cash-bash-drawing-now {
	padding: 2rem;
}

.cash-bash-drawing-now-text {
	/* Embedded view caps at 4rem so "DRAWING NOW!" doesn't overflow the
	 * 900px wrapper. Fullscreen and live-page override this below with
	 * the original projector-scale sizing. */
	font-size: clamp(2rem, 7vw, 4rem);
	font-weight: 900;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #ff4444;
	/* Guard against horizontal overflow on narrow embeds. */
	max-width: 100%;
	word-break: break-word;
	/* Explicit line-height + bottom margin reserves vertical space for
	 * the scale(1.05) pulse animation and text-shadow glow so the prize
	 * line below doesn't visually collide with descenders + glow. */
	line-height: 1.1;
	margin-bottom: 2.5rem;
	animation: cash-bash-drawing-pulse 0.8s ease-in-out infinite alternate;
}

.cash-bash-drawing-now-prize {
	font-size: clamp(1.5rem, 4vw, 2.5rem);
	font-weight: 600;
	color: var(--cash-bash-accent);
	/* margin-top removed — spacing now lives on the DRAWING NOW text's
	 * margin-bottom so the animation's scale doesn't eat into it. */
}

@keyframes cash-bash-drawing-pulse {
	from { transform: scale(1); text-shadow: 0 0 20px rgba(255, 68, 68, 0.3); }
	to   { transform: scale(1.05); text-shadow: 0 0 40px rgba(255, 68, 68, 0.6); }
}

/* ──────────────────────────────────────────────
 * Prize Schedule List
 * ────────────────────────────────────────────── */

.cash-bash-schedule {
	margin-top: 2rem;
	text-align: left;
	max-width: 600px;
	margin-left: auto;
	margin-right: auto;
}

.cash-bash-schedule-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
	font-size: clamp(0.9rem, 2vw, 1.1rem);
	transition: background 0.3s, opacity 0.3s;
}

.cash-bash-schedule-item:last-child {
	border-bottom: none;
}

.cash-bash-schedule-next {
	background: rgba(0, 255, 136, 0.12);
	border-radius: 4px;
	font-weight: 600;
}

.cash-bash-schedule-time {
	font-weight: 600;
	min-width: 5em;
	flex-shrink: 0;
}

/* Winner + ticket column — lives between time and prize so the
 * drawn-winner info reads down the center of the list. Empty span
 * on un-drawn rows keeps the prize column aligned across rows. */
.cash-bash-schedule-winner {
	flex: 1 1 0;
	text-align: center;
	font-weight: 600;
	padding: 0 0.75rem;
	/* Long names shouldn't push the row into a wrap — ellipsize once
	 * the column runs out of space. Ticket stays on the same line. */
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cash-bash-schedule-desc {
	flex: 1 1 0;
	text-align: right;
}

.cash-bash-schedule-won {
	opacity: 0.5;
}

/* ──────────────────────────────────────────────
 * "No Active Event" Message
 * ────────────────────────────────────────────── */

.cash-bash-no-event {
	font-size: 1.5rem;
	opacity: 0.6;
	padding: 3rem 1rem;
}

/* ──────────────────────────────────────────────
 * Fullscreen Toggle Button
 * ────────────────────────────────────────────── */

.cash-bash-fullscreen-btn {
	position: absolute;
	top: 1rem;
	right: 1rem;
	background: rgba(0, 0, 0, 0.1);
	border: none;
	border-radius: 4px;
	padding: 0.5rem 0.75rem;
	cursor: pointer;
	font-size: 1.2rem;
	line-height: 1;
	transition: background 0.2s;
	z-index: 10;
}

.cash-bash-fullscreen-btn:hover {
	background: rgba(0, 0, 0, 0.2);
}

/* ──────────────────────────────────────────────
 * QR Code (#23)
 *
 * On the embedded view (shortcode in a themed page), the QR is rendered
 * as a static, centered element below the schedule. This avoids the
 * absolute-positioned QR overlapping the tail of the schedule list when
 * the wrapper is narrow.
 *
 * On the live-page and :fullscreen views (plenty of viewport real estate),
 * the rules further down override to position:fixed in the bottom-right.
 * ────────────────────────────────────────────── */

.cash-bash-qr {
	display: block;
	margin: 2rem auto 0;
	text-align: center;
	opacity: 0.7;
	transition: opacity 0.3s;
	z-index: 10;
}

.cash-bash-qr:hover {
	opacity: 1;
}

.cash-bash-qr canvas,
.cash-bash-qr img {
	display: block;
	margin: 0 auto;
}

.cash-bash-qr-label {
	font-size: 0.65rem;
	opacity: 0.6;
	margin-top: 0.25rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* Hide QR during announcements. */
.cash-bash-wrapper.cash-bash-announcing .cash-bash-qr {
	opacity: 0;
	pointer-events: none;
}

/* ──────────────────────────────────────────────
 * Winner Announcement Splash
 *
 * Staggered reveal: label → name → ticket → prize (#18).
 * Each child has an increasing animation-delay.
 * ────────────────────────────────────────────── */

.cash-bash-announcement {
	padding: 2rem;
}

.cash-bash-announcement-label {
	font-size: clamp(1.5rem, 4vw, 2.5rem);
	text-transform: uppercase;
	letter-spacing: 0.1em;
	opacity: 0;
	margin-bottom: 1rem;
	animation: cash-bash-stagger-in 0.5s ease-out forwards;
	animation-delay: 0s;
	/* Force white regardless of the wrapper's inherited color. The
	 * base .cash-bash-wrapper sets `color: var(--cash-bash-primary)`
	 * (dark navy) for the embedded shortcode layout, which made the
	 * "WINNER!" label render nearly invisible against the dark
	 * announcement backdrop. Setting an explicit color here means the
	 * label reads cleanly in all three render modes: shortcode,
	 * live-page, and browser fullscreen. */
	color: #ffffff;
}

.cash-bash-announcement-name {
	font-size: clamp(3rem, 10vw, 7rem);
	font-weight: 900;
	line-height: 1.1;
	/* Reserve enough vertical space below the name for its 60px neon
	 * text-shadow so it doesn't bleed onto the Ticket # line below,
	 * which was rendering washed out inside the glow cloud. */
	margin-bottom: 3rem;
	opacity: 0;
	animation: cash-bash-stagger-in 0.6s ease-out forwards;
	animation-delay: 0.5s;
	/* Neon glow effect using accent color. */
	text-shadow: 0 0 10px var(--cash-bash-accent),
	             0 0 30px var(--cash-bash-accent),
	             0 0 60px var(--cash-bash-accent);
}

.cash-bash-announcement-ticket {
	font-size: clamp(1.5rem, 4vw, 3rem);
	opacity: 0;
	margin-bottom: 1rem;
	/* Solid white + weight bump + subtle dark shadow so the ticket
	 * stays legible even if any residual accent glow reaches it. */
	color: #ffffff;
	font-weight: 700;
	text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
	animation: cash-bash-stagger-in 0.5s ease-out forwards;
	animation-delay: 1s;
}

/* Drawing time — e.g. "10:30 PM Drawing". Sits between the ticket
 * number and the prize description, sized slightly smaller than
 * either so it reads as a contextual label rather than competing
 * with the prize. Stagger-animates in just before the prize line. */
.cash-bash-announcement-time {
	font-size: clamp(1.1rem, 3vw, 2rem);
	opacity: 0;
	margin-bottom: 0.75rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	font-weight: 600;
	color: #ffffff;
	animation: cash-bash-stagger-in 0.5s ease-out forwards;
	animation-delay: 1.2s;
}

.cash-bash-announcement-prize {
	font-size: clamp(1.5rem, 4vw, 3rem);
	font-weight: 600;
	color: var(--cash-bash-accent);
	opacity: 0;
	animation: cash-bash-stagger-in 0.5s ease-out forwards;
	animation-delay: 1.4s;
}

/* Staggered fade-in + slide-up for announcement elements. */
@keyframes cash-bash-stagger-in {
	from { opacity: 0; transform: translateY(20px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ──────────────────────────────────────────────
 * Winners Table
 * ────────────────────────────────────────────── */

.cash-bash-winners {
	margin-top: 2rem;
	max-width: 700px;
	margin-left: auto;
	margin-right: auto;
}

.cash-bash-winners h2 {
	font-size: clamp(1.2rem, 3vw, 1.8rem);
	margin-bottom: 0.75rem;
}

/* Auto-scroll container with gradient fade masks (#24). */
.cash-bash-winners-scroll {
	max-height: 50vh;
	overflow: hidden;
	position: relative;
	-webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 95%, transparent 100%);
	mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 95%, transparent 100%);
}

/* When content fits, remove the mask so top/bottom aren't faded. */
.cash-bash-winners-scroll.no-overflow {
	-webkit-mask-image: none;
	mask-image: none;
}

.cash-bash-winners-table {
	width: 100%;
	border-collapse: collapse;
	text-align: left;
	font-size: clamp(0.85rem, 1.8vw, 1rem);
	font-variant-numeric: tabular-nums;
}

.cash-bash-winners-table th,
.cash-bash-winners-table td {
	padding: 0.5rem 0.75rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.cash-bash-winners-table th {
	font-weight: 700;
	text-transform: uppercase;
	font-size: 0.85em;
	letter-spacing: 0.03em;
	opacity: 0.7;
}

/* ──────────────────────────────────────────────
 * Fullscreen Mode
 * ────────────────────────────────────────────── */

.cash-bash-wrapper:fullscreen,
.cash-bash-wrapper:-webkit-full-screen {
	background: radial-gradient(ellipse at center, #1a1a2e, #0d0d1a);
	/* !important needed to beat the base .cash-bash-wrapper's
	 * color: var(--cash-bash-primary) (dark navy) which would
	 * otherwise win specificity and leave text unreadable on
	 * the dark backdrop. */
	color: #ffffff !important;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	max-width: none;
	padding: 3rem;
}

/* Boost dim helper text contrast in fullscreen (parallel to live-page). */
.cash-bash-wrapper:fullscreen .cash-bash-countdown h2,
.cash-bash-wrapper:fullscreen .cash-bash-qr,
.cash-bash-wrapper:fullscreen .cash-bash-qr-label,
.cash-bash-wrapper:fullscreen .cash-bash-winners-table th,
.cash-bash-wrapper:-webkit-full-screen .cash-bash-countdown h2,
.cash-bash-wrapper:-webkit-full-screen .cash-bash-qr,
.cash-bash-wrapper:-webkit-full-screen .cash-bash-qr-label,
.cash-bash-wrapper:-webkit-full-screen .cash-bash-winners-table th {
	opacity: 0.92;
}

.cash-bash-wrapper:fullscreen .cash-bash-schedule-won,
.cash-bash-wrapper:-webkit-full-screen .cash-bash-schedule-won {
	opacity: 0.7;
}

/* Bigger timer in fullscreen for projector readability (#18). */
.cash-bash-wrapper:fullscreen .countdown-timer,
.cash-bash-wrapper:-webkit-full-screen .countdown-timer {
	font-size: clamp(6rem, 15vw, 12rem);
}

.cash-bash-wrapper:fullscreen .cash-bash-fullscreen-btn,
.cash-bash-wrapper:-webkit-full-screen .cash-bash-fullscreen-btn {
	position: fixed;
	top: 1rem;
	right: 1rem;
	background: rgba(255, 255, 255, 0.15);
	color: #ffffff;
}

.cash-bash-wrapper:fullscreen .cash-bash-schedule-item,
.cash-bash-wrapper:-webkit-full-screen .cash-bash-schedule-item {
	border-bottom-color: rgba(255, 255, 255, 0.15);
}

.cash-bash-wrapper:fullscreen .cash-bash-schedule-next,
.cash-bash-wrapper:-webkit-full-screen .cash-bash-schedule-next {
	background: rgba(0, 255, 136, 0.2);
}

.cash-bash-wrapper:fullscreen .cash-bash-winners-table th,
.cash-bash-wrapper:fullscreen .cash-bash-winners-table td,
.cash-bash-wrapper:-webkit-full-screen .cash-bash-winners-table th,
.cash-bash-wrapper:-webkit-full-screen .cash-bash-winners-table td {
	border-bottom-color: rgba(255, 255, 255, 0.15);
}

.cash-bash-wrapper:fullscreen .cash-bash-qr,
.cash-bash-wrapper:-webkit-full-screen .cash-bash-qr {
	position: fixed;
	bottom: 1rem;
	right: 1rem;
	margin: 0;
}

/* Restore projector-scale "DRAWING NOW!" text in fullscreen. The embedded
 * default is capped at 4rem to prevent overflow in a narrow wrapper. */
.cash-bash-wrapper:fullscreen .cash-bash-drawing-now-text,
.cash-bash-wrapper:-webkit-full-screen .cash-bash-drawing-now-text {
	font-size: clamp(3rem, 10vw, 7rem);
}

/* ──────────────────────────────────────────────
 * Full-Screen Page Template
 *
 * The live-page template (template-cash-bash-live.php) sets
 * <body class="cash-bash-live-page"> and the only content in <body> is
 * meant to be #cash-bash-display. However, many WordPress plugins
 * (cookie banners, chat widgets, accessibility toolbars, etc.) inject
 * their own elements as direct children of <body> via wp_footer().
 *
 * Earlier versions of this block used `display: flex` on <body>, which
 * caused flexbox to redistribute horizontal space between the injected
 * element and #cash-bash-display — pushing the cash-bash display aside.
 *
 * The new approach pins #cash-bash-display to the viewport with
 * position: fixed; inset: 0 and a high z-index. Injected body siblings
 * stay in document flow behind the takeover layer, so they cannot
 * influence the Cash Bash layout.
 * ────────────────────────────────────────────── */

.cash-bash-live-page {
	background: radial-gradient(ellipse at center, #1a1a2e, #0d0d1a);
	color: #ffffff;
	min-height: 100vh;
	margin: 0;
	padding: 0;
}

/* The shortcode wrapper becomes the viewport takeover layer.
 *
 * overflow: hidden means the page itself can NEVER scroll — the
 * progress dots and countdown stay pinned exactly where they render
 * and never get pushed off the top. When the prize schedule (or
 * winners table) has too many rows to fit, those inner lists grow
 * their own internal scrollbars instead (see
 * .cash-bash-live-page .cash-bash-schedule rules below).
 *
 * justify-content is flex-start (not center) so content hugs the top
 * of the viewport instead of floating mid-screen — gives the prize
 * schedule more vertical room to breathe before its 40vh cap kicks
 * in. Top padding is intentionally small (1.5rem) to maximize that
 * usable space on projector / TV screens where real estate matters. */
.cash-bash-live-page #cash-bash-display {
	position: fixed;
	inset: 0;
	z-index: 99998;
	overflow: hidden;
	background: radial-gradient(ellipse at center, #1a1a2e, #0d0d1a);
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	align-items: center;
	max-width: none;
	padding: 1.5rem 3rem 3rem;
}

/* Event content wrapper becomes a flex column on the live-page so the
 * schedule/winners list can grow into whatever height is left after
 * the fixed header items (progress bar, countdown label + timer,
 * next-prize callout). Without this the schedule falls back to its
 * own max-height and can't tell how much room it actually has.
 *
 * display is set to flex via CSS here rather than in JS. The JS only
 * toggles the inline display between 'none' (no active event) and ''
 * (clear, defer to CSS) — see handlePollResponse in cash-bash.js.
 *
 * align-items: center keeps each child visually centered in the
 * viewport at its natural/max-width (e.g. schedule's max-width:600px
 * is preserved and centered). flex: 1 1 auto + min-height: 0 lets
 * the wrapper itself absorb the full viewport height so the child
 * schedule can then flex: 1 into whatever's left. */
.cash-bash-live-page #cash-bash-event-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
}

/* Hide the event name and logo on the live-page takeover. The progress
 * bar already communicates "how many prizes, how many drawn", and the
 * event name is visible everywhere else a viewer would look (admin
 * schedule, browser tab title). Hiding them frees a chunk of vertical
 * space that was competing with the countdown and schedule. */
.cash-bash-live-page .cash-bash-event-name,
.cash-bash-live-page .cash-bash-logo {
	display: none;
}

/* Pull the countdown label ("NEXT DRAWING IN") close to the top edge —
 * with the progress bar and event title both removed from the live-page,
 * the countdown is now the first visible element. */
.cash-bash-live-page .cash-bash-countdown h2 {
	margin-top: 0;
	margin-bottom: 0.25rem;
}

/* On the live-page, let the prize schedule absorb whatever vertical
 * space is left between the countdown block and the bottom of the
 * viewport. Fixed vh caps (old 40vh) left dead space on tall screens
 * and clipped content on short ones; flex: 1 1 0 with min-height: 0
 * inside a flex-column parent makes the list size itself to the
 * actual available height.
 *
 * The inner scrollbar only appears when the prize list is taller
 * than the space it ends up with — fewer prizes = no scrollbar, lots
 * of prizes = scrollbar + the existing auto-scroll cycle kicks in.
 *
 * NOTE: this rule depends on #cash-bash-event-content being a flex
 * column (see below) AND on all of its other children (progress bar,
 * countdown, drawing-now, announcement) NOT having flex-grow, so the
 * schedule is the only child that absorbs the slack. */
.cash-bash-live-page .cash-bash-schedule {
	flex: 1 1 0;
	min-height: 0;
	max-height: none;
	overflow-y: auto;
	/* Reserve gutter for the scrollbar so rows don't reflow when it
	 * appears/disappears on pages with exactly-fitting content. */
	padding-right: 0.5rem;
	/* Widen beyond the base 600px on the projector/TV takeover —
	 * there's plenty of horizontal real estate on the live-page and
	 * a wider list means longer prize descriptions stop wrapping to
	 * two lines. */
	max-width: 750px;
	width: 100%;
}

/* Same treatment for the final winners list when the event has
 * finished: the .cash-bash-winners section itself becomes a flex
 * column filling the remaining viewport, and .cash-bash-winners-scroll
 * absorbs whatever height is left below the "Winners" heading. */
.cash-bash-live-page .cash-bash-winners {
	display: flex;
	flex-direction: column;
	flex: 1 1 0;
	min-height: 0;
	width: 100%;
	/* Match the (widened) schedule's visual width so the event-end
	 * winners list doesn't suddenly sprawl across the full projector
	 * width when the schedule it replaces was sized to 900px. */
	max-width: 750px;
}
.cash-bash-live-page .cash-bash-winners-scroll {
	flex: 1 1 0;
	min-height: 0;
	max-height: none;
}

/* Bigger timer in live-page for projector readability (#18). */
.cash-bash-live-page .countdown-timer {
	font-size: clamp(6rem, 15vw, 12rem);
}

.cash-bash-live-page .cash-bash-wrapper {
	max-width: none;
	/* The base .cash-bash-wrapper sets color: var(--cash-bash-primary)
	 * which is dark navy — designed for LIGHT theme backgrounds. On the
	 * live-page dark gradient it becomes nearly invisible (event title,
	 * countdown digits, "NEXT DRAWING IN" label, schedule times, etc.
	 * all render in dark navy on dark background). Force white text
	 * throughout the live-page takeover. */
	color: #ffffff;
}

/* High-contrast overrides for dim helper text on the dark backdrop.
 * The default opacities (0.6 – 0.8) look fine on white but are too
 * faint when the underlying color is white on near-black. */
.cash-bash-live-page .cash-bash-countdown h2,
.cash-bash-live-page .cash-bash-qr,
.cash-bash-live-page .cash-bash-qr-label,
.cash-bash-live-page .cash-bash-winners-table th,
.cash-bash-live-page .cash-bash-no-event {
	opacity: 0.92;
}

/* "NEXT DRAWING IN" label — the base rule's opacity: 0.8 combined
 * with color inheritance from the .cash-bash-wrapper left it reading
 * olive/dim on the live-page dark gradient, visibly harder to scan
 * than the surrounding content. Force full opacity + explicit white
 * on the live-page so it matches the readability of the timer
 * below. Same pattern as the .cash-bash-announcement-label fix from
 * 0.1.26. Keep this after the block above so its opacity wins. */
.cash-bash-live-page .cash-bash-countdown h2 {
	opacity: 1;
	color: #ffffff;
}

/* Schedule rows already have their own dim-on-won state — keep that,
 * but bump it up slightly so won rows are still legible on dark. */
.cash-bash-live-page .cash-bash-schedule-won {
	opacity: 0.7;
}

/* Restore projector-scale "DRAWING NOW!" text on the live page. */
.cash-bash-live-page .cash-bash-drawing-now-text {
	font-size: clamp(3rem, 10vw, 7rem);
}

/* Park the QR in the bottom-right corner of the takeover layer,
 * same as fullscreen mode. */
.cash-bash-live-page .cash-bash-qr {
	position: fixed;
	bottom: 1rem;
	right: 1rem;
	margin: 0;
}

/* Narrow live-page viewports (e.g. laptop browser window, not a
 * wide projector) don't have enough horizontal clearance between
 * the centered 600px schedule and the fixed bottom-right QR —
 * they collide. At these widths, let the QR flow inline at the
 * bottom of the content instead. The takeover's overflow: auto
 * allows scrolling if the combined height exceeds the viewport. */
@media (max-width: 900px) {
	.cash-bash-live-page .cash-bash-qr {
		position: static;
		margin: 2rem auto 0;
	}
}

.cash-bash-live-page .cash-bash-schedule-item {
	border-bottom-color: rgba(255, 255, 255, 0.15);
}

.cash-bash-live-page .cash-bash-schedule-next {
	background: rgba(0, 255, 136, 0.2);
}

.cash-bash-live-page .cash-bash-winners-table th,
.cash-bash-live-page .cash-bash-winners-table td {
	border-bottom-color: rgba(255, 255, 255, 0.15);
}

/* ──────────────────────────────────────────────
 * Live Page — Narrow Viewport / Mobile
 *
 * The base .cash-bash-live-page styles are tuned for projector/TV
 * widths. On a portrait phone (~390px) the 3rem outer padding plus
 * the three-column schedule row (time / winner / description) don't
 * fit horizontally, and the row content gets clipped off the edges.
 *
 * Strategy: at ≤600px, shrink the outer padding and drop the winner
 * column entirely. The winner info is still visible on every other
 * surface (Live Control table, Winners tab, end-of-event list), and
 * removing it here lets the two remaining columns (time + prize)
 * read clearly on a phone without cramming or ellipsizing.
 *
 * This block intentionally does NOT touch vertical sizing — the
 * existing flex: 1 1 0 + min-height: 0 chain on schedule /
 * event-content is what makes the scroll area fill the viewport,
 * and adding overflow-x or max-width declarations up here was
 * breaking that chain on larger screens. Keep changes scoped to
 * ≤600px only.
 * ────────────────────────────────────────────── */

/* ──────────────────────────────────────────────
 * Live Page — Landscape phone (very short viewport)
 *
 * On an iPhone rotated to landscape the viewport is ~850×390. The
 * base live-page countdown uses font-size: clamp(6rem, 15vw, 12rem)
 * which, at 850px wide, resolves to 127px — a single digit eats
 * almost a third of the 390px height. Combine that with the ~170px
 * QR code block at the top and there's no room left for the
 * schedule list, so viewers can't see (or scroll to) the prizes.
 *
 * This media query kicks in only when height is short AND the
 * screen is oriented landscape, so it doesn't affect desktop
 * windows that happen to be wide. Key changes:
 *   - countdown timer sized off viewport HEIGHT (vh) instead of
 *     viewport WIDTH (vw) so it scales with the tight axis.
 *   - QR code hidden — it's a "scan to view on your phone" shortcut
 *     which is redundant when you're already holding a phone.
 *   - tighter outer padding to claw back every pixel for the list.
 * ────────────────────────────────────────────── */
@media (orientation: landscape) and (max-height: 500px) {
	.cash-bash-live-page #cash-bash-display {
		padding: 0.5rem 1rem;
	}
	.cash-bash-live-page .countdown-timer {
		font-size: clamp(2.5rem, 14vh, 5rem);
	}
	.cash-bash-live-page .cash-bash-countdown h2 {
		font-size: 0.85rem;
		margin-bottom: 0;
	}
	.cash-bash-live-page .cash-bash-next-prize {
		font-size: 1rem;
		margin-top: 0.25rem;
	}
	/* Hide the QR block entirely — redundant on a phone. Both the
	 * fixed (wide-viewport) and inline (narrow-viewport) forms. */
	.cash-bash-live-page .cash-bash-qr {
		display: none;
	}
}

@media (max-width: 600px) {
	/* Claw back the outer padding so schedule rows have room to
	 * breathe on a phone. 0.75rem sides keeps text off the bezel
	 * without starving content. */
	.cash-bash-live-page #cash-bash-display {
		padding: 1rem 0.75rem 1.5rem;
	}

	/* Defensive clip — if anything below this rule tries to render
	 * wider than the viewport (long winner-name splash, overflowing
	 * progress bar, etc.), hide the overflow rather than scroll the
	 * whole page sideways. Scoped to mobile so it doesn't affect the
	 * projector/TV layout. */
	.cash-bash-live-page,
	.cash-bash-live-page #cash-bash-display {
		overflow-x: hidden;
	}

	/* ── Mobile schedule rows: card-style stacked layout ──────────
	 *
	 * The desktop layout uses a three-column flex row
	 * (time / winner / description). On a phone that doesn't fit —
	 * the description column always pushes off the right edge. At
	 * ≤600px we flip the row to flex-direction: column so each
	 * prize reads as a compact card:
	 *
	 *   10:30 PM                    ← small, muted time label
	 *   Weekend Getaway             ← larger, bold prize name
	 *
	 * The winner column stays hidden on mobile — that info is on
	 * the Live Control table, Winners tab, and end-of-event list.
	 * ──────────────────────────────────────────────────────────── */
	.cash-bash-schedule-item {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.1rem;
		padding: 0.55rem 0.75rem;
		font-size: 1rem;
	}
	.cash-bash-schedule-time {
		min-width: 0;
		font-size: 0.75em;
		font-weight: 500;
		letter-spacing: 0.04em;
		text-transform: uppercase;
		opacity: 0.7;
	}
	.cash-bash-schedule-desc {
		text-align: left;
		font-weight: 600;
		width: 100%;
		padding: 0;
		/* Let long prize names wrap on mobile instead of ellipsizing —
		 * plenty of vertical room in the stacked layout. */
		white-space: normal;
		overflow: visible;
		text-overflow: clip;
	}
	/* Winner info becomes the third line in the stacked card — shown
	 * only on rows where a winner has been drawn (the desktop layout
	 * renders an empty span otherwise, which the :empty selector hides
	 * so the spacing stays tight).
	 *
	 * `flex: 0 0 auto` resets the desktop-layer `flex: 1 1 0` rule —
	 * with the parent row flipped to flex-direction: column on mobile,
	 * flex-basis:0 means the initial height is 0 (column-axis basis),
	 * which collapsed the winner line to a 0-height sliver even when
	 * it contained text. Using auto basis lets the span size to its
	 * own content.
	 *
	 * `white-space: normal`, `overflow: visible`, `text-overflow: clip`
	 * undo the desktop ellipsis rules so long winner names wrap to a
	 * second line on a narrow phone instead of silently truncating.
	 */
	.cash-bash-schedule-winner {
		display: block;
		flex: 0 0 auto;
		width: 100%;
		text-align: left;
		font-weight: 500;
		font-size: 0.9em;
		opacity: 0.85;
		padding: 0;
		margin-top: 0.15rem;
		color: var(--cash-bash-accent);
		white-space: normal;
		overflow: visible;
		text-overflow: clip;
	}
	.cash-bash-schedule-winner:empty {
		display: none;
	}

	/* Inline the QR (already done by the 900px breakpoint earlier
	 * in the file) with a tighter top margin so it doesn't shove
	 * against the bezel on small phones. */
	.cash-bash-live-page .cash-bash-qr {
		margin: 1rem auto 0;
	}
}

/* ──────────────────────────────────────────────
 * Archive Page (#9)
 * ────────────────────────────────────────────── */

.cash-bash-archive-title {
	font-size: clamp(1.5rem, 4vw, 2.5rem);
	margin-bottom: 1.5rem;
}

.cash-bash-archive-empty {
	opacity: 0.6;
	font-size: 1.2rem;
}

.cash-bash-archive-list {
	max-width: 600px;
	margin: 0 auto;
}

.cash-bash-archive-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
	text-decoration: none;
	color: inherit;
	transition: background 0.15s;
}

.cash-bash-archive-item:hover {
	background: rgba(0, 0, 0, 0.04);
}

.cash-bash-archive-item:last-child {
	border-bottom: none;
}

.cash-bash-archive-item-name {
	font-weight: 600;
	font-size: 1.1rem;
}

.cash-bash-archive-item-date {
	opacity: 0.6;
	font-size: 0.95rem;
}

/* ──────────────────────────────────────────────
 * Results Page (#9)
 * ────────────────────────────────────────────── */

.cash-bash-results-page {
	text-align: center;
}

.cash-bash-results-date {
	opacity: 0.6;
	margin-bottom: 1.5rem;
}
