/* Ranks + XP (triage #392): plaques, the sidebar rank block, the header XP
   bar, the "New rank" tab, the baby genie drag and the +XP floats. */

[data-brand-block][hidden], .hh-rank-block[hidden], .hh-xpbar[hidden] { display: none !important; }

.hh-rank-plaque { position: relative; display: block; }
.hh-rank-plaque > svg,
.hh-rank-plaque > img { position: relative; display: block; width: 100%; height: 100%; }
.hh-rank-aura {
  position: absolute; left: -25%; top: -60%; width: 150%; height: 175%;
  pointer-events: none;
}

/* Tier accent: bar fill, glows, labels */
.hh-rank-herald { --rank: #e0a070; --rank-2: #a8653c; }
.hh-rank-guardian { --rank: #dbe4ee; --rank-2: #8fa0b5; }
.hh-rank-crusader { --rank: #fcd34d; --rank-2: #d69e1c; }
.hh-rank-archon { --rank: #4ade80; --rank-2: #10b981; }
.hh-rank-legend { --rank: #7aa6ff; --rank-2: #3b6ff5; }
.hh-rank-ancient { --rank: #d0a4ff; --rank-2: #8b5cf6; }
.hh-rank-divine { --rank: #fff1a8; --rank-2: #f5b82e; }
.hh-rank-immortal { --rank: #ff8f8f; --rank-2: #e11d48; }

/* Sidebar / drawer block */
.hh-rank-block { display: flex; align-items: center; gap: 0.75rem; min-width: 0; flex: 1; }
.hh-rank-block .hh-rank-slot { width: 2.5rem; height: 2.5rem; flex: none; }
.hh-rank-block.is-pending .hh-rank-slot { animation: hh-rank-pending 1.6s ease-in-out infinite; }
.hh-xp-track {
  position: relative; display: block; height: 0.375rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08); overflow: hidden;
}
.hh-xp-track > i, .hh-xpbar > i {
  position: absolute; left: 0; top: 0; bottom: 0; display: block; border-radius: inherit;
  background: linear-gradient(90deg, var(--rank-2, #10b981), var(--rank, #34d399));
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Thin bar along the bottom edge of the app header */
.hh-xpbar {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  background: rgba(255, 255, 255, 0.06); pointer-events: none; z-index: 1;
}
.hh-xpbar > i { border-radius: 0 3px 3px 0; box-shadow: 0 0 10px var(--rank, #34d399); }

.hh-xp-shimmer > i::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  animation: hh-xp-shimmer 0.7s ease-out;
}

/* "New rank" strip across the bottom of the header, in its flow */
.hh-xp-strip {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  height: 34px; padding: 0 1rem; border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.8125rem; font-weight: 700; color: #fff; white-space: nowrap;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent), rgba(10, 16, 30, 0.6);
  animation: hh-xp-strip-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hh-xp-strip > span { text-shadow: 0 0 12px var(--rank, #34d399); }
.hh-xp-strip > b {
  padding: 0.1rem 0.7rem; border-radius: 999px; font-weight: 800; font-size: 0.75rem;
  background: var(--rank, #34d399); color: #0b1220;
  animation: hh-rank-glow 1.8s ease-in-out infinite;
}
/* Phones: the header is fixed, so the page moves down with the strip */
@media (max-width: 767px) {
  body.hh-rank-strip #app-main-wrapper.pt-14 { padding-top: calc(3.5rem + 34px); }
  body.hh-rank-strip #app-main-wrapper.pt-\[6\.5rem\] { padding-top: calc(6.5rem + 34px); }
}

/* The stage: the header bar slid down and thickened while the genie drags it.
   Above modals (z 100+), since replies are often written inside one. */
.hh-xp-stage {
  position: fixed; z-index: 180; pointer-events: none; transform-origin: 50% 0;
  padding: 0.55rem 0.9rem 0.75rem; border-radius: 1rem;
  background: #0b1220; border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 24px -6px var(--rank, #34d399);
}
.hh-xp-stage.is-floating { top: calc(env(safe-area-inset-top, 0px) + 14px); }
.hh-xp-stage-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem;
  margin-bottom: 0.45rem; font-size: 0.8125rem; line-height: 1.1; white-space: nowrap;
}
.hh-xp-stage-row > b { color: #fff; font-weight: 800; overflow: hidden; text-overflow: ellipsis; }
.hh-xp-stage-row > span { color: var(--rank, #34d399); font-weight: 800; font-variant-numeric: tabular-nums; }
.hh-xp-stage-slot { height: 12px; }
/* The header bar in flight: peels off the header into the slot and back */
.hh-xp-fly {
  position: fixed; z-index: 181; pointer-events: none; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), 0 0 12px -2px var(--rank, #34d399);
}
.hh-xp-fly > i {
  position: absolute; left: 0; top: 0; bottom: 0; display: block; border-radius: inherit;
  background: linear-gradient(90deg, var(--rank-2, #10b981), var(--rank, #34d399));
  box-shadow: 0 0 14px var(--rank, #34d399);
}
.hh-xp-stage.is-rankup { animation: hh-rank-glow 1s ease-in-out infinite; }
.hh-xp-stage.is-rankup .hh-xp-stage-row > b { text-shadow: 0 0 12px var(--rank, #34d399); }

/* Baby genie dragging the stage bar forward */
.hh-xp-genie { position: fixed; z-index: 182; pointer-events: none; }
.hh-xp-genie > img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }
.hh-xp-genie > span {
  position: absolute; top: -18px; translate: -50% 0;
  padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 1rem; font-weight: 900; color: #0b1220; white-space: nowrap;
  background: var(--rank, #34d399); box-shadow: 0 0 16px var(--rank, #34d399), 0 2px 6px rgba(0, 0, 0, 0.5);
  opacity: 0;
}
.hh-xp-poof { position: fixed; z-index: 183; width: 0; height: 0; pointer-events: none; --s: 1; }
.hh-xp-poof > i {
  position: absolute; left: calc(-12px * var(--s)); top: calc(-12px * var(--s));
  width: calc(24px * var(--s)); height: calc(24px * var(--s)); border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffffff, rgba(226, 232, 240, 0.9) 45%, rgba(203, 213, 225, 0));
  box-shadow: 0 0 12px var(--rank, #34d399);
  animation: hh-xp-poof 0.7s ease-out forwards;
}
@keyframes hh-xp-poof {
  from { transform: translate(0, 0) scale(0.4); opacity: 0.95; }
  to { transform: translate(var(--dx), var(--dy)) scale(1.6); opacity: 0; }
}

/* +1 XP floating off a button */
.hh-xp-float {
  position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, 0);
  font-size: 0.75rem; font-weight: 800; color: #6ee7b7; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  animation: hh-xp-float 0.9s ease-out forwards;
}
.hh-xp-float.is-big { font-size: 1.05rem; animation-duration: 1.3s; }

/* Sealed rank on /app/rank: a glowing silhouette until it's unwrapped */
.hh-rank-sealed > svg {
  filter: brightness(0) drop-shadow(0 0 2px var(--rank, #34d399)) drop-shadow(0 0 16px var(--rank, #34d399));
  animation: hh-sealed-float 2.6s ease-in-out infinite;
}
@keyframes hh-sealed-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* Rank page stars (Dota style, above the plaque) */
.hh-rank-stars { display: flex; justify-content: center; gap: 0.35rem; color: #fbbf24; }
.hh-rank-stars i { filter: drop-shadow(0 1px 0 #78350f) drop-shadow(0 0 6px rgba(251, 191, 36, 0.45)); }
.hh-rank-stars i.is-off { color: rgba(255, 255, 255, 0.14); filter: none; }

@keyframes hh-xp-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes hh-xp-float {
  0% { opacity: 0; transform: translate(-50%, 4px) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -6px) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -30px) scale(1); }
}
@keyframes hh-xp-strip-in {
  from { opacity: 0; transform: scaleY(0.4); }
  to { opacity: 1; transform: none; }
}
@keyframes hh-rank-glow {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 14px 1px var(--rank, #34d399); }
}
@keyframes hh-rank-pending {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); transform: scale(1); }
  50% { filter: drop-shadow(0 0 8px var(--rank, #34d399)); transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .hh-xp-strip, .hh-xp-strip > b, .hh-rank-block.is-pending .hh-rank-slot, .hh-xp-shimmer > i::after { animation: none; }
}
