:root {
  --ink: #332417;
  --cream: #fff8d8;
  --grass: #67b83f;
  --grass-dark: #2e7b31;
  --wood: #9c5528;
  --wood-dark: #5f301d;
  --gold: #ffd84c;
  --orange: #f28b2d;
  --red: #db4a32;
  --blue: #55bde7;
  --panel-shadow: 0 6px 0 rgb(71 37 19 / 76%);
  --game-font: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

.atlas-icon {
  display: block;
  width: 100%;
  height: 100%;
  background-image: url("assets/ui-atlas.webp");
  background-repeat: no-repeat;
  background-size: 300% 200%;
}

.atlas-coin { background-position: 0 0; }
.atlas-star { background-position: 50% 0; }
.atlas-barn { background-position: 100% 0; }
.atlas-jobs { background-position: 0 100%; }
.atlas-chart { background-position: 50% 100%; }
.atlas-sound { background-position: 100% 100%; }

.goods-icon {
  display: block;
  width: 100%;
  height: 100%;
  background-image: url("assets/farm-goods-atlas.webp");
  background-repeat: no-repeat;
  background-size: 300% 200%;
}

.goods-egg { background-position: 0 0; }
.goods-milk { background-position: 50% 0; }
.goods-wool { background-position: 100% 0; }
.goods-crate { background-position: 0 100%; }
.goods-well { background-position: 50% 100%; }
.goods-truck { background-position: 100% 100%; }
}

html {
  min-width: 320px;
  background: #8bd8ff;
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #8bd8ff 0 120px, #b9ecff 320px, #78bd4e 100%);
  font-family: var(--game-font);
  font-weight: 800;
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

a {
  text-decoration: none;
}

button,
a,
.grass-spot,
.farm-product,
.animal {
  -webkit-tap-highlight-color: transparent;
}

.game-app {
  min-height: 100svh;
}

.top-hud {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  width: min(calc(100% - 24px), 1540px);
  min-height: 92px;
  margin: 0 auto;
  padding: 10px 0 8px;
}

.farm-logo {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 245px;
  padding: 10px 22px 11px 62px;
  color: #fff9d1;
  background: var(--wood);
  border: 4px solid var(--wood-dark);
  border-radius: 19px 12px 22px 10px;
  box-shadow: var(--panel-shadow);
  text-shadow: 0 2px 0 var(--wood-dark);
  transform: rotate(-1deg);
}

.farm-logo::before,
.farm-logo::after {
  position: absolute;
  z-index: -1;
  top: -12px;
  width: 18px;
  height: calc(100% + 24px);
  content: "";
  background: #74401f;
  border: 3px solid var(--wood-dark);
  border-radius: 10px;
}

.farm-logo::before {
  left: 16px;
  transform: rotate(2deg);
}

.farm-logo::after {
  right: 16px;
  transform: rotate(-2deg);
}

.logo-leaf {
  position: absolute;
  z-index: 2;
  top: 2px;
  left: 3px;
  width: 58px;
  height: 58px;
  object-fit: contain;
  transform: rotate(-12deg);
}

.logo-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  line-height: 0.95;
}

.logo-copy strong {
  font-size: 27px;
  letter-spacing: -0.055em;
}

.logo-copy small {
  margin-top: 6px;
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 0.12em;
}

.hud-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 155px;
  min-height: 56px;
  padding: 7px 15px 8px 8px;
  background: rgb(255 248 216 / 96%);
  border: 3px solid var(--wood-dark);
  border-radius: 22px 17px 20px 15px;
  box-shadow: 0 4px 0 rgb(95 48 29 / 70%);
}

.stat-pill > span:last-child {
  display: flex;
  min-width: 80px;
  flex: 1;
  flex-direction: column;
}

.stat-pill small {
  color: #79512f;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.stat-pill strong {
  font-size: 22px;
  line-height: 1;
}

.coin-icon,
.level-star,
.water-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 24px;
  font-weight: 900;
}

.coin-icon .atlas-icon,
.level-star .atlas-icon {
  width: 44px;
  height: 44px;
}

.level-star {
  font-size: 21px;
}

.water-icon .goods-icon {
  width: 48px;
  height: 48px;
}

.xp-track,
.quest-progress {
  display: block;
  width: 100%;
  height: 9px;
  margin-top: 4px;
  overflow: hidden;
  background: #d6c49c;
  border: 2px solid #7c5734;
  border-radius: 10px;
}

.xp-track i,
.quest-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #58b5ed, #7de9ff);
  transition: width 280ms ease;
}

.token-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.hud-button {
  min-height: 45px;
  padding: 10px 17px;
  cursor: pointer;
  background: var(--cream);
  border: 3px solid var(--wood-dark);
  border-radius: 14px 10px 15px 9px;
  box-shadow: 0 4px 0 var(--wood-dark);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.hud-button:hover,
.hud-button:focus-visible {
  transform: translateY(-2px) rotate(-1deg);
  outline: 3px solid rgb(255 255 255 / 80%);
}

.hud-button:active {
  box-shadow: 0 1px 0 var(--wood-dark);
  transform: translateY(3px);
}

.hud-button.is-offline {
  color: #846f5b;
  background: #e6dcc7;
}

.buy-button {
  color: #fff;
  background: var(--grass-dark);
}

.dex-button {
  color: #fff;
  background: var(--red);
}

.farm-shell {
  width: min(calc(100% - 18px), 1600px);
  margin: 0 auto 28px;
}

.world-scroll {
  position: relative;
  overflow: auto;
  background: #58a63c;
  border: 7px solid var(--wood-dark);
  border-radius: 22px 18px 12px 24px;
  box-shadow: 0 9px 0 #442313, 0 16px 30px rgb(48 50 20 / 24%);
  overscroll-behavior: contain;
  scrollbar-color: var(--wood) var(--cream);
  scrollbar-width: thin;
}

.farm-stage {
  position: relative;
  width: max(100%, 980px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #75c14a url("assets/farm-map.webp") center / 100% 100% no-repeat;
  isolation: isolate;
}

.farm-stage::after {
  position: absolute;
  z-index: 20;
  inset: 0;
  content: "";
  pointer-events: none;
  box-shadow: inset 0 0 70px rgb(44 79 27 / 20%);
}

.cloud {
  position: absolute;
  z-index: 1;
  top: 6%;
  width: 80px;
  height: 24px;
  pointer-events: none;
  opacity: 0.62;
  background: rgb(255 255 255 / 88%);
  border-radius: 50px;
  filter: blur(0.3px);
  animation: cloud-drift 34s linear infinite;
}

.cloud::before,
.cloud::after {
  position: absolute;
  content: "";
  background: inherit;
  border-radius: 50%;
}

.cloud::before {
  top: -17px;
  left: 18px;
  width: 35px;
  height: 35px;
}

.cloud::after {
  top: -10px;
  right: 10px;
  width: 27px;
  height: 27px;
}

.cloud-one {
  left: -10%;
}

.cloud-two {
  top: 12%;
  left: -18%;
  opacity: 0.4;
  animation-duration: 46s;
  animation-delay: -16s;
  transform: scale(0.75);
}

.quest-board {
  position: absolute;
  z-index: 16;
  color: #fff8d7;
  background: #8b4d29;
  border: 4px solid #4e2a18;
  box-shadow: var(--panel-shadow);
  text-shadow: 0 2px 0 #4e2a18;
}

.quest-board {
  top: 22%;
  left: 2.2%;
  display: flex;
  width: 205px;
  min-height: 126px;
  padding: 14px 17px 12px;
  flex-direction: column;
  border-radius: 12px 18px 10px 15px;
  transform: rotate(-1.5deg);
}

.quest-board::before,
.quest-board::after {
  position: absolute;
  z-index: -1;
  bottom: -33px;
  width: 14px;
  height: 36px;
  content: "";
  background: #6b381f;
  border: 3px solid #4e2a18;
}

.quest-board::before {
  left: 30px;
}

.quest-board::after {
  right: 30px;
}

.board-pin {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 14px;
  height: 14px;
  background: var(--gold);
  border: 3px solid #5f301d;
  border-radius: 50%;
}

.quest-board small {
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.11em;
}

.quest-board strong {
  margin: 5px 0 3px;
  font-size: 16px;
  line-height: 1.02;
}

.quest-board > span:last-of-type {
  margin-top: 4px;
  font-size: 11px;
}

.quest-progress {
  height: 11px;
  margin-top: 5px;
  background: #4e2a18;
  border-color: #32180e;
}

.quest-progress i {
  background: var(--gold);
}

#claim-quest {
  margin-top: 7px;
  padding: 6px 8px;
  cursor: pointer;
  color: #40220f;
  background: var(--gold);
  border: 2px solid #4e2a18;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 900;
}

.grass-layer,
.animals-layer,
.products-layer,
.effects-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grass-layer { z-index: 9; }
.animals-layer { z-index: 10; }
.products-layer { z-index: 13; }
.effects-layer { z-index: 19; overflow: hidden; }

.grass-spot {
  position: absolute;
  display: grid;
  width: 4.4%;
  aspect-ratio: 1;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  background: rgb(63 109 35 / 9%);
  border: 2px dashed rgb(66 102 38 / 22%);
  border-radius: 48% 44% 52% 46%;
  place-items: center;
  transform: translate(-50%, -50%);
  transition: background 130ms ease, border-color 130ms ease;
}

.grass-spot:nth-child(3n) { transform: translate(-50%, -50%) rotate(5deg); }
.grass-spot:nth-child(4n) { transform: translate(-50%, -50%) rotate(-4deg); }

.grass-spot img {
  display: block;
  width: 86%;
  height: 86%;
  opacity: 0;
  object-fit: contain;
  pointer-events: none;
  transform: translateY(7px) scale(calc(0.42 + var(--grass-growth, 0) * 0.58));
  transform-origin: center bottom;
  transition: opacity 140ms ease, transform 220ms ease;
}

.grass-spot[data-state="growing"] img,
.grass-spot[data-state="ready"] img { opacity: 1; }
.grass-spot[data-state="ready"] { background: transparent; border-color: transparent; }
.grass-spot[data-state="ready"] img { transform: translateY(2px) scale(1); }

.grass-spot[data-state="empty"]:hover,
.grass-spot[data-state="empty"]:focus-visible {
  background: rgb(255 239 119 / 28%);
  border-color: rgb(255 248 175 / 90%);
  outline: none;
}

.grass-spot[data-state="empty"]::after {
  display: grid;
  width: 24px;
  height: 24px;
  content: "+";
  opacity: 0;
  color: #fff;
  background: #428b31;
  border: 2px solid #fff2ae;
  border-radius: 50%;
  place-items: center;
  font-size: 17px;
  transition: opacity 120ms ease;
}

.grass-spot[data-state="empty"]:hover::after,
.grass-spot[data-state="empty"]:focus-visible::after { opacity: 1; }

.farm-product {
  position: absolute;
  width: 44px;
  height: 44px;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  background: rgb(255 247 197 / 82%);
  border: 3px solid #fff4bc;
  border-radius: 50%;
  box-shadow: 0 3px 0 rgb(75 45 21 / 35%);
  transform: translate(-50%, -50%);
  animation: product-ready 650ms ease-in-out infinite alternate;
}

.farm-product .goods-icon { width: 100%; height: 100%; }
.farm-product:hover,
.farm-product:focus-visible { outline: 4px solid #fff; filter: brightness(1.08); }

.map-station {
  position: absolute;
  z-index: 15;
  display: flex;
  min-width: 140px;
  padding: 6px 12px 7px 5px;
  cursor: pointer;
  align-items: center;
  gap: 4px;
  color: #fff9d4;
  background: rgb(113 62 31 / 92%);
  border: 3px solid #4e2a18;
  border-radius: 13px 9px 15px 10px;
  box-shadow: 0 4px 0 rgb(71 37 19 / 72%);
  text-align: left;
  text-shadow: 0 2px 0 #4e2a18;
}

.map-station > .goods-icon { width: 50px; height: 50px; flex: 0 0 50px; }
.map-station span { display: flex; flex-direction: column; }
.map-station b { font-size: 14px; }
.map-station small { color: #ffe16b; font-size: 9px; }
.map-station:hover,
.map-station:focus-visible { outline: 4px solid rgb(255 247 172 / 82%); transform: translateY(-2px); }
.well-station { right: 17%; bottom: 11%; transform: rotate(1deg); }
.warehouse-station { left: 3%; bottom: 9%; transform: rotate(-1deg); }

.animal {
  position: absolute;
  display: grid;
  width: var(--animal-size, 110px);
  height: var(--animal-size, 110px);
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  background: transparent;
  place-items: center;
  transform: translate(-50%, -50%) scaleX(var(--facing, 1));
  transition: left 3.2s ease-in-out, top 3.2s ease-in-out, filter 140ms ease;
}

.animal:hover,
.animal:focus-visible {
  filter: drop-shadow(0 0 7px #fff8a6) brightness(1.06);
  outline: none;
}

.animal img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  animation: animal-idle 1.8s ease-in-out infinite alternate;
}

.animal-hunger {
  position: absolute;
  right: 17%;
  bottom: 4%;
  left: 17%;
  z-index: 4;
  display: block;
  height: 11px;
  overflow: hidden;
  background: #4d321f;
  border: 2px solid #fff7d5;
  border-radius: 8px;
  box-shadow: 0 2px 0 rgb(59 37 20 / 45%);
  transform: scaleX(var(--facing, 1));
}

.animal-hunger i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #e75035 0 22%, #f0c83d 45%, #55b83f 70%);
  transform-origin: left;
  transition: width 240ms ease;
}

.animal.is-hungry .animal-hunger {
  animation: hunger-alert 700ms ease-in-out infinite alternate;
}

.animal.is-starving {
  filter: grayscale(0.85) brightness(0.77);
}

.animal.is-starving::after {
  content: "!";
  color: #fff;
  background: var(--red);
  border-color: #fff0d2;
}

.animal.is-eating img {
  animation: animal-eat 320ms ease 2;
}

.animal:nth-child(2n) img {
  animation-delay: -0.8s;
}

.animal:nth-child(3n) img {
  animation-duration: 2.25s;
}

.animal.is-ready::after {
  position: absolute;
  top: -5px;
  left: 50%;
  display: grid;
  width: 36px;
  height: 36px;
  content: "¢";
  color: #8d5000;
  background: var(--gold);
  border: 3px solid #fff6b3;
  border-radius: 50%;
  place-items: center;
  box-shadow: 0 3px 0 rgb(92 60 12 / 40%);
  font-size: 22px;
  font-weight: 900;
  transform: translateX(-50%) scaleX(var(--facing, 1));
  animation: coin-bubble 700ms ease-in-out infinite alternate;
}

.animal.is-collecting img {
  animation: animal-pop 260ms ease;
}

.float-reward {
  position: absolute;
  z-index: 22;
  pointer-events: none;
  color: #fff;
  text-shadow: -2px -2px 0 #6f3c0d, 2px -2px 0 #6f3c0d, -2px 2px 0 #6f3c0d, 2px 2px 0 #6f3c0d;
  font-size: 26px;
  font-weight: 900;
  transform: translate(-50%, -50%);
  animation: reward-float 900ms ease-out forwards;
}

.action-toast {
  position: absolute;
  z-index: 25;
  bottom: 3%;
  left: 50%;
  max-width: 440px;
  padding: 11px 18px;
  opacity: 0;
  pointer-events: none;
  color: #fff8d9;
  background: rgb(71 39 21 / 92%);
  border: 3px solid #fff0b1;
  border-radius: 14px 11px 16px 9px;
  box-shadow: 0 4px 0 rgb(53 29 16 / 55%);
  text-align: center;
  transform: translate(-50%, 14px);
  transition: opacity 170ms ease, transform 170ms ease;
}

.action-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.farm-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: min(940px, calc(100% - 24px));
  margin: -4px auto 0;
  padding: 11px 16px 14px;
  background: #8f4e28;
  border: 5px solid var(--wood-dark);
  border-top-width: 3px;
  border-radius: 0 0 24px 24px;
  box-shadow: 0 7px 0 #462414;
}

.farm-dock button {
  display: flex;
  min-width: 112px;
  min-height: 53px;
  padding: 7px 13px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff5c9;
  border: 3px solid var(--wood-dark);
  border-radius: 16px 12px 15px 10px;
  box-shadow: 0 4px 0 var(--wood-dark);
  font-size: 12px;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.farm-dock button span {
  font-size: 25px;
}

.farm-dock .dock-icon {
  display: grid;
  width: 47px;
  height: 47px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  place-items: center;
  transform: rotate(-2deg);
}

.farm-dock button:nth-child(2) .dock-icon {
  transform: rotate(2deg);
}

.farm-dock button:nth-child(3) .dock-icon {
  transform: rotate(-1deg);
}

.farm-dock button:nth-child(4) .dock-icon {
  transform: rotate(2deg);
}

.collect-dock-icon {
  filter: drop-shadow(0 2px 0 rgb(73 44 19 / 22%));
}

.sound-icon.is-muted {
  opacity: 0.48;
  filter: grayscale(1);
}

.farm-dock button:hover,
.farm-dock button:focus-visible {
  outline: 3px solid #fff;
  transform: translateY(-2px);
}

.farm-dock button:active {
  box-shadow: 0 1px 0 var(--wood-dark);
  transform: translateY(3px);
}

.game-dialog {
  width: min(920px, calc(100% - 26px));
  max-height: calc(100svh - 28px);
  padding: 0;
  overflow: visible;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.game-dialog::backdrop {
  background: rgb(33 49 23 / 66%);
  backdrop-filter: blur(3px);
}

.dialog-card {
  position: relative;
  max-height: calc(100svh - 28px);
  padding: 31px;
  overflow: auto;
  background: #fff5cc;
  border: 6px solid var(--wood-dark);
  border-radius: 25px 17px 28px 19px;
  box-shadow: 0 11px 0 #4e2817, 0 25px 60px rgb(0 0 0 / 24%);
}

.dialog-card::before {
  position: absolute;
  z-index: -1;
  inset: 10px;
  content: "";
  border: 3px dashed rgb(131 77 37 / 35%);
  border-radius: 17px;
  pointer-events: none;
}

.dialog-close {
  position: absolute;
  z-index: 5;
  top: 12px;
  right: 14px;
  display: grid;
  width: 42px;
  height: 42px;
  cursor: pointer;
  color: #fff;
  background: var(--red);
  border: 3px solid var(--wood-dark);
  border-radius: 50%;
  place-items: center;
  box-shadow: 0 3px 0 var(--wood-dark);
  font-size: 28px;
  line-height: 1;
}

.dialog-heading {
  margin-bottom: 20px;
  text-align: center;
}

.dialog-heading small {
  color: #9a5a22;
  font-size: 12px;
  letter-spacing: 0.18em;
}

.dialog-heading h2 {
  margin: 2px 0 4px;
  color: var(--grass-dark);
  font-size: clamp(37px, 6vw, 68px);
  line-height: 0.92;
  letter-spacing: -0.065em;
  text-shadow: 0 3px 0 #c9e991;
}

.dialog-heading p {
  margin: 0;
  color: #7b5637;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.shop-grid.three-items {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 720px;
  margin: 0 auto;
}

.shop-item {
  display: flex;
  min-width: 0;
  padding: 12px;
  cursor: pointer;
  align-items: center;
  flex-direction: column;
  background: #f5e2a7;
  border: 4px solid #8a5229;
  border-radius: 22px 15px 24px 13px;
  box-shadow: 0 5px 0 #63351c;
  text-align: center;
  transition: transform 130ms ease, filter 130ms ease;
}

.shop-item:nth-child(2n) {
  transform: rotate(0.8deg);
}

.shop-item:nth-child(3n) {
  transform: rotate(-0.7deg);
}

.shop-item:hover,
.shop-item:focus-visible {
  filter: brightness(1.04);
  outline: 4px solid #fff;
  transform: translateY(-4px) rotate(-1deg);
}

.shop-item.is-too-expensive {
  filter: grayscale(0.5) opacity(0.72);
}

.shop-item img {
  width: 100%;
  max-width: 145px;
  aspect-ratio: 1;
  object-fit: contain;
}

.shop-item span {
  display: flex;
  min-height: 47px;
  flex-direction: column;
}

.shop-item strong {
  font-size: 16px;
}

.shop-item small {
  color: #765236;
  font-size: 10px;
}

.shop-item > b {
  margin-top: 8px;
  padding: 6px 12px;
  color: #754400;
  background: var(--gold);
  border: 3px solid #ad6e0c;
  border-radius: 13px;
}

.help-card {
  max-width: 650px;
  margin: auto;
}

.warehouse-card {
  max-width: 680px;
  margin: auto;
}

.goods-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.goods-list > div {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 10px;
  background: #f2dfa6;
  border: 3px solid #865028;
  border-radius: 17px 12px 19px 10px;
}

.goods-list .goods-icon {
  width: 70px;
  height: 70px;
}

.goods-list span {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.goods-list small { color: #785236; font-size: 9px; }
.goods-list > div > strong { font-size: 25px; }

.warehouse-sell {
  display: block;
  min-width: 230px;
  margin: 18px auto 0;
}

.warehouse-sell:disabled {
  cursor: default;
  opacity: 0.52;
  filter: grayscale(0.6);
}

.help-list {
  display: grid;
  gap: 13px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.help-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: #f1dda2;
  border: 3px solid #8a5229;
  border-radius: 15px 12px 17px 10px;
}

.help-list b {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  color: #fff;
  background: var(--grass-dark);
  border: 3px solid #235720;
  border-radius: 50%;
  place-items: center;
  font-size: 19px;
}

.compact-heading {
  margin-bottom: 13px;
}

.dex-card {
  padding-bottom: 25px;
}

.dex-frame {
  position: relative;
  height: min(590px, 66svh);
  overflow: hidden;
  background: #e8ddba;
  border: 5px solid var(--wood-dark);
  border-radius: 17px 11px 19px 13px;
}

#dex-chart {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.dex-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #6a4a2e;
  background: #efe4bd;
}

.dex-empty span {
  width: 72px;
  height: 72px;
  color: #51301c;
}

.dex-empty strong {
  font-size: 28px;
}

.dex-empty[hidden],
#dex-chart[hidden] {
  display: none;
}

.welcome-dialog {
  width: min(720px, calc(100% - 28px));
}

.welcome-card {
  display: grid;
  grid-template-columns: minmax(150px, 250px) 1fr;
  align-items: center;
  gap: 15px;
  overflow: hidden;
}

.welcome-card img {
  width: 125%;
  margin: -20% 0 -20% -20%;
}

.welcome-card small {
  color: #9a5a22;
  letter-spacing: 0.16em;
}

.welcome-card h2 {
  margin: 0 0 7px;
  color: var(--grass-dark);
  font-size: clamp(43px, 7vw, 72px);
  line-height: 0.9;
  letter-spacing: -0.065em;
}

.welcome-card p {
  margin: 0 0 18px;
  color: #6e4c31;
  line-height: 1.35;
}

.start-button {
  padding: 12px 19px;
  cursor: pointer;
  color: #fff;
  background: var(--grass-dark);
  border: 4px solid #204f20;
  border-radius: 15px 11px 17px 9px;
  box-shadow: 0 5px 0 #204f20;
  font-weight: 900;
}

@keyframes cloud-drift {
  from {
    left: -12%;
  }
  to {
    left: 106%;
  }
}

@keyframes animal-idle {
  from {
    transform: translateY(0) rotate(-0.7deg);
  }
  to {
    transform: translateY(-4px) rotate(0.7deg);
  }
}

@keyframes animal-pop {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.18) rotate(-3deg);
  }
}

@keyframes animal-eat {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  50% {
    transform: translateY(5px) rotate(3deg);
  }
}

@keyframes hunger-alert {
  from {
    box-shadow: 0 2px 0 rgb(59 37 20 / 45%);
  }
  to {
    box-shadow: 0 0 0 4px rgb(231 80 53 / 55%);
  }
}

@keyframes coin-bubble {
  from {
    translate: 0 0;
  }
  to {
    translate: 0 -7px;
  }
}

@keyframes product-ready {
  from { translate: 0 0; }
  to { translate: 0 -5px; }
}

@keyframes reward-float {
  0% {
    opacity: 0;
    translate: 0 8px;
    scale: 0.8;
  }
  20% {
    opacity: 1;
    scale: 1.12;
  }
  100% {
    opacity: 0;
    translate: 0 -70px;
    scale: 1;
  }
}

@media (max-width: 1040px) {
  .top-hud {
    grid-template-columns: auto 1fr;
  }

  .token-actions {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .farm-logo {
    min-width: 220px;
  }

  .world-scroll {
    max-height: calc(100svh - 184px);
  }

  .farm-stage {
    width: 980px;
  }
}

@media (max-width: 720px) {
  body {
    background: linear-gradient(180deg, #8bd8ff 0 220px, #72b64b 100%);
    padding-bottom: 92px;
  }

  .top-hud {
    grid-template-columns: 1fr;
    gap: 9px;
    width: calc(100% - 14px);
    padding-top: 7px;
  }

  .farm-logo {
    min-width: 0;
    width: min(320px, calc(100% - 14px));
    margin: 0 auto;
  }

  .hud-stats {
    gap: 7px;
  }

  .stat-pill {
    min-width: 0;
    width: calc(33.333% - 5px);
    min-height: 49px;
    padding: 5px 9px 6px 5px;
  }

  .stat-pill > span:last-child {
    min-width: 0;
  }

  .stat-pill small {
    font-size: 8px;
    letter-spacing: 0.03em;
  }

  .coin-icon,
  .level-star,
  .water-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 19px;
  }

  .coin-icon .atlas-icon,
  .level-star .atlas-icon,
  .water-icon .goods-icon {
    width: 36px;
    height: 36px;
  }

  .stat-pill strong {
    font-size: 18px;
  }

  .token-actions {
    gap: 7px;
  }

  .hud-button {
    min-height: 40px;
    padding: 8px 13px;
    font-size: 11px;
  }

  .farm-shell {
    width: calc(100% - 8px);
    margin-bottom: 100px;
  }

  .world-scroll {
    max-height: 56svh;
    border-width: 5px;
    border-radius: 15px 12px 8px 16px;
  }

  .farm-stage {
    width: 820px;
  }

  .quest-board {
    width: 158px;
    min-height: 104px;
    padding: 11px 13px 10px;
  }

  .animal {
    --animal-size: 78px !important;
  }

  .farm-dock {
    position: fixed;
    z-index: 40;
    bottom: max(7px, env(safe-area-inset-bottom));
    left: 50%;
    gap: 4px;
    width: calc(100% - 12px);
    margin: 0;
    padding: 7px 5px 9px;
    border: 4px solid var(--wood-dark);
    border-radius: 18px 14px 20px 13px;
    box-shadow: 0 6px 0 #462414, 0 12px 24px rgb(42 24 13 / 28%);
    transform: translateX(-50%);
  }

  .farm-dock button {
    min-width: 0;
    flex: 1;
    padding: 5px;
    gap: 1px;
    flex-direction: column;
    font-size: 8px;
  }

  .farm-dock button span {
    font-size: 21px;
  }

  .farm-dock .dock-icon {
    width: 34px;
    height: 34px;
    padding: 0;
  }

  .map-station {
    min-width: 120px;
    padding: 4px 8px 5px 3px;
  }

  .map-station > .goods-icon {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .dialog-card {
    padding: 27px 16px 20px;
  }

  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shop-grid.three-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .goods-list {
    grid-template-columns: 1fr;
  }

  .welcome-card {
    grid-template-columns: 110px 1fr;
  }

  .welcome-card img {
    width: 150%;
    margin-left: -42%;
  }
}

@media (max-width: 460px) {
  .logo-copy strong {
    font-size: 23px;
  }

  .logo-copy small {
    font-size: 12px;
  }

  .farm-stage {
    width: 760px;
  }

  .shop-item {
    padding: 8px;
  }

  .shop-item img {
    max-width: 105px;
  }

  .welcome-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .welcome-card img {
    width: 155px;
    margin: -35px auto -20px;
  }
}

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