
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #0c0c27;
    color: #fff;
    font-family: 'Tahoma', sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    touch-action: none;
    padding: 10px;
}

#main-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 900px;
}

#game-title {
    text-align: center;
    margin-bottom: 10px;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

#game-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

#game-container {
    border: 3px solid #6c5ce7;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.5);
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 800px;
    touch-action: none;
}

canvas { 
    display: block; 
    background-color: #020111;
    transition: background-color 0.8s ease-in-out;
    width: 100%;
    height: auto;
}

#ui {
    position: absolute;
    top: 10px; left: 10px; right: 10px;
    display: flex; 
    justify-content: space-between;
    font-size: clamp(0.9rem, 3vw, 1.5rem);
    font-weight: bold;
    text-shadow: 2px 2px 4px #000;
    z-index: 10;
    pointer-events: none;
}

/* کنترل‌های موبایل - خارج از کانتینر بازی */
#mobile-controls {
    display: flex;
    gap: 60px;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    z-index: 100;
}

.control-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(108, 92, 231, 0.9);
    border: 3px solid #fff;
    color: white;
    font-size: 2.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.1s, background 0.1s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    transform: scale(0.92);
    background: rgba(108, 92, 231, 1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* Media Queries برای موبایل */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    #game-title {
        margin-bottom: 5px;
    }
    
    #game-wrapper {
        gap: 15px;
    }
    
    #game-container {
        border-width: 2px;
        border-radius: 5px;
    }
    
    #ui {
        top: 5px;
        left: 5px;
        right: 5px;
    }
    
    .control-btn {
        width: 85px;
        height: 85px;
        font-size: 2rem;
    }
    
    #mobile-controls {
        gap: 50px;
        margin-top: 15px;
    }
}

@media (max-width: 480px) {
    .control-btn {
        width: 75px;
        height: 75px;
        font-size: 1.8rem;
    }
    
    #mobile-controls {
        gap: 40px;
    }
}

/* استایل‌های مربوط به افکت‌ها */
#flash-overlay {
    position: absolute; 
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 500;
    pointer-events: none;
}

#collision-indicator {
    position: absolute;
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: bold;
    color: #ff4757;
    text-shadow: 2px 2px 4px #000;
    z-index: 20;
    pointer-events: none;
    transition: opacity 0.5s ease-out;
}

/* مودال‌ها - با z-index بالا برای نمایش روی همه چیز */
.modal-overlay {
    display: flex;
    justify-content: center; 
    align-items: center;
    width: 100%; 
    height: 100%;
    position: fixed; 
    top: 0; 
    left: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    padding: 20px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    padding: 20px;
}

.modal-content {
    background: linear-gradient(135deg, #1e1e4b 0%, #2a2a5e 100%);
    padding: 25px;
    border-radius: 15px; 
    text-align: center;
    border: 3px solid #6c5ce7; 
    box-shadow: 0 0 30px rgba(108, 92, 231, 0.8);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 { 
    margin-top: 0; 
    color: #a29bfe;
    font-size: clamp(1.3rem, 3vw, 2rem);
    margin-bottom: 15px;
}

.modal-content p {
    font-size: clamp(0.95rem, 2.5vw, 1.2rem);
    margin: 10px 0;
    line-height: 1.6;
}

.modal-content button {
    background: linear-gradient(45deg, #6c5ce7, #8a7ffb);
    color: white;
    border: none; 
    padding: 12px 30px;
    border-radius: 25px; 
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    cursor: pointer; 
    margin-top: 15px; 
    transition: all 0.3s;
    width: 60%;
    min-width: 140px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.modal-content button:hover { 
    background: linear-gradient(45deg, #8a7ffb, #a29bfe);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.6);
}

.modal-content button:active {
    transform: translateY(0);
}

.feedback-button-intro {
    display: block; 
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white; 
    text-decoration: none;
    padding: 12px 20px; 
    border-radius: 25px;
    margin: 15px auto; 
    width: 80%;
    transition: all 0.3s;
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
}

.feedback-button-intro:hover { 
    background: linear-gradient(45deg, #2ecc71, #3ed778);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.6);
}

/* صفحه پایان */
.end-screen {
    text-align: center;
    padding: 20px;
}

.end-screen h1 { 
    font-size: clamp(1.5rem, 4vw, 2.5rem); 
    color: #a29bfe; 
    margin-bottom: 20px;
}

.end-screen .stats {
    background: rgba(30, 30, 75, 0.9);
    padding: 20px; 
    border-radius: 15px;
    margin: 20px auto; 
    border: 2px solid #6c5ce7;
    display: inline-block;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.5);
}

.end-screen p { 
    font-size: clamp(0.95rem, 2.5vw, 1.2rem); 
    margin: 10px 0; 
}

.feedback-button {
    display: inline-block;
    background: linear-gradient(45deg, #8e44ad, #3498db);
    color: white; 
    padding: 15px 30px; 
    border-radius: 50px;
    text-decoration: none; 
    font-size: clamp(0.95rem, 2.5vw, 1.2rem); 
    font-weight: bold;
    margin-top: 20px; 
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.feedback-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(142, 68, 173, 0.7);
}

.hidden { 
    display: none !important; 
}
