/* ——— Master Builder's grounds (js/builder.js, js/builder-grounds.js) ———
   Below the East Wing on the palace map (in Speedy Town, the town park).
   Everything here starts with mb-. */

.mb-grounds {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  margin: 18px auto 0;
  padding: 16px clamp(12px, 2.4vw, 22px) 18px;
  border: 4px solid #fff;
  border-radius: 28px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.55) 0 6%, transparent 7%),
    radial-gradient(circle at 86% 12%, rgba(255, 255, 255, 0.45) 0 4%, transparent 5%),
    linear-gradient(#d4f2c4, #bdeaa8);
  box-shadow: 0 8px 0 #9fd58c, var(--shadow);
  scroll-margin-top: calc(var(--hud-top, 80px) + var(--chip, 100px) + 40px); /* clear of the title chip */
}
.pl-imm .mb-grounds { width: min(100%, 980px, max(600px, 90dvh)); }
.lp-night .mb-grounds { filter: brightness(0.9) saturate(0.9); }

.mb-head { display: flex; align-items: center; gap: 12px; }
.mb-head h2 { margin: 0; font-size: clamp(20px, 3.4vw, 28px); color: var(--ink); }
.mb-badge {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c4, #ffc53d 70%);
  box-shadow: 0 3px 0 #d99a12;
  font-size: 28px;
}
.mb-rank { margin: 2px 0 0; font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.mb-rank b { color: var(--ink); }

.mb-bar {
  height: 16px;
  margin: 12px 0 6px;
  overflow: hidden;
  border: 3px solid #fff;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.6);
}
.mb-bar i { display: block; height: 100%; min-width: 10px; border-radius: 99px; background: linear-gradient(90deg, #ff9cc8, #ffc53d); }
.mb-to-next { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.mb-how { margin: 6px 0 12px; font-size: 13px; color: var(--ink-soft); }

.mb-plots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(8px, 1.4vw, 14px); }
@media (max-width: 700px) {
  .mb-plots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.mb-plot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 6px 6px 10px;
  border: 3px solid #fff;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
  color: var(--ink);
  text-align: center;
}
.mb-plot .mb-art { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.mb-name { font-size: 14px; font-weight: 700; line-height: 1.15; }
.mb-note { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.mb-price { font-size: 14px; font-weight: 700; }

/* Built: it stands on a little patch of lawn. */
.mb-built { background: radial-gradient(ellipse at 50% 80%, #e9fbe0 0 45%, rgba(255, 255, 255, 0.8) 46%); }
.mb-built .mb-note { color: #2f8f4e; }

/* Rank reached: a blueprint, ready to build with gems. */
.mb-ready { cursor: pointer; border-style: dashed; border-color: #8fc2ff; background: #f2f8ff; }
.mb-blueprint {
  display: block;
  width: 100%;
  border-radius: 14px;
  background:
    repeating-linear-gradient(0deg, transparent 0 15px, rgba(80, 140, 230, 0.16) 15px 16px),
    repeating-linear-gradient(90deg, transparent 0 15px, rgba(80, 140, 230, 0.16) 15px 16px),
    #e3f0ff;
}
.mb-blueprint .mb-art { filter: grayscale(1) sepia(1) hue-rotate(175deg) saturate(2.4) opacity(0.6); }
.mb-ready.mb-can { border-color: #ffc53d; background: #fffbe8; box-shadow: 0 0 0 4px rgba(255, 197, 61, 0.35); animation: mb-ready 1.6s ease-in-out infinite alternate; }
.mb-ready.mb-can .mb-note { color: #b5710a; }
@keyframes mb-ready { to { box-shadow: 0 0 0 8px rgba(255, 197, 61, 0.15); } }

/* Not yet: a little wooden sign on an empty plot. */
.mb-locked { opacity: 0.85; }
.mb-sign {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  background: radial-gradient(ellipse at 50% 88%, #e9d2b0 0 30%, transparent 31%);
}
.mb-sign span {
  display: grid;
  place-items: center;
  width: 56%;
  aspect-ratio: 1.3;
  border: 3px solid #b5713d;
  border-radius: 12px;
  background: #f3d9b0;
  box-shadow: 0 4px 0 #b5713d;
  font-size: clamp(24px, 4vw, 38px);
  filter: grayscale(0.35);
}
.mb-next { opacity: 1; border-color: #ffd6ea; }
.mb-next .mb-note { color: var(--pink); }

/* Moving parts: the windmill's sails, the turbine, the Ferris wheel. */
.mb-spin { animation: mb-spin 9s linear infinite; }
.mb-spin.mb-slow { animation-duration: 24s; }
.mb-blueprint .mb-spin, .mb-locked .mb-spin { animation: none; }
@keyframes mb-spin { to { transform: rotate(360deg); } }
.mb-glow { animation: lp-twinkle 1.8s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) {
  .mb-spin, .mb-glow, .mb-ready.mb-can { animation: none; }
}

/* A landmark just built pops in. */
.mb-fresh { animation: mb-pop 0.7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes mb-pop { from { transform: scale(0.6); opacity: 0; } }

/* The rank on the results screen after a round. */
.mb-rankup { color: #b5710a; }

/* ——— Speedy Town: the town park ——— */
html[data-theme='town'] .mb-grounds { background: linear-gradient(#d6f0c8, #b9e3a3); box-shadow: 0 8px 0 #93c97e, var(--shadow); }
html[data-theme='town'] .mb-bar i { background: linear-gradient(90deg, #5aa9ff, #ffd23f); }
html[data-theme='town'] .mb-next { border-color: #cfe4ff; }
