/* ============================================================
   3A游戏网 · 全站在线聊天 / 留言板挂件
   左下角霓虹悬浮按钮 + 玻璃拟态聊天面板
   ============================================================ */

:root {
  --lywc-purple: #a78bfa;
  --lywc-violet: #7c5cff;
  --lywc-cyan:   #22d3ee;
  --lywc-bg:     #12151d;
  --lywc-panel:  rgba(17, 21, 30, .92);
  --lywc-line:   #2d3341;
  --lywc-text:   #d9dee6;
  --lywc-dim:    #8b94a3;
  --lywc-grad:   linear-gradient(135deg, var(--lywc-violet), var(--lywc-cyan));
}

/* ---------- 悬浮按钮 ---------- */
#lywChatBtn {
  position: fixed;
  left: 22px;
  bottom: 26px;
  z-index: 99998;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: var(--lywc-grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(124, 92, 255, .45), 0 2px 8px rgba(34, 211, 238, .25);
  transition: transform .3s cubic-bezier(.18, 1.5, .35, 1), box-shadow .3s;
}
#lywChatBtn:hover {
  transform: translateY(-4px) scale(1.08);
  box-shadow: 0 10px 34px rgba(124, 92, 255, .6), 0 4px 14px rgba(34, 211, 238, .4);
}
#lywChatBtn:active { transform: scale(.94); }
#lywChatBtn svg { width: 26px; height: 26px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)); }

/* 呼吸光环：两圈依次扩散 */
#lywChatBtn::before,
#lywChatBtn::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(167, 139, 250, .55);
  animation: lyw-pulse 2.6s ease-out infinite;
  pointer-events: none;
}
#lywChatBtn::after { animation-delay: 1.3s; }
@keyframes lyw-pulse {
  0%   { transform: scale(1);   opacity: .9; }
  70%  { transform: scale(1.55); opacity: 0; }
  100% { transform: scale(1.55); opacity: 0; }
}

/* 悬停滑出的文字标签 */
.lyw-chat-tip {
  position: absolute;
  left: calc(100% + 12px);
  white-space: nowrap;
  background: var(--lywc-panel);
  border: 1px solid var(--lywc-line);
  color: var(--lywc-text);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 10px;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.lyw-chat-tip b {
  background: var(--lywc-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
#lywChatBtn:hover .lyw-chat-tip { opacity: 1; transform: translateX(0); }

/* 未读红点 */
#lywChatDot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff4d67;
  border: 2px solid #12151d;
  display: none;
  animation: lyw-dot-blink 1.2s ease-in-out infinite;
}
@keyframes lyw-dot-blink { 50% { transform: scale(1.25); } }

/* ---------- 聊天面板 ---------- */
#lywChatPanel {
  position: fixed;
  left: 22px;
  bottom: 96px;
  z-index: 99999;
  width: 382px;
  height: min(560px, calc(100vh - 130px));
  border-radius: 18px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(620px 200px at -10% -5%, rgba(124, 92, 255, .16), transparent 60%),
    radial-gradient(500px 180px at 110% 110%, rgba(34, 211, 238, .12), transparent 60%),
    var(--lywc-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .05);
  transform-origin: left bottom;
  font-size: 14px;
  color: var(--lywc-text);
}
#lywChatPanel.open {
  display: flex;
  animation: lyw-pop .38s cubic-bezier(.18, 1.5, .35, 1);
}
@keyframes lyw-pop {
  from { opacity: 0; transform: scale(.7) translateY(24px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* 顶部流动渐变描边 */
#lywChatPanel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--lywc-violet), var(--lywc-cyan), var(--lywc-violet));
  background-size: 200% 100%;
  animation: lyw-flow 4s linear infinite;
}
@keyframes lyw-flow { to { background-position: -200% 0; } }

/* 面板头 */
.lyw-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--lywc-line);
  flex: none;
}
.lyw-chat-logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--lywc-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  box-shadow: 0 3px 12px rgba(124, 92, 255, .5);
  flex: none;
}
.lyw-chat-title { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.lyw-chat-sub   { font-size: 11px; color: var(--lywc-dim); display: flex; align-items: center; gap: 3px; }
.lyw-chat-sub b { color: #7ee787; font-size: 12px; }

/* 在线绿点：常亮呼吸 */
.lyw-on-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #3fb950;
  box-shadow: 0 0 6px rgba(63, 185, 80, .9);
  margin-right: 4px;
  flex: none;
  animation: lyw-on-breath 2s ease-in-out infinite;
}
@keyframes lyw-on-breath { 50% { opacity: .55; } }
.lyw-on-sep { margin: 0 4px; color: #5a6270; }
.lyw-chat-close {
  margin-left: auto;
  width: 28px; height: 28px;
  border: none; border-radius: 8px;
  background: transparent;
  color: var(--lywc-dim);
  font-size: 17px;
  cursor: pointer;
  transition: background .2s, color .2s, transform .3s;
  flex: none;
}
.lyw-chat-close:hover { background: rgba(255, 255, 255, .07); color: #fff; transform: rotate(90deg); }

/* 消息区 */
.lyw-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 6px;
  scrollbar-width: thin;
  scrollbar-color: #3a4155 transparent;
}
.lyw-chat-body::-webkit-scrollbar { width: 5px; }
.lyw-chat-body::-webkit-scrollbar-thumb { background: #3a4155; border-radius: 3px; }

/* 顶部公告条 */
.lyw-chat-notice {
  text-align: center;
  font-size: 11px;
  color: var(--lywc-dim);
  margin: 2px 0 12px;
}
.lyw-chat-notice b {
  background: var(--lywc-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}

/* 日期分隔 */
.lyw-day {
  text-align: center;
  font-size: 10.5px;
  color: #5a6270;
  margin: 10px 0 12px;
  position: relative;
}
.lyw-day::before {
  content: "";
  position: absolute;
  left: 10%; right: 10%; top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--lywc-line), transparent);
}
.lyw-day span { position: relative; background: #141925; padding: 0 10px; }

/* 更早消息加载条 */
.lyw-chat-more {
  display: block;
  margin: 0 auto 12px;
  border: 1px solid var(--lywc-line);
  background: rgba(255, 255, 255, .03);
  color: var(--lywc-dim);
  font-size: 11.5px;
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.lyw-chat-more:hover { border-color: var(--lywc-purple); color: var(--lywc-purple); }

/* 消息气泡 */
.lyw-msg { display: flex; gap: 9px; margin-bottom: 14px; }
.lyw-ava {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
  color: rgba(255, 255, 255, .95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.lyw-bubble {
  max-width: 76%;
  background: #1c2230;
  border: 1px solid var(--lywc-line);
  border-radius: 4px 14px 14px 14px;
  padding: 8px 12px 9px;
  position: relative;
  transition: border-color .2s;
}
.lyw-msg:hover .lyw-bubble { border-color: #39415a; }
.lyw-meta { font-size: 11px; color: var(--lywc-dim); margin-bottom: 3px; display: flex; gap: 8px; align-items: baseline; }
.lyw-meta .nk { color: var(--lywc-cyan); font-weight: 600; }
.lyw-meta .tm { color: #5a6270; font-size: 10.5px; }
.lyw-text { font-size: 13.5px; line-height: 1.55; word-break: break-word; white-space: pre-wrap; }

/* 自己发的：右对齐 + 渐变气泡 */
.lyw-msg.own { flex-direction: row-reverse; }
.lyw-msg.own .lyw-bubble {
  border-radius: 14px 4px 14px 14px;
  background: linear-gradient(135deg, rgba(124, 92, 255, .32), rgba(34, 211, 238, .22));
  border-color: rgba(124, 92, 255, .45);
}
.lyw-msg.own .lyw-meta { flex-direction: row-reverse; }
.lyw-msg.own .lyw-meta .nk { color: var(--lywc-purple); }

/* 新消息入场动画 */
.lyw-msg.anim-in { animation: lyw-rise .35s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes lyw-rise {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 空状态 */
.lyw-chat-empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--lywc-dim);
  font-size: 13px;
}
.lyw-chat-empty .big { font-size: 42px; margin-bottom: 12px; animation: lyw-float 3s ease-in-out infinite; }
@keyframes lyw-float { 50% { transform: translateY(-7px); } }

/* ---------- 输入区 ---------- */
.lyw-chat-foot {
  flex: none;
  border-top: 1px solid var(--lywc-line);
  padding: 10px 12px 12px;
  background: rgba(10, 13, 19, .55);
}
.lyw-chat-nickrow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.lyw-chat-nick {
  flex: 1;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--lywc-line);
  border-radius: 8px;
  color: var(--lywc-text);
  font-size: 12px;
  padding: 5px 10px;
  outline: none;
  transition: border-color .2s;
}
.lyw-chat-nick:focus { border-color: var(--lywc-purple); }
.lyw-chat-nicklabel { font-size: 11px; color: #5a6270; flex: none; }

.lyw-chat-inputrow { display: flex; align-items: flex-end; gap: 8px; }
#lywChatInput {
  flex: 1;
  resize: none;
  height: 40px;
  max-height: 92px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--lywc-line);
  border-radius: 10px;
  color: var(--lywc-text);
  font-size: 13.5px;
  font-family: inherit;
  padding: 10px 12px;
  outline: none;
  line-height: 1.4;
  transition: border-color .2s, box-shadow .2s;
}
#lywChatInput:focus { border-color: var(--lywc-purple); box-shadow: 0 0 0 3px rgba(124, 92, 255, .12); }
#lywChatInput::placeholder { color: #5a6270; }

#lywChatSend {
  flex: none;
  border: none;
  border-radius: 10px;
  background: var(--lywc-grad);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 11px 16px;
  cursor: pointer;
  box-shadow: 0 3px 14px rgba(124, 92, 255, .45);
  transition: transform .2s cubic-bezier(.18, 1.5, .35, 1), box-shadow .2s, opacity .2s;
}
#lywChatSend:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(124, 92, 255, .6); }
#lywChatSend:active { transform: scale(.94); }
#lywChatSend:disabled { opacity: .55; cursor: wait; transform: none; }

.lyw-chat-tips { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10.5px; color: #5a6270; }
.lyw-chat-tips .err { color: #ff6b7d; }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  #lywChatBtn { left: 14px; bottom: 16px; width: 52px; height: 52px; }
  .lyw-chat-tip { display: none; }
  #lywChatPanel {
    left: 8px; right: 8px;
    bottom: 78px;
    width: auto;
    height: calc(100vh - 96px);
  }
}

/* 减弱动效偏好 */
@media (prefers-reduced-motion: reduce) {
  #lywChatBtn::before, #lywChatBtn::after, #lywChatPanel::before,
  .lyw-chat-empty .big { animation: none; }
  #lywChatPanel.open, .lyw-msg.anim-in { animation: none; }
}
