:root {
  --mint: #2ec4b6;
  --mint-deep: #1a9e92;
  --peach: #ff8a65;
  --candy-pink: #ff5d8f;
  --sky: #ffe8d6;
  --ink: #2a1f2d;
  --cream: #fff7f0;
  --panel: rgba(255, 247, 240, 0.88);
  --glow: rgba(46, 196, 182, 0.45);
  --font-display: "Baloo 2", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
  --radius: 1.25rem;
  --shadow: 0 18px 50px rgba(42, 31, 45, 0.28);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: #1a2a32;
}

body {
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(160deg, rgba(255, 232, 214, 0.55), rgba(46, 196, 182, 0.28) 45%, rgba(255, 93, 143, 0.22)),
    url("/assets/bg-candy-land.jpg") center / cover no-repeat;
  z-index: -2;
  transform: scale(1.02);
  animation: drift 28s ease-in-out infinite alternate;
}

.sparkles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.55) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.4) 0 1.5px, transparent 3px),
    radial-gradient(circle at 40% 75%, rgba(255, 255, 255, 0.35) 0 2px, transparent 3px),
    radial-gradient(circle at 85% 60%, rgba(255, 255, 255, 0.45) 0 1px, transparent 2px);
  animation: twinkle 4.5s ease-in-out infinite;
}

@keyframes drift {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to { transform: scale(1.06) translate3d(-1.5%, 1%, 0); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

/* —— Hero —— */
.hero {
  width: min(920px, 100%);
  text-align: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  animation: heroIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.logo {
  display: block;
  width: min(680px, 100%);
  margin: 0 auto 1rem;
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
  mix-blend-mode: normal;
}

.tagline {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  font-weight: 700;
  margin: 0 auto 1.5rem;
  max-width: 28ch;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.cta {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  padding: 0.85rem 2.2rem;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--mint), var(--mint-deep));
  box-shadow: 0 10px 28px var(--glow), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.cta:hover {
  transform: translateY(-2px) scale(1.03);
}

.cta:active {
  transform: translateY(1px) scale(0.98);
}

.cta.small {
  font-size: 1.05rem;
  padding: 0.65rem 1.4rem;
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* —— Game —— */
.game {
  width: min(1100px, 100%);
  animation: heroIn 0.55s ease both;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.logo-sm {
  height: 56px;
  width: auto;
  border-radius: 0.75rem;
  box-shadow: 0 8px 20px rgba(42, 31, 45, 0.2);
}

.stage {
  display: grid;
  grid-template-columns: 1fr minmax(200px, 240px);
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 820px) {
  .stage {
    grid-template-columns: 1fr;
  }
  .hud {
    order: 2;
  }
}

.board-frame {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 247, 240, 0.92), rgba(255, 232, 214, 0.82));
  border-radius: calc(var(--radius) + 0.35rem);
  padding: 0.85rem;
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(46, 196, 182, 0.35);
  overflow: hidden;
}

.board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 0.4rem;
  aspect-ratio: 6 / 5;
  min-height: 280px;
}

.cell {
  position: relative;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.45);
  display: grid;
  place-items: center;
  overflow: hidden;
  transform-origin: center;
}

.cell img.sym {
  width: 86%;
  height: 86%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(42, 31, 45, 0.18));
}

.cell.tumble-out {
  animation: tumbleOut 0.42s cubic-bezier(0.55, 0.05, 0.8, 0.4) forwards;
}

.cell.tumble-in {
  animation: tumbleIn 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cell.win-pulse {
  animation: winPulse 0.55s ease-in-out 2;
  box-shadow: 0 0 0 2px var(--peach), 0 0 18px rgba(255, 138, 101, 0.65);
  z-index: 2;
}

.cell .mult {
  position: absolute;
  inset: auto 4% 4% auto;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.78rem;
  color: #5a3a08;
  background:
    linear-gradient(160deg, #ffe082, #ffb300);
  border: 2px solid #fff3c4;
  box-shadow: 0 4px 12px rgba(255, 179, 0, 0.55);
  animation: multPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  z-index: 3;
}

@keyframes tumbleOut {
  to {
    opacity: 0;
    transform: translateY(28%) scale(0.55) rotate(12deg);
  }
}

@keyframes tumbleIn {
  from {
    opacity: 0;
    transform: translateY(-55%) scale(0.85);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes winPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes multPop {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  70% { transform: scale(1.18) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

.win-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  pointer-events: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  color: #fff;
  text-shadow: 0 4px 0 rgba(42, 31, 45, 0.25), 0 10px 30px rgba(42, 31, 45, 0.35);
  background: linear-gradient(135deg, var(--candy-pink), var(--peach));
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  z-index: 5;
  white-space: nowrap;
}

.win-banner.show {
  animation: bannerPop 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes bannerPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(0.95); }
}

.fs-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(42, 31, 45, 0.45);
  backdrop-filter: blur(4px);
  z-index: 6;
  animation: heroIn 0.35s ease both;
}

.fs-overlay[hidden] {
  display: none !important;
}

.bonus-win-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(26, 42, 50, 0.62);
  backdrop-filter: blur(6px);
  z-index: 8;
  padding: 1rem;
  animation: heroIn 0.4s ease both;
}

.bonus-win-overlay[hidden] {
  display: none !important;
}

.bonus-win-card {
  width: min(520px, 100%);
  background: linear-gradient(165deg, #fff7f0, #ffe8d6);
  border-radius: 1.35rem;
  padding: 1rem 1rem 1.25rem;
  text-align: center;
  box-shadow: 0 22px 60px rgba(42, 31, 45, 0.4), 0 0 0 3px rgba(255, 179, 0, 0.45);
  animation: multPop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.bonus-win-art {
  display: block;
  width: 100%;
  border-radius: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 10px 28px rgba(42, 31, 45, 0.22);
}

.bonus-win-headline {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.45rem, 3.6vw, 2rem);
  color: var(--candy-pink);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
  line-height: 1.15;
}

.bonus-win-sub {
  margin: 0 0 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  opacity: 0.85;
}

.cell.bonus-glow {
  box-shadow: 0 0 0 2px #ffb300, 0 0 22px rgba(255, 179, 0, 0.75);
  animation: winPulse 0.6s ease-in-out 3;
  z-index: 2;
}

.bonus-hud {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: #5a3a08;
  background: linear-gradient(135deg, #ffe082, #ffb300);
  border-radius: 0.75rem;
  padding: 0.45rem 0.6rem;
  box-shadow: 0 6px 16px rgba(255, 179, 0, 0.35);
}

.bonus-hud[hidden] {
  display: none !important;
}

.fs-card {
  background: var(--cream);
  padding: 1.5rem 1.75rem;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 90%;
}

.fs-card h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--candy-pink);
}

.fs-card p {
  margin: 0;
  font-weight: 700;
}

/* HUD */
.hud {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat.compact {
  align-items: center;
  min-width: 5.5rem;
}

.label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
}

.value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.1;
}

.value.accent {
  color: var(--candy-pink);
}

.bet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.chip {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, var(--peach), #e86a45);
  box-shadow: 0 6px 14px rgba(232, 106, 69, 0.4);
}

.spin-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  margin-top: 0.25rem;
  padding: 1rem;
  border-radius: 1rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, var(--candy-pink), #e23a72);
  box-shadow: 0 12px 28px rgba(226, 58, 114, 0.45), inset 0 -4px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.spin-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.spin-btn:disabled {
  filter: grayscale(0.35) brightness(0.9);
  cursor: not-allowed;
}

.spin-btn.busy {
  animation: spinPulse 0.9s ease-in-out infinite;
}

@keyframes spinPulse {
  50% { filter: brightness(1.08); transform: scale(0.98); }
}

.ghost {
  appearance: none;
  border: 2px solid rgba(42, 31, 45, 0.15);
  background: transparent;
  border-radius: 0.85rem;
  padding: 0.55rem;
  font-family: var(--font-body);
  font-weight: 800;
  cursor: pointer;
  color: var(--ink);
}

.rtp-line {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.7;
  text-align: center;
}

.modal {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  max-width: min(520px, 94vw);
  background: var(--cream);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(26, 42, 50, 0.55);
}

.modal-inner {
  padding: 1.35rem 1.5rem 1.5rem;
}

.modal-inner h2 {
  font-family: var(--font-display);
  margin: 0 0 0.75rem;
}

.modal-inner p {
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.pay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.55rem;
  margin: 1rem 0;
}

.pay-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 0.75rem;
  padding: 0.35rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.pay-item img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
