/* Reading space and compact replies, shared by desktop and mobile. */
:root { --ink: #19372e; --muted: #60756c; --line: #dce9e1; --leaf: #08765b; }
body { background: #edf3ef; color: var(--ink); padding: 18px; }
body .container { max-width: 1120px; min-height: 0; height: calc(100dvh - 36px); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 12px 40px #19372e0d; }
body .header { position: relative; background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); padding: 18px 26px; gap: 14px; flex-wrap: nowrap; flex-shrink: 0; }
body .header-info { min-width: 0; flex: 1; }
body .header-info h1 { color: var(--ink); font-size: 21px; letter-spacing: -.4px; }
body .header-info p, body .header-subtitle { color: var(--muted); }
body .header-icon { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 14px; }
body .header-stats { display: none; }
body .brand-leaf { background: #eaf4ed; color: var(--leaf); }
.brand-leaf svg { width: 30px; height: 30px; fill: #c2dfcd; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.header-more { position: relative; flex: 0 0 auto; }
.header-more > summary { display: flex; gap: 5px; align-items: center; justify-content: center; cursor: pointer; list-style: none; border: 1px solid var(--line); border-radius: 12px; min-height: 44px; padding: 0 12px; color: var(--ink); font-size: 15px; letter-spacing: 1px; }
.header-more > summary::-webkit-details-marker { display: none; }
.header-more > summary span { font-size: 12px; letter-spacing: 0; }
.header-more[open] > summary { background: #edf6ef; border-color: #b3d5c1; }
body .header-more .top-right-actions { position: absolute; z-index: 1300; top: calc(100% + 10px); right: 0; width: 268px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 88px); overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 12px 36px #19372e24; }
.header-more:not([open]) .top-right-actions { display: none; }
body .header-more .api-key-btn { min-height: 44px; padding: 10px; box-shadow: none; font-size: 13px; }
body .header-more #browser-location-button { grid-column: 1 / -1; }
body .header-more #lang-switcher { justify-content: center; border-radius: 9px !important; min-height: 44px; box-shadow: none !important; }
body .header-more #lang-switcher select { max-width: 92px; min-height: 32px; }
body .header-more .connection-status { grid-column: 1 / -1; justify-content: center; border-radius: 9px; min-height: 36px; }
body .header-more .beta-location { grid-column: 1 / -1; color: var(--muted); font-size: 12px; max-width: 100%; overflow-wrap: anywhere; }
.more-account-note, .more-service-note { grid-column: 1 / -1; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; line-height: 1.6; }
.more-account-note { border-top: 1px solid var(--line); padding-top: 10px; }
body .stat-value { color: var(--leaf); }
body .tabs { padding: 0 26px; background: #fff; border-bottom: 1px solid var(--line); }
body .tab { border-radius: 0; color: var(--muted); background: transparent; }
body .tab.active { color: var(--leaf); background: transparent; border-bottom: 3px solid var(--leaf); }
body .top-right-actions .api-key-btn { background: #f4f8f5; border: 1px solid var(--line); color: var(--ink); border-radius: 9px; }
body .chat-tools { background: #fafcfb; padding: 12px 26px; border-bottom: 1px solid var(--line); }
body .tool-btn { background: #fff; border-color: var(--line); font-weight: 500; }
.session-note { color: var(--muted); font-size: 12px; }
body .chat-container { background: #fafcfb; padding: 24px 34px; overscroll-behavior: contain; }
body .message { gap: 12px; margin-bottom: 24px; animation: none; opacity: 1; }
body .message-content { min-width: 0; max-width: min(860px, 90%); overflow-wrap: anywhere; }
body .message.assistant .message-content { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 0 16px 16px 16px; box-shadow: 0 2px 8px #19372e04; padding: 20px 24px; font-size: 15px; line-height: 1.8; }
body .message.user .message-content { background: #e1f1e7; color: var(--ink); border-radius: 16px 0 16px 16px; padding: 12px 18px; box-shadow: none; }
body .message-avatar { height: 32px; width: 32px; flex: 0 0 32px; }
.answer-body > p:first-child { font-size: 16px; color: #123b2d; }
.answer-body h3 { font-size: 16px; line-height: 1.5; margin: 18px 0 8px; color: #08684e; }
.answer-body h3:first-child { margin-top: 0; }
.answer-body p { margin-bottom: 12px; }
.answer-body ul, .answer-body ol { padding-left: 23px; margin: 10px 0 16px; }
.answer-body li { padding-left: 3px; margin: 7px 0; }
.answer-body li::marker { color: #08765b; }
.answer-body blockquote { border-left: 3px solid #bdd9c6; background: #f6faf7; padding: 8px 14px; margin: 12px 0; color: var(--muted); }
.answer-body code { background: #edf3ef; padding: 2px 5px; border-radius: 4px; font-size: .88em; }
.answer-body pre { background: #f3f7f4; overflow-x: auto; padding: 14px; border-radius: 9px; margin: 12px 0; }
.answer-body pre code { padding: 0; background: none; white-space: pre; }
.answer-body hr { height: 1px; border: 0; background: var(--line); margin: 16px 0; }
.answer-body a { color: #066b54; text-decoration: underline; text-underline-offset: 3px; }
.answer-table { overflow-x: auto; margin: 14px 0; max-width: 100%; }
.answer-table table { border-collapse: collapse; font-size: 13px; width: 100%; min-width: 320px; }
.answer-table th, .answer-table td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; }
.answer-table th { background: #f0f7f2; font-weight: 600; }
body .answer-supplement { margin: 12px 0 0; padding: 0; background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.answer-supplement summary, .answer-more summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 10px 0; }
.answer-supplement summary:hover, .answer-more summary:hover { color: var(--leaf); }
.answer-more { border-top: 1px dashed var(--line); margin-top: 12px; }
body .recommendation-item { background: #f6faf7; border-color: var(--line); margin: 8px 0; box-shadow: none; }
body .knowledge-ref ul { margin: 0 0 12px; padding-left: 20px; }
body .suggestions { border-top: 1px solid var(--line); }
body .suggestion-btn { color: #36624d; background: #f8fbf9; border: 1px solid var(--line); border-radius: 8px; }
body .trace-panel { font-size: 12px; border-color: var(--line); background: #f6faf7; box-shadow: none; margin-bottom: 12px; }
body .trace-panel.live { margin-left: 44px; }
body .input-area { background: #fff; border-top: 1px solid var(--line); padding: 16px 26px; }
body .input-wrapper { border: 1px solid #c4d9cb; border-radius: 14px; background: #fafcfb; padding: 8px; box-shadow: none; }
body .input-wrapper:focus-within { border-color: #238963; box-shadow: 0 0 0 3px #2389630c; }
body .input-box { background: transparent; border: 0; min-height: 44px; padding: 10px; }
body .input-box { min-width: 0; }
body .input-box:focus { box-shadow: none; }
body .send-btn { background: #08765b; border-radius: 10px; }
body .welcome { max-width: 760px; margin: auto; padding: 22px 24px; }
body .welcome-pet { width: 84px; height: 98px; margin: 0 auto 10px; }
.welcome-eyebrow { display: block; color: #587e68; font-size: 11px; letter-spacing: 1.5px; margin-bottom: 12px; }
body .welcome h2 { font-size: clamp(22px, 2.6vw, 30px); font-weight: 600; letter-spacing: -.8px; color: #163d2c; }
body .welcome p { color: var(--muted); margin: 12px 0 26px; line-height: 1.8; }
body .quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
body .quick-btn { padding: 14px 18px; color: #245e42; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
body .quick-btn:hover { background: #edf7f0; border-color: #abd0b8; transform: translateY(-1px); }
body .task-entry { display: flex; align-items: center; gap: 14px; min-height: 112px; padding: 22px 18px; text-align: left; box-shadow: 0 5px 18px #173d2905; }
.task-entry-icon { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 46px; border-radius: 12px; background: #eaf5ee; font-size: 31px; font-weight: 400; color: #14775b; }
.energy-entry .task-entry-icon { background: #f6f1e5; color: #927139; }
.task-entry-copy { display: block; flex: 1; min-width: 0; }
.task-entry-copy strong { display: block; font-size: 18px; font-weight: 600; color: #183f2f; }
.task-entry-copy small { display: block; font-size: 12px; line-height: 1.7; color: var(--muted); margin-top: 5px; }
.task-entry-arrow { color: #8ba899; font-size: 25px; }
.welcome-hint { display: block; font-size: 12px; color: #789082; margin-top: 18px; }
.profile-commit-status { display: flex; gap: 10px; align-items: center; justify-content: space-between; color: #38644c; font-size: 12px; line-height: 1.5; padding: 0 2px 10px; }
.profile-commit-status[hidden] { display: none; }
.profile-commit-status[data-status="failed"] { color: #9c481c; }
.profile-commit-status button { border: 0; background: transparent; color: inherit; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; cursor: pointer; padding: 4px 0; min-height: 32px; }
.auth-recovery-status { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 0 2px 10px; color: #9c481c; font-size: 12px; line-height: 1.6; }
.auth-recovery-status[hidden] { display: none; }
.auth-recovery-status button { border: 1px solid #e9d2b6; background: #fffaf2; color: inherit; border-radius: 8px; padding: 7px 9px; flex: 0 0 auto; font-size: 12px; cursor: pointer; min-height: 36px; }
body .history-panel { background: #fff; margin: 0; padding: 4px 26px; border-bottom: 1px solid var(--line); max-height: 260px; }
body .history-item { border-color: #edf3ef; }
body .travel-card { background: #f4faf6; border: 1px solid #b9d8c6; border-radius: 14px; padding: 18px; }
body .travel-card-title { font-size: 18px; }
body .travel-card-sub { font-size: 13px; margin: 6px 0 14px; color: var(--muted); }
body .travel-map-placeholder, body .travel-map { min-height: 280px; max-height: 420px; }
body .travel-route { border-radius: 10px; background: #fff; }
body .travel-route.focused { border-color: #159070; box-shadow: 0 0 0 2px #15907016; }
.travel-carbon-details { color: var(--muted); font-size: 12px; line-height: 1.7; margin-top: 10px; cursor: auto; }
.travel-carbon-details summary { cursor: pointer; color: var(--leaf); }
.travel-carbon-details p { margin: 6px 0; }
.travel-carbon-details ul { padding-left: 18px; }
:focus-visible { outline: 2px solid #159070; outline-offset: 3px; }
body .eco-companion { bottom: 150px; }
body .eco-companion-status { pointer-events: none; }
body .eco-companion-bubble { pointer-events: auto; cursor: pointer; }
body .auth-username { color: var(--ink); max-width: 150px; }
body .header-user-area .auth-btn { min-height: 44px; }
body .header-user-area .auth-btn-outline { color: var(--leaf); border-color: var(--line); background: #f5faf7; }
body .message-feedback { opacity: 1; gap: 4px; margin-top: 14px; align-items: center; }
body .feedback-btn { border: 0; background: transparent; color: #7b8782; padding: 7px; border-radius: 7px; min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; }
body .feedback-btn svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
body .feedback-btn:hover { color: var(--leaf); background: #edf5ef; transform: none; }
body .feedback-btn.liked, body .feedback-btn.disliked, body .feedback-btn.comment-active { color: var(--leaf); background: #e5f2e9; }
body .feedback-btn:disabled { opacity: .5; cursor: wait; }
.selection-menu { position: fixed; z-index: 10010; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 5px; box-shadow: 0 8px 32px #173d2929; min-width: 170px; }
.selection-menu button { display: block; border: 0; border-radius: 6px; background: transparent; padding: 10px 14px; width: 100%; text-align: left; color: var(--ink); cursor: pointer; }
.selection-menu button:hover { background: #edf5ef; }
.notes-dialog { margin: auto 0 auto auto; height: 100dvh; max-height: 100dvh; width: min(480px, 100vw); max-width: 100vw; border: 0; border-left: 1px solid var(--line); padding: 22px; color: var(--ink); background: #fafcfb; }
.notes-dialog::backdrop { background: #173d293d; }
.notes-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.notes-heading h2 { font-size: 20px; margin: 0; }
.notes-dialog button { border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; cursor: pointer; background: #fff; color: var(--ink); }
.notes-dialog button:hover { border-color: #68ad87; }
.notes-dialog label { display: block; margin: 12px 0 5px; font-size: 13px; }
.notes-dialog input, .notes-dialog textarea { box-sizing: border-box; width: 100%; border: 1px solid #c4d9cb; padding: 10px; border-radius: 8px; font: inherit; color: var(--ink); background: #fff; }
.notes-dialog textarea { min-height: 180px; resize: vertical; font-size: 14px; }
.notes-dialog .notes-save { background: var(--leaf); color: #fff; margin: 10px 0 18px; }
.notes-status { font-size: 13px; color: var(--muted); margin: 10px 0; }
.note-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; margin: 12px 0; }
.note-item h3 { font-size: 15px; margin: 0 0 8px; }
.note-item pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; line-height: 1.7; margin: 8px 0; max-height: 220px; overflow: auto; }
.note-item time { font-size: 11px; color: var(--muted); }
.note-item footer { display: flex; gap: 8px; margin-top: 10px; }
@media (max-width: 760px) {
  body { padding: 0; min-height: 0; height: 100dvh; overflow: hidden; }
  body .container { border: 0; border-radius: 0; height: var(--app-height, 100dvh); min-height: 0; }
  body .header { padding: max(8px, env(safe-area-inset-top)) 14px 8px; gap: 10px; flex-direction: row; flex-wrap: nowrap; align-items: center; }
  body .header-icon { width: 36px; height: 40px; flex-basis: 36px; border-radius: 12px; }
  .brand-leaf svg { width: 25px; height: 25px; }
  body .header-info { min-width: 0; flex: 1; }
  body .header-info h1 { font-size: 16px; line-height: 1.3; white-space: nowrap; margin-bottom: 3px; }
  body .header-info p { font-size: 10px; }
  body .header-user-area { margin: 0; flex: 0 0 auto; }
  body .header-user-area .auth-btn { border: 0; background: transparent; padding: 0 2px; font-size: 12px; min-width: 34px; }
  body .auth-username { display: none; }
  .header-more > summary { width: 40px; padding: 0; border: 0; font-size: 16px; }
  .header-more > summary span { display: none; }
  body .tabs { padding: 0 14px; flex-shrink: 0; }
  body .tab { padding: 13px 4px 12px; font-size: 13px; white-space: nowrap; }
  body .chat-tools { padding: 6px 12px; gap: 8px; flex-shrink: 0; }
  body .chat-tools .tool-btn { padding: 0 9px; min-height: 44px; font-size: 12px; border: 0; background: transparent; border-radius: 8px; }
  body .chat-tools .tool-btn:hover { background: #eaf4ed; }
  .session-note { display: none; }
  body .main-content { height: auto; }
  body .chat-container { padding: 16px 12px; scrollbar-gutter: stable; }
  body .message { gap: 0; margin-bottom: 20px; }
  body .message-avatar { display: none; }
  body .message-content { max-width: 100%; }
  body .message.assistant .message-content { padding: 16px 14px; font-size: 15px; width: 100%; border-radius: 14px; }
  body .message.user .message-content { max-width: 90%; border-radius: 14px 2px 14px 14px; font-size: 15px; }
  body .input-area { padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); flex-shrink: 0; }
  body .input-wrapper { gap: 4px; padding: 5px; border-radius: 16px; }
  body .input-box { font-size: 16px; padding: 10px 8px; border-radius: 10px; line-height: 1.45; }
  body .input-box::placeholder { font-size: 14px; }
  body .send-btn { width: 44px; min-width: 44px; height: 44px; flex: 0 0 44px; font-size: 21px; }
  body .beta-voice { min-width: 40px; height: 44px; padding: 5px; border: 0; font-size: 12px; background: transparent; }
  body .stop-btn { padding: 0 8px; min-width: 44px; min-height: 44px; font-size: 12px; }
  body .beta-input-note:empty { display: none; }
  body .beta-input-note { margin-top: 6px; font-size: 11px; }
  body .welcome { padding: 6px 8px 18px; }
  body .welcome-pet { width: 68px; height: 78px; margin-bottom: 8px; }
  .welcome-eyebrow { font-size: 10px; letter-spacing: 1.2px; margin-bottom: 12px; }
  body .welcome h2 { font-size: 24px; line-height: 1.4; letter-spacing: -.6px; }
  body .welcome p { font-size: 13px; line-height: 1.7; margin: 12px 0 22px; }
  body .quick-actions { grid-template-columns: 1fr; gap: 10px; }
  body .task-entry { padding: 16px; gap: 14px; min-height: 94px; border-radius: 16px; }
  .task-entry-copy strong { font-size: 17px; }
  .task-entry-copy small { font-size: 12px; }
  .welcome-hint { font-size: 11px; margin-top: 16px; }
  body .travel-card { padding: 12px; }
  body .travel-card-routes { grid-template-columns: minmax(0, 1fr); }
  body .travel-route-stats { flex-wrap: wrap; gap: 6px 12px; }
  body .travel-map-placeholder, body .travel-map { min-height: 220px; max-height: 300px; }
  body .travel-card-title { font-size: 17px; overflow-wrap: anywhere; }
  body .trace-panel.live { margin-left: 0; }
  body .eco-companion { display: none; }
  body .history-panel { padding: 0 12px; max-height: 35dvh; }
  body .history-item { padding: 12px; min-height: 60px; }
  body .profile-container, body .policy-container { padding: 16px; }
  body .profile-card { min-width: 0; }
  body .beta-domain-grid { grid-template-columns: minmax(0, 1fr); }
  body .personalization-indicator { max-width: calc(100vw - 24px); bottom: max(90px, env(safe-area-inset-bottom)); }
  body .feedback-toast { max-width: calc(100vw - 32px); width: max-content; white-space: normal; overflow-wrap: anywhere; bottom: max(100px, env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) {
  /* 顶部 chrome 压缩：给聊天区让出更多纵向空间，不砍「新对话/历史/笔记」功能 */
  body .header { padding: max(4px, env(safe-area-inset-top)) 12px 6px; gap: 8px; }
  body .header-info h1 { font-size: 15px; }
  body .header-tagline { display: none; }
  body .tabs { padding: 0 8px; }
  body .tab { padding: 10px 2px 9px; font-size: 12px; }
  body .chat-tools { padding: 4px 8px; gap: 6px; }
  body .chat-tools .tool-btn { padding: 0 7px; min-height: 38px; font-size: 11px; }
  body .chat-tools .tool-spacer { display: none; }
  body .main-content { height: auto; min-height: 0; flex: 1 1 auto; }
  body .chat-container { flex: 1 1 auto; min-height: 0; padding: 14px 12px; }
}
@media (max-width: 360px), (max-width: 760px) and (max-height: 650px) {
  body .welcome-pet { display: none; }
  body .welcome h2 { font-size: 22px; }
  body .welcome { padding-top: 8px; }
  body .welcome p { margin: 9px 0 16px; }
  body .task-entry { min-height: 86px; padding: 12px; gap: 10px; }
  .task-entry-copy small { font-size: 11px; }
  body .header { gap: 6px; padding-right: 10px; padding-left: 10px; }
  body .profile-commit-status { font-size: 11px; padding-bottom: 6px; }
}
@media (max-width: 1000px) and (max-height: 520px) {
  body { padding: 0; min-height: 0; overflow: hidden; }
  body .container { height: var(--app-height, 100dvh); border-radius: 0; min-height: 0; }
  body .header { padding: 4px 12px; gap: 10px; }
  body .header-icon { width: 32px; height: 36px; flex-basis: 32px; }
  body .header-info h1 { font-size: 16px; margin: 0; }
  body .header-tagline { display: none; }
  body .tabs { padding: 0 12px; flex-shrink: 0; }
  body .tab { padding: 9px 4px; font-size: 13px; }
  body .main-content { height: auto; }
  body .chat-tools { padding: 0 12px; flex-shrink: 0; }
  body .chat-tools .tool-btn { min-height: 44px; }
  body .chat-container { padding: 8px 12px; }
  body .input-area { flex-shrink: 0; padding: 8px 12px max(8px, env(safe-area-inset-bottom)); }
  body .input-wrapper { padding: 5px; gap: 4px; }
  body .input-box { max-height: 22dvh; font-size: 16px; padding: 8px; }
  body .send-btn { width: 44px; height: 44px; flex: 0 0 44px; }
  body .beta-input-note:empty { display: none; }
  body .profile-commit-status { padding-bottom: 4px; }
  body .eco-companion { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  body *, body *::before, body *::after { scroll-behavior: auto !important; }
  body .quick-btn { transition: none; }
}
