/* Main Theme */
:root {
	--bg-color: #1a1a2e;
	--card-bg: #16213e;
	--accent: #e94560;
	--text: #f0f0f0;
	--success: #4cc9f0;
	--gold: #ffd700;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	padding: 0;
	background-color: var(--bg-color);
	color: var(--text);
	font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
	height: 100vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* Utils */
.hidden {
	display: none !important;
}

/* Login Screen */
#login-screen {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: radial-gradient(circle at center, #2a2a4e, #1a1a2e);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 1000;
}

.login-card {
	background: var(--card-bg);
	padding: 40px;
	border-radius: 15px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
	text-align: center;
	width: 300px;
	border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-card h1 {
	color: var(--accent);
	margin-bottom: 30px;
}

.input-group input {
	width: 100%;
	padding: 12px;
	margin-bottom: 20px;
	background: rgba(0, 0, 0, 0.2);
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: white;
	border-radius: 5px;
	font-size: 16px;
}

#login-pass {
	width: 100%;
	padding: 12px;
	margin-bottom: 20px;
	background: rgba(0, 0, 0, 0.2);
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: white;
	border-radius: 5px;
	font-size: 16px;
}

.btn-primary {
	background: var(--accent);
	color: white;
	border: none;
	padding: 12px 25px;
	border-radius: 5px;
	font-size: 16px;
	cursor: pointer;
	transition: transform 0.2s;
	width: 100%;
}

.btn-secondary {
	background: rgba(255, 255, 255, 0.12);
	color: var(--text);
	border: 1px solid rgba(255, 255, 255, 0.15);
	padding: 12px 25px;
	border-radius: 5px;
	font-size: 16px;
	cursor: pointer;
	transition: transform 0.2s;
	width: 100%;
}

.btn-secondary:active {
	transform: scale(0.95);
}

.btn-primary:active {
	transform: scale(0.95);
}

/* Game Screen */
#game-screen {
	display: none;
	width: 100%;
	height: 100%;
	flex-direction: column;
}

header {
	height: 60px;
	background: var(--card-bg);
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 40px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
	gap: 20px;
	overflow: hidden;
}

.user-info {
	display: flex;
	align-items: center;
	gap: 15px;
}

.badge {
	padding: 4px 8px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: bold;
}

.badge.free {
	background: #555;
	color: #ccc;
}
.badge.premium {
	background: linear-gradient(45deg, var(--gold), #ff8c00);
	color: #000;
}

.game-container {
	flex: 1;
	position: relative;
	background: #000;
}

.header-right,
.user-profile {
	min-width: 0;
}

.agreement-links {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	flex-wrap: nowrap;
	min-width: 0;
}

.agreement-link {
	appearance: none;
	background: linear-gradient(180deg, #444, #222);
	border: 1px solid #888;
	border-radius: 4px;
	color: #fff;
	cursor: pointer;
	font-size: 12px;
	font-weight: bold;
	line-height: 1;
	padding: 8px 13px;
	text-transform: uppercase;
	white-space: nowrap;
}

.agreement-link:hover {
	border-color: #c5c5c5;
	background: linear-gradient(180deg, #555, #2a2a2a);
}

/* Round Tabs (Launcher) */
.cycle-tabs-bar {
	background-image: url("/assets/image/bar.png");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 100% 100%;
	padding: 10px 40px;
}

.cycle-tabs {
	display: flex;
	gap: 8px;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
}

.cycle-tab {
	appearance: none;
	background-color: transparent;
	background-repeat: no-repeat;
	background-position: center;
	background-size: 100% 100%;
	border: none;
	padding: 0;
	margin: 0;
	/* Button images are 235x161; keep aspect ratio while scaling responsively. */
	aspect-ratio: 235 / 161;
	height: clamp(34px, 5vh, 58px);
	width: auto;
	cursor: pointer;
	user-select: none;
	/* Text label is provided by the image; keep DOM text for accessibility. */
	color: transparent;
	font-size: 0;
}

.cycle-tab:disabled {
	cursor: not-allowed;
}

.cycle-tab--locked {
	cursor: not-allowed;
}

.cycle-tab--active {
	cursor: default;
}

@media (max-width: 1280px) {
	header {
		padding: 0 16px;
	}

	.agreement-links {
		gap: 6px;
	}

	.agreement-link {
		font-size: 11px;
		padding: 7px 9px;
	}
}

iframe {
	width: 100%;
	height: 100%;
	border: none;
	display: block;
}

/* Paywall Modal */
.modal-overlay {
	background: rgba(0, 0, 0, 0.85);
	backdrop-filter: blur(5px);
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: none; /* Flex when active */
	justify-content: center;
	align-items: flex-start;
	overflow-y: auto;
	padding: 24px 0;
	z-index: 2000;
}

.modal-content {
	background: var(--card-bg);
	padding: 40px;
	border-radius: 20px;
	max-width: 900px;
	width: 90%;
	text-align: center;
	border: 1px solid rgba(255, 255, 255, 0.1);
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
	position: relative;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

/* Unlock confirm modal */
.unlock-confirm-content {
	max-width: 520px;
}

.unlock-confirm-actions {
	display: flex;
	gap: 12px;
	justify-content: center;
	align-items: center;
}

.unlock-confirm-actions .btn-primary,
.unlock-confirm-actions .btn-secondary {
	width: 180px;
}

.modal-content h2 {
	font-size: 2.5em;
	margin-bottom: 10px;
	color: #fff;
}

.modal-content p {
	color: #aaa;
	margin-bottom: 40px;
}

.plans-scroll {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
}

.payment-groups {
	display: grid;
	gap: 0;
	margin-bottom: 0;
	text-align: left;
}

.paywall-acc {
	background: transparent;
	border: 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 0;
	overflow: hidden;
	padding: 10px 0;
}

.paywall-acc:first-child {
	padding-top: 0;
}

.paywall-acc:last-child {
	border-bottom: none;
}

.paywall-acc summary {
	list-style: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	cursor: pointer;
	padding: 6px 0;
	font-weight: 700;
	font-size: 14px;
	color: #fff;
	user-select: none;
}

.paywall-acc summary::-webkit-details-marker {
	display: none;
}

.paywall-acc summary::after {
	content: "›";
	color: rgba(255, 255, 255, 0.78);
	font-size: 22px;
	font-weight: 400;
	line-height: 1;
	transition: transform 0.15s ease;
}

.paywall-acc[open] summary::after {
	transform: rotate(90deg);
}

.paywall-acc-content {
	padding: 8px 0 0;
	color: rgba(255, 255, 255, 0.75);
	font-size: 12px;
	line-height: 1.5;
	overflow: hidden;
	height: 0;
	transition: height 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.paywall-pay-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding-top: 4px;
}

.paywall-pay-item {
	appearance: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	background: transparent;
	border: 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 10px;
	color: #fff;
	cursor: pointer;
	padding: 8px 10px;
	text-align: left;
}

.paywall-pay-item:last-child {
	border-bottom: none;
}

.paywall-pay-item:hover {
	background: rgba(255, 255, 255, 0.06);
}

.paywall-pay-item.is-selected {
	background: rgba(212, 175, 55, 0.1);
	border: 1px solid rgba(212, 175, 55, 0.6);
}

.paywall-pay-name {
	color: rgba(255, 255, 255, 0.9);
	font-size: 13px;
	font-weight: 600;
}

.paywall-pay-icon {
	height: 18px;
	width: auto;
	object-fit: contain;
	opacity: 0.95;
}

.plans-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 14px;
	align-items: stretch;
	width: 100%;
	max-width: 100%;
}

.paywall-body {
	display: flex;
	flex-direction: row;
	flex: 1;
	gap: 16px;
	min-height: 0;
	overflow: hidden;
	padding: 20px;
}

.paywall-sidebar {
	border-right: 1px solid rgba(255, 255, 255, 0.12);
	flex-shrink: 0;
	overflow-y: auto;
	padding-right: 16px;
	width: 190px;
}

.paywall-main {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
}

.paywall-footer {
	align-items: center;
	display: flex;
	flex-shrink: 0;
	justify-content: center;
	padding: 16px 20px 20px;
}

.paywall-footer .btn-buy {
	max-width: 520px;
}

.plan-card {
	background: rgba(255, 255, 255, 0.05);
	padding: 18px 16px;
	border-radius: 12px;
	width: 100%;
	min-width: 0;
	border: 2px solid transparent;
	transition: all 0.3s ease;
	cursor: pointer;
	position: relative;
}

.plan-card:hover {
	transform: translateY(-6px);
	background: rgba(255, 255, 255, 0.08);
}

.plan-card.recommended {
	border-color: var(--accent);
	background: rgba(233, 69, 96, 0.1);
	transform: none;
}

.plan-card.recommended:hover {
	transform: translateY(-6px);
}

.plan-card.selected {
	border-color: var(--success);
	background: rgba(76, 201, 240, 0.15);
}

.plan-card.selected::after {
	content: "✓";
	position: absolute;
	top: 10px;
	right: 10px;
	background: var(--success);
	color: white;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: bold;
}

.plan-badge {
	position: absolute;
	top: -12px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--accent);
	color: white;
	padding: 5px 15px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: bold;
}

.plan-icon {
	font-size: 2.4em;
	margin-bottom: 10px;
	display: block;
}
.plan-title {
	display: block;
	font-size: 1.05em;
	font-weight: bold;
	margin-bottom: 8px;
	word-break: break-word;
}
.plan-price {
	display: block;
	font-size: 1.3em;
	color: var(--success);
	margin-bottom: 10px;
	font-weight: bold;
}
.plan-features {
	color: #888;
	font-size: 0.85em;
	margin-bottom: 14px;
	line-height: 1.4;
	word-break: break-word;
}

@media (max-width: 980px) {
	.paywall-body {
		flex-direction: column;
		overflow-y: auto;
	}

	.paywall-sidebar {
		border-bottom: 1px solid rgba(255, 255, 255, 0.12);
		border-right: none;
		padding-bottom: 12px;
		padding-right: 0;
		width: 100%;
	}

	.plans-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.plans-grid {
		grid-template-columns: 1fr;
	}
}

.btn-buy {
	background: transparent;
	border: 2px solid white;
	color: white;
	padding: 10px 20px;
	border-radius: 25px;
	cursor: pointer;
	transition: all 0.2s;
	width: 100%;
}

.btn-buy:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.plan-card.recommended .btn-buy {
	background: var(--accent);
	border-color: var(--accent);
}

.plan-card:hover .btn-buy {
	background: white;
	color: black;
	border-color: white;
}

#close-paywall-btn {
	background: transparent;
	border: 1px solid #666;
	color: #888;
	padding: 8px 16px;
	margin: 30px auto 0;
	display: block;
	border-radius: 20px;
	cursor: pointer;
	transition: all 0.2s;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}
#close-paywall-btn:hover {
	border-color: white;
	color: white;
}
