/* =====================================================================================
   "Bạn có tạch đỉnh Olympia?" (/olympia-luck/) - the page around the Olympia 26 stage: the menu
   (the show's opening card), the stage fitted to the window, the hints / toasts / "Tiếp ›" over it,
   and the result card. The stage itself is olympia.css + o26.css as on default.html.
   ===================================================================================== */
html, body.luckPage {
	margin: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #050a1c;
	font-family: Nunito, "Segoe UI", system-ui, sans-serif;
	color: #f4f6ff;
}

/* the stage: 1920 x 1080 scaled by LuckScreens.js fit(), centred */
#luckFrame {
	position: fixed;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	overflow: hidden;
}
#luckFrame .stageContainerDiv {
	transform-origin: 0 0;
	touch-action: manipulation;
	-webkit-touch-callout: none;   /* no iOS long-press menu anywhere on the stage */
}
#luckFrame .authorityWarningDiv { display: none !important; }

/* where the player may tap: the elements themselves take the tap, a soft glow says so */
#luckFrame .questionBarDiv,
#luckFrame .vcnvQuestionDiv,
#luckFrame .vcnvPictureDiv,
#luckFrame .vcnvBoardDiv [class*="vcnvStrip"],
#luckFrame .ttDiv,
#luckFrame .vdQuestionGroup { pointer-events: auto; }
#luckFrame .luckGlow { cursor: pointer; animation: luckGlow 1.1s ease-in-out infinite alternate; }
@keyframes luckGlow {
	from { filter: drop-shadow(0 0 0 rgba(255, 214, 90, 0)); }
	to { filter: drop-shadow(0 0 18px rgba(255, 214, 90, .95)); }
}

/* ---------- over the stage ---------- */
#luckHint {
	position: fixed;
	left: 50%;
	bottom: max(14px, env(safe-area-inset-bottom));
	transform: translate(-50%, 20px);
	max-width: min(760px, calc(100vw - 32px));
	padding: 10px 18px;
	border-radius: 999px;
	background: rgba(8, 14, 40, .86);
	border: 1px solid rgba(255, 214, 90, .5);
	color: #ffe9a8;
	font-weight: 800;
	font-size: clamp(13px, 1.6vw, 17px);
	text-align: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity .25s, transform .35s cubic-bezier(.16, 1, .3, 1);
	z-index: 20;
}
#luckHint.on { opacity: 1; transform: translate(-50%, 0); }

#luckToasts {
	position: fixed;
	right: 14px;
	top: 14px;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	max-width: min(360px, calc(100vw - 28px));
	pointer-events: none;
	z-index: 20;
}
.luckToast {
	padding: 8px 12px;
	border-radius: 10px;
	background: rgba(8, 14, 40, .88);
	border-left: 4px solid #8aa0d8;
	font-size: 14px;
	font-weight: 700;
	animation: luckIn .35s cubic-bezier(.16, 1, .3, 1) both;
	transition: opacity .5s;
}
.luckToast.good { border-left-color: #3fd28b; }
.luckToast.bad { border-left-color: #ff6b5e; }
.luckToast.warn { border-left-color: #ffcf4a; }
.luckToast.out { opacity: 0; }
@keyframes luckIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

#luckCounter {
	position: fixed;
	left: 14px;
	top: 64px;
	padding: 8px 14px;
	border-radius: 10px;
	background: rgba(8, 14, 40, .88);
	font-weight: 900;
	font-size: 16px;
	display: none;
	z-index: 20;
}
#luckCounter.on { display: block; }

#luckNext {
	position: fixed;
	right: 14px;
	bottom: max(14px, env(safe-area-inset-bottom));
	overflow: hidden;
	padding: 10px 18px 12px;
	border: 1px solid rgba(255, 255, 255, .25);
	border-radius: 12px;
	background: rgba(8, 14, 40, .88);
	color: #fff;
	font: 800 15px Nunito, sans-serif;
	cursor: pointer;
	display: none;
	z-index: 21;
}
#luckNext.on { display: block; }
#luckNext:active { transform: scale(.97); }
#luckNext i {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	background: #ffcf4a;
	transform-origin: 0 50%;
}

#luckPick, #luckStar {
	position: fixed;
	left: 50%;
	top: 16px;
	transform: translateX(-50%);
	z-index: 21;
	display: none;
}
#luckPick.on { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: rgba(8, 14, 40, .9); border: 1px solid rgba(255, 214, 90, .5); }
#luckPick p { margin: 0 6px 0 0; font-weight: 800; }
#luckPick small { color: #ffcf4a; margin-left: 6px; }
#luckPick button, #luckStar, #luckResult button {
	min-height: 42px;
	padding: 0 18px;
	border: 0;
	border-radius: 10px;
	background: linear-gradient(#ffd85a, #f0a91c);
	color: #2b1700;
	font: 900 15px Nunito, sans-serif;
	cursor: pointer;
}
#luckPick button:active, #luckStar:active, #luckResult button:active { transform: translateY(1px) scale(.98); }
#luckStar.on { display: block; top: auto; bottom: max(14px, env(safe-area-inset-bottom)); left: 14px; transform: none; }

/* ---------- the result ---------- */
#luckResult {
	position: fixed;
	inset: 0;
	z-index: 30;
	display: none;
	place-items: center;
	padding: 16px;
	background: rgba(3, 6, 18, .72);
}
#luckResult.on { display: grid; animation: luckIn .5s cubic-bezier(.16, 1, .3, 1) both; }
#luckResult .card {
	width: min(460px, 100%);
	padding: 22px;
	border-radius: 18px;
	background: #0b1433;
	border: 1px solid rgba(255, 214, 90, .4);
	box-shadow: 0 30px 80px -30px #000;
}
#luckResult .eyebrow { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #9aa6c8; }
#luckResult h2 { margin: 6px 0 4px; font-size: 24px; font-weight: 900; line-height: 1.2; color: #ffd85a; }
#luckResPlace { margin: 0 0 12px; font-size: 18px; font-weight: 800; }
#luckResList { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 4px; }
#luckResList li { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .05); font-weight: 700; }
#luckResList li.me { background: rgba(255, 216, 90, .16); color: #ffe9a8; }
#luckResList b { font-variant-numeric: tabular-nums; }
#luckResLuck { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: #d7ddf3; }
#luckResult .row { display: flex; gap: 8px; flex-wrap: wrap; }
#luckAgain { background: rgba(255, 255, 255, .1) !important; color: #fff !important; }

/* a phone held upright: the stage is tiny - ask to turn it */
@media (max-aspect-ratio: 1/1) {
	body.playing::after {
		content: "Xoay ngang điện thoại để nhìn rõ hơn";
		position: fixed;
		left: 50%;
		top: 12px;
		transform: translateX(-50%);
		padding: 6px 12px;
		border-radius: 999px;
		background: rgba(8, 14, 40, .9);
		font-size: 13px;
		font-weight: 800;
		z-index: 22;
	}
}
@media (prefers-reduced-motion: reduce) {
	#luckFrame .luckGlow, .luckToast, #luckResult.on { animation: none; }
}
/* F6 / the board button: results board + the game frozen */
#luckBoard {
	position: fixed;
	left: 14px;
	top: 14px;
	min-height: 40px;
	padding: 0 14px;
	border: 1px solid rgba(255, 255, 255, .25);
	border-radius: 10px;
	background: rgba(8, 14, 40, .88);
	color: #fff;
	font: 800 14px Nunito, sans-serif;
	cursor: pointer;
	display: none;
	z-index: 21;
}
body.playing #luckBoard { display: block; }
body.luckPaused #luckBoard { background: linear-gradient(#ffd85a, #f0a91c); color: #2b1700; }
body.luckPaused::before {
	content: "Đang tạm dừng - F6 hoặc nút \"Tiếp tục\" để chơi tiếp";
	position: fixed;
	left: 50%;
	bottom: 16px;
	transform: translateX(-50%);
	padding: 10px 18px;
	border-radius: 999px;
	background: rgba(8, 14, 40, .92);
	border: 1px solid rgba(255, 214, 90, .5);
	color: #ffe9a8;
	font-weight: 800;
	z-index: 22;
}
body.luckPaused #luckHint, body.luckPaused #luckNext, body.luckPaused #luckPick, body.luckPaused #luckStar { visibility: hidden; }

/* the standing on the result card: Verdana, as the results board (F6) */
#luckResList, #luckResPlace { font-family: Verdana, Geneva, sans-serif; }
#luckResList li { font-weight: 700; font-size: 14px; }

/* ========================================================================== the menu
   Split screen: the show's opening card on the left (it fades into the night blue), the form on
   the right. One accent - the card's gold, toned down. Everything arrives in order (--i), the
   word "lên" is struck out and "tạch" written over it. While the stage loads, the start button
   is a shimmer; if it never loads, the form says so under the button. */
#luckMenu {
	--gold: #f2c94c;
	--ink: #e9edf8;
	--mute: #9ea8c6;
	--line: rgba(233, 237, 248, .14);
	--bg: #060c20;
	position: fixed;
	inset: 0;
	z-index: 30;
	display: grid;
	grid-template-columns: minmax(0, 1.35fr) minmax(340px, 460px);
	align-items: center;
	gap: clamp(20px, 4vw, 64px);
	min-height: 100dvh;
	padding: 72px clamp(16px, 5vw, 72px) 32px;
	box-sizing: border-box;
	background: radial-gradient(ellipse 70% 80% at 30% 50%, #0f2a52 0%, #0a1838 45%, var(--bg) 100%);
	color: var(--ink);
	overflow-y: auto;
	transition: opacity .5s, visibility .5s;
}
#luckMenu.gone { opacity: 0; visibility: hidden; }

.luckBack {
	position: absolute;
	left: clamp(16px, 2.5vw, 32px);
	top: clamp(14px, 2.5vw, 28px);
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px 8px 10px;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: rgba(6, 12, 32, .55);
	color: var(--ink);
	font-weight: 800;
	font-size: 14px;
	text-decoration: none;
	transition: border-color .2s, transform .2s cubic-bezier(.16, 1, .3, 1);
}
.luckBack:hover { border-color: rgba(242, 201, 76, .5); }
.luckBack:active { transform: translateY(1px); }

/* left: the opening card (no frame, it melts into the background) and the five rounds under it */
.menuLeft { display: grid; gap: clamp(12px, 2vh, 24px); align-content: center; min-width: 0; }
.menuArt { margin: 0; }
.menuArt img {
	display: block;
	width: 100%;
	height: auto;
	max-height: calc(100dvh - 300px);
	margin: 0 auto;
	object-fit: contain;
	-webkit-mask-image: radial-gradient(ellipse 60% 58% at 50% 50%, #000 52%, transparent 100%);
	mask-image: radial-gradient(ellipse 60% 58% at 50% 50%, #000 52%, transparent 100%);
	animation: artIn 1.2s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes artIn { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }

/* the form: a sheet of glass - an inner border and a top highlight, no glow */
#luckForm {
	position: relative;
	padding: 28px 28px 22px;
	border-radius: 22px;
	background: rgba(9, 17, 42, .72);
	border: 1px solid var(--line);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 30px 60px -30px rgba(2, 5, 16, .9);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}
#luckForm > * { animation: rise .7s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--i, 0) * 60ms + 150ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

#luckForm .kicker {
	margin: 0 0 10px;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--mute);
}
#luckForm h1 {
	margin: 0 0 12px;
	font-size: clamp(26px, 2.4vw, 32px);
	font-weight: 900;
	line-height: 1.15;
	letter-spacing: -.01em;
	color: var(--ink);
}
#luckForm h1 .was { position: relative; color: var(--mute); }
#luckForm h1 .was::after {
	content: "";
	position: absolute;
	left: -2px;
	right: -2px;
	top: 54%;
	height: 3px;
	border-radius: 2px;
	background: var(--gold);
	transform: scaleX(0);
	transform-origin: 0 50%;
	animation: strike .45s cubic-bezier(.65, 0, .35, 1) .9s forwards;
}
#luckForm h1 .now { display: inline-block; color: var(--gold); animation: writeIn .5s cubic-bezier(.16, 1, .3, 1) 1.3s both; }
@keyframes strike { to { transform: scaleX(1); } }
@keyframes writeIn { from { opacity: 0; transform: translateY(-6px) rotate(-4deg); } to { opacity: 1; transform: none; } }
#luckForm .lead { margin: 0 0 18px; max-width: 46ch; font-size: 15px; line-height: 1.55; color: #c9d1ea; }

/* the five rounds, in playing order: five columns under the card */
.menuLeft .rounds {
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: round;
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 0;
	border-top: 1px solid var(--line);
}
.menuLeft .rounds li {
	counter-increment: round;
	display: grid;
	align-content: start;
	gap: 4px;
	padding: 12px 14px 0 0;
	font-size: 12.5px;
	line-height: 1.45;
	animation: rise .7s cubic-bezier(.16, 1, .3, 1) both;
	animation-delay: calc(var(--i, 0) * 70ms + 500ms);
}
.menuLeft .rounds li + li { padding-left: 14px; border-left: 1px solid var(--line); }
.menuLeft .rounds li::before {
	content: counter(round, decimal-leading-zero);
	font: 700 12px "JetBrains Mono", ui-monospace, Menlo, monospace;
	color: var(--gold);
}
.menuLeft .rounds b { font-weight: 800; font-size: 14px; color: var(--ink); }
.menuLeft .rounds span { color: var(--mute); }
.menuLeft .rounds i { font-style: normal; color: var(--ink); }

/* seat and mode: one connected segmented control each */
#luckForm .pick { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
#luckForm .pick legend, #luckForm .field label { display: block; margin: 0 0 6px; padding: 0; font-size: 13px; font-weight: 800; color: var(--ink); }
#luckForm .pick .seg {
	display: grid;
	padding: 3px;
	gap: 3px;
	border-radius: 12px;
	border: 1px solid var(--line);
	background: rgba(255, 255, 255, .03);
}
#luckForm .pick label { position: relative; display: block; min-width: 0; cursor: pointer; }
#luckForm .pick input { position: absolute; opacity: 0; pointer-events: none; }
#luckForm .pick span {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 36px;
	border-radius: 9px;
	font-weight: 800;
	font-size: 14px;
	color: var(--mute);
	transition: background-color .25s cubic-bezier(.16, 1, .3, 1), color .25s;
}
#luckForm .pick label:hover span { color: var(--ink); }
#luckForm .pick input:checked + span { background: var(--gold); color: #241900; }
#luckForm .pick input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
#luckForm .pick label:active span { transform: scale(.97); }

#luckSeats .seg { grid-template-columns: 2fr repeat(4, 1fr); }
#luckMode .seg { grid-template-columns: 1fr 1fr; }
#luckModeHelp { display: block; margin-top: 6px; font-size: 12px; color: var(--mute); }

/* name: label above, help under it */
#luckForm .field { display: grid; gap: 6px; margin: 0 0 16px; }
#luckForm .field label { margin: 0; }
#luckForm input#luckName {
	height: 44px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: rgba(255, 255, 255, .04);
	color: var(--ink);
	font: 700 15px Nunito, sans-serif;
	transition: border-color .2s;
}
#luckForm input#luckName::placeholder { color: rgba(158, 168, 198, .7); }
#luckForm input#luckName:focus { outline: none; border-color: var(--gold); }
#luckForm .field small { font-size: 12px; color: var(--mute); }

/* start: a shimmer while the stage loads */
#luckStart {
	position: relative;
	width: 100%;
	height: 48px;
	border: 0;
	border-radius: 12px;
	background: var(--gold);
	color: #241900;
	font: 900 16px Nunito, sans-serif;
	cursor: pointer;
	overflow: hidden;
	transition: transform .2s cubic-bezier(.16, 1, .3, 1), filter .2s;
}
#luckStart:hover { filter: brightness(1.05); }
#luckStart:active { transform: translateY(1px) scale(.99); }
#luckStart .skeleton { display: none; }
#luckForm.loading #luckStart { background: rgba(255, 255, 255, .06); cursor: progress; }
#luckForm.loading #luckStart .label { visibility: hidden; }
#luckForm.loading #luckStart .skeleton {
	display: block;
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, transparent 20%, rgba(242, 201, 76, .22) 50%, transparent 80%) -100% 0 / 200% 100% no-repeat;
	animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: 200% 0; } }
#luckForm.failed #luckStart { background: rgba(255, 255, 255, .06); color: var(--mute); cursor: not-allowed; }
#luckErr { margin: 8px 0 0; font-size: 13px; font-weight: 700; color: #ff8a7a; }
#luckErr:empty { display: none; }
#luckForm .foot { margin: 14px 0 0; font-size: 12px; line-height: 1.5; color: var(--mute); }

/* below 760 px wide (phones held upright): one column, the card on top */
@media (max-width: 760px) {
	#luckMenu { grid-template-columns: minmax(0, 1fr); align-items: start; padding: 64px 16px 24px; }
	.menuLeft { display: contents; }
	.menuArt { order: 1; }
	.menuArt img { max-height: 40dvh; }
	#luckForm { order: 2; padding: 22px 18px 18px; }
	.menuLeft .rounds { order: 3; grid-template-columns: minmax(0, 1fr); }
	.menuLeft .rounds li { grid-template-columns: 26px minmax(0, 1fr); padding: 10px 0; border-bottom: 1px solid var(--line); }
	.menuLeft .rounds li + li { padding-left: 0; border-left: 0; }
	.menuLeft .rounds li::before { grid-row: 1 / 3; }
}
/* a phone held sideways: little height - the round list goes */
@media (max-height: 560px) {
	#luckMenu { padding-top: 56px; }
	.menuLeft .rounds { display: none; }
	.menuArt img { max-height: calc(100dvh - 90px); }
	#luckMenu { padding-bottom: 12px; }
	#luckForm { padding: 16px 18px; }
	#luckForm .kicker, #luckForm .foot, #luckForm .field small { display: none; }
	#luckForm .pick, #luckForm .field { margin-bottom: 10px; }
	#luckForm .pick span { height: 32px; }
	#luckModeHelp { display: none; }
	#luckForm input#luckName, #luckStart { height: 40px; }
	#luckForm .lead { display: none; }
	#luckForm h1 { font-size: 22px; margin-bottom: 12px; }
	#luckForm .pick legend, #luckForm .field label { margin-bottom: 4px; }
	#luckForm .pick span { height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
	.menuArt img, #luckForm > *, #luckForm h1 .now, .menuLeft .rounds li { animation: none; }
	#luckForm h1 .was::after { animation: none; transform: scaleX(1); }
	#luckForm.loading #luckStart .skeleton { animation: none; }
}

/* Câu hỏi phụ: "BẮT ĐẦU" inside the question bar, in place of the question, while the 15 s music plays (LuckDirector startSign) */
#luckFrame .questionBarDiv .luckGo {
	position: absolute;
	left: 0;
	right: 0;
	top: 72px;
	margin: 0;
	text-align: center;
	font-size: 110px;
	font-weight: 900;
	line-height: 1;
	letter-spacing: 4px;
	color: #fff;
	text-shadow: 0 4px 18px rgba(0, 0, 0, .45);
	pointer-events: none;
	opacity: 0;
	transform: scale(.85);
}
#luckFrame .questionBarDiv.luckGoOn .questionTextP { visibility: hidden; }
#luckFrame .questionBarDiv .luckGo.on {
	opacity: 1;
	transform: scale(1);
	transition: opacity .15s, transform .25s cubic-bezier(.16, 1, .3, 1);
}
