:root {
	--brand-primary: #ffd833;
	--brand-secondary: #ff2e88;
	--brand-bg: #1b0b29;
	--hud-bg: rgba(18, 7, 30, 0.78);
}

* {
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

html, body {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #0b0512;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #fff;
	touch-action: none;
	overscroll-behavior: none;
	user-select: none;
	-webkit-user-select: none;
}

.hidden {
	display: none !important;
}

#stage-wrap {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: radial-gradient(circle at center, #25113b 0%, #0a0411 100%);
}

#phone-frame {
	position: relative;
	width: 100vw;
	height: 100dvh;
	overflow: hidden;
	background: #140821;
}

@media (min-width: 560px) {
	#phone-frame {
		height: 94dvh;
		width: calc(94dvh * 9 / 16);
		max-width: 460px;
		max-height: 860px;
		border-radius: 22px;
		box-shadow: 0 24px 70px rgba(0, 0, 0, 0.78), 0 0 0 2px rgba(255, 216, 51, 0.3);
	}
}

#game-container {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

#game-container canvas {
	display: block;
	width: 100% !important;
	height: 100% !important;
	image-rendering: pixelated;
	touch-action: none;
}

#damage-flash {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: rgba(255, 25, 45, 0.38);
	opacity: 0;
	transition: opacity 0.22s ease-out;
	z-index: 15;
}

/* Top HUD */
#hud-bar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 20;
	padding: max(8px, env(safe-area-inset-top)) 10px 6px;
	background: var(--hud-bg);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	border-bottom: 1px solid rgba(255, 255, 255, 0.12);
	pointer-events: none;
}

.hud-row {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 6px;
}

.hud-left, .hud-right {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.hud-right {
	align-items: flex-end;
}

.hud-right-top {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 800;
}

#mute-btn {
	pointer-events: auto;
	border: none;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	width: 24px;
	height: 22px;
	border-radius: 6px;
	font-size: 12px;
	cursor: pointer;
	padding: 0;
	line-height: 22px;
}

.hud-stat {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	font-weight: 800;
}

.hud-stat img, .hud-timer img {
	width: 13px;
	height: 13px;
	image-rendering: pixelated;
}

.hud-stat.hp { color: #ff5b5b; }
.hud-stat.coins { color: #ffe047; }

.hud-center {
	text-align: center;
}

.hud-timer {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	font-size: 16px;
	font-weight: 900;
	letter-spacing: 0.5px;
}

.hud-timer.urgent { color: #ff5247; }

.hud-goal {
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.5px;
	color: #7ee8ff;
}

.hud-goal.beaten {
	color: #ffd833;
}

.hud-combo {
	font-size: 11px;
	font-weight: 900;
	color: #ffae2b;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.xp-track {
	margin-top: 6px;
	height: 5px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.16);
	overflow: hidden;
}

#hud-xp-fill {
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, #22c55e, #ffd833);
	transition: width 0.12s ease;
}

/* Boss Bar & Banner */
#boss-bar {
	position: absolute;
	top: 68px;
	left: 16px;
	right: 16px;
	z-index: 20;
	pointer-events: none;
	text-align: center;
}

#boss-name {
	font-size: 13px;
	font-weight: 900;
	letter-spacing: 1px;
	color: #ffd833;
	text-shadow: 0 2px 6px #000;
	margin-bottom: 4px;
}

.boss-track {
	height: 11px;
	border-radius: 999px;
	background: rgba(30, 6, 12, 0.9);
	border: 1.5px solid #ffd833;
	overflow: hidden;
}

#boss-hp-fill {
	height: 100%;
	width: 100%;
	background: linear-gradient(90deg, #ef4444, #f97316);
	transition: width 0.1s linear;
}

#boss-banner {
	position: absolute;
	top: 40%;
	left: 16px;
	right: 16px;
	z-index: 25;
	pointer-events: none;
	text-align: center;
	font-size: 28px;
	font-weight: 900;
	line-height: 1.1;
	color: #ff3b30;
	text-shadow: 0 3px 0 #1a0610, 0 0 22px rgba(255, 59, 48, 0.85);
	animation: bannerPop 0.3s ease-out;
}

@keyframes bannerPop {
	0% { transform: scale(0.65); opacity: 0; }
	70% { transform: scale(1.08); opacity: 1; }
	100% { transform: scale(1); opacity: 1; }
}

/* Power-up Toast */
#powerup-toast {
	position: absolute;
	top: 98px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 24;
	pointer-events: none;
	display: flex;
	align-items: center;
	gap: 10px;
	width: min(310px, 88%);
	padding: 8px 12px;
	border-radius: 12px;
	background: rgba(18, 8, 32, 0.92);
	border: 2px solid #ffd833;
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
	animation: toastIn 0.18s ease-out;
}

@keyframes toastIn {
	from { opacity: 0; transform: translate(-50%, -8px) scale(0.92); }
	to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

#powerup-icon {
	width: 28px;
	height: 28px;
	image-rendering: pixelated;
	flex-shrink: 0;
}

.powerup-text {
	min-width: 0;
}

#powerup-title {
	font-size: 12px;
	font-weight: 900;
	letter-spacing: 0.4px;
	color: #ffd833;
}

#powerup-detail {
	font-size: 11px;
	font-weight: 700;
	color: #f0ebfa;
	margin-top: 1px;
}

/* Overlays & Modals */
.overlay {
	position: absolute;
	inset: 0;
	z-index: 40;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 16px;
	background: rgba(8, 3, 16, 0.8);
	backdrop-filter: blur(5px);
	-webkit-backdrop-filter: blur(5px);
	overflow-y: auto;
	touch-action: auto;
}

.modal-card {
	width: 100%;
	max-width: 340px;
	background: var(--brand-bg);
	border: 2px solid var(--brand-primary);
	border-radius: 18px;
	padding: 18px;
	text-align: center;
	box-shadow: 0 22px 54px rgba(0, 0, 0, 0.72);
	touch-action: auto;
}

.logo-pill {
	display: inline-block;
	background: var(--logo-pill-bg, #fffbf2);
	border: 2px solid var(--brand-primary);
	border-radius: 12px;
	padding: 8px 16px;
	margin-bottom: 10px;
}

.logo-pill img {
	display: block;
	max-height: 54px;
	max-width: 220px;
	object-fit: contain;
}

.logo-pill.small {
	padding: 5px 12px;
	margin-bottom: 6px;
}

.logo-pill.small img {
	max-height: 38px;
	max-width: 170px;
}

.brand-kicker {
	font-size: 12px;
	font-weight: 900;
	letter-spacing: 1.4px;
	color: var(--brand-secondary);
	text-transform: uppercase;
	margin-bottom: 4px;
}

.game-title {
	margin: 2px 0 4px;
	font-size: 24px;
	font-weight: 900;
	color: var(--brand-primary);
	line-height: 1.1;
}

.tagline {
	font-size: 12px;
	color: #bfeff7;
	font-weight: 700;
	margin-bottom: 10px;
}

.prize-pill {
	display: inline-block;
	padding: 6px 12px;
	border-radius: 999px;
	background: rgba(34, 197, 94, 0.2);
	border: 1px solid #4ade80;
	color: #86efac;
	font-size: 12px;
	font-weight: 900;
	margin-bottom: 6px;
}

.record-line {
	font-size: 12px;
	font-weight: 800;
	color: #7ee8ff;
	margin-bottom: 10px;
}

.howto {
	margin: 0 0 14px;
	font-size: 13px;
	line-height: 1.45;
	color: rgba(255, 255, 255, 0.84);
}

/* Victory Card */
.win-card {
	padding: 14px;
}

.win-banner {
	border-radius: 12px;
	padding: 12px 10px 10px;
	margin-bottom: 10px;
	background: radial-gradient(circle at center, rgba(110, 32, 130, 0.9), rgba(32, 12, 52, 0.95));
	border: 1px solid rgba(255, 216, 51, 0.5);
}

.win-headline {
	font-size: 22px;
	font-weight: 900;
	color: var(--brand-primary);
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.voucher-box {
	background: rgba(8, 3, 16, 0.72);
	border: 2px solid var(--brand-secondary);
	border-radius: 14px;
	padding: 12px;
	margin-bottom: 10px;
}

.voucher-prize {
	font-size: 18px;
	font-weight: 900;
	color: var(--brand-primary);
}

.voucher-terms {
	font-size: 11px;
	color: rgba(255, 255, 255, 0.75);
	margin-top: 2px;
}

.voucher-code {
	font-size: 17px;
	font-weight: 900;
	letter-spacing: 1.5px;
	color: #fff;
	margin: 8px 0;
}

.live-strip {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 11px;
	font-weight: 800;
	margin-bottom: 10px;
	padding: 5px 8px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.06);
}

.live-indicator {
	display: flex;
	align-items: center;
	gap: 6px;
	color: #86efac;
}

.pulse-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #4ade80;
	animation: dotPulse 1s infinite ease-in-out;
}

@keyframes dotPulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.25; }
}

#win-expiry {
	color: #fbbf24;
}

.hint-tiny {
	font-size: 10px;
	color: rgba(255, 255, 255, 0.55);
	margin-top: 6px;
}

.score-summary {
	font-size: 12px;
	font-weight: 800;
	color: #fde68a;
	margin: 6px 0 10px;
}

.win-footer-btns {
	display: flex;
	gap: 8px;
	justify-content: center;
}

.win-footer-btns > * {
	flex: 1;
}

.go-title {
	margin: 0 0 8px;
	font-size: 24px;
	font-weight: 900;
	color: var(--brand-secondary);
}

.go-stat {
	font-size: 15px;
	font-weight: 800;
	color: #ff6b6b;
	margin-bottom: 4px;
}

/* Buttons */
.btn-primary, .btn-green, .btn-wa, .btn-line, .btn-gold, .btn-ghost {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 16px;
	border-radius: 12px;
	border: none;
	font-size: 14px;
	font-weight: 900;
	color: #fff;
	cursor: pointer;
	text-decoration: none;
}

.btn-primary {
	background: linear-gradient(135deg, #ff2e88, #d41664);
	box-shadow: 0 6px 18px rgba(212, 22, 100, 0.4);
}

.btn-green {
	background: linear-gradient(135deg, #22c55e, #15803d);
	box-shadow: 0 6px 18px rgba(21, 128, 61, 0.4);
}

.btn-wa {
	background: linear-gradient(135deg, #25d366, #128c7e);
	box-shadow: 0 6px 18px rgba(18, 140, 126, 0.4);
	margin-bottom: 8px;
}

.btn-line {
	background: linear-gradient(135deg, #06c755, #00993d);
	box-shadow: 0 6px 18px rgba(0, 153, 61, 0.4);
	margin-bottom: 8px;
}

.btn-gold {
	background: linear-gradient(135deg, #f59e0b, #d97706);
}

.btn-ghost {
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.25);
	color: #ffd833;
	font-size: 12px;
	padding: 10px 14px;
}

.btn-link {
	width: 100%;
	margin-top: 6px;
	padding: 8px;
	border: none;
	background: transparent;
	color: rgba(255, 255, 255, 0.65);
	font-size: 13px;
	cursor: pointer;
}

.big-btn {
	width: 100%;
	padding: 14px;
	font-size: 17px;
}

.full-btn {
	width: 100%;
}

button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Forms */
.field {
	text-align: left;
	margin-bottom: 10px;
}

.field label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	color: rgba(255, 255, 255, 0.78);
	margin-bottom: 4px;
}

.field input {
	width: 100%;
	padding: 12px 13px;
	border-radius: 10px;
	border: 1.5px solid rgba(255, 255, 255, 0.24);
	background: rgba(255, 255, 255, 0.09);
	color: #fff;
	font-size: 16px;
	outline: none;
	user-select: text;
	-webkit-user-select: text;
}

.field input:focus {
	border-color: var(--brand-primary);
}

.optin-row {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	text-align: left;
	font-size: 12px;
	color: rgba(255, 255, 255, 0.85);
	margin: 10px 0 12px;
	cursor: pointer;
}

.optin-row input {
	width: 18px;
	height: 18px;
	accent-color: var(--brand-primary);
	flex-shrink: 0;
}

.or-divider {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 10px 0;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 1px;
	color: rgba(255, 255, 255, 0.52);
}

.or-divider::before, .or-divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: rgba(255, 255, 255, 0.2);
}

.err-box {
	margin-bottom: 10px;
	padding: 8px 10px;
	border-radius: 8px;
	background: rgba(255, 60, 75, 0.22);
	border: 1px solid rgba(255, 80, 95, 0.6);
	color: #fecaca;
	font-size: 12px;
}

.code-dashed {
	margin: 10px 0 12px;
	padding: 12px;
	border-radius: 12px;
	background: rgba(0, 0, 0, 0.35);
	border: 2px dashed var(--brand-primary);
}
