* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

.display {
    display: none;
}

table {
    width: 250px;
    height: 250px;
    border: 0.5px solid black;
}

tr {
    border: 1px solid black;
}

td {
    border: 1px solid black;
    text-align: center;
    font-size: 1.5em;
}

button {
    cursor: pointer;
}

.tables,
.product,
.sum,
.subtraction {
    width: 75%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    border: 1px solid black;
    gap: 10px;
}

.tables {
    margin-top: 10px;
    justify-content: center;
}

.sum {
    margin-left: -192px;
}

.sum,
.product,
.subtraction {
    justify-content: center;
}

.math-functions {
    display: grid;
    grid-template-columns: repeat(2,2fr);
}

.inverse-matrices {
    width: 75%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: -192px;
    border: 1px solid black;
    gap: 5px;
}

section>div>table {
    width: 200px;
    height: 200px;
}

.btns {
    width: 75%;
    display: flex;
    justify-content: center;
    border: 1px solid black;
    gap: 10px;
}

button {
    padding: 5px;
    background-color: white;
    border: 1px solid black;
    cursor: pointer;
}

p {
    color: red;
    text-align: center;
    margin-block: 75px;
    font-size: 18px;
}

/* Portrait smartphones */
@media screen and (max-width: 600px) {
    table {
        width: 150px;
        height: 150px;
        font-size: 1.2em;
    }

    .tables,
    .product,
    .sum,
    .subtraction,
    .inverse-matrices,
    .btns {
        width: 95%;
        flex-direction: column;
        margin-left: 0;
        gap: 5px;
    }

    .math-functions {
        grid-template-columns: 1fr; /* Stack vertically */
        gap: 10px;
    }

    button {
        width: 80%;
        height: 40px;
        font-size: 16px;
    }

    p {
        font-size: 16px;
        margin-block: 50px;
    }
}

/* Landscape smartphones (short height) */
@media screen and (max-height: 500px) and (orientation: landscape) {
    table {
        width: 120px;
        height: 120px;
        font-size: 1em;
    }

    .tables,
    .product,
    .sum,
    .subtraction,
    .inverse-matrices,
    .btns {
        width: 90%;
        gap: 5px;
    }

    button {
        height: 35px;
        font-size: 14px;
    }

    p {
        font-size: 14px;
        margin-block: 30px;
    }
}
