*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

body{
    min-height: 100vh;
    display: flex;
    justify-content: center;    
    align-items: center;
    background: #0037ff;
    padding: 20px;
    flex-direction: column;
}

.container{
    position: relative;
    max-width: 360px;
    width: 100%;
    min-width: 280px;
    border-radius: 12px;
    padding: 15px;
    background: #000000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.04);
    border: 2px solid black;
    margin: 10px;
}

.display{
    height: 100px;
    width: 100%;
    outline: none;
    border: 2px solid black;
    background: white;
    text-align: right;
    margin-bottom: 15px;
    font-size: 2rem;
    color: #000000;
    pointer-events: none;
    padding: 0 10px;
    border-radius: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.buttons{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 10px;
}

.buttons button{
    padding: 15px 0;
    border-radius: 8px;
    border: 2px solid black;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.2s ease;
    min-height: 50px;
}

footer{
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: white;
}

.buttons button:active{
    transform: scale(0.97);
    background-color: rgba(0, 0, 0, 0.1);
}

.operator{
    color: #ff0000;
    background-color: #ffffffd9;
}

.buttons button:not(.operator) {
    background-color: #fff;
}

@media (hover: hover) {
    .buttons button:hover {
        background-color: rgba(0, 0, 0, 0.05);
        color: white;
    }
}

@media (max-width: 400px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 10px;
        margin: 5px;
    }
    
    .display {
        height: 90px;
        font-size: 1.8rem;
        margin-bottom: 12px;
    }
    
    .buttons button {
        padding: 12px 0;
        font-size: 1.1rem;
        min-height: 45px;
    }
    
    footer {
        margin-top: 15px;
        font-size: 13px;
    }
}

@media (max-width: 320px) {
    .display {
        height: 80px;
        font-size: 1.6rem;
    }
    
    .buttons button {
        padding: 10px 0;
        font-size: 1rem;
        min-height: 40px;
    }
    
    .buttons {
        grid-gap: 8px;
    }
    
    footer {
        margin-top: 12px;
        font-size: 12px;
    }
}