/* village.css — Storybook clearings (Keno Quest: adventure dioramas, world-assets/scene-N.webp). Legacy brand pass below is overridden by adventure-world.css.
   with four ground-anchored landmarks. Buildings are locally bundled transparent paintings (.cv-art).
   Scoped to .candy-village / .village-* / .cv-*. District palette arrives as --v-* vars. */

/* ---------- shared building art (also used in modal previews + completion gallery) ---------- */
.cv-art {
  --cv-accent: #fa718f; --cv-deep: #604574; --cv-cream: #fff4d8; --cv-glow: #fff4b0;
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; pointer-events: none;
}
.cv-art img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; user-select: none; -webkit-user-drag: none; }
.cv-shadow {
  position: absolute; left: 14%; right: 14%; bottom: 0; height: 16%; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(40, 14, 40, .38), transparent 70%);
}

/* Stages share one full-scale silhouette. Unearned = pale frosted plan (never finished colour). */
.cv-ghost { position: absolute; inset: 0 0 3% 0; }
/* stage 1: the unbuilt upper part stays a pale plan so the built base reads clearly */
.cv-ghost-img { filter: saturate(.25) brightness(1.3) contrast(.7); opacity: .45; }
/* stage 0: muted original colour and detail, clearly unearned (no shadow, softened, stakes + Planned tag) */
.cv-stage-0 .cv-ghost-img { filter: saturate(.55) brightness(1.12) contrast(.92); opacity: .78; }
.cv-stage-2 .cv-ghost, .cv-stage-3 .cv-ghost { display: none; }
.cv-ground { position: absolute; left: 12%; right: 12%; bottom: 0; height: 16%; }
.cv-ground::before { content: ""; position: absolute; inset: 20% 0 0; border-radius: 50%; border: 2px dashed color-mix(in srgb, var(--cv-deep) 60%, #fff); background: color-mix(in srgb, var(--cv-cream) 45%, transparent); }
.cv-stage-2 .cv-ground, .cv-stage-3 .cv-ground { display: none; }
.cv-stake { position: absolute; bottom: 30%; width: 3.2%; height: 90%; border-radius: 2px; background: linear-gradient(90deg, #f7d9a8, #b77a3c); }
.cv-stake::before { content: ""; position: absolute; left: -60%; top: 0; width: 220%; height: 22%; border-radius: 2px; background: var(--cv-accent); }
.cv-stake.is-0 { left: 0; } .cv-stake.is-1 { right: 0; } .cv-stake.is-2 { left: 26%; bottom: 62%; height: 70%; } .cv-stake.is-3 { right: 26%; bottom: 62%; height: 70%; }
.cv-rope { position: absolute; left: 1%; right: 1%; bottom: 95%; height: 2px; background: repeating-linear-gradient(90deg, var(--cv-accent) 0 6px, #fff8ee 6px 10px); }
.cv-signpost { position: absolute; left: 8%; bottom: 6%; width: 14%; height: 18%; background: linear-gradient(#b77a3c, #b77a3c) 50% 100% / 12% 60% no-repeat; }
.cv-signpost::before { content: ""; position: absolute; left: -10%; right: -10%; top: 0; height: 48%; border-radius: 3px; background: var(--cv-cream); border: 2px solid var(--cv-accent); box-shadow: 0 2px 0 rgba(60,30,20,.3); }
.cv-body { position: absolute; inset: 0 0 3% 0; transform-origin: 50% 100%; }
.cv-body .cv-img { filter: drop-shadow(0 5px 3px rgba(50, 18, 50, .3)); }
/* stage 1: bottom third built in muted colour under scaffold */
.cv-stage-1 .cv-body { clip-path: inset(62% 0 0 0); }
.cv-stage-1 .cv-body .cv-img { filter: saturate(.55) brightness(1.02); }
.cv-scaffold { position: absolute; left: 14%; right: 14%; bottom: 3%; height: 52%; }
.cv-pole { position: absolute; bottom: 0; width: 3%; height: 100%; background: linear-gradient(90deg, #ffe7bf, #c98f52); border-radius: 2px; }
.cv-pole.is-0 { left: 0; } .cv-pole.is-1 { left: 48%; height: 86%; } .cv-pole.is-2 { right: 0; }
.cv-plank { position: absolute; left: -4%; right: -4%; height: 5%; border-radius: 3px; background: linear-gradient(180deg, #ffd9a0, #c98844); box-shadow: 0 2px 0 rgba(90,45,20,.35); }
.cv-plank.is-a { top: 8%; } .cv-plank.is-b { top: 44%; transform: rotate(-2deg); }
.cv-crate { position: absolute; right: 4%; bottom: 3%; width: 12%; aspect-ratio: 1; border-radius: 3px; background: linear-gradient(135deg, #ffd79a, #c07c3a); border: 2px solid #8c5424; }
/* stage 2: standing, undressed — softer colour, no pennant */
.cv-stage-2 .cv-body .cv-img { filter: saturate(.72) brightness(1.03) drop-shadow(0 5px 3px rgba(50, 18, 50, .28)); }
/* stage 3: finished — rich colour, pennant, sparkles */
.cv-stage-3 .cv-body .cv-img { filter: saturate(1.15) contrast(1.04) drop-shadow(0 6px 4px rgba(50, 18, 50, .34)); }
.cv-flourish { position: absolute; inset: 0; }
/* pennant planted at the front-left footprint edge, so it works for tall and wide landmarks */
.cv-flag { position: absolute; left: 14%; bottom: 4%; width: 2px; height: 20%; border-radius: 1px; background: var(--cv-deep); box-shadow: 0 1px 0 rgba(50, 18, 50, .3); }
.cv-flag::before { content: ""; position: absolute; left: -3px; bottom: -2px; width: 8px; height: 3px; border-radius: 50%; background: rgba(50, 18, 50, .3); }
.cv-flag::after { content: ""; position: absolute; left: 2px; top: 0; width: 14px; height: 10px; background: var(--cv-accent); clip-path: polygon(0 0, 100% 50%, 0 100%); transform-origin: 0 50%; animation: cvFlag 1.6s ease-in-out infinite; }
.cv-spark { position: absolute; width: 10%; aspect-ratio: 1; background: radial-gradient(circle, #fff 0 18%, var(--cv-glow) 30%, transparent 62%); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); animation: cvTwinkle 2.6s ease-in-out infinite; opacity: 0; }
.cv-spark.is-0 { left: 10%; top: 18%; } .cv-spark.is-1 { right: 8%; top: 34%; animation-delay: -.9s; } .cv-spark.is-2 { left: 26%; top: 54%; animation-delay: -1.7s; }
@keyframes cvFlag { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.7); } }
@keyframes cvTwinkle { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: 1; transform: scale(1) rotate(25deg); } }

/* ---------- village shell ---------- */
.candy-village {
  --v-sky: #aee8f4; --v-land: #9dd683; --v-accent: #fa718f; --v-deep: #604574; --v-cream: #fff4d8;
  --v-accent-dark: #b8336a; --v-deep-dark: #3e2a4d; --v-glow: #fff4b0; --v-tint: transparent;
  --v-focus: #2b1a5c;
  --v-font: "Fredoka FX", system-ui, -apple-system, "Segoe UI", sans-serif;
  position: relative; display: flex; flex-direction: column; gap: 8px;
  width: 100%; max-width: 900px; flex: 1 0 auto; min-height: 100%; margin: 0 auto; padding: 10px 12px 12px;
  box-sizing: border-box; color: var(--v-deep-dark);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; overflow-x: hidden;
}
.candy-village[hidden], .candy-village [hidden] { display: none !important; }
.candy-village *, .candy-village *::before, .candy-village *::after { box-sizing: border-box; }
.candy-village :where(h3, p) { margin: 0; }

/* parent layout: the diorama owns the panel; repetitive footer copy becomes screen-reader only */
.candy-map.is-village .village-host {
  display: flex; flex-direction: column;
  background: radial-gradient(120% 60% at 50% 30%, color-mix(in srgb, #fff 55%, transparent), transparent 70%), linear-gradient(180deg, #fff3ea, #fbe3ee);
}
.candy-map.is-village .map-summary { padding: 6px 12px max(6px, env(safe-area-inset-bottom)); gap: 2px 10px; }
.candy-map.is-village #mapNextBuild,
.candy-map.is-village:not(.map-is-readonly) #mapModeNote {
  position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important;
}
.candy-map.is-village.map-is-readonly #mapModeNote { font-size: .72rem; }

.candy-village .village-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.candy-village .village-title { min-width: 0; text-align: center; display: grid; line-height: 1.1; }
.candy-village .village-kicker { font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--v-accent-dark); overflow-wrap: anywhere; }
.candy-village .village-name { font-family: var(--v-font); font-weight: 700; font-size: clamp(1.2rem, 4.4vw, 1.7rem); color: var(--v-deep-dark); overflow-wrap: anywhere; }
.candy-village :is(.village-back, .village-next) {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; margin: 0;
  border: 2px solid #fff; border-radius: 999px; cursor: pointer;
  font-family: var(--v-font); font-weight: 700; font-size: .92rem;
  background: linear-gradient(180deg, #fffdf8, var(--v-cream)); color: var(--v-deep-dark);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--v-deep) 45%, #fff), 0 6px 12px rgba(74, 31, 69, .12);
  transition: transform .12s ease;
}
.candy-village .village-next { background: linear-gradient(180deg, #8ff0cf, #54cfa6); color: #0f4d39; box-shadow: 0 3px 0 #1f8e6a; }
.candy-village :is(.village-back, .village-next):active:not(:disabled) { transform: translateY(2px) !important; }
.candy-village :is(.village-back, .village-next):disabled { opacity: .55; cursor: default; }

.candy-village .village-meter { display: flex; align-items: center; gap: 10px; }
.candy-village .village-meter-bar {
  position: relative; flex: 1; height: 14px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--v-deep) 14%, #fff8f2); border: 2px solid #fff;
  box-shadow: inset 0 2px 3px rgba(74, 31, 69, .18);
}
.candy-village .village-meter-fill {
  position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0);
  background: repeating-linear-gradient(-45deg, var(--v-accent) 0 8px, color-mix(in srgb, var(--v-accent) 60%, #fff) 8px 16px);
  transition: transform .6s cubic-bezier(.34, 1.3, .64, 1);
}
.candy-village .village-meter-tick { position: absolute; top: 2px; bottom: 2px; width: 2px; margin-left: -1px; background: rgba(255, 255, 255, .85); border-radius: 1px; }
.candy-village .village-meter-label { flex: none; font-family: var(--v-font); font-weight: 600; font-size: .8rem; font-variant-numeric: tabular-nums; }

/* ---------- the diorama ---------- */
.candy-village .village-stagewrap {
  --v-stage-min: 404px; --v-frame-top: 0px; --v-frame-bottom: 16px;
  flex: 1 1 0; min-height: calc(var(--v-stage-min) + var(--v-frame-top) + var(--v-frame-bottom));
  display: flex; justify-content: center; align-items: flex-start;
  /* Container units use the content box: reserve painted depth outside it,
     without reducing the minimum scene budget or taking text out of flow. */
  padding-top: var(--v-frame-top); padding-bottom: var(--v-frame-bottom);
  container-type: size;
}
.candy-village .village-scene {
  --v-aspect: .8; --v-bw: 30%;
  position: relative; flex: none; aspect-ratio: var(--v-aspect);
  width: min(100cqw, calc(100cqh * var(--v-aspect)));
  border-radius: 28px; overflow: hidden; isolation: isolate; background: var(--v-sky);
  box-shadow: 0 0 0 4px #fff, 0 9px 0 4px color-mix(in srgb, var(--v-deep) 55%, #fff), 0 24px 40px rgba(60, 20, 60, .28);
}
/* Without container units, use the guaranteed content budget rather than a
   viewport estimate that omits wrapped headings, instructions and notes. */
@supports not (width: 1cqh) { .candy-village .village-scene { width: min(100%, calc(var(--v-stage-min) * var(--v-aspect))); } }
.candy-village .village-paint { position: absolute; inset: 0; z-index: 0; }
.candy-village .village-paint-img { position: absolute; display: block; max-width: none; object-fit: fill; }
.candy-village .village-scene.is-mirrored .village-paint-img { transform: scaleX(-1); }
.candy-village .village-scene.is-mirrored :is(.cv-img, .cv-ghost-img) { transform: scaleX(-1); }
.candy-village .village-light { position: absolute; inset: 0; mix-blend-mode: soft-light; pointer-events: none; }
.candy-village .is-morning .village-light { background: linear-gradient(160deg, rgba(255, 255, 240, .3), transparent 50%); }
.candy-village .is-noon .village-light { background: radial-gradient(80% 60% at 30% 10%, rgba(255, 255, 255, .45), transparent 70%); }
.candy-village .is-golden .village-light { background: linear-gradient(200deg, rgba(255, 190, 120, .35), transparent 55%); }
.candy-village .village-vignette { position: absolute; inset: 0; background: radial-gradient(120% 100% at 50% 45%, transparent 60%, color-mix(in srgb, var(--v-deep) 38%, transparent)), linear-gradient(var(--v-tint), var(--v-tint)); pointer-events: none; }

.candy-village .village-motes { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.candy-village .village-mote { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: radial-gradient(circle, #fff, var(--v-glow) 50%, transparent 70%); opacity: 0; animation: villageMote 7s ease-in-out infinite; }
.candy-village .village-mote.is-0 { left: 12%; top: 70%; } .candy-village .village-mote.is-1 { left: 48%; top: 80%; animation-delay: -1s; }
.candy-village .village-mote.is-2 { left: 80%; top: 60%; animation-delay: -2.2s; } .candy-village .village-mote.is-3 { left: 26%; top: 40%; animation-delay: -3.1s; }
.candy-village .village-mote.is-4 { left: 64%; top: 30%; animation-delay: -4s; } .candy-village .village-mote.is-5 { left: 90%; top: 86%; animation-delay: -5.2s; }
.candy-village .village-mote.is-6 { left: 6%; top: 24%; animation-delay: -6s; }
@keyframes villageMote { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: .9; } 100% { opacity: 0; transform: translateY(-60px); } }

.candy-village .village-plots { position: absolute; inset: 0; z-index: 2; }
.candy-village .village-plot {
  position: absolute; width: var(--v-bw); margin: 0; z-index: 1; padding: 0; border: 0; border-radius: 18px;
  /* Keep the hit target anchored; global button press feedback must not move it. */
  transform: translate(-50%, -92%) !important; display: block;
  background: transparent; color: inherit; font: inherit; cursor: pointer; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.candy-village .village-plot[aria-disabled="true"] { cursor: progress; }
.candy-village .village-plot-stage { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; transition: transform .18s cubic-bezier(.34, 1.56, .64, 1); transform-origin: 50% 90%; }
.candy-village .village-plot:hover:not([aria-disabled="true"]) .village-plot-stage { transform: translateY(-4px) scale(1.03); }
.candy-village .village-plot:active:not([aria-disabled="true"]) .village-plot-stage { transform: scale(.95); }
.candy-village .village-plot-mat {
  position: absolute; left: 12%; right: 12%; bottom: -2%; height: 22%; border-radius: 50%;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--v-glow) 70%, transparent) 0 40%, transparent 70%); opacity: 0;
}
.candy-village .village-plot.is-suggested .village-plot-mat { opacity: 1; animation: villagePulse 1.8s ease-in-out infinite; }
.candy-village .village-plot-art, .candy-village .village-plot-scaffold { position: absolute; inset: 0; display: block; }
.candy-village .village-plot-scaffold svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* tag: a small sugar pill pinned to the front edge of the pad, below the building */
.candy-village .village-plaque {
  position: absolute; left: 50%; top: 96%; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 1px; width: max-content; max-width: 170%;
  padding: 2px 7px 3px; border-radius: 10px;
  background: color-mix(in srgb, var(--v-cream) 88%, transparent); border: 1.5px solid #fff;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--v-deep) 50%, #fff), 0 4px 10px rgba(40, 12, 40, .25);
  backdrop-filter: blur(3px);
}
.candy-village .village-plaque-name { font-family: var(--v-font); font-weight: 700; font-size: clamp(.6rem, 2.3vw, .8rem); line-height: 1.1; color: var(--v-deep-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.candy-village .village-plaque-row { display: inline-flex; align-items: center; gap: 4px; }
.candy-village .village-plaque > .village-plaque-row + .village-plaque-cost { margin-top: 1px; }
.candy-village .village-pips { display: flex; gap: 3px; }
.candy-village .village-pip { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--v-deep) 16%, #fff); box-shadow: inset 0 1px 2px rgba(74, 31, 69, .25); }
.candy-village .village-pip.is-on { background: radial-gradient(circle at 35% 30%, #fff 0 16%, var(--v-accent) 45%, var(--v-accent-dark)); box-shadow: 0 1px 0 var(--v-accent-dark); }
.candy-village .village-plaque-level { display: none; font-size: .62rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: color-mix(in srgb, var(--v-deep) 80%, #fff); }
.candy-village .village-plaque-cost {
  display: inline-flex; align-items: center; gap: 3px; padding: 0 7px 0 2px; border-radius: 999px;
  background: linear-gradient(180deg, #fffdf6, #ffe19a); color: #6b3a04; box-shadow: 0 2px 0 #d69a2a;
  font-family: var(--v-font); font-weight: 700; font-size: clamp(.6rem, 2.2vw, .76rem); font-variant-numeric: tabular-nums;
}
.candy-village .village-coin { width: 12px; height: 12px; flex: none; }
.candy-village .village-coin-fallback { border-radius: 50%; background: #f8cd50; border: 2px solid #bb7d22; }
.candy-village .village-plot.is-short .village-plaque-cost { background: linear-gradient(180deg, #faf6fb, #e8e0ec); color: #5f5664; box-shadow: 0 2px 0 #b3aab8; }
.candy-village .village-plot.is-affordable .village-plaque { box-shadow: 0 3px 0 var(--v-accent-dark), 0 0 0 3px color-mix(in srgb, var(--v-accent) 45%, transparent), 0 6px 12px rgba(40, 12, 40, .25); }
.candy-village .village-plot.is-max .village-plaque-row { display: none; }
.candy-village .village-plot.is-max .village-plaque { background: linear-gradient(180deg, #fff9d6, #ffe38c); border-color: #fff4b8; }
.candy-village .village-plot.is-max .village-plaque-level { color: #8a5006; }
.candy-village .village-plot.is-empty .village-plaque-level { display: inline; }

.candy-village .village-plot:focus-visible,
body[data-theme] .candy-village .village-plot:focus-visible,
.candy-village :is(.village-back, .village-next):focus-visible,
body[data-theme] .candy-village :is(.village-back, .village-next):focus-visible {
  outline: 4px solid var(--v-focus) !important; outline-offset: 3px !important; box-shadow: 0 0 0 7px #fff !important;
}
.candy-village .village-plot:focus-visible { z-index: 200 !important; }

/* completion / gate / locked overlays */
.candy-village .village-done { position: absolute; left: 0; right: 0; top: 12px; z-index: 150; display: none; justify-content: center; pointer-events: none; }
.candy-village.is-complete .village-done { display: flex; }
.candy-village .village-done-ribbon {
  position: relative; padding: 6px 22px; background: var(--v-accent); color: #fff; border-radius: 6px;
  font-family: var(--v-font); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .82rem;
  box-shadow: 0 3px 0 var(--v-accent-dark), 0 8px 16px rgba(40, 12, 40, .3);
}
.candy-village.is-complete .village-scene { box-shadow: 0 0 0 4px #fff4b8, 0 10px 0 4px #d8a33a, 0 26px 44px rgba(60, 20, 60, .28); }
.candy-village.is-gate .village-scene::before {
  content: "Gate village"; position: absolute; right: 12px; bottom: 12px; z-index: 150; padding: 4px 12px; border-radius: 999px;
  background: var(--v-deep); color: var(--v-cream); font: 700 .7rem/1.4 var(--v-font); letter-spacing: .08em; text-transform: uppercase;
}
.candy-village .village-lockveil { position: absolute; inset: 0; z-index: 160; display: none; place-items: center; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .38) 0 16px, rgba(255, 255, 255, .12) 16px 32px); backdrop-filter: saturate(.35); }
.candy-village.is-locked .village-lockveil { display: grid; }
.candy-village .village-lockveil-tag { padding: 8px 18px; border-radius: 14px; background: #fff; color: var(--v-deep-dark); font: 700 .95rem/1.2 var(--v-font); box-shadow: 0 4px 0 color-mix(in srgb, var(--v-deep) 50%, #fff); }
.candy-village.is-busy .village-plot { cursor: progress; }

.candy-village .village-status { font-family: var(--v-font); font-weight: 600; font-size: .9rem; text-align: center; }
.candy-village .village-note { align-self: center; max-width: 520px; padding: 6px 14px; border-radius: 12px; background: #fff3d6; border: 2px solid #ffe2a0; color: #7a4a06; font-size: .8rem; font-weight: 600; text-align: center; }

@keyframes villagePulse { 0%, 100% { transform: scale(1); opacity: .7; } 50% { transform: scale(1.15); opacity: 1; } }

/* ---------- build hammers: one per unfinished landmark, inside the plot button ---------- */
.candy-village .village-hammer {
  position: absolute; top: 4%; right: 4%; width: 20%; min-width: 26px; max-width: 46px; aspect-ratio: 1;
  z-index: 3; pointer-events: none; display: block; transform-origin: 50% 90%;
  filter: drop-shadow(0 2px 0 rgba(123, 63, 196, .35));
}
.candy-village .village-plot.is-right .village-hammer { right: auto; left: 4%; }
.candy-village .village-hammer-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.candy-village .village-plot.is-ready .village-hammer { animation: villageHammer 1.5s ease-in-out infinite; }
.candy-village .village-plot.is-right.is-ready .village-hammer { animation-name: villageHammerL; }
@keyframes villageHammer { 0%, 100% { transform: translateY(0) rotate(-14deg); } 50% { transform: translateY(-4px) rotate(6deg); } }
@keyframes villageHammerL { 0%, 100% { transform: translateY(0) rotate(14deg) scaleX(-1); } 50% { transform: translateY(-4px) rotate(-6deg) scaleX(-1); } }
.candy-village .village-plot.is-right .village-hammer { transform: scaleX(-1); }
/* unavailable: still, sugar-paper muted, with a round "no" badge (non-colour cue) */
.candy-village .village-plot.is-unavailable .village-hammer { animation: none; filter: grayscale(.85) opacity(.6); transform: rotate(-30deg); }
.candy-village .village-plot.is-right.is-unavailable .village-hammer { transform: rotate(30deg) scaleX(-1); }
.candy-village .village-hammer-lock { display: none; position: absolute; right: -8%; bottom: -6%; width: 46%; aspect-ratio: 1; border-radius: 50%;
  background: #fff8e8; border: 2px solid #6a5a78; }
.candy-village .village-hammer-lock::after { content: ""; position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; margin-top: -1px; background: #6a5a78; transform: rotate(-45deg); border-radius: 2px; }
.candy-village .village-plot.is-unavailable .village-hammer-lock { display: block; }
.candy-village .village-plot[data-unavailable="saving"] .village-hammer-lock::after { transform: none; left: 22%; right: 22%; box-shadow: 0 -4px 0 #6a5a78, 0 4px 0 #6a5a78; height: 1.5px; }
/* Keep the exact next price readable even when it cannot be spent yet. */
.candy-village .village-plot.is-unavailable .village-plaque-cost { box-shadow: none; }
/* Lower-row roof corners clear rear price plaques through the full rocking arc.
 * The inset also keeps the unavailable badge inside its own large tap target. */
.candy-village .village-plot:is([data-index="2"], [data-index="3"]) .village-hammer { top: max(14%, calc(66px - 13%)); left: 6%; right: auto; }
@media (max-width: 560px) { .candy-village .village-plot:is([data-index="2"], [data-index="3"]) .village-hammer { top: max(14%, calc(60px - 13%)); } }
.candy-village .village-plot.is-right:is([data-index="2"], [data-index="3"]) .village-hammer { left: auto; right: 6%; }
@media (forced-colors: active) { .candy-village .village-hammer { forced-color-adjust: none; } }

/* ---------- phones ---------- */
@media (max-width: 560px) {
  .candy-village { padding: 6px 6px 8px; gap: 5px; }
  .candy-village .village-head { grid-template-columns: auto minmax(0, 1fr); gap: 6px; }
  .candy-village .village-next { grid-column: 1 / -1; justify-self: center; }
  .candy-village .village-stagewrap { --v-stage-min: 324px; }
  .candy-village .village-scene { border-radius: 20px; }
  .candy-village .village-meter-label { font-size: .72rem; }
  .candy-village .village-status { font-size: .8rem; }
}
@media (max-width: 360px) {
  .candy-village :is(.village-back, .village-next) { padding: 6px 10px; font-size: .84rem; }
  .candy-village .village-pip { width: 7px; height: 7px; }
}

/* ---------- motion ---------- */
.candy-map:not(.is-village) .candy-village *, .candy-village.is-paused *, .candy-village.is-paused *::before, .candy-village.is-paused *::after { animation-play-state: paused !important; }
body.fx-paused .candy-village *, body.fx-paused .candy-village *::after { animation-play-state: paused !important; }
body.fx-paused .cv-art *, body.fx-paused .cv-art *::before, body.fx-paused .cv-art *::after { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  .candy-village *, .candy-village *::before, .candy-village *::after, .cv-art *, .cv-art *::after { animation: none !important; transition: none !important; }
  .cv-spark { opacity: .8; }
}
body.fx-reduced-motion .candy-village *, body.fx-reduced-motion .candy-village *::before, body.fx-reduced-motion .candy-village *::after,
body.fx-reduced-motion .cv-art *, body.fx-reduced-motion .cv-art *::after { animation: none !important; transition: none !important; }
@media (forced-colors: active) {
  .candy-village .village-pip.is-on { forced-color-adjust: none; background: Highlight; }
  .candy-village .village-plot:focus-visible { outline-color: Highlight !important; }
}

/* painted scene reads as backdrop; landmarks carry the saturation */
.candy-village .village-paint-img { filter: saturate(.9) brightness(.97); }
.candy-village .village-plot.is-max { z-index: auto; }

/* ---------- Candy Keno brand pass: glossy arcade candy, rounded cream cards, pink/purple/yellow ---------- */
.candy-village { --ck-pink: #ff4f8b; --ck-pink-dark: #c9246a; --ck-purple: #7b3fc4; --ck-purple-dark: #4e2193; --ck-yellow: #ffd23f; --ck-cream: #fff8e8; }
/* construction cues become candy: striped candy-stick stakes with gumdrop caps, pink/cream ribbon */
.cv-ground::before { border: 2px dashed #ff8fb6; background: color-mix(in srgb, #fff8e8 55%, transparent); }
.cv-stake { border-radius: 99px; background: repeating-linear-gradient(-35deg, #fff8e8 0 4px, #ff4f8b 4px 8px); box-shadow: 0 1px 0 rgba(123, 63, 196, .35); }
.cv-stake::before { left: -70%; top: -18%; width: 240%; height: auto; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 18%, #ffd23f 40%, #e0a100); }
.cv-rope { height: 3px; border-radius: 3px; background: repeating-linear-gradient(90deg, #ff4f8b 0 6px, #fff8e8 6px 10px); }
.cv-signpost { background: linear-gradient(#b884f0, #7b3fc4) 50% 100% / 14% 60% no-repeat; }
.cv-signpost::before { border-radius: 6px; background: #fff8e8; border: 2px solid #ff4f8b; box-shadow: 0 2px 0 #c9246a; }
.cv-pole { border-radius: 99px; background: repeating-linear-gradient(-35deg, #fff8e8 0 5px, #ff4f8b 5px 10px); box-shadow: 0 1px 2px rgba(123, 63, 196, .3); }
.cv-plank { border-radius: 99px; background: linear-gradient(180deg, #ffe680, #ffc21a 60%, #e9a300); box-shadow: 0 2px 0 #b77f00; }
.cv-crate { border-radius: 6px; background: linear-gradient(180deg, #d6b4ff, #9a5fe0); border: 2px solid #fff; box-shadow: 0 2px 0 #5d2aa6, inset 0 2px 0 rgba(255,255,255,.5); }
/* soft coloured shadows instead of dark ones */
.cv-body .cv-img { filter: drop-shadow(0 5px 3px rgba(123, 63, 196, .28)); }
.cv-stage-2 .cv-body .cv-img { filter: saturate(.8) brightness(1.04) drop-shadow(0 5px 3px rgba(123, 63, 196, .26)); }
.cv-stage-3 .cv-body .cv-img { filter: saturate(1.08) drop-shadow(0 6px 4px rgba(201, 36, 106, .3)); }
.cv-flag { width: 3px; border-radius: 99px; background: linear-gradient(90deg, #fff, #7b3fc4); }
.cv-flag::after { background: #ff4f8b; }
.cv-flag::before { background: rgba(123, 63, 196, .3); }
/* diorama framed like a Candy Keno card: cream rim, pink pressed-edge shadow, no dark wash */
.candy-map.is-village .village-host { background: repeating-linear-gradient(-45deg, #ff6f9f 0 26px, #ff5f94 26px 52px); }
.candy-village .village-scene { border-radius: 26px; box-shadow: 0 0 0 5px #fff4dc, 0 0 0 7px #ffc7dc, 0 9px 0 7px #c9246a, 0 20px 34px rgba(123, 30, 90, .3); }
.candy-village.is-complete .village-scene { box-shadow: 0 0 0 5px #fff4dc, 0 0 0 7px #ffd23f, 0 9px 0 7px #d49a00, 0 20px 34px rgba(123, 30, 90, .3); }
.candy-village .village-vignette { background: radial-gradient(130% 110% at 50% 45%, transparent 70%, rgba(255, 79, 139, .18)); }
.candy-village .village-light { opacity: .6; }
.candy-village .village-paint-img { filter: saturate(1.02); }
/* header + meter speak the arcade language */
/* Dark candy ink keeps small headings readable against the bright pink stripes. */
.candy-village .village-kicker { color: #43165f; text-shadow: 0 1px 0 rgba(255, 248, 232, .4); }
.candy-village .village-name { color: #43165f; text-shadow: 0 2px 0 rgba(255, 248, 232, .55); }
.candy-village :is(.village-back, .village-next) { border: 3px solid #fff4dc; border-radius: 16px; background: #fff8e8; color: var(--ck-purple); box-shadow: 0 4px 0 #e7b9cf; }
.candy-village .village-next { background: linear-gradient(180deg, #9be05a, #5fb52a); color: #fff; text-shadow: 0 1px 0 #3d7d14; box-shadow: 0 4px 0 #3d7d14; }
.candy-village .village-meter-bar { height: 16px; background: #fff8e8; border: 2px solid #fff; box-shadow: inset 0 2px 3px rgba(201, 36, 106, .25); }
.candy-village .village-meter-fill { background: repeating-linear-gradient(-45deg, #ffd23f 0 8px, #ffe680 8px 16px); }
.candy-village .village-meter-label { color: #43165f; text-shadow: 0 1px 0 rgba(255, 248, 232, .4); }
/* plaques: small cream candy cards with purple type and yellow coin pill */
.candy-village .village-plaque { border-radius: 12px; background: #fff8e8; border: 2px solid #ffc7dc; backdrop-filter: none; box-shadow: 0 3px 0 #e39ab9, 0 5px 10px rgba(123, 30, 90, .2); }
.candy-village .village-plaque-name { color: var(--ck-purple-dark); }
.candy-village .village-pip { background: #f3e3f0; }
.candy-village .village-pip.is-on { background: radial-gradient(circle at 35% 30%, #fff 0 16%, #ff4f8b 45%, #c9246a); box-shadow: 0 1px 0 #c9246a; }
.candy-village .village-plaque-level { color: var(--ck-pink-dark); }
.candy-village .village-plaque-cost { background: linear-gradient(180deg, #ffe680, #ffc21a); color: #6b3a04; box-shadow: 0 2px 0 #c98a00; }
.candy-village .village-plot.is-short .village-plaque-cost { background: #efe6f3; color: #6a5a78; box-shadow: 0 2px 0 #c6b6d2; }
.candy-village .village-plot.is-affordable .village-plaque { border-color: #ff4f8b; box-shadow: 0 3px 0 #c9246a, 0 5px 10px rgba(123, 30, 90, .22); }
.candy-village .village-plot.is-max .village-plaque { background: linear-gradient(180deg, #fff6c4, #ffd23f); border-color: #fff; box-shadow: 0 3px 0 #c98a00; }
.candy-village .village-done-ribbon { background: #ff4f8b; border-radius: 14px; border: 3px solid #fff4dc; box-shadow: 0 4px 0 #c9246a; }
.candy-village .village-status { color: #43165f; text-shadow: 0 1px 0 rgba(255, 248, 232, .4); }
.candy-village .village-note { background: #fff8e8; border-color: #ffc7dc; color: var(--ck-purple-dark); }
.candy-village .village-lockveil-tag { border-radius: 16px; color: var(--ck-purple-dark); box-shadow: 0 4px 0 #e39ab9; }
.candy-village.is-gate .village-scene::before { background: var(--ck-purple); color: #fff8e8; border: 2px solid #fff4dc; }

/* ================= Sugar diorama redesign (all appearances) ================= */
.candy-village { max-width: 1180px; --sd-ink: #3a1640; --sd-berry: #c2186b; --sd-berry-dark: #7a0f4c; --sd-red: #e2342f; --sd-red-dark: #8f1715; --sd-gold: #ffc72e; --sd-cream: #fff5dc; }
.candy-map.is-village .village-host,
html body[data-theme] #districtMap.is-village .village-host { background: radial-gradient(90% 50% at 50% 0, #fff6c8 0, transparent 70%), linear-gradient(180deg, #8fe4ff, #4cc6f0 60%, #2aa3d8); }
.candy-village .village-head,
html body[data-theme] #districtMap .candy-village .village-head { position: relative; padding: 4px 8px; border: 0; background: none; box-shadow: none; }
.candy-village .village-title { justify-self: center; position: relative; padding: 4px 34px 7px; color: #fff;
  background: linear-gradient(180deg, #ff5a52 0, var(--sd-red) 55%, #c2221f); border-radius: 14px;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.35), 0 4px 0 var(--sd-red-dark), 0 10px 18px rgba(60,10,20,.25); }
.candy-village .village-title::before, .candy-village .village-title::after { content: ""; position: absolute; top: 50%; width: 15px; height: 15px; margin-top: -8px;
  background: radial-gradient(circle at 35% 30%, #fff8c8, var(--sd-gold) 55%, #c98a00); clip-path: polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%); }
.candy-village .village-title::before { left: 11px; } .candy-village .village-title::after { right: 11px; }
.candy-village .village-kicker, html body[data-theme] #districtMap .candy-village .village-kicker { color: #ffe3dc; text-shadow: 0 1px 0 var(--sd-red-dark); font-size: .62rem; }
.candy-village .village-name, html body[data-theme] #districtMap .candy-village .village-name { color: #fff; font-size: clamp(1.05rem, 3.2vw, 1.45rem); text-shadow: 0 2px 0 var(--sd-red-dark); }
.candy-village .village-meter { max-width: 560px; width: 100%; align-self: center; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--sd-cream); box-shadow: 0 3px 0 #b77a2a, 0 0 0 2px #fff; }
.candy-village .village-meter-bar, html body[data-theme] #districtMap .candy-village .village-meter-bar { height: 14px; background: #f1dfc0; border: 0; box-shadow: inset 0 2px 3px rgba(90,40,10,.3); }
.candy-village .village-meter-fill, html body[data-theme] #districtMap .candy-village .village-meter-fill { background: linear-gradient(180deg, #ff7cb8, var(--sd-berry) 70%); box-shadow: inset 0 3px 0 rgba(255,255,255,.4); }
.candy-village .village-meter-label, html body[data-theme] #districtMap .candy-village .village-meter-label { color: var(--sd-ink); text-shadow: none; padding: 2px 10px; border-radius: 999px; background: #fff; }
.candy-village .village-scene, html body[data-theme] #districtMap .candy-village .village-scene,
.candy-village.is-complete .village-scene { border-radius: 30px; box-shadow: 0 0 0 5px #fff, 0 10px 0 5px #2f8fb8, 0 24px 40px rgba(10,50,90,.3); }
.candy-village .village-vignette, html body[data-theme] #districtMap .candy-village .village-vignette { background: radial-gradient(130% 110% at 50% 45%, transparent 72%, rgba(20,60,100,.18)); }
/* stage now comes from real images: neutralise legacy filter staging */
.candy-village .cv-art .cv-img, .cv-stage-1 .cv-body .cv-img, .cv-stage-2 .cv-body .cv-img { filter: drop-shadow(0 5px 3px rgba(40,20,60,.28)); }
.cv-stage-1 .cv-body { clip-path: none; }
/* plaque: cream plaque with stars + magenta brick cost */
.candy-village .village-plaque, html body[data-theme] #districtMap .candy-village .village-plaque { padding: 3px 9px 4px; border-radius: 12px; background: linear-gradient(180deg, #fffaf0, #f7e5bf); border: 2px solid #fff; box-shadow: 0 3px 0 #b98a4a, 0 6px 12px rgba(60,30,10,.25); }
.candy-village .village-plaque-name, html body[data-theme] #districtMap .candy-village .village-plaque-name { color: var(--sd-ink); }
.candy-village .village-pip, .candy-village .village-pip.is-on { width: 13px; height: 13px; border-radius: 0; box-shadow: none; clip-path: polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%); background: #d9c7a6; }
.candy-village .village-pip.is-on { background: radial-gradient(circle at 40% 30%, #fff8c8, var(--sd-gold) 50%, #d08a00); }
.candy-village .village-pips { gap: 1px; }
.candy-village .village-plaque-level { color: var(--sd-berry-dark); }
.candy-village .village-plaque-cost, html body[data-theme] #districtMap .candy-village .village-plaque-cost { padding: 1px 8px 1px 3px; background: linear-gradient(180deg, #ff6fb0, var(--sd-berry)); color: #fff; box-shadow: 0 2px 0 var(--sd-berry-dark); }
.candy-village .village-plaque-cost .village-brick { width: 14px; height: 14px; }
.candy-village .village-plot.is-short .village-plaque-cost { background: #f3e0ea; color: #6e2a50; box-shadow: 0 2px 0 #c9a3b8; }
.candy-village .village-plot.is-affordable .village-plaque { border-color: #6fd65a; box-shadow: 0 3px 0 #2f8a22, 0 6px 12px rgba(60,30,10,.25); }
.candy-village .village-plot.is-max .village-plaque { background: linear-gradient(180deg, #fff7c8, #ffd85a); border-color: #fff; box-shadow: 0 3px 0 #b77f00; }
/* chunky green hammer badge */
.candy-village .village-hammer { width: 24%; min-width: 34px; max-width: 54px; padding: 3px; border-radius: 50%; background: radial-gradient(circle at 40% 30%, #fff, #e9fbe0); box-shadow: 0 3px 0 #2f8a22, 0 0 0 2px #fff; filter: none; }
.candy-village .village-plot.is-unavailable .village-hammer { filter: grayscale(.8); opacity: .75; }
/* red completion ribbon with forked tails + stars */
.candy-village .village-done-ribbon { padding: 8px 40px; border: 0; border-radius: 6px; background: linear-gradient(180deg, #ff5a52, var(--sd-red)); font-size: .9rem; box-shadow: inset 0 3px 0 rgba(255,255,255,.3), 0 4px 0 var(--sd-red-dark), 0 10px 20px rgba(60,10,20,.3); }
.candy-village .village-done-ribbon::before, .candy-village .village-done-ribbon::after { content: ""; position: absolute; top: 8px; width: 22px; height: 100%; background: #b92622; z-index: -1; }
.candy-village .village-done-ribbon::before { left: -16px; clip-path: polygon(0 0,100% 0,100% 100%,0 100%,35% 50%); }
.candy-village .village-done-ribbon::after { right: -16px; clip-path: polygon(0 0,100% 0,65% 50%,100% 100%,0 100%); }
.candy-village .village-status { color: #0e3552; }
.candy-village .village-next, html body[data-theme] #districtMap .candy-village .village-next { background: linear-gradient(180deg, #7fdc5a, #3fae2a); color: #fff; text-shadow: 0 1px 0 #1d5e17; border: 3px solid #fff; border-radius: 16px; box-shadow: 0 4px 0 #1d5e17; }
@media (min-width: 1100px) { .candy-village .village-stagewrap { --v-stage-min: 460px; } }
@media (forced-colors: active) {
  .candy-village .village-title, .candy-village .village-done-ribbon, .candy-village .village-plaque { border: 2px solid CanvasText; }
  .candy-village .village-pip { forced-color-adjust: none; background: GrayText; } .candy-village .village-pip.is-on { background: Highlight; }
}
