/* Font Tanımlamaları */
@font-face {
    font-family: 'Arakom';
    src: url('../fonts/Arakom.ttf') format('truetype');
}

@font-face {
    font-family: 'WinSoft';
    src: url('../fonts/WinSoftPro-Med.otf') format('opentype');
}

.title-font { font-family: 'Arakom', sans-serif; }
.arabic-ui { font-family: 'WinSoft', sans-serif; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none; 
    -webkit-user-select: none;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden; 
    background-color: #87CEEB; 
}

#game-area {
    position: relative;
    width: 100%;
    height: 100%;
    background-image: url('../images/background.png');
    background-size: cover; 
    background-position: bottom center; 
    overflow: hidden;
}

#hud {
    position: absolute;
    top: 10px;
    left: 5px;
    right: 5px;
    display: flex;
    flex-wrap: wrap; 
    justify-content: center;
    align-items: center;
    z-index: 100;
    gap: 6px;
}

.hud-item {
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 10px;
    border-radius: 15px;
    font-size: 0.95rem;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    white-space: nowrap;
    transition: color 0.3s;
}

.hud-buttons { display: flex; gap: 5px; }

.btn {
    padding: 6px 10px;
    border: none;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    background: #FFD700;
    color: #333;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: transform 0.1s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn:active { transform: scale(0.95); }

.primary-btn {
    font-size: 1.3rem;
    padding: 12px 30px;
    background: #4CAF50;
    color: white;
}

/* Tüm Kaplama Ekranları */
.overlay-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 9999; 
    padding: 10px;
}

/* Eğitim Modu Blur Efekti */
.blur-bg {
    backdrop-filter: blur(15px);
    background: rgba(0, 0, 0, 0.6) !important;
}

.overlay-screen h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    text-align: center;
}

/* Rekor Skor Paneli */
.high-scores {
    font-size: 1.2rem;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 15px;
    border-radius: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Yeni Oyuncu İpucu Rozeti */
.hint-badge {
    position: absolute;
    top: -15px;
    right: 20%;
    background: #FF5252;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    pointer-events: none;
    animation: pulse-hint 1s infinite alternate;
}
@keyframes pulse-hint {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.15) rotate(-5deg); opacity: 1; }
}

/* Eğitim Modu Flashcard Tasarımı */
.flashcard {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    margin-bottom: 25px;
    width: 80vw;
    max-width: 400px;
}
.flashcard img {
    width: 100%;
    max-height: 250px;
    object-fit: contain;
    margin-bottom: 15px;
    /* YENİ: Balonların değil, sadece bu karta özel nefes animasyonunu kullanacak */
    animation: flashcard-breathe 3s infinite ease-in-out; 
    transform-origin: center center;
}

/* YENİ: Sadece Eğitim Modu Kartı İçin Merkezden Nefes Animasyonu */
@keyframes flashcard-breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}
.flashcard #train-name {
    font-size: 4rem;
    color: #333;
    display: inline-block;
}
.bounce-active {
    animation: bounce-text-anim 0.6s ease;
}
@keyframes bounce-text-anim {
    0%, 100% { transform: translateY(0) scale(1); color: #333; }
    50% { transform: translateY(-20px) scale(1.2); color: #FF5252; }
}
.train-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.stats-container {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid rgba(255,255,255,0.3);
    width: 100%;
    max-width: 400px;
    text-align: right;
}

.stats-container p { font-size: 1.3rem; margin-bottom: 5px; }

.bar-row { display: flex; align-items: center; margin-bottom: 8px; gap: 10px; }
.bar-label { width: 30%; text-align: left; font-size: 1.1rem; }
.bar-track { width: 70%; background: rgba(0,0,0,0.3); border-radius: 10px; height: 15px; overflow: hidden; }
.bar-fill { height: 100%; background: #FF5252; border-radius: 10px; transition: width 1s ease-out; }

/* Balon Mimarisi - YENİ DİNAMİK YAPI */
.balloon-wrapper {
    position: absolute;
    top: 0;  
    left: 0; 
    width: 25vw; 
    max-width: 200px; 
    min-width: 90px; 
    /* Yükseklik kısıtlamasını (aspect-ratio) kaldırdık ki her şekli alabilsin */
    cursor: pointer;
}

.balloon-img { 
    position: relative; 
    width: 100%; 
    height: auto; /* Görsel kendi şeklini korur (yatay balık veya dikey roket) */
    display: block;
    z-index: 2; 
}

/* Hayvan Görseline Canlılık Hissi Veren Animasyon */
.animal-img { 
    position: absolute; 
    width: 55%; 
    aspect-ratio: 1 / 1; 
    object-fit: contain; 
    top: 45%; /* Görselin merkezinin çok hafif üstü */
    left: 50%; /* Tam ortası */
    z-index: 3; 
    pointer-events: none; 
    animation: animal-breathe 2.5s infinite ease-in-out;
}

/* Animasyona "translate(-50%, -50%)" eklendi ki şekiller hep merkezde kalsın */
@keyframes animal-breathe {
    0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    50% { transform: translate(-50%, -60%) scale(1.08) rotate(3deg); }
}

.animal-name-box {
    position: absolute;
    bottom: -25px; /* Dinamik şekillerde kaymaması için px olarak alta sabitledik */
    left: 50%;
    transform: translateX(-50%);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-family: 'Arakom', sans-serif;
    font-size: 1.5rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 3px solid white;
    white-space: nowrap;
    z-index: 5;
    pointer-events: none;
    transition: all 0.3s;
}

.powerup-icon {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 3rem;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(255,255,255,0.8);
}

.balloon-freeze .balloon-img { filter: hue-rotate(180deg) brightness(1.2) drop-shadow(0 0 10px #00BCD4); }
.balloon-hint .balloon-img { filter: hue-rotate(270deg) brightness(1.2) drop-shadow(0 0 10px #E040FB); }

.fade-out {
    opacity: 0.15 !important;
    transition: opacity 0.5s ease;
    pointer-events: none !important;
}

.time-add { color: #4CAF50 !important; transform: scale(1.2); }
.time-sub { color: #FF5252 !important; transform: scale(1.2); }

.balloon-wrapper.level-2 .animal-name-box { transform: translateX(-50%) scale(0.7); }
.balloon-wrapper.level-3 .animal-name-box { display: none; }
.balloon-wrapper.level-4 .animal-name-box { display: none; } 

.shake { animation: shake-animation 0.5s ease-in-out; }
@keyframes shake-animation {
    0% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-10px) rotate(-5deg); }
    50% { transform: translateX(10px) rotate(5deg); }
    75% { transform: translateX(-10px) rotate(-5deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

.pop-effect { transform: scale(0.1) !important; opacity: 0; transition: all 0.2s ease-out !important; pointer-events: none; }

@media (max-width: 600px) {
    .hide-mobile { display: none; }
    .powerup-icon { font-size: 2rem; }
    .flashcard #train-name { font-size: 3rem; }
    .hint-badge { right: 10%; }
}

@media (min-width: 768px) {
    #hud { justify-content: space-between; flex-wrap: nowrap; gap: 15px; top: 20px; left: 20px; right: 20px; }
    .hud-item { font-size: 1.2rem; padding: 10px 20px; }
    .btn { font-size: 1.1rem; padding: 10px 20px; }
    .balloon-wrapper { max-width: 215px; }
    .animal-name-box { font-size: 1.8rem; }
    .powerup-icon { font-size: 4rem; }
}
/* --- YENİ: PDF KARNE TASARIMI (ŞIK VE ARAPÇA) --- */
#certificate-template {
    position: fixed;
    top: 0;
    left: 0;
    z-index: -9999; 
}

#cert-content {
    width: 800px;
    height: 600px;
    background: radial-gradient(circle, #ffffff 20%, #e0f2f1 100%);
    border: 20px solid #2E7D32; /* Koyu şık ve resmi bir yeşil çerçeve */
    padding: 15px;
    box-sizing: border-box;
    position: relative;
}

.cert-inner {
    width: 100%;
    height: 100%;
    border: 3px double #FFD700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly; /* İÇERİĞİ SAYFAYA MÜKEMMEL ORTALAR VE DAĞITIR */
    padding: 10px 20px; /* Üstteki fazla boşluğu azalttık */
    box-sizing: border-box;
}

.cert-inner h1 {
    color: #1B5E20; /* Şık ve resmi koyu yeşil */
    font-size: 4.8rem; /* Kocaman font */
    margin: 5;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.15); /* Zarif bir gölge */
}

.subtitle-text {
    color: #424242;
    font-size: 1.7rem;
    margin-top: 10px; /* Üstündeki dev başlık ile arasını açar */
    margin-bottom: 5px; /* Altındaki rozet ile dengeler */
}

.score-badge {
    background: linear-gradient(135deg, #FF9800, #F44336);
    color: white;
    min-width: 160px; /* Rakam büyüdükçe yanlara esnemesini sağlar */
    height: 140px;
    padding: 0 30px; /* Esnediğinde yanlarda pay bırakır */
    border-radius: 70px; /* Kapsül/Hap şekli verir */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(244, 67, 54, 0.4);
    border: 5px solid #FFD700;
	margin-top: 4px;
    margin-bottom: 4px;
}

.score-badge #cert-score-val {
    font-size: 4rem; /* Rakamın kapsüle rahat sığması için biraz küçülttük */
    line-height: 1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
	margin-top: 3px;
    margin-bottom: 3px;
}

.accuracy-text {
    font-size: 1.8rem;
    color: #333;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 30px;
    border-radius: 30px;
    border: 2px solid #ccc;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    font-weight: normal; /* Kontur/Çamur görünümünü engeller */
    text-shadow: none !important; /* Tüm gölgeleri sıfırlar */
	margin-top: 3px;
    margin-bottom: 3px;
}

.footer-section {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    border-top: 2px dashed #9E9E9E;
    padding-top: 20px;
    color: #555;
    font-size: 1.4rem;
    font-weight: normal; /* Fonttaki suni kalınlaştırmayı (konturu) engeller */
    text-shadow: none !important; /* Tüm gölgeleri sıfırlar */
}
/* --- YENİ: KARNE HATALI KELİMELER BÖLÜMÜ --- */
.wrong-words-section {
    background: rgba(255, 235, 238, 0.8);
    border: 2px dashed #EF9A9A;
    border-radius: 15px;
    padding: 10px 15px;
    width: 90%;
    margin: 0; /* Boşlukları flex space-evenly'e bıraktık */
    text-align: center;
}

.wrong-word-chip {
    background: white;
    padding: 3px 12px;
    border-radius: 12px;
    border: 1px solid #FFCDD2;
    color: #D32F2F;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
/* Tüm oyun ekranı için sarsıntı efekti */
#game-area.shake {
    animation: screen-shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes screen-shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
    40%, 60% { transform: translate3d(8px, 0, 0); }
}
.extra-life-anim {
    position: absolute;
    font-size: 2.5rem;
    color: #4CAF50;
    pointer-events: none;
    z-index: 10002;
    animation: floatUpLife 1.5s ease-out forwards;
}

@keyframes floatUpLife {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-150px) scale(1.5); opacity: 0; }
}
/* Altın Balon Özel Görünümü */
.balloon-gold .balloon-img {
    filter: hue-rotate(10deg) brightness(1.3) saturate(1.5) drop-shadow(0 0 15px #FFD700);
    animation: gold-pulse 1s infinite alternate;
}

@keyframes gold-pulse {
    0% { filter: hue-rotate(10deg) brightness(1.3) drop-shadow(0 0 5px #FFD700); }
    100% { filter: hue-rotate(10deg) brightness(1.6) drop-shadow(0 0 25px #FFF176); }
}

/* Altın Balon Yazı Kutusu */
.balloon-gold .animal-name-box {
    background: linear-gradient(135deg, #FFD700, #FFA000) !important;
    color: #333 !important;
    border-color: #FFF !important;
    font-weight: bold;
}
/* Bonus Yazısı İçin Özel Belirginlik (Kontur) */
.bonus-text-effect {
    font-weight: bold;
    text-shadow: 
        2px 2px 0 #000, 
       -2px -2px 0 #000, 
        2px -2px 0 #000, 
       -2px  2px 0 #000, 
        0px  0px 10px rgba(255, 215, 0, 0.9); /* Altın parlaması */
    letter-spacing: 1px;
}