/* ============================================================
   GAMIFICATION.CSS — Mobile-first XP HUD, all pages
   Pedro Ribeiro Portfolio 2026
   Uses tokens from css/tokens.css (loaded first in header.php)
   ============================================================ */

/* ---- Floating XP label ------------------------------------- */
.xp-float {
  position: fixed;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--c-gold);
  letter-spacing: 0.12em;
  text-shadow: 0 0 18px rgba(231,184,0,0.65);
  pointer-events: none;
  z-index: 99990;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ---- HUD wrapper ------------------------------------------- */
.g-hud {
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 9990;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s var(--ease-expo);
  pointer-events: none;
  font-family: var(--font-mono);
}

.g-hud.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

@keyframes hudPulse {
  0%   { box-shadow: 0 0 0 0   rgba(231,184,0,0.55); }
  60%  { box-shadow: 0 0 0 12px rgba(231,184,0,0);    }
  100% { box-shadow: 0 0 0 0   rgba(231,184,0,0);    }
}
.g-hud.pulse .g-hud-pill {
  animation: hudPulse 0.42s ease forwards;
}

/* ---- Pill (always visible) --------------------------------- */
.g-hud-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(8, 8, 8, 0.93);
  border: 1px solid rgba(231, 184, 0, 0.35);
  border-radius: 24px;
  padding: 8px 14px 8px 11px;
  cursor: pointer;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--c-grey-4);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: border-color 0.2s ease, background 0.2s ease;
  outline: none;
}

.g-hud-pill:hover,
.g-hud.expanded .g-hud-pill {
  border-color: rgba(231, 184, 0, 0.7);
  background: rgba(8, 8, 8, 0.99);
}

.g-pill-icon   { color: var(--c-gold); font-size: 13px; line-height: 1; }
.g-pill-lvl    { color: var(--c-gold); font-weight: 700; font-size: 10px; }
.g-pill-sep    { color: rgba(192, 189, 182, 0.35); font-size: 9px; }
.g-pill-xp     { color: var(--c-off-white); font-size: 10px; }
.g-pill-caret  {
  color: rgba(192, 189, 182, 0.45);
  font-size: 8px;
  transition: transform 0.25s ease;
  margin-left: 2px;
}
.g-hud.expanded .g-pill-caret { transform: rotate(180deg); }

/* ---- Panel (slides up above pill) -------------------------- */
.g-hud-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  width: 228px;
  background: rgba(8, 8, 8, 0.98);
  border: 1px solid rgba(231, 184, 0, 0.2);
  border-radius: 8px;
  padding: 16px 18px 14px;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.22s var(--ease-expo);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.g-hud.expanded .g-hud-panel {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

.g-hud-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
}

.g-hud-icon {
  color: var(--c-gold);
  font-size: 12px;
  line-height: 1;
}

.g-hud-title {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #888;
  flex: 1;
}

.g-hud-status {
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-green);
}

/* Progress bar */
.g-hud-bar-wrap {
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  margin-bottom: 11px;
  overflow: hidden;
}

.g-hud-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--c-gold), #ffd700);
  border-radius: 2px;
  transition: width 0.8s var(--ease-expo);
}

/* Stats row */
.g-hud-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 13px;
}

.g-hud-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.g-hud-stat-val {
  font-size: 17px;
  font-weight: 700;
  color: var(--c-off-white);
  line-height: 1;
  transition: color 0.3s;
}

.g-hud-stat-key {
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #555;
}

/* Achievement slots */
.g-hud-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 11px;
}

.g-slot {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  color: transparent;
  transition: background 0.3s, border-color 0.3s, transform 0.3s var(--ease-expo);
}

.g-slot.earned {
  background: var(--c-gold);
  border-color: var(--c-gold);
  color: var(--c-black);
  transform: scale(1.08);
}

/* Reset button */
.g-hud-reset {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(136, 136, 136, 0.4);
  padding: 0;
  transition: color 0.2s;
  display: block;
}

.g-hud-reset:hover { color: #888; }


/* ---- Combo display ----------------------------------------- */
.g-combo {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  font-family: var(--font-display);
  font-size: clamp(30px, 6vw, 68px);
  color: var(--c-gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  pointer-events: none;
  z-index: 99980;
  opacity: 0;
  text-shadow: 0 0 50px rgba(231, 184, 0, 0.45), 0 0 100px rgba(231, 184, 0, 0.2);
  transition: opacity 0.2s ease, transform 0.38s var(--ease-expo);
}

.g-combo.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}


/* ---- Toasts ----------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 76px;
  right: 14px;
  z-index: 9995;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  pointer-events: none;
  max-width: 240px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(10, 10, 10, 0.92);
  border: 1px solid rgba(231, 184, 0, 0.22);
  border-left: 2px solid var(--c-gold);
  padding: 8px 12px 8px 10px;
  border-radius: 3px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform: translateX(calc(100% + 20px));
  opacity: 0;
  transition: transform 0.45s var(--ease-expo), opacity 0.22s ease;
}

.toast.show {
  transform: translateX(0);
  opacity: 0.92;
}

.toast-icon { font-size: 14px; flex-shrink: 0; opacity: 0.8; }

.toast-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.toast-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-gold);
  opacity: 0.8;
}

.toast-name {
  display: block;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  color: #d8d4cb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-xp {
  display: block;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile: tiny single toast, only last-child visible */
@media (max-width: 640px) {
  .toast-container {
    bottom: 80px;
    right: 10px;
    max-width: 190px;
  }
  .toast-container .toast:not(:last-child) { display: none; }
  .toast { padding: 6px 9px; gap: 7px; }
  .toast-icon { font-size: 12px; }
  .toast-name { font-size: 10px; }
  .g-hud { right: 12px; bottom: 16px; }
}


/* ---- Konami flash ------------------------------------------ */
.konami-flash {
  position: fixed;
  inset: 0;
  background: var(--c-gold);
  pointer-events: none;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.1s ease;
}
.konami-flash.active { opacity: 0.2; }
