* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.calculator {
    width: 320px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    padding: 25px;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.calculator:hover {
    transform: translateY(-5px);
}

.display {
    width: 100%;
    height: 100px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    margin-bottom: 20px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
}

.display::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.previous-operand {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    text-align: right;
    min-height: 1.2rem;
    overflow: hidden;
}

.current-operand {
    color: white;
    font-size: 2.5rem;
    text-align: right;
    font-weight: 300;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.button {
    height: 65px;
    border-radius: 15px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

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

.button:hover::before {
    width: 300px;
    height: 300px;
}

.button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.button:active {
    transform: translateY(1px);
}

.button.span-two {
    grid-column: span 2;
}

.button.operator {
    background: rgba(255, 107, 107, 0.3);
}

.button.equals {
    background: rgba(72, 187, 120, 0.3);
}

.button.clear {
    background: rgba(255, 159, 67, 0.3);
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.button .icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.button:hover .icon {
    transform: rotate(15deg) scale(1.2);
}

.history {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    max-height: 150px;
    overflow-y: auto;
}

.history h3 {
    color: white;
    margin-bottom: 10px;
    font-weight: 400;
    font-size: 1rem;
}

.history-item {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive design */
@media (max-width: 400px) {
    .calculator {
        width: 100%;
        max-width: 320px;
    }
    
    .button {
        height: 60px;
    }
}