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

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    overflow: hidden;
    padding: 20px;
}

body::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -250px;
    right: -250px;
    filter: blur(80px);
}

body::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    bottom: -150px;
    left: -150px;
    filter: blur(60px);
}

.calculator {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.92));
    backdrop-filter: blur(20px);
    padding: 22px;
    border-radius: 24px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.3),
        0 15px 35px rgba(0, 0, 0, 0.2),
        inset 0 -2px 6px rgba(0, 0, 0, 0.05),
        inset 0 2px 2px rgba(255, 255, 255, 0.8);
    width: 100%;
    max-width: 380px;
    position: relative;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.display {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    color: #fff;
    font-size: 2.2em;
    padding: 22px;
    border-radius: 16px;
    text-align: right;
    margin-bottom: 18px;
    min-height: 75px;
    word-wrap: break-word;
    box-shadow:
        inset 0 4px 12px rgba(0, 0, 0, 0.5),
        inset 0 -1px 3px rgba(255, 255, 255, 0.05),
        0 2px 8px rgba(0, 0, 0, 0.2);
    font-weight: 300;
    letter-spacing: 2px;
    border: 1px solid rgba(0, 0, 0, 0.3);
}

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

button {
    padding: 22px;
    font-size: 1.5em;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 1px rgba(255, 255, 255, 0.4);
    position: relative;
    overflow: hidden;
    min-height: 62px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 14px 14px 0 0;
    pointer-events: none;
}

button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::after {
    width: 300px;
    height: 300px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.2),
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

button:active {
    transform: translateY(1px);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.number {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    color: #2d3436;
}

.operator {
    background: linear-gradient(145deg, #ff9500, #ff8000);
    color: #fff;
    box-shadow:
        0 6px 16px rgba(255, 149, 0, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.operator:hover {
    box-shadow:
        0 10px 24px rgba(255, 149, 0, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.equals {
    background: linear-gradient(145deg, #34c759, #28a745);
    color: #fff;
    grid-column: span 2;
    box-shadow:
        0 6px 16px rgba(52, 199, 89, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.equals:hover {
    box-shadow:
        0 10px 24px rgba(52, 199, 89, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.clear {
    background: linear-gradient(145deg, #ff3b30, #e02020);
    color: #fff;
    box-shadow:
        0 6px 16px rgba(255, 59, 48, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.clear:hover {
    box-shadow:
        0 10px 24px rgba(255, 59, 48, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.zero {
    grid-column: span 2;
}

/* Desktop */
@media (min-width: 768px) {
    .calculator {
        max-width: 420px;
        padding: 25px;
    }

    .display {
        font-size: 2.6em;
        padding: 26px;
        min-height: 85px;
    }

    button {
        padding: 26px;
        font-size: 1.7em;
        min-height: 70px;
    }

    .buttons {
        gap: 13px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .calculator {
        padding: 18px;
        max-width: 100%;
    }

    .display {
        font-size: 2em;
        padding: 20px;
        min-height: 70px;
    }

    button {
        padding: 20px;
        font-size: 1.4em;
        min-height: 60px;
    }

    .buttons {
        gap: 10px;
    }
}

@media (max-width: 360px) {
    .display {
        font-size: 1.8em;
        padding: 15px;
    }

    button {
        padding: 18px;
        font-size: 1.3em;
        min-height: 55px;
    }
}