/* ===========================================================
   Shared achievement toast (legitsauce.com)
   --------------------------------------------------------------
   One stylesheet for every game's bottom-right achievement box.
   Anchored to the viewport (NOT the game canvas) so it survives
   fullscreen toggles, canvas resizes, and engine swaps. Pure CSS
   — no per-game theming needed.

   Used by:
     window.LegitsauceAchievements.unlock({game, id, title, description})

   Brand reference: public/styles/main.css (cyan/violet/lime grad,
   #0a0a16 bg, Space Grotesk + Inter).
   =========================================================== */

.legitsauce-ach-stack {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 2147483600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.legitsauce-ach {
  --la-grad: linear-gradient(135deg, #00e5ff 0%, #7c5cff 55%, #a3ff3c 100%);
  position: relative;
  width: min(360px, calc(100vw - 24px));
  padding: 1px;
  border-radius: 14px;
  background: var(--la-grad);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(124, 92, 255, 0.28);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
  will-change: opacity, transform;
  overflow: hidden;
}
.legitsauce-ach.is-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.legitsauce-ach.is-out {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition-duration: 0.45s;
}

.legitsauce-ach-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #12122a;
  border-radius: 13px;
  padding: 10px 14px 12px;
}

.legitsauce-ach-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--la-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0a16;
}
.legitsauce-ach-icon svg { display: block; }

.legitsauce-ach-text {
  flex: 1 1 auto;
  min-width: 0;
}

.legitsauce-ach-eyebrow {
  font-size: 10px;
  letter-spacing: 0.2em;
  font-weight: 600;
  color: #00e5ff;
  line-height: 1;
  margin: 2px 0 6px;
  text-transform: uppercase;
}

.legitsauce-ach-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: #f5f5ff;
  line-height: 1.15;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legitsauce-ach-desc {
  font-size: 12px;
  color: #b5b5d4;
  line-height: 1.35;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legitsauce-ach-timer {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 3px;
  height: 1px;
  background: var(--la-grad);
  border-radius: 1px;
  opacity: 0.55;
  transform-origin: left center;
  animation: la-ach-timer var(--la-hold, 2.65s) linear forwards;
}
@keyframes la-ach-timer {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Small phones: tighten margins + drop title a touch so the box
   still fits on a 320px-wide screen without wrapping. */
@media (max-width: 480px) {
  .legitsauce-ach-stack {
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }
  .legitsauce-ach-inner { padding: 9px 12px 11px; gap: 10px; }
  .legitsauce-ach-icon { width: 38px; height: 38px; border-radius: 9px; }
  .legitsauce-ach-title { font-size: 16px; }
  .legitsauce-ach-eyebrow { font-size: 9px; letter-spacing: 0.22em; }
}

@media (prefers-reduced-motion: reduce) {
  .legitsauce-ach,
  .legitsauce-ach.is-in,
  .legitsauce-ach.is-out {
    transition: opacity 0.12s linear;
    transform: none;
  }
  .legitsauce-ach-timer { animation-duration: var(--la-hold, 2.65s); }
}
