* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.calculator-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.calculator {
    background: #2d3748;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.display {
    background: #1a202c;
    color: white;
    padding: 20px;
    text-align: right;
    position: relative;
}

.memory-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 12px;
    color: #48bb78;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.memory-indicator.active {
    opacity: 1;
}

.history {
    font-size: 14px;
    color: #a0aec0;
    min-height: 20px;
    margin-bottom: 10px;
}

.input {
    font-size: 36px;
    font-weight: 300;
    min-height: 45px;
    word-wrap: break-word;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: #4a5568;
}

.row {
    display: contents;
}

.btn {
    background: #2d3748;
    color: white;
    border: none;
    padding: 20px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0);
    transition: transform 0.2s ease;
    border-radius: 50%;
}

.btn:active::before {
    transform: scale(1);
}

.btn.number {
    background: #2d3748;
}

.btn.operator {
    background: #ed8936;
    font-size: 24px;
}

.btn.equals {
    background: #48bb78;
    font-size: 24px;
}

.btn.clear {
    background: #e53e3e;
}

.btn.function {
    background: #4299e1;
}

.btn.memory {
    background: #9f7aea;
    font-size: 14px;
}

.btn:hover {
    filter: brightness(1.1);
}

@media (max-width: 400px) {
    .calculator-container {
        padding: 10px;
    }
    
    .btn {
        padding: 15px;
        font-size: 16px;
    }
    
    .input {
        font-size: 28px;
    }
}

@media (max-width: 320px) {
    .btn {
        padding: 12px;
        font-size: 14px;
    }
    
    .input {
        font-size: 24px;
    }
}