/* =============================================================
   HolaMundi.com — styles.css
   Sistema de diseño completo, compatible con todos los navegadores
   Creado por Román Gutiérrez Tormo
   ============================================================= */

/* --- Variables --- */
:root {
  --primary:       #1a1f3c;
  --primary-mid:   #2d3561;
  --accent:        #c8a96e;
  --accent-light:  #f5ecd7;
  --success:       #16a34a;
  --success-light: #dcfce7;
  --danger:        #dc2626;
  --danger-light:  #fee2e2;
  --warning:       #d97706;
  --warning-light: #fef3c7;
  --bg:            #f4f6fb;
  --card:          #ffffff;
  --text:          #1a1f3c;
  --muted:         #6b7280;
  --border:        #e5e7eb;
  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     20px;
  --shadow:        0 4px 24px rgba(26, 31, 60, 0.10);
  --shadow-sm:     0 2px 8px  rgba(26, 31, 60, 0.07);
  --font:          'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* --- Reset mínimo --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a   { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout principal --- */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.main-content {
  flex: 1;
  padding: 1.5rem 1rem 3rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* --- Navbar --- */
.navbar {
  background: var(--primary);
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
}
.navbar-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
}
.navbar-logo img {
  height: 36px;
  width: auto;
  border-radius: 8px;
}
.navbar-logo-text {
  font-size: .9rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .5px;
}
.navbar-logo-fallback {
  font-size: .75rem;
  color: rgba(255,255,255,.5);
  font-style: italic;
}
.navbar-stats {
  display: flex;
  gap: .6rem;
  align-items: center;
}
.stat-badge {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(200,169,110,.3);
  border-radius: 9999px;
  padding: .25rem .75rem;
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent-light);
  display: flex;
  align-items: center;
  gap: .3rem;
}

/* --- Hero de inicio --- */
.hero {
  background: var(--primary);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: rgba(200,169,110,.12);
  border-radius: 50%;
}
.hero-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  color: var(--primary);
  font-weight: 700;
}
.hero-logo img { width: 100%; height: 100%; object-fit: contain; }
.hero-domain  { font-size: .8rem; font-weight: 600; color: var(--accent); letter-spacing: 2px; text-transform: uppercase; margin-bottom: .5rem; }
.hero-title   { font-size: 2rem; font-weight: 800; color: #fff; line-height: 1.15; }
.hero-tagline { font-size: .95rem; color: rgba(255,255,255,.65); margin-top: .6rem; }
.hero-credit  { font-size: .7rem; color: rgba(255,255,255,.3); margin-top: 1.5rem; }

/* --- Cards --- */
.card {
  background: var(--card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  width: 100%;
}
.card + .card { margin-top: 1rem; }
.card-title {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .5rem;
}
.card-heading {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  text-align: center;
}

/* --- Hint box --- */
.hint {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: .65rem 1rem;
  margin-bottom: 1rem;
  font-size: .88rem;
  color: #78500a;
  font-weight: 500;
}

/* --- Selects / Dropdowns --- */
.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: .35rem;
  letter-spacing: .3px;
}
.field select,
.field input[type="text"] {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font);
  background: #fff;
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}
.field select:focus,
.field input[type="text"]:focus { border-color: var(--primary); }

/* --- Botones --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .85rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: .5rem;
  transition: transform .15s, background .15s, box-shadow .15s;
  text-align: center;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(26,31,60,.22);
}
.btn-primary:hover { background: var(--primary-mid); }
.btn-accent {
  background: var(--accent);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(200,169,110,.32);
}
.btn-accent:hover { background: #b8955a; }
.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: .5rem 1rem; font-size: .9rem; width: auto; border-radius: var(--radius-sm); }

/* --- Bilingüe: texto secundario --- */
.i18n-sub {
  font-size: .75em;
  font-weight: 400;
  color: inherit;
  opacity: .6;
  white-space: nowrap;
}

/* --- Barra de progreso --- */
.progress-wrap {
  background: var(--border);
  border-radius: 9999px;
  height: 8px;
  overflow: hidden;
  margin: .75rem 0;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 9999px;
  transition: width .4s ease;
}

/* --- Tarjeta de palabra (pantalla aprender) --- */
.word-card {
  background: linear-gradient(145deg, var(--primary), var(--primary-mid));
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}
.word-card::after {
  content: '';
  position: absolute;
  bottom: -30px; right: -30px;
  width: 100px; height: 100px;
  background: rgba(200,169,110,.1);
  border-radius: 50%;
}
.word-emoji {
  font-size: 3.5rem;
  margin-bottom: .6rem;
  display: block;
  line-height: 1;
}
.word-native { font-size: .95rem; color: rgba(255,255,255,.6); }
.word-target { font-size: 2.2rem; font-weight: 800; color: #fff; letter-spacing: -.5px; margin-top: .1rem; }
.word-accent-bar { width: 36px; height: 3px; background: var(--accent); border-radius: 2px; margin: .75rem auto 0; }

/* --- Stats row --- */
.stats-row {
  display: flex;
  gap: .6rem;
  margin-bottom: .75rem;
}
.stat-box {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: .75rem .5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-box .val   { font-size: 1.3rem; font-weight: 800; color: var(--primary); }
.stat-box .label { font-size: .68rem; color: var(--muted); font-weight: 600; margin-top: .1rem; }

/* --- Speak button --- */
.speak-btn {
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.25);
  border-radius: 10px;
  padding: .55rem 1.1rem;
  cursor: pointer;
  font-size: .88rem;
  font-family: var(--font);
  color: #fff;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: background .15s;
}
.speak-btn:hover { background: rgba(255,255,255,.22); }

/* --- Grid de temas --- */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}
.topic-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  text-align: center;
  transition: border-color .18s, background .18s, transform .18s;
  background: #fff;
}
.topic-card:hover  { border-color: var(--accent); background: var(--accent-light); transform: translateY(-2px); }
.topic-card.active { border-color: var(--primary); background: var(--accent-light); }
.topic-icon-wrap {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto .5rem;
  font-size: 1.5rem;
}
.topic-card .topic-name { font-size: .85rem; font-weight: 700; color: var(--primary); }

/* --- Selector de juego (grid 2x2) --- */
.game-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.game-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem .75rem;
  cursor: pointer;
  text-align: center;
  background: var(--card);
  transition: border-color .18s, background .18s, transform .18s, box-shadow .18s;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
}
.game-card:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(200,169,110,.2);
}
.game-card .game-icon  { font-size: 2rem; }
.game-card .game-label { font-size: .85rem; font-weight: 700; color: var(--primary); }
.game-card .game-desc  { font-size: .72rem; color: var(--muted); }

/* --- Juego: opciones múltiple (elegir) --- */
.mc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .65rem;
  margin: 1rem 0;
}
.mc-btn {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: .9rem;
  cursor: pointer;
  font-size: .95rem;
  font-weight: 600;
  font-family: var(--font);
  background: #fff;
  color: var(--primary);
  transition: border-color .15s, background .15s;
  text-align: center;
}
.mc-btn:hover   { border-color: var(--primary); background: var(--accent-light); }
.mc-btn.correct { background: var(--success-light); border-color: var(--success); color: #166534; }
.mc-btn.wrong   { background: var(--danger-light);  border-color: var(--danger);  color: #991b1b; }

/* --- Juego: emparejar (relacionar) --- */
.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
  margin: 1rem 0;
}
.match-col { display: flex; flex-direction: column; gap: .5rem; }
.match-btn {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: .8rem;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  font-family: var(--font);
  background: #fff;
  color: var(--primary);
  text-align: center;
  transition: border-color .15s, background .15s;
}
.match-btn:hover    { border-color: var(--primary); }
.match-btn.selected { border-color: var(--accent); background: var(--accent-light); }
.match-btn.matched  { border-color: var(--success); background: var(--success-light); color: #166534; cursor: default; }
.match-btn.error    { border-color: var(--danger);  background: var(--danger-light);  animation: shake .3s; }

/* --- Juego: escribir --- */
.type-input {
  width: 100%;
  padding: .85rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1.1rem;
  font-family: var(--font);
  text-align: center;
  outline: none;
  transition: border-color .15s;
  margin: .75rem 0;
  font-weight: 600;
  color: var(--text);
}
.type-input:focus   { border-color: var(--primary); }
.type-input.correct { border-color: var(--success); background: var(--success-light); }
.type-input.wrong   { border-color: var(--danger);  background: var(--danger-light); }

/* --- Juego: memoria --- */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin: 1rem 0;
}
.mem-card {
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  transition: all .2s;
  position: relative;
  overflow: hidden;
  font-size: 1.3rem;
}
.mem-card .mem-front { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; color: var(--primary); }
.mem-card .mem-back  { display: none; font-size: .65rem; font-weight: 700; text-align: center; padding: 3px; color: var(--primary); line-height: 1.2; width: 100%; height: 100%; align-items: center; justify-content: center; }
.mem-card.flipped,
.mem-card.matched  { background: var(--accent-light); border-color: var(--accent); }
.mem-card.matched  { background: var(--success-light); border-color: var(--success); cursor: default; }
.mem-card.flipped .mem-front,
.mem-card.matched .mem-front  { display: none; }
.mem-card.flipped .mem-back,
.mem-card.matched .mem-back   { display: flex; }

/* --- Feedback / toast --- */
.feedback {
  text-align: center;
  padding: .85rem 1rem;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  margin: .75rem 0;
  animation: pop .3s;
}
.feedback.correct { background: var(--success-light); color: #166534; }
.feedback.wrong   { background: var(--danger-light);  color: #991b1b; }

.hm-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--primary);
  color: #fff;
  padding: .65rem 1.5rem;
  border-radius: 9999px;
  font-size: .9rem;
  font-weight: 600;
  opacity: 0;
  transition: transform .25s, opacity .25s;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}
.hm-toast--show { transform: translateX(-50%) translateY(0); opacity: 1; }
.hm-toast--success { background: var(--success); }
.hm-toast--error   { background: var(--danger);  }

/* --- Modal --- */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(10,12,30,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 1rem;
}
.modal-bg[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 340px; width: 100%;
  animation: pop .3s;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-icon { font-size: 3.5rem; margin-bottom: .5rem; display: block; }
.modal h2   { font-size: 1.35rem; margin-bottom: .4rem; }
.modal p    { color: var(--muted); margin-bottom: 1.25rem; font-size: .95rem; }

/* --- Nav top (páginas internas) --- */
.nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-top: .25rem;
}
.back-btn {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  padding: .4rem 1rem;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--muted);
  transition: border-color .15s, color .15s;
}
.back-btn:hover { border-color: var(--primary); color: var(--primary); }
.streak-badge {
  background: var(--warning-light);
  color: #78500a;
  font-size: .8rem;
  font-weight: 700;
  padding: .3rem .85rem;
  border-radius: 9999px;
  border: 1px solid rgba(200,169,110,.3);
}

/* --- Footer --- */
#site-footer {
  background: var(--primary);
  color: rgba(255,255,255,.55);
  text-align: center;
  padding: 1.25rem 1rem;
  font-size: .78rem;
  margin-top: auto;
}
.footer-credit { font-weight: 600; color: rgba(255,255,255,.7); margin-bottom: .35rem; }
.footer-links  { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; }
.footer-links a { color: rgba(255,255,255,.55); transition: color .15s; }
.footer-links a:hover { color: var(--accent); text-decoration: none; }

/* --- Animaciones --- */
@keyframes pop  { 0% { transform: scale(.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* --- Responsive --- */
@media (max-width: 400px) {
  .topic-grid   { grid-template-columns: 1fr; }
  .mc-grid      { grid-template-columns: 1fr; }
  .match-grid   { grid-template-columns: 1fr; }
  .memory-grid  { grid-template-columns: repeat(3, 1fr); }
  .game-selector { grid-template-columns: 1fr; }
  .hero-title   { font-size: 1.6rem; }
}
@media (min-width: 600px) {
  .main-content { padding: 2rem 1.5rem 4rem; }
  .word-target  { font-size: 2.5rem; }
}
