/* Share modal — ported from reader_v3 with iOS 12+ compatibility adjustments. */

.sh-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 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;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0, 0, 0, 0.34);
}

.sh-card {
  position: relative;
  z-index: 1;
  width: min(460px, 92vw);
  max-height: calc(var(--vh, 1vh) * 100 - 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);
  -webkit-backdrop-filter: blur(16px);
  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;
}

.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);
  -webkit-backdrop-filter: blur(12px);
  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); }
}

.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;
}

.sh-title {
  max-width: 40ch;
  text-align: center;
  margin-top: 4px;
  display: grid;
  gap: 6px;
  line-height: 1.15;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sh-title-book {
  font-family: 'Nunito', system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.94);
  font-weight: 900;
  font-size: 19px;
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sh-sub {
  font-family: 'Nunito', system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 700;
  font-size: 13.5px;
  text-align: center;
  max-width: 98%;
}

.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%),
    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: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-user-select: none;
  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);
  }
}

.sh-ico {
  width: 34px;
  height: 34px;
  display: block;
  object-fit: contain;
}

.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);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.92);
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 900;
  font-size: 13.5px;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.32);
  transition: transform 120ms ease, filter 160ms ease;
}

.sh-copy:active { transform: scale(0.98); }

@media (hover: hover) and (pointer: fine) {
  .sh-copy:hover { filter: brightness(1.05); }
}

.sh-copy-txt { line-height: 1; white-space: nowrap; }

.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-family: 'Nunito', system-ui, sans-serif;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
  transition: transform 120ms ease, filter 160ms ease;
}

.sh-nativebtn:active { transform: scale(0.98); }

.sh-hint {
  font-family: 'Nunito', system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.62);
  font-weight: 700;
  font-size: 12px;
  text-align: center;
}

@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; }
}

@media (max-width: 520px) {
  .sh-card { width: min(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; }
}

@media (min-width: 521px) {
  .sh-nativebar { display: none !important; }
  .sh-sharebar { display: flex; }
}
