/* giftopen.css — the gift-opening moment (assets/giftopen.js). --paper/--paper2/--ribbon are set per gift (rarity / kind).
 * States on #gift-open: .open (shown) -> .cracking (last tap) -> .burst (lid flies, rays, confetti) -> .revealed (the item). */
.go { position: fixed; inset: 0; z-index: 9000; display: none; place-items: center; overflow: hidden; color: var(--ink);
  --paper: #ff2d95; --paper2: #b3126a; --ribbon: #ffe94d; }
.go.open { display: grid; animation: go-in .35s ease-out both; }
body.go-lock, html:has(body.go-lock) { overflow: hidden; }
@keyframes go-in { from { opacity: 0; } to { opacity: 1; } }

.go-bg { position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--paper) 35%, #1a0b33) 0%, #0b0515 62%, #05020b 100%);
  backdrop-filter: blur(6px); }
.go-bg::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(#fff 1px, transparent 1.5px); background-size: 46px 46px; opacity: .07; }

/* light rays: hidden until the burst, then a slow spin */
.go-rays { position: absolute; left: 50%; top: 42%; width: 190vmax; height: 190vmax; margin: -95vmax 0 0 -95vmax; opacity: 0; transform: scale(.2);
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--ribbon) 55%, transparent) 0 7deg, transparent 7deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 0, rgba(0,0,0,.6) 18%, transparent 52%); mask: radial-gradient(circle, #000 0, rgba(0,0,0,.6) 18%, transparent 52%);
  transition: opacity .5s ease-out, transform .8s cubic-bezier(.2,1.4,.4,1); pointer-events: none; }
.go.burst .go-rays { opacity: .85; transform: scale(1); animation: go-spin 18s linear infinite; }
@keyframes go-spin { to { rotate: 360deg; } }
.go-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.go-flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 42%, #fff 0, rgba(255,255,255,.85) 20%, transparent 60%); opacity: 0; pointer-events: none; z-index: 2; }
.go.burst .go-flash { animation: go-flash .7s ease-out both; }
@keyframes go-flash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

.go-inner { position: relative; z-index: 4; width: min(440px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.go-kicker { margin: 0; display: inline-flex; align-items: center; gap: .4em; font-size: .78rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--ribbon); }
.go-title { margin: 0; font-size: clamp(1.5rem, 6vw, 2.2rem); line-height: 1.15; font-weight: 900; animation: go-drop .6s cubic-bezier(.2,1.5,.4,1) both .1s; }
.go-from { color: var(--ribbon); text-shadow: 0 0 18px color-mix(in srgb, var(--ribbon) 60%, transparent); overflow-wrap: anywhere; }
@keyframes go-drop { from { transform: translateY(-30px) scale(.8); opacity: 0; } }

/* ---------- the present ---------- */
.go-stage { position: relative; width: 230px; height: 230px; margin: 14px 0 0; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  animation: go-arrive .8s cubic-bezier(.2,1.6,.4,1) both .2s; }
.go-stage:focus-visible { outline: 3px dashed var(--ribbon); outline-offset: 8px; border-radius: 20px; }
.go-stage:disabled { cursor: default; }
@keyframes go-arrive { 0% { transform: translateY(-120vh) rotate(-14deg); } 70% { transform: translateY(8px) rotate(3deg); } 100% { transform: none; } }
.go-glow { position: absolute; left: 50%; top: 55%; width: 260px; height: 260px; margin: -130px 0 0 -130px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--paper) 70%, transparent) 0, transparent 65%); opacity: .55; filter: blur(8px); }
.go-glow.pulse { animation: go-pulse .45s ease-out; }
@keyframes go-pulse { 0% { transform: scale(1); opacity: .55; } 30% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); opacity: .55; } }
.go-shadow { position: absolute; left: 50%; bottom: 6px; width: 170px; height: 22px; margin-left: -85px; border-radius: 50%; background: rgba(0,0,0,.5); filter: blur(6px); }

.go-present { --n: 0; position: absolute; left: 50%; bottom: 18px; width: 170px; height: 170px; margin-left: -85px; transform-origin: 50% 100%;
  animation: go-idle calc(2.4s - var(--n) * .35s) ease-in-out infinite; }
/* between taps it trembles more and more */
@keyframes go-idle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(calc(-1deg - var(--n) * 1.2deg)) translateY(calc(var(--n) * -1px)); }
  75% { transform: rotate(calc(1deg + var(--n) * 1.2deg)); } }
.go-present.hit { animation: go-hit .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes go-hit {
  0% { transform: scale(1, 1); }
  15% { transform: scale(calc(1 + var(--n) * .05), calc(1 - var(--n) * .07)) rotate(0); }
  35% { transform: scale(calc(1 - var(--n) * .03), calc(1 + var(--n) * .06)) translateY(calc(var(--n) * -9px)) rotate(calc(var(--n) * -4deg)); }
  55% { transform: translateY(calc(var(--n) * -4px)) rotate(calc(var(--n) * 3.5deg)); }
  75% { transform: rotate(calc(var(--n) * -2deg)); }
  100% { transform: none; } }

.go-body { position: absolute; left: 10px; right: 10px; bottom: 0; height: 112px; border-radius: 8px 8px 12px 12px; overflow: hidden;
  background: linear-gradient(90deg, var(--paper2) 0 6%, var(--paper) 30% 70%, var(--paper2) 94%),
              repeating-linear-gradient(45deg, rgba(255,255,255,.12) 0 8px, transparent 8px 20px);
  background-blend-mode: overlay; box-shadow: inset 0 -12px 0 rgba(0,0,0,.18), 0 10px 24px rgba(0,0,0,.35); }
.go-lid { position: absolute; left: 0; right: 0; bottom: 104px; height: 40px; z-index: 2; border-radius: 10px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--paper) 80%, #fff) 0, var(--paper) 45%, var(--paper2) 100%);
  box-shadow: 0 6px 0 rgba(0,0,0,.2); }
.go-rib-v { position: absolute; left: 50%; top: 0; bottom: 0; width: 26px; margin-left: -13px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ribbon) 70%, #000) 0, var(--ribbon) 25% 75%, color-mix(in srgb, var(--ribbon) 70%, #000) 100%); }
.go-rib-h { position: absolute; left: 0; right: 0; top: 40px; height: 22px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--ribbon) 70%, #000) 0, var(--ribbon) 25% 75%, color-mix(in srgb, var(--ribbon) 70%, #000) 100%); }
.go-bow { position: absolute; left: 50%; bottom: 100%; width: 0; height: 0; }
.go-bow i { position: absolute; bottom: -6px; width: 52px; height: 38px; border: 10px solid var(--ribbon); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.35); }
.go-bow i:first-child { right: 2px; transform: rotate(-24deg); transform-origin: 100% 100%; }
.go-bow i:last-child { left: 2px; transform: rotate(24deg); transform-origin: 0 100%; }
.go-bow b { position: absolute; left: -13px; bottom: -10px; width: 26px; height: 22px; border-radius: 8px; background: var(--ribbon); box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); }

/* cracks: light leaking out, one more line per tap */
.go-cracks { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; overflow: visible;
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 6px var(--ribbon)) drop-shadow(0 0 10px #fff); }
.go-cracks polyline { fill: none; stroke: #fffbe0; stroke-width: 3.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke;
  stroke-dasharray: 200; stroke-dashoffset: 200; opacity: 0; transition: stroke-dashoffset .35s ease-out, opacity .1s; }
.go-cracks polyline.on { stroke-dashoffset: 0; opacity: 1; }
.go.cracking .go-present { animation: go-rattle .07s linear infinite; }
@keyframes go-rattle { 0% { transform: translate(-3px, 1px) rotate(-3deg); } 50% { transform: translate(3px, -2px) rotate(3deg); } 100% { transform: translate(-2px, 0) rotate(-1deg); } }
.go.cracking .go-glow { opacity: 1; transform: scale(1.4); transition: transform .4s, opacity .4s; }

/* burst: lid rockets off, the box blows apart */
.go.burst .go-present { animation: none; }
.go.burst .go-lid { animation: go-lid .9s cubic-bezier(.25,.6,.4,1) forwards; }
@keyframes go-lid { 0% { transform: none; } 100% { transform: translate(80px, -70vh) rotate(160deg); opacity: 0; } }
.go.burst .go-body { animation: go-pop .55s ease-in forwards; }
@keyframes go-pop { 0% { transform: scale(1); } 25% { transform: scale(1.18, .85); filter: brightness(1.8); } 100% { transform: scale(1.6); opacity: 0; filter: brightness(3) blur(6px); } }
.go.burst .go-shadow, .go.burst .go-glow { opacity: 0; transition: opacity .4s; }
.go.revealed .go-stage { display: none; }

.go-spark { position: absolute; left: 50%; top: 52%; width: 8px; height: 8px; margin: -4px; border-radius: 2px; pointer-events: none; z-index: 5;
  animation: go-spark .75s cubic-bezier(.2,.8,.4,1) forwards; }
@keyframes go-spark { 0% { transform: translate(0, 0) scale(1) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(.2) rotate(240deg); opacity: 0; } }

.go-taps { display: flex; gap: 8px; min-height: 12px; }
.go-taps i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--ribbon) 70%, transparent); transition: background .2s, transform .2s; }
.go-taps i.on { background: var(--ribbon); transform: scale(1.25); box-shadow: 0 0 10px var(--ribbon); }
.go-hint { margin: 0; min-height: 1.5em; font-size: 1.15rem; font-weight: 900; letter-spacing: .03em; color: #fff; animation: go-bob 1.1s ease-in-out infinite; }
@keyframes go-bob { 50% { transform: translateY(-4px) scale(1.04); } }
.go.burst .go-taps, .go.burst .go-hint { visibility: hidden; }

/* ---------- reveal ---------- */
.go-reveal { display: none; flex-direction: column; align-items: center; gap: 6px; }
.go.revealed .go-reveal { display: flex; }
.go-look { position: relative; display: grid; place-items: center; min-width: 220px; min-height: 180px; animation: go-reveal .8s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes go-reveal { 0% { transform: scale(.1) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.12) rotate(4deg); opacity: 1; } 100% { transform: none; } }
.go-look::before { content: ""; position: absolute; width: 230px; height: 230px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, color-mix(in srgb, var(--ribbon) 45%, transparent) 0, transparent 68%); animation: go-halo 2.4s ease-in-out infinite; }
@keyframes go-halo { 50% { transform: scale(1.12); opacity: .7; } }
.go-art { display: inline-grid; place-items: center; transform: scale(2.3); margin: 40px; }
.go-t-stool .go-art { transform: scale(1.1); }
.go-t-badge .go-art { transform: scale(1.7); }
.go-t-wheel .go-art, .go-t-nocam .go-art { transform: none; margin: 0; }
.go-wheel { display: block; width: 190px; }
.go-nocam { display: block; width: 240px; aspect-ratio: 4 / 3; position: relative; border-radius: 16px; overflow: hidden; }
.go-cam { width: 240px; aspect-ratio: 4 / 3; display: grid; place-items: center; align-content: center; gap: 4px; color: var(--muted);
  background: radial-gradient(circle at 50% 40%, #3a2566, #160d2b); }
.go-cam b { font-size: .9rem; color: var(--ink); }
.go-rx-tile { cursor: pointer; }
.go-rx-emoji { font-size: 3.4rem; line-height: 1; }
.go-namebig { font-size: 2.3rem; font-weight: 900; }
.go-gems .i { width: 120px; height: 120px; filter: drop-shadow(0 0 20px #b98cff); animation: go-float 2.6s ease-in-out infinite; }
.go-gp { display: block; width: min(300px, 78vw); }
.go-gp .gp-art { height: 200px; }
.go-gp .gp-tw { width: 26px; height: 26px; margin: -13px 0 0 -13px; }
.go-pack-emoji { font-size: 6.5rem; line-height: 1; filter: drop-shadow(0 0 24px var(--ribbon)); animation: go-float 2.6s ease-in-out infinite; }
@keyframes go-float { 50% { transform: translateY(-8px) rotate(3deg); } }
.go-rar { margin: 6px 0 0; font-size: .8rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--ribbon); animation: go-drop .5s ease-out both .35s; }
.go-name { font-size: clamp(1.6rem, 7vw, 2.3rem); font-weight: 900; animation: go-drop .5s ease-out both .45s; }
.go-pack-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 360px; margin-top: 6px; }
.go-pi { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 14px; background: rgba(255,255,255,.07); overflow: hidden;
  animation: go-drop .45s ease-out both; }
.go-pi:nth-child(2) { animation-delay: .1s; } .go-pi:nth-child(3) { animation-delay: .2s; } .go-pi:nth-child(4) { animation-delay: .3s; }
.go-pi:nth-child(5) { animation-delay: .4s; } .go-pi:nth-child(6) { animation-delay: .5s; }
.go-pi .art-emoji { font-size: 2rem; } .go-pi .art-frame { width: 50px; height: 38px; } .go-pi .art-stool { transform: scale(.3); }
.go-pi .pbadge i, .go-pi .art-name { font-size: .6rem; }
.go-plus { margin: 4px 0 0; display: inline-flex; align-items: center; gap: .3em; font-weight: 800; }
.go-actions { display: none; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.go.revealed .go-actions { display: flex; animation: go-drop .4s ease-out both .7s; }
.go-later { margin-top: 6px; background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; text-decoration: underline; cursor: pointer; }
.go.burst .go-later { visibility: hidden; }

/* ---------- .go-buy: your own purchase / redeemed code. The present becomes a gem chest (purple, gold bands, a lock) ---------- */
.go-buy .go-lid { height: 52px; bottom: 102px; border-radius: 70px 70px 8px 8px / 40px 40px 8px 8px; }
.go-buy .go-rib-v { width: 16px; margin-left: 0; left: 26px; }
.go-buy .go-rib-v { box-shadow: 102px 0 0 var(--ribbon); }
.go-buy .go-body .go-rib-v { left: 16px; }
.go-buy .go-rib-h { top: 0; height: 10px; }
.go-buy .go-bow { bottom: auto; top: 100%; }
.go-buy .go-bow i { display: none; }
.go-buy .go-bow b { left: -17px; top: -16px; bottom: auto; width: 34px; height: 34px; border-radius: 8px 8px 14px 14px; z-index: 3;
  background: radial-gradient(circle at 50% 38%, #3a1a00 0 4px, transparent 4.5px), linear-gradient(#3a1a00, #3a1a00) 50% 62% / 4px 10px no-repeat,
              linear-gradient(180deg, #fff3b0, var(--ribbon) 45%, #c98a00); box-shadow: 0 3px 0 rgba(0,0,0,.3), 0 0 12px color-mix(in srgb, var(--ribbon) 60%, transparent); }
.go-buy .go-body::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 26px, rgba(0,0,0,.14) 26px 28px); }
.go-buy .go-later { display: none; }
.go-amount { display: inline-flex; align-items: center; gap: .3em; font-variant-numeric: tabular-nums; }
.go-amount .i { width: 1.1em; height: 1.1em; }
.go-amount.landed { animation: go-land .45s cubic-bezier(.3,1.8,.5,1); }
@keyframes go-land { 40% { transform: scale(1.18); filter: drop-shadow(0 0 14px var(--ribbon)); } }
.go-thanks { margin: 4px 0 0; display: inline-flex; align-items: center; gap: .35em; color: var(--muted); font-weight: 700; animation: go-drop .5s ease-out both .6s; }

@media (max-height: 640px) { .go-stage { height: 200px; margin-top: 0; } .go-title { font-size: 1.4rem; } }
@media (prefers-reduced-motion: reduce) {
  .go-present, .go-hint, .go-gems .i, .go-pack-emoji, .go-look::before { animation: none !important; }
  .go.burst .go-rays { animation: none; }
}

/* ---------- .go-gold: sent by someone with the Golden Wrap perk (p_giftwrap): gold paper with a moving shine ---------- */
.go-gold .go-body::before, .go-gold .go-lid::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .65) 45%, transparent 60%); background-size: 260% 100%; animation: go-shine 1.8s linear infinite; }
.go-gold .go-lid::before { border-radius: inherit; }
.go-gold .go-present { filter: drop-shadow(0 0 22px rgba(255, 210, 70, .65)); }
@keyframes go-shine { from { background-position: 130% 0; } to { background-position: -130% 0; } }
@media (prefers-reduced-motion: reduce) { .go-gold .go-body::before, .go-gold .go-lid::before { animation: none; } }
