/* ── Code-Eingabe mit 6 Feldern (Zwei-Faktor) ───────────────────────────────────
   Gemeinsam genutzt von der Login-Seite und den Einstellungen. Nutzt die Farb-Variablen
   der Seite, mit eigenen Rückfallwerten. Bewegung nur über transform/opacity,
   komplett abschaltbar über prefers-reduced-motion. */
.rl-otp {
  --otp-bg:      var(--s2, #161a24);
  --otp-border:  var(--border, rgba(255,255,255,.10));
  --otp-text:    var(--text, #eceef4);
  --otp-accent:  var(--blue, #4a8fff);
  --otp-ok:      var(--green, #00d68f);
  --otp-err:     var(--red, #ff4f6a);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 6px 0 4px;
}
.rl-otp-sep {
  width: 10px; height: 2px; border-radius: 2px; background: var(--otp-border); flex: none; margin: 0 2px;
}
.rl-otp-cell {
  position: relative; width: 50px; height: 62px; flex: none;
  border-radius: 14px; background: var(--otp-bg);
  border: 1px solid var(--otp-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease, transform .18s cubic-bezier(.16,1,.3,1);
}
.rl-otp-cell input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: transparent; border: 0; outline: 0; padding: 0; margin: 0;
  text-align: center; font: 600 26px/1 var(--mono, 'JetBrains Mono', ui-monospace, monospace);
  color: var(--otp-text); caret-color: transparent; letter-spacing: 0;
  border-radius: inherit;
}
.rl-otp-cell input::selection { background: transparent; }
/* Fortschrittsbalken unten im Feld: füllt sich, sobald eine Ziffer drin ist */
.rl-otp-cell::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 9px; height: 2px; border-radius: 2px;
  background: var(--otp-accent); transform: scaleX(0); transform-origin: left center; opacity: .9;
  transition: transform .22s cubic-bezier(.16,1,.3,1), background-color .2s ease;
}
.rl-otp-cell.filled::after { transform: scaleX(1); }
/* Blinkender Cursor im aktiven, leeren Feld */
.rl-otp-cell.active:not(.filled)::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 2px; height: 26px; margin: -13px 0 0 -1px;
  border-radius: 2px; background: var(--otp-accent); animation: rlOtpCaret 1.05s steps(1) infinite;
}
@keyframes rlOtpCaret { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.rl-otp-cell.active {
  border-color: var(--otp-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--otp-accent) 22%, transparent), inset 0 1px 0 rgba(255,255,255,.05);
  transform: translateY(-1px);
}
/* Einblenden beim Öffnen: gestaffelt */
.rl-otp.enter .rl-otp-cell { animation: rlOtpIn .46s cubic-bezier(.16,1,.3,1) backwards; animation-delay: calc(var(--i) * 45ms); }
@keyframes rlOtpIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }
/* Ziffer „ploppt“ ein */
.rl-otp-cell.pop input { animation: rlOtpPop .2s cubic-bezier(.34,1.56,.64,1); }
@keyframes rlOtpPop { from { transform: scale(.55); opacity: .2; } }
/* Alle Felder gefüllt: kurzer Impuls, dann Prüfen */
.rl-otp.complete .rl-otp-cell { border-color: color-mix(in srgb, var(--otp-accent) 55%, var(--otp-border)); }
.rl-otp.busy .rl-otp-cell { animation: rlOtpBusy 1s ease-in-out infinite; animation-delay: calc(var(--i) * 70ms); }
@keyframes rlOtpBusy { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
/* Fehler: Schütteln + rot */
.rl-otp.error { animation: rlOtpShake .42s cubic-bezier(.36,.07,.19,.97); }
.rl-otp.error .rl-otp-cell { border-color: var(--otp-err); box-shadow: 0 0 0 4px color-mix(in srgb, var(--otp-err) 18%, transparent); }
.rl-otp.error .rl-otp-cell::after { background: var(--otp-err); transform: scaleX(1); }
@keyframes rlOtpShake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
/* Erfolg: grüne Welle von links nach rechts */
.rl-otp.success .rl-otp-cell {
  border-color: var(--otp-ok); background: color-mix(in srgb, var(--otp-ok) 10%, var(--otp-bg));
  animation: rlOtpOk .5s cubic-bezier(.34,1.56,.64,1) both; animation-delay: calc(var(--i) * 55ms);
}
.rl-otp.success .rl-otp-cell::after { background: var(--otp-ok); transform: scaleX(1); }
@keyframes rlOtpOk { 0% { transform: translateY(0) scale(1); } 45% { transform: translateY(-6px) scale(1.06); } 100% { transform: translateY(0) scale(1); } }

/* Zeile mit Hinweis/Status unter den Feldern */
.rl-otp-note { text-align: center; font-size: 12px; min-height: 18px; color: var(--muted, #8b91a1); margin-top: 8px; transition: color .2s ease; }
.rl-otp-note.err { color: var(--red, #ff4f6a); }
.rl-otp-note.ok  { color: var(--green, #00d68f); }

@media (max-width: 420px) {
  .rl-otp { gap: 6px; }
  .rl-otp-cell { width: 42px; height: 54px; border-radius: 12px; }
  .rl-otp-cell input { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .rl-otp *, .rl-otp, .rl-otp-cell, .rl-otp-cell::before, .rl-otp-cell::after { animation: none !important; transition: none !important; }
  .rl-otp.error .rl-otp-cell { border-color: var(--otp-err); }
}
