:root {
    --bg-color: #000;
    --display-color: #1c1c1e;
    --btn-dark: #333;
    --btn-light: #a5a5a5;
    --btn-orange: #ff9f0a;
    --btn-orange-active: #ffb340;
    --text-light: #fff;
    --text-dark: #000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    user-select: none;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-color);
}

.calculator {
    width: 100%;
    max-width: 375px;
    border-radius: 40px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.display {
    padding: 80px 20px 20px;
    text-align: right;
    background-color: var(--bg-color);
    color: var(--text-light);
    position: relative;
}

.display .previous-operand {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    height: 30px;
    overflow: hidden;
}

.display .current-operand {
    font-size: 4rem;
    font-weight: 300;
    margin-top: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 12px;
    padding: 20px;
    background-color: var(--bg-color);
}

.btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn:active::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

.btn-light {
    background-color: var(--btn-light);
    color: var(--text-dark);
}

.btn-dark {
    background-color: var(--btn-dark);
    color: var(--text-light);
}

.btn-orange {
    background-color: var(--btn-orange);
    color: var(--text-light);
}

.btn-dark:active {
    background-color: #4d4d4d;
}

.btn-light:active {
    background-color: #d9d9d9;
}

.btn-orange:active {
    background-color: var(--btn-orange-active);
}

.span-2 {
    grid-column: span 2;
    width: auto;
    border-radius: 35px;
    justify-content: flex-start;
    padding-left: 30px;
}

.btn-active {
    background-color: var(--text-light);
    color: var(--btn-orange);
}

@media (max-width: 400px) {
    .btn {
        width: 60px;
        height: 60px;
        font-size: 1.7rem;
    }
}