/* 品名网 AI 功能样式（取名 / 八字 / 运势 / 星座 / AI解惑 / 今日批卦）
   文件名带版本号，CDN 下更新样式时改名即可绕过缓存 */
:root {
  --pm-primary: #666633;
  --pm-primary-dark: #4d4d26;
  --pm-gold: #c99a2e;
  --pm-gold-light: #fff6dc;
  --pm-ink: #1f2328;
  --pm-muted: #6b7280;
  --pm-line: #e7e5dc;
  --pm-bg: #faf8f1;
  --pm-ai-a: #ff3b30;
  --pm-ai-b: #ff8a00;
}

/* ---------- AI 角标 ---------- */
.pm-ai-badge,
.pm-tab-ai {
  display: inline-block;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .02em;
  color: #fff;
  background: linear-gradient(135deg, var(--pm-ai-a), var(--pm-ai-b));
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(255, 59, 48, .45);
  line-height: 1;
}
.pm-ai-badge {
  font-size: 10px;
  padding: 2px 4px;
  margin-left: 3px;
  vertical-align: 8px;
}
nav .pm-nav-ai > a { position: relative; }
nav .pm-nav-pigua > a { color: #ffe08a; font-weight: 700; }

/* 手机抽屉菜单中的 AI 项 */
.drawer .pm-nav-ai a, .drawer .pm-nav-pigua a { font-weight: 700; color: var(--pm-primary); }

/* ---------- 手机底部标签栏 ---------- */
.pm-tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, .97);
  border-top: 1px solid var(--pm-line);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, .06);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
}
.pm-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 56px;
  color: #8a8a80;
  font-size: 12px;
  -webkit-tap-highlight-color: transparent;
}
.pm-tab:hover { color: var(--pm-primary); }
.pm-tab.is-active { color: var(--pm-primary); font-weight: 700; }
.pm-tab-icon { position: relative; display: block; width: 26px; height: 26px; margin-bottom: 2px; }
.pm-tab-icon svg {
  width: 26px; height: 26px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.pm-tab.is-active .pm-tab-icon svg { stroke-width: 2.1; }
.pm-tab-ai {
  position: absolute;
  top: -5px; right: -15px;
  font-size: 9px;
  padding: 2px 4px;
  border: 1.5px solid #fff;
  animation: pm-pulse 2.4s ease-in-out infinite;
}
@keyframes pm-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
@media (max-width: 1023.98px) {
  body.pm-has-tabbar { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
}
@media (min-width: 1024px) {
  .pm-tabbar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pm-tab-ai { animation: none; }
}

/* ---------- 工具页 ---------- */
.pm-hero {
  position: relative;
  overflow: hidden;
  border-radius: .5rem;
  padding: 1.25rem 1rem 1.1rem;
  margin-bottom: .75rem;
  color: #fff;
  background:
    radial-gradient(circle at 92% 12%, rgba(255, 214, 120, .35) 0, rgba(255, 214, 120, 0) 42%),
    linear-gradient(135deg, #55552a 0%, var(--pm-primary) 55%, #8a7a35 100%);
}
.pm-hero::after {
  content: "";
  position: absolute;
  right: -30px; bottom: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  border: 18px solid rgba(255, 255, 255, .07);
}
.pm-hero h1 { font-size: 1.5rem; line-height: 2rem; font-weight: 800; color: #fff; display: flex; align-items: center; gap: .4rem; }
.pm-hero h1 .pm-ai-badge { font-size: 12px; padding: 3px 6px; vertical-align: 0; margin: 0; }
.pm-hero p { margin-top: .4rem; font-size: .9rem; line-height: 1.6; color: rgba(255, 255, 255, .88); position: relative; z-index: 1; }
.pm-hero .pm-points { margin-top: .7rem; display: flex; flex-wrap: wrap; gap: .4rem; position: relative; z-index: 1; }
.pm-hero .pm-points li { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff; }
@media (min-width: 1024px) {
  .pm-hero { padding: 1.75rem 1.5rem 1.5rem; margin-bottom: 1.25rem; }
  .pm-hero h1 { font-size: 1.875rem; line-height: 2.4rem; }
}

.pm-form { display: grid; grid-template-columns: 1fr; gap: .85rem; }
@media (min-width: 640px) { .pm-form { grid-template-columns: 1fr 1fr; } }
.pm-field { display: flex; flex-direction: column; gap: .35rem; }
.pm-field.is-wide { grid-column: 1 / -1; }
.pm-field > label, .pm-field > .pm-label { font-size: .875rem; font-weight: 700; color: var(--pm-ink); }
.pm-field > label em, .pm-field > .pm-label em { color: #d23b2a; font-style: normal; margin-left: 2px; }
.pm-field small { font-size: 12px; color: var(--pm-muted); }
.pm-input {
  width: 100%;
  height: 42px;
  padding: 0 .75rem;
  border: 1px solid #d9d6c8;
  border-radius: .4rem;
  background: #fff;
  color: var(--pm-ink);
  font-size: 16px; /* 防止 iOS 聚焦放大 */
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
select.pm-input {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6rem center;
  background-size: 16px;
  padding-right: 2rem;
}
.pm-input:focus { border-color: var(--pm-primary); box-shadow: 0 0 0 3px rgba(102, 102, 51, .15); }
.pm-input.pm-char { font-size: 28px; height: 60px; text-align: center; letter-spacing: .3em; font-family: "STKaiti", "KaiTi", "楷体", serif; }

.pm-seg { display: flex; gap: .4rem; flex-wrap: wrap; }
.pm-seg label { position: relative; cursor: pointer; }
.pm-seg input { position: absolute; opacity: 0; pointer-events: none; }
.pm-seg span {
  display: inline-block;
  min-width: 3.6rem;
  padding: .45rem .8rem;
  text-align: center;
  font-size: .875rem;
  border: 1px solid #d9d6c8;
  border-radius: .4rem;
  background: #fff;
  color: #555;
  transition: all .15s;
}
.pm-seg input:checked + span { border-color: var(--pm-primary); background: var(--pm-primary); color: #fff; font-weight: 700; }
.pm-seg input:focus-visible + span { box-shadow: 0 0 0 3px rgba(102, 102, 51, .25); }

.pm-actions { grid-column: 1 / -1; display: flex; flex-direction: column; gap: .5rem; margin-top: .25rem; }
.pm-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  height: 48px;
  border-radius: .5rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--pm-primary-dark), var(--pm-primary) 60%, #8a7a35);
  box-shadow: 0 6px 16px rgba(102, 102, 51, .28);
  transition: transform .1s, opacity .15s;
}
.pm-btn:active { transform: translateY(1px); }
.pm-btn[disabled] { opacity: .65; cursor: wait; }
.pm-btn .pm-ai-badge { vertical-align: 0; margin: 0; font-size: 11px; padding: 3px 6px; }
.pm-btn-ghost {
  height: 38px; padding: 0 1rem; border-radius: .4rem;
  border: 1px solid var(--pm-line); background: #fff; color: var(--pm-primary); font-weight: 700; font-size: .875rem;
}
.pm-tip { font-size: 12px; color: var(--pm-muted); text-align: center; }
.pm-error { display: none; font-size: .875rem; color: #c2321f; background: #fdeeec; border-radius: .4rem; padding: .5rem .75rem; }
.pm-error.is-show { display: block; }

/* 结果 */
.pm-result { display: none; scroll-margin-top: 12px; }
.pm-result.is-show { display: block; }
.pm-result-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-bottom: .6rem; border-bottom: 1px dashed var(--pm-line); margin-bottom: .6rem; }
.pm-result-head h2 { font-size: 1.125rem; font-weight: 800; color: var(--pm-ink); display: flex; align-items: center; gap: .4rem; }
.pm-result-head h2 .pm-ai-badge { vertical-align: 0; margin: 0; }
.pm-result-tools { display: none; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.pm-result.is-done .pm-result-tools { display: flex; }
.pm-loading { display: flex; align-items: center; gap: .6rem; color: var(--pm-primary); font-size: .9rem; padding: .5rem 0; }
.pm-result.is-done .pm-loading { display: none; }
.pm-bagua {
  width: 26px; height: 26px; border-radius: 50%;
  background: conic-gradient(var(--pm-primary) 0 50%, #e9e4cc 50% 100%);
  position: relative;
  animation: pm-spin 1.4s linear infinite;
}
.pm-bagua::before, .pm-bagua::after {
  content: ""; position: absolute; left: 50%; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%;
}
.pm-bagua::before { top: 0; background: #e9e4cc; box-shadow: inset 0 0 0 4.5px #e9e4cc, inset 0 0 0 6.5px var(--pm-primary); }
.pm-bagua::after { bottom: 0; background: var(--pm-primary); box-shadow: inset 0 0 0 4.5px var(--pm-primary), inset 0 0 0 6.5px #e9e4cc; }
@keyframes pm-spin { to { transform: rotate(360deg); } }

/* Markdown 正文 */
.pm-md { color: #374151; line-height: 1.9; font-size: .975rem; word-break: break-word; }
.pm-md h3 {
  margin: 1.1rem 0 .4rem;
  padding-left: .6rem;
  border-left: 4px solid var(--pm-gold);
  font-size: 1.08rem; font-weight: 800; color: var(--pm-ink); line-height: 1.5;
}
.pm-md h3:first-child { margin-top: .2rem; }
.pm-md h4 { margin: .8rem 0 .3rem; font-weight: 800; color: var(--pm-primary); }
.pm-md p { margin: .45rem 0; }
.pm-md ul, .pm-md ol { margin: .35rem 0 .5rem; padding-left: 1.3rem; }
.pm-md ul { list-style: disc; }
.pm-md ol { list-style: decimal; }
.pm-md li { margin: .2rem 0; }
.pm-md strong { color: #7a4b00; background: linear-gradient(transparent 62%, #ffe9a8 62%); font-weight: 800; }
.pm-md hr { border-top: 1px dashed var(--pm-line); margin: .8rem 0; }
.pm-md blockquote { margin: .5rem 0; padding: .4rem .8rem; background: var(--pm-gold-light); border-radius: .3rem; color: #6b5420; }
.pm-cursor::after { content: "▍"; color: var(--pm-gold); animation: pm-blink 1s steps(1) infinite; }
/* 光标跟在最后一段文字末尾，而不是另起一行（不支持 :has 的旧浏览器保持上面的写法） */
@supports selector(:has(a)) {
  .pm-cursor:has(> p:last-child, > ul:last-child, > ol:last-child)::after { content: none; }
  .pm-cursor > p:last-child::after, .pm-cursor > ul:last-child > li:last-child::after, .pm-cursor > ol:last-child > li:last-child::after {
    content: "▍"; color: var(--pm-gold); animation: pm-blink 1s steps(1) infinite;
  }
}
@keyframes pm-blink { 50% { opacity: 0; } }

/* SEO 说明 / FAQ */
.pm-intro { color: #4b5563; line-height: 1.95; font-size: .95rem; }
.pm-intro p + p { margin-top: .5rem; }
.pm-intro h2 { font-size: 1.1rem; font-weight: 800; color: var(--pm-ink); margin: .2rem 0 .5rem; }
.pm-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .75rem; counter-reset: pm; }
.pm-steps li { counter-increment: pm; background: var(--pm-bg); border-radius: .4rem; padding: .6rem .5rem; text-align: center; font-size: .82rem; color: #555; }
.pm-steps li::before { content: counter(pm); display: block; margin: 0 auto .25rem; width: 22px; height: 22px; line-height: 22px; border-radius: 50%; background: var(--pm-primary); color: #fff; font-weight: 800; font-size: 12px; }
.pm-faq details { border-bottom: 1px dashed var(--pm-line); padding: .55rem 0; }
.pm-faq details:last-child { border-bottom: 0; }
.pm-faq summary { cursor: pointer; font-weight: 700; color: var(--pm-ink); list-style: none; display: flex; justify-content: space-between; gap: .5rem; }
.pm-faq summary::-webkit-details-marker { display: none; }
.pm-faq summary::after { content: "+"; color: var(--pm-primary); font-weight: 800; }
.pm-faq details[open] summary::after { content: "−"; }
.pm-faq details p { margin-top: .35rem; color: #555; line-height: 1.85; font-size: .925rem; }

/* 列表 */
.pm-list li { padding: .35rem 0; line-height: 1.6; border-bottom: 1px dashed #e5e7eb; }
.pm-list li:last-child { border-bottom: 0; }
.pm-list a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-list a::before { content: "卦"; display: inline-block; margin-right: .4rem; padding: 0 4px; font-size: 11px; line-height: 16px; border-radius: 3px; color: var(--pm-primary); border: 1px solid currentColor; vertical-align: 1px; }
.pm-more { font-size: .875rem; font-weight: 400; margin-left: auto; color: var(--pm-muted); }

/* 其它工具入口（文章页 / 栏目页 / 工具页） */
.pm-cta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.pm-cta-grid > .pm-cta:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 768px) { .pm-cta-grid { grid-template-columns: repeat(5, 1fr); } .pm-cta-grid > .pm-cta:last-child:nth-child(odd) { grid-column: auto; } }
.pm-cta {
  position: relative;
  display: block;
  padding: .8rem .75rem;
  border-radius: .5rem;
  border: 1px solid var(--pm-line);
  background: linear-gradient(180deg, #fff, var(--pm-bg));
  transition: border-color .15s, transform .15s;
}
.pm-cta:hover { border-color: var(--pm-primary); transform: translateY(-1px); text-decoration: none; }
.pm-cta b { display: block; color: var(--pm-ink); font-size: 1rem; }
.pm-cta span { display: block; margin-top: .15rem; font-size: 12px; color: var(--pm-muted); line-height: 1.5; }
.pm-cta .pm-ai-badge { position: absolute; top: 8px; right: 8px; margin: 0; vertical-align: 0; }
.pm-cta.is-main { border-color: var(--pm-primary); background: linear-gradient(180deg, #fffdf4, var(--pm-gold-light)); }
.pm-disclaimer { margin-top: .75rem; font-size: 12px; color: #9ca3af; line-height: 1.7; }
.pm-lead { font-size: 1.02rem; line-height: 2; color: #374151; }

/* ---------- AI解惑：ChatGPT 式聊天 ---------- */
.pm-chatapp {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  height: calc(100vh - 150px);
  height: calc(100dvh - 140px - env(safe-area-inset-bottom));
  min-height: 440px;
  background: #fff;
  border: 1px solid var(--pm-line);
  border-radius: .75rem;
  overflow: hidden;
}
@media (min-width: 1024px) {
  .pm-chatapp { grid-template-columns: 250px minmax(0, 1fr); height: clamp(560px, calc(100vh - 200px), 860px); }
}

/* 侧栏：历史对话 */
.pm-chat-side {
  display: flex; flex-direction: column; gap: .5rem; min-height: 0;
  padding: .85rem .7rem; background: var(--pm-bg); border-right: 1px solid var(--pm-line);
}
.pm-chat-newbtn {
  display: flex; align-items: center; justify-content: center; gap: .35rem;
  height: 40px; border-radius: .6rem; font-weight: 700; font-size: .9rem;
  color: var(--pm-primary-dark); background: #fff; border: 1px solid var(--pm-line); cursor: pointer;
}
.pm-chat-newbtn:hover { border-color: var(--pm-primary); }
.pm-chat-newbtn svg, .pm-chat-icon svg, .pm-send svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.pm-chat-side-title { margin-top: .4rem; padding: 0 .35rem; font-size: 12px; color: var(--pm-muted); }
.pm-chat-hist { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.pm-chat-hist li { position: relative; border-radius: .5rem; }
.pm-chat-hist li:hover, .pm-chat-hist li.is-active { background: #efece0; }
.pm-hist-open { display: block; width: 100%; text-align: left; padding: .5rem 1.9rem .5rem .55rem; background: none; border: 0; cursor: pointer; }
.pm-hist-open b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .875rem; font-weight: 500; color: var(--pm-ink); }
.pm-hist-open small { display: block; font-size: 11px; color: var(--pm-muted); }
.pm-hist-del {
  position: absolute; top: 50%; right: .3rem; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%; border: 0; background: none;
  color: #a1a1aa; font-size: 16px; line-height: 1; cursor: pointer; opacity: 0;
}
.pm-chat-hist li:hover .pm-hist-del, .pm-chat-hist li.is-active .pm-hist-del { opacity: 1; }
.pm-hist-del:hover { background: #e4e0d0; color: #b42318; }
.pm-chat-hist-empty { padding: .5rem .55rem; font-size: 13px; color: var(--pm-muted); }
.pm-chat-side-tip { font-size: 11px; color: #a1a1aa; padding: 0 .35rem; }
.pm-chat-mask { display: none; }

@media (max-width: 1023px) {
  .pm-chat-side {
    position: absolute; z-index: 5; top: 0; bottom: 0; left: 0; width: min(78%, 290px);
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: 4px 0 18px rgba(0, 0, 0, .08);
  }
  .pm-chatapp.is-side .pm-chat-side { transform: none; }
  .pm-chatapp.is-side .pm-chat-mask { display: block; position: absolute; inset: 0; z-index: 4; background: rgba(0, 0, 0, .25); }
  .pm-hist-del { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .pm-chat-side { transition: none; } }

/* 主区域 */
.pm-chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pm-chat-bar { display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; border-bottom: 1px solid var(--pm-line); }
.pm-chat-title { flex: 1; min-width: 0; text-align: center; }
.pm-chat-title h1 { margin: 0; font-size: 1.05rem; line-height: 1.4; font-weight: 800; color: var(--pm-ink); }
.pm-chat-title small { display: block; font-size: 11px; color: var(--pm-muted); }
.pm-chat-icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: .5rem; border: 0; background: none; color: var(--pm-primary-dark); cursor: pointer;
}
.pm-chat-icon:hover { background: var(--pm-bg); }
@media (min-width: 1024px) { .pm-chat-menu { visibility: hidden; } }

.pm-chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1rem .9rem .5rem; }
.pm-chat-list, .pm-chat-empty, .pm-chat-bottom > * { max-width: 760px; margin-left: auto; margin-right: auto; }

/* 空状态 */
.pm-chat-empty { padding: 4vh 0 1rem; text-align: center; }
.pm-chat-empty[hidden] { display: none; }
.pm-chat-logo {
  display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%;
  color: #fff; font-size: 1.3rem; font-weight: 800; background: linear-gradient(135deg, var(--pm-primary-dark), var(--pm-gold));
}
.pm-chat-empty h2 { margin: .7rem 0 .35rem; font-size: 1.35rem; font-weight: 800; color: var(--pm-ink); }
.pm-chat-empty p { margin: 0 auto 1.1rem; max-width: 34em; font-size: .875rem; line-height: 1.8; color: var(--pm-muted); }
.pm-chat-suggest { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; text-align: left; }
.pm-chat-suggest button {
  text-align: left; padding: .65rem .75rem; border-radius: .7rem; border: 1px solid var(--pm-line); background: #fff; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pm-chat-suggest button:hover { border-color: var(--pm-primary); background: #fffdf4; }
.pm-chat-suggest b { display: block; font-size: .875rem; color: var(--pm-ink); }
.pm-chat-suggest span { display: block; margin-top: .15rem; font-size: 12px; color: var(--pm-muted); }

/* 消息 */
.pm-m { display: flex; margin-bottom: 1.15rem; }
.pm-m.is-user { justify-content: flex-end; }
.pm-m.is-user .pm-m-body {
  max-width: 82%; padding: .55rem .9rem; border-radius: 1.1rem; border-bottom-right-radius: .3rem;
  background: #f0eee4; color: var(--pm-ink); font-size: .9375rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
}
.pm-m.is-ai { gap: .65rem; }
.pm-m-avatar {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-top: .15rem;
  border-radius: 50%; color: #fff; font-size: .8rem; font-weight: 800;
  background: linear-gradient(135deg, var(--pm-primary-dark), var(--pm-gold));
}
.pm-m-col { flex: 1; min-width: 0; }
.pm-m.is-ai .pm-m-body { font-size: .9375rem; line-height: 1.85; color: #2b2f36; word-break: break-word; }
.pm-m.is-ai .pm-m-body p { margin: 0 0 .55rem; }
.pm-m.is-ai .pm-m-body > :last-child { margin-bottom: 0; }
.pm-m.is-ai .pm-m-body h3, .pm-m.is-ai .pm-m-body h4 { margin: .7rem 0 .35rem; font-size: 1rem; }
.pm-m.is-ai .pm-m-body ul, .pm-m.is-ai .pm-m-body ol { margin: .2rem 0 .6rem; padding-left: 1.3rem; }
.pm-m-acts { margin-top: .3rem; }
.pm-m-acts[hidden] { display: none; }
.pm-m-acts button { padding: .15rem .5rem; border: 0; border-radius: .35rem; background: none; font-size: 12px; color: var(--pm-muted); cursor: pointer; }
.pm-m-acts button:hover { background: var(--pm-bg); color: var(--pm-primary-dark); }
.pm-msg-err { color: #b42318; }
.pm-typing { display: inline-flex; gap: 4px; padding: .5rem 0; margin: 0; }
.pm-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--pm-gold); animation: pm-dot 1.2s infinite ease-in-out; }
.pm-typing i:nth-child(2) { animation-delay: .2s; }
.pm-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes pm-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .pm-typing i { animation: none; opacity: .7; } }

/* 输入区 */
.pm-chat-bottom { padding: .35rem .9rem .6rem; }
.pm-chat-bottom .pm-error { margin-bottom: .45rem; }
.pm-composer {
  display: flex; align-items: flex-end; gap: .5rem; padding: .4rem .4rem .4rem .95rem;
  border: 1px solid #dcd8c8; border-radius: 1.4rem; background: #fff; box-shadow: 0 4px 18px rgba(60, 60, 30, .07);
  transition: border-color .15s, box-shadow .15s;
}
.pm-composer:focus-within { border-color: var(--pm-primary); box-shadow: 0 4px 20px rgba(102, 102, 51, .14); }
.pm-composer textarea {
  flex: 1; min-width: 0; height: 36px; max-height: 160px; padding: .4rem 0; border: 0; outline: none; resize: none;
  background: transparent; font-size: 16px; line-height: 1.6; color: var(--pm-ink);
}
.pm-send {
  position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; border: 0; color: #fff; background: var(--pm-primary-dark); cursor: pointer;
  transition: background .15s, transform .1s;
}
.pm-send:not(:disabled):hover { background: var(--pm-primary); }
.pm-send:not(:disabled):active { transform: scale(.94); }
.pm-send:disabled { background: #d9d6c8; cursor: not-allowed; }
.pm-send.is-cd svg { display: none; }
.pm-send-cd { font-size: 12px; font-weight: 700; color: #6b6b5a; }
.pm-chat-foot { margin-top: .4rem; text-align: center; font-size: 11px; color: #a1a1aa; }
.pm-chat-count { color: var(--pm-muted); }
.pm-chat-count.is-over { color: #b42318; font-weight: 700; }

/* 八字页：农历生日选择 */
.pm-lunar { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: .4rem; align-items: center; }
.pm-lunar[hidden] { display: none; }
.pm-leap { display: inline-flex; align-items: center; gap: .25rem; font-size: .875rem; color: var(--pm-ink); white-space: nowrap; cursor: pointer; }
.pm-leap input { width: 16px; height: 16px; accent-color: var(--pm-primary); }
@media (max-width: 420px) { .pm-lunar { grid-template-columns: 1fr 1fr 1fr; } .pm-leap { grid-column: 1 / -1; } }

/* ---------- AI解惑：紫微斗数排盘弹窗 ---------- */
.pm-chat-suggest .pm-chat-zw { grid-column: 1 / -1; border-color: #d8c98f; background: linear-gradient(135deg, #fffaf0, #fff); }
.pm-chat-zw b i {
  margin-left: .4rem; padding: 0 .4rem; border-radius: 999px; font-style: normal; font-size: 11px; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, var(--pm-primary-dark), var(--pm-gold)); vertical-align: 2px;
}
html.pm-modal-open { overflow: hidden; }
.pm-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pm-modal[hidden] { display: none; }
.pm-modal-mask { position: absolute; inset: 0; background: rgba(20, 20, 10, .45); }
.pm-modal-box {
  position: relative; display: flex; flex-direction: column; width: min(920px, 100%); max-height: calc(100dvh - 32px);
  background: #fff; border-radius: .9rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); overflow: hidden;
}
.pm-modal-head { display: flex; align-items: center; justify-content: space-between; padding: .7rem .9rem .7rem 1.1rem; border-bottom: 1px solid var(--pm-line); }
.pm-modal-head h2 { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--pm-ink); }
.pm-modal-body { overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1.1rem 1.2rem; }
.pm-zw-form { max-width: 560px; margin: 0 auto; }
.pm-zw-form[hidden], .pm-zw-result[hidden] { display: none; }
@media (max-width: 640px) {
  .pm-modal { padding: 0; align-items: flex-end; }
  .pm-modal-box { width: 100%; max-height: 92dvh; border-radius: .9rem .9rem 0 0; }
  .pm-modal-body { padding: .8rem .6rem 1rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
}

/* 命盘 */
.pm-zw-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(118px, auto));
  gap: 1px; background: #d9d2b4; border: 1px solid #d9d2b4; border-radius: .5rem; overflow: hidden;
}
.pm-zw-cell { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 5px 6px 4px; background: #fff; font-size: 12px; line-height: 1.35; }
.pm-zw-cell.is-ming { background: #fffaea; box-shadow: inset 0 0 0 2px var(--pm-gold); }
.pm-zw-major, .pm-zw-aux { display: flex; flex-wrap: wrap; gap: 1px 6px; }
.pm-zw-s { white-space: nowrap; }
.pm-zw-major .pm-zw-s { font-size: 14px; font-weight: 800; color: #8a1f11; }
.pm-zw-aux .pm-zw-lucky { color: #1f6b3a; font-weight: 600; }
.pm-zw-aux .pm-zw-sha { color: #6b4a1f; font-weight: 600; }
.pm-zw-s small { margin-left: 1px; font-size: 10px; font-weight: 400; color: var(--pm-muted); }
.pm-zw-hua { display: inline-block; margin-left: 2px; padding: 0 2px; border-radius: 3px; font-style: normal; font-size: 10px; font-weight: 700; line-height: 14px; color: #fff; vertical-align: 1px; }
.pm-zw-hua-禄 { background: #2e8b57; } .pm-zw-hua-权 { background: #7a4fc2; } .pm-zw-hua-科 { background: #2b6cb0; } .pm-zw-hua-忌 { background: #c0392b; }
.pm-zw-empty { font-size: 12px; color: #a1a1aa; }
.pm-zw-minor { font-size: 11px; color: #8b8b7a; }
.pm-zw-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: baseline; gap: 4px; padding-top: 3px; border-top: 1px dashed #ece6cf; }
.pm-zw-foot b { font-size: 12px; color: var(--pm-primary-dark); white-space: nowrap; }
.pm-zw-foot b em { margin-left: 2px; padding: 0 3px; border-radius: 3px; font-style: normal; font-size: 10px; color: #fff; background: var(--pm-gold); }
.pm-zw-foot span { font-size: 11px; color: var(--pm-muted); white-space: nowrap; }
.pm-zw-center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px; background: #fbf9f1; text-align: center; font-size: 13px; color: #4a4a3a; }
.pm-zw-center p { margin: 0; }
.pm-zw-title { margin-bottom: 4px; font-size: 1rem; color: var(--pm-primary-dark); }
.pm-zw-note { font-size: 11px; color: #9a6b10; }
.pm-zw-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: .5rem 0 0; font-size: 12px; color: var(--pm-muted); }
.pm-zw-h { margin: 1rem 0 .4rem; font-size: 1rem; font-weight: 800; color: var(--pm-ink); }
.pm-zw-pats { margin: 0; padding: 0; list-style: none; display: grid; gap: .5rem; }
.pm-zw-pats li { padding: .55rem .7rem; border: 1px solid var(--pm-line); border-radius: .5rem; }
.pm-zw-pats b { font-size: .9rem; color: var(--pm-ink); }
.pm-zw-pats p { margin: .2rem 0 0; font-size: 13px; line-height: 1.7; color: #4a4a3a; }
.pm-zw-pats small { display: block; margin-top: .15rem; font-size: 11px; color: #a1a1aa; }
.pm-zw-lv { margin-left: .4rem; padding: 0 .35rem; border-radius: 3px; font-style: normal; font-size: 11px; color: #fff; background: #8b8b7a; }
.pm-zw-lv-excellent { background: #b8860b; } .pm-zw-lv-good { background: #2e8b57; } .pm-zw-lv-caution { background: #c0392b; }
.pm-zw-actions { position: sticky; bottom: -1.2rem; display: flex; gap: .6rem; margin-top: 1rem; padding: .7rem 0 0; background: linear-gradient(transparent, #fff 30%); }
.pm-zw-actions .pm-btn { flex: 1; }
.pm-btn-line { padding: 0 1rem; min-height: 44px; border-radius: .6rem; border: 1px solid var(--pm-line); background: #fff; color: var(--pm-primary-dark); font-weight: 700; cursor: pointer; }
@media (max-width: 640px) {
  .pm-zw-grid { grid-template-rows: repeat(4, minmax(104px, auto)); }
  .pm-zw-cell { padding: 3px 3px 2px; font-size: 10px; }
  .pm-zw-major .pm-zw-s { font-size: 12px; }
  .pm-zw-minor { display: none; } /* 手机上杂耀太多，只显示主星与六吉六煞 */
  .pm-zw-s small { font-size: 9px; }
  .pm-zw-foot { flex-direction: column; align-items: flex-start; gap: 0; }
  .pm-zw-foot span { font-size: 9px; }
  .pm-zw-center { font-size: 11px; padding: 4px; }
  .pm-zw-actions { bottom: -1rem; }
}
