.prompt-chat-popup {
  --panel-pad: clamp(16px, 3vw, 24px);
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}
.prompt-chat-popup [hidden] { display: none !important; }
.prompt-chat-popup :is(button, summary):focus-visible { outline: 2px solid var(--cp-gold); outline-offset: 2px; }
.prompt-chat-popup .companion-header { padding-inline: var(--panel-pad); }
.prompt-chat-popup .companion-collapse-tab { display: none; }
.companion-modes {
  display: flex; gap: 24px; padding: 0 var(--panel-pad);
  flex: 0 0 auto; border-bottom: 1px solid var(--cp-line);
}
.prompt-chat-popup .companion-modes button {
  position: relative; min-height: 44px; padding: 0 2px;
  border: 0 !important; border-radius: 0; box-shadow: none !important;
  background: transparent !important; color: var(--cp-text-2) !important; font: inherit; font-size: 14px; cursor: pointer;
}
.prompt-chat-popup .companion-modes [aria-selected=true] { color: var(--cp-gold) !important; font-weight: 700; }
.companion-modes [aria-selected=true]::after {
  content: ""; position: absolute; inset: auto 0 -1px; height: 3px; border-radius: 3px; background: var(--cp-gold);
}
.companion-text-panel { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.prompt-chat-popup[data-companion-mode=voice] :is([data-chat-history-toggle],[data-chat-new]) { display: none; }
.prompt-chat-popup .companion-messages { padding: 16px var(--panel-pad); }
.prompt-chat-popup .companion-welcome {
  width: 100%; box-sizing: border-box; align-items: stretch; text-align: left;
  padding: 14px 0; margin: auto 0;
}
.prompt-chat-popup .companion-welcome h3 {
  font-size: clamp(21px, 3.4vw, 26px); font-weight: 650; line-height: 1.45; letter-spacing: -.035em;
}
.prompt-chat-popup .companion-welcome p { max-width: 32em; margin-bottom: 24px; font-size: 14px; }
.prompt-chat-popup .companion-starters { gap: 8px; }
.prompt-chat-popup .companion-starter {
  flex-direction: row; align-items: center; justify-content: space-between; gap: 6px;
  min-height: 48px; padding: 9px 12px; border-radius: 12px;
}
.companion-starter::after { content: ""; width: 6px; height: 6px; flex: none; border: solid var(--cp-text-2); border-width: 1px 1px 0 0; transform: rotate(45deg); }
.prompt-chat-popup .companion-quick { padding-inline: var(--panel-pad); }
.prompt-chat-popup .companion-form { padding-inline: var(--panel-pad); }
.companion-voice {
  display: flex; flex: 1; flex-direction: column; gap: 18px; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain; padding: 24px var(--panel-pad) max(20px, env(safe-area-inset-bottom));
  color: var(--cp-text); scrollbar-width: thin;
}
.voice-stage {
  flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 18px 12px; text-align: center; isolation: isolate;
}
.voice-emblem {
  display: flex; position: relative; justify-content: center; align-items: center; gap: 4px;
  width: 112px; height: 112px; margin: 0 auto 14px; border-radius: 50%;
  color: var(--cp-gold); background: radial-gradient(ellipse at 36% 28%, var(--cp-gold-soft), transparent 70%);
}
.voice-emblem::before, .voice-emblem::after, .voice-emblem span {
  content: ""; position: absolute; inset: 6px; border: 1px solid var(--cp-gold-line);
  border-radius: 43% 52% 44% 54% / 51% 40% 58% 48%; transform: rotate(-24deg);
}
.voice-emblem::after { inset: 1px 8px; transform: rotate(43deg); }
.voice-emblem span { inset: 2px 6px; transform: rotate(120deg); opacity: .7; }
.voice-emblem i { width: 4px; height: 13px; background: currentColor; border-radius: 5px; }
.voice-emblem i:nth-of-type(2), .voice-emblem i:nth-of-type(4) { height: 24px; }
.voice-emblem i:nth-of-type(3) { height: 36px; }
.voice-stage h3 { margin: 0; color: var(--cp-text); font-family: inherit; font-weight: 650; font-size: 24px; line-height: 1.4; letter-spacing: -.03em; }
.voice-rate, .voice-state, .voice-tip { margin: 0; color: var(--cp-text-2); font-size: 13px; line-height: 1.6; }
.voice-tip { max-width: 24em; }
.voice-choice { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--cp-text-2); font-size: 13px; }
.voice-choice select {
  min-height: 36px; padding: 4px 10px; border: 1px solid var(--cp-line-2); border-radius: 8px;
  font: inherit; color: var(--cp-text); background-color: var(--cp-surface);
}
.voice-choice select:focus-visible { outline: 2px solid var(--cp-gold); outline-offset: 2px; }
.voice-state:empty { display: none; }
.prompt-chat-popup .voice-toggle {
  min-height: 44px; min-width: 144px; margin-top: 12px; padding: 8px 24px; border-radius: 99px;
  background: var(--cp-gold-grad) !important; color: var(--cp-on-gold) !important; border: 0 !important;
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.voice-toggle:disabled { opacity: .55; cursor: default; }
.companion-voice[data-state=connected] .voice-toggle { background: var(--cp-surface-2) !important; color: var(--cp-text) !important; border: 1px solid var(--cp-line-2) !important; }
.voice-info { display: grid; gap: 8px; }
.voice-info details { border-top: 1px solid var(--cp-line-2); }
.voice-info summary { padding: 12px 2px; cursor: pointer; color: var(--cp-text-2); font-size: 13px; font-weight: 600; }
.voice-info details > p { padding: 0 2px; margin: 0 0 12px; color: var(--cp-text-2); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.voice-history-picker { display: grid; gap: 6px; color: var(--cp-text-2); font-size: 13px; }
.voice-history-picker select {
  box-sizing: border-box; min-width: 0; width: 100%; min-height: 42px; padding: 7px 10px;
  border: 1px solid var(--cp-line-2); border-radius: 10px;
  color: var(--cp-text); background: var(--cp-surface); font: inherit;
}
.voice-turns {
  display: flex; flex-direction: column; gap: 8px; max-height: 340px; margin: 12px 0; padding: 2px 2px 2px 0;
  overflow: auto; scrollbar-width: thin; list-style: none;
}
.voice-turn {
  flex: none; padding: 10px 12px; border: 1px solid var(--cp-line-2); border-radius: 12px;
  background: var(--cp-surface); color: var(--cp-text); font-size: 13px; line-height: 1.65;
}
.voice-turn[data-role=user] { background: var(--cp-surface-2); }
.voice-turn strong { color: var(--cp-text-2); font-size: 12px; }
.voice-turn p { margin: 5px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.voice-history-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.prompt-chat-popup .voice-history-button {
  min-height: 36px; padding: 6px 10px; border: 1px solid var(--cp-line-2); border-radius: 8px;
  background: var(--cp-surface-2); color: var(--cp-text); font: inherit; font-size: 13px; cursor: pointer;
}
.prompt-chat-popup .voice-history-button:hover:not(:disabled) { border-color: var(--cp-gold); }
.prompt-chat-popup .voice-history-button:disabled { opacity: .5; cursor: default; }
.voice-turn .voice-history-button { margin-top: 8px; }
.voice-history [data-voice-storage-status]:empty { display: none; }
.voice-receipt { padding: 14px 16px; border: 1px solid var(--cp-line-2); border-radius: 14px; background: var(--cp-surface); }
.voice-receipt h4 { margin: 0 0 12px; color: var(--cp-text); font-size: 14px; }
.voice-receipt dl { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.voice-receipt dt { font-size: 12px; color: var(--cp-text-2); }
.voice-receipt dd { margin: 4px 0 0; color: var(--cp-text); font: 600 14px/1.6 system-ui,sans-serif; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.voice-receipt dl div:nth-child(2) dd { color: var(--cp-gold); }
.companion-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.voice-stage audio:not([controls]) { display: none; }
.voice-stage audio { max-width: 100%; }
html[data-theme=light] dialog.prompt-chat-popup[data-jiyun-companion] .companion-modes button[role=tab] {
  border: 0 !important; background: transparent !important; color: var(--cp-text-2) !important; box-shadow: none !important;
}
html[data-theme=light] dialog.prompt-chat-popup[data-jiyun-companion] .companion-modes button[aria-selected=true] {
  color: var(--cp-gold) !important;
}
html[data-theme=light] dialog.prompt-chat-popup[data-jiyun-companion] .voice-stage .voice-toggle {
  background: var(--cp-gold-grad) !important; color: var(--cp-on-gold) !important; border: 0 !important;
}
html[data-theme=light] dialog.prompt-chat-popup[data-jiyun-companion] [data-state=connected] .voice-stage .voice-toggle {
  background: var(--cp-surface-2) !important; color: var(--cp-text) !important; border: 1px solid var(--cp-line-2) !important;
}
@media (prefers-reduced-motion: no-preference) {
  .companion-voice[data-state=connected] .voice-emblem i { animation: companion-voice-wave 1.1s ease-in-out infinite alternate; }
  .companion-voice[data-state=connected] .voice-emblem i:nth-child(odd) { animation-delay: -.65s; }
  @keyframes companion-voice-wave { to { transform: scaleY(.45); } }
}
@media (max-height: 560px) {
  .prompt-chat-popup[open] { overflow-y: auto; }
  .companion-text-panel { flex: 1 0 auto; }
  .companion-text-panel .companion-messages { min-height: 110px; max-height: 45vh; }
  .voice-stage { padding-block: 8px; }
  .voice-emblem { width: 72px; height: 72px; margin-bottom: 2px; }
}

/* ===== 电脑紧凑尺寸（自动生成，只对鼠标设备、宽屏生效）===== */
@media (hover: hover) and (pointer: fine) and (min-width: 1024px) {
.companion-modes { gap: 19px; }
.prompt-chat-popup .companion-modes button { min-height: 35px; }
.prompt-chat-popup .companion-welcome h3 { font-size: clamp(17.22px,  2.72vw,  20.28px); }
.prompt-chat-popup .companion-starter { min-height: 38px; }
.companion-voice { gap: 14px; }
.voice-stage { padding: 15px 12px; }
.voice-stage h3 { font-size: 20px; }
.prompt-chat-popup .voice-toggle { min-height: 35px; padding: 8px 21px; }
.voice-history-picker select { min-height: 34px; }
.voice-receipt { padding: 14px 14px; }
@media (max-height: 560px) {
.companion-text-panel .companion-messages { min-height: 94px; }
}

}
