/* ==========================================================================
   /2fa — standalone bilingual TOTP page (20260916 v2)
   Self-contained: does NOT depend on site.css. Visual language copied from
   the store hero (#050506 stage + FloatingLines) and the dark theme tokens.
   ========================================================================== */

.tfa-body {
  --tfa-ink: #f5f5f5;
  --tfa-ink-soft: #e5e5e5;
  --tfa-muted: #a0a3ab;
  --tfa-faint: rgba(255, 255, 255, 0.42);
  --tfa-line: rgba(255, 255, 255, 0.12);
  --tfa-line-soft: rgba(255, 255, 255, 0.08);
  --tfa-cyan: #67e8f9;
  --tfa-blue: #3b82f6;
  --tfa-violet: #7c3aed;
  --tfa-warn: #f0b849;
  --tfa-danger: #f87a5c;
  --tfa-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  --tfa-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  margin: 0;
  min-height: 100vh;
  background: #050506;
  color: var(--tfa-ink);
  font-family: var(--tfa-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.tfa-body *,
.tfa-body *::before,
.tfa-body *::after {
  box-sizing: border-box;
}

/* ---------- stage: same gradient bed as the store hero ---------- */

.tfa-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background-color: #050506;
  background-image:
    linear-gradient(115deg, transparent 38%, rgba(59, 130, 246, 0.10) 54%, rgba(103, 232, 249, 0.09) 62%, transparent 78%),
    radial-gradient(1200px 500px at 78% 16%, rgba(59, 130, 246, 0.14), transparent 65%),
    radial-gradient(900px 460px at 36% 66%, rgba(103, 232, 249, 0.06), transparent 70%),
    radial-gradient(1000px 560px at 66% 44%, rgba(124, 58, 237, 0.10), transparent 70%);
}

.tfa-stage-fx {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  animation: tfaFxIn 0.9s ease 0.05s both;
}

@keyframes tfaFxIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Keeps the card legible over the animated lines and fades the stage out
   into the site background colour at the bottom edge. */
.tfa-stage-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(760px 420px at 50% 52%, rgba(5, 5, 6, 0.62), transparent 70%),
    linear-gradient(180deg, rgba(5, 5, 6, 0.55) 0%, rgba(5, 5, 6, 0) 26%),
    linear-gradient(180deg, rgba(5, 5, 6, 0) 72%, rgba(12, 12, 12, 0.88) 94%, #0b0b0b 100%);
}

/* ---------- topbar ---------- */

.tfa-topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  height: 72px;
  padding: 0 clamp(16px, 4.4vw, 40px);
  background: linear-gradient(180deg, rgba(3, 5, 9, 0.55) 0%, rgba(3, 5, 9, 0.18) 62%, rgba(3, 5, 9, 0) 100%);
}

.tfa-topbar .tfa-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
}

.tfa-topbar .tfa-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 40px;
  flex: none;
  overflow: hidden;
}

/* The uploaded logo is a black SVG — the site inverts it in dark mode. */
.tfa-topbar .tfa-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.26);
  transform-origin: center;
  filter: brightness(0) invert(1);
}

.tfa-topbar .tfa-brand-text {
  color: #f5f5f5;
  font-family: var(--tfa-font);
  font-size: 13px;
  font-weight: 610;
  letter-spacing: -0.13px;
  white-space: nowrap;
}

.tfa-topbar-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.tfa-lang {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.tfa-lang .tfa-lang-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 6px 13px;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--tfa-font);
  font-size: 12.5px;
  font-weight: 560;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.tfa-lang .tfa-lang-btn:hover {
  color: #ffffff;
}

.tfa-lang .tfa-lang-btn.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.tfa-topbar .tfa-store-link {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.tfa-topbar .tfa-store-link:hover {
  color: #ffffff;
}

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

.tfa-main {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 6vw, 56px) clamp(16px, 5vw, 40px) clamp(48px, 9vw, 88px);
}

.tfa-card {
  position: relative;
  width: min(520px, 100%);
  min-width: 0;
  padding: clamp(24px, 5vw, 36px);
  border: 1px solid var(--tfa-line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0) 38%),
    rgba(10, 12, 16, 0.66);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.tfa-card .tfa-kicker {
  margin: 0 0 12px;
  color: var(--tfa-faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tfa-card .tfa-title {
  margin: 0 0 10px;
  color: #ffffff;
  font-size: clamp(26px, 5.2vw, 32px);
  font-weight: 640;
  letter-spacing: -0.01em;
  line-height: 1.18;
}

.tfa-card .tfa-sub {
  margin: 0 0 28px;
  color: var(--tfa-muted);
  font-size: 14px;
  line-height: 1.65;
}

.tfa-card .tfa-label {
  display: block;
  margin-bottom: 9px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ---------- input ---------- */

.tfa-field {
  position: relative;
  min-width: 0;
}

.tfa-field .tfa-input {
  width: 100%;
  min-width: 0;
  height: 50px;
  padding: 0 44px 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--tfa-ink);
  font-family: var(--tfa-mono);
  font-size: 14.5px;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.tfa-field .tfa-input::placeholder {
  color: rgba(255, 255, 255, 0.32);
  font-family: var(--tfa-font);
  font-size: 14px;
  letter-spacing: 0;
}

.tfa-field .tfa-input:focus {
  border-color: rgba(103, 232, 249, 0.42);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.tfa-field .tfa-clear {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.72);
  transition: background 0.2s ease, color 0.2s ease;
}

.tfa-field .tfa-clear:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.tfa-card .tfa-hint {
  margin: 10px 0 0;
  min-height: 18px;
  color: var(--tfa-muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.tfa-card .tfa-hint.is-error {
  color: var(--tfa-danger);
}

.tfa-card .tfa-hint.is-ok {
  color: #7dd3a8;
}

/* ---------- code panel ---------- */

.tfa-code-panel {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--tfa-line-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.tfa-code-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 14px;
}

.tfa-code-head .tfa-code-label {
  color: var(--tfa-faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tfa-code-head .tfa-remain {
  color: var(--tfa-muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tfa-digits {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(6px, 1.6vw, 10px);
  min-width: 0;
  cursor: pointer;
  outline: none;
}

.tfa-digits.is-idle {
  cursor: default;
}

.tfa-digits .tfa-digit {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: clamp(56px, 13vw, 66px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  color: #ffffff;
  font-family: var(--tfa-font);
  font-size: clamp(24px, 6.4vw, 30px);
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

/* Only the glyph animates — animating the cell would blink its border and
   background out during the cascade. */
.tfa-digits .tfa-digit-num {
  display: block;
  font-style: normal;
}

.tfa-digits.is-flip .tfa-digit-num {
  animation: tfaDigitIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tfa-digits.is-flip .tfa-digit:nth-child(2) .tfa-digit-num { animation-delay: 0.03s; }
.tfa-digits.is-flip .tfa-digit:nth-child(3) .tfa-digit-num { animation-delay: 0.06s; }
.tfa-digits.is-flip .tfa-digit:nth-child(4) .tfa-digit-num { animation-delay: 0.09s; }
.tfa-digits.is-flip .tfa-digit:nth-child(5) .tfa-digit-num { animation-delay: 0.12s; }
.tfa-digits.is-flip .tfa-digit:nth-child(6) .tfa-digit-num { animation-delay: 0.15s; }

@keyframes tfaDigitIn {
  from { opacity: 0; transform: translateY(-5px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.tfa-digits.is-idle .tfa-digit {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.07);
}

.tfa-digits.is-idle .tfa-digit::after {
  content: "";
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
}

.tfa-digits.is-expiring .tfa-digit {
  border-color: rgba(240, 184, 73, 0.34);
  color: var(--tfa-warn);
}

.tfa-digits:focus-visible .tfa-digit {
  border-color: rgba(103, 232, 249, 0.5);
}

.tfa-track {
  height: 3px;
  margin-top: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.tfa-track .tfa-bar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--tfa-cyan), var(--tfa-blue) 52%, var(--tfa-violet));
  clip-path: inset(0 100% 0 0);
}

.tfa-track.is-idle .tfa-bar {
  background: rgba(255, 255, 255, 0.18);
}

.tfa-track.is-expiring .tfa-bar {
  background: linear-gradient(90deg, var(--tfa-warn), #f08a4b);
}

.tfa-card .tfa-safe {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.38);
  font-size: 12px;
  line-height: 1.45;
}

.tfa-card .tfa-safe svg {
  flex: none;
  margin-top: -1px;
}

.tfa-code-panel .tfa-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 18px;
  height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  background: #f5f5f5;
  color: #101012;
  font-family: var(--tfa-font);
  font-size: 13.5px;
  font-weight: 620;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.12s ease;
}

/* :not(.is-done) — otherwise the cursor resting on the button after a click
   repaints it white and swallows the green "copied" confirmation. */
.tfa-code-panel .tfa-copy:hover:not(:disabled):not(.is-done) {
  background: #ffffff;
}

.tfa-code-panel .tfa-copy:active:not(:disabled) {
  transform: translateY(1px);
}

.tfa-code-panel .tfa-copy:disabled {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.34);
}

.tfa-code-panel .tfa-copy.is-done {
  background: #7dd3a8;
  color: #08210f;
}

.tfa-code-panel .tfa-copy .tfa-copy-done {
  display: none;
}

.tfa-code-panel .tfa-copy.is-done .tfa-copy-icon {
  display: none;
}

.tfa-code-panel .tfa-copy.is-done .tfa-copy-done {
  display: block;
}

/* ---------- toast ---------- */

.tfa-toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  z-index: 40;
  transform: translate(-50%, 12px);
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(16, 18, 22, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--tfa-ink);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.tfa-toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- responsive ---------- */

@media (max-width: 620px) {
  .tfa-topbar {
    height: 64px;
    gap: 10px;
  }

  .tfa-topbar .tfa-brand-mark {
    width: 56px;
    height: 32px;
  }

  .tfa-topbar-nav {
    gap: 10px;
  }

  .tfa-lang .tfa-lang-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .tfa-code-panel {
    padding: 16px;
  }

  .tfa-card .tfa-safe {
    font-size: 11.5px;
  }
}

@media (max-width: 380px) {
  .tfa-topbar .tfa-store-link {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tfa-body *,
  .tfa-body *::before,
  .tfa-body *::after {
    animation: none !important;
    transition: none !important;
  }
}
