:root {
	--gold-top: #fff6c2;
	--gold-bottom: #ffb22e;
	--text: #fff;
	--muted: rgba(255, 255, 255, .62);
	--bg: #12061c;
	--bar-h: 64px;
	--bottom-h: 108px;
	color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	height: 100%;
	background: var(--bg) url(img/screen_bg.png) center / cover no-repeat fixed;
	color: var(--text);
	font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-weight: 700;
	overflow: hidden;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
}

button { font: inherit; color: inherit; }

/* ---------- common skin (9-slice sprites from the Unity project) ---------- */

.panel-bar {
	border-image: url(img/ui_bar.png) 16 fill / 8px stretch;
}

.plate {
	border-image: url(img/ui_plate.png) 44 fill / 22px stretch;
}

.gold {
	background: linear-gradient(var(--gold-top), var(--gold-bottom));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	filter: drop-shadow(0 2px 0 #3a1650) drop-shadow(0 0 1px #3a1650);
}

.btn {
	position: relative;
	border: 0;
	padding: 0;
	cursor: pointer;
	background: none;
	color: #fff;
	text-shadow: 0 2px 0 rgba(30, 10, 40, .8), 0 0 2px rgba(30, 10, 40, .9);
	transition: transform .08s ease-out, filter .15s;
	touch-action: manipulation;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: scale(.92); }
.btn:disabled { filter: grayscale(.85) brightness(.6); cursor: default; }
.btn:focus-visible { outline: 3px solid #ffe27a; outline-offset: 3px; border-radius: 40px; }

.btn.round {
	width: 52px; height: 52px;
	border-radius: 50%;
	background: center / contain no-repeat;
	font-size: 30px;
	line-height: 1;
}
.btn.round.small { width: 44px; height: 44px; font-size: 22px; }
.btn.round.big { width: 96px; height: 96px; font-size: 22px; }
.btn.round.green { background-image: url(img/ui_round_green.png); }
.btn.round.blue { background-image: url(img/ui_round_blue.png); }
.btn.round.red { background-image: url(img/ui_round_red.png); }

.btn.pill {
	height: 48px;
	padding: 0 18px;
	font-size: 17px;
	letter-spacing: .5px;
	border-image: url(img/ui_pill_blue.png) 62 fill / 24px stretch;
	white-space: nowrap;
}
.btn.pill.purple { border-image-source: url(img/ui_pill_purple.png); }
.btn.pill.teal { border-image-source: url(img/ui_pill_teal.png); }
.btn.pill.green { border-image-source: url(img/ui_pill_green.png); }
.btn.pill.active { box-shadow: 0 0 0 4px #5dff76, 0 0 18px 4px rgba(93, 255, 118, .6); border-radius: 30px; }

/* ---------- layout ---------- */

.app {
	height: 100%;
	display: flex;
	flex-direction: column;
	padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
	height: var(--bar-h);
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0 14px;
}

.balance {
	display: flex;
	align-items: center;
	height: 46px;
	min-width: 170px;
	padding: 0 16px 0 52px;
	position: relative;
}
.balance .coin {
	position: absolute;
	left: -6px; top: 50%;
	width: 56px; height: 56px;
	transform: translateY(-50%);
}
.balance .value { font-size: 22px; }

.title {
	flex: 1;
	margin: 0;
	text-align: center;
	font-size: 30px;
	letter-spacing: 3px;
	white-space: nowrap;
	overflow: hidden;
}

.stage {
	flex: 1 1 auto;
	position: relative;
	min-height: 0;
}

.slot {
	position: absolute;
	left: 50%; top: 50%;
	width: 1346px; height: 846px;
	transform-origin: 0 0;
}

.frame {
	position: absolute;
	inset: 0;
	width: 100%; height: 100%;
	pointer-events: none;
	z-index: 5;
}

.reels {
	position: absolute;
	left: 48px; top: 48px;
	width: 1250px; height: 750px;
	background: #0f0518;
	display: flex;
	gap: 12.5px;
}

.reel {
	position: relative;
	flex: 0 0 240px;
	height: 750px;
	overflow: hidden;
	background: url(img/ui_reel_back.png) center / 100% 100%;
}
.reel::after {
	content: "";
	position: absolute;
	inset: 0;
	background: url(img/ui_reel_shade.png) center / 100% 100%;
	pointer-events: none;
	z-index: 2;
}

/* waiting for a possible 3rd FREE / BONUS */
.reel.anticipate { box-shadow: inset 0 0 0 6px #ffd14a, inset 0 0 60px 10px rgba(255, 200, 60, .55); animation: anticipate .5s ease-in-out infinite alternate; }
@keyframes anticipate { to { box-shadow: inset 0 0 0 6px #fff3b0, inset 0 0 90px 20px rgba(255, 220, 90, .8); } }

.strip {
	position: absolute;
	left: 0; top: 0;
	width: 240px;
	will-change: transform;
}

.sym {
	position: absolute;
	left: 0;
	width: 240px; height: 250px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: filter .2s, opacity .2s;
}
.strip .sym { position: relative; }
.sym img {
	width: 226px; height: 226px;
	pointer-events: none;
}

.reels.dim .sym:not(.win) { filter: brightness(.45) saturate(.6); }
.sym.win img { animation: pulse .6s ease-in-out infinite alternate; }
.sym.win::before {
	content: "";
	position: absolute;
	inset: 8px;
	border-radius: 30px;
	background: radial-gradient(closest-side, rgba(255, 220, 90, .55), rgba(255, 180, 40, 0) 100%);
	animation: glow .6s ease-in-out infinite alternate;
}
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.1); } }
@keyframes glow { from { opacity: .4; } to { opacity: 1; } }

.sym.special-hit img { animation: pulse .45s ease-in-out infinite alternate; filter: drop-shadow(0 0 18px #fff6a0); }

/* burning (cascades) */
.sym.burn img { animation: burn .45s ease-in forwards; }
@keyframes burn {
	0% { transform: scale(1); filter: none; }
	30% { transform: scale(1.15); filter: sepia(1) saturate(4) hue-rotate(-20deg) brightness(1.3); }
	100% { transform: scale(.2) rotate(18deg); opacity: 0; filter: sepia(1) saturate(5) hue-rotate(-25deg) brightness(1.6); }
}

.paylines {
	position: absolute;
	left: 48px; top: 48px;
	width: 1250px; height: 750px;
	pointer-events: none;
	z-index: 3;
	overflow: visible;
}
.paylines polyline {
	fill: none;
	stroke-width: 12;
	stroke-linejoin: round;
	stroke-linecap: round;
	filter: drop-shadow(0 0 6px rgba(0, 0, 0, .9));
}

.fx {
	position: absolute;
	left: 48px; top: 48px;
	width: 1250px; height: 750px;
	pointer-events: none;
	z-index: 4;
}

.fire {
	position: absolute;
	width: 320px; height: 320px;
	margin: -160px 0 0 -160px;
}
.fire .flame, .fire .core {
	position: absolute;
	inset: 0;
	border-radius: 50%;
}
.fire .flame {
	background: radial-gradient(closest-side, rgba(255, 140, 30, .95), rgba(255, 60, 0, .5) 55%, rgba(255, 40, 0, 0));
	animation: flame .65s ease-out forwards;
}
.fire .core {
	inset: 60px;
	background: radial-gradient(closest-side, #fff8d0, rgba(255, 220, 120, .7) 50%, rgba(255, 200, 80, 0));
	animation: core .5s ease-out forwards;
}
.fire .ember {
	position: absolute;
	left: 50%; top: 50%;
	width: 22px; height: 22px;
	margin: -11px;
	border-radius: 50%;
	background: radial-gradient(closest-side, #ffe27a, #ff7a10 60%, rgba(255, 90, 0, 0));
	animation: ember .7s ease-out forwards;
}
@keyframes flame { 0% { transform: scale(.4); opacity: 0; } 25% { opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
@keyframes core { 0% { transform: scale(.2); opacity: 1; } 60% { transform: scale(1.1); opacity: .9; } 100% { transform: scale(1.2); opacity: 0; } }
@keyframes ember { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }

.banner {
	position: absolute;
	left: 50%; top: 8px;
	transform: translateX(-50%);
	padding: 6px 22px;
	border-image: url(img/ui_plate.png) 44 fill / 18px stretch;
	font-size: 20px;
	z-index: 10;
	white-space: nowrap;
}

.bottombar {
	flex: 0 0 auto;
	min-height: var(--bottom-h);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 8px 14px;
}

.group { display: flex; align-items: center; gap: 10px; }

.display {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 56px;
	min-width: 120px;
	padding: 0 16px;
	margin-top: 16px;
}
.display .caption {
	position: absolute;
	top: -20px; left: 0; right: 0;
	text-align: center;
	font-size: 12px;
	letter-spacing: 2px;
	color: #ffd98a;
}
.display .value { font-size: 26px; white-space: nowrap; }
.display.win { flex: 1; max-width: 420px; }
.display.win .value { font-size: 32px; }

.disclaimer {
	position: fixed;
	left: 0; right: 0; bottom: 0;
	margin: 0;
	text-align: center;
	font-size: 10px;
	font-weight: 400;
	color: rgba(255, 255, 255, .35);
	pointer-events: none;
}

/* ---------- modals ---------- */

.modal {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(8, 0, 14, .94);
	animation: fadein .25s ease-out;
}
.modal[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } }

.modal h2 {
	margin: 0;
	font-size: clamp(28px, 6vw, 56px);
	letter-spacing: 3px;
	text-align: center;
}

/* bonus */
.bonus {
	width: min(1100px, 96vw);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
}
.chests {
	display: flex;
	justify-content: center;
	gap: clamp(8px, 4vw, 60px);
	width: 100%;
}
.chest {
	position: relative;
	width: clamp(100px, 27vw, 260px);
	aspect-ratio: 1;
	border: 0;
	padding: 0;
	background: none;
	cursor: pointer;
}
.chest img.box {
	position: relative;
	width: 100%; height: 100%;
	z-index: 1;
	animation: wobble 2.4s ease-in-out infinite;
	animation-delay: var(--delay, 0s);
}
.chest:disabled { cursor: default; }
.chest .ray {
	position: absolute;
	inset: -30%;
	border-radius: 50%;
	background: repeating-conic-gradient(rgba(255, 215, 90, .5) 0 10deg, rgba(255, 215, 90, 0) 10deg 30deg);
	-webkit-mask: radial-gradient(closest-side, #000 30%, transparent);
	mask: radial-gradient(closest-side, #000 30%, transparent);
	opacity: 0;
	animation: spin 8s linear infinite;
	transition: opacity .4s;
}
.chest.picked .ray { opacity: 1; }
.chest.picked img.box { animation: none; }
.chest.opening img.box { animation: shake .35s ease-in-out; }
.chest.other { opacity: .5; transition: opacity .4s; }
.chest .prize {
	position: absolute;
	left: 0; right: 0; top: -8%;
	z-index: 2;
	text-align: center;
	font-size: clamp(30px, 7vw, 74px);
	transform: scale(0);
	transition: transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
.chest .prize.show { transform: scale(1); }
.chest.other .prize.show { transform: scale(.8); }
@keyframes wobble { 0%, 80%, 100% { transform: rotate(0); } 84% { transform: rotate(5deg); } 88% { transform: rotate(-5deg); } 92% { transform: rotate(3deg); } }
@keyframes shake { 25% { transform: rotate(-9deg) scale(1.1); } 50% { transform: rotate(9deg) scale(1.12); } 75% { transform: rotate(-6deg) scale(1.1); } }
@keyframes spin { to { transform: rotate(360deg); } }

.bonus-result {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	animation: pop .35s cubic-bezier(.3, 1.6, .5, 1);
}
.bonus-result[hidden] { display: none; }
.bonus-result .display { height: 76px; min-width: min(560px, 90vw); margin: 0; }
.bonus-result .value { font-size: 40px; }
.bonus-result .btn.pill { height: 60px; font-size: 22px; padding: 0 40px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* popups */
.popup {
	text-align: center;
	animation: pop .35s cubic-bezier(.3, 1.6, .5, 1);
	cursor: pointer;
	padding: 20px;
}
.popup-value { font-size: clamp(44px, 10vw, 110px); margin: 10px 0; }
.popup p { color: var(--muted); font-size: 18px; }

/* info */
.info {
	position: relative;
	width: min(1100px, 96vw);
	height: min(680px, 92vh);
	padding: 24px 70px 54px;
	display: flex;
	flex-direction: column;
	animation: pop .3s ease-out;
}
.info h2 { font-size: clamp(24px, 4vw, 40px); margin-bottom: 14px; }
.info .close { position: absolute; right: 14px; top: 14px; }
.info .nav { position: absolute; top: 50%; transform: translateY(-50%); }
.info .nav:active { transform: translateY(-50%) scale(.92); }
.info .prev { left: 12px; }
.info .next { right: 12px; }
.info-pages { flex: 1; position: relative; overflow: hidden; }
.page {
	position: absolute;
	inset: 0;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 16px;
	animation: slidein .3s ease-out;
}
.page[hidden] { display: none; }
@keyframes slidein { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 60px)); } }
.dots { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; justify-content: center; gap: 12px; }
.dots button { width: 14px; height: 14px; border-radius: 50%; border: 0; padding: 0; background: rgba(255, 255, 255, .3); cursor: pointer; }
.dots button.on { background: #ffd14a; transform: scale(1.3); }

.row { display: flex; align-items: center; gap: 18px; }
.row img { width: 96px; height: 96px; flex: 0 0 auto; }
.row h3 { margin: 0 0 4px; color: #ffd98a; font-size: 20px; }
.row p { margin: 0; font-weight: 600; font-size: 16px; line-height: 1.35; }
.row .hl { color: #ffd54a; }

.paytable { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.paycell { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-image: url(img/ui_plate.png) 44 fill / 16px stretch; }
.paycell img { width: 78px; height: 78px; }
.paycell .pays { font-size: 17px; line-height: 1.45; }
.paycell .pays b { color: #ffd54a; }

.lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.linecell { padding: 8px; border-image: url(img/ui_plate.png) 44 fill / 14px stretch; text-align: center; }
.linecell .n { color: #ffd98a; font-size: 15px; }
.linecell .grid { display: grid; gap: 4px; margin-top: 6px; }
.linecell .grid i { aspect-ratio: 1; border-radius: 4px; background: rgba(255, 255, 255, .13); }
.linecell .grid i.on { background: #ffd14a; box-shadow: 0 0 6px #ffb22e; }

.rules { font-weight: 600; font-size: 17px; line-height: 1.6; white-space: pre-line; }

.toast {
	position: fixed;
	left: 50%; top: 80px;
	transform: translateX(-50%);
	z-index: 60;
	padding: 10px 20px;
	border-image: url(img/ui_plate.png) 44 fill / 16px stretch;
	font-size: 16px;
}

/* ---------- phones ---------- */

@media (max-width: 760px), (max-height: 520px) {
	:root { --bar-h: 54px; }
	.title { font-size: 20px; letter-spacing: 1px; }
	.balance { min-width: 130px; height: 40px; padding-left: 44px; }
	.balance .coin { width: 46px; height: 46px; }
	.balance .value { font-size: 17px; }
}

@media (max-width: 760px) {
	.bottombar { flex-wrap: wrap; justify-content: center; gap: 8px 10px; padding: 6px 8px 12px; }
	.display.win { order: -1; flex: 1 0 100%; max-width: none; height: 48px; }
	.display.win .value { font-size: 26px; }
	.group.bet { gap: 6px; }
	.btn.round { width: 44px; height: 44px; font-size: 26px; }
	.btn.round.big { width: 78px; height: 78px; font-size: 18px; }
	.btn.pill { height: 42px; padding: 0 12px; font-size: 14px; }
	.display { height: 46px; min-width: 92px; padding: 0 10px; }
	.display .value { font-size: 20px; }
	.info { padding: 18px 16px 50px; }
	.info .nav { top: auto; bottom: 6px; transform: none; width: 40px; height: 40px; }
	.info .nav:active { transform: scale(.92); }
	.row img { width: 64px; height: 64px; }
	.row p { font-size: 14px; }
}
