/* ── Surface pills (preview overlay) — Scale Lab 2 compositor ── */
.pills-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pill {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  background: rgba(11, 13, 16, 0.78);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  backdrop-filter: blur(6px);
  pointer-events: auto;
  transition: border-color 0.12s, background 0.12s, transform 0.08s;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.pill:hover {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(11, 13, 16, 0.92);
}
.pill:active {
  transform: translate(-50%, -50%) scale(0.96);
}
.pill.selected {
  border-color: #7c5cff;
  background: rgba(124, 92, 255, 0.92);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(124, 92, 255, 0.35), 0 2px 10px rgba(0, 0, 0, 0.35);
}
.pill.assigned {
  border-color: rgba(139, 228, 161, 0.85);
}
.pill.assigned.selected {
  border-color: #7c5cff;
}

/* Master group pills (Paredes / Pisos) */
.pill.pill--master {
  padding: 6px 14px;
  font-size: 13px;
  letter-spacing: 0.02em;
  border-width: 2px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.42);
}
.pill.pill--master:active {
  transform: translate(-50%, -50%) scale(0.97);
}

/* Wall / floor — match inspector badges (--info / --purple) */
.pill.pill--wall {
  border-color: rgba(121, 200, 255, 0.5);
}
.pill.pill--wall:hover {
  border-color: var(--info);
  background: rgba(26, 36, 56, 0.92);
}
.pill.pill--wall.assigned {
  border-color: rgba(121, 200, 255, 0.9);
}
.pill.pill--wall.selected,
.pill.pill--wall.assigned.selected {
  border-color: var(--info);
  background: rgba(121, 200, 255, 0.28);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(121, 200, 255, 0.4), 0 2px 10px rgba(0, 0, 0, 0.35);
}

.pill.pill--floor {
  border-color: rgba(199, 155, 242, 0.5);
}
.pill.pill--floor:hover {
  border-color: var(--purple);
  background: rgba(40, 28, 56, 0.92);
}
.pill.pill--floor.assigned {
  border-color: rgba(199, 155, 242, 0.9);
}
.pill.pill--floor.selected,
.pill.pill--floor.assigned.selected {
  border-color: var(--purple);
  background: rgba(199, 155, 242, 0.28);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(199, 155, 242, 0.4), 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* Split decompose animation — children stacked at master, spread via transform */
.pill.pill--decompose-hidden {
  visibility: hidden;
  pointer-events: none;
}

.pill.pill--decompose-in {
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--pill-decompose-delay, 0ms);
}

/* Compose animation — children collapse to master centroid, reverse stagger */
.pill.pill--compose-hidden {
  visibility: hidden;
  pointer-events: none;
}

.pill.pill--compose-out {
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--pill-compose-delay, 0ms);
}

.pill-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.pill-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  margin-left: 2px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.pill-clear:hover {
  background: #ff8d8d;
}

@media (prefers-reduced-motion: reduce) {
  .pill.pill--decompose-in,
  .pill.pill--compose-out {
    transition: none !important;
    animation: none !important;
  }
}

@media (max-width: 520px) {
  .pill {
    padding: 4px 8px 4px 4px;
    font-size: 11px;
  }
  .pill.pill--master {
    padding: 5px 12px;
    font-size: 12px;
  }
  .pill-thumb {
    width: 18px;
    height: 18px;
  }
  .pill-clear {
    width: 16px;
    height: 16px;
    font-size: 0.85rem;
  }
}
