:root {
  --ach-border-color: #fff;
  --ach-bg-color: #fff;
  --rarity-common: #1eff00;    /* Green */
  --rarity-rare: #0070dd;      /* Blue */
  --rarity-epic: #a335ee;      /* Purple */ 
  --rarity-legendary: #ffffff; /* Gold */
  --rarity-cheater: #ff0000;
  --rarity-bg-common: #1eff0040;    /* Transp Green */
  --rarity-bg-rare: #0070dd40;      /* Transp Blue */
  --rarity-bg-epic: #a335ee40;      /* Transp Purple */ 
  --rarity-bg-legendary: #ffbf00; /* Slightly Dehydrated Piss */
  --rarity-bg-cheater: #ff000040;
}

#achievement-overlay {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  right: 1rem;
  top: 1rem;
  max-width: 100%;
}

@media (max-width: 600px) {
  #achievement-overlay {
    right: 0;
    left: 0;
    top: auto;
    bottom: 0;
    align-items: center;
  }
}

.ach-popup {
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  background-color: rgba(17, 17, 17, 0.4);
  color: white;
  padding: 1rem;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  position: relative;
  width: 300px;
  max-width: 90vw;
  animation: fadeIn 0.3s ease-out;
}

.ach-popup-icon {
  width: 64px;
  height: 64px;
  display: block;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.ach-popup-text {
  flex-grow: 1;
}

.ach-popup-title {
  font-weight: bold;
  margin-bottom: 4px;
}

.ach-popup-close {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 1.2rem;
  color: #aaa;
  cursor: pointer;
}

#achievement-sidebar {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 9998;
}

#achievement-dropdown-toggle {
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  background-color: rgba(17, 17, 17, 0.4);
  color: white;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

#achievement-dropdown-content {
  display: flex;
  flex-direction: column;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  background-color: rgba(17, 17, 17, 0.4);
  padding: 0.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  max-height: 400px;
  overflow-y: auto;
}

#achievement-dropdown-content::-webkit-scrollbar {
  width: 6px;
}
#achievement-dropdown-content::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 6px;
}
#achievement-dropdown-content::-webkit-scrollbar-thumb:hover {
  background-color: #888;
}

.ach-sidebar-icon {
  position: relative;
  cursor: pointer;
}

.ach-sidebar-icon-img { 
  width: 32px;
  height: 32px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.ach-tooltip {
  position: absolute;
  left: 0;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  background-color: rgba(17, 17, 17, 1);
  color: white;
  padding: 1rem;
  border-radius: 10px;
  width: 220px;
  z-index: 10000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.ach-tooltip-large {
  width: 128px;
  height: 128px;
  display: block;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.ach-tooltip-title {
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.ach-tooltip-desc {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.ach-tooltip-time {
  font-size: 0.75rem;
  color: #ccc;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.ach-tooltip-large,
.ach-sidebar-icon-img, .ach-popup-icon {
  transition: transform 0.15s ease;
  transform-style: preserve-3d;
  will-change: transform;
  backface-visibility: hidden;
}

.ach-popup .ach-border-animated {
    background-color: var(--ach-bg-color);
    border: 1px solid transparent;
    border-radius: 12px;
    height: 64px;
    margin-bottom: 10px;
    overflow: hidden;
    padding: 4px 4px;
    position: relative;
    width: 64px;
    z-index: 1;
    display: inline-block;   
}

.ach-sidebar-icon .ach-border-animated {
    background-color: var(--ach-bg-color);
    border: 1px solid transparent;
    border-radius: 12px;
    height: 32px;
    margin-bottom: 10px;
    overflow: hidden;
    padding: 4px 4px;
    position: relative;
    width: 32px;
    z-index: 1;
    display: inline-block;   
}

.ach-tooltip .ach-border-animated {
    background-color: var(--ach-bg-color);
    border: 1px solid transparent;
    border-radius: 12px;
    height: 128px;
    margin-bottom: 10px;
    overflow: hidden;
    padding: 4px 4px;
    position: relative;
    width: 128px;
    z-index: 1;
    display: inline-block;
}

.ach-border-animated::before {
    -webkit-animation-duration: 11.369s;
    animation-duration: 11.369s;
    -webkit-animation-iteration-count: infinite;
    animation-iteration-count: infinite;
    -webkit-animation-name: ach-border;
    animation-name: ach-border;
    -webkit-animation-timing-function: linear;
    animation-timing-function: linear;
    background: repeating-conic-gradient(transparent,var(--ach-border-color) 50deg,transparent 22.5deg,transparent 90deg);
    bottom: 0;
    content: "";
    display: inline-block;
    -webkit-filter: blur(5px);
    filter: blur(5px);
    position: absolute;
    right: 0;
    top: 0;
    left: 0;
}

.tooltip-close-btn {
  position: absolute;
  top: 4px;
  right: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 18px;
  user-select: none;
  color: #aaa;
  transition: color 0.2s ease;
  z-index: 1000;
}

.tooltip-close-btn:hover {
  color: #444;
}


.rarity-common    { --ach-border-color: var(--rarity-common); --ach-bg-color: var(--rarity-bg-common); }
.rarity-rare      { --ach-border-color: var(--rarity-rare); --ach-bg-color: var(--rarity-bg-rare); }
.rarity-epic      { --ach-border-color: var(--rarity-epic); --ach-bg-color: var(--rarity-bg-epic); }
.rarity-legendary { --ach-border-color: var(--rarity-legendary); --ach-bg-color: var(--rarity-bg-legendary); }
.rarity-cheater { --ach-border-color: var(--rarity-cheater); --ach-bg-color: var(--rarity-bg-cheater); }

@keyframes ach-border {
  0% {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg)
    }

    to {
        -webkit-transform: rotate(1turn);
        transform: rotate(1turn)
    }
}

@keyframes spinHeadOut {
  0% { opacity: 1; transform: rotate(0deg) scale(1); }
  100% { opacity: 0; transform: rotate(360deg) scale(0.8); }
}

@keyframes spinHeadIn {
  0% { opacity: 0; transform: rotate(0deg) scale(0.8); }
  100% { opacity: 1; transform: rotate(360deg) scale(1); }
}

.spin-out {
  animation: spinHeadOut 0.4s ease forwards;
}

.spin-in {
  animation: spinHeadIn 0.4s ease forwards;
}