/* The 6-digit code (pages/verify-email.html :: otp; js/bg-otp.js): one real field, so paste and autofill land whole,
   under six cells; with what it says back, the resend and the confirmed seal. A page sets --otp-accent, --otp-ring and
   --otp-radius on an ancestor (the account pages: petrol; the app's card: gold). Until drawn (.is-drawn) the field shows. */
.otp { position: relative; }
.otp input { width: 100%; height: 56px; padding: 0 14px; border: 1px solid var(--field-border); border-radius: var(--otp-radius, var(--r-lg));
  background: var(--bg-panel); font: inherit; font-size: 22px; letter-spacing: .4em; color: var(--ink); }
.otp input:focus { outline: 2px solid transparent; border-color: var(--otp-accent, var(--gold)); box-shadow: var(--otp-ring, var(--focus-ring)); }
.otp.is-drawn input { position: absolute; inset: 0; z-index: 1; height: 100%; opacity: 0; border: 0; font-size: 16px; caret-color: transparent; cursor: text; }
.otp:not(.is-drawn) .otp__cells { display: none; }
.otp__cells { display: grid; grid-template-columns: repeat(3, 1fr) 14px repeat(3, 1fr); gap: 8px; align-items: center; pointer-events: none; }
.otp__cell { display: grid; place-items: center; height: 60px; border: 1px solid var(--field-border); border-radius: var(--otp-radius, var(--r-lg));
  background: var(--bg-panel);
  font-family: var(--font-sans); font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink);
  transition: border-color var(--duration-normal), box-shadow var(--duration-normal); }
.otp__cell.is-filled { border-color: var(--sand-600); animation: otp-digit .18s var(--ease-out); }
@keyframes otp-digit { from { transform: scale(.94); } }
.otp__gap { justify-self: center; width: 8px; height: 2px; border-radius: 1px; background: var(--field-border); }
.otp:focus-within .otp__cell.is-active { border-color: var(--otp-accent, var(--gold)); box-shadow: var(--otp-ring, var(--focus-ring));
  outline: 2px solid transparent; }
.otp:focus-within .otp__cell.is-active:empty::after { content: ""; width: 2px; height: 26px; border-radius: 1px; background: var(--otp-accent, var(--gold));
  animation: otp-caret 1.05s steps(1) infinite; }
@keyframes otp-caret { 50% { opacity: 0; } }
.otp[data-state="error"] .otp__cell { border-color: var(--overdue-fg); color: var(--overdue-fg); }
.otp[data-state="error"] .otp__cells { animation: otp-shake .32s; }
@keyframes otp-shake { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
.otp[data-state="busy"] .otp__cell { border-color: var(--line); background: var(--paper); }

/* drawn, the sixth digit sends the code: its submit is for no script */
.otp__submit { margin-top: 14px; }
:has(> .otp.is-drawn) > .otp__submit { display: none; }

/* what the code step says back, under the cells */
.otp__status { display: flex; align-items: center; gap: var(--icon-gap-sm); min-height: 22px; margin-top: 10px; font-size: 13px; color: var(--text); }
.otp__status:empty { min-height: 0; margin-top: 0; }
.otp__status svg { flex: none; }
.otp__status--error { color: var(--overdue-fg); }
.otp__status--ok { color: var(--paid-fg); }
.otp__spinner { animation: bg-spin .9s linear infinite; }

/* "Not there? Check spam, or send a new code", counting down (BgOtp.countdown) */
.otp__resend { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: var(--space-1); margin: 18px 0 0; font-size: 13px;
  color: var(--text-muted); text-align: center; }
.otp__resend-link { min-height: var(--tap-min); padding: 0; border: 0; background: none; font: inherit; font-weight: 600;
  color: var(--otp-accent, var(--gold)); cursor: pointer; text-underline-offset: 3px; font-variant-numeric: tabular-nums; }
.otp__resend-link:hover:not(:disabled) { text-decoration: underline; }
.otp__resend-link:disabled { color: var(--text-muted); font-weight: 500; cursor: default; }

/* confirmed */
.otp__seal { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-xl); background: var(--paid-bg); color: var(--paid-fg); }

@media (max-width: 860px) {
  .otp__cells { gap: 6px; grid-template-columns: repeat(3, 1fr) 10px repeat(3, 1fr); }
  .otp__cell { height: 54px; font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .otp__cell, .otp__cells, .otp__spinner, .otp:focus-within .otp__cell.is-active:empty::after { animation: none; }
}
