
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

html,
body {
    min-height: 100%;
    width: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;

    font-family: 'Inter', sans-serif;
    color: #f8fafc;

    background:
        radial-gradient(circle at 15% 20%, #252b42 0%, transparent 35%),
        radial-gradient(circle at 85% 80%, #34251e 0%, transparent 35%),
        #0b0e14;
}

/* Calculator */

.calculator {
    width: min(100%, 350px);
    padding: 20px;

    background: rgba(25, 30, 42, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 24px;

    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.06);

    backdrop-filter: blur(20px);
}

/* Display */

.display {
    width: 100%;
    height: 85px;
    margin-bottom: 18px;
    padding: 16px;

    background: #111620;
    color: #f8fafc;

    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 15px;
    outline: none;

    font-family: 'Inter', sans-serif;
    font-size: 30px;
    font-weight: 600;
    text-align: right;
}

/* Button layout */

.buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

#calculator-body {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 10px;
}

.numbers {
    display: grid;
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
}

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

.right-buttons {
    display: grid;
    grid-template-rows: 3fr 1fr;
    gap: 10px;
}

/* Common button styling */

button {
    width: 100%;
    height: 65px;

    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;

    font-family: 'Inter', sans-serif;
    font-size: 21px;
    font-weight: 600;

    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

button:hover {
    transform: translateY(-2px);
}

button:active {
    transform: scale(0.94);
}

/* Number buttons */

.number {
    background: #242b38;
    color: #f1f5f9;
}

.number:hover {
    background: #333d4e;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.2);
}

/* Operators */

.sign {
    background: #303746;
    color: #ffad66;
}

.sign:hover {
    background: #414b5e;
    color: #ffc28d;
}

/* Equal button */

.equal {
    height: 100%;
    background: linear-gradient(145deg, #ffad55, #ff792e);
    color: #171717;

    font-size: 28px;
    font-weight: 800;

    border: none;
    box-shadow: 0 6px 20px rgba(255, 132, 48, 0.2);
}

.equal:hover {
    background: linear-gradient(145deg, #ffc17d, #ff914f);
    box-shadow: 0 8px 25px rgba(255, 132, 48, 0.35);
}

/* Clear button */

#clear {
    background: #492c32;
    color: #ff8585;
}

#clear:hover {
    background: #633840;
}

/* Backspace */

#backspace {
    height: 100%;
    background: #303746;
    color: #ffad66;
}

#backspace:hover {
    background: #414b5e;
}

/* Keyboard accessibility */

button:focus-visible {
    outline: 2px solid #ffad55;
    outline-offset: 3px;
}

/* Responsive */

@media (max-width: 400px) {
    .calculator {
        padding: 14px;
        border-radius: 20px;
    }

    button {
        height: 58px;
        font-size: 19px;
        border-radius: 12px;
    }

    .equal,
    #backspace {
        height: 100%;
    }

    .display {
        height: 75px;
        font-size: 26px;
    }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}
