.auth-widget {
  position: fixed;
  z-index: 110;
  top: 1rem;
  right: 1rem;
}

.auth-trigger {
  display: grid;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid rgb(38 145 255 / 62%);
  border-radius: 50%;
  place-items: center;
  color: var(--soft-blue);
  background: rgb(3 16 34 / 94%);
  box-shadow: 0 0 14px rgb(22 136 255 / 28%);
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.auth-trigger:hover,
.auth-trigger:focus-visible,
.auth-widget.is-open .auth-trigger {
  border-color: #73caff;
  background: #08234a;
  box-shadow: 0 0 22px rgb(22 136 255 / 54%);
  outline: none;
  transform: translateY(-2px);
}

.auth-profile-icon {
  width: 1.35rem;
  fill: currentcolor;
}

.auth-trigger-label,
.auth-trigger-chevron {
  display: none;
}

.auth-initial {
  display: grid;
  width: 1.85rem;
  height: 1.85rem;
  border: 1px solid rgb(84 180 255 / 58%);
  border-radius: 50%;
  place-items: center;
  color: #fff;
  background: rgb(22 109 230 / 30%);
  font-size: 0.92rem;
  font-weight: 750;
  text-transform: uppercase;
}

.auth-widget--mounted {
  position: relative;
  z-index: 1;
  top: auto;
  right: auto;
  width: 100%;
}

.auth-widget--mounted .auth-trigger {
  display: flex;
  width: 100%;
  min-width: 108px;
  height: 44px;
  padding: 0 0.75rem;
  border-radius: 5px;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  box-shadow: inset 0 0 14px rgb(22 136 255 / 7%);
}

.auth-widget--mounted .auth-profile-icon {
  width: 1.05rem;
}

.auth-widget--mounted .auth-initial {
  width: 1.55rem;
  height: 1.55rem;
  flex: 0 0 1.55rem;
  font-size: 0.76rem;
}

.auth-widget--mounted .auth-trigger-label {
  display: inline;
  color: #d7e8fb;
  font-size: 0.82rem;
  font-weight: 550;
}

.auth-widget--mounted .auth-trigger-chevron {
  display: block;
  width: 0.85rem;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 180ms ease;
}

.auth-widget--mounted.is-open .auth-trigger-chevron {
  transform: rotate(180deg);
}

.auth-menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  display: grid;
  width: 240px;
  padding: 0.7rem;
  border: 1px solid rgb(40 151 255 / 58%);
  border-radius: 6px;
  gap: 0.25rem;
  visibility: hidden;
  background:
    linear-gradient(145deg, rgb(10 37 76 / 38%), transparent 48%),
    rgb(2 12 28 / 98%);
  box-shadow: 0 18px 38px rgb(0 0 0 / 48%), 0 0 22px rgb(22 136 255 / 22%);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms;
}

.auth-widget:hover .auth-menu,
.auth-widget:focus-within .auth-menu,
.auth-widget.is-open .auth-menu {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.auth-menu-user {
  margin: 0;
  padding: 0.35rem 0.45rem 0.7rem;
  overflow: hidden;
  border-bottom: 1px solid rgb(54 149 255 / 20%);
  color: var(--soft-blue);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-menu-button {
  width: 100%;
  min-height: 40px;
  padding: 0.58rem 0.65rem;
  border: 0;
  border-radius: 4px;
  color: var(--blue);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.auth-menu-button:hover,
.auth-menu-button:focus-visible {
  color: #fff;
  background: rgb(22 136 255 / 13%);
  outline: none;
}

.auth-owner-button {
  color: #cbaeff;
  text-shadow: 0 0 8px rgb(147 77 255 / 50%);
}

.auth-dialog {
  width: min(92vw, 500px);
  max-height: min(88vh, 760px);
  padding: 0;
  overflow: auto;
  border: 1px solid rgb(39 151 255 / 72%);
  border-radius: 6px;
  color: var(--blue);
  background:
    linear-gradient(145deg, rgb(14 54 107 / 30%), transparent 42%),
    #030d20;
  box-shadow: 0 0 44px rgb(22 136 255 / 42%), 0 28px 65px rgb(0 0 0 / 64%);
}

.auth-dialog::backdrop {
  background: rgb(0 3 11 / 82%);
  backdrop-filter: blur(6px);
}

.auth-dialog-content {
  position: relative;
  padding: 1.8rem;
}

.auth-dialog-content::before {
  position: absolute;
  top: 0;
  right: 18%;
  left: 5%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, #5dc2ff, transparent);
  box-shadow: 0 0 9px rgb(68 181 255 / 65%);
}

.auth-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0.55rem;
  border: 1px solid rgb(47 153 255 / 35%);
  border-radius: 50%;
  place-items: center;
  color: var(--blue);
  background: rgb(2 11 27 / 72%);
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.auth-close:hover,
.auth-close:focus-visible {
  border-color: #5cc2ff;
  color: #fff;
  outline: none;
  transform: rotate(4deg);
}

.auth-close svg {
  width: 100%;
  fill: currentcolor;
}

.auth-view h2 {
  margin: 0.2rem 2.7rem 1.3rem 0;
  font-size: 2rem;
}

.auth-view label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  color: var(--soft-blue);
  font-size: 0.88rem;
}

.auth-view input,
.auth-view textarea {
  width: 100%;
  padding: 0.72rem;
  border: 1px solid rgb(39 145 255 / 46%);
  border-radius: 4px;
  color: var(--soft-blue);
  background: rgb(1 8 20 / 84%);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.auth-view input:focus,
.auth-view textarea:focus {
  border-color: var(--bright-blue);
  box-shadow: 0 0 13px rgb(22 136 255 / 34%);
}

.auth-view textarea {
  resize: vertical;
}

.auth-submit {
  width: 100%;
  margin-top: 0.35rem;
  text-align: center;
}

.auth-switch {
  margin: 1rem 0 0;
  color: var(--muted-blue);
  text-align: center;
}

.auth-link {
  padding: 0;
  border: 0;
  color: #a9d8ff;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-link:hover,
.auth-link:focus-visible {
  color: #fff;
}

.auth-dialog .auth-view[data-view="register"] .auth-submit.button {
  transform: none;
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.outpost-scope .auth-view[data-view="register"] .auth-submit.button:is(:hover, :focus-visible) {
  border-color: #f4d8b1;
  background-color: #f4d8b1;
  box-shadow: 0 0 0 3px rgb(238 203 155 / 16%);
}

.auth-dialog .auth-view[data-view="register"] .auth-link {
  transition: color 180ms ease, text-decoration-color 180ms ease;
}

.auth-dialog .auth-view[data-view="register"] .auth-link:is(:hover, :focus-visible) {
  color: var(--outpost-text, #fff);
  text-decoration-color: var(--outpost-ember, currentColor);
}

.auth-message {
  min-height: 1.5rem;
  margin: 0.75rem 0 0;
  color: #ff9bab;
  font-size: 0.86rem;
  text-align: center;
}

.auth-message.success {
  color: #7ce8ae;
}

.auth-account-card {
  margin-bottom: 1rem;
  padding: 0.9rem;
  border: 1px solid rgb(35 143 255 / 24%);
  border-radius: 5px;
  background: rgb(22 136 255 / 5%);
}

.auth-account-card p {
  margin: 0.15rem 0;
}

.auth-role-list {
  display: flex;
  margin-top: 0.65rem;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.auth-role {
  padding: 0.14rem 0.5rem;
  border: 1px solid rgb(45 154 255 / 40%);
  border-radius: 999px;
  color: var(--soft-blue);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.auth-role-code {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgb(45 154 255 / 24%);
}

.auth-role-code h3 {
  margin: 0 0 0.8rem;
  color: var(--soft-blue);
  font-size: 1rem;
}

.auth-danger {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgb(255 90 115 / 25%);
}

.auth-danger .auth-submit {
  border-color: #ff5a73;
  color: #ffafbd;
  background: rgb(93 13 31 / 28%);
  box-shadow: 0 0 8px rgb(255 90 115 / 24%);
}

.auth-hint {
  color: var(--muted-blue);
  font-size: 0.78rem;
}

.auth-hidden {
  display: none;
}

@media (max-width: 820px) {
  .auth-widget--mounted .auth-trigger {
    justify-content: flex-start;
  }

  .auth-widget--mounted .auth-trigger-chevron {
    margin-left: auto;
  }

  .auth-widget--mounted .auth-menu {
    right: auto;
    left: 0;
    width: min(100%, 300px);
  }
}

@media (max-width: 600px) {
  .auth-widget:not(.auth-widget--mounted) {
    top: 0.65rem;
    right: 0.65rem;
  }

  .auth-widget:not(.auth-widget--mounted) .auth-trigger {
    width: 2.7rem;
    height: 2.7rem;
  }

  .auth-dialog-content {
    padding: 1.4rem;
  }

  .auth-view h2 {
    font-size: 1.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-trigger,
  .auth-menu,
  .auth-close {
    transition: none;
  }
}
body {
  letter-spacing: .015em;
}

button, input, select, textarea {
  letter-spacing: inherit;
}

