/* 1. Global Reset & Body Setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body { 
    font-family: 'Segoe UI', Roboto, sans-serif; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    min-height: 100vh; 
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e); /* Deep space gradient */
    padding: 20px;
    overflow: hidden;
}

/* 2. Entrance Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 3. The Calculator Container */
.calc-card { 
    background: rgba(28, 28, 28, 0.95); 
    padding: 25px; 
    border-radius: 30px; 
    width: 100%; 
    max-width: 380px; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1); /* Smooth pop-in */
}

/* 4. The Display Screen */
#display { 
    width: 100%; 
    height: 90px; 
    font-size: 42px; 
    text-align: right; 
    margin-bottom: 25px; 
    padding: 15px 25px;
    border: none;
    border-radius: 20px;
    background: #000;
    color: #00ff88; 
    font-family: 'Courier New', monospace;
    outline: none;
    box-shadow: inset 0 4px 15px rgba(0,0,0,1);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.6); /* Glow effect */
}

/* 5. Button Grid */
.buttons { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 15px; 
}

/* 6. Button Styling & Animations */
button { 
    aspect-ratio: 1/1; 
    font-size: 24px; 
    font-weight: bold;
    cursor: pointer; 
    border: none; 
    border-radius: 20px; 
    background: #333;
    color: #fff;
    transition: all 0.2s ease; /* Smooth hover/tap transition */
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 0 #1a1a1a; /* 3D effect */
}

/* Interactive States */
button:hover {
    background: #444;
}

button:active { 
    transform: translateY(3px) scale(0.92); /* Visual "press" effect */
    box-shadow: 0 1px 0 #1a1a1a;
    filter: brightness(1.3);
}

/* Special Button Colors */
.clear { 
    background: #ff4757; 
}
.clear:hover { background: #ff6b81; }

.equal { 
    background: #2ed573; 
}
.equal:hover { background: #7bed9f; }

/* Math Operators (+, -, *, /) */
button:nth-child(2), 
button:nth-child(3), 
button:nth-child(4),
button:nth-child(8),
button:nth-child(12) {
    color: #ffa502;
    background: #2a2a2a;
}

/* Zero button span */
button[style*="grid-column: span 2;"] {
    aspect-ratio: auto;
    height: 100%;
}
