/* 響應式設計 */

/* 超大屏幕 */
@media (min-width: 2000px) {
    .element {
        min-width: 100px;
    }
}

/* 大屏幕 */
@media (max-width: 1999px) and (min-width: 1600px) {
    .element {
        min-width: 90px;
    }

    .element .symbol {
        font-size: 1.8rem;
    }
}

/* 中等屏幕 */
@media (max-width: 1599px) and (min-width: 1200px) {
    .element {
        min-width: 70px;
        padding: 6px;
    }

    .element .symbol {
        font-size: 1.6rem;
    }

    .element .number {
        font-size: 0.75rem;
    }

    .element .name {
        font-size: 12px;
    }

    .element .mass {
        font-size: 0.6rem;
    }
}

/* 平板横屏 */
@media (max-width: 1199px) and (min-width: 900px) {
    .element {
        min-width: 55px;
        padding: 5px;
    }

    .element .symbol {
        font-size: 1.3rem;
    }

    .element .number {
        font-size: 0.65rem;
        top: 3px;
        left: 5px;
    }

    .element .name {
        font-size: 10px;
    }

    .element .mass {
        font-size: 0.5rem;
    }

    .periodic-table {
        gap: 4px;
    }

    .la-ac-row {
        gap: 4px;
    }
}

/* 平板竖屏 */
@media (max-width: 899px) and (min-width: 600px) {
    .controls {
        flex-direction: column;
    }

    .timeline-panel {
        width: 100%;
    }

    .lang-switch {
        position: static;
        margin-bottom: 15px;
        justify-content: center;
    }

    .modal-header {
        flex-direction: column;
        text-align: center;
    }

    .modal-flex {
        grid-template-columns: 1fr;
    }

    .photos-grid {
        grid-template-columns: 1fr;
    }

    .element {
        min-width: 45px;
        padding: 4px;
    }

    .element .symbol {
        font-size: 1.1rem;
    }

    .element .number {
        font-size: 0.55rem;
        top: 2px;
        left: 4px;
    }

    .element .name {
        font-size: 9px;
    }

    .element .mass {
        font-size: 0.45rem;
    }

    .periodic-table {
        gap: 3px;
    }

    .la-ac-row {
        gap: 3px;
    }
}

/* 手機版 */
@media (max-width: 599px) {
    body {
        padding: 10px;
    }

    .controls {
        flex-direction: column;
        gap: 10px;
    }

    .timeline-panel {
        width: 100%;
    }

    .lang-switch {
        position: static;
        margin-bottom: 10px;
        justify-content: center;
    }

    .modal-header {
        flex-direction: column;
        text-align: center;
    }

    .modal-flex {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .photos-grid {
        grid-template-columns: 1fr;
    }

    .element {
        min-width: 70px;
        padding: 4px;
    }

    .element .symbol {
        font-size: 1.4rem;
    }

    .element .number {
        font-size: 0.7rem;
        top: 2px;
        left: 4px;
    }

    .element .name {
        display: block;
        font-size: 0.8rem;
    }

    .element .mass {
        display: block;
        font-size: 0.6rem;
    }

    .periodic-table {
        grid-template-columns: repeat(18, minmax(70px, 1fr));
        justify-content: start;
        padding-bottom: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 2px;
    }

    /* 同步滾動：將滾動設置在父容器上 */
    .lanthanides-actinides {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .la-ac-row {
        grid-template-columns: repeat(15, minmax(70px, 1fr));
        max-width: none;
        justify-content: start;
        padding-bottom: 10px;
        gap: 2px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .atom-model {
        width: 120px;
        height: 140px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .site-footer {
        font-size: 1.3rem;
        padding: 22px 0;
        margin-top: 26px;
        background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(123, 44, 191, 0.15));
        box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);
        border-top: 1px solid rgba(255, 255, 255, 0.25);
    }

    .site-footer .footer-text {
        letter-spacing: 0.4px;
        text-shadow: 0 3px 10px rgba(123, 44, 191, 0.45);
    }

    #examConfigModal .exam-modal {
        right: 10px;
        top: 10px;
        width: 95vw;
    }
}

/* 超小手機 */
@media (max-width: 400px) {
    .element {
        min-width: 60px;
        padding: 3px;
    }

    .element .symbol {
        font-size: 1.2rem;
    }

    .element .number {
        font-size: 0.6rem;
    }

    .periodic-table {
        gap: 2px;
        padding: 3px;
        grid-template-columns: repeat(18, minmax(60px, 1fr));
    }

    .la-ac-row {
        gap: 2px;
        grid-template-columns: repeat(15, minmax(60px, 1fr));
    }
}