/* Optimizaciones para tablets */
html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: Arial, sans-serif;
  background: #f0f4fa;
  color: #222;
  text-align: center;
  margin: 0;
  padding: 1em;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

/* Layout de controles del juego */
.game-controls {
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  align-items: center;
  margin: 1em auto;
  max-width: 1200px;
}

.game-controls__buttons {
  display: flex;
  gap: 1em;
  justify-content: center;
  flex-wrap: wrap;
}

.game-controls__settings {
  display: flex;
  gap: 1.5em;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 1em;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* Mejorar aspecto de selects para tablets */
select {
  font-size: 1.1rem;
  padding: 0.5em 1em;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: white;
  cursor: pointer;
  min-width: 120px;
} para tablets y dispositivos táctiles */
html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: Arial, sans-serif;
  background: #f0f4fa;
  color: #222;
  text-align: center;
  margin: 0;
  padding: 1em;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

/* Botones globales básicos (otros botones no relacionados seguirán estilos neutros) */
button {
  margin: 0.6em;
  padding: 0.8em 1.2em;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: #e6eefc;
  color: #0f172a;
  cursor: pointer;
}

/* Estilo consistente para botones de juego optimizado para tablets */
.game-btn {
  color: #ffffff;
  padding: 1.4em 2.8em; /* tamaño optimizado para touch */
  font-size: 1.4rem; /* texto más legible en tablets */
  border-radius: 16px;
  border: none;
  margin: 0.8em;
  min-width: 160px; /* asegurar área táctil mínima */
  min-height: 60px; /* altura mínima para mejor toque */
  transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.12s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  will-change: transform; /* optimizar animaciones */
}

/* Start = verde */
#startBtn,
#startMelodyBtn {
  background: #22c55e;
  box-shadow: 0 6px 14px rgba(34,197,94,0.14);
}
#startBtn:hover,
#startMelodyBtn:hover { background: #16a34a; box-shadow: 0 8px 18px rgba(22,163,74,0.14); transform: translateY(-1px); }
#startBtn:active,
#startMelodyBtn:active { transform: translateY(1px) scale(0.995); }
#startBtn:focus,
#startMelodyBtn:focus { outline: 3px solid rgba(34,197,94,0.18); outline-offset: 2px; }

/* Pause = ámbar */
#pauseBtn {
  background: #f59e0b;
  box-shadow: 0 6px 14px rgba(245,158,11,0.12);
}
#pauseBtn:hover { background: #d97706; box-shadow: 0 8px 18px rgba(217,119,6,0.12); transform: translateY(-1px); }
#pauseBtn:active { transform: translateY(1px) scale(0.995); }
#pauseBtn:focus { outline: 3px solid rgba(245,158,11,0.16); outline-offset: 2px; }

/* Restart = rojo */
#restartBtn {
  background: #ef4444;
  box-shadow: 0 6px 14px rgba(239,68,68,0.12);
}
#restartBtn:hover { background: #dc2626; box-shadow: 0 8px 18px rgba(220,38,38,0.12); transform: translateY(-1px); }
#restartBtn:active { transform: translateY(1px) scale(0.995); }
#restartBtn:focus { outline: 3px solid rgba(239,68,68,0.14); outline-offset: 2px; }

#resultado {
  margin-top: 2em;
  font-size: 1.3em;
  font-weight: bold;
}

/* Utilidad para botones secundarios si se necesita */
.btn-secondary {
  background: #475569;
  color: #fff;
}

.activity-grid {
  max-width: 900px;
  margin: 24px auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  text-align: left;
}

.activity-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, outline-color 0.18s ease;
  outline: 2px solid transparent;
  outline-offset: 4px;
}

.activity-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.16);
}

.activity-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
  outline-color: #2563eb;
}

.activity-card:active {
  transform: translateY(0);
  box-shadow: 0 3px 12px rgba(37, 99, 235, 0.18);
}

.activity-card h2 {
  margin: 0 0 8px;
}

.activity-card p {
  margin: 0 0 8px;
  color: #475569;
}

.activity-card small {
  color: #64748b;
  font-size: 0.85rem;
}

.activity-card--placeholder {
  background: #f1f5f9;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.4);
  color: #475569;
  cursor: default;
}

.activity-card--placeholder:hover,
.activity-card--placeholder:focus-visible,
.activity-card--placeholder:active {
  transform: none;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.5);
  outline-color: transparent;
}

.lang-switch {
  margin: 8px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #334155;
}

.lang-switch select {
  margin-left: 2px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  font-weight: 500;
}

.lang-switch select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #8c8c8e;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.home-link:hover,
.home-link:focus-visible {
  background: #757677;
  box-shadow: 0 0 0 3px rgba(145, 145, 146, 0.25);
}

.home-link:focus-visible {
  outline: none;
}

.home-icon {
  font-size: 1.95em;
  opacity: 0.8;
}

.btn-secondary.home-link {
  background: #475569;
  color: #fff;
}

.btn-secondary.home-link:hover,
.btn-secondary.home-link:focus-visible {
  background: #334155;
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.35);
}

.page-footer {
  margin-top: 24px;
  color: #64748b;
  font-size: 12px;
}

.sw-update-btn {
  margin-left: 12px;
  display: none;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #fff;
  transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

.sw-update-btn:hover,
.sw-update-btn:focus-visible {
  background: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
  outline: none;
}

.sfx-controls {
  position: fixed;
  right: 16px;
  bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.25);
  display: grid;
  gap: 10px;
  z-index: 1200;
  max-width: min(280px, 90vw);
  font-size: 0.95rem;
}

.sfx-controls__title {
  font-weight: 700;
  font-size: 1rem;
}

.sfx-controls__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sfx-controls__row input[type="range"] {
  flex: 1 1 auto;
}

.sfx-controls__row--mute {
  justify-content: flex-start;
  gap: 8px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .sfx-controls {
    right: 12px;
    bottom: 12px;
    padding: 10px 12px;
  }
}
