@font-face {
    font-family: "Fx82";
    src: url("../fonts/fx82nl.ttf") format("truetype");
}

@font-face {
    font-family: "Fx82Small";
    src: url("../fonts/fx82nl1.ttf") format("truetype");
}

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

body {
    --calc-shell-pad-x: 16px;
    --calc-shell-pad-y: 24px;
    --calc-max-scale: 1.35;
    background: radial-gradient(circle at 50% 14%, #58738a 0%, #243243 44%, #101821 100%);
    color: #fff;
    font-family: "Segoe UI", sans-serif;
}

html.calculator-embedded,
body.calculator-embedded {
    background: transparent;
}

body.calculator-embedded {
    --calc-shell-pad-x: 0px;
    --calc-shell-pad-y: 0px;
    --calc-max-scale: 1;
}

#app {
    width: 100%;
    height: 100%;
}

.loading-progress {
    position: fixed;
    inset: 50% auto auto 50%;
    width: 6rem;
    height: 6rem;
    transform: translate(-50%, -62%);
}

.loading-progress circle {
    fill: none;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:first-child {
    stroke: rgba(255, 255, 255, 0.18);
}

.loading-progress circle:last-child {
    stroke: #ffffff;
    stroke-dasharray: 188.4;
    stroke-dashoffset: 46;
    animation: loading-spin 1.15s linear infinite;
}

.loading-progress-text {
    position: fixed;
    left: 50%;
    top: calc(50% + 3.8rem);
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.95rem;
    letter-spacing: 0.03em;
}

@keyframes loading-spin {
    from {
        transform: rotate(-90deg);
    }

    to {
        transform: rotate(270deg);
    }
}

a,
button {
    touch-action: manipulation;
}

.app-shell {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100%;
    display: grid;
    place-items: center;
    padding: var(--calc-shell-pad-y) var(--calc-shell-pad-x);
    box-sizing: border-box;
}

.calculator-shell {
    width: calc(100vw - (var(--calc-shell-pad-x) * 2));
    width: calc(100dvw - (var(--calc-shell-pad-x) * 2));
    height: calc(100vh - (var(--calc-shell-pad-y) * 2));
    height: calc(100dvh - (var(--calc-shell-pad-y) * 2));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.calculator {
    position: relative;
    width: 306px;
    height: 643px;
    transform-origin: top center;
    scale: min(var(--calc-max-scale), calc((100dvw - (var(--calc-shell-pad-x) * 2)) / 306px), calc((100dvh - (var(--calc-shell-pad-y) * 2)) / 643px));
    filter: drop-shadow(0 24px 32px rgba(0, 0, 0, 0.42));
    outline: none;
}

body.calculator-embedded .calculator {
    filter: none;
}

.calculator-image {
    position: absolute;
    inset: 0;
    width: 306px;
    height: 643px;
    display: block;
    user-select: none;
    pointer-events: none;
}

.display {
    position: absolute;
    left: 34px;
    color: #111;
    white-space: nowrap;
    overflow: visible;
}

.input-display {
    top: 110px;
    width: 238px;
    height: 28px;
    padding-left: 2px;
    display: flex;
    align-items: center;
}

.output-display {
    top: 160px;
    width: 237px;
    height: 28px;
    padding-right: 2px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    text-align: right;
}

.line-display {
    top: 110px;
    width: 238px;
    height: 72px;
    display: grid;
    overflow: visible;
}

.line-display.rows-4 {
    grid-template-rows: repeat(4, 1fr);
}

.line-display.rows-6 {
    grid-template-rows: repeat(6, 1fr);
}

.line-row {
    overflow: visible;
    display: flex;
    align-items: center;
    padding-left: 2px;
}

.line-row-output {
    justify-content: flex-end;
    padding-right: 2px;
    padding-left: 0;
}

.status-bar {
    position: absolute;
    left: 34px;
    top: 98px;
    width: 237px;
    height: 13px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 3.5px;
}

.status-icon {
    height: 9px;
    width: auto;
    opacity: 0.25;
}

.status-icon.active {
    opacity: 1;
}

.screen-context,
.screen-inline,
.screen-inline-group {
    display: inline-flex;
    align-items: baseline;
    white-space: nowrap;
    overflow: visible;
}

.screen-context-sup,
.screen-sup-wrap {
    display: inline-flex;
    align-items: flex-start;
    transform: translateY(-7px);
}

.screen-sub-wrap {
    display: inline-flex;
    align-items: flex-end;
    transform: translateY(4px);
}

.spaced-char {
    display: inline-block;
    line-height: 1;
    color: #111;
}

.fx-base {
    font-family: "Fx82", sans-serif;
    font-size: 17px;
}

.fx-small {
    font-family: "Fx82Small", sans-serif;
    font-size: 10.5px;
}

.screen-caret {
    display: inline-block;
    position: relative;
    width: 0;
    height: 0;
    margin: 0;
    overflow: visible;
    animation: caret-blink 1s steps(1) infinite;
}

.screen-caret::after {
    content: "";
    position: absolute;
    left: -1px;
    top: -13px;
    width: 2px;
    height: 17px;
    background: #111;
}

.screen-caret-sup::after {
    top: -10px;
    height: 14px;
}

@keyframes caret-blink {
    50% {
        opacity: 0;
    }
}

.screen-implicit-space,
.screen-inline-gap {
    display: inline-block;
    width: 0.6px;
    flex: 0 0 auto;
}

.screen-implicit-space {
    width: 1.02px;
}

.screen-sqrt {
    display: inline-flex;
    align-items: flex-start;
}

.screen-sqrt-inner {
    border-top: 1px solid #111;
    padding: 2px 2px 0 1px;
    margin-top: 2px;
    display: inline-flex;
}

.screen-sqrt-glyph {
    align-self: flex-end;
}

.screen-fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0 3px;
    vertical-align: middle;
    overflow: visible;
}

.screen-fraction-top,
.screen-fraction-bottom {
    display: inline-flex;
    justify-content: center;
    overflow: visible;
}

.screen-fraction-top {
    margin-bottom: 2px;
}

.screen-fraction-bottom {
    margin-top: 2px;
}

.screen-fraction-bar {
    width: calc(100% - 2px);
    min-width: 10px;
    height: 1.15px;
    background: #111;
    margin: 0;
}

.home-box,
.menu-box,
.error-box {
    position: absolute;
    left: 34px;
    width: 238px;
}

.home-box {
    top: 98px;
    height: 90px;
    display: grid;
    grid-template-columns: repeat(3, 75px);
    gap: 4px;
    width: 237px;
    padding: 8px 0 0 3px;
}

.home-app {
    height: 36px;
    border-radius: 2px;
    display: block;
}

.home-app.selected {
    background: #111;
}

.home-app-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.home-app-icon {
    width: 31px;
    height: 18px;
    margin-top: 1px;
    flex: 0 0 auto;
    overflow: visible;
}

.home-app-k0 {
    fill: #111;
}

.home-app-k1 {
    fill: rgb(85, 85, 85);
}

.home-app-k2 {
    fill: rgb(170, 170, 170);
}

.home-app.selected .home-app-k0 {
    fill: rgb(213, 229, 218);
}

.home-app.selected .home-app-k1 {
    fill: rgb(170, 170, 170);
}

.home-app.selected .home-app-k2 {
    fill: rgb(85, 85, 85);
}

.home-app-text {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -1px;
    line-height: 1;
    white-space: nowrap;
}

.home-app-text .spaced-char {
    font-family: "Fx82Small", sans-serif;
    font-size: 17px;
    color: #111;
}

.home-app.selected .home-app-text .spaced-char {
    color: rgb(213, 229, 218);
}

.menu-box {
    top: 110px;
    height: 90px;
}

.menu-row {
    position: absolute;
    display: flex;
    align-items: center;
    overflow: hidden;
    color: #111;
}

.menu-row.selected {
    background: #111;
}

.menu-text {
    margin-left: 2px;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.menu-text .spaced-char,
.menu-suffix .spaced-char,
.table-status .menu-text .spaced-char {
    font-family: "Fx82", sans-serif;
    font-size: 16px;
    color: #111;
}

.menu-row.selected .menu-text .spaced-char,
.menu-row.selected .menu-suffix .spaced-char,
.error-row.selected .menu-text .spaced-char {
    color: rgb(213, 229, 218);
}

.menu-radio,
.menu-arrow {
    width: 16px;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 16px;
}

.menu-row.selected .menu-radio,
.menu-row.selected .menu-arrow {
    color: rgb(213, 229, 218);
}

.menu-suffix {
    margin-right: 1px;
    flex: 0 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.menu-arrow {
    margin-right: 2px;
    font-family: "Fx82", sans-serif;
    font-size: 13px;
}

.menu-radio-circle {
    position: relative;
    width: 8px;
    height: 8px;
    border: 1px solid currentColor;
    border-radius: 50%;
    box-sizing: border-box;
}

.menu-radio-circle.selected::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 3px;
    height: 3px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: currentColor;
}

.menu-scrollbar {
    position: absolute;
    left: 236px;
    width: 2px;
    background: #111;
    border-radius: 1px;
}

.menu-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

.table-box {
    position: absolute;
    left: 0;
    top: 2px;
    width: 234px;
    height: 72px;
}

.table-separator {
    position: absolute;
    background: #111;
}

.table-cell {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
}

.table-cell.selected {
    background: transparent;
}

.table-cell-selected-box {
    position: absolute;
    inset: 0 1px;
    background: #111;
    z-index: 0;
}

.table-cell > * {
    position: relative;
    z-index: 1;
}

.table-head-text .spaced-char {
    font-family: "Fx82Small", sans-serif;
    font-size: 16px;
    color: #111;
}

.table-text .spaced-char {
    font-family: "Fx82Small", sans-serif;
    font-size: 16px;
    color: #111;
}

.table-cell.selected .table-head-text .spaced-char,
.table-cell.selected .table-text .spaced-char {
    color: rgb(213, 229, 218);
}

.table-header-center {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Fx82Small", sans-serif;
    font-size: 16px;
    line-height: 1;
    color: #111;
}

.table-cell.selected .table-header-center {
    color: rgb(213, 229, 218);
}

.table-text-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 2px;
    box-sizing: border-box;
}

.table-text-wrap-right {
    justify-content: flex-end;
}

.table-status {
    position: absolute;
    left: 0;
    top: 54px;
    width: 234px;
    height: 18px;
    display: flex;
    align-items: center;
}

.error-box {
    top: 110px;
    height: 90px;
}

.variable-row {
    position: absolute;
    display: flex;
    align-items: center;
    overflow: hidden;
    color: #111;
}

.variable-row.selected {
    background: #111;
}

.variable-text {
    margin-left: 2px;
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.variable-text .spaced-char {
    font-family: "Fx82Small", sans-serif;
    font-size: 16px;
    color: #111;
}

.variable-row.selected .variable-text .spaced-char {
    color: rgb(213, 229, 218);
}

.menu-overlay-image {
    position: absolute;
    left: 34px;
    top: 103px;
    width: 238px;
    height: auto;
    display: block;
    pointer-events: none;
    z-index: 100;
}

.error-row {
    position: absolute;
    left: 0;
    width: 234px;
    height: 18px;
    display: flex;
    align-items: center;
}

.error-row:first-child {
    top: 2px;
}

.error-bottom {
    top: 56px;
    background: #111;
}

.error-image {
    position: absolute;
    left: 77px;
    top: 19px;
    width: 80px;
    height: 36px;
    object-fit: contain;
}

.calc-key {
    position: absolute;
    opacity: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.calc-key:focus-visible {
    opacity: 0.22;
    background: rgba(62, 218, 255, 0.45);
    outline: 2px solid rgba(255, 255, 255, 0.92);
    outline-offset: 1px;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    max-width: min(90vw, 700px);
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: rgba(30, 10, 10, 0.94);
    color: #fff3f3;
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.35);
    z-index: 9999;
}

#blazor-error-ui .reload {
    color: #fff;
    margin-left: 0.75rem;
}

#blazor-error-ui .dismiss {
    margin-left: 0.75rem;
    cursor: pointer;
}
