/* Minimal chrome around Flip PDF viewer (password gate + top actions). */

body {
  margin: 0;
}

/* Flip PDF: hide mobile bottom chapter / goto-page directory dropdown */
#btnGotoPage,
#btnTableOfContent,
#currentPageDDL,
.phoneGotoPageContent,
#menu:has(.phoneGotoPageContent) {
  display: none !important;
}

/* Flip PDF YouTube popup: windowed inside viewer, not device fullscreen */
#popup iframe.youtube-player {
  max-width: min(480px, 92vw) !important;
  max-height: min(270px, 52vw) !important;
}

.reader-status {
  margin: 0;
  padding: 24px 16px;
  text-align: center;
  color: #ddd;
  background: #000;
  font-family: "Noto Sans TC", Tahoma, sans-serif;
}

.reader-status:empty,
.reader-status[hidden] {
  display: none !important;
}

.reader-password-gate {
  max-width: 360px;
  margin: 40px auto;
  text-align: center;
  color: #f8f4ee;
  font-family: "Noto Sans TC", Tahoma, sans-serif;
}

.reader-password-gate h2 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.reader-password-form {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.reader-password-form input {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #666;
  border-radius: 10px;
  font: inherit;
  background: #fff;
  color: #111;
}

.reader-password-error {
  margin: 0;
  color: #ff8a80;
  font-size: 0.88rem;
}

.reader-password-gate a {
  color: #e8c9a8;
}

.reader-gate-btn {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: #3a3028;
  color: #f3dcc4;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Integrated into Flip PDF #pbTopBar: [More][回書庫] …logo… [分享][Thumb] */
#pbTopBar.reader-pb-integrated .phoneMoreButton {
  width: 44px !important;
}

#pbTopBar.reader-pb-integrated .phoneMoreButton div {
  margin-left: 9px !important;
}

#pbTopBar.reader-pb-integrated .reader-top-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  height: 28px;
  padding: 0 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #ecf5fb;
  font: 600 10px/28px "Noto Sans TC", Tahoma, sans-serif;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#pbTopBar.reader-pb-integrated .reader-top-share {
  color: #ecf5fb;
}

.share-sheet {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-family: "Noto Sans TC", Tahoma, sans-serif;
}

.share-sheet[hidden] {
  display: none !important;
}

.share-sheet-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(8, 6, 4, 0.55);
  cursor: pointer;
}

.share-sheet-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  margin: 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  background: #1d1813;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 0;
  color: #f8f4ee;
}

.share-sheet-handle {
  width: 42px;
  height: 4px;
  margin: 2px auto 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.share-sheet-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.share-sheet-sub {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: rgba(248, 244, 238, 0.72);
}

.share-sheet-url {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  word-break: break-all;
}

.share-sheet-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.share-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  color: inherit;
}

.share-action-copy {
  background: rgba(232, 201, 168, 0.16);
  border-color: rgba(232, 201, 168, 0.35);
  color: #f3dcc4;
}

.share-action-wa {
  background: #1f6b4a;
  color: #f4fff8;
}

.share-action-system {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}

.share-sheet-close {
  display: block;
  width: 100%;
  margin-top: 12px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(248, 244, 238, 0.7);
  font: inherit;
  cursor: pointer;
}

@media (min-width: 768px) {
  .share-sheet {
    align-items: center;
  }

  .share-sheet-panel {
    border-radius: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin: 16px;
  }

  .share-sheet-handle {
    display: none;
  }
}
