* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f0f8ff;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
}

.score-container {
    display: flex;
    justify-content: space-around;
    background-color: #e3f2fd;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.game-area {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .game-area {
        grid-template-columns: 1fr 1fr;
    }
    
    .compounds-formed {
        grid-column: span 2;
    }
}

.ions-container {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    grid-column: span 2;
}

.cations, .anions {
    flex: 1;
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cations h2 {
    color: #e74c3c; /* Red for positive ions */
}

.anions h2 {
    color: #3498db; /* Blue for negative ions */
}

.ions-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.ion {
    background-color: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ion:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ion.selected {
    border-color: #27ae60;
    background-color: #e8f5e9;
}

.cation {
    border-color: #e74c3c;
}

.anion {
    border-color: #3498db;
}

.ion-symbol {
    font-weight: bold;
    font-size: 1.2em;
}

.ion-charge {
    font-size: 0.9em;
    color: #666;
}

.bonding-area {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.selected-ions {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.selected-ion {
    background-color: #f5f5f5;
    border: 2px dashed #ccc;
    border-radius: 5px;
    padding: 15px;
    min-width: 120px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plus-sign {
    font-size: 24px;
    margin: 0 15px;
    color: #7f8c8d;
}

#bond-button {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

#bond-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

#bond-button:hover:not(:disabled) {
    background-color: #27ae60;
}

#result-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    min-height: 50px;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.compounds-formed {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#compounds-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.compound {
    background-color: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 5px;
    padding: 10px;
    text-align: center;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.controls button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.controls button:hover {
    background-color: #2980b9;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

/* Animation for new compounds */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.compound {
    animation: fadeIn 0.5s ease-out;
}