/* ===== Base mobile-first vertical, para chicos ===== */
:root {
  --bg1: #6a4cff;
  --bg2: #4cc9f0;
  --card: #ffffff;
  --ink: #2b2350;
  --pink: #ff5d8f;
  --yellow: #ffd166;
  --green: #06d6a0;
  --blue: #4cc9f0;
  --purple: #b388ff;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.12);
  --radius: 22px;
  font-size: clamp(16px, 4.4vw, 22px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: "Baloo 2", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
  -webkit-user-select: none;
}

/* Contenedor angosto tipo celular */
.app {
  width: 100%;
  max-width: 480px;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}

/* Botones grandes para dedos chiquitos */
.btn {
  border: none;
  border-radius: var(--radius);
  padding: 16px 22px;
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease, filter 0.1s;
  touch-action: manipulation;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,0.12); }
.btn:disabled { filter: grayscale(0.5) opacity(0.55); cursor: default; }

.btn-primary { background: var(--green); color: #053d2c; }
.btn-pink { background: var(--pink); color: #fff; }
.btn-ghost { background: rgba(255,255,255,0.85); }

/* Encabezado con botón volver y mute */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}
.icon-btn {
  width: 46px; height: 46px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,0.85);
  box-shadow: var(--shadow);
  font-size: 1.3rem; line-height: 1;
  display: grid; place-items: center;
  cursor: pointer; touch-action: manipulation;
}
.icon-btn:active { transform: translateY(3px); }
.topbar .spacer { flex: 0; }
.topbar h1 {
  font-size: 1.05rem; margin: 0; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.15);
  flex: 1; min-width: 0; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Modo Aventura: brújula al lado del título + borde animado en la pantalla. */
.topbar h1 .adv-badge { margin-left: 6px; font-size: 0.95em; }
body.adventure .topbar h1 { animation: adv-glow 2.2s ease-in-out infinite; }
@keyframes adv-glow {
  0%, 100% { text-shadow: 0 2px 0 rgba(0,0,0,0.15); }
  50% { text-shadow: 0 2px 0 rgba(0,0,0,0.15), 0 0 12px rgba(255,209,102,0.95); }
}

/* Botón claro de volver al menú (en cada juego) */
.btn-menu {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  border: none; border-radius: 999px; background: #fff; color: var(--ink);
  font: inherit; font-weight: 800; font-size: 0.85rem;
  padding: 9px 14px; box-shadow: var(--shadow); cursor: pointer; text-decoration: none;
  touch-action: manipulation;
}
.btn-menu:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.12); }

/* Bonus en el festejo: subida de nivel y medallas (compartido entre juegos) */
.bonus { margin: 0 0 14px; }
.bonus:empty { display: none; }
.lvl-up, .medal-win {
  font-weight: 800;
  border-radius: 14px;
  padding: 9px 12px;
  margin-top: 8px;
  animation: popin 0.4s ease;
}
.lvl-up { background: var(--purple); color: #2b1a55; }
.medal-win { background: var(--yellow); color: #5a4500; }

/* Brillo del botón de pista cuando el jugador está trabado (inactividad) */
.glow { animation: glow-pulse 1.05s ease-in-out infinite; }
@keyframes glow-pulse {
  0%, 100% { box-shadow: var(--shadow); transform: translateY(0) scale(1); }
  50% { box-shadow: 0 0 0 5px rgba(255, 209, 102, 0.7), var(--shadow); transform: translateY(-1px) scale(1.05); }
}
@keyframes popin {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
