#rewards-button {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 64px;
    height: 64px;
    padding: 0;
    border: 4px solid #fff7df;
    border-radius: 18px;
    background:
        radial-gradient(circle at 28% 18%, rgba(255,255,255,0.9), transparent 34%),
        linear-gradient(160deg, #ffe47a 0%, #ffae35 48%, #d45a24 100%);
    color: #472107;
    cursor: pointer;
    box-shadow: 0 7px 0 #894113, 0 14px 24px rgba(0,0,0,0.34), inset 0 3px 0 rgba(255,255,255,0.72);
    z-index: 8;
    pointer-events: auto;
    user-select: none;
    transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

#rewards-button:hover {
    filter: brightness(1.07);
    transform: translateY(-2px);
}

#rewards-button:active {
    transform: translateY(4px) scale(0.96);
    box-shadow: 0 3px 0 #894113, 0 8px 16px rgba(0,0,0,0.3), inset 0 3px 0 rgba(255,255,255,0.72);
}

#rewards-button.ready {
    animation: rewardsReadyPulse 1250ms ease-in-out infinite;
    box-shadow: 0 7px 0 #894113, 0 14px 24px rgba(0,0,0,0.34), 0 0 24px rgba(255,222,74,0.95), inset 0 3px 0 rgba(255,255,255,0.72);
}

#rewards-button.locked {
    background:
        radial-gradient(circle at 28% 18%, rgba(255,255,255,0.85), transparent 34%),
        linear-gradient(160deg, #dbe4eb 0%, #97a4ae 50%, #5e6973 100%);
    box-shadow: 0 7px 0 #38424b, 0 14px 24px rgba(0,0,0,0.34), inset 0 3px 0 rgba(255,255,255,0.66);
}

.rewards-gift-icon {
    position: absolute;
    left: 14px;
    top: 19px;
    width: 30px;
    height: 28px;
    border: 4px solid currentColor;
    border-radius: 7px;
    background: rgba(255,255,255,0.28);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.45);
}

.rewards-gift-icon::before {
    content: "";
    position: absolute;
    left: -6px;
    top: -11px;
    width: 34px;
    height: 8px;
    border: 4px solid currentColor;
    border-radius: 8px 8px 3px 3px;
    background: rgba(255,255,255,0.34);
}

.rewards-gift-icon::after {
    content: "";
    position: absolute;
    left: 10px;
    top: -14px;
    width: 10px;
    height: 42px;
    border-radius: 999px;
    background: currentColor;
}

.rewards-gift-icon span {
    position: absolute;
    left: 3px;
    top: -22px;
    width: 20px;
    height: 16px;
    border: 4px solid currentColor;
    border-bottom: 0;
    border-radius: 14px 14px 2px 2px;
}

.rewards-badge {
    position: absolute;
    right: -9px;
    top: -10px;
    min-width: 23px;
    height: 23px;
    padding: 0 5px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 3px solid #fff7df;
    border-radius: 999px;
    background: #e8332f;
    color: #fff7df;
    font-family: "Cooper Black", "Comic Sans MS", "Arial Black", sans-serif;
    font-size: 0.82rem;
    line-height: 1;
    text-shadow: 1px 1px 0 #7d160f;
    box-shadow: 0 3px 0 #8d211a;
    box-sizing: border-box;
}

.rewards-badge.show {
    display: flex;
}

#rewards-overlay {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    z-index: 39;
    background: radial-gradient(ellipse at center, rgba(31,21,7,0.42), rgba(6,4,2,0.74));
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#rewards-overlay.open {
    display: grid;
    animation: refillFadeIn 180ms ease;
}

#rewards-panel {
    width: min(460px, calc(100vw - 26px));
    max-height: min(720px, calc(100vh - 28px));
    overflow: auto;
    padding: 18px;
    border: 4px solid #fff7df;
    border-radius: 24px;
    background:
        radial-gradient(circle at 18% 10%, rgba(255,255,255,0.78), transparent 42%),
        linear-gradient(145deg, #fff4ad 0%, #ffc34d 46%, #df7340 100%);
    color: #3f2108;
    font-family: "Cooper Black", "Comic Sans MS", "Arial Black", sans-serif;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.55);
    box-shadow: 0 22px 48px rgba(0,0,0,0.45), inset 0 4px 0 rgba(255,255,255,0.8);
    animation: refillPopIn 300ms cubic-bezier(0.34,1.56,0.64,1);
    box-sizing: border-box;
}

.rewards-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.rewards-title {
    font-size: 1.55rem;
    line-height: 1;
}

.rewards-subtitle {
    margin-top: 5px;
    max-width: 260px;
    color: #744016;
    font-size: 0.72rem;
    line-height: 1.2;
}

.rewards-close,
.rewards-action {
    border: 3px solid #fff7df;
    border-radius: 14px;
    font-family: inherit;
    font-size: 0.78rem;
    color: #3e2109;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(105,52,14,0.65), inset 0 2px 0 rgba(255,255,255,0.62);
    transition: transform 150ms ease, filter 150ms ease;
}

.rewards-close {
    padding: 8px 10px;
    background: linear-gradient(180deg, #fff9c9, #e5a43a);
}

.rewards-action {
    width: 100%;
    min-height: 44px;
    margin-top: 12px;
    padding: 10px 12px;
}

.rewards-action.primary {
    background: linear-gradient(180deg, #f7ffb0, #68d26a);
    box-shadow: 0 5px 0 #267933, inset 0 2px 0 rgba(255,255,255,0.68);
}

.rewards-action.secondary {
    background: linear-gradient(180deg, #fff6b8, #eaa33a);
}

.rewards-action:disabled {
    cursor: default;
    filter: saturate(0.62) brightness(0.9);
    opacity: 0.72;
}

.rewards-close:hover,
.rewards-action:not(:disabled):hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

#rewards-content {
    display: grid;
    gap: 12px;
}

.rewards-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.rewards-tab {
    min-height: 42px;
    border: 3px solid #fff7df;
    border-radius: 14px;
    background: linear-gradient(180deg, #fff9cf, #e8a843);
    color: #3f2108;
    cursor: pointer;
    font-family: "Cooper Black", "Comic Sans MS", "Arial Black", sans-serif;
    font-size: 0.78rem;
    box-shadow: 0 4px 0 #8f4c16, inset 0 2px 0 rgba(255,255,255,0.68);
}

.rewards-tab.active {
    background: linear-gradient(180deg, #e4ff9a, #50c96b);
    box-shadow: 0 4px 0 #267933, inset 0 2px 0 rgba(255,255,255,0.7);
}

.rewards-card,
.rewards-locked-card {
    padding: 14px;
    border: 3px solid rgba(255,247,223,0.94);
    border-radius: 18px;
    background: rgba(255,255,255,0.36);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.58), 0 7px 16px rgba(91,46,14,0.18);
}

.rewards-card.ready {
    background:
        radial-gradient(circle at 85% 20%, rgba(255,255,255,0.82), transparent 38%),
        linear-gradient(155deg, rgba(255,255,255,0.44), rgba(255,239,119,0.58));
}

.rewards-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rewards-eyebrow {
    color: #8a4511;
    font-size: 0.66rem;
    text-transform: uppercase;
}

.rewards-card-title {
    margin-top: 2px;
    font-size: 1rem;
    line-height: 1.08;
}

.rewards-card-copy {
    margin-top: 9px;
    color: #744016;
    font-family: Arial, sans-serif;
    font-weight: 900;
    font-size: 0.78rem;
    line-height: 1.25;
    text-shadow: none;
}

.rewards-streak-meter,
.rewards-week-count {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    min-width: 58px;
    min-height: 52px;
    padding: 6px;
    border: 3px solid #fff7df;
    border-radius: 16px;
    background: linear-gradient(180deg, #fff8c9, #ffa83d);
    box-shadow: 0 4px 0 #9b541a;
    box-sizing: border-box;
}

.rewards-streak-meter span,
.rewards-week-count {
    font-size: 1.18rem;
    line-height: 1;
}

.rewards-streak-meter small {
    margin-top: 2px;
    color: #784017;
    font-size: 0.55rem;
    line-height: 1;
}

.reward-week-dots {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    margin-top: 12px;
}

.reward-dot {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    min-width: 0;
    border: 3px solid rgba(255,247,223,0.9);
    border-radius: 999px;
    background: rgba(93,53,20,0.22);
    color: rgba(67,32,9,0.65);
    font-size: 0.72rem;
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.26);
}

.reward-dot.filled {
    background: linear-gradient(180deg, #d7ff88, #40bf5b);
    color: #173514;
    box-shadow: 0 3px 0 #20713a, inset 0 2px 0 rgba(255,255,255,0.66);
}

.reward-dot.claimed {
    filter: saturate(0.7);
}

.rewards-last {
    padding: 9px 11px;
    border-radius: 14px;
    background: rgba(69,36,11,0.16);
    color: #5e310d;
    font-family: Arial, sans-serif;
    font-size: 0.8rem;
    font-weight: 900;
    text-shadow: none;
    text-align: center;
}

.rewards-last.rare {
    background: rgba(255,244,129,0.46);
    color: #3f2108;
}

.achievements-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 3px solid rgba(255,247,223,0.94);
    border-radius: 18px;
    background:
        radial-gradient(circle at 88% 18%, rgba(255,255,255,0.78), transparent 36%),
        linear-gradient(145deg, rgba(255,255,255,0.42), rgba(255,220,94,0.54));
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.58), 0 7px 16px rgba(91,46,14,0.18);
}

.achievement-ring {
    --achievement-progress: 0;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border: 3px solid #fff7df;
    border-radius: 50%;
    background:
        conic-gradient(#37b95a calc(var(--achievement-progress) * 1turn), rgba(93,53,20,0.2) 0),
        radial-gradient(circle, #fff7c3 0 54%, transparent 55%);
    box-shadow: 0 5px 0 #8f4c16, inset 0 2px 0 rgba(255,255,255,0.65);
}

.achievement-ring span {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff3a8;
    color: #3f2108;
    font-size: 0.72rem;
}

.achievements-list {
    display: grid;
    gap: 9px;
    max-height: min(430px, 48vh);
    overflow: auto;
    padding-right: 2px;
}

.achievement-card {
    display: grid;
    grid-template-columns: 45px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 3px solid rgba(255,247,223,0.82);
    border-radius: 16px;
    background: rgba(255,255,255,0.3);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.46), 0 5px 12px rgba(91,46,14,0.14);
}

.achievement-card.unlocked {
    background:
        radial-gradient(circle at 90% 14%, rgba(255,255,255,0.78), transparent 34%),
        linear-gradient(135deg, rgba(225,255,145,0.62), rgba(255,213,82,0.52));
}

.achievement-medal {
    position: relative;
    width: 38px;
    height: 38px;
    border: 3px solid #fff7df;
    border-radius: 50%;
    background: linear-gradient(160deg, #b9a58d, #6f5c4c);
    box-shadow: 0 4px 0 #5f4938, inset 0 2px 0 rgba(255,255,255,0.48);
}

.achievement-card.unlocked .achievement-medal {
    background:
        radial-gradient(circle at 34% 25%, #fffad1 0 18%, transparent 19%),
        linear-gradient(160deg, #ffe76f, #d47c24);
    box-shadow: 0 4px 0 #8c4a14, 0 0 15px rgba(255,232,95,0.62), inset 0 2px 0 rgba(255,255,255,0.58);
}

.achievement-medal::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 8px;
    width: 8px;
    height: 15px;
    border-right: 4px solid rgba(255,247,223,0.94);
    border-bottom: 4px solid rgba(255,247,223,0.94);
    transform: rotate(42deg);
}

.achievement-body {
    min-width: 0;
}

.achievement-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.achievement-title {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 0.84rem;
    line-height: 1.05;
}

.achievement-count {
    flex: 0 0 auto;
    color: #704014;
    font-family: Arial, sans-serif;
    font-size: 0.68rem;
    font-weight: 900;
    text-shadow: none;
}

.achievement-copy {
    margin-top: 4px;
    color: #744016;
    font-family: Arial, sans-serif;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1.18;
    text-shadow: none;
}

.achievement-progress {
    height: 8px;
    margin-top: 8px;
    border: 2px solid rgba(255,247,223,0.9);
    border-radius: 999px;
    overflow: hidden;
    background: rgba(93,53,20,0.24);
}

.achievement-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #42c963, #fff36f);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.48);
}

.reward-burst {
    position: fixed;
    right: 24px;
    bottom: 94px;
    z-index: 55;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(320px, calc(100vw - 44px));
    padding: 13px 15px;
    border: 4px solid #fff7df;
    border-radius: 20px;
    background: linear-gradient(145deg, #f9ffac, #5fcd70);
    color: #173514;
    font-family: "Cooper Black", "Comic Sans MS", "Arial Black", sans-serif;
    font-size: 0.92rem;
    line-height: 1.1;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.55);
    box-shadow: 0 9px 0 #277c3a, 0 18px 32px rgba(0,0,0,0.36);
    animation: rewardBurstPop 1700ms cubic-bezier(0.34,1.56,0.64,1) forwards;
}

.reward-burst.rare {
    background: linear-gradient(145deg, #fff9a6, #ffca42 48%, #dd5ac9 100%);
    box-shadow: 0 9px 0 #8f3f8e, 0 18px 32px rgba(0,0,0,0.36), 0 0 22px rgba(255,230,82,0.72);
}

.reward-burst-seed {
    flex: 0 0 auto;
    width: 26px;
    height: 32px;
    border-radius: 50% 50% 42% 42%;
    background:
        radial-gradient(circle at 36% 28%, #fff9c2 0 18%, transparent 19%),
        linear-gradient(160deg, #6b3b15, #2f1908);
    box-shadow: inset 0 3px 0 rgba(255,255,255,0.22);
}

.reward-burst-copy {
    min-width: 0;
    overflow-wrap: anywhere;
}

.achievement-unlock-banner {
    position: fixed;
    left: 50%;
    top: 16px;
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 13px;
    width: min(520px, calc(100vw - 30px));
    padding: 14px 16px;
    border: 4px solid #fff7df;
    border-radius: 22px;
    background:
        radial-gradient(circle at 15% 18%, rgba(255,255,255,0.88), transparent 33%),
        linear-gradient(145deg, #fff28a, #ffae35 52%, #df5c38);
    color: #3f2108;
    font-family: "Cooper Black", "Comic Sans MS", "Arial Black", sans-serif;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.58);
    box-shadow: 0 10px 0 #8f4c16, 0 22px 44px rgba(0,0,0,0.38), 0 0 24px rgba(255,230,83,0.62);
    transform: translate(-50%, -130%) scale(0.9);
    animation: achievementUnlockDrop 3600ms cubic-bezier(0.34,1.56,0.64,1) forwards;
}

.achievement-unlock-banner.mine {
    background:
        radial-gradient(circle at 15% 18%, rgba(255,255,255,0.9), transparent 33%),
        linear-gradient(145deg, #e5ff8d, #50ca69 48%, #209c7a);
    box-shadow: 0 10px 0 #20713a, 0 22px 44px rgba(0,0,0,0.38), 0 0 26px rgba(117,255,128,0.66);
}

.achievement-unlock-medal {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 4px solid #fff7df;
    border-radius: 50%;
    background:
        radial-gradient(circle at 34% 25%, #fffad1 0 18%, transparent 19%),
        linear-gradient(160deg, #ffe76f, #d47c24);
    box-shadow: 0 4px 0 #8c4a14, inset 0 2px 0 rgba(255,255,255,0.58);
}

.achievement-unlock-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.achievement-unlock-copy strong {
    font-size: 0.76rem;
    text-transform: uppercase;
    color: #744016;
}

.achievement-unlock-copy span {
    overflow-wrap: anywhere;
    font-size: 1.12rem;
    line-height: 1.05;
}

@keyframes rewardsReadyPulse {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.04); }
}

@keyframes rewardBurstPop {
    0% { opacity: 0; transform: translateY(24px) scale(0.78) rotate(-2deg); }
    14% { opacity: 1; transform: translateY(0) scale(1.04) rotate(1deg); }
    72% { opacity: 1; transform: translateY(-5px) scale(1); }
    100% { opacity: 0; transform: translateY(-20px) scale(0.94); }
}

@keyframes achievementUnlockDrop {
    0% { opacity: 0; transform: translate(-50%, -130%) scale(0.9) rotate(-1deg); }
    12% { opacity: 1; transform: translate(-50%, 0) scale(1.03) rotate(1deg); }
    78% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -32px) scale(0.96); }
}

@media (max-width: 540px) {
    #rewards-button {
        right: 14px;
        bottom: 16px;
        width: 58px;
        height: 58px;
        border-radius: 16px;
    }

    .rewards-gift-icon {
        left: 12px;
        top: 18px;
    }

    #rewards-panel {
        padding: 15px;
    }

    .rewards-title {
        font-size: 1.32rem;
    }
}
