/* styles-2.css: part 2 of 3 of the game styles. Loaded in this order. */
/* ======================================================================
   K. Animations and "less motion"
   ====================================================================== */

.shake {
  animation: shake 0.3s linear;
}

@keyframes floaty {
  50% {
    transform: translateY(-0.45em);
  }
}

@keyframes breathe {
  50% {
    transform: scale(1.05);
    filter: brightness(1.12);
  }
}

/* ---------- bonus banner: painted title, big text on the plate, note on a small plate ---------- */
.announce-art {
  position: relative;
  z-index: 31;
  width: min(84cqw, 118cqh);
  height: auto;
  filter: drop-shadow(0 0.4em 0.6em rgba(0, 0, 0, 0.8));
  animation: slam 0.5s cubic-bezier(0.2, 1.4, 0.35, 1) both;
}

.note {
  --ph: 2.9em;
  position: relative;
  z-index: 31;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--ph);
  max-width: 94cqw;
  padding: 0.75em 2.9em; /* clear of the carved caps; a second line makes the plate taller instead of touching its border */
  border: 1px solid transparent;
  border-image: url(../../art/pill.webp) 0 155 fill / 0 calc(var(--ph) * 0.787) stretch;
  font-size: min(4cqw, 8cqh, 0.86em);
  line-height: 1.15;
  text-align: center;
  text-wrap: balance;
  color: #fff;
  text-shadow: 0 0.08em 0 #000;
}

/* ---------- free spins: the multiplier medallion on the corner of the frame ---------- */
/* short landscape (phone on its side): the medallion sits ON the frame's top-right corner, below the round
   buttons at the top of the screen (it used to climb onto the menu button) */
@media (orientation: landscape) and (max-height: 520px) {
  .reels-wrap .mult {
    top: calc(var(--fb, 20px) * -0.35 - 1.1em);
    right: calc(var(--fb, 20px) * -0.3);
  }
}
@media (orientation: portrait) {
  .reels-wrap .mult {
    top: calc(var(--fb, 20px) * -0.6 - 1.5em);
  }
}
.mult {
  position: absolute;
  z-index: 4;
  right: calc(var(--fb, 20px) * -0.55);
  top: calc(var(--fb, 20px) * -0.9 - 2.1em);
  width: 4.2em;
  height: 4.2em;
  display: grid;
  place-items: center;
  background: url(../../art/btn-blank.webp) center / contain no-repeat;
  filter: drop-shadow(0 0.25em 0.4em rgba(0, 0, 0, 0.6)) drop-shadow(0 0 0.6em rgba(255, 200, 80, 0.7));
}

.mult span {
  font-size: 1.5em;
  line-height: 1;
  color: var(--gold-1);
  text-shadow:
    0 0.07em 0 var(--gold-4),
    0 0.12em 0.15em #000;
}

.mult.punch {
  animation: mult-punch 0.45s cubic-bezier(0.2, 1.6, 0.35, 1);
}

/* the medallion sits on the corner of the frame, next to the screen edge and the jackpots:
   it flashes hard and squeezes IN (never grows), so it never leaves the screen or touches its neighbours */
@keyframes mult-punch {
  0% {
    transform: scale(0.86);
    filter: brightness(2.4) drop-shadow(0 0 0.9em rgba(255, 220, 120, 1));
  }
  100% {
    transform: scale(1);
  }
}

/* ---------- locked coins: the respin counter as three stones ---------- */
.stone {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin-left: 0.3em;
  border-radius: 50%;
  vertical-align: -0.1em;
  background: radial-gradient(circle at 35% 30%, #2a4a80, #0a1730 70%);
  box-shadow: inset 0 0 0 0.09em rgba(143, 227, 255, 0.35);
}

.stone.on {
  background: radial-gradient(circle at 35% 30%, #fff6c4, var(--gold-2) 45%, var(--gold-3) 100%);
  box-shadow:
    0 0 0.55em rgba(255, 205, 90, 0.95),
    inset 0 0 0 0.08em var(--gold-4);
}

/* ---------- beats ---------- */
.cel-title img.slam {
  animation: slam 0.5s cubic-bezier(0.2, 1.4, 0.35, 1) both;
}

/* the final number lands with a flash; it stays inside its plate */
.cel-amount.slam {
  animation: amount-hit 0.4s cubic-bezier(0.2, 1.4, 0.35, 1);
}

@keyframes amount-hit {
  0% {
    transform: scale(1.1);
    filter: brightness(2.2);
  }
  100% {
    transform: scale(1);
  }
}

.cel-title img.step {
  animation: step-punch 0.42s cubic-bezier(0.2, 1.6, 0.35, 1);
}

.reels-wrap.jolt {
  animation: jolt 0.16s ease-out;
}

/* brand pieces step back while a win is being celebrated: the title owns the screen */
.app.celebrating .logo-small,
.app.celebrating .jackpots {
  filter: brightness(0.5);
  transition: filter 0.3s;
}

@keyframes slam {
  0% {
    transform: scale(0.2);
    opacity: 0;
  }
  /* the overshoot is small on purpose: the title may not leave the reel window, even for a frame */
  60% {
    transform: scale(1.07);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes step-punch {
  0% {
    transform: scale(1.07);
    filter: brightness(2.1) drop-shadow(0 0.4em 0.6em rgba(0, 0, 0, 0.8));
  }
  100% {
    transform: scale(1);
  }
}

@keyframes punch {
  0% {
    transform: scale(1.6);
    filter: brightness(1.8);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes jolt {
  35% {
    transform: translateY(0.22em);
  }
  70% {
    transform: translateY(-0.06em);
  }
}

/* the reel frame burns gold while a win is on screen */
.reels-wrap.win .frame {
  animation: frame-glow 0.9s ease-in-out infinite;
}

@keyframes frame-glow {
  0%,
  100% {
    filter: drop-shadow(0 0.4em 0.7em rgba(0, 0, 0, 0.6)) drop-shadow(0 0 0.35em rgba(255, 200, 80, 0.55));
  }
  50% {
    filter: drop-shadow(0 0.4em 0.7em rgba(0, 0, 0, 0.6)) drop-shadow(0 0 1.1em rgba(255, 215, 110, 1)) brightness(1.18);
  }
}

/* every coin that lands makes the balance coin pop */
.coin-ico.bump {
  animation: coin-bump 0.18s ease-out;
}

@keyframes coin-bump {
  40% {
    transform: scale(1.35);
    filter: brightness(1.5);
  }
}

/* a jackpot plaque that was hit: it glows; it barely grows, so it never leaves the screen */
@keyframes jp-hit {
  50% {
    transform: scale(1.03);
    filter: brightness(1.7) drop-shadow(0 0 0.5em rgba(255, 220, 120, 0.9));
  }
}

@keyframes pop {
  0% {
    transform: translateX(-50%) scale(1.35);
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}

@keyframes bump {
  40% {
    transform: scale(1.18);
  }
}

@keyframes ring {
  to {
    transform: rotate(360deg);
  }
}

@keyframes spin-idle {
  50% {
    transform: scale(1.04);
    filter: drop-shadow(0 0.35em 0.5em rgba(0, 0, 0, 0.6)) drop-shadow(0 0 0.7em rgba(255, 200, 80, 0.75));
  }
}

@keyframes banner-in {
  0% {
    transform: scale(0.3) rotate(-4deg);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes banner-step {
  /* the step up is a flash, not a jump in size: the plate must stay inside the reel window */
  0% {
    transform: scale(1.035);
    filter: brightness(2) drop-shadow(0 0.8em 1.4em rgba(0, 0, 0, 0.7));
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shake {
  15% {
    transform: translate(0.22em, -0.12em);
  }
  35% {
    transform: translate(-0.2em, 0.14em);
  }
  55% {
    transform: translate(0.14em, 0.1em);
  }
  75% {
    transform: translate(-0.08em, -0.06em);
  }
}

/* ======================================================================
   L. Living scenery and a HUD that answers back
   ====================================================================== */

/* Parallax: the cave is a little bigger than the screen and leans away from the pointer.
   On touch screens (no pointer to follow) it drifts slowly instead. */
.bg-img {
  scale: 1.05;
  translate: calc(var(--px, 0) * -1.2%) calc(var(--py, 0) * -0.8%);
  transition:
    translate 0.5s ease-out,
    opacity 0.9s ease;
}

@media (hover: none) {
  .bg-img {
    animation: bg-drift 26s ease-in-out infinite alternate;
  }
}

@keyframes bg-drift {
  from {
    translate: -1% 0;
  }
  to {
    translate: 1% -0.6%;
  }
}

.bg-aurora,
.bg-fire,
.bg-lit {
  position: absolute;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* The aurora breathes and sways over the painted one. */
.bg-aurora {
  inset: 0 0 62% 0;
  background:
    radial-gradient(ellipse 60% 45% at 40% 42%, rgba(60, 255, 170, 0.5), transparent 70%),
    radial-gradient(ellipse 45% 40% at 68% 30%, rgba(150, 90, 255, 0.45), transparent 70%);
  filter: blur(1.2em);
  animation: aurora 9s ease-in-out infinite alternate;
}

@keyframes aurora {
  from {
    opacity: 0.3;
    transform: translateX(-5%) skewX(-7deg);
  }
  to {
    opacity: 0.9;
    transform: translateX(5%) skewX(7deg);
  }
}

/* The brazier on the left flickers (portrait scenery only; the landscape one has no fire there). */
.bg-fire {
  display: none;
  left: -10%;
  top: 30%;
  width: 40%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(255, 150, 40, 0.6), transparent 65%);
  animation: fire 1.7s linear infinite;
}

@media (orientation: portrait) {
  .app:not([data-mode='free']) .bg-fire {
    display: block;
  }
}

@keyframes fire {
  0%,
  100% {
    opacity: 0.55;
  }
  13% {
    opacity: 0.85;
  }
  27% {
    opacity: 0.5;
  }
  41% {
    opacity: 0.95;
  }
  58% {
    opacity: 0.6;
  }
  73% {
    opacity: 0.9;
  }
}

/* A win lights the ice around the reels: a soft local glow, never a full-screen flash. */
.bg-lit {
  inset: 0;
  background: radial-gradient(ellipse 80% 46% at 50% 44%, rgba(255, 190, 90, 0.4), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.app.lit .bg-lit {
  opacity: 1;
}

.app.calm .bg-img {
  translate: none;
}

/* Spin button: the tap charges it, turbo spins the ring faster. */
.spin.busy.fast .spin-ring {
  animation-duration: 0.32s;
}
.spin.charge {
  animation: spin-charge 0.32s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes spin-charge {
  0% {
    transform: scale(0.86);
    filter: brightness(1.6) drop-shadow(0 0 1em rgba(255, 220, 120, 0.9));
  }
}

/* Numbers on a spring: mostly up and down, so they never push past the sides of their plate. */
.winbar.bump b,
#balance.spring,
#bet.spring {
  animation: spring 0.42s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes spring {
  25% {
    transform: scale(1.04, 1.2);
  }
  50% {
    transform: scale(1.01, 0.92);
  }
  75% {
    transform: scale(1, 1.05);
  }
}

/* Jackpots are alive: a wave of light runs mini -> grand every few seconds. */
.jp {
  animation: jp-sheen 6s ease-in-out infinite;
}
.jp-minor {
  animation-delay: 0.22s;
}
.jp-major {
  animation-delay: 0.44s;
}
.jp-grand {
  animation-delay: 0.66s;
}
.jp.hit {
  animation: jp-hit 0.6s ease-in-out 4;
}
.jp.ping {
  animation: jp-hit 0.5s ease-in-out 1;
}

@keyframes jp-sheen {
  0%,
  12%,
  100% {
    filter: drop-shadow(0 0.2em 0.3em rgba(0, 0, 0, 0.55));
  }
  6% {
    filter: drop-shadow(0 0.2em 0.3em rgba(0, 0, 0, 0.55)) brightness(1.4);
  }
}

/* ---------- win in steps ---------- */
.cel-amount.mile {
  animation: mile 0.26s cubic-bezier(0.2, 1.5, 0.4, 1);
}

@keyframes mile {
  0% {
    transform: scale(1.03, 1.16);
    filter: brightness(1.7);
  }
}

/* Final seal: one line of gold runs around the plate. */
@property --seal {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.banner {
  position: relative;
}

.banner.seal::after {
  content: '';
  position: absolute;
  inset: 13% 6%;
  padding: 0.16em;
  border-radius: 999px;
  background: conic-gradient(from var(--seal), transparent 0 76%, #fff6c8 92%, transparent 100%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box exclude,
    linear-gradient(#000 0 0);
  filter: drop-shadow(0 0 0.3em #ffd24a);
  pointer-events: none;
  animation: seal 0.9s linear 1 both;
}

@keyframes seal {
  from {
    --seal: 0deg;
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  to {
    --seal: 360deg;
    opacity: 0;
  }
}

/* EPIC changes the scenery: the aurora comes down and the cave brightens. */
.bg-aurora {
  transition:
    inset 1.2s ease,
    filter 1.2s ease;
}

.app[data-tier='epic'] .bg-aurora {
  inset: 0 0 15% 0;
  filter: blur(1.6em) brightness(1.7);
  animation-duration: 2.6s;
}

.bg-img {
  transition:
    translate 0.5s ease-out,
    opacity 0.9s ease,
    filter 1.2s ease;
}
.app[data-tier='epic'] .bg-img {
  filter: brightness(1.3) saturate(1.2);
}

/* GRAND: the board steps back so the flying plate owns the reel window. */
#reels {
  transition: filter 0.3s ease;
}
.app.grand #reels {
  filter: brightness(0.35) saturate(0.7);
}

/* ---------- rules sheet in four short pages ---------- */
.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4em;
  margin: 0.5em 0 0.9em;
}

.tabs .btn-pill {
  min-width: 0;
  width: 100%;
  --ph: 3.3em;
  font-size: max(0.72em, 11px); /* readable on a 360 px phone */
  letter-spacing: 0.04em;
  /* ornate plates: the carved ends take about a quarter of each side, the label stays on the glass */
  padding-inline: 1.3em;
}

/* a narrow sheet: the tabs go in two rows, so each label sits on its plate's glass (never on the ends) */
@media (max-width: 560px) {
  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* the rules card keeps one height for every tab (no jump); a long page scrolls inside it */
.sheet-card:has(.tabs) {
  height: min(100dvh - 2em, 46em);
}

.feat {
  display: flex;
  align-items: center;
  gap: 0.9em;
  margin: 0.5em 0;
  padding: 0.6em 0.8em;
  border-radius: 0.7em;
  background: rgba(8, 20, 48, 0.6);
  border: 0.08em solid rgba(143, 227, 255, 0.22);
}

.feat img {
  flex: none;
  width: 3.6em;
  height: 3.6em;
}
.feat b {
  color: var(--gold-1);
  letter-spacing: 0.06em;
}
.feat p {
  margin: 0.2em 0 0;
}

/* ---------- the Viking mascot ---------- */
.viking {
  position: relative;
  z-index: 32; /* he stays lit over the win overlay: he is the one cheering */
  grid-area: logo;
  justify-self: start;
  align-self: end;
  height: 10.4em;
  width: auto;
  /* the art ends at his thighs: everything below his belt hides behind the jackpot plates (painted after him) */
  margin: -0.6em 0 -5.6em 0.1em;
  pointer-events: none;
  transform-origin: 50% 100%;

  filter: drop-shadow(0 0.3em 0.4em rgba(0, 0, 0, 0.6));
  animation: viking-breathe 3.2s ease-in-out infinite;
}

.viking[data-pose='hype'] {
  animation: viking-hype 0.32s ease-in-out infinite;
}
.viking[data-pose='cheer'] {
  animation: viking-cheer 0.5s ease-in-out infinite;
}

@keyframes viking-breathe {
  50% {
    transform: scale(1.012, 1.035);
  }
}

/* he grows from his feet (never lifts): the cut at his legs must stay hidden */
@keyframes viking-hype {
  50% {
    transform: rotate(-1.2deg) scale(1.03);
  }
}

@keyframes viking-cheer {
  50% {
    transform: scale(1.06, 1.04);
  }
}

/* the reel canvas is positioned so that pieces placed before it in the page stay behind it */
#reels {
  position: relative;
}

.tabs .btn-pill {
  --ph: max(3.3em, 42px);
  height: var(--ph);
}

/* ---------- buy bonus ---------- */
.btn-buy {
  --ph: max(3em, 42px);
  position: relative;
  z-index: 32;
  grid-area: logo;
  justify-self: end;
  align-self: center;
  min-width: 0;
  /* the painted caps take about 0.6 of the height on each side: the text starts after them */
  padding: 0 calc(var(--ph) * 0.68);
  font-size: 0.82em;
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  letter-spacing: 0.04em;
}

.btn-buy span {
  display: block;
  white-space: nowrap;
}

.buy-price {
  color: var(--gold-1);
  font-size: 1.15em;
  text-align: center;
}

.buy-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8em;
  margin-top: 0.8em;
}

.buy-actions .btn-gold {
  --ph: max(3em, 42px);
  font-size: 1em;
  min-width: 0;
  padding: 0 calc(var(--ph) * 0.68);
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}
.buy-actions .btn-pill {
  min-width: 7em;
  --ph: max(3.7em, 42px);
}

/* ---------- loading: a gold bar fills inside a carved pill, then TAP TO PLAY takes its place ---------- */
/* both live in ONE slot as tall as the button, so the swap moves nothing on the screen */
.entry-cta {
  flex-shrink: 0;
  margin-top: auto;
  display: grid;
  place-items: center;
  height: calc(1.75em * 3.1);
}

.loading {
  --ph: 2.6em;
  grid-area: 1 / 1;
  position: relative;
  flex-shrink: 0;
  width: min(78vw, 22em);
  height: var(--ph);
  border: 1px solid transparent;
  border-image: url(../../art/pill.webp) 0 155 fill / 0 calc(var(--ph) * 0.787) stretch;
  filter: drop-shadow(0 0.3em 0.5em rgba(0, 0, 0, 0.6));
}

/* the fill runs inside the glass of the pill (between the carved caps) */
.loading i {
  position: absolute;
  left: 9%;
  top: 30%;
  bottom: 30%;
  width: calc(82% * var(--p, 0));
  border-radius: 1em;
  background: linear-gradient(180deg, #fff3b0, #ffc93c 45%, #c97a00);
  box-shadow: 0 0 0.6em rgba(255, 200, 80, 0.8);
  transition: width 0.25s ease-out;
}

.loading span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.85em;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow:
    0 0.08em 0 #000,
    0 0 0.3em #000;
}

.loading[hidden] {
  display: none;
}
.btn-play.pop {
  animation:
    banner-in 0.45s cubic-bezier(0.2, 1.6, 0.35, 1) both,
    play-breathe 1.8s ease-in-out 0.45s infinite;
}

/* ---------- level badge and free-coins gift (top buttons) ---------- */
.btn-level {
  position: relative;
}

/* XP: a gold ring around the badge fills up to the next level */
.btn-level::before {
  content: '';
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: conic-gradient(#ffd24a calc(var(--xp, 0) * 1turn), rgba(255, 255, 255, 0.12) 0);
  -webkit-mask: radial-gradient(circle, transparent 66%, #000 68%);
  mask: radial-gradient(circle, transparent 66%, #000 68%);
}

.btn-level b {
  position: relative;
  font-size: 1.05em;
  line-height: 1;
  color: var(--gold-1);
  text-shadow: 0 0.08em 0 #000;
}

.btn-level.up {
  animation: mult-punch 0.5s cubic-bezier(0.2, 1.6, 0.35, 1);
}

.btn-gift {
  position: relative;
}

.gift-dot {
  position: absolute;
  top: 6%;
  right: 6%;
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c4, #ffc93c 55%, #b86f00);
  box-shadow: 0 0 0.5em #ffd24a;
  animation: breathe 1.2s ease-in-out infinite;
}

.btn-gift:has(.gift-dot:not([hidden])) svg {
  stroke: #fff3b0;
  filter: drop-shadow(0 0 0.3em #ffc93c);
}

/* phones without a fullscreen API (iPhone) have no use for the fullscreen button */
#btn-full[hidden] {
  display: none;
}

/* the wheel */
.wheel-box {
  position: relative;
  width: min(70vw, 52vh, 19em);
  aspect-ratio: 1;
  margin: 1.2em auto 0.4em;
}

.wheel-box canvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 0.6em 0.8em rgba(0, 0, 0, 0.6));
}

.wheel-ptr {
  position: absolute;
  left: 50%;
  top: -7%;
  width: 15%;
  transform: translateX(-50%);
  filter: drop-shadow(0 0.2em 0.3em rgba(0, 0, 0, 0.7));
}

.wheel-row {
  display: flex;
  justify-content: center;
  min-height: 3.4em;
  align-items: center;
}
.wheel-row .btn-gold {
  --ph: max(3em, 42px);
  font-size: 1em;
  min-width: 0;
  padding: 0 calc(var(--ph) * 0.95);
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}
#wheel-go {
  --ph: max(3em, 42px);
  font-size: 1em;
  min-width: 0;
  padding: 0 calc(var(--ph) * 0.9);
  flex: none;
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}
#coins-go {
  --ph: max(3.5em, 42px);
  min-width: 0;
  padding: 0 calc(var(--ph) * 0.75);
  flex: none;
}
.wait {
  color: var(--gold-1);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.opt-row small {
  display: block;
  color: #cfe2ff;
  font-size: 0.8em;
}

/* level sheet: XP bar */
.xp-bar {
  position: relative;
  height: 2.2em;
  margin: 0.8em 0;
  border-radius: 1.1em;
  background: rgba(3, 10, 26, 0.8);
  border: 0.12em solid var(--gold-2);
  overflow: hidden;
}

.xp-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(100% * var(--p, 0));
  background: linear-gradient(180deg, #fff3b0, #ffc93c 45%, #c97a00);
}
.xp-bar span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
  text-shadow:
    0 0.08em 0 #000,
    0 0 0.3em #000;
}

/* buy sheet: the price is the headline; the note is quiet; the two buttons are the same size */
.buy-price.big {
  font-size: 1.5em;
  margin: 0.6em 0 0.2em;
}
.muted {
  color: #b9cbe6;
  font-size: 0.85em;
  text-align: center;
}
.buy-actions .btn-pill,
.buy-actions .btn-gold {
  flex: 1 1 0;
  max-width: 12em;
  min-width: 0;
}

/* the gift and buy buttons wait during a round: dimmed, never grey (grey reads as broken) */
.btn-buy:disabled,
.btn-gift:disabled {
  filter: brightness(0.78);
}

/* ---------- daily wheel: its own full-screen moment, not a box ---------- */
.wheel-stage {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: min(2.2vh, 1.2em);
  padding: calc(1em + var(--safe-t)) 1em calc(1em + var(--safe-b));
  background: radial-gradient(ellipse at 50% 48%, rgba(20, 40, 90, 0.55) 0%, rgba(3, 8, 20, 0.94) 70%);
  overflow: hidden;
}

/* slow golden rays turning behind the wheel */
.ws-rays {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 180vmax;
  height: 180vmax;
  margin: -90vmax 0 0 -90vmax;
  background: repeating-conic-gradient(rgba(255, 210, 90, 0.16) 0deg 7deg, rgba(255, 210, 90, 0) 7deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 42%);
  mask: radial-gradient(circle, #000 0%, transparent 42%);
  animation: ws-turn 40s linear infinite;
  pointer-events: none;
}

@keyframes ws-turn {
  to {
    transform: rotate(360deg);
  }
}

.ws-title {
  position: relative;
  margin: 0;
  line-height: 0;
}
/* painted lettering, like BIG WIN and FREE SPINS */
.ws-title img {
  width: min(82vw, 62vh, 30em);
  height: auto;
  filter: drop-shadow(0 0.3em 0.5em rgba(0, 0, 0, 0.7));
}

.ws-wheel {
  position: relative;
  width: min(88vw, 56vh, 34em);
  aspect-ratio: 1;
  flex-shrink: 0;
  animation: banner-in 0.5s cubic-bezier(0.2, 1.5, 0.35, 1) both;
}

.ws-wheel canvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 1em 1.4em rgba(0, 0, 0, 0.7)) drop-shadow(0 0 2em rgba(255, 200, 80, 0.35));
}

.ws-ptr {
  position: absolute;
  left: 50%;
  top: -6%;
  width: 14%;
  transform: translateX(-50%);
  filter: drop-shadow(0 0.25em 0.35em rgba(0, 0, 0, 0.7));
}

/* the prize, on the carved banner plate, laid over the lower half of the wheel */
.ws-won {
  position: absolute;
  left: 50%;
  top: 79%;
  translate: -50% 0;
  width: 78%;
  aspect-ratio: 1200 / 390;
  display: grid;
  place-items: center;
  padding: 0 15%;
  container-type: inline-size;
  background: url(../../art/banner.webp) center / 100% 100% no-repeat;
  animation: banner-in 0.45s cubic-bezier(0.2, 1.6, 0.35, 1) both;
}

.ws-won b {
  font-size: 15cqw;
  line-height: 1;
  color: var(--gold-1);
  text-shadow:
    0 0.07em 0 var(--gold-4),
    0 0.14em 0.2em #000;
  white-space: nowrap;
}

.ws-actions {
  position: relative;
  display: flex;
  gap: 0.8em;
  align-items: center;
}
.ws-actions .btn-gold {
  --ph: max(3.2em, 52px);
  font-size: max(1.5em, 20px);
  min-width: 7.5em;
  padding: 0 calc(var(--ph) * 0.8);
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}
.ws-actions .btn-pill {
  --ph: max(3.7em, 46px);
  font-size: max(1em, 14px);
  min-width: 7em;
}
/* while it turns there is nothing to press: the button steps out (its place is kept) */
.wheel-stage.done:not(.won) #ws-go {
  visibility: hidden;
}
.wheel-stage.done #ws-later {
  display: none;
}
.app.calm .ws-rays {
  animation: none;
}

/* the Viking watches the wheel from the corner (the screen edge cuts him); no room for him on a phone held upright */
.ws-viking {
  position: fixed;
  left: 0.6em;
  bottom: -3%;
  height: min(60vh, 50vw);
  pointer-events: none;
  transform-origin: 50% 100%;
  animation: viking-hype 0.32s ease-in-out infinite;
}
.wheel-stage.won .ws-viking {
  animation: viking-cheer 0.5s ease-in-out infinite;
}
@media (orientation: portrait) {
  .ws-viking {
    display: none;
  }
}
@media (orientation: landscape) and (max-height: 520px) {
  .ws-viking {
    height: 34vh;
  }
}

/* the pointer flicks every time a peg passes it */
.ws-ptr {
  transform-origin: 50% 20%;
}
.ws-ptr.flick {
  animation: ws-flick 0.12s ease-out;
}
@keyframes ws-flick {
  40% {
    transform: translateX(-50%) rotate(-16deg);
  }
}

/* a win: the rays burn brighter and faster */
.wheel-stage.won .ws-rays {
  animation-duration: 9s;
  filter: brightness(2.2);
}

/* while the wheel is on, the effects layer (coins, sparks) plays OVER it */
.app.staging .fx {
  z-index: 46;
}

.wheel-stage.leaving {
  animation: ws-out 0.28s ease-in forwards;
}
@keyframes ws-out {
  to {
    opacity: 0;
  }
}

/* a short landscape phone: the wheel on the left, title and buttons on the right */
@media (orientation: landscape) and (max-height: 520px) {
  .wheel-stage {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-areas: 'wheel title' 'wheel actions';
    align-content: center;
    justify-content: center;
    column-gap: 2em;
  }
  .ws-wheel {
    grid-area: wheel;
    width: min(84vh, 50vw);
  }
  .ws-title {
    grid-area: title;
    align-self: end;
  }
  .ws-actions {
    grid-area: actions;
    align-self: start;
    flex-direction: column;
  }
}

/* ---------- painted gold numbers (src/ui/glyphs.js): each character is a piece of one atlas ---------- */
.glyph {
  display: inline-block;
  height: 0.86em;
  vertical-align: -0.1em;
  margin-right: -0.035em;
  background: url(../../art/font-gold.webp) no-repeat;
  background-size: calc(var(--glyph-atlas, 10) * 1em) 0.86em;
  filter: drop-shadow(0 0.05em 0.04em rgba(20, 8, 0, 0.95)) drop-shadow(0 0 0.12em rgba(0, 0, 0, 0.6));
}

/* ---------- top row: one menu button instead of three ---------- */
.top-buttons {
  position: relative;
}
.menu-pop {
  position: absolute;
  top: calc(100% + 0.4em);
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  animation: banner-in 0.25s cubic-bezier(0.2, 1.4, 0.35, 1) both;
}
.menu-pop[hidden] {
  display: none;
}
#btn-menu[aria-expanded='true'] .ico {
  filter: drop-shadow(0 0 0.35em #ffc93c) brightness(1.2);
}
.btn-level {
  margin-left: 0.3em;
} /* clear of the balance plate */

/* ---------- quick messages on a carved plate, never a flat black pill ---------- */
.toast {
  --ph: 2.9em;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--ph);
  padding: 0 calc(var(--ph) * 0.95);
  white-space: nowrap;
  font-size: 0.85em;
  color: #fff;
  text-shadow: 0 0.08em 0 #000;
  background: none;
  border-radius: 0;
  border: 1px solid transparent;
  border-image: url(../../art/pill.webp) 0 155 fill / 0 calc(var(--ph) * 0.787) stretch;
  filter: drop-shadow(0 0.3em 0.5em rgba(0, 0, 0, 0.6));
  animation: banner-in 0.3s cubic-bezier(0.2, 1.5, 0.35, 1) both;
}

/* ---------- loading screen: the Viking ---------- */
.entry-viking {
  position: fixed;
  left: 0.6em;
  bottom: -3%;
  height: min(62vh, 40vw);
  pointer-events: none;
  transform-origin: 50% 100%;
  animation: viking-breathe 3.2s ease-in-out infinite;
}
.entry-viking-cta {
  display: none;
}
@media (orientation: portrait) {
  /* upright phone: no free corner, so he stands behind TAP TO PLAY (the button hides where his legs are cut)
     and the scatter and the WILD move out to the sides */
  .entry-viking {
    display: none;
  }
  .entry-cta {
    position: relative;
  }
  .entry-viking-cta {
    display: block;
    position: absolute;
    left: 50%;
    bottom: 45%;
    translate: -50% 0;
    height: min(34vh, 62vw);
    width: auto;
    pointer-events: none;
    transform-origin: 50% 100%;
    animation: viking-breathe 3.2s ease-in-out infinite;
  }
  .btn-play,
  .loading {
    position: relative;
    z-index: 1;
  }
  .entry-hoard {
    width: min(94vw, 30em);
    justify-content: space-between;
  }
  .entry-hoard img:nth-child(1) {
    display: none;
  }
}

/* ---------- free spins: the count is a big glowing number, no plate around it ---------- */
.announce.bignum .announce-card {
  background: none;
  filter: drop-shadow(0 0 0.6em rgba(140, 220, 255, 0.9)) drop-shadow(0 0.3em 0.4em rgba(0, 0, 0, 0.8));
}
.announce.bignum #announce-title {
  font-size: 34cqw;
}

/* ---------- GRAND: the title takes the whole reel window ---------- */
.announce.grand-show .announce-art {
  width: min(96cqw, 150cqh);
}

/* a 9-slice piece baked into one picture by src/ui/nine.js: the browser's 9-piece drawing is switched off */
.nine {
  border-image: none !important;
  background-size: 100% 100% !important;
  background-origin: border-box !important;
  background-clip: border-box !important;
  background-repeat: no-repeat !important;
}

/* ---------- painted icons on the round buttons ---------- */
.btn-ico .ico {
  width: 58%;
  height: 58%;
  object-fit: contain;
  filter: drop-shadow(0 0.06em 0.06em rgba(0, 0, 0, 0.8));
  pointer-events: none;
}
.btn-ico .ico.off {
  display: none;
}
#btn-sound[aria-pressed='true'] .ico.on {
  display: none;
}
#btn-sound[aria-pressed='true'] .ico.off {
  display: block;
}
.app:fullscreen #btn-full .ico.on {
  display: none;
}
.app:fullscreen #btn-full .ico.off {
  display: block;
}
.btn-gift:has(.gift-dot:not([hidden])) .ico {
  filter: drop-shadow(0 0 0.35em #ffc93c) brightness(1.15);
}

/* painted digits are boxes: a number must never wrap between them (it did on a short screen) */
.cel-amount,
#win,
#announce-title,
.ws-won b {
  white-space: nowrap;
}

/* the open menu sits on its own dark carved panel, above whatever is under it */
.menu-pop {
  padding: 0.45em;
  border-radius: 1.6em;
  background: linear-gradient(180deg, rgba(14, 32, 70, 0.96), rgba(4, 12, 30, 0.96));
  border: 0.12em solid var(--gold-2);
  box-shadow:
    0 0.5em 1.2em rgba(0, 0, 0, 0.6),
    inset 0 0 0.6em rgba(255, 200, 80, 0.15);
}

/* while the wheel is on, the Viking of the game steps out (the wheel has its own) */
.app.staging .viking {
  visibility: hidden;
}

/* feature intros: the reels stay visible under a lighter veil, a painted burst turns behind the title */
.announce {
  background: rgba(3, 8, 20, 0.62);
}
.announce .over-box::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 42%;
  width: 120cqmin;
  aspect-ratio: 1;
  translate: -50% -50%;
  z-index: -1;
  background: url(../../art/burst.webp) center / contain no-repeat;
  opacity: 0.85;
  animation: ws-turn 18s linear infinite;
  pointer-events: none;
}
.app.calm .announce .over-box::after {
  animation: none;
}

/* the wheel's prize plate sits on its lower rim, not over the wedges */

/* Less motion: keep the state changes, drop the movement. */
.app.calm *,
.app.calm *::before,
.app.calm *::after {
  animation: none !important;
  transition: none !important;
}

/* the gold seal is pure motion: without it there is nothing to show */
.app.calm .banner.seal::after {
  display: none;
}

/* ======================================================================
   L. Landscape (any height): one top row, one bottom row
   Bet on the left, win bar in the middle, spin + toggles grouped on the right.
   ====================================================================== */
@media (orientation: landscape) {
  .bg-base {
    background-image: url(../../art/bg-landscape.webp);
  }

  /* Everything fits centred; no need to push the button down. */
  .entry {
    justify-content: center;
    padding-top: 1em;
    padding-bottom: 1em;
  }

  .btn-play,
  .entry-cta {
    margin-top: 0;
  }
  .top {
    gap: 0.2em 0.8em;
  }
  .top-buttons {
    justify-self: end;
  }

  .logo-small {
    filter: drop-shadow(0 0 0.8em rgba(3, 8, 20, 0.9)) drop-shadow(0 0.3em 0.4em rgba(0, 0, 0, 0.6));
  }

  .jackpots {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  /* One row: bet column, win bar, right-hand group (.side-right). */
  .controls {
    grid-template-areas: 'betcol winbar right';
    gap: 1.2em;
  }

  .side-right {
    grid-area: right;
    align-items: center;
    gap: 0.9em;
    justify-self: start;
  }

  .spin {
    margin: 0;
  }
}

/* ======================================================================
   M. Tall landscape (desktop, tablet lying down): its own layout
   Three columns: logo on the left, big reels in the middle, the four jackpots stacked on the right.
   .top dissolves (display: contents) so balance, buttons, logo and jackpots sit directly on that grid.
   ====================================================================== */
@media (orientation: landscape) and (min-height: 521px) {
  .app {
    font-size: clamp(9px, 2.5vh, 19px);
  }

  .game {
    grid-template-columns: minmax(11em, 1fr) minmax(0, 3.3fr) minmax(11em, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      'balance . buttons'
      'logo machine jackpots'
      'controls controls controls';
    gap: 0.5em 1em;
    padding-bottom: calc(0.9em + var(--safe-b));
  }

  .top {
    display: contents;
  }

  /* the pieces of the dissolved .top keep their place above the dim layer and the coins */
  .balance,
  .top-buttons,
  .logo-small,
  .jackpots {
    position: relative;
    z-index: 32;
  }

  .balance {
    grid-area: balance;
    justify-self: start;
  }

  .top-buttons {
    grid-area: buttons;
    justify-self: end;
  }

  .logo-small {
    grid-area: logo;
    align-self: center;
    justify-self: center;
    width: min(100%, 15em);
    height: auto;
    margin: 0;
    align-self: start; /* the Viking stands in the lower half of this column */
  }

  .jackpots {
    grid-area: jackpots;
    align-self: center;
    justify-self: center;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.7em;
    width: min(100%, 13.5em);
  }

  .jp {
    --jh: 3.3em;
  }

  .viking {
    /* big, standing BEHIND the machine and the controls; the screen edge cuts his legs.
       main.js plantViking() sizes him so his face stays clear of the reels */
    position: fixed;
    z-index: 1;
    left: 0;
    bottom: -3%;
    width: auto;
    height: 60vh;
    margin: 0;
  }

  .machine {
    z-index: 2;
  }

  .btn-buy {
    grid-area: jackpots;
    justify-self: center;
    align-self: end;
    font-size: 0.9em;
  }

  .machine {
    grid-area: machine;
  }

  .controls {
    grid-area: controls;
  }

  .btn-pill {
    --ph: 3.3em;
    min-width: 7.4em;
  }

  /* Bet plaque and MAX BET side by side. */
  .bet-col {
    justify-self: end;
    flex-direction: row;
    align-items: center;
  }

  .winbar {
    width: 18em;
  }

  /* Here the wrapper is a real box: spin and toggles side by side. */
  .side-right {
    display: flex;
  }

  .spin {
    width: 6.4em;
    height: 6.4em;
  }
}

/* End of assets/ui/styles-2.css */
