:root {
  color-scheme: dark;
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  --yellow: #ffe56b;
  --coral: #ff725f;
  --ink: #243746;
  --panel: rgba(255, 250, 235, 0.91);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #243746;
}

body {
  min-height: 100dvh;
  overflow: hidden;
}

button { font: inherit; }

.app {
  position: relative;
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  isolation: isolate;
}

.world {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(#8bd8ff 0 44%, #fff2b8 68%, #6fcf8d);
  z-index: -3;
}

.world-track {
  display: flex;
  width: 300%;
  height: 100%;
  animation: scroll-world 24s linear infinite;
}

.scene-panel {
  position: relative;
  flex: 0 0 33.3333%;
  height: 100%;
  overflow: hidden;
}

.scene-panel::before {
  content: "";
  position: absolute;
  inset: 44% -10% 0;
  background:
    radial-gradient(ellipse at 20% 12%, color-mix(in srgb, var(--hill-a), white 13%) 0 29%, transparent 30%),
    radial-gradient(ellipse at 72% 6%, var(--hill-b) 0 38%, transparent 39%),
    linear-gradient(var(--ground-a), var(--ground-b));
  filter: saturate(1.05);
}

.sky-orb {
  position: absolute;
  width: 74px;
  aspect-ratio: 1;
  right: 12%;
  top: 15%;
  border-radius: 50%;
  background: var(--orb);
  border: 6px solid rgba(255,255,255,.32);
  box-shadow: 0 8px 0 rgba(50,67,75,.10), 0 0 38px color-mix(in srgb, var(--orb), transparent 45%);
}

.cloud {
  position: absolute;
  width: 105px;
  height: 30px;
  top: 25%;
  left: 9%;
  border-radius: 999px;
  background: rgba(255,255,255,.86);
  box-shadow: 34px -14px 0 7px rgba(255,255,255,.86), 68px 2px 0 -2px rgba(255,255,255,.86), 0 8px 0 rgba(68,91,105,.08);
}

.scene-art {
  position: absolute;
  left: 0;
  bottom: 11%;
  width: 100%;
  height: 58%;
  overflow: visible;
  filter: drop-shadow(0 9px 0 rgba(38,55,70,.14));
}

.ground-detail {
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: 6%;
  height: 42px;
  border-top: 8px dashed color-mix(in srgb, var(--detail), white 14%);
  border-bottom: 0;
  opacity: .75;
}

.shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(rgba(23,43,56,.04), transparent 30%, transparent 67%, rgba(23,43,56,.28));
}

.topbar {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) 18px 0;
}

.topbar h1 {
  margin: 0;
  justify-self: center;
  white-space: nowrap;
  font-size: clamp(24px, 7vw, 32px);
  line-height: 1;
  padding: 13px 20px;
  color: var(--ink);
  border: 3px solid rgba(255,255,255,.68);
  border-radius: 999px;
  background: rgba(255,250,235,.88);
  box-shadow: 0 7px 0 rgba(36,55,70,.15);
}

.circle-button {
  width: 46px;
  height: 46px;
  padding: 0;
  border: 3px solid rgba(255,255,255,.68);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255,250,235,.9);
  box-shadow: 0 6px 0 rgba(36,55,70,.18);
  font-size: 20px;
}

.playfield {
  display: flex;
  min-height: calc(100dvh - 182px);
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 24px;
}

.chicken-wrap {
  position: relative;
  height: clamp(170px, 30dvh, 270px);
  display: grid;
  place-items: end center;
}

.chicken {
  position: absolute;
  bottom: 3px;
  z-index: 1;
  width: 210px;
  height: 190px;
  transform-origin: 53% 78%;
  animation: chicken-bob .48s cubic-bezier(.45, 0, .55, 1) infinite alternate;
  filter: drop-shadow(0 9px 0 rgba(36,55,70,.18));
}

.chicken-body {
  position: absolute;
  left: 42px;
  top: 70px;
  z-index: 3;
  width: 126px;
  height: 101px;
  border: 4px solid #283e4d;
  border-radius: 56% 43% 52% 47%;
  background: #fff8df;
  transform: rotate(-2deg);
}

.chicken-wing {
  position: absolute;
  left: 17px;
  top: 17px;
  width: 75px;
  height: 54px;
  border: 4px solid #283e4d;
  border-radius: 72% 35% 68% 38%;
  background: #ffd15c;
  transform-origin: 82% 54%;
  animation: wing-wave .48s ease-in-out infinite alternate;
}

.chicken-wing::before,
.chicken-wing::after {
  content: "";
  position: absolute;
  left: 5px;
  bottom: -6px;
  width: 34px;
  height: 20px;
  border: 3px solid #283e4d;
  border-radius: 50%;
  background: #ffdf7d;
  transform: rotate(-18deg);
}

.chicken-wing::after {
  left: 29px;
  bottom: -9px;
  width: 38px;
  background: #ffb84e;
  transform: rotate(3deg);
}

.chicken-head {
  position: absolute;
  left: 124px;
  top: 34px;
  z-index: 5;
  width: 72px;
  height: 78px;
  border: 4px solid #283e4d;
  border-radius: 54% 48% 52% 50%;
  background: #ffdc69;
}

.chicken-head::after {
  content: "";
  position: absolute;
  right: 19px;
  top: 50px;
  width: 19px;
  height: 11px;
  border-radius: 50%;
  background: #ff8d83;
  opacity: .9;
}

.chicken-eye {
  position: absolute;
  right: 9px;
  top: 16px;
  width: 21px;
  height: 24px;
  border: 3px solid #283e4d;
  border-radius: 52%;
  background: white;
  box-shadow: none;
  transform: rotate(5deg);
}

.chicken-eye::before {
  content: "";
  position: absolute;
  right: 4px;
  top: 3px;
  z-index: 1;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: white;
}

.chicken-eye::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 12px;
  height: 14px;
  border-radius: 50%;
  background: #263238;
}

.chicken-smile {
  position: absolute;
  right: 4px;
  top: 47px;
  width: 14px;
  height: 8px;
  border-right: 3px solid #283e4d;
  border-bottom: 3px solid #283e4d;
  border-radius: 0 0 12px 0;
  transform: rotate(9deg);
}

.chicken-beak {
  position: absolute;
  right: -28px;
  top: 35px;
  width: 30px;
  height: 22px;
}

.chicken-beak::before,
.chicken-beak::after {
  content: "";
  position: absolute;
  left: 0;
  width: 0;
  height: 0;
  border-left: 28px solid #ff805e;
  filter: drop-shadow(2px 2px 0 #283e4d);
}

.chicken-beak::before {
  top: 0;
  border-top: 0 solid transparent;
  border-bottom: 9px solid transparent;
  transform: rotate(2deg);
}

.chicken-beak::after {
  top: 10px;
  border-top: 8px solid transparent;
  border-bottom: 0 solid transparent;
  transform: rotate(-7deg);
}

.chicken-tuft {
  position: absolute;
  left: 15px;
  top: -16px;
  width: 38px;
  height: 22px;
}

.chicken-tuft i {
  display: block;
  position: absolute;
  left: 8px;
  bottom: 0;
  width: 21px;
  height: 22px;
  border-radius: 60% 50% 40% 40%;
  border: 3px solid #283e4d;
  background: #ff725f;
  transform: rotate(-18deg);
  transform-origin: bottom;
}

.chicken-tuft i:nth-child(2) {
  left: 21px;
  height: 20px;
  transform: rotate(16deg);
}

.chicken-tail {
  position: absolute;
  left: 9px;
  top: 91px;
  z-index: 2;
  width: 64px;
  height: 61px;
}

.chicken-tail::after {
  content: "";
  position: absolute;
  right: -22px;
  top: 25px;
  width: 54px;
  height: 40px;
  border-radius: 55% 45% 48% 52%;
  border: 4px solid #283e4d;
  background: #fff8df;
  transform: rotate(-3deg);
}

.chicken-tail i {
  position: absolute;
  left: 19px;
  top: 11px;
  width: 27px;
  height: 55px;
  border: 3px solid #283e4d;
  border-radius: 70% 35% 65% 35%;
  background: #ff9b59;
  transform: rotate(-61deg);
  transform-origin: bottom right;
}

.chicken-tail i:nth-child(2) {
  left: 7px;
  top: 1px;
  background: #ffd15c;
  transform: rotate(-82deg);
}

.chicken-tail i:nth-child(3) {
  left: 28px;
  top: 23px;
  background: #ff725f;
  transform: rotate(-42deg);
}

.chicken-leg {
  position: absolute;
  top: 151px;
  z-index: 1;
  width: 7px;
  height: 42px;
  border-radius: 999px;
  background: #d66a3f;
  box-shadow: 0 0 0 2px #283e4d;
  transform-origin: 50% 3px;
}

.chicken-leg span {
  position: absolute;
  left: -1px;
  bottom: -2px;
  width: 29px;
  height: 7px;
  border-radius: 999px;
  background: #d66a3f;
  box-shadow: 0 0 0 2px #283e4d;
  transform: rotate(-5deg);
  transform-origin: left center;
}

.chicken-leg span::before,
.chicken-leg span::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 0;
  width: 17px;
  height: 4px;
  border-radius: 999px;
  background: #d66a3f;
  transform: rotate(30deg);
  transform-origin: left;
}

.chicken-leg span::after {
  transform: rotate(-31deg);
}

.chicken-leg-back {
  left: 82px;
  animation: leg-back .48s ease-in-out infinite alternate;
}

.chicken-leg-front {
  left: 136px;
  animation: leg-front .48s ease-in-out infinite alternate;
}

.chicken-shadow {
  position: absolute;
  bottom: -3px;
  width: 132px;
  height: 22px;
  border-radius: 50%;
  background: rgba(36,55,70,.23);
  animation: shadow-pulse .48s ease-in-out infinite alternate;
}

.chicken-pack {
  position: absolute;
  left: 43px;
  top: 78px;
  z-index: 1;
  width: 43px;
  height: 69px;
  border: 4px solid #283e4d;
  border-radius: 18px 10px 16px 19px;
  background: #29a79a;
  transform: rotate(-8deg);
}

.chicken-pack::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 11px;
  height: 18px;
  border: 3px solid #283e4d;
  border-radius: 8px;
  background: #63d1bc;
}

.chicken-scarf {
  position: absolute;
  left: 132px;
  top: 94px;
  z-index: 6;
  width: 44px;
  height: 16px;
  border: 3px solid #283e4d;
  border-radius: 999px;
  background: #ff725f;
  transform: rotate(7deg);
}

.chicken-scarf i {
  position: absolute;
  left: 2px;
  top: 8px;
  width: 38px;
  height: 17px;
  border: 3px solid #283e4d;
  border-radius: 4px 14px 14px 4px;
  background: #ff8b73;
  transform: rotate(24deg);
  transform-origin: left center;
}

.challenge-card {
  color: var(--ink);
  padding: 16px 20px;
  border: 4px solid rgba(255,255,255,.72);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: 0 9px 0 rgba(36,55,70,.17), 0 18px 36px rgba(36,55,70,.12);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  color: #df6556;
}

.challenge-card h2 {
  margin: 5px 0 13px;
  text-align: center;
  font-size: clamp(25px, 7vw, 32px);
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border: 3px solid #d9d1bd;
  border-radius: 999px;
  background: #eee6d4;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff725f, #ffd15c);
  transition: width .45s cubic-bezier(.2,.8,.2,1);
}

.progress-row, .health-row, .metric-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.progress-row {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
}

.card-divider {
  height: 1px;
  margin: 12px 0 10px;
  background: #ddd4c0;
}

.health-row {
  font-size: 12px;
  font-weight: 700;
  color: #466071;
}

.status {
  margin: 8px 0 0;
  text-align: center;
  font-size: 11px;
  color: #71818b;
}

.actions {
  padding: 14px 24px max(22px, env(safe-area-inset-bottom));
}

.primary-button, .secondary-button, .danger-button, .sim-grid button {
  min-height: 50px;
  border-radius: 999px;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  border: 0;
  border: 3px solid #283e4d;
  color: #283e4d;
  background: linear-gradient(180deg, #ffe67a, #ffc957);
  box-shadow: 0 7px 0 #283e4d, 0 13px 24px rgba(36,55,70,.2);
  font-size: 18px;
}

.secondary-button {
  width: 100%;
  border: 2px solid rgba(255,255,255,.82);
  color: white;
  background: transparent;
}

.sheet {
  width: min(100% - 18px, 520px);
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 28px 28px 0 0;
  color: var(--ink);
  background: #fffaf0;
  box-shadow: 0 -8px 0 rgba(36,55,70,.12);
}

.sheet::backdrop { background: rgba(0,0,0,.54); backdrop-filter: blur(5px); }
.sheet[open] { animation: sheet-in .25s ease-out; }

.sheet-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  padding: 16px 15px 11px;
  background: rgba(255,250,240,.95);
  backdrop-filter: blur(16px);
}

.sheet-header h2 {
  grid-column: 2;
  margin: 0;
  text-align: center;
  font-size: 19px;
}

.text-button {
  grid-column: 3;
  border: 0;
  color: var(--yellow);
  background: transparent;
  font-weight: 700;
}

.sheet-note {
  margin: 0;
  padding: 0 18px 14px;
  color: #667984;
  font-size: 13px;
  line-height: 1.4;
}

.scene-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px 12px;
  padding: 0 14px max(30px, env(safe-area-inset-bottom));
}

.scene-option {
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.scene-preview {
  position: relative;
  height: 94px;
  overflow: hidden;
  border: 3px solid rgba(36,55,70,.14);
  border-radius: 20px;
  background: linear-gradient(var(--sky-a), var(--sky-b) 55%, var(--ground) 56%);
}

.scene-option.selected .scene-preview {
  border-color: #ff725f;
  box-shadow: 0 5px 0 rgba(255,114,95,.28);
}

.scene-preview .scene-art {
  bottom: -5px;
  height: 94%;
  filter: drop-shadow(0 4px 0 rgba(36,55,70,.12));
}

.scene-option strong, .scene-option small {
  display: block;
  padding: 0 4px;
}

.scene-option strong { margin-top: 7px; font-size: 14px; }
.scene-option small { margin-top: 3px; color: #70808a; font-size: 11px; }

.metric-list {
  display: grid;
  gap: 8px;
  padding: 0 18px 18px;
}

.metric-list div {
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid #e1d8c5;
  background: #f5eddd;
}

.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 18px;
}

.sim-grid button {
  border: 3px solid #283e4d;
  color: #283e4d;
  background: #c9f0e4;
  box-shadow: 0 4px 0 #283e4d;
}

.danger-button {
  width: calc(100% - 36px);
  margin: 18px;
  border: 2px solid #d9867e;
  color: #a63d38;
  background: #ffe3df;
}

.celebration {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 18% 18%, #ffe778 0 7%, transparent 7.5%),
    radial-gradient(circle at 82% 12%, #62d7c3 0 6%, transparent 6.5%),
    linear-gradient(145deg, #ff7a68, #7d5ad7 74%);
}

.celebration-content {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(25px, env(safe-area-inset-top)) 28px max(25px, env(safe-area-inset-bottom));
  text-align: center;
}

.celebration-kicker {
  margin: 0 0 4px;
  color: #ffe85f;
  font-weight: 900;
  letter-spacing: .14em;
}

.celebration h2 { margin: 0; font-size: clamp(36px, 11vw, 54px); }
.celebration-content > p { margin: 9px 0; }

.egg {
  position: relative;
  width: 170px;
  height: 220px;
  margin: 24px 0 13px;
  border: 7px solid #fff8df;
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  background: linear-gradient(145deg, var(--egg-a), var(--egg-b));
  box-shadow: 0 10px 0 rgba(36,55,70,.25), 0 0 38px rgba(255,244,130,.4), inset -18px -20px 26px rgba(0,0,0,.10);
  animation: egg-reveal .65s cubic-bezier(.2,.9,.2,1.2);
}

.egg span {
  position: absolute;
  width: 37px;
  height: 70px;
  left: 34px;
  top: 25px;
  border-radius: 50%;
  background: rgba(255,255,255,.34);
  transform: rotate(24deg);
}

.found-label { color: rgba(255,255,255,.72); font-size: 12px; font-weight: 900; letter-spacing: .18em; }
.celebration h3 { margin: 0; font-size: 30px; }
.secret-hint { min-height: 20px; color: #ffe65e; font-size: 13px; font-weight: 800; }
.celebration-actions { display: grid; width: 100%; max-width: 360px; gap: 10px; margin-top: 14px; }

.confetti i {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  background: var(--c);
  animation: confetti-fall var(--speed) linear infinite;
  animation-delay: var(--delay);
}

@keyframes scroll-world { to { transform: translateX(-33.3333%); } }
@keyframes chicken-bob { from { transform: translateY(1px) rotate(-1.5deg); } to { transform: translateY(-9px) rotate(2deg); } }
@keyframes leg-front { from { transform: rotate(44deg); } to { transform: rotate(-43deg); } }
@keyframes leg-back { from { transform: rotate(-43deg); } to { transform: rotate(44deg); } }
@keyframes wing-wave { from { transform: rotate(-22deg); } to { transform: rotate(-43deg); } }
@keyframes shadow-pulse { from { transform: scaleX(1); opacity: .8; } to { transform: scaleX(.82); opacity: .55; } }
@keyframes sheet-in { from { transform: translateY(30%); opacity: .5; } }
@keyframes egg-reveal { from { transform: scale(.15) rotate(-18deg); opacity: 0; } }
@keyframes confetti-fall { to { transform: translateY(110dvh) rotate(540deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

@media (max-height: 730px) {
  .chicken-wrap { height: 130px; }
  .chicken { transform: scale(.78); transform-origin: center bottom; bottom: -2px; }
  .playfield { gap: 7px; }
  .challenge-card { padding-block: 12px; }
}
