*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:Arial, Helvetica, sans-serif;
}

body{
    background:#0f0f0f;
    display:flex;
    justify-content:center;
    align-items:center;
    min-height:100vh;
    padding:10px;
}

/* MAIN CALCULATOR */

.calculator{
    width:95%;
    max-width:480px;
    background:#1b1b1b;
    border-radius:20px;
    padding:12px;
    box-shadow:0 0 25px rgba(0,0,0,0.7);
}

/* TOP STATUS BAR */

.topbar{
    display:flex;
    gap:18px;
    color:#fff;
    font-size:13px;
    margin-bottom:10px;
    padding-left:5px;
}

/* SCREEN */

.screen{
    background:#dfe5e5;
    height:200px;
    border-radius:14px;
    padding:15px;
    margin-bottom:12px;
    overflow:hidden;
}

.input{
    min-height:60px;
    font-size:22px;
    color:#222;
    word-wrap:break-word;
    overflow-wrap:break-word;
}

.output{
    text-align:right;
    font-size:38px;
    margin-top:30px;
    color:#000;
    font-weight:bold;
}

/* MENU ROW */

.menu-row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:14px;
    gap:6px;
    flex-wrap:wrap;
}

.menu-btn{
    height:36px;
    min-width:36px;
    border:none;
    border-radius:10px;
    background:#2d2d2d;
    color:#fff;
    padding:0 10px;
    font-size:15px;
    cursor:pointer;
    transition:0.2s;
    flex:1 1 auto;
}

.menu-btn:hover{
    background:#444;
}

.pro{
    background:#9a7dff;
    color:#fff;
    font-weight:bold;
}

/* SCIENTIFIC GRID */

.scientific-grid{
    display:grid;
    grid-template-columns:repeat(6,1fr);
    gap:7px;
    margin-bottom:16px;
}

/* NUMBER GRID */

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

/* EACH KEY BLOCK */

.key-block{
    display:flex;
    flex-direction:column;
    align-items:center;
}

/* TOP LABELS */

.top-functions{
    width:100%;
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:0 4px;
    margin-bottom:3px;
    min-height:14px;
}

/* YELLOW LABEL */

.yellow-text{
    color:#f3d13b;
    font-size:10px;
    font-weight:bold;
}

/* PURPLE LABEL */

.purple-text{
    color:#9f8cff;
    font-size:10px;
    font-weight:bold;
}

/* BUTTONS */

.btn{
    width:100%;
    height:48px;
    border:none;
    border-radius:12px;
    background:#3a3a3a;
    color:white;
    font-size:20px;
    cursor:pointer;
    transition:0.15s;
    box-shadow:
        inset 0 1px 1px rgba(255,255,255,0.08),
        inset 0 -2px 3px rgba(0,0,0,0.5);
}

/* BUTTON HOVER */

.btn:hover{
    background:#4b4b4b;
}

/* BUTTON CLICK */

.btn:active{
    transform:scale(0.96);
}

/* SPECIAL BUTTONS */

.yellow{
    background:#f0c419;
    color:#000;
    font-weight:bold;
}

.purple{
    background:#7864ff;
    color:#fff;
    font-weight:bold;
}

.orange{
    background:#eb8f3d;
    color:#000;
    font-weight:bold;
}

.blue{
    background:#4a8fff;
    color:#fff;
    font-weight:bold;
}

/* MENU BUTTON ACTIVE */

.menu-btn:active{
    transform:scale(0.95);
}

/* RESPONSIVE */

@media(max-width:768px){
    .calculator{
        padding:12px;
    }

    .btn{
        height:45px;
        font-size:18px;
    }

    .screen{
        height:160px;
    }

    .output{
        font-size:34px;
    }
}

@media(max-width:600px){
    .calculator{
        padding:10px;
        max-width:100%;
        width:98%;
        margin:0 auto;
    }

    .topbar{
        font-size:11px;
        gap:10px;
        margin-bottom:8px;
    }

    .menu-row{
        gap:5px;
        margin-bottom:12px;
    }

    .menu-btn{
        height:34px;
        font-size:12px;
        padding:0 8px;
    }

    .screen{
        height:150px;
        padding:12px;
        margin-bottom:10px;
    }

    .input{
        font-size:16px;
    }

    .output{
        font-size:32px;
        margin-top:22px;
    }

    .scientific-grid{
        grid-template-columns:repeat(5,1fr);
        gap:6px;
        margin-bottom:10px;
    }

    .number-grid{
        grid-template-columns:repeat(5,1fr);
        gap:6px;
    }

    .btn{
        height:42px;
        font-size:15px;
    }

    .yellow-text,
    .purple-text{
        font-size:8px;
    }
}

@media(max-width:480px){
    .calculator{
        padding:8px;
        width:98%;
        max-width:100%;
        margin:0 auto;
        border-radius:18px;
    }

    .topbar{
        font-size:10px;
        gap:8px;
        margin-bottom:6px;
        padding-left:3px;
    }

    .menu-row{
        gap:4px;
        margin-bottom:8px;
    }

    .menu-btn{
        height:31px;
        font-size:10px;
        padding:0 6px;
        border-radius:8px;
    }

    .screen{
        height:130px;
        padding:10px;
        margin-bottom:8px;
        border-radius:12px;
    }

    .input{
        font-size:14px;
        min-height:45px;
    }

    .output{
        font-size:28px;
        margin-top:18px;
    }

    .scientific-grid{
        grid-template-columns:repeat(5,1fr);
        gap:5px;
        margin-bottom:8px;
    }

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

    .btn{
        height:38px;
        font-size:13px;
        border-radius:10px;
    }

    .yellow-text,
    .purple-text{
        font-size:7px;
    }

    .top-functions{
        margin-bottom:2px;
        min-height:11px;
        padding:0 2px;
    }
}

@media(max-width:400px){
    .calculator{
        padding:7px;
        width:99%;
        border-radius:16px;
    }

    .topbar{
        font-size:9px;
        gap:6px;
        margin-bottom:5px;
        padding-left:2px;
    }

    .menu-row{
        gap:3px;
        margin-bottom:7px;
    }

    .menu-btn{
        height:28px;
        font-size:9px;
        padding:0 5px;
        border-radius:7px;
    }

    .screen{
        height:115px;
        padding:9px;
        margin-bottom:7px;
        border-radius:11px;
    }

    .input{
        font-size:13px;
        min-height:40px;
    }

    .output{
        font-size:26px;
        margin-top:15px;
    }

    .scientific-grid{
        grid-template-columns:repeat(5,1fr);
        gap:4px;
        margin-bottom:7px;
    }

    .number-grid{
        grid-template-columns:repeat(5,1fr);
        gap:4px;
    }

    .btn{
        height:35px;
        font-size:12px;
        border-radius:8px;
    }

    .yellow-text,
    .purple-text{
        font-size:6px;
    }

    .top-functions{
        margin-bottom:1px;
        min-height:10px;
        padding:0 1px;
    }

    .key-block{
        display:flex;
        flex-direction:column;
        align-items:center;
    }
}

@media(max-width:360px){
    .calculator{
        padding:6px;
        width:99%;
        border-radius:15px;
    }

    .topbar{
        font-size:8px;
        gap:5px;
        margin-bottom:4px;
        padding-left:2px;
    }

    .menu-row{
        gap:2px;
        margin-bottom:6px;
    }

    .menu-btn{
        height:26px;
        font-size:8px;
        padding:0 4px;
        border-radius:6px;
    }

    .screen{
        height:105px;
        padding:8px;
        margin-bottom:6px;
        border-radius:10px;
    }

    .input{
        font-size:12px;
        min-height:38px;
    }

    .output{
        font-size:24px;
        margin-top:13px;
    }

    .scientific-grid{
        grid-template-columns:repeat(5,1fr);
        gap:3px;
        margin-bottom:6px;
    }

    .number-grid{
        grid-template-columns:repeat(5,1fr);
        gap:3px;
    }

    .btn{
        height:32px;
        font-size:11px;
        border-radius:7px;
    }

    .yellow-text,
    .purple-text{
        font-size:5px;
    }

    .top-functions{
        margin-bottom:1px;
        min-height:9px;
        padding:0 1px;
    }
}