#gifWindow {
  position: fixed;
  bottom: 82px;
  height: 400px;
  left: 1px;
  max-width: 400px;
  background: #1a1f2e;
  border: 1px solid rgba(78, 184, 232, 0.3);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

#gifHeader {
  display: flex;
  justify-content: space-between;
  padding: 8px;
  border-bottom: 1px solid rgba(78, 184, 232, 0.2);
  background: #13161d;
  border-radius: 10px 10px 0 0;
}

#gifSearch {
  flex: 1;
  padding: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(200, 214, 229, 0.3);
  border-radius: 4px;
  color: #c8d6e5;
}

#gifSearch::placeholder {
  color: rgba(200, 214, 229, 0.5);
}

#gifSearch:focus {
  outline: none;
  border-color: #4db8e8;
}

#gifClose {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #c8d6e5;
  cursor: pointer;
  padding-left: 8px;
}

#gifClose:hover {
  color: #ff6b6b;
}

#gifResults {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 5px;
  padding: 5px;
  background: #1a1f2e;
}

#gifFooter {
  display: flex;
  border-top: 1px solid rgba(78, 184, 232, 0.2);
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}

#gifFooter button {
  flex: 1;
  padding: 10px;
  border: none;
  background: #13161d;
  color: #c8d6e5;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

#gifFooter button:hover {
  background: #1e7ea8;
}

/* ── GIF card wrapper ── */
.gif-card {
  position: relative;
  display: block;
  width: 100%;
  line-height: 0;
}

.gif-card img {
  display: block;
  width: 100%;
}

/* ── Avatar button (corner of each GIF) ── */
.gif-avatar-btn {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 2;
  opacity: 1;
  transition: opacity 0.18s;
}

.gif-card:hover .gif-avatar-btn,
.gif-avatar-btn:focus {
  opacity: 1;
}

/* Always visible on touch devices */
@media (hover: none) {
  .gif-avatar-btn {
    opacity: 1;
  }
}

/* ── Avatar confirmation dialog ── */
.gif-avatar-dlg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gif-avatar-dlg-box {
  background: #1a1f2e;
  border: 1px solid rgba(78, 184, 232, 0.35);
  border-radius: 14px;
  padding: 24px 20px 20px;
  max-width: 300px;
  width: 90%;
  text-align: center;
  color: #c8d6e5;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.gif-avatar-preview {
  max-width: 120px;
  max-height: 120px;
  border-radius: 8px;
  margin-bottom: 14px;
  object-fit: contain;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.gif-avatar-dlg-box > p {
  margin: 0 0 18px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.gif-avatar-dlg-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.gif-avatar-yes,
.gif-avatar-no {
  padding: 11px 28px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-width: 80px;
}

.gif-avatar-yes {
  background: #4db8e8;
  color: #fff;
  transition: background 0.15s;
}

.gif-avatar-yes:hover {
  background: #38a0cc;
}

.gif-avatar-no {
  background: rgba(255, 255, 255, 0.1);
  color: #c8d6e5;
  transition: background 0.15s;
}

.gif-avatar-no:hover {
  background: rgba(255, 255, 255, 0.18);
}

#gifBranding img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  opacity: 0.6;
}
