/* 元素周期表网格 */
.periodic-table {
    display: grid;
    grid-template-columns: repeat(18, minmax(28px, 1fr));
    gap: 5px;
    margin: 0 auto 20px;
    padding: 10px;
    max-width: 100%;
    justify-content: center;
}

/* 元素格子 */
.element {
    aspect-ratio: 1;
    min-width: 100px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.element::after {
    content: '🔊';
    position: absolute;
    bottom: 3px;
    right: 3px;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.element:hover::after {
    opacity: 0.6;
}

.element::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
    border-radius: 8px;
}

.element:hover {
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.element.dimmed {
    opacity: 0.2;
}

.element.selected {
    box-shadow: 0 0 0 3px #fff, 0 0 20px rgba(255, 255, 255, 0.5);
}

.element .number {
    font-size: 0.9rem;
    position: absolute;
    top: 5px;
    left: 8px;
    color: rgba(255, 255, 255, 0.8);
}

.element .symbol {
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.element .name {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.element .mass {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
}

.element.empty {
    visibility: hidden;
}

/* 镧系锕系标记 */
.element.la-marker,
.element.ac-marker {
    background: transparent;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    font-size: 0.7rem;
}

/* 镧系锕系行 */
.lanthanides-actinides {
    margin: 10px auto 0;
    padding: 10px;
    max-width: 100%;
}

.la-ac-row {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 5px;
    margin: 0 auto 5px;
    max-width: calc(100% * 15 / 18);
}

/* 考试模式 */
.element.exam-hide {
    box-shadow: 0 0 0 3px #feca57, 0 0 20px rgba(254, 202, 87, 0.5);
}

.element.exam-blank {
    background: rgba(255, 255, 255, 0.08);
}

.element.exam-blank .symbol {
    color: #ff6b6b;
}