body {
    font-family: Arial, sans-serif;
    text-align: center; /* النص من اليمين لليسار */
    direction: rtl; /* الاتجاه من اليمين لليسار */
}

.hidden {
    display: none !important;
}

/* شاشة البداية */
#instructions {
    max-width: 600px;
    margin: 50px auto;
    padding: 30px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    text-align: center;
}

#instructions button {
    background: #10b981;
    margin-top: 20px;
    padding: 12px 30px;
    font-size: 18px;
}

/* لعبة */
#game-container {
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    color: #1e3a8a;
    text-align: center;
    margin: 30px 0;
    font-size: 2.5em;
}

/* شريط التقدم */
#progress-container {
    width: 80%;
    height: 25px;
    background: #e2e8f0;
    border-radius: 15px;
    margin: 20px auto;
    overflow: hidden;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width 0.5s ease-in-out;
}

#progress-text {
    text-align: center;
    color: #64748b;
    font-size: 1.2em;
}

/* الحيوانات */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    padding: 20px;
}

.animal {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 2px solid #e2e8f0;
}

.animal:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.animal img {
    width: 100%;
    height: 390px;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.animal img.loaded {
    opacity: 1;
}

.animal p {
    padding: 12px;
    text-align: center;
    background: #f8fafc;
    margin: 0;
    font-weight: 700;
    color: #1e293b;
}

/*
#animal-list {
    margin: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.animal {
    margin: 10px;
    cursor: pointer;
    border: 2px solid #ccc;
    border-radius: 10px;
    overflow: hidden;
    width: 150px;
    text-align: center;
}

.animal-name {
    margin: 0;
    padding: 5px;
    font-weight: bold;
    background-color: #f0f0f0;
}

.animal img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}
*/

.popup-hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    transition: all 0.3s ease-in-out;
}

#popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0,0,0,0.2);
    text-align: center;
    width: 90%;
    max-width: 400px;
    z-index: 1000;
}

#final-results-popup {
    display: contents;
    position: relative;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0,0,0,0.2);
    text-align: center;
    width: 90%;
    max-width: 400px;
    z-index: 1000;
}

#popup h3 {
    color: #1e3a8a;
    margin-bottom: 20px;
}

.buttons-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

button {
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-carnivore { background: #ef4444; color: white; }
.btn-herbivore { background: #10b981; color: white; }
.btn-omnivore { background: #f59e0b; color: white; }

button:hover {
    filter: brightness(110%);
    transform: scale(1.05);
}

/* النتائج النهائية */
#final-results-popup h2 {
    color: #1e3a8a;
    margin-bottom: 25px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.result-box {
    padding: 15px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
}

.carnivore { background: #ef4444; }
.herbivore { background: #10b981; }
.omnivore { background: #f59e0b; }

.restart-btn {
    background: #3b82f6;
    width: 100%;
    margin-top: 20px;
    color: white;
}

.feedback-hidden {
    display: none;
}

#feedback {
    margin-top: 10px;
    color: red;
}

.animal-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* الصور في المنتصف */
    gap: 10px; /* المسافة بين الصور */
    margin-top: 10px;
}

.animal-group .animal {
    cursor: default; /* تعطيل النقر على الحيوانات المصنفة */
}

/* أنماط لأزرار الترتيب */
#results button {
    margin: 5px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background-color: #007bff;
    color: white;
}

#results button:hover {
    background-color: #0056b3;
}

