/* =====================================================================
   PvZH Vault: mobile Deck Feed
   Load AFTER style.css. All rules are scoped to .pvz-feed / .pvz-feed-cta.
   ===================================================================== */

/* The site's mobile rule `#deckGrid > *` adds content-visibility and paint
   containment to every direct child. The feed root must opt out, or its
   sticky tabs and long scroll height break. */
#deckGrid > .pvz-feed {
    content-visibility: visible !important;
    contain: none !important;
    contain-intrinsic-size: none !important;
    grid-column: 1 / -1;
    min-width: 0;
}

.pvz-feed {
    --fc-bg: #1b2126;
    --fc-cell: #12171b;
    --fc-line: rgba(255, 255, 255, 0.07);
    --fc-muted: #9aa5ad;
    --fc-gold: #ffd34e;
    --fc-cyan: #00b4d8;
    color: #f3f6f8;
}

.pvz-feed [hidden] { display: none !important; }

.pvz-feed header,
.pvz-feed footer {
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
}

/* Reset the site's global button styles inside the feed. */
.pvz-feed button {
    all: unset;
    box-sizing: border-box;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.pvz-feed button:focus-visible {
    outline: 2px solid var(--fc-cyan);
    outline-offset: 2px;
    border-radius: 10px;
}


/* ---------------- Header ---------------- */

/* iOS-style back link: sits top-left where a back control is expected. */
.pvz-feed .pvz-feed-head {
    display: flex;
    justify-content: flex-start;
    padding: 0 0 6px;
}

.pvz-feed .pvz-feed-back {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 40px;
    margin-left: -6px;
    padding: 0 10px 0 4px;
    border-radius: 10px;
    color: #8ee4f5;
    font-size: 15px;
    font-weight: 700;
}

.pvz-feed .pvz-feed-back:active { background: rgba(255, 255, 255, 0.06); }

.pvz-feed .pvz-feed-back svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* ---------------- Sticky tabs ---------------- */

.pvz-feed .pvz-feed-tabs {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    gap: 6px;
    margin: 0 -10px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgba(18, 24, 27, 0.94);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--fc-line);
}

.pvz-feed .pvz-feed-tabs::-webkit-scrollbar,
.pvz-feed .pvz-feed-chips::-webkit-scrollbar { display: none; }

.pvz-feed .pvz-feed-tabs button {
    flex: none;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: #aeb7be;
    font-size: 14px;
    font-weight: 700;
}

.pvz-feed .pvz-feed-tabs button[aria-selected="true"] {
    background: #f3f6f8;
    color: #12181b;
}


/* ---------------- Hero filter chips ---------------- */

.pvz-feed .pvz-feed-chips {
    display: flex;
    gap: 8px;
    margin: 0 -10px;
    padding: 12px 10px 4px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
}

.pvz-feed .pvz-feed-chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 13px;
    border: 1px solid var(--fc-line);
    border-radius: 999px;
    background: #20252a;
    color: #d1d5db;
    font-size: 13px;
    font-weight: 600;
    scroll-snap-align: start;
}

.pvz-feed .pvz-feed-chip.has-img { padding-left: 4px; }

.pvz-feed .pvz-feed-chip img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
    background: var(--fc-cell);
}

.pvz-feed .pvz-feed-chip.is-active {
    border-color: var(--fc-cyan);
    background: rgba(0, 180, 216, 0.16);
    color: #fff;
}


/* ---------------- Feed list ---------------- */

.pvz-feed .pvz-feed-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 10px;
}

.pvz-feed .pvz-feed-sentinel { height: 1px; }


/* ---------------- Deck card ---------------- */

.pvz-feed .pvz-fc {
    position: relative;
    padding: 12px 12px 10px;
    overflow: hidden;
    border: 1px solid var(--fc-line);
    border-radius: 20px;
    background: var(--fc-bg);
    content-visibility: auto;
    contain-intrinsic-size: auto 330px;
}

/* Faction tint in the top-left corner, under the hero portrait. */
.pvz-feed .pvz-fc::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 96px;
    pointer-events: none;
    background: radial-gradient(110% 100% at 0% 0%, var(--fc-tint), transparent 70%);
}

.pvz-feed .pvz-fc--plant { --fc-tint: rgba(94, 224, 126, 0.16); }
.pvz-feed .pvz-fc--zombie { --fc-tint: rgba(192, 132, 252, 0.18); }

.pvz-feed .pvz-fc-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.pvz-feed .pvz-fc-avatars {
    position: relative;
    flex: none;
    display: flex;
    align-items: center;
    width: 52px;
    height: 52px;
}

.pvz-feed .pvz-fc-avatars.two { width: 64px; }

.pvz-feed .pvz-fc-avatars img {
    width: 52px;
    height: 52px;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
    background: var(--fc-cell);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.pvz-feed .pvz-fc-avatars.two img { width: 42px; height: 42px; }
.pvz-feed .pvz-fc-avatars.two img + img { margin-left: -20px; }

.pvz-feed .pvz-fc-title {
    flex: 1;
    min-width: 0;
}

.pvz-feed .pvz-fc-name {
    display: block;
    width: 100%;
    overflow: hidden;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pvz-feed .pvz-fc-meta {
    margin: 3px 0 0;
    overflow: hidden;
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pvz-feed .pvz-fc-hero { color: #e3e8ec; font-weight: 600; }
.pvz-feed .pvz-fc-by { margin-left: 6px; color: var(--fc-muted); }

.pvz-feed .pvz-fc-grade {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    color: var(--g);
    font-size: 19px;
    font-weight: 900;
}


/* The deck itself: the memorable part of every card. */
.pvz-feed .pvz-fc-strip {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 12px;
    aspect-ratio: 5 / 2.12;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.pvz-feed .pvz-fc-strip:empty {
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.14);
}

.pvz-feed .pvz-fc-strip:focus-visible {
    outline: 2px solid var(--fc-cyan);
    outline-offset: 3px;
    border-radius: 12px;
}

.pvz-feed .pvz-fc-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    background: none;
}

/* Absolute + contain keeps tall art (e.g. leafy cards) inside its square. */
.pvz-feed .pvz-fc-cell img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

.pvz-feed .pvz-fc-cell b {
    position: absolute;
    left: 3px;
    bottom: 3px;
    padding: 0 4px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    line-height: 15px;
}

.pvz-feed .pvz-fc-more {
    display: grid;
    place-items: center;
    border-radius: 50%;
    aspect-ratio: 1;
    align-self: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--fc-muted);
    font-size: 15px;
    font-weight: 800;
}


/* ---------------- Footer: tags + star ---------------- */

.pvz-feed .pvz-fc-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.pvz-feed .pvz-fc-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.pvz-feed .pvz-fc-tag {
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #c9d1d9;
    font-size: 11px;
    font-weight: 700;
}

.pvz-feed .pvz-fc-tag--gem { background: rgba(255, 211, 78, 0.14); color: #ffdd73; }
.pvz-feed .pvz-fc-tag--new { background: rgba(0, 180, 216, 0.15); color: #8ee4f5; }
.pvz-feed .pvz-fc-tag--rare { background: rgba(171, 134, 255, 0.16); color: #c9b4ff; }
.pvz-feed .pvz-fc-tag--fresh { background: rgba(94, 224, 126, 0.14); color: #9be8ae; }

.pvz-feed .pvz-fc-date {
    color: var(--fc-muted);
    font-size: 11px;
}

/* Simple star: icon + count, no chrome. Still a 44px touch target. */
.pvz-feed .pvz-fc-star {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    height: 44px;
    margin-right: -6px;
    padding: 0 8px;
    border-radius: 12px;
    color: #aeb7be;
    font-size: 16px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    transition: color 0.15s, background 0.15s, transform 0.12s;
}

.pvz-feed .pvz-fc-star:active {
    background: rgba(255, 255, 255, 0.06);
    transform: scale(0.92);
}

.pvz-feed .pvz-fc-star:disabled { opacity: 0.6; cursor: progress; }

.pvz-feed .pvz-fc-star svg {
    width: 26px;
    height: 26px;
    fill: transparent;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linejoin: round;
    animation: none;
}

.pvz-feed .pvz-fc-star-label { display: none; }

.pvz-feed .pvz-fc-star .deck-star-count {
    min-width: 0;
    padding: 0;
    background: none;
    color: inherit;
    font-size: 16px;
    font-weight: 800;
}

.pvz-feed .pvz-fc-star.starred { color: var(--fc-gold); }
.pvz-feed .pvz-fc-star.starred svg {
    fill: currentColor;
    filter: drop-shadow(0 0 6px rgba(255, 211, 78, 0.35));
}

.pvz-feed .pvz-fc-star.is-popping svg {
    animation: pvzFcPop 0.42s cubic-bezier(0.2, 1.6, 0.4, 1);
}

/* Double-tap burst over the card art. */
.pvz-feed .pvz-fc-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 88px;
    height: 88px;
    margin: -44px 0 0 -44px;
    color: var(--fc-gold);
    pointer-events: none;
    filter: drop-shadow(0 6px 18px rgba(255, 200, 40, 0.55));
    animation: pvzFcBurst 0.7s ease-out forwards;
}

.pvz-feed .pvz-fc-burst svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

@keyframes pvzFcPop {
    0% { transform: scale(1); }
    45% { transform: scale(1.45) rotate(14deg); }
    100% { transform: scale(1); }
}

@keyframes pvzFcBurst {
    0% { opacity: 0; transform: scale(0.3); }
    25% { opacity: 1; transform: scale(1.15); }
    60% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.35) translateY(-10px); }
}


/* ---------------- End / empty states ---------------- */

.pvz-feed .pvz-feed-end {
    padding: 28px 16px 36px;
    color: var(--fc-muted);
    font-size: 14px;
    text-align: center;
}

.pvz-feed .pvz-feed-end p { margin: 0 0 12px; }

.pvz-feed .pvz-feed-end button {
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(0, 180, 216, 0.16);
    color: #dff8ff;
    font-size: 14px;
    font-weight: 700;
}


/* ---------------- Discovery entry card (mobile) ---------------- */

#deckGrid .pvz-feed-cta {
    all: unset;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 3px 12px;
    width: 100%;
    margin: 0 0 16px;
    padding: 14px 14px 14px 16px;
    border: 1px solid rgba(0, 180, 216, 0.35);
    border-radius: 16px;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(171, 134, 255, 0.2), transparent 60%),
        rgba(0, 180, 216, 0.12);
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#deckGrid .pvz-feed-cta:focus-visible { outline: 2px solid #00b4d8; outline-offset: 2px; }
#deckGrid .pvz-feed-cta:active { transform: scale(0.985); }

#deckGrid .pvz-feed-cta-title {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.25;
}

#deckGrid .pvz-feed-cta-sub {
    grid-column: 1;
    color: #a9c7d0;
    font-size: 13px;
    line-height: 1.35;
}

#deckGrid .pvz-feed-cta-icon {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: #8ee4f5;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}


@media (prefers-reduced-motion: reduce) {
    .pvz-feed .pvz-fc-star,
    .pvz-feed .pvz-fc-star svg,
    .pvz-feed .pvz-fc-burst {
        transition: none !important;
        animation: none !important;
    }
}


/* ---------------- Search results + Discovery cleanup (mobile) ---------------- */

.pvz-feed.is-results .pvz-feed-list { padding-top: 2px; }

@media (max-width: 768px) {
    /* The feed entry card near the top replaces this footer on phones. */
    #deckGrid.pvz-discovery-mode .pvz-discovery-all-decks {
        display: none !important;
    }
}


/* ---------------- Inline expansion (replaces the deck modal on mobile) ---------------- */

/* Grid 0fr -> 1fr animates to the content's real height without measuring. */
.pvz-feed .pvz-fc-expand {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.pvz-feed .pvz-fc.is-open .pvz-fc-expand { grid-template-rows: 1fr; }
.pvz-feed .pvz-fc.no-anim .pvz-fc-expand { transition: none; }

.pvz-feed .pvz-fc-expand-inner {
    min-height: 0;
    overflow: hidden;
}

.pvz-feed .pvz-fc-expand-inner > * {
    opacity: 0;
    transition: opacity 0.22s ease;
}

.pvz-feed .pvz-fc.is-open .pvz-fc-expand-inner > * {
    opacity: 1;
    transition-delay: 0.08s;
}

.pvz-feed .pvz-fc.no-anim .pvz-fc-expand-inner > * { transition: none; }

/* Open card: show the whole name and meta line. */
.pvz-feed .pvz-fc.is-open .pvz-fc-name,
.pvz-feed .pvz-fc.is-open .pvz-fc-meta {
    white-space: normal;
}

/* Cards 11+ continue the same 5-column grid as the strip. */
.pvz-feed .pvz-fc-extra {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin-top: 6px;
}

.pvz-feed .pvz-fc-extra .pvz-fc-cell { aspect-ratio: 1; }

/* One quiet panel: two stats with resource icons + a mini cost curve. */
.pvz-feed .pvz-fc-stats {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.24);
}

.pvz-feed .pvz-fc-stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pvz-feed .pvz-fc-stat div {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.pvz-feed .pvz-fc-stat strong {
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.pvz-feed .pvz-fc-stat span {
    margin-top: 2px;
    color: var(--fc-muted);
    font-size: 11px;
    font-weight: 600;
}

.pvz-feed .pvz-fc-icon {
    flex: none;
    width: 24px;
    height: 24px;
}

.pvz-feed .pvz-fc-icon.is-spark {
    fill: #4dd0e1;
    filter: drop-shadow(0 0 6px rgba(77, 208, 225, 0.45));
}

.pvz-feed .pvz-fc-icon.is-sun circle { fill: #ffcf3a; }
.pvz-feed .pvz-fc-icon.is-sun path {
    fill: none;
    stroke: #ffcf3a;
    stroke-width: 2;
    stroke-linecap: round;
}

.pvz-feed .pvz-fc-icon.is-brain path { fill: #f49ac2; }
.pvz-feed .pvz-fc-icon.is-brain path.fold {
    fill: none;
    stroke: #b8507f;
    stroke-width: 1.4;
    stroke-linecap: round;
}

/* Mini cost curve, tinted by faction. */
.pvz-feed .pvz-fc-curve {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    height: 44px;
    justify-self: stretch;
}

.pvz-feed .pvz-fc-bar {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    justify-items: center;
    gap: 3px;
    min-width: 0;
}

.pvz-feed .pvz-fc-bar i {
    align-self: end;
    width: 100%;
    max-width: 14px;
    border-radius: 3px 3px 1px 1px;
    background: var(--fc-bar);
}

.pvz-feed .pvz-fc-bar small {
    color: var(--fc-muted);
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
}

.pvz-feed .pvz-fc--plant { --fc-bar: #6fd17f; }
.pvz-feed .pvz-fc--zombie { --fc-bar: #b58cff; }

.pvz-feed .pvz-fc-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.pvz-feed .pvz-fc-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #e6edf3;
    font-size: 14px;
    font-weight: 700;
}

.pvz-feed .pvz-fc-action:active { transform: scale(0.97); }

.pvz-feed .pvz-fc-action.is-primary {
    border-color: rgba(0, 180, 216, 0.45);
    background: rgba(0, 180, 216, 0.16);
    color: #dff8ff;
}

.pvz-feed .pvz-fc-action svg,
.pvz-feed .pvz-fc-less svg {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Reuse the site's history/video markup, tightened for the card. */
.pvz-feed .pvz-deck-history {
    margin-top: 14px !important;
    padding-top: 12px !important;
}

.pvz-feed .pvz-history-list { grid-template-columns: minmax(0, 1fr); }

.pvz-feed .pvz-fc-less {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
    padding: 10px 0 2px;
    color: var(--fc-muted);
    font-size: 13px;
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .pvz-feed .pvz-fc-expand,
    .pvz-feed .pvz-fc-expand-inner > * {
        transition: none !important;
    }
}



/* ---------------- Search bar: match the feed's surfaces (mobile) ---------------- */
/* Same selectors as style.css so these win by load order. */

@media (max-width: 768px) {
    #searchWrapper.pvz-smart-search .pvz-smart-search-field {
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 14px !important;
        background: #20252a !important;
        box-shadow: none !important;
        transform: none !important;
    }

    #searchWrapper.pvz-smart-search .pvz-smart-search-field:hover {
        border-color: rgba(255, 255, 255, 0.18) !important;
        box-shadow: none !important;
    }

    #searchWrapper.pvz-smart-search .pvz-smart-search-field:focus-within {
        border-color: rgba(0, 180, 216, 0.7) !important;
        background: #232a30 !important;
        box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.14) !important;
        transform: none !important;
    }

    #searchWrapper.pvz-smart-search .pvz-smart-search-icon {
        color: #9aa5ad !important;
    }

    #searchWrapper.pvz-smart-search .pvz-smart-search-field:focus-within .pvz-smart-search-icon {
        color: #8ee4f5 !important;
        transform: translateY(-50%) !important;
    }

    #searchWrapper.pvz-smart-search #searchInput {
        caret-color: #00b4d8 !important;
        font-weight: 600 !important;
    }

    #searchWrapper.pvz-smart-search .pvz-smart-search-highlight-text {
        font-weight: 600 !important;
    }

    #searchWrapper.pvz-smart-search #searchInput::placeholder {
        color: #7f8a92 !important;
        -webkit-text-fill-color: #7f8a92 !important;
        font-weight: 500 !important;
    }

    #searchWrapper.pvz-smart-search .pvz-smart-search-clear {
        border: 0 !important;
        background: rgba(255, 255, 255, 0.08) !important;
    }

    #searchWrapper.pvz-smart-search .pvz-smart-search-status {
        color: #7f8a92 !important;
        font-weight: 600 !important;
    }
}


/* ---------------- Search status line: hidden on mobile ---------------- */
/* Visually hidden, not removed, so screen readers still hear result counts. */

@media (max-width: 768px) {
    #searchWrapper.pvz-smart-search .pvz-smart-search-footer {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        min-height: 0 !important;
        margin: -1px !important;
        padding: 0 !important;
        overflow: hidden !important;
        clip: rect(0 0 0 0) !important;
        clip-path: inset(50%) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }

    #searchWrapper.pvz-smart-search .smart-search-bottom-row {
        display: none !important;
    }
}
