:root {
  --background: #fbf8f4;
  --foreground: #392618;
  --card: #ffffff;
  --primary: #f66c31;
  --primary-soft: #fdf1ec;
  --muted: #978272;
  --accent: #f4f0eb;
  --border: #ece7df;
  --success-bg: #dff6e8;
  --success-border: #9bd8b3;
  --success-text: #22683a;
  --try-bg: #fbefd9;
  --try-border: #e9d4ac;
  --try-text: #6c4b27;
  font-family: "LarkEmojiFont", "PingFang SC", "Microsoft Yahei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--foreground);
  background:
    radial-gradient(circle at 10% 10%, rgba(246, 108, 49, 0.09), transparent 24rem),
    radial-gradient(circle at 90% 22%, rgba(60, 167, 221, 0.08), transparent 20rem),
    var(--background);
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 18px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 58px;
  margin: 0 -18px 10px;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.back {
  position: absolute;
  left: 14px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.back:active {
  transform: scale(0.92);
}

.topbar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 34px 10px 38px;
  text-align: center;
  border-radius: 28px;
  background: radial-gradient(ellipse at center, hsl(35 60% 95%) 0%, hsl(35 50% 97%) 72%);
}

.float {
  position: absolute;
  opacity: 0.13;
  user-select: none;
  pointer-events: none;
  animation: popIn 700ms ease both;
}

.gift {
  display: block;
  font-size: clamp(88px, 25vw, 118px);
  line-height: 1;
  animation: bob 2.8s ease-in-out infinite;
}

.hero h2 {
  margin: 18px 0 8px;
  font-size: clamp(25px, 7vw, 32px);
  line-height: 1.15;
  font-weight: 950;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}

.modes {
  display: grid;
  gap: 16px;
  margin: 24px 0;
}

.mode-card {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 140px;
  gap: 20px;
  padding: 24px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.mode-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--start), var(--end));
}

.mode-card::after {
  content: attr(data-emoji);
  position: absolute;
  top: 12px;
  right: 24px;
  font-size: 110px;
  opacity: 0.035;
}

.mode-card:active {
  transform: scale(0.97) translateY(2px);
}

@media (hover: hover) {
  .mode-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(246, 108, 49, 0.45);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.09);
  }
}

.mode-emoji {
  flex: 0 0 auto;
  font-size: 68px;
  line-height: 1;
}

.mode-text {
  min-width: 0;
  flex: 1;
}

.mode-title {
  display: block;
  font-size: 26px;
  font-weight: 950;
}

.mode-desc {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.mode-arrow {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 48px;
  height: 48px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 28px;
  font-weight: 900;
  animation: nudge 1.5s ease-in-out infinite;
}

.preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 4px 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.preview-title::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 99px;
  background: var(--primary);
}

.word-track {
  overflow: hidden;
  padding: 12px 0;
  border-radius: 22px;
  background: rgba(244, 240, 235, 0.65);
  mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
}

.word-row {
  display: flex;
  width: max-content;
  gap: 12px;
  padding: 0 14px;
  animation: wordScroll 18s linear infinite;
}

.word-row:hover {
  animation-play-state: paused;
}

.word-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px solid hsl(35 25% 90%);
  border-radius: 20px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.word-chip:active {
  transform: scale(0.95);
}

.word-chip span:first-child {
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.word-chip span:last-child {
  font-size: 12px;
  font-weight: 900;
}

.learn-card {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 340px;
  padding: 30px;
  overflow: hidden;
  text-align: center;
  background: rgba(244, 240, 235, 0.72);
  border: 2px solid var(--border);
  border-radius: 28px;
  cursor: pointer;
}

.learn-card.switching {
  animation: slideIn 260ms ease;
}

.big-emoji {
  font-size: 88px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.word-main {
  margin-top: 10px;
  font-size: clamp(46px, 13vw, 58px);
  line-height: 1;
  font-weight: 950;
}

.word-cn {
  margin-top: 12px;
  color: var(--muted);
  font-size: 22px;
  font-weight: 700;
}

.sound-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 8px 16px;
  color: var(--primary);
  background: rgba(246, 108, 49, 0.1);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  margin: 24px 0 20px;
}

.round-btn {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  color: var(--primary);
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.round-btn:active {
  transform: translateY(2px) scale(0.88);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.08);
}

.count {
  min-width: 56px;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
  font-weight: 900;
}

.dots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.dot {
  width: 10px;
  height: 10px;
  padding: 0;
  background: hsl(35 25% 90%);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: width 170ms ease, background 170ms ease, transform 170ms ease;
}

.dot.active {
  width: 14px;
  background: var(--primary);
}

.score {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-weight: 950;
}

.question {
  display: grid;
  place-items: center;
  min-height: 60px;
  text-align: center;
  font-size: clamp(22px, 6vw, 26px);
  line-height: 1.25;
  font-weight: 950;
}

.box-area {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 220px;
}

.box-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: none;
  border: 0;
  cursor: pointer;
  animation: bobSmall 2.4s ease-in-out infinite;
}

.box-button.open {
  animation: none;
}

.box-emoji {
  font-size: clamp(100px, 30vw, 120px);
  line-height: 1;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.12));
}

.open-word {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -18px;
  animation: pop 350ms cubic-bezier(.2, .9, .2, 1.2);
}

.open-word .revealed-emoji {
  font-size: clamp(76px, 22vw, 92px);
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.14));
}

.open-word strong {
  margin-top: 6px;
  font-size: 28px;
  font-weight: 950;
}

.open-word small {
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-height: 120px;
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 10px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 8px 17px rgba(0, 0, 0, 0.07);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.choice:active {
  transform: translateY(2px) scale(0.92);
}

.choice .emoji {
  font-size: clamp(54px, 16vw, 70px);
  line-height: 1;
}

.choice strong {
  font-size: clamp(18px, 5vw, 21px);
  line-height: 1.05;
  font-weight: 950;
}

.choice small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.feedback {
  min-height: 120px;
}

.message {
  width: 100%;
  padding: 20px;
  text-align: center;
  border: 2px solid;
  border-radius: 22px;
  animation: pop 320ms cubic-bezier(.2, .9, .2, 1.2);
}

.message.success {
  color: var(--success-text);
  background: var(--success-bg);
  border-color: var(--success-border);
}

.message.try {
  color: var(--try-text);
  background: var(--try-bg);
  border-color: var(--try-border);
  animation: shake 480ms ease, pop 320ms cubic-bezier(.2, .9, .2, 1.2);
}

.message h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 950;
}

.message p,
.picked {
  margin: 8px 0 0;
  font-size: 16px;
  font-weight: 800;
}

.picked {
  text-align: center;
  color: var(--muted);
}

.burst {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.spark {
  position: absolute;
  left: 50%;
  top: 50%;
  animation: spark 1.35s ease-out forwards;
}

.hidden {
  display: none;
}

@keyframes wordScroll {
  to {
    transform: translateX(-50%);
  }
}

@keyframes bob {
  50% {
    transform: translateY(-14px);
  }
}

@keyframes bobSmall {
  50% {
    transform: translateY(-12px);
  }
}

@keyframes nudge {
  50% {
    transform: translateX(5px);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.72);
  }
}

@keyframes slideIn {
  from {
    opacity: 0.4;
    transform: translateX(40px) scale(0.96);
  }
}

@keyframes shake {
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

@keyframes spark {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(0) rotate(0deg);
  }
  55% {
    opacity: 1;
    transform: translate(var(--x), var(--y)) scale(1.2) rotate(var(--r));
  }
  100% {
    opacity: 0;
    transform: translate(var(--x), var(--y)) scale(0.8) rotate(var(--r));
  }
}

@media (max-width: 360px) {
  .shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .mode-card {
    gap: 14px;
    padding: 20px;
  }

  .mode-emoji {
    font-size: 58px;
  }

  .mode-arrow {
    width: 40px;
    height: 40px;
  }
}
