/* ==========================================================
   SecureCheck · 访问验证页样式
   布局参考了通用的「挑战页」形式，界面、图标、文案均为自己编写，
   未使用任何第三方页面代码、图标或文案。
   纯前端视觉效果，不具备真实的人机识别能力。
   ========================================================== */

:root {
  --bg: #fbfbfc;
  --ink: #1f2328;
  --muted: #6b7280;
  --muted-2: #9aa1ab;
  --line: #e3e6ea;
  --line-strong: #d0d5dc;
  --accent: #2f6fed;
  --ok: #1a9d5a;
  --danger: #d64545;
  --danger-soft: #fdeeee;
  --danger-line: #f2c4c4;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked { overflow: hidden; }

button { font: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ============================ 页面骨架 ============================ */

.page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px 84px;
}

.site-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin: 0 0 30px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--ink);
  word-break: break-all;
}

.site-icon {
  display: block;
  flex: none;
  width: 30px;
  height: 30px;
}

.stage { width: min(420px, 100%); }

.phases { display: grid; }

.phase {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity .35s var(--ease), transform .35s var(--ease), visibility .35s;
}

.stage[data-phase="checking"] .phase--checking,
.stage[data-phase="challenge"] .phase--challenge,
.stage[data-phase="success"] .phase--success,
.stage[data-phase="error"] .phase--error {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.phase__title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .01em;
}

.phase__desc {
  margin: 0;
  max-width: 34ch;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

/* ============================ 加载环 ============================ */

.spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 20px;
  border: 3px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

/* ============================ 确认框 ============================ */

.turnstile {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
  color: var(--ink);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.turnstile:hover {
  border-color: #b9c4d4;
  box-shadow: 0 2px 8px rgba(16, 24, 40, .08);
}

.turnstile:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.turnstile[disabled] { cursor: default; }

.turnstile__box {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  background: #fff;
  border: 2px solid #b9c1cc;
  border-radius: 4px;
  color: #fff;
  transition: background .2s, border-color .2s;
}

.turnstile__tick {
  width: 16px;
  height: 16px;
  opacity: 0;
  transform: scale(.6);
  transition: opacity .15s, transform .2s var(--ease);
}

.turnstile__spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid #d5dae1;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.turnstile.is-checking .turnstile__box {
  border-color: var(--accent);
  background: #f2f6ff;
}
.turnstile.is-checking .turnstile__spinner { display: block; }
.turnstile.is-done .turnstile__box {
  border-color: var(--accent);
  background: var(--accent);
}
.turnstile.is-done .turnstile__tick { opacity: 1; transform: none; }

.turnstile__label { flex: 1; }

.turnstile__brand {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--muted-2);
}
.turnstile__brand-icon {
  display: block;
  width: 14px;
  height: 14px;
}

.phase--challenge .phase__desc { margin-top: 14px; }

/* ============================ 成功 / 异常 ============================ */

.phase--success:focus,
.phase--error:focus { outline: none; }

.success-ring {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  border: 1px solid rgba(26, 157, 90, .35);
  border-radius: 50%;
  background: rgba(26, 157, 90, .08);
  color: var(--ok);
  animation: popIn .4s var(--ease) both;
}
.success-ring svg { width: 26px; height: 26px; }
.success-ring path {
  stroke-dasharray: 32;
  stroke-dashoffset: 32;
  animation: drawTick .45s .15s var(--ease) forwards;
}

.fallback-link {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.fallback-link:hover { color: #1f54c0; }
.fallback-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.error-ring {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border: 1px solid var(--danger-line);
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  animation: popIn .4s var(--ease) both;
}
.error-ring svg { width: 26px; height: 26px; }

.error-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px 10px;
  border: 1px solid var(--danger-line);
  border-radius: 99px;
  background: var(--danger-soft);
  color: #b23b3b;
  font-size: 12.5px;
  font-weight: 600;
}
.error-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 2s ease-in-out infinite;
}

/* ============================ 底部品牌行 ============================ */

.page-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 18px;
  margin: 0;
  text-align: center;
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--muted-2);
}

/* ============================ 动画 ============================ */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drawTick { to { stroke-dashoffset: 0; } }
@keyframes popIn {
  from { opacity: 0; transform: scale(.72); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { opacity: .5; }
  50%      { opacity: 1; }
}

/* ============================ 响应式 ============================ */

@media (max-width: 480px) {
  .page { padding: 32px 16px 72px; }
  .site-name { margin-bottom: 24px; }
  .phase__title { font-size: 20px; }
  .turnstile__brand { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
