/* styles-1.css: part 1 of 3 of the game styles. Loaded in this order. */
/* Rune Hoard styles.

   How this file is organised
   - Sizes are in em. The font-size of .app is the single scale knob of each layout.
   - Portrait is the base. Three media queries at the end adapt it: landscape (any height),
     tall landscape (desktop / tablet) and short landscape (phone lying down).
   - Each selector has one rule per layout (a few also share a rule placed right above their own),
     so what you read is what applies.
   - Plaques, pills and jackpot plates are painted images drawn with border-image:
     the slices keep the end caps at their drawn shape and stretch only the plain middle.
   - Stacking order: game < flying coins .fx (30) < overlay content (31) < HUD (32) < sheets (40) < toast (45). */

/* ======================================================================
   A. Tokens and reset
   ====================================================================== */

/* Palette and the notch / home-bar insets. Change a colour here and the whole HUD follows. */
:root {
  --gold-1: #fff3b0;
  --gold-2: #ffc93c;
  --gold-3: #e08a00;
  --gold-4: #7a3d00;
  --navy-1: #0b1d3f;
  --navy-2: #071226;
  --ice: #8fe3ff;
  --ink: #06101f;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* The game owns the whole viewport: no page scroll, no rubber-band bounce. */
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--navy-2);
  overscroll-behavior: none;
}

body {
  font-family:
    'Trebuchet MS',
    'Segoe UI',
    system-ui,
    -apple-system,
    Roboto,
    sans-serif;
  font-weight: 800;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button {
  padding: 0;
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

img {
  display: block;
  -webkit-user-drag: none;
}

/* JS shows and hides screens with the hidden attribute; it must beat every display rule below. */
[hidden] {
  display: none !important;
}

/* Screen-reader-only live region. */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* Counters tick without the digits jumping sideways. */
.num {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* Every size below is in em, so this font-size is the one scale knob of the whole game.
   Portrait scales with the smaller of width and height, so nothing is pushed off screen. */
.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  font-size: clamp(11px, min(4vw, 1.9vh), 20px);
}

/* ======================================================================
   B. Background
   ====================================================================== */

.bg,
.bg-img {
  position: absolute;
  inset: 0;
}

.bg-img {
  background-size: cover;
  background-position: center;
}

.bg-base {
  background-image: url(../../art/bg-portrait.webp);
}

/* Free-spins scenery cross-fades over the base one. */
.bg-free {
  background-image: url(../../art/bg-free.webp);
  opacity: 0;
  transition: opacity 0.9s ease;
}

.app[data-mode='free'] .bg-free {
  opacity: 1;
}

/* Vignette: darker edges keep the eye on the reels. */
.bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(4, 10, 24, 0.15) 0%, rgba(4, 10, 24, 0.6) 100%);
}

/* ======================================================================
   C. Shared pieces: gold text, plaques, buttons
   ====================================================================== */

/* Gradient clipped to the glyphs; the drop-shadows give the engraved edge. */
.gold-text {
  color: transparent;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 900;
  letter-spacing: 0.03em;
  background: linear-gradient(180deg, var(--gold-1) 0%, var(--gold-2) 38%, var(--gold-3) 62%, #ffd86b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0.06em 0 var(--gold-4)) drop-shadow(0 0.12em 0.1em rgba(0, 0, 0, 0.7));
}

/* Painted pill (same art family as the reel frame). The border-image slices keep the two end caps
   at their drawn shape and stretch only the plain middle, so one image fits any width.
   --ph is the pill height; the cap width follows it (0.787 = slice width / image height of pill.webp). */
.plaque,
.btn-pill {
  min-height: 0;
  height: var(--ph);
  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.22em 0.3em rgba(0, 0, 0, 0.55));
}

.plaque {
  --ph: 2.9em;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0 1.25em;
  color: #fff;
  text-shadow:
    0 0.08em 0 #000,
    0 0 0.25em rgba(0, 0, 0, 0.8);
}

.plaque small {
  font-size: 0.68em;
  color: var(--gold-2);
  letter-spacing: 0.12em;
}

/* Tall enough for a 44 px touch target on a phone. */
.btn-pill {
  --ph: 3.7em;
  min-width: 8em;
  padding: 0 0.3em;
  font-size: 0.78em;
  letter-spacing: 0.08em;
  text-shadow: 0 0.08em 0 #000;
  white-space: nowrap;
  transition:
    transform 0.09s ease,
    background 0.2s,
    box-shadow 0.2s;
}

/* Toggle on: swap the art for the gold pill and add a glow. */
.btn-pill[aria-pressed='true'] {
  color: #3b1c00;
  text-shadow: 0 0.05em 0 rgba(255, 244, 190, 0.8);
  border-image-source: url(../../art/btn-gold.webp);
  border-image-slice: 0 115 fill;
  border-image-width: 0 calc(var(--ph) * 0.5);
  filter: drop-shadow(0 0 0.5em rgba(255, 190, 60, 0.9));
}

/* Bet +/- : the box is a 40 px+ touch target, the painted gold disc stays small inside it
   (the gradient ends at 69%), and the negative margin keeps the boxes from widening the plaque. */
.btn-round {
  flex: none;
  width: 2.7em;
  height: 2.7em;
  margin: 0 -0.42em;
  font-size: 1em;
  line-height: 1;
  color: #3b1c00;
  border-radius: 50%;
  background: radial-gradient(
      circle closest-side,
      #fff6c4 0%,
      var(--gold-2) 38%,
      var(--gold-3) 62%,
      var(--gold-4) 67%,
      transparent 69%
    )
    center / 100% 100% no-repeat;
  transition:
    transform 0.09s ease,
    filter 0.15s;
}

.btn-ico {
  /* painted round button (gold knot rim, navy glass); the icon is drawn on top */
  width: 2.75em;
  height: 2.75em;
  display: grid;
  place-items: center;
  background: url(../../art/btn-blank.webp) center / contain no-repeat;
  filter: drop-shadow(0 0.2em 0.3em rgba(0, 0, 0, 0.55));
  transition: transform 0.09s;
}

.btn-ico svg {
  width: 1.45em;
  height: 1.45em;
  fill: none;
  stroke: var(--gold-1);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Sound button: waves when on, a cross when muted. */
#btn-sound .cross {
  display: none;
}

#btn-sound[aria-pressed='true'] .waves {
  display: none;
}
#btn-sound[aria-pressed='true'] .cross {
  display: inline;
}

/* Call-to-action button: same slicing trick as the pill, with the gold art (cap = half the height). */
.btn-gold {
  --ph: 3.1em;
  padding: 0 2.2em;
  height: var(--ph);
  min-width: 11em;
  font-size: 1.55em;
  letter-spacing: 0.06em;
  color: #4a2300;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 900;
  text-shadow: 0 0.05em 0 rgba(255, 244, 190, 0.85);
  border-radius: 0;
  border: 1px solid transparent;
  border-image: url(../../art/btn-gold.webp) 0 115 fill / 0 calc(var(--ph) * 0.5) stretch;
  filter: drop-shadow(0 0.3em 0.5em rgba(0, 0, 0, 0.6)) drop-shadow(0 0 0.8em rgba(255, 190, 60, 0.55));
  transition: transform 0.09s;
}

.btn-round:active,
.btn-pill:active,
.btn-ico:active,
.btn-gold:active {
  transform: scale(0.92);
}

/* disabled: the same painted piece, only faded (never a grey box) */
button:disabled {
  filter: saturate(0.3) brightness(0.62);
  cursor: default;
}

/* A filter replaces the whole list, so the pill repeats its own drop-shadow here. */
/* ======================================================================
   D. Entry screen
   ====================================================================== */

/* Logo at the top, play button low (pushed down by margin-top: auto), notice at the foot. */
.entry {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1.2em;
  padding: calc(1em + var(--safe-t)) 1em calc(1em + var(--safe-b));
  padding-top: calc(11vh + var(--safe-t));
  padding-bottom: calc(27vh + var(--safe-b));
  text-align: center;
}

/* Dark fade at the foot so the notice reads over any scenery. */
.entry::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16vh;
  background: linear-gradient(180deg, rgba(3, 8, 20, 0), rgba(3, 8, 20, 0.78));
  pointer-events: none;
}

/* On a short screen (phone browser bars) the column is too tall: only the logo may shrink.
   The button and the symbols keep their size, or the label would be squeezed out of its plate. */
.entry > * {
  flex-shrink: 0;
}

.entry-logo {
  width: min(86vw, 62vh, 34em);
  height: auto;
  aspect-ratio: 1469 / 1000; /* its space is kept before the image arrives: nothing jumps */
  flex-shrink: 1;
  min-height: 0;
  object-fit: contain; /* shrinking keeps its proportions */
  filter: drop-shadow(0 0.6em 1em rgba(0, 0, 0, 0.6));
  animation: floaty 4.5s ease-in-out infinite;
}

.entry-hoard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  filter: drop-shadow(0 1.2em 0.9em rgba(0, 0, 0, 0.55));
}

.entry-hoard img {
  width: min(25vw, 17vh, 9em);
  height: auto;
  aspect-ratio: 1;
  filter: drop-shadow(0 0.4em 0.6em rgba(0, 0, 0, 0.6));
  animation: floaty 3.6s ease-in-out infinite;
}

/* Reorder the three symbols and offset their float so they do not bob in sync. */
.entry-hoard img:nth-child(1) {
  width: min(33vw, 22vh, 12em);
  order: 2;
  animation-delay: -1.2s;
}

.entry-hoard img:nth-child(2) {
  order: 1;
  animation-delay: -0.5s;
}

.entry-hoard img:nth-child(3) {
  order: 3;
  animation-delay: -2.1s;
}

.btn-play {
  grid-area: 1 / 1;
  font-size: 1.75em;
  /* a soft golden glow that breathes; the shadow under the button never switches off */
  filter: drop-shadow(0 0.25em 0.35em rgba(0, 0, 0, 0.45)) drop-shadow(0 0 0.7em rgba(255, 190, 60, 0.45));
  animation: play-breathe 1.8s ease-in-out infinite;
}

@keyframes play-breathe {
  50% {
    transform: scale(1.04);
    filter: drop-shadow(0 0.25em 0.35em rgba(0, 0, 0, 0.45)) drop-shadow(0 0 1.1em rgba(255, 200, 80, 0.8))
      brightness(1.08);
  }
}

/* Optical centring of the label on the painted button. */
.btn-play span {
  display: block;
  transform: translateY(-0.04em);
}

/* legal notice: on a small carved plate at the foot, never loose over the gold */
.disclaimer {
  --ph: 2.6em;
  position: absolute;
  left: 50%;
  bottom: calc(12px + 1em + var(--safe-b));
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: min(calc(100% - 1.6em), 34em); /* a long notice wraps to two lines instead of running into the caps */
  min-height: var(--ph);
  margin: 0;
  padding: 0.55em 2.9em; /* clear of the carved caps, with air above and below on two lines */
  text-align: center;
  text-wrap: balance;
  border: 1px solid transparent;
  border-image: url(../../art/pill.webp) 0 155 fill / 0 calc(var(--ph) * 0.787) stretch;
  font-size: 0.66em;
  font-weight: 700;
  line-height: 1.15;
  text-shadow: 0 0.08em 0 #000;
}

.age {
  display: grid;
  place-items: center;
  margin: 0;
  width: 2.6em;
  height: 2.6em;
  font-size: 0.75em;
  border: 0.14em solid #fff;
  border-radius: 50%;
}

/* ======================================================================
   E. Game layout (portrait is the base)
   ====================================================================== */

/* Three rows: top bar, machine (takes what is left), controls.
   minmax(0, 1fr) lets the tracks shrink: nothing may push the layout wider than the screen. */
.game {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.5em;
  grid-template-columns: minmax(0, 1fr);
  padding: calc(0.5em + var(--safe-t)) calc(0.6em + var(--safe-r)) calc(0.7em + var(--safe-b))
    calc(0.6em + var(--safe-l));
  padding-left: calc(0.45em + var(--safe-l));
  padding-right: calc(0.45em + var(--safe-r));
  padding-bottom: calc(1.5em + var(--safe-b));
}

/* ======================================================================
   F. Top bar and jackpots
   ====================================================================== */

/* z-index 32: the HUD sits above the flying coins (.fx, 30) and the overlay content (31),
   so coins never cover a plate with text. Same value on the win bar, bet column, spin and toggles. */
.top {
  position: relative;
  z-index: 32;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'balance buttons'
    'logo logo'
    'jackpots jackpots';
  align-items: center;
  gap: 0.45em;
}

.balance {
  --ph: 2.9em;
  grid-area: balance;
  justify-self: start;
  min-width: 10.5em;
  padding: 0 1.1em 0 0.9em;
}

.coin-ico {
  width: 1.7em;
  height: 1.7em;
  margin-left: -0.45em;
}

.balance .num {
  flex: 1;
  font-size: 1.12em;
  text-align: center;
}

/* Refill button: the round button in green. */
.btn-plus {
  margin-right: -0.9em;
  color: #073a02;
  background: radial-gradient(circle closest-side, #d8ffc0 0%, #4fd130 38%, #1e8a12 62%, #073a02 67%, transparent 69%)
    center / 100% 100% no-repeat;
  animation: breathe 1.2s ease-in-out infinite;
}

.top-buttons {
  grid-area: buttons;
  display: flex;
  gap: 0.4em;
}

.logo-small {
  grid-area: logo;
  justify-self: center;
  height: 4.6em;
  width: auto;
  margin: -0.5em 0 -0.4em;
  filter: drop-shadow(0 0.3em 0.4em rgba(0, 0, 0, 0.6));
}

.jackpots {
  position: relative; /* paints over the Viking's waist */
  z-index: 32;
  grid-area: jackpots;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25em 0.4em;
  justify-self: center;
  width: min(100%, 25em);
}

/* Jackpot plate: asymmetric slices (62 right, 96 left) keep the larger left cap intact.
   --jh is the plate height. Label and value sit inside the glass, on one row. */
.jp {
  --jh: 2.9em;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  /* the text area is the glass between the gem (left) and the knot (right), as a share of the plate width */
  padding: 0 17% 0 24%;
  height: var(--jh);
  line-height: 1.05;
  text-shadow: 0 0.08em 0 rgba(0, 0, 0, 0.85);
  border: 1px solid transparent;
  border-image: url(../../art/jp-mini.webp) 0 62 0 96 fill / 0 calc(var(--jh) * 0.446) 0 calc(var(--jh) * 0.69) stretch;
  filter: drop-shadow(0 0.2em 0.3em rgba(0, 0, 0, 0.55));
}

/* Label: never below 11 px on a phone. */
.jp b {
  font-size: 0.74em;
  letter-spacing: 0.02em;
  color: var(--gold-1);
  text-shadow:
    0 0.08em 0 #000,
    0 0 0.25em #000;
}

.jp span {
  font-size: 0.9em;
}

/* the coloured glass sits lower than the plate's middle (the bottom band of the art is thicker): the text moves
   down onto it. --jp-dy = glass centre minus plate centre, as a share of the plate height (measured on this
   game's jp-*.webp). translate: no layout change, so the landscape value-only layout is untouched. */
.jp {
  --jp-dy: 0.026;
}
.jp > b,
.jp > span {
  translate: 0 calc(var(--jh) * var(--jp-dy));
}

/* Each tier only swaps the art (mini is the default above). */
.jp-minor {
  border-image-source: url(../../art/jp-minor.webp);
}

.jp-major {
  border-image-source: url(../../art/jp-major.webp);
}
.jp-grand {
  border-image-source: url(../../art/jp-grand.webp);
}
.jp.hit {
  animation: jp-hit 0.6s ease-in-out 4;
}

/* ======================================================================
   G. Machine: reels, frame, status tag
   ====================================================================== */

.machine {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
}

/* The reels read against a darker patch of scenery. */
.machine::before {
  content: '';
  position: absolute;
  inset: -6% -4%;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(3, 8, 20, 0.62) 0%,
    rgba(3, 8, 20, 0.38) 45%,
    rgba(3, 8, 20, 0) 72%
  );
  pointer-events: none;
}

/* JS sizes this box and sets --fb (frame border thickness) from its width. */
.reels-wrap {
  position: relative;
  border-radius: 0.3em;
}

#reels {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0.3em;
}

/* Painted frame around the canvas: the negative inset puts the border outside the reel window,
   and the border-image slices keep the corners undistorted at any size. */
.frame {
  position: absolute;
  inset: calc(-1 * var(--fb, 20px));
  border: var(--fb, 20px) solid transparent;
  border-image: url(../../art/frame.webp) 131 146 137 145 fill stretch;
  filter: drop-shadow(0 0.4em 0.7em rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

/* Bonus tag above the reels: same carved pill as the plaques, the number is the hero. */
.status {
  --ph: 2.5em;
  position: absolute;
  left: 50%;
  bottom: calc(100% + var(--fb, 20px) * 0.1);
  z-index: 3;
  display: flex;
  align-items: center;
  padding: 0 2.1em;
  height: var(--ph);
  white-space: nowrap;
  font-size: 0.9em;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow:
    0 0.08em 0 #000,
    0 0 0.3em #000;
  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.2em 0.4em rgba(0, 0, 0, 0.6));
  transform: translateX(-50%);
}

.status.pop {
  animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}

/* ======================================================================
   H. Controls: bet, win bar, spin, toggles
   ====================================================================== */

/* Spin on the centre axis, symmetric side columns. */
.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas:
    'winbar winbar winbar'
    'betcol spin toggles';
  align-items: center;
  gap: 0.5em 0.3em;
  justify-content: stretch;
}

.bet-col {
  position: relative;
  z-index: 32;
  grid-area: betcol;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35em;
}

/* Taller plaque so the label keeps clear of the top fillet. */
.bet {
  --ph: 3.5em;
  gap: 0.2em;
  padding: 0 0.4em;
}

.bet-val {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.2em;
  line-height: 1.05;
}

.bet-val small {
  font-size: 0.68em;
  line-height: 1;
}

.bet-val b {
  font-size: 0.95em;
  line-height: 1.05;
}

.winbar {
  --ph: 4.1em;
  position: relative;
  z-index: 32;
  grid-area: winbar;
  justify-self: center;
  justify-content: center;
  flex-wrap: wrap;
  align-content: center;
  gap: 0 0.55em;
  align-items: center;
  min-width: 0;
  padding: 0 2em;
  width: 72%;
}

.winbar small {
  font-size: 0.74em;
  line-height: 1;
}

.winbar b {
  min-width: 3em;
  font-size: 1.7em;
  color: var(--gold-1);
  text-align: center;
  line-height: 1;
  text-shadow:
    0 0.06em 0 var(--gold-4),
    0 0.12em 0.15em #000;
}

.winbar.bump b {
  animation: bump 0.22s ease-out;
}

/* Winning-line text floats just above the win bar instead of resizing it. */
/* "LINE 7: 400" sits inside the WIN plate, under the number (never loose over the scenery) */
.lineinfo {
  flex-basis: 100%;
  margin-top: 0.1em;
  text-align: center;
  font-size: 0.7em;
  font-weight: 700;
  color: var(--ice);
  line-height: 1.1;
  text-shadow:
    0 0.08em 0 #000,
    0 0 0.25em #000;
  pointer-events: none;
}

.lineinfo:empty {
  display: none;
}

/* with the line note on show the number shrinks, so the two never touch */
.winbar:has(.lineinfo:not(:empty)) b {
  font-size: 1.3em;
}

.winbar:has(.lineinfo:not(:empty)) small {
  font-size: 0.66em;
}

/* The big-win banner shows the amount; the win bar steps aside meanwhile. */
/* during a celebration the WIN plate mirrors the banner's number, so the HUD keeps its shape */

/* Wrapper of spin + toggles. In portrait it dissolves (display: contents) so both sit on the .controls grid. */
.side-right {
  position: relative;
  z-index: 32;
  display: contents;
}

.spin {
  position: relative;
  z-index: 32;
  grid-area: spin;
  width: 6.8em;
  height: 6.8em;
  border-radius: 50%;
  filter: drop-shadow(0 0.35em 0.5em rgba(0, 0, 0, 0.6));
  transition: transform 0.1s cubic-bezier(0.3, 1.5, 0.5, 1);
  animation: spin-idle 2.4s ease-in-out infinite;
}

.spin img {
  width: 100%;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.spin:active {
  transform: scale(0.9);
}
.spin.busy {
  animation: none;
}
.spin.busy img {
  transform: rotate(360deg);
}

/* Stop state: the same art, tinted warmer. */
.spin.stop img {
  filter: hue-rotate(-28deg) saturate(1.3);
}

/* Rotating highlight: a conic gradient masked down to a thin ring. */
.spin-ring {
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  opacity: 0;
  background: conic-gradient(from 0deg, transparent 0 65%, rgba(255, 240, 170, 0.95) 85%, transparent 100%);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 64%, #000 70%, transparent 72%);
  mask: radial-gradient(circle, transparent 62%, #000 64%, #000 70%, transparent 72%);
  pointer-events: none;
}

.spin.busy .spin-ring {
  opacity: 1;
  animation: ring 0.7s linear infinite;
}

/* Badge with the autospins left. */
.spin-count {
  position: absolute;
  left: 50%;
  top: -0.5em;
  min-width: 2em;
  padding: 0.05em 0.5em;
  font-size: 0.8em;
  border-radius: 1em;
  background: #0a1a3c;
  border: 0.12em solid var(--gold-2);
  transform: translateX(-50%);
}

.spin-count:empty {
  display: none;
}

.toggles {
  position: relative;
  z-index: 32;
  grid-area: toggles;
  justify-self: center;
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  align-items: stretch;
}

/* In-play notice (SCOPE.md): the credits are free and have no value. One quiet line in the bottom padding of
   .game, under the controls; never on a control or the reels (tools/qa-fit.js checks it). The celebration and
   the sheets are drawn over it. */
.notice {
  position: absolute;
  left: 50%;
  bottom: calc(0.15em + var(--safe-b));
  z-index: 31;
  transform: translateX(-50%);
  max-width: calc(100% - 1.2em);
  margin: 0;
  font:
    600 max(9px, 0.6em) / 1.2 'Trebuchet MS',
    'Segoe UI',
    system-ui,
    sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.62);
  text-shadow:
    0 1px 1px #000,
    0 0 3px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

/* ======================================================================
   I. Overlays: coins, announcement, celebration
   ====================================================================== */

/* Canvas for coins and sparks, above the game and below the banners. */
.fx {
  position: absolute;
  inset: 0;
  z-index: 30;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Dim layer. It has no z-index on purpose: it stays below the coins (30) and the HUD (32),
   while its content (.over-box, 31) rises above the coins. */
.announce,
.celebrate {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
}

.announce {
  background: rgba(3, 8, 20, 0.92);
  pointer-events: none;
}

.celebrate {
  background: radial-gradient(
    ellipse at 50% 46%,
    rgba(3, 8, 20, 0.96) 0%,
    rgba(3, 8, 20, 0.94) 45%,
    rgba(3, 8, 20, 0.86) 100%
  );
}

/* The overlay content lives inside the reel window: JS places this box on the canvas rect.
   container-type: size lets everything inside scale with that window (cqw / cqh), so nothing crosses the frame. */
.over-box {
  position: absolute;
  z-index: 31;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2cqh;
  container-type: size;
  padding: 3cqh 2cqw;
}

/* Painted banner plate; it is a container too, so the text inside scales with the plate. */
.announce-card,
.banner {
  z-index: 31;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(62cqw, 88cqh);
  aspect-ratio: 1200 / 390;
  container-type: inline-size;
  text-align: center;
  background: url(../../art/banner.webp) center / 100% 100% no-repeat;
  filter: drop-shadow(0 0.8em 1.4em rgba(0, 0, 0, 0.7));
}

.announce-card {
  padding: 1% 14% 0;
  overflow: hidden;
  animation: banner-in 0.45s cubic-bezier(0.2, 1.5, 0.35, 1) both;
}

#announce-title {
  /* as big as the glass allows; fitText() shrinks longer texts */
  font-size: 20.5cqw;
  line-height: 1;
  white-space: nowrap;
}

/* The title stands above the plate. Every tier uses the same size so it always fits the window;
   higher tiers are told apart by the step-up burst (.banner.step), not by overflowing. */
/* The tier title is painted lettering (title-big/mega/epic.webp), sized to stay inside the reel window. */
.cel-title {
  position: relative;
  z-index: 31;
  line-height: 0;
  /* room for the slam overshoot (scale 1.07): the title never touches the plate below, even for a frame */
  margin-bottom: 2.5cqh;
  animation: banner-in 0.5s cubic-bezier(0.2, 1.6, 0.35, 1) both;
}

.cel-title img {
  width: min(84cqw, 132cqh);
  height: auto;
  filter: drop-shadow(0 0.4em 0.6em rgba(0, 0, 0, 0.8));
}

.celebrate[data-tier='mega'] .cel-title img {
  width: min(88cqw, 146cqh);
}

.celebrate[data-tier='epic'] .cel-title img {
  width: min(92cqw, 160cqh);
}

/* a soft golden bloom behind title and amount: the "rays" of the celebration */
.celebrate .over-box::before {
  content: '';
  position: absolute;
  inset: -8% -4%;
  z-index: -1;
  background: radial-gradient(
    ellipse at 50% 42%,
    rgba(255, 196, 70, 0.34) 0%,
    rgba(255, 150, 20, 0.12) 38%,
    rgba(255, 150, 20, 0) 66%
  );
  pointer-events: none;
}

.banner {
  padding: 0 15%;
  padding-top: 1%;
  animation: banner-in 0.5s cubic-bezier(0.2, 1.6, 0.35, 1) both;
}

.banner.step {
  animation: banner-step 0.4s cubic-bezier(0.2, 1.7, 0.35, 1);
}

/* The amount fills the plate and is bigger than the title. */
.cel-amount {
  font-size: 20.5cqw;
  line-height: 1;
  color: var(--gold-1);
  text-shadow:
    0 0.07em 0 var(--gold-4),
    0 0.14em 0.2em #000;
}

/* the hint sits on its own small carved plate, so coins behind it never hurt its reading */
.skip {
  --ph: 2.3em;
  position: relative;
  z-index: 31;
  display: flex;
  align-items: center;
  height: var(--ph);
  padding: 0 1.9em;
  border: 1px solid transparent;
  border-image: url(../../art/pill.webp) 0 155 fill / 0 calc(var(--ph) * 0.787) stretch;
  font-size: min(3.6cqw, 7.5cqh, 0.8em);
  letter-spacing: 0.16em;
  text-shadow: 0 0.08em 0 #000;
  opacity: 0.92;
}

/* ======================================================================
   J. Sheets (rules, autospin) and toast
   ====================================================================== */

.sheet {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1em;
  background: rgba(3, 8, 20, 0.72);
}

/* The panel wears the same carved frame as the reels (9-slice), over a navy glass body. */
.sheet-card {
  --fb: 1.5em;
  position: relative;
  display: flex;
  width: min(100%, 40em);
  min-width: 0;
  /* never taller than the screen: the body scrolls inside the frame */
  max-height: calc(100vh - 2em);
  max-height: calc(100dvh - 2em);
  border: var(--fb) solid transparent;
  border-image: url(../../art/frame.webp) 131 146 137 145 stretch;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(120, 190, 255, 0.22) 0%, rgba(120, 190, 255, 0) 60%) padding-box,
    linear-gradient(180deg, #17376d, #06122b) padding-box;
  border-radius: 1.6em;
  filter: drop-shadow(0 1em 1.6em rgba(0, 0, 0, 0.75));
  animation: banner-in 0.3s cubic-bezier(0.2, 1.3, 0.35, 1) both;
}

/* painted close button, tucked inside the top-right corner of the panel */
.sheet-close {
  position: absolute;
  top: 0.2em;
  right: 0.2em;
  z-index: 2;
  width: 2.9em;
  height: 2.9em;
  border: 0;
  box-shadow: none;
  background: url(../../art/btn-close.webp) center / contain no-repeat;
}

.sheet-close svg {
  display: none;
}

.sheet-body h2 {
  padding: 0 2.2em;
}

/* on/off switch and "step through the choices" button: the game's own pill, never a native control */
.opt-row .btn-pill {
  flex: none;
  min-width: 8.8em;
  font-size: 1em;
  --ph: 3.5em;
}

.opt-row span {
  text-align: left;
  color: var(--gold-1);
}

.auto-opts {
  padding-bottom: 0.9em;
  border-bottom: 0.12em solid rgba(255, 201, 60, 0.35);
}

.auto-opts .inf {
  font-size: 2.3em;
  line-height: 0.6;
}

.sheet-body {
  overflow-y: auto;
  padding: 1.2em 1.1em;
  width: 100%;
  font-weight: 600;
  font-size: 0.82em;
  line-height: 1.4;
  -webkit-overflow-scrolling: touch;
}

.sheet-body h2 {
  margin: 0 0 0.5em;
  font-size: 1.5em;
  text-align: center;
}

.sheet-body h3 {
  margin: 1.1em 0 0.4em;
  color: var(--gold-2);
  font-size: 1.1em;
  letter-spacing: 0.05em;
}

.sheet-body p {
  margin: 0.4em 0;
}

/* Paytable. */
.pay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.8em, 1fr));
  gap: 0.5em;
}

.pay {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.35em 0.5em;
  border-radius: 0.7em;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 201, 60, 0.35);
}

.pay img {
  width: 3.8em;
  height: 3.8em;
}

.pay div {
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.pay i {
  margin-right: 0.3em;
  font-style: normal;
  color: var(--gold-2);
}

/* Payline diagrams: a 5 x 3 grid of dots, the line lit in gold. */
.lines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.4em, 1fr));
  gap: 0.45em;
}

.line-mini {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  padding: 0.2em;
  border-radius: 0.3em;
  background: rgba(0, 0, 0, 0.3);
}

.line-mini i {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 1px;
}

.line-mini i.on {
  background: var(--gold-2);
}

.line-mini b {
  position: absolute;
  left: 0.25em;
  top: -0.55em;
  font-size: 0.7em;
  color: var(--ice);
}

/* Autospin options. */
.auto-opts {
  display: grid;
  /* minmax(0, ...) lets the columns shrink: the carved pills must never push the sheet off a phone */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6em;
  margin: 0.8em 0;
}

.auto-opts .btn-pill {
  font-size: 1.15em;
}

.auto-opts .btn-pill {
  min-width: 0;
  width: 100%;
}

.sheet-body {
  min-width: 0;
  min-height: 0;
}

.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  margin: 0.6em 0;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(9em + var(--safe-b));
  z-index: 45;
  padding: 0.5em 1.1em;
  max-width: 90vw;
  font-size: 0.8em;
  text-align: center;
  border-radius: 1.2em;
  background: rgba(6, 16, 31, 0.92);
  border: 0.12em solid var(--gold-2);
  translate: -50% 0;
  pointer-events: none;
}

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