/* Final platform-logo fit. The plaque's usable panel is its lower half, so
   each brand mark is sized against that panel instead of a shared square. */
.social-rail {
  position: fixed;
  top: 45%;
  right: clamp(16px, 2.4vw, 42px);
  z-index: 72;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translateY(-50%);
}

.social-wechat-entry {
  position: relative;
  width: 132px;
  height: 148px;
}

.social-button.social-button--taptap,
.social-button.social-button--bilibili,
.social-button.social-button--wechat {
  position: relative;
  display: block;
  width: 132px;
  height: 148px;
  margin: 0;
  padding: 0;
  overflow: visible;
  background: url("../assets/img/ui/hanging-plaque-transparent.png") center / 100% 100% no-repeat;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: none;
}

.social-button.social-button--wechat {
  appearance: none;
  cursor: pointer;
}

.social-button.social-button--taptap::before,
.social-button.social-button--taptap::after,
.social-button.social-button--bilibili::before,
.social-button.social-button--bilibili::after,
.social-button.social-button--wechat::before,
.social-button.social-button--wechat::after {
  display: none;
  content: none;
}

.social-button.social-button--taptap .social-icon,
.social-button.social-button--bilibili .social-icon,
.social-button.social-button--wechat .social-icon {
  position: absolute;
  top: 49%;
  right: 8%;
  bottom: 7%;
  left: 8%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: none;
}

.social-button.social-button--taptap .social-icon img {
  display: block;
  width: 94%;
  height: auto;
  max-width: none;
  max-height: 70%;
  object-fit: contain;
  filter: drop-shadow(0 2px 0 rgba(39, 28, 16, .16));
  transform: none;
}

.social-button.social-button--bilibili .social-icon img {
  display: block;
  width: 62px;
  height: 62px;
  max-width: none;
  max-height: none;
  object-fit: contain;
  -webkit-clip-path: inset(1px round 24%);
  clip-path: inset(1px round 24%);
  filter: drop-shadow(0 2px 0 rgba(39, 28, 16, .14));
  transform: none;
}

.social-button.social-button--wechat .social-icon img {
  display: block;
  width: 88px;
  height: 88px;
  max-width: none;
  max-height: none;
  object-fit: contain;
  -webkit-clip-path: inset(16.5% round 20%);
  clip-path: inset(16.5% round 20%);
  filter: drop-shadow(0 2px 0 rgba(39, 28, 16, .14));
  transform: none;
}

.social-button.social-button--taptap .social-label,
.social-button.social-button--bilibili .social-label,
.social-button.social-button--wechat .social-label {
  display: none;
}

.social-button.social-button--taptap:hover,
.social-button.social-button--taptap:focus-visible,
.social-button.social-button--bilibili:hover,
.social-button.social-button--bilibili:focus-visible,
.social-button.social-button--wechat:hover,
.social-button.social-button--wechat:focus-visible {
  background: url("../assets/img/ui/hanging-plaque-transparent.png") center / 100% 100% no-repeat;
  border: 0;
  box-shadow: none;
  filter: brightness(1.06) saturate(1.04);
  transform: translateY(-3px);
}

.wechat-qr-panel {
  position: absolute;
  top: 57%;
  right: calc(100% - 12px);
  z-index: -1;
  display: grid;
  width: 184px;
  padding: 13px 13px 12px;
  place-items: center;
  color: #4a2e1c;
  text-align: center;
  background:
    linear-gradient(rgba(255, 248, 225, .96), rgba(235, 210, 162, .98)),
    #f4dfb7;
  border: 4px solid #5a3822;
  border-radius: 4px;
  box-shadow:
    0 0 0 2px #c79045,
    7px 7px 0 rgba(31, 21, 13, .32);
  opacity: 0;
  pointer-events: none;
  transform: translate(24px, -50%) scale(.94);
  transform-origin: right center;
  transition:
    opacity 180ms ease,
    transform 220ms cubic-bezier(.2, .8, .2, 1);
}

.wechat-qr-panel::after {
  position: absolute;
  top: 50%;
  right: -17px;
  width: 18px;
  height: 8px;
  background: #5a3822;
  content: "";
  transform: translateY(-50%);
}

.wechat-qr-panel img {
  display: block;
  width: 150px;
  height: 150px;
  margin: 0 0 8px;
  object-fit: cover;
  background: #fff;
  border: 5px solid #fff;
  box-shadow: 0 0 0 2px #6d482c;
}

.wechat-qr-panel strong,
.wechat-qr-panel span {
  display: block;
  line-height: 1.2;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .7);
}

.wechat-qr-panel strong {
  margin-bottom: 3px;
  font-size: 20px;
  letter-spacing: .08em;
}

.wechat-qr-panel span {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .12em;
}

.social-wechat-entry.is-open .wechat-qr-panel {
  z-index: 3;
  opacity: 1;
  pointer-events: auto;
  transform: translate(0, -50%) scale(1);
}

@media (hover: hover) and (pointer: fine) {
  .social-wechat-entry:hover .wechat-qr-panel,
  .social-wechat-entry:focus-within .wechat-qr-panel {
    z-index: 3;
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%) scale(1);
  }
}

@media (max-width: 900px) {
  .social-rail {
    top: 43%;
    right: 8px;
    gap: 2px;
  }

  .social-button.social-button--taptap,
  .social-button.social-button--bilibili,
  .social-button.social-button--wechat {
    width: 98px;
    height: 110px;
  }

  .social-wechat-entry {
    width: 98px;
    height: 110px;
  }

  .social-button.social-button--bilibili .social-icon img {
    width: 48px;
    height: 48px;
  }

  .social-button.social-button--wechat .social-icon img {
    width: 68px;
    height: 68px;
  }

  .wechat-qr-panel {
    right: calc(100% - 9px);
    width: 160px;
    padding: 11px;
  }

  .wechat-qr-panel img {
    width: 128px;
    height: 128px;
  }

  .wechat-qr-panel strong {
    font-size: 17px;
  }
}

@media (max-width: 560px) {
  .social-rail {
    top: 40%;
    right: 5px;
  }

  .social-button.social-button--taptap,
  .social-button.social-button--bilibili,
  .social-button.social-button--wechat {
    width: 86px;
    height: 97px;
  }

  .social-wechat-entry {
    width: 86px;
    height: 97px;
  }

  .social-button.social-button--bilibili .social-icon img {
    width: 42px;
    height: 42px;
  }

  .social-button.social-button--wechat .social-icon img {
    width: 62px;
    height: 62px;
  }

  .wechat-qr-panel {
    right: calc(100% - 7px);
    width: 146px;
    padding: 10px;
  }

  .wechat-qr-panel img {
    width: 116px;
    height: 116px;
    margin-bottom: 7px;
  }

  .wechat-qr-panel strong {
    font-size: 16px;
  }

  .wechat-qr-panel span {
    font-size: 12px;
  }
}

@media (max-height: 720px) and (min-width: 901px) {
  .social-rail {
    top: 43%;
    transform: translateY(-50%) scale(.88);
    transform-origin: right center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wechat-qr-panel {
    transition: none;
  }
}
