/* =========================================
   MOPO STORYBOOK - FULL UNIFIED STYLES
========================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Baloo 2', 'Poppins', sans-serif;
    color: #333;
    overflow-x: hidden;
}

#storybook-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    background-image: url('image/background.png'); 
    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-container {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 70%; 
    background-color: rgba(255, 255, 255, 0.95);
    padding: 10px 20px; 
    border-radius: 20px;
    border: 3px solid #3b82f6; 
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    text-align: center;
    z-index: 20;
}

.story-text {
    font-size: 30px; 
    line-height: 1.6;
}

.word {
    display: inline-block;
    transition: color 0.2s;
    margin: 0 3px;
}

.word.highlight {
    color: #d35400; 
}

/* ================== المان‌های صفحه ۱ و ۲ ================== */
#mopo-main, #mopo-page2 {
    width: 350px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.teeth-orbit {
    position: absolute;
    width: 50px;
    top: 50%;
    left: 50%;
    margin-top: -25px; 
    margin-left: -25px;
    z-index: 10;
    cursor: pointer;
    transition: all 0.6s ease-out;
    animation: orbit 20s linear infinite;
}

@keyframes orbit {
    from { transform: rotate(0deg) translateX(200px) rotate(0deg); }
    to   { transform: rotate(360deg) translateX(200px) rotate(-360deg); }
}

/* ================== المان‌های صفحه ۳ ================== */
#table-img {
    position: absolute;
    bottom: -2%; 
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 850px; 
    z-index: 4;
    pointer-events: none;
}

#mopo-page3 {
    width: 380px; 
    position: absolute;
    bottom: 8%; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
}

#mopo-page3:hover {
    transform: translateX(-50%) scale(1.03);
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.8));
}

.magic-bubble {
    position: absolute;
    background: rgba(255, 255, 255, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.5);
    z-index: 12;
    pointer-events: none;
    animation: floatBubble 2.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes floatBubble {
    0% { transform: translateY(0) scale(0.6) translateX(0); opacity: 1; }
    50% { transform: translateY(-180px) scale(1.1) translateX(15px); }
    100% { transform: translateY(-380px) scale(1.4) translateX(-10px); opacity: 0; }
}

/* ================== المان‌های صفحه ۴ ================== */
#table-page4 {
    position: absolute;
    bottom: -2%; 
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 850px;
    z-index: 4;
    pointer-events: none;
}

#mopo-page4 {
    width: 380px; 
    position: absolute;
    bottom: 8%; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    transition: all 0.5s ease-in-out;
}

#toothbrushes-container {
    position: absolute;
    bottom: 12%; 
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: space-between;
    width: 400px; 
    z-index: 10;
}

.t-brush {
    height: 120px; 
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.5s ease;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.2));
}

.t-brush:hover {
    transform: translateY(-10px) scale(1.05);
    filter: drop-shadow(0 10px 10px rgba(255, 255, 255, 0.6));
}

.brush-magic-fly {
    transform: translateY(-200px) scale(1.3) rotate(25deg) !important;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 1));
    z-index: 50;
    pointer-events: none;
}

/* ================== المان‌های صفحه ۵ ================== */
#table-page5 {
    position: absolute;
    bottom: -2%; 
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 850px;
    z-index: 4;
    pointer-events: none;
}

#mopo-page5 {
    width: 380px; 
    position: absolute;
    bottom: 8%; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    transition: transform 0.5s ease;
    cursor: pointer;
}

.sway-anim {
    animation: gentleSway 2.5s ease-in-out infinite;
}

@keyframes gentleSway {
    0% { transform: translateX(-50%) rotate(0deg); }
    25% { transform: translateX(-55%) rotate(-5deg); }
    75% { transform: translateX(-45%) rotate(5deg); }
    100% { transform: translateX(-50%) rotate(0deg); }
}

.sparkle-bubble {
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8), inset 0 0 5px rgba(255, 255, 255, 1);
    z-index: 12;
    pointer-events: none;
    animation: floatBubble 2.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ================== المان‌های صفحه ۶ (جدید) ================== */
#table-page6 {
    position: absolute;
    bottom: -2%; 
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 850px;
    z-index: 4;
    pointer-events: none;
}

#mopo-page6 {
    width: 380px; 
    position: absolute;
    bottom: 8%; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    cursor: pointer;
}

/* انیمیشن پرش شادمانه موپو */
.jump-anim {
    animation: happyJump 0.6s ease-out;
}

@keyframes happyJump {
    0% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-50px) scaleY(1.05); }
    100% { transform: translateX(-50%) translateY(0); }
}

/* افکت هاله نوری ملایم پشت موپو */
#final-glow-container {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 10px; height: 10px;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,223,0,0) 70%);
    border-radius: 50%;
    z-index: 3;
    opacity: 0;
    transition: all 1s ease-out;
    pointer-events: none;
}

.active-glow {
    width: 600px !important;
    height: 600px !important;
    opacity: 1 !important;
}

/* ================== ناوبری (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);
    transition: all 0.3s;
}

.nav-btn:hover {
    background-color: #2563eb;
    transform: scale(1.05);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
/* =========================================
   CREDITS PAGE STYLES (MATCHING SCREENSHOT)
========================================= */

.credits-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #1e293b; /* پس‌زمینه سورمه‌ای تیره بر اساس عکس */
    padding: 20px;
    position: relative;
}

/* دکمه خانه در بالا سمت چپ */
.credits-wrapper .home-button {
    position: absolute;
    top: 20px;
    left: 20px;
    background-color: white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.3s;
    z-index: 100;
}

.credits-wrapper .home-button:hover {
    transform: scale(1.1);
}

.credits-container {
    background: #ffffff;
    border-radius: 20px;
    padding: 40px;
    max-width: 650px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    max-height: 85vh; /* ایجاد اسکرول‌بار برای کادر در صورت طولانی بودن محتوا */
    overflow-y: auto;
}

.credits-logos {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
}

.credit-logo-img {
    height: 50px;
    object-fit: contain;
}

.credits-container h2 {
    color: #16a34a; /* رنگ سبز عنوان دقیقاً مطابق عکس */
    font-size: 2.2rem;
    margin-bottom: 20px;
    font-family: 'Baloo 2', sans-serif;
}

.credits-text {
    text-align: left;
    color: #334155;
    font-family: 'Poppins', sans-serif;
    line-height: 1.8;
    font-size: 1rem;
}

.credits-text p {
    margin-bottom: 5px;
}

.credits-text a {
    color: #2563eb; /* رنگ آبی برای لینک سایت‌ها */
    text-decoration: none;
    font-weight: bold;
}

/* دکمه شروع داستان */
.btn-start-story {
    display: inline-block;
    background-color: #16a34a; /* رنگ سبز دکمه */
    color: white;
    padding: 12px 35px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
    font-family: 'Baloo 2', sans-serif;
    margin-top: 30px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(22, 163, 74, 0.4);
}

.btn-start-story:hover {
    transform: scale(1.05);
    background-color: #15803d;
}
/* تنظیم شبکه بازی */
.cards-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 30px !important;
    padding: 20px !important;
    width: 90% !important;
    margin: 40px auto !important;
}

.magic-card {
    background: white;
    border-radius: 30px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.magic-card:hover {
    transform: translateY(-10px);
    border-color: #16a34a;
}

.card-img {
    width: 100%;
    max-height: 150px;
    object-fit: contain;
    display: block; /* برای اینکه تصویر در کارت وسط بیاید */
    margin: 0 auto;
}

.card-title {
    font-family: 'Baloo 2', cursive;
    color: #5d4037;
    margin-top: 15px;
    font-size: 1.5rem;
}
/* تنظیمات دقیق برای شبکه بازی (Grid) */
.cards-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 30px !important;
    padding: 30px !important;
    max-width: 900px !important;
    margin: 0 auto !important;
}

.magic-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 30px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 4px solid transparent;
}

.magic-card:hover {
    transform: translateY(-10px);
    border-color: #16a34a; /* رنگ سبز ملایم */
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.card-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

.card-title {
    font-family: 'Baloo 2', cursive;
    color: #5d4037;
    margin-top: 15px;
    font-size: 1.4rem;
    font-weight: bold;
}
/* تنظیمات پایه */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Baloo 2', cursive; }
body { background-color: #f0f9ff; display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }

.game-container { text-align: center; max-width: 600px; width: 100%; }

/* عنوان و راهنما */
h1 { color: #0f172a; margin-bottom: 10px; }
#instruction-text { font-size: 1.2rem; color: #475569; margin-bottom: 20px; }

/* دکمه اسپیکر */
.speaker-container { margin-bottom: 30px; }
.btn-speaker { 
    background-color: #3b82f6; color: white; border: none; 
    padding: 15px 30px; border-radius: 50px; font-size: 1.2rem; 
    cursor: pointer; transition: transform 0.2s, background-color 0.2s; 
}
.btn-speaker:hover { background-color: #2563eb; transform: scale(1.05); }

/* گرید کارت‌ها - اینجا بخش جادویی چیدمان است */
.cards-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); /* دو ستونه */
    gap: 20px; 
}

.option-card { 
    background: white; border-radius: 20px; padding: 15px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); cursor: pointer; 
    transition: all 0.3s ease; border: 4px solid transparent;
}
.option-card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px rgba(0,0,0,0.2); }

.card-img { width: 100%; height: 150px; object-fit: contain; }

/* افکت‌های بازخورد */
.correct-choice { border-color: #10b981 !important; transform: scale(1.05); }
.wrong-choice { border-color: #ef4444 !important; animation: shake 0.4s; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* موبایل */
@media (max-width: 480px) {
    .cards-grid { grid-template-columns: 1fr; }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background-color: #f0f9ff; font-family: sans-serif; display: flex; justify-content: center; padding: 20px; }

.game-container { text-align: center; max-width: 600px; width: 100%; }

.speaker-container { margin: 30px 0; }
.btn-speaker { background: #3b82f6; color: white; padding: 15px 30px; border-radius: 50px; border: none; cursor: pointer; font-size: 1.2rem; }

.cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.option-card { background: white; padding: 15px; border-radius: 20px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); cursor: pointer; border: 4px solid transparent; transition: 0.3s; }
.option-card img { width: 100%; height: 150px; object-fit: contain; }

.correct-choice { border-color: #10b981; transform: scale(1.05); }
.wrong-choice { border-color: #ef4444; animation: shake 0.4s; }

@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }

@media (max-width: 480px) {
    .cards-grid { grid-template-columns: 1fr; }
}
/* Navigation Bar Styling */
.nav {
    position: absolute; /* این دستور منو را از چیدمان اصلی جدا می‌کند */
    top: 0; /* منو را به بالاترین نقطه صفحه می‌چسباند */
    left: 0; /* از سمت چپ تراز می‌کند */
    display: flex;
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 15px; 
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    z-index: 100; /* باعث می‌شود منو همیشه روی بقیه اجزا قرار بگیرد */
}

/* Individual Button Styling */
.nav-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 24px;
    background-color: #4285F4; /* Blue color from your screenshot */
    color: white;
    text-decoration: none;
    border-radius: 30px; /* Makes the pill/capsule shape */
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap; /* CRITICAL: Stops the text from wrapping to a second line */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Adds a soft drop shadow */
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.nav-btn:hover {
    background-color: #3367D6; /* Slightly darker blue when you hover */
    transform: translateY(-2px); /* Moves the button up slightly when hovered */
}
.game-container {
    margin-top: 100px; /* این خط باعث می‌شود بازی از بالا فاصله بگیرد و زیر منو نرود */
    /* ... سایر کدهایی که از قبل در این کلاس بود را پاک نکنید ... */
}