index.css 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. /* Tailwind CSS 基础导入 */
  2. @import "tailwindcss";
  3. /* 小尺寸屏幕修复样式 */
  4. @import "./styles/mobile-fix.css";
  5. /* ========================================
  6. 全局重置样式(防御式设计)
  7. ======================================== */
  8. * {
  9. margin: 0;
  10. padding: 0;
  11. box-sizing: border-box;
  12. }
  13. html {
  14. /* 禁止所有滚动 - 移动端修复 */
  15. overflow: hidden;
  16. /* 固定高度 - iOS Safari 修复 */
  17. height: 100%;
  18. /* 使用 postcss-px-to-viewport 自动转换 px 为 vw */
  19. /* 防止 iOS Safari 字体放大 */
  20. -webkit-text-size-adjust: 100%;
  21. -ms-text-size-adjust: 100%;
  22. text-size-adjust: 100%;
  23. }
  24. /* 极小屏幕降级:启用滚动条 */
  25. html[data-too-small="true"] {
  26. overflow-y: auto;
  27. overflow-x: hidden;
  28. }
  29. body {
  30. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
  31. 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
  32. sans-serif;
  33. -webkit-font-smoothing: antialiased;
  34. -moz-osx-font-smoothing: grayscale;
  35. /* 禁止所有滚动 - 移动端修复 */
  36. overflow: hidden;
  37. /* 固定高度 - iOS Safari 修复 */
  38. height: 100%;
  39. /* 使用 vw 单位(postcss-px-to-viewport 自动转换) */
  40. font-size: 14px; /* PostCSS 会自动转换为 vw */
  41. /* 防止横向滚动 */
  42. width: 100%;
  43. /* 防止边距导致的滚动 */
  44. margin: 0;
  45. padding: 0;
  46. /* 全局背景:在宽度超过 600px 时,左右区域仍然使用应用背景而不是纯白色 */
  47. background-color: #E8E8E8;
  48. background-image: url("https://lyrria-pro.oss-cn-beijing.aliyuncs.com/chatbot-bg.svg");
  49. background-size: cover;
  50. background-position: center;
  51. background-repeat: no-repeat;
  52. /* 固定定位 - 防止地址栏导致的滚动 */
  53. position: fixed;
  54. top: 0;
  55. left: 0;
  56. right: 0;
  57. bottom: 0;
  58. }
  59. /* 极小屏幕降级:启用滚动条 */
  60. body[data-too-small="true"] {
  61. position: static;
  62. overflow-y: auto;
  63. overflow-x: hidden;
  64. height: auto;
  65. min-height: 100vh;
  66. }
  67. #root {
  68. width: min(100%, 600PX);
  69. max-width: 600PX;
  70. height: 100%;
  71. /* 禁止所有滚动 */
  72. overflow: hidden;
  73. position: relative;
  74. margin: 0 auto;
  75. }
  76. /* 极小屏幕降级:允许滚动 */
  77. #root[data-too-small="true"] {
  78. max-width: 100%;
  79. overflow-y: auto;
  80. overflow-x: hidden;
  81. height: auto;
  82. min-height: 100vh;
  83. }
  84. /* ========================================
  85. 响应式容器(三层防护)
  86. ======================================== */
  87. /* 全局容器 - 适配所有设备 */
  88. .mobile-container {
  89. width: 100%;
  90. height: 100%;
  91. display: flex;
  92. align-items: center;
  93. justify-content: center;
  94. overflow: hidden;
  95. position: relative;
  96. }
  97. /* 内容卡片 - 基础样式(移动端) */
  98. .content-card {
  99. width: min(100%, 600PX);
  100. max-width: 600PX;
  101. height: 100%;
  102. margin: 0 16PX;
  103. /* background: #F5F3F0; */
  104. position: relative;
  105. overflow: hidden;
  106. }
  107. /* 移动端 Chrome 高度修复:使用 100dvh 或 -webkit-fill-available */
  108. @supports (height: 100dvh) {
  109. .content-card.min-h-screen {
  110. min-height: 100dvh;
  111. }
  112. }
  113. @supports not (height: 100dvh) {
  114. .content-card.min-h-screen {
  115. min-height: -webkit-fill-available;
  116. }
  117. }
  118. /* 极小屏幕降级:固定最小高度,允许滚动 */
  119. .content-card[data-too-small="true"] {
  120. width: 100%;
  121. max-width: 100%;
  122. height: auto;
  123. min-height: 600px; /* 确保内容可见 */
  124. overflow-y: auto;
  125. overflow-x: hidden;
  126. }
  127. /* 自定义工具类 */
  128. .text-ellipsis-2 {
  129. display: -webkit-box;
  130. -webkit-line-clamp: 2;
  131. -webkit-box-orient: vertical;
  132. overflow: hidden;
  133. }
  134. .safe-top {
  135. padding-top: env(safe-area-inset-top);
  136. }
  137. .safe-bottom {
  138. padding-bottom: env(safe-area-inset-bottom);
  139. }
  140. .no-select {
  141. -webkit-user-select: none;
  142. user-select: none;
  143. }
  144. .scroll-smooth {
  145. -webkit-overflow-scrolling: touch;
  146. scroll-behavior: smooth;
  147. }
  148. /* 触摸优化 */
  149. .touch-manipulation {
  150. touch-action: manipulation;
  151. -webkit-tap-highlight-color: transparent;
  152. }
  153. /* 响应式图片 */
  154. img {
  155. max-width: 100%;
  156. height: auto;
  157. }
  158. /* 全局 Tooltip 样式:统一 tip 视觉 */
  159. .ant-tooltip .ant-tooltip-inner {
  160. background: #34313d;
  161. color: #ffffff;
  162. font-size: 12px;
  163. }
  164. .ant-tooltip .ant-tooltip-arrow::before {
  165. background: #34313d;
  166. }
  167. /* 全局消息提示(AntD Message)统一视觉 */
  168. .ant-message .ant-message-notice-content,
  169. .ant-message .ant-message-notice .ant-message-notice-content {
  170. background: #34313d !important;
  171. color: #ffffff !important;
  172. font-size: 12px;
  173. border: none;
  174. box-shadow: none;
  175. }
  176. .ant-message-notice-content {
  177. background: #34313d !important;
  178. color: #ffffff !important;
  179. font-size: 12px;
  180. border: none;
  181. box-shadow: none;
  182. }
  183. .ant-message .ant-message-custom-content {
  184. color: #ffffff !important;
  185. }
  186. .ant-message .ant-message-custom-content .anticon {
  187. color: #ffffff !important;
  188. }
  189. .ant-message-notice .ant-message-notice-content .anticon {
  190. color: #ffffff !important;
  191. }
  192. /* 浏览器兼容性:backdrop-filter */
  193. @supports not (backdrop-filter: blur(15px)) {
  194. .backdrop-blur {
  195. background: rgba(255, 255, 255, 0.15);
  196. }
  197. }
  198. /* 响应式工具类 */
  199. .responsive-container {
  200. width: 100%;
  201. max-width: min(100%, 600PX);
  202. margin: 0 auto;
  203. padding: 0 clamp(16px, 4vw, 32px);
  204. }
  205. /* 响应式图片容器 */
  206. .responsive-image {
  207. width: 100%;
  208. height: auto;
  209. max-width: 100%;
  210. object-fit: contain;
  211. }
  212. /* 响应式按钮尺寸 */
  213. .btn-responsive {
  214. width: clamp(44px, 12vw, 96px);
  215. height: clamp(44px, 12vw, 96px);
  216. min-width: 44px;
  217. min-height: 44px;
  218. }
  219. /* 响应式文本(使用 min(vw, vh) 确保字体不会因为单一维度变大而过大) */
  220. .text-responsive-sm {
  221. font-size: clamp(9.6px, min(3.2vw, 1.48vh), 14.4px);
  222. }
  223. .text-responsive-base {
  224. font-size: clamp(11.2px, min(3.73vw, 1.72vh), 16.8px);
  225. }
  226. .text-responsive-lg {
  227. font-size: clamp(14.4px, min(4.8vw, 2.22vh), 21.6px);
  228. }
  229. .text-responsive-xl {
  230. font-size: clamp(16px, min(5.33vw, 2.46vh), 24px);
  231. }
  232. .text-responsive-2xl {
  233. font-size: clamp(19.2px, min(6.4vw, 2.96vh), 28.8px);
  234. }
  235. .text-responsive-3xl {
  236. font-size: clamp(22.4px, min(7.47vw, 3.45vh), 33.6px);
  237. }
  238. /* 响应式间距 */
  239. .spacing-responsive-sm {
  240. padding: clamp(8px, 2vw, 16px);
  241. }
  242. .spacing-responsive-md {
  243. padding: clamp(16px, 4vw, 32px);
  244. }
  245. .spacing-responsive-lg {
  246. padding: clamp(24px, 6vw, 48px);
  247. }
  248. /* ========================================
  249. iOS 安全区适配(iPhone X+ 刘海屏)
  250. ======================================== */
  251. @supports (padding: env(safe-area-inset-top)) {
  252. .safe-area-inset {
  253. padding-top: env(safe-area-inset-top);
  254. padding-bottom: env(safe-area-inset-bottom);
  255. padding-left: env(safe-area-inset-left);
  256. padding-right: env(safe-area-inset-right);
  257. }
  258. /* 针对全屏容器的安全区 */
  259. .safe-area-fullscreen {
  260. padding-top: max(env(safe-area-inset-top), 20px);
  261. padding-bottom: max(env(safe-area-inset-bottom), 20px);
  262. }
  263. }
  264. /* ========================================
  265. 防止文本溢出和重叠
  266. ======================================== */
  267. * {
  268. /* 防止长文本溢出 */
  269. word-wrap: break-word;
  270. word-break: break-word;
  271. overflow-wrap: break-word;
  272. }
  273. /* 防止 flex 子元素收缩导致内容重叠 */
  274. .flex > * {
  275. flex-shrink: 0;
  276. }
  277. /* 确保图片不溢出 */
  278. img {
  279. max-width: 100%;
  280. height: auto;
  281. display: block;
  282. }
  283. /* ========================================
  284. 浏览器兼容性修复
  285. ======================================== */
  286. /* Safari/iOS 修复:防止 input 缩放页面 */
  287. input[type="text"],
  288. input[type="number"],
  289. input[type="email"],
  290. input[type="tel"],
  291. textarea {
  292. font-size: max(16px, 1em); /* iOS Safari 16px 以下会缩放 */
  293. }
  294. /* Android Chrome 修复:防止地址栏导致高度跳动 */
  295. @supports (-webkit-touch-callout: none) {
  296. #root {
  297. min-height: -webkit-fill-available;
  298. }
  299. }