.sh-modal {
  position: fixed;
  inset: 0;
  z-index: 10060;

  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;

  display: grid;
  place-items: center;

  padding-top: calc(env(safe-area-inset-top, 0px) + 18px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  padding-left: 12px;
  padding-right: 12px;

  background:
    radial-gradient(
      circle at 20% 10%,
      rgba(184, 179, 255, 0.22),
      transparent 45%
    ),
    radial-gradient(
      circle at 80% 30%,
      rgba(122, 114, 242, 0.16),
      transparent 55%
    ),
    #0b0b10;
}

.sh-modal.hidden {
  display: none !important;
}

.sh-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
}

/* Card */
.sh-card {
  position: relative;
  z-index: 1;

  width: min(460px, 92vw);
  max-height: calc(
    100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) -
      36px
  );

  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;

  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);

  background:
    radial-gradient(
      circle at 20% 0%,
      rgba(164, 122, 255, 0.12),
      transparent 60%
    ),
    radial-gradient(
      circle at 80% 100%,
      rgba(255, 84, 214, 0.08),
      transparent 55%
    ),
    rgba(255, 255, 255, 0.07);

  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);

  padding: 18px 18px 16px;

  display: grid;
  justify-items: center;
  gap: 12px;

  box-sizing: border-box;
}

.sh-card > * {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Close */
.sh-close {
  position: absolute;
  right: 14px;
  top: 14px;

  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);

  background:
    radial-gradient(
      circle at 30% 20%,
      rgba(164, 122, 255, 0.16),
      transparent 55%
    ),
    rgba(255, 255, 255, 0.08);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.3);
}

.sh-close:active {
  transform: scale(0.98);
}

@media (hover: hover) and (pointer: fine) {
  .sh-close:hover {
    filter: brightness(1.05);
  }
}

/* Cover */
.sh-cover {
  width: 200px;
  height: 200px;
  border-radius: 26px;
  overflow: hidden;

  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);

  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.38),
    0 0 0 6px rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(164, 122, 255, 0.14) inset;
}

.sh-cover-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Title */
.sh-title {
  max-width: 40ch;
  text-align: center;
  margin-top: 4px;

  display: grid;
  gap: 6px;

  line-height: 1.15;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.sh-title-book {
  color: rgba(255, 255, 255, 0.94);
  font-weight: 950;
  font-size: 19px;
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-wrap: balance;
}

.sh-sub {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 700;
  font-size: 13.5px;
  text-align: center;
  max-width: 98%;
}

/* Desktop share bar */
.sh-sharebar {
  width: 100%;
  max-width: min(520px, 100%);
  box-sizing: border-box;

  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;

  margin-top: 2px;
  padding: 12px;

  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);

  background:
    radial-gradient(
      circle at 18% 15%,
      rgba(255, 84, 214, 0.08),
      transparent 62%
    ),
    radial-gradient(
      circle at 85% 25%,
      rgba(164, 122, 255, 0.1),
      transparent 62%
    ),
    radial-gradient(
      circle at 30% 120%,
      rgba(20, 222, 255, 0.06),
      transparent 65%
    ),
    rgba(255, 255, 255, 0.05);

  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.sh-sharebar-spacer {
  flex: 1 1 auto;
  min-width: 6px;
}

.sh-icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;

  display: grid;
  place-items: center;

  cursor: pointer;
  user-select: none;

  box-shadow:
    0 14px 26px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);

  transition:
    transform 120ms ease,
    filter 160ms ease,
    box-shadow 180ms ease;
}

.sh-icon-btn:active {
  transform: scale(0.98);
}

@media (hover: hover) and (pointer: fine) {
  .sh-icon-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow:
      0 18px 34px rgba(0, 0, 0, 0.42),
      0 0 0 6px rgba(164, 122, 255, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
}

.sh-icon-btn:focus-visible {
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.42),
    0 0 0 4px rgba(164, 122, 255, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.sh-ico {
  width: 34px;
  height: 34px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.22));
}

/* Copy link */
.sh-copy {
  height: 44px;
  padding: 0 14px 0 12px;
  border-radius: 999px;

  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    radial-gradient(
      circle at 30% 20%,
      rgba(164, 122, 255, 0.16),
      transparent 55%
    ),
    rgba(255, 255, 255, 0.08);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  color: rgba(255, 255, 255, 0.92);
  font-weight: 950;
  font-size: 13.5px;
  letter-spacing: 0.2px;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  cursor: pointer;
  user-select: none;

  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.32);
  transition:
    transform 120ms ease,
    filter 160ms ease,
    box-shadow 180ms ease;
}

.sh-copy:active {
  transform: scale(0.98);
}

@media (hover: hover) and (pointer: fine) {
  .sh-copy:hover {
    filter: brightness(1.05);
    box-shadow:
      0 18px 34px rgba(0, 0, 0, 0.42),
      0 0 0 6px rgba(255, 84, 214, 0.08);
  }
}

.sh-copy-txt {
  line-height: 1;
  white-space: nowrap;
}

/* Mobile native button */
.sh-nativebar {
  width: 100%;
  display: none;
}

.sh-nativebtn {
  width: 100%;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);

  background: linear-gradient(
    180deg,
    rgba(122, 114, 242, 0.95),
    rgba(79, 124, 255, 0.95)
  );

  color: rgba(255, 255, 255, 0.98);
  font-weight: 950;
  font-size: 15px;
  letter-spacing: 0.2px;

  cursor: pointer;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);

  transition:
    transform 120ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.sh-nativebtn:active {
  transform: scale(0.98);
}

@media (hover: hover) and (pointer: fine) {
  .sh-nativebtn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow:
      0 24px 54px rgba(0, 0, 0, 0.46),
      0 0 0 8px rgba(255, 84, 214, 0.1);
  }
}

/* Hint */
.sh-hint {
  color: rgba(255, 255, 255, 0.62);
  font-weight: 750;
  font-size: 12px;
  text-align: center;
}

/* Short-height devices */
@media (max-height: 640px) {
  .sh-modal {
    place-items: start center;
  }

  .sh-card {
    gap: 10px;
    padding: 12px 12px 10px;
  }

  .sh-cover {
    width: 120px;
    height: 120px;
  }

  .sh-title-book {
    font-size: 17px;
  }
}

/* Mobile */
@media (max-width: 520px) {
  .sh-card {
    width: clamp(280px, 92vw, 520px);
    padding: 12px;
    gap: 10px;
  }

  .sh-cover {
    width: 138px;
    height: 138px;
    border-radius: 22px;
  }

  .sh-title-book {
    font-size: 18px;
  }

  .sh-sub {
    font-size: 13px;
  }

  .sh-nativebar {
    display: block;
  }

  .sh-sharebar {
    display: none !important;
  }

  .sh-nativebtn {
    height: 46px;
    font-size: 14px;
  }
}

/* Desktop-only tuning */
@media (min-width: 521px) {
  .sh-nativebar {
    display: none !important;
  }

  .sh-sharebar {
    display: flex;
  }
}

/* Utility */
.sh-hidden {
  display: none !important;
}
