/* TAOQI Minimal Ceramic Article Reward Modal & Mobile Bottom Sheet v0.9.1 */
/* Progressive enhancement: hide legacy JustNews 160px hover popover only after JS initializes */
html.tq-rw-ready .entry-action .btn-dashang .dashang-img,
html.tq-rw-ready .entry-bar .meta-item.dashang .dashang-img {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.entry-action .btn-dashang {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.entry-action .btn-dashang:focus-visible,
.entry-bar .meta-item.dashang:focus-visible {
    outline: 2px solid var(--tq-accent, #8e24aa);
    outline-offset: 2px;
}

body.tq-rw-lock {
    overflow: hidden !important;
}

.tq-rw-modal[hidden] {
    display: none !important;
}

.tq-rw-modal {
    position: fixed;
    inset: 0;
    z-index: 100030;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.tq-rw-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.tq-rw-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.46);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.tq-rw-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 376px;
    overflow: hidden;
    padding: 22px 22px 20px;
    border-radius: 16px;
    background: var(--tq-surface, #ffffff);
    border: 1px solid var(--tq-border, rgba(33, 56, 75, 0.10));
    color: var(--tq-ink, #21384b);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18), 0 4px 14px rgba(33, 56, 75, 0.08);
    text-align: center;
    transform: translateY(10px) scale(0.98);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.tq-rw-modal.is-open .tq-rw-dialog {
    transform: translateY(0) scale(1);
}

.tq-rw-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #07c160 0%, #16b96a 100%);
}

.tq-rw-modal.is-alipay .tq-rw-bar {
    background: linear-gradient(90deg, #1677ff 0%, #3b8eff 100%);
}

.tq-rw-handle {
    display: none;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: rgba(33, 56, 75, 0.18);
    margin: -6px auto 12px;
}

.tq-rw-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.tq-rw-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.tq-rw-head-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.tq-rw-ch-svg {
    display: block;
    border-radius: 6px;
}

.tq-rw-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--tq-ink, #21384b);
    letter-spacing: -0.01em;
}

.tq-rw-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(33, 56, 75, 0.06);
    color: var(--tq-muted, #5b6d7c);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tq-rw-close:hover {
    background: rgba(33, 56, 75, 0.12);
    color: var(--tq-ink, #21384b);
}

.tq-rw-close:focus-visible {
    outline: 2px solid var(--tq-accent, #8e24aa);
    outline-offset: 2px;
}

.tq-rw-desc {
    margin: 0 0 16px;
    font-size: 13.5px;
    line-height: 1.62;
    color: var(--tq-muted, #5b6d7c);
    text-align: left;
    text-wrap: balance;
}

/* Optional segmented tabs when both WeChat and Alipay are ever configured */
.tq-rw-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
    margin: 0 0 16px;
    border-radius: 10px;
    background: var(--tq-surface-muted, #edf2f7);
}

.tq-rw-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 6px 10px;
    border: 1.5px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--tq-muted, #5b6d7c);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.tq-rw-tab.is-active {
    background: var(--tq-surface, #ffffff);
    color: var(--tq-ink, #21384b);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.tq-rw-tab-wechat.is-active {
    border-color: rgba(7, 193, 96, 0.50);
}

.tq-rw-tab-alipay.is-active {
    border-color: rgba(22, 119, 255, 0.50);
}

.tq-rw-stage {
    margin: 0 0 16px;
}

.tq-rw-panel[hidden] {
    display: none !important;
}

/* Pure white high-contrast QR container (always pure white even in dark mode for 100% scan reliability) */
.tq-rw-frame {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 16px;
    background: #ffffff !important;
    border: 1px solid #e5ebf1;
    box-shadow: 0 4px 16px rgba(33, 56, 75, 0.06);
}

.tq-rw-code-img {
    display: block;
    width: 224px;
    height: 224px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border-radius: 8px;
}

.tq-rw-actions {
    margin: 0 0 11px;
}

.tq-rw-actions[hidden] {
    display: none !important;
}

.tq-rw-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    min-height: 44px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid rgba(7, 193, 96, 0.34);
    background: rgba(7, 193, 96, 0.10);
    color: #067a3e;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.tq-rw-save-btn:hover {
    background: #07c160;
    border-color: #07c160;
    color: #ffffff;
}

.tq-rw-save-btn:active {
    transform: scale(0.98);
}

.tq-rw-save-btn.is-done {
    background: #ecfdf3;
    border-color: #abefc6;
    color: #067647;
}

.tq-rw-modal.is-alipay .tq-rw-save-btn {
    border-color: rgba(22, 119, 255, 0.34);
    background: rgba(22, 119, 255, 0.09);
    color: #1258c4;
}

.tq-rw-modal.is-alipay .tq-rw-save-btn:hover {
    background: #1677ff;
    border-color: #1677ff;
    color: #ffffff;
}

.tq-rw-tip {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--tq-muted, #617485);
}

/* Mobile bottom sheet matching .tq-sheet ceramic drawer language */
@media (max-width: 767px) {
    .tq-rw-modal {
        align-items: flex-end;
        padding: 0;
    }

    .tq-rw-dialog {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
        padding: 16px 20px calc(22px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -10px 36px rgba(15, 23, 42, 0.22);
        transform: translateY(28px);
    }

    .tq-rw-modal.is-open .tq-rw-dialog {
        transform: translateY(0);
    }

    .tq-rw-handle {
        display: block;
    }

    .tq-rw-desc {
        text-align: center;
    }

    .tq-rw-code-img {
        width: 212px;
        height: 212px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tq-rw-modal,
    .tq-rw-dialog,
    .tq-rw-save-btn {
        transition: none !important;
    }
}

/* Dual Dark Mode (.style-for-dark + prefers-color-scheme: dark on body.style-by-auto) */
.style-for-dark .tq-rw-dialog {
    background: #1c222b;
    border-color: rgba(255, 255, 255, 0.10);
    color: #eef3f8;
    box-shadow: 0 20px 52px rgba(0, 0, 0, 0.45);
}

.style-for-dark .tq-rw-title {
    color: #eef3f8;
}

.style-for-dark .tq-rw-desc,
.style-for-dark .tq-rw-tip {
    color: #9aa8b6;
}

.style-for-dark .tq-rw-close {
    background: rgba(255, 255, 255, 0.08);
    color: #c2cdd8;
}

.style-for-dark .tq-rw-close:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.style-for-dark .tq-rw-handle {
    background: rgba(255, 255, 255, 0.22);
}

.style-for-dark .tq-rw-tabs {
    background: rgba(255, 255, 255, 0.07);
}

.style-for-dark .tq-rw-tab {
    color: #9aa8b6;
}

.style-for-dark .tq-rw-tab.is-active {
    background: #27303d;
    color: #eef3f8;
}

.style-for-dark .tq-rw-frame {
    background: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.16);
}

.style-for-dark .tq-rw-save-btn {
    background: rgba(7, 193, 96, 0.16);
    border-color: rgba(7, 193, 96, 0.42);
    color: #6ee7a8;
}

.style-for-dark .tq-rw-save-btn:hover {
    background: #07c160;
    border-color: #07c160;
    color: #ffffff;
}

@media (prefers-color-scheme: dark) {
    body.style-by-auto .tq-rw-dialog {
        background: #1c222b;
        border-color: rgba(255, 255, 255, 0.10);
        color: #eef3f8;
        box-shadow: 0 20px 52px rgba(0, 0, 0, 0.45);
    }

    body.style-by-auto .tq-rw-title {
        color: #eef3f8;
    }

    body.style-by-auto .tq-rw-desc,
    body.style-by-auto .tq-rw-tip {
        color: #9aa8b6;
    }

    body.style-by-auto .tq-rw-close {
        background: rgba(255, 255, 255, 0.08);
        color: #c2cdd8;
    }

    body.style-by-auto .tq-rw-close:hover {
        background: rgba(255, 255, 255, 0.16);
        color: #ffffff;
    }

    body.style-by-auto .tq-rw-handle {
        background: rgba(255, 255, 255, 0.22);
    }

    body.style-by-auto .tq-rw-tabs {
        background: rgba(255, 255, 255, 0.07);
    }

    body.style-by-auto .tq-rw-tab {
        color: #9aa8b6;
    }

    body.style-by-auto .tq-rw-tab.is-active {
        background: #27303d;
        color: #eef3f8;
    }

    body.style-by-auto .tq-rw-frame {
        background: #ffffff !important;
        border-color: rgba(255, 255, 255, 0.16);
    }

    body.style-by-auto .tq-rw-save-btn {
        background: rgba(7, 193, 96, 0.16);
        border-color: rgba(7, 193, 96, 0.42);
        color: #6ee7a8;
    }

    body.style-by-auto .tq-rw-save-btn:hover {
        background: #07c160;
        border-color: #07c160;
        color: #ffffff;
    }
}
