/* Keno Game Styles */

.keno-game {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
  color: #fff;
  padding: 10px;
  height: 100%;
  max-height: 100%;
  width: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Desktop - limit width */
@media (min-width: 768px) {
  .keno-game {
    max-width: 500px;
    margin: 0 auto;
  }
}

.keno-game.fullscreen-mode {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  z-index: 9999;
  padding: 16px;
  height: 100vh;
  height: 100dvh;
}

/* Header */
.keno-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.keno-header-left,
.keno-header-right {
  display: flex;
  gap: 4px;
}

.keno-icon-btn {
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  padding: 0;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keno-icon-btn svg {
  width: 18px;
  height: 18px;
}

.keno-icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.keno-icon-btn.close-btn {
  color: #ff6b6b;
}

.keno-icon-btn.close-btn:hover {
  background: rgba(255, 100, 100, 0.2);
}

/* Hide fullscreen toggle on mobile */
.keno-icon-btn.fullscreen-toggle {
  display: none;
}

@media (min-width: 768px) {
  .keno-icon-btn.fullscreen-toggle {
    display: flex;
  }
}

.keno-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  padding: 0px 10px;
  border-radius: 6px;
  font-weight: 600;
  min-width: 80px;
  height: 30px;
  transition: all 0.4s ease, width 0.4s ease, min-width 0.4s ease, background 0.4s ease;
}

.keno-timer.drawing {
  background: rgba(0, 50, 100, 0.6);
  min-width: 150px;
  width: 150px;
}

.keno-timer.winner {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  min-width: 80px;
  animation: winnerPulse 0.5s ease-out;
}

@keyframes winnerPulse {
  0% { transform: scale(0.95); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.timer-icon {
  display: flex;
  align-items: center;
  margin-right: 4px;
}

.timer-icon svg {
  width: 14px;
  height: 14px;
}

.timer-value {
  font-size: 13px;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.timer-value.urgent {
  color: #ff4444;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Timer balls during draw */
.timer-balls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 6px;
}

.timer-balls-list {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1 1;
}

.timer-ball {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* White 3D ball effect */
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #e8e8e8 40%, #c0c0c0 70%, #a0a0a0 100%);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: #333;
  animation: ballAppear 0.5s ease-out;
  flex-shrink: 0;
}

/* Newest ball - gold (first because list is reversed) */
.timer-ball:first-child {
  background: radial-gradient(circle at 30% 30%, #fff9c4 0%, #ffd700 40%, #ff8c00 80%, #e65100 100%);
  color: #000;
}

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

.timer-ball-count {
  font-size: 11px;
  color: #fff;
  opacity: 0.9;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 32px;
  text-align: right;
}

/* Timer win display */
.timer-win-label {
  font-size: 11px;
  font-weight: 700;
  color: #000;
  text-transform: uppercase;
}

.timer-win-amount {
  font-size: 16px;
  font-weight: 700;
  color: #000;
}

.keno-header-right {
  display: flex;
  gap: 8px;
}

/* Old win display - removed, now using timer area */

/* Number Grid */
.keno-grid-container {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 6px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.keno-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-gap: 3px;
  gap: 3px;
}

.keno-number {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2a3e;
  border: 1px solid #3a3a4e;
  border-radius: 6px;
  color: #888;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-user-select: none;
          user-select: none;
  max-width: 38px;
  max-height: 38px;
}

@media (min-width: 400px) {
  .keno-number {
    font-size: 12px;
  }
}

.keno-number:hover:not(:disabled) {
  background: #3a3a4e;
  border-color: #4a4a5e;
}

.keno-number.selected {
  background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%) !important;
  border-color: #ffd700 !important;
  color: #000 !important;
  font-weight: 700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.keno-number.in-card:not(.selected) {
  background: #4a4a6e;
  border-color: #6a6a8e;
  color: #fff;
}

.keno-number.drawn {
  background: #8b0000;
  border-color: #aa0000;
  color: #fff;
}

.keno-number.match {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%) !important;
  border-color: #ffd700 !important;
  color: #000 !important;
  font-weight: 700 !important;
  animation: matchPop 0.3s ease-out;
}

@keyframes matchPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.keno-number.just-drawn {
  animation: ballDrop 0.25s ease-out;
}

@keyframes ballDrop {
  0% { transform: scale(0) translateY(-20px); opacity: 0; }
  60% { transform: scale(1.1) translateY(0); }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.keno-number:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

/* Quick Pick Row - scrollable numbers + fixed buttons */
.keno-quickpick-row {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-shrink: 0;
  align-items: center;
}

.quickpick-numbers {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  flex: 1 1;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.quickpick-numbers::-webkit-scrollbar {
  display: none;
}

.quickpick-btn {
  min-width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2a3e;
  border: 1px solid #3a3a4e;
  border-radius: 5px;
  color: #888;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.quickpick-fixed-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.shuffle-btn,
.clear-btn {
  width: 32px;
  height: 26px;
  min-width: 32px;
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
  box-sizing: border-box;
}

.shuffle-btn {
  background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
  color: #000;
}

.clear-btn {
  background: rgba(255, 100, 100, 0.2);
  color: #ff6b6b;
}

.shuffle-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

.clear-btn:hover:not(:disabled) {
  background: rgba(255, 100, 100, 0.3);
}

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

.quickpick-btn:hover:not(:disabled) {
  background: #3a3a4e;
  border-color: #4a4a5e;
  color: #fff;
}

.quickpick-btn.active {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  border-color: #ffd700;
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* Highlight when manually selected count matches this number */
.quickpick-btn.selected-count:not(.active) {
  background: rgba(0, 200, 83, 0.25);
  border-color: #00c853;
  color: #00c853;
  font-weight: 700;
  box-shadow: 0 0 8px rgba(0, 200, 83, 0.5);
}

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

/* Bet Row */
.keno-bet-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
  padding-top: 4px;
}

.bet-selector {
  flex: 1 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.bet-selector:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

.bet-selector:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bet-selector .bet-label {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
}

.bet-selector .bet-value {
  font-size: 14px;
  font-weight: 700;
  color: #ffd700;
}

.add-card-btn {
  flex: 2 1;
  background: linear-gradient(135deg, #00aa00 0%, #008800 100%);
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.add-card-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: scale(1.02);
}

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

/* Cards Section */
.keno-cards-section {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 6px;
  flex: 1 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cards-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.cards-total {
  color: #ffd700;
}

.cards-list {
  flex: 1 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.no-cards {
  text-align: center;
  color: #666;
  padding: 20px;
  font-size: 13px;
}

.keno-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 5px 8px;
  margin-bottom: 4px;
  min-height: 28px;
  gap: 8px;
}

.keno-card.won {
  border-color: #00aa00;
  background: rgba(0, 170, 0, 0.1);
}

.keno-card.lost {
  border-color: #aa0000;
  background: rgba(170, 0, 0, 0.1);
  opacity: 0.7;
}

.card-info {
  display: flex;
  align-items: center;
  flex: 1 1;
  min-width: 0;
  line-height: 1;
}

.card-numbers {
  font-size: 11px;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}

.card-numbers .number-match {
  color: #ffd700;
  font-weight: 700;
}

.card-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.card-matches {
  font-size: 11px;
  color: #888;
  min-width: 28px;
  text-align: center;
}

.card-win {
  font-size: 12px;
  font-weight: 700;
  color: #00ff00;
}

.card-bet {
  font-size: 11px;
  font-weight: 600;
  color: #ffd700;
  min-width: 36px;
  text-align: right;
}

.remove-card-btn {
  background: none;
  border: none;
  padding: 0;
  color: #ff6666;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.remove-card-btn:hover {
  color: #ff4444;
}

/* History Popup */
.history-popup {
  max-width: 400px;
}

.history-popup-content {
  padding-top: 8px;
}

.history-popup .repeat-all-btn {
  width: 100%;
  margin-bottom: 12px;
  justify-content: center;
}

.repeat-all-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.repeat-all-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

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

.history-list {
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.no-history {
  text-align: center;
  color: #666;
  padding: 16px;
  font-size: 13px;
}

/* History round item */
.history-round-item {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-round-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.history-round-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.history-round {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  flex: 1 1;
}

.history-total {
  font-size: 12px;
  color: #888;
}

.history-total.positive {
  color: #00ff00;
  font-weight: 600;
}

.repeat-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

/* History cards list */
.history-cards-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.history-card.won {
  border-color: rgba(0, 255, 0, 0.3);
  background: rgba(0, 255, 0, 0.05);
}

.history-card.lost {
  opacity: 0.7;
}

.history-card-numbers {
  font-size: 10px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1;
  min-width: 0;
}

.history-card-numbers .match {
  color: #ffd700;
  font-weight: 600;
}

.history-card-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.history-card-matches {
  font-size: 10px;
  color: #666;
  min-width: 24px;
  text-align: center;
}

.history-card-win {
  font-size: 11px;
  font-weight: 600;
  color: #00ff00;
}

.history-card-bet {
  font-size: 10px;
  color: #ffd700;
  min-width: 32px;
  text-align: right;
}

.repeat-card-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 4px;
  padding: 4px 6px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

/* Popup Overlay */
.keno-popup-overlay {
  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: 10000;
  padding: 20px;
}

.keno-popup {
  background: #1a1a2e;
  border-radius: 16px;
  padding: 20px;
  max-width: 350px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

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

.popup-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.popup-close {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.popup-close:hover {
  color: #fff;
}

/* Bet Popup */
.bet-popup {
  max-width: 380px;
}

.bet-popup .popup-title {
  margin-bottom: 16px;
}

.bet-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-gap: 6px;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.bet-option {
  background: #2a2a3e;
  border: 2px solid #3a3a4e;
  border-radius: 6px;
  padding: 8px 4px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.bet-option:hover {
  background: #3a3a4e;
  border-color: #4a4a5e;
}

.bet-option.active {
  background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
  border-color: #ffd700;
  color: #000;
}

/* Paytable Popup */
.paytable-popup .popup-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 12px;
}

.paytable-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.paytable-tab {
  flex: 1 1;
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2a3e;
  border: 1px solid #3a3a4e;
  border-radius: 6px;
  color: #888;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.paytable-tab:hover {
  background: #3a3a4e;
  color: #fff;
}

.paytable-tab.active {
  background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
  border-color: #4a90d9;
  color: #fff;
}

.paytable-content h3 {
  text-align: center;
  font-size: 16px;
  margin-bottom: 12px;
  color: #ffd700;
}

.paytable-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.paytable-table th,
.paytable-table td {
  padding: 10px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.paytable-table th {
  color: #888;
  font-size: 12px;
  text-transform: uppercase;
}

.paytable-table td {
  font-size: 14px;
}

.paytable-table tr.jackpot td {
  color: #ffd700;
  font-weight: 700;
  font-size: 16px;
}

.paytable-info {
  text-align: center;
  color: #666;
  font-size: 12px;
}

.paytable-info p {
  margin: 4px 0;
}


/* Scrollbar styling */
.keno-game ::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.keno-game ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
}

.keno-game ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.keno-game ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Mobile optimizations */
@media (max-width: 360px) {
  .keno-game {
    padding: 6px;
  }

  .keno-number {
    font-size: 10px;
    border-radius: 4px;
  }

  .quickpick-btn {
    min-width: 22px;
    height: 26px;
    font-size: 10px;
  }

  .shuffle-btn {
    min-width: 28px;
  }

  .bet-selector .bet-value {
    font-size: 14px;
  }

  .add-card-btn {
    font-size: 13px;
    padding: 8px 12px;
  }
}

/* Fullscreen mode - limit button sizes on large screens */
.keno-game.fullscreen-mode .keno-grid-container {
  max-width: 550px;
  margin-left: auto;
  margin-right: auto;
}

.keno-game.fullscreen-mode .keno-number {
  max-width: 42px;
  max-height: 42px;
  font-size: 14px;
}

.keno-game.fullscreen-mode .keno-quickpick-row {
  max-width: 550px;
  margin-left: auto;
  margin-right: auto;
}

.keno-game.fullscreen-mode .keno-bet-row {
  max-width: 550px;
  margin-left: auto;
  margin-right: auto;
}

.keno-game.fullscreen-mode .keno-cards-section {
  max-width: 550px;
  margin-left: auto;
  margin-right: auto;
}

/* Touch devices - disable sticky hover */
@media (hover: none) {
  .keno-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .keno-icon-btn.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .keno-number:hover:not(:disabled):not(.selected):not(.in-card) {
    background: #2a2a3e;
    border-color: #3a3a4e;
  }

  .keno-number.selected:hover {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  }

  .quickpick-btn:hover:not(:disabled):not(.active) {
    background: #2a2a3e;
    border-color: #3a3a4e;
  }

  .quickpick-btn.active:hover {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    border-color: #ffd700;
  }

  .shuffle-btn:hover:not(:disabled),
  .add-card-btn:hover:not(:disabled),
  .repeat-all-btn:hover:not(:disabled) {
    filter: none;
    transform: none;
  }

  .bet-selector:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
  }

  .clear-btn:hover:not(:disabled) {
    background: transparent;
  }

  .repeat-btn:hover:not(:disabled),
  .repeat-card-btn:hover:not(:disabled) {
    background: transparent;
  }

  .bet-option:hover {
    background: #2a2a3e;
    border-color: #3a3a4e;
  }

  .paytable-tab:hover {
    background: transparent;
  }
}

