
/*
	Theme:
	- Uses provided SVG assets for background.
	- Keep colors simple and readable (user can refine later).
*/

:root {
	--fg: #ecf0f1;
	--muted: rgba(236, 240, 241, 0.75);
	--panel: rgba(8, 20, 14, 0.7);
	--panel-strong: rgba(8, 20, 14, 0.85);
	--border: rgba(236, 240, 241, 0.18);
	--btn: rgba(236, 240, 241, 0.14);
	--btn-hover: rgba(236, 240, 241, 0.22);
	--btn-primary: rgba(255, 220, 120, 0.18);
	--btn-primary-hover: rgba(255, 220, 120, 0.26);
	--tile-border-radius: 0;
}

body.jungle {
	color: var(--fg);
	font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
	background-color: #07140e;
}

/* Mask HUD (under-board shields indicator) */
.jtMaskHudWrap{
	position: absolute;
	top: 50%;
	right: 10px;
	transform: translateY(-50%);
	display: grid;
	place-items: center;
	margin: 0;
	z-index: 6;
	pointer-events: none;
}

.jtMaskHud{
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 10px 10px;
	border-radius: 14px;
	background: var(--ui-bg, rgba(8, 20, 14, 0.75));
	border: 1px solid var(--ui-border, rgba(236, 240, 241, 0.16));
	box-shadow: var(--ui-shadow, 0 18px 48px rgba(0,0,0,0.45));
	backdrop-filter: blur(10px);
	user-select: none;
}

.jtMaskHud__label{
	font-weight: 900;
	letter-spacing: .2px;
	font-size: 12px;
	color: var(--ui-muted, rgba(255,255,255,0.74));
}

.jtMaskHud__slots{
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.jtMaskHud__slot{
	width: 26px;
	height: 26px;
	display: grid;
	place-items: center;
	border-radius: 10px;
	background: rgba(0,0,0,0.18);
	border: 1px solid rgba(255,255,255,0.10);
	transform: translateZ(0);
}

@media (min-width: 680px){
	/* On larger screens, sit just outside the board art */
	.jtMaskHudWrap{
		right: -62px;
	}
}

.jtMaskHud__icon{
	width: 20px;
	height: 20px;
	display: block;
	filter: drop-shadow(0 4px 10px rgba(0,0,0,0.55));
}

.jtMaskHud__slot.is-empty .jtMaskHud__icon{
	opacity: 0.25;
	transform: scale(0.92);
	filter: drop-shadow(0 2px 6px rgba(0,0,0,0.45));
}

.jtMaskHud__slot.is-filled .jtMaskHud__icon{
	opacity: 1;
}

.multiplier {
	font-weight: 800;
	font-size: 1.2em;
	letter-spacing: 0.02em;
	padding: 12px 20px;
	border-radius: 20px;
	background: linear-gradient(135deg, rgba(255, 220, 120, 0.2), rgba(255, 220, 120, 0.1));
	border: 2px solid rgba(255, 220, 120, 0.3);
	box-shadow: 0 4px 15px rgba(255, 220, 120, 0.2);
	color: #ffdc78;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
	min-width: 100px;
	text-align: center;
	transition: all 0.3s ease;
}

.multiplier.multiplier--updated {
	animation: multiplierPulse 0.6s ease-out;
}

.btn {
	border: 1px solid var(--border);
	background: linear-gradient(135deg, rgba(236, 240, 241, 0.1), rgba(236, 240, 241, 0.05));
	padding: 12px 20px;
	border-radius: 16px;
	cursor: pointer;
	transition: all 200ms ease;
	user-select: none;
	font-weight: 600;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	position: relative;
	overflow: hidden;
}

.btn::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
	transition: left 0.5s;
}

.btn:hover {
	background: linear-gradient(135deg, rgba(236, 240, 241, 0.18), rgba(236, 240, 241, 0.12));
	transform: translateY(-1px);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.btn:hover::before {
	left: 100%;
}

.btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn[disabled] {
	opacity: 0.4;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.btn[disabled]:hover {
	background: linear-gradient(135deg, rgba(236, 240, 241, 0.1), rgba(236, 240, 241, 0.05));
	transform: none;
	box-shadow: none;
}

.btn--primary {
	background: linear-gradient(135deg, rgba(255, 220, 120, 0.25), rgba(255, 220, 120, 0.15));
	border-color: rgba(255, 220, 120, 0.4);
	color: #ffdc78;
	font-weight: 700;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.btn--primary:hover {
	background: linear-gradient(135deg, rgba(255, 220, 120, 0.35), rgba(255, 220, 120, 0.25));
	border-color: rgba(255, 220, 120, 0.6);
	box-shadow: 0 4px 20px rgba(255, 220, 120, 0.3);
}

.btn--secondary {
	background: linear-gradient(135deg, rgba(46, 204, 113, 0.25), rgba(46, 204, 113, 0.15));
	border-color: rgba(46, 204, 113, 0.4);
	color: #2ecc71;
	font-weight: 700;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.btn--secondary:hover {
	background: linear-gradient(135deg, rgba(46, 204, 113, 0.35), rgba(46, 204, 113, 0.25));
	border-color: rgba(46, 204, 113, 0.6);
	box-shadow: 0 4px 20px rgba(46, 204, 113, 0.3);
}

.btn--ghost {
	background: transparent;
	border-color: rgba(236, 240, 241, 0.3);
	color: rgba(236, 240, 241, 0.8);
}

.btn--ghost:hover {
	background: rgba(236, 240, 241, 0.1);
	border-color: rgba(236, 240, 241, 0.5);
	color: var(--fg);
}

.tile {
	width: 100%;
	height: 100%;
	border: none;
	border-radius: var(--tile-border-radius);
	background: url("../assets/images/ui/game-tiles/game-tile-main.svg") center center / var(--tile-bg-scale, 100%) var(--tile-bg-scale, 100%) no-repeat;
	display: flex;
	position: relative;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: var(--tile-pad, 0px);
	overflow: hidden;
	cursor: pointer;
	transform-style: preserve-3d;
	backface-visibility: hidden;
	will-change: transform;
}

.tile:focus-visible {
	outline: 2px solid rgba(255, 220, 120, 0.7);
	outline-offset: 2px;
}

.tile__icon {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 84%;
	height: 84%;
	transform: translate(-50%, -50%);
	pointer-events: none;
	filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.55));
	will-change: transform, opacity;
}

.tile--revealed {
	background-image:
		url("../assets/images/ui/jungle-frame.svg"),
		url("../assets/images/ui/game-tiles/game-tile-main.svg");
	background-size: cover, 100% 100%;
	background-position: center, center;
	background-repeat: no-repeat, no-repeat;
	cursor: default;
	transition: none;
}

.tile--available {
	box-shadow: 0 0 0 2px rgba(255, 220, 120, 0.6);
}

/* How To Section */
.how-to-section {
	max-height: 60vh;
	overflow-y: auto;
	/* background, border, radius, padding, etc. now handled by mainUI.css */
	margin-bottom: 20px;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 220, 120, 0.5) rgba(8, 20, 14, 0.5);
	color: inherit !important;
}

/* Mobile-specific adjustments for how-to section */
@media (max-width: 679px) {
	.how-to-section {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		max-height: none;
		height: 100vh;
		width: 100vw;
		margin: 0;
		border-radius: 0;
		z-index: 1000;
		padding: 20px;
		box-sizing: border-box;
		overflow-y: auto;
		background: rgba(8, 20, 14, 0.98);
	}
	
	.how-to-section.how-to--hidden {
		display: none !important;
	}
	
	.how-to-header {
		margin-bottom: 15px;
	}
	
	.how-to-content h2 {
		font-size: 1.3em;
		margin-bottom: 15px;
	}
	
	.how-to-content h3 {
		font-size: 1.1em;
		margin: 15px 0 8px 0;
	}
	
	.tile-grid {
		grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
		gap: 10px;
	}
}

.how-to-section::-webkit-scrollbar {
	width: 8px;
}

.how-to-section::-webkit-scrollbar-track {
	background: rgba(8, 20, 14, 0.5);
	border-radius: 4px;
}

.how-to-section::-webkit-scrollbar-thumb {
	background: rgba(255, 220, 120, 0.5);
	border-radius: 4px;
}

.how-to-section::-webkit-scrollbar-thumb:hover {
	background: rgba(255, 220, 120, 0.7);
}

.how-to--hidden {
	display: none;
}

.how-to-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
}

.how-to-close {
	background: none;
	border: none;
	color: #ffdc78;
	font-size: 2em;
	cursor: pointer;
	padding: 0;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background-color 0.2s;
}

.how-to-close:hover {
	background: rgba(255, 220, 120, 0.1);
}

.how-to-content h2 {
	color: inherit !important;
	font-size: 1.5em;
	margin-bottom: 20px;
	text-align: center;
	margin: 0;
}

.how-to-content h3 {
	color: inherit !important;
	font-size: 1.2em;
	margin: 20px 0 10px 0;
}

.how-to-content p, .how-to-content li {
	color: inherit !important;
	line-height: 1.6;
}

.how-to-content ul {
	padding-left: 20px;
}

.tile-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 15px;
	margin: 15px 0;
}

.tile-info {
	background: rgba(236, 240, 241, 0.1);
	border: 1px solid rgba(236, 240, 241, 0.2);
	border-radius: 8px;
	padding: 15px;
	text-align: center;
}

.tile-info img {
	width: 40px;
	height: 40px;
	margin-bottom: 10px;
}

.tile-info h4 {
	margin: 10px 0 5px 0;
	font-size: 1.1em;
}

.tile-info p {
	margin: 5px 0;
	font-size: 0.9em;
}

.tile-info small {
	color: rgba(236, 240, 241, 0.7);
	font-size: 0.8em;
}

.tile-info--snake h4 { color: #f44336; }
.tile-info--empty h4 { color: #9e9e9e; }
.tile-info--trail h4 { color: #4caf50; }
.tile-info--treasure h4 { color: #ff9800; }

.tile--active-path {
	box-shadow: inset 0 0 0 3px rgba(255, 220, 120, 0.8);
}

.overlay {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.55);
}

.overlay--hidden {
	display: none;
}

/* =========================================================
   PORTRAIT-ONLY (Mobile)
   Block gameplay in landscape on touch devices.
========================================================= */

body.jungle .jt-orientation[hidden]{
	display: none !important;
}

body.jungle.jt-landscape-block #game-container,
body.jungle.jt-landscape-block .ui-header,
body.jungle.jt-landscape-block .ui-bottombar,
body.jungle.jt-landscape-block .ui-modal{
	pointer-events: none;
}

body.jungle.jt-landscape-block{
	overflow: hidden;
}

body.jungle .jt-orientation{
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: grid;
	place-items: center;
	padding: 16px;
}

body.jungle .jt-orientation__backdrop{
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.78);
	backdrop-filter: blur(8px);
}

body.jungle .jt-orientation__panel{
	position: relative;
	width: min(520px, 92vw);
	border-radius: 16px;
	background: rgba(8, 20, 14, 0.92);
	border: 1px solid var(--border);
	box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
	padding: 16px 16px 14px;
	text-align: center;
}

body.jungle .jt-orientation__title{
	margin: 0 0 6px;
	font-weight: 900;
	letter-spacing: .2px;
	color: rgba(255,255,255,0.92);
}

body.jungle .jt-orientation__text{
	margin: 0;
	font-weight: 700;
	color: rgba(255,255,255,0.84);
}

.modal {
	width: min(92vw, 520px);
	border-radius: 16px;
	border: 1px solid var(--border);
	background: rgba(8, 20, 14, 0.92);
	padding: 16px;
}

.modal__title {
	margin: 0 0 8px 0;
	font-size: 1.15rem;
}

.modal__body {
	color: var(--muted);
	line-height: 1.4;
	max-height: 60vh;
	overflow-y: auto;
}

.modal__body::-webkit-scrollbar {
	width: 8px;
}

.modal__body::-webkit-scrollbar-track {
	background: rgba(8, 20, 14, 0.3);
	border-radius: 4px;
}

.modal__body::-webkit-scrollbar-thumb {
	background: rgba(236, 240, 241, 0.5);
	border-radius: 4px;
}

.modal__body::-webkit-scrollbar-thumb:hover {
	background: rgba(236, 240, 241, 0.7);
}

.modal__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-top: 14px;
}

/* Modal symbol animations (Mask + Snake) */
.jtModalSymbol{
	transform: translateZ(0);
	transform-origin: 50% 60%;
	will-change: transform;
}

.jtModalSymbol--mask{
	animation: jt-mask-float 2200ms ease-in-out infinite;
}

.jtModalSymbol--snake{
	/* Short, aggressive shake burst on open (not infinite). */
	animation: jt-snake-shake 120ms ease-in-out 0ms 10;
}

@keyframes jt-mask-float{
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-10px); }
}

@keyframes jt-snake-shake{
	0% { transform: translateX(0) rotate(0deg); }
	10% { transform: translateX(-4px) rotate(-2deg); }
	20% { transform: translateX(4px) rotate(2deg); }
	30% { transform: translateX(-3px) rotate(-1.6deg); }
	40% { transform: translateX(3px) rotate(1.6deg); }
	50% { transform: translateX(-2px) rotate(-1deg); }
	60% { transform: translateX(2px) rotate(1deg); }
	70% { transform: translateX(-2px) rotate(-0.8deg); }
	80% { transform: translateX(2px) rotate(0.8deg); }
	90% { transform: translateX(-1px) rotate(-0.4deg); }
	100% { transform: translateX(0) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce){
	.jtModalSymbol--mask,
	.jtModalSymbol--snake{
		animation: none !important;
	}
}

.background-video {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	z-index: -1;
}

.dev-tools {
	display: flex;
	gap: 20px;
	padding: 16px 20px;
	background: rgba(8, 20, 14, 0.95);
	backdrop-filter: blur(15px);
	border: 1px solid rgba(236, 240, 241, 0.15);
	border-radius: 12px;
	margin: 0 16px 16px;
	flex-wrap: wrap;
	justify-content: center;
	transition: all 0.3s ease;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.dev-tools--hidden {
	display: none;
}

/* Mobile dev tools improvements */
@media (max-width: 679px) {
	.dev-tools {
		flex-direction: column;
		gap: 12px;
		padding: 12px;
		margin: 0 8px 12px;
		align-items: stretch;
	}

	.dev-tools label {
		justify-content: space-between;
		font-size: 14px;
		padding: 4px 8px;
		min-height: 44px; /* Better touch target */
	}

	.dev-controls {
		justify-content: center;
		flex-wrap: wrap;
	}

	.dev-controls .btn {
		min-height: 44px;
		padding: 8px 16px;
		font-size: 14px;
	}

	.btn-adjust {
		width: 40px;
		height: 40px;
		font-size: 16px;
		min-width: 44px; /* Ensure minimum touch target */
	}

	input[type="range"] {
		height: 12px;
		min-height: 44px; /* Better touch target for slider track */
	}

	input[type="range"]::-webkit-slider-thumb {
		height: 24px;
		width: 24px;
		min-height: 44px; /* Ensure thumb is touchable */
		min-width: 44px;
	}

	input[type="range"]::-moz-range-thumb {
		height: 24px;
		width: 24px;
		min-height: 44px;
		min-width: 44px;
	}
}

/* Slider styles */
input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	background: var(--panel);
	cursor: pointer;
	height: 8px;
	border-radius: 4px;
	outline: none;
}

input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	height: 20px;
	width: 20px;
	border-radius: 50%;
	background: var(--btn-primary);
	cursor: pointer;
	border: 2px solid var(--border);
}

input[type="range"]::-moz-range-thumb {
	height: 20px;
	width: 20px;
	border-radius: 50%;
	background: var(--btn-primary);
	cursor: pointer;
	border: 2px solid var(--border);
}

.dev-tools label {
	display: flex;
	align-items: center;
	gap: 4px;
	color: var(--fg);
	font-size: 12px;
	font-weight: 500;
	white-space: nowrap;
}

.dev-controls {
	display: flex;
	gap: 8px;
	justify-content: center;
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--border);
}

.btn-adjust {
	width: 24px;
	height: 24px;
	padding: 0;
	border: 1px solid var(--border);
	background: var(--btn);
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	font-weight: bold;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 140ms ease;
}

.btn-adjust:hover {
	background: var(--btn-hover);
}

