/**
 * @file games/chaos-crew-neon/game.css
 * @description Visual theme for "Chaos Crew Neon" adhering to KASINO SSOT design tokens.
 * Features dark dystopian obsidian slate backgrounds, aggressive neon highlights (Magenta, Cyan, Toxic Green),
 * cyber glitch scanlines, responsive canvas layout, side betting actions, and win celebration modals.
 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

:root {
  --bg-main: #07090E;
  --bg-surface: #0E121D;
  --bg-elevated: #151B2B;
  --bg-glass: rgba(14, 18, 29, 0.82);

  --neon-pink: #FF007F;
  --neon-magenta: #FF2E93;
  --neon-cyan: #00F5FF;
  --neon-cyan-dark: #00D9F5;
  --neon-green: #39FF14;
  --neon-gold: #F59E0B;
  --neon-purple: #8B5CF6;

  --neon-pink-glow: rgba(255, 0, 127, 0.5);
  --neon-cyan-glow: rgba(0, 245, 255, 0.5);
  --neon-green-glow: rgba(57, 255, 20, 0.5);

  --font-display: 'Outfit', sans-serif;
  --font-primary: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-main);
  font-family: var(--font-primary);
  color: #F8FAFC;
}

#game-stage-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 35%, #1D061A 0%, #0F0412 50%, #07090E 100%);
  overflow: hidden;
}

/* Cyber Grid Lines & CRT Scanline Overlay */
#game-stage-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 0, 127, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 1;
}

#game-stage-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  opacity: 0.35;
  z-index: 2;
}

/* ==========================================================================
   TOP BAR HUD
   ========================================================================== */

.game-top-bar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1.4rem;
  background: linear-gradient(180deg, rgba(14, 18, 29, 0.94) 0%, rgba(14, 18, 29, 0.5) 100%);
  border-bottom: 1px solid rgba(255, 0, 127, 0.25);
  backdrop-filter: blur(8px);
}

.game-logo-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #FFFFFF 0%, #FFB3DC 35%, #FF007F 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px var(--neon-pink-glow));
}

.game-badge-neon {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  color: #07090E;
  background: #39FF14;
  border-radius: 4px;
  box-shadow: 0 0 10px var(--neon-green-glow);
  letter-spacing: 0.05em;
}

.top-hud-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Global Multiplier Meter Pill */
.top-multiplier-meter {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  background: rgba(14, 18, 29, 0.85);
  border: 1px solid rgba(0, 245, 255, 0.4);
  border-radius: 20px;
  box-shadow: 0 0 14px rgba(0, 245, 255, 0.25);
  transition: all 0.25s ease;
}

.top-multiplier-meter.has-multiplier {
  border-color: #39FF14;
  box-shadow: 0 0 18px var(--neon-green-glow);
  animation: pulseNeonGlow 1.4s infinite alternate;
}

.multiplier-meter-label {
  font-family: var(--font-primary);
  font-size: 0.65rem;
  font-weight: 700;
  color: #94A3B8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.multiplier-meter-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  color: #00F5FF;
  text-shadow: 0 0 8px var(--neon-cyan-glow);
}

.top-multiplier-meter.has-multiplier .multiplier-meter-val {
  color: #39FF14;
  text-shadow: 0 0 10px var(--neon-green-glow);
}

/* Free Spins Counter Pill */
.free-spins-counter-pill {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  background: linear-gradient(135deg, rgba(255, 0, 127, 0.2) 0%, rgba(14, 18, 29, 0.9) 100%);
  border: 1px solid #FF007F;
  border-radius: 20px;
  box-shadow: 0 0 14px var(--neon-pink-glow);
  animation: pulseNeonPink 1.2s infinite alternate;
}

.free-spins-counter-pill.is-active {
  display: flex;
}

.fs-counter-title {
  font-family: var(--font-primary);
  font-size: 0.65rem;
  font-weight: 800;
  color: #FFB3DC;
  letter-spacing: 0.08em;
}

.fs-counter-val {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 800;
  color: #FFFFFF;
  text-shadow: 0 0 8px #FF007F;
}

/* ==========================================================================
   MAIN GAME AREA (SIDE ACTIONS + 5x5 CANVAS)
   ========================================================================== */

#game-main-area {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  overflow: hidden;
  z-index: 10;
}

/* Left Side Betting Actions (Desktop) */
.side-bet-actions {
  width: 220px;
  flex-shrink: 0;
  padding: 1rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: rgba(14, 18, 29, 0.45);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(4px);
  z-index: 15;
  overflow-y: auto;
}

.bet-action-card {
  position: relative;
  padding: 0.75rem 0.85rem;
  background: var(--bg-surface-elevated, #151B2B);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}

.bet-action-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 0, 127, 0.4);
}

.ante-bet-card {
  border-color: rgba(0, 245, 255, 0.25);
}

.ante-bet-card.is-active {
  border-color: #00F5FF;
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.35);
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.12) 0%, #151B2B 100%);
}

.ante-badge, .buy-badge {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  border-radius: 4px;
  margin-bottom: 0.35rem;
  letter-spacing: 0.05em;
}

.ante-badge {
  background: rgba(0, 245, 255, 0.2);
  color: #00F5FF;
  border: 1px solid rgba(0, 245, 255, 0.4);
}

.ante-title, .buy-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.1;
  margin-bottom: 0.2rem;
}

.ante-sub {
  font-size: 0.65rem;
  color: #94A3B8;
  margin-bottom: 0.5rem;
}

.ante-toggle-btn {
  width: 100%;
  padding: 0.35rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ante-bet-card.is-active .ante-toggle-btn {
  background: #00F5FF;
  color: #07090E;
  border-color: #00F5FF;
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
}

.bonus-buy-card {
  border-color: rgba(255, 0, 127, 0.3);
  background: linear-gradient(135deg, rgba(255, 0, 127, 0.1) 0%, #151B2B 100%);
}

.buy-badge {
  background: rgba(255, 0, 127, 0.25);
  color: #FF007F;
  border: 1px solid rgba(255, 0, 127, 0.5);
}

.buy-cost-pill {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 800;
  color: #39FF14;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(57, 255, 20, 0.4);
  border-radius: 6px;
  margin-top: 0.3rem;
  text-shadow: 0 0 6px var(--neon-green-glow);
}

/* Tumble History Feed */
.tumble-feed-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(7, 9, 14, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 0.6rem;
  overflow: hidden;
}

.tumble-feed-header {
  font-size: 0.62rem;
  font-weight: 700;
  color: #64748B;
  letter-spacing: 0.08em;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
}

.tumble-feed-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
}

.tumble-feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.28rem 0.45rem;
  background: rgba(21, 27, 43, 0.7);
  border-left: 2px solid #FF007F;
  border-radius: 4px;
  font-size: 0.68rem;
  animation: slideInTumble 0.25s ease-out;
}

.tumble-feed-win {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #39FF14;
}

/* PixiJS Stage Canvas Container */
#game-canvas-container {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#game-canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}

/* ==========================================================================
   ENGINE ROOTS (Controls & Win Celebration)
   ========================================================================== */

#controls-root {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  z-index: 50;
  background: rgba(7, 9, 14, 0.95);
  border-top: 1px solid rgba(255, 0, 127, 0.2);
}

#celebration-root {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 90;
}

/* ==========================================================================
   MODALS (Bonus Buy, Bonus Intro, Bonus Result)
   ========================================================================== */

.bonus-overlay-modal {
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 14, 0.88);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.bonus-overlay-modal.is-open {
  display: flex;
  opacity: 1;
}

.bonus-modal-content {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: linear-gradient(135deg, #180820 0%, #0E121D 100%);
  border: 2px solid #FF007F;
  border-radius: 20px;
  box-shadow: 0 0 35px var(--neon-pink-glow);
  padding: 2rem 1.8rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: modalScaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bonus-modal-icon {
  width: 76px;
  height: 76px;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 16px var(--neon-pink-glow));
}

.bonus-modal-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: #FFFFFF;
  margin-bottom: 0.6rem;
  text-shadow: 0 0 14px var(--neon-pink-glow);
  letter-spacing: 0.04em;
}

.bonus-modal-desc {
  font-size: 0.85rem;
  color: #94A3B8;
  line-height: 1.45;
  margin-bottom: 1.2rem;
}

.bonus-modal-highlight {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 900;
  color: #39FF14;
  text-shadow: 0 0 15px var(--neon-green-glow);
  margin-bottom: 1.5rem;
}

.bonus-confirm-actions {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.bonus-modal-btn {
  flex: 1;
  padding: 0.8rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: #07090E;
  background: #39FF14;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 0 15px var(--neon-green-glow);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.bonus-modal-btn:hover {
  transform: scale(1.03);
  filter: brightness(1.15);
}

.bonus-btn-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: #F8FAFC;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.bonus-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Toast Container */
.kasino-toast-container {
  position: absolute;
  top: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.kasino-toast {
  padding: 0.55rem 1.2rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: toastFadeIn 0.3s ease-out;
}

.kasino-toast-gold {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #07090E;
  border: 1px solid #FFD700;
}

.kasino-toast-pink {
  background: linear-gradient(135deg, #FF007F 0%, #99004C 100%);
  color: #FFFFFF;
  border: 1px solid #FFB3DC;
}

/* ==========================================================================
   ANIMATION KEYFRAMES
   ========================================================================== */

@keyframes pulseNeonPink {
  0% { box-shadow: 0 0 10px var(--neon-pink-glow); }
  100% { box-shadow: 0 0 22px rgba(255, 0, 127, 0.85); }
}

@keyframes pulseNeonGlow {
  0% { box-shadow: 0 0 12px var(--neon-green-glow); }
  100% { box-shadow: 0 0 24px rgba(57, 255, 20, 0.85); }
}

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

@keyframes slideInTumble {
  0% { transform: translateX(-15px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

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

/* ==========================================================================
   RESPONSIVE LAYOUT (Mobile & Tablet)
   ========================================================================== */

@media (max-width: 768px) {
  .side-bet-actions {
    display: none; /* Mounted inside mobile modal/drawer if needed */
  }
  .game-top-bar {
    padding: 0.4rem 0.8rem;
  }
  .game-logo {
    font-size: 1.1rem;
  }
}
