/* RareFoil guided add: mobile-first, no change to existing collection editor or saved cards. */
.cosmic-collections .library-dialog{width:min(96vw,690px);max-height:min(94dvh,960px);overscroll-behavior:contain}
.rf-catalog{padding:18px;border:1px solid #c8a7df;background:linear-gradient(130deg,#fffaf2 0%,#f7ebff 63%,#f5f9ff 100%);border-radius:20px;margin:0 0 22px;color:#50206c;box-shadow:0 8px 25px #6d24800d}
.rf-catalog[hidden]{display:none!important}
.rf-catalog-title{display:flex;flex-direction:column;gap:6px}
.rf-catalog-title .rf-kicker{font-size:10px;font-weight:800;letter-spacing:.14em;color:#873b9c}
.rf-catalog-title h3{font:600 clamp(21px,4vw,27px)/1.2 Georgia,serif;margin:0;color:#522277}
.rf-hint,.rf-footnote{font-size:12px;line-height:1.5;color:#775b88;margin:9px 0}
.rf-coverage{margin:14px 0 17px;padding:13px;border:1px solid #d9bedc;border-radius:17px;background:linear-gradient(125deg,#fffdf8 0%,#f8eeff 55%,#f5f8ff 100%);box-shadow:0 5px 18px #50206c09}
.rf-coverage[hidden]{display:none!important}
.rf-coverage-kicker{margin:0 0 10px;font:800 10px/1.3 system-ui,sans-serif;letter-spacing:.09em;color:#764185}
.rf-coverage-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
.rf-coverage-stat{min-width:0;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;gap:4px;padding:11px 5px;background:#ffffffb8;border:1px solid #e8d8ee;border-radius:12px}
.rf-coverage-number{color:#5e2188;font:750 clamp(18px,2.7vw,24px)/1.1 system-ui,sans-serif;letter-spacing:-.045em;font-variant-numeric:tabular-nums}
.rf-coverage-label{color:#795c83;font:650 10px/1.25 system-ui,sans-serif;overflow-wrap:anywhere}
.rf-coverage-note{font:500 10px/1.5 system-ui,sans-serif;color:#755a7f;margin:10px 2px 0}
@media(max-width:560px){.rf-coverage{padding:10px;margin:12px 0 14px}.rf-coverage-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-coverage-stat{padding:10px 6px}.rf-coverage-number{font-size:23px}.rf-coverage-label{font-size:10px}}
.rf-footnote{margin:16px 0 0}
.rf-status{font-size:12px;color:#6e4196;min-height:0;margin:7px 0}
.rf-status:empty{display:none}
.rf-stage{display:flex;flex-direction:column;gap:10px}
.rf-stage h4{font:650 17px/1.3 system-ui,sans-serif;color:#62268b;margin:6px 0 2px}
.rf-start-choices{display:grid;gap:9px;grid-template-columns:1fr 1fr}
.rf-lang-label{display:grid;gap:5px;font-size:12px;font-weight:700;color:#59257b}
.rf-language,.rf-search{width:100%;min-width:0;border-radius:13px;border:1px solid #bda4cc;background:#fffdfb;color:#4c2864;min-height:48px;font-size:15px;padding:12px}
.rf-language{max-width:260px}
.rf-search:focus-visible,.rf-language:focus-visible,.rf-catalog button:focus-visible{outline:3px solid #9b66c9;outline-offset:2px}
.rf-catalog button{touch-action:manipulation;font:600 12px/1.35 system-ui,sans-serif;cursor:pointer;transition:background-color .15s,border-color .15s,transform .15s}
.rf-feature-choice,.rf-choice,.rf-set,.rf-species,.rf-card,.rf-variant{background:#fff9fe;color:#5e2a82;border:1px solid #cdb1d6;border-radius:14px;min-height:48px;padding:10px}
.rf-feature-choice{font-size:13px!important;min-height:70px;padding:13px}
.rf-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;max-height: min(43dvh,370px);overflow:auto;overscroll-behavior:contain;padding:2px 2px 5px;scrollbar-width:thin}
.rf-species{text-align:left!important;display:flex;align-items:center;gap:7px;min-width:0;overflow-wrap:anywhere}
.rf-species strong{font-size:12px}
.rf-dex{flex-shrink:0;color:#9568ac;font-size:10px}
.rf-set{display:flex;align-items:center;text-align:left;gap:8px;min-width:0;padding:8px}
.rf-set .rf-img,.rf-set .rf-img-fallback{width:52px;height:52px;object-fit:contain;flex-shrink:0;background:#f1e7f6;border-radius:9px}
.rf-set-label{display:grid;gap:4px;min-width:0;overflow-wrap:anywhere}
.rf-set-label strong{font-size:11px}
.rf-set-label small{font-size:10px;color:#866994}
.rf-card{display:flex;flex-direction:column;align-items:center;text-align:center;gap:7px;min-width:0;overflow-wrap:anywhere}
.rf-card .rf-img,.rf-card .rf-img-fallback{width:100%;height:145px;object-fit:contain;border-radius:9px;background:#f2eafa}
.rf-card strong{font-size:11px}
.rf-card small{font-size:10px;color:#775284}
.rf-unlisted-label{display:flex;flex-direction:column;gap:6px;color:#652f7c;font-size:12px;font-weight:700}
.rf-add-unlisted{background:#f3e7ff;border:1px solid #b990db;border-radius:12px;color:#5a267c;padding:12px;font-size:13px;min-height:49px;width:100%;font-weight:700;cursor:pointer}
.rf-add-unlisted:hover{background:#edd9ff}
.rf-vintage-start{grid-column:1/-1;background:linear-gradient(125deg,#e5d5fb,#fff3d5)!important;color:#5d307e!important;font-size:13px!important;min-height:64px!important}
.rf-vintage-groups{display:flex;gap:7px;overflow-x:auto;padding:5px 1px 7px;scrollbar-width:thin}
.rf-vintage-group{flex:0 0 auto;border:1px solid #c3a2d5;background:#fff9ff;color:#623981;border-radius:999px;padding:8px 11px;min-height:40px}
.rf-vintage-group[aria-pressed=true]{background:#703493;color:#fff;border-color:#703493}
.rf-vintage-fields{display:grid;gap:10px}
.rf-oddity-set .rf-img-fallback{width:52px;height:52px;flex-shrink:0}
.rf-img-fallback{display:grid;place-items:center;min-width:0;overflow:hidden;padding:5px;border:1px solid #d6badd;background:linear-gradient(145deg,#f7e8ff,#fff9ec);color:#643182;text-align:center;box-sizing:border-box}
.rf-fallback-label{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;overflow-wrap:anywhere;font:700 10px/1.2 system-ui,sans-serif;max-width:100%;max-height:100%}
.rf-img-fallback-card .rf-fallback-label{font-size:14px;-webkit-line-clamp:4}
.rf-preview>.rf-img-fallback,.rf-picked>.rf-img-fallback{width:100px;min-height:125px;flex-shrink:0;border-radius:10px}
.rf-preview>.rf-img-fallback .rf-fallback-label,.rf-picked>.rf-img-fallback .rf-fallback-label{font-size:13px}
.rf-card:hover,.rf-set:hover,.rf-species:hover,.rf-feature-choice:hover,.rf-variant:hover{background:#f3e5ff;border-color:#9b60bc}
.rf-card:active,.rf-set:active,.rf-species:active{transform:scale(.99)}
.rf-catalog-nav{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:12px}
.rf-link,.rf-more{font-size:12px!important;min-height:44px;border-radius:999px;padding:9px 13px;background:transparent;color:#7436a4;border:1px solid #c7a6d8}
.rf-link:hover,.rf-more:hover{background:#f1e0fa}
.rf-more[hidden]{display:none!important}
.rf-preview{display:flex;gap:15px;align-items:center;background:#fffdff;border:1px solid #e2d1ea;border-radius:14px;padding:12px}
.rf-preview>.rf-img,.rf-preview>.rf-img-empty{width:100px;max-height:147px;object-fit:contain;flex-shrink:0}
.rf-preview-copy{min-width:0;overflow-wrap:anywhere}
.rf-preview-copy h4{margin:0 0 8px}
.rf-preview-copy p{font-size:12px;margin:5px 0;color:#795f86}
.rf-variants{display:flex;flex-wrap:wrap;gap:8px}
.rf-variant.is-selected{background:#6e2da3;color:#fff;border-color:#6e2da3}
.rf-editions{flex:1 1 100%;display:flex;gap:6px;flex-wrap:wrap;align-items:center;padding-top:10px;border-top:1px solid #dfc7ec}
.rf-editions .rf-hint{width:100%;margin:0}
.rf-apply{min-height:49px;background:linear-gradient(110deg,#7722b7,#b12296);color:white;border:0;border-radius:999px;padding:10px 20px}
.rf-apply:disabled{opacity:.48;cursor:not-allowed}
.rf-picked{display:flex;align-items:center;gap:12px;padding:10px 0}
.rf-picked .rf-img,.rf-picked .rf-img-empty{width:62px;height:84px;object-fit:contain;border-radius:8px}
.rf-picked>div:last-child{display:grid;gap:5px;min-width:0;overflow-wrap:anywhere}
.rf-picked strong{font-size:13px}
.rf-picked small{font-size:11px}
.rf-picked .rf-hint{margin:0}
.rf-complete{padding:12px 15px}
.rf-complete .rf-catalog-title h3{font-size:19px}
.rf-complete>.rf-hint{display:none}
.cosmic-collections .library-editor>.rf-catalog{order:-1}
.cosmic-collections .library-editor>.rf-catalog button{width:auto}
.cosmic-collections .library-editor>.rf-catalog .rf-feature-choice{width:100%}
.cosmic-collections .library-editor>.rf-catalog .rf-card,.cosmic-collections .library-editor>.rf-catalog .rf-set,.cosmic-collections .library-editor>.rf-catalog .rf-species{width:100%}
.cosmic-collections .library-editor>.rf-catalog .rf-apply{width:100%}
.cosmic-collections .library-editor>.rf-catalog .rf-language{background:#fff;color:#512b61}
@media(max-width:500px){.rf-catalog{padding:12px;margin-bottom:17px;border-radius:16px}.rf-start-choices{grid-template-columns:1fr 1fr}.rf-feature-choice{padding:9px;font-size:11px!important}.rf-grid{gap:6px;max-height:38dvh}.rf-set{gap:5px;padding:7px}.rf-set .rf-img,.rf-set .rf-img-fallback{width:41px;height:45px}.rf-card .rf-img,.rf-card .rf-img-fallback{height:121px}.rf-preview>.rf-img,.rf-preview>.rf-img-fallback{width:80px}.rf-dex{font-size:9px}.rf-species{gap:4px;padding:8px}.rf-species strong{font-size:11px}}
@media(prefers-reduced-motion:reduce){.rf-catalog button{transition:none}}


/* Full-index quick-add route: accessible on touchscreens without requiring
   keyboard input; shortcuts and card results are always distinct buttons. */
.rf-quick-start{grid-column:1/-1;background:linear-gradient(110deg,#ecfaff,#f2e5ff)!important;color:#3b3982!important;border-color:#84bfe9!important;font-weight:800!important;min-height:60px!important}
.rf-quick-presets{display:flex;gap:7px;overflow-x:auto;overscroll-behavior-x:contain;padding:4px 0 8px;scrollbar-width:thin}
.rf-quick-chip{flex:0 0 auto;min-height:42px;padding:9px 13px;background:#e9f8ff;color:#234579;border:1px solid #98bde6;border-radius:999px;font-weight:780!important}
.rf-quick-chip:hover,.rf-quick-chip:focus-visible{background:#d5edff;border-color:#498ec2}
.rf-quick-results{max-height:min(49dvh,440px)}
.rf-quick-card{gap:6px!important}
.rf-quick-label{display:grid;gap:4px;width:100%;min-width:0}
.rf-quick-label strong{font-size:12px;overflow-wrap:anywhere}
.rf-quick-label small{font-size:10px;color:#685284;overflow-wrap:anywhere}
@media(max-width:500px){.rf-quick-start{font-size:12px!important}.rf-quick-card .rf-img,.rf-quick-card .rf-img-fallback{height:116px}.rf-quick-label strong{font-size:11px}}


/* Reliable visual references: printed symbols and exact indexed card fronts. */
.rf-set .rf-img-fallback,.rf-card .rf-img-fallback{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
.rf-img-fallback .rf-fallback-mark{
  max-width:100%;color:#19385b;font:900 clamp(13px,2.7vw,24px)/1.06 system-ui,sans-serif;
  letter-spacing:-.035em;overflow-wrap:anywhere;text-shadow:0 1px #fff;
}
.rf-set .rf-img-fallback .rf-fallback-mark{font-size:clamp(10px,2.3vw,16px)}
.rf-img-fallback .rf-fallback-detail{color:#4d6691;font:680 9px/1.15 system-ui,sans-serif;overflow-wrap:anywhere}
.rf-set .rf-img-fallback{background:linear-gradient(140deg,#f2faff,#ddeaff);border-color:#aac7e6}
.rf-set .rf-img-fallback .rf-fallback-label{font-size:8px;line-height:1.05;-webkit-line-clamp:2}
.rf-set .rf-img-fallback .rf-fallback-detail{font-size:8px;line-height:1.05}
.rf-card .rf-img-fallback{background:linear-gradient(140deg,#fffdf6,#e5eeff);border:1px dashed #a8b6d8}
.rf-card .rf-img-fallback .rf-fallback-label{font-size:11px;-webkit-line-clamp:3}
.rf-card .rf-img-fallback .rf-fallback-detail{font-size:10px}
.rf-preview>.rf-img{width:min(31vw,155px);max-height:224px;height:auto;max-width:44%;object-fit:contain;flex-shrink:0}
.rf-artwork-caveat{border-left:3px solid #6799bd;background:#eef7ff;padding:9px 11px;color:#375778!important;border-radius:6px}
.rf-quick-card .rf-img{aspect-ratio:245/337;object-fit:contain}
@media(max-width:500px){
 .rf-preview>.rf-img{width:112px;max-width:40%;max-height:172px}
 .rf-set .rf-img-fallback .rf-fallback-detail{display:none}
 .rf-set .rf-img-fallback .rf-fallback-label{font-size:7px}
}

/* Compact sprite selector — art is a character clue, not a card scan. */
.rf-species-portrait{height:40px;width:40px;max-width:40px;object-fit:contain;flex-shrink:0;image-rendering:auto;filter:drop-shadow(0 2px 2px #5b4b751c)}
.rf-species:has(.rf-species-portrait){gap:5px}
@media(max-width:500px){.rf-species-portrait{height:32px;width:32px;max-width:32px}.rf-species:has(.rf-species-portrait){padding:5px;gap:4px}}


/* Manual set picker: recognizable release logo + exact printed set mark.
   The small badge does not displace the set name on narrow phone screens. */
.rf-set-art-pair{
  display:block;position:relative;flex:0 0 65px;width:65px;height:56px;
  min-width:0;overflow:visible;isolation:isolate;
}
.rf-set-art-main{
  display:flex;align-items:center;justify-content:center;
  width:51px;height:51px;overflow:hidden;flex-shrink:0;
  background:linear-gradient(150deg,#f9faff,#e8ecff);
  border:1px solid #d8c7e6;border-radius:10px;
}
.rf-set-art-main .rf-set-hero-image,
.rf-set-art-main>.rf-img,
.rf-set-art-main>.rf-img-fallback{
  width:100%!important;height:100%!important;max-width:100%;
  object-fit:contain;box-sizing:border-box;
  background:transparent!important;border-radius:8px;
}
.rf-set-art-main .rf-set-hero-image{padding:3px}
.rf-set-symbol-pin{
  position:absolute;right:0;bottom:0;z-index:1;
  display:flex;align-items:center;justify-content:center;
  width:33px;height:33px;min-width:33px;
  overflow:hidden;border-radius:10px;
  border:2px solid #fff;
  background:#f5faff;
  box-shadow:0 2px 6px #263e6844,inset 0 0 0 1px #9ab2d7;
}
.rf-set-symbol-image{display:block;width:29px;height:29px;max-width:100%;max-height:100%;object-fit:contain;padding:2px;box-sizing:border-box}
.rf-set-symbol-unknown{
  padding:2px 1px;background:#e5edfc;color:#35527e;
  text-align:center;white-space:pre-line;overflow-wrap:anywhere;
  font:850 7px/1.05 system-ui,sans-serif;letter-spacing:-.015em;
}
.rf-set .rf-set-label{flex:1 1 auto;min-width:0}
.rf-set-art-help{margin:1px 0 6px!important;color:#6c537e!important}
@media(max-width:500px){
  .rf-set-art-pair{width:57px;flex-basis:57px;height:50px}
  .rf-set-art-main{width:46px;height:46px}
  .rf-set-symbol-pin{width:29px;height:29px;min-width:29px;border-radius:8px}
  .rf-set-symbol-image{width:26px;height:26px}
  .rf-set-symbol-unknown{font-size:6px}
  .rf-set{min-height:62px}
  .rf-set-label strong{line-height:1.17}
}
@media(max-width:370px){
  .rf-set-art-pair{flex-basis:51px;width:51px}
  .rf-set-art-main{width:42px;height:43px}
  .rf-set-symbol-pin{width:27px;height:27px;min-width:27px}
}


/* Only a sourced printed mark gets a corner badge.
   Without a mark, leave the existing release art clean — no label/pill. */
.rf-set-art-pair--solo{flex-basis:53px;width:53px;height:53px}
.rf-set-art-pair--solo .rf-set-art-main{width:51px;height:51px}
.rf-set-name-art{
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;
  max-width:100%;overflow:hidden;overflow-wrap:anywhere;
  text-align:center;color:#325276;font:800 8px/1.13 system-ui,sans-serif;
  letter-spacing:-.02em;padding:3px;
}
@media(max-width:500px){
 .rf-set-art-pair--solo{flex-basis:47px;width:47px;height:47px}
 .rf-set-art-pair--solo .rf-set-art-main{width:46px;height:46px}
 .rf-set-name-art{font-size:7px}
}
@media(max-width:370px){
 .rf-set-art-pair--solo{flex-basis:44px;width:44px;height:44px}
 .rf-set-art-pair--solo .rf-set-art-main{width:42px;height:43px}
}


/* Actual printed modern set codes, distinct from older illustrated symbols. */
.rf-set-code-pin{
  font:950 10px/1 system-ui,sans-serif;
  letter-spacing:-.03em;color:#fff;
  background:linear-gradient(150deg,#26354e,#0d192c);
  border-color:#fff;box-shadow:0 2px 6px #23365055,inset 0 0 0 1px #60738b;
  white-space:nowrap;text-align:center;
}
.rf-set-symbol-pin:not(.rf-set-code-pin){background:#fff;box-shadow:0 2px 6px #23365045}
.rf-set-symbol-pin .rf-set-symbol-image{object-fit:contain}
@media(max-width:500px){.rf-set-code-pin{font-size:9px}}
@media(max-width:370px){.rf-set-code-pin{font-size:8px}}


/* Official Pocket release IDs are digital catalog identifiers, not print symbols. */
.rf-set-digital-pin{background:linear-gradient(150deg,#41609b,#202f5c);font-size:9px;letter-spacing:-.04em}
.rf-set-code-pin{font-variant-numeric:tabular-nums;overflow:hidden;text-overflow:clip;padding:1px}
@media(max-width:500px){.rf-set-code-pin{font-size:9px}.rf-set-digital-pin{font-size:8px}}


/* Actual archived classic/EX/Sword & Shield marks have transparent light
   strokes. A dark background keeps their real outlines legible on mobile. */
.rf-set-symbol-pin.rf-set-symbol-archive{
 background:linear-gradient(145deg,#263347,#0d1727);
 border-color:#fff;
 box-shadow:0 2px 7px #19253c66,inset 0 0 0 1px #425875;
}
.rf-set-symbol-archive .rf-set-symbol-image{
 width:100%;height:100%;max-width:100%;max-height:100%;
 object-fit:contain;padding:2px;box-sizing:border-box;
}
.rf-set-art-pair .rf-set-name-art{word-break:normal;overflow-wrap:anywhere}
@media(max-width:500px){
 .rf-set-symbol-archive .rf-set-symbol-image{padding:2px}
}

/* An exact-set TCGdex card is a real reference photograph, not a set emblem. */
.rf-set-art-main:has(.rf-set-example-image){position:relative;background:#101729;overflow:hidden}
.rf-set-art-main .rf-set-example-image{width:100%;height:100%;object-fit:contain;background:#101729;padding:1px;box-sizing:border-box}
.rf-set-art-main .rf-set-example-caption{position:absolute;bottom:0;left:0;right:0;background:#111b30d9;color:#fff;font:800 6px/1.2 system-ui,sans-serif;letter-spacing:.045em;text-align:center;padding:3px 1px}
@media(max-width:500px){.rf-set-art-main .rf-set-example-caption{font-size:5.7px;padding:2px 1px}}

/* Vintage photo integrity: approved exact original scan, otherwise distinct release mark. */
.rf-oddity-set .rf-fallback-mark{font:900 clamp(9px,2vw,13px)/1.05 system-ui,sans-serif;letter-spacing:.02em;white-space:pre-line;overflow-wrap:anywhere;max-width:100%}
.rf-vintage-exact-card-photo{display:block;aspect-ratio:245/337;object-fit:contain;max-width:100%;background:#101829}
.rf-vintage-selected-scan{display:block;max-width:min(40vw,190px);max-height:295px;object-fit:contain;background:#101829;border:1px solid #91aaca;border-radius:11px;margin:0 auto 12px}
.rf-vintage-set-photo{object-fit:contain;border:1px solid #abc8dc}
