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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-30px, -30px) rotate(120deg); }
    66% { transform: translate(30px, -30px) rotate(240deg); }
}

.calculator-container {
    position: relative;
    z-index: 1;
}

.calculator {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    padding: 25px;
    max-width: 400px;
    width: 90vw;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.display {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: right;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: 'Courier New', monospace;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

.previous-operand {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    min-height: 24px;
    word-wrap: break-word;
    word-break: break-all;
}

.current-operand {
    color: white;
    font-size: 2.5rem;
    font-weight: 300;
    word-wrap: break-word;
    word-break: break-all;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

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

button {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    color: white;
    font-size: 1.3rem;
    font-weight: 500;
    padding: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

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

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

button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

button.operation {
    background: rgba(101, 127, 234, 0.4);
    color: white;
}

button.operation:hover {
    background: rgba(101, 127, 234, 0.6);
}

button.equals {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    grid-column: span 2;
}

button.equals:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a3f9e 100%);
}

button.clear {
    background: rgba(234, 84, 85, 0.4);
    color: white;
}

button.clear:hover {
    background: rgba(234, 84, 85, 0.6);
}

button[data-action="delete"] {
    background: rgba(255, 165, 0, 0.4);
    color: white;
}

button[data-action="delete"]:hover {
    background: rgba(255, 165, 0, 0.6);
}

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

@media (max-width: 480px) {
    .calculator {
        padding: 15px;
    }

    .display {
        padding: 15px;
        min-height: 80px;
    }

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

    .previous-operand {
        font-size: 1rem;
    }

    button {
        padding: 20px;
        font-size: 1.1rem;
    }

    .buttons {
        gap: 10px;
    }
}

@media (hover: none) {
    button:hover {
        background: rgba(255, 255, 255, 0.15);
        transform: none;
    }

    button.operation:hover {
        background: rgba(101, 127, 234, 0.4);
    }

    button.equals:hover {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    button.clear:hover {
        background: rgba(234, 84, 85, 0.4);
    }

    button[data-action="delete"]:hover {
        background: rgba(255, 165, 0, 0.4);
    }
}