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

html,
body,
#app {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #05060a;
}

#app {
  min-height: 100dvh;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #f4efe4;
  touch-action: none;
  -webkit-touch-callout: none;
}

button,
p,
h1 {
  margin: 0;
}

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

.boot {
  margin-top: 30vh;
  text-align: center;
  color: #c9b89a;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.screen {
  --reel-gap: clamp(6px, 0.8vw, 12px);
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(4px, 0.8vh, 10px);
  padding:
    max(8px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  background:
    radial-gradient(ellipse 70% 80% at 50% 46%, #12151e 0%, #05060a 72%);
}

.screen * {
  user-select: none;
  -webkit-user-select: none;
}

.reel-box {
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.bezel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  max-height: 100%;
}

.marker {
  width: 0;
  height: 0;
  flex: none;
  opacity: 0.85;
}

.marker.left {
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 10px solid #e6c56a;
}

.marker.right {
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 10px solid #e6c56a;
}

.bezel.hit .marker {
  filter: drop-shadow(0 0 6px #ffe08a);
}

.reels {
  position: relative;
  display: flex;
  gap: var(--reel-gap);
}

.reel-window {
  box-sizing: content-box;
  width: var(--cell);
  height: calc(var(--cell) * 3);
  overflow: hidden;
  position: relative;
  border-radius: 4px;
  background: linear-gradient(#141820, #07080c 22%, #07080c 78%, #12151c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.reel-window::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, transparent 14%, transparent 86%, rgba(0, 0, 0, 0.4) 100%);
}

.reel-window.spinning::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    transparent 0 6px,
    rgba(255, 255, 255, 0.04) 6px 8px
  );
  animation: streak 0.12s linear infinite;
}

@keyframes streak {
  to { transform: translateY(8px); }
}

.reel-strip {
  transform: translate3d(0, calc(var(--pos) * var(--cell) * -1), 0);
  transition: filter 0.12s linear;
  will-change: transform;
}

.reel-strip.go {
  animation-name: reel-spin;
  animation-duration: var(--dur);
  animation-timing-function: cubic-bezier(0.12, 0.62, 0.08, 1);
  animation-fill-mode: both;
}

@keyframes reel-spin {
  from { transform: translate3d(0, calc(var(--pos) * var(--cell) * -1), 0); }
  to { transform: translate3d(0, calc(var(--dest) * var(--cell) * -1), 0); }
}

.reel-window.spinning .reel-strip {
  filter: blur(1.4px);
}

.cell {
  height: var(--cell);
  width: var(--cell);
  display: grid;
  place-items: center;
  position: relative;
}

.sym {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.sym svg {
  width: 72%;
  height: 72%;
  overflow: visible;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
}

.logo-simbolo {
  width: 68%;
  height: 68%;
  object-fit: contain;
  pointer-events: none;
  animation: logo-giro 9s linear infinite;
}

@keyframes logo-giro {
  to { transform: rotate(360deg); }
}

.cell.hot .sym {
  animation: pop 0.45s ease-in-out infinite alternate;
}

.cell.hot .sym svg,
.cell.hot .logo-simbolo {
  filter: drop-shadow(0 0 8px rgba(255, 210, 70, 0.95));
}

@keyframes pop {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

.glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 16%);
}

.banner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  transform: translate(-50%, -50%);
  padding: 0.15em 0.45em 0.2em;
  border-radius: 8px;
  border: 2px solid #e6c56a;
  background: rgba(6, 7, 10, 0.88);
  color: #ffe7a4;
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: clamp(22px, calc(var(--cell) * 0.34), 64px);
  letter-spacing: 1px;
  white-space: nowrap;
  pointer-events: none;
  animation: banner-pop 0.28s ease-out both;
}

.banner.mega {
  color: #fff4d2;
  border-color: #ffd56a;
  text-shadow: 0 0 16px rgba(255, 196, 60, 0.8);
}

@keyframes banner-pop {
  0% { transform: translate(-50%, -50%) scale(0.92); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.bottombar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.meters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(6px, 1vw, 14px);
}

.meter {
  min-width: 0;
  padding: clamp(4px, 0.6vh, 8px) clamp(8px, 1vw, 14px) clamp(6px, 0.8vh, 10px);
  border-radius: 6px;
  background: #0b0d12;
  border: 1px solid rgba(255, 70, 70, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.meter-label {
  font-size: clamp(10px, 1.35vh, 13px);
  letter-spacing: 0.16em;
  color: #e7c9c9;
}

.meter-value {
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: clamp(24px, 4.6vh, 54px);
  line-height: 1;
  font-weight: 400;
  color: #ff2d2d;
  text-shadow: 0 0 10px rgba(255, 40, 40, 0.65);
  font-variant-numeric: tabular-nums;
}

.meter-win .meter-value {
  color: #ffd24a;
  text-shadow: 0 0 10px rgba(255, 200, 40, 0.55);
}

.meter-value.idle {
  opacity: 0.38;
}

.payline,
.hint {
  text-align: center;
  color: rgba(243, 230, 196, 0.72);
  font-size: clamp(11px, 1.45vh, 14px);
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.hint {
  color: rgba(243, 230, 196, 0.5);
}

.hud-btns {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-btn {
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.35);
  color: rgba(243, 230, 196, 0.9);
  cursor: pointer;
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  line-height: 1;
}

.hud-btn.mute {
  width: 36px;
  padding: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.hud-btn.auto {
  padding: 0 12px;
}

.hud-btn.auto.on {
  color: #ffd24a;
  border-color: rgba(255, 210, 74, 0.75);
  background: rgba(255, 180, 40, 0.2);
  box-shadow: 0 0 12px rgba(255, 180, 40, 0.35);
}

.hud-btn:focus-visible {
  outline: 2px solid #e6c56a;
  outline-offset: 2px;
}

.screen.is-jackpot .bezel {
  animation: screen-shake 0.4s linear;
}

@keyframes screen-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

@media (max-height: 520px) {
  .payline {
    display: none;
  }
}

@media (max-width: 720px) {
  .meters {
    grid-template-columns: 1fr 1fr;
  }

  .payline {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cell.hot .sym,
  .logo-simbolo,
  .reel-window.spinning::before {
    animation: none;
  }
}
