/* 牛小顿 —— 问答智能体。抽出独立样式表：model.php（app.css）与 index.php（home.css）
   用的基础样式表不同，牛小顿两者都要，故单独一份、两页都引。变量取自 site.css :root。 */
.newton-panel { display: flex; flex-direction: column; gap: 10px; }
.newton-panel[hidden] { display: none; }   /* display:flex 会压过 UA 的 [hidden]，显式兜回 */
/* /model.php 聊天卡锚点（首页滚动条「牛小顿」链到 /model.php#newtonChat），
   跳转落点避开 sticky 页头。定义在共享表里，两页都生效。 */
#newtonChat { scroll-margin-top: calc(var(--header-h) + 16px); }
.newton-list {
  max-height: 380px; overflow-y: auto; display: flex; flex-direction: column;
  gap: 8px; padding: 4px 2px;
}
/* 历史记录折叠块：登录用户回填的旧会话默认收起，避免打开页面把面板撑得过高。 */
.newton-history { display: flex; flex-direction: column; gap: 8px; }
.newton-history-toggle {
  align-self: flex-start; border: 0; background: none; cursor: pointer; padding: 2px 0;
  color: var(--teal-d); font: inherit; font-size: 13px;
}
.newton-history-toggle:hover { text-decoration: underline; }
.newton-history-body { display: flex; flex-direction: column; gap: 8px; }
.newton-history-body[hidden] { display: none; }   /* display:flex 会压过 UA 的 [hidden]，显式兜回 */
.newton-msg {
  max-width: 82%; padding: 8px 12px; border-radius: var(--radius);
  font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.newton-bot { align-self: flex-start; background: var(--teal-050); border: 1px solid var(--teal-100); color: var(--teal-d); }
.newton-user { align-self: flex-end; background: linear-gradient(100deg, var(--teal), var(--teal-l)); color: #fff; }
.newton-typing { opacity: .6; }
.newton-form { display: flex; gap: 8px; }
.newton-input { flex: 1 1 auto; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.newton-input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(78, 205, 196, .28); }
/* 发送按钮沿用网站主按钮风格（珊瑚渐变药丸，同 .btn-calc / .primary）；不依赖 app.css——首页只加载 home.css。 */
.newton-send {
  flex: 0 0 auto; padding: 0 18px;
  border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: linear-gradient(100deg, var(--coral), var(--coral-d)); color: #fff;
  font: inherit; font-weight: 700; letter-spacing: .04em;
  box-shadow: 0 10px 22px rgba(255, 107, 107, .34);
  transition: transform .12s ease, box-shadow .12s ease;
}
.newton-send:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(255, 107, 107, .44); }
.newton-send:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* 悬浮按钮锚定在首页 #hero 人形图右缘：.stage 是 sticky（定位盒），绝对定位子元素相对它定位，
   随人形图一起移动。窄屏（≤900px 单列布局）回退为视口右上固定。 */
.newton-fab {
  position: absolute; right: 14px; bottom: 60px; z-index: 5;
  height: 44px; padding: 0 18px; border-radius: var(--r-pill); border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--teal), var(--coral)); color: #fff;
  font: inherit; font-size: 15px; font-weight: 700; letter-spacing: .04em;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
/* 面板锚定同一角落、向按钮上方展开；尺寸收在 #hero 卡内（.stage overflow:hidden 不裁切）。 */
.newton-panel-floating {
  position: absolute; right: 14px; bottom: 116px; z-index: 6;
  width: min(88%, 340px); max-height: calc(100% - 136px); padding: 12px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.newton-panel-floating .newton-list { max-height: none; flex: 1 1 auto; min-height: 0; }
@media (max-width: 900px) {
  .newton-fab {
    position: fixed; top: calc(var(--header-h) + 10px); right: 14px; bottom: auto; z-index: 60;
  }
  .newton-panel-floating {
    position: fixed; top: calc(var(--header-h) + 66px); right: 14px; bottom: auto;
    width: min(92vw, 360px); max-height: calc(100vh - var(--header-h) - 90px);
  }
  .newton-panel-floating .newton-list {
    flex: 0 1 auto; max-height: min(50vh, calc(100vh - var(--header-h) - 180px));
  }
}
