/* P2: H5 问答/阅读视觉层。与 P1 首页、分享卡及 API 实现隔离。 */
#chat-view,
#answer-view { color: var(--ink); }
#chat-view .chat-heading {
  padding: 18px 2px 24px;
  border-bottom: 1px solid var(--line);
}
#chat-view .chat-heading .back-link {
  display: inline-block; margin: 0 0 25px; padding: 3px 0;
  font-size: 13px; color: var(--muted);
}
#chat-view .chat-heading .eyebrow,
#answer-view > .eyebrow {
  color: #816747; font-size: 12px; font-weight: 500;
  letter-spacing: .08em; margin-bottom: 12px;
}
#chat-view .chat-heading h1,
#answer-view h1 {
  margin: 0; color: #20352B; font-weight: 600;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  line-height: 1.43; letter-spacing: -.015em;
}
#chat-view .chat-heading h1 { font-size: clamp(27px, 4vw, 37px); }
#chat-view .chat-heading > p:last-child {
  margin: 13px 0 0; color: var(--muted);
  font-size: 14px; line-height: 1.85;
}
#chat-view .conversation {
  display: flex; flex-direction: column; gap: 18px;
  margin: 24px 2px 16px;
}
#chat-view .message {
  position: relative; width: fit-content; max-width: min(90%, 620px);
  padding: 14px 17px 16px; border-radius: 17px;
  font-size: 15px; line-height: 1.85; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere;
  box-shadow: 0 6px 17px rgba(44,52,37,.028);
}
#chat-view .message-label { display: block; margin: 0 0 5px; font-size: 11px; }
#chat-view .message-assistant {
  align-self: flex-start; margin-left: 38px;
  background: var(--paper); border: 1px solid #E5E8E0;
  border-top-left-radius: 5px;
}
#chat-view .message-assistant::before {
  content: "知"; position: absolute; left: -39px; top: 1px;
  display: grid; place-items: center; width: 27px; height: 27px;
  background: #E7EEE6; color: var(--accent); border-radius: 50%;
  font-size: 15px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
}
#chat-view .message-user {
  align-self: flex-end; margin-right: 0;
  color: var(--ink); background: #E7EEE6;
  border: 1px solid #DDE6DA; border-top-right-radius: 5px;
}
#chat-view .message-user .message-label { color: #50675A; }
#chat-view .conversation-progress { margin: 0 2px 16px; }
#chat-view .status-line:empty { display: none; }
#chat-view .status-line:not(:empty) {
  min-height: 0; margin: 0; padding: 14px 17px;
  border-left: 3px solid #A8BCA7; border-radius: 0 14px 14px 0;
  background: #EEF1EA; color: #3D5545;
  font-size: 13px; line-height: 1.8; overflow-wrap: anywhere;
}
#chat-view .status-line.status-working { position: relative; padding-left: 48px; }
#chat-view .status-working::before {
  content: ""; position: absolute; left: 17px; top: 16px;
  width: 17px; height: 17px; border: 2px solid #D4DFD4;
  border-top-color: #254B3C; border-radius: 50%;
  animation: zz-p2-spin 1.1s linear infinite;
}
@keyframes zz-p2-spin { to { transform: rotate(360deg); } }
#chat-view .status-line.status-ready {
  padding: 3px 1px 2px; border: 0; border-radius: 0;
  background: transparent; color: var(--muted);
}
#chat-view .status-line.status-error {
  border-left-color: #A98960; background: #F5F0E7; color: #71583D;
}
#chat-view .chat-recovery-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 13px 0 0; }
#chat-view .chat-recovery-actions:has(> [hidden]:first-child):has(> [hidden]:last-child) { display: none; }
#chat-view .chat-recovery-actions .button { min-height: 48px; }
#chat-view .question-form {
  padding: 19px 20px 18px; margin: 18px 0 0; border: 2px solid #FFFFFF;
  border-radius: 21px; background: #FFFFFF;
  box-shadow: 0 9px 30px rgba(44,52,37,.06), 0 2px 4px rgba(44,52,37,.02);
}
#chat-view .question-form:focus-within { border-color: #8CA18A; }
#chat-view .question-form label {
  display: block; margin-bottom: 9px;
  color: var(--ink); font-size: 16px; line-height: 1.5; font-weight: 600;
}
#chat-view .question-form textarea {
  display: block; width: 100%; height: 103px; min-height: 103px;
  padding: 2px 0 8px; background: transparent; border: 0; border-radius: 0;
  color: var(--ink); outline: none; box-shadow: none;
  font-size: 15px; line-height: 1.8; resize: vertical;
}
#chat-view .question-form textarea:focus { border: 0; box-shadow: none; }
#chat-view .question-form textarea::placeholder { color: #6D766B; opacity: 1; }
#chat-view .question-form textarea:disabled { opacity: .64; cursor: not-allowed; }
#chat-view .form-bottom { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 0; }
#chat-view .form-bottom > span { align-self: flex-end; color: #697168; font-size: 11px; font-variant-numeric: tabular-nums; }
#chat-view .form-bottom .button {
  display: block; position: relative; width: 100%; height: 49px; min-height: 49px;
  padding: 10px 45px; border-radius: 14px; font-size: 15px; font-weight: 500;
}
#chat-view .form-bottom .button:not(:disabled)::after {
  content: "↑"; position: absolute; right: 17px; top: 50%;
  transform: translateY(-50%); font-size: 18px; font-weight: 400;
}
#chat-view .form-bottom .button:disabled { background: #E1E7DE; color: #647161; opacity: 1; }
#chat-view #answer-without-more {
  display: block; width: 100%; margin: 12px 0 0; padding: 12px;
  border-radius: 13px; min-height: 48px; color: var(--accent);
  background: transparent; font-size: 13px;
}
#chat-view .privacy-note {
  margin: 25px 2px 0; padding: 15px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 11px; line-height: 1.85;
}
#chat-view .privacy-note a { text-decoration: underline; text-underline-offset: 3px; }
#answer-view { padding-top: 28px; }
#answer-view h1 { font-size: clamp(31px, 4.5vw, 43px); }
#answer-view .answer-card {
  margin: 27px 0 14px; padding: 30px 32px;
  background: var(--paper); border: 1px solid #EFF0E9;
  border-radius: 21px; box-shadow: 0 9px 30px rgba(44,52,37,.045);
}
#answer-view .answer-text {
  font-size: 16px; line-height: 2; white-space: pre-wrap;
  overflow-wrap: anywhere; word-break: break-word; color: var(--ink);
}
#answer-view .answer-boundary { margin: 17px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.85; }
#answer-view .answer-actions {
  display: flex; flex-direction: column; gap: 11px; margin: 27px 0 0;
}
#answer-view .answer-actions .button {
  display: block; width: 100%; min-height: 49px;
  border-radius: 14px; font-size: 15px; font-weight: 500;
}
#answer-view .answer-actions .button-primary { order: 0; }
#answer-view .answer-actions .button-secondary { order: 1; border-color: #CFD8CD; color: var(--accent); }
#answer-view .answer-share-note {
  margin: 13px 0 0; text-align: center;
  font-size: 11px; color: var(--muted); line-height: 1.85;
}
#chat-view .button:focus-visible,
#answer-view .button:focus-visible,
#chat-view .back-link:focus-visible {
  outline: 2px solid #8CA18A; outline-offset: 3px;
}
@media (max-width: 760px) {
  #chat-view .chat-heading { padding: 9px 0 20px; }
  #chat-view .chat-heading .back-link { margin-bottom: 22px; }
  #chat-view .chat-heading h1 { font-size: 29px; }
  #chat-view .chat-heading > p:last-child { font-size: 13px; margin-top: 11px; }
  #chat-view .conversation { gap: 14px; margin: 21px 0 13px; }
  #chat-view .message { max-width: calc(100% - 37px); padding: 12px 14px 14px; font-size: 14px; }
  #chat-view .status-line:not(:empty) { font-size: 12px; }
  #chat-view .question-form { padding: 17px 15px 15px; margin-top: 17px; }
  #chat-view .question-form textarea { height: 87px; min-height: 87px; resize: none; font-size: 14px; }
  #chat-view .chat-recovery-actions { flex-direction: column; }
  #chat-view .chat-recovery-actions .button { width: 100%; }
  #answer-view { padding-top: 14px; }
  #answer-view h1 { font-size: 33px; }
  #answer-view .answer-card { margin-top: 23px; padding: 24px 19px; border-radius: 19px; }
  #answer-view .answer-text { font-size: 15px; line-height: 1.96; }
  #answer-view .answer-actions { margin-top: 22px; }
}
@media (max-width: 350px) {
  #chat-view .chat-heading h1 { font-size: 26px; }
  #answer-view h1 { font-size: 29px; }
  #chat-view .question-form { padding-left: 12px; padding-right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  #chat-view .status-working::before { animation: none; }
}
