/* CSS Sıfırlama ve Temel Ayarlar */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Fredoka', sans-serif;
    background-color: #a1c4fd;
    touch-action: none;
    position: fixed; /* Mobilde çekip kaydırmayı engellemek için */
}

/* Gökyüzü Arka Planı */
.sky-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #89f7fe 0%, #66a6ff 100%);
    z-index: 1;
}

/* Bulut Tasarımı ve Animasyonu */
.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 100px;
    filter: blur(1px);
    pointer-events: none;
}

.cloud::before, .cloud::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
}

/* Bulut Şekilleri */
.cloud-1 {
    width: 150px;
    height: 50px;
    top: 15%;
    left: -180px;
    animation: drift 25s linear infinite;
}
.cloud-1::before {
    width: 70px;
    height: 70px;
    top: -35px;
    left: 20px;
}
.cloud-1::after {
    width: 50px;
    height: 50px;
    top: -20px;
    left: 75px;
}

.cloud-2 {
    width: 220px;
    height: 70px;
    top: 35%;
    left: -250px;
    animation: drift 35s linear infinite 5s;
    opacity: 0.7;
}
.cloud-2::before {
    width: 100px;
    height: 100px;
    top: -50px;
    left: 30px;
}
.cloud-2::after {
    width: 80px;
    height: 80px;
    top: -35px;
    left: 100px;
}

.cloud-3 {
    width: 120px;
    height: 40px;
    top: 60%;
    left: -150px;
    animation: drift 20s linear infinite 12s;
    opacity: 0.9;
}
.cloud-3::before {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 15px;
}
.cloud-3::after {
    width: 40px;
    height: 40px;
    top: -15px;
    left: 50px;
}

.cloud-4 {
    width: 180px;
    height: 60px;
    top: 8%;
    left: -200px;
    animation: drift 42s linear infinite 2s;
    opacity: 0.8;
}
.cloud-4::before {
    width: 80px;
    height: 80px;
    top: -40px;
    left: 25px;
}
.cloud-4::after {
    width: 60px;
    height: 60px;
    top: -25px;
    left: 85px;
}

@keyframes drift {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 300px)); }
}

/* Oyun Konteyneri */
#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    overflow: hidden;
}

/* Balon Genel Tasarımı */
.balloon-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 110px;
    height: 180px; /* Balon boyu + ipi */
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    will-change: transform;
}

/* Balonun Şişkin Kısmı */
.balloon {
    width: 110px;
    height: 130px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    position: relative;
    box-shadow: inset -8px -8px 15px rgba(0,0,0,0.15),
                inset 8px 8px 15px rgba(255,255,255,0.4),
                0 10px 20px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: wobble 4s ease-in-out infinite alternate;
}

/* Balonun Düğümlü Kısmı */
.balloon::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: calc(50% - 7px);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 8px solid currentColor; /* Renge göre dinamik değişir */
}

/* Balon İpi */
.balloon-string {
    width: 2px;
    height: 50px;
    background: rgba(255, 255, 255, 0.6);
    position: relative;
    top: 5px;
}

/* Arapça Harf */
.arabic-letter {
    font-family: 'Amiri', serif;
    font-size: 64px;
    font-weight: 500;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.25);
    user-select: none;
    pointer-events: none;
    line-height: 1;
    margin-bottom: 12px; /* Düğümden biraz yukarı */
}

/* Balon Renk Temaları (Parlak Çocuk Renkleri) */
.balloon-red { background-color: #ff5e62; color: #ff5e62; }
.balloon-blue { background-color: #38ef7d; color: #38ef7d; } /* Yanlış isimlendirmeleri düzeltelim */
.balloon-green { background-color: #11998e; color: #11998e; }
.balloon-orange { background-color: #ff9966; color: #ff9966; }
.balloon-purple { background-color: #b06ab3; color: #b06ab3; }
.balloon-pink { background-color: #ff85a2; color: #ff85a2; }
.balloon-cyan { background-color: #4facfe; color: #4facfe; }
.balloon-yellow { background-color: #f7b733; color: #f7b733; }

/* Ay Dede (Hilal) Tasarımı */
.ay-dede-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 150px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    will-change: transform;
}

.ay-dede-svg {
    width: 130px;
    height: 130px;
    filter: drop-shadow(0 6px 12px rgba(253, 224, 71, 0.4));
    pointer-events: none;
    animation: wobble-moon 5s ease-in-out infinite alternate;
}

/* Sallanma Animasyonları */
@keyframes wobble {
    0% { transform: rotate(-5deg); }
    100% { transform: rotate(5deg); }
}

@keyframes wobble-moon {
    0% { transform: rotate(-8deg) scale(0.95); }
    100% { transform: rotate(8deg) scale(1.05); }
}

/* Arayüz Elemanları */
.ui-container {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    pointer-events: none;
}

.ui-btn {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.6);
    color: white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s, background 0.2s;
}

.ui-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.4);
}

/* Başlangıç Ekranı */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 166, 255, 0.95);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.5s ease-out;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.start-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 32px;
    padding: 30px 20px;
    text-align: center;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 6px solid #ff9966;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.start-card h1 {
    color: #ff5e62;
    font-size: 32px;
    margin-bottom: 12px;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.05);
}

.start-card p {
    color: #4a5568;
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.intro-graphics {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.intro-balloon {
    width: 60px;
    height: 75px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cairo', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: white;
    animation: floatIntro 3s ease-in-out infinite alternate;
}

.intro-balloon.balloon-red {
    background-color: #ff5e62;
    animation-delay: 0.2s;
}

.intro-balloon.balloon-blue {
    background-color: #4facfe;
    animation-delay: 0.8s;
}

.intro-moon {
    font-size: 48px;
    animation: rotateIntro 4s ease-in-out infinite alternate;
}

.start-game-btn {
    background: linear-gradient(135deg, #ff9966 0%, #ff5e62 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 16px 40px;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(255, 94, 98, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    width: 80%;
    max-width: 280px;
}

.start-game-btn:active {
    transform: scale(0.95);
    box-shadow: 0 4px 6px rgba(255, 94, 98, 0.4);
}

.helper-text {
    font-size: 12px !important;
    color: #a0aec0 !important;
    margin-top: 16px;
    margin-bottom: 0 !important;
}

@keyframes popIn {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes floatIntro {
    0% { transform: translateY(0) rotate(-5deg); }
    100% { transform: translateY(-15px) rotate(5deg); }
}

@keyframes rotateIntro {
    0% { transform: translateY(0) rotate(-10deg) scale(0.9); }
    100% { transform: translateY(-10px) rotate(10deg) scale(1.1); }
}

/* Patlama Parçacıkları */
.particle {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;
    will-change: transform, opacity;
}

/* Bulutlar ve Butonların Kaymasını Önlemek için Genel */
button {
    font-family: inherit;
    outline: none;
}

/* Giriş Ekranı İletişim ve Kredi Alanı */
.credits {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 2px dashed #ff9966;
}

.credits p {
    font-size: 14px !important;
    color: #4a5568 !important;
    margin-bottom: 2px !important;
    line-height: 1.4 !important;
}

.credits strong {
    color: #ff5e62;
    font-weight: 700;
    font-size: 16px;
}

.credits .phone {
    font-size: 13px !important;
    color: #718096 !important;
    margin-top: 4px !important;
    font-weight: 600;
}

/* Mobil Yatay Mod ve Küçük Dikey Ekranlar İçin Düzenlemeler */
@media (max-height: 480px) {
    .start-card {
        padding: 15px 15px;
        border-width: 4px;
        border-radius: 20px;
        max-width: 400px;
    }
    
    .start-card h1 {
        font-size: 22px;
        margin-bottom: 4px;
    }
    
    .start-card p {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    /* Yükseklikten tasarruf etmek için dekoratif grafikleri yatayda gizle */
    .intro-graphics {
        display: none;
    }
    
    .start-game-btn {
        padding: 10px 30px;
        font-size: 18px;
        margin-top: 5px;
    }
    
    .helper-text {
        margin-top: 8px;
        font-size: 10px !important;
    }
    
    .credits {
        margin-top: 12px;
        padding-top: 8px;
    }
    
    .credits p {
        font-size: 11px !important;
    }
    
    .credits strong {
        font-size: 13px;
    }
    
    .credits .phone {
        font-size: 11px !important;
        margin-top: 2px !important;
    }
}

/* Bölüm Geçme (Celebration) Ekranı */
.level-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 166, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease-out;
}

.level-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.level-card-celebrate {
    background: white;
    border-radius: 40px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    border: 8px solid #38ef7d;
    max-width: 320px;
    width: 90%;
    animation: celebratePop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.level-star {
    font-size: 80px;
    margin-bottom: 10px;
    animation: spinStar 3s linear infinite;
    display: inline-block;
}

.level-card-celebrate h2 {
    color: #38ef7d;
    font-size: 36px;
    margin-bottom: 8px;
}

.level-card-celebrate p {
    color: #4a5568;
    font-size: 20px;
    font-weight: 600;
}

@keyframes celebratePop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes spinStar {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.15); }
    100% { transform: rotate(360deg) scale(1); }
}

/* Konfeti Yağmuru Parçacığı */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    pointer-events: none;
    z-index: 250;
    will-change: transform, opacity;
}
