:root {
  --lm-orange: #ea5b0c;
  --lm-orange-hover: #ff6d1e;
  --lm-orange-glow: rgba(234, 91, 12, 0.4);
  --lm-dark-bg: #0b0e14;
  --lm-dark-card: #131822;
  --lm-dark-card-hover: #1a2230;
  --lm-dark-border: #222c3d;
  --lm-dark-muted: #8b9bb4;
  --lm-text-light: #f3f4f6;
  --lm-text-dark: #0f172a;
  --lm-green: #10b981;
  --lm-gold: #f59e0b;
  --lm-red: #ef4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-orange: 0 0 20px rgba(234, 91, 12, 0.35);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: var(--lm-dark-bg);
  color: var(--lm-text-light);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(234, 91, 12, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(234, 91, 12, 0.05) 0%, transparent 40%);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--lm-dark-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--lm-dark-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--lm-orange);
}

/* Header & Navbar */
.navbar {
  background: rgba(19, 24, 34, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--lm-dark-border);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.brand-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.brand-logo:hover {
  transform: scale(1.03);
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--lm-orange), #ff7b29);
  color: #fff;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  box-shadow: 0 0 10px var(--lm-orange-glow);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-link {
  color: var(--lm-dark-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
}

.nav-link:hover, .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--lm-orange);
  background: rgba(234, 91, 12, 0.12);
  border: 1px solid rgba(234, 91, 12, 0.25);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--lm-orange), #ff6d1e);
  color: #fff;
  box-shadow: var(--shadow-orange);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ff6d1e, #ff843d);
  box-shadow: 0 0 25px rgba(234, 91, 12, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--lm-dark-card);
  color: var(--lm-text-light);
  border: 1px solid var(--lm-dark-border);
}

.btn-secondary:hover {
  background: var(--lm-dark-card-hover);
  border-color: var(--lm-orange);
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: #ef4444;
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Layout container */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
  position: relative;
}

.hero-subtitle {
  color: var(--lm-orange);
  text-transform: uppercase;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-bottom: 0.5rem;
  display: inline-block;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero-title span {
  color: var(--lm-orange);
  text-shadow: 0 0 30px var(--lm-orange-glow);
}

.hero-desc {
  color: var(--lm-dark-muted);
  max-width: 600px;
  margin: 0 auto 2rem;
  font-size: 1.1rem;
}

/* Grid & Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--lm-dark-card);
  border: 1px solid var(--lm-dark-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(234, 91, 12, 0.4);
  box-shadow: var(--shadow-card), 0 0 25px rgba(234, 91, 12, 0.15);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(234, 91, 12, 0.12);
  border: 1px solid rgba(234, 91, 12, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--lm-orange);
}

.card-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.card-badge.finalizado {
  background: rgba(139, 155, 180, 0.15);
  color: var(--lm-dark-muted);
  border-color: rgba(139, 155, 180, 0.3);
}

.card-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #fff;
}

.card-desc {
  color: var(--lm-dark-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  min-height: 40px;
}

.card-prize-box {
  background: rgba(234, 91, 12, 0.08);
  border: 1px dashed rgba(234, 91, 12, 0.35);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-prize-icon {
  font-size: 1.5rem;
}

.card-prize-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--lm-orange);
  font-weight: 700;
}

.card-prize-name {
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--lm-dark-border);
  padding-top: 1rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--lm-dark-muted);
}

/* Banner de Instalación PWA */
.pwa-install-banner {
  background: linear-gradient(90deg, #131822, #1c2333);
  border: 1px solid var(--lm-orange);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 10px 30px rgba(234, 91, 12, 0.2);
  display: none; /* Se muestra via JS si beforeinstallprompt dispara */
}

.pwa-install-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.pwa-install-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: #000;
  padding: 4px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--lm-dark-card);
  border: 1px solid var(--lm-dark-border);
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 100%;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  transform: scale(0.92);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.open .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--lm-dark-border);
  padding-bottom: 1rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--lm-dark-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

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

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #d1d5db;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: #0d1117;
  border: 1px solid var(--lm-dark-border);
  color: #fff;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--lm-orange);
  box-shadow: 0 0 0 3px rgba(234, 91, 12, 0.2);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* Ruleta Canvas Container */
.ruleta-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0;
  position: relative;
}

.ruleta-wheel-wrap {
  position: relative;
  width: min(90vw, 480px);
  height: min(90vw, 480px);
}

#ruletaCanvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(234, 91, 12, 0.3);
  transition: filter 0.3s;
}

.ruleta-pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 22px solid transparent;
  border-right: 22px solid transparent;
  border-top: 36px solid #fff;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.8));
  z-index: 10;
  transition: transform 0.1s ease;
}

.ruleta-center-cap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 76px;
  height: 76px;
  background: radial-gradient(circle, #2d3748 0%, #111827 100%);
  border: 4px solid var(--lm-orange);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.9), 0 0 10px var(--lm-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  cursor: pointer;
}

.ruleta-center-cap img {
  width: 44px;
  height: auto;
}

/* Bolillero Digital 3D */
.bolillero-container {
  background: radial-gradient(circle at center, #1b2332 0%, #0c1017 100%);
  border: 2px solid var(--lm-dark-border);
  border-radius: var(--radius-xl);
  padding: 3rem 1.5rem;
  text-align: center;
  box-shadow: inset 0 0 50px rgba(0,0,0,0.6);
  position: relative;
  overflow: hidden;
}

.bolilla-display {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 2.5rem 0;
  perspective: 1000px;
}

.bolilla {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #f97316 40%, #c2410c 100%);
  box-shadow: 
    inset -10px -10px 25px rgba(0, 0, 0, 0.7),
    inset 8px 8px 15px rgba(255, 255, 255, 0.6),
    0 15px 35px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(234, 91, 12, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  position: relative;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bolilla.rolling {
  animation: rollSphere 0.2s linear infinite;
}

@keyframes rollSphere {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Sorteador de Nombres / Slot Machine */
.slot-machine-box {
  background: #090c10;
  border: 3px solid var(--lm-orange);
  border-radius: var(--radius-xl);
  padding: 2.5rem 1.5rem;
  text-align: center;
  box-shadow: 0 0 35px var(--lm-orange-glow);
  position: relative;
  overflow: hidden;
  margin: 2rem 0;
}

.slot-name-viewport {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.slot-name-viewport.winner {
  color: var(--lm-orange);
  text-shadow: 0 0 35px var(--lm-orange-glow);
  animation: winnerPulse 1s infinite alternate;
}

@keyframes winnerPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* Winner Celebration Card */
.winner-card {
  background: linear-gradient(135deg, rgba(234, 91, 12, 0.15), rgba(19, 24, 34, 0.95));
  border: 2px solid var(--lm-orange);
  border-radius: var(--radius-xl);
  padding: 2.5rem 1.5rem;
  text-align: center;
  box-shadow: 0 0 50px rgba(234, 91, 12, 0.4);
  animation: zoomIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* Bottom Nav for Mobile PWA */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 20, 29, 0.95);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-top: 1px solid var(--lm-dark-border);
  padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom));
  z-index: 1000;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: var(--lm-dark-muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
}

.bottom-nav-item.active {
  color: var(--lm-orange);
}

/* Footer */
.footer {
  border-top: 1px solid var(--lm-dark-border);
  background: #090c10;
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--lm-dark-muted);
  font-size: 0.9rem;
  margin-top: auto;
}

.footer a {
  color: var(--lm-orange);
  text-decoration: none;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  body {
    padding-bottom: 70px;
  }
  .container {
    padding: 1.25rem 1rem;
  }
  .hero {
    padding: 1.5rem 0.5rem;
  }
}
