/* =========================================================
   Love Feelings Reading
   Layout + Components + States + Dark Theme
   =========================================================
   ساختار:
   1.  قاب کل صفحه (Fullscreen Shell)
   2.  منوی ساندویچی
   3.  ساختار صفحه (Page Layout)
   4.  هدر
   5.  کادر راهنما
   6.  ناحیه اصلی
   7.  فرم
   8.  دکمه
   9.  دسته‌ی اولیه
   10. ناحیه‌ی مراحل (Stage)
   11. پشته‌ی کارت
   12. حالت نیازمند فیلتر
   13. حالت‌های ادغام
   14. کنترل‌های ادغام
   15. کارت نگه‌داشته‌شده
   16. وضعیت
   17. نتایج
   18. کارت نگه‌داشته‌شده در نتایج
   19. آیتم‌های نتیجه
   20. ابزارها
   21. ریسپانسیو (تبلت)
   22. ریسپانسیو (موبایل کوچک)
   23. Reduced Motion
   ========================================================= */

/* =========================================================
   1. Fullscreen Shell
   ========================================================= */

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
}

body.dc-reading-page--love-feelings {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    direction: rtl;
    background-color: #05080f;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

body.dc-reading-page--love-feelings .site-main {
    position: relative;
    width: 100%;
    max-width: calc(100vh * 0.8); /* نسبت ۴:۵ */
    height: 100vh;
    max-height: 100vh;
    aspect-ratio: 4 / 5;
    margin: 0 auto;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;

    background-image: url('../../assets/images/bg/love-feelings-reading-bg.webp');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: #0a0f1d;

    box-shadow: 0 0 80px rgba(0, 0, 0, .9);
    z-index: 1;

    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, .4) transparent;
}

body.dc-reading-page--love-feelings .site-main::-webkit-scrollbar {
    width: 6px;
}
body.dc-reading-page--love-feelings .site-main::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, .4);
    border-radius: 3px;
}

/* =========================================================
   2. Sandwich Menu
   ========================================================= */

.lfr-menu-toggle {
    position: fixed;
    top: 20px;
    right: calc(50% - (100vh * 0.4) + 20px);
    width: 42px;
    height: 42px;
    background: rgba(10, 15, 29, .85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, .5);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    transition: all .3s ease;
}

.lfr-menu-toggle:hover {
    background: rgba(212, 175, 55, .25);
    border-color: #f9e596;
}

.lfr-menu-toggle span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: #f9e596;
    border-radius: 2px;
    transition: all .3s ease;
}

.lfr-menu-toggle.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.lfr-menu-toggle.is-open span:nth-child(2) { opacity: 0; }
.lfr-menu-toggle.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.lfr-menu {
    position: fixed;
    top: 72px;
    right: calc(50% - (100vh * 0.4) + 20px);
    min-width: 200px;
    background: rgba(10, 15, 29, .96);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(212, 175, 55, .4);
    border-radius: 12px;
    padding: 8px 0;
    z-index: 10000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .8);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all .3s ease;
}

.lfr-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lfr-menu a {
    display: block;
    padding: 10px 18px;
    color: #e0e6ed;
    text-decoration: none;
    font-size: 13px;
    transition: all .2s ease;
    border-right: 2px solid transparent;
}

.lfr-menu a:hover {
    background: rgba(212, 175, 55, .1);
    color: #f9e596;
    border-right-color: #d4af37;
}

/* =========================================================
   3. Page Layout
   ========================================================= */

.lfr-page-section {
    width: 100%;
    direction: rtl;
    box-sizing: border-box;
}

.lfr-page-inner {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 16px 0 40px;
    box-sizing: border-box;
}

/* =========================================================
   4. Header
   ========================================================= */

.lfr-header {
    width: 100%;
    text-align: center;
    margin: 0 0 16px;
    padding: 20px 16px 0;
}

.lfr-eyebrow {
    margin: 0 0 4px;
    font-size: 11px;
    color: #d4af37;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(212, 175, 55, .5);
}

.lfr-header h1 {
    margin: 0 0 6px;
    font-size: 24px;
    color: #f9e596;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(212, 175, 55, .6), 0 0 40px rgba(0, 0, 0, .8);
}

.lfr-intro {
    max-width: 500px;
    margin: 0 auto;
    font-size: 12px;
    line-height: 1.8;
    color: #9aa8b9;
    text-shadow: 0 0 10px rgba(0, 0, 0, .9);
}

/* =========================================================
   5. Instruction Box
   ========================================================= */

.lfr-instruction {
    width: min(90%, 600px);
    margin: 0 auto 16px;
    padding: 12px 16px;
    box-sizing: border-box;
    border-right: 3px solid #d4af37;
    border-radius: 8px;
    background: rgba(10, 15, 29, .75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-align: right;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .4);
    transition: background .3s, color .3s, border-color .3s;
}

.lfr-instruction-title {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 4px;
    color: #f9e596;
}

.lfr-instruction-text {
    margin: 0;
    font-size: 12px;
    line-height: 1.7;
    color: #e0e6ed;
}

.instruction--info    { border-right-color: #9aa8b9; }
.instruction--action  { border-right-color: #d4af37; }
.instruction--success { border-right-color: #4ade80; }

/* =========================================================
   6. Main Area
   ========================================================= */

#lfr-main-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* =========================================================
   7. Form
   ========================================================= */

.lfr-form {
    width: min(90%, 460px);
    margin: 0 auto 16px;
    padding: 20px;
    background: rgba(10, 15, 29, .75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(212, 175, 55, .3);
    border-radius: 14px;
    text-align: right;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .6);
}

.lfr-field { margin-bottom: 12px; }

.lfr-form label,
.lfr-form legend {
    font-weight: 700;
    margin-bottom: 6px;
    display: block;
    font-size: 13px;
    color: #f9e596;
}

.lfr-form input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    font-size: 16px;
    font-family: inherit;
    border: 1px solid rgba(212, 175, 55, .5);
    border-radius: 8px;
    background: rgba(3, 11, 20, .7);
    color: #f9e596;
    box-sizing: border-box;
    text-align: center;
}

.lfr-form input[type="number"]:focus {
    outline: none;
    border-color: #f9e596;
    box-shadow: 0 0 15px rgba(212, 175, 55, .4);
}

.lfr-form small {
    display: block;
    line-height: 1.5;
    margin-top: 4px;
    font-size: 11px;
    color: #9aa8b9;
}

.lfr-form fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 12px;
}

.lfr-skin-field label {
    display: inline-block;
    margin-left: 14px;
    font-weight: 400;
    font-size: 13px;
    color: #e0e6ed;
}

.lfr-form input[type="radio"] {
    margin-left: 5px;
    accent-color: #d4af37;
}

/* =========================================================
   8. Button
   ========================================================= */

.lfr-button {
    display: inline-block;
    border: 1px solid rgba(212, 175, 55, .6);
    border-radius: 50px;
    padding: 11px 32px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    background: rgba(10, 15, 29, .7);
    color: #f9e596;
    transition: all .3s ease;
    box-shadow: 0 0 20px rgba(212, 175, 55, .15), inset 0 0 15px rgba(212, 175, 55, .05);
}

.lfr-button:hover:not(:disabled):not(.is-disabled) {
    background: rgba(212, 175, 55, .25);
    border-color: #f9e596;
    box-shadow: 0 0 40px rgba(212, 175, 55, .5);
    transform: translateY(-2px);
}

.lfr-button.is-disabled,
.lfr-button:disabled {
    opacity: .35;
    cursor: not-allowed;
    background: rgba(10, 15, 29, .5);
    color: #666;
}

.lfr-button.is-disabled:hover,
.lfr-button:disabled:hover {
    background: rgba(10, 15, 29, .5);
    transform: none;
}

/* =========================================================
   9. Initial Deck
   ========================================================= */

.lfr-deck-area {
    width: 80px;
    height: 120px;
    margin: 10px auto 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform .3s ease;
}

.lfr-deck-area:hover { transform: scale(1.08); }

#lfr-deck {
    display: block;
    width: 80px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #d4af37;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .8), 0 0 25px rgba(212, 175, 55, .4);
}

/* =========================================================
   10. Stage Area
   ========================================================= */

.lfr-stage-area {
    width: 100%;
    min-height: 200px;
    box-sizing: border-box;
    margin: 4px 0 0;
    padding: 4px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.lfr-piles-grid {
    width: min(100%, 500px);
    min-height: 160px;
    display: grid;
    grid-template-columns: repeat(4, minmax(60px, 1fr));
    gap: 20px 10px;
    align-items: start;
    justify-items: center;
    box-sizing: border-box;
    margin: 0 auto;
    padding-top: 18px;
}

.lfr-piles-grid--1 { grid-template-columns: minmax(80px, 120px); }
.lfr-piles-grid--2 { grid-template-columns: repeat(2, minmax(80px, 120px)); justify-content: center; }
.lfr-piles-grid--3 { grid-template-columns: repeat(3, minmax(60px, 1fr)); }

.lfr-pile-cell {
    width: 100%;
    min-height: 120px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* =========================================================
   11. Card Stack
   ========================================================= */

.card-stack {
    position: relative;
    width: 72px;
    height: 130px;
    margin: 0 auto;
    cursor: pointer;
    user-select: none;
    touch-action: none;
    outline: none;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.card-stack:hover,
.card-stack:focus-visible {
    transform: translateY(-3px);
}

.card-stack img.card-image {
    position: absolute;
    width: 56px;
    height: 84px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid rgba(212, 175, 55, .5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .7);
    pointer-events: none;
}

.card-stack-label {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 100%;
    text-align: center;
    font-size: 12px;
    line-height: 1.5;
    font-weight: 700;
    color: #f9e596;
    text-shadow: 0 0 8px rgba(212, 175, 55, .6), 0 0 4px #000;
    pointer-events: none;
}

/* =========================================================
   12. Needs Filter
   ========================================================= */

.card-stack.requires-filter {
    border: 2px dashed #d4af37;
    border-radius: 10px;
    padding: 6px;
    box-sizing: border-box;
    animation: pulse-filter 1.8s ease-in-out infinite;
}

.card-stack.requires-filter:hover,
.card-stack.requires-filter:focus-visible {
    border-color: #f9e596;
    background: rgba(212, 175, 55, .08);
}

.card-stack-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #d4af37;
    color: #0a0f1d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    z-index: 100;
    box-shadow: 0 0 12px rgba(212, 175, 55, .8);
    pointer-events: none;
}

@keyframes pulse-filter {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, .5); }
    50%      { box-shadow: 0 0 0 8px rgba(212, 175, 55, 0); }
}

/* =========================================================
   13. Merge States
   ========================================================= */

.card-stack.merge-selected {
    box-shadow: 0 0 0 3px rgba(212, 175, 55, .6);
    transform: translateY(-5px);
}

.card-stack.merge-target {
    box-shadow: 0 0 0 3px rgba(74, 222, 128, .5);
    transform: translateY(-5px);
}

.card-stack.dragging { opacity: .55; }

.card-stack.drag-over {
    outline: 2px dashed #f9e596;
    outline-offset: 4px;
}

/* =========================================================
   14. Merge Controls
   ========================================================= */

.lfr-merge-controls {
    width: min(90%, 400px);
    margin: 12px auto 0;
    text-align: center;
}

.lfr-merge-selection {
    margin: 0 0 8px;
    line-height: 1.6;
    color: #9aa8b9;
    font-size: 12px;
}

.lfr-merge-button {
    min-width: 180px;
}

/* =========================================================
   15. Kept Card
   ========================================================= */

.lfr-kept-card-area {
    width: 100%;
    min-height: 0;
    margin: 10px 0 0;
    display: flex;
    justify-content: center;
}

.lfr-kept-card { text-align: center; }

.lfr-kept-card-title {
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 12px;
    color: #f9e596;
    text-shadow: 0 0 10px rgba(212, 175, 55, .5);
}

.lfr-kept-card img {
    display: block;
    width: 72px;
    height: 108px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #d4af37;
    box-shadow: 0 0 25px rgba(212, 175, 55, .4);
}

/* =========================================================
   16. Status
   ========================================================= */

.lfr-status {
    width: 90%;
    min-height: 24px;
    margin: 8px auto 0;
    text-align: center;
    line-height: 1.7;
    font-size: 11px;
    color: #9aa8b9;
    text-shadow: 0 0 8px rgba(0, 0, 0, .9);
}

/* =========================================================
   17. Results
   ========================================================= */

.lfr-results-container {
    width: min(90%, 600px);
    margin: 20px auto 0;
    padding-bottom: 40px;
}

.lfr-results {
    width: 100%;
    box-sizing: border-box;
    padding: 20px;
    border-radius: 14px;
    background: rgba(10, 15, 29, .9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(212, 175, 55, .35);
    color: #e0e6ed;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .7);
}

.lfr-results > h2 {
    text-align: center;
    margin: 0 0 16px;
    font-size: 20px;
    color: #f9e596;
    text-shadow: 0 0 20px rgba(212, 175, 55, .6);
}

.lfr-results-intro {
    background: rgba(212, 175, 55, .1);
    border-right: 3px solid #d4af37;
    padding: 12px 16px;
    border-radius: 8px;
    line-height: 1.9;
    margin: 16px 0;
    font-size: 12px;
    color: #e0e6ed;
}

.lfr-results-help {
    color: #9aa8b9;
    font-size: 12px;
    line-height: 1.8;
    margin: 12px 0 20px;
    padding-right: 8px;
}

.lfr-results-section-title {
    margin: 20px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(212, 175, 55, .3);
    font-size: 15px;
    color: #f9e596;
}

/* =========================================================
   18. Kept Card Interpretation
   ========================================================= */

.lfr-result-kept {
    background: rgba(212, 175, 55, .08);
    border: 1px solid rgba(212, 175, 55, .35);
    border-radius: 14px;
    padding: 18px 16px;
    margin: 16px 0 24px;
    text-align: center;
}

.lfr-result-kept h3 {
    margin: 0 0 12px;
    font-size: 15px;
    color: #f9e596;
}

.lfr-result-kept img {
    width: 90px;
    height: 135px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #d4af37;
    box-shadow: 0 0 25px rgba(212, 175, 55, .5);
    display: block;
    margin: 0 auto 12px;
}

.lfr-kept-title {
    font-size: 16px;
    font-weight: 700;
    color: #f9e596;
    margin: 8px 0;
}

.lfr-kept-verse {
    background: rgba(3, 11, 20, .6);
    border-radius: 10px;
    padding: 12px 14px;
    margin: 12px auto;
    max-width: 500px;
    border: 1px solid rgba(212, 175, 55, .2);
}

.lfr-kept-verse-line {
    margin: 4px 0;
    line-height: 2;
    color: #d4af37;
    font-style: italic;
    font-size: 13px;
}

.lfr-kept-description {
    text-align: justify;
    line-height: 2;
    color: #e0e6ed;
    margin: 14px auto 0;
    max-width: 550px;
    font-size: 12px;
}

.lfr-kept-no-interp {
    color: #9aa8b9;
    font-style: italic;
    margin-top: 12px;
    font-size: 12px;
}

/* =========================================================
   19. Result Items
   ========================================================= */

.lfr-result-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 14px 0;
    border-top: 1px solid rgba(212, 175, 55, .15);
}

.lfr-result-cards {
    display: flex;
    direction: ltr;
    flex: 0 0 auto;
}

.lfr-result-cards img {
    width: 44px;
    height: 66px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(212, 175, 55, .5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .7);
    margin-left: -12px;
}

.lfr-result-cards img:first-child { margin-left: 0; }

.lfr-result-text { line-height: 1.8; }

.lfr-result-text h3 {
    margin: 0 0 6px;
    color: #f9e596;
    font-size: 14px;
}

.lfr-result-count-meaning {
    background: rgba(34, 113, 177, .15);
    border-right: 3px solid #2271b1;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 6px 0 10px;
    font-size: 12px;
    line-height: 1.7;
    color: #93c5fd;
}

.lfr-result-title {
    font-weight: 700;
    color: #f9e596;
    margin: 6px 0;
    font-size: 13px;
}

.lfr-result-verse {
    font-style: italic;
    color: #d4af37;
    margin: 6px 0;
    padding-right: 10px;
    border-right: 2px solid rgba(212, 175, 55, .4);
    font-size: 12px;
}

.lfr-result-description {
    line-height: 1.9;
    color: #e0e6ed;
    margin-top: 8px;
    font-size: 12px;
}

.lfr-no-results {
    background: rgba(10, 15, 29, .6);
    padding: 18px;
    border-radius: 10px;
    text-align: center;
    color: #9aa8b9;
    line-height: 1.9;
    margin: 16px 0;
    font-size: 12px;
    border: 1px dashed rgba(212, 175, 55, .3);
}

.lfr-restart-button {
    display: block;
    margin: 16px auto 30px;
}

/* =========================================================
   20. Utility
   ========================================================= */

.hidden,
.is-hidden {
    display: none !important;
}

/* =========================================================
   21. Responsive — Tablet (max-width: 768px)
   ========================================================= */

@media (max-width: 768px) {
    body.dc-reading-page--love-feelings .site-main {
        max-width: 100%;
        aspect-ratio: auto;
    }

    .lfr-menu-toggle { top: 15px; right: 15px; width: 38px; height: 38px; }
    .lfr-menu { top: 62px; right: 15px; min-width: 180px; }
    .lfr-menu a { font-size: 12px; padding: 9px 16px; }

    .lfr-page-inner {
        width: calc(100% - 24px);
        padding: 12px 0 30px;
    }

    .lfr-header h1 { font-size: 20px; }
    .lfr-intro { font-size: 11px; }

    .lfr-instruction { padding: 10px 12px; }
    .lfr-instruction-title { font-size: 12px; }
    .lfr-instruction-text { font-size: 11px; }

    .lfr-piles-grid {
        grid-template-columns: repeat(4, minmax(50px, 1fr));
        gap: 16px 6px;
        padding-top: 14px;
    }

    .lfr-piles-grid--3 { grid-template-columns: repeat(3, minmax(60px, 1fr)); }
    .lfr-piles-grid--2 { grid-template-columns: repeat(2, minmax(80px, 1fr)); gap: 18px; }

    .card-stack { width: 60px; height: 110px; }
    .card-stack img.card-image { width: 48px; height: 72px; }
    .card-stack-label { font-size: 11px; bottom: calc(100% + 6px); }
    .card-stack-badge { width: 20px; height: 20px; font-size: 13px; top: -8px; right: -8px; }

    .lfr-result-item { flex-direction: column; align-items: center; }
    .lfr-result-text { text-align: right; width: 100%; }

    .lfr-form { padding: 16px; }
    .lfr-form input[type="number"] { font-size: 15px; }
    .lfr-form .lfr-button { width: 100%; }

    .lfr-merge-button { width: 100%; min-width: 0; }

    .lfr-results { padding: 16px 12px; }
    .lfr-result-cards img { width: 38px; height: 57px; }
}

/* =========================================================
   22. Responsive — Small Mobile (max-width: 430px)
   ========================================================= */

@media (max-width: 430px) {
    .lfr-piles-grid { gap: 12px 4px; padding-top: 12px; }
    .lfr-piles-grid--4 { grid-template-columns: repeat(4, minmax(46px, 1fr)); }
    .card-stack { width: 52px; }
    .card-stack img.card-image { width: 42px; height: 63px; }
    .card-stack-label { bottom: calc(100% + 5px); font-size: 10px; }
    .card-stack-badge { width: 18px; height: 18px; font-size: 12px; }

    .lfr-results { padding: 14px 10px; }
    .lfr-result-cards img { width: 36px; height: 54px; }
}

/* =========================================================
   23. Reduced Motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .card-stack.requires-filter { animation: none; }
    .lfr-button:hover:not(:disabled):not(.is-disabled) { transform: none; }
    .card-stack:hover, .card-stack:focus-visible { transform: none; }
}