/* ==========================================================================
   Nordiva Slot Machine — uses site CSS variables only
   ========================================================================== */

.slot-section {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
@media (max-width: 375px) {
  .slot-section .container {
    overflow: hidden;
  }
  .slot-section {
    padding: 4px;
  }
}

.slot-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

/* --- Machine frame --- */
.slot-machine {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  position: relative;
  overflow: visible;
}

.slot-machine::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--gradient);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.35;
  pointer-events: none;
}

.slot-frame {
  position: relative;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.slot-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(10, 14, 26, 0.55) 0%,
    transparent 18%,
    transparent 82%,
    rgba(10, 14, 26, 0.55) 100%
  );
  z-index: 3;
}

/* Confetti */
.slot-confetti {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  overflow: visible;
}

.slot-confetti-particle {
  position: absolute;
  left: 50%;
  top: 50%;
  opacity: 0;
  box-shadow:
    0 0 6px currentColor,
    0 0 14px currentColor,
    0 0 22px rgba(167, 139, 250, 0.45);
  animation: confettiBurst var(--dur, 2.5s) cubic-bezier(0.15, 0.85, 0.25, 1)
    forwards;
  will-change: transform, opacity;
}

@keyframes confettiBurst {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty)))
      rotate(var(--rot)) scale(0.2);
    opacity: 0;
  }
}

/* Slot column + win history */
.slot-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.slot-win-history {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.slot-win-history h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.slot-history-list {
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.slot-history-list::-webkit-scrollbar {
  width: 4px;
}

.slot-history-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.slot-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    background var(--transition),
    border-color var(--transition),
    transform var(--transition);
}

.slot-history-item.is-new {
  animation: historySlideIn 0.5s ease;
}

.slot-history-item.is-challenge {
  border-color: var(--accent-purple);
  background: linear-gradient(
    135deg,
    rgba(124, 58, 237, 0.12) 0%,
    rgba(6, 182, 212, 0.08) 100%
  );
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.15);
}

.slot-history-item.is-challenge .slot-history-label::before {
  content: "★ ";
  color: var(--accent-cyan);
}

.slot-history-item.is-challenge .slot-history-amount {
  color: var(--accent-purple);
  text-shadow: 0 0 12px rgba(167, 139, 250, 0.5);
}

@keyframes historySlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slot-history-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.slot-history-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-history-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.slot-history-amount {
  flex-shrink: 0;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.slot-history-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1.5rem 1rem;
}

/* Reels grid */
.slot-reels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  position: relative;
  z-index: 1;
}

.slot-reel {
  overflow: hidden;
  height: calc(var(--slot-symbol-h) * 3);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
}

.slot-reel::before,
.slot-reel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 28%;
  z-index: 2;
  pointer-events: none;
}

.slot-reel::before {
  top: 0;
  background: linear-gradient(180deg, var(--bg-primary) 0%, transparent 100%);
}

.slot-reel::after {
  bottom: 0;
  background: linear-gradient(0deg, var(--bg-primary) 0%, transparent 100%);
}

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

.slot-reel-strip.is-spinning {
  filter: blur(1.5px);
}

.slot-symbol {
  flex-shrink: 0;
  height: var(--slot-symbol-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  transition:
    filter var(--transition),
    transform var(--transition);
}

.slot-symbol svg,
.slot-symbol img {
  width: 100%;
  max-width: 52px;
  height: auto;
  max-height: 52px;
  object-fit: contain;
  display: block;
}

.slot-symbol.is-winning {
  filter: drop-shadow(0 0 8px var(--accent-cyan))
    drop-shadow(0 0 14px var(--accent-purple));
  transform: scale(1.08);
  z-index: 5;
  position: relative;
}

/* --- Controls panel --- */
.slot-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: center;
}

.slot-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.slot-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  text-align: center;
}

.slot-stat-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.slot-stat-value {
  font-family: var(--font-heading);
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 700;
  color: var(--text-primary);
  transition:
    color var(--transition),
    transform 0.4s ease;
}

.slot-stat-value.is-updating {
  color: var(--accent-cyan);
  transform: scale(1.06);
}

.slot-stat-value.is-win {
  color: var(--accent-purple);
}

.slot-bet-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.slot-bet-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color var(--transition),
    color var(--transition),
    transform var(--transition);
}

.slot-bet-btn:hover:not(:disabled) {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}

.slot-bet-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.slot-bet-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.slot-bet-value {
  min-width: 5rem;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.slot-spin-wrap {
  display: flex;
  justify-content: center;
}

.slot-spin-btn {
  min-width: 200px;
  padding: 1rem 2.5rem;
  border: none;
  border-radius: var(--radius);
  background: var(--gradient);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(124, 58, 237, 0.45);
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
}

.slot-spin-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 32px rgba(124, 58, 237, 0.6);
}

.slot-spin-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
}

.slot-spin-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.slot-spin-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

/* --- Rules / Paytable panel --- */
.slot-rules {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.slot-rules > h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.slot-rules-intro {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.slot-rules-intro ol {
  padding-left: 1.25rem;
  margin-top: 0.5rem;
}

.slot-rules-intro li {
  margin-bottom: 0.35rem;
}

/* Paytable */
.slot-paytable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.slot-paytable th,
.slot-paytable td {
  padding: 0.6rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.slot-paytable th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.slot-paytable td {
  color: var(--text-secondary);
}

.slot-paytable td:first-child {
  text-align: left;
}

.slot-paytable-symbol {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.slot-paytable-symbol svg,
.slot-paytable-symbol img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}

.slot-paytable .multiplier-high {
  color: var(--accent-cyan);
  font-weight: 700;
}

.slot-paytable .multiplier-mid {
  color: var(--accent-purple);
  font-weight: 600;
}

.slot-rules-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.6;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.slot-rules-meta a {
  color: var(--accent-purple);
}

/* CSS variables for slot sizing */
.slot-section {
  --slot-symbol-h: 56px;
}

@media (min-width: 480px) {
  .slot-section {
    --slot-symbol-h: 64px;
  }
}

@media (min-width: 992px) {
  .slot-section {
    --slot-symbol-h: 72px;
  }

  .slot-layout {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 2.5rem;
  }
}

@media (max-width: 479px) {
  .slot-stats {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1024px) {
  .slot-machine {
    padding: 1.75rem;
  }
}
