/* 吴时全站浮层 · 纸白 / 墨黑 / 朱红 — 默认克制，展开再完整 */
:root {
  --ws-paper: #F4F3ED;
  --ws-ink: #20221F;
  --ws-muted: #62665E;
  --ws-red: #D83D23;
  --ws-line: #D7D8CF;
  --ws-z: 99990;
}
#wushiRoot, aside[aria-label="吴时"] {
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ws-ink);
}
/* 默认：半透明朱红小点，不挡主 CTA；展开卡片时仍可用大 FAB */
.wushi-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: var(--ws-z);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1.5px solid rgba(32,34,31,0.55);
  background: rgba(216, 61, 35, 0.88);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: grab;
  box-shadow: 0 8px 22px rgba(32, 34, 31, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, width 0.15s ease, height 0.15s ease, border-radius 0.15s ease, opacity 0.15s ease;
  opacity: 0.92;
}
.wushi-fab:hover {
  transform: translateY(-1px);
  opacity: 1;
  box-shadow: 0 12px 28px rgba(216, 61, 35, 0.28);
}
.wushi-fab:active { cursor: grabbing; }
.wushi-fab.is-dragging { transition: none; }
.wushi-fab.is-open {
  width: 56px;
  height: 56px;
  border-radius: 3px;
  border-width: 2px;
  font-size: 14px;
  opacity: 1;
  box-shadow: 0 12px 32px rgba(216, 61, 35, 0.32), 0 0 0 3px rgba(244, 243, 237, 0.75);
}
.wushi-fab .ws-fab-pulse {
  position: absolute; inset: -5px; border: 1.5px solid rgba(216,61,35,0.55); border-radius: inherit;
  opacity: 0.35; animation: wsPulse 2.4s ease-out infinite; pointer-events: none;
}
.wushi-fab.is-open .ws-fab-pulse { inset: -6px; border-radius: 4px; }
@keyframes wsPulse {
  0% { transform: scale(1); opacity: 0.45; }
  70% { transform: scale(1.16); opacity: 0; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .wushi-fab .ws-fab-pulse { animation: none; }
  .wushi-fab { transition: none; }
}
.wushi-card {
  position: fixed;
  right: 16px;
  bottom: 72px;
  z-index: calc(var(--ws-z) + 1);
  width: min(360px, calc(100vw - 24px));
  background: var(--ws-paper);
  border: 1px solid var(--ws-line);
  border-radius: 3px;
  padding: 0;
  box-shadow: 0 20px 56px rgba(32, 34, 31, 0.16);
  display: flex;
  flex-direction: column;
  max-height: min(540px, calc(100vh - 100px));
  overflow: hidden;
}
.wushi-card.hidden, .wushi-card[hidden] { display: none !important; }
.wushi-card.is-minimized { display: none !important; }
.wushi-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--ws-line);
  cursor: grab; user-select: none; touch-action: none; background: #fff;
}
.wushi-head:active { cursor: grabbing; }
.wushi-title { font-size: 17px; font-weight: 700; letter-spacing: 0.04em; }
.wushi-title::before {
  content: ""; display: inline-block; width: 8px; height: 8px; background: var(--ws-red);
  margin-right: 8px; vertical-align: middle; border-radius: 1px;
}
.wushi-sub { font-size: 12px; color: var(--ws-muted); margin-top: 4px; }
.wushi-head-actions { display: flex; gap: 6px; flex-shrink: 0; }
.wushi-head-actions button, .wushi-actions button, .wushi-ask button {
  height: 30px; padding: 0 10px; border: 1px solid var(--ws-line); background: var(--ws-paper);
  color: var(--ws-ink); border-radius: 2px; font-size: 12px; cursor: pointer;
}
.wushi-head-actions button:hover, .wushi-actions button:hover, .wushi-ask button:hover {
  border-color: var(--ws-ink);
}
.wushi-btn-solid { background: var(--ws-red) !important; border-color: var(--ws-red) !important; color: #fff !important; }
.wushi-body { padding: 12px 14px 14px; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.wushi-levels { display: flex; gap: 6px; height: 6px; margin-bottom: 10px; }
.wushi-levels span {
  flex: 1; border-radius: 99px; background: rgba(216,61,35,0.15); position: relative; overflow: hidden;
}
.wushi-levels span::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: var(--lvl, 0%);
  background: var(--ws-red); transition: width .08s linear;
}
.wushi-log {
  flex: 1; min-height: 140px; max-height: 220px; overflow: auto;
  border: 1px solid var(--ws-line); border-radius: 2px; padding: 10px;
  font-size: 12px; line-height: 1.55; background: #fff; margin-bottom: 10px;
}
.wushi-log .you { color: var(--ws-ink); }
.wushi-log .bot { color: var(--ws-ink); line-height: 1.55; white-space: pre-wrap; }
.wushi-log .bot strong, .wushi-log .bot em, .wushi-log .bot .hl { color: var(--ws-red); font-style: normal; font-weight: 600; }
.wushi-log .sys { color: var(--ws-muted); font-size: 12px; }
.wushi-link-card {
  display: inline-block; margin: 4px 6px 4px 0; padding: 6px 10px;
  border: 1px solid var(--ws-line); border-radius: 2px; background: #fff;
  color: var(--ws-red) !important; text-decoration: none; font-size: 12px;
  max-width: 100%; overflow-wrap: anywhere; word-break: break-all;
}
.wushi-link-card:hover { border-color: var(--ws-red); background: #fff8f6; }
.wushi-log .has-links { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.wushi-actions, .wushi-ask { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.wushi-actions #wushiWakeOpt[aria-pressed="true"] { border-color: var(--ws-red); color: var(--ws-red); }
.wushi-ask input {
  flex: 1; background: #fff; border: 1px solid var(--ws-line); border-radius: 2px;
  padding: 8px 12px; font-size: 13px; color: var(--ws-ink);
}
.wushi-hint { font-size: 11px; color: var(--ws-muted); line-height: 1.45; margin: 0; }
.wushi-spotlight {
  outline: 3px solid var(--ws-red) !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 8px rgba(216,61,35,0.18) !important;
  transition: outline 0.2s ease;
}
.wushi-pointer {
  position: fixed;
  z-index: calc(var(--ws-z) + 20);
  width: 56px;
  height: 56px;
  pointer-events: none;
  transform: translate(-8px, -4px);
  transition: left 0.4s cubic-bezier(.2,.8,.2,1), top 0.4s cubic-bezier(.2,.8,.2,1);
  filter: drop-shadow(0 4px 10px rgba(32,34,31,0.45)) drop-shadow(0 0 0 2px rgba(244,243,237,0.9));
  background: none;
  border: none;
  border-radius: 0;
}
.wushi-pointer::before {
  content: "";
  display: block;
  width: 56px;
  height: 56px;
  background-repeat: no-repeat;
  background-size: 48px 48px;
  background-position: 0 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4 L8 38 L16.5 29.5 L22 42 L28 39.5 L22.5 27 L34 27 Z' fill='%2320221F' stroke='%23D83D23' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E");
  animation: wsPointerPulse 1.4s ease-out infinite;
}
@keyframes wsPointerPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .wushi-pointer::before { animation: none; }
  .wushi-pointer { transition: none; }
}
.wushi-pointer-label {
  position: fixed;
  z-index: calc(var(--ws-z) + 21);
  background: var(--ws-red);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 10px 14px;
  border-radius: 3px;
  border: 2px solid var(--ws-ink);
  box-shadow: 0 10px 28px rgba(216,61,35,0.35);
  pointer-events: none;
  max-width: 280px;
  line-height: 1.4;
}

/* 窗口收起但对话仍在进行 */
#wushiToggle.is-live { box-shadow: 0 0 0 3px rgba(178, 34, 34, .28); }
#wushiToggle.is-live::after { content: ''; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--ws-red, #b22222); }

/* 手机端：更大的点按区域；卡片为底部面板，不可拖出屏幕 */
.wushi-fab { -webkit-tap-highlight-color: transparent; }
@media (max-width: 640px), (pointer: coarse) {
  .wushi-fab {
    width: 52px; height: 52px; font-size: 13px; opacity: 1;
  }
  .wushi-fab:not([style*="left"]) {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .wushi-fab.is-open { width: 52px; height: 52px; }
  .wushi-fab::before { content: ''; position: absolute; inset: -8px; }
  .wushi-card {
    left: 0 !important; right: 0 !important; top: auto !important;
    bottom: 0 !important;
    width: 100% !important; max-width: 100% !important;
    max-height: min(78vh, 620px) !important;
    border-radius: 12px 12px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -12px 40px rgba(32,34,31,0.22);
  }
  .wushi-head { cursor: default; touch-action: auto; padding: 12px 14px; }
  .wushi-head-actions { gap: 8px; }
  .wushi-head-actions button, .wushi-actions button, .wushi-ask button {
    height: 40px; min-width: 44px; padding: 0 12px; font-size: 14px;
  }
  .wushi-ask input { font-size: 16px; padding: 10px 12px; min-height: 40px; }
  .wushi-log { max-height: 38vh; font-size: 14px; }
  .wushi-card:not(.hidden):not(.is-minimized) ~ .wushi-fab,
  body:has(.wushi-card:not(.hidden):not(.is-minimized)) .wushi-fab { opacity: 0; pointer-events: none; }
}

.wushi-sources { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.wushi-source-card { display: flex !important; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; box-sizing: border-box; }
.wushi-source-card strong { font-size: 13px; font-weight: 700; color: var(--ws-ink); }
.wushi-source-meta { font-size: 11px; color: var(--ws-muted); }

.wushi-toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(8px); z-index: calc(var(--ws-z) + 30); background: var(--ws-ink); color: #fff; font-size: 13px; padding: 8px 14px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.wushi-toast.show { opacity: 1; transform: translateX(-50%); }
@media (max-width: 640px) { .wushi-pointer-label { font-size: 14px; padding: 8px 12px; } }

/* 20261027j 跨页接续：继续语音提示按钮 */
.wushi-resume-voice {
  display: inline-block;
  margin: 6px 0 2px;
  padding: 8px 14px;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(180, 40, 30, .45);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.wushi-sources-toggle {
  display: inline-block;
  margin: 4px 0 2px;
  padding: 6px 12px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(120,120,120,.35);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  opacity: .85;
}
.wushi-source-detail { display: none; font-size: 11px; opacity: .55; margin-top: 2px; }
.wushi-source-detail[hidden] { display: none !important; }
.wushi-sources-more:not([hidden]) .wushi-source-detail { display: block; }
.wushi-sources-more:not([hidden]) { margin-top: 4px; }
.wushi-sources-main .wushi-source-detail { display: none !important; }
