/* Reset some basic styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f0f0f0;
    padding: 1rem;
    font-family: Arial, Helvetica, sans-serif;
}

.calc {
    width: 100%;
    max-width: 300px;
    height: 100%;
    max-height: 450px; 
    background-color: rgb(12, 12, 131);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 1px 1px 20px 10px rgba(0, 0, 0, 0.5);
}

.solar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    width: 35%;
    height: 25px;
    background-color: rgb(245, 236, 236);
    margin-left: 7rem;
    margin-bottom: 1rem;
    position: relative;
}

.solar .line {
    border-right: 1px solid black;
    height: 100%;
}

.solar .line:last-child {
    border-right: none;
}

.screen {
    width: 80%;
    height: 80px;
    background-color: rgb(205, 232, 255);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 1rem;
    font-size: 2rem;
    color: #000;
    overflow: hidden;
    text-overflow: ellipsis;
}

.buttons {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 18%);
    grid-auto-rows: 40px;
    gap: 10px;
    margin-left: 18%;
}

.buttons button {
    border: none;
    border-radius: 12px;
    background-color: rgb(237, 201, 224);
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.buttons button:hover {
    background-color: rgb(227, 181, 204);
}

.buttons button:active {
    transform: scale(0.95);
}

/* Specific Button Styles */
.plus {
    background-color: gold !important;
    grid-row: span 2;
}

.per, .div, .mul, .sub, .plus, .dot, .equal {
    background-color: gold !important;
}

.equal {
    background-color: rgb(0, 213, 255) !important;
}

.clear, .cross {
    background-color: rgb(239, 34, 143) !important;
}

.clear:hover, .cross:hover {
    background-color: rgb(219, 14, 123) !important;
}

/* Responsive Design */
@media (max-width: 400px) {
    .calc {
        padding: 1rem;
    }

    .screen {
        height: 80px;
        font-size: 1.5rem;
    }

    .buttons {
        gap: 8px;
        grid-template-columns: repeat(4, 18%);
        grid-auto-rows: 40px;
        gap: 10px;
    }

    .buttons button {
        font-size: 1.2rem;
    }

    .solar {
        width: 40%;
        height: 20px;
        margin-right: 15%;
    }
}

@media (max-width: 300px) {
    .calc {
    height: 100%;
    max-height: 390px; 
    }

    .screen {
        height: 80px;
        font-size: 1.2rem;
    }

    .buttons {
        grid-template-columns: repeat(4, 18%);
        grid-auto-rows: 35px;
        gap: 8px;
    }

    .buttons button {
        font-size: 1rem;
    }

    .solar {
        width: 50%;
        height: 20px;
        margin-left: 38%;
    }
}
