/*
 * Tetris easter egg styles.
 *
 * Colour tokens used throughout:
 *   Deep navy (playfield bg):   #080f1e
 *   Frame navy:                 #0a1020
 *   Brand blue:                 #1133af
 *   Accent blue (on dark):      #7f9dff
 *   Light heading text:         #ffffff
 *   Light body text:            #e9f0ff
 *   Muted light text:           rgba(233,240,255,0.65)
 */

body.finance_act_is_open {
	overflow: hidden;
	overscroll-behavior: none;
}

/* ── Modal backdrop ──────────────────────────────────────
   opacity starts at 0; JS adds .is-visible to fade in.
   pointer-events:none while invisible prevents ghost clicks. */

.finance_act {
	background: rgba(5, 10, 22, 0.84);
	backdrop-filter: blur(6px);
	bottom: 0;
	box-sizing: border-box;
	display: flex;
	font-family: var(--wp--preset--font-family--poppins, 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
	left: 0;
	opacity: 0;
	padding: 1.25rem;
	pointer-events: none;
	position: fixed;
	right: 0;
	top: 0;
	transition: opacity 160ms ease;
	overscroll-behavior: none;
	touch-action: none;
	z-index: 999999;
}

.finance_act.is-visible {
	opacity: 1;
	pointer-events: auto;
}

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

.finance_act_launch {
	color: inherit;
	cursor: text;
	font: inherit;
	text-decoration: none;
}

.finance_act_panel {
	margin: auto;
	max-width: 420px;
	position: relative;
	width: 100%;
}

/* ── Header buttons (Close and Help) ─────────────────────
   Both sit above the game-wrap, positioned relative to the panel. */

.finance_act_close,
.finance_act_help-btn {
	background: rgba(8, 15, 30, 0.9);
	border: 1px solid rgba(127, 157, 255, 0.25);
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
	color: #e9f0ff;
	cursor: pointer;
	font: inherit;
	font-size: 0.85rem;
	font-weight: 700;
	line-height: 1;
	padding: 0.45rem 0.6rem;
	position: absolute;
	top: -2.4rem;
}

.finance_act_close {
	right: 0;
}

.finance_act_help-btn {
	left: 0;
}

/* ── Outer frame — dark navy, subtle blue glow border ─── */

.finance_act_game-wrap {
	background: #0a1020;
	border: 1px solid rgba(127, 157, 255, 0.18);
	border-radius: 8px;
	box-shadow:
		0 24px 70px rgba(0, 0, 0, 0.65),
		0 0 0 1px rgba(127, 157, 255, 0.06);
	margin: 0 auto;
	overflow: hidden;
	padding: 10px;
	position: relative;
	width: min(100%, 340px);
}

/* ── The canvas area — deep navy playfield ───────────── */

.finance_act_game {
	display: block;
	width: 100%;
	height: min(640px, calc(100vh - 7rem));
	min-height: 360px;
	margin: 0 auto;
	background: #080f1e;
}

/* ── Flow screens (prize / leaderboard / confirm) ─────── */

.finance_act_screen,
.finance_act_help-screen,
.finance_act_confirm-screen {
	align-items: center;
	background: rgba(8, 15, 30, 0.96);
	color: #e9f0ff;
	display: flex;
	inset: 0;
	justify-content: center;
	overflow: auto;
	padding: 1rem;
	position: absolute;
}

.finance_act_screen {
	inset: 10px;
	z-index: 20;
}

/* Help overlays the full game-wrap (inset: 0) */
.finance_act_help-screen {
	z-index: 30;
}

/* Confirm sits above flow screens but below help */
.finance_act_confirm-screen {
	z-index: 25;
}

.finance_act_screen[hidden],
.finance_act_help-screen[hidden] {
	display: none;
}

/* ── Card layout ─────────────────────────────────────── */

.finance_act_card,
.finance_act_help-card {
	margin: auto;
	max-width: 290px;
	width: 100%;
}

.finance_act_card h2,
.finance_act_help-card h2 {
	color: #ffffff;
	font-family: inherit;
	font-size: 1.25rem;
	line-height: 1.15;
	margin: 0 0 0.75rem;
	text-align: center;
}

.finance_act_card p,
.finance_act_help-card p {
	color: rgba(233, 240, 255, 0.78);
	font-size: 0.9rem;
	line-height: 1.4;
	margin: 0 0 0.75rem;
	text-align: center;
}

.finance_act_eyebrow {
	color: #7f9dff !important;
	font-size: 0.76rem !important;
	font-weight: 700;
	letter-spacing: 0;
	text-transform: uppercase;
}

/* ── Personal best ───────────────────────────────────── */

.finance_act_personal-best {
	color: rgba(233, 240, 255, 0.7) !important;
	font-size: 0.82rem !important;
	font-weight: 600;
	margin: 0 0 0.5rem !important;
}

.finance_act_personal-best--new {
	color: #a8c8ff !important;
}

/* ── Prize and leader forms ──────────────────────────── */

.finance_act_prize-form,
.finance_act_leader-form {
	display: grid;
	gap: 0.7rem;
}

.finance_act_prize-form label,
.finance_act_initials-label {
	color: rgba(233, 240, 255, 0.6);
	display: grid;
	font-size: 0.78rem;
	font-weight: 700;
	gap: 0.25rem;
	letter-spacing: 0;
	text-transform: uppercase;
}

.finance_act_prize-form input,
.finance_act_initials {
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid rgba(127, 157, 255, 0.28);
	border-radius: 6px;
	color: #e9f0ff;
	font: inherit;
	font-size: 1rem;
	padding: 0.58rem 0.65rem;
	width: 100%;
}

.finance_act_prize-form input::placeholder {
	color: rgba(233, 240, 255, 0.35);
}

.finance_act_prize-form input:focus,
.finance_act_initials:focus {
	border-color: rgba(127, 157, 255, 0.6);
	outline: none;
}

.finance_act_initials {
	font-size: 1.35rem;
	font-weight: 700;
	letter-spacing: 0.2em;
	text-align: center;
	text-transform: uppercase;
}

.finance_act_form-error {
	color: #ff9090 !important;
	font-size: 0.78rem !important;
	margin: 0 !important;
	min-height: 1em;
}

/* ── Action buttons ──────────────────────────────────── */

.finance_act_actions {
	display: flex;
	gap: 0.5rem;
	justify-content: center;
}

.finance_act_actions button {
	background: #1133af;
	border: 1px solid #1133af;
	border-radius: 8px;
	box-shadow: 0 8px 20px rgba(17, 51, 175, 0.35);
	color: #fff;
	cursor: pointer;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1.2;
	padding: 0.65rem 0.9rem;
}

.finance_act_actions button:disabled {
	cursor: wait;
	opacity: 0.62;
}

/* Ghost / secondary button on dark background */
.finance_act_actions .finance_act_secondary {
	background: transparent;
	border-color: rgba(127, 157, 255, 0.35);
	box-shadow: none;
	color: #7f9dff;
}

/* ── Leaderboard ─────────────────────────────────────── */

.finance_act_card--leaderboard {
	max-width: 300px;
}

.finance_act_leaderboard {
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(127, 157, 255, 0.15);
	border-radius: 8px;
	color: #e9f0ff;
	display: grid;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
	font-size: 0.72rem;
	gap: 0;
	line-height: 1.2;
	list-style: none;
	margin: 0 0 0.85rem;
	padding: 0.55rem 0.65rem;
}

.finance_act_leaderboard li {
	display: grid;
	grid-template-columns: 2.2em 1fr auto;
	gap: 0.5rem;
	padding: 0.08rem 0;
}

/* Current player's row highlighted */
.finance_act_leaderboard li.is-current {
	background: rgba(127, 157, 255, 0.18);
	border-radius: 4px;
	margin: 0 -0.25rem;
	padding-left: 0.25rem;
	padding-right: 0.25rem;
}

/* Position number in accent blue */
.finance_act_leaderboard span {
	color: #7f9dff;
}

/* Initials in bright white */
.finance_act_leaderboard strong {
	color: #fff;
	font-weight: 700;
	letter-spacing: 0.08em;
}

/* Score in pale blue */
.finance_act_leaderboard em {
	color: #cfe0ff;
	font-style: normal;
	text-align: right;
}

.finance_act_leader-prompt {
	font-size: 0.82rem !important;
	margin-bottom: 0.5rem !important;
}

/* ── Attribution credit ──────────────────────────────── */

.finance_act_credit {
	margin: 1rem auto 0;
	max-width: 420px;
	color: rgba(233, 240, 255, 0.5);
	font-size: 0.8rem;
	line-height: 1.4;
	text-align: center;
}

.finance_act_credit a {
	color: #7f9dff;
	text-underline-offset: 0.16em;
}

/* ── Help modal controls table ───────────────────────── */

.finance_act_controls-table {
	border-collapse: collapse;
	font-size: 0.8rem;
	margin-bottom: 0.85rem;
	width: 100%;
}

.finance_act_controls-table thead th {
	border-bottom: 1px solid rgba(127, 157, 255, 0.2);
	color: #7f9dff;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0;
	padding: 0 0 0.25rem;
	text-align: left;
	text-transform: uppercase;
}

.finance_act_controls-table tbody td {
	color: rgba(233, 240, 255, 0.85);
	padding: 0.28rem 0;
	vertical-align: middle;
}

.finance_act_controls-table tbody td:first-child {
	color: #cfe0ff;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
	font-size: 0.78rem;
	padding-right: 0.85rem;
	white-space: nowrap;
}

/* ── Start screen extras ─────────────────────────────── */

.finance_act_start-extras {
	margin-top: 0.85rem;
}

.finance_act_start-stats {
	color: rgba(233, 240, 255, 0.6);
	font-size: 0.72rem;
	margin: 0 0 0.35rem;
	text-align: center;
}

.finance_act_kb-hint {
	color: rgba(233, 240, 255, 0.4);
	font-size: 0.65rem;
	line-height: 1.5;
	margin: 0 0 0.35rem;
	text-align: center;
}

.finance_act_portrait-nudge {
	color: rgba(233, 240, 255, 0.45);
	font-size: 0.7rem;
	margin: 0;
	text-align: center;
}

/* ── Score pulse animation ───────────────────────────── */

@keyframes finance_act-score-pop {
	0%   { transform: scale(1); }
	40%  { transform: scale(1.28); }
	100% { transform: scale(1); }
}

.finance_act_score-pop {
	animation: finance_act-score-pop 220ms ease-out;
}

/* ── Blockrain canvas overrides ──────────────────────── */

.finance_act .blockrain-game-holder {
	border-radius: 6px;
	color: #e9f0ff;
	font-family: inherit;
	overflow: hidden;
}

/* Score badge — dark pill, matches the frame */
.finance_act .blockrain-score-holder {
	background: rgba(8, 15, 30, 0.85);
	border: 1px solid rgba(127, 157, 255, 0.18);
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
	color: #e9f0ff;
	padding: 0.45rem 0.6rem;
	right: 10px !important;
	top: 10px !important;
}

.finance_act .blockrain-score-msg {
	color: rgba(233, 240, 255, 0.55);
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0;
	margin-bottom: 0.1rem;
	text-transform: uppercase;
}

.finance_act .blockrain-score-num {
	color: #e9f0ff;
	font-size: 1rem;
	font-weight: 700;
}

/* Start screen and game-over overlay — dark, matching the playfield */
.finance_act .blockrain-start-holder,
.finance_act .blockrain-game-over-holder {
	background: rgba(8, 15, 30, 0.92);
	color: #e9f0ff;
}

.finance_act .blockrain-start,
.finance_act .blockrain-game-over {
	left: 50%;
	max-width: 260px;
	transform: translate(-50%, -50%);
}

.finance_act .blockrain-start-msg,
.finance_act .blockrain-game-over-msg {
	color: #ffffff;
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.3;
	margin: 0 auto 1rem;
}

/* Primary action button inside Blockrain overlays */
.finance_act .blockrain-btn {
	background: #1133af;
	border: 1px solid #1133af;
	border-radius: 8px;
	box-shadow: 0 8px 20px rgba(17, 51, 175, 0.35);
	color: #fff;
	cursor: pointer;
	font-family: inherit;
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1.2;
	padding: 0.7rem 1rem;
	text-decoration: none;
}

.finance_act .blockrain-btn::before,
.finance_act .blockrain-btn::after {
	display: none;
}

.finance_act .blockrain-btn:hover,
.finance_act .blockrain-btn:focus-visible {
	background: #0d2a91;
	border-color: #0d2a91;
	color: #fff;
	outline: 3px solid rgba(17, 51, 175, 0.35);
	outline-offset: 3px;
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 420px) {
	.finance_act {
		padding: 0.75rem;
	}

	.finance_act_game {
		width: min(100%, 280px);
		height: min(560px, calc(100vh - 6rem));
	}

	.finance_act_game-wrap {
		width: min(100%, 300px);
	}

	.finance_act_screen {
		inset: 10px;
		padding: 0.75rem;
	}

	.finance_act_leaderboard {
		font-size: 0.68rem;
	}
}
