* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
    user-select: none;
}

:root {
    --bg-color: #121212;
    --calculator-bg: rgba(30, 30, 30, 0.8);
    --display-bg: rgba(20, 20, 20, 0.9);
    --btn-bg: rgba(60, 60, 60, 0.5);
    --btn-hover: rgba(80, 80, 80, 0.7);
    --btn-active: rgba(100, 100, 100, 0.9);
    --number-color: #ffffff;
    --operator-color: #ff9500;
    --special-color: #a5a5a5;
    --equals-color: #0070f3;
    --equals-hover: #0051b3;
    --text-color: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

body {
    background: var(--bg-color);
    background-image: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.calculator {
    background: var(--calculator-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 30px var(--shadow-color);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.display {
    background: var(--display-bg);
    color: var(--text-color);
    padding: 30px 20px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.previous-operand {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    min-height: 24px;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.current-operand {
    font-size: 2.5rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 20px;
}

button {
    border: none;
    outline: none;
    background: var(--btn-bg);
    color: var(--text-color);
    font-size: 1.5rem;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

button:hover::before {
    width: 200%;
    height: 200%;
}

button:hover {
    background: var(--btn-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

button:active {
    background: var(--btn-active);
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.number {
    color: var(--number-color);
}

.operator {
    color: var(--operator-color);
    font-weight: bold;
}

.special-btn {
    color: var(--special-color);
    font-weight: bold;
}

.equals {
    background: var(--equals-color);
    color: white;
    font-weight: bold;
}

.equals:hover {
    background: var(--equals-hover);
}

.zero {
    grid-column: span 2;
}

/* Ripple effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Responsive design */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .buttons {
        gap: 8px;
        padding: 15px;
    }
    
    button {
        font-size: 1.2rem;
        padding: 12px;
    }
    
    .current-operand {
        font-size: 2rem;
    }
}

@media (max-width: 320px) {
    button {
        font-size: 1rem;
        padding: 10px;
    }
    
    .current-operand {
        font-size: 1.8rem;
    }
}