/* ------Fonts----- */
@font-face {
    font-family: 'IRANYekan';
    font-weight: lighter;
    src: url('../Fonts/IRANYekanLight\(FaNum\).ttf') format('ttf');
    src: url('../Fonts/iranyekanweblight.eot') format('eot');
    src: url('../Fonts/iranyekanweblight.woff') format('woff');
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-family: 'IRANYekan', 'Tahoma', sans-serif;
}

body {
    font-family: 'IRANYekan', 'Tahoma', sans-serif;
    background: linear-gradient(to bottom, #8B4513, #D2691E);
    color: #fff;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    direction: rtl;
    touch-action: manipulation;
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 800px;
    max-height: 600px;
    background: url('../images/cover.jpg') center/cover no-repeat;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

@media (orientation: portrait) {
    .game-container {
        min-height: 430px;
        min-width: 320px;
    }
}

.game-ui {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px;
    border-radius: 5px;
    font-size: 16px;
    text-align: right;
}

.score {
    margin-bottom: 5px;
}

.timer {
    font-weight: bold;
    color: #FFD700;
}

.basket {
    position: absolute;
    bottom: 20px;
    width: 100px;
    height: 60px;
    z-index: 5;
    transition: transform 0.1s;
    pointer-events: none;
}

.basket img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
}

.leaf {
    position: absolute;
    width: 40px;
    height: 40px;
    z-index: 2;
    pointer-events: none;
    transition: transform 0.2s;
}

.leaf img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.3));
}

.wind-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 100px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
    z-index: 10;
}

.wind-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(to left, #87CEEB, #1E90FF);
    transition: width 0.5s;
}

.wind-direction {
    position: absolute;
    top: 35px;
    left: 10px;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.6);
    padding: 5px;
    border-radius: 5px;
    direction: ltr;
}

.start-screen,
.end-screen {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    text-align: center;
    padding: 20px;
}

h1 {
    font-size: 36px;
    margin-bottom: 20px;
    color: #FF8C00;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

h2 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #FFD700;
}

.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
    width: 80%;
    max-width: 300px;
}

.config-panel {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    width: 90%;
    max-width: 500px;
    display: none;
}

.config-item {
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

label {
    font-size: 16px;
    flex: 1;
}

input[type="range"] {
    width: 150px;
    margin: 0 10px;
}

.value-display {
    width: 40px;
    text-align: center;
    font-weight: bold;
}

button {
    background: linear-gradient(to bottom, #FF8C00, #FF4500);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    margin: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'IRANYekan', 'Tahoma', sans-serif;
    width: 100%;
    max-width: 250px;
    touch-action: manipulation;
}

button:hover,
button:active {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    background: linear-gradient(to bottom, #FF4500, #FF8C00);
}

.hidden {
    display: none;
}

.instructions {
    margin-top: 15px;
    text-align: center;
    max-width: 500px;
    line-height: 1.5;
    font-size: 14px;
}

/* کنترل صدا در منوی شروع */
.start-screen .sound-control {
    position: static;
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    direction: ltr;
}

/* کنترل صدا در حین بازی - بالا وسط */
.game-sound-control {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    z-index: 10;
    direction: ltr;
    font-size: 14px;
}

@media (max-width: 600px) {
    h1 {
        font-size: 28px;
    }

    h2 {
        font-size: 22px;
    }

    .game-ui {
        font-size: 14px;
        padding: 8px;
    }

    button {
        padding: 10px 20px;
        font-size: 16px;
    }

    .basket {
        width: 80px;
        height: 48px;
    }

    .leaf {
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 400px) {
    h1 {
        font-size: 24px;
    }

    .instructions {
        font-size: 12px;
    }

    .basket {
        width: 70px;
        height: 42px;
    }

    .leaf {
        width: 30px;
        height: 30px;
    }
}


/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s;
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 15px;
    position: relative;
    text-align: center;
    width: 80%;
    max-width: 400px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    transform: scale(0.8);
    animation: popIn 0.5s forwards;
    color: #000;
}

.close-btn {
    color: #000;
    font-size: 2em;
    position: absolute;
    top: 5px;
    left: 10px;
    cursor: pointer;
}

.close-btn:hover {
    color: #ccc;
}

.add-to-cart-btn {
    display: inline-block;
    background-color: #006039;
    color: #fff;
    padding: 10px;
    text-decoration: none;
    border-radius: 10px;
    margin-top: 20px;
    transition: background-color 0.3s;
    font-size: 14px;
}

.add-to-cart-btn:hover {
    background-color: #2980b9;
}



/* Sparkle Effect */
.sparkle {
    position: absolute;
    background-color: #ffd700;
    border-radius: 50%;
    opacity: 0;
    animation: sparkle-anim 1s forwards;
}

@keyframes sparkle-anim {
    from {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    to {
        transform: scale(1.5) rotate(360deg);
        opacity: 0;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    from { transform: scale(0.8); }
    to { transform: scale(1); }
}

canvas { 
position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; 
z-index:21;
}