/* ============================================================
   墨鲸 · 站点对话面板
   复用 index.html 里的 :root 变量（--glass / --line / --accent …），
   单独成文件，不碰 assets/style.css。
   ============================================================ */

.mjk-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999;
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(126, 232, 250, .35);
  background:
    radial-gradient(circle at 30% 25%, rgba(126, 232, 250, .22), transparent 62%),
    rgba(8, 17, 32, .86);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .55), 0 0 0 0 rgba(126, 232, 250, .35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s var(--ease, cubic-bezier(.22, .61, .36, 1)),
              transform .35s var(--ease, cubic-bezier(.22, .61, .36, 1)),
              box-shadow .35s var(--ease, cubic-bezier(.22, .61, .36, 1)),
              border-color .35s var(--ease, cubic-bezier(.22, .61, .36, 1));
}

/* 进站过场播完才现身，不抢他的过场 */
.mjk-fab.is-ready {
  opacity: 1;
  pointer-events: auto;
}

.mjk-fab:hover {
  transform: translateY(-3px) scale(1.04);
  border-color: var(--accent, #7ee8fa);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .6), 0 0 24px rgba(126, 232, 250, .28);
}

.mjk-fab:active { transform: translateY(-1px) scale(.99); }

.mjk-fab img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  border-radius: 50%;
  display: block;
}

/* 未读角标 */
.mjk-fab::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent, #7ee8fa);
  box-shadow: 0 0 10px var(--accent, #7ee8fa);
  opacity: 0;
  transform: scale(.4);
  transition: opacity .3s ease, transform .3s ease;
}

.mjk-fab.has-unread::after { opacity: 1; transform: scale(1); }

/* ---------- 面板 ---------- */
.mjk-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 1000;
  width: 384px;
  max-width: calc(100vw - 44px);
  height: min(620px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  border-radius: var(--radius, 20px);
  border: 1px solid var(--line, rgba(255, 255, 255, .085));
  background:
    radial-gradient(28rem 18rem at 85% -10%, rgba(126, 232, 250, .10), transparent 65%),
    rgba(7, 13, 24, .82);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow, 0 24px 70px rgba(0, 0, 0, .5));
  overflow: hidden;
  transform-origin: 100% 100%;
  opacity: 0;
  transform: translateY(14px) scale(.97);
  pointer-events: none;
  transition: opacity .32s var(--ease, cubic-bezier(.22, .61, .36, 1)),
              transform .32s var(--ease, cubic-bezier(.22, .61, .36, 1));
}

.mjk-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------- 头部 ---------- */
.mjk-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, .085));
  flex: 0 0 auto;
}

.mjk-head-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 18%;
  border: 1px solid rgba(126, 232, 250, .3);
  flex: 0 0 auto;
}

.mjk-head-text { line-height: 1.25; min-width: 0; }

.mjk-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text, #e9f2fa);
}

.mjk-state {
  font-size: 11px;
  color: var(--muted, #93a8bd);
  display: flex;
  align-items: center;
  gap: 5px;
}

.mjk-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent, #7ee8fa);
  box-shadow: 0 0 8px var(--accent, #7ee8fa);
}

.mjk-close {
  margin-left: auto;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted, #93a8bd);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}

.mjk-close:hover {
  color: var(--text, #e9f2fa);
  background: rgba(255, 255, 255, .06);
  border-color: var(--line, rgba(255, 255, 255, .085));
}

/* ---------- 消息区 ---------- */
.mjk-log {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 232, 250, .28) transparent;
}

.mjk-log::-webkit-scrollbar { width: 6px; }
.mjk-log::-webkit-scrollbar-thumb {
  background: rgba(126, 232, 250, .24);
  border-radius: 6px;
}
.mjk-log::-webkit-scrollbar-track { background: transparent; }

.mjk-msg {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.68;
  white-space: pre-wrap;
  word-break: break-word;
  animation: mjk-in .3s var(--ease, cubic-bezier(.22, .61, .36, 1)) both;
}

@keyframes mjk-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mjk-msg.is-me {
  align-self: flex-end;
  background: linear-gradient(160deg, rgba(77, 124, 255, .28), rgba(126, 232, 250, .16));
  border: 1px solid rgba(126, 232, 250, .22);
  color: var(--text, #e9f2fa);
  border-bottom-right-radius: 5px;
}

.mjk-msg.is-her {
  align-self: flex-start;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line, rgba(255, 255, 255, .085));
  color: #dbe8f4;
  border-bottom-left-radius: 5px;
}

.mjk-msg.is-err {
  align-self: center;
  background: rgba(255, 120, 120, .1);
  border: 1px solid rgba(255, 120, 120, .26);
  color: #ffb4b4;
  font-size: 12.5px;
}

/* 打字光标 */
.mjk-caret::after {
  content: "▍";
  color: var(--accent, #7ee8fa);
  animation: mjk-blink 1s steps(2) infinite;
  margin-left: 1px;
}

@keyframes mjk-blink { 50% { opacity: 0; } }

/* ---------- 快捷开场 ---------- */
.mjk-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 16px 6px;
  flex: 0 0 auto;
}

.mjk-hint {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(255, 255, 255, .085));
  background: rgba(255, 255, 255, .035);
  color: var(--muted, #93a8bd);
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.mjk-hint:hover {
  color: var(--accent, #7ee8fa);
  border-color: rgba(126, 232, 250, .4);
  background: rgba(126, 232, 250, .08);
}

/* ---------- 输入 ---------- */
.mjk-form {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line, rgba(255, 255, 255, .085));
}

.mjk-input {
  flex: 1 1 auto;
  resize: none;
  max-height: 108px;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: var(--radius-sm, 12px);
  border: 1px solid var(--line, rgba(255, 255, 255, .085));
  background: rgba(255, 255, 255, .04);
  color: var(--text, #e9f2fa);
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  outline: none;
  transition: border-color .2s ease, background .2s ease;
}

.mjk-input::placeholder { color: rgba(147, 168, 189, .7); }

.mjk-input:focus {
  border-color: rgba(126, 232, 250, .42);
  background: rgba(126, 232, 250, .05);
}

.mjk-send {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm, 12px);
  border: 1px solid rgba(126, 232, 250, .34);
  background: linear-gradient(160deg, rgba(126, 232, 250, .22), rgba(77, 124, 255, .2));
  color: var(--accent, #7ee8fa);
  cursor: pointer;
  transition: transform .2s var(--ease, cubic-bezier(.22, .61, .36, 1)),
              box-shadow .2s ease, opacity .2s ease;
}

.mjk-send svg { width: 18px; height: 18px; }

.mjk-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(126, 232, 250, .24);
}

.mjk-send:disabled {
  opacity: .38;
  cursor: not-allowed;
}

/* ---------- 小屏 ---------- */
@media (max-width: 560px) {
  .mjk-fab { right: 14px; bottom: 14px; width: 52px; height: 52px; }

  .mjk-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: calc(100vh - 0px);
    height: calc(100dvh - 0px);
    border-radius: var(--radius, 20px) var(--radius, 20px) 0 0;
    border-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mjk-fab, .mjk-panel, .mjk-msg { transition: none !important; animation: none !important; }
  .mjk-caret::after { animation: none; }
}


/* ============================================================
   认主人：钥匙按钮 + 暗号弹层（2026-11-14 墨鲸加）
   除了链接里的 #m=token，也能在面板头部点钥匙、手动输密码。
   ============================================================ */

/* 头部那把钥匙 */
.mjk-claim {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  margin-right: 2px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(200, 220, 235, .5);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color .2s ease, background .2s ease;
}
.mjk-claim:hover {
  color: rgb(126, 232, 250);
  background: rgba(126, 232, 250, .1);
}
.mjk-claim svg {
  width: 15px;
  height: 15px;
}

/* 弹层 */
.mjk-claim-box {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(4, 8, 14, .74);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.mjk-claim-box.is-on {
  display: grid;
}

.mjk-claim-panel {
  width: 100%;
  max-width: 320px;
  padding: 1.5rem 1.4rem 1.2rem;
  border-radius: 16px;
  background: rgba(14, 22, 32, .97);
  border: 1px solid rgba(126, 232, 250, .22);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .7);
  animation: mjkClaimIn .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes mjkClaimIn {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.mjk-claim-title {
  font-size: 1rem;
  font-weight: 600;
  color: #e6eef5;
  margin-bottom: .35rem;
}
.mjk-claim-sub {
  font-size: .78rem;
  color: #7f929f;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.mjk-claim-input {
  width: 100%;
  box-sizing: border-box;
  padding: .6rem .85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(0, 0, 0, .3);
  color: #e6eef5;
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s ease;
}
.mjk-claim-input:focus {
  border-color: rgba(126, 232, 250, .5);
}

.mjk-claim-err {
  min-height: 1.1rem;
  margin: .45rem 0 .2rem;
  font-size: .76rem;
  color: #ff8fa3;
}

.mjk-claim-actions {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  margin-top: .5rem;
}
.mjk-claim-actions button {
  padding: .48rem 1.1rem;
  border-radius: 9px;
  font-size: .84rem;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s ease, opacity .2s ease;
}
.mjk-claim-cancel {
  border: 1px solid rgba(255, 255, 255, .12);
  background: transparent;
  color: #8b9dab;
}
.mjk-claim-cancel:hover {
  background: rgba(255, 255, 255, .06);
}
.mjk-claim-ok {
  border: 1px solid rgba(126, 232, 250, .4);
  background: rgba(126, 232, 250, .16);
  color: #7ee8fa;
}
.mjk-claim-ok:hover {
  background: rgba(126, 232, 250, .26);
}
.mjk-claim-ok:disabled {
  opacity: .45;
  cursor: default;
}

/* 手机上稍微宽一点，手指好点 */
@media (max-width: 480px) {
  .mjk-claim-panel {
    max-width: none;
    width: 100%;
  }
}


/* ============ 对话气泡里的 Markdown 样式 ============
   2026-11-19 墨鲸加。只在墨鲸的回复上生效（.is-md）。

   .mjk-msg 原本用 white-space 或者纯文本，这里把内层元素的行高、间距收紧，
   别让 markdown 一上就把气泡撑得很大。
   */
.mjk-msg.is-md {
  line-height: 1.62;
}
.mjk-msg.is-md .md-p {
  margin: 0;
}
.mjk-msg.is-md .md-p + .md-p,
.mjk-msg.is-md .md-p + ul,
.mjk-msg.is-md .md-p + ol,
.mjk-msg.is-md .md-p + blockquote,
.mjk-msg.is-md .md-p + pre {
  margin-top: .35em;
}

.mjk-msg.is-md strong {
  color: #eaf4fb;
  font-weight: 600;
}
.mjk-msg.is-md em {
  font-style: italic;
  color: #cfe1ec;
}
.mjk-msg.is-md del {
  opacity: .6;
}

.mjk-msg.is-md code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .1);
  font-family: ui-monospace, Consolas, "Cascadia Code", monospace;
  font-size: .88em;
}
.mjk-msg.is-md pre {
  margin: .4em 0;
  padding: .6em .75em;
  border-radius: 8px;
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .08);
  overflow-x: auto;
}
.mjk-msg.is-md pre code {
  padding: 0;
  background: transparent;
  font-size: .84em;
  line-height: 1.55;
}

.mjk-msg.is-md ul,
.mjk-msg.is-md ol {
  margin: .3em 0;
  padding-left: 1.25em;
}
.mjk-msg.is-md li {
  margin: .18em 0;
}

.mjk-msg.is-md blockquote {
  margin: .35em 0;
  padding-left: .7em;
  border-left: 2px solid rgba(126, 232, 250, .4);
  color: #a9bcc9;
}

.mjk-msg.is-md a {
  color: #7ee8fa;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mjk-msg.is-md a:hover {
  color: #b6f2ff;
}

/* ============================================================
   墨鲸 2026-12-01：认主人弹层定位兜底
   有些手机浏览器不认 inset 简写，导致 fixed 退化成文档流，
   弹层漏在页面最下面。这里补上四个方向的显式值。
   ============================================================ */
.mjk-claim-box {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  display: none;
  z-index: 10002 !important;
  overflow: auto;
}

.mjk-claim-box.is-on {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* 弹层内部再兜一层，防止手机把面板挤扁 */
.mjk-claim-box.is-on .mjk-claim-panel {
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}