* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    display: flex;
    gap: 30px;
    max-width: 900px;
    width: 100%;
    align-items: flex-start;
}

.calculator {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 400px;
    max-width: 100%;
}

.display {
    margin-bottom: 24px;
}

    .display input[type="text"] {
        width: 100%;
        height: 80px;
        font-size: 32px;
        font-weight: 600;
        text-align: right;
        padding: 0 24px;
        border: 2px solid #e1e5e9;
        border-radius: 16px;
        background: linear-gradient(145deg, #f8f9fa, #e9ecef);
        color: #2c3e50;
        box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
    }

        .display input[type="text"]:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
        }

.checkbox-container {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

    .checkbox-container input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-right: 12px;
        cursor: pointer;
        accent-color: #667eea;
    }

    .checkbox-container label {
        font-weight: 500;
        color: #2c3e50;
        cursor: pointer;
        font-size: 16px;
    }

.button-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.calculator button {
    height: 64px;
    border: none;
    border-radius: 16px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

    .calculator button::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        transition: width 0.3s ease, height 0.3s ease;
    }

    .calculator button:active::before {
        width: 120px;
        height: 120px;
    }

/* Number buttons */
.btn-number {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    color: #2c3e50;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

    .btn-number:hover {
        background: linear-gradient(145deg, #f8f9fa, #e9ecef);
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    }

/* Operator buttons */
.btn-operator {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

    .btn-operator:hover {
        background: linear-gradient(145deg, #764ba2, #667eea);
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    }

/* Clear button */
.btn-clear {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    color: white;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

    .btn-clear:hover {
        background: linear-gradient(145deg, #c0392b, #e74c3c);
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(231, 76, 60, 0.4);
    }

/* Calculate button */
.btn-calculate {
    background: linear-gradient(145deg, #27ae60, #2ecc71);
    color: white;
    grid-column: span 4;
    height: 64px;
    font-size: 22px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
    border-radius: 20px;
}

    .btn-calculate:hover {
        background: linear-gradient(145deg, #2ecc71, #27ae60);
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(39, 174, 96, 0.4);
    }

/* History panel */
.history {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 320px;
    max-width: 100%;
}

    .history h3 {
        color: #2c3e50;
        margin-bottom: 20px;
        font-size: 22px;
        text-align: center;
        font-weight: 600;
    }

    .history textarea {
        width: 100%;
        height: 400px;
        border: 2px solid #e1e5e9;
        border-radius: 16px;
        padding: 20px;
        font-family: 'Segoe UI', monospace;
        font-size: 14px;
        resize: vertical;
        background: linear-gradient(145deg, #f8f9fa, #ffffff);
        color: #2c3e50;
        line-height: 1.6;
        transition: all 0.3s ease;
    }

        .history textarea:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
        }

/* Responsive design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        gap: 24px;
        align-items: center;
    }

    .calculator {
        width: 100%;
        max-width: 400px;
        padding: 24px;
    }

    .history {
        width: 100%;
        max-width: 400px;
    }

    .display input[type="text"] {
        height: 70px;
        font-size: 28px;
    }

    .calculator button {
        height: 58px;
        font-size: 18px;
    }

    .btn-calculate {
        height: 58px;
        font-size: 20px;
    }

    .history textarea {
        height: 300px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 15px;
    }

    .calculator, .history {
        padding: 20px;
    }

    .display input[type="text"] {
        height: 65px;
        font-size: 24px;
        padding: 0 20px;
    }

    .calculator button {
        height: 54px;
        font-size: 17px;
    }

    .button-grid {
        gap: 12px;
    }

    .btn-calculate {
        height: 54px;
        font-size: 19px;
    }
}

/* Loading animation for buttons */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.96);
    }

    100% {
        transform: scale(1);
    }
}

.calculator button:active {
    animation: pulse 0.15s ease;
}

/* Smooth transitions */
* {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Enhanced visual feedback */
.calculator button:focus {
    outline: 2px solid rgba(102, 126, 234, 0.4);
    outline-offset: 2px;
}

/* Improved button proportions */
.button-grid {
    aspect-ratio: 1;
}

.calculator button {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-calculate {
    aspect-ratio: 4/1;
}

