/* ═══════════════════════════════════════════════════════════════════════════
   ACHIEVEMENTS — HUD button, toast notifications, viewer modal
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── HUD Button ───────────────────────────────────────────────────────── */

#ach-hud-btn {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  color: var(--neon-yellow);
  background: transparent;
  border: 1px solid var(--neon-yellow);
  padding: 5px 10px;
  cursor: none;
  letter-spacing: 1px;
  text-shadow: 0 0 6px var(--neon-yellow);
  box-shadow: 0 0 8px var(--neon-yellow);
  transition:
    background 0.2s,
    box-shadow 0.2s;
  white-space: nowrap;
}
#ach-hud-btn:hover {
  background: rgba(255, 230, 0, 0.12);
  box-shadow:
    0 0 16px var(--neon-yellow),
    inset 0 0 8px rgba(255, 230, 0, 0.15);
}
#ach-hud-btn.ach-btn-complete {
  color: #fff;
  border-color: #fff;
  text-shadow:
    0 0 10px #fff,
    0 0 20px var(--neon-yellow);
  box-shadow: 0 0 18px var(--neon-yellow);
  animation: achBtnPulse 2s ease-in-out infinite;
}
@keyframes achBtnPulse {
  0%,
  100% {
    box-shadow: 0 0 12px var(--neon-yellow);
  }
  50% {
    box-shadow:
      0 0 28px var(--neon-yellow),
      0 0 48px rgba(255, 230, 0, 0.4);
  }
}

/* ── Toast Notification ───────────────────────────────────────────────── */

.ach-toast {
  position: fixed;
  bottom: 100px;
  right: -380px; /* starts off-screen */
  width: 340px;
  background: rgba(5, 0, 20, 0.96);
  border: 2px solid var(--neon-yellow);
  box-shadow:
    0 0 16px var(--neon-yellow),
    0 0 40px rgba(255, 230, 0, 0.25),
    inset 0 0 20px rgba(255, 230, 0, 0.05);
  z-index: 99000;
  pointer-events: none;
  transition: right 0.45s cubic-bezier(0.22, 1, 0.36, 1);

  /* Scanline texture overlay */
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.25) 2px,
    rgba(0, 0, 0, 0.25) 4px
  );
}
.ach-toast.ach-toast-in {
  right: 18px;
}
.ach-toast.ach-toast-out {
  right: -380px;
  transition: right 0.4s cubic-bezier(0.55, 0, 1, 0.45);
}

/* Rarity glow overrides */
.ach-toast.ach-rarity-common {
  border-color: var(--neon-cyan);
  box-shadow:
    0 0 16px var(--neon-cyan),
    inset 0 0 20px rgba(0, 245, 255, 0.04);
}
.ach-toast.ach-rarity-uncommon {
  border-color: var(--neon-green);
  box-shadow:
    0 0 16px var(--neon-green),
    inset 0 0 20px rgba(57, 255, 20, 0.04);
}
.ach-toast.ach-rarity-rare {
  border-color: var(--neon-pink);
  box-shadow:
    0 0 16px var(--neon-pink),
    inset 0 0 20px rgba(255, 45, 120, 0.06);
}
.ach-toast.ach-rarity-legendary {
  border-color: var(--neon-yellow);
  box-shadow:
    0 0 24px var(--neon-yellow),
    0 0 60px rgba(255, 230, 0, 0.3),
    inset 0 0 25px rgba(255, 230, 0, 0.07);
  animation: legendaryToastGlow 1.4s ease-in-out infinite;
}
@keyframes legendaryToastGlow {
  0%,
  100% {
    box-shadow:
      0 0 24px var(--neon-yellow),
      0 0 60px rgba(255, 230, 0, 0.3);
  }
  50% {
    box-shadow:
      0 0 40px var(--neon-yellow),
      0 0 90px rgba(255, 230, 0, 0.5);
  }
}

.ach-toast-header {
  padding: 7px 12px 5px;
  background: rgba(255, 230, 0, 0.08);
  border-bottom: 1px solid rgba(255, 230, 0, 0.3);
  text-align: center;
}
.ach-rarity-common .ach-toast-header {
  background: rgba(0, 245, 255, 0.08);
  border-bottom-color: rgba(0, 245, 255, 0.3);
}
.ach-rarity-uncommon .ach-toast-header {
  background: rgba(57, 255, 20, 0.08);
  border-bottom-color: rgba(57, 255, 20, 0.3);
}
.ach-rarity-rare .ach-toast-header {
  background: rgba(255, 45, 120, 0.08);
  border-bottom-color: rgba(255, 45, 120, 0.3);
}

.ach-toast-header-text {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px var(--neon-yellow);
  letter-spacing: 1px;
}
.ach-rarity-common .ach-toast-header-text {
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
}
.ach-rarity-uncommon .ach-toast-header-text {
  color: var(--neon-green);
  text-shadow: 0 0 8px var(--neon-green);
}
.ach-rarity-rare .ach-toast-header-text {
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--neon-pink);
}

.ach-toast-body {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
}
.ach-toast-icon {
  font-size: 38px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(255, 230, 0, 0.7));
  animation: achIconBounce 0.6s ease-out;
}
@keyframes achIconBounce {
  0% {
    transform: scale(0.4) rotate(-15deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.2) rotate(5deg);
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}
.ach-toast-info {
  flex: 1;
  min-width: 0;
}
.ach-toast-title {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px var(--neon-yellow);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ach-rarity-common .ach-toast-title {
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
}
.ach-rarity-uncommon .ach-toast-title {
  color: var(--neon-green);
  text-shadow: 0 0 8px var(--neon-green);
}
.ach-rarity-rare .ach-toast-title {
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--neon-pink);
}

.ach-toast-desc {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
}

/* Auto-drain progress bar */
.ach-toast-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.ach-toast-bar-fill {
  height: 100%;
  background: var(--neon-yellow);
  box-shadow: 0 0 6px var(--neon-yellow);
  animation: achBarDrain 3.5s linear forwards;
}
.ach-rarity-common .ach-toast-bar-fill {
  background: var(--neon-cyan);
  box-shadow: 0 0 6px var(--neon-cyan);
}
.ach-rarity-uncommon .ach-toast-bar-fill {
  background: var(--neon-green);
  box-shadow: 0 0 6px var(--neon-green);
}
.ach-rarity-rare .ach-toast-bar-fill {
  background: var(--neon-pink);
  box-shadow: 0 0 6px var(--neon-pink);
}
@keyframes achBarDrain {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

/* ── Viewer Modal Content ─────────────────────────────────────────────── */

/* Completion progress bar at the top of the viewer */
.ach-viewer-progress {
  margin-bottom: 18px;
}
.ach-viewer-progress-label {
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  color: var(--neon-yellow);
  text-shadow: 0 0 6px var(--neon-yellow);
  margin-bottom: 8px;
  text-align: center;
}
.ach-viewer-progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 230, 0, 0.3);
  overflow: hidden;
}
.ach-viewer-progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--neon-cyan) 0%,
    var(--neon-green) 50%,
    var(--neon-yellow) 100%
  );
  box-shadow: 0 0 10px var(--neon-yellow);
  transition: width 0.6s ease-out;
}

/* Achievement card grid */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.ach-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid;
  background: rgba(0, 0, 0, 0.4);
  position: relative;
  transition: box-shadow 0.2s;
}
.ach-card-done {
  border-color: rgba(255, 255, 255, 0.25);
}
.ach-card-done[data-rarity="common"] {
  border-color: rgba(0, 245, 255, 0.4);
}
.ach-card-done[data-rarity="uncommon"] {
  border-color: rgba(57, 255, 20, 0.4);
}
.ach-card-done[data-rarity="rare"] {
  border-color: rgba(255, 45, 120, 0.4);
}
.ach-card-done[data-rarity="legendary"] {
  border-color: rgba(255, 230, 0, 0.5);
  box-shadow: 0 0 12px rgba(255, 230, 0, 0.2);
  animation: legendaryCardPulse 2s ease-in-out infinite;
}

@keyframes legendaryCardPulse {
  0%,
  100% {
    box-shadow: 0 0 10px rgba(255, 230, 0, 0.2);
  }
  50% {
    box-shadow: 0 0 22px rgba(255, 230, 0, 0.45);
  }
}

.ach-card-locked {
  border-color: rgba(255, 255, 255, 0.08);
  opacity: 0.55;
  filter: grayscale(0.7);
}

.ach-card-icon {
  font-size: 30px;
  flex-shrink: 0;
  min-width: 36px;
  text-align: center;
}
.ach-card-locked .ach-card-icon {
  font-size: 28px;
  color: rgba(255, 255, 255, 0.3);
}
.ach-card-info {
  flex: 1;
  min-width: 0;
}
.ach-card-title {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ach-card-desc {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.4;
}
.ach-card-rarity {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  margin-top: 4px;
  opacity: 0.8;
  letter-spacing: 1px;
}
.ach-card-check {
  position: absolute;
  top: 6px;
  right: 8px;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  color: var(--neon-green);
  text-shadow: 0 0 6px var(--neon-green);
}
