/* ============================================================
   Rewards Page — RTL
   مستقل تماماً عن باقي ستايلات اللعبة، prefix: .rewards
   ============================================================ */

body.rewards #content.rewards {
    --rw-gold-primary: #c5a55a;
    --rw-gold-light: #dfd3ad;
    --rw-gold-secondary: rgb(229, 206, 155);
    --rw-gold-shadow: rgba(144, 109, 13, 0.4);
    --rw-gold-glow: 0 0 8px rgb(144, 109, 13);
    --rw-green-ring: #16a34a;
    --rw-green-ring-light: #4ade80;
    --rw-green-shadow: rgba(22, 163, 74, 0.45);
    --rw-card-bg: #fffcf8;
    --rw-text-main: #334155;
    --rw-text-muted: #6b7280;
    --rw-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    color: var(--rw-text-main);
    padding: 20px 14px !important;
    box-sizing: border-box;
    min-height: 600px;
    direction: rtl;
    text-align: right;
}

body.rewards #content.rewards * { box-sizing: border-box; }

body.rewards #content.rewards .rewardWrapper {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: rwFadeIn 0.6s ease-out;
}

@keyframes rwFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Premium Card ---------- */
body.rewards #content.rewards .premiumCard {
    background: var(--rw-card-bg);
    border: 1px solid var(--rw-gold-light);
    border-radius: 20px;
    padding: 32px 28px;
    box-shadow: var(--rw-gold-glow);
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* ---------- Daily Card Header ---------- */
body.rewards #content.rewards .cardHeader h1 {
    color: var(--rw-gold-primary);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin: 0 0 4px 0;
    border: none;
    background: none;
}
body.rewards #content.rewards .cardHeader .subtitle {
    font-size: 0.9rem;
    color: var(--rw-text-muted);
    margin: 0 0 28px 0;
    font-weight: 500;
}

/* ---------- Circular Timer ---------- */
body.rewards #content.rewards .timerViewport {
    display: flex;
    justify-content: center;
    margin: 24px 0 26px 0;
}
body.rewards #content.rewards .cardHeader + .timerViewport {
    margin-top: 28px;
}
body.rewards #content.rewards .timerOuter {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    padding: 14px;
    background: conic-gradient(var(--rw-gold-light) 0deg, var(--rw-gold-light) 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--rw-gold-shadow);
    transition: box-shadow 0.3s ease;
    position: relative;
}
body.rewards #content.rewards .timerOuter::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #daca9c;
    -webkit-mask: radial-gradient(circle, transparent 86px, #000 86px);
            mask: radial-gradient(circle, transparent 86px, #000 86px);
    z-index: 0;
}
body.rewards #content.rewards .timerOuter::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--rw-progress-bg, conic-gradient(var(--rw-gold-primary) 0deg, var(--rw-gold-light) 0deg));
    -webkit-mask: radial-gradient(circle, transparent 86px, #000 86px);
            mask: radial-gradient(circle, transparent 86px, #000 86px);
    z-index: 1;
    transition: none;
}
body.rewards #content.rewards .timerOuter.ready {
    animation: rwPulseGreen 2s infinite;
    box-shadow: 0 0 18px var(--rw-green-shadow);
}
@keyframes rwPulseGreen {
    0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7), 0 0 18px var(--rw-green-shadow); }
    70%  { box-shadow: 0 0 0 18px rgba(22, 163, 74, 0), 0 0 18px var(--rw-green-shadow); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0), 0 0 18px var(--rw-green-shadow); }
}
body.rewards #content.rewards .timerOuter.ready .timerInner {
    border-color: var(--rw-green-ring);
}
body.rewards #content.rewards .timerOuter.ready .timerVal {
    color: #15803d;
}
body.rewards #content.rewards .timerOuter.ready .timerLabel {
    display: none;
}
body.rewards #content.rewards .timerInner {
    width: 100%;
    height: 100%;
    background: var(--rw-card-bg);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--rw-gold-light);
    position: relative;
    z-index: 2;
}
body.rewards #content.rewards .timerVal {
    font-size: 1.9rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: 0.02em;
    font-family: 'Tahoma', 'Manrope', sans-serif;
    direction: ltr; /* الوقت يُقرأ LTR حتى في RTL */
    unicode-bidi: isolate;
    line-height: 1.1;
}
body.rewards #content.rewards .timerLabel {
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: var(--rw-text-muted);
    font-weight: 700;
    margin-top: 14px;
    line-height: 1.2;
}

/* ---------- Gold Button ---------- */
body.rewards #content.rewards .btnGold {
    background: linear-gradient(to bottom, var(--rw-gold-light), var(--rw-gold-primary));
    border: 1px solid var(--rw-gold-primary);
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    color: white;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(144, 109, 13, 0.3);
    transition: var(--rw-transition);
    margin-top: 6px;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}
body.rewards #content.rewards .btnGold .btnLabel {
    display: inline-block;
    line-height: 1;
    text-align: center;
}
body.rewards #content.rewards .btnGold:hover:not(:disabled) {
    filter: brightness(1.05);
    box-shadow: 0 6px 20px rgba(144, 109, 13, 0.5);
    transform: translateY(-2px);
}
body.rewards #content.rewards .btnGold:active { transform: translateY(0); }
body.rewards #content.rewards .btnGold:disabled {
    background: linear-gradient(to bottom, #e5e7eb, #cbd5e1) !important;
    border-color: #94a3b8 !important;
    color: #64748b !important;
    box-shadow: none !important;
    cursor: not-allowed;
    transform: none;
    filter: grayscale(0.4);
    opacity: 0.85;
}
body.rewards #content.rewards .btnGold:disabled:hover {
    filter: grayscale(0.4);
    box-shadow: none !important;
    transform: none;
}
body.rewards #content.rewards .btnGold.btnDone {
    background: #10b981;
    border-color: #059669;
}

body.rewards #content.rewards .cardFooterText {
    margin-top: 16px;
    font-size: 0.85rem;
    color: #906d0d;
    font-weight: 600;
}
body.rewards #content.rewards .cardFooterText strong {
    color: #6d4f00;
    font-weight: 800;
}

/* ============================================================
   Prize Reveal Animation — يظهر بدلاً من الدائرة عند الاستلام
   ============================================================ */
body.rewards #content.rewards .dailyCard { position: relative; }

body.rewards #content.rewards .prizeReveal {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(255, 248, 225, 0.96) 0%, rgba(255, 252, 248, 0.92) 60%, rgba(255, 252, 248, 0) 100%);
    border-radius: 20px;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.45s ease;
}
body.rewards #content.rewards .prizeReveal.rwActive {
    opacity: 1;
    visibility: visible;
}
body.rewards #content.rewards .prizeReveal.rwFading {
    opacity: 0;
}

body.rewards #content.rewards .prizeRevealInner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    transform: scale(0.4);
    opacity: 0;
}
body.rewards #content.rewards .prizeReveal.rwActive .prizeRevealInner {
    animation: rwPrizePop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes rwPrizePop {
    0%   { transform: scale(0.3) rotate(-12deg); opacity: 0; }
    60%  { transform: scale(1.15) rotate(4deg); opacity: 1; }
    80%  { transform: scale(0.96) rotate(-2deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

body.rewards #content.rewards .prizePackage,
body.rewards #content.rewards .prizeIcon {
    width: 140px;
    height: 140px;
    object-fit: contain;
    filter: drop-shadow(0 8px 24px rgba(144, 109, 13, 0.55));
}
body.rewards #content.rewards .prizePackage {
    animation: rwPkgShake 0.9s ease-in-out forwards;
}
@keyframes rwPkgShake {
    0%   { transform: scale(1) rotate(0deg); }
    20%  { transform: scale(1.08) rotate(-6deg); }
    40%  { transform: scale(0.96) rotate(5deg); }
    60%  { transform: scale(1.08) rotate(-4deg); }
    80%  { transform: scale(0.98) rotate(3deg); }
    100% { transform: scale(1.15) rotate(0deg); }
}
body.rewards #content.rewards .prizePackage.rwBurst {
    animation: rwPkgBurst 0.3s ease-out forwards;
}
@keyframes rwPkgBurst {
    0%   { transform: scale(1.15) rotate(0deg); opacity: 1; }
    50%  { transform: scale(1.6) rotate(8deg); opacity: 0.9; filter: drop-shadow(0 0 30px #f5c14b) brightness(1.5); }
    100% { transform: scale(2.2) rotate(-4deg); opacity: 0; filter: drop-shadow(0 0 50px #fff7d6) brightness(2); }
}
body.rewards #content.rewards .prizeIcon {
    animation: rwIconReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, rwIconFloat 2s ease-in-out 0.6s infinite;
}
@keyframes rwIconReveal {
    0%   { transform: scale(0.2) rotate(-180deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes rwIconFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

body.rewards #content.rewards .prizeName {
    font-size: 1.35rem;
    font-weight: 800;
    color: #6d4f00;
    text-align: center;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
body.rewards #content.rewards .prizeReveal.rwShowGold .prizeName,
body.rewards #content.rewards .prizeReveal.rwShowIcon .prizeName {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

body.rewards #content.rewards .prizeAmount {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(to bottom, #fff8e1, #f5e1a4);
    border: 2px solid #d4af37;
    border-radius: 100px;
    padding: 8px 18px;
    font-size: 1.7rem;
    font-weight: 800;
    color: #5a3e00;
    box-shadow: 0 4px 14px rgba(144, 109, 13, 0.35), inset 0 1px 0 rgba(255,255,255,0.7);
    line-height: 1;
    animation: rwPrizeShine 1.6s ease-in-out infinite;
    direction: ltr;
    unicode-bidi: isolate;
}
@keyframes rwPrizeShine {
    0%, 100% { box-shadow: 0 4px 14px rgba(144, 109, 13, 0.35), inset 0 1px 0 rgba(255,255,255,0.7); }
    50%      { box-shadow: 0 4px 24px rgba(212, 175, 55, 0.8), inset 0 1px 0 rgba(255,255,255,0.9); }
}
body.rewards #content.rewards .prizePlus {
    color: #16a34a;
    font-size: 1.4rem;
}
body.rewards #content.rewards .prizeGold {
    min-width: 50px;
    text-align: center;
    font-family: 'Tahoma', monospace;
}
body.rewards #content.rewards .prizeAmount img.gold {
    margin: 0 2px 0 0;
    transform: scale(1.4);
}

/* Sparkles المتطايرة */
body.rewards #content.rewards .prizeSparkles {
    position: absolute;
    inset: -20px;
    pointer-events: none;
}
body.rewards #content.rewards .prizeSparkles .spark {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #fff7d6 0%, #f5c14b 60%, transparent 100%);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    opacity: 0;
}
body.rewards #content.rewards .prizeReveal.rwActive .spark {
    animation: rwSparkFly 1.6s ease-out 0.5s forwards;
}
@keyframes rwSparkFly {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20%  { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--sx, -50%), var(--sy, -50%)) scale(1.2); }
}
body.rewards #content.rewards .spark.s1 { --sx: -120px; --sy: -110px; }
body.rewards #content.rewards .spark.s2 { --sx:  120px; --sy: -110px; }
body.rewards #content.rewards .spark.s3 { --sx: -130px; --sy:   30px; }
body.rewards #content.rewards .spark.s4 { --sx:  130px; --sy:   30px; }
body.rewards #content.rewards .spark.s5 { --sx:  -80px; --sy:  120px; }
body.rewards #content.rewards .spark.s6 { --sx:   80px; --sy:  120px; }
body.rewards #content.rewards .spark.s7 { --sx:    0px; --sy: -140px; animation-delay: 0.7s !important; }
body.rewards #content.rewards .spark.s8 { --sx:    0px; --sy:  150px; animation-delay: 0.7s !important; }

/* ---------- Vote Card ---------- */
body.rewards #content.rewards .voteSection { text-align: right; }
body.rewards #content.rewards .voteHeader {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-direction: row;
}
body.rewards #content.rewards .voteHeader .iconCheck {
    width: 22px;
    height: 22px;
    color: var(--rw-gold-primary);
    flex-shrink: 0;
}
body.rewards #content.rewards .voteTitle {
    font-size: 1.2rem;
    font-weight: 800;
    color: #906d0d;
    margin: 0;
    border: none;
    background: none;
}
body.rewards #content.rewards .voteDesc {
    font-size: 0.92rem;
    color: var(--rw-text-muted);
    margin: 0 0 20px 0;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rw-gold-light);
}

/* ---------- Task List ---------- */
body.rewards #content.rewards .taskList {
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    padding: 4px 0;
}
body.rewards #content.rewards .taskTrack {
    position: absolute;
    right: 20px;
    left: auto;
    top: 20px;
    bottom: 20px;
    width: 2px;
    background: var(--rw-gold-light);
    z-index: 1;
}
body.rewards #content.rewards .taskRow {
    display: flex;
    gap: 18px;
    align-items: center;
    position: relative;
    z-index: 2;
    flex-direction: row;
}
body.rewards #content.rewards .taskBullet {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--rw-gold-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 800;
    color: var(--rw-gold-primary);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    font-family: inherit;
}
body.rewards #content.rewards .taskBullet.completed {
    background: var(--rw-gold-primary);
    color: white;
}
body.rewards #content.rewards .taskBullet .iconCheck {
    width: 20px; height: 20px;
}

body.rewards #content.rewards .taskContentBox {
    flex-grow: 1;
    background: white;
    border: 1px solid var(--rw-gold-light);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: var(--rw-transition);
}
body.rewards #content.rewards .taskContentBox:hover {
    border-color: var(--rw-gold-primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
body.rewards #content.rewards .taskRow[data-status="claimed"] .taskContentBox {
    background: rgba(224, 217, 208, 0.25);
}
body.rewards #content.rewards .taskInfo h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: var(--rw-text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: none;
}
body.rewards #content.rewards .goldBadge {
    font-size: 0.78rem;
    font-weight: 800;
    background: linear-gradient(to bottom, #f4e4b8, #c5a55a);
    color: #5a3e00;
    padding: 2px 8px;
    border-radius: 100px;
    direction: ltr;
    unicode-bidi: isolate;
}

/* ---------- Reward Chip (شارة الذهب الأنيقة) ---------- */
body.rewards #content.rewards .rewardChip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 6px 0 4px 0;
    padding: 3px 10px 3px 8px;
    background: linear-gradient(to bottom, #fff8e1, #f5e1a4);
    border: 1px solid #d4af37;
    border-radius: 100px;
    box-shadow: 0 1px 3px rgba(144, 109, 13, 0.15), inset 0 1px 0 rgba(255,255,255,0.6);
    line-height: 1;
    direction: ltr;
    unicode-bidi: isolate;
}
body.rewards #content.rewards .rewardChip .rewardAmount {
    font-weight: 800;
    color: #6d4f00;
    font-size: 0.95rem;
    line-height: 1;
}
body.rewards #content.rewards .rewardChip img.gold {
    /* استخدم تعريف .gold الأصلي من general.css — لا override للأبعاد */
    margin: 0;
    vertical-align: middle;
}

body.rewards #content.rewards .nextVoteLine {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 6px 0;
    font-size: 0.85rem;
    color: #64748b;
}
body.rewards #content.rewards .nextVoteLine .nextVoteLabel {
    font-weight: 500;
}
body.rewards #content.rewards .nextVoteLine .nextVoteTimer {
    font-weight: 800;
    color: #b45309;
    font-family: 'Tahoma', monospace;
    direction: ltr;
    unicode-bidi: isolate;
    background: #fef3c7;
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

body.rewards #content.rewards .statusPill {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 100px;
    letter-spacing: 0.02em;
}
body.rewards #content.rewards .statusPill.done    { background: #dcfce7; color: #15803d; }
body.rewards #content.rewards .statusPill.pending { background: #fef3c7; color: #b45309; }
body.rewards #content.rewards .statusPill.ready   { background: #dbeafe; color: #1d4ed8; }

/* ---------- Action Buttons ---------- */
body.rewards #content.rewards .btnAction {
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.86rem;
    cursor: pointer;
    border: none;
    transition: var(--rw-transition);
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    white-space: nowrap;
}
body.rewards #content.rewards .btnVote,
body.rewards #content.rewards .btnClaim {
    background: linear-gradient(to bottom, var(--rw-gold-light), var(--rw-gold-primary));
    color: white;
    box-shadow: 0 2px 4px rgba(144, 109, 13, 0.2);
}
body.rewards #content.rewards .btnVote:hover,
body.rewards #content.rewards .btnClaim:hover:not(:disabled) {
    transform: scale(1.04);
    filter: brightness(1.08);
    color: white;
}
body.rewards #content.rewards .btnClaim {
    background: linear-gradient(to bottom, #86efac, #16a34a);
    color: white;
}
body.rewards #content.rewards .btnClaim:hover:not(:disabled) {
    background: linear-gradient(to bottom, #86efac, #15803d);
}
body.rewards #content.rewards .btnClaimed {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    font-size: 0.78rem;
}
body.rewards #content.rewards .btnClaimed .cooldownLabel {
    font-weight: 600;
    color: #64748b;
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
}

body.rewards #content.rewards .footerNote {
    text-align: center;
    margin: 20px 0 0 0;
    font-size: 0.75rem;
    color: var(--rw-text-muted);
}
body.rewards #content.rewards .emptyState {
    text-align: center;
    padding: 30px;
    color: var(--rw-text-muted);
    font-style: italic;
}

/* ---------- Responsiveness (mobile viewport 620) ---------- */
@media (max-width: 640px) {
    body.rewards #content.rewards .premiumCard {
        padding: 22px 18px;
        border-radius: 16px;
    }
    body.rewards #content.rewards .cardHeader h1 { font-size: 1.4rem; }
    body.rewards #content.rewards .timerOuter { width: 160px; height: 160px; }
    body.rewards #content.rewards .timerVal { font-size: 1.4rem; }
    body.rewards #content.rewards .taskContentBox {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 14px;
    }
    body.rewards #content.rewards .btnAction { width: 100%; }
    body.rewards #content.rewards .taskRow { gap: 10px; }
    body.rewards #content.rewards .taskTrack { right: 19px; left: auto; }
}

/* ============================================================
   Toast — مستقل عن .rewards container
   ============================================================ */
.rwToast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #1e293b;
    color: white;
    padding: 12px 22px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    max-width: 90%;
    text-align: center;
    pointer-events: none;
    font-family: inherit;
    direction: rtl;
}
.rwToast.rwShow {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.rwToast.rwok   { background: linear-gradient(to left, #16a34a, #15803d); }
.rwToast.rwwarn { background: linear-gradient(to left, #d97706, #b45309); }
.rwToast.rwerr  { background: linear-gradient(to left, #dc2626, #991b1b); }

/* ============================================================
   sideinfo box — تايمر الجائزة (سطر في sidebarBoxInfobox)
   ============================================================ */
#sidebarBoxInfobox li.rewardsReadyItem {
    font-weight: 700;
    color: #b45309;
}
#sidebarBoxInfobox li.rewardsReadyItem a {
    color: #b45309 !important;
    font-weight: 700;
    text-decoration: none;
}
#sidebarBoxInfobox li.rewardsReadyItem a:hover {
    text-decoration: underline;
}
#sidebarBoxInfobox li.rewardsReadyItem.ready {
    color: #15803d;
}
#sidebarBoxInfobox li.rewardsReadyItem.ready a {
    color: #15803d !important;
    animation: rwBlink 1.6s ease-in-out infinite;
}
@keyframes rwBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}
