/* ==========================================================
   TK666 网站居民 · 陪伴层样式
   只负责气泡、空状态插图、轻动画，不影响原有布局。
   ========================================================== */

/* ---------- 首页看板娘气泡 ---------- */

.resident {
  position: relative;
  justify-self: end;
}

.resident .intro-figure {
  animation: resident-float 6s ease-in-out infinite;
}

@keyframes resident-float {
  0%, 100% { transform: rotate(2deg) translateY(0); }
  50% { transform: rotate(2deg) translateY(-6px); }
}

.resident-bubble {
  position: absolute;
  top: -14px;
  right: calc(100% + 14px);
  width: max-content;
  max-width: 240px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px 16px 4px 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 143, 179, 0.4);
  box-shadow: 0 12px 28px rgba(202, 140, 158, 0.22);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
  z-index: 5;
}

.resident-bubble.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.resident-bubble::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: 14px;
  width: 12px;
  height: 12px;
  background: inherit;
  border-top: 1px solid rgba(255, 143, 179, 0.4);
  border-right: 1px solid rgba(255, 143, 179, 0.4);
  transform: rotate(45deg);
  border-radius: 2px;
}

.resident-bubble-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 143, 179, 0.45);
}

.resident-bubble-text {
  margin: 0;
}

.resident-bubble-close {
  flex: 0 0 auto;
  margin: -4px -6px 0 2px;
  padding: 2px 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  cursor: pointer;
}

.resident-bubble-close:hover {
  background: var(--pink-mist);
}

/* 看板娘可点击（彩蛋），但保持文字可选中、无侵入 */
.resident .intro-figure {
  cursor: pointer;
}

/* ---------- 空状态插图 ---------- */

.empty-note.with-resident {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.empty-resident {
  width: 132px;
  border-radius: 18px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 22px rgba(202, 140, 158, 0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.empty-resident.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- 赞助弹窗彩蛋 ---------- */

.sponsor-chibi {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 74px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 18px rgba(202, 140, 158, 0.25);
  transform: rotate(3deg);
  pointer-events: none;
}

/* ---------- 手机端：气泡移到看板娘右侧，不遮挡标题和按钮 ---------- */

@media (max-width: 720px) {
  .resident {
    justify-self: start;
  }

  .resident .intro-figure {
    animation: none;
  }

  .resident-bubble {
    top: 0;
    right: auto;
    bottom: auto;
    left: calc(100% + 12px);
    max-width: min(44vw, 240px);
    font-size: 12px;
    border-radius: 16px 16px 16px 4px;
  }

  .resident-bubble::after {
    right: auto;
    left: -7px;
    bottom: 16px;
    border: 0;
    border-left: 1px solid rgba(255, 143, 179, 0.4);
    border-bottom: 1px solid rgba(255, 143, 179, 0.4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .resident .intro-figure {
    animation: none;
  }

  .resident-bubble,
  .empty-resident {
    transition: none;
  }
}
