:root {
            --font-family: 'Marhey', sans-serif;
            --font-family-arabic: 'Harmattan', serif;
            --primary-color: #007bff;
            --success-color: #28a745; 
            --error-color: #dc3545;
            --star-color: #ffc107; 
            
            --background-color: #f8f9fa; 
            --panel-background: #f8f9fa; 
            --text-color: #343a40; 
            --light-text-color: #adb5bd;
            
            --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.05);
            --shadow-dark: 0 10px 15px rgba(0, 0, 0, 0.1);
            --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.06);

            --container-width: 90%; 
            --circle-size: 38px;
            --circle-font-size: 1.1em; 
        }

        html, body { 
            height: 100%; 
            margin: 0; 
            padding: 0; 
            overflow: hidden; 
            overscroll-behavior: none;
        }
        
        body {
    font-family: var(--font-family) !important;
    background-color: var(--background-color); 
    color: var(--text-color);
    background-image: linear-gradient(45deg, rgba(0,0,0,0.02) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.02) 75%),
                      linear-gradient(45deg, rgba(0,0,0,0.02) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.02) 75%);
    background-size: 4px 4px;
    background-position: 0 0, 2px 2px;
    
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    padding: 5px; box-sizing: border-box; 
    direction: ltr;
    
    margin: 0 auto; /* YENİ EKLENEN SATIR: Bu, body'yi yatayda ortalamaya zorlar */
}
        
        #game-container {
             width: var(--container-width); 
             position: relative;
             margin: auto; 
        }
        main { display: none; }
        main.active { display: block; }

        /* Ana Panel */
        #level2-container {
            width: 100%; 
            margin: 0 auto;
            padding: 15px 25px;
            background-color: var(--panel-background);
            border-radius: 20px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            direction: ltr;
            text-align: center;
            max-height: 98vh;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            overflow-y: auto; 
            font-size: clamp(14px, 1.6vw, 18px);
            position: relative; 
        }

        /* Dairesel Geri Tuşu */
        .back-button {
            position: absolute;
            top: 15px;
            left: 25px;
            font-size: 1.5em; /* İkonu büyüt */
            color: #000000; /* Siyah ikon */
            background-color: #ffffff; /* Beyaz dolgu */
            border-radius: 50%; /* Daire */
            width: 44px;  /* Kompakt boyut */
            height: 44px; /* Kompakt boyut */
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: var(--shadow-light);
            cursor: pointer;
            z-index: 10;
            font-family: var(--font-family);
            transition: all 0.2s ease;
            line-height: 1; /* Dikey hizalama için */
        }
        .back-button:hover {
            background-color: #f0f0f0; /* Hafif gri hover */
            box-shadow: var(--shadow-dark);
            transform: scale(1.05);
        }

        /* Üst Bar */
        #l2-top-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            margin-bottom: 10px;
            flex-shrink: 0;
            direction: ltr;
            gap: 10px;
            padding-top: 40px; 
        }

        /* Sayaç */
        #l2-timer {
            font-family: var(--font-family) !important;
            font-size: 1.8em;
            font-weight: 700;
            color: var(--error-color);
            background: var(--panel-background);
            padding: 10px 20px;
            border-radius: 10px;
            box-shadow: var(--shadow-inset);
            flex-shrink: 0;
            min-width: 100px;
            text-align: center;
        }

        /* Puan Kutusu */
        #l2-score-display {
            font-family: var(--font-family) !important;
            font-size: 1.8em;
            font-weight: 700;
            color: var(--primary-color);
            background: var(--panel-background);
            padding: 10px 20px;
            border-radius: 10px;
            box-shadow: var(--shadow-inset);
            flex-shrink: 0;
            min-width: 120px;
            text-align: center;
        }

        /* Kelime İlerleme Çubuğu */
        #l2-turkish-word-area {
            display: flex;
            justify-content: center;
            gap: 8px;
            padding: 5px;
            border-radius: 10px;
            direction: ltr;
            flex-wrap: wrap; 
            flex-grow: 1;
            position: relative;
            background: var(--panel-background);
            box-shadow: var(--shadow-inset);
            min-height: 50px;
            align-items: center;
        }

        /* Hedef Kelime */
        .l2-target-word {
            font-family: var(--font-family) !important; 
            font-size: 1.3em;
            font-weight: bold;
            color: var(--text-color); 
            padding: 6px 12px;
            border-radius: 8px;
            background-color: var(--background-color); 
            transition: all 0.3s ease;
            opacity: 1;
            margin: 2px; 
            box-shadow: var(--shadow-light);
            border: 2px solid transparent;
        }
        .l2-target-word.active {
            color: var(--text-color);
            border: 2px solid var(--error-color);
            transform: scale(1.1);
            box-shadow: 0 0 10px var(--error-color);
            opacity: 1;
        }
        .l2-target-word.incorrect-flash {
            animation: word-flash-red 0.5s;
        }
        /* YENİ: Başarısız kelime stili (Kalıcı kırmızı) */
        .l2-target-word.failed {
            background-color: var(--error-color) !important;
            color: white !important;
            border-color: var(--error-color) !important;
            box-shadow: none !important;
            opacity: 0.8 !important; 
            transform: scale(1) !important;
        }
        .l2-target-word.done {
            background-color: var(--success-color); 
            color: white; 
            border: 2px solid var(--success-color); 
            opacity: 1; 
            transform: scale(1);
            box-shadow: none;
        }
        
        /* Ana Oyun Alanı */
        #l2-main-game-area {
            display: flex;
            direction: ltr; 
            gap: 25px; 
            width: 100%;
            border-top: 2px solid rgba(0,0,0,0.05);
            padding-top: 20px;
            flex-grow: 1;
            min-height: 70vh; 
        }

        /* Kalıplar (Sağdaki Sütunlar) */
        #l2-patterns-wrapper {
            flex-basis: 70%; 
            display: grid;
            /* GÜNCELLENDİ: Sütun sayısı artık JS tarafından --pattern-cols ile ayarlanıyor */
            grid-template-columns: repeat(var(--pattern-cols, 3), 1fr);
            grid-template-rows: repeat(4, auto); 
            gap: 15px; 
            row-gap: 20px;
            direction: rtl; 
            overflow-y: auto;
            position: relative;
            --line-color: rgba(0,0,0,0.1);
            align-content: start;
        }
        #l2-patterns-wrapper::before {
            content: ''; position: absolute; top: 0; bottom: 0;
            right: 33.33%; width: 4px; background-color: var(--line-color);
            transform: translateX(50%);
        }
        #l2-patterns-wrapper::after {
            content: ''; position: absolute; top: 0; bottom: 0;
            right: 66.66%; width: 4px; background-color: var(--line-color);
            transform: translateX(50%);
        }
        
        /* Kökler (En sağdaki sütun) */
        #l2-roots-sidebar {
            flex-basis: 30%; 
            display: grid; 
            /* GÜNCELLENDİ: Sütun/Sıra sayısı artık JS tarafından ayarlanıyor */
            grid-template-columns: 1fr 1fr; 
            grid-template-rows: repeat(5, auto); 
            gap: 15px; 
            direction: rtl;
            overflow-y: auto;
            align-content: center; 
        }

        /* Sürüklenebilir Kök Kartı */
        .l2-draggable-root { 
            display: flex;
            align-items: center; justify-content: center; gap: 10px; 
            padding: 10px; 
            font-family: var(--font-family-arabic) !important;
            font-size: clamp(1.6em, 3.5vh, 2.4em); 
            font-weight: bold; line-height: 1; 
            background-color: #FFFFFF; 
            border: 2px solid #e0e0e0;  
            box-shadow: var(--shadow-light); 
            color: var(--text-color); 
            border-radius: 15px; 
            cursor: grab; 
            transition: all 0.2s ease;
            user-select: none; position: relative;
            z-index: 2;
            touch-action: none; 
            width: 90%; 
            justify-self: center; 
            min-height: 10vh; 
            box-sizing: border-box;
            animation: gentle-wobble 2s infinite ease-in-out;
        }
        .l2-draggable-root:hover { 
            transform: translateY(-3px); 
            box-shadow: var(--shadow-dark); 
            animation-play-state: paused;
        }
        .l2-draggable-root.dragging {
            opacity: 0.3 !important; animation: none !important;
            box-shadow: var(--shadow-inset) !important; cursor: grabbing;
        }
        .l2-draggable-root.highlight-correct-root {
            border-width: 3px;
            transform: scale(1.05);
            animation: none;
        }

        /* Hayalet Kart */
        .drag-ghost { 
            position: fixed; top: 0; left: 0; 
            display: inline-flex; align-items: center; justify-content: center; gap: 10px; 
            padding: 10px;
            font-family: var(--font-family-arabic) !important;
            font-size: clamp(1.6em, 3.5vh, 2.4em);
            font-weight: bold; line-height: 1; 
            background-color: #FFFFFF; 
            border: 2px solid var(--primary-color); 
            box-shadow: 0 10px 25px rgba(0,0,0,0.25); 
            color: var(--text-color); 
            border-radius: 15px; 
            transform: scale(1.05) !important; 
            opacity: 0.9;
            pointer-events: none; z-index: 1000; 
            direction: rtl !important;
            transition: none; 
        }
        .drag-ghost span { display: inline-block; font-family: var(--font-family-arabic) !important; }

        /* Kalıp Kutusu */
        .l2-pattern-group {
            background-color: transparent; 
            border: 2px dashed #cccccc; 
            box-shadow: none; 
            border-radius: 15px;
            padding: 8px;
            padding-top: calc(var(--circle-size) + 12px); 
            transition: all 0.3s ease;
            position: relative;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            width: 90%; 
            justify-self: center; 
            min-height: 15vh; 
            box-sizing: border-box;
        }
        
        .l2-pattern-group.dragover { 
            border-style: solid; border-color: var(--primary-color);
            background-color: rgba(0, 123, 255, 0.1); 
            box-shadow: none; 
        }
        .l2-pattern-group.incorrect-flash { 
            animation: shake 0.5s; 
            border-color: var(--error-color);
            background-color: rgba(220,53,69, 0.1);
        }
        .l2-pattern-group.highlight-correct-pattern {
            border-color: var(--success-color);
            border-style: solid;
            background-color: rgba(40,167,69, 0.1);
        }

        /* Daire İkonu */
        .pattern-number-circle {
            position: absolute;
            left: 50%; top: 8px;  
            transform: translateX(-50%); 
            width: var(--circle-size); height: var(--circle-size);
            background-color: var(--background-color); 
            color: var(--error-color); 
            border-radius: 50%;
            display: flex;
            align-items: center; justify-content: center;
            font-size: var(--circle-font-size);
            font-weight: bold;
            font-family: var(--font-family);
            z-index: 3; line-height: 1; 
            box-shadow: none; 
            border: 2px solid #eeeeee; 
        }

        /* Kalıp Metni */
        .l2-pattern-number {
            font-family: var(--font-family-arabic) !important;
            font-size: clamp(2.2em, 5vh, 3.0em); 
            font-weight: normal;
            color: var(--error-color); 
            position: absolute; 
            width: 100%; left: 0;
            top: calc(var(--circle-size) + 12px); 
            height: calc(100% - var(--circle-size) - 12px); 
            display: flex; align-items: center; justify-content: center;
            gap: 10px;
            direction: rtl;
            padding: 0 10px;
            pointer-events: none;
            transition: opacity 0.3s ease; 
            box-sizing: border-box; 
        }
        .l2-pattern-number span { display: inline-block; line-height: 1; background-color: transparent; padding: 3px 6px; border-radius: 4px; }
        .l2-pattern-number.hidden { opacity: 0; }

        /* Başarı Metni */
        .l2-derived-word {
            font-family: var(--font-family-arabic) !important; 
            font-size: clamp(2.4em, 5vh, 3.2em); /* GÜNCELLENDİ: Yazı tipi büyütüldü */
            font-weight: bold;
            color: var(--success-color); 
            text-align: center;
            line-height: 1.2;
            position: absolute;
            width: 100%; height: 100%;
            top: 0; left: 0;
            transform: none; 
            direction: rtl;
            padding: 10px; /* GÜNCELLENDİ: Genel dolgu ayarlandı */
            padding-bottom: 15px; /* GÜNCELLENDİ: Alt boşluk eklendi */
            display: flex;
            align-items: flex-end; /* GÜNCELLENDİ: 'center' -> 'flex-end' (Aşağıya hizalar) */
            justify-content: center;
            gap: 8px; 
            background-color: var(--background-color);
            z-index: 2;
            box-sizing: border-box; /* GÜNCELLENDİ: Padding'in kutu boyutunu bozmamasını sağlar */
        }
         .l2-derived-word span { font-size: 0.8em; line-height: 1; }

        /* Puan Patlama Animasyonu */
        .score-burst {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 1.8em;
            font-weight: bold;
            color: var(--success-color);
            font-family: var(--font-family);
            z-index: 10;
            pointer-events: none;
            animation: burst-and-fade 1.2s ease-out forwards;
        }

        #l2-global-result { 
            margin-top: 10px; 
            font-size: 1.0em; 
            color: var(--primary-color); 
            font-weight: 500; 
            min-height: 1.5em; 
            font-family: var(--font-family) !important; 
            flex-shrink: 0;
            display: none; 
        }
        
        .hidden { display: none !important; }

        /* Overlay */
        .overlay { 
            position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
            background-color: rgba(248, 249, 250, 0.97);
            display: flex; justify-content: center; align-items: center; text-align: center; 
            z-index: 10; transition: opacity 0.3s, visibility 0.3s; 
            direction: ltr; padding: 15px; box-sizing: border-box; 
        }
        .overlay.hidden { opacity: 0; visibility: hidden; }
        .overlay-content { 
            background: var(--panel-background); 
            padding: 30px 40px; 
            border-radius: 20px; 
            box-shadow: var(--shadow-dark);
            max-width: 90%; margin: auto; direction: ltr; text-align: center; 
            position: relative; /* YENİ: Geri tuşu için */
        }
        /* YENİ: Başlangıç ekranı geri tuşu konumu */
        #start-screen .back-button {
            top: 20px; 
            left: 20px;
        }


        .overlay h1, .overlay h2 { color: var(--text-color); margin-top: 0; font-family: var(--font-family) !important; }
        .start-options { display: flex; justify-content: center; gap: 15px; margin-top: 25px; margin-bottom: 30px; flex-wrap: wrap; }
        
        /* Seviye Butonları */
        .start-button-option { 
            background-color: var(--primary-color); 
            color: white; border: none; padding: 12px 25px; 
            font-size: 1.1em; font-weight: bold; border-radius: 10px; 
            cursor: pointer; transition: all 0.2s ease; flex-shrink: 0; 
            font-family: var(--font-family) !important; 
            box-shadow: var(--shadow-light);
            min-width: 120px;
        }
        .start-button-option:hover { 
            background-color: #0056b3; 
            transform: translateY(-2px); 
            box-shadow: var(--shadow-dark); 
        }
        .start-button-option:active {
            box-shadow: var(--shadow-inset);
            transform: translateY(1px);
        }
        .start-button-option[data-difficulty="easy"] { background-color: var(--success-color); }
        .start-button-option[data-difficulty="easy"]:hover { background-color: #1e7e34; }
        .start-button-option[data-difficulty="hard"] { background-color: var(--error-color); }
        .start-button-option[data-difficulty="hard"]:hover { background-color: #b21f2d; }


        /* Sonuç Ekranı Düzeni */
        #results-screen .overlay-content { 
            padding-top: 40px; 
            padding-bottom: 40px; 
            min-width: 50vw; 
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 30px;
        }
        #results-details { 
            min-width: auto; 
            flex-grow: 1; /* YENİ: Detayların genişlemesini sağla */
        }
        /* YENİ: Sonuç ekranı puan yazısı (Animasyon için) */
        #results-details .final-score { 
            font-family: var(--font-family) !important; 
            font-size: 2.2em; /* Puanı daha da büyüt */
            font-weight: bold;
            color: var(--primary-color);
            margin: 10px 0 15px 0;
            text-align: center; 
            /* Animasyon JavaScript tarafından tetiklenecek */
        }
        /* YENİ: Diğer p etiketleri (Doğru/Yanlış sayısı) */
        #results-details p { 
            font-family: var(--font-family) !important; 
            font-size: 1.3em;
            text-align: center; 
            margin: 5px 0;
        }
        #results-details .result-stars {
            font-size: 1.8em;
            color: var(--star-color);
            margin-top: 10px;
        }
        #results-details div[style] {
            max-height: 300px !important; 
            font-size: 1.6em !important;  
            line-height: 1.8; 
            text-align: right; 
        }

        /* --- YENİ CSS --- */
        /* Sonuç ekranı butonları için wrapper */
        #results-button-wrapper {
            display: flex;
            flex-direction: column; /* Butonları dikey hizala */
            gap: 15px;
            align-items: center;
            justify-content: center;
            flex-shrink: 0; /* Büzülmesini engelle */
        }

        /* Sonuç ekranı butonlarının (her ikisi) için ortak stil */
        #next-round-button,
        #play-again-button {
            font-family: var(--font-family) !important;
            color: white;
            border: none;
            padding: 12px 25px;
            font-size: 1.2em;
            font-weight: bold;
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.2s ease;
            flex-shrink: 0;
            box-shadow: var(--shadow-light);
            min-width: 200px; /* Genişlik verelim */
        }
        
        /* Yeni Tur Butonu (Mavi) */
        #next-round-button {
            background-color: var(--primary-color);
        }
        #next-round-button:hover {
            background-color: #0056b3;
            transform: translateY(-2px);
            box-shadow: var(--shadow-dark);
        }

        /* Seviyeler Butonu (Yeşil) - Stili düzelttim */
        #play-again-button {
            background-color: var(--success-color); 
        }
        #play-again-button:hover {
            background-color: #1e7e34;
            transform: translateY(-2px);
            box-shadow: var(--shadow-dark);
        }
        /* --- YENİ CSS BİTİŞ --- */


        /* Geri Sayım Ekranı (Oyun Üstünde) */
        #countdown-overlay {
            background-color: rgba(248, 249, 250, 0.85); 
            z-index: 20; 
        }
        #countdown-overlay .overlay-content {
            background: transparent;
            box-shadow: none;
        }
        #countdown-text {
            font-size: clamp(6em, 20vw, 10em);
            color: var(--primary-color);
            margin: 0;
            animation: countdown-pulse 1s infinite ease-in-out;
        }
        

        /* Animasyonlar */
        @keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); } }
        @keyframes gentle-wobble {
            0%, 100% { transform: rotate(0); }
            25% { transform: rotate(-3deg); } 
            75% { transform: rotate(3deg); }  
        }
        @keyframes word-flash-red {
            0%, 100% { background-color: var(--background-color); border-color: var(--error-color); }
            50% { background-color: rgba(220, 53, 69, 0.1); }
        }
        @keyframes burst-and-fade {
            0% {
                transform: translate(-50%, -50%) scale(0.5);
                opacity: 1;
            }
            70% {
                transform: translate(-50%, -150px) scale(1.2); 
                opacity: 1;
            }
            100% {
                transform: translate(-50%, -200px) scale(1.2);
                opacity: 0;
            }
        }
        @keyframes countdown-pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.1); }
        }
         /* YENİ: Sonuç ekranı puan patlama animasyonu */
        @keyframes final-score-pop {
            0% { transform: scale(1); }
            50% { transform: scale(1.2); color: var(--success-color); }
            100% { transform: scale(1); }
        }

        /* ------------------------------------------- */
        /* --- YENİ: MOBİL UYUMLULUK CSS --- */
        /* ------------------------------------------- */
        @media (max-width: 768px) {
            
            /* GÜNCELLENDİ: Sayfa kaymasını engelle (Orijinal davranış) */
            body {
                padding: 5px;
                display: flex; 
                overflow-y: hidden; 
                min-height: 100vh;
            }
            #game-container {
                width: 100%;
                min-height: auto;
                padding: 0;
            }
            /* GÜNCELLENDİ: Panel içinde kaydırmayı etkinleştir */
            #level2-container {
                padding: 10px;
                max-height: 98vh; /* Ekrana sığdır */
                overflow-y: auto; /* Panel içinde kaydır */
                min-height: 90vh; /* Yüksekliğini koru */
            }
            
            /* Üst Barı Yeniden Düzenle */
            #l2-top-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        /* padding-top: 45px; */ /* KALDIRILDI: Artık gerek yok */
        padding-top: 10px; /* YENİ: Normal üst boşluk */
        align-items: center; /* YENİ: Geri tuşunu dikey ortalamak için */
    }

    /* 1. SIRA: Zaman ve Puan */
    #l2-timer, #l2-score-display {
        font-size: 1.4em;
        padding: 8px 15px;
        flex-grow: 1;
        order: 1; /* Zaman ve Puanı en üste al */
    }

            /* 2. SIRA: Türkçe Kelimeler */
            #l2-turkish-word-area {
                order: 2; /* Kelimeleri 2. sıraya al (Zaman/Puandan sonra) */
                flex-basis: 100%;
                min-height: 40px;
                gap: 5px;
                align-content: center; /* Dikey ortalama için eklendi */
            }
            
            /* Ana Oyun Alanını Dikey Yap */
            #l2-main-game-area {
                flex-direction: column;
                min-height: 0; /* Min-height'i sıfırla */
                flex-grow: 1; /* Esnesin */
                gap: 15px;
            }

            /* 3. SIRA: Kökler */
            #l2-roots-sidebar {
                order: 1; /* Kökler üste gelsin (main-game-area içinde) */
                flex-basis: auto;
                gap: 10px;
                min-height: 12vh;
            }
            
            /* 4. SIRA: Kalıplar */
            #l2-patterns-wrapper {
                order: 2; /* Kalıplar alta gelsin (main-game-area içinde) */
                flex-basis: auto;
                gap: 10px;
                row-gap: 10px;
                grid-template-rows: repeat(3, auto); /* 3 sıra */
                min-height: auto; /* GÜNCELLENDİ: Gereksiz boşluk kaldırıldı */
            }

            /* --- YENİ SIRALAMA BİTİŞ --- */

            .l2-target-word {
                font-size: 1.1em;
                padding: 4px 8px;
            }

            .back-button {
        position: relative; /* YENİ: Absolute konumlandırmayı kaldır */
        top: auto; /* YENİ: Sıfırla */
        left: auto; /* YENİ: Sıfırla */
        width: 40px;
        height: 40px;
        order: 1; /* YENİ: Zaman ve Puan ile aynı sıraya al */
        flex-shrink: 0; /* YENİ: Büzülmesini engelle */
    }
            #start-screen .back-button {
                 top: 10px; 
                 left: 10px;
            }

             /* Mobilde (2 sütun) dikey çizgiyi ayarla */
            #l2-patterns-wrapper::before {
                right: 50%; 
                width: 2px;
                display: none;
            }
            #l2-patterns-wrapper::after {
                display: none; /* 3. çizgiyi gizle */
            }

            /* GÜNCELLENDİ: Kalıp numarasını KÜÇÜLT ve ORTALA */
            .pattern-number-circle {
                left: 50%;
                right: auto;
                transform: translateX(-50%);
                width: 23px; /* Küçültüldü */
                height: 23px; /* Küçültüldü */
                font-size: 0.9em; /* Küçültüldü */
            }
            
            /* GÜNCELLENDİ: Yeni daire boyutuna göre ayarla */
            .l2-pattern-group {
                padding-top: calc(25px + 10px); 
            }
            .l2-pattern-number {
                top: calc(25px + 10px); 
                height: calc(100% - 25px - 10px); 
            }
            
            /* Mobil için kart boyutları */
            .l2-draggable-root {
                min-height: 10vh;
                font-size: clamp(1.4em, 4vh, 2em);
            }
            .l2-pattern-group {
                min-height: 15vh;
            }
            .l2-pattern-number {
                font-size: clamp(1.8em, 4.5vh, 2.5em);
            }

            /* Sonuç Ekranı */
            #results-screen .overlay-content {
                flex-direction: column;
                min-width: 90vw;
                gap: 20px;
                padding: 30px 20px;
            }
            #results-details .final-score {
                font-size: 1.8em;
            }
            #results-details p {
                font-size: 1.1em;
            }
            #results-button-wrapper {
                flex-direction: row; /* Butonlar yan yana sığar */
                flex-wrap: wrap;
                width: 100%;
            }
            #next-round-button,
            #play-again-button {
                font-size: 1em;
                min-width: 130px;
                flex-grow: 1;
            }

            /* Başlangıç Ekranı */
            .overlay-content {
                padding: 20px;
            }
            .overlay h1 { font-size: 1.8em; }
            .overlay h2 { font-size: 1.3em; }

        }

/* --- HATA LİSTESİ STİLLERİ --- */
.mistakes-wrapper {
    margin-top: 20px;
    width: 100%;
    max-height: 200px; /* Çok uzarsa kaydırma çubuğu çıksın */
    overflow-y: auto;
    border-top: 2px dashed #eee;
    padding-top: 10px;
    text-align: left; /* Listeyi sola yasla */
}

.mistakes-title {
    font-size: 1.1em;
    color: var(--error-color);
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}

.mistake-item {
    background-color: #fff0f0; /* Hafif kırmızı arka plan */
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-left: 4px solid var(--error-color);
}

.mistake-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.m-turkce {
    font-weight: bold;
    color: var(--text-color);
    font-size: 0.95em;
}

.m-details {
    font-size: 0.85em;
    color: #666;
}

.m-arapca {
    font-family: var(--font-family-arabic) !important;
    font-size: 1.6em;
    color: var(--primary-color);
    font-weight: bold;
    direction: rtl;
}

/* Mobilde detaylar biraz daha küçük olsun */
@media (max-width: 768px) {
    .mistake-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    .m-arapca {
        align-self: flex-end; /* Arapçayı sağa yasla */
    }
}

/* ==== KONTEYNER TASARIMLARI KALDIRILDI: hem ilk sayfa hem oyun ekranı; elementler tüm sayfayı kullansın ==== */
#game-container {
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    max-width: none;
    max-height: none;
    margin: 0;
}
#level2-container {
    background: none;
    box-shadow: none;
    border-radius: 0;
    max-width: none;
    height: auto;
    min-height: 100vh;
    padding: 12px;
}
#start-screen .overlay-content {
    background: none;
    box-shadow: none;
    border-radius: 0;
    max-width: 100%;
    padding: 12px;
}
/* İlk sayfa geri tuşu sayfanın sol-üstünde sabit */
#start-back-button {
    position: fixed;
    top: 15px;
    left: 15px;
}

/* ============================================================= */
/* ===  YENİ ELEMENT YERLEŞİM TASARIMI (Zamana Karşı!)  ======== */
/* ============================================================= */

/* Sayfa zemini: yumuşak degrade derinlik, üstten hizalı */
body {
    background-image:
        radial-gradient(1100px 520px at 50% -12%, rgba(0,123,255,0.07), transparent 62%),
        linear-gradient(180deg, #fbfcfe 0%, #eef2f7 100%);
    background-size: auto;
    align-items: flex-start;
}

/* Sayfayı ortala, ferah dikey ritim (evrensel, konteynır değil) */
#game-container, #level2-container {
    box-sizing: border-box;   /* padding genişliğe eklenmesin -> taşma yok */
    width: 100%;
    max-width: none;
    margin: 0;
}
#level2-container {
    gap: 14px;
}

/* Türkçe kelime bandı: tam genişlikte, hafif ışıltılı zemin (kutu değil, band) */
#l2-turkish-word-area {
    background: linear-gradient(180deg, #ffffff, #f5f8fc);
    box-shadow: 0 6px 18px rgba(0,0,0,0.05), inset 0 0 0 1px rgba(0,0,0,0.035);
    border-radius: 16px;
}

/* Zaman / Puan pilleri: yumuşak yüzen görünüm */
#l2-timer, #l2-score-display {
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06), inset 0 0 0 1px rgba(0,0,0,0.04);
}

/* Kartlar tek tek elementler olarak modern dokunuş (arka planda konteynır yok) */
.l2-pattern-group { border-radius: 18px; }
.l2-draggable-root {
    border-radius: 18px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}

/* --------------------------------------------------------- */
/* MASAÜSTÜ: HUD + Kelime Bandı + Tam Yükseklik Oyun Alanı    */
/* --------------------------------------------------------- */
@media (min-width: 769px) {

    /* Tam genişlik — her iki kenardan 10px (kök sütunu dahil) */
    #level2-container {
        max-width: none;
        margin: 0;
        padding: 12px 10px 16px 10px;
    }

    /* HUD: geri tuşu + zaman + puan HEPSİ TEK SATIRDA */
    #l2-top-bar {
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 14px;
        padding-top: 10px;   /* geri tuşu artık akışta, üstte yer açmaya gerek yok */
    }
    /* Geri tuşunu akışa al (absolute değil) — zaman ve puanla aynı satırda */
    #game-back-button {
        position: static;
        top: auto;
        left: auto;
        order: 0;
    }
    #l2-timer, #l2-score-display {
        order: 1;
        font-size: 1.5em;
        padding: 9px 24px;
    }

    /* Türkçe kelimeler kendi tam-genişlik bandında, HUD'un altında */
    #l2-turkish-word-area {
        order: 2;
        flex-basis: 100%;
        padding: 10px 14px;
        gap: 10px;
        min-height: auto;
    }
    .l2-target-word {
        font-size: 1.3em;
        padding: 7px 14px;
    }

    /* Oyun alanı: çizgisiz, doğal yükseklik (zorlama yok -> taşma/scroll yok) */
    #l2-main-game-area {
        border-top: none;
        padding-top: 10px;
        gap: clamp(20px, 3vw, 40px);
        min-height: 0;
        align-items: start;
    }

    /* Kalıplar: kalan alanı doldurur (taşma olmaz) */
    #l2-patterns-wrapper {
        flex: 1 1 0;
        min-width: 0;
        align-content: start;
        gap: 16px 20px;
    }

    /* Kökler: sabit oranlı sağ sütun — satırdan taşmaz */
    #l2-roots-sidebar {
        flex: 0 0 27%;
        min-width: 0;
        box-sizing: border-box;
        align-content: start;
        gap: 14px;
        /* Kartların üst çizgisi/gölgesi kırpılmasın diye üstten boşluk */
        padding: 14px 6px 6px;
    }
}

/* --------------------------------------------------------- */
/* MOBİL: mevcut dikey akışa hafif rötuşlar                    */
/* --------------------------------------------------------- */
@media (max-width: 768px) {
    #l2-turkish-word-area { padding: 8px 10px; }
    #l2-timer, #l2-score-display { border-radius: 12px; }
    #l2-roots-sidebar { box-sizing: border-box; padding-top: 10px; }
}