body{
    background-color: #070C17;
    box-sizing: border-box;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.rules{
    background-color: #070C17;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    /* height: 100vh; */
    width: 100%;
    align-items: center;
    justify-content: center;
    /* padding-top: 62px;
    padding-bottom: 62px; */
    gap: 10px;
    margin-top: 12vh;
}


.rules-heading-container{
    display: flex;
    font-family: "Montserrat", sans-serif;
    font-weight: 700;
    line-height: normal;
    color: #FEFBF1;
    align-self: flex-start;
    font-size: 40px;
    margin-left: 5%;
    /* position: absolute;
    left: 10%;
    top: 10%; */
}

#guidelines{
    color: #D9FE78;
}

.rules-main-area {
    position: relative;
    /* width: 100vw; */
    max-width: 81vw;
    height: 80vh;
    overflow-x: hidden;
    /* display: flex;
    flex-direction: column; */
    display: grid;
    grid-template-rows: repeat(2, 1fr);
    grid-template-columns: repeat(6, 1fr);
    /* justify-content: center; */
    align-items: center;
    gap: 1vw;
}

.rules-main-mesh-area{
    background: url("../../images/mesh.png");
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

.rule-card-container {
    display: flex;
    flex-direction: row;
    /* overflow: hidden; */
    width: 100%;
    gap: 18px;
    scroll-behavior: smooth;
    margin-bottom: 30px;
    padding-inline: 40px;
    box-sizing: border-box;
    position: relative;
}


.rules-arrow-container {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.rules-arrow {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #FEFBF1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s ease;
    position: relative;

}

.rules-arrow:hover {
    border-color: #D9FE78;
}



.rule-area{
    display: flex;
    gap: 20px;
    flex-direction: row;
    flex-shrink: 1;
    min-width: 297px;
    width: 26vw;
    padding: 1vw;
    /* border: 0.596px solid #FEFBF1; */
    flex: 0 0;
    align-items: center;
    justify-content: center;
    height: 30vh;
}

.rule-card{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    border-radius: 50px;
    border: 0.596px solid #FEFBF1;
    background: #0C1A38;
    flex: 0 0; /* 3 cards per row with gap */
    min-width: 297px;
    width: 26vw;
    padding: 1vw;
    height: 30vh;
}

.rule-card-heading{
    color: #D9FE78;
    text-align: center;
    font-family: Montserrat, sans-serif;
    font-size: 24px;
    font-style: normal;
    font-weight: 600;
    line-height: normal;
}

.rule-card-content{
    color: #FEFBF1;
    text-align: center;
    font-family: Montserrat, sans-serif;
    font-size: 18px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
}

.rules-arrow-container{
    display: flex;
    gap: 5px;
}

.arrow-icon{
    stroke: #FEFBF1;
    transition: stroke 0.3s ease;
}

.rules-arrow:hover .arrow-icon path {
    stroke: #D9FE78;
  }

.shape-container.yellow-star{
    animation-name: cwrotate;
    animation-duration: 8s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

.shape-container.red-star{
    animation-name: acwrotate;
    animation-duration: 8s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

@keyframes cwrotate {
    from{
        transform: rotate(0deg);
    }
    to{
        transform: rotate(360deg);
    }
}

@keyframes acwrotate {
    from{
        transform: rotate(0deg);
    }
    to{
        transform: rotate(-360deg);
    }
}

.progress-ring-wrapper {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 57px;
  height: 57px;
  z-index: 0;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-circle {
  fill: none;
  stroke: #D9FE78;
  stroke-width: 4;
  stroke-dasharray: 176;
  stroke-dashoffset: 176;
  transition: stroke-dashoffset 0.3s linear;
}



@media (max-width:1330px){
    .rules-main-area{
        max-width: 62vw;
    }

    .rule-area{
        min-width: 30vw;
    }

    .rule-card{
        min-width: 30.1vw;
    }
}

/* --- UPDATED MOBILE/ACCORDION VIEW --- */
@media (max-width:956px){
    .rules-main-mesh-area{
        background: none;
    }

    /* Hide desktop-only elements */
    .rules-arrow-container,
    .rule-area {
        display: none;
    }

    /* Style the main container for a vertical list */
    .rules-main-area{
        display: flex;
        flex-direction: column;
        gap: 16px;
        width: 90%;
        max-width: 500px;
        margin: 0 auto;
        overflow-x: hidden;
        justify-content: flex-start;
        align-items: center;
        height: auto; /* Override fixed height for content to expand */
        padding-bottom: 50px;
    }
    
    /* --- Reorder cards to match mobile design --- */
    .rules-main-area > .rule-card:nth-of-type(1) { order: 1; } /* Unstop Registration */
    .rules-main-area > .rule-card:nth-of-type(3) { order: 2; } /* Team Member */
    .rules-main-area > .rule-card:nth-of-type(2) { order: 3; } /* Verification */
    .rules-main-area > .rule-card:nth-of-type(5) { order: 4; } /* Team Leader */
    .rules-main-area > .rule-card:nth-of-type(6) { order: 5; } /* Eligibility */
    .rules-main-area > .rule-card:nth-of-type(4) { order: 6; } /* Single Track per Idea */

    /* Default (collapsed) accordion item style */
    .rule-card {
        border-radius: 12px;
        background: #FEFBF1;
        width: 100%;
        box-sizing: border-box;
        padding: 20px 24px;
        cursor: pointer;
        transition: all 0.3s ease-in-out;
        position: relative;
        border: 1px solid rgba(254, 251, 241, 0.2);
        /* display: flex;
        flex-direction: column; */
        /* display: flex;
        flex-direction: row;
        flex-wrap: wrap; */
    }

    .rule-card-heading {
        color: #0C1A38;
        font-family: Montserrat, sans-serif;
        font-size: 16px;
        font-weight: 600;
        text-align: left; /* This correctly aligns the heading text to the left */
        line-height: 1.4;
        padding-right: 30px; /* Makes space for the arrow */
        transition: color 0.3s ease-in-out;
        position: relative;
    }

    .rule-card-content {
        color: #0C1A38;
        font-family: Montserrat, sans-serif;
        font-size: 14px;
        font-weight: 400;
        line-height: 1.5;
        text-align: left; /* This aligns the description text to the left */
        max-height: 0;
        overflow: hidden;
        margin-top: 0;
        transition: max-height 0.4s ease-out, margin-top 0.4s ease-out;
    }

    /* Arrow icon using a pseudo-element */
    .rule-card::after {
        content: '';
        position: absolute;
        right: 24px;
        top: 22px;
        width: 20px;
        height: 20px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230C1A38' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
        transition: transform 0.3s ease, background-image 0.3s ease;
        transform: rotate(0deg);
    }
    
    /* --- Styles for the OPEN accordion item --- */
    .rule-card.open {
        background: #FEFBF1;
        border-color: #FEFBF1;
    }

    .rule-card.open .rule-card-heading {
        color: #0C1A38;
    }

    .rule-card.open .rule-card-content {
        max-height: 250px; /* A generous height to allow content to show */
        margin-top: 12px;
    }

    .rule-card.open::after {
        transform: rotate(180deg);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230C1A38' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    }
}