:root {
  --bg: #eceff3;
  --card-bg: #ffffff;
  --border: #d3d3d3;
  --border-hover: #b0b0b0;
  --text-title: #1f1f1f;
  --text-subtitle: #5f6368;
  --blue: #4285f4;
  --red: #d93025;
  --radius-card: 14px;
  --radius-box: 4px;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 10px 24px rgba(0, 0, 0, 0.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  color: var(--text-title);
}

.card {
  width: 100%;
  max-width: 360px;
  background: var(--card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  text-align: center;
}

.card__title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 600;
}

.card__subtitle {
  margin: 0 0 24px;
  font-size: 0.9rem;
  color: var(--text-subtitle);
}

.captcha {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-box);
  background: #fafafa;
  padding: 14px 16px 26px;
  text-align: left;
  transition: border-color 0.2s ease;
}

.captcha__control {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.captcha__control:focus-visible .captcha__box {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.captcha__control[aria-disabled="true"] {
  cursor: default;
}

.captcha__box {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-hover);
  border-radius: var(--radius-box);
  background: #fff;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.captcha__control:hover .captcha__box {
  border-color: #9a9a9a;
}

/* Spinner (loading state) */
.captcha__spinner {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 3px solid #e0e0e0;
  border-top-color: var(--blue);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.captcha.is-loading .captcha__spinner {
  opacity: 1;
  transform: scale(1);
  animation: spin 0.8s linear infinite;
}

.captcha.is-loading .captcha__box {
  border-color: transparent;
}

/* Cross (error / final state) */
.captcha__cross {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.captcha__cross path {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.captcha.is-error .captcha__box {
  border-color: var(--red);
  background: #fdecea;
}

.captcha.is-error .captcha__cross {
  opacity: 1;
  transform: scale(1);
}

.captcha.is-error {
  border-color: var(--red);
}

.captcha__label {
  font-size: 0.95rem;
  color: #333;
  user-select: none;
}

.captcha__status {
  position: absolute;
  left: 16px;
  bottom: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--red);
}

.captcha__footer {
  position: absolute;
  right: 12px;
  bottom: 6px;
}

.captcha__footer-text {
  font-size: 0.68rem;
  color: #9a9a9a;
}

@keyframes spin {
  to {
    transform: scale(1) rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .captcha.is-loading .captcha__spinner {
    animation: none;
  }
  .captcha__spinner,
  .captcha__cross,
  .captcha__box,
  .captcha {
    transition: none;
  }
}

@media (max-width: 400px) {
  .card {
    padding: 24px 18px;
  }
  .captcha {
    gap: 10px;
    padding: 12px 12px 24px;
  }
}

/* ---------- Bot-Audit ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.audit {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: left;
  animation: audit-in 0.3s ease;
}

@keyframes audit-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.audit__title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-title);
}

.audit__intro {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--text-subtitle);
}

.audit__question-wrap {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius-box);
  padding: 12px 14px;
  margin-bottom: 12px;
  min-height: 20px;
}

.audit__question {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--text-title);
}

.audit__form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audit__textarea {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-box);
  font: inherit;
  font-size: 0.9rem;
  color: var(--text-title);
  transition: border-color 0.2s ease;
}

.audit__textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: var(--blue);
}

.audit__textarea:disabled {
  background: #f2f2f2;
  color: var(--text-subtitle);
}

.audit__submit {
  align-self: flex-end;
  appearance: none;
  border: none;
  border-radius: 20px;
  padding: 9px 22px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--blue);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.audit__submit:hover:not(:disabled) { background: #3367d6; }
.audit__submit:active:not(:disabled) { transform: scale(0.97); }
.audit__submit:disabled { background: #b0c7f4; cursor: default; }

.audit__loader {
  width: 22px;
  height: 22px;
  margin: 10px auto 0;
  border-radius: 50%;
  border: 3px solid #e0e0e0;
  border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}

.audit__result {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-box);
  border: 1px solid var(--border);
}

.audit__result-headline {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 0.95rem;
}

.audit__result-comment {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-subtitle);
}

.audit__result--robot {
  background: #fdecea;
  border-color: var(--red);
}
.audit__result--robot .audit__result-headline { color: var(--red); }

.audit__result--human {
  background: #e8f0fe;
  border-color: var(--blue);
}
.audit__result--human .audit__result-headline { color: var(--blue); }

@media (prefers-reduced-motion: reduce) {
  .audit { animation: none; }
  .audit__loader { animation: none; }
}
