/* C:\Users\sebti\.gemini\antigravity\scratch\mini-juegos\shared\styles\common.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&family=JetBrains+Mono:wght@400;600;700;800&display=swap');

:root {
  /* Colors */
  --bg-color: #0b1120;
  --bg-color-alt: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --secondary: #64748b;
  --secondary-hover: #475569;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --accent-cyan: #00f0ff;
  --accent-pink: #f43f5e;
  --accent-purple: #a855f7;
  --accent-green: #00ff88;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  /* Typography */
  --font-sans: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shadows / Glow */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --glow-primary: 0 0 15px rgba(59, 130, 246, 0.5);

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

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

/* Universal Screen & Phased Visibility Rules */
.hidden {
  display: none !important;
}

.screen {
  display: none !important;
  width: 100%;
}

.screen.active {
  display: block !important;
  animation: fadeIn 0.4s ease forwards;
}

.screen.hidden {
  display: none !important;
}

.level-ui {
  display: none !important;
  width: 100%;
}

.level-ui.active {
  display: block !important;
  animation: fadeIn 0.35s ease forwards;
}

.level-ui.hidden {
  display: none !important;
}

.game-header.hidden {
  display: none !important;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Typography Utilities */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
}
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: var(--font-mono); }

/* Desktop Responsiveness Container Base */
.game-container-fluid {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.5rem);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}

/* Glassmorphism */
.glass {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.glass-panel {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.92) 0%, rgba(15, 23, 42, 0.88) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-lg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  gap: var(--space-2);
  user-select: none;
}

.btn:active {
  transform: scale(0.94);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  animation: shine 3.5s infinite;
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6), 0 0 15px rgba(59, 130, 246, 0.4);
  transform: translateY(-2px) scale(1.02);
}

.btn-secondary {
  background: rgba(100, 116, 139, 0.25);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
}
.btn-secondary:hover {
  background: rgba(100, 116, 139, 0.45);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px) scale(1.02);
}

.btn-icon {
  padding: var(--space-2);
  border-radius: var(--radius-full);
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

/* Universal Back / Mute Buttons */
.back-btn, .global-back-btn {
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 999;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  transition: all var(--transition-fast);
  cursor: pointer;
}
.back-btn:hover, .global-back-btn:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: var(--primary);
  transform: translateX(-3px);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.mute-btn, .global-mute-btn {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 999;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  transition: all var(--transition-fast);
  cursor: pointer;
}
.mute-btn:hover, .global-mute-btn:hover {
  background: rgba(30, 41, 59, 0.95);
  transform: scale(1.1);
  border-color: var(--accent-cyan);
}

/* Modals & "Cómo Jugar" overlay */
.modal-overlay, .how-to-play-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 22, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1.5rem;
}
.modal-overlay.active, .how-to-play-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content, .how-to-play-modal {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: 2.2rem;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(59, 130, 246, 0.2);
  transform: translateY(20px) scale(0.96);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.modal-overlay.active .modal-content,
.how-to-play-overlay.active .how-to-play-modal {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.8);
  transform: scale(1.1);
}

/* Visual Example Boxes in Guides */
.visual-example-box {
  background: rgba(10, 15, 29, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.2rem;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 0.5rem;
}

.example-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.8rem;
  text-align: center;
  font-size: 0.85rem;
}

.key-badge {
  display: inline-block;
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  border: 1px solid #475569;
  border-bottom: 3px solid #0f172a;
  border-radius: 6px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #38bdf8;
  font-size: 0.85rem;
  margin: 0 3px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.concept-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
}

/* In-game Floating Concept Callout */
.in-game-concept-box {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.92rem;
  color: #cbd5e1;
  margin: 12px 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}
.in-game-concept-box .concept-icon {
  font-size: 1.3rem;
  line-height: 1;
}

/* ========================================================
   DIGITAL MENTOR (PROFESOR PIXEL) & THEORY DRAWER
   ======================================================== */
.mentor-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

.mentor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: all;
}

.mentor-btn {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #f8fafc;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mentor-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  transform: translateY(-2px);
}

.mentor-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(56, 189, 248, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  pointer-events: all;
}
.mentor-avatar:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 25px rgba(56, 189, 248, 0.6);
}
.mentor-emoji {
  font-size: 1.8rem;
  line-height: 1;
}

.mentor-bubble {
  position: relative;
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 14px;
  padding: 14px 16px;
  max-width: 340px;
  margin-bottom: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.mentor-bubble.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.mentor-bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: #38bdf8;
  font-weight: 700;
}
.mentor-close-bubble {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
}
.mentor-close-bubble:hover {
  color: #ef4444;
}
.mentor-message {
  font-size: 0.92rem;
  line-height: 1.5;
  color: #f1f5f9;
}

/* Theory Slide-out Drawer */
.theory-drawer {
  position: fixed;
  inset: 0;
  z-index: 3000;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.3s;
}
.theory-drawer.active {
  visibility: visible;
  pointer-events: all;
}

.theory-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.theory-drawer.active .theory-drawer-overlay {
  opacity: 1;
}

.theory-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.8);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.theory-drawer.active .theory-drawer-panel {
  transform: translateX(0);
}

.theory-drawer-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.theory-drawer-header h2 {
  font-size: 1.25rem;
  color: #38bdf8;
}
.theory-drawer-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  transition: background 0.2s;
}
.theory-drawer-close:hover {
  background: #ef4444;
}

.theory-drawer-content {
  padding: 1.5rem;
  overflow-y: auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.theory-card {
  background: rgba(10, 15, 29, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1.2rem;
}
.theory-card h3 {
  font-size: 1.05rem;
  color: #facc15;
  margin-bottom: 8px;
}
.theory-card p {
  font-size: 0.92rem;
  color: #cbd5e1;
  line-height: 1.6;
}
.theory-formula {
  background: #000;
  border-left: 3px solid #38bdf8;
  padding: 8px 12px;
  margin: 8px 0;
  border-radius: 4px;
  color: #38bdf8;
  font-size: 0.88rem;
}
.theory-example {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 6px;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shine { 0% { left: -100%; } 20% { left: 200%; } 100% { left: 200%; } }

/* Responsive Adjustments for Computers & Laptops */
@media (max-width: 900px) {
  .mentor-container {
    bottom: 16px;
    right: 16px;
  }
}
