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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --bg-color: #ecf0f1;
    --text-color: #2c3e50;
    --display-bg: #34495e;
    --button-bg: #ffffff;
    --button-hover: #f8f9fa;
    --operator-bg: #3498db;
    --operator-hover: #2980b9;
    --equals-bg: #27ae60;
    --equals-hover: #229954;
    --clear-bg: #e74c3c;
    --clear-hover: #c0392b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-color);
}

header {
    padding: 1rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.built-with {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.built-with:hover {
    opacity: 0.8;
    text-decoration: underline;
}

main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
}

.calculator {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    max-width: 400px;
    width: 100%;
}

.display {
    background: var(--display-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    word-wrap: break-word;
    word-break: break-all;
}

.display-previous {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    min-height: 1.5rem;
    margin-bottom: 0.5rem;
}

.display-current {
    color: white;
    font-size: 2.5rem;
    font-weight: 300;
    min-height: 2.5rem;
}

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

.btn {
    border: none;
    border-radius: 10px;
    font-size: 1.5rem;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    background: var(--button-bg);
    color: var(--text-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

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

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

.btn-number:hover {
    background: var(--button-hover);
}

.btn-operator {
    background: var(--operator-bg);
    color: white;
}

.btn-operator:hover {
    background: var(--operator-hover);
}

.btn-clear {
    background: var(--clear-bg);
    color: white;
    grid-column: span 2;
}

.btn-clear:hover {
    background: var(--clear-hover);
}

.btn-delete {
    background: var(--accent-color);
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
}

.btn-equals {
    background: var(--equals-bg);
    color: white;
    grid-row: span 2;
}

.btn-equals:hover {
    background: var(--equals-hover);
}

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

footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    .calculator {
        padding: 1rem;
        border-radius: 15px;
    }

    .display {
        padding: 1rem;
        min-height: 80px;
    }

    .display-current {
        font-size: 2rem;
    }

    .display-previous {
        font-size: 1rem;
    }

    .btn {
        font-size: 1.25rem;
        padding: 1rem;
    }

    .buttons {
        gap: 0.5rem;
    }
}

@media (max-width: 320px) {
    .btn {
        font-size: 1rem;
        padding: 0.75rem;
    }

    .display-current {
        font-size: 1.5rem;
    }
}