* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f5f5f5;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }

/* 顶部栏 */
.m-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #fff;
    font-size: 12px;
    color: #999;
    border-bottom: 1px solid #f0f0f0;
}
.m-topbar a { color: #666; padding: 0 8px; }

/* 搜索区 */
.m-search-area {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 16px 16px;
}
.m-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.m-logo-img { height: 32px; width: auto; border-radius: 6px; }
.m-logo-text {
    font-size: 22px;
    font-weight: bold;
    color: #fff;
}
.m-search-box {
    display: flex;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.m-engine-select {
    position: relative;
    padding: 10px 12px;
    font-size: 13px;
    color: #667eea;
    font-weight: 500;
    border-right: 1px solid #eee;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.m-engine-select::after {
    content: ' ▾';
    font-size: 10px;
}
.m-engine-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    min-width: 100px;
    overflow: hidden;
}
.m-engine-list.show { display: block; }
.m-engine-item {
    padding: 10px 14px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
}
.m-engine-item:active { background: #f5f5f5; }
.m-search-form {
    display: flex;
    flex: 1;
}
.m-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 12px;
    font-size: 14px;
    min-width: 0;
    background: transparent;
}
.m-search-btn {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
}
.m-search-btn:active { background: #5a6fd6; }
.m-hotwords {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.m-hotwords::-webkit-scrollbar { display: none; }
.m-hotword {
    background: rgba(255,255,255,0.2);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}
.m-hotword:active { background: rgba(255,255,255,0.35); }

/* 快捷入口 */
.m-quicklinks {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 12px 12px 8px;
    background: #fff;
    margin-bottom: 8px;
}
.m-quicklink-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    border-radius: 8px;
}
.m-quicklink-item:active { background: #f5f5f5; }
.m-quicklink-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
}
.m-quicklink-icon-text {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
}
.m-quicklink-name {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* 分组标签 */
.m-group-tabs {
    display: flex;
    overflow-x: auto;
    gap: 0;
    background: #fff;
    padding: 0 12px;
    border-bottom: 1px solid #f0f0f0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: sticky;
    top: 0;
    z-index: 50;
}
.m-group-tabs::-webkit-scrollbar { display: none; }
.m-group-tab {
    padding: 12px 14px;
    font-size: 14px;
    color: #666;
    white-space: nowrap;
    position: relative;
    flex-shrink: 0;
}
.m-group-tab.active {
    color: #667eea;
    font-weight: 600;
}
.m-group-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: #667eea;
    border-radius: 2px;
}

/* 通用板块 */
.m-section {
    background: #fff;
    margin: 8px 0;
    padding: 14px 14px 8px;
}
.m-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}
.m-refresh-btn {
    font-size: 12px;
    color: #667eea;
    font-weight: normal;
}

/* 热搜列表 */
.m-hot-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
.m-hot-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    border-radius: 6px;
    font-size: 13px;
    color: #444;
}
.m-hot-item:active { background: #f5f5f5; }
.m-hot-num {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: #eee;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}
.m-hot-num.top { background: #667eea; color: #fff; }
.m-hot-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 网站宫格 */
.m-site-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 8px;
}
.m-site-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    border-radius: 8px;
}
.m-site-item:active { background: #f5f5f5; }
.m-site-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    background: #f0f0f0;
}
.m-site-icon-fallback {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
}
.m-site-name {
    font-size: 11px;
    color: #555;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* 底部导航栏 */
.m-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
    z-index: 200;
}
.m-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
    font-size: 11px;
    color: #999;
}
.m-bar-item.active { color: #667eea; }
.m-bar-icon { font-size: 20px; }

/* 面板 */
.m-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    max-height: 70vh;
    z-index: 300;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}
.m-panel.show { transform: translateY(0); }
.m-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.m-panel-close {
    font-size: 18px;
    color: #999;
    padding: 4px 8px;
}
.m-panel-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}
.m-panel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f8f8f8;
}
.m-panel-item:active { background: #f5f5f5; }

/* 遮罩 */
.m-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 250;
    display: none;
}
.m-overlay.show { display: block; }

/* 底部间距 */
.m-footer {
    text-align: center;
    padding: 16px 16px 80px;
    font-size: 12px;
    color: #bbb;
}
