/**
 * 拼图缺口拖动验证样式 (Puzzle Captcha CSS)
 * v128：支持弹窗模式 (Modal) 与嵌入模式，高清毛玻璃与丝滑微动效
 */

/* ─── 弹窗模式遮罩层 ──────────────────────────────────────── */
.pv-modal-mask {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  width: 100vw;
  height: 100vh;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; width: 100vw; height: 100vh;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
}

.pv-modal-mask.pv-show {
  opacity: 1;
  visibility: visible;
}

/* ─── 弹窗主体卡片 ────────────────────────────────────────── */
.pv-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 340px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 18px;
  box-sizing: border-box;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.2), opacity 0.26s ease;
  user-select: none;
  -webkit-user-select: none;
}

.pv-modal-mask.pv-show .pv-modal-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* 弹窗顶部栏 */
.pv-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.pv-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pv-modal-title i {
  color: #2d8cf0;
  font-size: 16px;
}

.pv-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.pv-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: rotate(90deg);
}

/* ─── 拼图图片展示区 ──────────────────────────────────────── */
.pv-img-box {
  position: relative;
  width: 100%;
  height: 155px;
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.pv-bg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.pv-piece-canvas {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  display: block;
  z-index: 4;
  cursor: grab;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
  will-change: transform;
}

.pv-piece-canvas:active {
  cursor: grabbing;
}

/* 顶部工具按钮（刷新） */
.pv-tools {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  display: flex;
  gap: 6px;
}

.pv-tool-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s;
  opacity: 0.85;
}

.pv-tool-btn:hover {
  opacity: 1;
  background: rgba(15, 23, 42, 0.8);
  transform: scale(1.08) rotate(45deg);
}

/* 加载动画蒙层 */
.pv-loading {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; width: 100vw; height: 100vh;
  background: rgba(15, 23, 42, 0.82);
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 12px;
  gap: 8px;
  border-radius: 12px;
  transition: opacity 0.2s;
}

.pv-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: pv-spin 0.7s linear infinite;
}

@keyframes pv-spin {
  to { transform: rotate(360deg); }
}

/* 提示文字浮层（成功/失败） */
.pv-flash-msg {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  line-height: 30px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  z-index: 6;
  opacity: 0;
  transform: translateY(100%);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.pv-flash-msg.show {
  opacity: 1;
  transform: translateY(0);
}

.pv-flash-msg.success {
  background: rgba(16, 185, 129, 0.95);
  color: #ffffff;
}

.pv-flash-msg.fail {
  background: rgba(239, 68, 68, 0.95);
  color: #ffffff;
}

/* ─── 下方滑动轨道 ────────────────────────────────────────── */
.pv-track-box {
  position: relative;
  width: 100%;
  height: 42px;
  background: #f1f5f9;
  border-radius: 24px;
  margin-top: 14px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-sizing: border-box;
}

.pv-track-tip {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; width: 100vw; height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  pointer-events: none;
  letter-spacing: 0.5px;
  transition: opacity 0.2s;
}

.pv-track-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, rgba(45, 140, 240, 0.18), rgba(45, 140, 240, 0.42));
  border-radius: 24px;
  pointer-events: none;
  transition: background 0.2s;
}

.pv-track-fill.success {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.5));
}

.pv-track-fill.fail {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.5));
}

/* 滑块手柄按钮 */
.pv-handle {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 38px;
  height: 36px;
  border-radius: 20px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: #475569;
  font-size: 16px;
  transition: transform 0.02s linear, background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
  z-index: 5;
}

.pv-handle:hover {
  background: #2d8cf0;
  border-color: #2d8cf0;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(45, 140, 240, 0.38);
}

.pv-handle:active {
  cursor: grabbing;
  background: #1a76d8;
  border-color: #1a76d8;
  color: #ffffff;
}

.pv-handle.success {
  background: #10b981 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45);
}

.pv-handle.fail {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.45);
}

/* 嵌入式模式容器 */
.pv-inline-wrapper {
  width: 100%;
  margin: 12px 0 16px;
}
