/*
 * =========================================================
 * DivinationChaloce
 * Custom Fate Reading — 8 Cards
 * =========================================================
 */


/* =========================================================
   Page
========================================================= */

.custom-fate-reading-page {
    min-height: 100vh;
}

.cfr-container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 60px 0 80px;
}


/* =========================================================
   Header
========================================================= */

.cfr-header,
.cfr-stage-heading,
.cfr-approved-heading {
    text-align: center;
}

.cfr-header {
    margin-bottom: 38px;
}

.cfr-header h1 {
    margin: 0 0 14px;
}

.cfr-intro {
    max-width: 720px;
    margin: 0 auto;
    line-height: 1.9;
}


/* =========================================================
   Stage
========================================================= */

.cfr-stage {
    width: 100%;
}

.cfr-stage-heading {
    margin-bottom: 24px;
}

.cfr-stage-heading h2 {
    margin: 0 0 10px;
}

.cfr-stage-heading p {
    max-width: 720px;
    margin: 0 auto;
    line-height: 1.8;
}

.cfr-stage-heading h2:focus-visible,
.cfr-stage-success h2:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 6px;
    border-radius: 4px;
}


/* =========================================================
   Selection Counter
========================================================= */

.cfr-selection-status {
    text-align: center;
    margin: 0 0 22px;
    font-weight: 700;
    line-height: 1.7;
}

.cfr-selection-status:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 5px;
    border-radius: 4px;
}


/* =========================================================
   Deck — 13 columns (5 cards × 13 = 65 + 4 for spacing)
========================================================= */

.cfr-deck-grid {
    display: grid;
    grid-template-columns: repeat(13, minmax(0, 1fr));
    gap: 8px;
    align-items: center;
    justify-items: center;
    width: min(720px, 92vw);
    margin: 0 auto 30px;
}


/* =========================================================
   Card
========================================================= */

.cfr-card {
    width: 100%;
    max-width: 52px;
    aspect-ratio: 2 / 3;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    perspective: 900px;
    position: relative;
}


.cfr-card-inner {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.65s ease;
}

.cfr-card.is-revealed .cfr-card-inner {
    transform: rotateY(180deg);
}


/* =========================================================
   Card Faces
========================================================= */

.cfr-card-face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 8px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .20);
}

.cfr-card-face img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
}

.cfr-card-back {
    transform: rotateY(0);
}

.cfr-card-front {
    transform: rotateY(180deg);
}


/* =========================================================
   Card States
========================================================= */

.cfr-card:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 6px;
    border-radius: 8px;
}

.cfr-card.is-selected .cfr-card-front {
    box-shadow:
        0 0 0 3px currentColor,
        0 10px 28px rgba(0, 0, 0, .25);
}

.cfr-card:disabled {
    opacity: .92;
}


/* =========================================================
   Selected Slots (8 slots)
========================================================= */

.cfr-selected-cards,
.cfr-final-cards,
.cfr-approved-cards {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.cfr-selected-slot {
    width: 74px;
    min-height: 108px;
    border: 1px dashed rgba(0, 0, 0, .35);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6px;
    box-sizing: border-box;
    line-height: 1.4;
    font-size: .78rem;
}

.cfr-selected-slot.has-card {
    border-style: solid;
}

.cfr-selected-slot img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}


/* =========================================================
   Form
========================================================= */

.cfr-form {
    width: min(650px, 100%);
    margin: 32px auto 0;
}

.cfr-field {
    margin-bottom: 18px;
}

.cfr-field label {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
}

.cfr-field input,
.cfr-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, .25);
    border-radius: 8px;
    font: inherit;
    background: #fff;
    color: #222;
}

.cfr-field textarea {
    resize: vertical;
    min-height: 140px;
}

.cfr-field input:focus-visible,
.cfr-field textarea:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}


/* =========================================================
   Notice
========================================================= */

.cfr-form-notice {
    margin: 15px 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(180, 0, 0, .08);
    border: 1px solid rgba(180, 0, 0, .25);
    line-height: 1.8;
}

.cfr-form-notice:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}


/* =========================================================
   Buttons
========================================================= */

.cfr-button {
    display: inline-block;
    width: min(100%, 320px);
    margin: 12px auto 0;
    padding: 13px 20px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.cfr-button:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 4px;
}

.cfr-button:disabled {
    opacity: .6;
    cursor: wait;
}

.cfr-button-secondary {
    margin-top: 20px;
    background: #f0f0f0;
    color: #222;
}


/* =========================================================
   Success
========================================================= */

.cfr-stage-success {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.cfr-success-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 15px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 30px;
    font-weight: 700;
    background: #d4edda;
    color: #155724;
}

.cfr-request-summary {
    margin-top: 25px;
    line-height: 1.9;
}


/* =========================================================
   Hidden
========================================================= */

[hidden] {
    display: none !important;
}


/* =========================================================
   Reduced Motion
========================================================= */

@media (prefers-reduced-motion: reduce) {
    .cfr-card-inner {
        transition: none;
    }
}


/* =========================================================
   Tablet
========================================================= */

@media (max-width: 900px) {
    .cfr-deck-grid {
        grid-template-columns: repeat(10, minmax(0, 1fr));
        gap: 10px;
        width: min(600px, 92vw);
    }

    .cfr-card {
        max-width: 58px;
    }
}


/* =========================================================
   Mobile
========================================================= */

@media (max-width: 650px) {
    .cfr-container {
        width: min(100% - 20px, 560px);
        padding: 38px 0 55px;
    }

    .cfr-header {
        margin-bottom: 30px;
    }

    .cfr-deck-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        gap: 8px;
    }

    .cfr-card {
        max-width: 62px;
    }

    .cfr-selected-slot {
        width: 64px;
        min-height: 92px;
        font-size: .72rem;
    }

    .cfr-final-cards .cfr-approved-card {
        width: 64px;
    }

    .cfr-final-cards .cfr-approved-card img {
        width: 64px;
    }
}


/* =========================================================
   Small Mobile
========================================================= */

@media (max-width: 420px) {
    .cfr-deck-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 6px;
    }

    .cfr-card {
        max-width: 48px;
    }

    .cfr-selected-slot {
        width: 58px;
        min-height: 84px;
        font-size: .68rem;
    }
}


/* =========================================================
   Approved Cards (used in final cards and approved readings)
========================================================= */

.cfr-approved-card {
    width: 74px;
    margin: 0;
    text-align: center;
}

.cfr-approved-card img {
    width: 74px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    margin: 0 auto 6px;
}

.cfr-approved-card figcaption {
    font-size: .78rem;
    line-height: 1.4;
}

/* =========================================================
   =========================================================
   NEW: Dark Theme + Fullscreen Shell + Sandwich Menu
   این لایه روی تمام استایل‌های قبلی سوار می‌شود
   =========================================================
   ========================================================= */

/* ---------- 1. قاب عمودی ۴:۵ ---------- */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
}

body.dc-reading-page--custom-fate {
    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--custom-fate .custom-fate-reading-page {
    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/custom-fate-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--custom-fate .custom-fate-reading-page::-webkit-scrollbar { width: 6px; }
body.dc-reading-page--custom-fate .custom-fate-reading-page::-webkit-scrollbar-thumb {
    background: rgba(212,175,55,.4);
    border-radius: 3px;
}

/* در موبایل: تمام‌صفحه */
@media (max-width: 768px) {
    body.dc-reading-page--custom-fate .custom-fate-reading-page {
        max-width: 100%;
        aspect-ratio: auto;
    }
}

/* ---------- 2. Sandwich Menu ---------- */
.cfr-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;
}

.cfr-menu-toggle:hover {
    background: rgba(212,175,55,.25);
    border-color: #f9e596;
}

.cfr-menu-toggle span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: #f9e596;
    border-radius: 2px;
    transition: all .3s ease;
}

.cfr-menu-toggle.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.cfr-menu-toggle.is-open span:nth-child(2) { opacity: 0; }
.cfr-menu-toggle.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.cfr-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;
}

.cfr-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cfr-menu a {
    display: block;
    padding: 10px 18px;
    color: #e0e6ed;
    text-decoration: none;
    font-size: 13px;
    transition: all .2s ease;
    border-right: 2px solid transparent;
}

.cfr-menu a:hover {
    background: rgba(212,175,55,.1);
    color: #f9e596;
    border-right-color: #d4af37;
}

@media (max-width: 768px) {
    .cfr-menu-toggle { top: 15px; right: 15px; width: 38px; height: 38px; }
    .cfr-menu { top: 62px; right: 15px; min-width: 180px; }
    .cfr-menu a { font-size: 12px; padding: 9px 16px; }
}

/* ---------- 3. Container ---------- */
.cfr-container {
    width: min(90%, 600px);
    margin: 0 auto;
    padding: 60px 0 40px;
}

/* ---------- 4. Header ---------- */
.cfr-header {
    text-align: center;
    margin-bottom: 32px;
}

.cfr-header h1 {
    margin: 0 0 10px;
    font-size: 26px;
    color: #f9e596;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(212,175,55,.6), 0 0 40px rgba(0,0,0,.8);
}

.cfr-intro {
    max-width: 500px;
    margin: 0 auto 10px;
    font-size: 13px;
    line-height: 1.9;
    color: #9aa8b9;
    text-shadow: 0 0 10px rgba(0,0,0,.9);
}

.cfr-price {
    margin: 12px 0 0;
    font-size: 14px;
    color: #e0e6ed;
}

.cfr-price strong {
    color: #f9e596;
    font-size: 16px;
    text-shadow: 0 0 15px rgba(212,175,55,.5);
}

/* ---------- 5. Stage Heading ---------- */
.cfr-stage-heading {
    text-align: center;
    margin-bottom: 22px;
}

.cfr-stage-heading h2 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #f9e596;
    text-shadow: 0 0 15px rgba(212,175,55,.5);
}

.cfr-stage-heading p {
    max-width: 500px;
    margin: 0 auto;
    font-size: 12px;
    line-height: 1.8;
    color: #9aa8b9;
}

.cfr-stage-heading h2:focus-visible {
    outline: 2px solid #d4af37;
    outline-offset: 4px;
    border-radius: 4px;
}

/* ---------- 6. Selection Counter ---------- */
.cfr-selection-status {
    text-align: center;
    margin: 0 0 18px;
    font-weight: 700;
    font-size: 14px;
    color: #f9e596;
    text-shadow: 0 0 10px rgba(212,175,55,.5);
}

.cfr-selection-status:focus-visible {
    outline: 2px solid #d4af37;
    outline-offset: 4px;
    border-radius: 4px;
}

/* ---------- 7. Deck Grid (13 columns) ---------- */
.cfr-deck-grid {
    display: grid;
    grid-template-columns: repeat(13, minmax(0, 1fr));
    gap: 6px;
    align-items: center;
    justify-items: center;
    width: 100%;
    margin: 0 auto 24px;
    padding: 0 4px;
    box-sizing: border-box;
}

/* ---------- 8. Cards ---------- */
.cfr-card {
    width: 100%;
    max-width: 42px;
    aspect-ratio: 2 / 3;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    perspective: 900px;
    position: relative;
}

.cfr-card-inner {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform .65s ease;
}

.cfr-card.is-revealed .cfr-card-inner {
    transform: rotateY(180deg);
}

.cfr-card-face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 5px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border: 1px solid rgba(212,175,55,.5);
    box-shadow: 0 2px 8px rgba(0,0,0,.7);
}

.cfr-card-face img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
}

.cfr-card-back  { transform: rotateY(0); }
.cfr-card-front { transform: rotateY(180deg); }

.cfr-card:focus-visible {
    outline: 2px solid #d4af37;
    outline-offset: 4px;
    border-radius: 5px;
}

.cfr-card.is-selected .cfr-card-front {
    box-shadow: 0 0 0 2px #d4af37, 0 0 15px rgba(212,175,55,.7);
}

.cfr-card:disabled {
    opacity: .95;
    cursor: default;
}

/* ---------- 9. Selected Slots (8 slots) ---------- */
.cfr-selected-cards,
.cfr-final-cards {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.cfr-selected-slot {
    width: 58px;
    min-height: 84px;
    border: 1px dashed rgba(212,175,55,.4);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4px;
    box-sizing: border-box;
    line-height: 1.4;
    font-size: 10px;
    color: #9aa8b9;
    background: rgba(10,15,29,.5);
}

.cfr-selected-slot.has-card {
    border-style: solid;
    border-color: rgba(212,175,55,.7);
}

.cfr-selected-slot img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    border: 1px solid rgba(212,175,55,.5);
}

/* ---------- 10. Form ---------- */
.cfr-form {
    width: 100%;
    margin: 24px auto 0;
    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);
    box-sizing: border-box;
}

.cfr-field {
    margin-bottom: 16px;
}

.cfr-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 13px;
    color: #f9e596;
}

.cfr-field input,
.cfr-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid rgba(212,175,55,.5);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    background: rgba(3,11,20,.7);
    color: #f9e596;
}

.cfr-field input:focus-visible,
.cfr-field textarea:focus-visible {
    outline: none;
    border-color: #f9e596;
    box-shadow: 0 0 15px rgba(212,175,55,.4);
}

/* ---------- 11. Notice ---------- */
.cfr-form-notice {
    margin: 14px 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(220,38,38,.15);
    border: 1px solid rgba(220,38,38,.4);
    color: #fca5a5;
    line-height: 1.8;
    font-size: 13px;
}

/* ---------- 12. Buttons ---------- */
.cfr-button {
    display: inline-block;
    width: 100%;
    margin: 10px auto 0;
    padding: 12px 20px;
    border: 1px solid rgba(212,175,55,.6);
    border-radius: 50px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    font-size: 14px;
    text-align: center;
    text-decoration: none;
    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);
}

.cfr-button:hover:not(:disabled) {
    background: rgba(212,175,55,.25);
    border-color: #f9e596;
    box-shadow: 0 0 40px rgba(212,175,55,.5);
    transform: translateY(-2px);
}

.cfr-button:focus-visible {
    outline: 2px solid #d4af37;
    outline-offset: 4px;
}

.cfr-button:disabled {
    opacity: .6;
    cursor: wait;
}

.cfr-form-note {
    margin: 14px 0 0;
    font-size: 11px;
    line-height: 1.8;
    color: #9aa8b9;
    text-align: center;
}

/* ---------- 13. Final Cards (Approved) ---------- */
.cfr-approved-card {
    width: 58px;
    margin: 0;
    text-align: center;
}

.cfr-approved-card img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid rgba(212,175,55,.6);
    box-shadow: 0 2px 8px rgba(0,0,0,.7);
    display: block;
    margin: 0 auto 4px;
}

.cfr-approved-card figcaption {
    font-size: 10px;
    line-height: 1.4;
    color: #9aa8b9;
}

/* ---------- 14. Responsive ---------- */
@media (max-width: 768px) {
    .cfr-container { width: min(94%, 560px); padding: 40px 0 40px; }
    .cfr-header h1 { font-size: 22px; }
    .cfr-intro { font-size: 12px; }

    .cfr-deck-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; }
    .cfr-card { max-width: 38px; }

    .cfr-selected-slot { width: 48px; min-height: 72px; font-size: 9px; }
    .cfr-approved-card { width: 48px; }
    .cfr-approved-card figcaption { font-size: 9px; }
}

@media (max-width: 480px) {
    .cfr-deck-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
    .cfr-card { max-width: 36px; }
    .cfr-selected-slot { width: 42px; min-height: 63px; font-size: 8px; }
    .cfr-approved-card { width: 42px; }
}

/* ---------- 15. Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .cfr-card-inner { transition: none; }
    .cfr-button:hover:not(:disabled) { transform: none; }
}

/* ---------- 16. Hidden ---------- */
[hidden] {
    display: none !important;
}