globals.css 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. @tailwind base;
  2. @tailwind components;
  3. @tailwind utilities;
  4. :root {
  5. --background: #ffffff;
  6. --foreground: #171717;
  7. }
  8. @media (prefers-color-scheme: dark) {
  9. :root {
  10. --background: #0a0a0a;
  11. --foreground: #ededed;
  12. }
  13. }
  14. /* 移动端视口高度 - 解决浏览器地址栏遮挡问题 */
  15. @supports (height: 100dvh) {
  16. .h-screen-mobile {
  17. height: 100dvh;
  18. }
  19. }
  20. body {
  21. color: var(--foreground);
  22. background: var(--background);
  23. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  24. -webkit-font-smoothing: antialiased;
  25. -moz-osx-font-smoothing: grayscale;
  26. /* 防止 iOS Safari 中 body 弹性滚动 */
  27. overscroll-behavior: none;
  28. }
  29. /* 移动端优化 */
  30. @media (max-width: 768px) {
  31. body {
  32. font-size: 16px;
  33. line-height: 1.5;
  34. }
  35. /* 防止触摸时的高亮 */
  36. * {
  37. -webkit-tap-highlight-color: transparent;
  38. }
  39. }
  40. @layer utilities {
  41. .text-balance {
  42. text-wrap: balance;
  43. }
  44. }
  45. /* 自定义样式 - 消息气泡 */
  46. .message-bubble {
  47. @apply max-w-[85%] md:max-w-[75%] rounded-2xl px-4 py-3 shadow-sm;
  48. }
  49. @media (max-width: 768px) {
  50. .message-bubble {
  51. @apply max-w-[90%] rounded-2xl px-3 py-2 text-[15px];
  52. }
  53. }
  54. .user-message {
  55. @apply bg-gradient-to-br from-blue-500 to-blue-600 text-white ml-auto;
  56. }
  57. .user-message:hover {
  58. @apply from-blue-600 to-blue-700;
  59. }
  60. .assistant-message {
  61. @apply bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 border border-gray-200 dark:border-gray-700 shadow-sm;
  62. }
  63. /* 工具调用样式 */
  64. .tool-call {
  65. @apply bg-purple-50 dark:bg-purple-950/30 border-l-4 border-purple-500 p-3 my-2 rounded-r-lg;
  66. }
  67. @media (max-width: 768px) {
  68. .tool-call {
  69. @apply p-2 my-1 text-sm;
  70. }
  71. }
  72. .tool-error {
  73. @apply bg-red-50 dark:bg-red-950/30 border-l-4 border-red-500 p-3 my-2 rounded-r-lg text-red-700 dark:text-red-400;
  74. }
  75. @media (max-width: 768px) {
  76. .tool-error {
  77. @apply p-2 my-1 text-sm;
  78. }
  79. }
  80. /* 移动端滚动条优化 */
  81. @media (max-width: 768px) {
  82. /* 自定义滚动条 */
  83. ::-webkit-scrollbar {
  84. width: 4px;
  85. height: 4px;
  86. }
  87. ::-webkit-scrollbar-track {
  88. background: transparent;
  89. }
  90. ::-webkit-scrollbar-thumb {
  91. background: rgba(156, 163, 175, 0.5);
  92. border-radius: 2px;
  93. }
  94. ::-webkit-scrollbar-thumb:hover {
  95. background: rgba(156, 163, 175, 0.7);
  96. }
  97. }
  98. /* 安全区域支持 */
  99. .safe-area-inset-bottom {
  100. padding-bottom: env(safe-area-inset-bottom, 0);
  101. }
  102. .safe-area-inset-top {
  103. padding-top: env(safe-area-inset-top, 0);
  104. }
  105. /* 固定底部输入框 - 解决浏览器地址栏遮挡 */
  106. @media (max-width: 768px) {
  107. /* 触摸友好的按钮 */
  108. button, .btn {
  109. min-height: 44px;
  110. min-width: 44px;
  111. }
  112. /* 输入框区域固定在视口底部 */
  113. .fixed-bottom-input {
  114. position: fixed;
  115. bottom: 0;
  116. left: 0;
  117. right: 0;
  118. z-index: 50;
  119. background: white;
  120. padding-bottom: max(env(safe-area-inset-bottom, 0), 8px);
  121. }
  122. .dark .fixed-bottom-input {
  123. background: #1f2937; /* gray-800 */
  124. }
  125. /* 为消息列表添加底部 padding,避免被输入框遮挡 */
  126. .messages-with-fixed-input {
  127. padding-bottom: 80px; /* 大约输入框高度 */
  128. }
  129. /* pb-safe 类:底部安全区域 + 额外间距 */
  130. .pb-safe {
  131. padding-bottom: max(env(safe-area-inset-bottom, 0), 12px);
  132. }
  133. }
  134. /* 桌面端保持原有样式 */
  135. @media (min-width: 769px) {
  136. .fixed-bottom-input {
  137. position: relative;
  138. }
  139. .messages-with-fixed-input {
  140. padding-bottom: 1rem;
  141. }
  142. .pb-safe {
  143. padding-bottom: 1rem;
  144. }
  145. }