
.grid {
  position: relative;
  z-index: 0;
  flex: none;
  align-self: center;
  display: grid;
  grid-template-columns: repeat(5, var(--cell));
  justify-content: center;
  gap: 3px;
  padding: 6px;
  border-radius: 6px;
  background: linear-gradient(180deg, #0a1240, #050826);
  border: 3px solid #ffe680;
  box-shadow: 0 0 0 1px var(--gold-deep), 0 0 6px 1px var(--gold), 0 0 22px 4px rgba(255, 200, 60, 0.6), inset 0 0 18px rgba(0, 0, 0, 0.8);
}

:root {
  --reel-frame: url("../art/frames/vault.webp");
}

.grid::before,
.aurora-top-grid::before {
  content: "";
  position: absolute;
  top: -18px;
  bottom: -4px;
  left: -23px;
  right: -23px;
  z-index: -1;
  border-image: var(--reel-frame) 99 90 48 90 / 33px 30px 16px 30px stretch;
  pointer-events: none;
}

.reel {
  grid-row: 1;
  position: relative;
  height: calc(var(--cell) * var(--reel-rows, 3));
  overflow: hidden;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 211, 77, 0.5), inset 1px 0 0 rgba(255, 255, 255, 0.08), inset -1px 0 0 rgba(0, 0, 0, 0.5);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent 22%, rgba(255, 255, 255, 0.05) 50%, transparent 78%, rgba(0, 0, 0, 0.6)),
    radial-gradient(ellipse at 50% 50%, #18246a, #0a1038 82%);
}

.strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.cell.cell-spin {
  overflow: hidden;
}

.cell-reel {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  will-change: transform;
}

.cell-reel > .cell {
  flex: none;
}

.reel-shine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 30%;
  z-index: 1;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.11) 48%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.11) 52%, transparent 80%);
  pointer-events: none;
  animation: reel-shine 9s ease-in-out infinite;
}

.grid.has-win .reel-shine {
  display: none;
}

.win-plate {
  position: absolute;
  left: 50%;
  bottom: -9px;
  z-index: 3;
  max-width: 96%;
  padding: 2px 12px 1px;
  border-radius: 6px;
  background: linear-gradient(180deg, #2a1a00, #0a0600);
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 1px var(--gold-deep), 0 2px 8px rgba(0, 0, 0, 0.7), 0 0 12px rgba(255, 211, 77, 0.5);
  color: var(--gold-light);
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 #000;
  transform: translate(-50%, 0) scale(0);
  opacity: 0;
  pointer-events: none;
}

.win-plate .sym-img {
  width: 1.5em;
  height: 1.5em;
  margin: -0.3em 0.3em -0.2em -0.2em;
}

.win-plate.show {
  animation: plate-in 220ms cubic-bezier(0.3, 1.5, 0.5, 1) forwards;
}

.line-tabs {
  position: absolute;
  top: 2px;
  bottom: 2px;
  z-index: 1;
  display: none;
  flex-direction: column;
  justify-content: space-evenly;
  width: 20px;
  pointer-events: none;
}

.line-tabs.left { left: -21px; }
.line-tabs.right { right: -21px; }

.line-tab {
  width: 16px;
  height: 13px;
  margin: 0 auto;
  border-radius: 3px;
  background: linear-gradient(180deg, #1c2a5a, #06102e);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-family: var(--display);
  font-size: 11px;
  line-height: 13px;
  text-align: center;
}

.line-tab.lit {
  background: var(--c);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 8px var(--c);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.7);
}

.cell {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--cell);
  height: var(--cell);
  font-size: calc(var(--cell) * 0.6);
  line-height: 1;
}

.cell.sym {
  isolation: isolate;
  background: radial-gradient(closest-side, var(--glow), transparent);
}

body:not(.at-drums) .cell.sym::before {
  content: "";
  position: absolute;
  inset: 4%;
  z-index: -1;
  border: 1px solid #d8a82e;
  border-radius: 2px;
  background:
    linear-gradient(#ffe68a, #ffe68a) left 3px top 3px / 12% 2px no-repeat,
    linear-gradient(#ffe68a, #ffe68a) left 3px top 3px / 2px 12% no-repeat,
    linear-gradient(#ffe68a, #ffe68a) right 3px top 3px / 12% 2px no-repeat,
    linear-gradient(#ffe68a, #ffe68a) right 3px top 3px / 2px 12% no-repeat,
    linear-gradient(#ffe68a, #ffe68a) left 3px bottom 3px / 12% 2px no-repeat,
    linear-gradient(#ffe68a, #ffe68a) left 3px bottom 3px / 2px 12% no-repeat,
    linear-gradient(#ffe68a, #ffe68a) right 3px bottom 3px / 12% 2px no-repeat,
    linear-gradient(#ffe68a, #ffe68a) right 3px bottom 3px / 2px 12% no-repeat,
    radial-gradient(ellipse at 50% 35%, var(--glow), transparent 80%),
    linear-gradient(145deg, #260d3e, #0c061b);
  box-shadow: inset 0 0 0 1px #543211;
}

.sym-face {
  font-size: calc(var(--cell) * 0.82);
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.85));
}

.sym-img {
  display: inline-block;
  width: 1.18em;
  height: 1.18em;
  vertical-align: middle;
  -webkit-user-drag: none;
  user-select: none;
}

.cell .sym-img {
  display: block;
  object-fit: contain;
}

.cell.sym-0 { --glow: rgba(255, 92, 40, 0.75); }
.cell.sym-1 { --glow: rgba(255, 196, 60, 0.6); }
.cell.sym-2 { --glow: rgba(60, 220, 200, 0.55); }
.cell.sym-3 { --glow: rgba(80, 150, 255, 0.6); }
.cell.sym-4 { --glow: rgba(255, 70, 150, 0.6); }

.cell.wild { --glow: rgba(255, 215, 80, 0.85); }

.wild-tag {
  position: absolute;
  left: 50%;
  bottom: 6%;
  transform: translateX(-50%);
  padding: 0 0.3em;
  border-radius: 4px;
  background: linear-gradient(180deg, #871bbc, #30064e);
  box-shadow: 0 0 0 1.5px #ffd75a;
  color: #ffe9a0;
  font-family: var(--display);
  font-size: max(0.7rem, calc(var(--cell) * 0.2));
  letter-spacing: 0.06em;
  line-height: 1.15;
}

.cell.sym-0 .sym-face {
  font-size: calc(var(--cell) * 0.84);
  filter: drop-shadow(0 1px 2px rgba(70, 24, 0, 0.9));
}

.cell.letter {
  display: grid;
  place-items: center;
  font-family: var(--symbol);
  font-size: calc(var(--cell) * 0.7);
  font-weight: 400;
}

.glyph-shadow,
.glyph-edge,
.glyph {
  position: relative;
  grid-area: 1 / 1;
  padding: 0.12em 0.4em;
  line-height: 1;
  text-shadow: none;
}

.glyph-shadow {
  color: var(--royal-shadow, #000);
  -webkit-text-stroke: calc(var(--cell) * 0.13) var(--royal-shadow, #000);
  transform: translateY(1px);
}

.glyph-edge {
  color: var(--royal-edge, #fff);
  -webkit-text-stroke: calc(var(--cell) * 0.075) var(--royal-edge, #fff);
}

.glyph {
  background-image:
    linear-gradient(170deg, var(--royal-sheen, rgba(255, 255, 255, 0.45)) 0 18%, transparent 30%),
    linear-gradient(180deg, var(--l1) 0%, var(--l2) 45%, var(--l3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--royal-ink, #000);
}

.cell.letter-Q { font-size: calc(var(--cell) * 0.66); }
.letter-Q .glyph-shadow { transform: none; }

.cell.letter-10 {
  font-size: calc(var(--cell) * 0.5);
  letter-spacing: -0.04em;
}

.letter-9 { --l1: #c8ffb0; --l2: #2ccc2a; --l3: #0a6a10; }
.letter-10 { --l1: #ffb0a8; --l2: #f0141e; --l3: #8a0008; }
.letter-J { --l1: #b8e0ff; --l2: #2070f0; --l3: #0a2a90; }
.letter-Q { --l1: #fffac0; --l2: #ffd418; --l3: #c08000; }
.letter-K { --l1: #ffe0a0; --l2: #ff8410; --l3: #a83800; }
.letter-A { --l1: #ffc0e8; --l2: #ff2ea0; --l3: #900050; }

.letter-crown,
.letter-gem {
  position: absolute;
  background: center / contain no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

.letter-crown {
  top: 0;
  width: calc(var(--cell) * 0.3);
  height: calc(var(--cell) * 0.225);
  background-image: url("../art/ui/letter-crown.webp");
}

.letter-K .letter-crown {
  left: 10%;
  transform: rotate(-14deg);
}

.letter-Q .letter-crown {
  right: 4%;
  top: 32%;
  transform: rotate(10deg);
}

.letter-gem {
  left: 50%;
  top: 60%;
  width: calc(var(--cell) * 0.24);
  height: calc(var(--cell) * 0.158);
  transform: translate(-50%, -50%);
  background-image: url("../art/ui/letter-gem.webp");
}

.cell.orb {
  isolation: isolate;
  background: radial-gradient(closest-side, var(--c), transparent);
  color: var(--gold-light);
  font-family: var(--display);
  font-size: calc(var(--cell) * 0.27);
  font-weight: 400;
  line-height: 1;
}

.cell.orb::before {
  content: "";
  position: absolute;
  inset: 4%;
  z-index: -1;
  border: calc(var(--cell) * 0.045) solid transparent;
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
}

.cell.orb::before {
  background:
    conic-gradient(from 22.5deg, rgba(255, 255, 255, 0.4) 0 12.5%, transparent 0 25%, rgba(0, 0, 0, 0.18) 0 37.5%, transparent 0 50%, rgba(0, 0, 0, 0.28) 0 62.5%, transparent 0 75%, rgba(255, 255, 255, 0.22) 0 87.5%, transparent 0) padding-box,
    radial-gradient(circle at 40% 32%, var(--c-light), var(--c) 50%, var(--c-dark)) padding-box,
    var(--gold-rim) border-box;
}

.orb-label {
  position: relative;
  z-index: 1;
  padding: 0.1em 0.45em 0.05em;
  border-radius: 4px;
  background: linear-gradient(180deg, #2a1a50, #0c0620);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.55), 0 2px 4px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 #000;
  white-space: nowrap;
}

.cell.orb::after {
  content: "";
  position: absolute;
  inset: 27%;
  z-index: -1;
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
  background: radial-gradient(circle at 45% 35%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.08) 70%);
}

.cell.orb.jp {
  color: var(--gold);
  font-size: max(0.7rem, calc(var(--cell) * 0.19));
}

.slot.jp {
  font-size: 0.5rem;
}

.cell.win {
  z-index: 1;
  animation: win-bob 700ms ease-in-out infinite;
}

.cell.win::after {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 2;
  border: 3px solid #fff;
  border-radius: 7px;
  box-shadow: 0 0 0 1px var(--gold-dark), inset 0 0 0 1px var(--gold-dark), 0 0 12px var(--gold), inset 0 0 14px rgba(255, 211, 77, 0.35);
  pointer-events: none;
  animation: win-box 700ms ease-in-out infinite;
  will-change: transform;
}

.grid.has-win .cell:not(.win):not(.orb),
:is(.grid, .aurora-top-grid).cycling .cell:not(.win):not(.orb) {
  opacity: 0.8;
  transition: opacity 100ms ease;
}

.payline.off,
.drum-line-set.off,
.payline-beam.off {
  display: none;
}

.payline {
  position: absolute;
  z-index: 0;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-light) 6%, #fff 50%, var(--gold-light) 94%, transparent);
  box-shadow: 0 0 10px var(--gold), 0 0 20px rgba(255, 140, 0, 0.8);
  opacity: 0.6;
  pointer-events: none;
  animation: payline 650ms ease-in-out infinite alternate;
}

.payline-beams {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.payline-beams.ascent-beams {
  z-index: 3;
}

.payline-beams-svg {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.payline-beam.off {
  display: none;
}

.payline-beam-glow,
.payline-beam-core {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.payline-beam-glow {
  stroke: var(--payline-color, var(--gold));
  stroke-width: 11;
  opacity: 0.36;
  stroke-dasharray: var(--beam-len, 1000);
  stroke-dashoffset: 0;
  animation: payline-trace 240ms cubic-bezier(0.22, 1, 0.36, 1) both, payline-beam-glow 650ms ease-in-out infinite alternate;
}

.payline-beam-core {
  stroke: var(--payline-core, var(--payline-color, var(--gold-light)));
  stroke-width: 4;
  opacity: 0.95;
  stroke-dasharray: var(--beam-len, 1000);
  stroke-dashoffset: 0;
  animation: payline-trace 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.payline-beams.ascent-beams .payline-beam-glow {
  stroke-width: 13;
}

.payline-beams.ascent-beams .payline-beam-core {
  stroke: var(--gold-light);
  stroke-width: 3.5;
}

.payline-beam-dot {
  fill: var(--payline-color, var(--gold));
  stroke: #fff;
  stroke-width: 1.5;
}

.payline-beam-no {
  fill: #fff;
  font-family: var(--display);
  font-size: 11px;
  text-anchor: middle;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.7);
  stroke-width: 2px;
}

@keyframes payline-trace {
  from { stroke-dashoffset: var(--beam-len, 1000); }
  to { stroke-dashoffset: 0; }
}

@keyframes payline-beam-glow {
  from { opacity: 0.22; }
  to { opacity: 0.5; }
}

body.scene-motion-paused .payline-beam-glow,
body.scene-motion-paused .payline-beam-core {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .payline-beam-glow,
  .payline-beam-core {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
    animation: none;
  }
}

.reel.teasing {
  box-shadow: 0 0 0 2px var(--gold), 0 0 16px var(--gold), inset 0 0 14px rgba(255, 211, 77, 0.7);
}

.reel-fx {
  grid-row: 1;
  position: relative;
  z-index: 3;
  overflow: visible;
  pointer-events: none;
}

.reel-fx > .sting,
.reel-fx > .cell-feedback {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% * var(--reel-fx-row) / var(--reel-rows, 3));
  height: calc(100% / var(--reel-rows, 3));
}

.sting {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, var(--gold-light) 0, var(--sting-gold) 34%, transparent 68%);
  animation: sting-burst 420ms ease-out;
}

.sting.scatter {
  background: radial-gradient(circle at 50% 50%, var(--gold-light) 0, var(--sting-gold) 40%, transparent 78%);
}

.sting.jp.grand {
  background: radial-gradient(circle at 50% 50%, var(--gold-light) 0, var(--gold) 20%, var(--jp-grand) 44%, transparent 72%);
}

.sting.jp.major {
  background: radial-gradient(circle at 50% 50%, var(--gold-light) 0, var(--gold) 20%, var(--jp-major) 44%, transparent 72%);
}

.lightning {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
}

.lightning svg {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.lightning.strike {
  animation: strike 520ms linear forwards;
}

.lightning.strike:where(.replay-b) {
  animation-name: strike-b;
}

.lightning .bolt,
.lightning .bolt-glow {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightning .bolt {
  stroke: #fff;
  stroke-width: 5;
}

.lightning .bolt-glow {
  stroke: #7fdcff;
  stroke-width: 16;
  opacity: 0.75;
  filter: blur(4px);
}

.lightning .fork {
  stroke-width: 2.5;
}

.lightning .bolt-glow.fork {
  stroke-width: 9;
}

.grid.struck {
  animation: struck 520ms ease-out;
}

.grid.struck:where(.replay-b) {
  animation-name: struck-b;
}

.winner {
  position: absolute;
  left: -10px;
  right: -10px;
  top: 50%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--cell) * 0.3) calc(var(--cell) * 0.4) calc(var(--cell) * 0.32);
  transform: translateY(-50%) scale(0);
  opacity: 0;
  pointer-events: none;
}

.winner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-style: solid;
  border-color: transparent;
  border-width: calc(var(--cell) * 0.6) calc(var(--cell) * 0.69);
  border-image: url("../art/winner/frame.webp") 80 92 fill stretch;
  filter: drop-shadow(0 0 14px rgba(255, 211, 77, 0.6)) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.7));
}

.winner::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 1;
  width: calc(var(--cell) * 1.25);
  aspect-ratio: 246 / 108;
  background: url("../art/winner/crest.webp") center / contain no-repeat;
  transform: translate(-50%, -68%);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
}

.winner.show {
  animation: winner-in 420ms cubic-bezier(0.3, 1.6, 0.5, 1) forwards;
}

.winner.show.hide {
  animation: winner-out 250ms ease-in forwards;
}

.winner-title {
  font-family: var(--display);
  font-size: calc(var(--cell) * 0.7);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  background-image: var(--gold-bevel);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 #6a0016) drop-shadow(0 0 10px rgba(255, 140, 0, 0.9));
}

.winner-amount {
  margin-top: 2px;
  font-family: var(--display);
  font-size: calc(var(--cell) * 0.55);
  font-weight: 900;
  line-height: 1.05;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 0 #000, 0 0 12px var(--gold);
}

.cell.collected {
  opacity: 0.75;
  transition: opacity 200ms ease;
}

.grid.tease {
  animation: tease 300ms ease-in-out infinite alternate;
}

