* { box-sizing: border-box; margin: 0; padding: 0; }

:root{
  --green-dark: #2f9e34;
  --green-mid: #6bd54a;
  --brown: #a9682f;
  --panel-bg: rgba(20, 30, 15, 0.72);
  --accent: #ffd24f;
  --text: #ffffff;
}

html, body{
  height: 100%;
  background: linear-gradient(180deg, #cdeeff 0%, #eafff0 100%);
  font-family: 'Segoe UI', Tahoma, Verdana, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  padding: 6px;
}

#stage{
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 960 / 620;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.28);
  border: 4px solid #ffffff;
}

canvas{
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
}

#cornerBtns{
  position: absolute;
  top: 12px; left: 12px;
  display: flex;
  gap: 8px;
  z-index: 10;
}
.icon-btn{
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  border: 2px solid rgba(255,255,255,0.5);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: transform .12s ease;
}
.icon-btn:hover{ transform: scale(1.08); }

#coinHud{
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(0,0,0,0.4);
  border: 2px solid var(--accent);
  border-radius: 20px;
  padding: 6px 16px;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}
.coin-icon{ font-size: 16px; }

#inventoryHud{
  position: absolute;
  top: 58px; right: 12px;
  background: rgba(0,0,0,0.4);
  border-radius: 14px;
  padding: 6px 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  z-index: 10;
  max-width: 240px;
  text-align: right;
  animation: pulseGlow 1.4s ease-in-out infinite;
}
@keyframes pulseGlow{
  0%,100%{ box-shadow: 0 0 0 rgba(255,210,79,0); }
  50%{ box-shadow: 0 0 14px rgba(255,210,79,0.7); }
}

#seedBar{
  position: absolute;
  bottom: 10px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: rgba(0,0,0,0.4);
  padding: 8px;
  border-radius: 16px;
  z-index: 10;
  max-width: 94%;
  overflow-x: auto;
}

.seed-btn{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 66px;
  padding: 6px 4px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  font-size: 10px;
  transition: transform .12s ease, background .15s ease;
  flex-shrink: 0;
}
.seed-btn:hover{ transform: translateY(-2px); background: rgba(255,255,255,0.22); }
.seed-btn.selected{ border-color: var(--accent); background: rgba(255,210,79,0.25); }
.seed-btn .emoji{ font-size: 22px; }
.seed-btn .name{ font-weight: 700; }
.seed-btn .cost{ color: var(--accent); font-weight: 700; }
.seed-btn.locked{ opacity: .45; cursor: not-allowed; }

#toast{
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
  z-index: 30;
  animation: toastPop .25s ease;
}
@keyframes toastPop{
  from{ opacity: 0; transform: translate(-50%,-50%) scale(0.8); }
  to{ opacity: 1; transform: translate(-50%,-50%) scale(1); }
}
.hidden{ display: none !important; }

.overlay{
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(10, 20, 10, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 20px;
  color: #fff;
}

.title{
  font-size: clamp(30px, 6vw, 46px);
  font-weight: 800;
  text-shadow: 0 4px 0 rgba(0,0,0,0.25);
}
.title span{ color: var(--accent); }
.subtitle{ opacity: .9; max-width: 420px; font-size: 14px; }

.btn{
  min-width: 200px;
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease;
}
.btn:hover{ transform: translateY(-2px); }
.btn.primary{ background: linear-gradient(135deg, #6bd54a, #2f9e34); color: #fff; box-shadow: 0 8px 20px rgba(47,158,52,0.4); }
.btn.danger{ background: linear-gradient(135deg, #ff6b6b, #c22b2b); color: #fff; }

.footer-note{ font-size: 12px; opacity: .75; max-width: 380px; margin-top: 6px; }

#title-bar{
  width: 100%;
  max-width: 960px;
  padding: 10px 16px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
#title-bar h3{ font-size: 18px; color: #234; }
#title-bar .sub{ font-size: 12px; color: #678; }

@media (max-width: 620px){
  .seed-btn{ width: 56px; font-size: 9px; }
  #coinHud{ font-size: 13px; padding: 5px 12px; }
}
