.periodic-table-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
}

.element-info-panel {
    margin-bottom: 30px;
    min-height: 200px;
    background: #1abc9c;
    color: white;
}

.element-info-panel h3 {
    margin-bottom: 10px;
    font-size: 2rem;
    font-weight: bold;
}

.element-info-panel .element-symbol {
    font-size: 5rem;
    font-weight: bold;
    margin: 20px 0;
}

.element-info-panel .element-details {
    font-size: 1.3rem;
    line-height: 2;
}

.element-info-panel .element-details strong {
    color: #2c3e50;
}

.periodic-table {
    display: grid;
    grid-template-columns: repeat(18, minmax(0, 1fr));
    gap: 3px;
    margin: 0 auto;
    max-width: 1600px;
}

.element {
    aspect-ratio: 1;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    position: relative;
    min-width: 0;
    color: #000000;
}

.element:hover {
    transform: scale(1.1);
    z-index: 10;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.element.selected {
    border-color: #fff;
    border-width: 3px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

.element .atomic-number {
    font-size: 0.9rem;
    position: absolute;
    top: 2px;
    left: 4px;
}

.element .symbol {
    font-size: 1.8rem;
    font-weight: bold;
    line-height: 1;
}

.element .symbol a {
    color: inherit;
    text-decoration: none;
}

.element .symbol a:hover {
    text-decoration: underline;
}

.element .name {
    font-size: 0.75rem;
    text-align: center;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.element .mass {
    font-size: 0.75rem;
    position: absolute;
    bottom: 2px;
}

/* Element Categories */
.nonmetal { background-color: #4CAF50; }
.noble-gas { background-color: #9C27B0; }
.alkali-metal { background-color: #FF5722; }
.alkaline-earth { background-color: #FF9800; }
.metalloid { background-color: #607D8B; }
.halogen { background-color: #00BCD4; }
.metal { background-color: #2196F3; }
.transition-metal { background-color: #3F51B5; }
.lanthanide { background-color: #E91E63; }
.actinide { background-color: #9E9E9E; }
.post-transition { background-color: #795548; }

.empty {
    background: transparent;
    border: none;
    cursor: default;
}

.empty:hover {
    transform: none;
    box-shadow: none;
}

@media (max-width: 1200px) {
    .element .symbol {
        font-size: 1.5rem;
    }
    .element .name {
        font-size: 0.7rem;
    }
    .element .atomic-number {
        font-size: 0.8rem;
    }
    .element .mass {
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    .periodic-table {
        gap: 1px;
    }
    .element {
        font-size: 0.5rem;
        padding: 2px;
    }
    .element .symbol {
        font-size: 1rem;
        font-weight: bold;
    }
    .element .name {
        display: none;
    }
    .element .atomic-number {
        display: none;
    }
    .element .mass {
        display: none;
    }
}
