:root {
  --dm-auth-bg: rgba(2, 12, 7, .88);
  --dm-auth-line: rgba(114, 255, 156, .34);
  --dm-auth-hot: #72ff9c;
  --dm-auth-ink: #e6ffe9;
  --dm-auth-muted: #9bcbaa;
  --dm-auth-dim: #5d8068;
  --dm-auth-cyan: #65f7ff;
  --dm-auth-danger: #ff6079;
  --dm-auth-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.dm-auth-widget {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 80;
  display: none;
  width: 64px;
  max-width: calc(100vw - 24px);
  min-height: 64px;
  max-height: 64px;
  border: 1px solid var(--dm-auth-line);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--dm-auth-bg), rgba(0, 0, 0, .78));
  box-shadow: 0 18px 64px rgba(0, 0, 0, .55), 0 0 22px rgba(114, 255, 156, .14);
  color: var(--dm-auth-ink);
  font-family: var(--dm-auth-mono);
  text-shadow: none;
  backdrop-filter: blur(14px) saturate(1.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
  overflow: hidden;
  cursor: default;
  transition:
    width 180ms ease,
    max-height 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.dm-auth-widget[data-ready="true"] { display: block; }

.dm-auth-widget.is-expanded,
.dm-auth-widget[data-expanded="true"],
.dm-auth-widget:hover,
.dm-auth-widget:focus,
.dm-auth-widget:focus-within {
  width: min(300px, calc(100vw - 24px));
  max-height: 150px;
  border-color: rgba(114, 255, 156, .56);
  box-shadow: 0 22px 72px rgba(0, 0, 0, .62), 0 0 28px rgba(114, 255, 156, .20);
  transform: translateY(-1px);
  outline: none;
}

.dm-auth-widget::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--dm-auth-hot), transparent);
  opacity: .72;
}

.dm-auth-widget__inner {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 278px;
  padding: 10px;
}

.dm-auth-widget__avatar-link {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
}

.dm-auth-widget__avatar-link:focus-visible {
  outline: 2px solid var(--dm-auth-hot);
  outline-offset: 3px;
}

.dm-auth-widget__avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(114, 255, 156, .48);
  border-radius: 14px;
  background: radial-gradient(circle at 30% 20%, rgba(101, 247, 255, .24), transparent 50%), rgba(114, 255, 156, .12);
  color: var(--dm-auth-hot);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .08em;
  box-shadow: inset 0 0 18px rgba(114, 255, 156, .12);
  overflow: hidden;
}

.dm-auth-widget__avatar.has-image {
  background: rgba(114, 255, 156, .08);
}

.dm-auth-widget__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dm-auth-widget__body,
.dm-auth-widget__actions {
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
  transition-delay: 0ms;
}

.dm-auth-widget.is-expanded .dm-auth-widget__body,
.dm-auth-widget[data-expanded="true"] .dm-auth-widget__body,
.dm-auth-widget:hover .dm-auth-widget__body,
.dm-auth-widget:focus .dm-auth-widget__body,
.dm-auth-widget:focus-within .dm-auth-widget__body,
.dm-auth-widget.is-expanded .dm-auth-widget__actions,
.dm-auth-widget[data-expanded="true"] .dm-auth-widget__actions,
.dm-auth-widget:hover .dm-auth-widget__actions,
.dm-auth-widget:focus .dm-auth-widget__actions,
.dm-auth-widget:focus-within .dm-auth-widget__actions {
  opacity: 1;
  transform: translateX(0);
  transition-delay: 80ms;
}

.dm-auth-widget__status {
  color: var(--dm-auth-hot);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  line-height: 1.2;
  text-transform: uppercase;
}

.dm-auth-widget__name {
  margin-top: 2px;
  color: var(--dm-auth-ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-auth-widget__meta {
  margin-top: 2px;
  color: var(--dm-auth-dim);
  font-size: 10px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-auth-widget__actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 2px;
}

.dm-auth-widget__actions a {
  flex: 1 1 auto;
  min-width: max-content;
  border: 1px solid rgba(114, 255, 156, .22);
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(0, 18, 7, .55);
  color: var(--dm-auth-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
}

.dm-auth-widget__actions a:hover,
.dm-auth-widget__actions a:focus-visible {
  border-color: var(--dm-auth-hot);
  color: var(--dm-auth-hot);
  outline: none;
}

.dm-auth-widget__actions a[data-action="logout"] {
  border-color: rgba(255, 96, 121, .32);
  color: #ff9aad;
}

.dm-auth-widget__actions a[data-action="logout"]:hover,
.dm-auth-widget__actions a[data-action="logout"]:focus-visible {
  border-color: var(--dm-auth-danger);
  color: var(--dm-auth-danger);
}

@media (max-width: 720px) {
  .dm-auth-widget {
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    width: 60px;
    min-height: 60px;
    max-height: 60px;
    max-width: calc(100vw - 20px);
  }

  .dm-auth-widget.is-expanded,
  .dm-auth-widget[data-expanded="true"],
  .dm-auth-widget:hover,
  .dm-auth-widget:focus,
  .dm-auth-widget:focus-within {
    width: min(280px, calc(100vw - 20px));
    max-height: 150px;
  }
}
