/* Shared, lightweight community links. No Discord widget or third-party requests. */
body:has(> .discord-support) {
  --support-size: 56px;
  --support-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  padding-bottom: calc(var(--support-bottom) + var(--support-size) + 16px);
}

.alpha-banner {
  border-bottom: 1px solid #c4a34f;
  background: #f5df94;
  color: #493710;
}
.alpha-banner-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 7px max(16px, env(safe-area-inset-right, 0px)) 7px
    max(16px, env(safe-area-inset-left, 0px));
  font: 14px/1.4 var(--body);
  text-align: center;
  color: inherit;
  text-decoration: none;
}
.alpha-badge {
  flex: none;
  padding: 3px 7px;
  border: 1px solid #b6933b;
  border-radius: 4px;
  background: #efd077;
  font: 800 11px/1.2 var(--font);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.alpha-banner-action {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.alpha-banner-link:hover {
  background: #f1d680;
}
.alpha-banner-link:focus-visible {
  outline: 3px solid #493710;
  outline-offset: -4px;
}

.discord-support {
  position: fixed;
  z-index: 25;
  right: max(24px, env(safe-area-inset-right, 0px));
  bottom: var(--support-bottom);
  display: grid;
  place-items: center;
  width: var(--support-size);
  height: var(--support-size);
  border: 2px solid #b4baff;
  border-radius: 50%;
  background: #5865f2;
  box-shadow:
    0 3px 0 #303991,
    0 6px 18px #07180c40;
  color: #fff;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.discord-support img {
  display: block;
  width: 28px;
  height: 28px;
}
.discord-support:hover {
  background: #4752c4;
}
.discord-support:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
  box-shadow: 0 0 0 7px #303991;
}
.discord-support-label {
  position: absolute;
  right: calc(100% + 12px);
  padding: 8px 12px;
  border: 1px solid #b4baff;
  border-radius: 6px;
  background: #303991;
  color: #fff;
  font: 700 13px/1.4 var(--body);
  white-space: nowrap;
  visibility: hidden;
  pointer-events: none;
}
.discord-support:focus-visible .discord-support-label {
  visibility: visible;
}
@media (hover: hover) {
  .discord-support:hover .discord-support-label {
    visibility: visible;
  }
}

/* Keep transient messages and dialogs clear of the floating link. */
body:has(dialog[open], .toast:not([hidden])) > .discord-support {
  display: none;
}

@media (max-width: 700px) {
  body:has(> .discord-support) {
    --support-size: 52px;
    --support-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  body:has(> .discord-support):has(.mobile-nav) {
    --support-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
  .alpha-banner-link {
    gap: 8px;
    font-size: 12px;
  }
  .discord-support {
    right: max(14px, env(safe-area-inset-right, 0px));
  }
}

/* A touch keyboard can also open on tablets and landscape phones. */
@media (max-width: 700px), (pointer: coarse) {
  body:has(
      input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):focus,
      select:focus,
      textarea:focus,
      [contenteditable="true"]:focus
    )
    > .discord-support {
    display: none;
  }
}

@media print {
  .alpha-banner,
  .discord-support {
    display: none;
  }
  body:has(> .discord-support) {
    padding-bottom: 0;
  }
}
