/* WebEgg Hatch — pixel-art build screen + waiting arcade.
   Self-contained: only needs the page's Space Grotesk / Press Start 2P fonts
   (falls back to system fonts). Colors inherit the brand tokens when present. */
.we-hatch {
  --we-orange: var(--orange, #F5820A);
  --we-dark: var(--dark, #1A1A1A);
  --we-muted: var(--muted, #6E6E73);
  --we-line: var(--line, #EAEAEC);
  --we-line-strong: var(--line-strong, #D8D8DC);
  --we-surface: var(--surface, #FFFFFF);
  --we-bg: var(--bg, #F6F6F8);
  --we-green: var(--green, #0D8C3F);
  --we-pixel: 'Press Start 2P', 'Courier New', monospace;
  --we-sans: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
  font-family: var(--we-sans);
  color: var(--we-dark);
}
.we-hatch *, .we-hatch *::before, .we-hatch *::after { box-sizing: border-box; }

/* ── Egg ── */
.we-hatch-stage {
  position: relative;
  height: 176px;
  display: flex; align-items: flex-end; justify-content: center;
  margin: 4px auto 14px;
}
.we-hatch-egg {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 112px; height: 168px;
  display: block;
}
.we-hatch-shadow {
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 64px; height: 8px; border-radius: 50%;
  background: rgba(26,26,26,.10);
  animation: we-shadow 2.4s ease-in-out infinite;
}
@keyframes we-shadow { 0%,100% { transform: translateX(-50%) scaleX(1); } 50% { transform: translateX(-50%) scaleX(.78); opacity: .7; } }

/* ── Copy ── */
.we-hatch-title {
  font-size: 23px; font-weight: 800; letter-spacing: -.01em; line-height: 30px; height: 30px;
  margin: 0 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.we-hatch-msg {
  /* exactly one line, always the same height — the arcade below must not move */
  height: 22px; line-height: 22px; font-size: 14.5px; color: var(--we-muted); margin: 0 0 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .25s;
}
.we-hatch-msg.is-swapping { opacity: 0; }
.we-hatch-note { font-size: 13px; color: var(--we-muted); line-height: 1.5; margin: 0 0 18px; }  /* static — may wrap */
.we-hatch-meta {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  font-family: var(--we-pixel); font-size: 9px; letter-spacing: .5px; color: var(--we-muted);
  margin: 10px 0 18px;
}
.we-hatch-meta b { color: var(--we-dark); font-weight: 400; }
.we-hatch-meta .we-dot { width: 4px; height: 4px; background: var(--we-line-strong); display: inline-block; }

/* ── Steps ── */
.we-hatch-steps {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  max-width: 420px; margin: 0 auto 24px;
}
.we-hatch-step {
  position: relative;
  padding: 10px 6px 9px;
  border: 1px solid var(--we-line);
  background: var(--we-surface);
  border-radius: 8px;
  font-family: var(--we-pixel); font-size: 7px; line-height: 1.5; letter-spacing: .3px;
  color: var(--we-muted);
  overflow: hidden;
  transition: color .3s, border-color .3s;
}
.we-hatch-step i {
  display: block; width: 100%; height: 4px; margin-bottom: 8px;
  background: var(--we-line);
  position: relative; overflow: hidden;
}
.we-hatch-step i::after {
  content: ""; position: absolute; inset: 0; width: 0%;
  background: var(--we-orange);
  transition: width .6s ease;
}
.we-hatch-step.is-active { color: var(--we-dark); border-color: var(--we-orange); }
.we-hatch-step.is-active i::after { width: var(--we-fill, 35%); }
.we-hatch-step.is-active i::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 25%;
  left: calc(var(--we-fill, 35%) - 25%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent);
  animation: we-shimmer 1.3s linear infinite;
}
@keyframes we-shimmer { from { transform: translateX(-30%); } to { transform: translateX(130%); } }
.we-hatch-step.is-done { color: var(--we-dark); border-color: var(--we-line); }
.we-hatch-step.is-done i::after { width: 100%; background: var(--we-green); }

/* ── Arcade ── */
.we-arcade {
  border: 1px solid var(--we-line);
  background: var(--we-surface);
  border-radius: 12px;
  overflow: hidden;
  text-align: left;
  box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.04);
}
.we-arcade-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--we-line);
  background: var(--we-bg);
}
.we-arcade-label { font-family: var(--we-pixel); font-size: 7px; color: var(--we-muted); letter-spacing: .5px; white-space: nowrap; }
.we-arcade-tabs { display: flex; gap: 4px; }
.we-arcade-tab {
  font-family: var(--we-pixel); font-size: 7px; letter-spacing: .3px;
  padding: 8px 10px; border: 1px solid var(--we-line-strong); background: var(--we-surface);
  color: var(--we-muted); cursor: pointer; border-radius: 6px;
  transition: all .15s;
}
.we-arcade-tab:hover { color: var(--we-dark); }
.we-arcade-tab.is-on { background: var(--we-dark); color: #fff; border-color: var(--we-dark); }
.we-arcade-screen {
  position: relative;
  background: #7CC8FF;
  aspect-ratio: 16 / 9;
}
.we-arcade-screen canvas {
  display: block; width: 100%; height: 100%;
  image-rendering: pixelated; image-rendering: crisp-edges;
  outline: none; touch-action: none; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.we-arcade-screen canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--we-orange); }
.we-arcade-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px;
  font-family: var(--we-pixel); font-size: 7px; letter-spacing: .4px; color: var(--we-muted);
}
.we-arcade-foot b { color: var(--we-dark); font-weight: 400; }
.we-arcade-hint { font-family: var(--we-sans); font-size: 12px; color: var(--we-muted); letter-spacing: 0; }

/* ── Hatch burst (full-screen flash on done) ── */
.we-hatch.is-hatched .we-hatch-title { color: var(--we-orange); }
.we-hatch.is-hatched .we-arcade { opacity: .4; pointer-events: none; transition: opacity .4s; }

@media (max-width: 480px) {
  .we-hatch-title { font-size: 20px; }
  .we-hatch-steps { gap: 4px; }
  .we-hatch-step { font-size: 6px; padding: 8px 4px 7px; }
  .we-arcade-label, .we-hatch-meta .we-dot { display: none; }
  .we-hatch-meta { gap: 8px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .we-hatch-shadow, .we-hatch-step.is-active i::before { animation: none; }
}
