@font-face {
  font-family: "Pocket";
  src: url("./assets/fonts/ipster.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+0000-00D5,
    U+00D7-00F5,
    U+00F7-024F,
    U+1E00-1EFF;
}

@font-face {
  font-family: "Pocket";
  src: url("./assets/fonts/pixel-square.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+00D6,
    U+00F6;
}

:root {
  --paper: #fffaf3;
  --ink: #56426e;
  --violet: #71598f;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

img,
button,
a {
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  max-width: 100%;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

body {
  color: var(--ink);
  font-family: "Pocket", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  position: relative;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(255, 250, 243, 0.72), rgba(255, 250, 243, 0.72)),
    url("./assets/ui/background.png");
  background-repeat: repeat;
  background-size: 1080px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  position: relative;
  margin: 0 auto;
  min-height: 100vh;
  width: min(100%, 560px);
  max-width: 560px;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  overflow-x: hidden;
  overflow-x: clip;
}

.top-controls {
  position: fixed;
  right: 16px;
  top: 16px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-link {
  display: inline-flex;
  height: 40px;
  width: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #e6d3f2;
  background: rgba(255, 247, 255, 0.96);
  color: var(--violet);
  box-shadow: 0 4px 10px rgba(107, 83, 131, 0.18);
  transition: transform 0.15s ease;
  text-decoration: none;
}

.home-link:hover,
.lang-switch:hover,
.star-home:hover,
.submit-btn:hover {
  transform: translateY(-2px);
}

.home-link svg {
  width: 18px;
  height: 18px;
}

.lang-switch {
  position: relative;
  display: inline-flex;
  height: 40px;
  width: 84px;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #e6d3f2;
  background: rgba(255, 247, 255, 0.96);
  padding: 0 8px;
  font-size: 12px;
  color: var(--violet);
  box-shadow: 0 4px 10px rgba(107, 83, 131, 0.18);
  transition: transform 0.15s ease;
  cursor: pointer;
}

.lang-labels {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

.lang-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  height: 32px;
  width: 36px;
  border-radius: 999px;
  background: #f7ebff;
  box-shadow: 0 2px 6px rgba(115, 88, 145, 0.25);
  transition: transform 0.2s ease;
}

.lang-switch[data-locale="en"] .lang-knob {
  transform: translateX(36px);
}

.hero {
  margin-bottom: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.star-home {
  margin: 0 auto;
  display: inline-flex;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.star-home img {
  width: 34px;
  height: auto;
}

.banner {
  margin: 16px auto 0;
  width: 300px;
  max-width: 100%;
  height: auto;
  cursor: pointer;
}

.subtitle {
  margin: 24px 0 0;
  font-size: 15px;
  line-height: 1.15;
  color: #6e5d82;
}

.stage {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow-x: clip;
}

.stage-box {
  transform: translateY(-56px);
}

.stage-gift {
  transform: translateY(-8px);
}

.box-view {
  text-align: center;
}

.gift-box-btn {
  position: relative;
  display: inline-flex;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.gift-box-btn:active {
  transform: scale(0.98);
}

.gift-box-img {
  width: 200px;
  height: auto;
}

.gift-box-btn.hovered .gift-box-img {
  animation: boxWobble 0.6s linear infinite;
}

.box-question {
  pointer-events: none;
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #fff6ff;
  padding: 2px 10px;
  font-size: 20px;
  line-height: 1;
  font-family: inherit;
  color: #71588f;
  box-shadow: 0 2px 8px rgba(120, 97, 146, 0.18);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.gift-box-btn.hovered .box-question {
  opacity: 1;
}

.box-caption {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.1;
  color: #6f5b85;
}

.gift-card {
  width: 100%;
  max-width: 430px;
  min-height: 560px;
  text-align: center;
  overflow-x: hidden;
  overflow-x: clip;
}

.gift-name {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: #59486d;
  font-style: italic;
  word-break: break-word;
}

.star-tiny {
  display: block;
  width: 14px;
  height: auto;
  margin: 4px auto;
}

.gift-meta {
  min-height: 54px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  line-height: 1.35;
  color: #59486d;
}

.gift-meta p {
  margin: 0;
  white-space: pre-line;
  word-break: break-word;
}

.gift-image-wrap {
  position: relative;
  margin: 0 auto;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.gift-image-wrap.tap-ready {
  cursor: pointer;
}

.image-size-charm {
  height: 190px;
  max-width: 205px;
  margin: 20px auto;
}

.image-size-bird {
  height: 170px;
  max-width: 170px;
  margin: 12px auto;
}

.image-size-lemon {
  height: 190px;
  max-width: 205px;
  margin: 16px auto;
}

.image-size-moss {
  height: 188px;
  max-width: 210px;
  margin: 12px auto;
}

.image-size-default {
  height: 208px;
  max-width: 232px;
  margin: 12px auto;
}

.gift-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gift-image.interactive {
  animation: interactive-gift-float 1.9s ease-in-out infinite;
}

.gift-image-wrap.shake {
  animation: charmShake 0.4s ease-out;
}

.gift-image-wrap.bird-flying-mobile {
  animation: birdFlyMobile 3.2s linear forwards;
}

.gift-image-wrap.bird-flying-desktop {
  animation: birdFlyDesktop 6.2s linear forwards;
}

.fallback-path {
  margin: 0;
  padding: 0 8px;
  text-align: center;
  font-size: 12px;
  color: #8f7da5;
}

.interaction {
  position: relative;
  margin-top: 0;
}

.interaction-result {
  min-height: 72px;
}

.interaction-result.hidden {
  height: 0;
  overflow: hidden;
  min-height: 0;
}

.interaction-text,
.interaction-instruction {
  margin: 0;
  padding: 0 8px;
  text-align: center;
  font-size: 15px;
  line-height: 1.25;
  color: #59486d;
  white-space: pre-line;
  word-break: break-word;
}

.interaction-instruction {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  color: #624f77;
}

.interaction-text.strong-last span:last-child {
  font-weight: 600;
}

.interaction-label,
.interaction-strong {
  display: block;
}

.interaction-strong {
  font-weight: 700;
}

.result-gap {
  display: block;
  height: 10px;
}

.bird-form {
  margin-top: 0;
}

.bird-prompt {
  margin: 0;
  padding: 0 4px;
  text-align: left;
  font-size: 15px;
  line-height: 1.2;
  color: #624f77;
}

.form-gap {
  height: 10px;
}

.bird-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bird-input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid #e9dcee;
  background: #fff;
  padding: 8px 12px;
  font-size: 15px;
  line-height: 1.2;
  color: #5e4c73;
  outline: none;
  font-family: inherit;
}

.submit-btn {
  display: inline-flex;
  height: 32px;
  width: 32px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #e4d3ea;
  background: #fff8ff;
  font-size: 14px;
  line-height: 1;
  color: #6d5983;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.bird-empty-slot {
  height: 40px;
}

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

.hidden {
  display: none !important;
}

.rain-drop {
  position: absolute;
  top: -24px;
  border-radius: 999px;
  background: linear-gradient(to bottom, rgba(162, 198, 255, 0), rgba(144, 183, 255, 0.9));
  animation: rain-fall linear infinite;
}

.moss-follower {
  position: fixed;
  z-index: 120;
  pointer-events: none;
}

.moss-follower img {
  width: 74px;
  height: auto;
}

.moss-follower.mobile-center {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.moss-follower.mobile-center img {
  width: 134px;
}

@keyframes rain-fall {
  0% {
    transform: translateY(-24px);
    opacity: 0;
  }

  12% {
    opacity: 1;
  }

  100% {
    transform: translateY(110vh);
    opacity: 0;
  }
}

@keyframes interactive-gift-float {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }

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

@keyframes charmShake {
  0% { transform: translateX(0) rotate(0deg); }
  16% { transform: translateX(-4px) rotate(-3deg); }
  33% { transform: translateX(4px) rotate(3deg); }
  50% { transform: translateX(-2px) rotate(-1deg); }
  66% { transform: translateX(2px) rotate(1deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

@keyframes boxWobble {
  0% { transform: rotate(0deg) translateY(0); }
  20% { transform: rotate(-2deg) translateY(-2px); }
  40% { transform: rotate(2deg) translateY(0); }
  60% { transform: rotate(-1deg) translateY(0); }
  80% { transform: rotate(1deg) translateY(-1px); }
  100% { transform: rotate(0deg) translateY(0); }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes birdFlyDesktop {
  from {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  to {
    transform: translate(-5200px, -24px) scale(0.98) rotate(-5deg);
  }
}

@keyframes birdFlyMobile {
  from {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  to {
    transform: translate(-2400px, -240px) scale(0.94) rotate(-10deg);
  }
}

@media (min-width: 640px) {
  .app-shell {
    overflow-x: visible;
    padding-top: 32px;
    padding-bottom: 32px;
  }

  .banner {
    width: 360px;
  }

  .gift-box-img {
    width: 215px;
  }

  .gift-card {
    overflow-x: visible;
  }
}

@media (max-width: 639px) {
  .app-shell {
    max-width: 420px;
    padding: 20px 12px 28px;
  }

  .gift-card {
    max-width: min(92vw, 400px);
    contain: layout paint;
  }

  .top-controls {
    right: 10px;
    top: 10px;
  }
}
