:root {
  /* 字体：标题用几何无衬线（Futura 一类），正文用苹方 */
  --title-font: "Futura", "Avenir Next", "Century Gothic", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --body-font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --ink: #333;
  --text: #777;
  --muted: #999;
  --line: #e6e6e6;
  --accent: #000;
  --red: #d93025;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--body-font);
  color: var(--text);
  background: #fff;
  font-size: 15px;
  line-height: 2;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { opacity: .45; cursor: default; }
[hidden] { display: none !important; }

/* ---------- 第一屏：封面 ---------- */
.splash {
  height: 100vh; height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; background: #fbfbfb; text-align: center; padding: 0 16px;
}
.splash-title {
  margin: 0; font-family: var(--title-font); font-weight: 400;
  font-size: clamp(40px, 6vw, 60px); line-height: 1.2; color: #000; letter-spacing: .04em;
}
.splash-sub {
  margin: 1.6em 0 0; min-height: 1.6em; font-size: 14px; line-height: 1.6;
  color: #999; letter-spacing: .5em; padding-left: .5em; white-space: nowrap;
}
.caret {
  display: inline-block; width: 1px; height: 1.1em; margin-left: -.3em; vertical-align: -.2em;
  background: #bbb; animation: blink 1s steps(1) infinite;
}
.down {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  border: none; background: none; padding: 8px; color: #333;
}
.down:hover { color: #000; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 第二屏：正文 ---------- */
.app { height: 100vh; height: 100svh; display: flex; flex-direction: column; overflow: hidden; }
.top {
  flex-shrink: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px clamp(16px, 3vw, 44px);
  background: rgba(255, 255, 255, .95); border-bottom: 1px solid #eee;
}
.brand {
  font-family: var(--title-font); font-weight: 600; font-size: 28px; line-height: 1.4;
  color: #000; text-decoration: none; letter-spacing: .02em;
}
.actions { display: flex; gap: 6px; }
/* 右上角：纯文字标签，悬停/选中时浅灰底 */
.tab {
  border: none; background: none; border-radius: 2px;
  padding: 6px 18px; font-size: 15px; font-weight: 500; color: #666; line-height: 1.6;
}
.tab:hover, .tab.on { background: #efefef; color: #333; }

main {
  width: 100%; max-width: 880px; margin: 0 auto; padding: 0 16px calc(12px + env(safe-area-inset-bottom));
  flex: 1; min-height: 0; display: flex; flex-direction: column;
}
/* 对话区单独滚动，输入框固定在下面不动 */
.messages {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 28px 18px 8px 0; margin-right: -8px;
  scrollbar-width: thin; scrollbar-color: #cfcfcf transparent;
}
/* 滚动条：细、浅灰、圆头，和正文的灰字一个调子 */
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-track { background: #f3f3f3; border-radius: 3px; margin: 28px 0 8px; }
.messages::-webkit-scrollbar-thumb { background: #cfcfcf; border-radius: 3px; }
.messages::-webkit-scrollbar-thumb:hover { background: #999; }

/* 消息：模型的话前面一个小圆点，用户的话灰底、前面一个「>」 */
.msg { margin: 16px 0; }
.msg .body { overflow-wrap: anywhere; position: relative; }
.msg.user .body {
  white-space: pre-wrap; padding: 4px 12px 4px 2.2em;
  background: #f4f4f4; color: var(--ink);
}
.msg.user .body::before { content: ">"; position: absolute; left: .9em; color: #999; }
.msg.ai .body { padding-left: 1.6em; }
.msg.ai .body::before { content: "⏺"; position: absolute; left: 0; top: .1em; font-size: 9px; color: #333; }
.msg.ai .body > :first-child { margin-top: 0; }
.msg.ai .body p { margin: .4em 0; }
.msg.ai .body strong { color: var(--ink); font-weight: 600; }
.msg.ai .body ol, .msg.ai .body ul { padding-left: 1.6em; margin: .4em 0; }
.msg.ai .body li { margin: .2em 0; color: var(--ink); }
.msg.ai .body li::marker { color: var(--ink); }
.msg.ai .body blockquote { margin: .5em 0; padding: 0 0 0 1em; border-left: 3px solid #bbb; color: var(--ink); }
.msg.ai .body h2, .msg.ai .body h3, .msg.ai .body h4 { font-size: 1.05em; font-weight: 600; color: var(--ink); margin: 1em 0 .3em; }
.msg.ai .body hr { border: none; border-top: 1px solid var(--line); }

/* 「第 N 步 / 共 4 步」：细体大字，像小标题 */
.step-label {
  font-family: var(--title-font); font-weight: 300; font-size: 26px; line-height: 1.4;
  color: #333; margin: 0 0 .5em; letter-spacing: .04em;
}
.msg.ai .body:has(> .step-label)::before { top: 1.25em; }

/* 第一步固定文字里放 5 条示范的位置 */
.examples { margin: .4em 0; }
.examples .hint { color: var(--muted); }
.examples.wait, .msg.wait .body { color: #d97757; }
.msg.error .body, .msg.error .body::before { color: #c62828; }
.typing::after { content: "▍"; animation: blink 1s infinite; color: #333; }
.wait.typing::after { display: none; }

/* 收尾提示：和参考开头分开 */
.msg.ai .body .note {
  margin-top: 1.2em; padding-top: .8em;
  border-top: 1px dashed #bbb; color: #999; font-size: .92em;
}
.msg.ai .body .note strong { color: inherit; }

/* ---------- 输入框（固定在底部） ---------- */
.composer {
  position: relative; flex-shrink: 0;
  background: #fff; border: 1px solid #c8c8c8; border-radius: 8px;
  padding: 6px 8px 6px 2.2em; margin-top: 8px;
}
.composer::before { content: ">"; position: absolute; left: .9em; top: 6px; color: #333; line-height: 1.7; }
.composer textarea {
  width: 100%; border: none; outline: none; resize: none; background: transparent; display: block;
  font: inherit; font-size: 15px; line-height: 1.7; color: var(--ink);
  min-height: 1.7em; max-height: 40vh; padding: 0;
}
.composer textarea::placeholder { color: #aaa; }
.composer-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 2px; }
.tags { display: flex; flex-wrap: wrap; }
.tag { font-size: 13px; color: var(--muted); white-space: nowrap; }
.tag.trial { color: var(--red); }
.next {
  flex-shrink: 0; border: none; border-radius: 6px;
  background: #000; color: #fff; font-size: 14px; padding: 4px 14px; line-height: 1.7;
}
.next:not(:disabled):hover { background: #333; }
#input.nudge { animation: nudge .6s; }
@keyframes nudge {
  0%, 100% { box-shadow: none; }
  30%, 70% { box-shadow: 0 0 0 2px #d97757; }
}

/* ---------- 弹窗 ---------- */
dialog { border: none; border-radius: 10px; padding: 0; width: min(440px, 92vw); color: var(--ink); line-height: 1.8; }
dialog::backdrop { background: rgba(0, 0, 0, .25); }
.dialog-body { padding: 22px 24px; }
.dialog-body h2 { margin: 0 0 8px; font-family: var(--title-font); font-size: 22px; font-weight: 400; color: #000; }
.dialog-body ol { padding-left: 1.3em; }
.dialog-body a { color: #000; }
.dialog-body input {
  width: 100%; font: inherit; padding: 8px 12px;
  border: 1px solid #ccc; border-radius: 6px; outline-color: #000;
}
.dialog-body .tip { color: var(--red); font-weight: 600; }
#contact-text { white-space: pre-line; }
.small { font-size: 13px; color: var(--muted); }
.dialog-body .msg { margin: 0; min-height: 1.4em; font-size: 14px; color: #000; }
.row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.pill { padding: 4px 16px; border-radius: 6px; border: 1px solid #ccc; background: #fff; font-size: 14px; }
.pill:hover { background: #f3f3f3; }

@media (max-width: 520px) {
  .brand { font-size: 22px; }
  .tab { padding: 4px 10px; font-size: 14px; }
  .splash-sub { letter-spacing: .3em; font-size: 13px; }
  .step-label { font-size: 22px; }
}
