* {
    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;
    padding: 20px;
}

.calculator-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
}

.calculator-header {
    text-align: center;
    margin-bottom: 30px;
}

.calculator-header h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 5px;
}

.calculator-header p {
    color: #666;
    font-size: 1.1em;
}

.calculator {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.1);
}

.display {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: right;
    min-height: 100px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.previous-operand {
    color: #666;
    font-size: 1.2em;
    min-height: 24px;
    margin-bottom: 10px;
}

.current-operand {
    color: #333;
    font-size: 2.5em;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.btn {
    border: none;
    border-radius: 10px;
    padding: 15px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn.number {
    background: white;
    color: #333;
}

.btn.number:hover {
    background: #f0f0f0;
}

.btn.operator {
    background: #ff6b6b;
    color: white;
}

.btn.operator:hover {
    background: #ff5252;
}

.btn.function {
    background: #4ecdc4;
    color: white;
}

.btn.function:hover {
    background: #45b7aa;
}

.btn.equals {
    background: #48bb78;
    color: white;
    grid-column: span 1;
}

.btn.equals:hover {
    background: #3da16a;
}

.advanced-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.btn.advanced {
    background: #667eea;
    color: white;
    font-size: 1em;
    padding: 12px;
}

.btn.advanced:hover {
    background: #5a6fd8;
}

.expression-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#expressionInput {
    flex: 1;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1em;
    outline: none;
}

#expressionInput:focus {
    border-color: #667eea;
}

.btn.evaluate {
    background: #9f7aea;
    color: white;
    padding: 12px 20px;
}

.btn.evaluate:hover {
    background: #8b6ce1;
}

.history-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.history-panel h3 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

#historyList {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.history-item {
    padding: 8px 12px;
    margin-bottom: 5px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    font-size: 0.9em;
}

.btn.clear-history {
    background: #e53e3e;
    color: white;
    width: 100%;
    padding: 12px;
}

.btn.clear-history:hover {
    background: #c53030;
}

@media (max-width: 600px) {
    .calculator-container {
        padding: 20px;
        margin: 10px;
    }
    
    .buttons {
        gap: 8px;
    }
    
    .btn {
        padding: 12px;
        font-size: 1.1em;
    }
    
    .advanced-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .current-operand {
        font-size: 2em;
    }
}