/* Daily recommendation: centered modal that grows to full screen while reading. Physical left/right, RTL-safe. */
@property --rec-open {
    syntax: "<number>";
    inherits: true;
    initial-value: 0;
}
.daily-rec-fab {
    position: fixed;
    top: auto;
    right: auto;
    left: 1rem;
    bottom: 5.75rem;
    z-index: 50;
    direction: ltr;
    min-width: 3.25rem;
    height: 3.25rem;
    padding: 0 0.95rem 0 0.8rem;
    gap: 0.45rem;
    border: 1px solid color-mix(in oklab, var(--color-base-100) 60%, transparent);
    border-radius: 999px;
    background: color-mix(in oklab, var(--color-base-100) 62%, transparent);
    color: var(--color-base-content);
    box-shadow: 0 12px 32px color-mix(in oklab, var(--color-base-content) 18%, transparent);
    backdrop-filter: blur(16px);
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    transition: padding 0.32s cubic-bezier(0.4, 0, 0.2, 1), gap 0.32s cubic-bezier(0.4, 0, 0.2, 1), transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.daily-rec-fab i { font-size: 1.35rem; color: var(--color-primary); flex: none; }

.daily-rec-fab-label {
    direction: rtl;
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1;
    max-width: 9rem;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
}

.daily-rec-fab.is-compact {
    padding: 0;
    width: 3.25rem;
    justify-content: center;
    gap: 0;
}

.daily-rec-fab.is-compact .daily-rec-fab-label {
    max-width: 0;
    opacity: 0;
}

.daily-rec-fab.is-open {
    transform: translateY(8rem);
    opacity: 0;
    pointer-events: none;
}

.daily-rec-fab.has-quest::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: inherit;
    border: 2px solid color-mix(in oklab, var(--color-primary) 70%, transparent);
    animation: daily-rec-pulse 2.4s ease-out infinite;
}

@media (min-width: 768px) {
    .daily-rec-fab { left: 1.25rem; bottom: 2rem; }
}

@keyframes daily-rec-pulse {
    0% { transform: scale(0.92); opacity: 0.85; }
    100% { transform: scale(1.18); opacity: 0; }
}

.daily-rec {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    --rec-open: 0;
    padding: calc(1.25rem * (1 - var(--rec-open)));
    background: rgba(8, 10, 16, calc(0.62 * (1 - var(--rec-open))));
    backdrop-filter: blur(8px);
    font-family: Vazirmatn, sans-serif;
    transition: --rec-open 0.52s cubic-bezier(0.22, 0.8, 0.2, 1);
}

.daily-rec.is-reading { --rec-open: 1; }

.daily-rec-panel {
    position: relative;
    width: calc(min(960px, 100vw - 2.5rem) + (100vw - min(960px, 100vw - 2.5rem)) * var(--rec-open));
    height: calc(min(860px, 100dvh - 2.5rem) + (100dvh - min(860px, 100dvh - 2.5rem)) * var(--rec-open));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: calc(1.75rem * (1 - var(--rec-open)));
    background: #12141c;
    color: #f8fafc;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

.daily-rec.hidden { display: none; }

.daily-rec-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.daily-rec-head {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent);
}

.daily-rec-iconbtn {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.16);
    color: inherit;
    backdrop-filter: blur(14px);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex: none;
}

.daily-rec-title {
    font-weight: 700;
    font-size: 1rem;
}

.daily-rec-chip {
    margin-inline-start: auto;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(12px);
}

.daily-rec-stage {
    position: relative;
    min-height: 22rem;
    padding: 0.5rem 0 1.5rem;
    overflow: hidden;
}

.daily-rec-blur,
.daily-rec-wash {
    position: absolute;
    inset: -8%;
    background-size: cover;
    background-position: center;
    filter: blur(42px) saturate(1.25);
    transform: scale(1.08);
    transition: opacity 0.45s ease;
}

.daily-rec-wash {
    filter: none;
    background-image: none !important;
    background-color: transparent;
    opacity: 0.92;
}

.daily-rec-rail {
    position: relative;
    z-index: 1;
    direction: rtl;
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    /* Half a slide, so the first and last covers sit in the center in RTL. */
    padding: 1.25rem calc(50% - 8.5rem) 0.5rem;
    scroll-padding-inline: calc(50% - 8.5rem);
    scrollbar-width: none;
    cursor: grab;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

.daily-rec-rail.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
}

.daily-rec-cover {
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

.daily-rec-rail::-webkit-scrollbar { display: none; }

.daily-rec-slide {
    flex: none;
    width: 17rem;
    scroll-snap-align: center;
    text-align: center;
    transform: scale(0.86);
    opacity: 0.55;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.daily-rec-slide.is-active {
    transform: scale(1);
    opacity: 1;
}

.daily-rec-cover {
    width: min(58%, 12rem);
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 1.25rem;
    margin: 0 auto 0.85rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    background: rgba(255, 255, 255, 0.08);
}

.daily-rec-booktitle {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.6;
    margin: 0 0.4rem 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.daily-rec-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem;
    padding: 0 0.35rem;
}

.daily-rec-stat {
    aspect-ratio: 1;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.25rem;
}

.daily-rec-stat span {
    font-size: 0.65rem;
    opacity: 0.75;
}

.daily-rec-stat strong {
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.daily-rec-sheet {
    position: relative;
    z-index: 2;
    margin-top: -1.25rem;
    border-radius: 1.6rem 1.6rem 0 0;
    background: color-mix(in oklab, var(--color-base-100) 88%, transparent);
    color: var(--color-base-content);
    backdrop-filter: blur(18px);
    min-height: 24rem;
    padding: 1.1rem 1.15rem 6rem;
    box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.18);
}

.daily-rec-chapter-kicker {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-bottom: 0.2rem;
}

.daily-rec-chapter-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.daily-rec-prose {
    font-size: 1.05rem;
    line-height: 2.15;
    text-align: justify;
    user-select: none;
}

.daily-rec-prose .paragraph-block { margin: 0 0 1rem; }
.daily-rec-prose .paragraph-block p { margin: 0; }

.daily-rec-pages img {
    display: block;
    width: 100%;
    margin: 0 auto 0.75rem;
    border-radius: 0.75rem;
}

.daily-rec-lock,
.daily-rec-empty,
.daily-rec-loading {
    text-align: center;
    padding: 2.5rem 1rem;
    opacity: 0.8;
}

.daily-rec-readbar {
    display: flex;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 0.8rem;
    background: linear-gradient(to bottom, rgba(18, 20, 28, 0.92), rgba(18, 20, 28, 0.55) 70%, transparent);
    color: #f8fafc;
}

.daily-rec-head,
.daily-rec-stage {
    max-height: 40rem;
    transition: max-height 0.52s cubic-bezier(0.22, 0.8, 0.2, 1), opacity 0.35s ease, padding 0.52s ease;
}

.daily-rec.is-reading .daily-rec-head,
.daily-rec.is-reading .daily-rec-stage {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

.daily-rec.is-reading .daily-rec-scroll { overflow: hidden; }

.daily-rec.is-reading .daily-rec-sheet {
    position: absolute;
    inset: 0;
    margin: 0;
    border-radius: 0;
    overflow: auto;
    padding-top: 4.6rem;
    background: #161820;
    color: #f4f4f5;
}

.daily-rec.is-reading .daily-rec-readbar {
    opacity: 1;
    pointer-events: auto;
}

.daily-rec-readbar .daily-rec-chapter-label {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.daily-rec-navbtn {
    border: 0;
    background: rgba(255, 255, 255, 0.14);
    color: inherit;
    border-radius: 999px;
    padding: 0.4rem 0.7rem;
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}

.daily-rec-navbtn:disabled { opacity: 0.35; cursor: default; }

.daily-rec-library {
    position: absolute;
    right: 1rem;
    bottom: 1.15rem;
    z-index: 5;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.18);
    color: #f8fafc;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.daily-rec-library.is-in { background: var(--color-primary); color: var(--color-primary-content, #fff); }
.daily-rec-library i { font-size: 1.3rem; }

.daily-rec-gold {
    position: relative;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    display: grid;
    place-items: center;
    color: inherit;
}

.daily-rec-gold i { color: #fbbf24; font-size: 1.05rem; position: relative; }

/* Stroke starts at 3 o'clock. Rotate to 12, and keep LTR so RTL does not mirror it to 9. */
.daily-rec-gold-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    direction: ltr;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.daily-rec-gold-svg [data-ring-progress] {
    stroke-dasharray: 119.38;
    stroke-dashoffset: 119.38;
    transition: stroke-dashoffset 0.6s ease;
}

@media (prefers-reduced-motion: reduce) {
    .daily-rec,
    .daily-rec-fab,
    .daily-rec-slide,
    .daily-rec-head,
    .daily-rec-stage,
    .daily-rec-blur,
    .daily-rec-wash,
    .daily-rec-readbar { transition: none; }
    .daily-rec-fab.has-quest::after { animation: none; }
}
