
/* styles/main.css */
:root {
  --bg: #0f172a;
  --surface: #111827;
  --surface-2: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #22c55e;
  --primary-700: #15803d;
  --accent: #38bdf8;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 20% 0%, #0b1023 0%, var(--bg) 60%);
  color: var(--text);
}

/* Preloader */
#preloader {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 9999;
  background: rgba(0,0,0,0.6);
}
.spinner {
  width: 56px; height: 56px; border-radius: 50%;
  border: 6px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Header */
header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: rgba(17,24,39,0.8); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#page-logo { width: 28px; height: 28px; object-fit: cover; border-radius: 6px; }
.header-title-container h1 { margin: 0; font-weight: 900; letter-spacing: 0.5px; }
.header-title-container h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); }

#global-home-btn {
  margin-left: auto; font-size: 20px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15); background: var(--surface-2); color: var(--text);
  cursor: pointer;
}
#global-home-btn:hover { background: #2b3545; }

/* Layout */
.container { max-width: 980px; margin: 20px auto; padding: 0 16px; }

/* Vistas */
.view { display: none; animation: fadeIn 200ms ease-out; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none; } }

h2 { margin-top: 0; }
.welcome-subtitle { color: var(--muted); margin-top: -6px; }

/* Inputs y botones */
input[type="text"] {
  width: 100%; max-width: 360px; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15);
  background: var(--surface-2); color: var(--text); outline: none; margin: 6px 0 10px;
}
button {
  border: none; border-radius: 10px; padding: 10px 14px; font-weight: 800; cursor: pointer;
  background: linear-gradient(180deg, var(--primary), var(--primary-700)); color: #052e16; letter-spacing: .3px;
}
button:hover { filter: brightness(1.05); }
button.back-btn, button.home-btn {
  background: linear-gradient(180deg, #93c5fd, #60a5fa); color: #0b1a34;
}
button.menu-btn-small {
  background: linear-gradient(180deg, #fde68a, #f59e0b); color: #3b2501;
}

/* Menú principal */
.menu-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.menu-btn { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--surface-2); color: var(--text); }
.menu-btn img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }

/* Cards */
.card-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.card { display: grid; gap: 8px; padding: 10px; background: var(--surface-2); color: var(--text); text-align: left; }
.card img { width: 100%; height: 120px; object-fit: cover; border-radius: 10px; }

/* Progreso */
.progress-container { width: 100%; height: 10px; border-radius: 999px; background: rgba(255,255,255,0.1); overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #34d399, #10b981); transition: width .2s ease; }
#progress-text, #software-progress-text { color: var(--muted); }

/* Info views */
.view.info-view img { width: 100%; max-height: 280px; object-fit: contain; border-radius: 12px; background: #0b1324; }
.button-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* Quiz (estructura visual) */
.quiz-char { width: 80px; height: 80px; object-fit: contain; }
.quiz-image { width: 100%; max-height: 240px; object-fit: contain; border-radius: 8px; background: #0b1324; }
.quiz-options-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 10px 0; }
.quiz-question-text { font-size: 18px; font-weight: 800; }

/* Glosario */
.glossary-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.glossary-term { background: var(--surface-2); border: 1px solid rgba(255,255,255,0.08); padding: 12px; border-radius: 12px; }
.glossary-term h3 { margin-top: 8px; }
.glossary-thumb {
  width: 100%;
  height: 96px; /* más reducido y uniforme */
  object-fit: cover;
  border-radius: 10px;
  background: #0b1324;
  display: block;
}

/* Juego */
.game-container { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.names-container, .dropzones-container { display: grid; gap: 8px; align-content: start; }
.draggable-name { background: var(--surface-2); padding: 10px; border-radius: 10px; border: 1px dashed rgba(255,255,255,0.2); cursor: grab; }
.dropzone { min-height: 140px; background: #0b1324; border: 2px dashed #334155; border-radius: 10px; display: grid; place-items: center; padding: 8px; color: var(--muted); gap: 6px; }
.dropzone-thumb { width: 100%; max-width: 200px; height: 100px; object-fit: cover; border-radius: 8px; background: #020617; }
.dropzone-label { font-size: 12px; color: var(--muted); }
.dropzone.matched { border-color: #16a34a; background: rgba(22,163,74,0.1); color: #22c55e; font-weight: 800; }
#game-timer-container { color: var(--warning); font-weight: 800; }

/* Footer */
footer { margin-top: 40px; padding: 14px 16px; background: rgba(17,24,39,0.8); border-top: 1px solid rgba(255,255,255,0.06); }
.footer-content { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }

/* Accesibilidad */
:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Responsivo */
@media (max-width: 640px) {
  .game-container { grid-template-columns: 1fr; }
  header { flex-wrap: wrap; }
  #global-home-btn { margin-left: 0; }
}
