html {
  min-height: 100%;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  background: var(--bg);
}

body {
  min-height: 100vh;
  background-color: var(--bg) !important;
  background-image: url("/assets/nika-background.png") !important;
  background-position: center center !important;
  background-size: cover !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 63px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(23, 17, 33, 0.96);
  backdrop-filter: blur(8px);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 170px;
  color: var(--text);
  text-decoration: none;
}

header .brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
  background: #3d2569;
  border: 1px solid #8d62dc;
  flex: 0 0 auto;
}

header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

header nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

header .nav-item {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  white-space: nowrap;
}

header .nav-item.active {
  background: #2a2140;
  color: var(--text);
  border-color: #7450b8;
}

header .nav-item:hover {
  border-color: #7b6a98;
  color: var(--text);
}

header .login-link {
  min-height: 36px;
  border: 1px solid #8d62dc;
  border-radius: 6px;
  color: var(--text);
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  background: #3d2569;
  font-weight: 700;
  white-space: nowrap;
}

header .account-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  min-height: 34px;
  min-width: 0;
}

header .account-user strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

header .account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2a2336;
  flex: 0 0 auto;
}

header .spacer {
  flex: 1;
}

.invite-bubble {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 30;
  display: grid;
  grid-template-columns: 81px minmax(0, 315px);
  gap: 15px;
  align-items: center;
  max-width: calc(100vw - 36px);
  color: var(--text);
  text-decoration: none;
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.invite-avatar {
  width: 81px;
  height: 81px;
  border-radius: 50%;
  object-fit: cover;
  background: #2a2140;
  border: 3px solid #8d62dc;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.42), 0 0 0 rgba(179, 140, 255, 0);
  animation: invite-glow 3.8s ease-in-out infinite;
}

.invite-message {
  position: relative;
  display: block;
  width: 315px;
  max-width: 100%;
  min-height: 63px;
  padding: 15px 20px;
  border: 1px solid #8d62dc;
  border-radius: 8px;
  background: rgba(29, 22, 41, 0.96);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.42), 0 0 0 rgba(179, 140, 255, 0);
  font-size: 18px;
  font-weight: 700;
  animation: invite-glow 3.8s ease-in-out infinite;
}

.invite-message::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 26px;
  width: 16px;
  height: 16px;
  background: rgba(29, 22, 41, 0.96);
  border-left: 1px solid #8d62dc;
  border-bottom: 1px solid #8d62dc;
  transform: rotate(45deg);
}

.invite-text {
  display: inline-block;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--accent);
  animation: invite-type 1.8s steps(27, end) 0.35s forwards, invite-caret 0.85s step-end 0.35s 4;
}

.invite-seen .invite-text {
  animation: none;
  max-width: none;
  border-right: 0;
}

@keyframes invite-type {
  to { max-width: 27ch; }
}

@keyframes invite-caret {
  50% { border-color: transparent; }
}

@keyframes invite-glow {
  0%, 100% { box-shadow: 0 16px 34px rgba(0, 0, 0, 0.42), 0 0 0 rgba(179, 140, 255, 0); }
  50% { box-shadow: 0 16px 34px rgba(0, 0, 0, 0.42), 0 0 18px rgba(179, 140, 255, 0.36); }
}

@media (prefers-reduced-motion: reduce) {
  .invite-avatar,
  .invite-message,
  .invite-text {
    animation: none;
  }

  .invite-text {
    max-width: none;
    border-right: 0;
  }
}

@media (max-width: 820px) {
  header {
    min-height: 0;
    padding: 12px 14px;
    align-items: stretch;
    flex-direction: column;
  }

  header .brand {
    min-width: 0;
  }

  header nav {
    width: 100%;
  }

  header .nav-item {
    flex: 1 1 auto;
    justify-content: center;
  }

  .invite-bubble {
    left: 10px;
    bottom: 10px;
    grid-template-columns: 64px minmax(0, 250px);
    gap: 12px;
  }

  .invite-avatar {
    width: 64px;
    height: 64px;
  }

  .invite-message {
    width: 250px;
    min-height: 54px;
    padding: 12px 16px;
    font-size: 16px;
  }
}
