:root {
	--orange-1:  #d06b50;
	--orange-2:  #b8492e;
	--orange-3:  #8a2820;
	--gold-1:    #f3d04e;
	--gold-2:    #b6862a;
	--ink:       #1a0807;
	--stage-w:   480px;
	--reel-w:    86%;
}

* {
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	background: #15080a;
	color: var(--gold-1);
	font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
	overflow: hidden;
}

img {
	display: block;
	max-width: 100%;
	user-select: none;
	pointer-events: none;
}

button {
	border: 0;
	background: transparent;
	padding: 0;
	cursor: pointer;
	color: inherit;
	font: inherit;
}

.stage {
	position: relative;
	width: 100%;
	max-width: var(--stage-w);
	margin: 0 auto;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	background:
		linear-gradient(180deg,
			var(--orange-1) 0%,
			var(--orange-2) 50%,
			var(--orange-3) 100%);
	overflow: hidden;
	box-shadow: 0 0 30px rgba(0,0,0,.6);
}

.bg-top {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 16%;
	object-fit: cover;
	object-position: top center;
	-webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
	mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
	z-index: 0;
}

.bg-bottom {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 26%;
	object-fit: cover;
	object-position: bottom center;
	-webkit-mask-image: linear-gradient(to top, black 70%, transparent 100%);
	mask-image: linear-gradient(to top, black 70%, transparent 100%);
	z-index: 0;
}

.game {
	position: relative;
	z-index: 1;
	padding: 10px 0 0;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.logo {
	display: block;
	width: 40%;
	max-width: 260px;
	margin: 0 auto 6px;
	filter: drop-shadow(0 4px 10px rgba(0,0,0,.55));
}

.mult {
	position: relative;
	width: 106%;
	margin: 2px -3% -20px;
	aspect-ratio: 772 / 120;
	z-index: 4;
}

.mult__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	transition: opacity 360ms ease-out;
}

.mult__img.is-on {
	opacity: 1;
}

.board {
	position: relative;
	width: 100%;
	flex: 1;
	min-height: 0;
}

.phoenix-wrap {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 7%;
	right: 7%;
	pointer-events: none;
	z-index: 5;
}

.phoenix {
	position: absolute;
	top: 50%;
	left: -20%;
	height: 120%;
	width: auto;
	transform: translate(-58%, -50%);
	filter: drop-shadow(0 0 14px rgba(255,180,60,.45));
}

.reel {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 7%;
	right: 7%;
	overflow: hidden;
	border-radius: 8px;
	background: linear-gradient(180deg, #4a1c14 0%, #2a0c08 100%);
	box-shadow: 0 6px 16px rgba(0,0,0,.45);
	z-index: 2;
}

.reel::before,
.reel::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	pointer-events: none;
	z-index: 5;
}

.reel::before {
	top: 0;
	height: 25px;
	background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 100%);
}

.reel::after {
	bottom: 0;
	height: 45px;
	background: linear-gradient(0deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 100%);
}

.reel__grid {
	position: absolute;
	inset: 4px;
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	grid-template-rows: repeat(7, 1fr);
}

.cell {
	position: relative;
	overflow: hidden;
	border-radius: 4px;
}

.cell img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: fill;
	transition: opacity 120ms ease-out;
}

.cell--win img {
	animation: winFlash 260ms ease-out;
}

@keyframes winFlash {
	0%, 100% { filter: brightness(1); }
	50%      { filter: brightness(1.45) drop-shadow(0 0 10px #ffd34a); }
}

.cell--burst {
	z-index: 4;
}

.cell--burst img {
	animation: burstOut 480ms cubic-bezier(.55, -0.3, .65, 0.4) forwards;
	will-change: transform, opacity, filter;
}

@keyframes burstOut {
	0%   { transform: scale(1);    opacity: 1; filter: brightness(1); }
	30%  { transform: scale(1.15); opacity: 1; filter: brightness(1.5) drop-shadow(0 0 14px #ffd34a); }
	100% { transform: scale(0);    opacity: 0; filter: brightness(.5); }
}

.cell--drop {
	overflow: visible;
	z-index: 2;
}

.cell--drop img {
	animation: dropIn 750ms cubic-bezier(.35, .1, .3, 1);
	will-change: transform;
}

@keyframes dropIn {
	0%   { transform: translateY(var(--drop-from, -200%)); opacity: 1; }
	78%  { transform: translateY(5%);  opacity: 1; }
	90%  { transform: translateY(-2%); opacity: 1; }
	100% { transform: translateY(0);   opacity: 1; }
}

.cell--settle img {
	animation: settleBump 320ms cubic-bezier(.3, 1.3, .5, 1);
}

@keyframes settleBump {
	0%   { transform: translateY(-20%); opacity: .65; }
	55%  { transform: translateY(5%);   opacity: 1; }
	100% { transform: translateY(0);    opacity: 1; }
}

.goodluck {
	position: relative;
	display: block;
	width: 93%;
	margin: -33px auto 0;
	z-index: 4;
}

.controls {
	position: relative;
	width: 100%;
	padding: 4px 0;
	margin-top: -14px;
	z-index: 3;
}

.controls::before {
	content: "";
	position: absolute;
	top: -90px;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(180deg,
		rgba(38, 12, 8, 0) 0%,
		rgba(38, 12, 8, .25) 35%,
		rgba(38, 12, 8, .55) 100%);
	z-index: -1;
	pointer-events: none;
}

.controls__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: var(--reel-w);
	margin: 0 auto;
	gap: 8px;
}

.ctrl__scatter {
	flex: 0 0 auto;
	width: 22%;
	max-width: 80px;
	height: auto;
	filter: drop-shadow(0 4px 8px rgba(0,0,0,.6));
}

.spin {
	position: relative;
	flex: 0 0 auto;
	display: block;
	width: 110px;
	height: 110px;
	border-radius: 50%;
	transition: transform 120ms ease-out;
}

.spin:active {
	transform: scale(.94);
}

.spin[disabled] {
	cursor: not-allowed;
}

.spin__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	transition: opacity 200ms ease-out;
}

.spin__img.is-on {
	opacity: 1;
}

.spin__img[data-state="spinning"].is-on {
	animation: spinRotate 800ms linear infinite;
}

@keyframes spinRotate {
	to { transform: rotate(360deg); }
}

.spin__pulse {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	pointer-events: none;
	box-shadow: 0 0 0 0 rgba(255, 200, 60, .55);
	opacity: 0;
}

.spin:not([disabled]) .spin__pulse {
	animation: spinPulse 1600ms ease-out infinite;
	opacity: 1;
}

@keyframes spinPulse {
	0%   { box-shadow: 0 0 0 0 rgba(255, 200, 60, .55); }
	60%  { box-shadow: 0 0 0 8px rgba(255, 200, 60, 0); }
	100% { box-shadow: 0 0 0 0 rgba(255, 200, 60, 0); }
}

.pop {
	position: fixed;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 100%;
	max-width: 480px;
	height: 100vh;
	height: 100dvh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	background: rgba(0, 0, 0, .78);
	z-index: 100;
}

.pop[hidden] {
	display: none;
}

.pop--jp {
	cursor: default;
}

.pop__inner {
	position: relative;
	width: 100%;
	max-width: none;
	aspect-ratio: 1080 / 540;
	animation: popImgIn 360ms cubic-bezier(.3, 1.5, .5, 1);
}

.pop__img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

@keyframes popIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes popImgIn {
	0%   { transform: scale(.3);  opacity: 0; }
	60%  { transform: scale(1.08); opacity: 1; }
	100% { transform: scale(1);    opacity: 1; }
}