/* ============================================================
   The Garden — cozy pixel UI
   ============================================================ */
@font-face {
  font-family: "Press Start 2P";
  src: url("../assets/fonts/PressStart2P-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #2e4031;
  --bg2: #24331f;
  --panel: #f7ecd4;
  --panel-dark: #e6d3ac;
  --ink: #3b2d1f;
  --ink-soft: #7a6a50;
  --accent: #6fae4e;
  --accent-dark: #4c8736;
  --gold: #e8b84b;
  --red: #c65b4e;
  --up: #3f9448;
  --down: #c65b4e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(ellipse 40% 30% at 8% 12%, rgba(26, 42, 24, .9) 0%, transparent 70%),
    radial-gradient(ellipse 45% 35% at 94% 20%, rgba(24, 40, 22, .9) 0%, transparent 70%),
    radial-gradient(ellipse 50% 30% at 12% 92%, rgba(22, 36, 20, .95) 0%, transparent 70%),
    radial-gradient(ellipse 50% 32% at 90% 90%, rgba(22, 36, 20, .95) 0%, transparent 70%),
    radial-gradient(ellipse at 50% -20%, #435c3b 0%, var(--bg) 45%, var(--bg2) 100%);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* full-page petal/firefly overlay */
#page-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

/* header nav */
#mainnav { display: flex; gap: 18px; margin-right: 10px; }
.nav-link {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  color: #c6d8ba;
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.nav-link:hover { color: #fff; }
.nav-link.active { color: #f5e6c8; border-bottom-color: var(--accent); }

/* round coin icons */
.cicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff8e6;
  border: 2px solid var(--panel-dark);
  font-size: 13px;
  flex: 0 0 auto;
}
.guide-steps p { font-size: 13px; line-height: 1.5; margin: 8px 0; }

/* ---------- top bar ---------- */
#topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}
#topbar h1 {
  font-family: "Press Start 2P", monospace;
  font-size: 15px;
  color: #f5e6c8;
  margin: 0;
  text-shadow: 2px 2px 0 #1a2414;
}
#demo-badge {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  background: var(--gold);
  color: #4a3410;
  border: 2px solid #4a3410;
  padding: 4px 7px;
  border-radius: 3px;
  box-shadow: 2px 2px 0 rgba(0,0,0,.35);
}
#live-badge {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  background: #3f9448;
  color: #eaffe6;
  border: 2px solid #1f5a26;
  padding: 4px 7px;
  border-radius: 3px;
  box-shadow: 2px 2px 0 rgba(0,0,0,.35);
}
body.wallet-mode .demo-only { display: none !important; }
.dc-row.readonly { justify-content: space-between; font-size: 12px; color: var(--ink-soft); }
.dc-pair-warn { font-size: 10px; color: #a0703c; }
.tagline { color: #b9ccae; font-size: 13px; flex: 1; }
#panel-toggle { display: none; }

/* ---------- layout ---------- */
#layout {
  display: flex;
  gap: 14px;
  padding: 0 14px 14px;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
}
#stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
#game {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 3px solid #171f12;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 0 3px #5b7250;
  background: #24331f;
}
#loading {
  font-family: "Press Start 2P", monospace;
  color: #d6e8c8;
  padding: 60px 20px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
#loading img {
  width: 44px;
  image-rendering: pixelated;
  animation: sprout-bounce 1.1s ease-in-out infinite;
}
@keyframes sprout-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.06); }
}

/* hover tooltip over garden things */
#tip {
  position: fixed;
  z-index: 45;
  pointer-events: none;
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 5px;
  box-shadow: 2px 2px 0 rgba(0,0,0,.4);
  padding: 5px 9px;
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
}
#tip b { font-family: "Press Start 2P", monospace; font-size: 9px; }

/* stat value bump */
.bump { animation: stat-bump .35s ease-out; }
@keyframes stat-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.sb-item b { display: inline-block; }
#help-line {
  color: #9cb490;
  font-size: 12px;
  margin: 8px 0 0;
  text-align: center;
}

/* ---------- visit banner ---------- */
#visit-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow: 3px 3px 0 rgba(0,0,0,.4);
  padding: 8px 14px;
  margin-bottom: 10px;
  font-size: 13px;
}
#visit-banner[hidden] { display: none; }
body.visit-mode #panel { display: none; }
body.visit-mode #connect-btn { display: none; }
body.visit-mode #panel-toggle { display: none; }

/* ---------- explore ---------- */
.explore-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.explore-tabs .btn.active { background: var(--accent); color: #fff; border-color: #2f5a1e; }
.garden-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--panel-dark);
  border-radius: 6px;
  background: #fdf6e4;
  padding: 8px 10px;
  margin-bottom: 7px;
  cursor: pointer;
}
.garden-card:hover { border-color: var(--accent-dark); background: #eef7e0; }
.garden-card .gc-name { font-family: "Press Start 2P", monospace; font-size: 9px; }
.garden-card .gc-meta { color: var(--ink-soft); font-size: 11px; }
.garden-card .gc-value { margin-left: auto; font-weight: 700; }

/* ---------- garden stats bar (fills space under the canvas) ---------- */
#stats-bar {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  width: 100%;
  max-width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}
.sb-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 16px;
  min-width: 120px;
  background: linear-gradient(160deg, #6d4c2c, #59391f 60%, #4c2f18);
  border: 3px solid #3a2410;
  border-radius: 6px;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, .4), inset 0 0 0 2px #7c5a35;
}
.sb-item span {
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  text-transform: uppercase;
  color: #c9ae7e;
}
.sb-item b {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: #f7ecd4;
}
.sb-shelf { cursor: pointer; min-width: 180px; }
.sb-shelf:hover { filter: brightness(1.12); }
#sb-trophies { display: flex; gap: 4px; align-items: flex-end; min-height: 26px; }
#sb-trophies img { width: 24px; height: 24px; image-rendering: pixelated; }
#sb-trophies .hint-mini { color: #a58a5e; font-size: 11px; font-style: normal; }

/* ---------- side panel ---------- */
#panel {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 70px);
  overflow-y: auto;
  padding-bottom: 8px;
}
.panel-box {
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow: 3px 3px 0 rgba(0,0,0,.4), inset 0 0 0 2px var(--panel-dark);
  padding: 12px;
}
.panel-box h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  margin: 0 0 8px;
  color: var(--ink);
}
.panel-box h3 {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  margin: 14px 0 6px;
  color: var(--ink-soft);
}
.hint { font-size: 12px; color: var(--ink-soft); margin: 4px 0 8px; line-height: 1.45; }

/* ---------- demo coin editor ---------- */
.demo-coin {
  border: 2px solid var(--panel-dark);
  border-radius: 5px;
  padding: 7px 8px;
  margin-bottom: 7px;
  background: #fdf6e4;
}
.dc-head { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.dc-head b { font-family: "Press Start 2P", monospace; font-size: 9px; }
.dc-usd { margin-left: auto; font-weight: 600; font-size: 12px; color: var(--ink-soft); }
.badge {
  font-size: 10px;
  background: #ded0b0;
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--ink-soft);
}
.badge.planted { background: #cfe8b8; color: #2f5a1e; }
.badge.sold { background: #e8c4bc; color: #7a2f24; }
.dc-row { display: flex; align-items: center; gap: 7px; margin-top: 5px; }
.dc-row label { font-size: 10px; color: var(--ink-soft); width: 32px; text-transform: uppercase; }
.dc-row input[type="range"] { flex: 1; accent-color: var(--accent-dark); }
.dc-row input[type="number"] {
  flex: 1;
  border: 2px solid var(--panel-dark);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
  background: #fff;
  color: var(--ink);
}
.dc-pct { font-size: 11px; font-weight: 700; width: 44px; text-align: right; }
.up { color: var(--up); }
.down { color: var(--down); }
.proj-stats { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.proj-stats .stat { flex: 1; }

/* ---------- stats ---------- */
.stat {
  display: flex;
  flex-direction: column;
  background: #fdf6e4;
  border: 2px solid var(--panel-dark);
  border-radius: 5px;
  padding: 5px 8px;
  margin-bottom: 6px;
}
.stat span { font-size: 10px; text-transform: uppercase; color: var(--ink-soft); }
.stat b { font-size: 13px; }
.stat em { font-style: normal; font-size: 11px; }

/* ---------- buttons ---------- */
.btn {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  padding: 9px 12px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: var(--panel-dark);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0,0,0,.35);
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(0,0,0,.35); }
.btn.primary { background: var(--accent); color: #fff; border-color: #2f5a1e; }
.btn.danger { background: var(--red); color: #fff; border-color: #6e281f; }
.btn.small { padding: 6px 9px; font-size: 8px; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- modal ---------- */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 10, .6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
#modal.open { display: flex; }
#modal-body {
  width: min(480px, 94vw);
  max-height: 86vh;
  overflow-y: auto;
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } }

.coin-list { display: flex; flex-direction: column; gap: 5px; max-height: 180px; overflow-y: auto; }
.coin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--panel-dark);
  border-radius: 5px;
  padding: 6px 8px;
  cursor: pointer;
  background: #fdf6e4;
  font-size: 13px;
}
.coin-row:has(input:checked) { border-color: var(--accent-dark); background: #eef7e0; }
.coin-row .sym { font-family: "Press Start 2P", monospace; font-size: 9px; }
.coin-row .cname { color: var(--ink-soft); font-size: 12px; flex: 1; }
.coin-row .cval { font-weight: 700; font-size: 12px; }

.sp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-height: 320px; overflow-y: auto; padding-right: 4px; }
.sp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 2px solid var(--panel-dark);
  border-radius: 5px;
  padding: 6px 2px;
  cursor: pointer;
  background: #fdf6e4;
  font-size: 10px;
  text-align: center;
}
.sp-card:has(input:checked) { border-color: var(--accent-dark); background: #eef7e0; }
.sp-card img { width: 48px; height: 48px; image-rendering: pixelated; }
.sp-card input, .coin-row input { position: absolute; opacity: 0; }
.sp-card.locked { opacity: 0.55; cursor: not-allowed; filter: grayscale(0.6); }
.sp-card.locked small { font-size: 8px; color: var(--ink-soft); }

.detail-grid { display: flex; gap: 12px; align-items: flex-start; }
.plant-big { width: 96px; height: 96px; image-rendering: pixelated; background: #eef3e2; border: 2px solid var(--panel-dark); border-radius: 6px; }
.detail-grid > div { flex: 1; }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.trophy {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fdf6e4;
  border: 2px solid var(--panel-dark);
  border-radius: 6px;
  padding: 8px 4px;
  font-size: 11px;
  text-align: center;
}
.trophy img { width: 48px; height: 48px; image-rendering: pixelated; }
.trophy b { font-family: "Press Start 2P", monospace; font-size: 8px; margin-top: 3px; }
.trophy span { color: var(--ink-soft); font-size: 10px; }
.trophy em { color: var(--ink-soft); font-size: 9px; font-style: normal; }
.trophy .trophy-sub { font-size: 9px; color: var(--ink-soft); line-height: 1.4; }
.trophy.gold { border-color: var(--gold); box-shadow: 0 0 8px rgba(232,184,75,.5); }
.trophy.mythic { border-color: #b06ee8; box-shadow: 0 0 10px rgba(176,110,232,.55); }

/* ---------- unlocks ---------- */
.tier-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tier-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #fdf6e4;
  border: 2px solid var(--panel-dark);
  border-radius: 6px;
  padding: 7px;
  text-align: center;
  font-size: 11px;
}
.tier-card img { width: 100%; border-radius: 4px; image-rendering: auto; }
.tier-card b { font-family: "Press Start 2P", monospace; font-size: 8px; }
.tier-card span { color: var(--ink-soft); font-size: 10px; }
.tier-card em { font-style: normal; color: var(--accent-dark); font-weight: 700; font-size: 10px; }
.tier-card.owned { border-color: var(--accent-dark); }
.tree-row { display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
.tree-step { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--ink-soft); }
.tree-step img { width: 56px; height: 56px; image-rendering: pixelated; background: #eef3e2; border: 2px solid var(--panel-dark); border-radius: 5px; }

/* ---------- NFT view + share ---------- */
.nft-view { display: flex; gap: 14px; align-items: flex-start; }
.nft-view img { width: 180px; height: 180px; image-rendering: pixelated; border: 3px solid var(--ink); border-radius: 6px; background: #1d2b1a; }
.nft-view > div { flex: 1; }
.copyable { cursor: pointer; }
.copyable:hover { text-decoration: underline; }
.share-preview { width: 100%; border: 2px solid var(--panel-dark); border-radius: 6px; image-rendering: auto; }
.btn-row a.btn { text-decoration: none; display: inline-block; }
#music-btn.off, #sfx-btn.off { opacity: 0.45; }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(80px);
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow: 3px 3px 0 rgba(0,0,0,.4);
  padding: 10px 16px;
  font-size: 13px;
  z-index: 60;
  transition: transform .25s ease;
  max-width: 90vw;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- mobile ---------- */
@media (max-width: 700px) {
  #mainnav { display: none; }
  #stats-bar { gap: 6px; }
  .sb-item { min-width: 0; flex: 1 1 40%; padding: 8px 10px; }
  .sb-shelf { min-width: 0; }
}
@media (max-width: 860px) {
  #layout { flex-direction: column; align-items: center; }
  #panel { flex: 1 1 auto; width: 100%; max-width: 520px; max-height: none; display: none; }
  body.panel-open #panel { display: flex; }
  #panel-toggle { display: inline-block; }
  .tagline { display: none; }
  #topbar h1 { font-size: 12px; }
}
