:root {
	/* Let shared shell do most styling; these tune the stage/frame */
	--nh-frame-radius: 18px;
	--nh-glow: rgba(124, 92, 255, 0.45);
	--nh-glow2: rgba(46, 242, 255, 0.28);
	--nh-payline-stroke: rgba(255, 150, 46, 0.92);
	--nh-payline-dot-fill: rgba(255, 230, 156, 0.98);
	--nh-payline-dot-stroke: rgba(0, 0, 0, 0.55);
	--nh-payline-back-stroke: rgba(0, 0, 0, 0.60);
	--nh-payline-width: 9px;
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
	.nh-cell,
	.nh-cell * {
		transition: none !important;
		animation: none !important;
	}
}

.nh-frame {
	position: absolute;
	inset: 0;
	pointer-events: none;
	border-radius: calc(var(--ui-radius) - 10px);
	/* Fallback frame: visible if the SVG art fails to load */
	background:
		radial-gradient(120% 80% at 20% 10%, rgba(124, 92, 255, 0.22), transparent 55%),
		radial-gradient(120% 80% at 80% 90%, rgba(46, 242, 255, 0.14), transparent 55%);
	border: 1px solid rgba(255, 255, 255, 0.10);
	box-shadow:
		0 0 0 1px rgba(255, 255, 255, 0.06) inset,
		0 0 40px rgba(124, 92, 255, 0.08),
		0 0 40px rgba(46, 242, 255, 0.06);
}

.nh-frame::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(180deg, rgba(255,255,255,0.06), transparent 35%, rgba(0,0,0,0.20));
	opacity: 0.65;
}

.nh-artWrap {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

/* Mascot: desktop-only, behind the game board art, peeking from the left */
.nh-mascot{
	position: absolute;
	display: none;
	width: auto;
	object-fit: contain;
	transform: translate3d(0, 0, 0);
	filter: drop-shadow(0 18px 30px rgba(0,0,0,0.45));
	z-index: 0;
}


/* Mobile-only mascot tuning (edit these values per game as needed) */
@media (max-width: 920px) {
	.nh-mascot{
		display: block;
		left: 0%;
		bottom: 25%;
		height: 86%;
	}
	.nh-gameArt{ z-index: 1; }
	.nh-frame{ z-index: 2; }
}

/* Desktop-only mascot tuning (edit these values per game as needed) */
@media (min-width: 921px) {
	.nh-mascot{
		display: block;
		left: 0%;
		bottom: 25%;
		height: 86%;
	}
	.nh-gameArt{ z-index: 1; }
	.nh-frame{ z-index: 2; }
}

.nh-gameArt {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
	transform: translate3d(var(--reel-art-x, 0px), var(--reel-art-y, 0px), 0) scale(var(--reel-art-scale, 1));
	transform-origin: 50% 50%;
	filter: drop-shadow(0 18px 30px rgba(0,0,0,0.45));
	z-index: 1;
}

/*
	The SVG has viewBox 1200x672 and includes a clipped rect:
	X: 211.33..988.33 (≈17.6% padding left/right)
	Y: 88.5..583.5 (≈13.2% padding top/bottom)
	We position reels in that safe "window" so the art visually contains the grid.
*/
.nh-artWindow {
	position: absolute;
	left: var(--reel-window-left, 17.6%);
	right: var(--reel-window-right, 17.6%);
	top: var(--reel-window-top, 13.2%);
	bottom: var(--reel-window-bottom, 13.2%);
	border-radius: var(--reel-window-radius, 16px);
	overflow: hidden;
	z-index: 3;
}

.nh-reels {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	grid-template-rows: repeat(3, 1fr);
	transform: translate3d(var(--reel-reels-x, 0px), var(--reel-reels-y, 0px), 0) scale(var(--reel-reels-scale, 1));
	transform-origin: 50% 50%;
	gap: var(--reel-grid-gap, 8px);
	padding: var(--reel-grid-padding, 12px);
}

/* Payline overlay (SVG) */
.nh-paylines {
	position: absolute;
	inset: 0;
	z-index: 4;
	pointer-events: none;
}

.nh-payline {
	fill: none;
	stroke: var(--nh-payline-stroke, rgba(46, 242, 255, 0.78));
	stroke-width: var(--nh-payline-width, 8px);
	stroke-linecap: round;
	stroke-linejoin: round;
	opacity: 0.9;
	filter: drop-shadow(0 10px 16px rgba(0,0,0,0.35)) drop-shadow(0 0 18px rgba(46, 242, 255, 0.12));
}

.nh-payline--back {
	stroke: var(--nh-payline-back-stroke, rgba(0, 0, 0, 0.55));
	stroke-width: calc(var(--nh-payline-width, 8px) + 6px);
	opacity: 0.55;
	filter: none;
}

.nh-paylineDot {
	fill: var(--nh-payline-dot-fill, rgba(255, 255, 255, 0.95));
	stroke: var(--nh-payline-dot-stroke, rgba(0, 0, 0, 0.55));
	stroke-width: 2px;
	opacity: 0.95;
	filter: drop-shadow(0 8px 12px rgba(0,0,0,0.35)) drop-shadow(0 0 16px rgba(255,255,255,0.18));
}

/* Reel spin effect (per-column) */
@keyframes nhReelSpin {
	0% { transform: translate3d(0, -34%, 0) scale(1.02); filter: blur(1.6px) saturate(1.1) brightness(1.06); opacity: 0.92; }
	50% { transform: translate3d(0, 34%, 0) scale(1.02); filter: blur(2.1px) saturate(1.18) brightness(1.10); opacity: 0.86; }
	100% { transform: translate3d(0, -34%, 0) scale(1.02); filter: blur(1.6px) saturate(1.1) brightness(1.06); opacity: 0.92; }
}

.nh-cell.is-spinning .nh-symbolImg {
	animation: nhReelSpin 120ms linear infinite;
}

@media (max-width: 560px) {
	.nh-reels { padding: 10px; gap: 7px; }
}

.nh-cell {
	position: relative;
	z-index: 1;
	border-radius: var(--reel-cell-radius, 14px);
	background: rgba(0, 0, 0, 0.20);
	border: 1px solid rgba(255, 255, 255, 0.10);
	overflow: hidden;
	display: grid;
	place-items: center;
	transform: translate3d(0, 0, 0);
}

.nh-cell::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background-image: url('../assets/images/bandicoot-racing-rounds-reel-tile-BG.svg');
	/* Default to a true fill; editor can switch to cover/contain if preferred */
	background-size: var(--reel-tile-bg-size, 100% 100%);
	background-position: center;
	background-repeat: no-repeat;
	opacity: var(--reel-tile-bg-opacity, 0.95);
	transform: scale(var(--reel-tile-bg-scale, 1));
	transform-origin: 50% 50%;
}

.nh-cell::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background:
		linear-gradient(180deg, rgba(255,255,255,0.08), transparent 30%, rgba(0,0,0,0.22));
	opacity: 0.75;
}

.nh-symbolImg {
	position: relative;
	z-index: 1;
	width: min(76%, 92px);
	height: min(76%, 92px);
	object-fit: contain;
	transform: scale(var(--reel-symbol-scale, 1));
	filter: drop-shadow(0 10px 16px rgba(0,0,0,0.35));
}

.nh-fallbackText {
	position: relative;
	z-index: 1;
	font-weight: 900;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	font-size: 12px;
	color: rgba(255,255,255,0.86);
	text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}

.nh-cell.is-win {
	border-color: rgba(46, 242, 255, 0.65);
	box-shadow: 0 0 0 2px rgba(46, 242, 255, 0.16) inset, 0 0 24px rgba(46, 242, 255, 0.12);
	animation: nhWinPop 900ms cubic-bezier(0.15, 0.9, 0.2, 1) both;
}

@keyframes nhWinPop {
	0% { transform: translate3d(0, 0, 0) scale(1); }
	22% { transform: translate3d(0, -3%, 0) scale(1.08); }
	60% { transform: translate3d(0, 0, 0) scale(1.05); }
	100% { transform: translate3d(0, 0, 0) scale(1); }
}

.nh-cell.is-remove {
	animation: nhFadeOut 220ms ease-out forwards;
}

@keyframes nhFadeOut {
	to { opacity: 0; transform: scale(0.96); }
}

.nh-cell.is-drop {
	animation: nhDrop var(--nh-drop-ms, 360ms) cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

/* Racing Rounds Reel: side-controls need slightly different horizontal offsets */
@media (max-width: 920px) and (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
	.reel-app .reel-sideControls__col{
		/* Left column: move right a bit (increase inset). */
		--reel-side-left-inset: 125px;
		/* Right column: move left a bit (increase inset). */
		--reel-side-right-inset: 125px;
	}
}

@keyframes nhDrop {
	from { transform: translate3d(0, var(--nh-drop-from, -22%), 0); }
	to { transform: translate3d(0, 0, 0); }
}

/* Scatter feature: activation zoom + fly-by icon */
.reel-stageInner.rr-scatterZoom {
	animation: rrScatterZoom 420ms cubic-bezier(0.15, 0.9, 0.2, 1) both;
}

@keyframes rrScatterZoom {
	0% { transform: scale(1); }
	40% { transform: scale(1.05); }
	100% { transform: scale(1); }
}

.rr-scatterFly {
	position: absolute;
	z-index: 9;
	pointer-events: none;
	filter:
		drop-shadow(0 12px 18px rgba(0,0,0,0.45))
		drop-shadow(0 0 14px rgba(255, 230, 156, 0.22));
	will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
	.reel-stageInner.rr-scatterZoom { animation: none !important; }
}

/* Bonus trigger: zoom stage + bonus tiles */
.reel-stageInner.rr-bonusStageZoom {
	animation: rrBonusStageZoom 520ms cubic-bezier(0.15, 0.9, 0.2, 1) both;
}

@keyframes rrBonusStageZoom {
	0% { transform: scale(1); }
	38% { transform: scale(1.03); }
	100% { transform: scale(1); }
}

.nh-cell.rr-bonusZoom {
	animation: rrBonusTileZoom 520ms cubic-bezier(0.15, 0.9, 0.2, 1) both;
}

@keyframes rrBonusTileZoom {
	0% { transform: scale(1); }
	38% { transform: scale(1.18); }
	100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.reel-stageInner.rr-bonusStageZoom, .nh-cell.rr-bonusZoom { animation: none !important; }
}

/* Foreground bonus popout sprite */
.rr-bonusPopout{
	position:fixed;
	z-index:5600;
	pointer-events:none;
	transform:translate(-50%,-50%);
	opacity:0;
	left:50%;
	top:50%;
	width:clamp(240px, 48vw, 520px);
	height:auto;
	filter:
		drop-shadow(0 22px 34px rgba(0,0,0,0.55))
		drop-shadow(0 0 18px rgba(255, 220, 120, 0.22))
		drop-shadow(0 0 28px rgba(46, 242, 255, 0.14));
	will-change:transform,opacity;
}

/* Bonus overlay (game-local, does not depend on shared modal) */
.nh-bonusOverlay {
	position: fixed;
	inset: 0;
	z-index: 60;
	display: none;
	place-items: center;
}

.nh-bonusOverlay[aria-hidden="false"] {
	display: grid;
}

.nh-bonusBackdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.72);
}

.nh-bonusPanel {
	position: relative;
	width: min(92vw, 820px);
	border-radius: var(--ui-radius);
	border: 1px solid rgba(255,255,255,0.12);
	background: rgba(12, 14, 30, 0.92);
	backdrop-filter: blur(12px);
	padding: 14px;
	display: grid;
	gap: 12px;
	grid-template-rows: auto auto 1fr auto;
}

.nh-bonusTop {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 10px;
}

.nh-bonusTitle {
	margin: 0;
	font-size: 18px;
}

.nh-bonusClose {
	appearance: none;
	border: 1px solid rgba(255,255,255,0.18);
	background: rgba(255,255,255,0.06);
	color: rgba(255,255,255,0.92);
	border-radius: 12px;
	padding: 8px 10px;
	cursor: pointer;
}

.nh-bonusInfo {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	color: rgba(255,255,255,0.86);
}

.nh-bonusInfo .label {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: rgba(255,255,255,0.64);
}

.nh-bonusInfo .value {
	font-weight: 900;
	font-size: 18px;
}

.nh-panels {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}

@media (max-width: 560px) {
	.nh-panels { grid-template-columns: repeat(2, 1fr); }
	.nh-bonusInfo { grid-template-columns: 1fr; }
}

.nh-panelBtn {
	appearance: none;
	cursor: pointer;
	border-radius: 16px;
	border: 1px solid rgba(255,255,255,0.12);
	background:
		radial-gradient(120% 90% at 30% 20%, rgba(124, 92, 255, 0.24), transparent 55%),
		radial-gradient(120% 90% at 70% 80%, rgba(46, 242, 255, 0.16), transparent 55%),
		rgba(0,0,0,0.18);
	color: rgba(255,255,255,0.92);
	padding: 16px 10px;
	min-height: 74px;
	font-weight: 900;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.nh-panelBtn[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
}

.nh-panelBtn.is-revealed {
	border-color: rgba(46, 242, 255, 0.55);
	box-shadow: 0 0 0 2px rgba(46, 242, 255, 0.16) inset;
}

.nh-bonusBottom {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 10px;
}

.nh-bonusMsg {
	color: rgba(255,255,255,0.78);
	font-weight: 700;
}

.nh-continueBtn {
	appearance: none;
	cursor: pointer;
	border-radius: 14px;
	border: 1px solid rgba(255,255,255,0.20);
	background: linear-gradient(90deg, rgba(124, 92, 255, 0.95), rgba(46, 242, 255, 0.80));
	color: rgba(255,255,255,0.96);
	padding: 12px 14px;
	font-weight: 900;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* Reel Editor export for /games/bandicoot-racing-rounds-reel/index.html
   Layout vars are now sourced from config.json (uiVars) to keep Studio export
   and live runtime in sync. */