/* Control del lienzo con la mano (MediaPipe). Solo visible al activarlo. */

.cp-btn-manos.is-active,
.cp-btn-manos[aria-pressed="true"] {
  border-color: rgba(36, 88, 245, 0.45);
  background: #EEF2FF;
  color: #1E4BE0;
}

.cp-btn-manos.is-busy {
  opacity: 0.7;
}

.cp-manos-overlay[hidden] {
  display: none !important;
}

.cp-manos-preview {
  position: fixed;
  right: max(0.7rem, env(safe-area-inset-right, 0px));
  bottom: max(4.6rem, env(safe-area-inset-bottom, 0px));
  z-index: 80;
  width: 148px;
  padding: 0.4rem;
  border: 1px solid var(--cp-line, #d7dde7);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

.cp-manos-video {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  background: #111827;
  transform: scaleX(-1);
}

.cp-manos-status {
  margin: 0.35rem 0 0.3rem;
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.25;
  color: var(--cp-ink, #1c2430);
}

.cp-manos-off {
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  background: #1E4BE0;
  color: #fff;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.cp-manos-cursor {
  position: fixed;
  z-index: 81;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid #1E4BE0;
  border-radius: 999px;
  background: rgba(238, 242, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(30, 75, 224, 0.18);
  pointer-events: none;
}

.cp-manos-cursor.is-pinch {
  background: #1E4BE0;
  transform: scale(0.82);
}

html.cp-manos-on #canvasFrame,
html.cp-manos-on .cp-topbar,
html.cp-manos-on .cp-toolbar,
html.cp-manos-on .cp-history-group,
html.cp-manos-on #canvasFormatBadge,
html.cp-manos-on #secPropiedades {
  outline: 2px solid #1E4BE0;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(30, 75, 224, 0.16);
}

html.cp-manos-on .cp-history-group {
  border-radius: 10px;
}

html.cp-manos-on .is-manos-aim {
  outline: 2px solid #1E4BE0 !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(30, 75, 224, 0.28);
  position: relative;
  z-index: 3;
}

.cp-manos-cursor.is-ui {
  border-color: #0f766e;
  background: rgba(204, 251, 241, 0.75);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}

.cp-manos-cursor.is-ui.is-pinch {
  background: #0f766e;
}

.cp-modal-card-manos {
  width: min(420px, 100%);
  padding: 1.1rem 1rem 0.95rem;
}

.cp-manos-help-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #B45309;
}

.cp-manos-help-warn {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(180, 83, 9, 0.28);
  border-radius: 10px;
  background: #FFF7ED;
  color: #7C2D12;
  font-size: 0.8rem;
  line-height: 1.35;
  font-weight: 600;
}

.cp-modal-card-manos h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  line-height: 1.25;
}

.cp-manos-help-stage {
  display: block;
  width: 100%;
  min-height: 168px;
  margin: 0 0 0.7rem;
  padding: 0.7rem 0.6rem 0.55rem;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #EEF2FF 0%, #F8FAFF 100%);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.cp-manos-help-scene {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 140px;
}

.cp-manos-help-scene.is-on {
  display: flex;
}

.cp-manos-help-hint {
  font-size: 0.72rem;
  font-weight: 650;
  color: #3f4a5c;
}

.cp-manos-help-cam {
  position: relative;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  color: #1E4BE0;
}

.cp-manos-help-cam-ring {
  position: absolute;
  inset: 0;
  border: 2px solid #1E4BE0;
  border-radius: 999px;
  opacity: 0.35;
  animation: cp-manos-pulse 1.4s ease-out infinite;
}

.cp-manos-help-board {
  width: 78%;
  max-width: 240px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.cp-manos-help-chrome {
  display: block;
  padding: 0.28rem 0.5rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: #8a93a3;
  background: #f3f4f6;
}

.cp-manos-help-lienzo {
  position: relative;
  height: 88px;
  margin: 0.4rem;
  border: 2px solid #1E4BE0;
  border-radius: 8px;
  background: #F8FAFF;
}

.cp-manos-help-dot {
  position: absolute;
  top: 18px;
  left: 16px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #1E4BE0;
  animation: cp-manos-dot 2.2s ease-in-out infinite;
}

.cp-manos-help-hand {
  position: relative;
  width: 84px;
  height: 84px;
}

.cp-manos-help-finger {
  position: absolute;
  width: 14px;
  height: 42px;
  border-radius: 999px;
  background: #f3c6a5;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.06);
}

.cp-manos-help-finger.is-thumb {
  left: 18px;
  top: 28px;
  transform: rotate(38deg);
  transform-origin: 50% 90%;
}

.cp-manos-help-finger.is-index {
  left: 48px;
  top: 12px;
  transform: rotate(-12deg);
  transform-origin: 50% 90%;
}

.cp-manos-help-stage[data-manos-step="2"] .cp-manos-help-finger.is-thumb,
.cp-manos-help-stage.is-play[data-manos-step="2"] .cp-manos-help-finger.is-thumb {
  animation: cp-manos-pinch-thumb 1.1s ease-in-out infinite;
}

.cp-manos-help-stage[data-manos-step="2"] .cp-manos-help-finger.is-index,
.cp-manos-help-stage.is-play[data-manos-step="2"] .cp-manos-help-finger.is-index {
  animation: cp-manos-pinch-index 1.1s ease-in-out infinite;
}

.cp-manos-help-ripple {
  position: absolute;
  left: 34px;
  top: 22px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid #1E4BE0;
  opacity: 0;
}

.cp-manos-help-stage[data-manos-step="2"] .cp-manos-help-ripple {
  animation: cp-manos-ripple 1.1s ease-out infinite;
}

.cp-manos-help-hand.is-small {
  position: absolute;
  width: 54px;
  height: 54px;
  top: 18px;
  left: 18px;
  animation: cp-manos-carry 1.8s ease-in-out infinite;
}

.cp-manos-help-hand.is-small .cp-manos-help-finger {
  width: 10px;
  height: 28px;
}

.cp-manos-help-drag {
  position: relative;
  width: 86%;
  height: 96px;
  border: 2px solid #1E4BE0;
  border-radius: 10px;
  background: #fff;
}

.cp-manos-help-box {
  position: absolute;
  top: 28px;
  left: 18px;
  width: 42px;
  height: 28px;
  border-radius: 6px;
  background: #1E4BE0;
  animation: cp-manos-box 1.8s ease-in-out infinite;
}

.cp-manos-help-dots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 0 0.65rem;
}

.cp-manos-help-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #c9d2e4;
  cursor: pointer;
}

.cp-manos-help-dots button.is-on {
  width: 22px;
  background: #1E4BE0;
}

.cp-manos-help-props {
  width: 86%;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cp-manos-help-steps,
.cp-manos-help-tabs {
  display: flex;
  justify-content: space-between;
  gap: 0.28rem;
}

.cp-manos-help-steps span,
.cp-manos-help-tabs span {
  flex: 1;
  min-height: 22px;
  padding: 0.18rem 0.2rem;
  border-radius: 7px;
  background: #fff;
  color: #5b6577;
  font-size: 0.62rem;
  font-weight: 750;
  text-align: center;
  line-height: 1.2;
}

.cp-manos-help-steps span.is-on,
.cp-manos-help-tabs span.is-on {
  background: #1E4BE0;
  color: #fff;
}

.cp-manos-help-swatches {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.2rem 0 0.15rem;
}

.cp-manos-help-swatches span {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #94a3b8;
}

.cp-manos-help-swatches span:nth-child(2) {
  background: #f59e0b;
}

.cp-manos-help-swatches span:nth-child(3) {
  background: #ef4444;
}

.cp-manos-help-swatches span.is-aim {
  background: #1E4BE0;
  box-shadow: 0 0 0 4px rgba(30, 75, 224, 0.28);
  animation: cp-manos-aim 1.1s ease-in-out infinite;
}

.cp-manos-help-copy {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: #3f4a5c;
  min-height: 4.2em;
}

.cp-manos-help-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cp-manos-help-nav .cp-btn {
  flex: 1 1 auto;
  min-height: 40px;
}

@keyframes cp-manos-pulse {
  0% { transform: scale(0.86); opacity: 0.45; }
  100% { transform: scale(1.18); opacity: 0; }
}

@keyframes cp-manos-dot {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(92px, 36px); }
}

@keyframes cp-manos-pinch-thumb {
  0%, 100% { transform: rotate(38deg) translate(0, 0); }
  50% { transform: rotate(22deg) translate(8px, -6px); }
}

@keyframes cp-manos-pinch-index {
  0%, 100% { transform: rotate(-12deg) translate(0, 0); }
  50% { transform: rotate(4deg) translate(-8px, 4px); }
}

@keyframes cp-manos-ripple {
  0%, 40% { opacity: 0; transform: scale(0.4); }
  55% { opacity: 1; }
  100% { opacity: 0; transform: scale(2.2); }
}

@keyframes cp-manos-box {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(92px); }
}

@keyframes cp-manos-carry {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(92px); }
}

@keyframes cp-manos-aim {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

@media (max-width: 860px) {
  .cp-toolbar #btnManos {
    display: none;
  }

  #btnManosTop .cp-btn-label {
    display: none;
  }

  .cp-manos-preview {
    width: 124px;
    bottom: max(5.6rem, env(safe-area-inset-bottom, 0px));
    padding: 0.32rem;
  }

  .cp-manos-video {
    height: 88px;
  }

  .cp-modal-card-manos {
    width: min(420px, 100%);
    padding: 0.95rem 0.85rem 0.85rem;
  }

  .cp-manos-help-stage {
    min-height: 150px;
  }

  .cp-manos-help-nav .cp-btn {
    min-height: 38px;
  }
}
