/* 品名网 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; }
@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解惑 聊天 ---------- */
.pm-hero-sm { padding-bottom: 1rem; }
.pm-chat { display: flex; flex-direction: column; gap: .6rem; }
.pm-chat-head { display: flex; align-items: center; gap: .6rem; padding-bottom: .6rem; border-bottom: 1px solid var(--pm-line); }
.pm-chat-head b { display: block; font-size: .95rem; color: var(--pm-ink); }
.pm-chat-head small { display: block; font-size: 12px; color: var(--pm-muted); }
.pm-chat-avatar {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  color: #fff; font-weight: 700; font-size: 1rem;
  background: linear-gradient(135deg, var(--pm-primary-dark), var(--pm-gold));
}
.pm-chat-new { margin-left: auto; flex: none; }
.pm-chat-list {
  display: flex; flex-direction: column; gap: .75rem;
  min-height: 260px; max-height: 62vh; overflow-y: auto;
  padding: .25rem .1rem; overscroll-behavior: contain;
}
.pm-msg { display: flex; }
.pm-msg .pm-md {
  max-width: 88%; padding: .6rem .8rem; border-radius: .75rem;
  font-size: .9375rem; line-height: 1.7; word-break: break-word;
}
.pm-msg .pm-md p { margin: 0 0 .4rem; }
.pm-msg .pm-md p:last-child, .pm-msg .pm-md ul:last-child, .pm-msg .pm-md ol:last-child { margin-bottom: 0; }
.pm-msg .pm-md h3, .pm-msg .pm-md h4 { font-size: 1rem; margin: .4rem 0 .3rem; }
.pm-msg.is-ai .pm-md { background: var(--pm-bg); border: 1px solid var(--pm-line); border-top-left-radius: .2rem; color: var(--pm-ink); }
.pm-msg.is-user { justify-content: flex-end; }
.pm-msg.is-user .pm-md { background: var(--pm-primary); color: #fff; border-top-right-radius: .2rem; white-space: pre-wrap; }
.pm-msg-err { color: #b42318; }
.pm-typing { display: inline-flex; gap: 4px; padding: .35rem 0; margin: 0; }
.pm-typing i { width: 6px; height: 6px; 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-quick { display: flex; flex-wrap: wrap; gap: .4rem; }
.pm-chat-quick button {
  border: 1px solid var(--pm-line); background: #fff; color: var(--pm-primary-dark);
  border-radius: 999px; padding: .3rem .75rem; font-size: 13px; cursor: pointer;
}
.pm-chat-quick button:hover { border-color: var(--pm-primary); background: var(--pm-gold-light); }
.pm-chat-form { display: flex; gap: .5rem; align-items: stretch; }
.pm-chat-form textarea { flex: 1; height: auto; min-height: 48px; max-height: 120px; resize: none; line-height: 1.5; padding-top: .6rem; padding-bottom: .6rem; }
.pm-chat-form .pm-btn { flex: none; width: auto; padding: 0 1.25rem; margin: 0; }
