/* Compact role badges shown beside group-coloured usernames. */
.astral-role-badge {
  display: inline-flex !important;
  flex: 0 0 16px !important;
  width: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  max-height: 16px !important;
  margin-left: 4px;
  padding: 0 !important;
  box-sizing: border-box !important;
  align-items: center;
  justify-content: center;
  overflow: visible;
  vertical-align: -4px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
  line-height: 1;
  text-decoration: none;
}

.astral-role-badge svg {
  display: block !important;
  flex: 0 0 16px !important;
  width: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  max-height: 16px !important;
  overflow: visible;
}

.profile-hero-name .astral-role-badge {
  position: relative;
  top: -2px;
}

.astral-role-admin {
  color: #f3c85b;
  filter: drop-shadow(0 0 2px rgba(243, 200, 91, 0.45));
}

.astral-role-admin svg,
.astral-role-admin svg path {
  fill: #f3c85b !important;
}

.astral-role-moderator {
  color: #60a0dc;
  filter: drop-shadow(0 0 2px rgba(96, 160, 220, 0.4));
}

.astral-role-moderator svg,
.astral-role-moderator svg path {
  fill: #60a0dc !important;
}

.astral-role-og {
  color: #c084fc;
  filter: drop-shadow(0 0 2px rgba(192, 132, 252, 0.48));
}

.astral-role-og svg,
.astral-role-og svg path {
  fill: #c084fc !important;
}

.astral-earned-badge {
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}

.astral-role-admin[data-astral-badge],
.astral-role-moderator[data-astral-badge],
.astral-role-og[data-astral-badge] {
  cursor: pointer;
}

.astral-earned-badge:hover {
  transform: translateY(-1px) scale(1.08);
}

.astral-badge-trader {
  color: #38ddb2;
  filter: drop-shadow(0 0 2px rgba(56, 221, 178, 0.58));
}

.astral-badge-hall-of-fame {
  color: #ffd76a;
  filter: drop-shadow(0 0 2px rgba(255, 215, 106, 0.75)) drop-shadow(0 0 5px rgba(255, 173, 45, 0.28));
  animation: astral-hall-of-fame-glow 2.8s ease-in-out infinite;
}

.astral-badge-event-champion {
  color: #ffad42;
  filter: drop-shadow(0 0 2px rgba(255, 173, 66, 0.62));
}

.astral-badge-researcher {
  color: #a993ff;
  filter: drop-shadow(0 0 2px rgba(169, 147, 255, 0.68));
}

.astral-badge-bug-hunter {
  color: #61dda0;
  filter: drop-shadow(0 0 2px rgba(97, 221, 160, 0.62));
}

.astral-badge-bug-hunter .astral-badge-tone-shadow {
  color: #199f59;
}

.astral-badge-admin-preview {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 145px;
}

.astral-badge-admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(260px, 420px);
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  width: 100%;
  max-width: 660px;
}

.astral-badge-admin-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
}

.pun .astral-badge-reason-input {
  box-sizing: border-box;
  width: 100% !important;
  min-width: 0;
  padding: 5px 7px;
}

body.astral-modal-open {
  overflow: hidden;
}

.astral-badge-modal {
  position: fixed;
  z-index: 5000;
  inset: 0;
  font-family: Verdana, Helvetica, Arial, sans-serif;
}

.astral-badge-modal[hidden] {
  display: none;
}

.astral-badge-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 7, .76);
  backdrop-filter: blur(3px);
}

.astral-badge-modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(420px, calc(100vw - 34px));
  box-sizing: border-box;
  padding: 24px;
  transform: translate(-50%, -50%);
  border: 1px solid #3b414a;
  background: linear-gradient(145deg, #1b1f24, #111418 72%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .72);
  color: #c7cfd8;
  text-align: center;
}

.astral-badge-modal-close {
  position: absolute;
  top: 7px;
  right: 9px;
  border: 0;
  background: transparent;
  color: #818b96;
  cursor: pointer;
  font-size: 23px;
}

.astral-badge-modal-icon {
  display: flex;
  justify-content: center;
  margin: 3px 0 12px;
}

.astral-badge-modal-icon .astral-role-badge {
  flex-basis: 46px !important;
  width: 46px !important;
  min-width: 46px !important;
  max-width: 46px !important;
  height: 46px !important;
  min-height: 46px !important;
  max-height: 46px !important;
  margin: 0;
  transform: none;
}

.astral-badge-modal-icon .astral-role-badge svg {
  flex-basis: 46px !important;
  width: 46px !important;
  min-width: 46px !important;
  max-width: 46px !important;
  height: 46px !important;
  min-height: 46px !important;
  max-height: 46px !important;
}

.astral-badge-modal-card h3 {
  margin: 0 0 8px;
  color: #f3f6f9;
  font-size: 18px;
}

.astral-badge-modal-description {
  margin: 0 0 16px;
  color: #98a3af;
  font-size: 11px;
  line-height: 1.55;
}

.astral-badge-modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 9px;
  padding: 10px;
  border: 1px solid #2c323a;
  background: rgba(5, 7, 9, .28);
  text-align: left;
}

.astral-badge-modal-field strong {
  color: #dce3ea;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.astral-badge-modal-field span {
  color: #8e99a5;
  font-size: 10px;
  line-height: 1.45;
}

.astral-badge-modal-directory {
  display: inline-block;
  margin-top: 17px;
  color: #69aaff !important;
}

.astral-badge-directory .inbox {
  padding: 14px;
}

.astral-badge-directory-intro {
  margin-bottom: 14px;
  padding: 13px 14px;
  border: 1px solid #343a42;
  background: linear-gradient(110deg, rgba(83, 134, 221, .11), rgba(112, 75, 169, .08));
}

.astral-badge-directory-intro strong {
  color: #edf2f7;
  font-size: 13px;
}

.astral-badge-directory-intro p {
  margin: 3px 0 0;
  color: #909ba7;
  line-height: 1.5;
}

.astral-badge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.astral-badge-card {
  padding: 14px;
  border: 1px solid #323840;
  background: linear-gradient(145deg, #1b1f23, #15181c);
}

.astral-badge-card.is-selected {
  border-color: #5d8fd4;
  box-shadow: 0 0 0 1px rgba(93, 143, 212, .2), 0 0 18px rgba(93, 143, 212, .12);
}

.astral-badge-card-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 9px;
}

.astral-badge-directory-icon {
  display: flex;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
}

.astral-badge-directory-icon .astral-role-badge {
  flex-basis: 32px !important;
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  margin: 0;
  transform: none;
}

.astral-badge-directory-icon .astral-role-badge svg {
  flex-basis: 32px !important;
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
}

.astral-badge-card h3 {
  margin: 0;
  color: #edf2f6;
  font-size: 12px;
}

.astral-badge-card-head span {
  color: #697581;
  font-size: 9px;
}

.astral-badge-card > p {
  min-height: 34px;
  margin: 0 0 10px;
  color: #929ca8;
  line-height: 1.45;
}

.astral-badge-criteria {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px;
  border-left: 2px solid #485361;
  background: #121519;
}

.astral-badge-criteria strong {
  color: #cdd5dd;
  font-size: 9px;
  text-transform: uppercase;
}

.astral-badge-criteria span {
  color: #7d8894;
  font-size: 9px;
  line-height: 1.4;
}

.astral-badge-holders {
  margin-top: 10px;
}

.astral-badge-holders summary {
  color: #6da9f6;
  cursor: pointer;
  font-size: 10px;
}

.astral-badge-holders > div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.astral-badge-holders > div > a,
.astral-badge-no-holders {
  padding: 4px 7px;
  border: 1px solid #30363e;
  background: #111418;
  font-size: 9px;
}

.astral-badge-no-holders {
  color: #69737e;
}

@keyframes astral-hall-of-fame-glow {
  0%, 100% {
    filter: drop-shadow(0 0 2px rgba(255, 215, 106, 0.68)) drop-shadow(0 0 4px rgba(255, 173, 45, 0.2));
  }
  50% {
    filter: drop-shadow(0 0 3px rgba(255, 235, 160, 0.9)) drop-shadow(0 0 7px rgba(255, 173, 45, 0.42));
  }
}

@media (prefers-reduced-motion: reduce) {
  .astral-badge-hall-of-fame {
    animation: none;
  }
}

@media (max-width: 680px) {
  .profile-hero-name > a,
  .postleft .username > a,
  .postright .username > a {
    display: inline-flex;
    max-width: 100%;
    flex-wrap: wrap;
    align-items: center;
  }
  .astral-badge-modal-card {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }
  .astral-badge-grid {
    grid-template-columns: 1fr;
  }
  .astral-badge-admin-row {
    align-items: flex-start;
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .pun .astral-badge-reason-input {
    width: 100%;
  }
}
