/* Petlings: every surface borrows from the game art: bright colour, a dark-brown outline, a hard lip shadow. */
:root {
  --sky: #62bdf0;
  --meadow: #4f9a2e;
  --gold: #ffd23f;
  --ink: #3b1d0c;
  --ink-soft: #6b4a33;
  --cream: #fff4dc;
  --paper: #fffaf0;
  --shade: #b9a58c;
  --night: #15216a;
  --display: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  --body: "M PLUS Rounded 1c", "Trebuchet MS", sans-serif;
  --line: 3px solid var(--ink);
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 500 1.0625rem/1.55 var(--body);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

body > main { flex: 1; }

img { max-width: 100%; height: auto; display: block; }

[hidden] { display: none !important; }

a { color: inherit; }

p { margin: 0 0 1rem; text-wrap: pretty; }

h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; }

h2 {
  font-size: clamp(2.2rem, 1.4rem + 2.8vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: 0.005em;
  margin-bottom: 0.9rem;
  text-wrap: balance;
}

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  background: var(--gold);
  font-weight: 800;
}

.skip:focus { top: 1rem; }

/* Buttons: the game's gold button, outline and lip. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.6rem;
  border: var(--line);
  border-radius: 18px;
  background: var(--gold);
  box-shadow: 0 5px 0 var(--ink);
  color: var(--ink);
  font: 800 1.1rem/1.2 var(--body);
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn[href], button.btn { cursor: pointer; }
.btn[href]:hover, button.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.btn[href]:active, button.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }

.btn-small {
  padding: 0.45rem 1rem;
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
  font-size: 0.95rem;
}

/* Header floats over the first scene of each page. */
.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 18px var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 1.65rem/1 var(--display);
  text-decoration: none;
}

.brand img { width: 40px; height: 40px; }

.site-header .brand + * { margin-left: auto; }

.site-nav { display: flex; gap: 24px; }

.site-nav a {
  font-weight: 800;
  text-decoration: none;
  text-underline-offset: 5px;
  text-decoration-thickness: 3px;
}

.site-nav a:hover { text-decoration-line: underline; }

/* Painted backdrops fill their section. */
.scene { position: absolute; inset: 0; z-index: -1; }
.scene img { width: 100%; height: 100%; object-fit: cover; }

/* Hero: the farm, and a merge you can do right here. */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: max(100svh, 720px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: clamp(76px, 10vh, 104px);
}

.hero-copy {
  width: 100%;
  max-width: 38rem;
  padding: 0 var(--gutter);
  text-align: center;
}

.wordmark { width: min(440px, 76vw, 50vh); margin: 0 auto; }

.lede {
  max-width: 34rem;
  margin: 0.3rem auto 1.2rem;
  font-weight: 800;
  font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem);
  line-height: 1.4;
  text-wrap: balance;
}

.play {
  width: 100%;
  max-width: 820px;
  margin-top: auto;
  padding: 16px var(--gutter) clamp(18px, 3vh, 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hint {
  order: 1;
  margin: 14px 0 0;
  padding: 0.35rem 1rem;
  border: var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 800;
  font-size: 0.98rem;
  text-align: center;
  text-wrap: balance;
}

.field {
  --base: clamp(100px, min(13vw, 19vh), 168px);
  --size: calc(var(--base) * var(--grow, 1));
  position: relative;
  width: 100%;
  height: calc(var(--base) * 1.27 + 36px);
}

.pet {
  position: absolute;
  left: var(--x);
  bottom: 0;
  width: var(--size);
  height: var(--size);
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transform: translate(calc(-50% + var(--dx, 0px)), var(--dy, 0px));
}

/* A soft shadow on the grass under each pet. */
.pet::before {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 2%;
  height: 12%;
  border-radius: 50%;
  background: rgba(40, 70, 10, 0.28);
}

.pet img {
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform-origin: 50% 92%;
  animation: breathe 2.6s ease-in-out infinite;
}

.pet + .pet img { animation-delay: -1.3s; }

@keyframes breathe {
  50% { transform: scale(1.03, 0.97); }
}

.pet.is-dragging { z-index: 3; cursor: grabbing; }
.pet.is-dragging img { animation: none; transform: scale(1.1); }
.pet.is-target img { filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 18px var(--gold)); }
.pet.is-settling { transition: transform 0.3s cubic-bezier(0.3, 1.5, 0.5, 1); }
.pet.is-gliding { transition: transform 0.38s ease-in; }
.pet.is-gone { visibility: hidden; }
.pet.is-egg img { animation: none; transform: scale(0.62); }
.pet:disabled { cursor: default; }

.hand {
  position: absolute;
  z-index: 4;
  left: 30%;
  bottom: calc(var(--size) * 0.42 - 80px);
  width: 64px;
  pointer-events: none;
  animation: guide 2.6s ease-in-out infinite;
}

@keyframes guide {
  0% { left: 30%; opacity: 0; transform: translate(-25%, 12px); }
  12% { left: 30%; opacity: 1; transform: translate(-25%, 0) scale(0.9); }
  68% { left: 70%; opacity: 1; transform: translate(-25%, 0) scale(0.9); }
  84%, 100% { left: 70%; opacity: 0; transform: translate(-25%, 0); }
}

.card {
  position: absolute;
  z-index: 4;
  left: var(--at, 70%);
  bottom: calc(var(--size) + 14px);
  min-width: 9.5rem;
  padding: 0.45rem 1.1rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 5px 0 var(--ink);
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
}

.card.is-new { animation: pop 0.4s ease-out; }

.card-kicker {
  padding: 0.05rem 0.65rem;
  border-radius: 999px;
  background: var(--meadow);
  color: #fff;
  font-weight: 800;
  font-size: 0.78rem;
}

.card strong { font: 1.55rem/1.15 var(--display); margin-top: 0.15rem; }
.card span:last-child { font-weight: 800; font-size: 0.9rem; color: var(--ink-soft); }

@keyframes pop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.6); }
  60% { opacity: 1; transform: translateX(-50%) scale(1.06); }
  100% { transform: translateX(-50%) scale(1); }
}

.again {
  position: absolute;
  left: var(--x, 30%);
  bottom: calc(var(--base) * 0.4);
  transform: translateX(-50%);
}

.again:hover { transform: translate(-50%, -2px); }
.again:active { transform: translate(-50%, 3px); }

/* Merge burst: a glow, a ring, and the game's own sparkles. */
.burst { position: absolute; z-index: 2; width: 0; height: 0; pointer-events: none; }

.burst i, .burst img { position: absolute; left: 0; top: 0; }

.burst .glow {
  width: 380px;
  height: 380px;
  margin: -190px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0, rgba(255, 250, 220, 0.95) 18%, rgba(255, 210, 63, 0.6) 40%, rgba(255, 210, 63, 0) 68%);
  animation: glow 0.8s ease-out forwards;
}

.burst .ring {
  width: 260px;
  height: 260px;
  margin: -130px;
  border: 8px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 5px var(--gold), inset 0 0 0 5px var(--gold);
  animation: ring 0.6s ease-out forwards;
}

.burst.is-small .glow, .burst.is-small .ring { scale: 0.6; }
.burst .spark { width: 42px; }

@keyframes glow {
  0% { opacity: 0; transform: scale(0.3); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.15); }
}

@keyframes ring {
  from { opacity: 1; transform: scale(0.2); }
  to { opacity: 0; transform: scale(1.3); }
}

/* The Chick line, tier 1 to 10: pets you have made show, the rest are silhouettes. */
.rail {
  order: 2;
  display: flex;
  gap: 4px;
  margin: 12px 0 0;
  padding: 6px 10px;
  list-style: none;
  border: var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 4px 0 var(--ink);
}

.rail li { position: relative; width: clamp(28px, 4.6vw, 46px); aspect-ratio: 1; }

.rail span {
  position: absolute;
  inset: 0;
  background: var(--shade);
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}

.rail .is-found span { background: var(--src) center / contain no-repeat; -webkit-mask: none; mask: none; }
.rail .is-new span { animation: rail-pop 0.5s ease-out; }

@keyframes rail-pop {
  0% { transform: scale(0.4); }
  60% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Battle on the beach. */
.battle {
  position: relative;
  isolation: isolate;
  border-top: 4px solid var(--ink);
  padding: clamp(64px, 9vw, 120px) var(--gutter);
}

.battle .scene img { object-position: left center; }

.battle-inner {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 470px);
  justify-content: center;
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
}

.phone { width: 100%; filter: drop-shadow(10px 12px 0 rgba(59, 29, 12, 0.25)); }

.panel {
  padding: clamp(24px, 3.2vw, 40px);
  border: var(--line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--ink);
}

.panel h3 { font-size: 1.55rem; margin: 1.6rem 0 0.35rem; }

.weapons {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 54px));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.weapons li {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--cream);
}

.weapons img { width: 78%; height: auto; }

/* Twenty worlds in a strip you can swipe. */
.worlds {
  border-top: 4px solid var(--ink);
  padding: clamp(64px, 8vw, 110px) 0 clamp(56px, 7vw, 96px);
  background: linear-gradient(180deg, #7cc8f2, #b9e2f7);
}

.worlds-head {
  max-width: 1200px;
  margin: 0 auto 24px;
  padding: 0 var(--gutter);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.worlds-head p { margin: 0; max-width: 30rem; font-size: 1.12rem; }

.arrows { display: flex; gap: 12px; }

.arrow {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0;
  border: var(--line);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
}

.arrow:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

.arrow svg {
  width: 24px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.strip {
  --inset: max(var(--gutter), calc((100% - 1200px) / 2 + var(--gutter)));
  display: flex;
  gap: 18px;
  margin: 0;
  padding: 6px var(--inset) 18px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--inset);
  scrollbar-width: none;
}

.strip::-webkit-scrollbar { display: none; }

.strip li {
  position: relative;
  flex: 0 0 clamp(172px, 21vw, 244px);
  aspect-ratio: 2 / 3;
  overflow: hidden;
  scroll-snap-align: start;
  border: var(--line);
  border-radius: 22px;
  box-shadow: 0 6px 0 var(--ink);
  background: var(--shade);
}

.strip img { width: 100%; height: 100%; object-fit: cover; }

.strip .boss {
  position: absolute;
  left: 50%;
  bottom: 21%;
  width: 74%;
  height: auto;
  transform: translateX(-50%);
  filter: drop-shadow(0 8px 0 rgba(40, 30, 10, 0.22));
}

.strip span {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 0.3rem 0.5rem;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  font-size: 0.8rem;
  line-height: 1.3;
  text-align: center;
}

.strip b { display: block; font-size: 0.95rem; }

/* Pets at golden hour: recipes, then the collection as the game shows it. */
.pets {
  border-top: 4px solid var(--ink);
  padding: clamp(64px, 8vw, 110px) var(--gutter);
  background: linear-gradient(180deg, #ffd47c, #ffae76);
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 700px);
  justify-content: center;
  align-items: center;
  gap: clamp(32px, 6vw, 88px);
}

.pets-copy > p { font-size: 1.12rem; }

.recipes { display: grid; gap: 10px; margin: 1.6rem 0 0; padding: 0; list-style: none; }

.recipes li { display: flex; align-items: center; gap: 4px; }
.recipes img { width: 76px; height: 76px; }

.recipes img:last-child {
  width: 96px;
  height: 96px;
  margin-left: 4px;
  filter: drop-shadow(0 0 10px rgba(255, 250, 225, 0.95));
}

.recipes b { font: 2rem/1 var(--display); width: 1.2em; text-align: center; }

.collection {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.collection li {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 10px;
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  background: var(--paper);
  text-align: center;
}

.collection img, .collection i { width: 84%; aspect-ratio: 1; height: auto; }

.collection i {
  display: block;
  background: var(--shade);
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}

.collection b { font-weight: 800; font-size: 0.82rem; line-height: 1.2; margin-top: 4px; }
.collection span { font-size: 0.74rem; color: var(--ink-soft); }
.collection .unknown { background: #f1e4c8; }

/* Night on the farm. */
.closer {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: clamp(620px, 88vh, 860px);
  border-top: 4px solid var(--ink);
  padding: clamp(80px, 11vw, 140px) var(--gutter) 0;
  color: #fff;
  text-align: center;
  background: var(--night);
}

.closer .scene img { object-position: 72% center; }
.closer :focus-visible { outline-color: var(--gold); }

.closer-copy { max-width: 34rem; margin: 0 auto; }
.closer-copy h2 { text-shadow: 0 4px 0 var(--ink); }
.closer-copy p { font-size: 1.15rem; text-wrap: balance; }
.closer .fine { margin-top: 1.2rem; font-size: 0.95rem; color: #dfe5ff; }

.nest {
  position: absolute;
  left: 50%;
  bottom: clamp(20px, 5vh, 48px);
  display: flex;
  align-items: flex-end;
  transform: translateX(-50%);
}

.nest img { width: clamp(88px, 11vw, 132px); }

.nest .egg {
  width: clamp(64px, 8vw, 96px);
  margin: 0 -6px 6px;
  filter: drop-shadow(0 0 18px rgba(255, 220, 120, 0.85));
  transform-origin: 50% 90%;
  animation: rock 4s ease-in-out infinite;
}

@keyframes rock {
  0%, 80%, 100% { transform: rotate(0); }
  84% { transform: rotate(-8deg); }
  88% { transform: rotate(8deg); }
  92% { transform: rotate(-5deg); }
  96% { transform: rotate(3deg); }
}

/* Footer. */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 32px;
  padding: 26px var(--gutter);
  border-top: 4px solid var(--ink);
  background: var(--ink);
  color: var(--cream);
}

.site-footer .brand { font-size: 1.35rem; }
.site-footer .brand img { width: 32px; height: 32px; }
.site-footer p { margin: 0 0 0 auto; font-size: 0.92rem; opacity: 0.8; }
.site-footer :focus-visible { outline-color: var(--gold); }

.footer-links { display: flex; gap: 22px; }
.footer-links a { color: var(--gold); font-weight: 800; text-decoration: none; }
.footer-links a:hover, .footer-links a[aria-current] { text-decoration: underline; text-underline-offset: 4px; }

/* Privacy, Terms and Support. */
.legal {
  padding: 112px var(--gutter) 88px;
  background: linear-gradient(180deg, var(--sky) 0, #bfe6fa 360px, var(--cream) 760px);
}

.legal > h1, .legal-updated, .legal-card { max-width: 820px; margin-inline: auto; }

.legal > h1 { font-size: clamp(2.4rem, 1.6rem + 3vw, 3.6rem); line-height: 1.05; }

.legal-updated { margin-top: 0.4rem; margin-bottom: 1.4rem; font-weight: 800; }

.legal-card {
  margin-top: 1.4rem;
  padding: clamp(22px, 4vw, 48px);
  border: var(--line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--ink);
  line-height: 1.65;
}

.legal-updated + .legal-card { margin-top: 0; }
.legal-card h2 { font-size: 1.7rem; margin: 2.2rem 0 0.6rem; }
.legal-card h3 { font: 800 1.15rem/1.3 var(--body); margin: 1.5rem 0 0.4rem; }
.legal-card > :first-child { margin-top: 0; }
.legal-card p + p { margin-top: 0.8rem; }
.legal-card :is(ul, table) { margin: 0.8rem 0 0; }
.legal-card ul { padding-left: 1.3rem; }
.legal-card li + li { margin-top: 0.35rem; }
.legal-card :is(ul, table) + p { margin-top: 0.8rem; }
.legal-card table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.legal-card :is(th, td) { text-align: left; vertical-align: top; padding: 0.55rem 0.6rem; border-bottom: 2px solid #efdfbd; }
.legal-card a { color: #1d5f96; font-weight: 800; }

@media (max-width: 860px) {
  .battle-inner, .pets { grid-template-columns: minmax(0, 520px); }
  .battle-inner .panel { order: -1; }
  .phone { max-width: 300px; margin: 0 auto; }
  .collection { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .collection li:nth-child(n + 10) { display: none; }
}

@media (max-width: 720px) {
  .site-nav, .arrows { display: none; }
  .site-nav + .btn { margin-left: auto; }
  .brand { font-size: 1.45rem; }
  .brand img { width: 34px; height: 34px; }
  .site-footer p { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hand { display: none; }
}
