/* ==========================================================================
   ODWRÓCONY CHUJ CI W DUPE — GAME.CSS
   Theme: Satyryczno-buntowniczy Cyber-Neon / Push-Your-Luck / Minefield
   ========================================================================== */

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

:root {
  --neon-green: #00FFA3;
  --neon-cyan: #00D9F5;
  --neon-pink: #FF0055;
  --neon-red: #FF334B;
  --neon-gold: #FFD700;
  --neon-purple: #A855F7;
  --bg-deep: #08050E;
  --bg-surface: #140E24;
  --bg-card: #1C132B;
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-neon: rgba(0, 255, 163, 0.4);
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #F8FAFC;
}

#game-stage-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  perspective: 1200px;
  background: radial-gradient(circle at center, #1C132B 0%, #08050E 100%);
  transition: filter 0.8s ease-in-out;
}

/* Stan Wielkiego Odwrócenia na poziomie wrappera */
#game-stage-wrapper.grand-reverse-active {
  filter: hue-rotate(180deg) contrast(1.25);
}

/* BELKA GÓRNA HUD */
.game-top-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  background: rgba(14, 10, 25, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 40;
  gap: 1rem;
}

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

.game-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #FF0055 0%, #FF8A00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 15px rgba(255, 0, 85, 0.5);
}

.badge-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(0, 255, 163, 0.15);
  color: var(--neon-green);
  border: 1px solid rgba(0, 255, 163, 0.35);
}

/* WKURWOMETR (Rage Bar HUD) */
.rage-bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex: 1;
  max-width: 320px;
}

.rage-bar-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.rage-bar-title {
  color: #FFA500;
  text-transform: uppercase;
}

.rage-bar-percent {
  color: #FF3B5C;
}

.rage-bar-container {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 68, 68, 0.45);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(255, 50, 50, 0.25);
  position: relative;
}

.rage-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #FF6B00 0%, #FF0055 100%);
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px #FF0055;
}

.rage-bar-container.full-rage {
  animation: rage-pulse 0.8s infinite alternate;
}

@keyframes rage-pulse {
  0% {
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.7);
    border-color: #FF0055;
  }
  100% {
    box-shadow: 0 0 28px rgba(255, 0, 85, 1);
    border-color: #00FFA3;
  }
}

/* PRAWE WSKAŹNIKI STATUSU */
.top-status-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.status-chip.chip-shield {
  border-color: rgba(56, 189, 248, 0.4);
  color: #38BDF8;
}

.status-chip.chip-scatter {
  border-color: rgba(245, 158, 11, 0.4);
  color: #F59E0B;
}

.status-chip.chip-multiplier {
  border-color: rgba(0, 255, 163, 0.4);
  color: var(--neon-green);
}

/* OBSZAR CANVAS PIXIJS */
#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;
  touch-action: none;
}

/* WĘZŁY MONTOWANIA SILNIKA */
#controls-root {
  flex-shrink: 0;
  width: 100%;
  z-index: 50;
}

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

/* ZMYŁKA PRZEGRANEJ (Fake-Loss Reveal) */
.fake-loss-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 85;
  backdrop-filter: grayscale(1) contrast(1.4);
}

.fake-loss-overlay.active {
  display: flex;
}

.fake-loss-stamp {
  width: 320px;
  max-width: 80%;
  animation: stamp-slam 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes stamp-slam {
  0% {
    transform: scale(3) rotate(-25deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(-6deg);
    opacity: 1;
  }
}

/* TOAST POWIADOMIENIA */
.kasino-toast-container {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  z-index: 100;
}

.kasino-toast {
  background: rgba(18, 23, 38, 0.95);
  border: 1px solid var(--neon-green);
  box-shadow: 0 0 20px rgba(0, 255, 163, 0.4);
  color: #FFFFFF;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  animation: toast-in 0.3s ease-out forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-15px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* MODALE BONUSOWE */
.bonus-modal {
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 10, 0.92);
  backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 1rem;
}

.bonus-modal.open {
  display: flex;
  animation: modal-fade-in 0.3s ease-out;
}

@keyframes modal-fade-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.bonus-modal-content {
  background: #151024;
  border: 2px solid var(--neon-gold);
  border-radius: 20px;
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.4);
}

.bonus-modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--neon-gold);
  text-align: center;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.bonus-hud-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.6rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
}

/* SIATKA BONUSU 1: KARUZELA KARMY (4x4) */
.karma-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 360px;
}

.karma-tile {
  aspect-ratio: 1;
  background: #231B38;
  border: 1.5px solid #F59E0B;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  perspective: 600px;
  padding: 0;
}

.karma-tile:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
}

.karma-tile.flipped {
  background: #064E3B;
  border-color: var(--neon-green);
  cursor: default;
}

.karma-tile-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.karma-tile .karma-tile-back {
  display: none;
}

.karma-tile.flipped .karma-tile-front {
  display: none;
}

.karma-tile.flipped .karma-tile-back {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 900;
  font-size: 0.8rem;
  color: var(--neon-green);
  text-align: center;
}

.karma-icon {
  font-size: 1.6rem;
  color: #F59E0B;
}

/* SIATKA BONUSU 2: ALL-IN ARENA (3x3 SEJFY) */
.arena-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 380px;
}

.arena-safe {
  aspect-ratio: 1;
  background: #191428;
  border: 2px solid var(--neon-cyan);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  padding: 0.5rem;
}

.arena-safe:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(0, 217, 245, 0.7);
}

.arena-safe.opened {
  cursor: default;
  border-color: var(--neon-green);
  background: #0A1C24;
}

.safe-front-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 0.3rem;
}

.safe-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 800;
  color: #94A3B8;
}

.safe-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.arena-safe .safe-back {
  display: none;
}

.arena-safe.opened .safe-front {
  display: none;
}

.arena-safe.opened .safe-back {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 900;
  font-size: 0.75rem;
  line-height: 1.3;
}

/* RESPONSYWNOŚĆ DLA URZĄDZEŃ MOBILNYCH */
@media (max-width: 768px) {
  .game-top-bar {
    padding: 0.4rem 0.75rem;
    gap: 0.5rem;
  }

  .game-title {
    font-size: 0.95rem;
  }

  .rage-bar-wrapper {
    max-width: 180px;
  }

  .status-chip {
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
  }

  .bonus-modal-content {
    padding: 1rem;
    max-width: 95%;
  }

  .karma-grid {
    gap: 6px;
    max-width: 300px;
  }

  .arena-grid {
    gap: 8px;
    max-width: 300px;
  }
}
