/**
 * =========================================================
 * Pyramid Reading - CSS
 * Dark, Gold, Fullscreen, Vertical Frame
 * =========================================================
 */

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
}

.pyr-page {
    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;
}

/* =========================================================
   قاب عمودی ۴:۵ در مرکز مانیتور
   ========================================================= */
.pyr-fullscreen-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: calc(100vh * 0.8);
    max-height: 100vh;
    aspect-ratio: 4 / 5;
    margin: 0 auto;

    background-image: url('../../assets/images/bg/pyramid-reading-bg.webp');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: #0a0f1d;
    overflow: hidden;

    box-shadow: 0 0 80px rgba(0,0,0,.9);
}

@media (max-width: 768px) {
    .pyr-fullscreen-container {
        max-width: 100%;
        max-height: 100%;
        aspect-ratio: auto;
        height: 100%;
    }
}

/* =========================================================
   Sandwich Menu
   ========================================================= */
.pyr-menu-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    background: rgba(10,15,29,.7);
    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;
}

.pyr-menu-toggle:hover {
    background: rgba(212,175,55,.2);
    border-color: #f9e596;
}

.pyr-menu-toggle span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: #f9e596;
    border-radius: 2px;
    transition: all .3s ease;
}

.pyr-menu-toggle.is-open span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}
.pyr-menu-toggle.is-open span:nth-child(2) {
    opacity: 0;
}
.pyr-menu-toggle.is-open span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

.pyr-menu {
    position: absolute;
    top: 72px;
    right: 20px;
    min-width: 200px;
    background: rgba(10,15,29,.95);
    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;
}

.pyr-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pyr-menu a {
    display: block;
    padding: 10px 18px;
    color: #e0e6ed;
    text-decoration: none;
    font-size: 13px;
    transition: all .2s ease;
    border-right: 2px solid transparent;
}

.pyr-menu a:hover {
    background: rgba(212,175,55,.1);
    color: #f9e596;
    border-right-color: #d4af37;
}

/* =========================================================
   Header
   ========================================================= */
.pyr-header-section {
    position: absolute;
    top: 4%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 100;
    width: 90%;
    pointer-events: none;
}

.pyr-title {
    margin: 0 0 6px;
    font-size: 24px;
    color: #f9e596;
    text-shadow: 0 0 20px rgba(212,175,55,.7), 0 0 40px rgba(0,0,0,.8);
    font-weight: 700;
}

.pyr-intro {
    margin: 0 auto;
    max-width: 360px;
    font-size: 11px;
    color: #9aa8b9;
    text-shadow: 0 0 10px rgba(0,0,0,.9);
    line-height: 1.7;
}

/* =========================================================
   Start Button
   ========================================================= */
.pyr-start-btn {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 12px 40px;
    background: rgba(10,15,29,.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(212,175,55,.6);
    border-radius: 50px;
    color: #f9e596;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(212,175,55,.2), inset 0 0 20px rgba(212,175,55,.1);
    transition: all .4s ease;
    z-index: 5000;
    animation: pyr-pulse-gold 2.5s infinite;
    font-family: inherit;
}

@keyframes pyr-pulse-gold {
    0%,100% { box-shadow: 0 0 30px rgba(212,175,55,.2), inset 0 0 20px rgba(212,175,55,.1); }
    50%     { box-shadow: 0 0 50px rgba(212,175,55,.5), inset 0 0 30px rgba(212,175,55,.3); }
}

.pyr-start-btn:hover {
    background: rgba(212,175,55,.25);
    border-color: #f9e596;
    box-shadow: 0 0 60px rgba(212,175,55,.7);
    transform: translate(-50%,-50%) scale(1.05);
}

.pyr-game.is-showing-result .pyr-start-btn {
    display: none;
}

/* =========================================================
   Game Area
   ========================================================= */
.pyr-game {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    height: 68vh;
    z-index: 10;
    text-align: center;
}

/* =========================================================
   Board
   ========================================================= */
.pyr-board {
    position: relative;
    width: 100%;
    height: 70%;
    margin: 0 auto;
    transition: opacity .4s ease, filter .4s ease;
}

.pyr-game.is-showing-result .pyr-board {
    pointer-events: none;
    opacity: .2;
    filter: blur(3px);
}

/* =========================================================
   Cards
   ========================================================= */
.pyr-card {
    position: absolute;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,.7), 0 0 4px rgba(212,175,55,.15);
    transition: transform .2s ease, box-shadow .2s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.pyr-pyramid-card {
    width: clamp(38px, 9vw, 58px);
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid rgba(212,175,55,.6);
}

.pyr-pyramid-card:hover {
    transform: scale(1.08);
    z-index: 10;
    box-shadow: 0 0 14px rgba(212,175,55,.6);
}

.pyr-selected {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
    box-shadow: 0 0 18px rgba(212,175,55,.9);
    z-index: 20;
}

/* =========================================================
   Stacks
   ========================================================= */
.pyr-stacks {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 40px;
    margin-top: 15px;
    transition: opacity .4s ease, filter .4s ease;
}

.pyr-game.is-showing-result .pyr-stacks {
    pointer-events: none;
    opacity: .2;
    filter: blur(3px);
}

.pyr-stack {
    position: relative;
    width: clamp(48px, 11vw, 68px);
    height: clamp(72px, 16.5vw, 102px);
    border: 1px dashed rgba(212,175,55,.5);
    border-radius: 8px;
    background: rgba(10,15,29,.4);
    padding: 3px;
}

.pyr-stack:hover {
    border-color: #f9e596;
    background: rgba(212,175,55,.08);
}

.pyr-stack-card,
.pyr-reserve-card {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid rgba(212,175,55,.55);
    box-shadow: 0 2px 6px rgba(0,0,0,.7);
}

.pyr-reserve-card {
    filter: brightness(.7) sepia(.4);
}

.pyr-return-btn {
    position: relative;
    z-index: 5;
    padding: 8px 12px;
    cursor: pointer;
    border: 1px solid #d4af37;
    background: rgba(10,15,29,.7);
    color: #f9e596;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
    font-family: inherit;
    transition: all .2s ease;
}

.pyr-return-btn:hover {
    background: rgba(212,175,55,.25);
    color: #fff;
}

/* =========================================================
   Result (Overlay)
   ========================================================= */
.pyr-result {
    display: none;
}

.pyr-result.is-visible {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 900;
    margin: 0;
    padding: 20px 14px 90px;
    max-height: 100%;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(3,11,20,.92), rgba(3,11,20,.98));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(212,175,55,.3);
    border-radius: 14px;
    text-align: right;
    color: #e0e6ed;
    animation: pyrFadeIn .35s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(212,175,55,.4) transparent;
}

.pyr-result::-webkit-scrollbar { width: 6px; }
.pyr-result::-webkit-scrollbar-thumb { background: rgba(212,175,55,.4); border-radius: 3px; }

@keyframes pyrFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pyr-result-heading {
    max-width: 800px;
    margin: 0 auto 20px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #f9e596;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(212,175,55,.3);
    text-shadow: 0 0 15px rgba(212,175,55,.5);
}

/* =========================================================
   Result Card
   ========================================================= */
.pyr-card-container {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 16px;
    max-width: 700px;
    margin: 0 auto 16px;
    background: rgba(10,15,29,.6);
    border: 1px solid rgba(212,175,55,.25);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,.4);
    animation: pyrCardIn .4s ease both;
}

@keyframes pyrCardIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pyr-card-container--main {
    background: rgba(212,175,55,.12);
    border: 2px solid #d4af37;
    box-shadow: 0 6px 20px rgba(212,175,55,.25);
    animation-delay: 0s;
}

.pyr-result-card {
    width: 100px;
    max-width: 100px;
    height: auto;
    display: block;
    flex-shrink: 0;
    border-radius: 6px;
    border: 1px solid rgba(212,175,55,.5);
    box-shadow: 0 4px 12px rgba(0,0,0,.5);
}

.pyr-card-text {
    flex: 1;
    font-size: 13px;
    color: #e0e6ed;
    text-align: right;
    min-height: 150px;
    padding: 8px 12px;
    box-sizing: border-box;
    overflow-y: auto;
    line-height: 1.9;
}

.pyr-card-text h4 {
    margin: 0 0 8px;
    font-size: 15px;
    color: #f9e596;
    font-weight: 700;
}

.pyr-card-text p { margin: 0; line-height: 1.95; }

.pyr-card-verse {
    font-style: italic;
    color: #d4af37;
    margin: 8px 0;
    padding-right: 12px;
    border-right: 2px solid rgba(212,175,55,.4);
    line-height: 2;
}

.pyr-card-description { margin: 8px 0 0; line-height: 1.95; color: #e0e6ed; }
.pyr-card-no-info { color: #9aa8b9; font-style: italic; margin: 0; }

/* =========================================================
   Special Message
   ========================================================= */
.pyr-special-message {
    display: block;
    max-width: 500px;
    margin: 40px auto;
    padding: 30px 25px;
    font-style: italic;
    font-size: 15px;
    text-align: center;
    line-height: 2.2;
    color: #f9e596;
    background: rgba(10,15,29,.7);
    border: 1px dashed #d4af37;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(212,175,55,.15);
    text-shadow: 0 0 15px rgba(212,175,55,.4);
    animation: pyrCardIn .4s ease both;
}

/* =========================================================
   Restart Button
   ========================================================= */
.pyr-restart-btn {
    display: none;
}

.pyr-restart-btn.is-visible {
    display: block;
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 950;
    padding: 12px 36px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    border: 1px solid rgba(212,175,55,.6);
    border-radius: 50px;
    background: rgba(10,15,29,.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f9e596;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(212,175,55,.3), inset 0 0 20px rgba(212,175,55,.1);
    transition: all .3s ease;
    animation: pyrBtnIn .4s ease both;
}

@keyframes pyrBtnIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pyr-restart-btn.is-visible:hover {
    background: rgba(212,175,55,.25);
    border-color: #f9e596;
    box-shadow: 0 0 60px rgba(212,175,55,.7);
    transform: translateX(-50%) translateY(-2px);
}

/* =========================================================
   Overlay (Modal)
   ========================================================= */
.pyr-overlay {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,.75);
    z-index: 9999;
}

.pyr-overlay-visible { display: flex; }

.pyr-result-box {
    background: rgba(10,15,29,.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(212,175,55,.5);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    width: min(450px, calc(100% - 40px));
    box-sizing: border-box;
    box-shadow: 0 20px 60px rgba(0,0,0,.7), 0 0 40px rgba(212,175,55,.15);
    color: #e0e6ed;
}

.pyr-show-result {
    padding: 11px 24px;
    cursor: pointer;
    border: 1px solid #d4af37;
    border-radius: 50px;
    background: rgba(212,175,55,.15);
    color: #f9e596;
    font-weight: 700;
    font-size: 14px;
    font-family: inherit;
    transition: all .2s ease;
}

.pyr-show-result:hover {
    background: rgba(212,175,55,.35);
    transform: translateY(-1px);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 768px) {
    .pyr-title { font-size: 18px; }
    .pyr-intro { font-size: 10px; max-width: 300px; }
    .pyr-start-btn { top: 18%; padding: 10px 30px; font-size: 13px; }
    .pyr-game { top: 26%; height: 72vh; }
    .pyr-menu-toggle { top: 15px; right: 15px; width: 38px; height: 38px; }
    .pyr-menu { top: 62px; right: 15px; min-width: 180px; }
    .pyr-result-heading { font-size: 17px; }
    .pyr-card-container { flex-direction: column; align-items: center; padding: 12px; gap: 10px; }
    .pyr-result-card { width: 90px; max-width: 90px; }
    .pyr-card-text { font-size: 12px; min-height: auto; width: 100%; padding: 8px 10px; }
    .pyr-card-text h4 { font-size: 14px; }
    .pyr-special-message { font-size: 13px; padding: 20px 15px; margin: 25px auto; }
    .pyr-restart-btn.is-visible { bottom: 12px; padding: 10px 26px; font-size: 13px; }
}