.wild-scene {
  --field: #5da998;
  --field-light: #b6e4a8;
  --field-dark: #226e72;
  --soil: #284c50;
  --glint: #fff3a6;
  display: grid;
  justify-items: center;
  gap: .75rem;
  padding: clamp(.3rem, 1.5vw, .9rem);
  min-width: 0;
  color: #fff8df;
  border-radius: 1rem;
  isolation: isolate;
  background: linear-gradient(160deg, #102532d1, #123d40d9);
}
.live-play-area[data-world="desert"] .wild-scene { --field-light: #f2d89e; --field: #d3a87e; --field-dark: #946548; --soil: #644d42; }
.live-play-area[data-world="crystals"] .wild-scene { --field-light: #abcdea; --field: #8d99ce; --field-dark: #625584; --soil: #494666; }
.live-play-area[data-world="islands"] .wild-scene { --field-light: #9ce8d9; --field: #67b3ba; --field-dark: #42798a; --soil: #34566e; }
.live-play-area[data-world="sky"] .wild-scene { --field-light: #e6daf3; --field: #ab9bc9; --field-dark: #736699; --soil: #55486c; }
.live-play-area[data-world="void"] .wild-scene { --field-light: #c4b8ea; --field: #9082af; --field-dark: #594979; --soil: #40374f; }
.wild-grid {
  display: grid;
  isolation: isolate;
  position: relative;
  inline-size: min(100%, calc(var(--cols) * 4.5rem));
  aspect-ratio: var(--cols) / var(--rows);
  grid-template: repeat(var(--rows), minmax(0, 1fr)) / repeat(var(--cols), minmax(0, 1fr));
  overflow: visible;
  border-radius: 10px;
  background: var(--soil);
  box-shadow: 0 4px 0 2px var(--soil), 0 7px 12px #08161a55;
}
.wild-grid button, .wild-undo {
  appearance: none;
  padding: 0;
  touch-action: manipulation;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.wild-grid > * { min-width: 0; min-height: 0; }
.wild-grid button:focus-visible, .wild-grid:focus-visible, .wild-undo:focus-visible {
  outline: 3px solid #fff9b7;
  outline-offset: -3px;
  z-index: 8;
}
.wild-footer { width: min(100%, 30rem); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; }
.wild-status { flex: 1 1 8rem; margin: 0; line-height: 1.35; font-size: .86rem; font-weight: 720; }
.wild-undo { border: 1px solid #b0d7c6; background: #193e43; padding: 0 .7rem; min-height: 44px; border-radius: 1rem; font-size: .83rem; font-weight: 750; }
.wild-scene button[aria-disabled="true"] { cursor: default; }
.wild-undo[aria-disabled="true"] { color: #bccec7; border-color: #9aafa7; }
.wild-square { position: relative; }
.wild-water {
  background:
    radial-gradient(ellipse at 20% 65%, transparent 6%, #e8ffde77 7% 9%, transparent 10%) 5px 0 / 54% 37%,
    linear-gradient(157deg, var(--field-light), var(--field) 58%, var(--field-dark));
  box-shadow: inset 1px 1px #ffffff42, inset -1px -1px #244b5433;
}
.wild-water:nth-child(3n) { background-position: 70% 50%, center; }
.wild-rock {
  position: absolute; inset: 14% 6% 8%;
  transform: rotate(-6deg);
  border-radius: 54% 38% 30% 26%;
  background: linear-gradient(135deg, #c2c7af 0 22%, #929e93 23% 49%, #6a797b 50% 70%, #49585f 71%);
  border: 2px solid #4f6966;
  box-shadow: inset 0 -3px #38565b6b, 0 3px #23545d70;
}
.wild-rock::after { content: ''; position: absolute; width: 35%; height: 24%; bottom: -5%; right: -5%; border-radius: 70% 38% 40% 22%; background: #dbe8bb; box-shadow: inset -3px -3px #92a48e; }
.wild-parcel { position: absolute; inset: 0; display: grid; place-items: center; color: #ffde5c; -webkit-text-stroke: 1px #965d20; font-size: clamp(1.35rem, 5vw, 2rem); filter: drop-shadow(0 2px 0 #714025); }
.wild-parcel[data-picked="true"] { opacity: 0; transform: scale(.2); }
.wild-refuge { position: absolute; width: 111%; height: 112%; object-fit: contain; left: -5%; bottom: 1%; pointer-events: none; filter: drop-shadow(0 2px 0 #254e56a8); }
.wild-dock { position: absolute; top: -7%; left: -4%; display: grid; place-items: center; width: 45%; height: 45%; border-radius: 55% 55% 55% 15%; color: #543c2d; background: #fff1b1; border: 2px solid #6d5943; font-weight: 900; line-height: 1; }
.wild-grid[data-deliverable="true"] .wild-refuge { filter: drop-shadow(0 0 3px #fff3a6) drop-shadow(0 0 5px #fff3a6); }
.wild-courier {
  position: absolute; z-index: 4; left: 0; top: 0;
  width: calc(100% / var(--cols)); height: calc(100% / var(--rows));
  transform: translate(calc(var(--x) * 100%), calc(var(--y) * 100%)); pointer-events: none;
}
.wild-courier::before {
  content: ''; position: absolute; left: 4%; right: 4%; bottom: 10%; height: 22%; border-radius: 80% 10% 70% 44%;
  background: linear-gradient(175deg, #fff4aa 20%, #eda04d 45%, #e45c3a 49% 70%, #ffe188 71%); border: 1px solid #855747; box-shadow: 0 4px 0 #44867a70;
}
.wild-rider { position: absolute; bottom: 18%; left: -1%; width: 105%; height: 92%; object-fit: contain; filter: drop-shadow(0 2px 1px #26414361); }
.wild-courier[data-face="left"] .wild-rider { transform: scaleX(-1); }
.wild-landing {
  position: absolute; inset: 0; z-index: 5; grid-area: 1 / 1; justify-self: stretch; align-self: stretch; background: transparent; border: 0; display: grid; align-items: end; justify-items: end;
}
.wild-landing[hidden] { display: none; }
.wild-landing > span {
  width: 47%; height: 47%; display: grid; place-items: center; border-radius: 50%; border: 1px solid #d5fff2;
  color: white; font-size: clamp(.85rem, 4vw, 1.35rem); font-weight: 900; line-height: 1; background: #254c5c; box-shadow: 0 2px 0 #214d5e75;
}
.wild-landing[aria-disabled="true"] > span { opacity: .48; }
.wild-landing:not([aria-disabled="true"]):hover > span { background: #06676e; }

.wild-scene[data-kind="glow"] .wild-grid { background: radial-gradient(ellipse at 50% 0, var(--field-dark), var(--soil) 80%); }
.wild-bed { position: relative; border: 0; background: transparent; }
.wild-soil::after { content: '✧'; position: absolute; inset: 0; display: grid; place-items: center; font-size: .7rem; color: #c3dbc580; }
.wild-stem { position: absolute; width: 12%; height: 39%; left: 44%; top: 49%; border-radius: 25%; background: #638e76; box-shadow: inset -2px 0 #345c59; transform: rotate(-5deg); }
.wild-stem::before, .wild-stem::after { content: ''; position: absolute; top: 44%; width: 190%; height: 47%; background: linear-gradient(130deg,#acd68c,#57917b); border: 1px solid #3d6862; }
.wild-stem::before { right: 40%; border-radius: 5% 90% 5% 90%; }
.wild-stem::after { left: 50%; border-radius: 90% 5% 90% 5%; transform: translateY(36%); }
.wild-bulb { position: absolute; inset: 14% 24% 31%; border: 2px solid #798b98; border-radius: 50% 50% 44% 42%; transform: rotate(-8deg); background: radial-gradient(ellipse at 31% 25%, #c1d6e2 0 7%, transparent 8%), linear-gradient(145deg,#8596b2,#50647c 65%,#384d5e); box-shadow: inset -3px -3px #32456155, 0 3px 0 #243d444d; }
.wild-bulb::before { content: ''; position: absolute; left: 25%; right: 24%; top: -21%; height: 24%; transform: rotate(4deg); border-radius: 70% 70% 15% 15%; background: #dfab76; border: 1px solid #76563f; }
.wild-spark { position: absolute; inset: 22% 30% 38%; display: grid; place-items: center; color: #435074; font-size: clamp(.75rem,4vw,1.3rem); line-height: 1; }
.wild-lamp[aria-pressed="true"] .wild-bulb { border-color: #faf2a8; background: radial-gradient(ellipse at 29% 27%, white 0 8%, transparent 9%), radial-gradient(ellipse at 45% 45%,#fffab9 5%,#fdd46b 58%,#df8a3c 100%); box-shadow: 0 0 10px 3px #fff08e8c, inset -3px -3px #d695524f; }
.wild-lamp[aria-pressed="true"] .wild-spark { color: #7d5031; }

.wild-scene[data-kind="springs"] .wild-grid { background: var(--field); }
.wild-conduit { position: relative; border: none; background: linear-gradient(140deg, var(--field-light), var(--field)); box-shadow: inset 0 0 0 1px #ffffff40; }
button.wild-conduit { background: radial-gradient(circle, #fff6cf66, transparent 56%), linear-gradient(140deg, var(--field-light), var(--field)); }
.wild-pipe { position: absolute; inset: 0; transform: rotate(var(--turn, 0deg)); }
.wild-branch { --flow: #826950; position: absolute; width: 25%; height: 51%; left: 37.5%; top: 0; transform-origin: 50% 99%; background: linear-gradient(to right,#526258 0 9%,#baa774 10% 20%,var(--flow) 21% 76%,#ae9161 77% 89%,#586154 90%); }
.wild-branch-1 { transform: rotate(90deg); }
.wild-branch-2 { transform: rotate(180deg); }
.wild-branch-3 { transform: rotate(270deg); }
.wild-hub { position: absolute; inset: 35%; border-radius: 50%; background: #8d785b; border: 2px solid #9a885e; }
.wild-conduit[data-wet="true"] .wild-branch { --flow: #2786b0; }
.wild-conduit[data-wet="true"] .wild-hub { background: #68dbe5; border-color: #398998; }
.wild-conduit[data-leak="true"]::after { content: '●'; color: #daf9ff; text-shadow: 0 1px #0f769e; position: absolute; left: 12%; bottom: 10%; }
.wild-twist { position: absolute; right: 1%; bottom: 1%; border-radius: 50%; width: 32%; height: 32%; display: grid; place-items: center; background: #294d49; color: #fffad4; font-weight: 900; line-height: .8; font-size: clamp(.72rem,3vw,1rem); }
.wild-flower, .wild-source { position: absolute; inset: 13%; display: grid; place-items: center; font-size: clamp(1.4rem,5vw,2.4rem); line-height: 1; color: #80866a; text-shadow: 0 2px 0 #415b4c; transform: scale(.82); }
.wild-conduit[data-wet="true"] .wild-flower { color: #ffdd76; text-shadow: 0 2px 0 #9e6d40, 0 0 4px #fff6c1; transform: scale(1.12); }
.wild-source { inset: 23%; border-radius: 50%; color: #f7fffa; background: #177399; border: 2px solid #a2efff; transform: none; font-weight: 900; }

@media (prefers-reduced-motion: no-preference) {
  .wild-courier { transition: transform 280ms cubic-bezier(.27,.58,.4,1); }
  .wild-parcel { transition: opacity .16s ease .14s, transform .2s ease .14s; }
  .wild-pipe, .wild-flower { transition: transform 220ms ease-out; }
  .wild-bulb { transition: box-shadow .22s ease, background .22s ease; }
  .wild-lamp:active .wild-bulb { transform: rotate(-16deg) scale(.91); }
  .wild-grid[data-delivered="true"] .wild-refuge { animation: wild-arrival .6s ease-out; }
  @keyframes wild-arrival { 45% { transform: translateY(-12%) scale(1.09); } }
}

.wild-scene {
  position: relative;
  container-type: inline-size;
  background: linear-gradient(160deg, #10253294, #123d40bb), var(--play-landscape) center 62% / cover;
}
.wild-footer {
  box-sizing: border-box;
  width: auto;
  max-width: 100%;
  justify-content: center;
  padding: .2rem .32rem;
  background: #19333bea;
  border-radius: .75rem;
}
.wild-footer .wild-status { flex: 1 1 7rem; }
.wild-friend { flex: 0 0 2.4rem; width: 2.4rem; height: 2.7rem; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 2px 1px #132f3894); pointer-events: none; }
.wild-friend[data-gesture="lean"] { transform: translateY(-2px) rotate(4deg); }
@container (min-width: 32rem) {
  .wild-footer { width: min(94%, 28rem); padding-inline: .5rem; }
  .wild-friend { position: absolute; width: min(15cqw, 7.5rem); height: min(18cqw, 9.5rem); left: 2%; bottom: 20%; }
  .wild-friend[data-gesture="lean"] { transform: translateY(-6px) rotate(4deg); }
}
@media (prefers-reduced-motion: no-preference) {
  .wild-friend { transition: transform 230ms ease-in-out; }
}
@media (prefers-reduced-motion: reduce) {
  .wild-friend[data-gesture="lean"] { transform: none; }
}
