.tool-sprite {
  --tool-flip: 1;
  position: absolute;
  z-index: 10001;
  width: 56px;
  height: 56px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  transform: scaleX(var(--tool-flip, 1));
  transform-origin: 68% 82%;
  filter: drop-shadow(1px 2px 1px #17250a66);
}
canvas.tool-press:not(.dragging) {
  animation: none;
}
.tool-sprite[hidden] {
  display: none;
}
.tool-sprite[data-action="water"],
.tool-sprite[data-action="fertilize"],
.tool-sprite[data-action="pest"],
.tool-sprite[data-action="harvest"] {
  --tool-flip: -1;
}
.tool-sprite[data-action="fertilizer"] {
  --tool-flip: 1;
}
.tool-sprite.tool-action {
  animation: tool-action 0.48s ease-out;
}
.tool-sprite[data-action="prepare"].tool-action {
  animation: tool-shovel 0.48s ease-out;
}
.tool-sprite[data-action="water"].tool-action {
  animation: tool-pour 0.48s ease-out;
}
.tool-sprite[data-action="plant"].tool-action {
  animation: tool-seed-pour 0.58s ease-out;
}
.tool-sprite[data-action="pest"].tool-action,
.tool-sprite[data-action="fertilize"].tool-action {
  animation: tool-spray 0.48s ease-out;
}
.tool-sprite[data-action="fertilizer"].tool-action {
  animation: tool-fertilizer 0.58s ease-out;
}
.tool-sprite[data-action="harvest"].tool-action {
  animation: tool-hand 0.48s ease-out;
}
#toolbar {
  left: 26%;
  bottom: 0.8%;
  width: 48%;
  height: 6.8%;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0;
  padding: 2px 12px;
  border: 1px solid #88ae4a;
  border-radius: 8px;
  background: linear-gradient(180deg, #245d18e8, #143e10ed);
  box-shadow:
    inset 0 1px 10px #0b260b99,
    0 2px 6px #10280e88;
}
#toolbar button {
  flex: 1 1 0;
  width: auto;
  height: 100%;
  min-width: 0;
  padding: 1px;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: grid;
  place-items: center;
  transition:
    filter 0.12s ease,
    transform 0.12s ease;
}
#toolbar img {
  width: min(100%, 56px);
  height: 54px;
  object-fit: contain;
  mix-blend-mode: normal;
  filter: drop-shadow(0 2px 2px #091b0aaa);
  transition:
    filter 0.12s ease,
    transform 0.12s ease;
}
#toolbar button[data-tool="select"] img {
  filter: none;
}
#toolbar button:hover img {
  transform: translateY(-2px) scale(1.04);
  filter: drop-shadow(0 0 4px #e8f6a8);
}
#toolbar button.active {
  background: transparent;
  box-shadow: none;
}
#toolbar button.active img {
  filter: drop-shadow(0 0 3px #fffbdc) drop-shadow(0 0 8px #fff4c7) brightness(1.08);
}
#toolbar button[data-tool="select"].active img {
  filter: drop-shadow(0 0 3px #fffbdc) drop-shadow(0 0 8px #fff4c7) brightness(1.08);
}
#toolbar button.bag-open img {
  filter: drop-shadow(0 0 3px #fffbdc) drop-shadow(0 0 8px #fff4c7) brightness(1.08);
}
.bag-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
}
.bag-grid .item {
  min-height: 150px;
  padding: 10px;
}
.bag-grid .item > img {
  width: 86px;
  height: 86px;
}
.bag-grid .item > p {
  font: bold 12px/1.2 Georgia;
  margin: 4px 0;
}
.bag-grid .bag-quantity {
  display: block;
  font: bold 10px Arial;
  color: #677b49;
}
.bag-grid .ration-card {
  min-height: 183px !important;
  height: 183px;
}
.bag-grid .ration-card.used img {
  filter: none;
  opacity: 1;
}
.bag-grid .ration-card.unused img {
  filter: grayscale(1);
  opacity: 0.55;
}
@media (max-width: 700px) {
  .bag-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }
  .bag-grid .item {
    min-height: 118px;
    padding: 5px;
  }
  .bag-grid .item > img {
    width: 56px;
    height: 56px;
  }
  .bag-grid .ration-card {
    min-height: 132px !important;
    height: 132px;
  }
  .bag-grid .ration-card img {
    width: 64px !important;
    height: 64px !important;
  }
}
#toolbar button[data-tool="water"] img,
#toolbar button[data-tool="fertilize"] img,
#toolbar button[data-tool="pest"] img,
#toolbar button[data-tool="harvest"] img {
  scale: -1 1;
}
@keyframes tool-action {
  50% {
    transform: translateY(5px) scale(0.96);
  }
}
@keyframes tool-shovel {
  35% {
    transform: rotate(-38deg) translateY(3px);
  }
  70% {
    transform: rotate(12deg) translateY(5px);
  }
}
@keyframes tool-pour {
  0%,
  100% {
    transform: scaleX(var(--tool-flip, 1)) rotate(0);
  }
  45% {
    transform: scaleX(var(--tool-flip, 1)) rotate(42deg) translateY(5px);
  }
  75% {
    transform: scaleX(var(--tool-flip, 1)) rotate(28deg) translateY(3px);
  }
}
@keyframes tool-seed-pour {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-10deg) translateY(1px);
  }
  52% {
    transform: rotate(-58deg) translateY(5px);
  }
  78% {
    transform: rotate(-43deg) translateY(3px);
  }
}
@keyframes tool-spray {
  0%,
  100% {
    transform: scaleX(var(--tool-flip, 1)) rotate(0);
  }
  30% {
    transform: scaleX(var(--tool-flip, 1)) rotate(7deg) translateY(1px);
  }
  58% {
    transform: scaleX(var(--tool-flip, 1)) rotate(-4deg) translateY(3px);
  }
  82% {
    transform: scaleX(var(--tool-flip, 1)) rotate(2deg);
  }
}
@keyframes tool-fertilizer {
  0%,
  100% {
    transform: scaleX(var(--tool-flip, 1)) rotate(0);
  }
  28% {
    transform: scaleX(var(--tool-flip, 1)) rotate(-8deg) translateY(1px);
  }
  58% {
    transform: scaleX(var(--tool-flip, 1)) rotate(-52deg) translateY(5px);
  }
  82% {
    transform: scaleX(var(--tool-flip, 1)) rotate(-28deg) translateY(3px);
  }
}
@keyframes tool-hand {
  0%,
  100% {
    transform: scaleX(var(--tool-flip, 1)) scale(1);
  }
  28% {
    transform: scaleX(var(--tool-flip, 1)) scale(0.96) rotate(-5deg);
  }
  52% {
    transform: scaleX(var(--tool-flip, 1)) scale(0.78) rotate(-7deg);
  }
  78% {
    transform: scaleX(var(--tool-flip, 1)) scale(1.03) rotate(3deg);
  }
}
@media (max-width: 900px) {
  #toolbar {
    left: 12%;
    width: 76%;
    height: 11%;
    padding: 2px 8px;
  }
  #toolbar img {
    width: min(100%, 42px);
    height: 42px;
  }
  .tool-sprite {
    width: 48px;
    height: 48px;
  }
}
@media (max-width: 600px) {
  #toolbar {
    left: 5%;
    width: 90%;
    height: 23%;
    bottom: 1%;
    padding: 1px 4px;
  }
  #toolbar img {
    width: min(100%, 38px);
    height: 38px;
  }
}
#tooltip.crop-tooltip,
#treasureBubble.crop-tooltip {
  z-index: 5;
  width: 320px;
  max-width: calc(100vw - 16px);
  padding: 10px 12px;
  border: 2px solid #718d32;
  border-radius: 6px;
  background: linear-gradient(135deg, #b6df44f5, #d3ed64f5);
  box-shadow: 1px 3px 7px #1d321d66;
  color: #263515;
  font:
    700 14px Georgia,
    serif;
}
#tooltip.crop-tooltip {
  transform: translate(-50%, calc(-100% - 10px));
  overflow: visible;
  width: 310px;
  max-width: calc(100vw - 16px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: #30271a;
  font:
    700 12px Georgia,
    serif;
}
#tooltip.crop-tooltip:after {
  display: none;
}
#tooltip.crop-tooltip .crop-stat {
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 5px;
  margin: 0 0 4px;
}
#tooltip.crop-tooltip .crop-stat-icon {
  width: 32px;
  height: 32px;
  filter: drop-shadow(1px 2px 1px #3e2c1d88);
}
#tooltip.crop-tooltip .crop-stat-content > b {
  display: block;
  margin: 0 0 1px;
  color: #33281c;
  font:
    bold 12px Georgia,
    serif;
  text-shadow: 1px 1px 1px #e7ce8d;
}
#tooltip.crop-tooltip .crop-meter {
  height: 20px;
  border: 2px solid #ae763a;
  border-radius: 12px;
  background: linear-gradient(#ece4ca, #d4c6a3);
  box-shadow:
    0 1px 2px #392a1e88,
    inset 0 1px 2px #fff8d8;
}
#tooltip.crop-tooltip .crop-meter > i {
  inset: 1px;
  background: linear-gradient(180deg, #fff67a, #f4c523 55%, #db971b);
  border-radius: 9px;
}
#tooltip.crop-tooltip .crop-meter > i.growth-meter {
  background: linear-gradient(180deg, #c7ef85, #77bc42 55%, #44872d);
}
#tooltip.crop-tooltip .crop-meter > strong {
  padding: 0 5px;
  color: #30271a;
  font:
    bold 13px Georgia,
    serif;
  text-shadow: 1px 1px #fff6d8;
}
#tooltip.crop-tooltip .crop-stat-content {
  min-width: 0;
}
#tooltip.crop-tooltip .health-stat {
  grid-template-columns: 34px minmax(0, 1fr);
}
#tooltip.crop-tooltip .growth-stat .crop-stat-icon {
  object-fit: contain;
}
#tooltip.crop-tooltip .crop-sun {
  position: relative;
  width: 23px;
  height: 23px;
  justify-self: center;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    #fff7a0 0 22%,
    #ffd735 24% 48%,
    #f2a61c 52% 62%,
    transparent 65%
  );
  filter: drop-shadow(0 1px 1px #59401f88);
}
#tooltip.crop-tooltip .crop-sun:before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, #ffd644 0deg 9deg, transparent 9deg 45deg);
  mask: radial-gradient(circle, transparent 0 52%, #000 57% 70%, transparent 74%);
}
.crop-stat {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 2px 0 10px;
}
.crop-stat-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
}
.crop-stat-content {
  min-width: 0;
}
.crop-stat-content > b {
  display: block;
  margin: 0 0 4px;
  font-size: 14px;
}
.crop-meter {
  position: relative;
  height: 25px;
  overflow: hidden;
  border: 2px solid #87958e;
  border-radius: 13px;
  background: #f1edd6;
  box-shadow: inset 0 1px 3px #263a2344;
}
.crop-meter > i {
  position: absolute;
  inset: 1px auto 1px 1px;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff778, #f4c512 55%, #dda800);
}
.crop-meter > i.growth-meter {
  background: linear-gradient(180deg, #e7f7a2, #aed848 55%, #79ae2c);
}
.crop-meter > strong {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: center;
  padding: 0 8px;
  color: #283523;
  font:
    700 13px Arial,
    sans-serif;
  white-space: nowrap;
  text-shadow: 0 1px #fff9;
}
.crop-care {
  margin: 0 0 0 42px;
  color: #344923;
  font:
    700 11px Arial,
    sans-serif;
}

#game,
#game * {
  user-select: none;
  -webkit-user-select: none;
}
#game input,
#game textarea,
#game select,
#game [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}
#game img {
  -webkit-user-drag: none;
  user-drag: none;
}
#save {
  display: none !important;
}
#cameraControls {
  right: 2%;
  bottom: 2.5%;
  z-index: 8;
}
#hudActions #helpOpen {
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: auto;
  height: 34px;
  min-width: 66px;
  padding: 5px 9px;
  border: 1px solid #eaf6cc;
  border-radius: 6px;
  background: linear-gradient(#f2f8dc, #d8e8ac);
  color: #4f6d36;
  font: 700 12px Arial;
  box-shadow: 0 2px 4px #27452066;
}
#hudActions #helpOpen .help-mark {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font: 700 12px Arial;
}
#hudActions #helpOpen:hover {
  filter: brightness(1.06);
}
.balance-row > span:first-child {
  position: absolute;
  left: 0;
  top: 0;
}
.balance-row > .mv-balance {
  position: absolute;
  left: 151px;
  top: 0;
  gap: 4px;
}
#buyMv {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  flex: none;
  padding: 0;
  border: 1px solid #4c9d35;
  border-radius: 50%;
  background: #f3ffdf;
  color: #418d2e;
  font: 700 17px/16px Arial;
  box-shadow: 0 1px 2px #284b2355;
}
#buyMv[hidden] {
  display: none;
}
#buyMv:hover {
  background: #e1f6bd;
  transform: scale(1.08);
}
#buyMv:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
#hudActions {
  gap: 2px;
  padding: 4px;
  border: 1px solid #efffe777;
  border-radius: 9px;
  background: #efffe733;
  box-shadow:
    inset 0 1px 4px #fff5,
    0 2px 5px #183a1644;
  backdrop-filter: none;
}
#hudActions > button,
#hudActions > a {
  background: transparent;
  border-color: transparent;
  border-radius: 5px;
  box-shadow: none;
}
#hudActions > button:hover,
#hudActions > a:hover {
  background: #f3ffe866;
  border-color: #f5ffe877;
}
#hudActions #vipOpen {
  background: transparent;
  color: #9b6f15;
}
#hudActions #vipOpen:hover {
  background: #fff5c755;
}
#friendsRail {
  position: fixed;
  z-index: 6;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: stretch;
  max-height: min(76%, 470px);
  color: #344a31;
}
#friendsRailToggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  align-self: center;
  padding: 0;
  border: 1px solid #d9edb8;
  border-right: 0;
  border-radius: 7px 0 0 7px;
  background: #e5f4cbe8;
  color: #577b3d;
  box-shadow: 0 2px 6px #213d1d66;
  font: 700 20px/24px Arial;
}
#friendsRailToggle:hover {
  background: #f3ffde;
}
#friendsRailBody {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 220px;
  max-height: min(72vh, 470px);
  overflow: hidden;
  padding: 7px;
  border: 1px solid #d9edb8;
  border-radius: 0 8px 8px 0;
  background: #e6f4d9e8;
  box-shadow: 0 3px 9px #213d1d66;
  backdrop-filter: none;
}
.friends-rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  padding: 0 4px 5px;
  color: #557342;
  font: 700 13px Georgia;
}
#friendsRailCount {
  color: #79906b;
  font: 11px Arial;
}
#friendsRailList {
  min-width: 0;
  min-height: 0;
  max-height: min(64vh, 420px);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: #8fa978 transparent;
}
.friends-rail-item {
  padding: 2px 0;
  border-top: 1px solid #73956125;
}
.friends-rail-person {
  display: grid;
  grid-template-columns: 25px 31px minmax(0, 1fr) 28px 28px;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 3px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #3e5636;
  text-align: left;
}
.friends-rail-person:hover,
.friends-rail-item.selected .friends-rail-person {
  background: #fff8;
}
.friends-rail-person > img {
  width: 30px;
  height: 30px;
  object-fit: cover;
  border: 1px solid #bfd19f;
  border-radius: 4px;
  background: #fff9;
}
.friends-rail-rank {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 2px solid #b7c995;
  border-radius: 50%;
  background: #e8f0d8;
  color: #587443;
  font: 700 10px Arial, sans-serif;
  box-shadow: inset 0 1px #fff;
}
.friends-rail-item:nth-child(1) .friends-rail-rank {
  border-color: #e47d45;
  background: #ed5036;
  color: #fff;
}
.friends-rail-item:nth-child(2) .friends-rail-rank {
  border-color: #e0ba3d;
  background: #f1c83e;
  color: #fff;
}
.friends-rail-item:nth-child(3) .friends-rail-rank {
  border-color: #55a6be;
  background: #47b2d1;
  color: #fff;
}
.friends-rail-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 12px Arial;
}
.friends-rail-stat {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
}
.friends-rail-stat > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.friends-rail-stat > b {
  position: relative;
  color: #fff;
  font: 700 9px Arial;
  text-shadow: 0 1px 2px #314a4a;
}
.friends-rail-bot {
  margin-left: 4px;
  color: #6f8d4e;
  font: 700 8px Arial;
  vertical-align: 1px;
}
.friends-rail-bot:before {
  content: "· ";
  margin-left: 2px;
}
.friends-rail-visit {
  width: calc(100% - 42px);
  margin: 0 3px 3px 40px;
  padding: 4px 8px;
  border: 1px solid #91b77a;
  border-radius: 4px;
  background: #f4f9e8;
  color: #527242;
  font: 700 11px Arial;
}
.friends-rail-empty {
  padding: 12px 5px;
  color: #75856a;
  font: 11px/1.4 Arial;
}
#friendsRail.collapsed {
  height: auto;
  max-height: none;
  left: 0;
}
#friendsRail.collapsed #friendsRailToggle {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border: 1px solid #d9edb8;
  border-left: 0;
  border-radius: 0 7px 7px 0;
  font-size: 20px;
}
#friendsRail.collapsed #friendsRailBody {
  display: none;
}
#hudActions #helpOpen {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
#hudActions #helpOpen:hover {
  border-color: #f5ffe877;
  background: #f3ffe866;
}
#visitBanner {
  top: 1.5%;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: #fff4cce8;
}
#visitBanner button {
  margin: 0;
}
#tooltip.hud-tooltip {
  z-index: 9;
  width: max-content;
  min-width: 120px;
  max-width: min(320px, calc(100vw - 16px));
  padding: 8px 10px;
  border-radius: 6px;
  line-height: 1.35;
  white-space: normal;
}
.hud-tooltip .tooltip-heading {
  display: block;
  margin-bottom: 3px;
  color: #30451c;
  font:
    bold 14px Georgia,
    serif;
}
.hud-tooltip .tooltip-description {
  display: block;
  color: #3c5028;
  font:
    12px/1.45 Arial,
    sans-serif;
}
@media (max-width: 700px) {
  #friendsRail {
    left: 3px;
    top: 15%;
    max-height: min(42.75vw, 360px);
    overflow: hidden;
  }
  #friendsRailBody {
    width: 194px;
    max-height: min(42.75vw, 360px);
    padding: 5px;
  }
  #friendsRailList {
    max-height: min(calc(42.75vw - 40px), 310px);
  }
  .friends-rail-person {
    grid-template-columns: 28px minmax(0, 1fr) 25px 25px;
    gap: 4px;
    padding: 2px;
  }
  .friends-rail-person > img {
    width: 27px;
    height: 27px;
  }
  .friends-rail-name {
    font-size: 10px;
  }
  .friends-rail-stat {
    width: 25px;
    height: 25px;
  }
  .friends-rail-stat > b {
    font-size: 8px;
  }
  #hudActions {
    padding: 2px;
    gap: 0;
  }
  #hudActions > button,
  #hudActions > a {
    min-width: 31px;
  }
  #game.visiting #status {
    bottom: 18%;
  }
  #visitBanner {
    top: 1%;
    right: 1%;
    left: auto;
    max-width: 42%;
    gap: 4px;
    padding: 3px 5px;
    transform: none;
  }
  #visitName {
    display: none;
  }
  #visitBanner button {
    padding: 3px 5px;
    font-size: 10px;
  }
}
#rotatePrompt {
  display: none;
}
@media (max-width: 700px) and (orientation: portrait) {
  #game > *:not(#rotatePrompt) {
    visibility: hidden;
  }
  #rotatePrompt {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    background: radial-gradient(ellipse at center, #456c25, #17260f 72%);
    color: #fffbe7;
    text-align: center;
    padding: 24px;
  }
  #rotatePrompt[hidden] {
    display: none;
  }
  #authScreen {
    visibility: hidden;
  }
  .rotate-card {
    max-width: 300px;
  }
  .rotate-card > span {
    display: block;
    font: 64px Arial;
    transform: rotate(-45deg);
    color: #f3d36a;
  }
  .rotate-card h1 {
    font: 26px Georgia;
    margin: 14px 0;
  }
  .rotate-card p {
    font: 15px/1.5 Arial;
    margin: 0 0 18px;
    color: #e0e8ca;
  }
  .rotate-card button {
    border: 1px solid #d7e8a5;
    border-radius: 7px;
    background: linear-gradient(#a9c966, #6f953e);
    color: #fffce9;
    padding: 12px 16px;
    font: bold 14px Arial;
    box-shadow: 0 3px #365922;
  }
}
@media (max-width: 700px) and (orientation: landscape) {
  #game {
    width: 100vw;
    height: 56.25vw;
    top: 50%;
    transform: translateY(-50%);
  }
  #toolbar {
    left: 22%;
    width: 56%;
    height: 14%;
    bottom: 1%;
  }
  #toolbar button {
    padding: 2px;
  }
  #toolbar img {
    max-width: 50px;
    max-height: 50px;
  }
  #toolHint {
    bottom: 16%;
  }
  #friendsRail {
    top: 18%;
    max-height: 62vh;
  }
  #friendsRailList {
    max-height: 54vh;
  }
  #cameraControls {
    right: 2%;
    bottom: 2%;
  }
}
#game.visiting #status {
  top: auto;
  bottom: 13%;
}
#game.visiting #toolHint {
  display: none;
}
@media (max-width: 700px) {
  #hudActions #helpOpen {
    min-width: 52px;
    height: 28px;
    padding: 3px 5px;
    font-size: 10px;
  }
  #hudActions #helpOpen .help-mark {
    width: 16px;
    height: 16px;
    font-size: 10px;
  }
  #cameraControls {
    right: 2%;
    bottom: 2%;
  }
}
