/* ==========================================================================
   ACHIEVEMENT TOAST SYSTEM
   ========================================================================== */
.achievement-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9900;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  min-width: 280px;
  max-width: 380px;
  background: rgba(10, 10, 14, 0.88);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(var(--accent-rgb, 255, 51, 51), 0.35);
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), inset 0 0 30px rgba(0,0,0,0.3);
  transform: translateY(120%) translateX(0);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  pointer-events: none;
  font-family: 'Inter', sans-serif;
  cursor:none;
}

.achievement-toast-visible {
  transform: translateY(0) translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.achievement-toast-exit {
  transform: translateY(120%) translateX(0);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.55, 0, 1, 0.45), opacity 0.35s ease;
}

.achievement-toast-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.achievement-toast-content {
  flex: 1;
  min-width: 0;
}

.achievement-toast-label {
  font-size: 0.55rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 3px;
  opacity: 0.85;
}

.achievement-toast-title {
  font-size: 0.95rem;
  font-weight: 300;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 2px;
}

.achievement-toast-desc {
  font-size: 0.72rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
}

/* Border now uses var(--accent-rgb) automatically — no per-page overrides needed */

/* Mobile adjustments */
@media (max-width: 600px) {
  .achievement-toast {
    bottom: 16px;
    right: 12px;
    left: 12px;
    max-width: none;
    min-width: 0;
    padding: 14px 16px;
    gap: 12px;
  }
  .achievement-toast-icon {
    font-size: 1.3rem;
    width: 34px;
    height: 34px;
  }
  .achievement-toast-title { font-size: 0.88rem; }
  .achievement-toast-desc { font-size: 0.68rem; }
}

/* Reduced motion: no slide, just appear/disappear */
@media (prefers-reduced-motion: reduce) {
  .achievement-toast {
    transition: opacity 0.2s ease !important;
    transform: translateY(0) !important;
  }
  .achievement-toast-exit {
    transition: opacity 0.2s ease !important;
    transform: translateY(0) !important;
  }
}

/* ==========================================================================
   ACHIEVEMENT CARD — TEASER / LOCKED PREVIEW STATE
   ========================================================================== */
/* Teaser: subtle hover lift on locked cards (does NOT reveal title) */
.achievement-card.locked {
  opacity: 0.78 !important;
  filter: grayscale(0.85) brightness(0.82) !important;
  border-style: dashed !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  background: rgba(255, 255, 255, 0.018) !important;
  transition: opacity 0.4s ease, filter 0.4s ease, transform 0.3s ease, border-color 0.4s ease, box-shadow 0.4s ease !important;
}

.achievement-card.locked:hover {
  opacity: 0.92 !important;
  filter: grayscale(0.6) brightness(0.92) !important;
  border-color: rgba(var(--accent-rgb, 255, 51, 51), 0.22) !important;
  box-shadow: 0 0 18px rgba(var(--accent-rgb, 255, 51, 51), 0.08), inset 0 0 18px rgba(var(--accent-rgb, 255, 51, 51), 0.02) !important;
  transform: translateY(-3px) !important;
}

/* Silhouetted icon */
.achievement-card.locked .achievement-icon {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.08);
  position: relative;
}

.achievement-card.locked .achievement-icon svg {
  opacity: 0.32;
  stroke: rgba(255, 255, 255, 0.55);
  filter: blur(0.4px);
  transition: opacity 0.4s ease, filter 0.4s ease;
}

.achievement-card.locked:hover .achievement-icon svg {
  opacity: 0.48;
  filter: blur(0px);
}

/* Mysterious glyph behind the silhouette */
.achievement-card.locked .achievement-icon::after {
  content: '?';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.05em;
  pointer-events: none;
}

/* Redacted title ("???" with blur shimmer) */
.achievement-card.locked .achievement-name {
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.24em;
  font-size: 0.85rem;
  filter: blur(0.5px);
  transition: letter-spacing 0.4s ease, filter 0.4s ease;
}

.achievement-card.locked:hover .achievement-name {
  letter-spacing: 0.32em;
}

/* Hide the real description on locked cards — hint takes its place */
.achievement-card.locked .achievement-desc {
  display: none;
}

/* Cryptic hint — the riddle */
.achievement-card.locked .achievement-cryptic {
  display: block;
  font-size: 0.73rem;
  font-weight: 300;
  font-style: italic;
  color: rgba(255, 215, 0, 0.55);
  line-height: 1.6;
  margin: 0 0 14px;
  padding: 10px 14px;
  background: rgba(255, 215, 0, 0.025);
  border: 1px dashed rgba(255, 215, 0, 0.18);
  border-radius: 6px;
  letter-spacing: 0.01em;
  transition: color 0.4s ease, background 0.4s ease, border-color 0.4s ease;
}

.achievement-card.locked:hover .achievement-cryptic {
  color: rgba(255, 215, 0, 0.78);
  background: rgba(255, 215, 0, 0.045);
  border-color: rgba(255, 215, 0, 0.32);
}

/* Hide cryptic on earned cards */
.achievement-card.unlocked .achievement-cryptic,
.achievement-card:not(.locked) .achievement-cryptic {
  display: none;
}

/* LOCKED badge — subtle, ceremonial */
.achievement-card.locked .achievement-status {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.55);
}

/* Hide the bare "locked" hint block from the earlier implementation when locked
   — we replace with .achievement-cryptic */
.achievement-card.locked .achievement-hint {
  display: none;
}

/* Reduced motion: strip transforms on hover */
@media (prefers-reduced-motion: reduce) {
  .achievement-card.locked,
  .achievement-card.locked:hover {
    transition: opacity 0.2s ease, filter 0.2s ease !important;
    transform: none !important;
  }
  .achievement-card.locked .achievement-name,
  .achievement-card.locked .achievement-icon svg,
  .achievement-card.locked .achievement-cryptic {
    transition: none !important;
  }
}

/* ==========================================================================
   ACHIEVEMENT RARITY — PERCENTAGE + TIER LABEL
   ========================================================================== */
.achievement-rarity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 0.58rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  color: rgba(255, 255, 255, 0.72);
  transition: opacity 0.4s ease, border-color 0.4s ease, background 0.4s ease;
}

.achievement-rarity-percent {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 400;
  letter-spacing: 0.1em;
}

.achievement-rarity-sep {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  margin: 0 2px;
  flex-shrink: 0;
}

.achievement-rarity-tier {
  font-weight: 500;
  letter-spacing: 0.18em;
  /* tier color applied inline via --tier-color */
  color: var(--tier-color, rgba(255, 255, 255, 0.72));
  text-shadow: 0 0 8px color-mix(in srgb, var(--tier-color, transparent) 35%, transparent);
}

/* Tone rarity down on locked cards — still visible but subdued */
.achievement-card.locked .achievement-rarity {
  opacity: 0.72;
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.015);
}

.achievement-card.locked:hover .achievement-rarity {
  opacity: 0.92;
  border-color: rgba(255, 255, 255, 0.12);
}

/* Tier-specific outer glow on unlocked cards (accent feel without noise) */
.achievement-card.unlocked .achievement-rarity {
  border-color: color-mix(in srgb, var(--tier-color, rgba(255, 255, 255, 0.2)) 35%, rgba(255, 255, 255, 0.08));
  background: color-mix(in srgb, var(--tier-color, transparent) 5%, rgba(255, 255, 255, 0.02));
}

/* Mobile: slightly smaller */
@media (max-width: 600px) {
  .achievement-rarity {
    font-size: 0.54rem;
    padding: 4px 10px;
    gap: 6px;
  }
}

/* Reduced motion: remove transitions */
@media (prefers-reduced-motion: reduce) {
  .achievement-rarity {
    transition: none !important;
  }
}

/* ==========================================================================
   PINNED SHOWCASE — featured achievements (Task 4)
   ========================================================================== */
.pinned-showcase {
  max-width: 960px;
  margin: 0 auto 8px;
  padding: 0 16px;
  display: none; /* toggled on by JS when there are earned achievements */
}

.pinned-showcase.is-visible {
  display: block;
}

.pinned-showcase-header {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
  margin-bottom: 18px;
  text-align: center;
}

.pinned-showcase-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255, 215, 0, 0.78);
  margin: 0;
}

.pinned-showcase-sub {
  font-family: 'Inter', sans-serif;
  font-size: 0.62rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}

.pinned-showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.pinned-slot {
  position: relative;
  min-height: 230px;
  border-radius: 14px;
  padding: 26px 22px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 0.35s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}

/* Filled (pinned) slot — trophy card */
.pinned-slot.pinned-filled {
  background: linear-gradient(
    180deg,
    rgba(255, 215, 0, 0.055) 0%,
    rgba(255, 215, 0, 0.018) 60%,
    rgba(10, 10, 14, 0.6) 100%
  );
  border: 1px solid rgba(255, 215, 0, 0.42);
  box-shadow:
    0 0 26px rgba(255, 215, 0, 0.14),
    0 10px 36px rgba(0, 0, 0, 0.45),
    inset 0 0 30px rgba(255, 215, 0, 0.035);
  cursor:none;
}

.pinned-slot.pinned-filled:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 215, 0, 0.62);
  box-shadow:
    0 0 34px rgba(255, 215, 0, 0.22),
    0 14px 44px rgba(0, 0, 0, 0.5),
    inset 0 0 36px rgba(255, 215, 0, 0.05);
}

.pinned-slot-corner {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  background: rgba(255, 215, 0, 0.085);
  border: 1px solid rgba(255, 215, 0, 0.42);
  border-radius: 999px;
  font-size: 0.52rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 215, 0, 0.92);
}

.pinned-slot-corner svg {
  width: 10px;
  height: 10px;
  stroke: rgba(255, 215, 0, 0.92);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pinned-slot-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.48);
  box-shadow: 0 0 22px rgba(255, 215, 0, 0.22);
}

.pinned-slot-icon svg {
  width: 26px;
  height: 26px;
  stroke: #ffd700;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pinned-slot-name {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 300;
  color: #fff;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.pinned-slot-date {
  font-family: 'Inter', sans-serif;
  font-size: 0.62rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: rgba(255, 215, 0, 0.7);
  margin-bottom: 10px;
}

.pinned-slot .achievement-rarity {
  margin-top: 4px;
}

/* Empty (placeholder) slot */
.pinned-slot.pinned-empty {
  background: rgba(255, 255, 255, 0.012);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.35);
}

.pinned-slot-empty-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.pinned-slot-empty-icon svg {
  width: 100%;
  height: 100%;
  stroke: rgba(255, 215, 0, 0.35);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pinned-slot-empty-text {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.42);
  line-height: 1.5;
  letter-spacing: 0.04em;
  max-width: 160px;
}

/* ==========================================================================
   PIN BUTTON on main-grid earned cards
   ========================================================================== */
.achievement-pin-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor:none;
  padding: 0;
  color: rgba(255, 255, 255, 0.55);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
  z-index: 6;
}

.achievement-pin-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: fill 0.3s ease;
}

.achievement-pin-btn:hover {
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.45);
  color: #ffd700;
  transform: translateY(-1px);
}

.achievement-pin-btn.is-pinned {
  background: rgba(255, 215, 0, 0.18);
  border-color: rgba(255, 215, 0, 0.7);
  color: #ffd700;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.28);
}

.achievement-pin-btn.is-pinned svg {
  fill: rgba(255, 215, 0, 0.85);
}

.achievement-pin-btn.refuse-bounce {
  animation: pinRefuseBounce 0.5s ease;
}

@keyframes pinRefuseBounce {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-4px); }
  50%  { transform: translateX(4px); }
  75%  { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

/* Pin toast — reuses achievement toast visual language, lighter */
.pin-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 120%);
  z-index: 9900;
  padding: 12px 20px;
  background: rgba(10, 10, 14, 0.94);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.92);
  font-family: 'Inter', sans-serif;
  font-size: 0.76rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.pin-toast.pin-toast-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* Responsive: stack pinned cards vertically on narrow screens */
@media (max-width: 720px) {
  .pinned-showcase-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .pinned-slot {
    min-height: 200px;
  }
  .pinned-showcase-header {
    flex-direction: column;
    gap: 4px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .pinned-slot,
  .pinned-slot.pinned-filled:hover,
  .achievement-pin-btn,
  .achievement-pin-btn:hover {
    transition: none !important;
    transform: none !important;
  }
  .achievement-pin-btn.refuse-bounce {
    animation: none !important;
  }
  .pin-toast {
    transition: opacity 0.2s ease !important;
    transform: translate(-50%, 0) !important;
  }
  .pin-toast.pin-toast-visible {
    transform: translate(-50%, 0) !important;
  }
}
