/* ========================================
   VARIABLES Y RESET
======================================== */
:root {
  --bg-dark: #0a0b0f;
  --bg-card: rgba(20, 22, 35, 0.95);
  --bg-card-border: rgba(80, 90, 120, 0.3);
  --bg-input: rgba(15, 17, 28, 0.9);
  --bg-tip: rgba(30, 35, 55, 0.8);
  
  --text-primary: #e8e8ec;
  --text-secondary: #9498a8;
  --text-muted: #6b6f80;
  
  --accent-purple: #a855f7;
  --accent-violet: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-coral: #f87171;
  --accent-gold: #fbbf24;
  --accent-green: #34d399;
  
  --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #a855f7 50%, #c084fc 100%);
  --gradient-button: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
  --gradient-coral: linear-gradient(135deg, #f87171 0%, #fb923c 100%);
  
  --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.15);
  --shadow-card: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --font-main: 'Nunito', system-ui, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-main);
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
}

body {
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(236, 72, 153, 0.05) 0%, transparent 50%),
    var(--bg-dark);
  min-height: 100vh;
}

/* ========================================
   MODAL DE BIENVENIDA
======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 10, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  max-width: 750px;
  width: 100%;
  overflow: hidden;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to { 
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-layout {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  min-height: 450px;
}

@media (max-width: 650px) {
  .modal-layout {
    grid-template-columns: 1fr;
  }
  .modal-logo-section {
    padding: 30px 30px 0 !important;
  }
}

.modal-logo-section {
  background: linear-gradient(180deg, rgba(30, 35, 55, 0.5) 0%, rgba(20, 22, 35, 0.3) 100%);
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.logo-container {
  background: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.logo-img {
  width: 140px;
  height: 140px;
  border-radius: var(--radius-md);
  display: block;
}

.mascot {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  gap: 2px;
}

.mascot-question {
  color: var(--accent-coral);
  font-weight: 800;
  font-size: 14px;
  animation: bounce 2s ease-in-out infinite;
}

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

.mascot-dog {
  width: 50px;
  height: 40px;
}

.modal-content-section {
  padding: 35px 40px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.modal-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.2;
}

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.7;
}

.modal-description strong {
  color: var(--text-primary);
  font-weight: 700;
}

.tip-box {
  background: var(--bg-tip);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.tip-icon {
  font-size: 1.2rem;
}

.tip-text {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.tip-text strong {
  color: #60a5fa;
}

.btn-primary {
  width: 100%;
  background: var(--gradient-button);
  border: none;
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-main);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.modal-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--bg-card-border), transparent);
  margin: 24px 0;
}

.modal-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--bg-tip);
  margin: -35px -40px;
  margin-top: 0;
  padding: 16px;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ========================================
   APP PRINCIPAL
======================================== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.panel {
  width: 100%;
  max-width: 450px;
}

.hidden {
  display: none !important;
}

/* ========================================
   GAME CARD
======================================== */
.game-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  overflow: hidden;
  animation: slideUp 0.4s ease;
}

.card-header {
  text-align: center;
  padding: 30px 30px 20px;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.08) 0%, transparent 100%);
}

.header-logo {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.card-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.card-body {
  padding: 20px 30px 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
}

input[type="text"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 1rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  transition: all 0.2s ease;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

/* ========================================
   PANTALLA DE JUEGO
======================================== */
#juego {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(236, 72, 153, 0.05) 0%, transparent 50%),
    var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.juego-card {
  max-width: 400px;
  width: 100%;
}

.juego-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--bg-card-border);
}

.juego-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.intentos-badge {
  background: var(--bg-tip);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.intentos-badge span {
  color: var(--accent-coral);
}

canvas {
  display: block;
  margin: 20px auto;
  background: transparent;
}

#estadoPalabra {
  font-size: 2rem;
  letter-spacing: 8px;
  text-align: center;
  padding: 0 24px 16px;
  font-weight: 700;
  color: var(--text-primary);
}

#estadoPalabra .ok {
  color: var(--accent-purple);
  text-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}

#letrasErroneas {
  text-align: center;
  padding: 0 24px 20px;
  color: var(--accent-coral);
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 24px;
}

.input-row {
  display: flex;
  gap: 10px;
  padding: 0 24px 16px;
}

.input-row input {
  flex: 1;
  text-align: center;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 2px;
}

.btn-secondary {
  background: var(--gradient-button);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-main);
  white-space: nowrap;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.3);
}

.btn-ghost {
  width: calc(100% - 48px);
  margin: 0 24px 24px;
  background: var(--bg-tip);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 14px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-main);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(139, 92, 246, 0.3);
}

/* ========================================
   MODAL RESULTADO
======================================== */
.resultado-card {
  max-width: 400px;
  padding: 40px;
  text-align: center;
}

#resultadoContenido h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 12px;
}

#resultadoContenido p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 1rem;
}

#resultadoContenido .emoji {
  font-size: 4rem;
  margin-bottom: 20px;
  display: block;
}

.resultado-win h2 {
  color: var(--accent-green);
}

.resultado-lose h2 {
  color: var(--accent-coral);
}

/* ========================================
   ANIMACIONES EXTRAS
======================================== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.3s ease;
}

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 480px) {
  .modal-content-section {
    padding: 25px 24px;
  }
  
  .modal-title {
    font-size: 1.5rem;
  }
  
  .logo-img {
    width: 110px;
    height: 110px;
  }
  
  .card-header h1 {
    font-size: 1.5rem;
  }
  
  #estadoPalabra {
    font-size: 1.5rem;
    letter-spacing: 5px;
  }
  
  .modal-footer {
    margin: -25px -24px;
    margin-top: 0;
  }
}
