/* ═══════════════════════════════════════════════════════════════
   Muscle Finder – Shared Styles
   ═══════════════════════════════════════════════════════════════ */

/* ─── Wrapper ─── */
.mf-wrapper {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    margin: 0 auto;
    padding: 0;
    direction: rtl;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

/* ─── Fixed Header ─── */
.mf-wrapper #mf-fixed-header {
    position: relative;
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    z-index: 10;
    flex-shrink: 0;
}
.mf-wrapper .mf-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 60px;
    gap: 12px;
}
.mf-wrapper #mf-step-counter {
    font-size: 14px;
    font-weight: 300;
    color: #64748b;
    min-width: 50px;
    text-align: center;
    direction: ltr;
}
.mf-wrapper #mf-current-step, .mf-wrapper #mf-total-steps {
    font-weight: 600;
    color: #0f766e;
}
.mf-wrapper #mf-logo {
    margin: 0;
    flex: 1;
    text-align: center;
    font-family: 'BordeauxBlack', 'Arial Black', sans-serif;
    font-size: 24px;
    color: #0f766e;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.3s;
}
.mf-wrapper #mf-logo:hover { color: #0d6761; }
.mf-wrapper #mf-back-button {
    background: none;
    border: none;
    font-size: 30px;
    color: #0f766e;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: transform 0.2s;
}
.mf-wrapper #mf-back-button:hover { transform: scale(1.1); color: #0d6761; }

/* ─── Progress Bar ─── */
.mf-wrapper #mf-progress-bar-container {
    width: calc(100% - 40px);
    max-width: 460px;
    height: 4px;
    margin: 0 auto;
    background-color: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}
.mf-wrapper #mf-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #0ea5a4, #14b8a6);
    border-radius: 3px;
    transition: width 0.35s ease;
}

/* ─── Container ─── */
.mf-wrapper .mf-container {
    background: #ffffff;
    padding: 24px 20px;
    flex: 1;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 90px;
    overscroll-behavior-y: contain;
}

/* ─── Step Card ─── */
.mf-wrapper .mf-step-card {
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 24px 20px;
    text-align: center;
    margin-bottom: 16px;
}
.mf-wrapper .mf-step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    padding: 6px 14px;
    background: #dff7f4;
    color: #0f766e;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}
.mf-wrapper .mf-step-title {
    margin: 0 0 10px;
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
}
.mf-wrapper .mf-step-desc {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 2;
    color: #64748b;
}
.mf-disclaimer {
    margin: 0 0 16px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.7;
    color: #64748b;
    text-align: justify;
}
/* ─── Muscle list (collapsible + search) ─── */
.mf-muscle-list-wrap {
    margin-top: 16px;
    text-align: right;
}

.mf-list-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #0f766e;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.mf-list-toggle:hover {
    border-color: #99f6e4;
    background: #f0fdfa;
}

.mf-list-toggle[aria-expanded="true"] {
    border-color: #0f766e;
    background: #f0fdfa;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.mf-list-toggle.has-selection {
    border-color: #99f6e4;
    background: #f0fdfa;
}

.mf-list-toggle-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-align: right;
    min-width: 0;
}

.mf-list-toggle-label {
    font-size: 14px;
    font-weight: 700;
    color: inherit;
}

.mf-list-toggle-sub {
    font-size: 12px;
    font-weight: 600;
    color: #0f766e;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mf-list-toggle-sub[hidden] {
    display: none !important;
}

.mf-list-toggle-arrow {
    flex-shrink: 0;
    transition: transform 0.25s ease;
    color: #94a3b8;
}

.mf-list-toggle[aria-expanded="true"] .mf-list-toggle-arrow {
    transform: rotate(180deg);
    color: #0f766e;
}

.mf-list-panel {
    border: 1.5px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    background: #fff;
    padding: 12px;
}

.mf-list-panel[hidden] {
    display: none !important;
}

.mf-list-search-wrap {
    margin-bottom: 10px;
}

.mf-list-search {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #334155;
    background: #f8fafc;
    direction: rtl;
}

.mf-list-search:focus {
    outline: none;
    border-color: #0f766e;
    background: #fff;
}

.mf-muscle-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-left: 2px;
}

.mf-muscle-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-align: right;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mf-muscle-list-item:hover {
    border-color: #99f6e4;
    background: #f0fdfa;
}

.mf-muscle-list-item.is-selected {
    border-color: #0f766e;
    background: #f0fdfa;
    color: #0f766e;
    box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.15);
}

.mf-muscle-list-item.is-hidden {
    display: none;
}

.mf-muscle-list-num {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #0f766e;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.mf-muscle-list-item.is-selected .mf-muscle-list-num {
    background: #14b8a6;
}

.mf-muscle-list-empty {
    margin: 0 0 8px;
    padding: 10px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
}

/* وقتی مدل ۳بعدی در دسترس نیست — لیست اجباری و برجسته */
.mf-muscle-list-wrap.mf-list-emphasis .mf-list-toggle {
    border-color: #0f766e;
    background: #f0fdfa;
}

.mf-muscle-list-wrap.mf-list-emphasis .mf-list-panel {
    border-color: #0f766e;
    background: #f0fdfa;
}

.mf-muscle-list-wrap.mf-list-emphasis {
    padding: 0;
    border: none;
    background: transparent;
}

/* ─── Muscle Info Bar (step 2 top) ─── */
.mf-muscle-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0fdfa, #ccfbf1);
    border: 1px solid #99f6e4;
    border-radius: 14px;
    margin-bottom: 20px;
}
.mf-muscle-info-text {
    font-size: 14px;
    font-weight: 600;
    color: #0f766e;
}
.mf-muscle-info-change {
    background: none;
    border: 1px solid #0f766e;
    color: #0f766e;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
}
.mf-muscle-info-change:hover {
    background: #0f766e;
    color: #fff;
}

/* ─── Next Button ─── */
.mf-wrapper #mf-next-button-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    background: #ffffff;
    padding: 14px 20px;
    text-align: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
    z-index: 100;
    box-sizing: border-box;
}
.mf-wrapper .mf-next-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(90deg, #0f766e, #14b8a6);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(15,118,110,0.25);
}
.mf-wrapper .mf-next-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(15,118,110,0.35); }
.mf-wrapper .mf-next-btn:active:not(:disabled) { transform: translateY(0); }
.mf-wrapper .mf-next-btn:disabled { opacity: 0.4; cursor: not-allowed; background: #94a3b8; box-shadow: none; }

/* دکمه مرحله ۲/۳ وقتی فرم ناقص است — قابل کلیک ولی کم‌رنگ */
.mf-wrapper .mf-next-btn.mf-btn-incomplete {
    opacity: 0.55;
    background: #94a3b8;
    box-shadow: none;
    cursor: pointer;
}

.mf-wrapper .mf-next-btn.mf-btn-incomplete:hover {
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.mf-wrapper .mf-next-btn.mf-btn-incomplete:active {
    transform: scale(0.98);
}
/* ═══════════════════════════════════════════════════════════════
   Step 1 – 3D Viewer
   ═══════════════════════════════════════════════════════════════ */

.mf-wrapper .mf-3d-viewer canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.mf-wrapper .mf-3d-viewer {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    width: 100%;
    height: 420px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(165deg, #eef2f7 0%, #e2e8f0 45%, #dbe4ee 100%);
    box-shadow: inset 0 0 40px rgba(15, 23, 42, 0.04);
    border: 1px solid #e2e8f0;
}
.mf-wrapper .mf-3d-loading {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: rgba(226,232,240,0.95); z-index: 10; transition: opacity 0.5s;
}
.mf-wrapper .mf-3d-loading.hidden { opacity: 0; pointer-events: none; }
.mf-wrapper .mf-3d-loading p,
.mf-wrapper .mf-3d-loading #mf-load-status {
    color: #64748b;
    font-size: 0.85rem;
    margin-top: 12px;
    text-align: center;
    padding: 0 16px;
    line-height: 1.7;
}
/* نوار پیشرفت لود مدل (جدا از #mf-progress-bar مراحل) */
.mf-wrapper .mf-load-progress {
    width: min(220px, 70%);
    height: 10px;
    margin-top: 14px;
    background: #cbd5e1;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #94a3b8;
}
.mf-wrapper .mf-load-progress[hidden] {
    display: none !important;
}
.mf-wrapper .mf-load-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0f766e, #14b8a6);
    border-radius: 999px;
    transition: width 0.25s linear;
}

.mf-loader-ring { display: inline-block; position: relative; width: 40px; height: 40px; }
.mf-loader-ring div { box-sizing: border-box; display: block; position: absolute; width: 32px; height: 32px; margin: 4px; border: 3px solid transparent; border-radius: 50%; animation: mfLoaderSpin 1.2s cubic-bezier(0.5,0,0.5,1) infinite; border-top-color: #0f766e; }
.mf-loader-ring div:nth-child(1) { animation-delay: -0.45s; }
.mf-loader-ring div:nth-child(2) { animation-delay: -0.3s; }
.mf-loader-ring div:nth-child(3) { animation-delay: -0.15s; }
@keyframes mfLoaderSpin { to { transform: rotate(360deg); } }

/* ─── Hints ─── */
.mf-wrapper .mf-3d-hint { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; font-size: 0.72rem; color: #64748b; background: rgba(255,255,255,0.9); padding: 5px 12px; border-radius: 16px; pointer-events: none; white-space: nowrap; z-index: 5; max-width: calc(100% - 24px); }
.mf-wrapper .mf-3d-hint > span { pointer-events: none; }
.mf-wrapper .mf-hint-status {
    color: #0f766e;
    font-weight: 700;
}
.mf-wrapper .mf-hint-status[hidden] { display: none !important; }
/* وقتی status پویا هست، راهنمای ثابت را مخفی کن تا شلوغ نشود */
.mf-wrapper .mf-3d-hint.has-status .mf-hint-base { display: none; }
.mf-wrapper .mf-fullscreen-btn { pointer-events: all; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: none; background: rgba(0,0,0,0.06); border-radius: 6px; cursor: pointer; color: #64748b; transition: all 0.2s; flex-shrink: 0; }
.mf-wrapper .mf-fullscreen-btn:hover { background: rgba(0,0,0,0.12); color: #334155; }
.mf-hint-mobile { display: none; }

/* ─── Marker Label ─── */
.mf-wrapper .mf-marker-label { position: absolute; pointer-events: none; background: linear-gradient(135deg, #0f766e, #14b8a6); color: #fff; padding: 5px 12px; border-radius: 8px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -20px; box-shadow: 0 4px 12px rgba(15,118,110,0.3); opacity: 0; transition: opacity 0.3s; z-index: 20; font-family: inherit; direction: rtl; }
.mf-wrapper .mf-marker-label.visible { opacity: 1; }
.mf-wrapper .mf-marker-label::after { content: ''; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 4px solid #14b8a6; }

/* ─── Side Hint ─── */
.mf-wrapper .mf-side-hint { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 5px; background: rgba(15,23,42,0.85); color: #f8fafc; padding: 6px 14px; border-radius: 8px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; opacity: 0; transition: opacity 0.4s, transform 0.4s; transform: translateX(-50%) translateY(-4px); z-index: 20; pointer-events: none; font-family: inherit; direction: rtl; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.mf-wrapper .mf-side-hint.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Muscle Nav ─── */
.mf-wrapper .mf-3d-viewer { position: relative; }
.mf-wrapper .mf-muscle-nav {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 3px;
    background: rgba(30, 41, 59, 0.10);
    border-radius: 10px;
    z-index: 15;
}
.mf-wrapper .mf-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.mf-wrapper .mf-nav-btn:hover { background: rgba(30, 41, 59, 0.08); }
.mf-wrapper .mf-nav-btn:active { transform: scale(0.9); background: rgba(30, 41, 59, 0.12); }
.mf-wrapper .mf-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.mf-wrapper .mf-muscle-display {
    flex: 1;
    text-align: center;
    padding: 2px 4px;
    min-height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mf-wrapper .mf-muscle-display-text {
    font-weight: 700;
    font-size: 0.78rem;
    color: #1e293b;
    white-space: nowrap;
}
.mf-wrapper .mf-muscle-display-text.empty {
    color: #0f172a;
    font-weight: 500;
    font-size: 0.72rem;
}

/* ─── Front / Back: زیر mf-muscle-nav، هم‌تراز چپ/راست و هم‌تم ─── */
.mf-wrapper .mf-view-side-btn {
    position: absolute;
    top: 46px; /* 12px nav top + ~28px nav height + 6px gap */
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 28px;
    padding: 3px 12px;
    border: none;
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.10);
    color: #1e293b;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}
/* جلو: زیر nav، راست‌چین هم‌تراز لبه راست nav (right: 12px) */
.mf-wrapper .mf-view-side-front {
    right: 12px;
    left: auto;
}
/* پشت: زیر nav، چپ‌چین هم‌تراز لبه چپ nav (left: 12px) */
.mf-wrapper .mf-view-side-back {
    left: 12px;
    right: auto;
}
.mf-wrapper .mf-view-side-btn:hover {
    background: rgba(30, 41, 59, 0.16);
}
.mf-wrapper .mf-view-side-btn:active {
    transform: scale(0.96);
    background: rgba(30, 41, 59, 0.18);
}
.mf-wrapper .mf-view-side-btn.is-active {
    background: rgba(15, 118, 110, 0.22);
    color: #0f766e;
}
.mf-wrapper .mf-view-side-btn:focus-visible {
    outline: 2px solid #0f766e;
    outline-offset: 2px;
}
.mf-wrapper .mf-3d-viewer.mf-fullscreen .mf-view-side-btn {
    top: 52px;
}
.mf-wrapper .mf-3d-viewer.mf-fullscreen .mf-view-side-front {
    right: 12px;
}
.mf-wrapper .mf-3d-viewer.mf-fullscreen .mf-view-side-back {
    left: 12px;
}

/* ─── Fullscreen ─── */
.mf-wrapper .mf-3d-viewer.mf-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0;
    z-index: 9999;
    border: none;
}
.mf-wrapper .mf-3d-viewer.mf-fullscreen canvas {
    width: 100% !important;
    height: 100% !important;
}


/* ─── Step1 polish (g1) ─── */
.mf-wrapper .mf-marker-label.visible {
    animation: mfLabelPop 0.35s ease;
}
@keyframes mfLabelPop {
    0%   { opacity: 0; transform: translate(-50%, -90%) scale(0.92); }
    100% { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}
.mf-wrapper .mf-muscle-display-text:not(.empty) {
    color: #0f766e;
}
.mf-wrapper .mf-next-btn.mf-next-ready:not(:disabled) {
    animation: mfCtaPulse 1.8s ease-in-out 1;
    box-shadow: 0 4px 16px rgba(15, 118, 110, 0.4);
}
@keyframes mfCtaPulse {
    0%, 100% { transform: scale(1); }
    40%      { transform: scale(1.02); }
    70%      { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .mf-wrapper .mf-marker-label.visible,
    .mf-wrapper .mf-next-btn.mf-next-ready:not(:disabled) {
        animation: none;
    }
}


/* ═══════════════════════════════════════════════════════════════
   Step 2 – Pain Details Form
   ═══════════════════════════════════════════════════════════════ */
.mf-form-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin-bottom: 14px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.mf-form-section.mf-section-active {
    box-shadow: 0 2px 12px rgba(15,118,110,0.08);
}
.mf-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.mf-section-header:hover {
    background: #f8fafc;
}
.mf-section-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mf-section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.mf-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}
.mf-section-arrow {
    transition: transform 0.3s;
    color: #94a3b8;
}
.mf-form-section.mf-section-active .mf-section-arrow {
    transform: rotate(180deg);
}
.mf-section-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
    padding: 0 16px;
}
.mf-form-section.mf-section-active .mf-section-body {
    max-height: 2000px;
    padding: 0 16px 18px;
}
.mf-radio-group.mf-radio-yesno {
    grid-template-columns: repeat(2, 1fr);
}

/* ─── Form Fields ─── */
.mf-field {
    margin-bottom: 16px;
}
.mf-field:last-child {
    margin-bottom: 0;
}
.mf-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}
.mf-field-hint {
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
    margin-right: 4px;
}

/* Radio Group */
.mf-radio-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.mf-radio-pill {
    position: relative;
}
.mf-radio-pill input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.mf-radio-pill label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 6px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    text-align: center;
    min-height: 42px;
}
.mf-radio-pill label:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}
.mf-radio-pill input:checked + label {
    border-color: #0f766e;
    background: #f0fdfa;
    color: #0f766e;
    font-weight: 600;
}

/* ─── Checkbox Group (multi-select) ─── */
.mf-checkbox-group .mf-radio-pill input:checked + label {
    border-color: #00857a;
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    color: #00857a;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,133,122,0.15);
}
.mf-checkbox-group .mf-radio-pill label::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid #cbd5e1;
    background: #fff;
    transition: all 0.2s;
    opacity: 0;
}
.mf-checkbox-group .mf-radio-pill input:checked + label::after {
    content: '✓';
    background: #00857a;
    border-color: #00857a;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}
.mf-radio-pill label .mf-radio-emoji {
    font-size: 15px;
}

/* ─── Severity Slider ─── */
.mf-slider-wrap {
    padding: 4px 0;
}
.mf-slider-value {
    text-align: center;
    font-size: 32px;
    font-weight: 800;
    color: #94a3b8;
    line-height: 1.2;
    margin-bottom: 12px;
    transition: color 0.3s;
    font-variant-numeric: tabular-nums;
    direction: ltr;
}
.mf-slider-value.mf-val-low { color: #16a34a; }
.mf-slider-value.mf-val-med { color: #d97706; }
.mf-slider-value.mf-val-high { color: #dc2626; }

.mf-slider-track-wrap {
    position: relative;
    height: 36px;
    display: flex;
    align-items: center;
}
.mf-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    /* سبز (کم) → قرمز (زیاد) — مقیاس رایج درد */
    background: linear-gradient(90deg, #22c55e 0%, #84cc16 25%, #eab308 50%, #f97316 75%, #dc2626 100%);
    outline: none;
    position: relative;
    z-index: 2;
    cursor: pointer;
}
.mf-slider.mf-slider-untouched {
    opacity: 0.75;
}
.mf-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #0f766e;
    box-shadow: 0 2px 8px rgba(15,118,110,0.25);
    cursor: grab;
    transition: box-shadow 0.2s, transform 0.15s;
    position: relative;
    z-index: 3;
}
.mf-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 3px 14px rgba(15,118,110,0.35);
    transform: scale(1.1);
}
.mf-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.15);
    box-shadow: 0 4px 18px rgba(15,118,110,0.4);
}
.mf-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #0f766e;
    box-shadow: 0 2px 8px rgba(15,118,110,0.25);
    cursor: grab;
    transition: box-shadow 0.2s, transform 0.15s;
}
.mf-slider::-moz-range-thumb:hover {
    box-shadow: 0 3px 14px rgba(15,118,110,0.35);
}
.mf-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: #94a3b8;
}

/* Select */
.mf-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #334155;
    background: #fff;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    cursor: pointer;
    transition: border-color 0.2s;
}
.mf-select:focus {
    outline: none;
    border-color: #0f766e;
}

/* ─── Scroll Wheel Picker ─── */
.mf-wheel-picker {
    position: relative;
    width: 100%;
    height: 180px;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    direction: ltr;
}
.mf-wheel-picker::before,
.mf-wheel-picker::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 70px;
    z-index: 3;
    pointer-events: none;
}
.mf-wheel-picker::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.95) 0%, transparent);
}
.mf-wheel-picker::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(255,255,255,0.95) 0%, transparent);
}
.mf-wheel-highlight {
    position: absolute;
    top: 50%;
    left: 12px;
    right: 12px;
    height: 40px;
    transform: translateY(-50%);
    border-radius: 12px;
    background: linear-gradient(135deg, #f0fdfa, #e6faf7);
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(15,118,110,0.08), 0 2px 8px rgba(15,118,110,0.06);
}
.mf-wheel-scroll {
    position: relative;
    z-index: 2;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.mf-wheel-scroll::-webkit-scrollbar {
    display: none;
}
.mf-wheel-item {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #94a3b8;
    transition: color 0.2s, transform 0.2s, font-weight 0.2s;
    cursor: pointer;
    user-select: none;
    direction: rtl;
    unicode-bidi: embed;
}
.mf-wheel-item.mf-wheel-active {
    color: #0f766e;
    font-weight: 700;
    font-size: 18px;
}
.mf-wheel-item:not(.mf-wheel-active) {
    transform: scale(0.88);
    opacity: 0.7;
    color: #64748b;
}
.mf-wheel-spacer {
    height: 70px;
    scroll-snap-align: none;
    pointer-events: none;
}

/* Textarea */
.mf-textarea {
    width: 90%;
    margin: 0 auto;
    display: block;
    padding: 14px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #334155;
    background: #fff;
    resize: vertical;
    min-height: 70px;
    line-height: 1.8;
    transition: border-color 0.2s;
}
.mf-textarea:focus {
    outline: none;
    border-color: #0f766e;
}
.mf-textarea::placeholder {
    color: #94a3b8;
}

/* ─── Validation Error ─── */
.mf-validation-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 600;
    color: #991b1b;
    line-height: 1.8;
}

/* ─── Warning Box (step 2) ─── */
.mf-risk-warning {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    display: none;
}
.mf-risk-warning.mf-visible {
    display: block;
}
.mf-risk-warning-title {
    font-size: 14px;
    font-weight: 700;
    color: #dc2626;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mf-risk-warning-text {
    font-size: 13px;
    color: #7f1d1d;
    line-height: 1.8;
}
.mf-risk-actions {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}
.mf-risk-soft-actions {
    margin-top: 14px;
}
.mf-risk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all 0.2s;
}
.mf-risk-btn-primary {
    background: linear-gradient(90deg, #0f766e, #14b8a6);
    color: #fff;
}
.mf-risk-btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.mf-risk-btn-secondary {
    background: #fff;
    color: #0f766e;
    border: 1.5px solid #0f766e;
}
.mf-risk-ack {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.7;
    color: #7f1d1d;
    margin-bottom: 12px;
    cursor: pointer;
}
.mf-risk-ack input {
    margin-top: 4px;
    flex-shrink: 0;
}

/* ─── Result (step 3 placeholder) ─── */
.mf-result-exercise {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}
.mf-result-exercise h3 {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}
.mf-result-exercise h4 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: #0f766e;
}
.mf-result-exercise p {
    margin: 0 0 8px;
    font-size: 13px;
    color: #475569;
    line-height: 1.8;
}
.mf-exercise-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.mf-exercise-meta span {
    font-size: 12px;
    color: #64748b;
    background: #f1f5f9;
    padding: 3px 10px;
    border-radius: 6px;
}
.mf-result-warning {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #7f1d1d;
    line-height: 1.8;
}

/* ─── Loading Overlay ─── */
.mf-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.92);
    z-index: 9999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.mf-loading-overlay.mf-visible {
    display: flex;
}
.mf-loading-overlay p {
    font-size: 15px;
    font-weight: 600;
    color: #0f766e;
}

/* ═══════════════════════════════════════════════════════════════
   Step 4 – Protocol Card
   ═══════════════════════════════════════════════════════════════ */
.mf-protocol-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 16px;
}
.mf-protocol-loading {
    padding: 48px 20px;
    text-align: center;
}
.mf-protocol-loading p {
    color: #64748b;
    font-size: 14px;
    margin-top: 12px;
}

/* Protocol Header */
.mf-protocol-header {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #fff;
    padding: 20px;
    text-align: center;
}
.mf-protocol-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 10px;
}
.mf-protocol-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 14px;
    font-size: 13px;
    opacity: 0.9;
}
.mf-protocol-meta strong {
    font-weight: 700;
}

/* Protocol Sections */
.mf-protocol-section {
    padding: 18px 20px;
    border-bottom: 1px solid #f1f5f9;
}
.mf-protocol-section:last-child {
    border-bottom: none;
}
.mf-protocol-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
}

/* Exercise Card */
.mf-protocol-exercise {
    display: flex;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
}
.mf-protocol-exercise:last-child { margin-bottom: 0; }
.mf-exercise-num {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mf-exercise-body { flex: 1; }
.mf-exercise-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}
.mf-exercise-desc {
    font-size: 13px;
    color: #475569;
    line-height: 1.8;
    margin-bottom: 8px;
}
.mf-exercise-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.mf-exercise-meta span {
    font-size: 11px;
    font-weight: 500;
    color: #0f766e;
    background: #f0fdfa;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid #ccfbf1;
}
.mf-exercise-meta .mf-meta-note {
    color: #92400e;
    background: #fffbeb;
    border-color: #fde68a;
}

/* GIF wrapper for exercise images */
.mf-gif-wrap {
    margin-bottom: 12px;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    text-align: center;
}
.mf-gif-wrap img {
    display: block;
    width: 100%;
    max-width: 320px;
    height: auto;
    margin: 0 auto;
    border-radius: 10px;
}
.mf-gif-wrap.mf-gif-missing {
    display: none;
}

/* Lists (avoid / lifestyle) */
.mf-protocol-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.mf-protocol-list li {
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.8;
    color: #475569;
}
.mf-protocol-list li:last-child { margin-bottom: 0; }
.mf-protocol-list.mf-avoid li {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}
.mf-protocol-list.mf-lifestyle li {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* Followup */
.mf-protocol-followup {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 14px;
    font-size: 13px;
    line-height: 1.8;
    color: #1e40af;
}

/* Warning */
.mf-protocol-warning {
    margin: 0 20px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 14px;
    font-size: 13px;
    color: #991b1b;
    line-height: 1.8;
}

/* ─── Share Bar ─── */
.mf-share-bar {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}
.mf-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    color: #475569;
}
.mf-share-btn:hover {
    border-color: #94a3b8;
    background: #f8fafc;
    transform: translateY(-1px);
}
.mf-share-whatsapp { color: #25d366; border-color: #bbf7d0; }
.mf-share-whatsapp:hover { background: #f0fdf4; }
.mf-share-email { color: #0f766e; border-color: #99f6e4; }
.mf-share-email:hover { background: #f0fdfa; }
.mf-share-print { color: #64748b; }
.mf-share-print:hover { color: #334155; }

/* ─── Print Styles ─── */
@media print {
    .mf-wrapper #mf-fixed-header,
    .mf-wrapper #mf-next-button-container,
    .mf-share-bar,
    .mf-muscle-info-change,
    .mf-wrapper #mf-back-button { display: none !important; }
    .mf-wrapper { max-width: 100%; height: auto; overflow: visible; }
    .mf-wrapper .mf-container { overflow: visible; padding-bottom: 0; }
    .mf-protocol-card { border: none; box-shadow: none; }
    .mf-protocol-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ─── Mobile Responsive ─── */
@media (max-width: 540px) {
    .mf-wrapper { max-width: 100%; }
    .mf-wrapper .mf-3d-viewer { height: 480px; }
    .mf-hint-desktop { display: none; }
    .mf-hint-mobile { display: inline; }
    .mf-slider-value { font-size: 28px; }
}

/* قفل اسکرول وقتی viewer تمام‌صفحه است */
html.mf-fs-open,
body.mf-fs-open {
    overflow: hidden !important;
    height: 100% !important;
    touch-action: none;
}

body.mf-fs-open {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
}

/* حالت خروج روی دکمه پایین */
.mf-wrapper .mf-fullscreen-btn.is-exit {
    background: rgba(15, 118, 110, 0.15);
    color: #0f766e;
}

.mf-wrapper .mf-3d-viewer.mf-fullscreen .mf-fullscreen-btn.is-exit {
    background: rgba(15, 118, 110, 0.25);
    color: #0f766e;
}