/* 文心一言 · 极简排版风（与门户页共用一套视觉） */
:root {
  --paper: #FBFAF7;
  --ink: #1C1B19;
  --ink-soft: #6B6862;
  --ink-faint: #A8A49C;
  --rule: #E6E3DC;
  --rule-strong: #DCD8CE;
  --accent: #B5854F;
  --gutter: clamp(24px, 7vw, 72px);
  --display: Georgia, "Times New Roman", "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body.wenxin-page {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  justify-content: center;
}

.wx-shell {
  width: min(720px, 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(64px, 14vh, 130px) var(--gutter) 40px;
}

/* ── 卡片 ── */
.wx-card { display: flex; flex-direction: column; }

.wx-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.wx-label {
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--ink-soft);
}

.wx-refresh {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.2s ease;
}

.wx-refresh:hover { color: var(--accent); }
.wx-refresh:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.wx-refresh.spinning { color: var(--accent); }

/* ── 正文 ── */
.wx-quote {
  margin: 0;
  padding: clamp(40px, 8vh, 78px) 0 clamp(30px, 5vh, 52px);
  font-family: var(--display);
  font-size: clamp(24px, 5.2vw, 40px);
  font-weight: 400;
  line-height: 1.72;
  letter-spacing: 0.01em;
  text-indent: 2em;
  color: var(--ink);
  min-height: 3.2em;
  transition: opacity 0.45s ease;
}

.wx-quote.loading {
  text-indent: 0;
  font-style: italic;
  color: var(--ink-faint);
  font-size: clamp(16px, 3vw, 20px);
}

/* 淡出要比淡入快：220ms 正好对齐 loadQuote 里的换场等待，
   旧字在换场那一刻已经完全透明，不会出现「闪回一下再消失」 */
.wx-quote.fade-out { opacity: 0; transition-duration: 0.22s; }

.wx-card.breathe { animation: wxRise 0.55s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes wxRise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── 打字光标 ── */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 0.92em;
  margin-left: 3px;
  vertical-align: -0.1em;
  background: var(--accent);
  animation: wxBlink 1s step-end infinite;
}

@keyframes wxBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── 倒计时 ── */
.wx-progress {
  height: 1px;
  background: var(--rule);
  overflow: hidden;
}

.wx-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

/* ── 操作 ── */
.wx-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: clamp(48px, 9vh, 96px);
}

.wx-btn {
  flex: 1;
  height: 44px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.wx-btn:hover { border-color: var(--accent); color: var(--accent); }
.wx-btn:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

.wx-btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.wx-btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

/* ── 提示 ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 8px);
  z-index: 50;
  padding: 9px 18px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ══════════════════════════════════════
   屏保模式（门户页空闲时以 ?mode=screensaver 嵌入）
   ══════════════════════════════════════ */
body.wenxin-page.is-screensaver .wx-shell {
  justify-content: center;
  padding-top: clamp(48px, 10vh, 96px);
  padding-bottom: clamp(48px, 10vh, 96px);
}

body.wenxin-page.is-screensaver .wx-actions,
body.wenxin-page.is-screensaver .wx-progress,
body.wenxin-page.is-screensaver .wx-refresh,
body.wenxin-page.is-screensaver .wx-head {
  display: none;
}

body.wenxin-page.is-screensaver .wx-quote {
  padding: 0;
  font-size: clamp(28px, 6vw, 52px);
}

@media (prefers-reduced-motion: reduce) {
  .wx-quote, .toast { transition: none; }
  .wx-card.breathe { animation: none; }
  .typing-cursor { animation: none; }
}
