/* Hatching by hand (client/hatch.ts): the hatch moment, and the "ready" look of a finished egg everywhere it shows. */

/* ---- ready eggs ---- */
.st-nest.ready { border-color: #f0c45a; background: radial-gradient(ellipse at 50% 40%, rgba(255, 210, 120, .28), transparent 70%), rgba(40, 28, 12, .6); box-shadow: 0 0 0 1px #f0c45a88, 0 0 12px rgba(240, 196, 90, .35); animation: hx-ready-pulse 1.6s ease-in-out infinite; }
.st-nest.ready .egg-ic, .nu-nest.ready .egg-ic, .nu-nest.ready img { animation: hx-nudge 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
.st-hatch { flex: none; padding: 2px 10px; border-radius: 9px; font: 800 12.5px/1.3 var(--sans); color: #2a1a08; background: linear-gradient(180deg, #f3cf72, #c8962f); }
.stead .hplate.st-ready .sub { color: #ffd77a; font-weight: 700; }
.nu-nest.ready { box-shadow: inset 0 0 0 1px #f0c45a, 0 0 10px rgba(240, 196, 90, .4); cursor: pointer; }
.nu-nest.ready small { color: #ffd77a; font-weight: 800; }
.hu-tag.ready { border-color: #f0c45a; color: #ffe2a0; font-weight: 800; animation: hx-ready-pulse 1.6s ease-in-out infinite; }
.inc-ch .inc-hatch { margin: 6px auto 0; display: block; }
.inc-ch.ready .inc-nest > * { animation: hx-nudge 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
.qs-row.qs-ready { display: flex; align-items: center; gap: 6px; }
.qs-row.qs-ready .ellip { flex: 1; min-width: 0; }
@keyframes hx-ready-pulse { 50% { box-shadow: 0 0 0 1px #f0c45a, 0 0 18px rgba(240, 196, 90, .6); } }
@keyframes hx-nudge { 0%, 55%, 100% { transform: rotate(0); } 62% { transform: rotate(-9deg); } 70% { transform: rotate(8deg); } 78% { transform: rotate(-5deg); } 86% { transform: rotate(3deg); } }

/* ---- the hatch ---- */
.hx-scrim { z-index: 400; background: rgba(4, 6, 10, .78); padding: 12px; }
.hx-dlg { width: min(420px, 100%); max-height: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.hx-stage { --c1: #fff4d6; --c2: rgba(255, 220, 150, .35); --rock: 1100ms; position: relative; height: min(360px, calc(100dvh - 90px)); min-height: 250px; border-radius: 14px; overflow: hidden; cursor: pointer;
  background: radial-gradient(ellipse at 50% 58%, #2c2216 0, #15110c 62%, #0b0907 100%); box-shadow: inset 0 0 0 1px rgba(240, 200, 140, .3), 0 10px 40px rgba(0, 0, 0, .6); user-select: none; -webkit-user-select: none; }
.hx-stage.t1.hx-a { --c1: #cfe6ff; --c2: rgba(78, 163, 255, .45); }
.hx-stage.hx-bl { --c1: #ffe9b0; --c2: rgba(240, 196, 90, .5); }
.hx-stage.hx-s { --c1: #ecd9ff; --c2: rgba(183, 124, 255, .6); }
.hx-stage.hx-sp { --c1: #ffe0b0; --c2: rgba(255, 140, 50, .7); }
.hx-stage.hx-aura { --c1: #fff; --c2: rgba(255, 230, 140, .75); }

/* light rays behind everything, only once it bursts */
.hx-rays { position: absolute; left: 50%; top: 46%; width: 900px; height: 900px; margin: -450px 0 0 -450px; opacity: 0; transform: scale(.3);
  background: repeating-conic-gradient(from 0deg, var(--c2) 0 7deg, transparent 7deg 22deg); -webkit-mask: radial-gradient(circle, #000 0, transparent 46%); mask: radial-gradient(circle, #000 0, transparent 46%); }
.hx-stage.hx-aura .hx-rays { background: repeating-conic-gradient(from 0deg, rgba(255, 120, 120, .5) 0 6deg, transparent 6deg 15deg, rgba(255, 220, 110, .55) 15deg 21deg, transparent 21deg 30deg, rgba(120, 230, 160, .5) 30deg 36deg, transparent 36deg 45deg, rgba(120, 180, 255, .55) 45deg 51deg, transparent 51deg 60deg, rgba(210, 140, 255, .5) 60deg 66deg, transparent 66deg 75deg); }
.hx-stage.hx-burst .hx-rays { animation: hx-rays-in .7s ease-out forwards, hx-spin 14s linear infinite; }
.hx-stage.t0.hx-burst .hx-rays { animation: hx-rays-in-soft .7s ease-out forwards, hx-spin 20s linear infinite; }
@keyframes hx-rays-in { to { opacity: 1; transform: scale(1); } }
@keyframes hx-rays-in-soft { to { opacity: .35; transform: scale(.8); } }
@keyframes hx-spin { to { rotate: 360deg; } }

/* a glow that grows while it rocks: its colour is the first tell of a good roll */
.hx-glow { position: absolute; left: 50%; top: 46%; width: 200px; height: 200px; margin: -100px 0 0 -100px; border-radius: 50%; background: radial-gradient(circle, var(--c2), transparent 65%); opacity: .15; transform: scale(.6); }
.hx-stage.hx-rock .hx-glow { animation: hx-glow var(--rock) ease-in forwards; }
.hx-stage.hx-burst .hx-glow { animation: hx-glow-out 1.2s ease-out forwards; }
.hx-stage.t0 .hx-glow { --c2: rgba(255, 240, 210, .25); }
@keyframes hx-glow { to { opacity: 1; transform: scale(1.5); } }
@keyframes hx-glow-out { from { opacity: 1; transform: scale(1.5); } to { opacity: .55; transform: scale(2.4); } }

/* the egg */
.hx-egg { position: absolute; left: 50%; top: 46%; width: 102px; height: 132px; margin: -66px 0 0 -51px; transform-origin: 50% 92%; }
.hx-egg::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: -6px; height: 14px; border-radius: 50%; background: radial-gradient(ellipse, rgba(0, 0, 0, .55), transparent 70%); z-index: -1; }
.hx-shell { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.hx-shell.top, .hx-shell.bot { opacity: 0; }
.hx-shell.top { clip-path: polygon(0 0, 100% 0, 100% 46%, 91% 51%, 81% 44%, 70% 55%, 59% 42%, 49% 53%, 35% 43%, 26% 54%, 12% 43%, 0 50%); }
.hx-shell.bot { clip-path: polygon(0 50%, 12% 43%, 26% 54%, 35% 43%, 49% 53%, 59% 42%, 70% 55%, 81% 44%, 91% 51%, 100% 46%, 100% 100%, 0 100%); }
.hx-stage.hx-rock .hx-egg { animation: hx-rock var(--rock) ease-in forwards; }
.hx-stage.t3.hx-rock .hx-egg, .hx-stage.t4.hx-rock .hx-egg { animation: hx-rock-big var(--rock) ease-in forwards; }
@keyframes hx-rock {
  0% { transform: rotate(0); } 10% { transform: rotate(-6deg); } 16% { transform: rotate(5deg); } 22% { transform: rotate(0); }
  40% { transform: rotate(0); } 46% { transform: rotate(-9deg); } 52% { transform: rotate(9deg); } 58% { transform: rotate(-6deg); } 63% { transform: rotate(0); }
  72% { transform: rotate(-12deg) scale(1.03); } 77% { transform: rotate(12deg) scale(1.05); } 82% { transform: rotate(-12deg) scale(1.06); } 87% { transform: rotate(10deg) scale(1.08); }
  92% { transform: rotate(-8deg) scale(1.1); } 96% { transform: rotate(5deg) scale(1.12, 1.05); } 100% { transform: rotate(0) scale(1.16, .96); } }
@keyframes hx-rock-big {
  0% { transform: rotate(0); } 8% { transform: rotate(-7deg); } 13% { transform: rotate(6deg); } 18% { transform: rotate(0); }
  30% { transform: rotate(0) translateY(0); } 34% { transform: rotate(-10deg) translateY(-8px); } 38% { transform: rotate(10deg) translateY(0); } 42% { transform: rotate(0); }
  55% { transform: rotate(-13deg) translateY(-14px); } 60% { transform: rotate(13deg) translateY(0); } 65% { transform: rotate(-13deg) translateY(-10px); } 70% { transform: rotate(0); }
  76% { transform: translate(-3px, 0) rotate(-4deg) scale(1.06); } 79% { transform: translate(3px, 0) rotate(4deg) scale(1.08); } 82% { transform: translate(-4px, 0) rotate(-5deg) scale(1.1); } 85% { transform: translate(4px, 0) rotate(5deg) scale(1.12); }
  88% { transform: translate(-5px, 0) rotate(-6deg) scale(1.14); } 91% { transform: translate(5px, 0) rotate(6deg) scale(1.16); } 94% { transform: translate(-5px, 0) rotate(-6deg) scale(1.18); } 97% { transform: translate(5px, 0) rotate(5deg) scale(1.2); } 100% { transform: scale(1.24, .94); } }

/* cracks draw in and light leaks through them */
.hx-cracks { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: var(--c1); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 3px var(--c1)) drop-shadow(0 0 6px var(--c2)); opacity: 0; }
.hx-cracks path { stroke-dasharray: 90; stroke-dashoffset: 90; }
.hx-stage.hx-crack .hx-cracks { opacity: 1; }
.hx-stage.hx-crack .hx-cracks path { animation: hx-draw calc(var(--rock) * .38) ease-out forwards; }
@keyframes hx-draw { to { stroke-dashoffset: 0; } }

/* the burst: the shell splits and flies, a flash, sparks */
.hx-stage.hx-burst .hx-shell.whole, .hx-stage.hx-burst .hx-cracks { opacity: 0; }
.hx-stage.hx-burst .hx-egg { animation: none; transform: scale(1.16, .96); }
.hx-stage.hx-burst .hx-shell.top { opacity: 1; animation: hx-top .75s cubic-bezier(.2, .7, .4, 1) forwards; }
.hx-stage.hx-burst .hx-shell.bot { opacity: 1; animation: hx-bot .75s ease-in forwards; }
@keyframes hx-top { to { transform: translate(46px, -120px) rotate(62deg); opacity: 0; } }
@keyframes hx-bot { 0% { transform: none; opacity: 1; } 40% { transform: translateY(6px) scaleY(.9); opacity: 1; } 100% { transform: translateY(24px) scaleY(.8); opacity: 0; } }
.hx-flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 46%, var(--c1), var(--c2) 35%, transparent 70%); opacity: 0; pointer-events: none; }
.hx-stage.hx-burst .hx-flash { animation: hx-flash .6s ease-out; }
.hx-stage.t3.hx-burst .hx-flash, .hx-stage.t4.hx-burst .hx-flash { animation: hx-flash-big .9s ease-out; }
@keyframes hx-flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
@keyframes hx-flash-big { 0% { opacity: 0; background-color: transparent; } 12% { opacity: 1; background-color: rgba(255, 255, 255, .8); } 100% { opacity: 0; background-color: transparent; } }
.hx-stage.t4.hx-burst:not(.hx-skip) { animation: hx-shake .5s linear; }
@keyframes hx-shake { 10%, 50%, 90% { transform: translate(-5px, 2px); } 30%, 70% { transform: translate(5px, -2px); } }
.hx-sparks { position: absolute; left: 50%; top: 46%; width: 0; height: 0; }
.hx-sparks i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--c1); box-shadow: 0 0 8px var(--c2), 0 0 3px #fff; opacity: 0; }
.hx-stage.hx-burst .hx-sparks i { animation: hx-spark .9s cubic-bezier(.15, .7, .3, 1) var(--d) forwards; }
.hx-stage.t0 .hx-sparks i:nth-child(odd) { display: none; }
.hx-stage.hx-aura .hx-sparks i:nth-child(5n+1) { background: #ff8a8a; } .hx-stage.hx-aura .hx-sparks i:nth-child(5n+2) { background: #ffe07a; }
.hx-stage.hx-aura .hx-sparks i:nth-child(5n+3) { background: #8af0b0; } .hx-stage.hx-aura .hx-sparks i:nth-child(5n+4) { background: #8ac0ff; } .hx-stage.hx-aura .hx-sparks i:nth-child(5n) { background: #d79aff; }
@keyframes hx-spark { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(1.2); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-150px) scale(.4); } }

/* the creature lands */
.hx-mon { position: absolute; left: 50%; top: 46%; width: 150px; height: 150px; margin: -100px 0 0 -75px; display: grid; place-items: end center; opacity: 0; transform: scale(.2) translateY(30px); }
.hx-mon img { width: 128px; height: 128px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 0 10px var(--c2)) drop-shadow(0 4px 2px rgba(0, 0, 0, .5)); }
.hx-mon::after { content: ''; position: absolute; left: 30px; right: 30px; bottom: -6px; height: 14px; border-radius: 50%; background: radial-gradient(ellipse, rgba(0, 0, 0, .55), transparent 70%); z-index: -1; }
.hx-stage.hx-burst .hx-mon { animation: hx-pop .65s cubic-bezier(.3, 1.6, .5, 1) .12s forwards; }
.hx-stage.hx-aura .hx-mon img { filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 16px rgba(255, 220, 120, .9)); animation: hx-aura-hue 3s linear infinite; }
@keyframes hx-pop { 0% { opacity: 0; transform: scale(.2) translateY(30px); } 60% { opacity: 1; transform: scale(1.15) translateY(-12px); } 100% { opacity: 1; transform: none; } }
@keyframes hx-aura-hue { 0%, 100% { filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 16px rgba(255, 220, 120, .9)); } 33% { filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 16px rgba(140, 220, 255, .9)); } 66% { filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 16px rgba(230, 150, 255, .9)); } }

/* the big call for a big roll */
.hx-call { position: absolute; left: 0; right: 0; top: 14px; text-align: center; font: 700 30px/1 'Cormorant SC', var(--serif, serif); letter-spacing: .04em; color: var(--c1); text-shadow: 0 0 12px var(--c2), 0 2px 0 rgba(0, 0, 0, .6); opacity: 0; transform: scale(2.2); }
.hx-stage.hx-burst .hx-call { animation: hx-stamp .5s cubic-bezier(.3, 1.5, .5, 1) .25s forwards; }
.hx-stage.hx-aura .hx-call { font-size: 40px; text-transform: uppercase; background: linear-gradient(90deg, #ff9a9a, #ffe37a, #8af0b0, #8ac0ff, #d79aff, #ff9a9a); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 0 8px rgba(255, 230, 150, .8)); }
.hx-stage.hx-aura.hx-burst .hx-call { animation: hx-stamp .5s cubic-bezier(.3, 1.5, .5, 1) .25s forwards, hx-slide 2.5s linear infinite; }
@keyframes hx-stamp { to { opacity: 1; transform: none; } }
@keyframes hx-slide { to { background-position: 200% 0; } }

/* the facts */
.hx-facts { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 5px; opacity: 0; transform: translateY(14px); text-align: center; }
.hx-stage.hx-card .hx-facts { animation: hx-up .4s ease-out forwards; }
@keyframes hx-up { to { opacity: 1; transform: none; } }
.hx-name { font: 700 22px/1.1 'Cormorant SC', var(--serif, serif); color: #f6e7c4; text-shadow: 0 2px 0 rgba(0, 0, 0, .6); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-marks { display: inline-flex; align-items: center; gap: 8px; }
.hx-marks .gr.lg { width: 34px; height: 34px; }
.hx-stage.hx-card .hx-marks .gr { animation: hx-stamp-in .45s cubic-bezier(.3, 1.6, .5, 1) both; }
/* The medallion is not a box, so a top grade's halo follows its shape. */
.hx-stage.t3 .hx-marks .gr, .hx-stage.t2.hx-s .hx-marks .gr { filter: drop-shadow(0 0 7px var(--c2)); }
@keyframes hx-stamp-in { from { transform: scale(2.4); opacity: 0; } to { transform: none; opacity: 1; } }
.hx-marks .crest { padding: 3px 7px 3px 5px; border-radius: 9px; background: rgba(0, 0, 0, .45); font-size: 13px; filter: brightness(1.25); }
.hx-marks .crest svg { width: 13px; height: 15px; }
.hx-gm .crest { filter: brightness(1.3); }
.hx-line { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; font-size: 13px; color: #d9c9a6; }
.hx-line b { color: #fff3d0; }
.hx-rare { color: #d9b0ff; font-weight: 700; }
.hx-hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 12px; color: rgba(240, 220, 180, .5); transition: opacity .2s; }
.hx-stage.hx-burst .hx-hint { opacity: 0; }

/* skipped to the end: everything in its final place, no motion */
.hx-stage.hx-skip .hx-egg, .hx-stage.hx-skip .hx-shell, .hx-stage.hx-skip .hx-sparks i, .hx-stage.hx-skip .hx-flash { animation: none !important; opacity: 0 !important; }
.hx-stage.hx-skip .hx-mon, .hx-stage.hx-skip .hx-facts, .hx-stage.hx-skip .hx-call { animation: none; opacity: 1; transform: none; }
.hx-stage.hx-skip.hx-aura .hx-call { animation: hx-slide 2.5s linear infinite; }
.hx-stage.hx-skip .hx-rays { animation: hx-spin 14s linear infinite; opacity: 1; transform: none; }
.hx-stage.hx-skip.t0 .hx-rays { opacity: .35; transform: scale(.8); }
.hx-stage.hx-skip .hx-glow { animation: none; opacity: .55; transform: scale(2.4); }
.hx-stage.hx-end { cursor: default; }

.hx-acts { display: flex; justify-content: center; gap: 10px; }
.hx-acts .btn { min-width: 120px; min-height: 40px; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.hx-acts .btn small { opacity: .75; font-size: 12px; }

/* several at once, skipped: one row of what came out, best first */
.hx-sum .hx-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 14px; cursor: default; }
.hx-sum .hx-rays { opacity: .5; transform: none; animation: hx-spin 20s linear infinite; }
.hx-title { position: relative; font: 700 24px/1 'Cormorant SC', var(--serif, serif); color: #f6e7c4; }
.hx-grid { position: relative; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.hx-grid li { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border-radius: 9px; background: rgba(0, 0, 0, .35); box-shadow: inset 0 0 0 1px rgba(240, 200, 140, .2); animation: hx-stamp-in .4s ease-out both; }
.hx-grid li:nth-child(2) { animation-delay: .06s; } .hx-grid li:nth-child(3) { animation-delay: .12s; } .hx-grid li:nth-child(4) { animation-delay: .18s; } .hx-grid li:nth-child(5) { animation-delay: .24s; } .hx-grid li:nth-child(6) { animation-delay: .3s; }
.hx-grid li.t2, .hx-grid li.t3 { box-shadow: inset 0 0 0 1px #f0c45a, 0 0 12px rgba(240, 196, 90, .35); }
.hx-grid li.hx-aura { box-shadow: inset 0 0 0 2px #ffe58a, 0 0 16px rgba(255, 220, 140, .6); }
.hx-grid img { width: 56px; height: 56px; object-fit: contain; image-rendering: pixelated; }
.hx-gn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: #f3e6c4; }
.hx-gm { display: inline-flex; align-items: center; gap: 4px; }

@media (max-height: 520px) {
  .hx-stage { min-height: 220px; }
  .hx-mon img { width: 96px; height: 96px; }
  .hx-call { top: 8px; font-size: 24px; }
  .hx-stage.hx-aura .hx-call { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .hx-stage.hx-burst .hx-rays, .hx-sum .hx-rays { animation-duration: .01s, 0s; }
  .st-nest.ready, .hu-tag.ready, .st-nest.ready .egg-ic, .nu-nest.ready .egg-ic, .nu-nest.ready img, .inc-ch.ready .inc-nest > * { animation: none; }
}
