/* 5 Lions Megaways - Minimal Functional Styles */

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  color: #fff;
}

.game-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Hidden utility class */
.hidden {
  display: none !important;
}

/* Header */
.game-header {
  text-align: center;
  margin-bottom: 20px;
}

.game-header h1 {
  font-size: 2.5rem;
  color: #ffd700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  margin-bottom: 10px;
}

.player-info {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 0.9rem;
  color: #ccc;
}

/* Info Bar */
.info-bar {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 20px;
  background: rgba(0, 0, 0, 0.3);
  padding: 15px;
  border-radius: 10px;
}

.info-bar > div {
  text-align: center;
}

.info-bar .label {
  display: block;
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
}

.info-bar .value {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
  color: #ffd700;
}

#win.value {
  color: #00ff00;
}

/* Reel Container */
.reel-container {
  position: relative;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 20px;
}

.reel-grid {
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: flex-end; /* Align reels to bottom like real Megaways */
}

.reel {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 80px;
  min-height: 420px; /* Fixed height for all reels */
  justify-content: flex-end; /* Stack symbols from bottom */
}

.symbol {
  width: 80px;
  height: 60px; /* Default height, will be overridden by JS */
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

/* Symbol Colors */
.symbol.WD { background: linear-gradient(135deg, #ffd700, #ff8c00); color: #000; border-color: #ffd700; }
.symbol.BO { background: linear-gradient(135deg, #9400d3, #4b0082); color: #fff; border-color: #9400d3; }
.symbol.H1 { background: linear-gradient(135deg, #dc143c, #8b0000); color: #fff; }
.symbol.H2 { background: linear-gradient(135deg, #ff4500, #ff6347); color: #fff; }
.symbol.H3 { background: linear-gradient(135deg, #32cd32, #228b22); color: #fff; }
.symbol.H4 { background: linear-gradient(135deg, #1e90ff, #4169e1); color: #fff; }
.symbol.H5 { background: linear-gradient(135deg, #20b2aa, #008b8b); color: #fff; }
.symbol.L1 { background: #444; color: #ffd700; }
.symbol.L2 { background: #444; color: #c0c0c0; }
.symbol.L3 { background: #333; color: #cd853f; }
.symbol.L4 { background: #333; color: #87ceeb; }
.symbol.L5 { background: #333; color: #dda0dd; }

.symbol.winning {
  animation: pulse 0.5s ease-in-out infinite;
  box-shadow: 0 0 20px #ffd700;
}

.symbol.wild-multiplier {
  animation: wildPulse 0.4s ease-in-out infinite;
  box-shadow: 0 0 30px #ff8c00, 0 0 50px #ffd700;
  border: 3px solid #ffd700;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes wildPulse {
  0%, 100% { 
    transform: scale(1.05); 
    box-shadow: 0 0 30px #ff8c00, 0 0 50px #ffd700;
  }
  50% { 
    transform: scale(1.15); 
    box-shadow: 0 0 40px #ff8c00, 0 0 70px #ffd700;
  }
}

.symbol.exploding {
  animation: explode 0.3s ease-out forwards;
}

@keyframes explode {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0); opacity: 0; }
}

.symbol.falling {
  animation: fall 0.3s ease-in forwards;
}

@keyframes fall {
  0% { transform: translateY(-100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Message Overlay */
.message-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
}

.message-overlay.hidden {
  display: none;
}

.message-content {
  font-size: 2rem;
  font-weight: bold;
  color: #ffd700;
  text-align: center;
  animation: bounce 0.5s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.bet-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bet-controls label {
  font-weight: bold;
}

.bet-controls select {
  padding: 10px 15px;
  font-size: 1rem;
  border-radius: 5px;
  border: none;
  background: #2d3748;
  color: #fff;
  cursor: pointer;
}

.mode-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.mode-controls input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.action-buttons {
  display: flex;
  gap: 15px;
}

.spin-btn {
  padding: 15px 50px;
  font-size: 1.2rem;
  font-weight: bold;
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #000;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.spin-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(255, 215, 0, 0.5);
}

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

.buy-btn {
  padding: 15px 30px;
  font-size: 1rem;
  font-weight: bold;
  background: linear-gradient(135deg, #9400d3, #4b0082);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.buy-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(148, 0, 211, 0.5);
}

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

/* Auto Bet Button */
.auto-btn {
  padding: 15px 30px;
  font-size: 1rem;
  font-weight: bold;
  background: linear-gradient(135deg, #32cd32, #228b22);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.auto-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(50, 205, 50, 0.5);
}

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

.auto-btn.active {
  background: linear-gradient(135deg, #ff4444, #cc0000);
  animation: autoPulse 1s ease-in-out infinite;
}

@keyframes autoPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 68, 68, 0.5); }
  50% { box-shadow: 0 0 25px rgba(255, 68, 68, 0.8); }
}

/* Auto Bet Settings */
.auto-bet-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  align-items: center;
  background: rgba(50, 205, 50, 0.1);
  border: 1px solid rgba(50, 205, 50, 0.3);
  padding: 15px;
  border-radius: 10px;
  margin-top: 15px;
  width: 100%;
}

.auto-bet-settings.hidden {
  display: none;
}

.auto-setting {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auto-setting label {
  font-size: 0.9rem;
  color: #ccc;
  display: flex;
  align-items: center;
  gap: 5px;
}

.auto-setting select {
  padding: 8px 12px;
  font-size: 0.9rem;
  border-radius: 5px;
  border: none;
  background: #2d3748;
  color: #fff;
  cursor: pointer;
}

.auto-setting input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Auto Spin Counter */
.auto-spin-counter {
  background: linear-gradient(135deg, #32cd32, #228b22);
  color: #fff;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: bold;
  margin-left: 10px;
}

/* Status Log */

.status-log {
  background: rgba(0, 0, 0, 0.3);
  padding: 15px;
  border-radius: 10px;
}

.status-log h3 {
  margin-bottom: 10px;
  color: #888;
}

.log-container {
  max-height: 200px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.log-entry {
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.log-entry.win { color: #00ff00; }
.log-entry.trigger { color: #ffd700; }
.log-entry.error { color: #ff4444; }
.log-entry.info { color: #87ceeb; }

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  border: 3px solid #ffd700;
}

.modal-content h2 {
  color: #ffd700;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.modal-content p {
  margin-bottom: 15px;
  color: #ccc;
}

/* Free Spin Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.option-btn {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid #444;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #fff;
}

.option-btn:hover {
  border-color: #ffd700;
  transform: scale(1.05);
}

.option-btn .spins {
  font-size: 1.2rem;
  font-weight: bold;
  color: #ffd700;
}

.option-btn .multipliers {
  font-size: 0.9rem;
  color: #00ff00;
}

.option-btn .volatility {
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
}

.option-btn.mystery {
  background: linear-gradient(135deg, rgba(148, 0, 211, 0.3), rgba(75, 0, 130, 0.3));
  border-color: #9400d3;
}

/* Win Celebration */
.win-celebration {
  background: linear-gradient(135deg, #1a1a2e, #0f3460);
}

.win-amount {
  font-size: 3rem;
  font-weight: bold;
  color: #00ff00;
  margin: 20px 0;
  text-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

.win-multiplier {
  font-size: 1.5rem;
  color: #ffd700;
  margin-bottom: 20px;
}

.close-btn {
  padding: 15px 40px;
  font-size: 1.1rem;
  font-weight: bold;
  background: linear-gradient(135deg, #00ff00, #32cd32);
  color: #000;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.close-btn:hover {
  transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
  .game-header h1 {
    font-size: 1.5rem;
  }

  .info-bar {
    gap: 20px;
  }

  .info-bar .value {
    font-size: 1.2rem;
  }

  .symbol {
    width: 50px;
    height: 40px;
    font-size: 0.9rem;
  }

  .reel {
    min-width: 50px;
  }

  .controls {
    flex-direction: column;
  }

  .action-buttons {
    flex-direction: column;
    width: 100%;
  }

  .spin-btn, .buy-btn {
    width: 100%;
  }

  /* History Tab Responsive */
  .game-tabs {
    flex-wrap: wrap;
  }

  .tab-btn {
    padding: 8px 15px;
    font-size: 0.9rem;
  }

  .history-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .history-table {
    font-size: 0.8rem;
  }

  .history-table th,
  .history-table td {
    padding: 8px 10px;
  }

  .round-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .history-detail-modal {
    max-height: 95vh;
  }

  .free-spin-summary {
    flex-direction: column;
    gap: 8px;
  }
}

/* Resume Indicator */
.resume-indicator {
  background: linear-gradient(135deg, #4169e1, #1e90ff);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 10px;
  font-weight: bold;
  animation: resumePulse 1.5s ease-in-out infinite;
}

.resume-indicator.hidden {
  display: none;
}

@keyframes resumePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Tab Navigation */
.game-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

.tab-btn {
  padding: 10px 25px;
  font-size: 1rem;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.1);
  color: #ccc;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.tab-btn.active {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #000;
  border-color: #ffd700;
}

/* History Tab */
.history-tab {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 15px;
  padding: 20px;
  margin-top: 20px;
}

.history-tab.hidden {
  display: none;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.history-header h2 {
  color: #ffd700;
  margin: 0;
}

.refresh-btn {
  padding: 8px 16px;
  font-size: 0.9rem;
  background: linear-gradient(135deg, #4169e1, #1e90ff);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.refresh-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 10px rgba(65, 105, 225, 0.5);
}

/* History Table */
.history-table-container {
  overflow-x: auto;
  margin-bottom: 15px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.history-table th,
.history-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-table th {
  background: rgba(255, 215, 0, 0.1);
  color: #ffd700;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

.history-table tbody tr {
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.1);
}

.history-table .win-amount {
  color: #00ff00;
  font-weight: bold;
}

.history-table .win-amount.zero {
  color: #888;
}

.history-table .multiplier {
  color: #ffd700;
}

.history-table .mode-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
}

.mode-badge.base {
  background: rgba(100, 100, 100, 0.5);
  color: #ccc;
}

.mode-badge.ante {
  background: rgba(255, 165, 0, 0.3);
  color: #ffa500;
}

.mode-badge.buy {
  background: rgba(148, 0, 211, 0.3);
  color: #da70d6;
}

.has-freespins {
  color: #ffd700;
}

/* Pagination */
.history-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 15px;
}

.pagination-btn {
  padding: 8px 16px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

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

#pageInfo {
  color: #888;
  font-size: 0.9rem;
}

/* Loading & Empty States */
.history-loading,
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #888;
}

.history-loading.hidden,
.history-empty.hidden {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #ffd700;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* History Detail Modal */
.history-detail-modal {
  max-width: 800px;
  width: 95%;
  max-height: 85vh;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
  margin: 0;
}

.close-modal-btn {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-modal-btn:hover {
  background: rgba(255, 68, 68, 0.5);
}

/* Round Summary */
.round-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
}

.summary-item {
  text-align: center;
}

.summary-label {
  display: block;
  font-size: 0.75rem;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.summary-value {
  display: block;
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
}

.summary-item.highlight .summary-value {
  color: #00ff00;
  font-size: 1.2rem;
}

/* Play by Play */
.play-by-play-container h3 {
  color: #ffd700;
  margin-bottom: 15px;
  font-size: 1rem;
}

.play-by-play-content {
  max-height: 300px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 10px;
}

.play-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
  line-height: 1.4;
}

.play-event:last-child {
  border-bottom: none;
}

.event-index {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  font-size: 0.7rem;
  color: #888;
}

.event-description {
  flex: 1;
  color: #ccc;
}

.play-event.win .event-description {
  color: #00ff00;
}

.play-event.trigger .event-description {
  color: #ffd700;
  font-weight: bold;
}

.play-event.reveal .event-description {
  color: #87ceeb;
}

.play-event.tumble .event-description {
  color: #da70d6;
}

.play-event.freespin .event-description {
  color: #ff69b4;
}

.play-event.final .event-description {
  color: #00ff00;
  font-weight: bold;
  font-size: 1rem;
}

/* Free Spins Detail */
.free-spins-detail {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.free-spins-detail.hidden {
  display: none;
}

.free-spins-detail h3 {
  color: #ffd700;
  margin-bottom: 15px;
}

.free-spin-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
  padding: 10px 15px;
  background: rgba(148, 0, 211, 0.2);
  border-radius: 8px;
  font-size: 0.9rem;
}

.free-spin-summary span {
  color: #da70d6;
}

.free-spins-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.free-spin-item {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  overflow: hidden;
}

.free-spin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: rgba(148, 0, 211, 0.2);
  cursor: pointer;
  transition: background 0.2s ease;
}

.free-spin-header:hover {
  background: rgba(148, 0, 211, 0.3);
}

.free-spin-header .spin-number {
  font-weight: bold;
  color: #ffd700;
}

.free-spin-header .spin-win {
  color: #00ff00;
}

.free-spin-header .expand-icon {
  color: #888;
  transition: transform 0.2s ease;
}

.free-spin-item.expanded .expand-icon {
  transform: rotate(180deg);
}

.free-spin-tumbles {
  display: none;
  padding: 10px 15px;
}

.free-spin-item.expanded .free-spin-tumbles {
  display: block;
}

.tumble-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.tumble-item:last-child {
  border-bottom: none;
}

.tumble-number {
  color: #888;
}

.tumble-wins {
  color: #ccc;
}

.tumble-win {
  color: #00ff00;
  font-weight: bold;
}

