/* ===== Daily Task (每日任务) — standalone module ===== */

/* Full page (same as the decoration page), not a centered popup. */
.dtask-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: #0d0c1c;
    z-index: 10001;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

/* Top bar matches the other full-page views (back arrow + centered title). */
.dtask-topbar {
    display: flex; align-items: center; padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #1e1e3a; flex-shrink: 0;
}
.dtask-back {
    background: none; border: none; font-size: 24px; cursor: pointer;
    color: #fff; padding: 0 8px 0 0; line-height: 1;
}
.dtask-topbar-title {
    flex: 1; text-align: center; font-size: 17px; font-weight: 600; color: #fff;
    margin-right: 32px;
}

.dtask-modal {
    position: relative;
    flex: 1; min-height: 0; width: 100%;
    display: flex;
    background: radial-gradient(120% 120% at 50% 0%, #17162e 0%, #0d0c1c 55%, #08070f 100%);
    overflow: hidden;
    box-sizing: border-box;
}

/* While the task/sign-in APIs are still loading the panel shows only a
   spinner, so no partially filled layout is painted first. */
.dtask-overlay.dtask-loading .dtask-sidebar,
.dtask-overlay.dtask-loading .dtask-scroll > *:not(.dtask-spinner) {
    visibility: hidden;
}
.dtask-spinner { display: none; }
.dtask-overlay.dtask-loading .dtask-spinner {
    display: block;
    width: 28px; height: 28px;
    margin: 80px auto 0;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #8a5cff;
    border-radius: 50%;
    animation: dtaskSpin 0.8s linear infinite;
}
@keyframes dtaskSpin { to { transform: rotate(360deg); } }

/* ===== Left sidebar ===== */
.dtask-sidebar {
    width: 200px; flex-shrink: 0;
    padding: 14px 12px;
    background: linear-gradient(180deg, rgba(30, 28, 56, 0.55), rgba(16, 15, 32, 0.55));
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex; flex-direction: column;
    overflow-y: auto;
}
.dtask-sidebar-title {
    font-size: 15px; font-weight: 700; color: #fff;
    margin: 2px 0 12px 2px;
}
.dtask-reward-card {
    position: relative;
    box-sizing: border-box;
    background: linear-gradient(160deg, #23213f, #16152a);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 8px 8px 6px;
    margin-bottom: 10px;
    text-align: center;
}
.dtask-reward-badge {
    position: absolute; top: 0; left: 0;
    background: linear-gradient(135deg, #8a5cff, #6a3df0);
    color: #fff; font-size: 12px; font-weight: 700;
    padding: 3px 12px;
    border-radius: 12px 0 12px 0;
}
.dtask-reward-img {
    height: 48px; margin: 3px 0 3px;
    display: flex; align-items: center; justify-content: center;
}
.dtask-reward-img img {
    max-height: 48px; max-width: 96%;
    filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.45));
}
.dtask-reward-points {
    font-size: 20px; font-weight: 800;
    background: linear-gradient(180deg, #ffe7a8, #f5b53c);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.dtask-reward-unit { font-size: 12px; color: #9a99b5; margin-top: 2px; }

.dtask-days-card {
    box-sizing: border-box;
    background: linear-gradient(160deg, #201e3a, #14132700);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px; padding: 8px 8px;
    text-align: center; margin-bottom: 10px;
}
.dtask-days-label { font-size: 13px; color: #c7c6dd; margin-bottom: 4px; }
.dtask-days-num {
    font-size: 24px; font-weight: 800;
    background: linear-gradient(180deg, #ffe7a8, #f5b53c);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.dtask-days-num span { font-size: 14px; color: #c7c6dd; -webkit-text-fill-color: #c7c6dd; margin-left: 3px; }
.dtask-days-streak { font-size: 12px; color: #ff8a3d; margin-top: 6px; }

.dtask-calendar-btn {
    margin-top: auto;
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px; padding: 9px 12px;
    color: #e4e3f2; font-size: 14px; font-weight: 600;
    cursor: pointer;
}
.dtask-calendar-btn:hover { background: rgba(255, 255, 255, 0.09); }

/* ===== Main area ===== */
.dtask-main {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
    overflow: hidden;
}

.dtask-scroll {
    flex: 1; overflow-y: auto;
    padding: 14px 18px 24px;
}

.dtask-section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin: 20px 0 10px;
}
.dtask-section-head:first-child { margin-top: 0; }
.dtask-section-title { font-size: 16px; font-weight: 700; color: #fff; }
.dtask-section-title .dtask-arrow { color: #f3b73f; margin-left: 4px; }
.dtask-unlock-tip {
    margin-left: 10px; margin-right: auto; padding: 4px 12px; border-radius: 8px;
    background: rgba(243, 183, 63, 0.1);
    border: 1px solid rgba(243, 183, 63, 0.45);
    color: #f3b73f; font-size: 13px; font-weight: 600;
}

.dtask-panel {
    background: linear-gradient(180deg, rgba(30, 28, 56, 0.5), rgba(18, 17, 36, 0.5));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px; padding: 12px;
}

/* ===== Sign-in row ===== */
.dtask-signin-row {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px;
    align-items: stretch;
}
.dtask-signin-cell {
    position: relative; overflow: hidden;
    background: #191830;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 8px 6px 10px;
    text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.dtask-signin-cell.signed {
    background: linear-gradient(180deg, #2a2350, #1d1937);
    border-color: rgba(155, 110, 240, 0.5);
}
.dtask-signin-cell.available {
    background: linear-gradient(180deg, #2c2717, #1c1a10);
    border-color: #f3b73f;
    box-shadow: 0 0 0 1px #f3b73f, 0 6px 18px rgba(243, 183, 63, 0.25);
}
/* corner ribbon on already signed days */
.dtask-signin-ribbon {
    position: absolute; left: -26px; top: 6px; width: 76px;
    transform: rotate(-45deg);
    background: linear-gradient(90deg, #7b5cf0, #a86df4);
    color: #fff; font-size: 10px; line-height: 16px; font-weight: 700;
}
.dtask-signin-day { font-size: 13px; color: #e6e5f5; font-weight: 600; }
.dtask-signin-icon {
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.dtask-signin-icon img { max-width: 52px; max-height: 52px; object-fit: contain; }
/* chat bubble & entry effect previews are wide strips: use the whole card width */
.dtask-signin-cell.bubble .dtask-signin-icon { width: calc(100% + 10px); margin: 0 -5px; }
.dtask-signin-cell.bubble .dtask-signin-icon img {
    width: 100%; height: 100%; max-width: none; max-height: none;
}
.dtask-signin-cell.pending .dtask-signin-icon img { filter: grayscale(0.5) brightness(0.8); }
.dtask-signin-label { font-size: 12px; color: #d8d7ea; }
.dtask-signin-cell.available .dtask-signin-label { color: #ffd76a; font-weight: 700; }
.dtask-signin-cell.pending .dtask-signin-label { color: #9a99b4; }
.dtask-signin-foot {
    margin-top: 2px; font-size: 12px; width: 100%;
    padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.06);
}
.dtask-signin-foot.done { color: #b39bf5; }
.dtask-signin-foot.lock { color: #7c7b94; }
.dtask-signin-btn {
    margin-top: 2px; width: 100%; padding: 5px 0;
    border: none; border-radius: 8px; cursor: pointer;
    background: linear-gradient(180deg, #ffd76a, #e0a021);
    color: #4a3200; font-size: 13px; font-weight: 700;
}
.dtask-signin-btn:disabled {
    background: #3a3952; color: #8a89a3; cursor: not-allowed;
}

/* ===== Sign-in reward popup ===== */
.dtask-signpop-mask {
    position: fixed; inset: 0; z-index: 10010;
    background: rgba(0, 0, 0, 0.65);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.dtask-signpop {
    position: relative; width: 100%; max-width: 320px;
    background: radial-gradient(120% 80% at 50% 0%, #3a2a63 0%, #1a1530 60%, #14112a 100%);
    border: 1px solid rgba(168, 109, 244, 0.35);
    border-radius: 18px; padding: 22px 20px 20px; text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.dtask-signpop-x {
    position: absolute; top: 10px; right: 12px;
    background: none; border: none; cursor: pointer;
    color: #cfcbe6; font-size: 24px; line-height: 1;
}
.dtask-signpop-title {
    font-size: 24px; font-weight: 800; color: #ffd76a;
    text-shadow: 0 2px 10px rgba(255, 200, 90, 0.35);
}
.dtask-signpop-sub { font-size: 13px; color: #bdb9d6; margin-top: 4px; }
.dtask-signpop-pic { margin: 14px 0 10px; }
.dtask-signpop-pic img { max-width: 100%; max-height: 180px; object-fit: contain; }
.dtask-betpop-coin {
    margin: 16px auto 10px; width: 92px; height: 92px; border-radius: 50%;
    background: radial-gradient(circle at 50% 40%, #ffe89a, #e0a021 60%, #8a5f0d);
    display: flex; align-items: center; justify-content: center;
    color: #7a5200; font-size: 20px; font-weight: 800;
}
.dtask-betpop-value { font-size: 26px; font-weight: 800; color: #fff; }
.dtask-betpop-value span { font-size: 15px; color: #c3bfdd; margin-left: 4px; }
.dtask-signpop-name { font-size: 17px; font-weight: 700; color: #fff; }
.dtask-signpop-type { font-size: 13px; color: #c3bfdd; margin-top: 4px; }
.dtask-signpop-tip { font-size: 12px; color: #8d8aa8; margin-top: 12px; }
.dtask-signpop-ok {
    margin-top: 16px; width: 100%; padding: 11px 0;
    border: none; border-radius: 24px; cursor: pointer;
    background: linear-gradient(180deg, #ffd76a, #e0a021);
    color: #4a3200; font-size: 16px; font-weight: 700;
}

/* ===== Task list ===== */
.dtask-task-item {
    display: flex; align-items: center;
    background: #191830;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.dtask-task-item:last-child { margin-bottom: 0; }
.dtask-task-icon {
    width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.dtask-task-icon img { width: 32px; height: 32px; object-fit: cover; }
.dtask-task-info { flex: 1; min-width: 0; margin-left: 12px; }
.dtask-task-title { font-size: 14px; font-weight: 600; color: #fff; }
.dtask-task-desc { font-size: 12px; color: #8b8aa5; margin-top: 3px; }
.dtask-task-progress {
    font-size: 15px; color: #e4e3f2; font-weight: 600;
    flex-shrink: 0; margin: 0 14px; min-width: 44px; text-align: center;
}
.dtask-task-state {
    flex-shrink: 0; min-width: 74px; text-align: right;
    font-size: 13px; font-weight: 600;
}
.dtask-task-state.done { color: #b6a4ff; }
.dtask-task-state.todo { color: #7c7b94; }

/* ===== Bet task ===== */
.dtask-new-badge {
    display: inline-block; vertical-align: 2px;
    background: linear-gradient(135deg, #ff5f7a, #e63757);
    color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 0.5px;
    padding: 1px 7px; border-radius: 8px; margin-right: 7px;
}
.dtask-bet { margin-top: 0; }
.dtask-bet-desc { font-size: 12px; color: #9a99b5; line-height: 1.6; }
.dtask-bet-desc-sub { color: #6f6e8a; }

.dtask-bet-tiers {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
    margin: 8px 0;
}
.dtask-bet-tier {
    background: #191830;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px; padding: 7px 8px;
    text-align: center;
}
.dtask-bet-tier.reached {
    background: linear-gradient(180deg, #2c2717, #1c1a10);
    border-color: rgba(243, 183, 63, 0.7);
}
.dtask-bet-tier-label { font-size: 12px; color: #c7c6dd; }
.dtask-bet-tier-reward {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 3px;
}
.dtask-bet-tier-reward img { width: 26px; height: 26px; object-fit: contain; }
.dtask-bet-tier-num {
    font-size: 20px; font-weight: 800; line-height: 1;
    background: linear-gradient(180deg, #ffe7a8, #f5b53c);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.dtask-bet-tier-unit { font-size: 12px; color: #9a99b5; }

.dtask-bet-foot { display: flex; align-items: center; gap: 18px; }
.dtask-bet-progress { flex: 1; min-width: 0; }
.dtask-bet-progress-head {
    display: flex; align-items: center; gap: 5px;
    font-size: 12px; color: #9a99b5;
}
.dtask-bet-amount { margin-left: 4px; color: #c7c6dd; }
.dtask-bet-amount b {
    font-size: 16px; font-weight: 800; margin-right: 2px;
    background: linear-gradient(180deg, #ffe7a8, #f5b53c);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.dtask-bet-bar {
    position: relative; height: 8px; margin-top: 6px;
    background: rgba(255, 255, 255, 0.08); border-radius: 5px;
}
.dtask-bet-bar-fill {
    height: 100%; width: 0; border-radius: 5px;
    background: linear-gradient(90deg, #f5b53c, #ffe08a);
    box-shadow: 0 0 10px rgba(243, 183, 63, 0.45);
    transition: width 0.4s ease;
}
.dtask-bet-marks { position: absolute; inset: 0; }
.dtask-bet-mark {
    position: absolute; top: 50%; width: 8px; height: 8px;
    transform: translate(-50%, -50%); border-radius: 50%;
    background: #322f4d; border: 1px solid rgba(255, 255, 255, 0.18);
}
.dtask-bet-labels { position: relative; height: 15px; margin-top: 3px; }
.dtask-bet-label {
    position: absolute; transform: translateX(-50%);
    font-size: 11px; color: #8b8aa5; white-space: nowrap;
}
.dtask-bet-action { flex-shrink: 0; text-align: center; }
.dtask-bet-btn {
    min-width: 150px;
    padding: 9px 26px; border-radius: 22px; border: none; cursor: pointer;
    font-size: 15px; font-weight: 800; color: #4a2c00;
    background: linear-gradient(135deg, #ffe08a, #f0a92c);
    box-shadow: 0 6px 16px rgba(240, 169, 44, 0.3);
}
.dtask-bet-btn:disabled {
    background: rgba(255, 255, 255, 0.08); color: #7c7b94;
    box-shadow: none; cursor: not-allowed;
}
.dtask-bet-claimed { font-size: 12px; color: #9a99b5; margin-top: 6px; }

/* ===== Responsive (mobile / narrow) ===== */
@media (max-width: 820px) {
    .dtask-overlay { padding: 0; }
    /* Whole modal becomes one vertical scroll container (no nested inner scroll). */
    .dtask-modal {
        display: block;
        max-width: 100%; width: 100%; max-height: 100%;
        border-radius: 0; border: none;
        overflow-y: auto; -webkit-overflow-scrolling: touch;
    }
    /* Sidebar stacks vertically; the 3 reward cards go in a 3-column grid. */
    .dtask-sidebar {
        width: auto; display: block;
        border-right: none; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        overflow: visible; padding: 14px;
    }
    #dtaskRewardList {
        display: grid; grid-template-columns: repeat(3, 1fr);
        gap: 8px; margin-bottom: 12px;
    }
    .dtask-reward-card { margin-bottom: 0; }
    .dtask-reward-img { height: 60px; }
    .dtask-reward-img img { max-height: 60px; }
    .dtask-reward-points { font-size: 20px; }
    .dtask-days-card { margin-bottom: 12px; }
    .dtask-calendar-btn { width: 100%; margin-top: 0; }
    .dtask-main { display: block; overflow: visible; }
        .dtask-scroll { flex: none; overflow: visible; padding: 14px 14px 28px; }
    .dtask-bet-foot { flex-direction: column; align-items: stretch; gap: 12px; }
    .dtask-bet-action { width: 100%; }
    .dtask-bet-btn { width: 100%; }
}

@media (max-width: 520px) {
    .dtask-signin-row { grid-template-columns: repeat(3, 1fr); }
    .dtask-signin-icon { width: 42px; height: 42px; }
    .dtask-signin-icon img { max-width: 42px; max-height: 42px; }
    .dtask-bet-tiers { gap: 6px; }
    .dtask-bet-tier { padding: 6px 4px; }
    .dtask-bet-tier-label { font-size: 11px; }
    .dtask-bet-tier-reward { gap: 3px; }
    .dtask-bet-tier-reward img { width: 20px; height: 20px; }
    .dtask-bet-tier-num { font-size: 17px; }
    .dtask-task-progress { margin: 0 8px; min-width: 36px; font-size: 14px; }
    .dtask-task-state { min-width: 56px; }
    }

/* Floating daily-task button: draggable, shown on the main tabs */
.dtask-float {
    position: fixed;
    right: 12px;
    bottom: 110px;
    width: 64px;
    z-index: 900;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    display: none;
}
.dtask-float-icon { width: 64px; height: auto; display: block; pointer-events: none; }
.dtask-float-count {
    position: absolute;
    left: 50.5%;
    top: 91%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    color: #ffe9c9;
    letter-spacing: .5px;
    pointer-events: none;
}
.dtask-float-dbg {
    position: fixed;
    left: 4px;
    bottom: 4px;
    z-index: 9999;
    max-width: 96vw;
    padding: 4px 6px;
    background: rgba(0,0,0,.72);
    color: #7CFC7C;
    font-size: 10px;
    line-height: 1.3;
    word-break: break-all;
    pointer-events: none;
}
