body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #e2c2ff, #f5a5e1);
    margin: 0;
    overflow: hidden;
}

.calculator {
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    max-width: 100%;
    width: 100%;
    max-width: 350px; 
    text-align: center;
}

.calculator-name {
    font-size: 2em;
    color: #fff;
    margin-bottom: 20px;
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #ff8a80, #ff5252);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text; 
    color: transparent; 
    margin-bottom: 20px;
    transition: transform 0.3s, color 0.3s;
}

.calculator-name:hover {
    transform: scale(1.1);
    color: #ff1744; 
}

#display {
    width: 100%;
    height: 60px;
    margin-bottom: 15px;
    font-size: 1.8em;
    text-align: right;
    padding: 15px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #f7f7f7, #e0e0e0);
    color: #333;
    box-sizing: border-box;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

button {
    padding: 18px;
    font-size: 1.4em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(145deg, #ff8a80, #ff5252);
    color: #fff;
    transition: background 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

button:hover {
    background: linear-gradient(145deg, #ff5252, #ff1744);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

button:active {
    background: linear-gradient(145deg, #ff1744, #d50032);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button.equals {
    background: linear-gradient(145deg, #00e676, #00c853);
}

button.equals:hover {
    background: linear-gradient(145deg, #00c853, #00b74a);
}

button.equals:active {
    background: linear-gradient(145deg, #00b74a, #009624);
}

/* Special button colors */
button:nth-child(4n) {
    background: linear-gradient(145deg, #ffab91, #ff7043);
}

button:nth-child(4n):hover {
    background: linear-gradient(145deg, #ff7043, #ff5722);
}

button:nth-child(4n):active {
    background: linear-gradient(145deg, #ff5722, #d84315);
}

/* Media Queries for Responsiveness */
@media (max-width: 768px) {
    #display {
        height: 50px;
        font-size: 1.5em;
        padding: 12px;
    }

    button {
        padding: 14px;
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    #display {
        height: 45px;
        font-size: 1.4em;
        padding: 10px;
    }

    button {
        padding: 12px;
        font-size: 1em;
    }
}

@media (max-width: 360px) {
    .calculator {
        width: 100%;
        padding: 10px;
    }

    #display {
        height: 40px;
        font-size: 1.2em;
        padding: 8px;
    }

    button {
        padding: 10px;
        font-size: 0.9em;
    }
}
