/* TraceCaptcha — 轨迹人机验证（多主题 + 动效） */
.tc-mask {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.28s ease;
}
.tc-mask.open {
  display: flex;
  opacity: 1;
  animation: tc-mask-in 0.32s ease both;
}
@keyframes tc-mask-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tc-modal {
  width: min(540px, 100%);
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.14), 0 4px 12px rgba(0, 0, 0, 0.04);
  padding: 22px 26px 24px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", sans-serif;
  transform: scale(0.96) translateY(8px);
  opacity: 0;
  -webkit-font-smoothing: antialiased;
}
.tc-mask.open .tc-modal {
  animation: tc-modal-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes tc-modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.tc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.tc-modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1d1d1f;
  margin: 0;
}
.tc-close {
  width: 28px;
  height: 28px;
  font-size: 20px;
  color: #86868b;
  cursor: pointer;
  line-height: 1;
  background: #f5f5f7;
  border: none;
  border-radius: 999px;
  padding: 0;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}
.tc-close:hover { background: #ebebed; color: #1d1d1f; }

.tc-card {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  user-select: none;
  -webkit-user-select: none;
}

.tc-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}
.tc-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.tc-main-title { font-size: 14px; font-weight: 700; color: #1d1d1f; }
.tc-sub-badge {
  font-size: 10px;
  color: #86868b;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
  background: #f5f5f7;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
}
.tc-theme-pill {
  font-size: 10px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  color: #56565c;
  letter-spacing: 0.02em;
}

.tc-refresh {
  width: 28px;
  height: 28px;
  cursor: pointer;
  border: 1.5px solid #1d1d1f;
  border-radius: 50%;
  position: relative;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  background: transparent;
  padding: 0;
  flex-shrink: 0;
}
.tc-refresh::after {
  content: '';
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 2px;
}
.tc-refresh:hover { transform: rotate(180deg); }

/* —— Canvas themes —— */
.tc-canvas-wrap {
  width: 100%;
  height: 230px;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #e8ecf0 0%, #f0f1f3 100%);
  cursor: crosshair;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}
.tc-canvas-wrap[data-theme="ink"] {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(0, 0, 0, 0.03), transparent 50%),
    linear-gradient(145deg, #f4f1ea 0%, #ebe6dc 55%, #e4dfd4 100%);
}
.tc-canvas-wrap[data-theme="frost"] {
  background:
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.7), transparent 45%),
    linear-gradient(135deg, #d9e6f0 0%, #e8f0f6 45%, #cfdce8 100%);
}
.tc-canvas-wrap[data-theme="dawn"] {
  background: linear-gradient(135deg, #f8e6d4 0%, #f3d5c0 42%, #edd0c8 100%);
}
.tc-canvas-wrap[data-theme="meadow"] {
  background: linear-gradient(135deg, #e4f0e6 0%, #d5e8da 50%, #c8dfd0 100%);
}
.tc-canvas-wrap[data-theme="graphite"] {
  background: linear-gradient(145deg, #f2f2f4 0%, #e8e8ec 50%, #dedee3 100%);
}

.tc-modal[data-theme="ink"] .tc-theme-pill { background: rgba(44, 44, 44, 0.08); color: #2c2c2c; }
.tc-modal[data-theme="frost"] .tc-theme-pill { background: rgba(61, 126, 166, 0.12); color: #2f6284; }
.tc-modal[data-theme="dawn"] .tc-theme-pill { background: rgba(196, 122, 58, 0.14); color: #9a5a28; }
.tc-modal[data-theme="meadow"] .tc-theme-pill { background: rgba(47, 107, 79, 0.12); color: #2a5c44; }
.tc-modal[data-theme="graphite"] .tc-theme-pill { background: rgba(0, 113, 227, 0.1); color: #0071e3; }

.tc-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.tc-canvas-wrap.tc-shake {
  animation: tc-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes tc-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

/* Progress */
.tc-progress-track {
  height: 4px;
  margin-top: 12px;
  border-radius: 999px;
  background: #ebebed;
  overflow: hidden;
}
.tc-progress-bar {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1d1d1f, #86868b);
  transition: width 0.18s ease;
}
.tc-modal[data-theme="frost"] .tc-progress-bar {
  background: linear-gradient(90deg, #3d7ea6, #5b8def);
}
.tc-modal[data-theme="dawn"] .tc-progress-bar {
  background: linear-gradient(90deg, #c47a3a, #e07a5f);
}
.tc-modal[data-theme="meadow"] .tc-progress-bar {
  background: linear-gradient(90deg, #2f6b4f, #3d9b6e);
}
.tc-modal[data-theme="ink"] .tc-progress-bar {
  background: linear-gradient(90deg, #2c2c2c, #6a6a6a);
}
.tc-modal[data-theme="graphite"] .tc-progress-bar {
  background: linear-gradient(90deg, #0071e3, #34c759);
}

.tc-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding: 0 2px;
}
.tc-dots { display: flex; gap: 5px; }
.tc-dots span {
  width: 5px;
  height: 5px;
  background: #d2d2d7;
  border-radius: 50%;
  transition: background 0.2s;
}
.tc-modal[data-theme] .tc-dots span:nth-child(1) { background: #1d1d1f; }
.tc-help {
  width: 18px;
  height: 18px;
  border: 1px solid #c7c7cc;
  color: #86868b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
}

.tc-success-mask {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
}
.tc-success-mask.active { opacity: 1; pointer-events: auto; }

.tc-success-icon-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  transform: scale(0.55);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tc-success-mask.active .tc-success-icon-wrap { transform: scale(1); }

.tc-pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: rgba(52, 199, 89, 0.22);
  animation: tc-pulse 1.8s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}
@keyframes tc-pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

.tc-success-svg { width: 64px; height: 64px; stroke: #34c759; }
.tc-success-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 3.5;
  fill: none;
}
.tc-success-check {
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke-width: 3.5;
  stroke-linecap: round;
}
.tc-success-mask.active .tc-success-circle {
  animation: tc-stroke 0.55s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}
.tc-success-mask.active .tc-success-check {
  animation: tc-stroke 0.45s cubic-bezier(0.65, 0, 0.45, 1) 0.4s forwards;
}
@keyframes tc-stroke { 100% { stroke-dashoffset: 0; } }

.tc-success-title {
  font-size: 16px;
  font-weight: 700;
  color: #1d1d1f;
  letter-spacing: -0.02em;
}
.tc-success-desc { font-size: 12px; color: #86868b; margin-top: 4px; }

.tc-fail-toast {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: rgba(255, 59, 48, 0.92);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 12px;
  font-weight: 550;
  padding: 7px 14px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(255, 59, 48, 0.25);
  z-index: 50;
}
.tc-fail-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tc-hint {
  margin-top: 14px;
  margin-bottom: 0;
  font-size: 12px;
  color: #86868b;
  line-height: 1.55;
}

/* —— Stage / Easy modes (slide · hold · magnet) —— */
.tc-stage { position: relative; min-height: 120px; }
.tc-easy-host[hidden],
.tc-canvas-wrap[hidden],
.tc-progress-track[hidden] { display: none !important; }
.tc-easy {
  padding: 8px 2px 4px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tc-spring {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}

/* Slide */
.tc-slide-track {
  position: relative;
  width: 100%;
  height: 48px;
  background: #f0f0f2;
  border-radius: 999px;
  padding: 4px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.04);
}
.tc-slide-bg {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: #34c759;
  border-radius: 999px;
  transition: width 0.12s linear;
}
.tc-slide-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  padding-left: 28px;
  color: #86868b;
}
.shimmer-text {
  background: linear-gradient(90deg, rgba(134,134,139,0.45) 0%, rgba(29,29,31,0.9) 50%, rgba(134,134,139,0.45) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: tc-shimmer 2.8s infinite linear;
}
@keyframes tc-shimmer {
  0% { background-position: 150% 0; }
  100% { background-position: -150% 0; }
}
.tc-slide-ok {
  color: #fff;
  font-weight: 700;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 12px;
  -webkit-text-fill-color: #fff;
}
.tc-slide-thumb {
  position: absolute;
  left: 4px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  z-index: 10;
  color: #1d1d1f;
  touch-action: none;
}
.tc-slide-thumb:active { cursor: grabbing; }
.tc-slide-thumb.is-ok { color: #34c759; }

/* Hold */
.tc-hold-btn {
  position: relative;
  width: 100%;
  height: 48px;
  border-radius: 16px;
  background: #f0f0f2;
  border: 1px solid rgba(0, 0, 0, 0.04);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  transition: transform 0.12s ease;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.tc-hold-btn:active { transform: scale(0.98); }
.tc-hold-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: #0071e3;
}
.tc-hold-success {
  position: absolute;
  inset: 0;
  background: #34c759;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-family: "SF Mono", Menlo, monospace;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 5;
}
.tc-hold-success.show { opacity: 1; }
.tc-hold-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1d1d1f;
  transition: color 0.15s;
}
.tc-hold-content.is-fill { color: #fff; }
.tc-hold-content svg { color: #0071e3; flex-shrink: 0; }
.tc-hold-content.is-fill svg { color: #fff; }
.tc-hold-note {
  margin-top: 10px;
  text-align: center;
  font-size: 10px;
  font-family: "SF Mono", Menlo, monospace;
  color: #a1a1a6;
}

/* Magnet */
.tc-magnet-arena {
  position: relative;
  width: 100%;
  height: 64px;
  background: #f0f0f2;
  border-radius: 16px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(0, 0, 0, 0.04);
}
.tc-magnet-start {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px dashed #d2d2d7;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tc-magnet-start span {
  font-size: 9px;
  font-family: "SF Mono", Menlo, monospace;
  color: #a1a1a6;
  letter-spacing: 0.04em;
}
.tc-magnet-key {
  position: absolute;
  left: 8px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: #0071e3;
  z-index: 20;
  touch-action: none;
}
.tc-magnet-key:active { cursor: grabbing; }
.tc-magnet-key.is-in { opacity: 0; pointer-events: none; }
.tc-magnet-hole {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(210, 210, 215, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #86868b;
  transition: background 0.3s, color 0.3s, box-shadow 0.3s;
}
.tc-magnet-hole.is-unlocked {
  background: #34c759;
  color: #fff;
  box-shadow: 0 0 24px rgba(52, 199, 89, 0.28);
}

.tc-modal[data-mode="slide"] .tc-theme-pill,
.tc-modal[data-mode="hold"] .tc-theme-pill,
.tc-modal[data-mode="magnet"] .tc-theme-pill {
  background: rgba(0, 113, 227, 0.1);
  color: #0071e3;
}
