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

:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #00d4ff;
    --accent-hover: #00b8e6;
    --operator: #ff6b35;
    --operator-hover: #ff5722;
    --shadow: rgba(0, 212, 255, 0.2);
    --border-radius: 16px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.calculator {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    max-width: 320px;
    width: 100%;
}

.display {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px 20px;
    margin-bottom: 20px;
    text-align: right;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.display-previous {
    color: var(--text-secondary);
    font-size: 14px;
    min-height: 20px;
    margin-bottom: 8px;
}

.display-current {
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 300;
    min-height: 40px;
    word-wrap: break-word;
    word-break: break-all;
}

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

.btn {
    background: var(--bg-secondary);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 500;
    height: 60px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

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

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

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

.btn.function {
    background: var(--accent);
    color: var(--bg-primary);
    font-weight: 600;
}

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

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

.btn.equals {
    background: var(--accent);
    color: var(--bg-primary);
    font-weight: 600;
    font-size: 24px;
}

.btn.equals:hover {
    background: var(--accent-hover);
    box-shadow: 0 8px 20px var(--shadow);
}

@media (max-width: 480px) {
    .calculator {
        padding: 20px;
        max-width: 280px;
    }

    .btn {
        height: 55px;
        font-size: 16px;
    }

    .display-current {
        font-size: 28px;
    }
}

.error {
    color: var(--operator) !important;
}