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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(140deg, #8100D1 50%, #0E21A0 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    padding: 20px;
}

.calculator {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 320px;
}

.display {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: right;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

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

.current-operand {
    color: white;
    font-size: 2rem;
    font-weight: 300;
    word-wrap: break-word;
    word-break: break-all;
}

.preview-result {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
    min-height: 1.3rem;
    word-wrap: break-word;
    word-break: break-all;
    font-style: italic;
    margin-top: 5px;
}

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

.btn {
    border: none;
    border-radius: 50px;
    font-size: 1.2rem;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

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

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

.btn-operator {
    background: #1A3263;
    color: white;
}

.btn-operator:hover {
    background: #0f1f3d;
}

.btn-function {
    background: white;
    color: #333;
}

.btn-function:hover {
    background: #f0f0f0;
}

.btn-equals {
    background: #C3110C;
    color: white;
}

.btn-equals:hover {
    background: #9a0d09;
}

.btn-zero {
    grid-column: span 2;
}

@media (max-width: 480px) {
    .calculator {
        padding: 15px;
    }
    
    .btn {
        padding: 20px;
        font-size: 1.2rem;
    }
    
    .current-operand {
        font-size: 2rem;
    }
}

.back-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 25px;
    background: white;
    color: #667eea;
    text-decoration: none;
    border-radius: 10px;
    font-weight: bold;
    border: 2px solid white;
    transition: all 0.3s;
    text-align: center;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}
