@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg-main: #07090e;
  --bg-card: rgba(18, 22, 34, 0.75);
  --bg-card-hover: rgba(28, 34, 52, 0.85);
  --border-glass: rgba(255, 255, 255, 0.1);
  --border-active: rgba(168, 85, 247, 0.5);
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(168, 85, 247, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.1) 0px, transparent 50%);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* Header & Barra Superior */
.app-header {
  width: 100%;
  max-width: 900px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.brand-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.8));
  animation: pulse-glow 3s infinite ease-in-out;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 40%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Tabs de Navegación de Juegos */
.game-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid var(--border-glass);
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(6, 182, 212, 0.3));
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.25);
}

/* Botones de Control & Audio */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.reward-btn {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: white;
  border: none;
  font-weight: 600;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
  animation: subtle-bounce 4s infinite ease-in-out;
  transition: transform 0.2s;
}

.reward-btn:hover {
  transform: scale(1.04);
}

/* Barra de Estadísticas Zen */
.stats-bar {
  width: 100%;
  max-width: 900px;
  display: flex;
  justify-content: space-around;
  padding: 10px 16px;
  margin: 8px 0;
  background: rgba(18, 22, 34, 0.5);
  border-radius: 16px;
  border: 1px solid var(--border-glass);
  font-size: 13px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-label {
  color: var(--text-muted);
}

.stat-value {
  font-weight: 700;
  font-family: var(--font-heading);
  color: #38bdf8;
}

#active-perk-badge {
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.4);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
}

/* Área del Juego (Canvas) */
.game-viewport {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 9 / 14;
  margin: 10px auto;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(168, 85, 247, 0.15);
  border: 1px solid var(--border-glass);
  display: flex;
  justify-content: center;
  align-items: center;
  background: #090c15;
}

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

/* Botón flotante para el juego activo (ej. Pulso Zen) */
.floating-action-btn {
  position: absolute;
  bottom: 85px;
  right: 20px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.floating-action-btn:hover {
  background: rgba(168, 85, 247, 0.4);
  transform: scale(1.05);
}

/* Slot de Monetización (Banner de Anuncios) */
.ad-slot-container {
  width: 100%;
  max-width: 480px;
  margin: 10px auto 20px auto;
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 8px;
  text-align: center;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.ad-slot-container a {
  color: #38bdf8;
  text-decoration: none;
}

/* Modal de Anuncio Recompensado / Apoyo */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #111524;
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  max-width: 380px;
  width: 100%;
  padding: 28px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9), 0 0 35px rgba(168, 85, 247, 0.2);
}

.modal-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.ad-timer {
  display: inline-block;
  font-size: 16px;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 6px 18px;
  border-radius: 30px;
  margin-bottom: 15px;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  padding: 10px 20px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 13px;
  margin-top: 10px;
}

/* Toast de Notificación */
.toast-msg {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--accent-emerald);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 200;
}

.toast-msg.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Animaciones */
@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.6)); }
  50% { filter: drop-shadow(0 0 16px rgba(6, 182, 212, 0.9)); }
}

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

@media (max-width: 600px) {
  .app-header {
    padding: 10px 14px;
  }
  .brand-title {
    font-size: 17px;
  }
  .tab-btn {
    font-size: 11px;
    padding: 6px 10px;
  }
  .stats-bar {
    font-size: 11px;
  }
}
