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

body {
  background: #1a1a2e;
  color: #eee;
  font-family: 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  width: 900px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #16213e;
  border-radius: 10px;
}

header h1 {
  font-size: 1.4rem;
  letter-spacing: 2px;
  color: #e94560;
}

#hud {
  display: flex;
  gap: 24px;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-item .label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
}

.hud-item span:last-child {
  font-size: 1.1rem;
  font-weight: 600;
  color: #f0db4f;
}

/* Bonus bar */
#bonus-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #0f3460;
  border-radius: 8px;
  border: 1px solid #e94560;
  font-weight: 600;
}

#bonus-bar.hidden { display: none; }

#bonus-label {
  color: #f0db4f;
  font-size: 0.9rem;
  letter-spacing: 2px;
}

#spins-remaining { color: #eee; }
#session-win { color: #2ecc71; }

/* Super bonus banner */
#bonus-bar.super {
  background: #3d0060;
  border-color: #b44bff;
}

#bonus-bar.super #bonus-label { color: #b44bff; }

/* Reels */
#reels-container {
  background: #0d0d1a;
  border-radius: 10px;
  padding: 16px;
  min-height: 400px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden; /* clip symbols falling in from above */
}

#reels {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.reel {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.7rem;
  border: 2px solid rgba(255,255,255,0.08);
  transition: opacity 0.15s;
  flex-shrink: 0;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  color: #fff;
}

.cell.winning {
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255,255,255,0.6);
  z-index: 1;
}

.cell.cleared {
  background: transparent !important;
  border-color: transparent;
  box-shadow: none;
}

/* Footer */
footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

#controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 1px;
  transition: opacity 0.15s, transform 0.1s;
}

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

.btn:not(:disabled):active { transform: scale(0.97); }

.btn-primary  { background: #e94560; color: #fff; }
.btn-bonus    { background: #f0db4f; color: #1a1a2e; }
.btn-super    { background: #b44bff; color: #fff; }
.btn-secondary { background: #444; color: #eee; }

#message {
  min-height: 22px;
  font-size: 0.85rem;
  color: #f0db4f;
  letter-spacing: 1px;
  text-align: center;
}

.win-breakdown {
  font-size: 0.75rem;
  color: #aaa;
  letter-spacing: 0;
}

/* Fall-in animation for new symbols */
@keyframes fall-in {
  from { transform: translateY(-320px); opacity: 0; }
  to   { transform: translateY(0);      opacity: 1; }
}
.cell.falling {
  animation: fall-in 0.28s ease-out both;
}

/* Mult symbol collect — pops up then holds a gold glow until swept by renderGrid */
@keyframes mult-collect {
  0%   { transform: scale(1);    box-shadow: none;                                               border-color: rgba(255,255,255,0.08); }
  12%  { transform: scale(1.6);  box-shadow: 0 0 24px 9px gold, 0 0 48px 8px rgba(255,215,0,0.5); border-color: gold; }
  24%  { transform: scale(1.05); box-shadow: 0 0 12px 5px gold;                                  border-color: gold; }
  100% { transform: scale(1.05); box-shadow: 0 0 10px 4px gold;                                  border-color: gold; }
}
.cell.mult-collect {
  animation: mult-collect 1.4s ease-out forwards;  /* forwards holds the glow until DOM is replaced */
  position: relative;
  z-index: 10;
}

/* Center multiplier overlay */
#mult-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: none;
}
#mult-overlay.hidden { display: none; }

/* Popup card */
.mult-popup {
  text-align: center;
  animation: mult-popup-enter 3.15s ease-out forwards;
}

@keyframes mult-popup-enter {
  0%   { opacity: 0; transform: scale(0.2) translateY(24px); }
  8%   { opacity: 1; transform: scale(1.22) translateY(0); }
  14%  { transform: scale(0.94); }
  20%  { transform: scale(1.06); }
  26%  { transform: scale(1);    opacity: 1; }
  78%  { opacity: 1; transform: scale(1); }
  88%  { opacity: 0.6; }
  100% { opacity: 0; transform: scale(0.9); }
}

.mult-popup-syms {
  font-size: 18px;
  letter-spacing: 8px;
  color: #ccc;
  margin-bottom: 6px;
  min-height: 24px;
}

.mult-popup-value {
  font-size: 72px;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 18px #ffd700, 0 0 40px rgba(255,215,0,0.45);
  line-height: 1;
  letter-spacing: 2px;
}

.mult-popup-label {
  font-size: 12px;
  color: #aaa;
  letter-spacing: 7px;
  text-transform: uppercase;
  margin-top: 10px;
}
