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

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

:root {
    --blue: #47c9ff;
    --deep-blue: #168bdf;
    --white: #ffffff;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 24px;
    font-family: 'Inter', sans-serif;
    background:
        radial-gradient(ellipse at 20% 20%, #b8f1ff 0%, transparent 38%),
        radial-gradient(ellipse at 80% 80%, #7dcaff 0%, transparent 40%),
        linear-gradient(135deg, #eafcff, #8edbff 48%, #d5f6ff);
    perspective: 1200px;
    color: #ffffff;
}

/* Moving water bubbles */

.water {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(2px);
    animation: float 8s ease-in-out infinite alternate;
}

.water-one {
    width: 300px;
    height: 300px;
    top: -90px;
    left: -70px;
    background: radial-gradient(circle at 30% 30%,
        #ffffffc9, #73d8ff70, #4abaff20);
    box-shadow: inset -15px -15px 40px #39a9ed30,
                0 20px 60px #54c6ff30;
}

.water-two {
    width: 230px;
    height: 230px;
    right: -50px;
    bottom: -60px;
    background: radial-gradient(circle at 30% 25%,
        #ffffffb8, #62c7ff60, #319df120);
    animation-delay: -3s;
}

.water-three {
    width: 90px;
    height: 90px;
    top: 15%;
    right: 15%;
    background: #ffffff55;
    box-shadow: inset -8px -8px 20px #57b9ff30,
                0 0 40px #ffffff80;
    animation-delay: -5s;
}

@keyframes float {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(25px, -30px, 20px) scale(1.1); }
}

/* 3D calculator */

.scene {
    width: 100%;
    max-width: 390px;
    z-index: 1;
    animation: appear 1s ease both;
}

@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(50px) rotateX(12deg) scale(.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0) scale(1);
    }
}

.calculator {
    position: relative;
    padding: 25px;
    border-radius: 32px;
    overflow: hidden;
    background: linear-gradient(145deg,
        #ffffffb8, #c6f0ff7c 45%, #ffffff65);
    border: 1px solid #ffffffd9;
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    box-shadow:
        0 35px 80px #178bc744,
        0 12px 25px #248bc72b,
        inset 2px 2px 2px #ffffff,
        inset -2px -2px 8px #6cc9ff45;
    transform-style: preserve-3d;
    transition: transform .35s ease, box-shadow .35s ease;
}

.calculator:hover {
    transform: rotateX(2deg) rotateY(-2deg) translateY(-4px);
    box-shadow:
        0 42px 85px #178bc750,
        inset 2px 2px 2px #ffffff;
}

.top-bar, .logo, .status, .bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    justify-content: flex-start;
    gap: 8px;
    color: #087fbd;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 1px;
}

.logo-icon {
    font-size: 26px;
    color: #168bdf;
}

.logo-light {
    font-weight: 500;
    color: #53bde9;
}

.status {
    gap: 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #288bb6;
}

.status i {
    width: 7px;
    height: 7px;
    background: #36d9a1;
    border-radius: 50%;
    box-shadow: 0 0 10px #36d9a1;
}

/* Display */

.display {
    margin: 28px 0 22px;
    padding: 19px 17px;
    min-height: 132px;
    border-radius: 21px;
    background: linear-gradient(145deg, #d9f6ffb5, #ffffff85);
    border: 1px solid #ffffffd9;
    box-shadow: inset 3px 3px 10px #58b6e72b,
                inset -3px -3px 8px #ffffffb8;
    text-align: right;
    overflow: hidden;
}

.display-label {
    text-align: left;
    color: #65a9c8;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.7px;
    margin-bottom: 13px;
}

#history {
    min-height: 17px;
    color: #5ca6ca;
    font-size: 12px;
    overflow-wrap: anywhere;
}

#display {
    display: block;
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: #087cb7;
    font-family: inherit;
    font-size: clamp(30px, 8vw, 40px);
    font-weight: 700;
    text-align: right;
}

/* Buttons grid */

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

button {
    min-width: 0;
    height: 59px;
    border: 1px solid #ffffffdb;
    border-radius: 17px;
    background: linear-gradient(145deg, #ffffffc9, #d9f5ffb0);
    color: #277da7;
    font-family: inherit;
    font-size: 19px;
    font-weight: 600;
    cursor: pointer;
    box-shadow:
        0 5px 0 #8bc9e8a1,
        0 8px 13px #368fc51c,
        inset 1px 1px 2px #ffffff;
    transition: transform .12s ease, box-shadow .12s ease,
               background .2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

button:hover {
    background: linear-gradient(145deg, #ffffff, #bdefff);
    color: #087dbd;
    transform: translateY(-2px);
    box-shadow: 0 7px 0 #8bc9e8a1, 0 10px 17px #368fc52c;
}

button:active {
    transform: translateY(4px) scale(.96);
    box-shadow: 0 1px 0 #8bc9e8a1, inset 2px 2px 5px #65b4d94a;
}

button.utility {
    color: #168cc2;
    background: linear-gradient(145deg, #d8f6ff, #b0eaff);
    font-size: 15px;
}

button.operator {
    color: white;
    border-color: #ffffffad;
    background: linear-gradient(145deg, #71d8ff, #239ce7);
    box-shadow: 0 5px 0 #1477bd, 0 9px 15px #178fe83b,
                inset 1px 1px 2px #ffffffa8;
    font-size: 23px;
}

button.operator:hover {
    background: linear-gradient(145deg, #91e4ff, #37aaff);
}

button.equals {
    color: white;
    background: linear-gradient(145deg, #48d7f5, #1685df);
    box-shadow: 0 5px 0 #0966b4, 0 9px 18px #168ce74a,
                inset 1px 1px 2px #ffffffb5;
    font-size: 26px;
}

button.equals:hover {
    background: linear-gradient(145deg, #70e5ff, #168de9);
}

.bottom-bar {
    margin-top: 24px;
    padding-top: 15px;
    border-top: 1px solid #ffffffa6;
    color: #5dabc9;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Small mobile screens */

@media (max-width: 380px) {
    body {
        padding: 14px;
    }

    .calculator {
        padding: 19px;
        border-radius: 27px;
    }

    .buttons {
        gap: 9px;
    }

    button {
        height: 53px;
        border-radius: 14px;
        font-size: 17px;
    }

    .display {
        margin-top: 23px;
        min-height: 120px;
    }
}

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

/* Full screen calculator - No scrolling */

html,
body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.scene {
    width: min(100%, 370px);
    max-width: 370px;
    max-height: 100%;
    margin: auto;
}

.calculator {
    width: 100%;
    padding: clamp(12px, 3vh, 22px);
    border-radius: 28px;
}

.display {
    margin: clamp(12px, 2.5vh, 22px) 0;
    min-height: 0;
    padding: clamp(10px, 2vh, 17px);
}

.buttons {
    gap: clamp(6px, 1.5vh, 10px);
}

button {
    height: clamp(38px, 7.5vh, 55px);
    border-radius: 14px;
    font-size: clamp(15px, 2.5vh, 19px);
}

.bottom-bar {
    margin-top: clamp(12px, 2.5vh, 20px);
    padding-top: 10px;
}

/* Choti screen par bhi fit rahe */

@media (max-height: 650px) {
    body {
        padding: 6px;
    }

    .calculator {
        padding: 12px;
        border-radius: 22px;
    }

    .display {
        margin: 10px 0;
        padding: 10px 12px;
    }

    .display-label {
        margin-bottom: 5px;
    }

    .buttons {
        gap: 6px;
    }

    button {
        height: clamp(32px, 7vh, 43px);
        border-radius: 11px;
    }

    .bottom-bar {
        margin-top: 10px;
        padding-top: 7px;
    }

    .logo {
        font-size: 14px;
    }
}
