:root {
  --grass: #b7d58d;
  --grass-deep: #8fb873;
  --grass-pale: #d7e8b5;
  --ink: #2f4538;
  --muted: #6b7c68;
  --paper: #fff8e9;
  --paper-soft: #f8efd8;
  --wood: #bc8b5f;
  --soil: #a87850;
  --accent: #d99b54;
  --accent-deep: #aa7042;
  --shadow: rgba(54, 78, 51, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: #dcecc2;
}

button {
  color: inherit;
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.topbar,
.farm-layout,
.bottom-grid {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 16px;
}

.eyebrow,
.panel-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 5vw, 52px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0;
}

.resource-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.resource-pill {
  min-width: 72px;
  padding: 8px 10px;
  border: 1px solid rgba(76, 104, 65, 0.14);
  border-radius: 8px;
  background: rgba(255, 248, 233, 0.72);
  box-shadow: 0 6px 14px var(--shadow);
  font-weight: 700;
  text-align: center;
}

.farm-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: stretch;
}

.farm-stage {
  position: relative;
  min-height: 610px;
  overflow: hidden;
  border: 1px solid rgba(76, 104, 65, 0.16);
  border-radius: 8px;
  background:
    radial-gradient(circle at 14% 16%, rgba(255, 255, 210, 0.18) 0 2px, transparent 3px),
    radial-gradient(circle at 76% 28%, rgba(255, 255, 210, 0.18) 0 2px, transparent 3px),
    linear-gradient(135deg, var(--grass-pale), var(--grass) 48%, #a8c982);
  box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.05), 0 16px 40px var(--shadow);
}

.grass-noise {
  position: absolute;
  inset: 0;
  opacity: 0.34;
  background-image:
    linear-gradient(70deg, transparent 0 92%, rgba(58, 105, 57, 0.45) 93% 96%, transparent 97%),
    linear-gradient(120deg, transparent 0 90%, rgba(255, 255, 255, 0.25) 91% 94%, transparent 95%);
  background-size: 32px 24px, 41px 31px;
}

.path {
  position: absolute;
  background: rgba(238, 213, 150, 0.54);
  box-shadow: inset 0 0 0 2px rgba(169, 129, 78, 0.09);
}

.path-main {
  left: 7%;
  bottom: 17%;
  width: 72%;
  height: 58px;
  border-radius: 50%;
  transform: rotate(-12deg);
}

.path-side {
  left: 42%;
  top: 24%;
  width: 44px;
  height: 50%;
  border-radius: 45%;
  transform: rotate(32deg);
}

.plot,
.hut,
.orchard,
.mine,
.bakery,
.caravan {
  position: absolute;
  border: 0;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

.plot:hover,
.hut:hover,
.orchard:hover,
.mine:hover,
.bakery:hover,
.caravan:hover {
  transform: translateY(-3px);
  filter: brightness(1.04);
}

.plot {
  width: 138px;
  height: 104px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 246, 204, 0.16) 0 9px, transparent 9px 20px),
    linear-gradient(135deg, #b9875a, var(--soil));
  box-shadow: inset 0 0 0 7px rgba(94, 64, 43, 0.12), 0 13px 20px var(--shadow);
}

.plot::after {
  content: "";
  position: absolute;
  inset: 20px 22px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 20% 45%, #d76655 0 7px, transparent 8px),
    radial-gradient(circle at 52% 45%, #d76655 0 7px, transparent 8px),
    radial-gradient(circle at 80% 45%, #d76655 0 7px, transparent 8px),
    radial-gradient(circle at 36% 75%, #d76655 0 7px, transparent 8px),
    radial-gradient(circle at 66% 74%, #d76655 0 7px, transparent 8px);
  opacity: 0;
}

.plot.planted::after {
  opacity: 1;
}

.plot-a {
  left: 13%;
  top: 38%;
}

.plot-b {
  left: 34%;
  top: 51%;
}

.hut {
  right: 12%;
  top: 14%;
  width: 150px;
  height: 118px;
  border-radius: 8px;
  background: linear-gradient(#eacb91, #c79663);
  box-shadow: inset 0 -13px rgba(131, 91, 56, 0.13), 0 14px 24px var(--shadow);
}

.hut .roof {
  position: absolute;
  left: -16px;
  right: -16px;
  top: -28px;
  height: 48px;
  border-radius: 8px 8px 4px 4px;
  background: #bd6e56;
  transform: skewX(-7deg);
}

.hut .door {
  position: absolute;
  left: 62px;
  bottom: 0;
  width: 34px;
  height: 52px;
  border-radius: 14px 14px 0 0;
  background: #7d543b;
}

.orchard {
  left: 58%;
  top: 43%;
  width: 112px;
  height: 130px;
  border-radius: 50% 50% 46% 46%;
  background:
    radial-gradient(circle at 38% 34%, #dba55e 0 9px, transparent 10px),
    radial-gradient(circle at 63% 52%, #dba55e 0 8px, transparent 9px),
    radial-gradient(circle at 50% 42%, #8fb36c 0 46px, transparent 47px),
    linear-gradient(90deg, transparent 45%, #9a6d45 46% 56%, transparent 57%);
}

.mine {
  left: 10%;
  top: 12%;
  width: 142px;
  height: 96px;
  border-radius: 48% 52% 10px 10px;
  background:
    radial-gradient(ellipse at 50% 78%, #3d443e 0 36px, transparent 37px),
    linear-gradient(135deg, #aeb3a4, #7f8b7d);
  box-shadow: 0 14px 22px var(--shadow);
}

.bakery {
  right: 24%;
  bottom: 17%;
  width: 126px;
  height: 100px;
  border-radius: 8px;
  background: #e4b878;
  box-shadow: 0 14px 22px var(--shadow);
}

.bakery::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: -21px;
  height: 34px;
  border-radius: 50% 50% 8px 8px;
  background: #c76e55;
}

.bakery span {
  position: absolute;
  right: 18px;
  top: -46px;
  width: 18px;
  height: 42px;
  border-radius: 5px;
  background: #8d664d;
}

.bakery span::after {
  content: "";
  position: absolute;
  left: -8px;
  top: -15px;
  width: 34px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  animation: smoke 2.5s ease-in-out infinite;
}

.caravan {
  right: 8%;
  bottom: 10%;
  width: 120px;
  height: 66px;
  border-radius: 16px 20px 13px 13px;
  background: #d99b54;
  box-shadow: 0 13px 22px var(--shadow);
}

.caravan::before,
.caravan::after {
  content: "";
  position: absolute;
  bottom: -9px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #5a4a3e;
}

.caravan::before {
  left: 19px;
}

.caravan::after {
  right: 19px;
}

.locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.tree {
  position: absolute;
  width: 72px;
  height: 86px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #93b86f 0 33px, transparent 34px);
}

.tree::after {
  content: "";
  position: absolute;
  left: 32px;
  bottom: 0;
  width: 11px;
  height: 38px;
  border-radius: 5px;
  background: #8b6544;
}

.tree-one {
  left: 70%;
  top: 63%;
}

.tree-two {
  left: 6%;
  bottom: 9%;
}

.tree-three {
  right: 6%;
  top: 47%;
}

.rock {
  position: absolute;
  width: 45px;
  height: 31px;
  border-radius: 50% 48% 42% 44%;
  background: #9da695;
  box-shadow: inset -8px -5px rgba(87, 96, 86, 0.17);
}

.rock-one {
  left: 29%;
  top: 23%;
}

.rock-two {
  right: 33%;
  bottom: 11%;
}

.fence {
  position: absolute;
  background: repeating-linear-gradient(90deg, #a9784d 0 12px, transparent 12px 28px);
}

.fence-top {
  left: 16%;
  top: 6%;
  width: 55%;
  height: 18px;
}

.fence-right {
  right: 3%;
  top: 10%;
  width: 18px;
  height: 50%;
  background: repeating-linear-gradient(0deg, #a9784d 0 12px, transparent 12px 28px);
}

.side-panel,
.inventory,
.story,
.soft-dialog,
.wait-dialog {
  border: 1px solid rgba(76, 104, 65, 0.14);
  border-radius: 8px;
  background: rgba(255, 248, 233, 0.86);
  box-shadow: 0 16px 36px var(--shadow);
}

.side-panel {
  padding: 16px;
}

.panel-block {
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.36);
  margin-bottom: 12px;
}

.panel-block p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.action-button,
.primary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
}

.action-button {
  width: 100%;
  border: 1px solid rgba(111, 130, 85, 0.18);
  padding: 12px;
  background: #fffaf0;
  text-align: left;
  box-shadow: 0 7px 14px rgba(54, 78, 51, 0.08);
}

.action-button strong {
  display: block;
  font-size: 16px;
}

.action-button span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.action-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.bottom-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 16px;
}

.inventory,
.story {
  padding: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.item-card {
  min-height: 86px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.item-card strong {
  display: block;
}

.item-card span,
.story-log p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.story-log {
  display: grid;
  gap: 9px;
}

.story-log p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.soft-dialog,
.wait-dialog {
  width: min(460px, calc(100vw - 28px));
  padding: 20px;
  color: var(--ink);
}

.wait-dialog {
  width: min(560px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(42, 62, 48, 0.28);
  backdrop-filter: blur(3px);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.primary-button,
.ghost-button {
  border: 1px solid rgba(91, 112, 76, 0.16);
  padding: 0 15px;
}

.primary-button {
  background: var(--accent);
  color: #fffaf0;
  font-weight: 700;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.38);
}

.wait-scene {
  display: grid;
  place-items: center;
  min-height: 180px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, #d9ebb7, #a9ce83);
  overflow: hidden;
}

.seedling {
  position: relative;
  width: 116px;
  height: 126px;
  animation: sway 2.4s ease-in-out infinite;
}

.seedling::before {
  content: "";
  position: absolute;
  left: 53px;
  bottom: 28px;
  width: 11px;
  height: 68px;
  border-radius: 8px;
  background: #6c9154;
}

.seedling::after {
  content: "";
  position: absolute;
  left: 22px;
  bottom: 84px;
  width: 45px;
  height: 28px;
  border-radius: 50% 0 50% 0;
  background: #7fac63;
  transform: rotate(-18deg);
}

.seedling span {
  position: absolute;
  right: 18px;
  bottom: 72px;
  width: 46px;
  height: 31px;
  border-radius: 0 50% 0 50%;
  background: #91bd6b;
  transform: rotate(16deg);
}

.progress-shell {
  width: 100%;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(87, 111, 72, 0.16);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8fb873, #d7ad67);
  transition: width 300ms ease;
}

.time-left {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.harvest-items {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.harvest-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

@keyframes sway {
  0%,
  100% {
    transform: rotate(-2deg);
  }

  50% {
    transform: rotate(2deg);
  }
}

@keyframes smoke {
  0%,
  100% {
    opacity: 0.2;
    transform: translateY(4px) scale(0.8);
  }

  50% {
    opacity: 0.55;
    transform: translateY(-8px) scale(1);
  }
}

@media (max-width: 900px) {
  .topbar,
  .farm-layout,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .resource-row {
    justify-content: flex-start;
  }

  .farm-stage {
    min-height: 500px;
  }

  .side-panel {
    order: -1;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100vw - 18px, 1180px);
    padding-top: 14px;
  }

  .farm-stage {
    min-height: 430px;
  }

  .plot {
    width: 105px;
    height: 82px;
  }

  .hut {
    width: 116px;
    height: 92px;
  }

  .hut .door {
    left: 47px;
  }

  .orchard {
    width: 84px;
    height: 105px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }
}
