/* ============================================================
   Power AI — 对话浮窗（问问 Power AI）
   光明未来派设计系统 · 与 main.css 共享设计 token
   ============================================================ */

.pa-chat-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: var(--font-sans);
}

/* 主动引导气泡 */
.pa-nudge {
  position: relative;
  max-width: 300px;
  background: var(--bg-pure);
  border: 1px solid rgba(0, 194, 209, 0.35);
  border-radius: 16px;
  box-shadow: var(--shadow-lift);
  padding: 12px 14px;
  animation: pa-nudge-in 0.5s var(--ease-out);
}
@keyframes pa-nudge-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.pa-nudge-body p {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 8px;
}
.pa-nudge-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pa-nudge-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: none;
  font-size: 16px;
  color: var(--ink-faint);
  cursor: pointer;
  line-height: 1;
}
.pa-nudge-close:hover { color: var(--ink); }

/* ---------- 入口按钮 ---------- */
.pa-chat-fab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 22px 0 12px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #0B2B45 0%, #0891B2 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 194, 209, 0.35);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
  position: relative;
}
.pa-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 194, 209, 0.45);
}
.pa-chat-fab:active { transform: translateY(0) scale(0.98); }
.pa-chat-fab-ico {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  display: grid;
  place-items: center;
  position: relative;
  flex: none;
}
.pa-chat-fab-ico svg { width: 19px; height: 19px; display: block; }
.pa-chat-fab::after {
  content: '';
  position: absolute;
  left: 10px;
  top: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(57, 230, 245, 0.55);
  animation: pa-ping 2.4s var(--ease-out) infinite;
  pointer-events: none;
}
@keyframes pa-ping {
  0% { transform: scale(0.85); opacity: 0.9; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}
.pa-chat-fab-label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ---------- 对话面板 ---------- */
.pa-chat-panel {
  width: 396px;
  height: 560px;
  max-height: calc(100vh - 112px);
  background: var(--bg-pure);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: var(--shadow-lift);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.32s var(--ease-out), transform 0.32s var(--ease-out);
}
.pa-chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 头部 */
.pa-chat-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #0B2B45 0%, #0E3D60 60%, #0A4A5E 100%);
  color: #fff;
}
.pa-chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0B2B45 0%, #0891B2 100%);
  border: 1px solid rgba(57, 230, 245, 0.45);
  display: grid;
  place-items: center;
  flex: none;
}
.pa-chat-avatar svg { width: 18px; height: 18px; display: block; }
.pa-chat-head-main { flex: 1; min-width: 0; }
.pa-chat-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pa-chat-title em { font-style: normal; color: #39E6F5; }
.pa-chat-title span { white-space: nowrap; }
.pa-chat-status {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.62);
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pa-chat-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.9);
}
.pa-chat-close {
  flex: none;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: none;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.25s, color 0.25s;
}
.pa-chat-close:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.pa-chat-close svg { width: 13px; height: 13px; display: block; }
.pa-chat-headbtn {
  flex: none;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: none;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.25s, color 0.25s;
}
.pa-chat-headbtn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.pa-chat-headbtn svg { width: 14px; height: 14px; display: block; }
.pa-chat-headbtn .pa-fs-icon-exit { display: none; }
.pa-chat-headbtn.is-active .pa-fs-icon-enter { display: none; }
.pa-chat-headbtn.is-active .pa-fs-icon-exit { display: block; }
.pa-lang-btn {
  flex: none;
  height: 28px;
  min-width: 46px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: background 0.25s, color 0.25s;
}
.pa-lang-btn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.pa-user-chip {
  flex: none;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.75);
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* 手机号登录弹窗 */
.pa-profile {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(11, 43, 69, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.pa-profile[hidden] { display: none !important; }
.pa-profile-card {
  width: 100%;
  max-width: 340px;
  background: var(--bg-pure);
  border-radius: 18px;
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-lift);
  animation: pa-nudge-in 0.35s var(--ease-out);
}
.pa-profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.pa-profile-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.pa-profile-sub { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.pa-profile-form { display: flex; flex-direction: column; gap: 12px; }
.pa-profile-field { display: flex; flex-direction: column; gap: 5px; }
.pa-profile-field span { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.pa-profile-field input {
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  outline: none;
}
.pa-profile-field input:focus {
  border-color: rgba(0, 194, 209, 0.65);
  box-shadow: 0 0 0 3px var(--energy-glow);
}
.pa-profile-err { font-size: 12px; color: #E11D48; margin: 0; }
.pa-profile-ops { display: flex; justify-content: flex-end; }
.pa-profile-btn {
  height: 40px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #0B2B45 0%, #0891B2 100%);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.pa-profile-btn:hover { box-shadow: 0 6px 20px rgba(0, 194, 209, 0.35); }

/* 消息区 */
.pa-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--bg);
  background-size: 56px 56px;
  scrollbar-width: thin;
  scrollbar-color: rgba(11, 43, 69, 0.18) transparent;
}
.pa-chat-body::-webkit-scrollbar { width: 5px; }
.pa-chat-body::-webkit-scrollbar-thumb {
  background: rgba(11, 43, 69, 0.18);
  border-radius: 4px;
}

.pa-msg { display: flex; gap: 9px; max-width: 92%; }
.pa-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.pa-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.pa-msg.ai .pa-msg-avatar {
  background: linear-gradient(135deg, #0B2B45 0%, #0891B2 100%);
  color: #fff;
  margin-top: 2px;
}
.pa-msg.user .pa-msg-avatar {
  background: var(--energy-glow);
  color: var(--energy-deep);
  margin-top: 2px;
}
.pa-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.65;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
  max-width: 100%;
}
.pa-msg.ai .pa-bubble {
  background: var(--bg-pure);
  border: 1px solid var(--line);
  color: var(--ink);
  border-top-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(11, 43, 69, 0.04);
}
.pa-msg.user .pa-bubble {
  background: var(--energy);
  color: #fff;
  border-top-right-radius: 4px;
}
.pa-bubble p { margin: 0; overflow-wrap: anywhere; word-break: break-word; }
.pa-bubble li { overflow-wrap: anywhere; word-break: break-word; }
.pa-bubble p + p { margin-top: 7px; }
.pa-bubble strong { color: var(--energy-deep); font-weight: 700; }
.pa-msg.user .pa-bubble strong { color: #fff; }
.pa-bubble ul { margin: 7px 0 0; padding-left: 17px; }
.pa-bubble li { margin: 3px 0; }
.pa-bubble li::marker { color: var(--energy); }
.pa-msg.user .pa-bubble li::marker { color: #fff; }
.pa-bubble .pa-md-h1 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  margin: 10px 0 6px;
  padding-left: 9px;
  border-left: 3px solid var(--energy);
}
.pa-bubble .pa-md-h2 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin: 8px 0 4px;
}
.pa-bubble .pa-md-h3, .pa-bubble .pa-md-h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 6px 0 3px;
}
.pa-bubble .pa-md-quote {
  font-size: 12.5px;
  color: var(--ink-soft);
  border-left: 2px solid var(--energy);
  padding-left: 9px;
  margin: 6px 0;
}
.pa-chart {
  margin: 10px 0;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.pa-chart svg {
  display: block;
  width: 100%;
  height: auto;
  min-width: 220px;
}
.pa-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 12px;
  display: block;
  overflow-x: auto;
}
.pa-table th, .pa-table td {
  border: 1px solid var(--line);
  padding: 6px 9px;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.pa-table th {
  background: var(--energy-glow);
  color: var(--ink);
  font-weight: 700;
}
.pa-table td { color: var(--ink-soft); }
.pa-md-code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--energy-glow);
  color: var(--energy-deep);
  border-radius: 5px;
  padding: 1px 5px;
}
.pa-md-pre {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.65;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
}
.pa-md-details { margin-top: 8px; }
.pa-md-details summary {
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--energy-deep);
  user-select: none;
}
.pa-md-details[open] summary { margin-bottom: 6px; }
.pa-bubble .pa-row-tbl {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-soft);
  padding: 6px 0;
}
.pa-stream-status {
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.pa-stream-status::before {
  content: '● ';
  color: var(--energy);
  animation: pa-pulse-dot 1.2s infinite;
}
@keyframes pa-pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
.pa-msg-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  margin-top: 4px;
  letter-spacing: 0.04em;
}
.pa-msg.user .pa-msg-time { text-align: right; }

/* 来源链接 */
.pa-src-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.pa-src {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(8, 145, 178, 0.3);
  color: var(--energy-deep);
  background: var(--energy-glow);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.25s, color 0.25s;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.pa-src:hover { background: var(--energy); color: #fff; }
.pa-cite {
  font-size: 10px;
  font-weight: 700;
  color: var(--energy-deep);
  background: var(--energy-glow);
  border-radius: 5px;
  padding: 0 4px;
  margin: 0 1px;
  cursor: pointer;
  vertical-align: super;
  line-height: 1;
}
.pa-cite:hover { background: var(--energy); color: #fff; }
.pa-ref-chip {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(8, 145, 178, 0.3);
  background: var(--energy-glow);
  color: var(--energy-deep);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.22s;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
}
.pa-ref-chip:hover { background: var(--energy); color: #fff; }
.pa-ref-box {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--energy);
  border-radius: 10px;
  font-size: 12px;
  color: var(--ink-soft);
}
.pa-ref-box strong { display: block; margin-bottom: 4px; font-size: 12px; }
.pa-ref-box p { font-size: 11.5px; line-height: 1.6; overflow-wrap: anywhere; word-break: break-word; }
.pa-act-row { display: flex; gap: 6px; margin-top: 10px; }
.pa-fb {
  border: 1px solid var(--line-strong);
  background: var(--bg-pure);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.22s;
}
.pa-fb:hover:not(:disabled) { background: var(--energy-glow); border-color: rgba(0, 194, 209, 0.5); }
.pa-fb:disabled { opacity: 0.45; cursor: default; }
.pa-fb-dl {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--energy-deep);
  border-color: rgba(8, 145, 178, 0.35);
}
.pa-mic {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.25s;
}
.pa-mic svg { width: 16px; height: 16px; display: block; }
.pa-mic:hover { border-color: rgba(0, 194, 209, 0.5); color: var(--energy-deep); }
.pa-mic.active {
  background: #E11D48;
  border-color: #E11D48;
  color: #fff;
  animation: pa-pulse-dot 1s infinite;
}

/* 输入中指示 */
.pa-typing { display: flex; align-items: center; gap: 5px; padding: 4px 2px; }
.pa-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--energy);
  animation: pa-bounce 1.1s infinite ease-in-out;
}
.pa-typing span:nth-child(2) { animation-delay: 0.15s; }
.pa-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pa-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* 快捷问题 */
.pa-chips {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 8px 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-pure);
  border-top: 1px solid var(--line);
}
.pa-chips::-webkit-scrollbar { display: none; }
.pa-chip {
  flex: none;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-pure);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-family: var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s var(--ease-out);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.pa-chip:hover {
  border-color: rgba(8, 145, 178, 0.45);
  color: var(--energy-deep);
  background: var(--energy-glow);
}

/* 输入行 */
.pa-chat-input-row {
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px 14px;
  background: var(--bg-pure);
}
.pa-chat-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.pa-chat-input:focus {
  border-color: rgba(0, 194, 209, 0.65);
  box-shadow: 0 0 0 3px var(--energy-glow);
}
.pa-chat-input::placeholder { color: var(--ink-faint); }
.pa-chat-send {
  flex: none;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: var(--energy);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.25s, transform 0.25s;
}
.pa-chat-send:hover { background: var(--energy-deep); }
.pa-chat-send:active { transform: scale(0.94); }
.pa-chat-send:disabled { opacity: 0.45; cursor: not-allowed; }
.pa-chat-send svg { width: 16px; height: 16px; display: block; }

/* 移动端：底部抽屉 */
@media (max-width: 720px) {
  .pa-chat-root { right: 16px; bottom: 16px; }
  .pa-chat-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: min(76vh, 620px);
    max-height: 76vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }
  .pa-chat-fab { height: 52px; padding: 0 10px; }
  .pa-chat-fab-label { display: none; }
  .pa-chat-fab-ico { width: 34px; height: 34px; }
}

@media (max-width: 480px) {
  .pa-user-chip { display: none; }
}

/* 全屏对话模式 */
body.pa-fs-lock { overflow: hidden; }
.pa-chat-root.pa-fs-active { z-index: 120; }
.pa-chat-panel.fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  border: none;
  transform: none;
}
.pa-chat-panel.fullscreen .pa-chat-body {
  padding: 28px clamp(16px, 6vw, 48px) 16px;
}
.pa-chat-panel.fullscreen .pa-msg {
  max-width: 820px;
  width: 100%;
  align-self: center;
}
.pa-chat-panel.fullscreen .pa-bubble {
  font-size: 14.5px;
  padding: 13px 17px;
}
.pa-chat-panel.fullscreen .pa-chips,
.pa-chat-panel.fullscreen .pa-chat-input-row {
  padding-left: clamp(16px, 6vw, 48px);
  padding-right: clamp(16px, 6vw, 48px);
}
.pa-chat-panel.fullscreen .pa-chat-input-row {
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.pa-chat-panel.fullscreen .pa-chips { overflow-x: visible; flex-wrap: wrap; }

/* 动效降级 */
@media (prefers-reduced-motion: reduce) {
  .pa-chat-fab-ico::after { animation: none; opacity: 0; }
  .pa-typing span { animation: none; opacity: 0.5; }
  .pa-chat-panel { transition: opacity 0.15s linear; }
}
