Files

627 lines
13 KiB
CSS

/**
* 移动端优化样式表
* 针对移动设备的响应式设计和触摸优化
*/
/* ========== 基础移动端优化 ========== */
/* 小屏幕设备 (手机) - 最大宽度 768px */
@media (max-width: 768px) {
/* 全局字体和间距优化 */
body {
font-size: 14px;
overflow-x: hidden;
}
/* 容器优化 */
.container {
width: 95%;
padding: 0 10px;
margin: 1rem auto;
}
/* 页面标题优化 */
.page-title {
font-size: 1.5rem !important;
margin-bottom: 1rem !important;
line-height: 1.3;
padding: 0 10px;
}
.page-subtitle {
font-size: 0.9rem !important;
margin-bottom: 1.5rem !important;
padding: 0 10px;
line-height: 1.4;
}
/* 头部导航优化 */
.header {
padding: 12px 0;
position: sticky;
top: 0;
z-index: 1000;
background-color: #ffffff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.header-content {
padding: 0 15px;
}
.logo {
height: 45px !important;
}
/* 导航菜单移动端优化 */
.menu-toggle {
display: block;
font-size: 1.8rem;
padding: 8px;
color: #333;
background: none;
border: none;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.nav-list {
position: fixed;
top: 70px;
right: 0;
left: 0;
background-color: #ffffff !important;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
border-radius: 0 0 12px 12px;
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease-in-out;
z-index: 999;
}
.nav-menu.active .nav-list {
max-height: 500px;
padding: 15px;
}
.nav-list li {
margin: 0;
border-bottom: 1px solid #f0f0f0;
}
.nav-list li:last-child {
border-bottom: none;
}
.nav-list li a {
display: block;
padding: 15px 10px;
font-size: 16px;
color: #333 !important;
text-decoration: none;
transition: background-color 0.2s;
}
.nav-list li a:active {
background-color: #f5f5f5;
}
/* Tab 标签页优化 */
.tab-container {
flex-direction: column;
gap: 10px;
margin-bottom: 1.5rem;
}
.tab {
width: 100%;
max-width: none;
padding: 15px 20px;
font-size: 15px;
border-radius: 10px;
justify-content: center;
min-height: 50px;
-webkit-tap-highlight-color: transparent;
}
.tab i {
font-size: 18px;
margin-right: 8px;
}
/* 内容区域优化 */
.content {
padding: 1.2rem !important;
border-radius: 12px;
margin-bottom: 1rem;
}
/* 输入框和搜索框优化 */
.input-group,
.search-container {
flex-direction: column;
gap: 12px;
}
.input-group input,
.search-container input,
#imageInput {
width: 100% !important;
padding: 14px 16px !important;
font-size: 16px !important; /* 防止 iOS 自动缩放 */
border-radius: 10px !important;
min-height: 48px; /* 增加触摸目标大小 */
}
.input-group button,
.search-container button {
width: 100% !important;
padding: 14px 20px !important;
font-size: 16px !important;
min-height: 48px;
border-radius: 10px !important;
-webkit-tap-highlight-color: transparent;
}
/* 按钮优化 - 增加触摸目标 */
button, .btn {
min-height: 44px; /* iOS 推荐的最小触摸目标 */
padding: 12px 20px;
font-size: 15px;
-webkit-tap-highlight-color: transparent;
}
/* Registry 选择器优化 */
.registry-tabs {
gap: 8px;
padding: 10px;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
}
.registry-tabs::-webkit-scrollbar {
display: none;
}
.registry-tab {
padding: 10px 16px;
font-size: 13px;
white-space: nowrap;
flex-shrink: 0;
min-height: 44px;
-webkit-tap-highlight-color: transparent;
}
/* 搜索结果优化 */
#searchResults {
grid-template-columns: 1fr !important;
gap: 15px;
}
.search-result-item {
padding: 16px !important;
border-radius: 12px;
}
.search-result-item h3 {
font-size: 16px !important;
line-height: 1.4;
}
.search-result-item p {
font-size: 13px;
line-height: 1.5;
}
/* 命令显示区域优化 */
.command-box,
.command-display {
padding: 12px;
font-size: 13px;
border-radius: 10px;
word-break: break-all;
}
.command-box pre,
.command-display pre {
font-size: 12px !important;
line-height: 1.6;
white-space: pre-wrap;
word-wrap: break-word;
}
/* 复制按钮优化 */
.copy-btn,
.copy-button {
padding: 10px 16px !important;
font-size: 14px !important;
min-height: 44px;
border-radius: 8px;
-webkit-tap-highlight-color: transparent;
}
/* 标签表格优化 */
.tag-table {
font-size: 13px;
overflow-x: auto;
display: block;
-webkit-overflow-scrolling: touch;
}
.tag-table thead,
.tag-table tbody,
.tag-table tr {
display: block;
}
.tag-table thead {
display: none; /* 在移动端隐藏表头 */
}
.tag-table tr {
margin-bottom: 15px;
border: 1px solid #e5e7eb;
border-radius: 10px;
padding: 12px;
background: white;
}
.tag-table td {
display: flex;
justify-content: space-between;
padding: 8px 0 !important;
border: none !important;
text-align: left !important;
}
.tag-table td::before {
content: attr(data-label);
font-weight: 600;
color: #64748b;
margin-right: 10px;
}
/* 隐藏某些不重要的列 */
.tag-table td:nth-child(3),
.tag-table td:nth-child(4) {
font-size: 12px;
color: #64748b;
}
/* 文档列表优化 */
#documentList {
padding: 12px;
max-height: 300px;
}
#documentationText {
padding: 16px !important;
}
#documentationText h1 {
font-size: 1.4rem !important;
}
#documentationText h2 {
font-size: 1.2rem !important;
}
#documentationText h3 {
font-size: 1.05rem !important;
}
#documentationText pre {
font-size: 12px !important;
padding: 12px !important;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
#documentationText code {
font-size: 12px !important;
}
/* 返回顶部按钮优化 */
.back-to-top-btn {
bottom: 20px !important;
right: 20px !important;
width: 50px !important;
height: 50px !important;
font-size: 20px !important;
-webkit-tap-highlight-color: transparent;
}
/* 搜索无结果优化 */
.empty-result {
padding: 40px 20px !important;
margin: 15px 0 !important;
}
.empty-result .empty-icon {
width: 60px !important;
height: 60px !important;
margin-bottom: 20px !important;
}
.empty-result .empty-icon i {
font-size: 28px !important;
}
.empty-result h3 {
font-size: 18px !important;
margin-bottom: 10px !important;
}
.empty-result > p {
font-size: 14px !important;
margin-bottom: 20px !important;
}
.empty-tips {
padding: 16px !important;
max-width: 100% !important;
}
.empty-tips > p {
font-size: 13px !important;
}
.empty-tips ul li {
font-size: 13px !important;
padding: 5px 0 !important;
}
/* 特性卡片优化 */
.features {
grid-template-columns: 1fr !important;
gap: 15px;
}
.feature-card {
padding: 1.5rem;
}
/* 加载指示器优化 */
.loading-indicator {
padding: 2rem 0;
font-size: 1rem;
}
}
/* ========== 超小屏幕设备优化 (小于 480px) ========== */
@media (max-width: 480px) {
.page-title {
font-size: 1.3rem !important;
}
.page-subtitle {
font-size: 0.85rem !important;
}
.logo {
height: 40px !important;
}
.tab {
padding: 12px 16px;
font-size: 14px;
}
.content {
padding: 1rem !important;
}
.registry-tab {
padding: 8px 12px;
font-size: 12px;
}
.registry-tab span {
display: none; /* 只显示图标 */
}
.search-result-item {
padding: 14px !important;
}
.command-box,
.command-display {
font-size: 12px;
padding: 10px;
}
}
/* ========== 横屏模式优化 ========== */
@media (max-width: 768px) and (orientation: landscape) {
.header {
padding: 8px 0;
}
.logo {
height: 35px !important;
}
.tab-container {
flex-direction: row;
flex-wrap: wrap;
}
.tab {
flex: 1 1 auto;
min-width: 150px;
}
}
/* ========== 触摸优化 ========== */
@media (hover: none) and (pointer: coarse) {
/* 移除 hover 效果,使用 active 状态 */
a:hover,
button:hover,
.btn:hover {
transform: none;
}
a:active,
button:active,
.btn:active {
opacity: 0.7;
transform: scale(0.98);
}
/* 优化点击反馈 */
.tab:active {
transform: scale(0.98);
opacity: 0.9;
}
.registry-tab:active {
transform: scale(0.95);
}
.copy-btn:active,
.copy-button:active {
transform: scale(0.95);
}
}
/* ========== iOS 特定优化 ========== */
@supports (-webkit-touch-callout: none) {
/* iOS Safari 优化 */
input,
textarea,
select {
font-size: 16px !important; /* 防止缩放 */
}
/* 优化 iOS 滚动 */
.nav-list,
.registry-tabs,
#documentationText,
.tag-table {
-webkit-overflow-scrolling: touch;
}
/* 移除 iOS 默认样式 */
input,
button,
textarea {
-webkit-appearance: none;
border-radius: 10px;
}
}
/* ========== 平板设备优化 (481px - 768px) ========== */
@media (min-width: 481px) and (max-width: 768px) {
.container {
width: 90%;
}
#searchResults {
grid-template-columns: repeat(2, 1fr) !important;
gap: 20px;
}
.tab-container {
flex-direction: row;
flex-wrap: wrap;
}
.tab {
flex: 1 1 calc(50% - 10px);
min-width: 200px;
}
}
/* ========== 中等平板优化 (769px - 992px) ========== */
@media (min-width: 769px) and (max-width: 992px) {
.container {
width: 92%;
}
#searchResults {
grid-template-columns: repeat(2, 1fr);
}
}
/* ========== 可访问性优化 ========== */
@media (max-width: 768px) {
/* 增加焦点指示器 */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
outline: 2px solid var(--primary-color, #3D7CF4);
outline-offset: 2px;
}
/* 优化跳过导航链接 */
.skip-to-content {
position: absolute;
top: -40px;
left: 0;
background: var(--primary-color, #3D7CF4);
color: white;
padding: 8px 16px;
text-decoration: none;
border-radius: 0 0 4px 0;
z-index: 10000;
}
.skip-to-content:focus {
top: 0;
}
}
/* ========== 性能优化 ========== */
@media (max-width: 768px) {
/* 减少动画以提高性能 */
* {
animation-duration: 0.2s !important;
transition-duration: 0.2s !important;
}
/* 优化滚动性能 */
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
/* ========== 暗色模式支持 ========== */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
body {
background-color: #1a1a1a;
color: #e5e5e5;
}
.header {
background-color: #2a2a2a;
border-bottom-color: #3a3a3a;
}
.content,
.search-result-item,
.tag-table tr {
background-color: #2a2a2a;
border-color: #3a3a3a;
}
.nav-list {
background-color: #2a2a2a;
}
.nav-list li a {
color: #e5e5e5;
}
input,
textarea,
select {
background-color: #3a3a3a;
color: #e5e5e5;
border-color: #4a4a4a;
}
}