@font-face { font-family: "Space Grotesk"; font-weight: 500; src: url("fonts/SpaceGrotesk-500.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Space Grotesk"; font-weight: 600; src: url("fonts/SpaceGrotesk-600.woff2") format("woff2"); font-display: swap; }

:root {
  --bg: #0a0c0a;
  --bg-2: #121512;
  --panel: rgba(26, 30, 26, 0.72);
  --ink: #e8ede2;
  --sub: #a4ab9f;
  --dim: #6b7268;
  --line: rgba(232, 237, 226, 0.12);
  --glass: rgba(20, 24, 20, 0.55);
  --accent: #7fe0cf;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", system-ui, sans-serif;
  --brand: "Space Grotesk", var(--sans);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.7 var(--sans); overflow-x: hidden;
}
a { color: inherit; }

/* ---- 背景沙粒 ---- */
#sand { position: fixed; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; }
.scrim {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 78%, transparent) 0%, transparent 34%, color-mix(in srgb, var(--bg) 66%, transparent) 100%);
}

/* ---- 顶栏 ---- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(20px, 5vw, 72px);
  background: color-mix(in srgb, var(--bg) 66%, transparent);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.logo { font: 600 22px/1 var(--brand); letter-spacing: -0.01em; text-decoration: none; cursor: pointer; transition: color 0.2s; }
.logo:hover { color: var(--accent); }
.logo small { font: 500 11px/1 var(--brand); letter-spacing: 0.24em; color: var(--sub); margin-left: 8px; vertical-align: 3px; }
.badge {
  font: 500 12px/1 var(--brand); letter-spacing: 0.14em; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 999px; padding: 7px 14px;
}

/* ---- 聊天 ---- */
main { position: relative; z-index: 2; }
.chat { max-width: 820px; margin: 0 auto; padding: 96px 20px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.messages { flex: 1; display: flex; flex-direction: column; gap: 18px; }

.msg { max-width: 78%; padding: 13px 17px; border-radius: 16px; line-height: 1.75; font-size: 16px; white-space: pre-wrap; word-break: break-word; }
.msg.ai { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-top-left-radius: 5px; backdrop-filter: blur(10px); }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--bg); border-top-right-radius: 5px; }
.msg p { margin: 0 0 0.7em; }
.msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 0.4em 0 0.7em; padding-left: 1.3em; }
.msg li { margin: 0.25em 0; }
.msg strong { color: var(--accent); }
.msg.user strong { color: inherit; }
.msg code { font-family: var(--brand); font-size: 0.9em; background: var(--line); padding: 1px 6px; border-radius: 6px; }
.msg pre { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow: auto; font-size: 14px; }

/* 欢迎块 */
.welcome { align-self: stretch; text-align: center; padding: 40px 12px 12px; }
.welcome .kicker { font: 500 12px/1 var(--brand); letter-spacing: 0.26em; color: var(--accent); text-transform: uppercase; }
.welcome h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.12; letter-spacing: -0.02em; font-weight: 700; margin: 18px 0 0; }
.welcome h1 .brand { font-family: var(--brand); font-weight: 600; letter-spacing: -0.03em; }
.welcome p { color: #c9cfc3; margin: 16px auto 0; max-width: 30em; }
.welcome p.stat { color: var(--dim); font-size: 13px; margin-top: 12px; letter-spacing: 0.03em; }
.mode { display: flex; gap: 14px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.mode button {
  appearance: none; border: 1px solid var(--line); background: var(--glass); color: var(--ink);
  border-radius: 16px; padding: 18px 22px; cursor: pointer; text-align: left; font: inherit;
  backdrop-filter: blur(12px); transition: border-color 0.2s, transform 0.2s; max-width: 260px;
}
.mode button:hover { border-color: var(--accent); transform: translateY(-2px); }
.mode button b { display: block; font-size: 17px; }
.mode button span { display: block; color: var(--dim); font-size: 13px; line-height: 1.5; margin-top: 6px; }

/* 正在输入 */
.typing { align-self: flex-start; display: inline-flex; gap: 6px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; border-top-left-radius: 5px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--sub); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ---- 输入 ---- */
.composer {
  display: flex; gap: 12px; align-items: flex-end; margin-top: 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 12px;
  backdrop-filter: blur(12px);
}
.composer textarea {
  flex: 1; background: transparent; color: var(--ink); border: 0; resize: none;
  font: 16px/1.6 var(--sans); max-height: 160px; padding: 8px 4px; outline: none;
}
.composer textarea::placeholder { color: var(--dim); }
.composer button {
  appearance: none; border: 0; cursor: pointer; border-radius: 12px; padding: 12px 20px;
  font: 600 15px/1 var(--sans); background: var(--ink); color: var(--bg); flex: none;
  transition: opacity 0.2s;
}
.composer button:disabled { opacity: 0.4; cursor: default; }
.gzh {
  display: flex; align-items: center; gap: 14px; margin-top: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px; text-decoration: none; backdrop-filter: blur(12px);
  transition: border-color 0.2s;
}
.gzh:hover { border-color: var(--accent); }
.gzh-icon { width: 48px; height: 48px; border-radius: 12px; flex: none; object-fit: cover; background: var(--bg-2); }
.gzh-text { flex: 1; min-width: 0; }
.gzh-text b { display: block; font-size: 16px; }
.gzh-text b .gzh-note { font-size: 12px; color: var(--dim); font-weight: 400; margin-left: 6px; }
.gzh-text span { display: block; color: var(--sub); font-size: 13px; line-height: 1.5; margin-top: 2px; }
.gzh-arrow { color: var(--accent); font-family: var(--brand); font-size: 20px; flex: none; }
.foot { text-align: center; color: var(--dim); font-size: 12px; margin-top: 16px; }
.foot.icp { margin-top: 6px; }
.foot.icp a { color: var(--dim); text-decoration: none; }
.foot.icp a:hover { color: var(--sub); }
.sessions { width: 100%; max-width: 520px; margin: 32px auto 0; display: flex; flex-direction: column; gap: 10px; }
.sessions-title { font: 500 12px/1 var(--brand); letter-spacing: 0.2em; color: var(--dim); text-transform: uppercase; margin-bottom: 2px; }
.session-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); background: var(--glass); color: var(--ink);
  border-radius: 14px; padding: 14px 16px; cursor: pointer; text-align: left; font: inherit;
  backdrop-filter: blur(12px); transition: border-color 0.2s;
}
.session-item:hover { border-color: var(--accent); }
.session-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.session-time { color: var(--dim); font-size: 12px; flex: none; }

@media (max-width: 640px) {
  .msg { max-width: 88%; }
  .mode { flex-direction: column; align-items: stretch; }
  .mode button { max-width: none; }
}

/* ---- 公众号图标放大弹窗 ---- */
.gzh-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.gzh-modal[hidden] { display: none; }
.gzh-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(6, 8, 6, 0.78);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.gzh-modal-card {
  position: relative; z-index: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px 26px 26px;
  text-align: center;
  max-width: 340px; width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.gzh-modal-close {
  position: absolute; top: 8px; right: 10px;
  border: 0; background: transparent; color: var(--sub);
  font-size: 28px; line-height: 1; cursor: pointer; padding: 4px 10px;
  transition: color 0.2s;
}
.gzh-modal-close:hover { color: var(--accent); }
.gzh-modal-img {
  width: 240px; height: 240px;
  object-fit: contain;
  background: #fff; border-radius: 14px;
}
.gzh-modal-text {
  margin: 18px 0 0; color: var(--ink); font-size: 16px; line-height: 1.6;
}
.gzh-modal-text strong { color: var(--accent); }
