/* ============================================================
   game.css — Modo Game (Fase 1)
   Todo namespaced bajo body.game-on, o como overlays.
   En modo Simple estos estilos no afectan nada.
   ============================================================ */

/* Espacio para el HUD fijo */
body.game-on { padding-top: 52px; }
body.game-on .nav { top: 52px; }

/* ---------- HUD ---------- */
.gm-hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  background: var(--dark); color: #fff; border-bottom: 2px solid var(--blue);
}
.gm-hud-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 14px; height: 52px;
  font-family: var(--font-mono);
}
.gm-level { font-size: .8rem; letter-spacing: .1em; white-space: nowrap; }
.gm-level b { color: var(--pink); }
.gm-xp { flex: 1; min-width: 110px; display: flex; flex-direction: column; gap: 3px; }
.gm-xp-bar { height: 10px; background: rgba(255,255,255,.12); border: 1px solid #3a4160; }
.gm-xp-fill { display: block; height: 100%; width: 0; background: var(--blue); transition: width .3s; }
.gm-xp-txt { font-size: .6rem; color: #9aa3ff; letter-spacing: .08em; }
.gm-core {
  font-family: var(--font-mono); font-size: .78rem; color: #fff; white-space: nowrap;
  background: rgba(31,46,255,.25); border: 1px solid var(--blue); cursor: pointer;
  padding: 6px 12px; transition: transform .08s, background .12s;
}
.gm-core:hover { background: rgba(31,46,255,.45); }
.gm-core:active { transform: scale(.94); }
.gm-hbtn {
  font-family: var(--font-mono); font-size: .72rem; color: #cfd4e6; white-space: nowrap;
  background: none; border: 1px solid #3a4160; cursor: pointer; padding: 6px 10px;
  transition: background .12s, color .12s, border-color .12s;
}
.gm-hbtn:hover { background: var(--pink); color: #fff; border-color: var(--pink); }

/* ---------- Botón flotante para entrar a Modo Game (visible en modo Simple) ---------- */
.gm-toggle {
  position: fixed; right: 16px; bottom: 16px; z-index: 250;
  font-family: var(--font-mono); font-size: .74rem; font-weight: 700; letter-spacing: .04em;
  background: var(--dark); color: #fff; border: 2px solid var(--blue);
  box-shadow: 3px 3px 0 var(--blue); cursor: pointer; padding: 10px 14px;
  transition: transform .12s, box-shadow .12s, background .12s;
}
.gm-toggle:hover { background: var(--blue); transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--blue); }

/* ---------- Banner bloqueado ---------- */
.game-on .project-banner.gm-locked .pb-media,
.game-on .project-banner.gm-locked .pb-body { filter: grayscale(1) brightness(.7); pointer-events: none; }
.game-on .project-banner.gm-locked .pb-title { color: transparent; }
.gm-lock {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(10,11,16,.55);
}
.gm-lock-ico { font-size: 2rem; }
.gm-unlock { background: var(--blue); color: #fff; border-color: var(--blue); font-size: .8rem; padding: 10px 18px; }
.gm-unlock:hover { background: var(--pink); border-color: var(--pink); }
.gm-lock.gm-shake { animation: gm-shake .4s; }
@keyframes gm-shake { 0%,100%{transform:none} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

/* ---------- Popup +XP ---------- */
.gm-pop {
  position: fixed; z-index: 400; transform: translate(-50%,0);
  font-family: var(--font-mono); font-weight: 700; font-size: .9rem; color: #fff;
  background: var(--pink); padding: 3px 9px; pointer-events: none;
  animation: gm-rise .9s ease-out forwards;
}
@keyframes gm-rise { 0%{opacity:0;transform:translate(-50%,6px)} 15%{opacity:1} 100%{opacity:0;transform:translate(-50%,-34px)} }

/* Aviso al intentar entrar a un proyecto bloqueado */
.gm-hint {
  position: fixed; z-index: 400; transform: translate(-50%,0);
  font-family: var(--font-mono); font-weight: 700; font-size: .74rem; color: #fff;
  background: var(--ink); border: 1px solid var(--blue); padding: 5px 10px; pointer-events: none;
  animation: gm-rise 1.1s ease-out forwards;
}

/* ============ FASE 2 ============ */

/* Emblema clicker (home, solo Modo Clicker) */
.gm-clicker-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 34px; }
.gm-clicker { background: none; border: 0; padding: 0; cursor: pointer; width: 280px; height: 280px; line-height: 0; transition: transform .12s ease, filter .15s ease; }
.gm-clicker svg { width: 100%; height: 100%; display: block; }
.gm-clicker .gm-ck-ring { transform-origin: 110px 110px; animation: gm-ck-spin 14s linear infinite; }
.gm-clicker .gm-ck-core { transform-origin: 110px 110px; animation: gm-ck-pulse 2.6s ease-in-out infinite; }
.gm-clicker:hover { transform: scale(1.06); filter: brightness(1.22) drop-shadow(0 0 16px rgba(31,46,255,.65)); }
.gm-clicker:active { transform: scale(.97); }
.gm-clicker:hover .gm-ck-ring { animation-duration: 6s; }
.gm-clicker-wrap:hover .gm-clicker-label { color: var(--pink); }
.gm-clicker.gm-punch .gm-ck-core { animation: gm-ck-punch .28s ease-out; }
@keyframes gm-ck-spin { to { transform: rotate(360deg); } }
@keyframes gm-ck-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes gm-ck-punch { 0% { transform: scale(1); } 40% { transform: scale(.9); } 100% { transform: scale(1); } }
.gm-clicker-label { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .28em; color: #7d87ff; text-transform: uppercase; }
.gm-clicker-sub { font-family: var(--font-mono); font-size: .8rem; color: #fff; }
.gm-clicker-sub b { color: var(--pink); }

/* Layout home Modo Clicker: menú a la izquierda, clicker a la derecha */
.game-on .hero-hint { display: none; }
.gm-hero-row { display: flex; align-items: center; justify-content: center; gap: 54px; flex-wrap: wrap; width: 100%; margin-top: 12px; }
.gm-hero-left { display: flex; flex-direction: column; align-items: flex-start; }
.gm-hero-left .game-menu { margin: 0; max-width: none; width: auto; }
.gm-hero-row .gm-clicker-wrap { margin-top: 0; }
@media (max-width: 720px) {
  .gm-hero-row { gap: 24px; }
  .gm-clicker { width: 210px; height: 210px; }
}

/* HUD: puntos como display + botones nuevos */
.gm-points-box { font-family: var(--font-mono); font-size: .78rem; color: #fff; white-space: nowrap; }
.gm-upgrade[disabled] { opacity: .5; cursor: default; }
.gm-upgrade.gm-shake { animation: gm-shake .4s; }

/* Toasts de logro */
.gm-toasts { position: fixed; top: 64px; right: 16px; z-index: 450; display: flex; flex-direction: column; gap: 8px; max-width: 300px; }
.gm-toast { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 2px solid var(--ink); border-left: 4px solid var(--blue); box-shadow: 4px 4px 0 var(--blue); padding: 10px 14px; animation: gm-toast-in .3s ease-out; }
.gm-toast.gm-out { animation: gm-toast-out .5s ease-in forwards; }
.gm-toast-ico { font-size: 1.4rem; }
.gm-toast-k { display: block; font-family: var(--font-mono); font-size: .58rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.gm-toast-n { display: block; font-family: var(--font-head); font-size: .92rem; text-transform: uppercase; color: var(--ink); }
.gm-toast-n b { color: var(--blue); }
@keyframes gm-toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes gm-toast-out { to { opacity: 0; transform: translateX(20px); } }

/* Panel de logros */
.gm-panel { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; background: rgba(10,11,16,.92); padding: 24px; }
.gm-panel-card { background: var(--paper); border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--blue); width: 100%; max-width: 640px; max-height: 82vh; display: flex; flex-direction: column; }
.gm-panel-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 2px solid var(--ink); font-family: var(--font-head); text-transform: uppercase; font-size: 1.2rem; }
.gm-panel-count { font-family: var(--font-mono); font-size: .8rem; color: var(--blue); }
.gm-panel-x { margin-left: auto; background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--ink); line-height: 1; }
.gm-panel-x:hover { color: var(--pink); }
.gm-panel-grid { padding: 16px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; overflow-y: auto; }
.gm-ach-card { display: flex; gap: 10px; border: 2px solid var(--ink); background: var(--panel); padding: 10px 12px; opacity: .85; }
.gm-ach-card.done { opacity: 1; box-shadow: 4px 4px 0 var(--blue); }
.gm-ach-ico { font-size: 1.3rem; font-style: normal; flex: none; }
.gm-ach-name { font-family: var(--font-head); font-size: .92rem; text-transform: uppercase; }
.gm-ach-desc { font-size: .76rem; color: var(--ink-2); }
.gm-ach-prog { font-family: var(--font-mono); font-size: .68rem; color: var(--muted); margin-top: 4px; }
.gm-ach-card.done .gm-ach-prog { color: var(--blue); }
.gm-ach-bar { height: 6px; background: var(--paper); border: 1px solid var(--line); margin-top: 6px; }
.gm-ach-bar i { display: block; height: 100%; background: var(--pink); }
@media (max-width: 560px) { .gm-panel-grid { grid-template-columns: 1fr; } }

/* ---------- Level up ---------- */
.gm-levelup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 400;
  font-family: var(--font-head); font-weight: 700; font-size: 2.4rem; color: #fff;
  text-shadow: 3px 3px 0 var(--blue); pointer-events: none; text-transform: uppercase;
  animation: gm-levelup 1.5s ease-out forwards;
}
@keyframes gm-levelup { 0%{opacity:0;transform:translate(-50%,-50%) scale(.6)} 20%{opacity:1;transform:translate(-50%,-50%) scale(1)} 80%{opacity:1} 100%{opacity:0;transform:translate(-50%,-62%) scale(1)} }

/* ---------- Overlays: entrada y 100% ---------- */
.gm-entry, .gm-win {
  position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center;
  background: rgba(10,11,16,.92); padding: 24px;
}
.gm-entry-card, .gm-win-card {
  background: var(--panel); border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--blue);
  padding: 36px 40px; max-width: 460px; text-align: center;
}
.gm-entry-kicker { font-family: var(--font-mono); color: var(--blue); letter-spacing: .16em; font-size: .74rem; text-transform: uppercase; }
.gm-entry-card h2, .gm-win-card h2 { font-family: var(--font-head); text-transform: uppercase; margin: 10px 0 22px; font-size: 2rem; }
.gm-entry-opts { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.gm-entry-simple, .gm-entry-game { font-size: .9rem; padding: 14px 22px; border-width: 2px; }
.gm-entry-simple { border-color: var(--ink); color: var(--ink); }
.gm-entry-simple:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.gm-entry-game { background: var(--blue); color: #fff; border-color: var(--blue); }
.gm-entry-game:hover { background: var(--pink); border-color: var(--pink); }
.gm-entry-hint { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); margin-top: 18px; line-height: 1.5; min-height: 2.6em; }
.gm-entry-note { font-family: var(--font-mono); font-size: .68rem; color: var(--blue); letter-spacing: .08em; margin-top: 6px; }
.gm-entry-note::before { content: "\00BB  "; color: var(--pink); }
.gm-win-card p { color: var(--ink-2); margin: 0 0 22px; }
.gm-win-close { font-size: .85rem; padding: 12px 20px; background: var(--blue); color: #fff; border-color: var(--blue); }

/* ============ FASE 3 ============ */

/* Botón de sonido del HUD: atenuado cuando está silenciado */
.gm-sound { line-height: 1; }
.gm-sound.gm-muted { opacity: .5; }
.gm-sound.gm-muted:hover { opacity: .8; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .gm-hud-inner { gap: 8px; padding: 0 12px; }
  .gm-switch { display: none; }
  .gm-level { font-size: .7rem; }
}
