.auth-overlay {
  box-sizing: border-box;
  width: min(500px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #303638;
  border-radius: 12px;
  background: #101416;
  color: #f4f5f3;
  box-shadow: 0 24px 100px #0008;
  font-family: "Inter", "Segoe UI", sans-serif;
}
.auth-overlay[open] { animation: auth-overlay-enter 180ms ease-out; }
.auth-overlay::backdrop { background: rgb(0 0 0 / 68%); backdrop-filter: blur(6px); }
.auth-overlay-close {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #101416;
  color: #b4bcbd;
  cursor: pointer;
}
.auth-overlay-close:hover { background: #202729; color: #fff; }
.auth-overlay-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.auth-overlay :is(button, a):focus-visible { outline: 2px solid #65e0ce; outline-offset: 3px; }
.auth-overlay-frame { display: block; width: 100%; height: 340px; max-height: calc(100dvh - 50px); border: 0; background: #101416; }
.auth-overlay:not(.is-ready) .auth-overlay-frame { visibility: hidden; }
.auth-overlay-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 56px 30px; text-align: center; color: #a6acae; font-size: .875rem; line-height: 1.6; }
.auth-overlay-loading::before { content: ""; width: 24px; height: 24px; border: 2px solid #303b3e; border-top-color: #2bd7d8; border-radius: 50%; animation: auth-overlay-spin 800ms linear infinite; }
.auth-overlay-loading a { color: #c9eded; text-decoration: underline; text-underline-offset: 3px; }
.auth-overlay.is-ready .auth-overlay-loading { display: none; }
.auth-overlay.has-error .auth-overlay-loading::before { content: none; }
.auth-overlay-progress { position: absolute; z-index: 3; top: 0; left: 0; width: 100%; height: 2px; overflow: hidden; pointer-events: none; }
.auth-overlay.is-busy .auth-overlay-progress::before { content: ""; display: block; width: 35%; height: 100%; background: #2bd7d8; animation: auth-overlay-progress 1.2s ease-in-out infinite; }
@keyframes auth-overlay-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes auth-overlay-spin { to { transform: rotate(360deg); } }
@keyframes auth-overlay-progress { from { transform: translateX(-100%); } to { transform: translateX(390%); } }
@media (max-width: 540px) {
  .auth-overlay { width: 100vw; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .auth-overlay-frame { height: 100dvh !important; max-height: none; }
  .auth-overlay-close { top: 18px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-overlay[open], .auth-overlay-loading::before, .auth-overlay.is-busy .auth-overlay-progress::before { animation: none; }
}
