:root {
  --bg-top: #fff8ef;
  --bg-mid: #ffe9db;
  --bg-bottom: #d8f1df;
  --mint: #98d7b5;
  --mint-deep: #5eb48a;
  --peach: #f8bf9b;
  --sky: #8dcdf3;
  --butter: #ffe497;
  --cream: #fffaf1;
  --ink: #5f5a66;
  --ink-soft: rgba(95, 90, 102, 0.72);
  --shadow: 0 18px 40px rgba(139, 116, 99, 0.14);
  --panel: rgba(255, 250, 241, 0.86);
  --cell-size: min(14vw, 58px);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Nunito", sans-serif;
  color: var(--ink);
  touch-action: none;
}

body {
  overflow: hidden;
}

button {
  font: inherit;
}

.sky {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.85), transparent 34%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 48%, var(--bg-bottom) 100%);
}

.hill {
  position: absolute;
  inset-inline: -8%;
  border-radius: 50%;
  filter: blur(2px);
}

.hill-back {
  bottom: 18%;
  height: 26vh;
  background: rgba(181, 233, 205, 0.7);
}

.hill-front {
  bottom: -12%;
  height: 24vh;
  background: rgba(152, 215, 181, 0.88);
}

.petal {
  position: absolute;
  width: 18px;
  height: 12px;
  border-radius: 60% 40% 60% 40%;
  opacity: 0.7;
  background: rgba(255, 255, 255, 0.8);
  animation: drift 12s linear infinite;
}

.petal::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(248, 191, 155, 0.75);
}

.petal-a {
  top: 12%;
  left: 8%;
  animation-delay: -2s;
}

.petal-b {
  top: 20%;
  right: 12%;
  animation-duration: 14s;
}

.petal-c {
  top: 38%;
  left: 72%;
  animation-duration: 16s;
  animation-delay: -6s;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.72;
  mix-blend-mode: screen;
  animation: orbFloat 11s ease-in-out infinite;
}

.orb-a {
  top: 8%;
  right: 12%;
  width: 86px;
  height: 86px;
  background: radial-gradient(circle, rgba(141, 205, 243, 0.55), rgba(141, 205, 243, 0));
}

.orb-b {
  bottom: 22%;
  left: 6%;
  width: 108px;
  height: 108px;
  background: radial-gradient(circle, rgba(248, 191, 155, 0.5), rgba(248, 191, 155, 0));
  animation-delay: -4s;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 12px;
  padding: 16px 14px 22px;
}

.topbar,
.hud,
.board-panel,
.tray-panel,
.cta-strip {
  width: min(100%, 460px);
  margin: 0 auto;
}

.topbar,
.hud,
.board-panel,
.tray-panel {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
}

.topbar,
.board-panel,
.tray-panel {
  border-radius: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
}

.header-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.install-chip {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #89cfac, #5eb48a);
  box-shadow: 0 10px 20px rgba(94, 180, 138, 0.22);
}

.eyebrow {
  margin: 0 0 3px;
  font-family: "Baloo 2", sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  color: var(--mint-deep);
}

h1,
h2,
.panel-title {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
}

h1 {
  font-size: 2rem;
  line-height: 0.92;
}

.header-note {
  margin: 6px 0 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  max-width: 220px;
}

.icon-button {
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 0 0 1px rgba(95, 90, 102, 0.08);
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: 22px;
}

.stat-card {
  padding: 11px 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.64);
  border-radius: 18px;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.1rem;
}

.timer-card.alert {
  animation: pulse 0.9s ease-in-out infinite;
}

.board-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
}

.panel-copy {
  display: grid;
  gap: 4px;
}

.panel-title {
  font-size: 1.18rem;
}

.panel-subtitle {
  margin: 0;
  color: var(--ink-soft);
  min-height: 22px;
}

.goal-strip {
  display: grid;
  gap: 8px;
}

.goal-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.goal-label {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.goal-meter {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 0 0 1px rgba(95, 90, 102, 0.08);
}

.goal-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f7c57d, #f49c7a, #80d7bb);
  transition: width 0.26s ease;
}

.combo-badge {
  justify-self: start;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #ef9f85, #e38166);
  box-shadow: 0 10px 20px rgba(227, 129, 102, 0.24);
  animation: badgeIn 0.28s ease;
}

.combo-badge.hidden {
  display: none;
}

.board-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.board {
  display: grid;
  grid-template-columns: repeat(5, var(--cell-size));
  grid-template-rows: repeat(5, var(--cell-size));
  gap: 7px;
  padding: 12px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.58), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.38)),
    rgba(236, 249, 240, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.75),
    0 14px 28px rgba(133, 118, 109, 0.08);
  transform: translateY(-1px);
}

.cell {
  position: relative;
  width: var(--cell-size);
  height: var(--cell-size);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.5)),
    rgba(255, 255, 255, 0.62);
  box-shadow:
    inset 0 0 0 1px rgba(152, 215, 181, 0.22),
    inset 0 -10px 18px rgba(255, 255, 255, 0.18);
  transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.cell.filled {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.18));
}

.cell.can-drop {
  background: rgba(255, 228, 151, 0.68);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.92),
    0 0 0 5px rgba(255, 228, 151, 0.24);
}

.cell.tutorial-target {
  animation: softGlow 1.1s ease-in-out infinite alternate;
  background: rgba(255, 236, 176, 0.84);
}

.cell.clear-flash {
  animation: clearFlash 0.45s ease;
}

.tile-bunny {
  --piece-color: #8dcdf3;
}

.tile-kitten {
  --piece-color: #f8bf9b;
}

.tile-panda {
  --piece-color: #98d7b5;
}

.tile-chick {
  --piece-color: #ffe497;
}

.piece-fragment {
  position: absolute;
  inset: 6px;
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), var(--piece-color));
  box-shadow:
    inset 0 -5px 10px rgba(255, 255, 255, 0.45),
    0 7px 16px rgba(125, 123, 140, 0.12);
}

.piece-fragment::before {
  content: attr(data-face);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(18px, 4.6vw, 26px);
}

.tray-panel {
  padding: 14px;
}

.tray-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.tray-copy p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.tray {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 104px;
}

.piece-card {
  position: relative;
  flex: 1;
  min-height: 104px;
  padding: 8px;
  border: none;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 247, 240, 0.76));
  box-shadow:
    inset 0 0 0 1px rgba(95, 90, 102, 0.06),
    0 10px 22px rgba(133, 118, 109, 0.08);
  overflow: hidden;
  transform: translateZ(0);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.piece-card::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto;
  height: 70%;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.58), transparent 65%);
  opacity: 0.85;
  pointer-events: none;
}

.piece-card:active {
  transform: scale(0.97);
}

.piece-card.glow {
  animation: softGlow 1.1s ease-in-out infinite alternate;
}

.piece-card.hidden-card {
  visibility: hidden;
}

.piece-grid {
  position: relative;
  width: 100%;
  height: 100%;
}

.piece-name {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  z-index: 1;
}

.drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 20;
  width: 86px;
  height: 86px;
  opacity: 0.92;
  filter: drop-shadow(0 16px 18px rgba(109, 94, 86, 0.18));
}

.drag-ghost.hidden {
  display: none;
}

.drag-ghost .piece-grid {
  width: 100%;
  height: 100%;
}

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

.burst-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, rgba(255, 255, 255, 0.25));
  opacity: 0;
  animation: burstFloat 0.9s ease-out forwards;
}

.cta-strip {
  display: grid;
}

.reward-panel {
  width: min(100%, 460px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 24px;
  color: var(--ink);
  backdrop-filter: blur(14px);
  background: linear-gradient(135deg, rgba(255, 248, 225, 0.92), rgba(232, 252, 241, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
  animation: panelLift 0.35s ease;
}

.reward-panel.hidden {
  display: none;
}

.reward-copy {
  display: grid;
  gap: 2px;
}

.reward-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mint-deep);
}

.reward-copy p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.cta-button {
  border: none;
  border-radius: 999px;
  padding: 15px 18px;
  font-size: 1.02rem;
  font-weight: 800;
  color: white;
  background: linear-gradient(180deg, #65c392, var(--mint-deep));
  box-shadow:
    0 12px 24px rgba(74, 166, 119, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  position: relative;
  overflow: hidden;
}

.cta-button.mini {
  padding: 12px 14px;
  font-size: 0.9rem;
}

.cta-button.secondary {
  background: linear-gradient(180deg, #f8d28f, #f4a65a);
  box-shadow:
    0 12px 24px rgba(244, 166, 90, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  animation: pulseCta 1.6s ease-in-out infinite;
}

.cta-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 25%, rgba(255, 255, 255, 0.22) 45%, transparent 65%);
  transform: translateX(-120%);
}

.cta-button.secondary::after {
  animation: shimmer 3.8s ease-in-out infinite;
}

.cta-button.ghost {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 250, 243, 0.84));
  box-shadow: none;
}

.end-card {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 251, 238, 0.72), rgba(95, 90, 102, 0.3) 72%),
    rgba(95, 90, 102, 0.18);
  backdrop-filter: blur(10px);
}

.end-card.hidden {
  display: none;
}

.end-card-inner {
  width: min(100%, 380px);
  padding: 22px 18px 18px;
  text-align: center;
  border-radius: 30px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.88), transparent 48%),
    linear-gradient(180deg, rgba(255, 250, 241, 0.99), rgba(255, 242, 233, 0.96));
  box-shadow:
    0 24px 60px rgba(95, 90, 102, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.58);
  position: relative;
  overflow: hidden;
}

.end-card-inner::before {
  content: "";
  position: absolute;
  inset: -30% auto auto -20%;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 228, 151, 0.32), transparent 68%);
  pointer-events: none;
}

.end-card-inner h2 {
  font-size: 2rem;
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

.preview-frame {
  position: relative;
  width: 100%;
  height: 126px;
  margin: 0 0 14px;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, #c8ebf8, #ecf8de 72%, #d0eec9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.52);
}

.preview-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.96), transparent 16%),
    radial-gradient(circle at 14% 24%, rgba(255, 255, 255, 0.26), transparent 20%),
    radial-gradient(circle at 82% 20%, rgba(255, 228, 151, 0.24), transparent 20%);
}

.preview-board {
  position: absolute;
  left: 50%;
  bottom: 14px;
  display: grid;
  grid-template-columns: repeat(3, 18px);
  gap: 5px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(255, 250, 241, 0.72);
  transform: translateX(-50%);
  box-shadow: 0 10px 20px rgba(90, 112, 84, 0.14);
}

.preview-board span {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(125, 168, 132, 0.18);
}

.preview-board .lit {
  background: linear-gradient(180deg, #f7c57d, #f4a65a);
}

.end-summary {
  margin: 10px 0 14px;
  color: var(--ink-soft);
  position: relative;
  z-index: 1;
}

.store-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin: 0 0 12px;
  text-align: left;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 250, 244, 0.72));
  box-shadow: inset 0 0 0 1px rgba(95, 90, 102, 0.06);
}

.store-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  font-size: 1.7rem;
  background: linear-gradient(180deg, #f8cda9, #f4a671);
}

.store-copy {
  display: grid;
}

.store-copy strong {
  font-size: 1rem;
}

.store-copy span {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.store-bullets {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 14px;
}

.feature-pills span {
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
}

.end-actions {
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

@keyframes drift {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(26px, 18px, 0) rotate(16deg);
  }
  100% {
    transform: translate3d(-18px, 34px, 0) rotate(34deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes softGlow {
  from {
    box-shadow:
      inset 0 0 0 1px rgba(95, 90, 102, 0.06),
      0 0 0 0 rgba(244, 166, 90, 0.18);
  }
  to {
    box-shadow:
      inset 0 0 0 1px rgba(95, 90, 102, 0.06),
      0 0 0 9px rgba(244, 166, 90, 0.18);
  }
}

@keyframes clearFlash {
  0% {
    transform: scale(1);
    background: rgba(255, 255, 255, 0.62);
  }
  40% {
    transform: scale(1.07);
    background: rgba(255, 255, 255, 0.98);
  }
  100% {
    transform: scale(1);
    background: rgba(255, 255, 255, 0.62);
  }
}

@keyframes badgeIn {
  from {
    transform: translateY(6px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes burstFloat {
  0% {
    transform: translate3d(0, 0, 0) scale(0.5);
    opacity: 0;
  }
  25% {
    opacity: 0.9;
  }
  100% {
    transform: translate3d(var(--burst-x), var(--burst-y), 0) scale(1.2);
    opacity: 0;
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-120%);
  }
  45%,
  100% {
    transform: translateX(120%);
  }
}

@keyframes floatGlow {
  from {
    transform: translate3d(0, 0, 0) scale(0.98);
  }
  to {
    transform: translate3d(0, -12px, 0) scale(1.03);
  }
}

@keyframes orbFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -10px, 0) scale(1.05);
  }
}

@keyframes pulseCta {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

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

@media (min-width: 700px) {
  :root {
    --cell-size: 62px;
  }

  .app-shell {
    padding-top: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .sky::after {
    opacity: 0.06;
  }
}
