*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #e8e6df;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.calculator {
    width: 340px;
    background: #f5f4f0;
    border-radius: 0;
    padding: 24px;
    border: 1px solid #b5b3ac;
    box-shadow: none;
}

/* ---- Display ---- */
.display {
    background: #ffffff;
    border-radius: 0;
    padding: 20px 24px;
    margin-bottom: 20px;
    text-align: right;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    border: 1px solid #c8c6bf;
}

.previous-operand {
    color: #8a8880;
    font-size: 0.95rem;
    min-height: 1.2em;
    word-break: break-all;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.current-operand {
    color: #1a1a1a;
    font-size: 2.4rem;
    font-weight: 300;
    word-break: break-all;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

/* ---- Buttons Grid ---- */
.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.btn {
    border: 1px solid #c8c6bf;
    border-radius: 0;
    padding: 18px;
    font-size: 1.3rem;
    font-weight: 300;
    cursor: pointer;
    transition: background 0.12s, transform 0.08s;
    background: #f5f4f0;
    color: #1a1a1a;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.btn:hover {
    background: #eae9e4;
}

.btn:active {
    transform: scale(0.97);
    background: #d6d5d0;
}

/* Span two columns */
.span-two {
    grid-column: span 2;
}

/* Clear button */
.btn-clear {
    background: #1a1a1a;
    color: #f5f4f0;
    border-color: #1a1a1a;
}

.btn-clear:hover {
    background: #333333;
}

.btn-clear:active {
    background: #000000;
}

/* Operator buttons */
.btn-operator {
    background: #d6d5d0;
    color: #1a1a1a;
    border-color: #b5b3ac;
}

.btn-operator:hover {
    background: #c8c6bf;
}

.btn-operator:active {
    background: #b5b3ac;
}

/* Equals button */
.btn-equals {
    background: #6b6960;
    color: #f5f4f0;
    font-size: 1.5rem;
    font-weight: 300;
    border-color: #6b6960;
}

.btn-equals:hover {
    background: #57564e;
}

.btn-equals:active {
    background: #3d3c36;
}

/* ---- Responsive ---- */
@media (max-width: 400px) {
    .calculator {
        width: 95vw;
        padding: 16px;
    }

    .btn {
        padding: 14px;
        font-size: 1.1rem;
    }

    .current-operand {
        font-size: 2rem;
    }
}

