/* Buyer-facing Sakura Membership Receipt theme.
   Visual overrides only: layouts, text, routes and client-side behavior stay in their templates. */
:root {
    --sakura-page: #fff5f6;
    --sakura-surface: rgba(255, 253, 253, 0.96);
    --sakura-soft: #ffeaf0;
    --sakura-item: #fffafa;
    --sakura-ink: #4d2943;
    --sakura-muted: #80667a;
    --sakura-faint: #ad94a5;
    --sakura-border: #efcbd8;
    --sakura-rose: #e25d85;
    --sakura-rose-dark: #bc3861;
    --sakura-rose-soft: #fff0f4;
    --sakura-warning: #b66a38;
    --sakura-warning-soft: #fff3ea;
    --sakura-success: #28795f;
    --sakura-success-soft: #e5f8ef;
    --sakura-shadow: 0 13px 30px rgba(164, 76, 109, 0.12);
}

html { background: var(--sakura-page); }
body {
    background-color: var(--sakura-page) !important;
    background-image: linear-gradient(135deg, #fff8f9 0%, #fff1f5 48%, #fff8f3 100%) !important;
    color: var(--sakura-ink) !important;
}

.container,
.sidebar,
.report-card,
.card,
.info-panel {
    background: var(--sakura-surface) !important;
    border-color: var(--sakura-border) !important;
    box-shadow: var(--sakura-shadow) !important;
}

.container,
.card,
.info-panel {
    position: relative;
}

.container::before,
.card::before,
.info-panel::before {
    content: '';
    position: absolute;
    inset: 7px;
    border: 1px solid rgba(226, 93, 133, 0.12);
    border-radius: inherit;
    pointer-events: none;
}

h1,
h2,
h3 { color: var(--sakura-ink) !important; }
.subtitle,
.lead,
.note,
.form-foot,
.message,
.secondary-link,
p { color: var(--sakura-muted); }

input,
input[type="text"] {
    background: #fff !important;
    border-color: var(--sakura-border) !important;
    color: var(--sakura-ink) !important;
    box-shadow: none !important;
}

input:focus,
input[type="text"]:focus {
    border-color: var(--sakura-rose) !important;
    box-shadow: 0 0 0 3px rgba(226, 93, 133, 0.14) !important;
}

button,
.download-btn,
.primary-btn {
    background: var(--sakura-rose);
    border: 1px solid var(--sakura-rose-dark);
    box-shadow: 0 4px 0 rgba(159, 49, 85, 0.28), 0 8px 16px rgba(226, 93, 133, 0.16);
    color: #fff;
}

button:hover,
.download-btn:hover,
.primary-btn:hover {
    background: #ce4d76;
}

button:disabled { background: #c8abb6; border-color: #b798a6; }

.footer,
.warning,
.claim-alert {
    color: var(--sakura-warning) !important;
    background: var(--sakura-warning-soft) !important;
    border-color: #edb68d !important;
}

.error,
#result.error {
    color: #b8465e !important;
    background: #fff0f3 !important;
    border-color: #efb7c5 !important;
}

#result.success {
    color: var(--sakura-success) !important;
    background: var(--sakura-success-soft) !important;
    border-color: #9ad9c2 !important;
}

.spinner {
    border-color: #f0ced9 !important;
    border-top-color: var(--sakura-rose) !important;
}

/* Download pages: retain the original three-column layout and element positions. */
.warn-text,
.sidebar-left h3 { color: var(--sakura-warning) !important; }
.sidebar-right h3 { color: var(--sakura-ink) !important; }
.report-text { color: var(--sakura-ink) !important; }
.report-contact { color: var(--sakura-rose-dark); }

.vip-badge {
    background: linear-gradient(135deg, #fff6bc 0%, #f5cd62 24%, #d99b25 57%, #9a6214 100%) !important;
    border: 1px solid #8b5916 !important;
    color: #4d2607 !important;
    text-shadow: 0 1px #fff8c8;
    box-shadow: inset 0 1px 0 #fff9ca, 0 3px 0 #76430d, 0 8px 18px rgba(184, 122, 27, 0.28) !important;
}

.game-tab {
    background: #fff !important;
    border-color: var(--sakura-border) !important;
    color: var(--sakura-muted) !important;
}
.game-tab:hover { border-color: var(--sakura-rose) !important; color: var(--sakura-rose-dark) !important; }
.game-tab.active { background: var(--sakura-rose) !important; border-color: var(--sakura-rose-dark) !important; color: #fff !important; }
.game-tab.locked { background: #f7edf0 !important; color: var(--sakura-faint) !important; }

.bookmark-reminder {
    background: var(--sakura-rose-soft) !important;
    border-color: #eeabc1 !important;
    color: var(--sakura-muted) !important;
}
.bookmark-reminder strong { color: var(--sakura-ink) !important; }

.mod-item {
    background: var(--sakura-item);
    border-color: var(--sakura-border) !important;
    box-shadow: 0 3px 0 rgba(226, 93, 133, 0.04);
}
.mod-item:hover { border-color: var(--sakura-rose) !important; }
.mod-content { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.mod-info { min-width: 0; }
.mod-name { color: var(--sakura-ink); }
.mod-name .ver,
.sidebar-item .v {
    color: var(--sakura-rose-dark) !important;
    background: var(--sakura-rose-soft) !important;
}
.mod-meta { color: var(--sakura-muted) !important; }
.mod-avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 1px solid #d88aa4;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffe3ec 0%, #f7afc5 58%, #e7799c 100%);
    box-shadow: inset 0 1px 0 #fff7fa, 0 3px 8px rgba(196, 73, 113, 0.16);
    color: #7e2948;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}
.sidebar-item { background: #fffafa !important; color: var(--sakura-ink) !important; border: 1px solid rgba(239, 203, 216, 0.7); }
.sidebar-item:not([data-pid]) { cursor: default !important; }
.sidebar-check { margin-left: 4px; font-size: 12px; }
.sidebar-right h3 { position: relative; text-align: center; }
.sidebar-title-icon { position: absolute; left: 0; top: 50%; transform: translateY(-50%); }
.sidebar-title-text { display: inline-block; }
.sidebar-hint { margin: -6px 0 10px; color: var(--sakura-faint); font-size: 12px; line-height: 1.5; text-align: center; }
.empty { color: var(--sakura-faint) !important; }
.toast { background: #4d2943 !important; border: 1px solid #7d4869; box-shadow: var(--sakura-shadow); }

/* 普通码页面：公开最近更新，并允许未购买角色在侧栏查看更新说明。 */
.wrapper-standard-code { max-width: 1018px; }
html[lang="en"] .wrapper-standard-code { max-width: 1050px; }

.recent-updates {
    position: relative;
    margin: 0 0 20px;
    padding: 14px;
    border: 1px solid var(--sakura-border);
    border-radius: 10px;
    background: var(--sakura-item);
}
.recent-updates h2 { margin: 0 0 10px; color: var(--sakura-ink); font-size: 16px; }
.recent-update-list { display: grid; gap: 7px; }
.recent-update-item {
    padding: 9px 11px;
    border: 1px solid rgba(239, 203, 216, 0.7);
    border-radius: 7px;
    background: #fff;
}
.recent-update-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.recent-update-title strong { min-width: 0; overflow: hidden; color: var(--sakura-ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.recent-update-title span { flex: 0 0 auto; color: var(--sakura-rose-dark); font-size: 11px; }
.recent-update-title time { margin-left: auto; flex: 0 0 auto; color: var(--sakura-faint); font-size: 10px; }
.recent-update-item p { margin-top: 4px; color: var(--sakura-muted); font-size: 12px; line-height: 1.55; }

.sidebar-right-updates { width: 228px; }
html[lang="en"] .sidebar-right-updates { width: 260px; }
.sidebar-update-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px;
    align-items: center;
    gap: 7px;
    margin-bottom: 5px;
}
.sidebar-update-row .sidebar-item {
    min-width: 0;
    min-height: 34px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
}
.sidebar-character-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-update-row .v,
.sidebar-update-row .sidebar-check { flex: 0 0 auto; }
.view-update-btn {
    width: 64px;
    min-height: 34px;
    padding: 6px 7px;
    border: 1px solid #e3a6ba;
    border-radius: 6px;
    background: var(--sakura-rose-soft);
    box-shadow: none;
    color: var(--sakura-rose-dark);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.view-update-btn:hover,
.view-update-btn:focus-visible {
    border-color: var(--sakura-rose);
    background: #ffe3ec;
    box-shadow: none;
    color: var(--sakura-rose-dark);
    outline: none;
}
.sidebar-update-popover {
    position: absolute;
    z-index: 30;
    top: 50%;
    right: calc(100% + 10px);
    width: 300px;
    padding: 15px 16px;
    transform: translateY(-50%);
    border: 1px solid var(--sakura-border);
    border-radius: 10px;
    background: #fffdfd;
    box-shadow: 0 16px 36px rgba(91, 40, 68, 0.2);
    color: var(--sakura-ink);
}
.sidebar-update-popover[hidden] { display: none; }
.sidebar-update-popover::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -7px;
    width: 12px;
    height: 12px;
    transform: translateY(-50%) rotate(45deg);
    border-top: 1px solid var(--sakura-border);
    border-right: 1px solid var(--sakura-border);
    background: #fffdfd;
}
.sidebar-update-popover h4 { padding-right: 24px; color: var(--sakura-ink); font-size: 15px; }
.sidebar-update-popover h4 span { margin-left: 4px; color: var(--sakura-rose-dark); font-size: 11px; }
.sidebar-update-popover time { display: block; margin: 5px 0 8px; color: var(--sakura-faint); font-size: 11px; }
.sidebar-update-popover p { color: var(--sakura-muted); font-size: 13px; line-height: 1.65; }
.sidebar-update-close {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--sakura-rose-dark);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
.sidebar-update-close:hover,
.sidebar-update-close:focus-visible { background: var(--sakura-rose-soft); box-shadow: none; color: var(--sakura-rose-dark); outline: none; }

/* Ko-fi page keeps its existing two-column/stacked layout. */
.info-panel strong { color: var(--sakura-ink) !important; }
.info-panel p { color: var(--sakura-muted) !important; }
.info-panel .privacy-note { color: var(--sakura-warning) !important; border-color: var(--sakura-border) !important; }
label { color: var(--sakura-muted) !important; }
.warning strong,
.claim-alert strong { color: #91552b; }

.icon { filter: drop-shadow(0 4px 6px rgba(226, 93, 133, 0.18)); }
.secondary-link:hover { color: var(--sakura-rose-dark) !important; }

@media (max-width: 760px) {
    body { background-image: none !important; }
    .mod-content { width: 100%; }
    .wrapper-standard-code,
    .sidebar-right-updates { width: 100%; max-width: none; }
    .sidebar-update-popover {
        top: calc(100% + 7px);
        right: 0;
        width: min(300px, calc(100vw - 56px));
        transform: none;
    }
    .sidebar-update-popover::after { display: none; }
}

@media (max-width: 380px) {
    .mod-avatar { width: 36px; height: 36px; flex-basis: 36px; font-size: 16px; }
}

/* Desktop-only Sakura petals. The layer is decorative and stays beneath buyer controls. */
.buyer-petal-layer {
    position: fixed;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.buyer-petal-layer__petal {
    position: absolute;
    inset-block-start: var(--petal-y);
    inset-inline-start: var(--petal-x);
    inline-size: var(--petal-size);
    block-size: var(--petal-size);
    opacity: var(--petal-opacity);
    background: url('/static/buyer-assets/sakura-petal.png') center / contain no-repeat;
    filter: blur(var(--petal-blur));
    transform-origin: center;
    will-change: translate, rotate;
    animation:
        buyer-petal-drop var(--petal-duration) linear var(--petal-delay) infinite,
        buyer-petal-turn calc(var(--petal-duration) * .68) linear var(--petal-delay) infinite;
}

body > .container,
body > .wrapper,
body > .redeem-layout,
body > .card {
    position: relative;
    z-index: 2;
}

body > .toast { z-index: 999; }

@keyframes buyer-petal-drop {
    from { translate: 0 0; }
    to { translate: var(--petal-drift) 130vh; }
}

@keyframes buyer-petal-turn {
    from { rotate: 0deg; }
    to { rotate: var(--petal-turn); }
}

@media (max-width: 760px), (prefers-reduced-motion: reduce) {
    .buyer-petal-layer { display: none; }
}

/* 公告标题与公告块：背景与书签提醒一致，边框更粗、字体醒目 */
.buyer-announcement-title {
    margin: 0 0 6px;
    color: var(--sakura-rose-dark) !important;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 6px;
    text-align: center;
}

.buyer-announcement {
    margin: 0 0 18px;
    padding: 14px 18px;
    background: var(--sakura-rose-soft) !important;
    border: 3px solid #eeabc1 !important;
    border-radius: 12px;
    color: var(--sakura-ink) !important;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.7;
    text-align: left;
    white-space: pre-line;
    box-shadow: 0 3px 0 rgba(226, 93, 133, 0.12);
    overflow-wrap: anywhere;
}

/* 右侧已完成角色列表：JS 驱动在顶部/底部停靠位之间平滑滑动 */
.sidebar-right {
    position: static;
}

/* Right-hand character list: clickable items and 3x background flash on target card. */
.sidebar-item[data-pid] {
    cursor: pointer;
}

.sidebar-item[data-pid]:hover,
.sidebar-item[data-pid]:focus {
    outline: none;
    border-color: var(--sakura-rose);
    background: var(--sakura-rose-soft);
}

.mod-item.mod-flash {
    animation: buyer-mod-flash 0.4s ease-in-out 3 !important;
}

@keyframes buyer-mod-flash {
    0%, 100% {
        background: var(--sakura-item);
        box-shadow: 0 3px 0 rgba(226, 93, 133, 0.04);
    }
    50% {
        background: #ffd7e4;
        box-shadow: 0 0 0 3px rgba(226, 93, 133, 0.65);
    }
}

@media (prefers-reduced-motion: reduce) {
    .mod-item.mod-flash {
        animation: none !important;
        border-color: var(--sakura-rose) !important;
        box-shadow: 0 0 0 2px var(--sakura-rose) !important;
    }
}

/* Desktop download-link reflection; decorative only and never captures clicks. */
.download-btn {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.download-btn::after {
    content: '';
    position: absolute;
    z-index: 0;
    inset: -35%;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.52) 50%, transparent 62%);
    mix-blend-mode: screen;
    transform: translateX(-135%) skewX(-18deg);
    transition: transform 0.6s ease;
}

@media (hover: hover) and (pointer: fine) {
    .download-btn:hover {
        box-shadow: 0 4px 0 rgba(159, 49, 85, 0.28), 0 10px 20px rgba(226, 93, 133, 0.24);
    }

    .download-btn:hover::after {
        transform: translateX(135%) skewX(-18deg);
    }
}

.download-btn[style*="background-color"]::after,
.download-btn.disabled::after {
    display: none;
}

/* Paused products remain visible but are deliberately not interactive. */
.download-paused {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 24px;
    border: 1px solid #d8c6ce;
    border-radius: 8px;
    background: #f1ebed;
    color: #8b7a82;
    box-shadow: none;
    cursor: not-allowed;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    user-select: none;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: none;
    transition: none;
}

.download-paused small {
    margin-top: 2px;
    color: #a18f97;
    font-size: 12px;
    font-weight: 400;
}

.download-paused:hover,
.download-paused:focus,
.download-paused:active {
    background: #f1ebed;
    border-color: #d8c6ce;
    box-shadow: none;
    color: #8b7a82;
    filter: none;
    outline: none;
    transform: none;
}

.download-paused::after {
    content: none;
    display: none;
}

@media (max-width: 760px) {
    .download-paused {
        width: 100%;
        min-height: 44px;
        padding: 12px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .download-btn,
    .download-btn::after {
        transition: none;
    }

    .download-btn::after {
        display: none;
    }
}
