:root {
  --dino-frame-nudge-y: 0px;
  --paper: #fff6df;
  --moss: #315b3d;
  --moss-deep: #183627;
  --gold: #e4ae35;
  --gold-soft: rgba(255, 219, 112, 0.72);
  --ink: #243125;
  --cream: rgba(255, 248, 230, 0.82);
  --line: rgba(47, 78, 51, 0.2);
  --shadow: 0 30px 80px rgba(42, 48, 29, 0.26);
  --stage-w: min(calc(100vw - 28px), 390px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow-x: hidden;
  color: var(--ink);
  background: linear-gradient(135deg, #fff7e6 0%, #dceccc 100%);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button {
  font: inherit;
}

.page-shell {
  width: 100%;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.phone-stage {
  position: relative;
  width: var(--stage-w);
  aspect-ratio: 9 / 16;
  max-height: calc(100svh - 36px);
  overflow: hidden;
  border: 1px solid rgba(49, 91, 61, 0.2);
  border-radius: 26px;
  background: #f9e8b5;
  box-shadow: var(--shadow);
  isolation: isolate;
  touch-action: none;
}

.phone-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 253, 239, 0.34), transparent 22%, rgba(28, 60, 36, 0.1) 100%);
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
}

.screen.is-active {
  display: block;
}

.screen-home {
  z-index: 5;
}

.screen-reward {
  z-index: 9;
  padding: 18px;
  overflow-y: auto;
  scrollbar-width: none;
  color: var(--moss-deep);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 224, 118, 0.34), transparent 36%),
    linear-gradient(180deg, rgba(255, 247, 220, 0.8), rgba(255, 239, 182, 0.54) 46%, rgba(49, 91, 61, 0.18)),
    rgba(255, 246, 223, 0.28);
  backdrop-filter: blur(1px);
}

.screen-reward::-webkit-scrollbar,
.screen-collection::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.asset {
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.asset.is-missing {
  display: none;
}

.asset-background {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-bar {
  position: relative;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 0;
  color: var(--moss-deep);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand-mark,
.brand-status {
  border: 1px solid rgba(49, 91, 61, 0.22);
  border-radius: 999px;
  padding: 7px 9px;
  background: rgba(255, 250, 235, 0.56);
  box-shadow: 0 10px 28px rgba(64, 74, 41, 0.12);
  backdrop-filter: blur(14px);
}

.brand-status {
  color: #765623;
}

.scene-copy {
  position: relative;
  z-index: 7;
  width: min(88%, 340px);
  margin: 30px auto 0;
  text-align: center;
  text-shadow: 0 2px 18px rgba(255, 255, 255, 0.52);
}

.eyebrow {
  margin: 0 0 8px;
  color: rgba(49, 91, 61, 0.86);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  color: var(--moss-deep);
  font-size: clamp(26px, 6.2vw, 33px);
  line-height: 1.08;
  letter-spacing: 0;
  text-wrap: pretty;
}

.dino-layer {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 19.5%;
  width: 92%;
  aspect-ratio: 1070 / 1470;
  transform: translateX(-50%);
  pointer-events: none;
}

.home-action {
  position: absolute;
  z-index: 9;
  left: 22px;
  right: 22px;
  bottom: 24px;
  display: grid;
  gap: 10px;
  justify-items: center;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}

.home-action.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.home-action p {
  max-width: 310px;
  margin: 0;
  color: rgba(24, 54, 39, 0.78);
  text-align: center;
  font-size: 12px;
  line-height: 1.52;
  text-shadow: 0 1px 14px rgba(255, 255, 255, 0.68);
}

.nfc-scan-card {
  position: absolute;
  z-index: 9;
  left: 50%;
  top: 13.2%;
  display: none;
  width: min(58%, 220px);
  min-height: 44px;
  overflow: hidden;
  border: 1px solid rgba(146, 108, 32, 0.24);
  border-radius: 8px;
  padding: 11px 14px 10px;
  color: #654916;
  background: rgba(255, 250, 235, 0.74);
  box-shadow: 0 18px 46px rgba(70, 58, 38, 0.14);
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}

[data-state="nfc_scanning"] .scene-copy {
  opacity: 0.72;
  transform: translateY(0);
}

.nfc-scan-card p {
  position: relative;
  z-index: 2;
  margin: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.scan-line {
  position: absolute;
  z-index: 1;
  left: 16px;
  right: 16px;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(206, 154, 44, 0.72), transparent);
  transform: translateY(-50%);
  animation: scanLinePulse 1s ease-in-out infinite;
}

[data-state="nfc_scanning"] .nfc-scan-card {
  display: block;
}

.nfc-debug-button {
  position: absolute;
  z-index: 10;
  right: 14px;
  bottom: 14px;
  display: none;
  min-height: 34px;
  border: 1px solid rgba(49, 91, 61, 0.18);
  border-radius: 999px;
  padding: 0 12px;
  color: rgba(24, 54, 39, 0.72);
  background: rgba(255, 250, 235, 0.62);
  box-shadow: 0 10px 26px rgba(64, 74, 41, 0.12);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  backdrop-filter: blur(14px);
}

.phone-stage.is-debug-nfc .nfc-debug-button {
  display: inline-flex;
  align-items: center;
}

.dino-frame-layer {
  overflow: visible;
}

.dino-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  opacity: 1;
  transform: translateY(var(--dino-frame-nudge-y));
  transition: opacity 180ms ease;
  will-change: opacity;
}

.egg-button {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: 6.4%;
  width: 28%;
  min-width: 96px;
  aspect-ratio: 1 / 1.18;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translateX(-50%);
  cursor: pointer;
  touch-action: manipulation;
}

.egg-button:focus-visible {
  outline: 3px solid rgba(255, 219, 112, 0.9);
  outline-offset: 7px;
  border-radius: 18px;
}

.egg {
  position: absolute;
  z-index: 2;
  left: 8%;
  right: 8%;
  bottom: 0;
  width: 84%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 16px 18px rgba(69, 55, 30, 0.22));
  transition: transform 220ms ease;
}

.egg-button:active .egg {
  transform: translateY(2px) scale(0.98);
}

.glow {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: -24%;
  width: 190%;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transform: translateX(-50%) scale(0.92);
  transition:
    opacity 420ms ease,
    transform 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}

.egg-button.is-awake .glow {
  opacity: 0.86;
  transform: translateX(-50%) scale(1);
}

.primary-action {
  min-height: 44px;
  border: 1px solid rgba(67, 81, 38, 0.2);
  border-radius: 999px;
  padding: 0 18px;
  color: #fff9e8;
  background: linear-gradient(180deg, #8d6a20, #5d471b);
  box-shadow:
    0 13px 28px rgba(72, 55, 23, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.primary-action:active {
  transform: translateY(1px);
}

.reward-status {
  position: relative;
  z-index: 4;
  width: fit-content;
  max-width: calc(100% - 18px);
  margin-left: auto;
  border: 1px solid rgba(49, 91, 61, 0.2);
  border-radius: 999px;
  padding: 8px 11px;
  color: #6b4e1c;
  background: rgba(255, 250, 235, 0.68);
  box-shadow: 0 10px 28px rgba(64, 74, 41, 0.12);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.reward-card {
  position: relative;
  z-index: 2;
  width: min(91%, 336px);
  min-height: auto;
  margin: 18px auto 0;
  overflow: hidden;
  border: 1px solid rgba(99, 83, 35, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 252, 238, 0.7), rgba(255, 234, 166, 0.28)),
    rgba(255, 250, 232, 0.44);
  box-shadow:
    0 28px 68px rgba(66, 61, 35, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.64);
  backdrop-filter: blur(10px);
}

.reward-card::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 26%;
  width: 64%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 219, 112, 0.44);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 233, 144, 0.52) 0 28%, rgba(255, 233, 144, 0.12) 48%, transparent 68%);
  opacity: 0.74;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.reward-card::after {
  content: "";
  position: absolute;
  left: 11%;
  right: 11%;
  bottom: auto;
  top: 286px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(122, 92, 28, 0.18), transparent 68%);
  pointer-events: none;
}

.reward-copy {
  position: relative;
  z-index: 3;
  width: min(88%, 310px);
  margin: 22px auto 8px;
  text-align: center;
}

.reward-copy h2 {
  margin: 0;
  color: var(--moss-deep);
  font-size: clamp(23px, 6.2vw, 30px);
  line-height: 1.08;
  letter-spacing: 0;
}

.reward-copy p:not(.eyebrow) {
  margin: 8px auto 0;
  max-width: 270px;
  color: rgba(24, 54, 39, 0.78);
  font-size: 14px;
  line-height: 1.6;
}

.collection-card {
  position: relative;
  z-index: 3;
  width: calc(100% - 24px);
  margin: 0 auto 10px;
  display: grid;
  grid-template-columns: minmax(112px, 42%) 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(99, 83, 35, 0.2);
  border-radius: 14px;
  padding: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 247, 0.7), rgba(255, 238, 183, 0.34)),
    rgba(255, 250, 232, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.reward-baby-slot {
  position: relative;
  z-index: 3;
  width: 100%;
  min-height: 184px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.gold-baby {
  max-width: 100%;
  max-height: 202px;
  object-fit: contain;
  filter:
    drop-shadow(0 24px 24px rgba(67, 58, 34, 0.2))
    drop-shadow(0 0 18px rgba(255, 218, 101, 0.28));
  animation: rewardBabyBreath 3.4s ease-in-out infinite;
  transform-origin: 50% 76%;
  will-change: transform;
}

.baby-profile {
  position: relative;
  z-index: 4;
  min-width: 0;
}

.profile-name {
  margin: 0 0 8px;
  color: var(--moss-deep);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.18;
  text-wrap: pretty;
}

.profile-meta {
  display: grid;
  gap: 6px;
  margin: 0;
}

.profile-meta div {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 7px;
  align-items: baseline;
  min-width: 0;
}

.profile-meta dt {
  color: rgba(24, 54, 39, 0.54);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.profile-meta dd {
  min-width: 0;
  margin: 0;
  color: rgba(24, 54, 39, 0.84);
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.dex-progress,
.next-clue {
  position: relative;
  z-index: 3;
  width: calc(100% - 24px);
  margin: 10px auto 0;
  border: 1px solid rgba(49, 91, 61, 0.15);
  border-radius: 12px;
  padding: 11px;
  background: rgba(255, 250, 235, 0.5);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(24, 54, 39, 0.76);
  font-size: 12px;
  font-weight: 900;
}

.section-heading strong {
  color: #7d5a1b;
}

.slot-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-top: 9px;
}

.progress-slot {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  border: 1px dashed rgba(49, 91, 61, 0.22);
  border-radius: 8px;
  color: rgba(24, 54, 39, 0.42);
  background: rgba(255, 255, 255, 0.32);
  font-size: 10px;
  font-weight: 900;
}

.progress-slot.is-unlocked {
  border-style: solid;
  color: #fff8e6;
  background: linear-gradient(180deg, #d4a13a, #8a6422);
  box-shadow: 0 8px 18px rgba(122, 92, 28, 0.18);
}

.next-clue {
  display: grid;
  gap: 5px;
  color: rgba(24, 54, 39, 0.72);
}

.next-clue p,
.next-clue span,
.sticker-link {
  margin: 0;
  font-size: 12px;
  line-height: 1.48;
}

.next-clue strong {
  color: var(--moss-deep);
}

.next-clue em {
  color: #77531a;
  font-style: normal;
  font-weight: 900;
}

.sticker-link {
  position: relative;
  z-index: 3;
  width: calc(100% - 24px);
  margin: 10px auto 14px;
  border-top: 1px solid rgba(49, 91, 61, 0.14);
  padding-top: 10px;
  color: rgba(24, 54, 39, 0.68);
  text-align: center;
}

.reward-actions {
  position: sticky;
  z-index: 6;
  bottom: 0;
  width: min(91%, 336px);
  margin: 10px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border: 1px solid rgba(49, 91, 61, 0.14);
  border-radius: 999px;
  padding: 8px;
  background: rgba(255, 250, 235, 0.82);
  box-shadow: 0 16px 36px rgba(66, 61, 35, 0.16);
  backdrop-filter: blur(14px);
}

.secondary-action {
  min-height: 44px;
  border: 1px solid rgba(49, 91, 61, 0.22);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--moss-deep);
  background: rgba(255, 250, 235, 0.72);
  box-shadow: 0 10px 24px rgba(64, 74, 41, 0.11);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.reward-missing {
  display: none;
  width: 100%;
  border: 1px solid rgba(49, 91, 61, 0.18);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 250, 235, 0.82);
  box-shadow: 0 20px 48px rgba(70, 58, 38, 0.16);
  text-align: left;
  backdrop-filter: blur(16px);
}

.reward-missing.is-visible {
  display: block;
}

.reward-missing h3 {
  margin: 6px 0 8px;
  color: var(--moss-deep);
  font-size: 18px;
  line-height: 1.18;
}

.reward-missing p:last-child {
  margin: 0;
  color: rgba(36, 49, 37, 0.72);
  font-size: 13px;
  line-height: 1.62;
}

.continue-action {
  position: static;
  z-index: auto;
  left: auto;
  bottom: auto;
  transform: none;
  min-width: 132px;
}

.continue-action:active {
  transform: translateY(1px);
}

.screen-collection {
  z-index: 10;
  padding: 18px;
  overflow-y: auto;
  color: var(--moss-deep);
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 226, 132, 0.34), transparent 30%),
    linear-gradient(180deg, rgba(255, 248, 226, 0.9), rgba(232, 244, 218, 0.7)),
    rgba(255, 246, 223, 0.34);
  backdrop-filter: blur(1px);
}

.collection-book {
  width: min(92%, 344px);
  min-height: calc(100% - 22px);
  margin: 10px auto 0;
  border: 1px solid rgba(49, 91, 61, 0.18);
  border-radius: 18px;
  padding: 18px 14px 16px;
  background:
    linear-gradient(90deg, rgba(49, 91, 61, 0.08) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(255, 254, 244, 0.8), rgba(255, 244, 212, 0.62));
  background-size: 22px 100%, 100% 100%;
  box-shadow:
    0 28px 68px rgba(66, 61, 35, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.collection-book-header {
  text-align: center;
}

.collection-book-header h2 {
  margin: 0;
  color: var(--moss-deep);
  font-size: clamp(24px, 6.4vw, 32px);
  line-height: 1.08;
}

.collection-book-header span {
  display: inline-block;
  margin-top: 8px;
  color: rgba(24, 54, 39, 0.68);
  font-size: 12px;
  font-weight: 900;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.album-slot {
  min-height: 138px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  border: 1px solid rgba(49, 91, 61, 0.16);
  border-radius: 12px;
  padding: 10px 8px;
  background: rgba(255, 250, 235, 0.58);
  text-align: center;
}

.album-slot.is-unlocked {
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 222, 111, 0.3), transparent 48%),
    rgba(255, 250, 235, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.album-slot.is-locked {
  border-style: dashed;
  color: rgba(24, 54, 39, 0.48);
}

.album-baby-image {
  width: auto;
  max-width: 70px;
  height: 70px;
  object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(67, 58, 34, 0.16));
}

.album-slot strong {
  color: var(--moss-deep);
  font-size: 12px;
  line-height: 1.2;
}

.album-slot span {
  color: rgba(24, 54, 39, 0.64);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.28;
}

.album-back-action {
  width: min(220px, 100%);
  margin: 18px auto 0;
  display: block;
}

.missing-panel {
  position: absolute;
  z-index: 20;
  left: 18px;
  right: 18px;
  bottom: 72px;
  display: none;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 235, 0.92);
  box-shadow: 0 18px 50px rgba(70, 58, 38, 0.16);
  backdrop-filter: blur(18px);
}

.missing-panel.is-visible {
  display: grid;
  gap: 12px;
}

.panel-kicker {
  margin: 0;
  color: #b88317;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.missing-panel h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.16;
  letter-spacing: 0;
}

.panel-copy {
  margin: 0;
  color: rgba(36, 49, 37, 0.72);
  font-size: 13px;
  line-height: 1.62;
}

.missing-panel code {
  color: var(--moss-deep);
  font-weight: 800;
}

#missingList {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#missingList li {
  border: 1px solid rgba(49, 91, 61, 0.18);
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.48);
  color: #6d4e1f;
  font-size: 12px;
  font-weight: 800;
}

.interaction-hint {
  display: none;
}

.has-missing-assets .interaction-hint {
  display: none;
}

@keyframes rewardBabyBreath {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-5px) scale(1.015);
  }
}

@keyframes scanLinePulse {
  0%,
  100% {
    opacity: 0.24;
    transform: translateY(-50%) scaleX(0.72);
  }

  50% {
    opacity: 0.9;
    transform: translateY(-50%) scaleX(1);
  }
}

@media (max-width: 390px) {
  .page-shell {
    padding: 0;
  }

  .phone-stage {
    width: 100vw;
    max-height: none;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
  }

  .brand-bar {
    padding-inline: 14px;
    font-size: 8px;
  }

  .brand-mark,
  .brand-status {
    padding: 7px 8px;
    white-space: nowrap;
  }

  .scene-copy {
    width: min(90%, 330px);
    margin-top: 28px;
  }

  .dino-layer {
    top: 20.8%;
    width: 96%;
  }

  .egg-button {
    bottom: 5.8%;
    width: 27%;
  }

  .home-action {
    left: 18px;
    right: 18px;
    bottom: 18px;
  }

  .screen-reward {
    padding: 16px;
  }

  .reward-copy {
    width: min(90%, 330px);
    margin-top: 24px;
  }

  .reward-card {
    width: min(92%, 342px);
  }

  .reward-baby-slot {
    min-height: 172px;
  }

  .collection-card {
    grid-template-columns: minmax(104px, 39%) 1fr;
  }

  .reward-actions {
    grid-template-columns: 1fr;
    border-radius: 18px;
  }

  .panel-copy,
  #missingList li,
  .reward-missing p {
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dino-frame,
  .egg,
  .glow {
    transition-duration: 1ms;
  }

  .gold-baby,
  .scan-line {
    animation: none;
  }
}
