
    * {
      box-sizing: border-box;
    }

    body {
      font-family: sans-serif;
      background: white;
      display: flex;
      flex-direction: column;
      justify-content: center; 
      align-items: center;     
      
      /* تغییر vh به dvh برای وسط‌چین شدن دقیق در موبایل */
      height: 100dvh;
      min-height: 100dvh;
      
      margin: 0;
      padding: 20px;
      direction: ltr;
      user-select: none;
      overflow: hidden; 
      max-width: 100vw;
    }

    h2 {
      text-align: center;
      color: #333;
      margin-bottom: 10px;
    }

    input[type="file"] {
      padding: 10px;
      border: 1px solid #aaa;
      border-radius: 8px;
      background: #fff;
      cursor: pointer;
    }

  .flipbook-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-end; /* لبه‌ی پایین دکمه‌ها و کتاب کاملاً هم‌تراز و در یک خط قرار می‌گیرند */
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
  }

    #flipbook {
      display: none;
      background: white;
      box-shadow: 0 10px 25px rgba(0,0,0,0.3);
      border-radius: 10px;
      overflow: hidden;
      transition: transform 0.3s ease;
      transform-origin: top center;
    }

    #flipbook canvas {
      width: 100%;
      height: 100%;
      display: block;
    }

    #controls {
      margin-top: 0;
      margin-left: 5px;
      display: none;
      flex-direction: column;
      gap: 12px;
      z-index: 100;
      position: relative;
    }

    button {
      padding: 8px 16px;
      border: none;
      border-radius: 8px;
      background: white;
      color: #2a8f81;
      font-size: 20px;
      cursor: pointer;
      transition: background 0.2s;
    }

    #controls button {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
      display: flex;
      align-items: center;
      justify-content: center;
       padding: 0;
      line-height: 1;

      position: relative;
    }
    #firstPage {
      transform: translateX(-1px);
    }

    #lastPage {
      transform: translateX(1px);
    }

    #prevPage {
      transform: translateX(-1px);
    }

    #nextPage {
      transform: translateX(1px);
    }
    #controls button:hover {
      background: #f0f0f0;
      transform: scale(1.08);
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    }

    .title-img {
      width: min(420px, 55%);
      height: auto;
      display: block;
      margin: 0 auto 15px;
      pointer-events: none;
      filter: drop-shadow(0 10px 25px rgba(2,6,23,0.10));
    }

    @media (max-width: 900px) {
      .title-img {
        width: min(220px, 75%);
        margin: 0 auto 5px;
      }
    }

    #thumbnails {
      display: none;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 20px;
      justify-content: center;
      width: 100%;
    }

    .thumb {
      width: 200px;
      height: 130px;
      border: 1px solid #ccc;
      border-radius: 6px;
      overflow: hidden;
      cursor: pointer;
      background: white;
      box-shadow: 0 4px 4px rgba(0, 0, 0, 0.3);
    }

    .thumb canvas {
      width: 100%;
      height: 100%;
    }

    .cards-row {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 20px;
      flex-wrap: nowrap;
      width: 100%;
    }

    img.feature-card-img { width: 27%; }
    img.feature-card-img1 { width: 8%; }

    @media (max-width: 768px) {
     img.feature-card-img { width: 45%; }
    img.feature-card-img1 { width: 25%; }
    
    .flipbook-wrapper {
      flex-direction: column;
      align-items: center;
      justify-content: center; /* وسط‌چین کردن المان‌ها در محور عمودی موبایل */
      flex-grow: 1;            /* اجازه دادن به رپر برای گرفتن فضای خالی عمودی */
      width: 100%;
      gap: 10px;               /* کم کردن فاصله المان‌ها برای جا شدن بهتر در موبایل */
    }
    
    #controls {
      flex-direction: row !important;
      margin-left: 0 !important;
      margin-top: 15px !important;
      justify-content: center !important;
      gap: 10px !important;
      flex-wrap: wrap;
      width: 100%;
      padding: 0 10px;
    }
    
    #controls button {
      width: 44px;
      height: 44px;
      font-size: 18px;
    }
    
    .top-logos {
      flex-direction: row;
      justify-content: center;
      align-items: center;
      gap: 15px;
      order: -1;
      margin-bottom: 5px; /* کاهش فاصله برای تعادل بهتر */
    }
    .book-logo {
      width: 80px;
    }
    }

    #loader {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(255,255,255,0.8);
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      z-index: 999;
    }

    #loader p {
      font-family: 'Vazir', sans-serif;
      font-size: 16px;
      color: #000;
    }

    .spinner {
      width: 50px;
      height: 50px;
      border: 5px solid #ddd;
      border-top: 5px solid #2a8f81;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin-bottom: 10px;
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    @font-face {
      font-family: 'Vazir';
      src: url('./font/Vazirmatn-Regular.woff2') format('woff2'),
           url('./font/Vazirmatn-Regular.ttf') format('truetype');
      font-weight: normal;
      font-style: normal;
    }

    @font-face {
      font-family: 'Vazir';
      src: url('./font/Vazirmatn-Bold.woff2') format('woff2'),
           url('./font/Vazirmatn-Bold.ttf') format('truetype');
      font-weight: bold;
      font-style: normal;
    }

    .thumbnails-active #controls {
      position: relative;
      right: auto;
      top: auto;
      transform: none;
      flex-direction: row;
      justify-content: center;
      margin-top: 20px;
      margin-left: 0;
    }

.top-logos {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}
.book-logo {
  width: 70px;
  height: auto;
  object-fit: contain;
}
@media (max-width: 768px) {

  .flipbook-wrapper {
    flex-direction: column;
    align-items: center;
  }

  .top-logos {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 15px;
    order: -1;
    margin-bottom: 15px;
  }
  .book-logo {
    width: 80px;
  }

  #controls {
    flex-direction: row !important;
    margin-left: 0 !important;
    margin-top: 15px !important;
    justify-content: center !important;
    gap: 10px !important;
    flex-wrap: wrap;
    width: 100%;
    padding: 0 10px;
  }

  #controls button {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
}
#controls button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);

  display: flex;
  align-items: center;
  justify-content: center;

  line-height: 1;
  padding: 0;
}
.thumbnails-area .top-logos,
body.thumbnails-active .top-logos,
.thumbnails-active .top-logos {
  flex-direction: row !important;
  justify-content: center;
  align-items: center;
}
#controls button i {
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* باز کردن قفل اسکرول فقط زمانی که فهرست فعال است */
body.thumbnails-active {
  overflow-y: auto;         /* فعال کردن اسکرول عمودی */
  align-items: flex-start;  /* چیدن فهرست از بالای صفحه (نه وسط) */
  height: auto;             /* ارتفاع آزاد برای جا گرفتن تمام صفحات */
  padding-top: 40px;        /* فاصله از سقف */
  padding-bottom: 40px;     /* فاصله از کف */
}

/* فاصله دادن گالری فهرست از دکمه‌ها و لوگوها در موبایل */
.thumbnails-active #thumbnails {
  margin-top: 30px;
  margin-bottom: 30px;
}