/* ============================================================
   BuildSpin — overlays: receipt card, jackpot ticket,
   gallery, shared view, modals
   ============================================================ */

/* ================= MODAL SHELL ================= */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal__scrim {
  position: fixed; inset: 0;
  background: rgba(5,3,10,.78);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: scrim-in .3s ease;
}
.modal__scrim--jackpot {
  background:
    radial-gradient(60% 60% at 50% 42%, rgba(255,194,51,.14), transparent 70%),
    rgba(5,3,10,.85);
}
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }

.modal__panel {
  position: relative; z-index: 2;
  margin: auto;
  animation: panel-rise .55s var(--ease-spring);
}
.modal__panel:focus { outline: none; } /* panel takes programmatic focus; buttons keep their rings */
@keyframes panel-rise {
  0% { transform: translateY(64px) scale(.94) rotate(.6deg); opacity: 0; }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}
.modal__close {
  position: absolute; top: -14px; right: -14px; z-index: 5;
  width: 40px; height: 40px; border-radius: 50%;
  background: #201a38; border: 1px solid rgba(244,241,255,.25);
  color: var(--ink-dim); font-size: 15px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
  transition: color .2s, transform .2s;
}
.modal__close:hover { color: var(--ink); transform: rotate(90deg); }

.cardactions {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin-top: 18px;
}

/* ================= THE CURSED BUILD RECEIPT ================= */
.receipt-wrap { perspective: 1200px; }
.receipt {
  --edge: 12px;
  position: relative;
  width: min(460px, calc(100vw - 56px));
  margin: 0 auto;
  background: var(--paper);
  color: var(--paper-ink);
  font-family: var(--font-mono);
  font-size: 13px; line-height: 1.5;
  padding: 26px 26px 30px;
  box-shadow:
    0 30px 80px rgba(0,0,0,.65),
    0 6px 22px rgba(0,0,0,.5);
  /* punched perforation top & bottom */
  -webkit-mask-image:
    radial-gradient(circle 7px at 10px 0, transparent 98%, #000) ,
    radial-gradient(circle 7px at 10px 100%, transparent 98%, #000);
  -webkit-mask-size: 20px 51%, 20px 51%;
  -webkit-mask-position: 0 0, 0 100%;
  -webkit-mask-repeat: repeat-x;
  mask-image:
    radial-gradient(circle 7px at 10px 0, transparent 98%, #000),
    radial-gradient(circle 7px at 10px 100%, transparent 98%, #000);
  mask-size: 20px 51%, 20px 51%;
  mask-position: 0 0, 0 100%;
  mask-repeat: repeat-x;
  transform-style: preserve-3d;
  transition: transform .25s ease-out;
}
/* subtle paper grain */
.receipt::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background:
    repeating-linear-gradient(0deg, rgba(36,29,22,.016) 0 2px, transparent 2px 4px),
    linear-gradient(180deg, rgba(36,29,22,.05), transparent 8%, transparent 92%, rgba(36,29,22,.06));
}

.receipt__head { text-align: center; position: relative; }
.receipt__labs { font-size: 10px; letter-spacing: .34em; color: var(--paper-faint); font-weight: 600; }
.receipt__doctitle {
  font-family: var(--font-display); font-size: 17px; letter-spacing: .04em;
  margin: 6px 0 2px; color: #1c1610;
}
.receipt__tagline { font-size: 10px; letter-spacing: .22em; color: var(--paper-faint); }

.receipt__meta {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 14px; padding-top: 10px;
  border-top: 1.5px dashed rgba(36,29,22,.3);
  font-size: 10.5px; color: var(--paper-faint);
}
.receipt__meta b { color: var(--paper-ink); font-weight: 600; }

.receipt__title {
  font-family: var(--font-display);
  font-size: clamp(22px, 5.6vw, 30px);
  line-height: 1.08;
  text-align: center;
  margin: 18px 0 4px;
  color: #14100b;
  overflow-wrap: break-word;
}
.receipt__pitch {
  text-align: center; font-style: italic; font-size: 13.5px;
  color: #453a2c; margin-bottom: 4px;
}
.receipt__fed {
  margin-top: 10px; text-align: center;
  font-size: 10px; letter-spacing: .06em; color: var(--paper-faint);
  overflow-wrap: anywhere;
}
.receipt__summary {
  margin-top: 12px; padding-top: 12px;
  border-top: 1.5px dashed rgba(36,29,22,.3);
  font-size: 12.75px;
}

.receipt__fields { margin-top: 14px; border-top: 1.5px dashed rgba(36,29,22,.3); padding-top: 10px; }
.receipt__row {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 3.5px 0; font-size: 12.25px;
}
.receipt__row dt { color: var(--paper-faint); letter-spacing: .12em; font-size: 10.5px; padding-top: 2px; flex: none; }
.receipt__row dd { text-align: right; font-weight: 600; overflow-wrap: anywhere; }

.receipt__rules { margin-top: 14px; border-top: 1.5px dashed rgba(36,29,22,.3); padding-top: 12px; }
.receipt__ruleshead { font-size: 10.5px; letter-spacing: .26em; color: var(--paper-faint); margin-bottom: 8px; }
.receipt__rules ul { list-style: none; }
.receipt__rules li {
  position: relative; padding: 2.5px 0 2.5px 24px; font-size: 12.5px;
}
.receipt__rules li::before {
  content: "☐"; position: absolute; left: 2px; top: 2px; font-size: 13px; color: #9c2f42;
}

.receipt__roast {
  margin-top: 16px;
  background: rgba(156,47,66,.07);
  border: 1.5px solid rgba(156,47,66,.35);
  border-radius: 8px;
  padding: 12px 14px 12px 46px;
  position: relative;
  font-size: 12.75px;
}
.receipt__roast::before {
  content: ""; position: absolute; left: 12px; top: 12px; width: 24px; height: 24px;
  background: #9c2f42;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2c-1.8 0-3.2 1.2-3.6 2.9C7 4.2 5.2 4.5 4.2 5.9c-1.1 1.5-.8 3.6.7 4.7.9.7 2 .8 3 .5-.3 1-.1 2.1.6 3l2.1 2.6c.2.3.4.7.4 1.1V21a1 1 0 0 0 2 0v-3.2c0-.4.1-.8.4-1.1l2.1-2.6c.7-.9.9-2 .6-3 1 .3 2.1.2 3-.5 1.5-1.1 1.8-3.2.7-4.7-1-1.4-2.8-1.7-4.2-1C15.2 3.2 13.8 2 12 2z"/></svg>') center/contain no-repeat;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2c-1.8 0-3.2 1.2-3.6 2.9C7 4.2 5.2 4.5 4.2 5.9c-1.1 1.5-.8 3.6.7 4.7.9.7 2 .8 3 .5-.3 1-.1 2.1.6 3l2.1 2.6c.2.3.4.7.4 1.1V21a1 1 0 0 0 2 0v-3.2c0-.4.1-.8.4-1.1l2.1-2.6c.7-.9.9-2 .6-3 1 .3 2.1.2 3-.5 1.5-1.1 1.8-3.2.7-4.7-1-1.4-2.8-1.7-4.2-1C15.2 3.2 13.8 2 12 2z"/></svg>') center/contain no-repeat;
}
.receipt__roasthead { font-size: 10px; letter-spacing: .26em; color: #9c2f42; font-weight: 700; margin-bottom: 4px; }

.receipt__prompt { margin-top: 16px; }
.receipt__prompthead {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; letter-spacing: .22em; color: var(--paper-faint); margin-bottom: 7px;
}
.receipt__promptbox {
  background: #14100e;
  color: #7ee8d2;
  border-radius: 8px;
  padding: 13px 14px;
  font-size: 11.25px; line-height: 1.62;
  max-height: 190px; overflow-y: auto;
  white-space: pre-wrap; overflow-wrap: break-word;
  box-shadow: inset 0 0 20px rgba(0,0,0,.7);
  scrollbar-width: thin; scrollbar-color: #3d564e #14100e;
}

.receipt__foot {
  margin-top: 18px; padding-top: 12px;
  border-top: 1.5px dashed rgba(36,29,22,.3);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.receipt__barcode { display: flex; align-items: flex-end; gap: 0; height: 34px; }
.receipt__barcode i { display: block; background: #241d16; height: 100%; margin-right: 2px; }
.receipt__barcode i.short { height: 76%; }
.receipt__slug { font-size: 9.5px; color: var(--paper-faint); margin-top: 4px; letter-spacing: .06em; }
.receipt__motto { text-align: right; font-size: 10px; letter-spacing: .18em; color: var(--paper-faint); }
.receipt__motto b { display: block; color: #9c2f42; font-size: 11px; }

/* stamp */
.receipt__stamp {
  position: absolute; right: 14px; top: 150px;
  transform: rotate(9deg);
  border: 3px double rgba(156,47,66,.75);
  border-radius: 6px;
  color: rgba(156,47,66,.85);
  font-family: var(--font-display);
  font-size: 13px; letter-spacing: .1em;
  padding: 6px 10px;
  mix-blend-mode: multiply;
  pointer-events: none;
  animation: stamp-in .5s var(--ease-spring) both;
  animation-delay: .5s;
}
@keyframes stamp-in {
  0% { opacity: 0; transform: rotate(9deg) scale(2.4); }
  60% { opacity: 1; transform: rotate(9deg) scale(.94); }
  100% { opacity: .92; transform: rotate(9deg) scale(1); }
}

/* holographic foil sticker */
.receipt__foil {
  position: absolute; left: 13px; top: 13px;
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(from var(--foil-a, 0deg),
    #ff8da1, #ffd47e, #9dffd8, #8fc6ff, #d29bff, #ff8da1);
  box-shadow: 0 3px 10px rgba(0,0,0,.25), inset 0 0 0 3px rgba(255,255,255,.55);
  animation: foil-spin 6s linear infinite;
  opacity: .92;
}
@property --foil-a {
  syntax: '<angle>'; initial-value: 0deg; inherits: false;
}
@keyframes foil-spin { to { --foil-a: 360deg; } }
.receipt__foil svg { width: 22px; height: 22px; color: rgba(40,20,30,.72); }
.receipt__foil::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.8), transparent 42%);
}

/* prize strip on receipt when user won */
.receipt__prize {
  margin-top: 16px;
  border: 2px dashed rgba(185,130,26,.8);
  background: repeating-linear-gradient(-45deg, rgba(255,194,51,.16) 0 10px, rgba(255,194,51,.06) 10px 20px);
  border-radius: 8px;
  padding: 12px 14px;
  text-align: center;
}
.receipt__prize b { font-family: var(--font-display); font-size: 14px; color: #7c5510; letter-spacing: .06em; }
.receipt__prize code { display: block; margin-top: 4px; font-weight: 700; font-size: 15px; color: #241d16; letter-spacing: .14em; }

/* ================= JACKPOT TICKET ================= */
.ticket {
  position: relative;
  width: min(520px, calc(100vw - 48px));
  border-radius: 18px;
  padding: 34px 38px 30px;
  color: #3a2a06;
  background:
    radial-gradient(140% 90% at 50% -10%, rgba(255,255,255,.5), transparent 45%),
    repeating-linear-gradient(-52deg, rgba(255,255,255,.12) 0 6px, transparent 6px 12px),
    linear-gradient(165deg, #ffe9a8 0%, var(--gold) 40%, #e8a81f 78%, #c98d12 100%);
  box-shadow:
    0 34px 90px rgba(0,0,0,.7),
    0 0 60px rgba(255,194,51,.45),
    inset 0 2px 0 rgba(255,255,255,.7),
    inset 0 -3px 0 rgba(120,80,10,.45);
  /* punched circles on the sides */
  -webkit-mask-image: radial-gradient(circle 13px at 0 50%, transparent 97%, #000), radial-gradient(circle 13px at 100% 50%, transparent 97%, #000);
  -webkit-mask-composite: source-in;
  mask-image: radial-gradient(circle 13px at 0 50%, transparent 97%, #000), radial-gradient(circle 13px at 100% 50%, transparent 97%, #000);
  mask-composite: intersect;
  overflow: hidden;
  text-align: center;
  font-family: var(--font-ui);
}
.ticket::after { /* foil sweep */
  content: ""; position: absolute; inset: -40%;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.5) 50%, transparent 58%);
  animation: ticket-sweep 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ticket-sweep {
  0%, 20% { transform: translateX(-46%); }
  60%, 100% { transform: translateX(46%); }
}

.ticket__eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .4em; color: #7c5510; }
.ticket__title {
  font-family: var(--font-display);
  font-size: clamp(26px, 6vw, 40px); line-height: 1.05;
  margin: 10px 0 6px; color: #2d1f03;
  text-shadow: 0 2px 0 rgba(255,255,255,.4);
}
.ticket__body { font-size: 15.5px; font-weight: 600; color: #4c3a10; }
.ticket__prizeline { font-size: 17px; font-weight: 700; margin-top: 12px; }

.ticket__slogan {
  margin: 16px auto 0; max-width: 380px;
  background: rgba(255,255,255,.5);
  border: 1.5px solid rgba(120,80,10,.35);
  border-radius: 10px;
  padding: 10px 16px;
  font-style: italic; font-weight: 600; font-size: 15px;
}
.ticket__sloganlabel { display: block; font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: .3em; color: #7c5510; margin-bottom: 3px; }

.ticket__code {
  margin: 16px auto 0; width: fit-content;
  border: 2.5px dashed rgba(120,80,10,.65);
  border-radius: 10px;
  background: rgba(255,255,255,.65);
  padding: 10px 22px;
  font-family: var(--font-mono); font-weight: 700; font-size: clamp(17px, 4vw, 22px);
  letter-spacing: .16em; color: #241a04;
  user-select: all;
}

.ticket__claim {
  margin: 18px auto 0; max-width: 400px; text-align: left;
  font-size: 13.5px; line-height: 1.65; color: #4c3a10;
}
.ticket__claim b { color: #2d1f03; }
.ticket__claim ol { margin: 6px 0 0 20px; }
.ticket__screenshot {
  margin-top: 12px; padding: 9px 12px;
  background: rgba(45,31,3,.1); border-radius: 8px;
  font-size: 12.5px; font-weight: 600;
}
.ticket__fine { margin-top: 14px; font-size: 11.5px; color: #6b5210; font-style: italic; }

.ticket__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.ticket__actions .btn--dark {
  background: linear-gradient(180deg, #35270a, #1d1503);
  color: var(--gold-hot);
  box-shadow: 0 4px 0 #0c0901, 0 10px 24px rgba(45,31,3,.5), inset 0 1px 0 rgba(255,220,130,.25);
}
.ticket__actions .btn--dark:hover { transform: translateY(-2px); }

/* ================= GALLERY ================= */
.gallery { max-width: 1080px; margin: 76px auto 0; padding: 0 20px; }
.gallery__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.gallery__head h2 {
  font-family: var(--font-display); font-size: clamp(19px, 2.6vw, 26px);
  color: var(--ink);
  text-shadow: 0 0 24px rgba(139,92,246,.5);
}
.gallery__sub { display: block; font-family: var(--font-ui); font-weight: 500; font-size: 12.5px; letter-spacing: .18em; color: var(--ink-faint); margin-top: 4px; text-transform: uppercase; }

.gallery__tabs { display: flex; gap: 8px; }
.gallery__tab {
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid rgba(244,241,255,.14);
  color: var(--ink-dim); font-weight: 600; font-size: 13.5px;
  transition: all .2s;
}
.gallery__tab:hover { color: var(--ink); border-color: rgba(244,241,255,.3); }
.gallery__tab.is-active {
  color: var(--gold-hot); border-color: rgba(255,194,51,.5);
  background: rgba(255,194,51,.08);
  box-shadow: 0 0 18px rgba(255,194,51,.14);
}
.gallery__count {
  display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 4px;
  background: rgba(255,194,51,.18); border-radius: 999px;
  font-size: 11.5px; text-align: center;
}

.gallery__rail {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.minicard {
  position: relative; text-align: left;
  border-radius: 16px; padding: 18px 18px 14px;
  background: linear-gradient(165deg, rgba(244,241,255,.055), rgba(244,241,255,.02));
  border: 1px solid rgba(244,241,255,.1);
  overflow: hidden;
  transition: transform .22s var(--ease-snap), border-color .22s, box-shadow .22s;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
}
.minicard::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--mc-color, var(--purple));
  box-shadow: 0 0 12px var(--mc-color, var(--purple));
}
.minicard:hover {
  transform: translateY(-5px);
  border-color: rgba(244,241,255,.26);
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
}
.minicard__title { font-family: var(--font-display); font-size: 16px; line-height: 1.2; color: var(--ink); }
.minicard__pitch { font-size: 13px; color: var(--ink-dim); line-height: 1.5; flex: 1; }
.minicard__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.minicard__tag {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .06em;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(244,241,255,.06);
  border: 1px solid rgba(244,241,255,.12);
  color: var(--ink-dim);
  white-space: nowrap;
}
.minicard__tag--theme { color: var(--mc-color, var(--purple)); border-color: color-mix(in srgb, var(--mc-color, var(--purple)) 45%, transparent); }
.minicard__mine {
  position: absolute; top: 12px; right: 12px;
  font-size: 9px; font-weight: 700; letter-spacing: .2em;
  color: var(--gold); border: 1px solid rgba(255,194,51,.4);
  border-radius: 999px; padding: 3px 8px;
  background: rgba(255,194,51,.07);
}
.gallery__empty {
  grid-column: 1 / -1; text-align: center; padding: 44px 20px;
  color: var(--ink-faint); font-size: 14.5px; line-height: 1.7;
  border: 1.5px dashed rgba(244,241,255,.12); border-radius: 16px;
}

/* ================= SHARED VIEW ================= */
.shared { padding: clamp(16px, 4vh, 44px) 20px 20px; }
.shared__inner { max-width: 560px; margin: 0 auto; text-align: center; }
.shared__eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: .34em;
  color: var(--gold); text-shadow: 0 0 12px rgba(255,194,51,.5);
  margin-bottom: 22px;
}
.shared__receipt { text-align: left; }
.shared__actions {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin-top: 26px;
}
.shared__hint {
  margin-top: 18px; font-size: 12px; letter-spacing: .3em; font-weight: 700;
  color: var(--ink-faint);
}
