/* =================== GAMES LAYOUT =================== */
:root {
  --felt-green: #1a4a2a;
  --felt-dark: #122e1a;
  --felt-light: #226035;
  --card-bg: #faf5e4;
  --card-red: #c0392b;
  --card-black: #1a1a2e;
  --reel-bg: #1a0a05;
  --slot-gold: #c9a84c;
}

.game-page {
  padding-top: var(--nav-height);
  min-height: 100vh;
  background: var(--bg-primary);
}

/* =================== GAME HEADER =================== */
.game-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 16px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.game-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
}

.game-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.game-back-btn:hover { color: var(--gold-primary); }

.game-header-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.game-wallet {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.game-wallet-icon { font-size: 20px; }

.game-wallet-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.game-wallet-amount {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold-primary);
}

/* =================== GAME AREA =================== */
.game-area {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 40px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.game-main { }

.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.game-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-panel-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.game-panel-body { padding: 20px; }

/* =================== STATUS MESSAGE =================== */
.game-status {
  text-align: center;
  padding: 16px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  color: var(--text-secondary);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  margin-bottom: 20px;
}

.game-status.win {
  border-color: var(--gold-primary);
  background: rgba(201, 168, 76, 0.08);
  color: var(--gold-light);
  font-weight: 600;
  font-size: 1.1rem;
  box-shadow: 0 0 20px rgba(201, 168, 76, 0.15);
}

.game-status.lose {
  border-color: var(--red-accent);
  background: rgba(168, 48, 48, 0.08);
  color: var(--red-light);
}

/* =================== POKER GAME =================== */
.poker-table {
  background: radial-gradient(ellipse at center, var(--felt-light) 0%, var(--felt-green) 40%, var(--felt-dark) 100%);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  border: 3px solid #2a5a1a;
  box-shadow: inset 0 2px 20px rgba(0,0,0,0.4), 0 0 40px rgba(0,0,0,0.5);
  position: relative;
  min-height: 340px;
}

.poker-table::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: calc(var(--radius-xl) - 2px);
  border: 1px solid rgba(255,255,255,0.06);
  pointer-events: none;
}

.poker-dealer-area {
  text-align: center;
  margin-bottom: 32px;
}

.poker-dealer-label {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.cards-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* =================== PLAYING CARDS =================== */
.playing-card {
  width: 72px;
  height: 100px;
  background: var(--card-bg);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: all 0.2s ease;
  user-select: none;
  transform-style: preserve-3d;
  perspective: 600px;
}

.playing-card.held {
  transform: translateY(-12px);
  box-shadow: 0 8px 20px rgba(201, 168, 76, 0.5), 0 0 0 2px var(--gold-primary);
}

.playing-card .card-rank-top {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.playing-card .card-suit-center {
  font-size: 2rem;
  line-height: 1;
}

.playing-card .card-rank-bottom {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  transform: rotate(180deg);
}

.playing-card.red .card-rank-top,
.playing-card.red .card-rank-bottom { color: var(--card-red); }

.playing-card.black .card-rank-top,
.playing-card.black .card-rank-bottom { color: var(--card-black); }

.playing-card.face-down {
  background: linear-gradient(135deg, #1a3a6a 0%, #0d2040 50%, #1a3a6a 100%);
  cursor: default;
}

.playing-card.face-down .card-pattern {
  width: 52px;
  height: 76px;
  border-radius: 4px;
  border: 1px solid rgba(201,168,76,0.3);
  background: repeating-linear-gradient(
    45deg,
    rgba(201,168,76,0.08) 0px,
    rgba(201,168,76,0.08) 2px,
    transparent 2px,
    transparent 8px
  );
}

.held-label {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--gold-primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* =================== POKER CONTROLS =================== */
.poker-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.bet-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bet-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bet-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.bet-btn {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bet-btn:hover { background: var(--gold-faint); color: var(--gold-primary); }

.bet-amount {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 48px;
  text-align: center;
}

/* =================== PAYOUT TABLE =================== */
.payout-table { width: 100%; border-collapse: collapse; }

.payout-table tr { transition: background var(--transition); }
.payout-table tr:hover { background: var(--gold-faint); }

.payout-table td {
  padding: 8px 4px;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border-subtle);
}

.payout-table td:first-child { color: var(--text-secondary); }
.payout-table td:last-child { color: var(--gold-primary); font-weight: 600; text-align: right; }

.payout-table tr.highlight td { color: var(--gold-light) !important; background: var(--gold-faint); }

/* =================== SLOT MACHINE =================== */
.slot-machine {
  background: linear-gradient(135deg, #1a0a05, #2a1205);
  border-radius: var(--radius-xl);
  padding: 32px;
  border: 3px solid #3a1a05;
  box-shadow: inset 0 2px 20px rgba(0,0,0,0.6), 0 0 40px rgba(0,0,0,0.5);
  text-align: center;
}

.slot-machine-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--gold-primary);
  text-transform: uppercase;
  margin-bottom: 24px;
  text-shadow: 0 0 20px rgba(201,168,76,0.5);
}

.slot-reels-container {
  background: #0a0604;
  border-radius: var(--radius-md);
  padding: 16px;
  border: 2px solid #2a1a08;
  margin-bottom: 24px;
  position: relative;
  box-shadow: inset 0 4px 20px rgba(0,0,0,0.8);
}

.slot-reels {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.slot-reel-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #080402;
  box-shadow: inset 0 2px 12px rgba(0,0,0,0.8);
}

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

.slot-reel-wrapper::before {
  top: 0;
  background: linear-gradient(to bottom, #080402, transparent);
}

.slot-reel-wrapper::after {
  bottom: 0;
  background: linear-gradient(to top, #080402, transparent);
}

.slot-reel {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0s linear;
}

.slot-symbol {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  line-height: 1;
  flex-shrink: 0;
}

.win-line {
  position: absolute;
  top: 50%;
  left: -4px;
  right: -4px;
  height: 2px;
  background: transparent;
  transform: translateY(-50%);
  z-index: 3;
  pointer-events: none;
  transition: background 0.3s ease;
}

.win-line.active {
  background: linear-gradient(to right, transparent, var(--gold-primary), var(--gold-primary), transparent);
  box-shadow: 0 0 8px var(--gold-primary);
}

.slot-reel-sep {
  width: 2px;
  height: 60px;
  background: linear-gradient(to bottom, transparent, rgba(201,168,76,0.3), transparent);
}

/* =================== ROULETTE =================== */
.roulette-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.roulette-wheel-wrapper {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 0 auto;
}

#roulette-canvas {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  box-shadow: 0 0 0 8px #2a1a05, 0 0 0 12px var(--gold-dark), 0 8px 40px rgba(0,0,0,0.6);
  display: block;
}

.roulette-ball-marker {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  background: radial-gradient(circle, #fff, #ccc);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.3s;
}

.roulette-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 20px solid var(--gold-primary);
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.roulette-betting-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.roulette-bet-row {
  display: flex;
  gap: 8px;
}

.roulette-bet-btn {
  flex: 1;
  padding: 12px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.roulette-bet-btn:hover { border-color: var(--border-hover); color: var(--gold-primary); background: var(--gold-faint); }

.roulette-bet-btn.red-btn { color: #e05555; border-color: rgba(224,85,85,0.3); }
.roulette-bet-btn.red-btn:hover { background: rgba(224,85,85,0.1); border-color: rgba(224,85,85,0.6); }
.roulette-bet-btn.black-btn { color: var(--text-secondary); }
.roulette-bet-btn.green-btn { color: var(--green-light); border-color: rgba(56,160,94,0.3); }
.roulette-bet-btn.green-btn:hover { background: rgba(56,160,94,0.1); border-color: rgba(56,160,94,0.5); }

.roulette-bet-btn.selected {
  border-color: var(--gold-primary);
  background: var(--gold-faint);
  color: var(--gold-light);
}

.current-bet-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
}

.current-bet-label { color: var(--text-muted); }
.current-bet-value { font-weight: 600; color: var(--gold-primary); }

/* =================== BET CHIPS =================== */
.chip-rack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 16px;
}

.chip {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 3px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  border: 3px solid rgba(255,255,255,0.15);
  user-select: none;
}

.chip:hover { transform: translateY(-3px) scale(1.05); }
.chip:active { transform: translateY(0) scale(0.98); }

.chip-10 { background: radial-gradient(circle, #6ba3e0, #3a78c9); color: #fff; border-color: #5a8fd4; }
.chip-25 { background: radial-gradient(circle, #6acf7c, #3a9e52); color: #fff; border-color: #4ab862; }
.chip-50 { background: radial-gradient(circle, #cf6a6a, #9e3a3a); color: #fff; border-color: #b84a4a; }
.chip-100 { background: radial-gradient(circle, #e8c96a, #c9a84c); color: #1a1a1a; border-color: #d4b455; }
.chip-250 { background: radial-gradient(circle, #b06ad4, #7a3a9e); color: #fff; border-color: #9250ba; }

/* =================== WIN ANIMATION =================== */
@keyframes winPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

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

.win-animation { animation: winPulse 0.5s ease 3; }
.coin-drop { animation: coinDrop 0.4s ease; }

/* =================== HISTORY LOG =================== */
.history-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.history-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  background: var(--bg-surface);
}

.history-entry.win-entry { background: rgba(201,168,76,0.08); }
.history-entry.lose-entry { background: rgba(168,48,48,0.06); }

.history-entry-result { font-weight: 600; }
.history-entry-result.win { color: var(--gold-primary); }
.history-entry-result.lose { color: var(--red-light); }
.history-entry-round { color: var(--text-muted); }

/* =================== RESPONSIVE GAME =================== */
@media (max-width: 900px) {
  .game-area {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  .game-header { padding: 12px 20px; }
  .roulette-wheel-wrapper { width: 240px; height: 240px; }
  #roulette-canvas { width: 240px; height: 240px; }
}

@media (max-width: 600px) {
  .poker-table { padding: 20px 16px; }
  .playing-card { width: 58px; height: 82px; }
  .playing-card .card-suit-center { font-size: 1.6rem; }
  .playing-card .card-rank-top, .playing-card .card-rank-bottom { font-size: 0.9rem; }
  .cards-row { gap: 8px; }
  .slot-reel-wrapper { width: 75px; height: 75px; }
  .slot-symbol { width: 75px; height: 75px; font-size: 36px; }
}
