body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Keep a readable font, Arabic will use system default or a suitable fallback */
    direction: rtl; /* Right-to-left for Arabic text */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top instead of center */
    min-height: 100vh;
    background-color: #eef2f7; /* Fallback */
    background-image: url('background.png'); /* Kid-friendly background */
    background-size: cover;
    background-position: center;
    background-attachment: fixed; /* Keep background fixed when scrolling */
    margin: 20px;
    box-sizing: border-box;
}

.game-container {
    background-color: rgba(255, 255, 255, 0.95); /* Slightly transparent white for background image */
    padding: 30px;
    border-radius: 18px; /* More rounded corners */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); /* Softer, larger shadow */
    text-align: center;
    width: 100%;
    max-width: 800px;
    margin-top: 20px;
    margin-bottom: 20px;
}

h1 {
    color: #4a6fa5; /* Softer blue */
    margin-bottom: 25px;
    font-size: 2.5em; /* Slightly larger heading */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.settings, .game-info, .question-area, .game-results {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #a0c4ff; /* Lighter, more playful border */
    border-radius: 12px; /* More rounded */
    background-color: #e9f5ff; /* Lighter background */
}

.settings {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.settings label {
    font-weight: bold;
    color: #3f5f87; /* Darker blue for text */
    font-size: 1.2em; /* Slightly larger font */
}

.settings input[type="number"],
.settings select,
.settings input[type="text"] { /* Style for the new select dropdown */
    padding: 10px;
    border: 1px solid #b0d4ff; /* Lighter border */
    border-radius: 8px; /* Rounded input/select */
    width: 120px; /* Wider for select or number input */
    text-align: center;
    font-size: 1.1em;
    background-color: #ffffff;
    color: #333;
    max-width: 100%; /* Ensure responsiveness */
}

button {
    background-color: #6a96f1; /* Brighter, more inviting blue */
    color: white;
    padding: 14px 30px; /* Larger buttons */
    border: none;
    border-radius: 8px; /* More rounded */
    cursor: pointer;
    font-size: 1.2em;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: #4e7ac7; /* Slightly darker on hover */
    transform: translateY(-3px); /* More pronounced lift */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.game-info p {
    margin: 8px 0;
    font-size: 1.3em; /* Slightly larger info text */
    color: #34495e;
}

.game-info span {
    font-weight: bold;
    color: #007bff; /* Keep a prominent color for dynamic info */
}

.question-area p {
    font-size: 1.6em; /* Larger question text */
    font-weight: bold;
    color: #333;
    background-color: #d1e7ff; /* Lighter, cheerful blue */
    padding: 18px;
    border-radius: 10px;
    margin: 0;
}

.numbers-to-sort, .sorted-numbers {
    min-height: 120px; /* Taller containers */
    border: 3px dashed #80aaff; /* Thicker, more visible dashed border */
    border-radius: 15px; /* More rounded */
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px; /* Larger gap between items */
    background-color: #f0f8ff;
}

.sorted-numbers {
    border-style: solid; /* Solid border for target */
    border-color: #4a6fa5; /* Distinct color for sorted area */
    background-color: #e0edff;
}

.number-item {
    background-color: #ffffff;
    border: 2px solid #a0c4ff; /* Thicker, softer border */
    border-radius: 10px; /* More rounded */
    padding: 15px 25px; /* Larger padding for bigger numbers */
    font-size: 2.2em; /* Significantly larger numbers */
    font-weight: bold;
    cursor: grab;
    user-select: none;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    color: #333;
}

.number-item:hover {
    background-color: #f5faff;
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
    border-color: #6a96f1; /* Highlight border on hover */
}

.number-item.dragging {
    opacity: 0.7;
    transform: scale(1.08); /* More pronounced scaling */
    border-color: #007bff;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

.number-item.hover-target {
    border: 3px solid #007bff; /* Thicker highlight for drop target */
    box-shadow: 0 0 15px rgba(0, 123, 255, 0.6);
}

.sorted-numbers .placeholder {
    color: #888;
    font-style: italic;
    font-size: 1.4em; /* Larger placeholder text */
}

.feedback {
    margin-top: 20px;
    font-size: 1.5em; /* Larger feedback text */
    font-weight: bold;
    padding: 12px 0;
    border-radius: 8px; /* More rounded feedback boxes */
}

.feedback.correct {
    color: #28a745; /* Standard green */
    background-color: #e6ffe9;
}

.feedback.incorrect {
    color: #dc3545; /* Standard red */
    background-color: #ffe6e6;
}

/* Added for game-end messages */
.feedback-message {
    margin-top: 20px;
    font-size: 1.6em;
    font-weight: bold;
    color: #4a6fa5;
    padding: 15px;
    border-radius: 10px;
    background-color: #d1e7ff;
    border: 2px solid #a0c4ff;
    display: none; /* Hidden by default, shown when needed */
}

.game-results h2 {
    color: #4a6fa5;
    margin-bottom: 15px;
    font-size: 2em; /* Larger heading */
}

.game-results ul {
    list-style: none;
    padding: 0;
    max-height: 280px; /* Slightly more height */
    overflow-y: auto;
    border: 1px solid #a0c4ff;
    border-radius: 12px;
    background-color: #fdfdfd;
}

.game-results li {
    background-color: #f7f9fc;
    margin: 0;
    padding: 12px 18px; /* Larger padding */
    border-bottom: 1px solid #eef2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2em; /* Larger list items */
    color: #555;
}

.game-results li:last-child {
    border-bottom: none;
}

.game-results li span {
    font-weight: bold;
    color: #333;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .game-container {
        padding: 20px;
        margin: 10px;
    }

    h1 {
        font-size: 2em;
    }

    .settings {
        flex-direction: column;
        gap: 10px;
    }

    .settings input[type="number"],
    .settings select,
    .settings input[type="text"],
    button {
        width: 100%;
        max-width: 250px; /* Constrain width for better mobile layout */
    }

    .number-item {
        font-size: 1.8em;
        padding: 10px 15px;
    }

    .question-area p {
        font-size: 1.3em;
        padding: 12px;
    }

    .feedback {
        font-size: 1.2em;
    }
    .feedback-message {
        font-size: 1.3em;
    }
}