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

.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.is-open {
  transform: translateX(0);
}

.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;
}

@media (max-width: 720px) {
  body:has(.public-auth-entry) .site-header {
    padding-right: 16px;
  }

  .public-auth-entry {
    top: auto;
    right: 14px;
    bottom: 14px;
    left: 14px;
    display: flex;
    justify-content: flex-end;
  }

  .public-auth-drawer {
    top: auto;
    bottom: 0;
    width: 100vw;
    height: min(84vh, 520px);
    transform: translateY(104%);
    border-radius: 8px 8px 0 0;
  }

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