.ios-calc {
    width: min(100%, 390px);
    aspect-ratio: 390 / 640;
    margin: 24px auto;
    padding: 112px 14px 16px;
    box-sizing: border-box;
    border-radius: 44px;
    background: #000;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    position: relative;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
    overflow: hidden;
}

.ios-calc * {
    box-sizing: border-box;
}

.responsive #top #main .container_wrap > .container:has(.ios-calc),
.ios-calc__theme-host {
    display: block !important;
}

html.ios-calc__page,
body.ios-calc__page {
    background: #000 !important;
}

html.ios-calc__page,
body.ios-calc__page,
.ios-calc__page #wrap_all,
.ios-calc__page #main,
.ios-calc__page .container_wrap,
.ios-calc__page .main_color,
.ios-calc__page .container,
.ios-calc__page .entry-content,
.ios-calc__page .entry-content-wrapper,
.ios-calc__page article {
    background: #000 !important;
    border: 0 !important;
    box-shadow: none !important;
}

html.ios-calc__page,
body.ios-calc__page {
    height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
}

body.ios-calc__page .ios-calc {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    border: 0;
    border-radius: 0;
    width: 100vw;
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    min-height: 0;
    max-width: none;
    aspect-ratio: auto;
    margin: 0;
    padding: 0 16px max(58px, env(safe-area-inset-bottom) + 34px);
    box-shadow: none;
}

body.ios-calc__page .ios-calc__status {
    top: max(10px, env(safe-area-inset-top));
}

body.ios-calc__page .ios-calc__display {
    flex: 0 0 auto;
    min-height: 0;
    height: 261px;
    margin: 0 0 26px;
    padding-bottom: 2px;
}

body.ios-calc__page .ios-calc__keys {
    flex: 0 0 auto;
    gap: 10px;
}

.ios-calc__status {
    position: absolute;
    top: 28px;
    left: 24px;
    right: 24px;
    display: none;
    min-height: 0;
    color: #8e8e93;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
}

.ios-calc__toolbar {
    position: absolute;
    top: -3px;
    left: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}

.ios-calc__tool {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: contain;
    user-select: none;
}

.ios-calc__tool--history {
    transform: translateX(-10px);
}

.ios-calc__tool--calculator {
    transform: translateX(10px);
}

.ios-calc__display {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    width: 100%;
    height: 261px;
    margin: 0 0 26px;
    padding: 0 5px;
    color: #fff;
    font-size: 78px;
    font-weight: 200;
    line-height: 0.95;
    letter-spacing: 0;
    text-align: right;
    overflow: hidden;
    white-space: nowrap;
}

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

.ios-calc__key {
    appearance: none;
    border: 0;
    border-radius: 999px;
    aspect-ratio: 1;
    min-width: 0;
    background: radial-gradient(circle at 58% 28%, #343434 0, #292929 66%, #242424 100%);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 42px;
    font-weight: 300;
    line-height: 1;
    letter-spacing: 0;
    transition: background-color 120ms ease, color 120ms ease, transform 80ms ease;
    -webkit-tap-highlight-color: transparent;
}

.ios-calc__key:active {
    transform: scale(0.96);
    background: #737373;
}

.ios-calc__key--utility {
    background: radial-gradient(circle at 58% 28%, #6a6a6a 0, #5c5c5c 70%, #535353 100%);
    color: #fff;
    font-size: 42px;
}

.ios-calc__key--utility:active {
    background: #d9d9d9;
}

.ios-calc__key--small-utility {
    font-size: 38px;
}

.ios-calc__key--operator {
    background: #f59a2d;
    color: #fff;
    font-size: 48px;
}

.ios-calc__key--operator.is-selected,
.ios-calc__key--operator:active {
    background: #fff;
    color: #ff9f0a;
}

.ios-calc__key--backspace {
    background: radial-gradient(circle at 58% 28%, #666 0, #5b5b5b 70%, #515151 100%);
}

.ios-calc__key--backspace img {
    display: block;
    width: 33px;
    height: auto;
    margin: 0 auto;
    pointer-events: none;
    user-select: none;
}

@media (max-width: 430px) {
    html:has(.ios-calc),
    body:has(.ios-calc),
    html.ios-calc__page,
    body.ios-calc__page {
        background: #000 !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    .ios-calc {
        position: fixed;
        inset: 0;
        z-index: 999999;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 0;
        border-radius: 0;
        width: 100vw;
        height: 100vh;
        height: 100svh;
        height: 100dvh;
        min-height: 0;
        aspect-ratio: auto;
        margin: 0;
        padding: 0 16px max(58px, env(safe-area-inset-bottom) + 34px);
        box-shadow: none;
    }

    .ios-calc__status {
        top: max(10px, env(safe-area-inset-top));
    }

    .ios-calc__display {
        flex: 0 0 auto;
        min-height: 0;
        height: 261px;
        margin: 0 0 26px;
        padding-bottom: 2px;
    }

    .ios-calc__keys {
        flex: 0 0 auto;
        gap: 10px;
    }
}

@media (width: 390px) and (max-height: 844px) {
    .ios-calc {
        padding-left: 16px;
        padding-right: 16px;
    }

    .ios-calc__keys {
        gap: 10px;
    }
}
