* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000000; /* Ensure the body background is black */
    color: #ffffff;
}

#container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    font-size: 18px;
}

#info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 350px;
    max-height: 80vh;
    background-color: rgba(0, 10, 30, 0.85);
    border-radius: 8px;
    color: white;
    padding: 15px;
    overflow-y: auto;
    z-index: 900;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.close-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
}

/* Add or update these tooltip styles */

#tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    pointer-events: none;
    z-index: 1000;
    max-width: 200px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    transition: opacity 0.2s ease;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    padding: 10px;
}

#time-controls, #view-controls {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

button {
    background-color: #333;
    color: #fff;
    border: none;
    padding: 5px 10px;
    margin-right: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #555;
}

input[type="range"] {
    width: 100px;
    margin: 0 10px;
}

#mini-map {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 200px;
    height: 200px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid #444;
    border-radius: 50%;
    overflow: hidden;
    z-index: 10;
}

/* Ensure hidden items stay hidden */
.hidden {
    display: none !important;
}

#planet-name {
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #444;
}

#planet-details p {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.4;
}

#planet-details p:first-child {
    margin-bottom: 15px;
}

/* Make UI elements more visible on smaller screens */
@media (max-width: 768px) {
    #controls {
        bottom: 10px;
        left: 10px;
        padding: 8px;
    }
    
    #mini-map {
        width: 150px;
        height: 150px;
        bottom: 10px;
        right: 10px;
    }
    
    #info-panel {
        width: 250px;
        top: 10px;
        right: 10px;
    }
    
    button {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    #tooltip {
        padding: 12px 16px;
        font-size: 16px;
        background-color: rgba(0, 0, 0, 0.9);
    }
    
    /* Make controls more touch-friendly */
    #controls button {
        min-height: 44px; /* Minimum touch target size */
        min-width: 44px;
        margin: 4px;
        padding: 8px 12px;
    }
    
    /* Better spacing for control sections */
    #time-controls, #view-controls, #language-controls {
        margin-bottom: 10px;
    }
    
    /* Make info panel more suitable for mobile */
    #info-panel {
        max-width: 90%;
        max-height: 80vh;
    }
}

/* Language controls */
#language-controls {
    position: absolute;
    top: -100px;
    left: 20px;
    display: flex;
    gap: 8px;
    z-index: 1000;
    flex-wrap: wrap;
}

/* Make language buttons responsive */
.lang-btn {
    padding: 5px 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 40px;
    white-space: nowrap;
}

.lang-btn:hover {
    background-color: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
}

.lang-btn.active {
    background-color: rgba(0, 60, 120, 0.7);
    border-color: rgba(100, 200, 255, 0.8);
}

/* Add special styling for Tamazight Latin */
.lang-btn[data-lang="tzm_lat"] {
    font-style: italic;
}

/* For RTL languages */
html[dir="rtl"] #controls {
    direction: rtl;
}

html[dir="rtl"] #info-panel {
    text-align: right;
}

html[dir="rtl"] .close-btn {
    right: auto;
    left: 10px;
}

html[dir="rtl"] #info-panel {
    right: auto;
    left: 20px;
}

/* Credits section */
#credits {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    padding: 8px 15px;
    z-index: 100;
    text-align: center;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

#credits:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

.credit-content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.credit-icons {
    display: flex;
    gap: 12px;
}

.credit-icons a {
    color: #fff;
    font-size: 16px;
    transition: color 0.2s ease;
}

.credit-icons a:hover {
    color: #64c8ff;
}

/* RTL handling for credits */
html[dir="rtl"] #credits {
    direction: ltr; /* Keep icons direction left-to-right even in RTL mode */
}

/* Mobile responsiveness for credits */
@media (max-width: 768px) {
    #credits {
        /* Position to top left on mobile */
        bottom: auto;
        top: 10px;
        left: 10px;
        transform: none; /* Remove the centering transform */
        padding: 6px 12px;
        font-size: 12px;
        max-width: 320px; /* Limit width on small screens */
        text-align: left;
    }
    
    .credit-content {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
    
    .credit-icons a {
        font-size: 18px; /* Larger tap targets on mobile */
        padding: 5px;
    }
}

/* Add proper font support for Tamazight language */
html[lang="ber"] #author-name,
html[lang="ar"] #author-name {
    font-family: 'Arial Unicode MS', sans-serif;
    font-weight: bold;
}

/* Quiz styles */
#quiz-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.quiz-content {
    width: 90%;
    max-width: 600px;
    background-color: rgba(10, 20, 40, 0.95);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 0 30px rgba(0, 100, 255, 0.3);
    color: white;
    position: relative;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.timer-display, .score-display {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-display i, .score-display i {
    color: #64c8ff;
}

.question-container {
    margin-bottom: 20px;
}

#question-text {
    font-size: 20px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.answer-btn {
    background-color: rgba(50, 70, 110, 0.6);
    border: 1px solid rgba(100, 200, 255, 0.3);
    padding: 12px 15px;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    text-align: left;
    transition: all 0.2s ease;
    cursor: pointer;
}

.answer-btn:hover {
    background-color: rgba(70, 100, 150, 0.8);
    transform: translateY(-2px);
}

.answer-btn.correct {
    background-color: rgba(40, 150, 80, 0.7);
    border-color: #50ff50;
}

.answer-btn.incorrect {
    background-color: rgba(180, 40, 40, 0.7);
    border-color: #ff5050;
}

.quiz-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.quiz-btn {
    background-color: #1e3a8a;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quiz-btn:hover {
    background-color: #2952cc;
}

.quiz-btn.cancel-btn {
    background-color: #6b1919;
}

.quiz-btn.cancel-btn:hover {
    background-color: #8f2222;
}

.results-container {
    text-align: center;
    padding: 20px 0;
}

.final-score {
    font-size: 36px;
    margin: 20px 0;
    color: #64c8ff;
}

.final-score i {
    color: #ffcc00;
    margin-right: 10px;
}

#results-message {
    font-size: 18px;
    margin-bottom: 30px;
    line-height: 1.5;
}

.quiz-button-container {
    margin-top: 20px;
    text-align: center;
}

#start-quiz-btn {
    padding: 12px 25px;
    font-size: 18px;
    background: linear-gradient(to right, #1e3a8a, #2952cc);
}

#start-quiz-btn:hover {
    background: linear-gradient(to right, #2952cc, #3a6aff);
}

/* RTL support for quiz */
html[dir="rtl"] .answer-btn {
    text-align: right;
}

html[dir="rtl"] .quiz-btn i {
    margin-right: 0;
    margin-left: 8px;
}

/* Mobile responsiveness for quiz */
@media (max-width: 768px) {
    .quiz-content {
        width: 95%;
        padding: 15px;
    }
    
    #question-text {
        font-size: 18px;
    }
    
    .answer-btn {
        padding: 15px;
        font-size: 16px;
    }
    
    .quiz-btn {
        padding: 12px 15px;
    }
    
    .final-score {
        font-size: 30px;
    }
}
