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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.calculator {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.display {
    background: #f8f8f8;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: right;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.expression {
    font-size: 16px;
    color: #666;
    word-break: break-all;
    margin-bottom: 4px;
    min-height: 20px;
}

.result {
    font-size: 40px;
    font-weight: 300;
    color: #333;
    word-break: break-all;
}

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

.btn {
    height: 64px;
    border: none;
    border-radius: 16px;
    font-size: 24px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:active {
    transform: scale(0.95);
}

.number, .zero {
    background: #f0f0f0;
    color: #333;
}

.number:hover, .zero:hover {
    background: #e5e5e5;
}

.function {
    background: #a5a5a5;
    color: #fff;
    font-size: 20px;
}

.function:hover {
    background: #8f8f8f;
}

.operator {
    background: #ff9500;
    color: #fff;
}

.operator:hover {
    background: #e68600;
}

.equals {
    background: #ff9500;
    color: #fff;
}

.equals:hover {
    background: #e68600;
}

.zero {
    grid-column: span 1;
}

@media (max-width: 400px) {
    .calculator {
        padding: 16px;
    }
    
    .btn {
        height: 56px;
        font-size: 20px;
    }
    
    .result {
        font-size: 32px;
    }
}
