.mgc-calculator {
    --mgc-primary: #b0004b;
    --mgc-primary-dark: #820038;
    --mgc-primary-soft: rgba(176, 0, 75, 0.09);
    --mgc-bg: #ffffff;
    --mgc-soft-bg: #f6f0eb;
    --mgc-text: #252525;
    --mgc-muted: #777777;
    --mgc-border: rgba(0, 0, 0, 0.10);
    --mgc-radius: 18px;

    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    font-family: "IRANYekanX", Sans-serif;
    color: var(--mgc-text);
}

.mgc-calculator *,
.mgc-calculator *::before,
.mgc-calculator *::after {
    box-sizing: border-box;
    font-family: "IRANYekanX", Sans-serif;
}

.mgc-card {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 100% 0%, rgba(176, 0, 75, 0.10), transparent 32%),
        linear-gradient(180deg, #ffffff 0%, #fffdfc 100%);
    border: 1px solid var(--mgc-border);
    border-radius: var(--mgc-radius);
    padding: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.07);
}

.mgc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.mgc-heading {
    min-width: 0;
}

.mgc-title {
    margin: 0;
    color: var(--mgc-text);
    font-size: 19px;
    font-weight: 850;
    line-height: 1.35;
}

.mgc-subtitle {
    margin: 2px 0 0;
    color: var(--mgc-muted);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
}

.mgc-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--mgc-primary);
    background: rgba(176, 0, 75, 0.07);
    border: 1px solid rgba(176, 0, 75, 0.16);
    border-radius: 12px;
}

.mgc-result-box {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(135deg, var(--mgc-soft-bg), #fbf7f3);
    border: 1px solid rgba(176, 0, 75, 0.08);
    border-radius: 16px;
    padding: 14px 12px 12px;
    margin-bottom: 12px;
    text-align: center;
}

.mgc-result-box::before {
    content: "";
    position: absolute;
    width: 130px;
    height: 130px;
    left: -55px;
    bottom: -70px;
    border-radius: 999px;
    background: rgba(176, 0, 75, 0.08);
}

.mgc-result-label {
    display: block;
    color: var(--mgc-muted);
    font-size: 12px;
    line-height: 1.45;
    margin-bottom: 2px;
}

.mgc-result-main {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mgc-total-weight {
    display: inline-block;
    direction: ltr;
    color: var(--mgc-primary);
    font-size: 30px;
    font-weight: 950;
    line-height: 1.25;
    letter-spacing: 0;
}

.mgc-result-main span {
    color: var(--mgc-muted);
    font-size: 12px;
}

.mgc-result-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 10px;
}

.mgc-result-item {
    min-width: 0;
    padding: 7px 6px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.85);
}

.mgc-result-item small {
    display: block;
    margin-bottom: 2px;
    color: var(--mgc-muted);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.6;
}

.mgc-result-item b {
    display: block;
    color: var(--mgc-text);
    font-size: 12px;
    font-weight: 850;
    line-height: 1.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mgc-fields {
    display: grid;
    gap: 9px;
}

.mgc-field {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    margin: 0;
}

.mgc-field > span {
    color: #555555;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.45;
}

.mgc-input-wrap {
    position: relative;
}

.mgc-input {
    width: 100%;
    height: 42px;
    margin: 0;
    padding: 0 12px 0 64px;
    color: var(--mgc-text);
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 10px;
    outline: none;
    box-shadow: none;
    font-size: 15px;
    font-weight: 800;
    text-align: right;
    direction: rtl;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.mgc-input:hover {
    border-color: rgba(176, 0, 75, 0.35);
}

.mgc-input:focus {
    border-color: var(--mgc-primary);
    box-shadow: 0 0 0 3px rgba(176, 0, 75, 0.10);
    background: #ffffff;
}

.mgc-input-wrap em {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    color: var(--mgc-muted);
    font-size: 11px;
    font-style: normal;
    line-height: 1;
    pointer-events: none;
}

.mgc-note {
    margin-top: 10px;
    padding: 8px 10px;
    color: #666666;
    background: rgba(176, 0, 75, 0.06);
    border: 1px solid rgba(176, 0, 75, 0.08);
    border-radius: 11px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.35;
}

.mgc-note strong {
    color: var(--mgc-primary-dark);
    font-weight: 850;
}

.mgc-is-updated .mgc-total-weight {
    animation: mgcPulse 0.28s ease;
}

@keyframes mgcPulse {
    0% {
        transform: scale(1);
        opacity: 0.75;
    }

    50% {
        transform: scale(1.035);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 520px) {
    .mgc-calculator {
        max-width: 100%;
    }

    .mgc-card {
        padding: 14px;
        border-radius: 16px;
    }

    .mgc-header {
        gap: 8px;
        margin-bottom: 10px;
    }

    .mgc-title {
        font-size: 18px;
    }

    .mgc-subtitle {
        font-size: 11px;
    }

    .mgc-total-weight {
        font-size: 27px;
    }

    .mgc-result-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
    }

    .mgc-result-item {
        padding: 6px 4px;
    }

    .mgc-result-item small {
        font-size: 9px;
    }

    .mgc-result-item b {
        font-size: 11px;
    }

    .mgc-field {
        grid-template-columns: 86px minmax(0, 1fr);
        gap: 7px;
    }

    .mgc-field > span {
        font-size: 12px;
    }

    .mgc-input {
        height: 40px;
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    .mgc-card {
        padding: 12px;
    }

    .mgc-field {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .mgc-result-item b {
        white-space: normal;
    }
}
