#rf-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000000;
  align-items: center;
  justify-content: center;
}

#rf-modal.rf-active {
  display: flex;
}

#rf-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.92);
}

#rf-modal-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px 20px 0;
}

#rf-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
}

#rf-close-btn:hover {
  background: rgba(255,255,255,0.25);
}

#rf-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 300px;
}

#rf-modal .rf-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rf-spin 0.8s linear infinite;
}

@keyframes rf-spin {
  to { transform: rotate(360deg); }
}

#rf-flipbook-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  overflow: hidden;
  transition: overflow 0.2s;
}

#rf-flipbook {
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  transform-origin: center top;
}

#rf-modal .rf-page {
  background: #fff;
  overflow: hidden;
}

#rf-modal .rf-page-loader {
  width: 100%;
  height: 100%;
  background: #f0f0f0;
  animation: rf-pulse 1.2s ease-in-out infinite;
}

@keyframes rf-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── TOOLBAR ───────────────────────────────────────────────── */
#rf-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  margin-top: 14px;
  margin-bottom: 14px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
}

#rf-modal .rf-toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
}

#rf-modal .rf-toolbar-group + .rf-toolbar-group {
  border-left: 1px solid rgba(255,255,255,0.12);
}

/* ── NAV BUTTONS ───────────────────────────────────────────── */
#rf-modal .rf-nav-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  padding: 0;
}

#rf-modal .rf-nav-btn svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#rf-modal .rf-nav-btn:hover:not(.rf-btn-disabled) {
  background: rgba(255,255,255,0.22);
  border-color: rgba(107,16,32,0.5);
  transform: scale(1.08);
}

#rf-modal .rf-nav-btn.rf-btn-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#rf-page-info {
  color: #fff;
  font-size: 13px;
  min-width: 64px;
  text-align: center;
  letter-spacing: 0.5px;
}

/* ── TOOL BUTTONS ──────────────────────────────────────────── */
#rf-modal .rf-tool-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.75);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  font-size: 12px;
  font-weight: 500;
  padding: 0;
}

#rf-modal .rf-tool-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#rf-modal .rf-tool-btn:hover:not(:disabled) {
  background: rgba(107,16,32,0.25);
  color: #fff;
}

#rf-modal .rf-tool-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#rf-zoom-level {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  min-width: 36px;
  text-align: center;
}

/* ── SHARE TIP ─────────────────────────────────────────────── */
#rf-share-tip {
  color: #f4a0a8;
  font-size: 12px;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  white-space: nowrap;
}

#rf-share-tip.rf-visible {
  max-width: 120px;
  opacity: 1;
  margin-left: 4px;
}

/* ── MOBILE ────────────────────────────────────────────────── */
@media (max-width: 767px) {
  #rf-modal-inner {
    padding: 10px 10px 0;
  }

  #rf-toolbar {
    gap: 2px;
    padding: 8px 10px;
    margin-top: 10px;
    border-radius: 16px;
  }

  #rf-modal .rf-toolbar-group {
    padding: 0 6px;
  }

  #rf-modal .rf-nav-btn {
    width: 34px;
    height: 34px;
  }

  #rf-modal .rf-tool-btn {
    width: 30px;
    height: 30px;
  }
}