/* PocketFX account form controls. */
.auth-shell { position: relative; width: 100%; min-width: 0; }
#login .auth-view { display: block; margin: 0; }
.auth-head { margin-bottom: 20px; }
.auth-head-switch { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
#login .auth-head h1 { margin: 0; font-size: clamp(30px, 3.5vw, 38px); font-weight: 740; line-height: 1.12; letter-spacing: -.04em; }
#login .auth-head h1:focus { outline: none; }
.auth-head p { margin: 8px 0 0; color: var(--ui-muted); font-size: 14px; line-height: 1.55; }
.auth-head strong { color: var(--ui-text); font-weight: 600; overflow-wrap: anywhere; }

.auth-card {
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-feature);
  background: var(--ui-panel);
}

.auth-alt-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 6px;
  margin: 14px 0 0;
  color: var(--ui-muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-method {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

#login .auth-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ui-muted);
  font-size: 22px;
  line-height: 1;
}
#login .auth-icon:is(:hover, :focus-visible) { background: #27323e; color: #fff; }

.auth-content { display: grid; gap: 16px; }
.auth-providers {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  margin-bottom: 16px;
}
.auth-providers > [data-google-button] {
  display: grid;
  grid-template: 40px / minmax(0, 1fr);
  place-items: center;
  height: 40px;
  color: var(--ui-muted);
  font-size: 13px;
  /* Match the provider iframe's canvas scheme. Google renders the button theme itself. */
  color-scheme: light;
}
.auth-providers > [data-google-button] > * { grid-area: 1 / 1; }
.auth-google-mount[inert] { visibility: hidden; }
/* Keep the Google fallback and iframe aligned if the iframe arrives after the fallback is visible. */
.auth-google-mount > :has(iframe) { display: grid; place-items: center; }
.auth-google-mount > :has(iframe) > * { grid-area: 1 / 1; }
.auth-google-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: min(100%, 400px);
  height: 100%;
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  background: var(--ui-chrome);
  color: var(--ui-text-secondary);
  font: 500 .875rem/20px "Google Sans", Arial, sans-serif;
  letter-spacing: .25px;
}
.auth-google-loading::before {
  content: "";
  flex: none;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  border: 2px solid var(--ui-border);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: auth-loading-spin .8s linear infinite;
}
@keyframes auth-loading-spin { to { transform: rotate(360deg); } }
#login .auth-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #8e918f;
  border-radius: 4px;
  background: #131314;
  color: #e3e3e3;
  font-size: 14px;
  font-weight: 550;
}
#login .auth-provider:hover:not(:disabled) { background: #262629; }
#login .auth-provider:disabled { opacity: .7; cursor: wait; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  color: var(--ui-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--ui-border); }
#login .auth-field { display: grid; gap: 6px; color: var(--ui-text-secondary); font-size: 13px; font-weight: 530; }
#login .auth-field > label:not(.auth-consent), #login .auth-label-row > label { color: inherit; font: inherit; }
.auth-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.auth-field-error { margin: 0; color: var(--ui-error); font-size: 12.5px; font-weight: 500; line-height: 1.45; }
#login .auth-content :where(input:not([type="checkbox"])) {
  width: 100%;
  min-width: 0;
  min-height: var(--ui-size-comfortable);
  padding: 0 11px;
  border-radius: var(--ui-radius-public-control);
  font-size: 14px;
}
#login .auth-code { letter-spacing: .13em; font-variant-numeric: tabular-nums; }
#login .auth-code::placeholder { letter-spacing: 0; }

.auth-account-row { display: flex; align-items: stretch; gap: 8px; }
.auth-dial-code { position: relative; flex: none; }
.auth-dial-code select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.auth-dial-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 80px;
  height: 100%;
  padding-inline: 10px;
  border: 1px solid var(--field-border);
  border-radius: var(--ui-radius-public-control);
  background: var(--field-bg);
  color: var(--field-text);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.auth-dial-label svg, .auth-referral summary svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: var(--ui-muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}
.auth-dial-code select:hover:not(:disabled) + .auth-dial-label { background: var(--field-hover-bg); }
.auth-dial-code select:focus + .auth-dial-label { border-color: var(--field-border-focus); }

.auth-label-row { display: flex; align-items: center; justify-content: space-between; gap: 2px 10px; flex-wrap: wrap; }
#login .auth-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 5px;
  border: 0;
  border-radius: 3px;
  background: none;
  color: #d9e2ef;
  font-size: 12.5px;
  font-weight: 620;
  line-height: 1.45;
  text-align: start;
}
#login :is(.auth-head-switch, .auth-alt-account) .auth-link { color: var(--ui-accent-text); }
#login .auth-method .auth-link { min-height: 32px; color: var(--ui-muted); text-align: center; }
#login .auth-link:not(:disabled):is(:hover, :focus-visible) { background: var(--ui-hover-bg); }
#login .auth-link:disabled { color: var(--ui-muted); }

.auth-referral { border-block: 1px solid var(--ui-border); }
.auth-referral summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--ui-size-comfortable);
  padding-inline: 2px;
  color: var(--ui-text-secondary);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  list-style: none;
}
.auth-referral summary::-webkit-details-marker { display: none; }
.auth-referral summary:hover { background: var(--ui-hover-bg); }
.auth-referral[open] summary svg { transform: rotate(180deg); }
.auth-referral summary span { margin-inline-start: auto; color: var(--ui-muted); font-size: 12px; font-weight: 400; }
.auth-referral .auth-field { margin: 4px 0 12px; }

.auth-password { position: relative; }
#login .auth-password input { padding-inline-end: 48px; }
#login .auth-password input::-ms-reveal { display: none; }
#login .auth-reveal {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: 4px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ui-muted);
  transform: translateY(-50%);
}
#login .auth-reveal:not([aria-pressed="true"]):is(:hover, :focus-visible) { background: #2b3543; color: #fff; }
#login .auth-reveal:focus-visible { outline-offset: -2px; }
.auth-reveal svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.auth-reveal .auth-eye-hide,
.auth-reveal[aria-pressed="true"] .auth-eye-show { display: none; }
.auth-reveal[aria-pressed="true"] .auth-eye-hide { display: block; }

#login .auth-consent { display: flex; align-items: flex-start; gap: 9px; color: var(--ui-muted); font-size: 12px; font-weight: 400; line-height: 1.55; }
#login .auth-consent input { margin-top: 1px; }
#login .auth-consent input[aria-invalid="true"] { outline: 2px solid var(--ui-error-border); outline-offset: 1px; }
.auth-consent a { color: #d9e2ef; text-decoration: underline; text-decoration-color: #718098; text-underline-offset: 2px; }
.auth-consent a:hover { color: #fff; text-decoration-color: currentColor; }

.auth-actions { margin-top: 18px; }
#login :is(.auth-submit, .auth-secondary) {
  min-height: var(--ui-size-comfortable);
  padding: 7px 13px;
  border: 1px solid var(--field-border);
  border-radius: var(--ui-radius-public-control);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
}
#login .auth-secondary { background: var(--ui-control-bg); color: var(--ui-text-secondary); }
#login .auth-secondary:hover:not(:disabled) { background: var(--ui-hover-bg); }
#login .auth-submit {
  width: 100%;
  background: var(--ui-action);
  border-color: var(--ui-action);
  color: var(--ui-on-accent);
  font-size: 14px;
  font-weight: 670;
}
#login .auth-submit:hover:not(:disabled) { background: var(--ui-action-hover); border-color: var(--ui-action-hover); }
#login .auth-submit:disabled { opacity: .72; cursor: progress; }

.auth-code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.auth-code-row button { min-width: 112px; white-space: nowrap; }
.auth-code-row button:disabled { opacity: .66; }

#login .auth-status {
  margin: 0;
  padding: 8px 10px;
  border-radius: 5px;
  background: var(--ui-hover-bg);
  color: var(--ui-muted);
  font-size: 12.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
#login .auth-status:empty { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
#login .auth-status[data-tone="error"] { background: #38262d; color: var(--ui-error); }
#login .auth-status[data-tone="success"] { background: #1c302b; color: var(--ui-success); }
#login .auth-provider-status:not(:empty) { margin-bottom: 12px; }

/* Slider puzzle, shown in place of the sign-in form before a LOGIN_RISK code is emailed. */
.auth-puzzle { --puzzle-offset: 0px; --puzzle-y: 0px; }
#login.puzzle-open .auth-view { display: none; }
.auth-puzzle-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.auth-puzzle-actions { display: flex; gap: 4px; }
.auth-puzzle-stage, .auth-puzzle-track { position: relative; width: 300px; max-width: 100%; margin: 0 auto; }
.auth-puzzle-stage { aspect-ratio: 300 / 160; overflow: hidden; border-radius: 6px; background: #11161c; }
.auth-puzzle-bg { display: block; width: 100%; height: 100%; object-fit: fill; }
.auth-puzzle-piece {
  position: absolute; top: 0; left: 0; pointer-events: none;
  transform: translate(var(--puzzle-offset), var(--puzzle-y));
  filter: drop-shadow(0 2px 5px rgb(0 0 0 / .55));
}
.auth-puzzle-piece:not([src]), .auth-puzzle-bg:not([src]) { visibility: hidden; }
.auth-puzzle.loading .auth-puzzle-stage { background: linear-gradient(100deg, #151b22 30%, #1d252f 50%, #151b22 70%) 0 0 / 300% 100%; animation: auth-shimmer 1.2s linear infinite; }
@keyframes auth-shimmer { to { background-position: -150% 0; } }
.auth-puzzle-track { height: 44px; border: 1px solid var(--field-border); border-radius: 6px; background: var(--field-bg); }
.auth-puzzle-fill {
  position: absolute; inset: 0 auto 0 0; width: calc(var(--puzzle-offset) + 22px);
  border-radius: var(--ui-radius-public-control); background: color-mix(in srgb, var(--ui-action) 14%, transparent);
}
.auth-puzzle-hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ui-muted); font-size: 12px; pointer-events: none; }
#login .auth-puzzle-handle {
  position: absolute; top: -1px; left: -1px; width: 44px; height: 44px; padding: 0; display: grid; place-items: center;
  border: 1px solid var(--ui-action); border-radius: 6px; background: var(--ui-action); color: var(--ui-on-accent);
  transform: translateX(var(--puzzle-offset)); cursor: grab; touch-action: none;
}
#login .auth-puzzle-handle.dragging { cursor: grabbing; }
.auth-puzzle-handle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-puzzle.checking .auth-puzzle-handle { opacity: .7; cursor: progress; }
.auth-puzzle.failed .auth-puzzle-track { border-color: var(--ui-error); animation: auth-shake .32s ease-in-out; }
@keyframes auth-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

@media (max-width: 340px) {
  .auth-head-switch { column-gap: 8px; }
}
@media (pointer: coarse) {
  #login .auth-content :where(input:not([type="checkbox"])) { min-height: 48px; font-size: 16px; }
  #login .auth-method .auth-link { min-height: var(--ui-size-comfortable); }
  #login .auth-icon { width: 44px; height: 44px; }
  #login .auth-password input { padding-inline-end: 54px; }
  #login .auth-reveal { width: 44px; height: 44px; inset-inline-end: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-google-loading::before { animation: none; }
  #login :is(.auth-puzzle-stage, .auth-puzzle-track) { animation: none; }
}
