/* ---------- BODY & GENERAL ---------- */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #f1f3f4;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh; /* fallback for Safari */
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ---------- CAPTCHA CARD ---------- */
.captcha-card {
  background: white;
  width: 90%;
  height:90%;
  max-width: 500px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  overflow: hidden;
  display: none; /* hidden until images load */
  flex-direction: column;
}

.captcha-header {
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 16px;
  color: #5f6368;
}

.captcha-header strong {
  display: block;
  font-size: 20px;
  color: #202124;
  margin-top: 4px;
}

/* ---------- IMAGE GRID ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px;
  justify-items: center;
}


.grid img {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: pointer;
  border: 3px solid transparent;
  border-radius: 8px;
  box-sizing: border-box;
  transition: border 0.2s;
}

.grid img.selected {
  border-color: #1a73e8;
}

/* ---------- CAPTCHA FOOTER ---------- */
.captcha-footer {
  padding: 15px;
  text-align: right;
  border-top: 1px solid #e0e0e0;
}

.captcha-footer button {
  background: #1a73e8;
  border: none;
  color: white;
  padding: 10px 18px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
}

.error {
  font-size: 13px;
  color: #d93025;
  padding: 8px 12px;
}

/* ---------- OVERLAY POPUP ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 10px;
}

.popup {
  background: white;
  padding: 25px;
  border-radius: 12px;
  text-align: center;
  width: 100%;
  max-width: 350px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  font-size: large;
}

.popup h3 {
  margin: 0 0 10px;
  color: #202124;
}

.popup button {
  margin-top: 15px;
  padding: 10px 18px;
  border: none;
  background: #1a73e8;
  color: white;
  border-radius: 6px;
  cursor: pointer;
}

/* ---------- LOADING ---------- */
#loading {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f1f3f4;
  z-index: 1000;
  font-size: 18px;
  color: #555;
}