.public-auth-entry {
  position: fixed;
  top: 16px;
  right: clamp(20px, 4vw, 56px);
  z-index: 80;
  max-width: calc(100vw - 36px);
}

body:has(.public-auth-entry) {
  overflow-x: clip;
}

@supports not (overflow: clip) {
  body:has(.public-auth-entry) {
    overflow-x: hidden;
  }
}

.site-header:has(~ .public-auth-entry),
body:has(.public-auth-entry) .site-header {
  padding-right: calc(clamp(20px, 4vw, 56px) + 210px);
}

body:has(.site-header.is-scrolled) .public-auth-entry {
  top: 10px;
}

.public-auth-button,
.public-auth-drawer button,
.public-auth-primary,
.public-auth-secondary,
.public-auth-link {
  font: inherit;
}

.public-auth-button {
  min-width: 112px;
  max-width: 182px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 6px;
  background: rgba(18, 22, 26, 0.82);
  color: #ffffff;
  padding: 0 14px;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
}

.public-auth-button.is-signed-in {
  justify-content: flex-start;
}

.public-auth-button__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-auth-online-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.public-auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.42);
}

.public-auth-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  width: min(360px, 92vw);
  height: 100vh;
  background: #ffffff;
  color: #161b22;
  box-shadow: -18px 0 45px rgba(0, 0, 0, 0.2);
  transform: translateX(104%);
  transition: transform 180ms ease;
  display: flex;
  flex-direction: column;
}

.public-auth-drawer[aria-hidden="true"] {
  visibility: hidden;
  pointer-events: none;
}

.public-auth-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.public-auth-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.public-auth-drawer__header button {
  width: 36px;
  height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.public-auth-drawer__body {
  display: grid;
  gap: 12px;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.public-auth-user-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
}

.public-auth-user-summary div {
  min-width: 0;
}

.public-auth-user-summary strong,
.public-auth-user-summary span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-auth-user-summary span {
  color: #6b7280;
  font-size: 14px;
}

.public-auth-logout-form {
  margin: 0;
}

.public-auth-logout-form button {
  width: 100%;
}

.public-auth-primary,
.public-auth-secondary,
.public-auth-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 6px;
  text-decoration: none;
  text-align: center;
  overflow-wrap: anywhere;
}

.public-auth-primary {
  background: #cc1f1a;
  color: #ffffff;
}

.public-auth-secondary {
  border: 1px solid #111827;
  color: #111827;
}

.public-auth-link {
  color: #374151;
}

body.public-auth-lock {
  overflow: hidden;
}

body.menu-open .public-auth-entry,
body.public-auth-lock .public-auth-entry {
  display: none;
}

body.public-auth-compact:has(.public-auth-entry) .site-header {
  padding-right: 16px;
}

body.public-auth-compact .public-auth-entry {
  top: 12px;
  right: 72px;
  bottom: auto;
  left: auto;
  display: flex;
  justify-content: flex-end;
  max-width: 118px;
}

body.public-auth-compact .public-auth-button {
  min-width: 72px;
  max-width: 118px;
  min-height: 44px;
  padding: 0 12px;
}

body.public-auth-compact .public-auth-drawer {
  left: 0;
  right: 0;
  top: auto;
  bottom: 0;
  width: auto;
  max-width: 100vw;
  height: auto;
  max-height: min(72svh, 480px);
  transform: translateY(calc(100% + 12px));
  border-radius: 8px 8px 0 0;
}

body.public-auth-compact .public-auth-drawer.is-open {
  transform: translateY(0);
}

@media (min-width: 941px) {
  body.public-auth-compact:has(.public-auth-entry) .site-header {
    padding-right: calc(clamp(20px, 4vw, 56px) + 210px);
  }

  body.public-auth-compact .public-auth-entry {
    top: 16px;
    right: clamp(20px, 4vw, 56px);
    max-width: 184px;
  }
}

@media (min-width: 941px) and (max-width: 1180px) {
  body:has(.public-auth-entry) .site-header {
    padding-right: calc(clamp(18px, 3vw, 32px) + 136px);
  }

  .public-auth-entry {
    top: 16px;
    right: clamp(18px, 3vw, 32px);
    max-width: 126px;
  }

  .public-auth-button {
    min-width: 88px;
    max-width: 126px;
    min-height: 44px;
    padding: 0 12px;
  }

  body:has(.site-header.is-scrolled) .public-auth-entry {
    top: 10px;
  }
}

@media (max-width: 940px) {
  body.public-auth-compact:has(.public-auth-entry) .site-header,
  body:has(.public-auth-entry) .site-header {
    padding-right: 104px;
  }

  body.public-auth-compact .public-auth-entry,
  .public-auth-entry {
    top: 12px;
    right: max(12px, env(safe-area-inset-right));
    bottom: auto;
    left: auto;
    display: flex;
    justify-content: flex-end;
    max-width: 118px;
  }

  body.public-auth-compact .public-auth-button,
  .public-auth-button {
    min-width: 72px;
    max-width: 118px;
    min-height: 44px;
    padding: 0 12px;
  }

  .public-auth-drawer {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    max-width: 100vw;
    height: auto;
    max-height: min(72svh, 480px);
    transform: translateY(calc(100% + 12px));
    border-radius: 8px 8px 0 0;
  }

  .public-auth-drawer.is-open {
    transform: translateY(0);
  }
}

@media (max-width: 360px) {
  body.public-auth-compact .public-auth-entry,
  .public-auth-entry {
    right: max(10px, env(safe-area-inset-right));
    max-width: 84px;
  }
}
