* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 20px;
    min-height: calc(100vh - 40px);
    background: #008080;
    color: #000;
    font-family: "Comic Sans MS", cursive;
}

.calculator {
    width: 320px;
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
    background: #c0c0c0;
    border: 4px outset #eee;
    box-shadow: 2px 2px 0 #000;
}


.calculator-header marquee {
    display: block;
    width: 100%;
    padding: 3px;
    overflow: hidden;

    background: #000080;
    color: yellow;

    border: 2px inset #fff;

    font-family: "Times New Roman", serif;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

h1 {
    margin: 12px 0;
    color: red;

    font-family: "Comic Sans MS", cursive;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    text-decoration: underline;

    overflow-wrap: anywhere;
}

.telegram-status {
    margin: 8px 0;
    padding: 4px;

    background: #000;
    color: #00ff00;

    border: 2px inset #fff;

    font-family: "Courier New", monospace;
    font-size: 11px;
    font-weight: bold;
    text-align: center;

    overflow: hidden;
}

.user-greeting {
    margin: 6px 0;

    color: blue;

    font-size: 11px;
    text-align: center;

    overflow-wrap: anywhere;
}


.calculator-body {
    width: 100%;
}

.screen {
    display: block;
    width: 100%;
    height: 40px;

    margin: 0 0 8px;
    padding: 4px;

    background: #fff;
    color: #000;

    border: 3px inset #fff;

    font-family: "Courier New", monospace;
    font-size: 18px;

    outline: none;
}

.screen:focus {
    outline: 1px dotted #000;
    outline-offset: -4px;
}

.screen::placeholder {
    color: #666;
    opacity: 1;
}


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

.buttons button {
    width: 100%;
    min-width: 0;
    height: 42px;

    margin: 0;
    padding: 0;

    background: #c0c0c0;
    color: #000;

    border: 3px outset #eee;

    font-family: "Times New Roman", serif;
    font-size: 18px;
    font-weight: bold;

    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.buttons button:hover {
    background: #d4d4d4;
}

.buttons button:active {
    background: #b0b0b0;
    border-style: inset;
    padding-top: 2px;
}

.buttons button:focus-visible {
    outline: 1px dotted #000;
    outline-offset: -5px;
}


.answer {
    width: 100%;
    min-height: 35px;

    margin-top: 10px;
    padding: 5px;

    background: #fff;
    color: #000;

    border: 3px inset #fff;

    font-family: "Courier New", monospace;
    font-size: 13px;

    overflow-wrap: anywhere;
    word-break: break-word;
}


.calculator-footer {
    width: 100%;
}

.warning {
    margin: 10px 0 0;
    padding: 5px;

    background: yellow;
    color: red;

    border: 2px dashed red;

    font-size: 11px;
    font-weight: bold;
    text-align: center;

    overflow-wrap: anywhere;
}

.footer {
    margin-top: 12px;
    padding-top: 6px;

    border-top: 2px dotted #000;

    font-size: 10px;
    text-align: center;
    line-height: 1.8;

    overflow-wrap: anywhere;
}

.footer a {
    color: blue;
    text-decoration: underline;
}

.footer a:visited {
    color: purple;
}

.footer a:hover {
    color: red;
}

.footer a:active {
    color: lime;
}


@media (max-width: 360px) {
    body {
        margin: 10px;
    }

    .calculator {
        padding: 8px;
    }

    h1 {
        font-size: 18px;
    }

    .buttons {
        gap: 3px;
    }

    .buttons button {
        height: 40px;
        font-size: 17px;
    }
}


@media (max-width: 320px) {
    body {
        margin: 5px;
    }

    .calculator {
        width: 100%;
        padding: 6px;
    }

    .buttons button {
        height: 38px;
        font-size: 16px;
    }
}