/* Field kit (fieldkit.js): the sign-in card, the phone field, the submit morph and the one-time code card.
   Shared by the landing page's lead form and the personal area. Colours are the tokens in tokens.css only:
   spruce (--brand) for the action and the focus, the spirit-level lime (--copper) as the light's glow,
   --ok for success, --danger for errors, --warn-ink for the lock. */

:root {
  --fk-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fk-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --fk-hair: color-mix(in oklch, var(--ink) 13%, transparent);
  --fk-hair-strong: color-mix(in oklch, var(--ink) 26%, transparent);
}

/* ---- the card ---------------------------------------------------------------------------------- */

.fk-card {
  container-type: inline-size;
  width: 100%;
  max-width: 400px;
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow:
    inset 0 0 0 1px var(--line),
    inset 0 1px 0 oklch(1 0 0),
    0 32px 80px -32px oklch(0.2 0.05 168 / 0.32),
    0 2px 6px -2px oklch(0.25 0.03 168 / 0.08);
  animation: fk-card-in 600ms var(--fk-ease) backwards;
}

.fk-card__body {
  padding: 28px 24px 24px;
}

@container (min-width: 384px) {
  .fk-card__body {
    padding: 36px 32px 32px;
  }
}

.fk-tile {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--brand-tint);
  color: var(--brand-ink);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--brand) 18%, transparent);
}

.fk-tile svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fk-card h1,
.fk-card .otp__title {
  margin-top: var(--s-5);
  font-size: clamp(1.45rem, 1.3rem + 0.6cqi, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.fk-card h1:focus {
  outline: none;
}

.fk-sub {
  margin-top: var(--s-2);
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.55;
}

.fk-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: var(--s-4);
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 0.93rem;
  line-height: 1.45;
  font-weight: 600;
  animation: fk-drop 300ms var(--fk-ease) both;
}

.fk-banner svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fk-banner--error {
  background: var(--danger-tint);
  color: oklch(0.42 0.16 27);
  box-shadow: inset 0 0 0 1px oklch(0.85 0.07 27);
}

.fk-banner--warn {
  background: var(--warn-tint);
  color: oklch(0.36 0.08 70);
  box-shadow: inset 0 0 0 1px oklch(0.85 0.07 85);
}

.fk-form {
  display: grid;
  gap: var(--s-4);
  margin-top: var(--s-5);
}

.fk-foot {
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* entrance: the card rises out of a blur, then its blocks in reading order */
.fk-in {
  animation: fk-block-in 450ms var(--fk-ease) backwards;
  animation-delay: calc(120ms + var(--i, 0) * 45ms);
}

.fk-in--late {
  animation-delay: calc(560ms + var(--i, 0) * 45ms);
}

@keyframes fk-card-in {
  from { opacity: 0; transform: translateY(16px); filter: blur(10px); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes fk-block-in {
  from { opacity: 0; transform: translateY(10px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes fk-drop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

@keyframes fk-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- fields ----------------------------------------------------------------------------------- */

.fk-field {
  display: grid;
  gap: 6px;
}

.fk-label {
  font-weight: 600;
  font-size: 0.97rem;
}

.fk-hint {
  color: var(--muted);
  font-size: 0.93rem;
}

.fk-shell {
  position: relative;
  border-radius: var(--r);
  background: var(--bg);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  transition: box-shadow 160ms var(--fk-ease);
}

.fk-shell:hover {
  box-shadow: inset 0 0 0 1.5px color-mix(in oklch, var(--ink) 42%, transparent);
}

/* the settled ring; while the light travels it is drawn by the light instead */
.fk-shell:focus-within {
  box-shadow: inset 0 0 0 2px var(--brand), 0 0 0 3px oklch(0.6 0.13 160 / 0.22);
}

.fk-shell.is-lighting:focus-within {
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}

.fk-shell.is-invalid,
.fk-shell:has(> [aria-invalid="true"]) {
  box-shadow: inset 0 0 0 1.5px var(--danger);
}

.fk-shell.is-invalid:focus-within,
.fk-shell:has(> [aria-invalid="true"]):focus-within {
  box-shadow: inset 0 0 0 2px var(--danger), 0 0 0 3px oklch(0.53 0.19 27 / 0.16);
}

.fk-shell.is-lighting.is-invalid:focus-within {
  box-shadow: inset 0 0 0 1.5px var(--danger);
}

.fk-shell.is-invalid .fk-light__ring,
.fk-shell.is-invalid .fk-light__tail,
.fk-shell.is-invalid .fk-light__core,
.fk-shell.is-invalid .fk-light__halo {
  stroke: var(--danger);
}

.fk-shell.is-readonly {
  opacity: 0.6;
}

.fk-input,
.fk-shell > .input {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 0 var(--s-4);
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
  outline: none;
  box-shadow: none;
}

.fk-input:focus,
.fk-input:focus-visible {
  outline: none;
  border-color: transparent;
}

.fk-input::placeholder {
  color: var(--muted);
}

.fk-shell__ok {
  position: absolute;
  inset-inline-end: 14px;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  color: var(--ok);
  opacity: 0;
  transition: opacity 200ms var(--fk-ease);
  pointer-events: none;
}

.fk-shell.is-valid:not(.is-invalid) .fk-shell__ok {
  opacity: 1;
}

.fk-shell.is-valid:not(.is-invalid) .fk-shell__ok path {
  animation: fk-draw 320ms var(--fk-ease) both;
}

/* the focus light: an SVG over the border */
.fk-light {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  fill: none;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 150ms linear;
}

.fk-light.is-on {
  opacity: 1;
}

.fk-light__ring {
  stroke: var(--brand);
  stroke-width: 2;
}

.fk-light__tail,
.fk-light__core {
  stroke: var(--brand);
}

.fk-light__halo {
  stroke: var(--copper);
}

.fk-light__core {
  stroke: oklch(0.35 0.08 160);
}

/* error under a field: slides down (height auto through grid rows, y -6 -> 0) */
.fk-msg {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 300ms var(--fk-ease);
}

.fk-msg.is-shown {
  grid-template-rows: 1fr;
}

.fk-msg__text {
  min-height: 0;
  overflow: hidden;
  color: var(--danger);
  font-weight: 600;
  font-size: 0.93rem;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 300ms var(--fk-ease), transform 300ms var(--fk-ease);
}

.fk-msg.is-shown .fk-msg__text {
  opacity: 1;
  transform: none;
}

.fk-shake {
  animation: fk-shake 420ms var(--fk-ease);
}

@keyframes fk-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

/* ---- buttons ------------------------------------------------------------------------------------ */

.fk-submit {
  position: relative;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
}

.fk-submit:active {
  transform: scale(0.98);
}

.fk-submit__layer {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  transition: opacity 220ms var(--fk-ease), transform 220ms var(--fk-ease), filter 220ms var(--fk-ease);
}

.fk-submit__busy,
.fk-submit__done {
  opacity: 0;
  transform: translateY(8px);
  filter: blur(3px);
}

.fk-submit[data-state="busy"] .fk-submit__idle,
.fk-submit[data-state="done"] .fk-submit__idle,
.fk-submit[data-state="done"] .fk-submit__busy {
  opacity: 0;
  transform: translateY(-8px);
  filter: blur(3px);
}

.fk-submit[data-state="busy"] .fk-submit__busy,
.fk-submit[data-state="done"] .fk-submit__done {
  opacity: 1;
  transform: none;
  filter: none;
}

.fk-submit[data-state="busy"],
.fk-submit[data-state="done"] {
  cursor: progress;
}

.btn.fk-submit[aria-disabled="true"] {
  opacity: 1; /* busy is not disabled-grey */
}

.fk-submit .fk-check {
  width: 20px;
  height: 20px;
}

.fk-submit[data-state="done"] .fk-check path {
  animation: fk-draw 360ms var(--fk-ease) 80ms both;
}

.fk-check {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fk-check path {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

@keyframes fk-draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

.fk-spin {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  animation: fk-spin 700ms linear infinite;
}

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

/* ---- rolling digits ------------------------------------------------------------------------- */

.fk-roll {
  display: inline-flex;
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
  vertical-align: bottom;
}

.fk-roll__slot {
  display: inline-grid;
  overflow: hidden;
  width: 0.62em;
  justify-items: center;
  line-height: 1.35;
}

.fk-roll__slot--sep {
  width: 0.32em;
}

.fk-roll__ch {
  grid-area: 1 / 1;
}

.fk-roll__ch.is-in {
  animation: fk-roll-in 300ms var(--fk-ease) both;
}

.fk-roll__ch.is-out {
  animation: fk-roll-out 300ms var(--fk-ease) both;
}

@keyframes fk-roll-in {
  from { transform: translateY(-70%); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes fk-roll-out {
  from { transform: none; opacity: 1; }
  to { transform: translateY(70%); opacity: 0; }
}

/* ---- the one-time code card ------------------------------------------------------------------- */

.otp__dest {
  margin-top: var(--s-2);
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.55;
}

.otp--inline .otp__dest {
  margin-top: 0;
}

.otp__num {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.otp__edit {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin: -12px 0;
  padding: 0 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--brand-ink);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  vertical-align: baseline;
}

.otp__edit svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 200ms var(--fk-ease);
}

.otp__edit:hover {
  color: var(--brand-hover);
}

.otp__edit:hover svg {
  transform: rotate(-12deg);
}

.otp__edit:active {
  transform: scale(0.97);
}

.otp__editor {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-4);
  animation: fk-drop 300ms var(--fk-ease) both;
}

.otp__editrow {
  display: flex;
  gap: var(--s-2);
}

.otp__row {
  position: relative;
  margin-top: 28px;
}

.otp--inline .otp__row {
  margin-top: var(--s-4);
}

.fk-slots {
  position: relative;
  display: flex;
  gap: 8px;
}

.fk-slot {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 52px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: color-mix(in oklch, var(--ink) 2%, var(--bg));
  box-shadow: inset 0 0 0 1px var(--fk-hair);
  transition: background-color 200ms var(--fk-ease), box-shadow 200ms var(--fk-ease), opacity 200ms var(--fk-ease),
    border-radius 260ms var(--fk-inout), transform 260ms var(--fk-inout);
}

.fk-slot--gap {
  margin-inline-end: 10px; /* the row is LTR: a wider gap between the two groups of three */
}

@container (min-width: 384px) {
  .fk-slot {
    height: 56px;
  }
}

.fk-slot.is-filled {
  background: color-mix(in oklch, var(--ink) 4%, var(--bg));
  box-shadow: inset 0 0 0 1px var(--fk-hair-strong);
}

.fk-slot__d {
  grid-area: 1 / 1;
  color: var(--ink);
  font-weight: 600;
  font-size: clamp(1.35rem, 1.15rem + 1cqi, 1.6rem);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1;
  animation: otp-d-in 300ms var(--fk-ease) var(--delay, 0ms) backwards;
}

.fk-slot__d.is-out {
  animation: otp-d-out 260ms var(--fk-ease) both;
}

@keyframes otp-d-in {
  from { opacity: 0; transform: translateY(60%) scale(0.86); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes otp-d-out {
  from { opacity: 1; transform: none; filter: none; }
  to { opacity: 0; transform: translateY(-60%) scale(0.92); filter: blur(3px); }
}

.fk-slot.is-lift {
  animation: otp-lift 300ms var(--fk-ease) var(--delay, 0ms);
}

@keyframes otp-lift {
  0%, 100% { transform: none; }
  45% { transform: translateY(-4px); }
}

.fk-slot.is-nudge {
  animation: otp-nudge 220ms var(--fk-ease);
}

@keyframes otp-nudge {
  0%, 100% { transform: none; }
  30% { transform: translateX(-3px); }
  70% { transform: translateX(3px); }
}

.fk-slot.is-shake {
  animation: otp-shake 400ms var(--fk-ease) var(--delay, 0ms);
}

@keyframes otp-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

/* the active-cell ring glides from cell to cell; a stepped caret blinks in an empty one, only while focused */
.fk-slots__ring {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1.5px color-mix(in oklch, var(--brand) 80%, transparent), 0 0 0 3px oklch(0.6 0.13 160 / 0.16);
  opacity: 0;
  pointer-events: none;
  transition: transform 280ms var(--fk-ease), opacity 150ms linear;
}

.fk-slots-row.is-focused .fk-slots__ring {
  opacity: 1;
}

.fk-slots__caret {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 22px;
  margin: -11px 0 0 -1px;
  border-radius: 1px;
  background: var(--brand);
  opacity: 0;
}

.fk-slots-row.is-focused.is-on-empty .fk-slots__caret {
  animation: otp-blink 1.06s steps(1, end) infinite;
}

@keyframes otp-blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

.fk-slots__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  box-shadow: none;
  font-size: 16px; /* never under 16px: iOS would zoom */
  letter-spacing: 0;
  text-indent: -9999px;
  outline: none;
  cursor: text;
  -webkit-tap-highlight-color: transparent;
}

.fk-slots__input::selection {
  background: transparent;
  color: transparent;
}

/* AutoFill: Safari and Chrome paint their own (yellow / blue) background and text on a filled field. On this
   transparent input that showed as a coloured blob over the slots, so every part of it stays transparent: the paint
   is held off by an endless transition, the text fill and caret stay clear. The slots are the only visuals.
   The fk-autofill animation tells fieldkit.js a value just arrived (some AutoFills fire no input event).
   Kept as separate rules: a browser that doesn't know :autofill would otherwise drop the whole rule. */
.fk-slots__input:-webkit-autofill,
.fk-slots__input:-webkit-autofill:hover,
.fk-slots__input:-webkit-autofill:focus,
.fk-slots__input:-webkit-autofill:active {
  -webkit-appearance: none;
  appearance: none;
  background-color: transparent !important;
  background-image: none !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: transparent !important;
  -webkit-box-shadow: none !important;
  box-shadow: none !important;
  transition: background-color 600000s 0s, color 600000s 0s;
  animation-name: fk-autofill;
  animation-duration: 1ms;
}

.fk-slots__input:autofill {
  -webkit-appearance: none;
  appearance: none;
  background-color: transparent !important;
  background-image: none !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: transparent !important;
  box-shadow: none !important;
  transition: background-color 600000s 0s, color 600000s 0s;
  animation-name: fk-autofill;
  animation-duration: 1ms;
}

@keyframes fk-autofill {
  from { opacity: 1; }
  to { opacity: 1; }
}

.fk-slots__input:focus-visible {
  outline: none; /* the gliding ring is the focus indicator */
}

/* verifying, locked, editing, error, success */
.otp[data-phase="verifying"] .fk-slot {
  opacity: 0.6;
}

.otp[data-phase="verifying"] .fk-slots__ring,
.otp[data-phase="locked"] .fk-slots__ring,
.otp[data-phase="success"] .fk-slots__ring,
.otp.is-editing .fk-slots__ring {
  opacity: 0;
}

.otp[data-phase="locked"] .fk-slot {
  opacity: 0.4;
}

.otp.is-editing .fk-slots {
  opacity: 0.4;
}

.otp[data-phase="locked"] .fk-slots__input,
.otp.is-editing .fk-slots__input {
  cursor: not-allowed;
}

.otp.is-error .fk-slot {
  background: color-mix(in oklch, var(--danger) 6%, var(--bg));
  box-shadow: inset 0 0 0 1.5px color-mix(in oklch, var(--danger) 70%, transparent);
}

.otp.is-error .fk-slot__d {
  color: oklch(0.45 0.17 27);
}

.otp.is-error .fk-slots__ring {
  box-shadow: inset 0 0 0 1.5px color-mix(in oklch, var(--danger) 80%, transparent);
}

.otp.is-success .fk-slot {
  background: color-mix(in oklch, var(--ok) 7%, var(--bg));
  box-shadow: inset 0 0 0 1.5px color-mix(in oklch, var(--ok) 50%, transparent);
}

.otp.is-success .fk-slot__d {
  color: oklch(0.38 0.09 155);
}

/* (1) a band of light crosses each cell in turn */
.fk-slot__band {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 80%;
  background: linear-gradient(90deg, transparent, color-mix(in oklch, var(--ok) 38%, transparent), transparent);
  transform: translateX(-110%);
  pointer-events: none;
}

.fk-slot__band.is-sweep {
  animation: otp-sweep 340ms linear var(--delay, 0ms) both;
}

@keyframes otp-sweep {
  from { transform: translateX(-110%); }
  to { transform: translateX(140%); }
}

/* (2) the cells close into one bar: inner corners square off, digits blur out */
.fk-slot.is-joined {
  border-radius: 0;
}

.fk-slot.is-joined:first-child {
  border-radius: 12px 0 0 12px;
}

.fk-slots .fk-slot.is-joined:nth-child(6) {
  border-radius: 0 12px 12px 0;
}

.fk-slot.is-joined .fk-slot__d {
  opacity: 0;
  filter: blur(4px);
  transition: opacity 260ms var(--fk-inout), filter 260ms var(--fk-inout);
}

.fk-slots.is-joining .fk-slot {
  box-shadow: none;
}

.fk-slots.is-pill .fk-slot {
  opacity: 0;
  transition: opacity 120ms linear;
}

/* (3) the bar becomes the pill */
.otp__pill {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  background: color-mix(in oklch, var(--ok) 12%, var(--bg));
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--ok) 45%, transparent), 0 0 0 4px color-mix(in oklch, var(--ok) 6%, transparent);
  color: oklch(0.36 0.09 155);
  font-weight: 700;
  font-size: 1.05rem;
  transition: left 460ms var(--fk-inout), top 460ms var(--fk-inout), width 460ms var(--fk-inout), height 460ms var(--fk-inout),
    border-radius 460ms var(--fk-inout);
}

.otp__pill.is-final {
  border-radius: 24px;
}

.otp__pill .fk-check {
  width: 20px;
  height: 20px;
  opacity: 0;
}

.otp__pilltext {
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 260ms var(--fk-ease), transform 260ms var(--fk-ease);
}

.otp__pill.is-text .fk-check {
  opacity: 1;
}

.otp__pill.is-text .fk-check path {
  animation: fk-draw 360ms var(--fk-ease) both;
}

.otp__pill.is-text .otp__pilltext {
  opacity: 1;
  transform: none;
  transition-delay: 120ms;
}

.otp--inline .otp__pill,
.fk-slots.is-pill {
  min-height: 52px;
}

.fk-slots.is-pill {
  justify-content: center;
}

/* reduced motion: the pill fades in where it ends */
.otp__pill.is-instant {
  animation: fk-fade 150ms linear both;
}

/* status line: height reserved, so nothing below jumps */
.otp__status {
  min-height: 42px;
  padding-top: 10px;
  font-size: 0.93rem;
  line-height: 1.45;
}

.otp__say:empty {
  display: none;
}

.otp__say {
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  animation: fk-drop 300ms var(--fk-ease) both;
}

.otp__say--alert {
  display: block;
  color: var(--danger);
  font-weight: 600;
}

.otp[data-phase="locked"] .otp__say--alert {
  color: var(--warn-ink);
}

.otp__lockroll {
  font-weight: 700;
}

.otp__retry {
  appearance: none;
  min-height: 32px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--brand-ink);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* resend row */
.otp__resend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: 44px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 0.93rem;
}

.otp.is-success .otp__resend,
.otp.is-success .otp__edit {
  visibility: hidden; /* keeps its space: nothing below moves while the pill forms */
}

.otp__resendq {
  color: var(--ink-soft);
}

.otp__again {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--brand-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.otp__again[aria-disabled="true"] {
  color: var(--muted);
  cursor: default;
}

.otp__again[data-state="sent"] {
  color: var(--ok);
}

.otp__again[data-state="ready"]:hover {
  color: var(--brand-hover);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.otp__again:active:not([aria-disabled="true"]) {
  transform: scale(0.97);
}

.otp__againicon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 200ms var(--fk-ease);
}

.otp__again:hover .otp__againicon {
  transform: rotate(-45deg);
}

.otp__again .fk-check {
  width: 16px;
  height: 16px;
}

.otp__again[data-state="sent"] .fk-check path {
  animation: fk-draw 360ms var(--fk-ease) both;
}

/* after a lockout a new code is the way forward: the control becomes a solid button */
.otp__again.otp__again--emph {
  min-height: 44px;
  padding: 0 var(--s-4);
  border-radius: var(--r-sm);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.97rem;
}

.otp__again.otp__again--emph:hover {
  background: var(--brand-hover);
  color: var(--on-brand);
  text-decoration: none;
}

.otp__foot {
  margin-top: var(--s-3);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

/* entrance: cells land one by one after the heading block */
.fk-slot--in {
  animation: otp-cell-in 450ms var(--fk-ease) backwards;
  animation-delay: calc(120ms + var(--after, 3) * 50ms + var(--c, 0) * 35ms);
}

@keyframes otp-cell-in {
  from { opacity: 0; transform: translateY(12px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* ---- a code card waiting for its code: in the DOM and focusable (never display:none or visibility:hidden, which
   cannot take focus), invisible and out of the layout. The send tap focuses its input inside the gesture, so iOS
   opens the keyboard; the holder opens in place when the code went out, the input still focused. ----------------- */

.fk-card {
  position: relative;
}

.fk-pending {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ---- the phone number in ten fk-slots (phoneField): 05X - XXX - XXXX, faint 050-000-0000 digits when empty -- */

.fk-slots-row {
  position: relative;
}

.ph__shell {
  display: flex;
  align-items: center;
  min-height: 60px;
  padding: 8px 8px 8px 32px; /* physical: the check sits on the left, the number reads from the right edge */
  cursor: text;
}

.ph__row {
  flex: 1;
  min-width: 0;
}

.ph .fk-slots {
  align-items: center;
  gap: 3px;
}

.ph .fk-slot {
  height: 44px;
  border-radius: 8px;
}

.ph .fk-slot__d {
  font-size: 1.2rem;
}

.fk-slot__ghost {
  grid-area: 1 / 1;
  color: var(--muted);
  opacity: 0.55;
  font-size: 1.1rem;
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
  transition: opacity 150ms linear;
}

.fk-slot.is-filled .fk-slot__ghost {
  opacity: 0;
}

.fk-slots__sep {
  flex: none;
  width: 6px;
  height: 2px;
  margin: 0 2px;
  border-radius: 1px;
  background: var(--line-strong);
}

.ph .fk-slots__ring {
  border-radius: 8px;
}

.ph .fk-slots__caret {
  height: 20px;
  margin-top: -10px;
}

.ph__shell .fk-shell__ok {
  inset-inline-start: auto;
  inset-inline-end: auto;
  left: 8px;
}

/* a complete, valid number: the filled fk-slots take a faint success edge next to the check */
.ph__shell.is-valid:not(.is-invalid) .fk-slot.is-filled {
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--ok) 38%, transparent);
}

.ph__shell.is-invalid .fk-slot.is-filled {
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--danger) 45%, transparent);
}

@media (min-width: 420px) {
  .ph .fk-slots {
    gap: 5px;
  }

  .fk-slots__sep {
    margin: 0 4px;
  }
}

/* ---- reduced motion: 150ms fades only; the ring appears without travel, no shake, roll, sweep or glide ---- */
@media (prefers-reduced-motion: reduce) {
  .fk-card,
  .fk-in,
  .fk-slot--in,
  .fk-banner,
  .otp__editor,
  .otp__say,
  .fk-slot__d,
  .otp__pill.is-instant {
    animation-name: fk-fade !important;
    animation-duration: 150ms !important;
    animation-delay: 0ms !important;
  }

  .fk-submit__layer {
    transform: none !important;
    filter: none !important;
    transition: opacity 150ms linear !important;
  }

  .fk-msg,
  .fk-msg__text {
    transform: none !important;
    transition: opacity 150ms linear !important;
  }

  .fk-slots__ring {
    transition: opacity 150ms linear !important;
  }

  .fk-spin {
    animation-duration: 1.4s !important;
    animation-iteration-count: infinite !important;
  }

  .fk-slots-row.is-focused.is-on-empty .fk-slots__caret {
    animation: none !important;
    opacity: 1;
  }
}
