/* 
   PGRI Demo - dark theme

/* --- Custom Properties --- */
:root {
	--bg-primary: #0a0a14;
	--bg-secondary: #12121e;
	--bg-surface: #1a1a2e;
	--bg-surface-hover: #22223a;
	--bg-overlay: rgba(0, 0, 0, 0.7);

	--text-primary: #f0ece4;
	--text-secondary: #9a96a6;
	--text-muted: #5e5a6e;

	--gold-primary: #d4a843;
	--gold-light: #e8c96a;
	--gold-dark: #b08a2e;
	--gold-glow: rgba(212, 168, 67, 0.25);
	--gold-gradient: linear-gradient(135deg, #d4a843 0%, #e8c96a 50%, #d4a843 100%);

	--error: #e05252;
	--success: #4caf50;
	--info: #5ca0d3;

	--border-subtle: rgba(255, 255, 255, 0.06);
	--border-gold: rgba(212, 168, 67, 0.3);

	--radius-sm: 6px;
	--radius-md: 10px;
	--radius-lg: 16px;
	--radius-xl: 24px;

	--shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
	--shadow-md: 0 4px 12px rgba(0,0,0,0.5);
	--shadow-lg: 0 8px 30px rgba(0,0,0,0.6);
	--shadow-gold: 0 0 20px rgba(212,168,67,0.2);

	--space-xs: 4px;
	--space-sm: 8px;
	--space-md: 16px;
	--space-lg: 24px;
	--space-xl: 32px;
	--space-2xl: 48px;

	--font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--transition-fast: 150ms ease;
	--transition-normal: 250ms ease;
	--transition-slow: 400ms ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	height: 100dvh;
	-webkit-text-size-adjust: 100%;
}

body {
	font-family: var(--font-stack);
	font-size: 15px;
	line-height: 1.5;
	color: var(--text-primary);
	background: var(--bg-primary);
	min-height: 100dvh;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
	width: 6px;
}
::-webkit-scrollbar-track {
	background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
	background: var(--bg-surface-hover);
	border-radius: 3px;
}

::selection {
	background: var(--gold-primary);
	color: var(--bg-primary);
}

/* --- Typography --- */
.heading-gold {
	font-size: 28px;
	font-weight: 700;
	background: var(--gold-gradient);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	letter-spacing: -0.5px;
}

/* --- Button System --- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 20px;
	border: none;
	border-radius: var(--radius-md);
	font-family: var(--font-stack);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: all var(--transition-fast);
	white-space: nowrap;
	gap: 8px;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
}

.btn:active {
	transform: scale(0.97);
}

.btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	transform: none;
}

.btn-primary {
	background: var(--gold-gradient);
	color: #1a1a2e;
	box-shadow: var(--shadow-gold);
}
.btn-primary:hover:not(:disabled) {
	box-shadow: 0 0 30px rgba(212,168,67,0.35);
	filter: brightness(1.05);
}

.btn-secondary {
	background: var(--bg-surface);
	color: var(--text-primary);
	border: 1px solid var(--border-subtle);
}
.btn-secondary:hover:not(:disabled) {
	background: var(--bg-surface-hover);
	border-color: var(--border-gold);
}

.btn-icon {
	min-height: 44px;
	min-width: 44px;
	padding: 0;
	font-size: 20px;
	background: var(--bg-surface);
	color: var(--text-primary);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
}
.btn-icon:hover:not(:disabled) {
	background: var(--bg-surface-hover);
	border-color: var(--border-gold);
	color: var(--gold-primary);
}

.btn-sm {
	min-height: 36px;
	padding: 6px 14px;
	font-size: 13px;
	border-radius: var(--radius-sm);
}

.btn-lg {
	min-height: 52px;
	padding: 14px 28px;
	font-size: 17px;
	border-radius: var(--radius-lg);
}

.btn-ghost {
	background: transparent;
	color: var(--text-secondary);
	border: none;
	padding: 10px 16px;
}
.btn-ghost:hover:not(:disabled) {
	color: var(--text-primary);
	background: rgba(255,255,255,0.05);
}

/* --- Form Inputs --- */
.form-group {
	margin-bottom: var(--space-md);
}

.form-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-secondary);
	margin-bottom: var(--space-xs);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.form-input {
	width: 100%;
	min-height: 44px;
	padding: 10px 14px;
	background: var(--bg-surface);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	color: var(--text-primary);
	font-family: var(--font-stack);
	font-size: 15px;
	transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
	outline: none;
}
.form-input::placeholder {
	color: var(--text-muted);
}
.form-input:focus {
	border-color: var(--gold-primary);
	box-shadow: 0 0 0 3px var(--gold-glow);
}

.checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: var(--space-sm);
	cursor: pointer;
	font-size: 14px;
	color: var(--text-secondary);
	line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
	appearance: none;
	-webkit-appearance: none;
	width: 22px;
	height: 22px;
	min-width: 22px;
	border: 2px solid var(--text-muted);
	border-radius: var(--radius-sm);
	background: var(--bg-surface);
	cursor: pointer;
	transition: all var(--transition-fast);
	position: relative;
	margin-top: 1px;
}
.checkbox-label input[type="checkbox"]:checked {
	background: var(--gold-primary);
	border-color: var(--gold-primary);
}
.checkbox-label input[type="checkbox"]:checked::after {
	content: "";
	position: absolute;
	left: 6px;
	top: 2px;
	width: 6px;
	height: 11px;
	border: solid #1a1a2e;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
.checkbox-label input[type="checkbox"]:focus {
	box-shadow: 0 0 0 3px var(--gold-glow);
}

/* --- Card --- */
.card {
	background: var(--bg-secondary);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-lg);
	padding: var(--space-lg);
	box-shadow: var(--shadow-md);
	transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card-hover:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow-lg);
}

/* --- Toast Notifications --- */
.toast-container {
	position: fixed;
	top: var(--space-md);
	left: 50%;
	transform: translateX(-50%);
	z-index: 10000;
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
	pointer-events: none;
	width: calc(100% - var(--space-xl));
	max-width: 420px;
}

.toast {
	padding: 12px 20px;
	border-radius: var(--radius-md);
	font-size: 14px;
	font-weight: 500;
	color: #fff;
	box-shadow: var(--shadow-lg);
	pointer-events: auto;
	opacity: 0;
	transform: translateY(-16px);
	transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.toast-visible {
	opacity: 1;
	transform: translateY(0);
}

.toast-error {
	background: var(--error);
}
.toast-success {
	background: var(--success);
}
.toast-info {
	background: var(--info);
}

/* --- Modal / Overlay --- */
.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 5000;
	opacity: 0;
	transition: opacity var(--transition-normal);
	padding: var(--space-md);
}

.modal-overlay.modal-visible {
	opacity: 1;
}

.modal-content {
	background: var(--bg-secondary);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-lg);
	padding: var(--space-lg);
	max-width: 400px;
	width: 100%;
	box-shadow: var(--shadow-lg);
	transform: scale(0.92);
	transition: transform var(--transition-normal);
}

.modal-visible .modal-content {
	transform: scale(1);
}

.modal-title {
	font-size: 18px;
	font-weight: 700;
	margin-bottom: var(--space-sm);
}

.modal-message {
	color: var(--text-secondary);
	margin-bottom: var(--space-lg);
	font-size: 15px;
	line-height: 1.5;
}

.modal-actions {
	display: flex;
	gap: var(--space-sm);
	justify-content: flex-end;
}

/* --- Page Transitions --- */
.page {
	display: none;
	opacity: 0;
	transition: opacity var(--transition-slow);
}

.page.active {
	display: block;
}

.page.visible {
	opacity: 1;
}

/* --- App Header --- */
.app-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--bg-primary);
	border-bottom: 1px solid var(--border-subtle);
	padding: var(--space-md) var(--space-lg);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.app-header .heading-gold {
	font-size: 20px;
}

.header-nav {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
}

.app-header.hidden {
	display: none;
}

/* --- Catalog Page --- */
.catalog-section-header {
	padding: var(--space-md) var(--space-lg);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.catalog-section-header h2 {
	font-size: 18px;
	font-weight: 600;
}

.cart-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 24px;
	padding: 0 7px;
	background: var(--gold-primary);
	color: var(--bg-primary);
	border-radius: 12px;
	font-size: 12px;
	font-weight: 700;
	margin-left: var(--space-sm);
}

.catalog-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--space-md);
	padding: 0 var(--space-md) 120px;
	align-items: start;
}

@media (min-width: 600px) {
	.catalog-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}
@media (min-width: 900px) {
	.catalog-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

/* --- Game Cards --- */
.game-card {
	background: var(--bg-secondary);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-lg);
	overflow: hidden;
	transition: all var(--transition-normal);
}

.game-card.in-cart {
	border-color: var(--gold-primary);
	box-shadow: 0 0 16px var(--gold-glow);
}

.game-card-image {
	width: 100%;
	aspect-ratio: 3 / 4;
	object-fit: cover;
	object-position: top;
	cursor: pointer;
	background: var(--bg-surface);
}

.game-card-body {
	padding: var(--space-sm) var(--space-md) var(--space-md);
}

.game-card-title {
	font-size: 13px;
	color: var(--text-secondary);
	margin-bottom: var(--space-xs);
}

.game-card-price {
	font-size: 16px;
	font-weight: 700;
	color: var(--gold-primary);
	margin-bottom: var(--space-sm);
}

.game-card-actions {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
}

.game-card-qty {
	font-size: 15px;
	font-weight: 600;
	min-width: 20px;
	text-align: center;
}

/* --- Sticky Purchase Footer --- */
.purchase-footer {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	background: var(--bg-secondary);
	border-top: 1px solid var(--border-subtle);
	padding: var(--space-md) var(--space-lg);
	display: flex;
	align-items: center;
	justify-content: space-between;
	z-index: 90;
	box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
	transform: translateY(100%);
	transition: transform var(--transition-normal);
}

.purchase-footer.footer-visible {
	transform: translateY(0);
}

.footer-total {
	font-size: 14px;
	color: var(--text-secondary);
}

.footer-total-amount {
	font-size: 22px;
	font-weight: 700;
	color: var(--gold-primary);
}

/* --- Welcome bar --- */
.welcome-bar {
	padding: var(--space-sm) var(--space-lg);
	color: var(--text-secondary);
	font-size: 14px;
}

/* --- Interstitial Page --- */
.interstitial-wrapper {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 80vh;
	padding: var(--space-lg);
}

.interstitial-wrapper video {
	width: 100%;
	max-width: 600px;
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-lg);
}

.progress-bar-track {
	width: 100%;
	max-width: 600px;
	height: 4px;
	background: var(--bg-surface);
	border-radius: 2px;
	margin-top: var(--space-lg);
	overflow: hidden;
}

.progress-bar-fill {
	height: 100%;
	background: var(--gold-gradient);
	border-radius: 2px;
	width: 0%;
	animation: progressFill 5s linear forwards;
}

@keyframes progressFill {
	to { width: 100%; }
}

/* --- Purchases Page --- */
.purchases-header {
	padding: var(--space-md) var(--space-lg);
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: var(--space-sm);
}

.purchases-header h2 {
	font-size: 18px;
	font-weight: 600;
}

.order-group {
	margin: 0 var(--space-md) var(--space-lg);
	background: var(--bg-secondary);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-lg);
	overflow: hidden;
}

.order-header {
	padding: var(--space-md) var(--space-lg);
	background: var(--bg-surface);
	border-bottom: 1px solid var(--border-subtle);
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: var(--space-sm);
}

.order-number {
	font-weight: 700;
	font-size: 14px;
}

.order-date {
	font-size: 13px;
	color: var(--text-secondary);
}

.ticket-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--space-md);
	padding: var(--space-md);
}

@media (min-width: 600px) {
	.ticket-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

.ticket-card {
	position: relative;
	border-radius: var(--radius-md);
	overflow: hidden;
	cursor: pointer;
	background: var(--bg-surface);
	border: 1px solid var(--border-subtle);
	transition: all var(--transition-normal);
}

.ticket-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow-md);
}

.ticket-card img {
	width: 100%;
	aspect-ratio: 3 / 4;
	object-fit: cover;
}

.ticket-card.unrevealed {
	border-color: var(--gold-dark);
}

.ticket-card.unrevealed::after {
	content: "TAP TO REVEAL";
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 8px;
	background: linear-gradient(transparent, rgba(0,0,0,0.85));
	color: var(--gold-light);
	font-size: 11px;
	font-weight: 700;
	text-align: center;
	letter-spacing: 1px;
}

.ticket-shimmer {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		110deg,
		transparent 30%,
		rgba(212, 168, 67, 0.08) 45%,
		rgba(212, 168, 67, 0.15) 50%,
		rgba(212, 168, 67, 0.08) 55%,
		transparent 70%
	);
	background-size: 250% 100%;
	animation: shimmer 2.5s infinite;
	pointer-events: none;
}

@keyframes shimmer {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

.ticket-win {
	padding: 6px;
	text-align: center;
	font-size: 13px;
	font-weight: 700;
}

.ticket-win.win-zero {
	color: var(--text-muted);
}

.ticket-win.win-normal {
	color: var(--success);
}

.ticket-win.win-big {
	color: var(--gold-primary);
	text-shadow: 0 0 10px var(--gold-glow);
}

/* --- Reveal Page --- */
.reveal-page {
	position: fixed;
	inset: 0;
	background: #000;
	z-index: 200;
	display: flex;
	flex-direction: column;
}

.reveal-top-bar {
	padding: var(--space-md) var(--space-lg);
	background: rgba(0,0,0,0.6);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	display: flex;
	align-items: center;
	justify-content: space-between;
	z-index: 1;
}

.reveal-instruction {
	font-size: 14px;
	color: var(--text-secondary);
}

.reveal-canvas-area {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.reveal-canvas-area canvas {
	box-shadow: 0 0 40px rgba(0,0,0,0.8);
	border-radius: var(--radius-sm);
}

.reveal-bottom-bar {
	padding: var(--space-md) var(--space-lg);
	background: rgba(0,0,0,0.6);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
	flex-wrap: wrap;
	z-index: 1;
}

.reveal-winnings {
	font-size: 20px;
	font-weight: 700;
}

.reveal-winnings.win-celebration {
	color: var(--gold-primary);
	animation: pulse 1s ease-in-out infinite;
}

.reveal-winnings.win-big-celebration {
	color: var(--gold-light);
	animation: bounce 0.6s ease-in-out infinite;
	text-shadow: 0 0 20px var(--gold-glow);
}

@keyframes pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.08); }
}

@keyframes bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-6px); }
}

.reveal-actions {
	display: flex;
	gap: var(--space-sm);
	align-items: center;
}

/* --- Video Modal (for Watch Scratch) --- */
.video-modal-content {
	max-width: 90vw;
	max-height: 80vh;
	background: #000;
	border-radius: var(--radius-lg);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.video-modal-content video {
	width: 100%;
	max-height: 70vh;
	border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.video-modal-actions {
	padding: var(--space-md);
	display: flex;
	justify-content: center;
	background: var(--bg-secondary);
}

/* --- Confirm Dialog --- */
#confirmDialog {
	display: none;
}

#confirmDialog.modal-overlay {
	display: flex;
}

/* --- Loading Overlay --- */
.loading-overlay {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 20, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: inherit;
	z-index: 10;
}

.spinner {
	width: 32px;
	height: 32px;
	border: 3px solid var(--border-subtle);
	border-top-color: var(--gold-primary);
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

/* --- Register Page --- */
.register-page {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100dvh;
	padding: var(--space-lg);
}

.register-card {
	width: 100%;
	max-width: 440px;
}

.register-card .heading-gold {
	text-align: center;
	margin-bottom: var(--space-xs);
}

.register-subtitle {
	text-align: center;
	color: var(--text-secondary);
	font-size: 14px;
	margin-bottom: var(--space-xl);
}

.register-card .form-group:last-of-type {
	margin-bottom: var(--space-lg);
}

.register-cta {
	width: 100%;
	margin-top: var(--space-md);
}

/* --- Image Zoom Modal --- */
.zoom-image {
	max-width: 90vw;
	max-height: 85vh;
	object-fit: contain;
	border-radius: var(--radius-md);
	cursor: pointer;
}
