/* Image verification dialog, adapted from the fen landing page. */
body.verify-open {
  overflow: hidden;
}

.verify-overlay {
  --verify-bg: #091511;
  --verify-card: #0f211b;
  --verify-card-deep: #0b1a16;
  --verify-primary: #baff43;
  --verify-primary-soft: rgba(186, 255, 67, .09);
  --verify-primary-border: rgba(186, 255, 67, .34);
  --verify-text: #edf4f1;
  --verify-muted: #80958d;
  --verify-border: rgba(255, 255, 255, .11);
  --verify-danger: #ff7b86;
  position: fixed;
  z-index: 4000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  overflow: auto;
  color: var(--verify-text);
  background: rgba(1, 8, 6, .88);
  backdrop-filter: blur(14px);
  -webkit-overflow-scrolling: touch;
}

.verify-overlay[hidden],
#verify-panel[hidden],
.verify-success[hidden] {
  display: none !important;
}

.verify-modal {
  width: min(100%, 430px);
  max-height: min(92dvh, calc(100vh - 24px));
  overflow: auto;
  border: 1px solid var(--verify-primary-border);
  border-radius: 18px;
  color: var(--verify-text);
  background: var(--verify-card);
  box-shadow: 0 28px 75px rgba(0, 0, 0, .58), 0 0 0 1px rgba(186, 255, 67, .04);
  animation: verify-pop .28s cubic-bezier(.2, .8, .2, 1);
  scrollbar-width: thin;
  scrollbar-color: #395148 transparent;
}

@keyframes verify-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(.98);
  }
}

.verify-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--verify-border);
  background: linear-gradient(180deg, #132820 0%, var(--verify-card) 100%);
}

.verify-head h2 {
  margin: 0;
  color: var(--verify-primary);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.verify-head p {
  margin: 6px 0 0;
  color: var(--verify-muted);
  font-size: 12px;
  line-height: 1.55;
}

.verify-close {
  width: 31px;
  height: 31px;
  padding: 0;
  display: grid;
  flex: 0 0 31px;
  place-items: center;
  border: 1px solid var(--verify-border);
  border-radius: 8px;
  color: var(--verify-muted);
  background: rgba(255, 255, 255, .025);
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.verify-close svg {
  width: 16px;
  height: 16px;
}

.verify-close:hover {
  color: var(--verify-primary);
  border-color: var(--verify-primary-border);
  background: var(--verify-primary-soft);
}

.verify-body {
  padding: 15px 18px 18px;
  background: var(--verify-card);
}

.verify-progress {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 13px;
  color: var(--verify-muted);
  font-size: 11px;
}

.verify-progress > span {
  white-space: nowrap;
}

.verify-progress-bar {
  height: 6px;
  flex: 1;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
}

.verify-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #86cb21, var(--verify-primary));
  box-shadow: 0 0 12px rgba(186, 255, 67, .32);
  transition: width .35s ease;
}

.verify-prompt {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--verify-primary-border);
  border-radius: 9px;
  color: var(--verify-text);
  background: var(--verify-primary-soft);
  font-size: 12px;
  line-height: 1.55;
}

.verify-prompt strong {
  color: var(--verify-primary);
}

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

.verify-grid.is-busy {
  pointer-events: none;
}

.verify-tile {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--verify-border);
  border-radius: 9px;
  background: var(--verify-bg);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, opacity .15s ease;
}

.verify-grid.is-busy .verify-tile {
  opacity: .72;
}

.verify-tile:hover {
  border-color: var(--verify-primary-border);
  transform: translateY(-1px);
}

.verify-tile.is-selected {
  border-color: var(--verify-primary);
  box-shadow: 0 0 0 1px var(--verify-primary), 0 0 18px rgba(186, 255, 67, .12);
}

.verify-tile.is-selected::after {
  content: "✓";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #10180b;
  background: var(--verify-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .34);
  font-size: 11px;
  font-weight: 800;
}

.verify-tile img {
  width: 100%;
  height: 100%;
  padding: 12px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.verify-tile.is-photo img {
  padding: 0;
  object-fit: cover;
}

.verify-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 12px 0 7px;
  color: var(--verify-muted);
  font-size: 10px;
}

.verify-meta span:last-child {
  text-align: right;
}

.verify-error {
  min-height: 19px;
  margin-bottom: 8px;
  color: var(--verify-danger);
  font-size: 11px;
  line-height: 1.45;
}

.verify-actions {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 9px;
}

.verify-button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--verify-border);
  border-radius: 9px;
  color: var(--verify-text);
  background: rgba(255, 255, 255, .045);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}

.verify-button:hover:not(:disabled) {
  color: var(--verify-primary);
  border-color: var(--verify-primary-border);
  background: var(--verify-primary-soft);
  transform: translateY(-1px);
}

.verify-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.verify-button--primary {
  border-color: var(--verify-primary);
  color: #10180b;
  background: var(--verify-primary);
  box-shadow: 0 12px 28px rgba(157, 233, 45, .16);
  font-weight: 800;
}

.verify-button--primary:hover:not(:disabled) {
  color: #10180b;
  background: #c5ff62;
}

.verify-button--primary:disabled {
  border-color: rgba(186, 255, 67, .2);
  color: #80966b;
  background: rgba(186, 255, 67, .1);
  box-shadow: none;
  opacity: 1;
}

.verify-close:focus-visible,
.verify-button:focus-visible,
.verify-tile:focus-visible {
  outline: 2px solid var(--verify-primary);
  outline-offset: 2px;
}

.verify-success {
  padding: 42px 24px 36px;
  text-align: center;
  background: var(--verify-card);
}

.verify-success-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 15px;
  border: 1px solid var(--verify-primary-border);
  border-radius: 50%;
  color: var(--verify-primary);
  background: var(--verify-primary-soft);
  font-size: 28px;
  line-height: 56px;
  box-shadow: 0 0 28px rgba(186, 255, 67, .09);
}

.verify-success h2 {
  margin: 0 0 8px;
  color: var(--verify-primary);
  font-size: 20px;
}

.verify-success p {
  margin: 0;
  color: var(--verify-muted);
  font-size: 12px;
}

.verify-loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid rgba(186, 255, 67, .2);
  border-top-color: var(--verify-primary);
  border-radius: 50%;
  animation: verify-spin .8s linear infinite;
  vertical-align: middle;
}

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

@media (max-width: 760px) {
  .verify-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .verify-modal {
    width: 100%;
    max-height: min(94dvh, 100%);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
  }

  .verify-head {
    position: sticky;
    z-index: 2;
    top: 0;
  }

  .verify-body {
    padding: 13px 15px calc(16px + env(safe-area-inset-bottom));
  }

  .verify-actions {
    position: sticky;
    bottom: 0;
    padding-top: 8px;
    background: linear-gradient(180deg, transparent, var(--verify-card) 28%);
  }
}

@media (max-width: 380px) {
  .verify-grid { gap: 6px; }
  .verify-tile img { padding: 9px; }
  .verify-head { padding: 15px 14px 12px; }
  .verify-meta { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .verify-modal,
  .verify-loading {
    animation: none;
  }

  .verify-progress-fill,
  .verify-tile,
  .verify-button {
    transition: none;
  }
}
