/* ============================================================
   style.css — Estilos base para Mundo Triqui (Nij´see xanh)
   ============================================================ */

/* ─── Variables de tema ────────────────────────────── */
:root {
  --bg-body: #f0fdf4;
  --bg-card: #ffffff;
  --bg-card-alt: #f0fdf4;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border-light: #e2e8f0;
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-700: #15803d;
  --green-800: #166534;
  --green-900: #14532d;
  --shadow-card: rgba(0,0,0,0.08);
  --header-bg: transparent;
  --offline-badge-bg: #dc2626;
  --map-border: #bbf7d0;
}

.dark-mode {
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-card-alt: #1e293b;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-light: #334155;
  --green-50: #0f172a;
  --green-100: #1e293b;
  --green-700: #4ade80;
  --green-800: #86efac;
  --green-900: #bbf7d0;
  --shadow-card: rgba(0,0,0,0.3);
  --header-bg: #0f172a;
  --offline-badge-bg: #991b1b;
  --map-border: #334155;
}

/* ─── Reseteo y tipografía ─────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-body);
  min-height: 100dvh;
  transition: background 0.3s, color 0.3s;
}

/* ─── Layout principal ─────────────────────────────────── */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: 5rem;
}

/* ─── Header ───────────────────────────────────────────── */
.app-header {
  text-align: center;
  padding: 1.5rem 0 1rem;
  position: relative;
  background: var(--header-bg);
  transition: background 0.3s;
}

.app-header .menu-hamburger {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  z-index: 10;
}

.app-header .menu-hamburger span {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--green-800);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.app-header .header-center {
  flex: 1;
}

.app-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--green-800);
  line-height: 1.2;
}

.app-header p {
  font-size: 0.85rem;
  color: var(--green-700);
  margin-top: 0.25rem;
}

/* ─── Tarjetas de sitios ───────────────────────────────── */
.sitio-card {
  background: var(--bg-card);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 12px var(--shadow-card);
  margin-bottom: 1rem;
  transition: transform 0.2s, background 0.3s, box-shadow 0.3s;
}

.sitio-card:active {
  transform: scale(0.98);
}

.sitio-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background: #e2e8f0;
}

.sitio-card .sitio-body {
  padding: 1rem;
}

.sitio-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--green-800);
  margin-bottom: 0.25rem;
}

.sitio-card .desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.sitio-card .distancia {
  font-size: 0.8rem;
  color: #38a169;
  font-weight: 600;
}

/* ─── Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 1.5rem;
  padding: 2rem 1.5rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transition: background 0.3s;
}

.modal-content h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--green-800);
  margin-bottom: 0.5rem;
}

.modal-content p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.modal-content .btn-grande {
  display: block;
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 0.75rem;
}

.btn-registrar {
  background: #16a34a;
  color: white;
}

.btn-registrar:hover {
  background: #15803d;
}

.btn-audio {
  background: #2563eb;
  color: white;
}

.btn-audio:hover {
  background: #1d4ed8;
}

.btn-cerrar {
  background: #e2e8f0;
  color: #475569;
  font-weight: 600;
}

/* ─── Slider menu ──────────────────────────────────────── */
.slide-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100dvh;
  background: var(--bg-card);
  box-shadow: 4px 0 20px var(--shadow-card);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  transform: translateX(-100%);
  transition: transform 0.3s ease, background 0.3s, box-shadow 0.3s;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--green-700) transparent;
}
.slide-nav::-webkit-scrollbar {
  width: 4px;
}
.slide-nav::-webkit-scrollbar-thumb {
  background: var(--green-700);
  border-radius: 4px;
}

.slide-nav.open {
  transform: translateX(0);
}

/* ─── Modo Desktop/Laptop: slider siempre visible (solo logueado) ─────── */
@media (min-width: 1024px) {
  body.logged-in .slide-nav {
    transform: translateX(0) !important;
    box-shadow: none;
    border-right: 1px solid var(--border-light);
    padding: 0.5rem 0;
  }
  body.logged-in .slide-nav .slide-nav-header {
    padding: 0.5rem 1rem 0.75rem;
    margin-bottom: 0.25rem;
  }
  body.logged-in .slide-nav .nav-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
  body.logged-in .slide-nav .nav-btn .icono {
    font-size: 1rem;
    width: 1.4rem;
  }
  body.logged-in .nav-overlay {
    display: none !important;
  }
  body.logged-in .menu-hamburger {
    display: none !important;
  }
  body.logged-in .map-blur {
    filter: none !important;
  }
  body.logged-in .theme-toggle {
    padding-top: 0.35rem !important;
    margin-top: 0.5rem;
  }
  body.logged-in .app-container {
    margin-left: 260px;
    width: calc(100% - 260px);
    max-width: 100%;
    padding: 1rem 2rem;
  }
  body.logged-in .offline-badge {
    left: 260px;
    width: calc(100% - 260px);
  }
  body.logged-in .app-header {
    left: 0;
    width: 100%;
    padding-left: 0;
    text-align: left;
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
  }
  body.logged-in .app-header h1 {
    font-size: 1.2rem;
    margin: 0;
  }
  body.logged-in .header-center {
    margin-left: 0;
    flex: 1 0 100%;
    text-align: left;
    order: -1;
  }
  body.logged-in .app-header .header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
  }
  body.logged-in #seccionSitios {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }
  body.logged-in #seccionSitios .map-container {
    flex: 1;
    height: auto;
    min-height: 300px;
  }
  body.logged-in .sitio-card {
    margin-bottom: 0.5rem;
  }
  body.logged-in #appFooter {
    margin-left: 260px;
    width: calc(100% - 260px);
  }
  body.logged-in #xunuBubble {
    right: 24px;
    bottom: 24px;
  }

  body.logged-in .content-area {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
  }
  body.logged-in .main-content {
    flex: 1;
    min-width: 0;
  }
  body.logged-in .side-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
    align-self: flex-start;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    scrollbar-width: thin;
  }
  body.logged-in .side-widget {
    background: linear-gradient(180deg, #111827, #0f172a);
    border: 1px solid #22c55e;
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.15), inset 0 0 20px rgba(34, 197, 94, 0.03);
    position: relative;
    overflow: hidden;
  }
  body.logged-in .side-widget::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #4ade80, transparent);
  }
  body.logged-in .side-widget-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: #4ade80;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  body.logged-in .side-widget-body {
    font-size: 0.8rem;
  }
  body.logged-in .side-reto {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(74, 222, 128, 0.1);
  }
  body.logged-in .side-reto:last-child {
    border-bottom: none;
  }
  body.logged-in .side-reto-check {
    width: 16px; height: 16px;
    border: 2px solid #4ade80;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 10px;
  }
  body.logged-in .side-reto-check.done {
    background: #22c55e;
    border-color: #22c55e;
  }
  body.logged-in .side-reto-text {
    flex: 1;
    font-size: 0.75rem;
    color: #d1d5db;
  }
  body.logged-in .side-reto-text.done {
    text-decoration: line-through;
    color: #6b7280;
  }
  body.logged-in .side-reto-progress {
    font-size: 0.65rem;
    color: #4ade80;
    font-weight: 700;
  }
  body.logged-in .side-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(74, 222, 128, 0.08);
  }
  body.logged-in .side-stat:last-child {
    border-bottom: none;
  }
  body.logged-in .side-stat-label {
    color: #9ca3af;
    font-size: 0.75rem;
  }
  body.logged-in .side-stat-value {
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 700;
  }
  body.logged-in .side-stat-bar {
    width: 100%;
    height: 6px;
    background: #1f2937;
    border-radius: 3px;
    margin-top: 0.4rem;
    overflow: hidden;
  }
  body.logged-in .side-stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    border-radius: 3px;
    transition: width 0.5s ease;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
  }
  body.logged-in .side-activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(74, 222, 128, 0.08);
  }
  body.logged-in .side-activity-item:last-child {
    border-bottom: none;
  }
  body.logged-in .side-activity-icon {
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
  }
  body.logged-in .side-activity-text {
    flex: 1;
    font-size: 0.7rem;
    color: #d1d5db;
    line-height: 1.3;
  }
  body.logged-in .side-activity-time {
    font-size: 0.6rem;
    color: #6b7280;
    flex-shrink: 0;
  }
}

.slide-nav-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0.25rem;
  flex-shrink: 0;
}

.slide-nav .nav-btn {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  text-align: left;
  width: 100%;
  flex-shrink: 0;
}

.slide-nav .nav-btn .icono {
  font-size: 1.1rem;
  width: 1.6rem;
  text-align: center;
}

.slide-nav .nav-btn:hover {
  background: var(--green-100);
}

.slide-nav .nav-btn.active {
  color: var(--green-700);
  background: var(--green-100);
  font-weight: 700;
}

/* ─── Overlay del menú ─────────────────────────────────── */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.nav-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Secciones ────────────────────────────────────────── */
.seccion {
  display: none;
}

.seccion.active {
  display: block;
}

/* ─── Memorama ─────────────────────────────────────────── */
.memorama-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  max-width: 400px;
  margin: 1rem auto;
}

.memorama-carta {
  aspect-ratio: 1;
  font-size: 1.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s;
}
.memorama-texto {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

@media (max-width: 360px) {
  .memorama-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ─── Sopa de Letras ───────────────────────────────────── */
.sopa-letras-grid {
  display: grid;
  gap: 2px;
  max-width: 400px;
  margin: 0 auto;
  background: var(--border-light);
  padding: 4px;
  border-radius: 0.5rem;
}

.sopa-letra {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: bold;
  background: white;
  border-radius: 2px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}
.sopa-letra:hover {
  background: var(--green-100);
}
.sopa-letra.seleccionada {
  background: #fef08a;
}
.sopa-letra.encontrada {
  background: #86efac;
  color: #166534;
}

/* ─── Crucigrama ───────────────────────────────────────── */
.crucigrama-container {
  max-width: 400px;
  margin: 0 auto;
}
.crucigrama-pregunta {
  background: var(--bg-card-alt);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-light);
}
.crucigrama-pregunta p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.crucigrama-pregunta input {
  width: 100%;
  padding: 0.5rem;
  border: 2px solid var(--border-light);
  border-radius: 0.5rem;
  font-size: 1rem;
  text-align: center;
  text-transform: uppercase;
  background: var(--bg-card);
  color: var(--text-primary);
}
.crucigrama-pregunta input.correcto {
  border-color: #22c55e;
  background: #dcfce7;
}
.crucigrama-pregunta input.incorrecto {
  border-color: #ef4444;
  background: #fee2e2;
}

/* ─── Offline indicator ────────────────────────────────── */
.offline-badge {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #dc2626;
  color: white;
  text-align: center;
  font-size: 0.8rem;
  padding: 0.3rem;
  font-weight: 600;
  z-index: 200;
  display: none;
}

/* ─── Welcome banner ──────────────────────────────────── */
.welcome-banner {
  background: linear-gradient(135deg, var(--green-800), var(--green-700));
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(22,101,52,0.3);
  animation: slideDown 0.4s ease-out;
}

.welcome-banner.hidden {
  display: none;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Leaflet map container ───────────────────────────── */
.map-container {
  height: 280px;
  border-radius: 1rem;
  overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: 0 2px 12px var(--shadow-card);
  border: 2px solid var(--map-border);
  position: relative;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.map-container.map-blur {
  filter: blur(3px);
  opacity: 0.5;
  pointer-events: none;
}

/* ─── GPS loader overlay ──────────────────────────────── */
.gps-loader {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 1000;
  font-size: 0.9rem;
  color: var(--green-800);
  font-weight: 600;
}

.dark-mode .gps-loader {
  background: rgba(15,23,42,0.92);
}

.gps-spinner {
  width: 32px;
  height: 32px;
  border: 4px solid #bbf7d0;
  border-top-color: #16a34a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── GPS dato curioso ───────────────────────────── */
.gps-dato {
  margin-top: 1rem;
  background: #ecfdf5;
  border-radius: 0.75rem;
  padding: 0.75rem;
  max-width: 260px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.gps-dato.hidden {
  display: none;
}
.gps-dato-titulo {
  color: #064e3b;
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gps-dato-texto {
  color: #374151;
  font-size: 0.72rem;
  line-height: 1.4;
}



/* ─── Dark mode Leaflet tiles ─────────────────────── */
.dark-mode #map .leaflet-tile-pane {
  filter: brightness(0.7);
}

/* ─── Dark mode overrides para Tailwind inline ────── */
.dark-mode .bg-white { background: var(--bg-card) !important; }
.dark-mode .text-gray-400 { color: var(--text-muted) !important; }
.dark-mode .text-gray-500 { color: var(--text-muted) !important; }
.dark-mode .text-gray-600 { color: var(--text-secondary) !important; }
.dark-mode .text-green-800 { color: var(--green-800) !important; }
.dark-mode .text-green-700 { color: var(--green-700) !important; }
.dark-mode .ring-green-300 { --tw-ring-color: var(--green-700); }
.dark-mode .bg-green-50 { background: var(--green-50) !important; }
.dark-mode .bg-green-100 { background: var(--green-100) !important; }
.dark-mode .bg-yellow-50 { background: #1e293b !important; }
.dark-mode .bg-yellow-100 { background: #334155 !important; }
.dark-mode .border-gray-200 { border-color: var(--border-light) !important; }
.dark-mode .shadow-sm { box-shadow: 0 1px 3px var(--shadow-card) !important; }
.dark-mode .shadow-md { box-shadow: 0 4px 6px var(--shadow-card) !important; }

/* ─── Theme toggle button ─────────────────────────── */
.theme-toggle {
  justify-content: center !important;
  gap: 0.5rem !important;
  border-top: 1px solid var(--border-light);
  margin-top: auto;
  padding-top: 0.5rem !important;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ─── Mascota Xunu' ─────────────────────────────── */
#xunuBubble {
  animation: xunuFloat 3s ease-in-out infinite;
}
@keyframes xunuFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
#xunuBubble .bg-white {
  position: relative;
}
#xunuBubble .bg-white::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 24px;
  left: auto;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid white;
}

/* ─── Confetti / Animaciones ──────────────────────── */
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ffd700;
  animation: confettiFall 2s ease-out forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ─── Barra de XP ─────────────────────────────────── */
.xp-bar {
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
  transition: width 0.5s ease-out;
}

/* ─── Sticker locked/unlocked ─────────────────────── */
.sticker-locked {
  filter: grayscale(1) opacity(0.3);
}
.sticker-unlocked {
  animation: stickerPop 0.5s ease-out;
}
@keyframes stickerPop {
  0% { transform: scale(0.5); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ─── Nivel badge ─────────────────────────────────── */
.nivel-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: bold;
  color: white;
}

/* ─── Quiz modal ──────────────────────────────────── */
#modalQuiz .modal-content {
  max-width: 400px;
}
.quiz-opcion {
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 2px solid #e5e7eb;
  background: white;
  transition: all 0.2s;
  cursor: pointer;
}
.quiz-opcion:hover {
  border-color: #22c55e;
  background: #f0fdf4;
}
.quiz-opcion.correcta {
  border-color: #22c55e;
  background: #dcfce7;
}
.quiz-opcion.incorrecta {
  border-color: #ef4444;
  background: #fee2e2;
}

/* ─── Misiones ────────────────────────────────────── */
.mision-card {
  background: white;
  border-radius: 1rem;
  padding: 1rem;
  border: 2px solid #e5e7eb;
  transition: all 0.2s;
}
.mision-card.completada {
  border-color: #22c55e;
  background: #f0fdf4;
}
.mision-card .mision-progreso {
  height: 0.5rem;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}
.mision-card .mision-progreso-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  border-radius: 9999px;
  transition: width 0.3s ease-out;
}

/* ─── Side Panel (gamer, solo escritorio) ──────────── */
.side-panel { display: none; }

/* ─── Caza del Tesoro ─────────────────────────────── */
.tesoro-pista {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px dashed #f59e0b;
}

/* ─── Crucigrama Grid ─────────────────────────────── */
.crucigrama-grid {
  display: grid;
  gap: 1px;
  max-width: 100%;
  margin: 0 auto;
  justify-content: center;
  background: #d1d5db;
  padding: 2px;
  border-radius: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 4px;
}
.crucigrama-celda {
  width: 26px;
  height: 26px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  color: #166534;
}
.crucigrama-celda.vacia {
  background: #374151;
}
.crucigrama-celda.rellena {
  background: #86efac;
  color: #166534;
}
@media (max-width: 400px) {
  .crucigrama-celda {
    font-size: 0.6rem;
  }
  .crucigrama-num {
    font-size: 5px;
  }
  .clue-input {
    min-width: 60px;
    font-size: 0.75rem;
  }
  .clue-box {
    width: 20px;
    height: 24px;
    font-size: 0.65rem;
  }
}
.crucigrama-num {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 7px;
  color: #6b7280;
  font-weight: bold;
  line-height: 1;
}
.clue-input {
  padding: 0.3rem 0.5rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  outline: none;
  min-width: 100px;
}
.clue-input:focus {
  border-color: #22c55e;
}
.clue-input.correcto {
  border-color: #22c55e;
  background: #dcfce7;
}
.clue-input.incorrecto {
  border-color: #ef4444;
  background: #fee2e2;
}
.clue-box {
  width: 24px;
  height: 28px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
  color: #166534;
  background: white;
}
.clue-box.rellena {
  background: #86efac;
  border-color: #22c55e;
}

/* ─── Adivina la Palabra (Ahorcado) ──────────────── */
.ahorcado-btn {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: white;
  font-weight: bold;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.ahorcado-btn:hover:not(:disabled) {
  background: #86efac;
  border-color: #22c55e;
}

/* ─── Lotería Triqui ─────────────────────────────── */
.loteria-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  max-width: 400px;
  margin: 0 auto;
}
.loteria-casilla {
  aspect-ratio: 1;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 4px;
  text-align: center;
}
.loteria-casilla:hover {
  border-color: #22c55e;
}
.loteria-casilla.acertada {
  background: #86efac;
  border-color: #22c55e;
  opacity: 0.7;
}
.loteria-casilla.destacada {
  border-color: #eab308;
  background: #fef9c3;
  transform: scale(1.05);
}

/* ─── Clasificación ──────────────────────────────── */
.clasif-categoria {
  min-width: 80px;
  min-height: 80px;
  background: white;
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  gap: 2px;
  flex: 1;
}
.clasif-categoria:hover {
  border-color: #22c55e;
  background: #f0fdf4;
}
.clasif-categoria .clasif-count {
  background: #22c55e;
  color: white;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
  min-width: 20px;
  text-align: center;
}
.clasif-palabra {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: white;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.clasif-palabra:hover:not(:disabled) {
  border-color: #22c55e;
  background: #f0fdf4;
}
.clasif-palabra.seleccionada {
  background: #22c55e;
  color: white;
  border-color: #166534;
}
.clasif-palabra.correcta {
  background: #86efac;
  border-color: #22c55e;
  opacity: 0.6;
  pointer-events: none;
}
.clasif-palabra:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ─── Flashcards (Tarjetas de Estudio) ────────────── */
.flashcard-contenedor {
  width: 100%;
  max-width: 320px;
  height: 260px;
  margin: 0.75rem auto;
  perspective: 800px;
  cursor: pointer;
  position: relative;
}
.flashcard-cara {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  transition: transform 0.5s;
  border: 2px solid #e5e7eb;
  background: white;
}
.flashcard-frente { transform: rotateY(0deg); }
.flashcard-reverso { transform: rotateY(180deg); }
.flashcard-contenedor.girada .flashcard-frente { transform: rotateY(180deg); }
.flashcard-contenedor.girada .flashcard-reverso { transform: rotateY(0deg); }
.flashcard-img {
  max-width: 120px;
  max-height: 120px;
  border-radius: 0.75rem;
  object-fit: cover;
}
.flashcard-img-fallback {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.flashcard-cat-btn {
  transition: all 0.15s;
}

/* ─── Quiz visual ─────────────────────────────────── */
.quiz-card {
  max-width: 320px;
  margin: 0 auto;
  text-align: center;
}
.quiz-img {
  max-width: 140px;
  max-height: 140px;
  border-radius: 0.75rem;
  object-fit: cover;
  display: block;
  margin: 0 auto;
}
.quiz-img-fallback {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto;
}
.quiz-opcion {
  padding: 0.75rem 0.5rem;
  border-radius: 0.75rem;
  border: 2px solid #e5e7eb;
  background: white;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.quiz-opcion:hover { border-color: #22c55e; background: #f0fdf4; }
.quiz-opcion.correcta { border-color: #22c55e; background: #86efac; }
.quiz-opcion.incorrecta { border-color: #ef4444; background: #fecaca; }
.quiz-opcion.destacada { border-color: #22c55e; background: #bbf7d0; }

/* ─── Ordena las Letras ───────────────────────────── */
.scramble-letra {
  width: 40px;
  height: 44px;
  border-radius: 8px;
  border: 2px solid #d1d5db;
  background: white;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
}
.scramble-letra:hover { border-color: #22c55e; background: #f0fdf4; }
.scramble-letra.usada { opacity: 0.3; pointer-events: none; }
.scramble-respuesta-letra {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 42px;
  border-bottom: 3px solid #22c55e;
  font-size: 1.2rem;
  font-weight: bold;
  color: #166534;
  text-transform: uppercase;
}

/* ─── Info cards (info, warning, tip) ─────────────── */
.card-info-blue {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  padding: 0.8rem;
  border-radius: 0.5rem;
}
.dark-mode .card-info-blue {
  background: #1e3a5f !important;
  border-left-color: #60a5fa !important;
}

.card-warning-yellow {
  background: #fef9c3;
  border-left: 4px solid #ca8a04;
  padding: 0.8rem;
  border-radius: 0.5rem;
}
.dark-mode .card-warning-yellow {
  background: #3d3520 !important;
  border-left-color: #facc15 !important;
}

.card-tip-green {
  background: #f0fdf4;
  border-left: 4px solid #22c55e;
  padding: 0.8rem;
  border-radius: 0.5rem;
}
.dark-mode .card-tip-green {
  background: #1a3a2a !important;
  border-left-color: #4ade80 !important;
}

.dark-mode .card-info-blue .text-blue-700 { color: #93c5fd !important; }
.dark-mode .card-warning-yellow .text-yellow-800 { color: #fde68a !important; }
.dark-mode .card-tip-green .text-green-700 { color: #86efac !important; }

/* ─── Quote (cita al final de Consejos) ─────────── */
.quote-triqui {
  border-left: 3px solid #16a34a;
  padding: 0.8rem 1.2rem;
  background: rgba(22,101,52,0.1);
  border-radius: 0 0.5rem 0.5rem 0;
}
.dark-mode .quote-triqui {
  background: rgba(74,222,128,0.08) !important;
}
.dark-mode .quote-triqui p { color: #86efac !important; }

/* ─── Table wrapper (para tablas responsivas) ──────── */
.table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: 0.8rem;
  border: 1px solid rgba(74,222,128,0.15);
}
.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table-wrapper th {
  background: rgba(22,101,52,0.3);
  color: var(--green-700);
  font-weight: 700;
  text-align: left;
  padding: 0.7rem 1rem;
  white-space: nowrap;
}
.table-wrapper td {
  padding: 0.6rem 1rem;
  border-top: 1px solid rgba(74,222,128,0.08);
  color: var(--text-secondary);
}
.table-wrapper tr:hover td {
  background: rgba(74,222,128,0.05);
}

/* ─── Combo / Racha ───────────────────────────────── */
.racha-flame {
  animation: flameFlicker 0.5s ease-in-out infinite alternate;
}
@keyframes flameFlicker {
  0% { transform: scale(1); }
  100% { transform: scale(1.1); }
}
