/* =========================================================
   Zona de juegos 2026 — usa las variables de styles.css
   ========================================================= */

[hidden] { display: none !important; }

.games {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Pestañas para elegir juego ---------- */
.game-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.game-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 143, 183, 0.35);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.game-tab img {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(255, 111, 155, 0.35);
}

.game-tab strong { display: block; font-size: 14px; }
.game-tab small { display: block; font-size: 11px; color: var(--text-soft); }

.game-tab:hover { transform: translateY(-2px); }

.game-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 25px rgba(255, 111, 155, 0.4);
}

.game-tab.active small { color: rgba(255, 255, 255, 0.9); }

/* ---------- Tarjeta del juego ---------- */
.game-panel {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 143, 183, 0.18);
  padding: 20px;
}

.game-head h3 { font-size: 18px; margin: 2px 0 4px; }
.game-head p { font-size: 13px; color: var(--text-soft); line-height: 1.6; }

.game-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 14px 0;
}

.hud-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #fff3f8;
  font-size: 12px;
  color: var(--text-soft);
}

.hud-item strong {
  font-size: 15px;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-soft);
  cursor: pointer;
}

.toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-dark);
}

/* ---------- Escenario (canvas + pantallas) ---------- */
.game-play { scroll-margin-top: 80px; }

.game-stage {
  position: relative;
  width: min(100%, 520px);
  margin: 0 auto;
}

.game-stage.tall { width: min(100%, 400px); }

.game-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: #fff0f6;
  box-shadow: inset 0 0 0 1px rgba(255, 143, 183, 0.3), 0 10px 25px rgba(255, 111, 155, 0.18);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.game-stage.tall .game-canvas { aspect-ratio: 3 / 4; }

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 245, 248, 0.86);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  text-align: center;
  animation: overlayIn 0.25s ease;
}

@keyframes overlayIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

.overlay-card { max-width: 320px; }

.overlay-face {
  width: 84px;
  height: 84px;
  margin-bottom: 10px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 10px 25px rgba(255, 111, 155, 0.45);
}

.overlay-card h3 {
  font-size: 19px;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.overlay-card p {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
  margin-bottom: 14px;
}

.overlay-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* ---------- Controles táctiles ---------- */
.game-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(2, 54px);
  grid-template-areas: ". up ." "left down right";
  gap: 6px;
}

.dpad [data-dir="up"]    { grid-area: up; }
.dpad [data-dir="left"]  { grid-area: left; }
.dpad [data-dir="down"]  { grid-area: down; }
.dpad [data-dir="right"] { grid-area: right; }

.dpad button,
.hold-btn {
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffe0ee, #ffc2d8);
  color: var(--primary-dark);
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(255, 111, 155, 0.25);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.08s ease, background 0.15s ease;
}

.dpad button:active,
.hold-btn:active {
  transform: scale(0.93);
  background: var(--primary);
  color: #fff;
}

.hold-btn {
  width: 96px;
  height: 58px;
  font-size: 24px;
}

.game-help {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-soft);
}

/* En computadora (mouse + teclado) escondemos los botones táctiles */
@media (hover: hover) and (pointer: fine) {
  .touch-only { display: none !important; }
}

@media (max-width: 600px) {
  .game-tabs { gap: 8px; }
  .game-tab {
    flex-direction: column;
    gap: 6px;
    padding: 10px 6px;
    text-align: center;
  }
  .game-tab small { display: none; }
  .game-tab strong { font-size: 12px; }
}

@media (max-width: 480px) {
  .game-panel { padding: 16px 12px; }
  .hud-item { padding: 5px 10px; }
}
