/* =========================================================================
   reCAPTCHA & Enterprise Verification Theme
   Clean light widget on dark futuristic background
   ========================================================================= */
:root {
  --bg: #0b0d12;
  --bg-grid: #141822;
  --surface: rgba(255, 255, 255, 0.75);
  --surface-subtle: rgba(249, 249, 249, 0.65);
  --border: rgba(255, 255, 255, 0.35);
  --border-light: rgba(0, 0, 0, 0.1);
  --text-main: #222222;
  --text-muted: #555555;
  --text-dim: #777777;
  --rc-blue: #1a73e8;
  --rc-blue-hover: #1558b0;
  --rc-blue-light: #e8f0fe;
  --rc-danger: #d93025;
  --rc-success: #1e8e3e;

  --font-sans: -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Roboto Mono", Consolas, monospace;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background-color: var(--bg);
  color: #e7e9ee;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-image:
    linear-gradient(rgba(11, 13, 18, 0.25), rgba(11, 13, 18, 0.4)),
    url("assets/background.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.mono {
  font-family: var(--font-mono);
}

/* =========================================================================
   LAYOUT & STAGE
   ========================================================================= */
.stage {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(24px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
  gap: 20px;
}

/* =========================================================================
   MAIN CARD CONTAINER
   ========================================================================= */
.card {
  width: 100%;
  max-width: 380px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 6px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
  transition: box-shadow 200ms ease;
}

.step {
  display: block;
}

.step[hidden] {
  display: none !important;
}

/* =========================================================================
   STEP 1: RECAPTCHA ANCHOR WIDGET
   ========================================================================= */
.rc-anchor-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-height: 74px;
}

.rc-anchor-checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  min-height: 44px;
}

.rc-anchor-checkbox-label input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.rc-checkbox {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(160, 160, 160, 0.75);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.8);
  margin-right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 150ms, background 150ms;
  position: relative;
}

.rc-anchor-checkbox-label:hover .rc-checkbox {
  border-color: #a0a0a0;
}

.rc-checkbox.loading {
  border-color: transparent !important;
  background: transparent !important;
}

.rc-checkbox.loading::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--rc-blue);
  border-radius: 50%;
  animation: rc-spin 700ms linear infinite;
}

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

.rc-anchor-checkbox-label input:checked+.rc-checkbox {
  border-color: var(--rc-blue);
  background: #ffffff;
}

.rc-anchor-checkbox-label input:checked+.rc-checkbox::after {
  content: "";
  width: 7px;
  height: 14px;
  border: solid var(--rc-blue);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
  margin-top: -3px;
}

.rc-anchor-text {
  font-size: 14.5px;
  font-weight: 500;
  color: #282828;
}

.rc-anchor-pt {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 9.5px;
  color: #555555;
  user-select: none;
}

.rc-logo {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  color: var(--rc-blue);
}

.rc-logo svg {
  width: 100%;
  height: 100%;
}

.rc-pt-text {
  color: #666;
  font-size: 9px;
  white-space: nowrap;
}

.rc-pt-links {
  font-size: 8px;
  color: #777;
  white-space: nowrap;
}

/* =========================================================================
   STEP 2: SLIDER / JIGSAW PUZZLE
   ========================================================================= */
.step-slider-inner {
  padding: 16px;
}

.puzzle-header {
  margin-bottom: 12px;
}

.puzzle-header h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  color: #222;
}

.puzzle-header p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
}

.puzzle-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 16px;
  background: #1c2130;
}

.puzzle-bg {
  position: absolute;
  inset: 0;
  background-image: url('assets/puzzle-bg.webp');
  background-size: cover;
  background-position: center;
}

.puzzle-notch {
  position: absolute;
  top: 35%;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 2px dashed rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
  backdrop-filter: brightness(0.6);
}

.puzzle-piece {
  position: absolute;
  top: 35%;
  left: 0;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background-image: url('assets/puzzle-bg.webp');
  background-size: cover;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6), inset 0 0 0 1.5px rgba(255, 255, 255, 0.6);
  will-change: transform;
}

.slider-track {
  position: relative;
  height: 44px;
  background: rgba(241, 243, 244, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 24px;
  display: flex;
  align-items: center;
  touch-action: none;
}

.slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: #d2e3fc;
  border-radius: 24px 0 0 24px;
}

.slider-label {
  position: relative;
  margin: 0 auto;
  font-size: 12.5px;
  color: var(--text-muted);
  pointer-events: none;
  font-weight: 500;
}

.slider-handle {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  color: #5f6368;
  display: grid;
  place-items: center;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  border: 1px solid #dadce0;
  will-change: transform;
  transition: color 150ms, box-shadow 150ms;
}

.slider-handle:hover {
  color: var(--rc-blue);
  box-shadow: 0 3px 8px rgba(26, 115, 232, 0.3);
}

.slider-handle:active,
.slider-handle.dragging {
  cursor: grabbing;
  background: #ffffff;
  color: var(--rc-blue);
}

.slider-handle svg {
  width: 20px;
  height: 20px;
}

/* =========================================================================
   STEP 3: RECAPTCHA PHOTO GRID CHALLENGE
   ========================================================================= */
.rc-header {
  background: rgba(26, 115, 232, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  padding: 18px 16px 16px;
}

.rc-header-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.3;
}

.rc-header-strong {
  display: block;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 2px;
}

.rc-header-sub {
  margin: 4px 0 0;
  font-size: 12px;
  opacity: 0.9;
}

.rc-body {
  padding: 6px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.grid3.shake {
  animation: rc-grid-shake 360ms ease-in-out;
}

@keyframes rc-grid-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 2px;
  border: 1px solid var(--border-light);
  background: #e8eaed;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  outline: none;
  transition: transform 120ms ease, opacity 120ms ease;
  user-select: none;
}

.tile:hover {
  opacity: 0.94;
}

.tile.selected {
  transform: scale(0.92);
  border-color: transparent;
}

.tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.tile-check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rc-blue);
  color: #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
  z-index: 2;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.tile.selected .tile-check {
  display: flex;
}

.rc-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.rc-controls {
  display: flex;
  gap: 16px;
  color: #70757a;
}

.rc-icon-btn {
  background: none;
  border: none;
  padding: 0;
  width: 44px;
  height: 44px;
  cursor: pointer;
  color: #70757a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms;
}

.rc-icon-btn:hover {
  color: #202124;
}

.rc-icon-btn svg {
  width: 20px;
  height: 20px;
}

.rc-button {
  background: var(--rc-blue);
  color: #ffffff;
  border: none;
  padding: 9px 24px;
  border-radius: 2px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 150ms, opacity 150ms;
  outline: none;
}

.rc-button:hover:not(:disabled) {
  background: var(--rc-blue-hover);
}

.rc-button:disabled {
  background: #dadce0;
  color: #ffffff;
  cursor: not-allowed;
}

.rc-icon-btn:focus-visible,
.rc-button:focus-visible,
.tile:focus-visible,
.slider-handle:focus-visible,
.rc-anchor-checkbox-label:focus-within .rc-checkbox {
  outline: 3px solid rgba(26, 115, 232, 0.55);
  outline-offset: 2px;
}

.hint-msg {
  min-height: 18px;
  font-size: 12px;
  margin: 6px 0 0;
  text-align: center;
  font-weight: 500;
}

.hint-msg.error {
  color: var(--rc-danger);
}

.hint-msg.ok {
  color: var(--rc-success);
}

/* =========================================================================
   STEP 4: TELEMETRY & SIGNAL AGGREGATION
   ========================================================================= */
.step-loader-inner {
  padding: 24px 20px;
  text-align: center;
}

.loader-ring {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 16px;
}

.loader-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: #e8eaed;
  stroke-width: 8;
}

.ring-fg {
  fill: none;
  stroke: var(--rc-blue);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 276.5;
  stroke-dashoffset: 276.5;
  transition: stroke-dashoffset 150ms linear;
}

.ring-pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: #202124;
}

.loader-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
  color: #202124;
}

.loader-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 16px;
}

/* Sleek linear pulse progress bar */
.linear-pulse-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  margin: 14px 0 16px;
}

.linear-pulse-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--rc-blue), #4285f4);
  border-radius: 999px;
  position: relative;
  transition: width 150ms ease-out;
}

.linear-pulse-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  animation: bar-shimmer 1.4s infinite;
}

@keyframes bar-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Dynamic live status phase pill */
.loader-phase {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin-bottom: 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rc-blue);
  box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.6);
  animation: dot-pulse 1.5s infinite;
  flex-shrink: 0;
}

.loader-phase.ok .pulse-dot {
  background: var(--rc-success);
  box-shadow: 0 0 0 0 rgba(30, 142, 62, 0.6);
}

@keyframes dot-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(26, 115, 232, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(26, 115, 232, 0);
  }
}

.phase-text {
  transition: opacity 150ms ease;
}

/* Security trust badges */
.security-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 11.5px;
  font-weight: 500;
  color: #5f6368;
}

.badge-icon {
  width: 14px;
  height: 14px;
  color: var(--rc-blue);
  flex-shrink: 0;
}

/* =========================================================================
   STEP 5: SUCCESS SCREEN
   ========================================================================= */
.step-success-inner {
  padding: 32px 20px;
  text-align: center;
}

.success-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  color: var(--rc-success);
}

.success-icon svg {
  width: 100%;
  height: 100%;
}

.success-circle {
  stroke: var(--rc-success);
  stroke-width: 3.5;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: draw-circle 500ms ease forwards;
}

.success-check {
  stroke: var(--rc-success);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: draw-check2 400ms 450ms ease forwards;
}

@keyframes draw-circle {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes draw-check2 {
  to {
    stroke-dashoffset: 0;
  }
}

.success-title {
  font-size: 20px;
  font-weight: 700;
  color: #202124;
  margin: 0 0 8px;
}

.success-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 20px;
  line-height: 1.4;
}

.fine-print {
  color: var(--text-dim);
  font-size: 11px;
  margin: 0;
}

/* =========================================================================
   FOOTER & PROGRESS INDICATOR
   ========================================================================= */
.progress-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3c4043;
  transition: background 200ms, transform 200ms;
}

.dot.active {
  background: var(--rc-blue);
  transform: scale(1.4);
}

.dot.done {
  background: var(--rc-success);
}

.footer-note {
  color: #9aa0a6;
  font-size: 11.5px;
  text-align: center;
  max-width: 320px;
  line-height: 1.4;
}

@media (max-width: 600px), (pointer: coarse) {
  body { background-attachment: scroll; }
}
