:root {
  --sky: #eff8ff;
  --mint: #dff8d6;
  --grass: #84cf57;
  --grass-deep: #469032;
  --soil: #8e5f39;
  --soil-deep: #6d4326;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-border: rgba(77, 125, 53, 0.18);
  --ink: #18321a;
  --muted: #5f755e;
  --sun: #ffd95c;
  --pea: #75d54b;
  --ice: #9fe7ff;
  --chili: #ff7d4f;
  --blue: #4ea3d8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.7), transparent 22%),
    linear-gradient(180deg, #d8f4ff 0%, #f8ffe8 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

body {
  padding: 18px;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  min-height: calc(100vh - 36px);
}

.sidebar,
.board-area {
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 60px rgba(55, 108, 47, 0.12);
}

.sidebar {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.brand h1,
.overlay-card h2 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.brand p,
.overlay-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.eyebrow,
.panel-title,
.hud-card span {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: #6ba64d;
  font-weight: 700;
}

.panel {
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(112, 168, 74, 0.16);
}

.tips {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.plant-cards {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.plant-card {
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 22px;
  border: 2px solid transparent;
  background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(236,255,228,0.94));
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.plant-card:hover {
  transform: translateY(-2px);
}

.plant-card.active {
  border-color: #70c64f;
  box-shadow: 0 10px 25px rgba(94, 180, 67, 0.18);
}

.plant-card strong {
  display: block;
  font-size: 1rem;
}

.plant-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.plant-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-weight: 700;
  color: #477d2f;
}

.board-area {
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  position: sticky;
  top: 18px;
}

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

.hud-card {
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(112, 168, 74, 0.16);
}

.hud-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid rgba(112, 168, 74, 0.16);
  background:
    linear-gradient(180deg, #bff0ff 0%, #dcffef 28%, #95d96a 28%, #68ba44 100%);
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  touch-action: manipulation;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(250, 255, 246, 0.54);
  backdrop-filter: blur(6px);
  z-index: 3;
}

.hidden {
  display: none;
}

.overlay-card {
  width: min(720px, calc(100% - 32px));
  padding: 26px;
  border-radius: 28px;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(112, 168, 74, 0.2);
  box-shadow: 0 20px 50px rgba(84, 129, 61, 0.16);
}

.action {
  margin-top: 18px;
  padding: 14px 22px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #7de34f, #ffe267);
  font-weight: 700;
  color: #23431f;
  cursor: pointer;
}

.skillbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.quick-plant-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(112, 168, 74, 0.2);
  box-shadow: 0 10px 24px rgba(32, 88, 74, 0.14);
}

.quick-plant {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border: 2px solid transparent;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 2px;
  background: #f9fff0;
  cursor: pointer;
  position: relative;
}

.quick-plant.active {
  border-color: #267365;
  background: #ddffd0;
}

.quick-plant.tool {
  background: #fff7df;
}

.quick-plant.tool.active {
  border-color: #b54637;
  background: #ffe2d6;
}

.quick-plant:disabled {
  filter: grayscale(0.8);
  opacity: 0.55;
}

.quick-plant img {
  max-width: 48px;
  max-height: 48px;
  pointer-events: none;
}

.quick-badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #267365;
  color: white;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.upgrade-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, auto);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(112, 168, 74, 0.2);
  box-shadow: 0 10px 24px rgba(32, 88, 74, 0.12);
}

.upgrade-panel span,
.upgrade-panel strong {
  display: block;
}

.upgrade-panel span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.upgrade-panel strong {
  margin-top: 2px;
  font-size: 0.95rem;
}

.upgrade-panel button {
  border: 0;
  border-radius: 8px;
  padding: 11px 13px;
  color: white;
  background: linear-gradient(135deg, #4ea3d8, #267365);
  font-weight: 800;
  cursor: pointer;
}

.upgrade-panel button:nth-child(3) {
  background: linear-gradient(135deg, #7c62d8, #4ea3d8);
}

.upgrade-panel button:nth-child(4) {
  background: linear-gradient(135deg, #ff9f4f, #b54637);
}

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

.skillbar button {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  color: white;
  background: linear-gradient(135deg, #267365, #4ea3d8);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(32, 88, 74, 0.22);
  cursor: pointer;
}

.skillbar button:nth-child(2) {
  background: linear-gradient(135deg, #b54637, #ff9f4f);
}

.skillbar button:nth-child(3) {
  background: linear-gradient(135deg, #5d5aa8, #af76d6);
}

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

.beian-footer {
  margin: 18px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.beian-footer a {
  display: inline-flex;
  min-height: 28px;
  gap: 5px;
  align-items: center;
}

.beian-footer img {
  display: block;
  flex: none;
}

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

  .board-area {
    order: -1;
    position: static;
  }

  .sidebar {
    max-height: none;
  }
}

@media (max-width: 760px) {
  body {
    padding: 12px;
  }

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

  .skillbar {
    justify-content: stretch;
  }

  .skillbar button {
    flex: 1;
    padding: 11px 8px;
  }

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

  .upgrade-panel button {
    width: 100%;
  }
}
