/* The Pro Shop and the reveal (stage 2, plan B, task 9). Linked from
   index.html; only this screen's own rules go here. Ported from v1's
   (game/index.html 175-296, 680-757), every rule scoped to .shop. */

main:has(> .shop) { max-width: 76rem; }

.shop {
  --field-2: #1B1E19; --chalk-dim: var(--muted); --good: #5FBF6A; --blue-lt: #7FB8E6;
  --mono: "Share Tech Mono", ui-monospace, Menlo, Consolas, monospace;
  background: transparent; padding: 0;
}
.shop .eyebrow { margin: 0; font-family: var(--mono); font-size: 12px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--chalk-dim); }
.shop .hint { margin: 0; }
.shop-message { background: var(--panel); padding: 20px; border-radius: 12px; }
.shop-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .75rem; }

/* ---- the shop: three columns on the PC, stacked on a phone ---- */
.shop-top { display: flex; align-items: center; gap: 10px; padding: 4px 0 8px; }
.shop-top > button { flex: 0 0 auto; padding: .55rem .9rem; }
.shop-title { flex: 1; text-align: center; font-size: 26px; margin: 0; color: var(--gold); }
.shop-top-spacer { width: 96px; }
@media (max-width: 480px) { .shop-top-spacer { display: none; } .shop-title { text-align: right; } }
.shop-msg { margin: 6px 0 0; }
.shop-grid { display: grid; grid-template-columns: 5fr 4fr 3fr; gap: 20px; align-items: start; margin-top: 10px; }
@media (max-width: 900px) { .shop-grid { grid-template-columns: 1fr; } }
.shop-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.shop-card { background: var(--field-2); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; min-width: 0; }
.shop-balance { font-family: var(--display); font-size: 60px; line-height: 1; color: var(--gold); margin-top: 6px; }
.shop-cta { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; margin-top: 16px;
  border-radius: 14px; padding: 14px 18px; border: 1px solid var(--line); background: var(--panel); color: var(--chalk); }
.shop-cta.gold { background: var(--gold); border-color: var(--gold); color: #241A02; }
.shop-cta.dad { border-color: var(--gold); }
.shop-cta + .shop-cta { margin-top: 10px; }
.shop-cta .ico { font-size: 26px; line-height: 1; }
.shop-cta .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shop-cta b { font-size: 18px; }
.shop-cta small { font-size: 13px; opacity: .85; margin-top: 2px; font-weight: 400; }
.shop-cta .chev { font-family: var(--mono); font-size: 22px; }
.shop-cta:disabled { opacity: .45; filter: saturate(.4); }
.shop-dad { font-size: 13px; color: var(--chalk-dim); margin: 12px 0 0; min-height: 18px; }
.shop-challenge { width: 100%; }

.shop-swap { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.shop-swap .swap-ico { font-size: 22px; color: var(--gold); }
.shop-swap .grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.shop-swap .dots, .shop-swap button, .shop-swap .swap-ico { flex-shrink: 0; }
@media (max-width: 560px) { .shop-swap { flex-wrap: wrap; } .shop-swap .grow { flex-basis: calc(100% - 40px); } }
.shop-swap b { font-size: 15px; }
.shop-swap small { font-size: 12px; color: var(--chalk-dim); margin-top: 1px; }
.shop-swap .dots { display: flex; gap: 4px; }
.shop-swap .dots i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--line); display: block; }
.shop-swap .dots i.on { background: var(--gold); border-color: var(--gold); }

.shop .earn-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.shop .earn-list li { display: flex; justify-content: space-between; gap: 10px; }
.shop .earn-list i { font-style: normal; font-family: var(--mono); color: var(--gold); }
.shop-note { font-size: 12px; color: var(--chalk-dim); margin: 14px 0 0; line-height: 1.45; }

/* the chase: the rare ones, as a goal he can hold */
.shop .chase h2 { font-family: var(--display); font-size: 34px; line-height: 1.05; margin: 8px 0 0; color: var(--chalk); }
.shop .chase .sub { font-size: 14px; color: var(--chalk-dim); margin: 8px 0 0; }
.chase-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.chase-grid img { width: 100%; aspect-ratio: 5/7; object-fit: cover; border-radius: 6px; border: 2px solid var(--gold); display: block; }
.chase-grid .gap { aspect-ratio: 5/7; border-radius: 6px; background: #1A1D17; border: 1px dashed var(--gold);
  display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 20px; color: var(--gold); opacity: .8; }
.chase-note { font-size: 12px; color: var(--chalk-dim); margin: 8px 0 0; }
.chase-set { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.chase-set .head { display: flex; align-items: baseline; gap: 8px; }
.chase-set .head b { flex: 1; font-size: 14px; }
.chase-set .head span { font-family: var(--mono); font-size: 12px; color: var(--good); }
.chase-set .name { font-size: 13px; color: var(--chalk-dim); margin-top: 2px; }
.chase-set .bar { height: 6px; border-radius: 3px; background: var(--panel); overflow: hidden; margin-top: 8px; }
.chase-set .bar i { display: block; height: 100%; width: 0; background: var(--good); }

/* ---- the wrapper: a 13-frame sprite (images/packwrap.webp), shaken, then torn */
.pack-fan { display: block; }
.packwrap { position: relative; z-index: 3; width: 200px; height: 280px; margin: 18px auto 0; }
.pk-sprite { position: absolute; inset: 0; background: url("../images/packwrap.webp") 0 0 / 2600px 280px no-repeat; }
.pk-count { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--mono); font-size: 12px; letter-spacing: .14em; color: #FFF4D6;
  background: rgba(11, 16, 32, .7); border-radius: 20px; padding: 4px 10px; }
.packwrap.shake { animation: packshake .62s ease-in-out; }
.packwrap.tear .pk-sprite { animation: packTear .56s steps(12) forwards; }
.packwrap.tear .pk-count { opacity: 0; transition: opacity .2s; }
@keyframes packTear { from { background-position: 0 0; } to { background-position: -2400px 0; } }
@keyframes packshake {
  0%, 100% { transform: rotate(0) translateX(0) scale(1); }
  15% { transform: rotate(-3deg) translateX(-5px) scale(1.015); }
  32% { transform: rotate(3deg) translateX(5px) scale(.99); }
  50% { transform: rotate(-4deg) translateX(-6px) scale(1.02); }
  68% { transform: rotate(4deg) translateX(6px) scale(.985); }
  85% { transform: rotate(-2deg) translateX(-3px) scale(1.01); }
}
@media (prefers-reduced-motion: reduce) {
  .packwrap.shake, .packwrap.tear .pk-sprite { animation: none; }
  .packwrap.tear { display: none; }
}

/* the swap: three face-up cards the database offered */
.swap-head { margin: 16px 0 8px; font-size: 14px; color: var(--chalk-dim); }
.swap-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.swap-pick { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px;
  background: var(--panel); color: var(--chalk); border: 2px solid var(--line); border-radius: 12px; min-width: 0; }
.swap-pick.star { border-color: var(--blue-lt); }
.swap-pick.superstar, .swap-pick.legend { border-color: var(--gold); }
.swap-pick .photo, .swap-pick .drawn { width: 100%; aspect-ratio: 5/7; border-radius: 8px; }
.swap-pick .pick-name { font-size: 13px; line-height: 1.2; overflow-wrap: anywhere; }
.swap-pick .pick-tier { font-size: 11px; font-weight: 400; color: var(--chalk-dim); }

/* a card face, photo or drawn (shared by the reveal, the minis, the summary) */
.shop .photo { display: block; width: 100%; aspect-ratio: 5/7; object-fit: cover; }
.shop .drawn { position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  width: 100%; aspect-ratio: 5/7; background: linear-gradient(170deg, #2A3024, #171A15); overflow: hidden; }
.shop .drawn .card-art { position: absolute; inset: 0 0 18% 0; width: 100%; height: 82%; }
.shop .drawn-name { position: relative; padding: 6px 8px; font-family: var(--display); font-size: 13px; line-height: 1.15;
  background: rgba(0, 0, 0, .55); color: var(--chalk); overflow-wrap: anywhere; }
.shop .pack-mystery { display: flex; align-items: center; justify-content: center; aspect-ratio: 5/7;
  font-family: var(--display); font-size: 54px; color: var(--gold); opacity: .65; }

/* ---- the reveal: one card, one moment ---- */
.shop.reveal { position: relative; min-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; }
.shop.reveal .rays { position: absolute; inset: -40%; pointer-events: none;
  background: repeating-conic-gradient(rgba(253, 184, 39, .11) 0 12deg, transparent 12deg 30deg);
  animation: raysTurn 40s linear infinite; }
@keyframes raysTurn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .shop.reveal .rays { animation: none; } }
.reveal-top { position: relative; display: flex; align-items: center; gap: 12px; padding: 4px 0 10px; }
.reveal-top .eyebrow { flex: 1; }
.reveal-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.reveal-dots i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--line); display: block; }
.reveal-dots i.out { background: var(--chalk-dim); border-color: var(--chalk-dim); }
.reveal-dots i.now { background: var(--gold); border-color: var(--gold); }
.reveal-stage { position: relative; flex: 1; display: grid; grid-template-columns: minmax(120px, 280px) minmax(0, 1fr) minmax(120px, 280px);
  align-items: center; gap: 16px; }
.reveal-side { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.reveal-side.right { align-items: flex-end; }
.reveal-side .lbl { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--chalk-dim); }
.reveal-side .row { display: flex; gap: 10px; flex-wrap: wrap; }
.reveal-side .mini { position: relative; width: 76px; border-radius: 8px; overflow: hidden; border: 2px solid var(--line); }
.reveal-side .mini.star { border-color: var(--blue-lt); }
.reveal-side .mini.superstar, .reveal-side .mini.legend { border-color: var(--gold); }
.reveal-side .mini.dup { opacity: .7; }
.reveal-side .mini .drawn-name { font-size: 9px; padding: 3px 4px; }
.shop .new { position: absolute; top: 6px; right: 6px; background: var(--gold); color: #241A02; font-family: var(--mono);
  font-size: 9px; padding: 2px 5px; border-radius: 4px; font-weight: 700; }
/* a phone: the one card alone (after .reveal-side, so it wins) */
@media (max-width: 760px) { .reveal-stage { grid-template-columns: 1fr; gap: 10px; } .reveal-side { display: none; } }
.reveal-stack { position: relative; width: 116px; height: 170px; }
.reveal-stack .facedown { position: absolute; width: 100px; aspect-ratio: 5/7; border-radius: 8px;
  background: linear-gradient(160deg, #23324a, #0f1a2b); border: 2px solid var(--blue-lt);
  display: flex; align-items: center; justify-content: center; color: var(--blue-lt); font-size: 28px; }
.reveal-stack .fd0 { left: 0; top: 0; }
.reveal-stack .fd1 { left: 5px; top: 5px; }
.reveal-stack .fd2 { left: 10px; top: 10px; }
.reveal-stack .fd3 { left: 15px; top: 15px; }
.reveal-main { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.reveal-card { position: relative; width: min(300px, 64vw); border-radius: 16px; overflow: hidden;
  border: 4px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: cardIn .45s cubic-bezier(.2, .9, .3, 1.2) both; }
.reveal-card.star { border-color: var(--blue-lt); }
.reveal-card.superstar { border-color: var(--gold); box-shadow: 0 0 0 5px rgba(253, 184, 39, .18), 0 30px 80px rgba(0, 0, 0, .6); }
.reveal-card.legend { border-color: var(--gold); box-shadow: 0 0 0 6px rgba(253, 184, 39, .25), 0 0 60px rgba(253, 184, 39, .35), 0 30px 80px rgba(0, 0, 0, .6); }
.reveal-card .new { top: 14px; right: 14px; font-size: 12px; letter-spacing: .1em; padding: 5px 9px; border-radius: 6px; }
.reveal-card .drawn-name { font-size: 18px; padding: 10px 12px; }
@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(.92); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .reveal-card { animation: none; } }
.reveal-name { text-align: center; }
.reveal-name .tier { font-family: var(--display); font-size: 30px; line-height: 1.1; letter-spacing: .04em; color: var(--chalk-dim); }
.reveal-name .tier.star { color: var(--blue-lt); }
.reveal-name .tier.superstar, .reveal-name .tier.legend { color: var(--gold); }
.reveal-name .rv-who { font-family: var(--display); font-size: 24px; line-height: 1.15; margin-top: 4px; }
.reveal-name .meta { font-size: 14px; color: var(--chalk-dim); margin-top: 4px; }
.reveal-foot { position: relative; display: flex; justify-content: center; align-items: center; gap: 14px; padding: 18px 0 10px; flex-wrap: wrap; }
.reveal-foot .reveal-next { font-size: 17px; padding: 14px 34px; border-radius: 28px; }

/* ---- the summary ---- */
.summary-body { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 20px; padding: 20px 0; }
.summary-body h1 { font-size: 34px; margin: 0; }
.summary-cards { display: flex; gap: 16px; align-items: flex-end; justify-content: center; flex-wrap: wrap; }
.summary-cards .one { position: relative; width: 120px; }
.summary-cards .one.best { width: 150px; }
@media (max-width: 480px) { .summary-cards { gap: 10px; } .summary-cards .one { width: 92px; } .summary-cards .one.best { width: 112px; } }
.summary-cards .one > .photo, .summary-cards .one > .drawn, .summary-cards .one > .pack-mystery { border-radius: 10px; border: 2px solid var(--line); }
.summary-cards .one.star > .photo, .summary-cards .one.star > .drawn { border-color: var(--blue-lt); }
.summary-cards .one.superstar > .photo, .summary-cards .one.superstar > .drawn { border-color: var(--gold); }
.summary-cards .one.legend > .photo, .summary-cards .one.legend > .drawn { border: 3px solid var(--gold); box-shadow: 0 0 0 5px rgba(253, 184, 39, .22); }
.summary-cards .one.dup > .photo, .summary-cards .one.dup > .drawn { opacity: .75; }
.summary-cards .one .new { top: 8px; right: 8px; font-size: 10px; padding: 3px 6px; }
.summary-cards .one .cap { font-size: 12px; color: var(--chalk-dim); margin-top: 6px; }
.summary-cards .one.legend .cap { font-family: var(--display); color: var(--gold); letter-spacing: .06em; }
.summary-moves { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.summary-moves .mv { background: var(--field-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.summary-moves .mv b { font-family: var(--mono); font-size: 20px; font-weight: 400; color: var(--gold); }
.summary-moves .mv b.good { color: var(--good); }
.summary-moves .mv span { font-size: 13px; color: var(--chalk-dim); }

/* a feat the pack earned: the binder's own card face, turned by a tap */
.summary-feats { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.summary-feats .bcard { width: 150px; padding: 0; background: var(--panel); color: var(--chalk); border: 2px solid var(--gold); border-radius: 12px; overflow: hidden; }
.summary-feats .bcard .card-art { display: block; width: 100%; height: auto; }
.summary-feats .bcard .card-name { font-family: var(--display); font-size: 14px; padding: 6px 8px 0; }
.summary-feats .bcard .card-pos { font-size: 11px; color: var(--chalk-dim); padding: 0 8px 8px; }
.summary-feats .bcard .back { display: none; padding: 10px; font-size: 12px; font-weight: 400; }
.summary-feats .bcard .back h5 { margin: 0 0 6px; font-size: 14px; }
.summary-feats .bcard .back p { margin: 0 0 6px; }
.summary-feats .bcard.flipped .face { display: none; }
.summary-feats .bcard.flipped .back { display: block; }
