:root {
  --game-black: #171811;
  --game-black-soft: rgba(23, 24, 17, .94);
  --game-gold: #e5b52f;
  --game-gold-dark: #8d6715;
  --game-green: #2e7d42;
  --game-green-light: #67bd62;
  --game-blue: #3a9dd8;
  --game-red: #d85b4d;
  --game-white: #fff;
  --game-muted: #c8c8bb;
}

.minigame-document {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.minigame-page,
.minigame-page button,
.minigame-page a,
.minigame-page input {
  font-family: "Kanit", "Noto Sans Thai", sans-serif;
  letter-spacing: 0;
}

.minigame-page {
  min-width: 320px;
  margin: 0;
  overflow: hidden;
  color: var(--game-white);
  background: #193d22;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.minigame-site-header {
  display: none;
}

.minigame-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 720px;
  overflow: hidden;
  isolation: isolate;
  background: #568744;
}

.minigame-shell::before,
.minigame-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.minigame-shell::before {
  z-index: -2;
  background: transparent;
  transition: background-color 700ms ease;
}

.minigame-shell::after {
  z-index: 90;
  background: #0c170f;
  opacity: 0;
  transition: opacity 480ms ease;
}

.minigame-shell.time-dawn .farm-world::before { background: rgba(255, 177, 91, .12); }
.minigame-shell.time-evening .farm-world::before { background: rgba(184, 82, 35, .18); }
.minigame-shell.time-night .farm-world::before { background: rgba(8, 24, 49, .46); }
.minigame-shell.time-dawn .orchard-background { filter: brightness(.96) saturate(1.01) contrast(1.02); }
.minigame-shell.time-day .orchard-background { filter: brightness(1.015) saturate(1.055) contrast(1.025); }
.minigame-shell.time-evening .orchard-background { filter: brightness(.84) saturate(.98) contrast(1.03); }
.minigame-shell.time-night .orchard-background { filter: brightness(.58) saturate(.72); }
.minigame-shell.sleep-transition::after {
  pointer-events: auto;
  opacity: .96;
}

.asset-picture {
  display: contents;
}

.orchard-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  image-rendering: auto;
  transform: translateZ(0);
  pointer-events: none;
  transition: filter 700ms ease;
}

.game-panel,
.utility-button,
.action-dock,
.formula-tray,
.feedback-panel,
.plot-panel,
.harvest-preview {
  border: 2px solid var(--game-gold-dark);
  border-radius: 8px;
  color: var(--game-white);
  background: var(--game-black-soft);
  box-shadow: 0 8px 24px rgba(5, 10, 5, .35);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #fff1ae;
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(.8);
  opacity: .48;
}

.player-hud {
  position: fixed;
  z-index: 30;
  top: 16px;
  left: 18px;
  width: 350px;
  min-height: 136px;
  padding: 10px 12px 10px 126px;
}

.player-hud picture {
  position: absolute;
  left: -8px;
  bottom: -7px;
  width: 134px;
  height: 150px;
  overflow: hidden;
  border: 3px solid var(--game-gold);
  border-radius: 50%;
  background: #2a3b25;
}

.player-hud picture img {
  width: 100%;
  height: 145%;
  object-fit: cover;
  object-position: 50% 8%;
}

.player-hud-copy {
  display: grid;
  gap: 5px;
}

.player-hud-copy > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-hud-copy > div:first-child > strong {
  font-size: 19px;
}

.level-shield {
  width: 42px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid var(--game-gold);
  border-radius: 6px;
  color: var(--game-gold);
  font-size: 19px;
  font-weight: 700;
}

.hud-resource {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 5px;
}

.hud-resource > span {
  color: var(--game-gold);
  font-size: 19px;
}

.hud-resource i,
.xp-meter {
  height: 10px;
  overflow: hidden;
  border: 1px solid #6e735f;
  border-radius: 3px;
  background: #25271e;
}

.hud-resource i b,
.xp-meter span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--game-blue);
  transition: width 200ms ease;
}

.hud-resource strong {
  font-size: 12px;
}

.coin-resource {
  grid-template-columns: 22px auto 1fr;
}

.coin-resource strong {
  color: var(--game-gold);
  font-size: 17px;
}

.coin-resource small,
.player-hud-copy > small {
  color: var(--game-muted);
  font-size: 8px;
}

.xp-meter {
  height: 5px;
}

.xp-meter span {
  background: var(--game-gold);
}

.time-hud {
  position: fixed;
  z-index: 30;
  top: 18px;
  left: 50%;
  width: 430px;
  height: 66px;
  padding: 8px 18px;
  display: grid;
  grid-template-columns: 44px 1fr 90px 1.2fr;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  text-align: center;
}

.time-hud > * + * {
  border-left: 1px solid #766937;
}

.time-hud .sun-icon {
  color: var(--game-gold);
  font-size: 26px;
  transition: color 300ms ease, transform 300ms ease;
}

.time-evening .time-hud .sun-icon { color: #ffb34c; transform: translateY(2px); }
.time-night .time-hud .sun-icon { color: #d9e7ff; transform: rotate(-8deg); }

.time-hud div {
  display: grid;
}

.time-hud small {
  color: var(--game-muted);
  font-size: 8px;
}

.time-hud strong,
.time-hud time {
  font-size: 16px;
  font-weight: 600;
}

.active-mission-hud {
  position: fixed;
  z-index: 31;
  top: 92px;
  left: 50%;
  width: 430px;
  min-height: 54px;
  padding: 7px 12px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: 1fr 5px;
  column-gap: 9px;
  row-gap: 5px;
  align-items: center;
  transform: translateX(-50%);
  color: var(--game-white);
  cursor: pointer;
  text-align: left;
}

.active-mission-icon {
  grid-row: 1 / 3;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid #f5cd4f;
  border-radius: 50%;
  color: #1e3b25;
  background: #f8d760;
  box-shadow: 0 3px 8px rgba(5, 10, 5, .28);
  font-size: 17px;
  font-weight: 800;
}

.active-mission-copy {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 0 8px;
}

.active-mission-copy small {
  grid-column: 1;
  color: #f5d875;
  font-size: 8px;
}

.active-mission-copy strong {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-mission-copy > span {
  grid-column: 1 / -1;
  color: #dfe8dc;
  font-size: 8px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.active-mission-hud > i {
  grid-column: 2;
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, .14);
}

.active-mission-hud > i b {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #69bd63, #f1cc45);
  transition: width 180ms ease;
}

.active-mission-hud.mission-changed {
  animation: active-mission-arrive 480ms cubic-bezier(.2, .78, .22, 1);
}

@keyframes active-mission-arrive {
  0% { transform: translateX(-50%) translateY(-6px) scale(.98); filter: brightness(1); }
  45% { transform: translateX(-50%) translateY(0) scale(1.015); filter: brightness(1.18); }
  100% { transform: translateX(-50%) translateY(0) scale(1); filter: brightness(1); }
}

.utility-hud {
  position: fixed;
  z-index: 35;
  top: 16px;
  right: 18px;
  display: flex;
  gap: 8px;
}

.utility-button {
  position: relative;
  width: 70px;
  height: 68px;
  padding: 6px;
  display: grid;
  place-items: center;
  color: var(--game-white);
  cursor: pointer;
  text-decoration: none;
}

.utility-button > span {
  color: var(--game-gold);
  font-size: 25px;
  line-height: 1;
}

.utility-button small {
  font-size: 9px;
}

.utility-button i {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--game-red);
  font-size: 9px;
  font-style: normal;
}

.utility-button.active {
  color: #fff7d2;
  box-shadow: inset 0 0 0 1px rgba(255, 224, 116, .65), 0 7px 18px rgba(7, 12, 6, .28);
}

.utility-button.pending {
  color: #fff1b7;
  box-shadow: inset 0 0 0 1px rgba(255, 224, 116, .42);
  animation: audio-ready-pulse 1.3s ease-in-out infinite;
}

.farm-world {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: max(100vw, 177.68vh);
  height: max(100vh, 56.28vw);
  transform: translate(calc(-50% + var(--farm-pan-x, 0%)), -50%);
  pointer-events: auto;
  transition: transform 360ms cubic-bezier(.22, .78, .25, 1);
}

.farm-world::before {
  content: "";
  position: absolute;
  z-index: 20;
  inset: 0;
  background: transparent;
  pointer-events: none;
  transition: background-color 700ms ease;
}

.farm-grid {
  position: absolute;
  z-index: 4;
  inset: 0;
}

.farm-plot {
  position: absolute;
  z-index: 4;
  display: block;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.farm-plot::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
  transition: background-color 140ms ease, filter 140ms ease;
}

.farm-plot:hover::after,
.farm-plot.selected::after {
  background: rgba(246, 201, 65, .08);
  filter: drop-shadow(0 0 7px rgba(255, 224, 119, .48));
}

.tool-paint-mode .farm-plot.selected::after {
  background: rgba(255, 226, 112, .14);
  filter: drop-shadow(0 0 10px rgba(255, 225, 111, .6));
}

.farm-plot::after {
  z-index: 1;
  pointer-events: none;
}

.plot-palm::after,
.plot-rubber::after,
.plot-durian::after { clip-path: polygon(50% 1%, 99% 47%, 50% 99%, 1% 53%); }

.tile-grid {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: block;
  touch-action: none;
}

.farm-tile {
  position: absolute;
  z-index: var(--tile-depth, 2);
  top: var(--tile-y, 50%);
  left: var(--tile-x, 50%);
  width: 20%;
  height: 25%;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transform: translate(-50%, -50%) scale(var(--tile-scale, 1));
  transition: transform 160ms ease, filter 160ms ease;
}

.farm-tile::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 5% 2%;
  clip-path: polygon(50% 0, 100% 42%, 50% 100%, 0 58%);
  border-radius: 8px;
  background: transparent;
  box-shadow: inset 0 0 0 1px transparent;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.farm-tile:hover,
.farm-tile.drag-preview,
.farm-tile.selected { z-index: 20; }

.farm-tile:hover::before,
.farm-tile.drag-preview::before,
.farm-tile.selected::before {
  z-index: 20;
  background: rgba(255, 231, 149, .12);
  box-shadow: inset 0 0 0 2px rgba(255, 231, 149, .72), 0 0 16px rgba(229, 181, 47, .2);
}

.farm-plot.selected .farm-tile:not(.selected):not(.drag-preview)::before {
  background: rgba(255, 240, 181, .035);
  box-shadow: inset 0 0 0 1px rgba(255, 233, 151, .28);
}

.farm-tile:nth-child(-n+3) { --tile-depth: 3; --perspective-scale: .84; }
.farm-tile:nth-child(n+4):nth-child(-n+6) { --tile-depth: 5; --perspective-scale: .98; }
.farm-tile:nth-child(n+7) { --tile-depth: 7; --perspective-scale: 1.1; }

/* วางฐานต้นตรงกลางช่องดินและดึงแถวริมเข้าด้านใน เพื่อให้ทรงพุ่มเก้าต้นรวมเป็นแปลงเดียวกัน */
.plot-palm .farm-tile:nth-child(1) { --tile-x: 50%; --tile-y: 26%; }
.plot-palm .farm-tile:nth-child(2) { --tile-x: 63.5%; --tile-y: 36.5%; }
.plot-palm .farm-tile:nth-child(3) { --tile-x: 77%; --tile-y: 47%; }
.plot-palm .farm-tile:nth-child(4) { --tile-x: 36.5%; --tile-y: 39%; }
.plot-palm .farm-tile:nth-child(5) { --tile-x: 50%; --tile-y: 49.5%; }
.plot-palm .farm-tile:nth-child(6) { --tile-x: 63.5%; --tile-y: 60%; }
.plot-palm .farm-tile:nth-child(7) { --tile-x: 23%; --tile-y: 52%; }
.plot-palm .farm-tile:nth-child(8) { --tile-x: 36.5%; --tile-y: 62.5%; }
.plot-palm .farm-tile:nth-child(9) { --tile-x: 50%; --tile-y: 73%; }

.plot-rubber .farm-tile:nth-child(1) { --tile-x: 23%; --tile-y: 43%; }
.plot-rubber .farm-tile:nth-child(2) { --tile-x: 36.5%; --tile-y: 32.5%; }
.plot-rubber .farm-tile:nth-child(3) { --tile-x: 50%; --tile-y: 22%; }
.plot-rubber .farm-tile:nth-child(4) { --tile-x: 36.5%; --tile-y: 56%; }
.plot-rubber .farm-tile:nth-child(5) { --tile-x: 50%; --tile-y: 45.5%; }
.plot-rubber .farm-tile:nth-child(6) { --tile-x: 63.5%; --tile-y: 35%; }
.plot-rubber .farm-tile:nth-child(7) { --tile-x: 50%; --tile-y: 69%; }
.plot-rubber .farm-tile:nth-child(8) { --tile-x: 63.5%; --tile-y: 58.5%; }
.plot-rubber .farm-tile:nth-child(9) { --tile-x: 77%; --tile-y: 48%; }

.plot-durian .farm-tile:nth-child(1) { --tile-x: 50%; --tile-y: 26%; }
.plot-durian .farm-tile:nth-child(2) { --tile-x: 63.5%; --tile-y: 36.5%; }
.plot-durian .farm-tile:nth-child(3) { --tile-x: 77%; --tile-y: 47%; }
.plot-durian .farm-tile:nth-child(4) { --tile-x: 36.5%; --tile-y: 39%; }
.plot-durian .farm-tile:nth-child(5) { --tile-x: 50%; --tile-y: 49.5%; }
.plot-durian .farm-tile:nth-child(6) { --tile-x: 63.5%; --tile-y: 60%; }
.plot-durian .farm-tile:nth-child(7) { --tile-x: 23%; --tile-y: 52%; }
.plot-durian .farm-tile:nth-child(8) { --tile-x: 36.5%; --tile-y: 62.5%; }
.plot-durian .farm-tile:nth-child(9) { --tile-x: 50%; --tile-y: 73%; }

.tool-paint-mode .farm-tile {
  cursor: crosshair;
}

.tool-paint-mode .farm-tile.drag-preview::before {
  background: rgba(255, 236, 166, .2);
  box-shadow: inset 0 0 0 3px #ffe58a, 0 0 20px rgba(255, 214, 82, .46);
}

.tool-paint-mode .farm-tile.drag-preview { --tile-scale: 1.035; }

.farm-tile.being-worked {
  --tile-scale: 1.055;
  filter: brightness(1.08);
}

.farm-tile.being-worked::before {
  box-shadow: inset 0 0 0 3px rgba(255, 239, 174, .72), 0 0 20px rgba(229, 181, 47, .48);
}

.tile-soil {
  position: absolute;
  z-index: 1;
  inset: 8% 3%;
  clip-path: polygon(50% 0, 100% 42%, 50% 100%, 0 58%);
  border-radius: 8px;
  opacity: 0;
}

.lifecycle-prepared .tile-soil {
  opacity: 1;
  background:
    linear-gradient(rgba(65, 43, 22, .42), rgba(45, 30, 17, .5)),
    repeating-linear-gradient(155deg, rgba(46, 30, 16, .68) 0 3px, rgba(108, 72, 35, .5) 4px 7px);
  box-shadow: inset 0 0 0 1px rgba(181, 135, 75, .2), 0 4px 6px rgba(42, 28, 14, .14);
}

.tile-crop {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 98%;
  aspect-ratio: 1;
  transform: translate(-50%, -100%) scale(var(--perspective-scale, 1));
  transform-origin: 50% 100%;
  pointer-events: none;
  animation: crop-settle 280ms cubic-bezier(.2, .78, .22, 1) both;
}

.crop-response {
  position: absolute;
  z-index: 1;
  inset: 0;
  transform-origin: 50% 96%;
  will-change: transform;
}

.crop-response::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 18%;
  right: 12%;
  width: 24%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 28% 28%, rgba(255, 246, 151, .95) 0 5%, transparent 7%),
    radial-gradient(circle at 72% 44%, rgba(236, 255, 176, .9) 0 4%, transparent 6%),
    radial-gradient(circle at 46% 78%, rgba(255, 230, 112, .82) 0 3.5%, transparent 5.5%);
  opacity: 0;
  transform: scale(.55) rotate(-8deg);
  pointer-events: none;
}

.tile-crop::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: 1.5%;
  width: 46%;
  height: 10%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(18, 22, 10, .38);
  filter: blur(2px);
  opacity: .82;
}

.crop-art {
  position: absolute;
  z-index: 1;
  inset: 0;
  background-image: image-set(
    url("../minigame/crop-stages.webp") type("image/webp"),
    url("../minigame/crop-stages.png") type("image/png")
  );
  background-repeat: no-repeat;
  background-size: 400% 300%;
  filter: saturate(1.08) brightness(1.035) contrast(1.025) drop-shadow(0 5px 4px rgba(10, 14, 6, .28));
  transform-origin: 50% 96%;
  will-change: transform;
  animation: crop-wind-rubber var(--wind-duration, 5.8s) ease-in-out var(--wind-delay, 0s) infinite;
}

.farm-tile[data-crop-id="palm"] .crop-art {
  animation-name: crop-wind-palm;
}

.farm-tile[data-crop-id="durian"] .crop-art {
  animation-name: crop-wind-durian;
}

/* ทุเรียนใช้ภาพแยกทุกระยะ เพราะทรงพุ่มเดิมล้ำขอบ atlas และเกิดเศษใบจากช่องข้างเคียง */
.farm-tile[data-crop-id="durian"][data-stage="0"] .tile-crop {
  width: 84%;
}

.farm-tile[data-crop-id="durian"][data-stage="1"] .tile-crop {
  width: 108%;
}

.farm-tile[data-crop-id="durian"][data-stage="2"] .tile-crop {
  width: 100%;
}

.durian-stage-art {
  background-repeat: no-repeat !important;
  background-position: center bottom !important;
  background-size: contain !important;
}

.durian-stage-0-art {
  background-image: image-set(
    url("../minigame/durian-stage-0-v3.webp?v=1") type("image/webp"),
    url("../minigame/durian-stage-0-v3.png?v=1") type("image/png")
  ) !important;
}

.durian-stage-1-art {
  background-image: image-set(
    url("../minigame/durian-stage-1-v3.webp?v=1") type("image/webp"),
    url("../minigame/durian-stage-1-v3.png?v=1") type("image/png")
  ) !important;
}

.durian-stage-2-art {
  background-image: image-set(
    url("../minigame/durian-flower-stage-v2.webp?v=3") type("image/webp"),
    url("../minigame/durian-flower-stage-v2.png?v=3") type("image/png")
  ) !important;
}

.durian-stage-3-art {
  background-image: image-set(
    url("../minigame/durian-stage-3-v3.webp?v=1") type("image/webp"),
    url("../minigame/durian-stage-3-v3.png?v=1") type("image/png")
  ) !important;
}

.farm-tile.crop-reacting .crop-response {
  animation: crop-touch-response 680ms cubic-bezier(.22, .72, .2, 1) both;
}

.farm-tile.crop-reacting .crop-response::after {
  animation: crop-touch-sparkle 680ms ease-out both;
}

.farm-tile.crop-reacting .crop-art {
  filter: saturate(1.13) brightness(1.055) contrast(1.02) drop-shadow(0 6px 5px rgba(10, 14, 6, .31));
}

.farm-tile:nth-child(1) { --wind-duration: 5.3s; --wind-delay: -1.4s; }
.farm-tile:nth-child(2) { --wind-duration: 5.9s; --wind-delay: -3.8s; }
.farm-tile:nth-child(3) { --wind-duration: 4.8s; --wind-delay: -.7s; }
.farm-tile:nth-child(4) { --wind-duration: 5.6s; --wind-delay: -4.1s; }
.farm-tile:nth-child(5) { --wind-duration: 5.1s; --wind-delay: -2.6s; }
.farm-tile:nth-child(6) { --wind-duration: 6.1s; --wind-delay: -1.9s; }
.farm-tile:nth-child(7) { --wind-duration: 4.9s; --wind-delay: -3.3s; }
.farm-tile:nth-child(8) { --wind-duration: 5.7s; --wind-delay: -.4s; }
.farm-tile:nth-child(9) { --wind-duration: 5.4s; --wind-delay: -4.6s; }

.lifecycle-planted .tile-crop { width: 56%; }
.lifecycle-growing .tile-crop { width: 80%; }
.lifecycle-mature .tile-crop,
.lifecycle-harvest-ready .tile-crop { width: 108%; }

.farm-tile[data-crop-id="durian"].lifecycle-mature .tile-crop,
.farm-tile[data-crop-id="durian"].lifecycle-harvest-ready .tile-crop { width: 98%; }

.farm-tile[data-crop-id="palm"].lifecycle-mature .tile-crop,
.farm-tile[data-crop-id="palm"].lifecycle-harvest-ready .tile-crop { width: 88%; }

.farm-tile[data-crop-id="palm"][data-stage="2"] .crop-art,
.farm-tile[data-crop-id="palm"][data-stage="3"] .crop-art { left: 3.5%; right: -3.5%; }

.farm-tile[data-crop-id="durian"][data-stage="3"] .crop-art { inset: 0; }

.farm-tile > i {
  position: absolute;
  z-index: 5;
  top: 2px;
  right: 3px;
  color: #ffe27a;
  font-size: 9px;
  font-style: normal;
}

.farm-plot.harvest-ready::after {
  animation: ready-pulse 1.4s ease-in-out infinite;
}

.farm-plot small {
  position: absolute;
  left: 50%;
  bottom: 2%;
  z-index: 8;
  min-width: 110px;
  padding: 4px 8px;
  transform: translateX(-50%);
  border: 1px solid var(--game-gold-dark);
  border-radius: 5px;
  color: #fff;
  background: rgba(23, 24, 17, .86);
  font-size: 9px;
  text-align: center;
}

.plot-palm {
  top: 39.3%;
  left: 23.8%;
  width: 27.6%;
  height: 31.4%;
}

.plot-rubber {
  top: 21.3%;
  left: 36.9%;
  width: 26.2%;
  height: 27.4%;
}

.plot-durian {
  top: 39.3%;
  right: 23.8%;
  width: 27.6%;
  height: 31.4%;
}

.plot-crop,
.plot-mini-crop,
.crop-preview {
  display: block;
  background-image: image-set(
    url("../minigame/crop-stages.webp") type("image/webp"),
    url("../minigame/crop-stages.png") type("image/png")
  );
  background-repeat: no-repeat;
  background-size: 400% 300%;
}

.plot-crop {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 9%;
  width: 54%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  filter: drop-shadow(0 9px 8px rgba(10, 14, 6, .28));
  transition: background-position 240ms ease, transform 200ms ease;
}

.plot-palm .plot-crop { width: 49%; }
.plot-rubber .plot-crop { width: 46%; }
.plot-durian .plot-crop { width: 51%; }
.farm-plot:hover .plot-crop { transform: translateX(-50%) translateY(-4px); }

.farmer-character {
  position: absolute;
  z-index: 14;
  top: 49%;
  left: 50%;
  width: 126px;
  height: 160px;
  transform: translate(-50%, -50%);
  --facing-scale: 1;
  --walk-duration: 260ms;
  pointer-events: none;
  will-change: top, left;
  transition:
    top var(--walk-duration) cubic-bezier(.4, 0, .2, 1),
    left var(--walk-duration) cubic-bezier(.4, 0, .2, 1);
}

.farmer-character[data-facing="left"] { --facing-scale: -1; }

.farmer-character::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: 2px;
  width: 44%;
  height: 9px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(10, 15, 7, .5) 0 42%, rgba(10, 15, 7, .18) 64%, transparent 76%);
  filter: blur(1.5px);
  opacity: .76;
}

.farmer-sprite {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 0;
  width: 126px;
  height: 168px;
  transform: translateX(-50%) scaleX(var(--facing-scale));
  transform-origin: 50% 100%;
  background-image: image-set(
    url("../minigame/khunsuek-mascot-production-walk-v5.webp") type("image/webp"),
    url("../minigame/khunsuek-mascot-production-walk-v5.png") type("image/png")
  );
  background-repeat: no-repeat;
  background-size: 400% 200%;
  background-position: 100% 100%;
  filter: saturate(.97) brightness(.98) drop-shadow(0 5px 3px rgba(10, 12, 6, .26));
  backface-visibility: hidden;
  will-change: transform, background-position;
  pointer-events: none;
}

.farmer-character.instant { transition: none; }
.farmer-character.idle .farmer-sprite { background-position: 100% 100%; animation: mascot-idle 2.2s ease-in-out infinite; }
.farmer-character.walking .farmer-sprite {
  background-image: image-set(
    url("../minigame/khunsuek-mascot-production-walk-v5.webp") type("image/webp"),
    url("../minigame/khunsuek-mascot-production-walk-v5.png") type("image/png")
  );
  background-size: 400% 200%;
  animation: mascot-walk-loop .72s linear infinite, mascot-walk-body .72s ease-in-out infinite;
}
.farmer-character.walking::after { animation: mascot-shadow-step .36s ease-in-out infinite alternate; }
.farmer-character.actioning[data-sprite="farm"] .farmer-sprite {
  width: 126px;
  height: 176px;
  background-image: image-set(
    url("../minigame/khunsuek-mascot-production-farm-actions-v5.webp") type("image/webp"),
    url("../minigame/khunsuek-mascot-production-farm-actions-v5.png") type("image/png")
  );
  background-size: 400% 400%;
  background-position: 0 var(--action-y, 0);
  animation: mascot-action-frames var(--action-duration, .64s) steps(1, end) infinite,
    mascot-action-depth var(--action-depth-duration, .64s) ease-in-out infinite;
}

.farmer-character.actioning[data-sprite="secondary"] .farmer-sprite {
  width: 160px;
  height: 176px;
  background-image: image-set(
    url("../minigame/khunsuek-mascot-production-secondary-actions-v5.webp") type("image/webp"),
    url("../minigame/khunsuek-mascot-production-secondary-actions-v5.png") type("image/png")
  );
  background-size: 400% 400%;
  background-position: 0 var(--action-y, 0);
  animation: mascot-action-frames var(--action-duration, .68s) steps(1, end) infinite,
    mascot-action-depth var(--action-depth-duration, .68s) ease-in-out infinite;
}

.farmer-character.actioning[data-sprite="harvest"] .farmer-sprite {
  width: 128px;
  height: 176px;
  background-image: image-set(
    url("../minigame/khunsuek-mascot-production-harvest-v1.webp") type("image/webp"),
    url("../minigame/khunsuek-mascot-production-harvest-v1.png") type("image/png")
  );
  background-size: 400% 300%;
  background-position: 0 var(--action-y, 0);
  animation: mascot-action-frames var(--action-duration, .96s) steps(1, end) infinite,
    mascot-harvest-depth var(--action-depth-duration, .96s) ease-in-out infinite;
}

.farmer-character.action-rest .farmer-sprite { bottom: 3px; }

.farmer-character.action-plant .farmer-sprite,
.farmer-character.action-prepare .farmer-sprite { bottom: 0; }
.farmer-character.action-prepare { --action-duration: .62s; --action-depth-duration: .62s; }
.farmer-character.action-plant { --action-duration: .64s; --action-depth-duration: .64s; }
.farmer-character.action-inspect { --action-duration: .68s; --action-depth-duration: .68s; }
.farmer-character.action-water { --action-duration: .68s; --action-depth-duration: .68s; }
.farmer-character.action-fertilize { --action-duration: .66s; --action-depth-duration: .66s; }
.farmer-character.action-harvest { --action-duration: .96s; --action-depth-duration: .96s; }
.farmer-character.action-celebrate { --action-duration: .76s; --action-depth-duration: .76s; }
.farmer-character.action-rest { --action-duration: 1.2s; --action-depth-duration: 1.2s; }
.farmer-character.action-harvest::after { animation: mascot-harvest-shadow .46s ease-in-out infinite alternate; }

.farmer-character.direct-control {
  transition: none;
}

.plot-rubber > small {
  top: -3%;
  bottom: auto;
}

.touch-joystick {
  position: fixed;
  z-index: 48;
  left: max(14px, env(safe-area-inset-left));
  bottom: 318px;
  width: 96px;
  height: 96px;
  display: none;
  place-items: center;
  border: 2px solid rgba(255, 226, 126, .68);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(63, 78, 48, .68) 0 42%, rgba(20, 28, 19, .72) 44% 100%);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .08), 0 8px 18px rgba(8, 15, 8, .3);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.touch-joystick::before,
.touch-joystick::after {
  content: "";
  position: absolute;
  border-radius: 2px;
  background: rgba(255, 236, 164, .28);
  pointer-events: none;
}

.touch-joystick::before { width: 54px; height: 2px; }
.touch-joystick::after { width: 2px; height: 54px; }

.touch-joystick-knob {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  border: 2px solid #f5d978;
  border-radius: 50%;
  background: linear-gradient(145deg, #496f42, #203b27);
  box-shadow: inset 0 3px 5px rgba(255, 255, 255, .2), 0 5px 10px rgba(3, 8, 4, .35);
  transform: translate(var(--joystick-x, 0px), var(--joystick-y, 0px));
  transition: transform 90ms ease-out;
  pointer-events: none;
}

.touch-joystick.active .touch-joystick-knob {
  transition: none;
}

.reduce-game-motion .minigame-shell::before,
.reduce-game-motion .minigame-shell::after,
.reduce-game-motion .orchard-background,
.reduce-game-motion .time-hud .sun-icon {
  transition: none;
}

.action-queue-hud {
  position: absolute;
  z-index: 36;
  top: 18%;
  left: 50%;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  transform: translate(-50%, -10px);
  border: 1px solid var(--game-gold);
  border-radius: 6px;
  color: #fff;
  background: rgba(23, 24, 17, .94);
  font-size: 10px;
  visibility: hidden;
  opacity: 0;
  transition: transform 160ms ease, opacity 160ms ease, visibility 160ms ease;
}

.action-queue-hud.open {
  transform: translate(-50%, 0);
  visibility: visible;
  opacity: 1;
}

.decoration-layer {
  position: absolute;
  z-index: 9;
  inset: 0;
  pointer-events: none;
}

.decoration-layer.placing { z-index: 24; }
.decoration-layer.placing .placed-decoration { pointer-events: none; }
.decoration-layer.placing .decoration-slot { z-index: 2000; }

.decor-object,
.decoration-preview {
  display: block;
  filter:
    saturate(.94)
    brightness(.97)
    contrast(1.04)
    drop-shadow(-1px -1px 0 rgba(255, 235, 169, .12))
    drop-shadow(1px 8px 5px rgba(9, 14, 7, .34));
}

.decor-object img,
.decoration-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center bottom;
}

.placed-decoration {
  position: absolute;
  left: var(--decor-x);
  top: var(--decor-y);
  width: calc(52px + (var(--footprint-columns, 1) - 1) * 42px);
  height: calc(38px + (var(--footprint-rows, 1) - 1) * 24px);
  padding: 0;
  transform: translate(-50%, -70%);
  border: 0;
  background-color: transparent;
  pointer-events: auto;
  cursor: grab;
  transition: transform 180ms cubic-bezier(.22, .78, .25, 1), filter 180ms ease;
  isolation: isolate;
}

.placed-decoration::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: 2px;
  width: calc(72px * var(--shadow-scale, 1));
  height: calc(28px * var(--shadow-scale, 1));
  transform: translateX(-50%) rotate(-3deg);
  border: 1px solid rgba(255, 224, 119, .7);
  border-radius: 50%;
  background: rgba(255, 227, 126, .08);
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}

.placed-decoration::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: 5px;
  width: calc(54px + (var(--footprint-columns, 1) - 1) * 30px);
  height: calc(18px + (var(--footprint-rows, 1) - 1) * 8px);
  transform: translateX(-50%) skewX(-12deg);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(77, 104, 38, .55) 0 42%, rgba(52, 73, 29, .28) 62%, transparent 78%);
  filter: blur(.7px);
  opacity: .78;
  pointer-events: none;
}

.decor-object {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 7px;
  width: 128px;
  height: 88px;
  transform: translateX(-50%) scaleX(var(--decor-facing, 1)) scale(var(--decor-scale, 1));
  transform-origin: 50% 100%;
  transition: transform 180ms cubic-bezier(.22, .78, .25, 1), filter 180ms ease;
  pointer-events: none;
}

/* รักษาสัดส่วนจริงของของแต่งแต่ละชิ้น เพื่อให้โคม ป้าย ม้านั่ง และบ่อน้ำมีมิติที่สัมพันธ์กับพื้นสวน */
.placed-decoration[data-decoration-item="tropical-flowers"] .decor-object { width: 112px; height: 106px; }
.placed-decoration[data-decoration-item="warrior-lantern"] .decor-object { width: 78px; height: 126px; }
.placed-decoration[data-decoration-item="farm-bench"] .decor-object { width: 132px; height: 108px; }
.placed-decoration[data-decoration-item="khunsuek-sign"] .decor-object { width: 92px; height: 126px; }
.placed-decoration[data-decoration-item="flower-pergola"] .decor-object { width: 124px; height: 112px; }
.placed-decoration[data-decoration-item="bird-bath"] .decor-object { width: 96px; height: 108px; }
.placed-decoration[data-decoration-item="stone-path"] .decor-object { width: 112px; height: 78px; }
.placed-decoration[data-decoration-item="lotus-pond"] .decor-object { width: 140px; height: 100px; }
.placed-decoration[data-decoration-item="friendly-scarecrow"] .decor-object { width: 82px; height: 126px; }
.placed-decoration[data-decoration-item="fruit-cart"] .decor-object { width: 132px; height: 108px; }
.placed-decoration[data-decoration-item="bamboo-fence"] .decor-object { width: 140px; height: 94px; }
.placed-decoration[data-decoration-item="warrior-fountain"] .decor-object { width: 96px; height: 126px; }

.placed-decoration[data-decoration-item="stone-path"]::after,
.placed-decoration[data-decoration-item="lotus-pond"]::after { opacity: .44; }

.decor-contact-shadow {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 6px;
  width: calc(68px * var(--shadow-scale, 1));
  height: calc(17px * var(--shadow-scale, 1));
  transform: translateX(-50%) rotate(-5deg) skewX(-12deg);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(9, 16, 7, .48) 0 38%, rgba(9, 16, 7, .18) 62%, transparent 76%);
  filter: blur(2.4px);
  opacity: .84;
  pointer-events: none;
}

.placed-decoration:hover,
.placed-decoration:focus-visible,
.placed-decoration.moving {
  transform: translate(-50%, -70%);
}

.placed-decoration:hover .decor-object,
.placed-decoration:focus-visible .decor-object,
.placed-decoration.moving .decor-object {
  transform: translateX(-50%) scaleX(var(--decor-facing, 1)) scale(var(--decor-scale, 1));
  filter:
    saturate(.98)
    brightness(1.015)
    contrast(1.04)
    drop-shadow(-1px -1px 0 rgba(255, 235, 169, .14))
    drop-shadow(1px 8px 5px rgba(9, 14, 7, .36));
}

.placed-decoration:hover::before,
.placed-decoration:focus-visible::before,
.placed-decoration.moving::before {
  opacity: 1;
}

.decoration-slot {
  position: absolute;
  z-index: 30;
  left: var(--decor-x);
  top: var(--decor-y);
  width: 46px;
  height: 30px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid #9ff29f;
  clip-path: polygon(50% 0, 100% 46%, 50% 100%, 0 54%);
  color: #2a2515;
  background: rgba(163, 239, 153, .5);
  box-shadow: 0 7px 13px rgba(18, 20, 11, .22);
  pointer-events: auto;
  cursor: pointer;
  animation: decor-slot-pulse 1.15s ease-in-out infinite;
}

.decoration-slot span { font-size: 17px; line-height: 1; }
.decoration-slot.current { border-color: #fff0a8; background: rgba(255, 231, 135, .78); }
.decoration-slot.occupied { border-color: rgba(156, 119, 101, .45); background: rgba(119, 70, 57, .28); opacity: .22; animation: none; }

.decoration-editor {
  position: fixed;
  z-index: 47;
  left: 50%;
  bottom: 122px;
  min-height: 48px;
  padding: 6px 7px 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
  border: 1px solid #d8ad35;
  border-radius: 8px;
  color: #fff8d9;
  background: rgba(27, 34, 23, .95);
  box-shadow: 0 12px 30px rgba(7, 13, 6, .38);
}

.decoration-editor[hidden] { display: none; }
.decoration-editor > span { max-width: 190px; display: grid; line-height: 1.55; }
.decoration-editor strong { font-size: 11px; }
.decoration-editor small { color: #ced9c9; font-size: 7px; }
.decoration-editor button {
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 226, 132, .36);
  border-radius: 6px;
  color: #fff;
  background: #3b4f35;
  font: inherit;
  font-size: 9px;
  cursor: pointer;
}
.decoration-editor button:last-child { color: #22321f; background: #f3cc57; }
.decoration-editor button:disabled { opacity: .4; cursor: not-allowed; }

.plot-panel {
  position: fixed;
  z-index: 28;
  left: 18px;
  bottom: 18px;
  width: 302px;
  padding: 14px;
}

.plot-panel header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plot-mini-crop {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
}

.plot-panel header div {
  display: grid;
}

.plot-panel header strong {
  color: var(--game-gold);
  font-size: 17px;
}

.plot-panel header small,
.plot-panel > small {
  color: var(--game-muted);
  font-size: 8px;
}

.inspection-goal {
  margin-top: 8px;
  padding: 7px 8px;
  display: grid;
  gap: 1px;
  border-left: 3px solid #d8ad35;
  border-radius: 4px;
  color: #eaf3e8;
  background: rgba(255, 255, 255, .065);
}

.inspection-goal strong { color: #ffe28a; font-size: 9px; }
.inspection-goal span { font-size: 8px; line-height: 1.6; }

.plot-panel > p {
  margin: 6px 0;
  font-size: 12px;
}

.tile-selection-summary {
  margin: 5px 0 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--game-muted);
  font-size: 9px;
}

.tile-selection-summary strong { color: var(--game-gold); }

.tile-selection-summary button {
  padding: 3px 7px;
  border: 1px solid #75652f;
  border-radius: 4px;
  color: #fff;
  background: rgba(255, 255, 255, .06);
  font-size: 8px;
  cursor: pointer;
}

.growth-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}

.growth-row i,
.plot-stats i {
  height: 8px;
  overflow: hidden;
  border: 1px solid #6c6c5e;
  border-radius: 3px;
  background: #2a2b21;
}

.growth-row i b,
.plot-stats i b {
  width: 0;
  height: 100%;
  display: block;
  background: var(--game-green-light);
  transition: width 200ms ease;
}

.stage-progress {
  margin: 7px 0 9px;
  display: flex;
  gap: 5px;
}

.stage-progress span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid #6c6c5e;
  border-radius: 50%;
  color: #9d9f91;
  font-size: 9px;
}

.stage-progress span.active {
  border-color: var(--game-gold);
  color: var(--game-black);
  background: var(--game-gold);
}

.stage-progress span.complete {
  border-color: var(--game-green-light);
  color: #fff;
  background: var(--game-green);
}

.plot-stats {
  margin: 0;
  display: grid;
  gap: 4px;
}

.plot-stats > div {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 7px;
}

.plot-stats dt {
  font-size: 9px;
}

.plot-stats dd {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 34px;
  align-items: center;
  gap: 5px;
}

.plot-stats strong {
  font-size: 9px;
  text-align: right;
}

.plot-stats > div:nth-child(1) b { background: var(--game-blue); }
.plot-stats > div:nth-child(2) b { background: var(--game-gold); }
.plot-stats > div:nth-child(3) b { background: var(--game-green-light); }

.quality-stars {
  margin: 8px 0 4px;
  color: var(--game-gold);
  font-size: 22px;
  line-height: 1;
}

.simulated-label {
  display: block;
  margin-top: 5px;
  color: #9a9c8e !important;
}

.harvest-preview {
  position: fixed;
  z-index: 27;
  right: 18px;
  bottom: 150px;
  width: 210px;
  padding: 14px;
  display: grid;
  text-align: center;
}

.harvest-preview small {
  color: var(--game-muted);
  font-size: 9px;
}

.harvest-preview strong {
  margin: 5px 0;
  color: var(--game-gold);
  font-size: 22px;
}

.harvest-preview span {
  font-size: 11px;
}

.harvest-preview b {
  color: var(--game-gold);
  font-size: 18px;
}

.mentor-bubble {
  position: fixed;
  z-index: 25;
  right: 18px;
  bottom: 87px;
  width: 270px;
  padding: 9px 12px;
  border: 1px solid var(--game-gold-dark);
  border-radius: 7px;
  color: #263629;
  background: rgba(255, 255, 255, .94);
}

.mentor-bubble strong {
  color: var(--game-green);
  font-size: 10px;
}

.mentor-bubble p {
  margin: 2px 0 0;
  font-size: 9px;
}

.crop-switcher { display: none; }

.action-dock {
  position: fixed;
  z-index: 40;
  left: calc(50% + 15px);
  bottom: 14px;
  width: min(820px, calc(100vw - 700px));
  min-width: 650px;
  min-height: 94px;
  padding: 7px;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  transform: translateX(-50%);
}

.tool-button {
  min-width: 0;
  padding: 5px 6px;
  display: grid;
  place-items: center;
  border: 0;
  border-right: 1px solid #62572f;
  color: #fff;
  background: transparent;
  cursor: pointer;
  transition: background-color 140ms ease, transform 140ms ease, color 140ms ease;
}

.tool-button:hover:not(:disabled) {
  border-radius: 6px;
  background: rgba(255, 255, 255, .08);
  transform: translateY(-2px);
}

.tool-button.active-tool {
  position: relative;
  border: 2px solid #ffe06a;
  border-radius: 6px;
  color: #fff8d7;
  background: linear-gradient(180deg, rgba(255, 224, 106, .24), rgba(93, 71, 17, .34));
  box-shadow: inset 0 0 14px rgba(255, 233, 143, .2), 0 0 18px rgba(229, 181, 47, .34);
  transform: translateY(-3px);
}

.tool-button.active-tool::after {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-right: 6px solid transparent;
  border-bottom: 7px solid #ffe06a;
  border-left: 6px solid transparent;
}

.tool-button:nth-child(1) .tool-icon { color: #d9a65b; }
.tool-button:nth-child(2) .tool-icon { color: #80cf72; }
.tool-button:nth-child(3) .tool-icon { color: #f3cf55; }
.tool-button:nth-child(4) .tool-icon { color: #62c5ef; }
.tool-button:nth-child(5) .tool-icon { color: #ef9b68; }
.tool-button:nth-child(6) .tool-icon { color: #dccdff; }
.tool-button:nth-child(7) .tool-icon { color: #ffd25c; }
.tool-button:nth-child(8) .tool-icon { color: #ffb8cf; }

.tool-button:last-child {
  border-right: 0;
}

.tool-button.featured {
  border: 2px solid var(--game-gold);
  border-radius: 6px;
  background: rgba(229, 181, 47, .08);
}

.tool-icon {
  color: var(--game-gold);
  font-size: 29px;
  line-height: 1;
}

.water-tool {
  color: #55bbed;
}

.tool-button strong {
  font-size: 11px;
}

.tool-button small {
  color: var(--game-muted);
  font-size: 7px;
}

.tool-mode-hint {
  position: fixed;
  z-index: 44;
  left: calc(50% + 15px);
  bottom: 120px;
  width: min(520px, calc(100vw - 32px));
  min-height: 58px;
  padding: 8px 48px 8px 58px;
  display: flex;
  align-items: center;
  border: 2px solid #e5b52f;
  border-radius: 8px;
  color: #473713;
  background: #fff9df;
  box-shadow: 0 6px 0 rgba(90, 68, 18, .18), 0 16px 30px rgba(22, 30, 16, .28);
  font-family: "Mali", "Kanit", Tahoma, sans-serif;
  line-height: 1.55;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: break-word;
  transform: translateX(-50%);
}

.tool-mode-hint[hidden] { display: none; }

/* โหมดจัดสวนมีแถบควบคุมเฉพาะ จึงซ่อนคำใบ้เครื่องมือทั่วไปเพื่อไม่ให้ซ้อนกัน */
.minigame-shell.decoration-placement-mode .tool-mode-hint {
  display: none !important;
}

.tool-mode-icon {
  position: absolute;
  left: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff9cf;
  background: #4e874e;
  font-size: 19px;
}

.tool-mode-hint strong,
.tool-mode-hint small { display: block; }
.tool-mode-hint strong { color: #315e34; font-size: 14px; }
.tool-mode-hint small { margin-top: 1px; color: #6c5a2e; font-size: 10px; }

.tool-mode-hint button {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(72, 95, 56, .28);
  border-radius: 50%;
  color: #476c48;
  background: #fff;
  font: 700 22px/1 Tahoma, sans-serif;
  cursor: pointer;
}

.tool-mode-hint button:hover,
.tool-mode-hint button:focus-visible {
  color: #fff;
  background: #4e874e;
  outline: 3px solid rgba(255, 214, 82, .62);
  outline-offset: 2px;
}

.formula-tray {
  position: fixed;
  z-index: 45;
  left: 50%;
  bottom: 120px;
  width: min(780px, calc(100vw - 430px));
  padding: 10px;
  transform: translate(-50%, 24px);
  visibility: hidden;
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease, visibility 180ms ease;
}

.formula-tray.open {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
}

.formula-tray header,
.game-modal-sheet > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.formula-tray header div,
.game-modal-sheet > header div {
  display: grid;
}

.formula-tray header strong,
.game-modal-sheet h2 {
  color: var(--game-gold);
  font-size: 16px;
}

.formula-tray header span,
.game-modal-sheet header span {
  color: var(--game-muted);
  font-size: 8px;
}

.formula-tray header > button,
.icon-close {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--game-gold-dark);
  border-radius: 5px;
  color: #fff;
  background: #2a2b21;
  cursor: pointer;
}

.formula-options {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.formula-group {
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(222, 177, 51, .34);
  border-radius: 6px;
  background: rgba(22, 28, 18, .62);
}

.formula-group > header {
  margin-bottom: 6px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 6px;
}

.formula-group > header strong { color: #ffe28a; font-size: 11px; }
.formula-group > header small { color: var(--game-muted); font-size: 7px; text-align: right; }

.formula-group > div {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-color: var(--game-gold-dark) #27281f;
}

.formula-option {
  width: 106px;
  min-width: 106px;
  min-height: 126px;
  padding: 7px;
  display: grid;
  place-items: center;
  border: 1px solid #62572f;
  border-radius: 6px;
  color: #fff;
  background: #24261d;
  cursor: pointer;
}

.formula-option:hover,
.formula-option:focus-visible {
  border-color: var(--game-gold);
}

.formula-option img {
  width: 68px;
  height: 76px;
  object-fit: contain;
}

.formula-option span {
  min-width: 0;
  display: grid;
  text-align: center;
}

.formula-option span b {
  justify-self: center;
  margin-bottom: 2px;
  padding: 1px 5px;
  border-radius: 3px;
  color: #dcebd5;
  background: #3f5539;
  font-size: 7px;
  line-height: 1.55;
}

.formula-option[data-product-category="organic"] span b {
  color: #fff0b5;
  background: #6a4f22;
}

.formula-option strong {
  color: var(--game-gold);
  font-size: 12px;
}

.formula-option em {
  justify-self: center;
  margin: 2px 0;
  padding: 1px 5px;
  border-radius: 3px;
  color: #d1d5cc;
  background: #393b31;
  font-size: 7px;
  font-style: normal;
}

.formula-option.fit-ideal em { color: #bdf0c5; background: #245c32; }
.formula-option.fit-close em { color: #ffe7a2; background: #67551f; }

.formula-option small {
  overflow: hidden;
  color: var(--game-muted);
  font-size: 7px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.feedback-panel {
  position: fixed;
  z-index: 48;
  right: 18px;
  bottom: 86px;
  width: 440px;
  padding: 12px;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 10px;
  transform: translateY(20px);
  visibility: hidden;
  opacity: 0;
}

.feedback-panel.open {
  transform: translateY(0);
  visibility: visible;
  opacity: 1;
}

.feedback-panel > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--game-green);
  font-size: 20px;
  font-weight: 700;
}

.feedback-panel div {
  display: grid;
}

.feedback-panel strong {
  color: var(--game-gold);
  font-size: 12px;
}

.feedback-panel p {
  margin: 1px 0;
  font-size: 9px;
}

.feedback-panel small {
  color: var(--game-muted);
  font-size: 7px;
}

.feedback-panel button,
.primary-button,
.secondary-button,
.onboarding-actions button,
.daily-mission-item button,
.decoration-item button {
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid var(--game-gold-dark);
  border-radius: 6px;
  color: #fff;
  background: var(--game-green);
  cursor: pointer;
  font-weight: 600;
}

.secondary-button {
  color: var(--game-gold);
  background: #25271e;
}

.crop-picker,
.completion-panel,
.game-modal {
  position: fixed;
  z-index: 80;
  inset: 0;
  padding: 18px;
  display: grid;
  place-items: center;
  background: rgba(9, 19, 11, .74);
  backdrop-filter: blur(8px);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.crop-picker.closed,
.completion-panel:not(.open),
.game-modal:not(.open) {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.picker-sheet,
.completion-sheet,
.game-modal-sheet {
  width: min(780px, calc(100vw - 36px));
  max-height: calc(100dvh - 36px);
  padding: 22px;
  overflow-y: auto;
  border: 2px solid var(--game-gold-dark);
  border-radius: 8px;
  color: #263128;
  background: #fff;
  box-shadow: 0 18px 55px rgba(3, 10, 5, .48);
}

.picker-sheet {
  text-align: center;
}

.picker-sheet > img {
  width: 190px;
  height: 68px;
  object-fit: contain;
}

.picker-sheet h1,
.completion-sheet h2 {
  margin: 2px 0;
  color: #173d27;
  font-size: 27px;
}

.picker-sheet > p,
.picker-sheet > small,
.game-modal-sheet > p {
  color: #5c665e;
}

.picker-player-summary {
  margin: 10px 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
}

.picker-player-summary span {
  padding: 4px 8px;
  border: 1px solid #b8c9ba;
  border-radius: 5px;
  color: #245a37;
  background: #f6faf6;
  font-size: 9px;
}

.crop-options {
  margin: 12px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.crop-option {
  min-height: 210px;
  padding: 10px;
  display: grid;
  place-items: center;
  border: 1px solid #adbdaf;
  border-radius: 7px;
  color: #203d2a;
  background: #f7faf7;
  cursor: pointer;
}

.crop-option:hover {
  border-color: var(--game-gold-dark);
  box-shadow: 0 8px 20px rgba(24, 72, 38, .12);
}

.crop-preview {
  width: 125px;
  height: 115px;
}

.crop-option div {
  display: grid;
  gap: 2px;
}

.crop-option strong {
  font-size: 16px;
}

.crop-option span,
.crop-option small {
  color: #5e685f;
  font-size: 8px;
}

.game-modal-sheet > header {
  padding-bottom: 10px;
  border-bottom: 1px solid #d9dfd9;
}

.game-modal-sheet h2 {
  margin: 0;
  color: #173d27;
  font-size: 22px;
}

.icon-close {
  color: #173d27;
  background: #fff;
}

.daily-mission-list,
.decoration-list {
  display: grid;
  gap: 8px;
}

.daily-mission-item,
.decoration-item {
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #c8d3c9;
  border-radius: 7px;
  background: #f8faf8;
}

.daily-mission-item div {
  display: grid;
}

.daily-mission-item span,
.daily-mission-item small {
  color: #687169;
  font-size: 9px;
}

.daily-mission-item i {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: #dce5dc;
}

.daily-mission-item i b {
  height: 100%;
  display: block;
  background: var(--game-green);
}

.daily-mission-item.continuous-mission {
  border-color: #d5a91f;
  background: linear-gradient(135deg, #fff9dc, #f5fbef);
}

.continuous-mission i b { background: linear-gradient(90deg, #4a9f53, #d6a914); }

.mission-auto-reward {
  min-width: 78px;
  padding: 8px 10px;
  border: 1px solid #d5a91f;
  border-radius: 6px;
  color: #5d4811 !important;
  background: #fff4bd;
  text-align: center;
  font-size: 10px !important;
  font-weight: 700;
}

.decoration-sheet {
  width: min(920px, calc(100vw - 36px));
}

.decoration-list {
  grid-template-columns: repeat(2, 1fr);
}

.decoration-item {
  grid-template-columns: 95px 1fr auto;
}

.decoration-preview {
  width: 92px;
  height: 76px;
  transform: scale(var(--preview-scale, 1));
  transform-origin: 50% 75%;
}

.decoration-item div {
  display: grid;
}

.decoration-item div small {
  color: var(--game-gold-dark);
  font-size: 8px;
}

.decoration-item div strong {
  color: #173d27;
  font-size: 13px;
}

.decoration-item div span {
  color: #687169;
  font-size: 8px;
}

.decoration-item .decoration-actions {
  display: grid;
  gap: 5px;
}

.decoration-item .decoration-buy-button {
  color: #245a37;
  background: #fff;
}

.decoration-item.locked {
  opacity: .65;
}

.product-catalog-sheet {
  width: min(1040px, calc(100vw - 36px));
}

.product-catalog-groups > section + section {
  margin-top: 18px;
}

.product-catalog-groups h3 {
  margin: 0 0 7px;
  color: #173d27;
}

.product-catalog-groups section > div {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.product-catalog-groups article {
  min-width: 0;
  padding: 7px;
  display: grid;
  place-items: center;
  border: 1px solid #c8d3c9;
  border-radius: 6px;
  text-align: center;
}

.product-catalog-groups img {
  width: 76px;
  height: 86px;
  object-fit: contain;
}

.product-catalog-groups strong {
  color: #173d27;
  font-size: 11px;
}

.product-catalog-groups small {
  color: #687169;
  font-size: 7px;
}

.catalog-product-card {
  align-content: start;
  gap: 4px;
}

.catalog-fit {
  padding: 2px 5px;
  border-radius: 3px;
  color: #5d665e;
  background: #eef1ee;
  font-size: 7px;
}

.catalog-fit.fit-ideal { color: #17652f; background: #dff2e4; }
.catalog-fit.fit-close { color: #795d11; background: #fff2c9; }
.catalog-fit.fit-blocked { color: #8a332c; background: #fbe1dd; }

.catalog-product-card button {
  width: 100%;
  min-height: 32px;
  margin-top: auto;
  padding: 5px 6px;
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: #2f7d42;
  font: inherit;
  font-size: 8px;
  cursor: pointer;
}

.catalog-product-card button:disabled {
  color: #777;
  background: #d8ddda;
  cursor: not-allowed;
}

.onboarding-sheet {
  width: min(470px, calc(100vw - 36px));
  text-align: center;
}

.onboarding-sheet picture img {
  width: 150px;
  height: 190px;
  object-fit: contain;
}

.onboarding-sheet > span {
  color: var(--game-gold-dark);
  font-size: 9px;
}

.onboarding-sheet h2 {
  margin: 2px 0;
  color: #173d27;
}

.onboarding-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.onboarding-actions button:first-child {
  color: #173d27;
  background: #fff;
}

.help-sheet {
  width: min(560px, calc(100vw - 36px));
}

.help-sheet ol {
  padding-left: 23px;
}

.help-sheet label {
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.audio-settings {
  margin: 12px 0;
  padding: 10px 12px 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
  border: 1px solid rgba(196, 150, 45, .46);
  border-radius: 6px;
}

.audio-settings legend {
  padding: 0 6px;
  color: var(--game-gold);
  font-weight: 700;
}

.help-sheet .audio-settings label {
  margin: 0;
  line-height: 1.55;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.audio-settings input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: #83b65e;
}

.help-sheet > button {
  width: 100%;
  margin-top: 7px;
}

.danger-outline {
  min-height: 40px;
  border: 1px solid #a83931;
  border-radius: 6px;
  color: #a83931;
  background: #fff;
  cursor: pointer;
}

.completion-sheet {
  width: min(520px, calc(100vw - 36px));
  text-align: center;
}

.completion-star {
  color: var(--game-gold);
  font-size: 58px;
  line-height: 1;
}

.completion-sheet > strong {
  display: block;
  margin: 10px 0;
  color: var(--game-gold-dark);
  font-size: 30px;
}

.completion-rewards {
  margin: 10px 0;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.completion-rewards span {
  padding: 6px 10px;
  border-radius: 5px;
  color: #173d27;
  background: #e7f2e7;
  font-size: 11px;
}

.completion-missions {
  margin-bottom: 10px;
  color: #687169;
  font-size: 10px;
}

.completion-sheet button {
  margin: 4px;
}

.care-effect {
  position: absolute;
  z-index: 18;
  inset: 0;
  pointer-events: none;
}

.farm-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--game-gold);
  animation: particle-burst .85s ease-out forwards;
}

.farm-particle.water {
  background: #58c2f3;
}

.farm-particle.harvest-palm {
  width: 11px;
  height: 8px;
  border-radius: 55% 45% 48% 52%;
  background: linear-gradient(145deg, #f08b1b, #9b2e18 68%);
  box-shadow: 0 1px 0 rgba(255, 209, 73, .65);
}

.farm-particle.harvest-rubber {
  width: 7px;
  height: 12px;
  border-radius: 60% 40% 65% 35%;
  background: linear-gradient(165deg, #fffdf0, #dbe5df);
  box-shadow: 0 1px 3px rgba(39, 62, 48, .28);
}

.farm-particle.harvest-durian {
  width: 12px;
  height: 10px;
  border-radius: 42%;
  background: #a9b73b;
  box-shadow: 3px 0 0 -2px #e1d86b, -3px 0 0 -2px #e1d86b, 0 3px 0 -2px #e1d86b;
}

.game-disclaimer {
  position: fixed;
  z-index: 20;
  right: 12px;
  bottom: 3px;
  margin: 0;
  color: rgba(255, 255, 255, .62);
  font-size: 7px;
  pointer-events: none;
}

.game-load-error {
  margin: 40px;
  text-align: center;
}

.game-notification {
  position: fixed;
  z-index: 100;
  top: 112px;
  left: 50%;
  width: min(580px, calc(100vw - 32px));
  min-height: 132px;
  padding: 20px 62px 18px 132px;
  border: 3px solid #78ad68;
  border-radius: 8px;
  color: #284631;
  background: #fffdf4;
  box-shadow: 0 9px 0 rgba(47, 82, 48, .18), 0 22px 46px rgba(25, 48, 29, .32);
  font-family: "Mali", "Kanit", Tahoma, sans-serif;
  line-height: 1.65;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: break-word;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -18px) scale(.97);
  transition: transform .26s cubic-bezier(.22, .78, .25, 1), opacity .2s ease, visibility .2s;
}

.game-notification::after {
  content: "";
  position: absolute;
  left: 104px;
  bottom: -11px;
  width: 20px;
  height: 20px;
  border-right: 2px solid #78ad68;
  border-bottom: 2px solid #78ad68;
  background: #fffdf4;
  transform: rotate(45deg);
}

.game-notification.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0) scale(1);
}

.game-notification.warning {
  border-color: #e09a50;
  color: #643c22;
  background: #fff7ec;
}

.game-notification.warning::after {
  border-color: #e09a50;
  background: #fff7ec;
}

.game-notification.mission-update {
  border-color: #d2a91d;
  color: #315238;
  background: #fff9dd;
  box-shadow: 0 9px 0 rgba(121, 91, 13, .16), 0 22px 46px rgba(25, 48, 29, .32);
}

.game-notification.mission-update::after {
  border-color: #d2a91d;
  background: #fff9dd;
}

.game-notification.mission-update strong { color: #8a6711; }

.game-notification picture {
  position: absolute;
  left: 10px;
  bottom: 2px;
  width: 112px;
  height: 126px;
  overflow: hidden;
  pointer-events: none;
}

.game-notification picture img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.game-notification strong {
  display: block;
  margin-bottom: 4px;
  color: #386939;
  font-size: 21px;
  line-height: 1.6;
}

.game-notification.warning strong { color: #a95828; }

.game-notification p {
  margin: 0;
  font-size: 15px;
  line-height: 1.72;
}

.game-notification button {
  position: absolute;
  z-index: 1;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(49, 87, 52, .24);
  border-radius: 50%;
  color: #436f47;
  background: rgba(255, 255, 255, .9);
  font: 700 25px/1 Tahoma, sans-serif;
  cursor: pointer;
}

.game-notification button:hover,
.game-notification button:focus-visible {
  color: #fff;
  background: #4e8551;
  outline: 3px solid rgba(255, 214, 82, .7);
  outline-offset: 2px;
}

.reduce-game-motion *,
.reduce-game-motion *::before,
.reduce-game-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}

@keyframes mascot-walk {
  from { background-position: 0 0; }
  to { background-position: 100% 0; }
}

@keyframes mascot-walk-loop {
  0%, 12.49% { background-position: 0 0; }
  12.5%, 24.99% { background-position: 33.333% 0; }
  25%, 37.49% { background-position: 66.667% 0; }
  37.5%, 49.99% { background-position: 100% 0; }
  50%, 62.49% { background-position: 0 100%; }
  62.5%, 74.99% { background-position: 33.333% 100%; }
  75%, 87.49% { background-position: 66.667% 100%; }
  87.5%, 100% { background-position: 100% 100%; }
}

@keyframes mascot-walk-body {
  0%, 50%, 100% { transform: translateX(-50%) translateY(0) rotate(-.18deg) scaleX(var(--facing-scale)); }
  25%, 75% { transform: translateX(-50%) translateY(-1.5px) rotate(.16deg) scaleX(var(--facing-scale)); }
}

@keyframes mascot-shadow-step {
  from { transform: translateX(-50%) scaleX(1); opacity: .82; }
  to { transform: translateX(-50%) scaleX(.82); opacity: .62; }
}

@keyframes mascot-idle {
  0%, 100% { transform: translateX(-50%) translateY(0) scaleX(var(--facing-scale)); }
  50% { transform: translateX(-50%) translateY(-3px) scaleX(var(--facing-scale)); }
}

@keyframes mascot-action {
  from { transform: translateX(-50%) scaleX(var(--facing-scale)) scaleY(1); }
  to { transform: translateX(-50%) scaleX(var(--facing-scale)) scaleY(1.035); }
}

@keyframes mascot-action-frames {
  0%, 24.99% { background-position: 0 var(--action-y, 0); }
  25%, 49.99% { background-position: 33.333% var(--action-y, 0); }
  50%, 74.99% { background-position: 66.667% var(--action-y, 0); }
  75%, 100% { background-position: 100% var(--action-y, 0); }
}

@keyframes mascot-action-depth {
  0%, 100% { transform: translateX(-50%) translateY(0) scaleX(var(--facing-scale)); }
  50% { transform: translateX(-50%) translateY(-2px) scaleX(var(--facing-scale)); }
}

@keyframes mascot-harvest-depth {
  0% { transform: translateX(-50%) translateY(1px) rotate(-1.1deg) scaleX(var(--facing-scale)) scale(.98, 1.015); }
  45% { transform: translateX(-50%) translateY(-2px) rotate(.45deg) scaleX(var(--facing-scale)) scale(1.015, .99); }
  100% { transform: translateX(-50%) translateY(-5px) rotate(1.15deg) scaleX(var(--facing-scale)) scale(1.035, .975); }
}

@keyframes mascot-harvest-shadow {
  from { transform: translateX(-50%) scaleX(1.08); opacity: .8; }
  to { transform: translateX(-50%) scaleX(.78); opacity: .52; }
}

@keyframes crop-settle {
  from { opacity: .62; transform: translate(-50%, -94%) scale(var(--perspective-scale, 1)); }
  to { opacity: 1; transform: translate(-50%, -100%) scale(var(--perspective-scale, 1)); }
}

@keyframes crop-wind-palm {
  0%, 100% { transform: translateX(-.2px) rotate(-.38deg) skewX(-.18deg) scaleY(1); }
  24% { transform: translateX(.25px) rotate(.16deg) skewX(.08deg) scaleY(1.002); }
  52% { transform: translateX(.7px) rotate(.62deg) skewX(.28deg) scaleY(.998); }
  76% { transform: translateX(.08px) rotate(-.06deg) skewX(-.04deg) scaleY(1.001); }
}

@keyframes crop-wind-rubber {
  0%, 100% { transform: translateX(-.12px) rotate(-.24deg) skewX(-.1deg); }
  31% { transform: translateX(.2px) rotate(.12deg) skewX(.05deg); }
  58% { transform: translateX(.46px) rotate(.38deg) skewX(.16deg); }
  82% { transform: translateX(.02px) rotate(-.05deg) skewX(-.03deg); }
}

@keyframes crop-wind-durian {
  0%, 100% { transform: translateX(-.1px) rotate(-.18deg) skewX(-.06deg) scaleY(1); }
  34% { transform: translateX(.14px) rotate(.08deg) skewX(.03deg) scaleY(1.0015); }
  63% { transform: translateX(.34px) rotate(.28deg) skewX(.1deg) scaleY(.999); }
  84% { transform: translateX(.01px) rotate(-.04deg) skewX(-.02deg) scaleY(1.0005); }
}

@keyframes crop-touch-response {
  0%, 100% { transform: translateX(0) rotate(0) scale(1); }
  14% { transform: translateX(-1.5px) rotate(-1.35deg) scale(.998, 1.004); }
  29% { transform: translateX(2px) rotate(1.75deg) scale(1.004, .997); }
  46% { transform: translateX(-1.15px) rotate(-.95deg) scale(.999, 1.002); }
  63% { transform: translateX(.7px) rotate(.55deg) scale(1.001); }
  79% { transform: translateX(-.3px) rotate(-.22deg) scale(1); }
}

@keyframes crop-touch-sparkle {
  0%, 16% { opacity: 0; transform: scale(.55) rotate(-8deg); }
  34% { opacity: .82; transform: scale(1) rotate(2deg); }
  72%, 100% { opacity: 0; transform: translate(4px, -7px) scale(.72) rotate(9deg); }
}

@keyframes decor-slot-pulse {
  0%, 100% { transform: translate(-50%, -50%); filter: brightness(.94); }
  50% { transform: translate(-50%, -50%); filter: brightness(1.18); }
}

@keyframes ready-pulse {
  0%, 100% { border-color: var(--game-gold); box-shadow: 0 0 0 rgba(229, 181, 47, 0); }
  50% { border-color: #fff1ae; box-shadow: 0 0 18px rgba(229, 181, 47, .45); }
}

@keyframes audio-ready-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.16); }
}

@keyframes particle-burst {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to { transform: translate(var(--x), var(--y)) scale(.3); opacity: 0; }
}

@media (max-width: 1180px) {
  .player-hud { width: 294px; padding-left: 108px; }
  .player-hud picture { width: 116px; height: 136px; }
  .time-hud { width: 360px; }
  .active-mission-hud { width: 360px; }
  .utility-button { width: 60px; }
  .action-dock { left: calc(50% + 20px); width: 610px; min-width: 610px; }
  .plot-panel { width: 270px; }
  .harvest-preview { width: 180px; }
  .mentor-bubble { display: none; }
}

@media (max-width: 820px) {
  .minigame-shell { min-height: 760px; }
  .player-hud {
    top: 7px;
    left: 7px;
    width: 190px;
    min-height: 82px;
    padding: 6px 7px 6px 68px;
  }
  .player-hud picture { left: -3px; bottom: -2px; width: 72px; height: 88px; border-width: 2px; }
  .player-hud-copy { gap: 2px; }
  .player-hud-copy > div:first-child > strong { font-size: 12px; }
  .level-shield { width: 27px; height: 25px; font-size: 12px; }
  .hud-resource { grid-template-columns: 14px 1fr auto; gap: 2px; }
  .hud-resource > span { font-size: 12px; }
  .hud-resource strong, .coin-resource strong { font-size: 9px; }
  .coin-resource { grid-template-columns: 14px auto 1fr; }
  .coin-resource small, .player-hud-copy > small { font-size: 6px; }
  .time-hud {
    top: 96px;
    width: calc(100vw - 14px);
    height: 50px;
    padding: 5px 8px;
    grid-template-columns: 30px 1fr 70px 1.2fr;
  }
  .time-hud .sun-icon { font-size: 19px; }
  .time-hud strong, .time-hud time { font-size: 11px; }
  .time-hud small { font-size: 6px; }
  .active-mission-hud {
    top: 152px;
    width: calc(100vw - 14px);
    min-height: 50px;
    padding: 6px 10px;
  }
  .active-mission-copy strong { font-size: 11px; }
  .active-mission-copy > span { font-size: 7px; }
  .utility-hud { top: 7px; right: 7px; gap: 4px; }
  .utility-button { width: 52px; height: 56px; padding: 4px; }
  .utility-button > span { font-size: 18px; }
  .utility-button small { font-size: 7px; }
  .utility-hud .utility-button:last-child { display: none; }
  .farm-world {
    top: 51%;
    bottom: auto;
    width: max(100vw, 138.58vh);
    height: max(78vh, 56.28vw);
  }
  .minigame-shell[data-selected-crop="palm"] .farm-world { --farm-pan-x: 14%; }
  .minigame-shell[data-selected-crop="rubber"] .farm-world { --farm-pan-x: 0%; }
  .minigame-shell[data-selected-crop="durian"] .farm-world { --farm-pan-x: -14%; }
  .minigame-shell[data-selected-crop="palm"] .farmer-character { left: 36%; }
  .minigame-shell[data-selected-crop="rubber"] .farmer-character { left: 50%; }
  .minigame-shell[data-selected-crop="durian"] .farmer-character { left: 64%; }
  .farm-grid, .decoration-layer { transform: none; }
  .farm-plot small { display: none; }
  .plot-crop { width: 65%; }
  .farmer-character { width: 86px; height: 110px; }
  .farmer-sprite { width: 84px; height: 112px; }
  .farmer-character.actioning[data-sprite="farm"] .farmer-sprite { width: 90px; height: 126px; }
  .farmer-character.actioning[data-sprite="secondary"] .farmer-sprite { width: 112px; height: 123px; }
  .farmer-character.actioning[data-sprite="harvest"] .farmer-sprite { width: 90px; height: 124px; }
  .placed-decoration {
    width: calc(44px + (var(--footprint-columns, 1) - 1) * 34px);
    height: calc(32px + (var(--footprint-rows, 1) - 1) * 20px);
  }
  .decor-object { width: 96px; height: 80px; }
  .placed-decoration[data-decoration-item="tropical-flowers"] .decor-object { width: 88px; height: 84px; }
  .placed-decoration[data-decoration-item="warrior-lantern"] .decor-object { width: 62px; height: 100px; }
  .placed-decoration[data-decoration-item="farm-bench"] .decor-object { width: 104px; height: 86px; }
  .placed-decoration[data-decoration-item="khunsuek-sign"] .decor-object { width: 72px; height: 100px; }
  .placed-decoration[data-decoration-item="flower-pergola"] .decor-object { width: 98px; height: 88px; }
  .placed-decoration[data-decoration-item="bird-bath"] .decor-object { width: 76px; height: 86px; }
  .placed-decoration[data-decoration-item="stone-path"] .decor-object { width: 88px; height: 62px; }
  .placed-decoration[data-decoration-item="lotus-pond"] .decor-object { width: 110px; height: 80px; }
  .placed-decoration[data-decoration-item="friendly-scarecrow"] .decor-object { width: 64px; height: 100px; }
  .placed-decoration[data-decoration-item="fruit-cart"] .decor-object { width: 104px; height: 86px; }
  .placed-decoration[data-decoration-item="bamboo-fence"] .decor-object { width: 110px; height: 74px; }
  .placed-decoration[data-decoration-item="warrior-fountain"] .decor-object { width: 76px; height: 100px; }
  .decoration-slot { width: 36px; height: 24px; border-width: 1px; }
  .decoration-slot span { font-size: 14px; }
  .plot-panel {
    z-index: 42;
    right: 7px;
    bottom: 103px;
    left: 7px;
    width: auto;
    height: 178px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 8px 14px;
    overflow: hidden;
  }
  .plot-panel header { grid-column: 1; }
  .plot-mini-crop { width: 42px; height: 42px; }
  .plot-panel header strong { font-size: 13px; }
  .plot-panel > p { grid-column: 1; margin: -8px 0 0 50px; font-size: 8px; }
  .growth-row { grid-column: 1; font-size: 7px; }
  .stage-progress { grid-column: 1; margin: 0; }
  .stage-progress span { width: 18px; height: 18px; font-size: 6px; }
  .plot-stats { grid-column: 2; grid-row: 1 / 5; }
  .plot-stats > div { grid-template-columns: 54px 1fr; }
  .plot-stats dt, .plot-stats strong { font-size: 7px; }
  .inspection-goal { grid-column: 1 / -1; padding: 4px 6px; margin: 0; }
  .inspection-goal strong { font-size: 7px; }
  .inspection-goal span { font-size: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .quality-stars { position: absolute; right: 14px; bottom: 6px; margin: 0; font-size: 15px; }
  .plot-panel > small { display: none; }
  .harvest-preview, .mentor-bubble { display: none; }
  .crop-switcher {
    position: fixed;
    z-index: 43;
    right: 7px;
    bottom: 287px;
    left: 7px;
    height: 36px;
    padding: 3px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    border: 1px solid var(--game-gold-dark);
    border-radius: 6px;
    background: rgba(23, 24, 17, .94);
  }
  .crop-switcher button {
    border: 0;
    border-radius: 4px;
    color: #d7d7ca;
    background: transparent;
    font: inherit;
    font-size: 9px;
  }
  .crop-switcher button.active { color: #171811; background: var(--game-gold); }
  .action-dock {
    right: 6px;
    bottom: 6px;
    left: 6px;
    width: auto;
    min-width: 0;
    min-height: 90px;
    padding: 5px;
    transform: none;
    overflow-x: auto;
  }
  .tool-mode-hint {
    top: 152px;
    right: 7px;
    bottom: auto;
    left: 7px;
    width: auto;
    min-height: 54px;
    padding: 7px 44px 7px 52px;
    transform: none;
  }
  .tool-mode-icon { left: 10px; width: 32px; height: 32px; }
  .tool-mode-hint strong { font-size: 12px; }
  .tool-mode-hint small { font-size: 8px; }
  .tool-mode-hint button { top: 8px; right: 8px; width: 32px; height: 32px; }
  .tool-button { min-width: 78px; }
  .tool-icon { font-size: 23px; }
  .tool-button strong { font-size: 9px; }
  .formula-tray {
    right: 7px;
    bottom: 103px;
    left: 7px;
    width: auto;
    max-height: 310px;
    padding: 8px;
    transform: translateY(20px);
  }
  .formula-tray.open { transform: translateY(0); }
  .formula-options { grid-template-columns: 1fr; max-height: 238px; overflow-y: auto; }
  .formula-group > div { padding-bottom: 3px; }
  .formula-option { width: 94px; min-width: 94px; min-height: 116px; }
  .formula-option img { width: 60px; height: 68px; }
  .feedback-panel {
    right: 7px;
    bottom: 103px;
    left: 7px;
    width: auto;
    grid-template-columns: 34px 1fr auto;
  }
  .feedback-panel p { font-size: 8px; }
  .decoration-list { grid-template-columns: 1fr; }
  .decoration-editor { bottom: 304px; max-width: calc(100vw - 14px); }
  .decoration-editor > span { max-width: 108px; }
  .decoration-editor button { padding: 4px 6px; font-size: 8px; }
  .product-catalog-groups section > div { grid-template-columns: repeat(3, 1fr); }
  .game-disclaimer { display: none; }
  .game-notification {
    top: 214px;
    width: min(520px, calc(100vw - 20px));
    min-height: 124px;
    padding: 16px 50px 16px 104px;
  }
  .game-notification picture { width: 90px; height: 108px; }
  .game-notification strong { font-size: 18px; }
  .game-notification p { font-size: 13px; }
}

@media (max-width: 820px) {
  .touch-joystick { bottom: 342px; display: grid; }
}

@media (max-width: 520px) {
  .player-hud { width: 174px; padding-left: 61px; }
  .player-hud picture { width: 65px; }
  .active-mission-hud { grid-template-columns: 30px minmax(0, 1fr); column-gap: 7px; }
  .active-mission-icon { width: 28px; height: 28px; font-size: 15px; }
  .active-mission-copy { grid-template-columns: 1fr; }
  .active-mission-copy small { display: none; }
  .active-mission-copy strong { grid-column: 1; }
  .utility-hud { gap: 2px; }
  .utility-button { width: 40px; }
  .audio-settings { grid-template-columns: 1fr; }
  .crop-picker, .completion-panel, .game-modal { padding: 6px; }
  .picker-sheet, .completion-sheet, .game-modal-sheet { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); padding: 14px; }
  .picker-sheet h1 { font-size: 22px; }
  .crop-options { grid-template-columns: 1fr; }
  .crop-option { min-height: 118px; grid-template-columns: 104px 1fr; text-align: left; }
  .crop-preview { width: 96px; height: 90px; }
  .crop-option div { justify-self: start; }
  .decoration-item { grid-template-columns: 76px 1fr; }
  .decoration-preview { width: 72px; height: 62px; }
  .decoration-item .decoration-actions { grid-column: 1 / -1; }
  .decoration-item button { grid-column: 1 / -1; width: 100%; }
  .product-catalog-groups section > div { grid-template-columns: repeat(2, 1fr); }
  .farm-world { bottom: 320px; }
  .plot-panel { bottom: 156px; }
  .crop-switcher { bottom: 320px; }
  .decoration-editor { bottom: 366px; }
  .action-dock {
    min-height: 144px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    overflow-x: hidden;
  }
  .tool-button { min-width: 0; }
  .tool-button:nth-child(4n) { border-right: 0; }
  .formula-tray,
  .feedback-panel { bottom: 156px; }
  .game-notification {
    top: 214px;
    min-height: 118px;
    padding: 14px 46px 14px 92px;
  }
  .game-notification picture { width: 80px; height: 96px; }
  .game-notification strong { font-size: 17px; }
  .game-notification p { font-size: 12px; }
  .touch-joystick {
    bottom: 372px;
    width: 88px;
    height: 88px;
  }
  .touch-joystick-knob { width: 39px; height: 39px; }
}

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