:root {
  color-scheme: light;
  font-family: "Trebuchet MS", "Avenir Next", system-ui, sans-serif;
  color: #29422d;
  background: #dff3f6;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 5%, #fff9c7 0 4%, transparent 17%),
    linear-gradient(#bdebf4 0 58%, #9ed477 58% 100%);
}

.is-hidden {
  display: none !important;
}

.auth-shell {
  width: min(100% - 28px, 850px);
  margin: 0 auto;
  padding: clamp(28px, 7vw, 72px) 0;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.auth-intro {
  margin: 20px auto 26px;
  color: #3f6245;
  font-weight: 800;
  text-align: center;
}

.auth-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.auth-card {
  display: grid;
  gap: 14px;
  border: 5px solid #f8edc8;
  border-radius: 26px;
  padding: clamp(20px, 4vw, 32px);
  background: #fff9de;
  box-shadow: 0 9px 0 #a96c38, 0 18px 35px rgba(39, 87, 49, 0.22);
}

.auth-card label {
  display: grid;
  gap: 5px;
  color: #385d3d;
  font-weight: 900;
}

.auth-card input {
  width: 100%;
  border: 3px solid #9b7546;
  border-radius: 12px;
  padding: 10px 12px;
  color: #29422d;
  background: white;
  font: inherit;
}

.auth-card input:focus {
  outline: 4px solid #a5d77e;
  outline-offset: 2px;
}

.auth-card button {
  border: 0;
  border-radius: 999px;
  padding: 11px 14px;
  color: white;
  background: #579c55;
  box-shadow: 0 4px 0 #367240;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.auth-card button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.auth-card small {
  color: #6c5a3d;
  line-height: 1.35;
}

.auth-message {
  min-height: 24px;
  margin-top: 22px;
  color: #8e2f27;
  font-weight: 900;
  text-align: center;
}

.game-shell {
  width: min(100% - 28px, 980px);
  margin: 0 auto;
  padding: 24px 0 32px;
}

.game-header {
  display: grid;
  grid-template-columns: minmax(180px, 300px) 1fr;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
}

.game-brand {
  display: grid;
  justify-items: start;
  gap: 3px;
}

.game-logo {
  display: block;
  width: min(100%, 300px);
  height: auto;
  filter: drop-shadow(0 5px 2px rgba(53, 83, 36, 0.22));
}

.game-logo-auth {
  width: min(88vw, 430px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: #214e34;
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  line-height: 1;
  text-shadow: 0 2px white;
}

h2 {
  font-size: clamp(1.2rem, 4vw, 1.75rem);
}

.eyebrow {
  margin-bottom: 4px;
  color: #527258;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.coin-card,
.plot-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 3px solid #d58a27;
  border-radius: 999px;
  padding: 9px 14px;
  color: #67421d;
  background: #fff3b3;
  box-shadow: 0 4px 0 #bd7023;
  font-weight: 900;
  white-space: nowrap;
}

.coin {
  color: #f4b82f;
  text-shadow: 0 2px #b9791d;
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-card {
  display: grid;
  max-width: 155px;
  gap: 3px;
  color: #365640;
  text-align: right;
}

.account-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card button {
  border: 0;
  padding: 0;
  color: #8b4937;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: right;
  text-decoration: underline;
}

.level-card {
  display: grid;
  min-width: 112px;
  gap: 3px;
  border: 3px solid #547e3c;
  border-radius: 16px;
  padding: 7px 10px;
  color: #315330;
  background: #e4f4bd;
  box-shadow: 0 4px 0 #487037;
  text-align: center;
}

.level-card small {
  font-size: 0.65rem;
  font-weight: 900;
}

.xp-track {
  overflow: hidden;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #b6c98a;
}

.xp-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #61a653;
  transition: width 300ms ease;
}

.shop-button {
  border: 3px solid #397a48;
  border-radius: 999px;
  padding: 9px 14px;
  color: white;
  background: #5aa45d;
  box-shadow: 0 4px 0 #367342;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.shop-button:hover,
.shop-button:focus-visible {
  outline: 3px solid #fff3a8;
  outline-offset: 2px;
  filter: brightness(1.08);
}

.farm-scene {
  position: relative;
  overflow: hidden;
  border: 5px solid #f8edc8;
  border-radius: 32px;
  padding: clamp(18px, 4vw, 38px);
  background:
    linear-gradient(180deg, #d9f1a9cc, transparent 34%),
    url("assets/levi-art/grass_1.png") center / cover,
    #8dce64;
  box-shadow: 0 10px 0 #5b9c4e, 0 16px 28px rgba(39, 87, 49, 0.25);
}

.farm-scene::after {
  position: absolute;
  inset: auto 0 0;
  height: 120px;
  content: "";
  background: url("assets/levi-art/tree_2.png") left bottom / auto 75% no-repeat,
    url("assets/levi-art/windmill_1.png") right bottom / auto 100% no-repeat;
  pointer-events: none;
}

.field-heading {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.plot-count {
  border-color: #5e9d45;
  color: #315e32;
  background: #dff3af;
  box-shadow: 0 4px 0 #568b3f;
  font-size: 0.85rem;
}

.farm-grid {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(100%, 660px);
  margin: 0 auto 54px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(5px, 1.3vw, 12px);
  padding: clamp(10px, 2.2vw, 20px);
  border: 5px solid #b5753c;
  border-radius: 24px;
  background: #d9a25d;
  box-shadow: 0 9px 0 #8d562d, inset 0 0 0 4px #edbd78;
  transform: perspective(900px) rotateX(2deg);
}

.farm-plot {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  border: 3px solid #6c3f28;
  border-radius: 18% 18% 24% 24%;
  background:
    repeating-linear-gradient(
      100deg,
      transparent 0 16%,
      rgba(246, 189, 116, 0.16) 17% 21%,
      transparent 22% 32%
    ),
    #96603c;
  box-shadow: inset 0 4px 0 #b87a4d, 0 4px 0 #75472c;
  color: #fff9dc;
  cursor: pointer;
  font: inherit;
  transition: transform 140ms ease, filter 140ms ease;
}

.farm-plot:hover:not(:disabled),
.farm-plot:focus-visible {
  z-index: 1;
  outline: 4px solid #fff3a8;
  outline-offset: 2px;
  filter: brightness(1.08);
  transform: translateY(-3px);
}

.farm-plot:disabled {
  cursor: default;
}

.farm-plot.is-ready {
  outline: 4px solid #ffe56f;
  outline-offset: 1px;
  animation: ready-pulse 1.2s ease-in-out infinite alternate;
}

.farm-plot.is-withered {
  border-color: #524439;
  background:
    repeating-linear-gradient(100deg, transparent 0 16%, rgba(54, 45, 37, 0.22) 17% 21%, transparent 22% 32%),
    #756354;
  box-shadow: inset 0 4px 0 #8b7765, 0 4px 0 #4f4035;
  filter: saturate(0.55);
}

.farm-plot.is-withered .crop-timer {
  background: #4c3f36;
}

.farm-plot.is-item {
  border-color: #417b91;
  background: #72b8c8;
  box-shadow: inset 0 4px 0 #a3dce5, 0 4px 0 #3d7182;
}

.farm-plot.is-boosted:not(.is-item) {
  box-shadow: inset 0 4px 0 #b87a4d, 0 4px 0 #75472c, 0 0 0 4px #8ed6e4;
}

.plot-crop {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 86%;
  text-align: center;
}

.crop-art {
  display: block;
  width: 100%;
  height: clamp(16px, 5.5vw, 55px);
  object-fit: contain;
  object-position: center bottom;
}

.is-withered .crop-art {
  filter: sepia(1) brightness(0.65);
}

.sprinkler-art {
  display: block;
  width: clamp(18px, 5vw, 45px);
  aspect-ratio: 1.35;
  background:
    radial-gradient(circle at 22% 23%, #e3faff 0 7%, transparent 9%),
    radial-gradient(circle at 78% 23%, #e3faff 0 7%, transparent 9%),
    radial-gradient(ellipse at 50% 38%, #66e3fa 0 23%, transparent 25%),
    linear-gradient(#d3ecf0, #628c9f) center 75% / 23% 60% no-repeat,
    radial-gradient(ellipse at 50% 82%, #476976 0 37%, transparent 39%);
}

.crop-timer {
  margin-top: 3px;
  padding: 2px 5px;
  border-radius: 999px;
  color: #fffced;
  background: rgba(58, 43, 27, 0.72);
  font-size: clamp(0.5rem, 1.4vw, 0.72rem);
  font-weight: 900;
  white-space: nowrap;
}

.loading-message {
  grid-column: 1 / -1;
  padding: 52px 12px;
  color: #fff4cc;
  font-weight: 900;
  text-align: center;
}

.farm-plot::after {
  position: absolute;
  inset: 8% 3%;
  content: "";
  background: url("assets/levi-art/land_1.png") center bottom / contain no-repeat;
  pointer-events: none;
}

.farm-plot.is-item::after {
  display: none;
}

.sun {
  position: absolute;
  top: 22px;
  right: 12%;
  width: 58px;
  aspect-ratio: 1;
  border: 6px solid rgba(255, 247, 184, 0.7);
  border-radius: 50%;
  background: #ffd66e;
  box-shadow: 0 0 0 10px rgba(255, 225, 126, 0.25);
}

.cloud {
  position: absolute;
  width: 70px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

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

.cloud::before {
  left: 13px;
  width: 28px;
  height: 28px;
}

.cloud::after {
  right: 11px;
  width: 36px;
  height: 36px;
}

.cloud-one {
  top: 64px;
  left: 4%;
}

.cloud-two {
  top: 126px;
  right: 5%;
  transform: scale(0.7);
}

.scene-footer {
  position: absolute;
  z-index: 3;
  right: 18px;
  bottom: 12px;
  left: 18px;
  height: 76px;
}

.fence {
  position: absolute;
  right: 0;
  bottom: 7px;
  left: 0;
  height: 12px;
  border: 3px solid #9e672f;
  border-radius: 4px;
  background: #f1c36e;
  box-shadow: 0 -28px 0 -3px #f1c36e;
}

.barn {
  position: absolute;
  right: 8%;
  bottom: 7px;
  width: 62px;
  height: 54px;
  border: 4px solid #8f3e2d;
  border-radius: 6px 6px 3px 3px;
  background: #d95e42;
}

.barn-roof {
  position: absolute;
  top: -18px;
  left: -10px;
  width: 74px;
  height: 24px;
  border: 4px solid #703528;
  background: #974836;
  transform: perspective(40px) rotateX(16deg);
}

.barn-door {
  position: absolute;
  right: 15px;
  bottom: 0;
  width: 25px;
  height: 32px;
  border: 3px solid #8f3e2d;
  background: #f6d28a;
}

.tree {
  position: absolute;
  bottom: 7px;
  left: 7%;
  width: 14px;
  height: 48px;
  border-radius: 3px;
  background: #8d552f;
}

.tree span {
  position: absolute;
  top: -24px;
  left: 50%;
  width: 62px;
  aspect-ratio: 1;
  border: 4px solid #397543;
  border-radius: 46% 54% 52% 48%;
  background: #5cae55;
  box-shadow: inset 8px -8px 0 #4a9749;
  transform: translateX(-50%);
}

.step-note {
  margin-top: 20px;
  color: #315436;
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
}

.status-message {
  min-height: 24px;
  margin-top: 18px;
  color: #274d31;
  font-weight: 900;
  text-align: center;
}

.status-message.is-error {
  color: #8e2f27;
}

.crop-dialog {
  width: min(92vw, 520px);
  border: 5px solid #f8edc8;
  border-radius: 28px;
  padding: 24px;
  color: #29422d;
  background: #fff9de;
  box-shadow: 0 12px 0 #bd7b3c, 0 22px 50px rgba(35, 63, 37, 0.4);
}

.crop-dialog::backdrop {
  background: rgba(31, 63, 43, 0.58);
  backdrop-filter: blur(3px);
}

.crop-dialog form {
  position: relative;
}

.close-dialog {
  position: absolute;
  top: -14px;
  right: -12px;
  border: 0;
  color: #6a3e2a;
  background: transparent;
  cursor: pointer;
  font-size: 2rem;
  font-weight: 900;
}

.seed-help {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-top: 14px;
  line-height: 1.4;
}

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

.crop-option {
  display: grid;
  gap: 5px;
  place-items: center;
  border: 4px solid #a96535;
  border-radius: 20px;
  padding: 18px 10px;
  color: #3d583b;
  background: #f6d995;
  box-shadow: 0 5px 0 #88512e;
  cursor: pointer;
  font: inherit;
}

.crop-option:hover,
.crop-option:focus-visible {
  outline: 4px solid #78ae55;
  outline-offset: 2px;
  filter: brightness(1.04);
}

.crop-option small {
  color: #664a31;
}

.crop-option:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7);
  opacity: 0.55;
}

.inventory-count {
  border-radius: 999px;
  padding: 3px 8px;
  color: #315e32;
  background: #e5f2bd;
  font-size: 0.72rem;
  font-weight: 900;
}

.sprinkler-option {
  border-color: #43869b;
  background: #bce9ef;
  box-shadow: 0 5px 0 #396f7e;
}

.corn-option {
  border-color: #c38b27;
  background: #ffe68a;
  box-shadow: 0 5px 0 #9c6d21;
}

.shop-dialog h3 {
  margin: 22px 0 9px;
  color: #426849;
}

.shop-list {
  display: grid;
  gap: 10px;
}

.shop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 2px solid #d5b777;
  border-radius: 15px;
  padding: 10px 12px;
  background: #fffdf0;
}

.shop-row span {
  display: grid;
  gap: 2px;
}

.shop-row small {
  color: #725638;
}

.shop-row button {
  border: 0;
  border-radius: 999px;
  padding: 8px 13px;
  color: white;
  background: #5a9f58;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  white-space: nowrap;
}

.shop-row button:disabled {
  cursor: not-allowed;
  background: #9e9a85;
  opacity: 0.65;
}

.crop-icon {
  width: 48px;
  height: 42px;
  object-fit: contain;
}

@keyframes ready-pulse {
  to {
    filter: brightness(1.18);
    transform: translateY(-2px);
  }
}

@media (max-width: 620px) {
  .auth-panels {
    grid-template-columns: 1fr;
  }

  .game-shell {
    width: min(100% - 18px, 980px);
    padding-top: 12px;
  }

  .game-header {
    grid-template-columns: 1fr;
  }

  .game-brand {
    justify-items: center;
    text-align: center;
  }

  .game-logo {
    width: min(82vw, 300px);
  }

  .coin-card {
    justify-content: center;
    padding: 7px 12px;
  }

  .player-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .account-card {
    grid-column: 1 / -1;
    max-width: none;
    text-align: center;
  }

  .account-card button {
    text-align: center;
  }

  .level-card,
  .coin-card,
  .shop-button {
    min-width: 0;
    padding-right: 7px;
    padding-left: 7px;
    font-size: 0.78rem;
  }

  .farm-scene {
    border-width: 4px;
    border-radius: 23px;
    padding: 16px 10px;
  }

  .farm-grid {
    gap: 4px;
    margin-bottom: 46px;
    padding: 8px;
    border-width: 4px;
    border-radius: 16px;
  }

  .farm-plot {
    border-width: 2px;
    border-radius: 8px;
    box-shadow: inset 0 3px 0 #b87a4d, 0 3px 0 #75472c;
  }

  .plot-count {
    padding: 7px 10px;
    font-size: 0.75rem;
  }

  .crop-options {
    grid-template-columns: 1fr;
  }

  .sun,
  .cloud {
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
