/* =========================================
   STORYBOOK - CLEAN & FIXED CSS
========================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Baloo 2', 'Poppins', sans-serif;
  background-color: #1e293b;
  color: white;
  overflow-x: hidden;
}

/* Home Button */
.home-button {
  position: absolute;
  top: 20px;
  left: 20px;
  background-color: rgba(255, 255, 255, 0.9);
  border: 3px solid #e2e8f0;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.home-button:hover {
  transform: scale(1.1);
  background-color: white;
}

/* Storybook Container */
#storybook-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  background-image: url('images/background.jpg');
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.story-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1s ease-in-out;
}

.active-page {
  opacity: 1;
  visibility: visible;
}

/* Text Styling */
.text-container {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 15px 30px;
  border-radius: 20px;
  border: 4px solid #16a34a;
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
  text-align: center;
  z-index: 10;
}

.story-text {
  font-size: 36px;
  color: #333;
  line-height: 1.8;
}

.word {
  display: inline-block;
  transition: color 0.2s;
  margin: 0 3px;
}

.word.highlight {
  color: #d35400;
}

/* Characters & Assets */
.character, .static-asset, .clickable-asset {
  position: absolute;
  transition: all 0.4s ease;
}

.clickable-asset:hover {
  transform: scale(1.08);
}

/* ================== STRONG BIRD FLYING ANIMATION ================== */
#bird {
  top: 20%;
  left: 10%;
  height: 22%;
  cursor: pointer;
  z-index: 30;
}

#bird.fly-around {
  animation: flyAround 3.8s ease-in-out forwards !important;
}

@keyframes flyAround {
  0%   { transform: scale(1) rotate(0deg) translate(0, 0); opacity: 1; }
  15%  { transform: scale(1.12) rotate(-22deg) translate(120px, -70px); }
  35%  { transform: scale(1.28) rotate(18deg) translate(340px, -165px); }
  55%  { transform: scale(1.22) rotate(-20deg) translate(590px, -95px); }
  75%  { transform: scale(1.08) rotate(12deg) translate(780px, -35px); }
  100% { transform: scale(0.65) rotate(42deg) translate(1050px, 90px); opacity: 0; }
}

/* Wind / Magic Effect for Page 4 */
#page-4 img {
  animation: gentleWind 4s ease-in-out infinite alternate;
}

@keyframes gentleWind {
  from { transform: rotate(-6deg) translateX(-20px); }
  to   { transform: rotate(7deg) translateX(30px); }
}

/* Navigation */
.story-navigation {
  position: absolute;
  bottom: 30px;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 30px;
  z-index: 1000;
}

.nav-btn {
  background-color: #3b82f6;
  color: white;
  border: none;
  padding: 12px 35px;
  border-radius: 50px;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.nav-btn:hover {
  background-color: #2563eb;
  transform: scale(1.05);
}

/* Mobile */
@media (max-width: 768px) {
  .story-text { font-size: 24px; }
  .nav-btn { font-size: 18px; padding: 10px 25px; }
}
/* Add this to style.css to ensure the flower renders correctly */
#hidden-flower {
    display: block !important;
    visibility: visible !important;
}
#page-3 {
    position: relative; /* این خط حیاتی است */
    width: 100%;
    height: 100vh;
}

#lake-img {
    position: absolute !important;
    bottom: 5% !important; /* چسباندن به پایین */
    top: auto !important;  /* حذفِ هرگونه تنظیمِ بالا */
    left: 20% !important;
    width: 60% !important;
    z-index: 1;
}
#page-3 {
    position: relative !important;
    height: 100vh !important;
    overflow: hidden;
}
.game-container {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    border-radius: 30px;
    padding: 40px;
    /* ... */
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
/* استایل برای صفحه منو */
.menu-body {
    background: radial-gradient(circle, #fffdf2 0%, #ffeecb 100%); /* پس‌زمینه گرم و کاغذی */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.menu-title {
    font-family: 'Baloo 2', cursive;
    color: #5d4037; /* رنگ قهوه‌ای گرم */
    font-size: 3rem;
    margin-bottom: 50px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    width: 80%;
    max-width: 900px;
}

.game-card {
    background: #ffffff;
    padding: 30px;
    border-radius: 40px; /* لبه‌های خیلی گرد */
    text-decoration: none;
    color: #5d4037;
    text-align: center;
    box-shadow: 0 15px 30px rgba(0,0,0,0.1); /* سایه نرم و عمیق */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 4px solid #fff;
}

.game-card:hover {
    transform: translateY(-15px) scale(1.05); /* حرکت شناور */
    box-shadow: 0 25px 50px rgba(93, 64, 55, 0.2);
    border: 4px solid #ffcc80;
}

.card-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.nav-back {
    display: inline-block;
    margin-top: 50px;
    font-family: 'Baloo 2', cursive;
    color: #8d6e63;
    text-decoration: none;
    font-size: 1.5rem;
}
/* استایل کارت‌های بازی */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.magic-card {
    background: white;
    border-radius: 30px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.magic-card:hover {
    transform: translateY(-10px);
    border-color: #ffd54f; /* رنگ طلایی گرم */
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.card-img {
    width: 100%;
    max-height: 120px;
    object-fit: contain;
}

.card-title {
    font-family: 'Baloo 2', cursive;
    color: #5d4037;
    margin-top: 15px;
}
/* --- استایل‌های اختصاصی صفحه Credits --- */
.credits-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle, #fffdf2 0%, #ffeecb 100%);
    padding: 20px;
}

.credits-container {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    border-radius: 40px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.credits-logos {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.credit-logo-img {
    height: 60px;
    object-fit: contain;
}

.credits-text {
    text-align: left;
    margin: 20px 0;
    font-family: 'Poppins', sans-serif;
    color: #5d4037;
    line-height: 1.6;
}

.home-button {
    font-size: 2rem;
    text-decoration: none;
    margin-bottom: 20px;
    display: inline-block;
}

.btn-start-story {
    display: inline-block;
    background: #ffcc00;
    color: #5d4037;
    padding: 15px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    font-family: 'Baloo 2', cursive;
    transition: transform 0.3s;
    margin-top: 20px;
}

.btn-start-story:hover {
    transform: scale(1.05);
}
/* تنظیمات پایه برای محیط کتابخانه */
.library-background {
    background-color: #1a2332; /* همان رنگ سرمه‌ای تیره در عکس تو */
    min-height: 100vh;
    padding: 50px 20px;
    color: white;
    font-family: 'Poppins', sans-serif;
}

.library-header {
    text-align: center;
    margin-bottom: 50px;
}

/* تنظیم شبکه کتاب‌ها */
.bookshelf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* استایل عمومی کارت کتاب */
.book-card {
    background: #2a3b50;
    border-radius: 20px;
    padding: 15px;
    transition: transform 0.3s ease;
    text-align: center;
    position: relative;
    border: 2px solid transparent;
}

/* استایل مخصوص کتاب فعال (سبز درخشان) */
.active-book {
    border: 2px solid #00ffcc;
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.3);
}

/* استایل کتاب‌های قفل شده */
.locked-book {
    opacity: 0.7;
    filter: grayscale(0.5);
}

.placeholder-cover {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: #1e2a38;
    border-radius: 15px;
    margin-bottom: 15px;
}

/* استایل دکمه‌های بازی در زیر کارت کتاب */
.direct-game-buttons {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
}

.mini-game-btn {
    background: #4a5d75;
    color: white;
    padding: 8px 15px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.mini-game-btn:hover {
    background: #00ffcc;
    color: #1a2332;
}

.book-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 15px;
}
/* =========================================
   تنظیمات پایه و عمومی
========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  /* پس‌زمینه ملایم و رویایی مناسب کتاب داستان */
  background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
  font-family: 'Poppins', sans-serif;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

/* =========================================
   قالب بندی اصلی (Wrapper & Container)
========================================= */
.credits-wrapper {
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.credits-container {
  background-color: #ffffff;
  width: 100%;
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  text-align: center;
  border: 4px solid rgba(255, 255, 255, 0.5);
}

/* =========================================
   دکمه بازگشت به خانه (Bibliotheek)
========================================= */
.nav-btn.btn-home {
  align-self: flex-start;
  text-decoration: none;
  background-color: #ffb703;
  color: #fff;
  font-family: 'Baloo 2', cursive;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 10px 25px;
  border-radius: 30px;
  margin-bottom: 20px;
  box-shadow: 0 6px 15px rgba(255, 183, 3, 0.3);
  transition: all 0.3s ease;
}

.nav-btn.btn-home:hover {
  background-color: #fb8500;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(255, 183, 3, 0.4);
}

/* =========================================
   لوگوها
========================================= */
.credits-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  margin-bottom: 20px;
}

.credit-logo-img {
  max-height: 80px;
  width: auto;
  object-fit: contain;
}

/* =========================================
   عنوان اصلی (Title)
========================================= */
h2 {
  font-family: 'Baloo 2', cursive;
  font-size: 2.2rem;
  color: #023047;
  margin-bottom: 25px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}

/* =========================================
   متن اعتبارات (Credits Text)
========================================= */
.credits-text {
  font-size: 0.95rem;
  line-height: 1.8;
  color: #555;
  margin-bottom: 35px;
  text-align: left;
  display: inline-block; /* برای وسط‌چین ماندن بلاک متنی در حالت کلی */
  background: #f8f9fa;
  padding: 25px;
  border-radius: 16px;
  width: 100%;
}

.credits-text p {
  margin-bottom: 6px;
  border-bottom: 1px dashed #e9ecef;
  padding-bottom: 4px;
}

.credits-text p:last-child {
  border-bottom: none;
}

.credits-text b {
  color: #219ebc;
  font-weight: 600;
}

.credits-text a {
  color: #fb8500;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.credits-text a:hover {
  color: #ffb703;
  text-decoration: underline;
}

/* =========================================
   دکمه شروع داستان (Start Story)
========================================= */
.btn-start-story {
  display: inline-block;
  text-decoration: none;
  background-color: #8ecae6;
  color: #023047;
  font-family: 'Baloo 2', cursive;
  font-size: 1.4rem;
  font-weight: 700;
  padding: 15px 40px;
  border-radius: 50px;
  box-shadow: 0 8px 20px rgba(142, 202, 230, 0.4);
  transition: all 0.3s ease;
}

.btn-start-story:hover {
  background-color: #219ebc;
  color: #fff;
  transform: scale(1.05);
  box-shadow: 0 10px 25px rgba(33, 158, 188, 0.5);
}

/* =========================================
   واکنش‌گرایی برای موبایل (Responsive)
========================================= */
@media (max-width: 600px) {
  h2 {
    font-size: 1.8rem;
  }
  
  .credits-container {
    padding: 25px 20px;
  }
  
  .credit-logo-img {
    max-height: 60px;
  }
  
  .credits-text {
    font-size: 0.9rem;
    padding: 15px;
  }
}