:root {
    --bg-color: #0f172a; /* Tailwind slate-900 */
    --calc-bg: rgba(30, 41, 59, 0.6); /* slate-800 with opacity */
    --calc-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --btn-bg: rgba(255, 255, 255, 0.05);
    --btn-hover: rgba(255, 255, 255, 0.1);
    --btn-active: rgba(255, 255, 255, 0.15);
    --btn-border: rgba(255, 255, 255, 0.05);
    
    --accent-op: #3b82f6; /* blue-500 */
    --accent-op-hover: #2563eb;
    
    --accent-equals: #8b5cf6; /* violet-500 */
    --accent-equals-hover: #7c3aed;
    
    --accent-clr: #ef4444; /* red-500 */
    --accent-clr-hover: #dc2626;

    --font-family: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.25), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.25), transparent 25%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.calculator-wrapper {
    position: relative;
    padding: 20px;
}

/* Subtle glowing orb behind calculator */
.calculator-wrapper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--accent-op), var(--accent-equals));
    filter: blur(80px);
    opacity: 0.3;
    z-index: -1;
    border-radius: 50%;
    animation: pulse 8s infinite alternate;
}

@keyframes pulse {
    0% { opacity: 0.2; transform: translate(-50%, -50%) scale(0.9); }
    100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1.1); }
}

.glass-effect {
    background: var(--calc-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--calc-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 24px;
}

.calculator-container {
    width: 400px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.display {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 20px;
    text-align: right;
    border: 1px inset rgba(255, 255, 255, 0.05);
    box-shadow: inner 0 4px 6px rgba(0, 0, 0, 0.1);
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    position: relative;
}

.history {
    font-size: 1rem;
    color: var(--text-secondary);
    min-height: 1.5rem;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}
.history::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.current {
    font-size: 2.5rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    transition: font-size 0.2s ease;
}
.current::-webkit-scrollbar {
    display: none;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

.mode-toggles, .memory-toggles {
    display: flex;
    gap: 8px;
}

.mode-btn, .mem-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.mode-btn:hover, .mem-btn:hover {
    color: var(--text-primary);
    background: var(--btn-hover);
}

.mode-btn.active {
    color: var(--text-primary);
    background: var(--accent-op);
}

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

.btn {
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1.1rem;
    border-radius: 12px;
    padding: 14px 0;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
}

.btn:hover {
    background: var(--btn-hover);
    transform: translateY(-1px);
}

.btn:active {
    background: var(--btn-active);
    transform: translateY(1px);
}

.btn.func {
    font-size: 0.95rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
}

.btn.func:hover {
    color: var(--text-primary);
    background: var(--btn-hover);
}

.btn.num {
    font-size: 1.3rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.08);
}

.btn.op {
    background: var(--accent-op);
    font-size: 1.4rem;
    font-weight: 500;
    border-color: transparent;
}

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

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

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

.btn.clr {
    color: var(--accent-clr);
    font-weight: 600;
}

.btn.clr:hover {
    background: rgba(239, 68, 68, 0.15);
}

.btn.del {
    color: var(--text-secondary);
}

/* Animations for display changes */
@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pop-anim {
    animation: pop 0.15s ease-out;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .calculator-container {
        width: 100%;
        max-width: 400px;
        border-radius: 0;
        min-height: 100vh;
        border: none;
    }
    
    .calculator-wrapper {
        padding: 0;
        width: 100%;
    }
    
    .glass-effect {
        border-radius: 0;
    }
}
