:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --farm-height: 100vh;
}
@supports (height: 100dvh) {
  :root {
    --farm-height: 100dvh;
  }
}
html,
body {
  overscroll-behavior: none;
}
#farm {
  height: var(--farm-height);
  padding: 0;
  display: block;
}
#world {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#hud {
  position: absolute;
  top: calc(6px + var(--safe-top));
  right: calc(6px + var(--safe-right));
  left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  width: max-content;
  max-width: 190px;
  height: 48px;
  min-height: 48px;
  padding: 2px 3px;
  border: 1px solid #b8c6ae80;
  background: #fff8e8e8;
  border-radius: 11px;
  z-index: 5;
  box-shadow: 0 2px 9px #355e5114;
}
#hud #wallet {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  padding: 0 5px;
  min-width: 54px;
  text-align: center;
  max-width: 82px;
}
#hud button.hud-icon {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
}
#hud button:hover {
  background: #e4edcc;
}
#hud svg {
  display: block;
  width: 20px;
  height: 20px;
}
#hud #inventory-count {
  position: absolute;
  bottom: 1px;
  right: 3px;
  font-size: 8px;
  font-weight: 600;
  line-height: 1;
}
#caption {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: calc(10px + var(--safe-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: 280px;
  max-width: min(280px, calc(100% - 24px - var(--safe-left) - var(--safe-right)));
  margin: 0;
  padding: 5px 9px;
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  border-radius: 8px;
  background: #fff9eae8;
  pointer-events: none;
  z-index: 4;
}
#caption[hidden] {
  display: none;
}
.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;
}
body.mobile dialog {
  max-height: calc(var(--farm-height) - 16px - var(--safe-top) - var(--safe-bottom));
  width: calc(100% - 16px - var(--safe-left) - var(--safe-right));
  max-width: 520px;
  width: min(520px, calc(100% - 16px - var(--safe-left) - var(--safe-right)));
  padding: 10px;
  border-radius: 14px;
}
body.mobile .panel-header h2 {
  font-size: 19px;
  margin: 0;
}
body.mobile .panel-header #close {
  width: 44px;
  height: 44px;
  padding: 0;
}
body.mobile .card {
  padding: 7px;
}
body.mobile .card svg {
  width: 42px;
  height: 42px;
}
body.mobile .grid {
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
}
body.mobile #tile-menu {
  width: 166px;
  max-height: calc(var(--farm-height) - 16px - var(--safe-top) - var(--safe-bottom));
  overflow: auto;
  padding: 5px;
  border-radius: 10px;
}
body.mobile #tile-menu button {
  min-height: 44px;
  margin: 1px 0;
  padding: 6px 9px;
  font-size: 12px;
}
body.mobile input,
body.mobile select {
  font-size: 16px;
}
#farm:fullscreen {
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}
#dpad {
  display: none;
  position: absolute;
  left: calc(6px + var(--safe-left));
  bottom: calc(6px + var(--safe-bottom));
  width: 132px;
  height: 132px;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  pointer-events: none;
  z-index: 3;
}
body.mobile #dpad {
  display: grid;
}
body.mobile #dpad[hidden] {
  display: none;
}
#dpad button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 7px;
  border: 0;
  background: transparent;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  border-radius: 12px;
}
#dpad button::before {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  bottom: 5px;
  left: 5px;
  top: 5px;
  right: 5px;
  bottom: 5px;
  left: 5px;
  background: #fff8e8e8;
  border: 1px solid #b8c6ae80;
  border-radius: 9px;
  box-shadow: 0 2px 7px #355e5114;
  z-index: -1;
}
#dpad button {
  position: relative;
  color: #46654c;
}
#dpad button[aria-pressed=true]::before {
  background: #c8de9c;
  border-color: #799461;
}
#dpad button:focus-visible {
  outline: 3px solid #426e48;
  outline-offset: -2px;
}
#dpad svg {
  display: block;
  width: 30px;
  height: 30px;
}
#dpad .pad-up {
  grid-column: 2;
  grid-row: 1;
}
#dpad .pad-left {
  grid-column: 1;
  grid-row: 2;
}
#dpad .pad-left svg {
  transform: rotate(-90deg);
}
#dpad .pad-right {
  grid-column: 3;
  grid-row: 2;
}
#dpad .pad-right svg {
  transform: rotate(90deg);
}
#dpad .pad-down {
  grid-column: 2;
  grid-row: 3;
}
#dpad .pad-down svg {
  transform: rotate(180deg);
}
@supports not (width: min(100px, 100%)) {
  dialog {
    width: calc(100vw - 24px);
    max-width: 590px;
    max-height: 82vh;
  }
  #hud > * + * {
    margin-left: 2px;
  }
  .row > * {
    margin-right: 8px;
    margin-bottom: 8px;
  }
  .card > * + * {
    margin-top: 6px;
  }
}
