/* =========================================================
   page_02_journey_map.css
   نقشه بازی‌وارِ مسیر پاکسازی («منچ تسکین») — صفحه page_02.
   کاشی‌های مارپیچ + مهره کاربر + مودال تمام‌صفحه.
   پالت: بنفش #4f3d8d · فیروزه‌ای #2bb8c4 · طلایی #d7b275
   ========================================================= */

/* ===== دکمه باز کردنِ نقشه (در بدنه صفحه) ===== */
.ip-map-cta {
    display: flex;
    justify-content: center;
    margin-top: clamp(6px, 1.4vh, 14px);
}

.ip-map-btn {
    --ip-primary: #4f3d8d;
    --ip-accent: #2bb8c4;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: clamp(12px, 2vh, 16px) clamp(22px, 4vw, 34px);
    border: 1px solid rgba(215, 178, 117, 0.85);
    border-radius: var(--app-radius-pill, 999px);
    background: linear-gradient(135deg, rgba(79, 61, 141, 0.96), rgba(43, 184, 196, 0.92));
    color: #fff;
    font-size: clamp(1.125rem, 1.8vw, 1.25rem); /* +۱.۵ پوینت */
    font-weight: 700;
    line-height: 1.6;
    text-decoration: none;
    cursor: pointer;
    box-shadow:
        0 10px 26px rgba(79, 61, 141, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    overflow: hidden;
}

.ip-map-btn::after {
    /* خطِ درخششِ گذری */
    content: "";
    position: absolute;
    inset: 0 auto 0 -60%;
    width: 45%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-18deg);
    animation: ip-map-shine 3.6s ease-in-out infinite;
}

@keyframes ip-map-shine {
    0%, 55%  { left: -60%; }
    100%     { left: 130%; }
}

.ip-map-btn:hover,
.ip-map-btn:focus-visible {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 14px 32px rgba(79, 61, 141, 0.45);
    color: #fff;
}

.ip-map-btn .bi {
    font-size: 1.25em;
}

.ip-map-btn .ip-map-btn-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 0.86em; /* +۱ پوینت */
    font-weight: 600;
}

/* ===== مودالِ نقشه ===== */
/* ★ z-index بالا (ایراد ۱): بالاتر از نوبارِ absolute و مگامنو */
.jm-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2.5vh, 28px);
    background: rgba(31, 41, 55, 0.55);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.jm-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.jm-modal[hidden] {
    display: none;
}

.jm-panel {
    position: relative;
    width: min(920px, 100%);
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    border-radius: clamp(16px, 2.5vw, 26px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.4);
    overflow: hidden;
    transform: translateY(18px) scale(0.97);
    transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.jm-modal.is-open .jm-panel {
    transform: translateY(0) scale(1);
}

/* هدرِ مودال — گرادیانِ برند + ذراتِ شناور */
.jm-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: clamp(14px, 2.4vh, 20px) clamp(16px, 3vw, 26px);
    background: linear-gradient(120deg, #4f3d8d 0%, #3d7d9e 55%, #2bb8c4 100%);
    color: #fff;
    overflow: hidden;
    flex: 0 0 auto;
}

.jm-head::before,
.jm-head::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    filter: blur(2px);
    animation: jm-float 7s ease-in-out infinite;
    pointer-events: none;
}

.jm-head::before { width: 90px; height: 90px; top: -34px; left: 8%; }
.jm-head::after  { width: 56px; height: 56px; bottom: -22px; left: 42%; animation-delay: 2.2s; }

@keyframes jm-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(10px); }
}

.jm-head-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 1.4rem;
}

.jm-head-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.jm-head-title {
    margin: 0;
    font-size: clamp(1.2rem, 2.3vw, 1.45rem); /* +۱.۵ پوینت */
    font-weight: 800;
    line-height: 1.5;
}

.jm-head-sub {
    font-size: clamp(0.95rem, 1.6vw, 1.05rem); /* +۱ پوینت */
    opacity: 0.92;
    line-height: 1.6;
}

.jm-close {
    margin-inline-start: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.25rem; /* +۱ پوینت */
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.jm-close:hover { background: rgba(255, 255, 255, 0.32); transform: rotate(90deg); }

/* بدنه مودال — پس‌زمینه کاغذِ ابری */
.jm-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: clamp(14px, 2.6vh, 24px) clamp(12px, 2.6vw, 26px) clamp(18px, 3vh, 28px);
    background:
        linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
        url("../image/paper/cloud_paper_tile.1e2a3175e9f9.webp") repeat center / 420px;
}

/* ===== نوارِ وضعیت ===== */
.jm-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 10px;
    margin-bottom: clamp(14px, 2.6vh, 22px);
}

.jm-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(79, 61, 141, 0.18);
    color: #374151;
    font-size: clamp(0.85rem, 1.45vw, 0.95rem); /* +۱ پوینت */
    font-weight: 500;
    line-height: 1.7;
    box-shadow: 0 4px 12px rgba(31, 41, 55, 0.06);
}

.jm-status-pill strong { color: #4f3d8d; font-weight: 700; }

.jm-status-now {
    border-color: rgba(215, 178, 117, 0.8);
    background: linear-gradient(135deg, rgba(215, 178, 117, 0.2), rgba(255, 255, 255, 0.9));
}

.jm-status-now .bi { color: #8a6339; }

.jm-status-rules { border-style: dashed; }

/* ===== ردیف‌های مارپیچ ===== */
.jm-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 780px;
    margin: 0 auto;
}

.jm-rowline {
    display: flex;
    flex-direction: column;
}

.jm-row {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(10px, 1.8vw, 18px);
    padding: 6px 4px;
}

.jm-row-rev {
    flex-direction: row-reverse;
}

.jm-row-single {
    justify-content: center;
}

.jm-row-single .jm-tile {
    flex: 0 1 560px;
}

/* اتصالِ U شکل بین ردیف‌ها */
.jm-turn {
    width: min(36%, 150px);
    height: 20px;
    margin: 0 10% 4px;
    border: 3px dashed rgba(43, 184, 196, 0.55);
    border-top: none;
    border-radius: 0 0 46px 46px;
    align-self: center;
    opacity: 0.85;
}

.jm-turn-l { margin-right: auto; margin-left: 12%; }
.jm-turn-r { margin-left: auto; margin-right: 12%; }

/* ===== کاشی‌ها ===== */
.jm-tile {
    position: relative;
    flex: 1 1 30%;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: clamp(14px, 2vh, 20px) clamp(10px, 1.4vw, 14px) clamp(16px, 2.2vh, 20px);
    border-radius: clamp(14px, 2vw, 20px);
    background: rgba(255, 255, 255, 0.82);
    border: 1.5px solid rgba(43, 184, 196, 0.25);
    box-shadow: 0 8px 20px rgba(31, 41, 55, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.jm-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 26px rgba(31, 41, 55, 0.14);
}

/* شماره کاشی — سمتِ راستِ کاشی (ایراد ۷) */
.jm-num {
    position: absolute;
    top: 10px;
    inset-inline-start: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(79, 61, 141, 0.1);
    color: #4f3d8d;
    font-size: 0.9375rem; /* +۱ پوینت */
    font-weight: 800;
}

/* آیکن کاشی */
.jm-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(44px, 5vw, 54px);
    height: clamp(44px, 5vw, 54px);
    margin-top: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(43, 184, 196, 0.16), rgba(79, 61, 141, 0.14));
    border: 1.5px solid rgba(79, 61, 141, 0.22);
    color: #4f3d8d;
    font-size: clamp(1.3125rem, 2.3vw, 1.5625rem); /* +۱ پوینت */
}

.jm-title {
    font-size: clamp(0.9375rem, 1.6vw, 1.1rem); /* +۱ پوینت */
    font-weight: 800;
    color: #1f2937;
    line-height: 1.6;
}

.jm-desc {
    font-size: clamp(0.8rem, 1.35vw, 0.9rem); /* +۱ پوینت */
    color: #4b5563;
    line-height: 1.8;
}

.jm-meta {
    margin-top: auto;
    padding: 3px 11px;
    border-radius: 999px;
    background: rgba(43, 184, 196, 0.12);
    color: #17727b;
    font-size: clamp(0.8rem, 1.3vw, 0.875rem); /* +۱ پوینت */
    font-weight: 700;
    line-height: 1.7;
}

/* ---------- رنگ‌بندیِ گروه‌ها ---------- */
.kind--axis1 {
    border-color: rgba(79, 61, 141, 0.3);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(79, 61, 141, 0.07));
}

.kind--axis1 .jm-icon {
    background: linear-gradient(135deg, rgba(79, 61, 141, 0.18), rgba(43, 184, 196, 0.14));
}

.kind--head {
    border-color: rgba(79, 61, 141, 0.45);
    background: linear-gradient(120deg, rgba(79, 61, 141, 0.14), rgba(43, 184, 196, 0.12)), rgba(255, 255, 255, 0.9);
}

.kind--head .jm-icon {
    background: linear-gradient(135deg, #4f3d8d, #2bb8c4);
    border: none;
    color: #fff;
    box-shadow: 0 8px 18px rgba(79, 61, 141, 0.35);
}

/* ---------- کاشی‌های شروع/پایان ----------
   ★ ایراد ۳: انتخابگرِ دوتایی (.jm-tile.jm-tile-start) تا گرادیانِ رنگی
     همیشه بر پس‌زمینه سفیدِ کلاس‌های state--* غالب بماند و متنِ سفید
     خوانا بماند. حالتِ «فعلی» فقط با قابِ طلایی و تپش نشان داده می‌شود. */
.jm-tile.jm-tile-start,
.jm-tile.jm-tile-finish {
    color: #fff;
    border: none;
}

.jm-tile.jm-tile-start {
    background: linear-gradient(135deg, #2bb8c4, #3d7d9e);
    box-shadow: 0 14px 30px rgba(43, 184, 196, 0.35);
}

.jm-tile.jm-tile-finish {
    background: linear-gradient(135deg, #4f3d8d, #8a6339 130%);
    box-shadow: 0 14px 30px rgba(79, 61, 141, 0.4);
    overflow: hidden;
}

/* شروعِ فعال: حفظِ گرادیان + قابِ طلایی و تپش */
.jm-tile.jm-tile-start.state--current {
    background: linear-gradient(135deg, #2bb8c4, #3d7d9e);
    border: 3px solid rgba(215, 178, 117, 0.95);
    animation: jm-pulse 2.2s ease-out infinite;
}

.jm-tile.jm-tile-start.state--current .jm-title,
.jm-tile.jm-tile-start.state--current .jm-desc { color: #fff; }

.jm-tile.jm-tile-start.state--current .jm-icon,
.jm-tile.jm-tile-finish.state--current .jm-icon {
    background: rgba(255, 255, 255, 0.25);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    color: #fff;
}

.jm-tile-finish::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 -60%;
    width: 45%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.28), transparent);
    transform: skewX(-18deg);
    animation: ip-map-shine 3.2s ease-in-out infinite;
}

.jm-tile-start .jm-num,
.jm-tile-finish .jm-num {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.jm-tile-start .jm-icon,
.jm-tile-finish .jm-icon {
    background: rgba(255, 255, 255, 0.18);
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    color: #fff;
}

.jm-tile-start .jm-title,
.jm-tile-finish .jm-title { color: #fff; }

.jm-tile-start .jm-desc,
.jm-tile-finish .jm-desc { color: rgba(255, 255, 255, 0.88); }

.jm-tile-start .jm-meta,
.jm-tile-finish .jm-meta {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ---------- حالت‌ها ---------- */
.state--done {
    border-color: rgba(16, 185, 129, 0.5);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(16, 185, 129, 0.1));
}

.state--done .jm-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(43, 184, 196, 0.14));
    border-color: rgba(16, 185, 129, 0.4);
    color: #047857;
}

.state--done .jm-meta { background: rgba(16, 185, 129, 0.14); color: #047857; }

.jm-done {
    position: absolute;
    top: 10px;
    inset-inline-end: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #2bb8c4);
    color: #fff;
    font-size: 0.9375rem; /* +۱ پوینت */
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

/* کاشیِ فعلی — طلایی و تپنده */
.state--current {
    border: 2px solid rgba(215, 178, 117, 0.95);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(215, 178, 117, 0.18));
    box-shadow:
        0 0 0 0 rgba(215, 178, 117, 0.55),
        0 14px 30px rgba(138, 99, 57, 0.22);
    animation: jm-pulse 2.2s ease-out infinite;
    transform: translateY(-4px);
    z-index: 3;
}

@keyframes jm-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(215, 178, 117, 0.55), 0 14px 30px rgba(138, 99, 57, 0.22); }
    70%  { box-shadow: 0 0 0 14px rgba(215, 178, 117, 0), 0 14px 30px rgba(138, 99, 57, 0.22); }
    100% { box-shadow: 0 0 0 0 rgba(215, 178, 117, 0), 0 14px 30px rgba(138, 99, 57, 0.22); }
}

.state--current .jm-icon {
    background: linear-gradient(135deg, #d7b275, #8a6339);
    border: none;
    color: #fff;
    box-shadow: 0 8px 18px rgba(138, 99, 57, 0.4);
}

.state--current .jm-meta {
    background: rgba(215, 178, 117, 0.25);
    color: #7a4f22;
}

/* شماره کاشیِ فعلی حذف می‌شود تا با روبان/مهره تداخل نکند */
.state--current .jm-num { display: none; }

/* مهره کاربر (کبوترِ آرامش) — سمتِ چپِ کاشی */
.jm-pawn {
    position: absolute;
    top: -30px;
    left: 16%;
    font-size: 1.7rem; /* +۱ پوینت */
    filter: drop-shadow(0 6px 8px rgba(138, 99, 57, 0.45));
    animation: jm-bob 2.4s ease-in-out infinite;
    z-index: 4;
}

@keyframes jm-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-7px); }
}

/* روبانِ «شما اینجایید» — سمتِ راستِ کاشی */
.jm-here {
    position: absolute;
    top: -13px;
    right: 10%;
    padding: 3px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #8a6339, #b58a4e);
    color: #fff;
    font-size: clamp(0.75rem, 1.15vw, 0.825rem); /* +۱ پوینت */
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 6px 14px rgba(138, 99, 57, 0.4);
    z-index: 5;
}

/* کاشیِ قدمِ بعدی */
.state--next {
    border: 2px dashed rgba(43, 184, 196, 0.75);
    background: rgba(255, 255, 255, 0.92);
}

.state--next .jm-meta {
    background: rgba(43, 184, 196, 0.16);
    color: #17727b;
}

.jm-next-tag {
    position: absolute;
    top: 10px;
    inset-inline-end: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #fff;
    border: 1.5px dashed rgba(43, 184, 196, 0.7);
    color: #17727b;
    font-size: clamp(0.66rem, 1.05vw, 0.74rem);
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(43, 184, 196, 0.18);
    z-index: 5;
}

/* کاشی‌های قفل */
.state--locked {
    opacity: 0.58;
    filter: saturate(0.75);
}

/* ===== راهنما و یادداشتِ تکرار ===== */
.jm-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
    margin-top: clamp(14px, 2.4vh, 20px);
    padding-top: clamp(10px, 2vh, 14px);
    border-top: 1px dashed rgba(79, 61, 141, 0.25);
}

.jm-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #4b5563;
    font-size: clamp(0.825rem, 1.4vw, 0.925rem); /* +۱ پوینت */
    font-weight: 600;
}

/* آیکن‌های راهنما (ایراد ۶: رنگ + آیکون) */
.jm-legend-item .bi {
    font-size: 1.125rem; /* +۱ پوینت */
    flex: 0 0 auto;
}

.jm-li-done    { color: #10b981; }
.jm-li-current { color: #b58a4e; text-shadow: 0 0 0 2px rgba(215, 178, 117, 0.35); }
.jm-li-next    { color: #2bb8c4; }
.jm-li-locked  { color: #6b7280; }

.jm-repeat-note {
    margin: clamp(10px, 2vh, 16px) 0 0;
    text-align: center;
    color: #4f3d8d;
    font-size: clamp(0.85rem, 1.45vw, 0.95rem); /* +۱ پوینت */
    font-weight: 600;
    line-height: 1.9;
}

.jm-repeat-note .bi { color: #2bb8c4; margin-inline-end: 4px; }

/* ===== پاورقیِ مودال ===== */
.jm-foot {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: clamp(10px, 2vh, 14px) clamp(14px, 3vw, 22px);
    border-top: 1px solid rgba(79, 61, 141, 0.12);
    background: rgba(255, 255, 255, 0.75);
}

.jm-foot-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 999px;
    border: none;
    font-size: clamp(0.95rem, 1.6vw, 1.05rem); /* +۱ پوینت */
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.jm-foot-btn:hover { transform: translateY(-2px); }

.jm-foot-primary {
    background: linear-gradient(135deg, #4f3d8d, #2bb8c4);
    color: #fff;
    box-shadow: 0 8px 20px rgba(79, 61, 141, 0.35);
}

.jm-foot-ghost {
    background: rgba(255, 255, 255, 0.9);
    border: 1.5px solid rgba(79, 61, 141, 0.35);
    color: #4f3d8d;
}

/* ===== موبایل ===== */
@media (max-width: 640px) {
    .jm-tile { min-width: 128px; }

    .jm-turn { width: 30%; }

    /* ★ جمله راهنمای کبوتر در موبایل هم نمایش داده می‌شود (قبلاً حذف می‌شد) */
    .jm-head-sub { font-size: 0.78rem; }

    .jm-row { gap: 8px; padding: 4px 0; }

    /* ★ مهره کبوتر داخلِ کاشی می‌نشیند تا در موبایل بریده/پنهان نشود */
    .jm-pawn { top: -6px; left: 10px; font-size: 1.3rem; }

    .jm-here { font-size: 0.65rem; /* +۱ پوینت */ top: -8px; }
}

@media (prefers-reduced-motion: reduce) {
    .jm-pawn, .state--current, .jm-head::before, .jm-head::after,
    .ip-map-btn::after, .jm-tile-finish::before {
        animation: none !important;
    }
}
