/* 将问答入口固定在右下角，为系统安全区留出距离。 */
#interview-launch {
  position: fixed;
  z-index: 6;
  right: max(clamp(14px, 2.6vw, 40px), env(safe-area-inset-right));
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px 0 12px;
  border: 1px solid #a990ee;
  border-radius: 24px;
  background: linear-gradient(118deg, #463482, #302454 74%);
  color: #fbf9ff;
  box-shadow: 0 5px 23px #0907138c, inset 0 1px #d7d0ff22;
  font-size: 13px;
  font-weight: 600;
}

/* 用细线星芒识别问答入口。 */
#interview-launch .ic { width: 20px; height: 20px; color: #e7dcff; }

/* 回应鼠标悬停或键盘焦点。 */
#interview-launch:is(:hover,:focus-visible) { background: linear-gradient(118deg, #59459b, #403064); }

/* 全屏作品和相册拥有独立的查看空间。 */
body:has(dialog[open]) #interview-launch { visibility: hidden; }

/* 小窗使用浏览器顶层显示，仍可点击背后的页面收起。 */
#interview-panel {
  position: fixed;
  inset: auto max(clamp(14px, 2.6vw, 40px), env(safe-area-inset-right)) max(74px, calc(env(safe-area-inset-bottom) + 66px)) auto;
  margin: 0;
  padding: 0;
  width: min(375px, calc(100vw - 28px));
  max-height: calc(100dvh - 90px);
  overflow: hidden;
  border: 1px solid #5d526f;
  border-radius: 18px;
  background: #17161d;
  color: #f6f4fa;
  box-shadow: 0 14px 64px #090712b0;
}

/* 将标题和输入框固定于可滚动对话区两端。 */
#interview-panel:popover-open { display: flex; flex-direction: column; }

/* 让输入框上方的内容覆盖稳定的阅读高度。 */
#interview-panel.has-messages { height: min(530px, calc(100dvh - 90px)); }

/* 标题区呼应站点 WX 的冷色高光。 */
.interview-head {
  flex: none;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 17px;
  border-bottom: 1px solid #36303f;
  background: linear-gradient(114deg, #312642 0%, #201d2b 69%, #19252e 100%);
}

/* 在标题旁放置助手图标。 */
.interview-emblem {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #8c73bd75;
  border-radius: 13px;
  color: #e3d2ff;
  background: #b895ff17;
}

/* 限定图标及面板标题的层级。 */
.interview-emblem .ic { width: 24px; height: 24px; }
#interview-title { font-size: 17px; letter-spacing: .01em; line-height: 1.35; }
.interview-head p { margin: 3px 0 0; color: #c0b7cd; font-size: 12px; }
.interview-head button { margin-left: auto; }

/* 消息独立滚动，触屏不会将惯性传给背页。 */
.interview-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #635773 transparent;
  padding: 18px;
}

/* 消息依据来源分侧排版。 */
#interview-history { display: grid; gap: 13px; }
.interview-message {
  justify-self: start;
  min-width: 0;
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.interview-message.from-user {
  justify-self: end;
  max-width: 90%;
  padding: 7px 12px;
  border-radius: 12px 12px 3px 12px;
  color: #f0eaff;
  background: #3a2e56;
}

/* 将依据作品放在答复下方，作为可直接打开的站内链接。 */
.interview-sources { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 6px; }
.interview-sources a { color: #d3b9ff; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.interview-message.pending { color: #b7aec4; }

/* 以一组紧凑的提问入口引导首次使用。 */
#interview-prompts h3 { margin: 0 0 10px; font-size: 12px; font-weight: 500; color: #bdb3cd; }
#interview-questions { display: grid; gap: 7px; }
#interview-questions button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #403747;
  border-radius: 8px;
  background: #221e29;
  color: #ede7f5;
  text-align: left;
  font-size: 13px;
  line-height: 1.5;
}
#interview-questions button::after { content: '↗'; color: #b694df; flex: none; }
#interview-questions button:hover { border-color: #827096; background: #2a2334; }

/* 在有对话时收起推荐列表，仍可随时展开。 */
#interview-recommend {
  align-self: end;
  margin: 5px 18px;
  padding: 4px;
  color: #c9b4e7;
  font-size: 12px;
}
.has-messages #interview-prompts { margin-top: 16px; }

/* 小窗底部的输入栏支持回车和点击提交。 */
#interview-form {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 15px 15px;
  padding: 6px 6px 6px 12px;
  border: 1px solid #645476;
  border-radius: 11px;
  background: #100f15;
}
#interview-form:focus-within { border-color: #b49ae2; }
#interview-input { flex: 1; min-width: 0; border: 0; background: none; color: inherit; font-size: 13px; outline: none; }
#interview-input::placeholder { color: #a59baa; }
#interview-form button { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; background: #c3adff; color: #20172d; }
.interview-input-label { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }

/* 紧凑屏幕保留完整输入栏，避免调起系统键盘时自动放大。 */
@media (max-width: 540px) {
  #interview-launch { right: 12px; min-height: 40px; padding-inline: 10px 13px; }
  #interview-panel { inset-inline: 10px; width: auto; bottom: max(66px, calc(env(safe-area-inset-bottom) + 58px)); max-height: calc(100dvh - 80px); }
  #interview-input { font-size: 16px; }
}

/* 打印作品集时略去对话控件。 */
@media print {
  #interview-panel, #interview-launch { display: none !important; }
}
