:root {
  color-scheme: light;
  --forest: #173f2b;
  --leaf: #2f7d4a;
  --leaf-soft: #e8f3e5;
  --gold: #d8a83f;
  --soil: #7a5031;
  --cream: #fffdf7;
  --muted: #5d6c62;
  --danger: #a43c32;
  --shadow: 0 24px 80px -45px rgba(23, 63, 43, 0.75);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(216, 168, 63, 0.2), transparent 34rem),
    linear-gradient(135deg, #f5f0dc 0%, #e7f1e2 46%, #dcebd3 100%);
  color: var(--forest);
}

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

.game-shell {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 max(22px, env(safe-area-inset-bottom));
}

.hero-card,
.hud article,
.tools,
.field-grid,
.tips,
.result-dialog > div {
  border: 1px solid rgba(23, 63, 43, 0.12);
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  overflow: hidden;
  position: relative;
  border-radius: 34px;
  padding: clamp(24px, 5vw, 52px);
}

.hero-card::after {
  content: "🌽";
  position: absolute;
  right: clamp(18px, 5vw, 70px);
  top: 22px;
  font-size: clamp(4rem, 12vw, 8rem);
  opacity: 0.16;
  transform: rotate(12deg);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--leaf);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(2.4rem, 8vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.hero-card p:not(.eyebrow),
.tips li,
.result-dialog p {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.primary-button,
.ghost-link,
.tool {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 16px;
  border: 0;
  padding: 0 18px;
  font-weight: 900;
  text-decoration: none;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.primary-button {
  background: var(--leaf);
  color: white;
  box-shadow: 0 14px 28px -18px rgba(23, 63, 43, 0.8);
}

.ghost-link {
  border: 1px solid rgba(23, 63, 43, 0.14);
  background: white;
  color: var(--forest);
}

.primary-button:hover,
.ghost-link:hover,
.tool:hover {
  transform: translateY(-2px);
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.hud article {
  border-radius: 22px;
  padding: 16px;
}

.hud span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(1.25rem, 5vw, 2rem);
}

.play-area {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 16px;
}

.tools {
  display: grid;
  align-content: start;
  gap: 10px;
  border-radius: 28px;
  padding: 14px;
}

.tool {
  width: 100%;
  justify-content: flex-start;
  border: 1px solid rgba(23, 63, 43, 0.12);
  background: #fff;
  color: var(--forest);
  cursor: pointer;
}

.tool span {
  font-size: 1.25rem;
}

.tool.is-selected {
  border-color: rgba(47, 125, 74, 0.45);
  background: var(--leaf-soft);
  color: var(--leaf);
}

.field-grid {
  display: grid;
  min-height: 460px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  border-radius: 32px;
  padding: 16px;
  background:
    linear-gradient(30deg, rgba(255, 255, 255, 0.38) 12%, transparent 12% 50%, rgba(255, 255, 255, 0.32) 50% 62%, transparent 62%),
    #a87a4e;
  background-size: 34px 34px;
}

.plot {
  position: relative;
  min-height: 130px;
  overflow: hidden;
  border: 4px solid rgba(82, 48, 26, 0.18);
  border-radius: 24px;
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.25), transparent 28%),
    linear-gradient(145deg, #8a5a38, #6d4429);
  color: white;
  cursor: pointer;
  isolation: isolate;
}

.plot::before {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: -1;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
}

.plot .emoji {
  display: block;
  font-size: clamp(2.2rem, 8vw, 4.4rem);
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.28));
}

.plot .label {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  opacity: 0.86;
}

.plot.is-empty {
  color: rgba(255, 255, 255, 0.72);
}

.plot.is-ready {
  border-color: rgba(216, 168, 63, 0.72);
  box-shadow: inset 0 0 0 999px rgba(216, 168, 63, 0.15);
}

.plot.has-pest {
  border-color: rgba(164, 60, 50, 0.8);
  animation: shake 420ms ease both;
}

.plot.is-wilted {
  filter: grayscale(0.85);
  opacity: 0.74;
}

.tips {
  margin-top: 16px;
  border-radius: 28px;
  padding: 22px;
}

.tips h2 {
  margin-bottom: 10px;
}

.tips ul {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tips li {
  border-radius: 16px;
  background: white;
  padding: 12px;
  font-size: 0.9rem;
}

.result-dialog {
  width: min(560px, calc(100% - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}

.result-dialog::backdrop {
  background: rgba(16, 36, 24, 0.55);
  backdrop-filter: blur(8px);
}

.result-dialog > div {
  border-radius: 32px;
  padding: 28px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0 0;
}

.result-stats div {
  border-radius: 16px;
  background: var(--leaf-soft);
  padding: 12px;
}

.result-stats dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-stats dd {
  margin: 4px 0 0;
  font-size: 1.3rem;
  font-weight: 1000;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-4px);
  }
  60% {
    transform: translateX(4px);
  }
}

@media (max-width: 780px) {
  .hud,
  .tips ul,
  .result-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .play-area {
    grid-template-columns: 1fr;
  }

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

  .tool {
    min-height: 68px;
    flex-direction: column;
    justify-content: center;
    padding: 8px;
    font-size: 0.78rem;
  }

  .field-grid {
    min-height: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .plot {
    min-height: 104px;
  }
}

@media (max-width: 480px) {
  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .result-stats {
    grid-template-columns: 1fr;
  }
}
