:root {
  color-scheme: light;
  --ink: #271f19;
  --muted: #6d614f;
  --panel: rgba(255, 246, 222, 0.92);
  --panel-strong: rgba(255, 252, 242, 0.96);
  --field: #7c9f54;
  --line: #d6b978;
  --accent: #567f25;
  --accent-dark: #324f1f;
  --accent-hot: #d79329;
  --barn: #b54133;
  --shadow: 0 22px 60px rgba(61, 43, 22, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 225, 151, 0.2), rgba(255, 248, 225, 0.45) 30%, rgba(143, 164, 104, 0.72) 100%),
    radial-gradient(circle at 64% 0%, rgba(255, 219, 115, 0.92) 0 7%, rgba(255, 188, 84, 0.28) 19%, transparent 36%),
    linear-gradient(155deg, transparent 0 39%, rgba(177, 120, 45, 0.32) 40% 53%, transparent 54%),
    linear-gradient(25deg, transparent 0 58%, rgba(83, 111, 72, 0.28) 59% 70%, transparent 71%),
    #e9c37c;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(165deg, transparent 0 44%, rgba(112, 79, 39, 0.2) 45% 48%, transparent 49%),
    linear-gradient(175deg, transparent 0 48%, rgba(123, 80, 34, 0.18) 49% 52%, transparent 53%),
    linear-gradient(180deg, transparent 0 68%, rgba(255, 255, 255, 0.42) 92%, rgba(255, 255, 255, 0.7) 100%);
}

button {
  border: 0;
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0;
}

.game-panel,
.side-panel {
  background: var(--panel);
  border: 1px solid rgba(121, 84, 38, 0.3);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.game-panel {
  min-width: 0;
  overflow: hidden;
}

.top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 16px;
  background:
    linear-gradient(90deg, rgba(255, 250, 234, 0.94), rgba(255, 230, 168, 0.62)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.48), transparent);
  border-bottom: 1px solid rgba(121, 84, 38, 0.24);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  letter-spacing: 0;
  line-height: 1.02;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

h2 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.top-bar p {
  max-width: 540px;
  margin-top: 6px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

.stats span {
  min-width: 88px;
  padding: 9px 10px;
  background: linear-gradient(180deg, #fff3cf, #ead091);
  border: 1px solid rgba(121, 84, 38, 0.28);
  border-radius: 6px;
  text-align: center;
  color: var(--muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.stats strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 1.2rem;
}

.farm-wrap {
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 207, 112, 0.44), rgba(91, 123, 55, 0.72)),
    linear-gradient(90deg, rgba(119, 69, 38, 0.16), transparent 34%, rgba(255, 244, 194, 0.22));
}

#farmCanvas {
  display: block;
  width: 100%;
  min-width: 0;
  max-height: calc(100vh - 220px);
  aspect-ratio: 4 / 3;
  background: var(--field);
  border: 2px solid rgba(55, 77, 31, 0.82);
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 246, 199, 0.16),
    0 14px 30px rgba(54, 68, 31, 0.24);
  cursor: pointer;
  touch-action: manipulation;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, 1fr));
  gap: 10px;
  padding: 14px 16px 16px;
  background: linear-gradient(180deg, rgba(255, 249, 232, 0.9), rgba(238, 211, 154, 0.76));
  border-top: 1px solid rgba(121, 84, 38, 0.24);
}

.tool,
.wide-button {
  min-width: 0;
  min-height: 42px;
  border-radius: 6px;
  background: linear-gradient(180deg, #fff2cb, #e5c783);
  color: var(--ink);
  border: 1px solid rgba(111, 79, 37, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
  cursor: pointer;
}

.tool:hover,
.wide-button:hover {
  background: linear-gradient(180deg, #ffe8a4, #d9b568);
}

.tool.is-active {
  background: linear-gradient(180deg, #7faa30, var(--accent));
  border-color: var(--accent-dark);
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 8px 18px rgba(50, 79, 31, 0.22);
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 251, 240, 0.95), rgba(240, 218, 171, 0.88)),
    linear-gradient(135deg, transparent, rgba(181, 65, 51, 0.08));
}

.side-panel section {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(121, 84, 38, 0.22);
}

.side-panel section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

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

.seed-card {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  background: linear-gradient(180deg, var(--panel-strong), rgba(247, 232, 195, 0.9));
  border: 1px solid rgba(121, 84, 38, 0.24);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(82, 55, 26, 0.08);
}

.seed-card.is-active {
  border-color: var(--accent);
  box-shadow:
    inset 0 0 0 1px var(--accent),
    0 6px 16px rgba(50, 79, 31, 0.14);
}

.seed-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.12);
}

.seed-name {
  display: block;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.seed-meta {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.seed-price {
  color: var(--barn);
  font-weight: 800;
}

.plot-details {
  display: grid;
  gap: 8px;
  margin: 0;
}

.plot-details div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(121, 84, 38, 0.16);
}

.plot-details div:last-child {
  border-bottom: 0;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.market-note {
  margin-bottom: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.wide-button {
  display: block;
  width: 100%;
  margin-top: 10px;
}

.wide-button.subtle {
  background: rgba(255, 252, 242, 0.46);
}

.wide-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .side-panel section {
    border-bottom: 0;
    padding-bottom: 0;
  }
}

@media (max-width: 640px) {
  .app-shell {
    display: block;
    width: calc(100vw - 20px);
    max-width: 1180px;
    padding: 10px 0;
    overflow: hidden;
  }

  .game-panel,
  .side-panel {
    width: 100%;
    max-width: 100%;
  }

  .side-panel {
    margin-top: 20px;
  }

  .top-bar {
    display: block;
    padding: 18px 20px 14px;
  }

  .stats {
    margin-top: 12px;
    justify-content: flex-start;
  }

  .farm-wrap {
    padding: 10px;
    overflow: hidden;
  }

  #farmCanvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
  }

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

  .side-panel {
    grid-template-columns: 1fr;
  }
}
