@font-face {
  font-family: "GaeguMneme";
  src: url("./assets/pixel/Gaegu-Bold-2.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "FuLuMneme";
  src: url("./assets/pixel/FuLuKuanJiaoDaiTi-2.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

body {
  background: #0b090b;
}

.field-layer {
  transform: translate3d(0, 105%, 0) scale(0.98);
  transition:
    transform 980ms cubic-bezier(0.17, 0.92, 0.18, 1),
    filter 980ms cubic-bezier(0.17, 0.92, 0.18, 1);
  filter: brightness(1.18) saturate(1.18);
  will-change: transform, filter;
}

body.is-field .field-layer {
  transform: translate3d(0, 0, 0) scale(1);
  filter: brightness(1) saturate(1);
}

body.is-preference .field-layer {
  transform: translate3d(0, 105%, 0) scale(0.98);
  filter: brightness(1.18) saturate(1.18);
}

body.is-loading .cursor-bee {
  opacity: 0;
}

body.is-field .cursor-bee {
  opacity: 1;
  transition: opacity 260ms ease 720ms;
}

.loading-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 46%, rgba(185, 236, 55, 0.1), transparent 32%),
    #0b090b;
  transform: translate3d(0, 0, 0);
  transition:
    transform 920ms cubic-bezier(0.17, 0.92, 0.18, 1),
    opacity 520ms ease 360ms;
  will-change: transform, opacity;
}

.loading-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(90deg, rgba(255, 0, 100, 0.05) 0 1px, transparent 1px 7px);
  mix-blend-mode: screen;
  opacity: 0.45;
}

.loading-layer::after {
  content: "";
  position: absolute;
  left: -10vw;
  right: -10vw;
  bottom: -18vh;
  height: 34vh;
  background: rgb(185, 236, 55);
  border-radius: 50% 50% 0 0 / 22% 22% 0 0;
  filter:
    drop-shadow(3px 0 0 rgba(255, 0, 94, 0.48))
    drop-shadow(-3px 0 0 rgba(0, 132, 255, 0.42));
  transform: translate3d(0, 10%, 0);
}

body.is-field .loading-layer {
  transform: translate3d(0, -112%, 0);
  opacity: 0;
  pointer-events: none;
}

.loading-mark {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 12px;
  transform: translate3d(0, -2vh, 0);
  animation: loadingFloat 860ms ease-in-out infinite alternate;
}

.loading-mark img {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter:
    drop-shadow(3px 0 0 rgba(255, 0, 94, 0.52))
    drop-shadow(-3px 0 0 rgba(0, 132, 255, 0.48))
    drop-shadow(0 10px 0 rgba(0, 0, 0, 0.24));
}

.loading-text {
  position: relative;
  color: rgb(255, 235, 246);
  font-family: "GaeguMneme", "Comic Sans MS", cursive;
  font-size: clamp(38px, 7vw, 84px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: 0;
  text-transform: lowercase;
  text-shadow:
    3px 0 0 rgba(255, 0, 94, 0.55),
    -3px 0 0 rgba(0, 132, 255, 0.5),
    0 5px 0 rgba(0, 0, 0, 0.28);
}

.loading-text::after {
  content: "...";
  position: absolute;
  left: 100%;
  bottom: 0.08em;
  width: 1.1em;
  overflow: hidden;
  animation: loadingDots 900ms steps(4, end) infinite;
}

@keyframes loadingFloat {
  from {
    transform: translate3d(0, -2vh, 0) rotate(-1.5deg);
  }

  to {
    transform: translate3d(0, calc(-2vh - 8px), 0) rotate(1.5deg);
  }
}

@keyframes loadingDots {
  from {
    width: 0;
  }

  to {
    width: 1.1em;
  }
}

.egg-layer {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.egg-sprite {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: var(--z);
  width: var(--size);
  height: var(--size);
  opacity: 0;
  transform: translate(-50%, -50%) translateY(22px) scale(0.2);
  transform-origin: 50% 88%;
  animation: eggRise 620ms var(--delay) cubic-bezier(0.16, 1.28, 0.26, 1) forwards;
  will-change: transform, opacity;
}

.egg-sprite img {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transform-origin: 50% 92%;
  animation: eggWiggle 1180ms calc(var(--delay) + 620ms) ease-in-out infinite;
  filter:
    drop-shadow(2px 0 0 rgba(255, 0, 94, 0.42))
    drop-shadow(-2px 0 0 rgba(0, 132, 255, 0.36));
}

.tree-sprite {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: var(--z);
  width: var(--size);
  height: calc(var(--size) * 1.203);
  opacity: 0;
  transform: translate(-50%, -100%) translateY(34px) scale(0.16);
  transform-origin: 50% 96%;
  animation: treeRise 760ms var(--delay) cubic-bezier(0.16, 1.24, 0.22, 1) forwards;
  will-change: transform, opacity;
}

.tree-sprite img {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transform-origin: 50% 96%;
  animation: treeBreath 2650ms calc(var(--delay) + 760ms) ease-in-out infinite;
  filter:
    drop-shadow(2px 0 0 rgba(255, 0, 94, 0.38))
    drop-shadow(-2px 0 0 rgba(0, 132, 255, 0.32));
}

.dialogue-layer {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}

.dialogue-layer.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.dialogue-box {
  position: relative;
  width: min(620px, 82vw);
  min-height: 188px;
  padding: clamp(42px, 5vw, 56px) clamp(36px, 5vw, 58px) clamp(70px, 7vw, 86px);
  background: #fffdf3;
  border-radius: 32px;
  transform: scale(0.18) rotate(-2deg);
  transform-origin: 50% 58%;
  animation: dialoguePop 720ms cubic-bezier(0.14, 1.5, 0.25, 1) forwards;
}

.dialogue-name {
  position: absolute;
  left: clamp(28px, 5vw, 54px);
  top: -28px;
  min-width: 156px;
  padding: 9px 22px 10px;
  border-radius: 999px;
  background: #c98c3a;
  color: #3e250c;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(17px, 2.3vw, 24px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  transform: rotate(-6deg);
}

.dialogue-text {
  min-height: 62px;
  margin: 0;
  color: #5f594c;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(26px, 4.6vw, 44px);
  font-weight: 900;
  line-height: 1.24;
  letter-spacing: 0;
  word-break: normal;
}

.dialogue-button {
  position: absolute;
  right: clamp(34px, 5vw, 64px);
  bottom: clamp(26px, 4vw, 42px);
  min-width: 126px;
  min-height: 52px;
  padding: 9px 22px 11px;
  border: 0;
  border-radius: 999px;
  background: rgb(255, 208, 1);
  color: #6f5a00;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  opacity: 0;
  cursor: none;
  transform: translateY(10px) scale(0.62);
  pointer-events: none;
}

.dialogue-button.is-ready {
  opacity: 1;
  pointer-events: auto;
  animation: buttonPop 420ms cubic-bezier(0.12, 1.7, 0.26, 1) forwards;
}

.dialogue-button.is-pressed {
  animation: buttonPress 230ms cubic-bezier(0.12, 1.7, 0.26, 1) forwards;
}

.dialogue-button:disabled {
  opacity: 0.82;
  color: #957700;
}

.dialogue-button[hidden] {
  display: none;
}

.pixel-button {
  min-height: 52px;
  padding: 9px 24px 11px;
  border: 0;
  border-radius: 999px;
  color: #6f5a00;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  cursor: none;
  transform: translateY(0) scale(1);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.pixel-button.primary {
  background: rgb(255, 208, 1);
}

.pixel-button.secondary {
  background: #fffdf3;
  color: #7c6240;
}

.pixel-button.teal {
  background: rgb(12, 202, 190);
  color: #fffdf3;
}

.pixel-button.is-pressed,
.refresh-personality.is-pressed {
  animation: buttonPress 230ms cubic-bezier(0.12, 1.7, 0.26, 1) forwards;
}

.jump-dots {
  display: inline-flex;
  gap: 0.06em;
  margin-left: 0.05em;
  vertical-align: baseline;
}

.jump-dots i {
  display: inline-block;
  font-style: normal;
  animation: dotJump 740ms ease-in-out infinite;
}

.jump-dots i:nth-child(2) {
  animation-delay: 120ms;
}

.jump-dots i:nth-child(3) {
  animation-delay: 240ms;
}

.preference-layer {
  --tile: 82px;
  --move-x: 164px;
  --move-y: 0;
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, -112%, 0);
  background-color: rgb(232, 36, 110);
  background-image:
    linear-gradient(45deg, rgb(233, 124, 160) 25%, transparent 25%, transparent 75%, rgb(233, 124, 160) 75%),
    linear-gradient(45deg, rgb(233, 124, 160) 25%, transparent 25%, transparent 75%, rgb(233, 124, 160) 75%);
  background-position: 0 0, var(--tile) var(--tile);
  background-size: calc(var(--tile) * 2) calc(var(--tile) * 2);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.preference-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 5px),
    radial-gradient(circle at 50% 48%, transparent 0 58%, rgba(0, 0, 0, 0.18) 100%);
  mix-blend-mode: soft-light;
}

.preference-layer.is-active {
  pointer-events: auto;
  opacity: 1;
  animation:
    preferenceDrop 1060ms cubic-bezier(0.16, 1.04, 0.19, 1) forwards,
    checkerDrift 7200ms linear infinite;
}

.preference-layer.is-shaking {
  filter: brightness(1.08) saturate(1.08);
}

.preference-layer.is-leaving {
  pointer-events: none;
  animation: preferenceLeave 520ms ease-in forwards;
}

.preference-card {
  position: relative;
  z-index: 2;
  width: min(430px, 76vw);
  min-height: min(520px, 56vh);
  padding: clamp(32px, 5vw, 54px);
  display: grid;
  place-items: center;
  border-radius: 34px;
  background: #fffdf3;
  color: #5f594c;
  touch-action: none;
  user-select: none;
  opacity: 0;
  transform: translate3d(0, 22px, 0) scale(0.32);
  transform-origin: 50% 78%;
  will-change: transform, opacity;
}

.preference-layer.is-ready .preference-card {
  opacity: 1;
  animation: cardPop 560ms cubic-bezier(0.12, 1.72, 0.26, 1) forwards;
}

.preference-card.is-dragging {
  animation: none;
}

.preference-card.is-out-left {
  animation: cardOutLeft 380ms cubic-bezier(0.58, 0.04, 0.92, 0.45) forwards;
}

.preference-card.is-out-right {
  animation: cardOutRight 380ms cubic-bezier(0.58, 0.04, 0.92, 0.45) forwards;
}

.preference-card-text {
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(30px, 5.2vw, 58px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0;
  text-align: center;
}

.preference-caption {
  position: absolute;
  left: 50%;
  bottom: clamp(54px, 9vh, 92px);
  z-index: 3;
  max-width: min(720px, 86vw);
  color: rgb(241, 241, 243);
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(28px, 4.8vw, 54px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0;
  text-align: center;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.16);
  transform: translateX(-50%) scale(1);
  pointer-events: none;
}

.preference-caption.is-pop {
  animation: captionPop 320ms cubic-bezier(0.13, 1.75, 0.25, 1) forwards;
}

@keyframes preferenceDrop {
  0% {
    transform: translate3d(0, -112%, 0);
  }

  58% {
    transform: translate3d(0, 6%, 0);
  }

  73% {
    transform: translate3d(0, -3%, 0);
  }

  86% {
    transform: translate3d(0, 1.3%, 0);
  }

  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes preferenceLeave {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  to {
    opacity: 0;
    transform: translate3d(0, -112%, 0);
  }
}

@keyframes checkerDrift {
  from {
    background-position: 0 0, var(--tile) var(--tile);
  }

  to {
    background-position: var(--move-x) var(--move-y), calc(var(--tile) + var(--move-x)) calc(var(--tile) + var(--move-y));
  }
}

@keyframes cardPop {
  0% {
    transform: translate3d(0, 22px, 0) scale(0.32);
  }

  46% {
    transform: translate3d(0, -8px, 0) scale(1.16, 0.9);
  }

  72% {
    transform: translate3d(0, 3px, 0) scale(0.94, 1.06);
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes cardOutLeft {
  to {
    opacity: 0;
    transform: translate3d(-120vw, -6vh, 0) rotate(-22deg) scale(0.92);
  }
}

@keyframes cardOutRight {
  to {
    opacity: 0;
    transform: translate3d(120vw, -6vh, 0) rotate(22deg) scale(0.92);
  }
}

@keyframes captionPop {
  0% {
    transform: translateX(-50%) scale(0.58);
  }

  58% {
    transform: translateX(-50%) scale(1.18, 0.88);
  }

  100% {
    transform: translateX(-50%) scale(1);
  }
}

@keyframes eggRise {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(22px) scale(0.18);
  }

  54% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(-8px) scale(1.16, 0.82);
  }

  76% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(2px) scale(0.92, 1.1);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0) scale(1);
  }
}

@keyframes eggWiggle {
  0%,
  100% {
    transform: scaleX(var(--flip)) rotate(-3deg) scale(1, 1);
  }

  25% {
    transform: scaleX(var(--flip)) rotate(4deg) scale(1.08, 0.92) translateY(2px);
  }

  50% {
    transform: scaleX(var(--flip)) rotate(-2deg) scale(0.95, 1.07) translateY(-2px);
  }

  75% {
    transform: scaleX(var(--flip)) rotate(5deg) scale(1.05, 0.95) translateY(1px);
  }
}

@keyframes treeRise {
  0% {
    opacity: 0;
    transform: translate(-50%, -100%) translateY(34px) rotate(0deg) scale(0.16);
  }

  58% {
    opacity: 1;
    transform: translate(-50%, -100%) translateY(-8px) rotate(var(--tilt)) scale(1.1, 0.9);
  }

  78% {
    opacity: 1;
    transform: translate(-50%, -100%) translateY(3px) rotate(var(--tilt)) scale(0.94, 1.06);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -100%) translateY(0) rotate(var(--tilt)) scale(1);
  }
}

@keyframes treeBreath {
  0%,
  100% {
    transform: scaleX(var(--flip)) rotate(0deg) scale(1, 1);
  }

  42% {
    transform: scaleX(var(--flip)) rotate(-1.5deg) scale(1.035, 0.975) translateY(1px);
  }

  72% {
    transform: scaleX(var(--flip)) rotate(1.2deg) scale(0.985, 1.025) translateY(-1px);
  }
}

@keyframes dialoguePop {
  0% {
    transform: scale(0.18) rotate(-2deg);
  }

  44% {
    transform: scale(1.18, 0.86) rotate(1.4deg);
  }

  64% {
    transform: scale(0.92, 1.08) rotate(-0.8deg);
  }

  82% {
    transform: scale(1.04, 0.98) rotate(0.3deg);
  }

  100% {
    transform: scale(1) rotate(0);
  }
}

@keyframes buttonPop {
  0% {
    transform: translateY(10px) scale(0.62);
  }

  56% {
    transform: translateY(-2px) scale(1.16, 0.9);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes buttonPress {
  0% {
    transform: translateY(0) scale(1);
  }

  54% {
    transform: translateY(0) scale(1.18, 0.9);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

.effect-layer {
  position: fixed;
  inset: 0;
  z-index: 990;
  pointer-events: none;
  overflow: hidden;
}

.screen-burst {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 0;
  height: 0;
  pointer-events: none;
}

.screen-burst span {
  position: absolute;
  left: 0;
  top: -1px;
  width: 16px;
  height: 3px;
  border-radius: 999px;
  background: #fff;
  transform-origin: 0 50%;
  animation: screenBurst 520ms ease-out forwards;
}

.dust-puff {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  background: url("./assets/pixel/spr_dust.png") center / contain no-repeat;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  animation: dustPuff 560ms ease-out forwards;
}

.hatch-layer {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

.hatch-layer.is-active {
  opacity: 1;
  pointer-events: auto;
}

.hatch-egg {
  position: relative;
  z-index: 3;
  grid-area: 1 / 1;
  width: min(250px, 42vw);
  height: min(250px, 42vw);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: none;
  opacity: 0;
  transform: translateY(42px) scale(0.22);
  transform-origin: 50% 88%;
  pointer-events: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hatch-egg.is-visible {
  opacity: 1;
  animation: hatchEggPop 720ms cubic-bezier(0.14, 1.52, 0.22, 1) forwards;
}

.hatch-egg.is-hit {
  animation: hatchEggHit 280ms cubic-bezier(0.12, 1.65, 0.26, 1) forwards;
}

.hatch-egg.is-done {
  pointer-events: none;
  animation: hatchEggDone 460ms ease-in forwards;
}

.hatch-egg img {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter:
    drop-shadow(4px 0 0 rgba(255, 0, 94, 0.5))
    drop-shadow(-4px 0 0 rgba(0, 132, 255, 0.42))
    drop-shadow(0 14px 0 rgba(54, 80, 0, 0.12));
}

.pet-placeholder {
  position: relative;
  z-index: 8;
  grid-area: 1 / 1;
  width: min(220px, 36vw);
  height: min(220px, 36vw);
  opacity: 0;
  transform: translateY(32px) scale(0.18);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.pet-placeholder.is-visible {
  opacity: 1;
  animation: petPop 760ms cubic-bezier(0.13, 1.7, 0.23, 1) forwards;
}

.pixel-pet {
  --pet-color: rgb(255, 208, 1);
  --pet-shape: url("./assets/pixel/spr_cloud.png");
  --face-tilt: 0deg;
  position: relative;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  animation: petSquish 1420ms ease-in-out infinite;
  transform-origin: 50% 88%;
}

.pixel-pet-shape,
.pixel-pet-outline {
  position: absolute;
  inset: 8%;
  background: var(--pet-color);
  -webkit-mask: var(--pet-shape) center / contain no-repeat;
  mask: var(--pet-shape) center / contain no-repeat;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.pixel-pet-outline {
  z-index: 0;
  inset: 2%;
  background: #101010;
}

.pixel-pet-shape {
  z-index: 1;
}

.pixel-pet-face {
  position: absolute;
  left: 50%;
  top: 47%;
  z-index: 2;
  width: 38%;
  height: 38%;
  object-fit: contain;
  transform: translate(-50%, -50%) rotate(var(--face-tilt));
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hatch-actions {
  position: absolute;
  left: 50%;
  top: calc(50% + min(170px, 27vw));
  z-index: 9;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  width: min(620px, 86vw);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px) scale(0.72);
}

.hatch-actions.is-visible {
  opacity: 1;
  pointer-events: auto;
  animation: hatchActionsPop 430ms cubic-bezier(0.12, 1.7, 0.26, 1) forwards;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  z-index: 14;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  left: var(--x);
  top: -28px;
  width: var(--w);
  height: var(--h);
  border-radius: 0;
  background: var(--c);
  box-shadow:
    3px 0 0 #111,
    -3px 0 0 #111,
    0 3px 0 #111,
    0 -3px 0 #111;
  transform: rotate(var(--r));
  animation: confettiFall var(--dur) linear var(--delay) forwards;
}

.naming-layer {
  --tile: 86px;
  --move-x: 172px;
  --move-y: 0;
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  grid-template-columns: minmax(240px, 36vw) minmax(340px, 540px);
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 6vw, 84px);
  overflow: hidden;
  padding: clamp(24px, 5vw, 70px);
  background-color: rgb(232, 152, 81);
  background-image:
    linear-gradient(45deg, rgb(235, 128, 34) 25%, transparent 25%, transparent 75%, rgb(235, 128, 34) 75%),
    linear-gradient(45deg, rgb(235, 128, 34) 25%, transparent 25%, transparent 75%, rgb(235, 128, 34) 75%);
  background-position: 0 0, var(--tile) var(--tile);
  background-size: calc(var(--tile) * 2) calc(var(--tile) * 2);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, -112%, 0);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.naming-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 6px),
    radial-gradient(circle at 50% 48%, transparent 0 62%, rgba(0, 0, 0, 0.2) 100%);
  mix-blend-mode: soft-light;
}

.naming-layer.is-active {
  opacity: 1;
  pointer-events: auto;
  animation:
    namingDrop 960ms cubic-bezier(0.16, 1.04, 0.19, 1) forwards,
    checkerDrift 7600ms linear infinite;
}

.naming-pet-wrap,
.naming-panel {
  position: relative;
  z-index: 2;
}

.naming-pet-wrap {
  display: grid;
  justify-items: center;
  gap: 22px;
  transform: translateY(18px);
  animation: namingPetPop 560ms 760ms cubic-bezier(0.12, 1.72, 0.26, 1) both;
}

.naming-pet,
.share-pet {
  width: min(260px, 36vw);
  height: min(260px, 36vw);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.naming-pet-badge {
  padding: 12px 28px 14px;
  border-radius: 999px;
  background: #fffdf3;
  color: #734f22;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 900;
  line-height: 1;
}

.naming-panel {
  width: min(540px, 88vw);
  padding: clamp(30px, 4vw, 44px);
  border-radius: 34px;
  background: #fffdf3;
  color: #734f22;
  animation: namingPanelPop 580ms 820ms cubic-bezier(0.12, 1.72, 0.26, 1) both;
}

.personality-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.personality-tag {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 16px 9px;
  border-radius: 999px;
  background: rgb(187, 236, 59);
  color: #2d742c;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.refresh-personality {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgb(255, 208, 1);
  color: #6f5a00;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  cursor: none;
}

.naming-panel h1 {
  margin: 0 0 26px;
  color: #734f22;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
}

.name-field {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.name-field span {
  color: #734f22;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 900;
}

.name-field input {
  width: 100%;
  min-height: 62px;
  box-sizing: border-box;
  padding: 12px 22px 14px;
  border: 0;
  border-radius: 999px;
  background: #f8f7ee;
  color: #734f22;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 900;
  outline: none;
  cursor: none;
}

.name-field input::placeholder {
  color: rgba(115, 79, 34, 0.45);
}

.naming-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.login-status {
  flex: 1 1 100%;
  min-height: 24px;
  margin: -4px 0 0;
  color: rgba(115, 79, 34, 0.72);
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
}

.share-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 8, 8, 0.36);
  opacity: 0;
  pointer-events: none;
}

.share-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.share-card {
  width: min(420px, 82vw);
  min-height: 520px;
  padding: 34px 30px 38px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 18px;
  border-radius: 38px;
  background: #fffdf3;
  color: #734f22;
  transform: scale(0.3) rotate(-3deg);
  animation: shareCardPop 560ms cubic-bezier(0.12, 1.72, 0.26, 1) forwards;
}

.share-pet {
  width: min(210px, 48vw);
  height: min(210px, 48vw);
}

.share-personality {
  padding: 8px 18px 9px;
  border-radius: 999px;
  background: rgb(187, 236, 59);
  color: #2d742c;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.share-name {
  color: #734f22;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(40px, 7vw, 70px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.portal-transition {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  background: transparent;
}

.portal-transition.is-active {
  opacity: 1;
}

.portal-dot {
  width: 180vmax;
  height: 180vmax;
  border-radius: 50%;
  background: #0b090b;
  transform: scale(0);
}

.portal-transition.is-active .portal-dot {
  animation: portalPulse 1160ms cubic-bezier(0.16, 1, 0.24, 1) forwards;
}

.hub-layer {
  --hub-tile: 74px;
  position: fixed;
  inset: 0;
  z-index: 250;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.26), transparent 32%),
    rgb(255, 208, 1);
  background-size: var(--hub-tile) var(--hub-tile), var(--hub-tile) var(--hub-tile), auto, auto;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.08);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hub-layer::before {
  content: "";
  position: absolute;
  inset: 28px;
  border: 12px solid #0b090b;
  border-radius: 46px;
  pointer-events: none;
}

.hub-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.08) 0 1px, transparent 1px 5px),
    radial-gradient(circle at 50% 50%, transparent 0 64%, rgba(0, 0, 0, 0.22) 100%);
}

.hub-layer.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  animation: hubPop 720ms cubic-bezier(0.12, 1.55, 0.24, 1) forwards;
}

.hub-pet-orbit {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 16px;
  transform: translateY(2vh);
}

.hub-pet {
  width: min(260px, 38vw);
  height: min(260px, 38vw);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  animation: hubPetBob 1500ms ease-in-out infinite;
}

.hub-greeting {
  min-height: 42px;
  padding: 10px 22px 12px;
  border-radius: 999px;
  background: #fffdf3;
  color: #734f22;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(18px, 2.8vw, 28px);
  font-weight: 900;
  line-height: 1;
}

.hub-bubble {
  position: absolute;
  z-index: 3;
  width: min(330px, 35vw);
  min-height: 156px;
  padding: 24px 26px 28px;
  border: 8px solid #0b090b;
  border-radius: 999px;
  background: rgb(187, 236, 59);
  color: #0b090b;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(24px, 3.6vw, 42px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
  cursor: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-shadow:
    8px 0 0 rgb(254, 118, 168),
    -8px 0 0 rgb(100, 168, 205);
}

.bubble-anime {
  left: clamp(52px, 10vw, 170px);
  top: clamp(98px, 18vh, 190px);
  animation: bubblePulseA 1600ms ease-in-out infinite;
}

.bubble-life {
  right: clamp(52px, 10vw, 170px);
  bottom: clamp(96px, 16vh, 180px);
  background: rgb(100, 168, 205);
  animation: bubblePulseB 1850ms ease-in-out infinite;
}

.original-app-link {
  position: fixed;
  right: 22px;
  bottom: 20px;
  z-index: 520;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  min-height: 46px;
  padding: 9px 18px 11px;
  border-radius: 999px;
  background: #fffdf3;
  color: #734f22;
  text-decoration: none;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: none;
}

@keyframes dotJump {
  0%,
  100% {
    transform: translateY(0);
  }

  42% {
    transform: translateY(-0.22em);
  }
}

@keyframes hatchActionsPop {
  0% {
    transform: translate(-50%, 18px) scale(0.72);
  }

  58% {
    transform: translate(-50%, -4px) scale(1.14, 0.88);
  }

  100% {
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes petSquish {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  44% {
    transform: translateY(7px) scale(1.06, 0.94);
  }

  72% {
    transform: translateY(-5px) scale(0.96, 1.05);
  }
}

@keyframes namingDrop {
  0% {
    transform: translate3d(0, -112%, 0);
  }

  58% {
    transform: translate3d(0, 5%, 0);
  }

  74% {
    transform: translate3d(0, -2.5%, 0);
  }

  88% {
    transform: translate3d(0, 1%, 0);
  }

  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes namingPetPop {
  0% {
    opacity: 0;
    transform: translateY(34px) scale(0.42);
  }

  58% {
    opacity: 1;
    transform: translateY(-8px) scale(1.16, 0.9);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes namingPanelPop {
  0% {
    opacity: 0;
    transform: translateY(38px) scale(0.5);
  }

  58% {
    opacity: 1;
    transform: translateY(-8px) scale(1.08, 0.95);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shareCardPop {
  0% {
    transform: scale(0.3) rotate(-3deg);
  }

  56% {
    transform: scale(1.14, 0.9) rotate(2deg);
  }

  100% {
    transform: scale(1) rotate(0);
  }
}

@keyframes portalPulse {
  0% {
    transform: scale(1);
  }

  42% {
    transform: scale(0.035);
  }

  100% {
    transform: scale(1.08);
  }
}

@keyframes hubPop {
  0% {
    transform: scale(1.12);
  }

  58% {
    transform: scale(0.96, 1.04);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes hubPetBob {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  48% {
    transform: translateY(9px) scale(1.05, 0.94);
  }
}

@keyframes bubblePulseA {
  0%,
  100% {
    transform: rotate(-5deg) scale(1);
  }

  50% {
    transform: rotate(4deg) scale(1.08, 0.93);
  }
}

@keyframes bubblePulseB {
  0%,
  100% {
    transform: rotate(6deg) scale(1);
  }

  50% {
    transform: rotate(-3deg) scale(0.94, 1.08);
  }
}

@keyframes screenBurst {
  0% {
    opacity: 1;
    transform: rotate(var(--angle)) translateX(8px) scaleX(1);
  }

  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(58px) scaleX(0.05);
  }
}

@keyframes dustPuff {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(0.5);
  }

  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(1.8);
  }
}

@keyframes hatchEggPop {
  0% {
    transform: translateY(42px) scale(0.22);
  }

  52% {
    transform: translateY(-12px) scale(1.16, 0.86);
  }

  76% {
    transform: translateY(4px) scale(0.92, 1.08);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes hatchEggHit {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  48% {
    transform: translateY(10px) scale(1.18, 0.78) rotate(-3deg);
  }
}

@keyframes hatchEggDone {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(36px) scale(0.08);
  }
}

@keyframes petPop {
  0% {
    transform: translateY(32px) scale(0.18);
  }

  48% {
    transform: translateY(-12px) scale(1.18, 0.86);
  }

  72% {
    transform: translateY(4px) scale(0.92, 1.08);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(var(--r));
  }

  100% {
    opacity: 1;
    transform: translate3d(var(--dx), 118vh, 0) rotate(calc(var(--r) + 420deg));
  }
}

@media (max-width: 900px) {
  .naming-layer {
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: 18px;
    padding: 22px;
  }

  .naming-pet-wrap {
    gap: 12px;
  }

  .naming-pet {
    width: min(190px, 42vw);
    height: min(190px, 42vw);
  }

  .naming-pet-badge {
    padding: 10px 22px 12px;
    font-size: clamp(18px, 4vw, 22px);
  }

  .naming-panel {
    width: min(620px, 92vw);
    padding: 28px;
  }

  .naming-panel h1 {
    margin-bottom: 18px;
    font-size: clamp(30px, 7vw, 44px);
  }

  .naming-actions {
    gap: 10px;
  }

  .naming-actions .pixel-button {
    min-height: 48px;
    padding-inline: 18px;
    font-size: 18px;
  }

  .share-card {
    width: min(390px, 84vw);
    min-height: 500px;
  }

  .hub-layer::before {
    inset: 16px;
    border-width: 8px;
    border-radius: 34px;
  }

  .hub-pet {
    width: min(230px, 46vw);
    height: min(230px, 46vw);
  }

  .hub-bubble {
    width: min(300px, 44vw);
    min-height: 126px;
    border-width: 6px;
    font-size: clamp(21px, 4.6vw, 32px);
  }

  .bubble-anime {
    left: 22px;
    top: 86px;
  }

  .bubble-life {
    right: 22px;
    bottom: 84px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .field-layer,
  .loading-layer,
  .loading-mark,
  .loading-text::after,
  .egg-sprite,
  .egg-sprite img,
  .tree-sprite,
  .tree-sprite img,
  .dialogue-box,
  .dialogue-button,
  .preference-layer,
  .preference-card,
  .preference-caption,
  .hatch-egg,
  .pet-placeholder,
  .pixel-pet,
  .hatch-actions,
  .naming-layer,
  .naming-pet-wrap,
  .naming-panel,
  .share-card,
  .portal-transition .portal-dot,
  .hub-layer,
  .hub-pet,
  .hub-bubble,
  .confetti-piece,
  .screen-burst span,
  .dust-puff,
  .jump-dots i {
    transition: none;
    animation: none;
  }
}
