/* Store fragments follow the approved four-card collection layout. */
#store-tab-fragments[hidden],
#store-panel-fragments[hidden],
.store-fragments [hidden] { display: none !important; }

.store-fragments {
    --fragment-ink: #142236;
    --fragment-gold: #b88624;
    min-width: 0;
    color: var(--fragment-ink);
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    container: fragment-store / inline-size;
}

/* Match the collection navigation without changing the other store views. */
.store-tabs:has(#store-tab-fragments.is-active) { gap: 14px; }
.store-tabs:has(#store-tab-fragments.is-active) .store-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 122px;
    min-height: 45px;
    padding: 0 22px;
    border-color: #ecd9aa;
    background: #fffdfa;
    font-size: 16px;
    font-weight: 750;
    letter-spacing: 0;
}
.store-tabs:has(#store-tab-fragments.is-active) #store-tab-fragments {
    min-width: 144px;
    gap: 7px;
    color: #142236;
    border-color: #dfaf43;
    background: linear-gradient(180deg, #f8d56a, #e7b341);
    box-shadow: 0 9px 19px #bc861c25;
}
.store-tab-fragments-icon { width: 18px; height: 20px; flex: 0 0 auto; color: #866022; vertical-align: -4px; }
#store-tab-fragments .store-tab-badge,
#store-tab-fragments.is-active .store-tab-badge {
    min-width: 18px;
    height: 18px;
    margin-left: 1px;
    padding: 0 5px;
    background: #795619;
    color: #fff4cd;
    font-size: 10px;
    font-weight: 700;
}

.fragments-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin: 0 0 20px; }
.fragments-heading h3 { margin: 0 0 6px; color: var(--fragment-ink); font-size: 21px; font-weight: 750; line-height: 1.35; letter-spacing: .2px; }
.fragments-heading p { margin: 0; color: #7d817f; font-size: 11px; line-height: 1.6; }
.fragments-heading p strong { color: #9b762f; font-weight: 700; }
.fragments-heading-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: 0 0 auto; }
.fragments-link { display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 0; border: 0; color: #9e792d; background: transparent; font: inherit; font-size: 12px; line-height: 1.5; cursor: pointer; }
.fragments-link svg { width: 14px; height: 14px; flex: 0 0 auto; }
.fragments-link span { font-size: 16px; line-height: 1; }
.fragments-link:hover:not(:disabled) { color: #825b1c; }
.fragments-link:disabled { opacity: .5; cursor: default; }
.fragments-legend { display: flex; align-items: center; gap: 12px; color: #8e9297; font-size: 9px; line-height: 1.3; }
.fragments-legend span { display: inline-flex; align-items: center; gap: 4px; }
.fragments-legend i { width: 6px; height: 6px; border-radius: 2px; background: #deb75d; }
.fragments-legend span:last-child i { background: #b4bac0; }
.fragments-refresh { padding: 8px 13px; border: 1px solid #dfd6c5; border-radius: 999px; color: #726851; background: #fffdf8; font: inherit; font-size: 11px; cursor: pointer; }
.fragments-refresh:hover:not(:disabled) { color: #825b1c; border-color: #cbb078; }
.fragments-refresh:disabled { opacity: .5; cursor: default; }
#fragments-refresh { display: none; }
.store-fragments:has(.fragments-feedback.is-error:not([hidden])) #fragments-refresh { display: inline-flex; }
.fragments-refresh:focus-visible, .fragments-link:focus-visible, .fragment-craft:focus-visible { outline: 2px solid #ad7d26; outline-offset: 3px; }

.fragments-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; gap: 16px; }
.fragment-card { min-width: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #eae4d8; border-radius: 16px; background: #fff; box-shadow: 0 8px 23px #26364d06; }
.fragment-card[data-piece-count="5"] { --fragment-piece-color: #e6b078; }
.fragment-card[data-piece-count="6"] { --fragment-piece-color: #73ccf8; }
.fragment-card[data-piece-count="7"] { --fragment-piece-color: #f1d574; }
.fragment-card[data-piece-count="8"] { --fragment-piece-color: #ffdf86; }
.fragment-card.is-ready { border-color: #e9bc52; box-shadow: 0 10px 26px #b2872a18; }
.fragment-art { position: relative; display: flex; flex: 0 0 268px; align-items: center; justify-content: center; height: 268px; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at 50% 61%, #27435580, transparent 61%), linear-gradient(130deg, #1e2e41, #142236); }
.is-ready .fragment-art { background: radial-gradient(ellipse at 50% 61%, #9e793035, transparent 61%), linear-gradient(130deg, #243140, #142236); }
.fragment-status, .fragment-piece-count { position: absolute; z-index: 2; top: 12px; padding: 4px 7px; border: 1px solid #e4edff22; border-radius: 6px; background: #ffffff0b; color: #aab8c9; font-size: 9px; line-height: 1.35; }
.fragment-status { left: 12px; display: inline-flex; align-items: center; gap: 4px; }
.fragment-status::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: #889db7; }
.fragment-piece-count { right: 12px; color: #bdc7d3; border-color: #ffffff1d; }
.is-ready .fragment-status { color: #ffdf86; background: #bc8b2b20; border-color: #f5d57742; }
.is-ready .fragment-status::before { background: #f6cf62; box-shadow: 0 0 6px #f8d96c; }
.is-ready .fragment-piece-count { color: #e5c679; border-color: #e5c67940; }
.fragment-art-floor { position: absolute; z-index: -1; bottom: 19px; width: 130px; height: 14px; border-radius: 50%; background: #071321aa; filter: blur(6px); }
.fragment-art-halo { display: none; position: absolute; z-index: -1; top: 38px; width: 207px; height: 207px; border-radius: 50%; background: radial-gradient(ellipse, #e8b44026, transparent 65%); }
.is-ready .fragment-art-halo { display: block; }
.is-ready .fragment-art-halo::before, .is-ready .fragment-art-halo::after { content: ''; position: absolute; border-radius: 50%; }
.is-ready .fragment-art-halo::before { inset: 21px; border: 1px solid #f4cd6033; }
.is-ready .fragment-art-halo::after { inset: 12px; border: 1px solid #f4cd6014; }
.fragment-artwork { display: block; position: relative; z-index: 1; width: 154px; max-width: 90%; height: 242px; margin-top: 19px; overflow: visible; filter: drop-shadow(0 9px 9px #050d1b80); }
.is-ready .fragment-artwork { filter: drop-shadow(0 0 7px #f0c25c38) drop-shadow(0 10px 8px #040b1755); }
.fragment-piece-surface { fill: #8491a313; }
.fragment-piece-edge { fill: none; stroke: #a7b5c3; stroke-width: .5px; stroke-opacity: .28; }
.fragment-piece image { opacity: .13; filter: none; }
.fragment-piece.is-owned image { opacity: 1; }
.fragment-piece.is-owned .fragment-piece-surface { fill: none; }
.fragment-piece.is-owned .fragment-piece-edge { stroke: var(--fragment-piece-color, #a7b5c3); stroke-opacity: .46; }
.fragment-card.is-ready .fragment-piece .fragment-piece-edge { stroke: #ffdf86; stroke-width: .65px; stroke-opacity: .66; }
.fragment-piece-number { display: none; }

/* Approved empty-collection effect: 06 / invisible ripple. These rules never
   brighten missing positions once the player owns any part of this item. */
.fragment-artwork.is-empty-ripple .fragment-ripple-base { fill: #1a2b3d; }
.fragment-artwork.is-empty-ripple .fragment-piece image { opacity: .38; }
.fragment-artwork.is-empty-ripple .fragment-piece-edge { stroke: #d6f0ff; stroke-width: .55px; stroke-opacity: .22; }
.fragment-ripple-light { mix-blend-mode: screen; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
    .fragment-artwork.is-empty-ripple .fragment-piece image { opacity: .38 !important; }
    .fragment-artwork.is-empty-ripple .fragment-piece-edge { stroke-opacity: .22 !important; }
    .fragment-ripple-light { display: none; }
}

.fragment-info { display: flex; flex: 1; flex-direction: column; min-height: 227px; padding: 18px 17px 17px; background: #fff; }
.fragment-name { margin: 0; color: var(--fragment-ink); font-size: 16px; font-weight: 750; line-height: 22px; overflow-wrap: anywhere; }
.fragment-meta { display: flex; align-items: center; gap: 5px; margin: 5px 0 17px; color: #9298a0; font-size: 9px; line-height: 14px; letter-spacing: .1px; }
.fragment-meta-icon { width: 11px; height: 13px; flex: 0 0 auto; color: #aa8b55; }
.fragment-amount { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 9px; color: #8b9098; font-size: 10px; line-height: 23px; }
.fragment-amount strong { color: #253449; font: 700 23px/1 "Segoe UI", Arial, sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fragment-amount strong span { color: #a7adb4; font-size: 13px; font-weight: 500; }
.is-ready .fragment-amount strong { color: var(--fragment-gold); }
/* Allow all positions to wrap; duplicate quantities keep their full text width. */
.fragment-parts { display: flex; flex-wrap: wrap; gap: 4px; flex: 0 0 auto; min-width: 0; min-height: 22px; height: auto; margin: 0; padding: 0; overflow: visible; list-style: none; }
.fragment-part { display: flex; flex: 1 0 20px; align-items: center; justify-content: center; min-width: 20px; height: 22px; padding: 0 1px; border: 1px solid #dddeda; border-radius: 5px; color: #b0b5b4; background: #f1f1ed; font: 600 9px/1 "Segoe UI", Arial, sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fragment-part strong { flex-shrink: 0; font-size: inherit; font-weight: inherit; }
.fragment-part span { display: none; flex-shrink: 0; }
.fragment-part.is-duplicate { flex-basis: auto; min-width: max-content; padding: 0 4px; gap: 3px; }
.fragment-part.is-duplicate span { display: inline; font-size: 8px; line-height: 1; }
.fragment-part.is-owned { border-color: #e2bd62; color: #997128; background: linear-gradient(180deg, #fff1cb, #f4dfac); }
.is-ready .fragment-part.is-owned { border-color: #dfb443; color: #7d591a; background: linear-gradient(180deg, #f5d577, #eec557); }
.fragment-status-copy { min-height: 24px; margin: 9px 0 8px; color: #9da1a7; font-size: 9px; line-height: 16px; }
.is-ready .fragment-status-copy { color: #a8812d; }
.fragment-craft { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 38px; margin-top: auto; padding: 8px 9px; border: 1px solid #e3b348; border-radius: 10px; color: #342a17; background: linear-gradient(180deg, #f7d56b, #e7b443); box-shadow: inset 0 1px 0 #fff8, 0 5px 12px #bd90221a; font: inherit; font-size: 12px; font-weight: 700; line-height: 20px; cursor: pointer; }
.fragment-craft-icon { width: 14px; height: 14px; flex: 0 0 auto; }
.fragment-craft-label { min-width: 0; }
.fragment-craft:hover:not(:disabled) { border-color: #bb8d2c; background: #f1cd6b; }
.fragment-craft:disabled { color: #a3a4a3; border-color: #e9e6df; background: #f4f2ed; box-shadow: none; cursor: default; }
.fragment-retired { margin: -10px 0 9px; color: #9a8160; font-size: 9px; line-height: 15px; }
.fragment-progress, .fragment-quantities { display: none; }
.fragment-drop-source { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.fragments-note { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; margin: 21px 0 0; color: #a9a399; font-size: 10px; line-height: 1.7; text-align: center; }
.fragments-note-icon { width: 12px; height: 12px; flex: 0 0 auto; color: #b6a178; }
.fragments-note i { width: 3px; height: 3px; margin: 0 5px; border-radius: 50%; background: #c9bea9; }
.fragments-note strong { color: #a69470; font-weight: 400; }
.fragments-intro { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.fragments-eyebrow { color: #98702c; font-size: 10px; font-weight: 700; letter-spacing: .17em; }
.fragments-feedback { margin: 0 0 18px; padding: 12px 15px; border: 1px solid #dce5d6; border-radius: 11px; color: #4c7057; background: #f4f8ef; font-size: 12px; line-height: 1.8; }
.fragments-feedback.is-error { border-color: #edcfbb; color: #a14635; background: #fff4ed; }
.fragments-pending { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 0 18px; padding: 14px 16px; border: 1px solid #e4d3ad; border-radius: 11px; background: #fff8e8; }
.fragments-pending p { margin: 0; color: #96753b; font-size: 12px; line-height: 1.8; }
.fragments-loading, .fragments-empty { padding: 48px 24px; border: 1px solid #e5daca; border-radius: 16px; color: #8b867d; background: #fffdf8; text-align: center; font-size: 13px; }
.fragments-empty h4 { margin: 15px 0 8px; color: var(--fragment-ink); font-size: 19px; font-weight: 600; }
.fragments-empty p { margin: 0; font-size: 12px; line-height: 1.8; }
.fragments-history { margin-top: 26px; padding: 20px 22px; border: 1px solid #e5ded1; border-radius: 15px; background: #fffcf6; }
.fragments-history-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 5px; }
.fragments-history-heading h4 { margin: 0; color: var(--fragment-ink); font-size: 16px; line-height: 1.7; }
.fragments-history-heading span { color: #9a907d; font-size: 11px; }
.fragments-history-rows { margin: 0; padding: 0; list-style: none; }
.fragments-history-row { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid #eee7d9; }
.fragments-history-row:last-child { padding-bottom: 0; border-bottom: 0; }
.fragments-history-item, .fragments-history-receipt { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 11px; line-height: 1.7; }
.fragments-history-item strong { color: #4b5664; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.fragments-history-item span { color: #8c927c; }
.fragments-history-receipt { flex-shrink: 0; align-items: flex-end; color: #9f9684; font-variant-numeric: tabular-nums; }
.fragments-history-empty { margin: 18px 0 1px; color: #9b9281; font-size: 12px; line-height: 1.8; }

@container fragment-store (max-width: 900px) {
    .fragments-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container fragment-store (max-width: 660px) {
    .fragments-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .fragments-heading { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
    .fragments-heading-actions { flex-direction: row; align-items: center; justify-content: space-between; width: 100%; }
    .fragments-pending { align-items: flex-start; flex-direction: column; gap: 10px; }
    .fragments-history { padding: 17px; }
    .fragments-history-row { flex-direction: column; gap: 7px; }
    .fragments-history-receipt { align-items: flex-start; flex-direction: row; flex-wrap: wrap; gap: 5px 12px; }
}
@container fragment-store (max-width: 440px) {
    .fragments-grid { grid-template-columns: minmax(0, 1fr); }
    .fragments-note { gap: 5px 7px; }
}
