/* 壁纸社 · 人机验证（v1.8 自绘滑块）
   不再加载第三方 captcha-web-sdk 浮层：SDK 按固定 348px 计算拼图尺寸，
   塞进窄表单栏后拼图块会被拉成半张卡片。这里全部由主题自绘。 */

/* --- 触发按钮 --- */
.wh-tac-trigger {
  width: 100%; min-height: 44px; padding: 9px 14px;
  border: 1px solid var(--wh-border); border-radius: var(--wh-radius-sm);
  background: var(--wh-surface-2); color: var(--wh-text-2);
  font-size: 13.5px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: border-color .18s, color .18s, background .18s;
}
.wh-tac-trigger:hover { background: var(--wh-primary-soft); border-color: var(--wh-primary); color: var(--wh-primary); }
.wh-tac-trigger small { font-weight: 400; font-size: 11.5px; opacity: .75; }
.wh-tac-trigger.is-verified { background: var(--wh-primary-soft); border-color: var(--wh-primary); color: var(--wh-primary); }
.wh-tac-state { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--wh-text-3); }
.wh-tac-state.is-ok { color: var(--wh-primary); font-weight: 600; }

/* --- 内嵌容器：空时不占位 --- */
#wh-tac-box { position: relative; width: 100%; z-index: 1; }
#wh-tac-box:empty { display: none; }
#wh-tac-box.is-open:not(:empty) { margin-top: 10px; }
.wh-slider__loading { padding: 18px; text-align: center; font-size: 12.5px; color: var(--wh-text-3); }

/* --- 验证卡片：跟随表单栏宽度，最大 320px，不浮层 --- */
.wh-slider {
  width: 100%; max-width: 320px; margin: 0 auto; box-sizing: border-box;
  padding: 14px; border: 1px solid var(--wh-border); border-radius: var(--wh-radius);
  background: var(--wh-surface); box-shadow: var(--wh-shadow);
  animation: wh-slider-in .18s ease-out;
}
@keyframes wh-slider-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.wh-slider__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.wh-slider__title { font-size: 15px; font-weight: 600; color: var(--wh-text); line-height: 1.3; }
.wh-slider__sub { margin: 3px 0 10px; font-size: 11.5px; line-height: 1.5; color: var(--wh-text-3); }
.wh-slider__x {
  flex: 0 0 24px; width: 24px; height: 24px; padding: 0; border: 0; background: transparent;
  color: var(--wh-text-3); cursor: pointer; font-size: 12px; border-radius: 4px;
}
.wh-slider__x:hover { background: var(--wh-surface-2); color: var(--wh-text); }

/* 单一画布：背景图 100%×100%，拼图块绝对定位在左侧 */
.wh-slider__stage {
  position: relative; width: 100%; aspect-ratio: 300 / 180; overflow: hidden;
  border-radius: 6px; background: var(--wh-surface-2); border: 1px solid var(--wh-border);
  user-select: none; -webkit-user-select: none;
}
.wh-slider__bg { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.wh-slider__piece {
  position: absolute; left: 0; top: 0; display: block;
  object-fit: fill; pointer-events: none; box-shadow: 0 0 0 1px rgba(255,255,255,.85);
}
.wh-slider__tip {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 8px;
  font-size: 11.5px; color: #fff; text-align: center;
  transform: translateY(100%); transition: transform .22s; opacity: 0;
}
.wh-slider__tip.is-on { transform: none; opacity: 1; }
.wh-slider__tip.is-ok { background: rgba(15,110,80,.94); }
.wh-slider__tip.is-err { background: rgba(160,62,54,.94); }
.wh-slider__tip:not(.is-ok):not(.is-err) { background: rgba(31,74,125,.9); }

/* 滑块条 */
.wh-slider__track {
  position: relative; height: 42px; margin-top: 12px; border-radius: 999px;
  background: var(--wh-surface-2); border: 1px solid var(--wh-border); overflow: hidden;
}
.wh-slider__label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--wh-text-3); pointer-events: none; transition: opacity .18s;
}
.wh-slider__mask {
  position: absolute; left: 0; top: 0; bottom: 0; width: 46px;
  background: var(--wh-primary-soft); border-right: 1px solid var(--wh-primary); border-radius: 999px 0 0 999px;
}
.wh-slider__btn {
  position: absolute; left: 0; top: 2px; width: 42px; height: 36px; padding: 0;
  border: 0; border-radius: 999px; background: var(--wh-primary); color: #fff;
  font-size: 13px; cursor: grab; touch-action: none; z-index: 2;
  display: flex; align-items: center; justify-content: center;
}
.wh-slider__btn:active { cursor: grabbing; }
.wh-slider__track.is-dragging .wh-slider__btn { background: var(--wh-accent); }
.wh-slider__track.is-fail .wh-slider__btn { background: #b0443a; }
.wh-slider__track.is-fail { border-color: #b0443a; }

.wh-slider__foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.wh-slider__icon {
  width: 26px; height: 26px; padding: 0; border: 1px solid var(--wh-border);
  border-radius: 6px; background: var(--wh-surface); color: var(--wh-text-2); cursor: pointer; font-size: 12px;
}
.wh-slider__icon:hover { color: var(--wh-primary); border-color: var(--wh-primary); }
.wh-slider__hint { font-size: 11px; color: var(--wh-text-3); }

html[data-theme="dark"] .wh-slider { background: #20262d; }
html[data-theme="dark"] .wh-slider__track { background: #262b31; }
html[data-theme="dark"] .wh-slider__mask { background: #1f2d3d; }

@media (max-width: 400px) { .wh-slider { padding: 10px; } }
