/* ---------- character builder (js/builder.js) ----------
   Option A: the figure is the interface. Every part carries a label that is always visible (phones
   have no hover), tapping a part points the arrows at it, and the chips underneath cover the things
   that aren't a body part. Built phone-first; the desktop layout is the same thing, wider. */
#overlayBox.builder-modal { width: min(560px, 100%); padding: 14px 16px 16px; text-align: center; }
.bld h2 { text-align: center; font-size: 34px !important; margin: 0 !important; }
.bld-sub { margin: 2px 0 10px; text-align: center; font: 17px/1.15 var(--hand); }
.bld-sub small, .bld-k small, .bld-warn small { display: block; font: 12px/1.25 system-ui, sans-serif; color: #5b4a3a; }

/* the mirror and everything pinned on it */
.bld-stage { position: relative; margin: 0 auto; width: 100%; max-width: 430px; }
.bld-mirror {
  position: relative; overflow: hidden; height: 400px;
  border: 3px solid var(--ink); border-radius: 120px 120px 18px 18px;
  box-shadow: 4px 5px 0 var(--ink), inset 0 0 0 7px var(--mustard), inset 0 0 0 10px var(--ink);
  background:
    radial-gradient(circle at 50% 22%, #f6d77a 0 58px, rgba(246, 215, 122, 0) 59px),
    linear-gradient(180deg, #bfe0d2 0 74%, var(--jade) 74% 100%);
}
.bld-mirror::before {
  content: ''; position: absolute; left: 50%; top: 22%; width: 340px; height: 340px; translate: -50% -50%;
  background: repeating-conic-gradient(rgba(227, 185, 63, 0.35) 0 9deg, transparent 9deg 22deg);
  border-radius: 50%;
}
.bld-fig { position: absolute; left: 50%; top: 14px; height: 372px; width: auto; translate: -50% 0; }

/* Each of the five things you wear has its own pair of arrows, at the height of that part of the body:
   left arrow to the left of the character, right arrow to the right, the name of what you're wearing
   between them. Nothing to select first, no list to scroll. */
.bld-wear { position: absolute; top: var(--t); left: 6px; right: 6px; display: flex; align-items: center; gap: 6px; pointer-events: none; }
.bld-wear .bld-ar.r { margin-left: auto; }
.bld-wear > * { pointer-events: auto; }
.bld-wear.bump .bld-ar { animation: bld-bump 0.28s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bld-bump { from { transform: translateY(-4px) scale(0.95); } }
.bld-ar {
  flex: none; width: 38px; height: 38px; padding: 0; display: grid; place-items: center;
  background: var(--mustard); border: 3px solid var(--ink); border-radius: 50%; box-shadow: 2px 2px 0 var(--ink);
}
.bld-ar svg { width: 17px; height: 17px; fill: var(--ink); }
.bld-ar.r { background: var(--jade); }
.bld-ar.r svg { fill: var(--cream); }
.bld-ar:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.bld-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.bld-random {
  position: absolute; left: 6px; bottom: 6px; z-index: 3; width: 50px; height: 50px; display: grid; place-items: center;
  background: var(--terracotta); border: 3px solid var(--ink); border-radius: 50%; box-shadow: 2px 3px 0 var(--ink);
}
.bld-dice { font-size: 22px; line-height: 1; }

/* piel, colores, detalles y voz: one small strip, and the chosen one opens its colours right there */
.bld-extras { margin-top: 10px; padding: 7px 8px 8px; background: #efe2c2; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 2px 3px 0 var(--ink); }
.bld-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.bld-chip { flex: none; padding: 5px 10px; white-space: nowrap; font: 14px var(--display); background: var(--cream); border: 2.5px solid var(--ink); border-radius: 10px; }
.bld-chip.on { background: var(--jade); color: var(--cream); }
.bld-pal { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; margin-top: 7px; min-height: 42px; }
.bld-dot { flex: none; width: 34px; height: 34px; padding: 0; border: 3px solid var(--ink); border-radius: 50%; box-shadow: 2px 2px 0 var(--ink); }
.bld-dot.on { box-shadow: 0 0 0 3px var(--mustard), 2px 2px 0 var(--ink); }
/* a colour you haven't earned yet: dimmed, with its padlock over it */
.bld-dot.locked { display: grid; place-items: center; font-size: 13px; border-style: dashed; filter: grayscale(0.5) opacity(0.75); }
.bld-pill { flex: none; padding: 5px 10px; white-space: nowrap; font: 14px var(--display); background: var(--cream); border: 2.5px solid var(--ink); border-radius: 10px; }
.bld-pill.on { background: var(--mustard); }
.bld-lock { font-style: normal; }

.bld-name { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; text-align: left; }
.bld-k { font: 13px var(--display); letter-spacing: 0.05em; text-transform: uppercase; color: var(--terracotta); }
.bld .bld-input { width: 100%; margin: 0; font-size: 20px; padding: 6px 12px; text-align: left; }
.bld .bld-input:focus { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.bld .bld-input.nope { animation: bld-no 0.32s; border-color: var(--terracotta); }
@keyframes bld-no { 25% { transform: translateX(-6px); } 60% { transform: translateX(5px); } }
.bld-warn { margin: 6px 0 0; font: 16px/1.25 var(--hand); color: var(--terracotta); }
.bld-lockwarn { padding: 6px 10px; background: #fbe3d6; border: 2.5px solid var(--terracotta); border-radius: 12px; }
.bld-lockwarn.nope { animation: bld-no 0.32s; }
.builder-modal .buttons { justify-content: center; }
.bld-ar:focus-visible, .bld-chip:focus-visible, .bld-dot:focus-visible, .bld-pill:focus-visible, .bld-random:focus-visible,
.bld-ar.pad-focus, .bld-chip.pad-focus, .bld-dot.pad-focus, .bld-pill.pad-focus, .bld-random.pad-focus { outline: 4px solid var(--cobalt); outline-offset: 2px; }

/* small phones: a shorter mirror, everything else the same */
@media (max-height: 740px) {
  .bld-mirror { height: 320px; }
  .bld-fig { height: 300px; top: 10px; }
  .bld h2 { font-size: 28px !important; }
  .bld-sub { font-size: 15px; margin-bottom: 8px; }
  .bld-sub small { display: none; }
}
/* narrow phones: smaller arrows, figure stays centred (the labels that used to crowd it are gone) */
@media (max-width: 430px) {
  .bld-ar { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) { .bld .bld-input.nope, .bld-lockwarn.nope, .bld-fig { animation: none; transition: none; } }
