/* Navagraha Grid Layout */
.mandala-outer-wrapper {
    width: 100%;
    display: flex;
    justify-content: center; 
    padding: 10px 0; 
    box-sizing: border-box;
}

.navagraha-grid-final {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 92vw; 
    max-width: 400px; 
    aspect-ratio: 1 / 1;
    gap: 3px;
    background-color: #d44b00;
    padding: 3px;
    border: 1px solid #d44b00;
    box-sizing: border-box; 
}

.graha-cell-final {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: bold;
    overflow: visible; /* అక్షరాలు కట్ అవ్వకుండా */
    line-height: 1.4;
}

.graha-name-final {
    font-size: clamp(12px, 4vw, 18px); 
    margin-bottom: 2px;
}

.dir-label-final {
    font-size: clamp(9px, 2.8vw, 12px);
    font-weight: normal;
}

/* --- Planet Colors --- */
.sun, .mars { background-color: #800000 !important; color: #FFFFFF !important; border: 1px solid #4d0000; }
.moon, .venus { background-color: #FFFFFF !important; color: #000000 !important; }
.mercury { background-color: #0f490f !important; color: #FFFFFF !important; }
.jupiter { background-color: #FFD700 !important; color: #000000 !important; }
.rahu { background-color: #708090 !important; color: #000000 !important; }
.saturn { background-color: #1a1a1a !important; color: #FFFFFF !important; }
.ketu { 
    background: linear-gradient(45deg, #ad2b0a, #ffff99, #99ff99, #99ffff, #9999ff, #708090, #4d0000) !important; 
    color: #000000 !important; 
    text-shadow: 0px 0px 2px #fff; 
}

/* --- Tabs and Content Styling --- */
.planets-container { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; justify-content: center; }
.tab-btn {
    flex: 0 1 auto; min-width: 140px; padding: 10px 15px 20px 15px;
    cursor: pointer; background: #fff; border: 2px solid #d4af37; 
    border-radius: 6px; font-weight: bold; color: #8b0000; font-size: 1.4rem; transition: 0.2s;
}
.tab-btn.active { background: #8b0000; color: #ffd700; border-color: #8b0000; }
.tab-content { display: none; width: 100%; margin-top: 15px; }

.mandapa-section {
    background: #fffdf5; border: 2px solid #d4af37; border-radius: 12px;
    padding: 25px; box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.ritual-title {
    background: #8b0000; color: #ffd700 !important; padding: 8px 20px;
    text-align: center; border-radius: 4px; margin: 0 auto 20px auto; width: fit-content; font-size: 1.4rem;
}

.mantra-label { color: #8b0000; font-weight: bold; font-size: 1.3rem; border-bottom: 1px solid #d4af37; margin: 15px 0 5px 0; width: fit-content; }
.mantra-text { line-height: 1.8; font-size: 1.3rem; text-align: justify; }

.ritual-text { display: inline-block; text-align: justify; font-weight: bold; font-size: 22px; color: #aa0000; }
.ritual-instruction { color: #191970; font-weight: bold; }
.ritual-instruction::before { content: "("; }
.ritual-instruction::after { content: ")"; }

/* --- Mobile View Settings --- */
@media (max-width: 768px) {
    .desktop-table { display: none; }
    .mobile-grid {
        display: grid; grid-template-columns: repeat(3, 1fr) !important; 
        gap: 5px; padding: 10px; border: 2px solid #d44b00; background-color: #fdf2d9;
    }
    .planets-container { flex-direction: column; gap: 5px; }
    .tab-btn { text-align: center; }
    .tab-content { margin-top: 0; margin-bottom: 10px; }
    .mandapa-section { border-radius: 0 0 12px 12px; }
}