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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1e1e2f 0%, #2a2a40 100%);
    padding: 20px;
}

.calculator {
    width: 100%;
    max-width: 340px;
    background: #1c1c28;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.05);
}

.display {
    background: #14141d;
    border-radius: 12px;
    padding: 20px 18px;
    margin-bottom: 20px;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    text-align: right;
    overflow: hidden;
}

.history {
    color: #6b6b7d;
    font-size: 0.95rem;
    font-weight: 400;
    min-height: 20px;
    margin-bottom: 6px;
    word-wrap: break-word;
}

.result {
    color: #ffffff;
    font-size: 2.6rem;
    font-weight: 300;
    letter-spacing: 0.5px;
    word-wrap: break-word;
    line-height: 1.1;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.btn {
    height: 64px;
    border: none;
    border-radius: 14px;
    font-size: 1.3rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.08s ease, background-color 0.15s ease,
                box-shadow 0.15s ease;
    font-family: inherit;
    user-select: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-number {
    background: #2d2d3f;
    color: #ffffff;
}

.btn-number:hover {
    background: #383850;
}

.btn-function {
    background: #45455c;
    color: #ffffff;
    font-size: 1.1rem;
}

.btn-function:hover {
    background: #525269;
}

.btn-operator {
    background: #f39c4a;
    color: #ffffff;
    font-size: 1.5rem;
}

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

.btn-operator-disabled,
.btn-operator:disabled {
    background: #2d2d3f;
    color: #4a4a5c;
    cursor: not-allowed;
    opacity: 0.55;
    pointer-events: none;
}

.btn-operator-disabled:hover,
.btn-operator:disabled:hover {
    transform: none;
    background: #2d2d3f;
}

.btn-equal {
    background: #4a8df3;
    color: #ffffff;
    font-size: 1.5rem;
}

.btn-equal:hover {
    background: #63a0f7;
}

.btn-zero {
    grid-column: span 2;
    text-align: left;
    padding-left: 26px;
}

@media (max-width: 360px) {
    .calculator {
        padding: 18px;
    }

    .btn {
        height: 56px;
        font-size: 1.15rem;
    }

    .result {
        font-size: 2.2rem;
    }
}
