/* ==================== 移动端专用样式 ==================== */
/* 此文件仅在移动端(max-width: 768px)生效，完全按照预览_移动端.html */

@media (max-width: 768px) {
    /* 隐藏PC端专用元素 */
    .pc-only,
    .sidebar,
    .banner-side,
    .novel-grid.pc-only,
    .header-nav,
    .header-search,
    .header-actions-pc {
        display: none !important;
    }
    
    /* 显示移动端专用元素 */
    .mobile-only {
        display: block !important;
    }
    
    /* 底部导航特别处理 */
    .bottom-nav.mobile-only {
        display: block !important;
    }
    
    /* 横向滚动特别处理 */
    .novel-scroll.mobile-only {
        display: flex !important;
    }
    
    /* 头部inner特别处理 */
    .header-inner.mobile-only {
        display: flex !important;
    }
    
    /* ==================== 基础样式 ==================== */
    body {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
    
    /* ==================== 背景装饰 ==================== */
    .bg-decor {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: -1;
        overflow: hidden;
    }
    
    .bg-blob {
        position: absolute;
        border-radius: 50%;
        filter: blur(80px);
        opacity: 0.6;
        animation: float 8s ease-in-out infinite;
    }
    
    .bg-blob-1 {
        width: 200px;
        height: 200px;
        background: var(--candy-pink);
        top: -50px;
        right: -50px;
    }
    
    .bg-blob-2 {
        width: 150px;
        height: 150px;
        background: var(--candy-purple);
        top: 30%;
        left: -30px;
        animation-delay: -3s;
    }
    
    .bg-blob-3 {
        width: 180px;
        height: 180px;
        background: var(--candy-blue);
        bottom: 20%;
        right: -40px;
        animation-delay: -5s;
    }
    
    @keyframes float {
        0%, 100% { transform: translateY(0) scale(1); }
        50% { transform: translateY(-20px) scale(1.05); }
    }
    
    /* ==================== 顶部导航 ==================== */
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
        padding: env(safe-area-inset-top, 0) 16px 6px;
        padding-top: calc(6px + env(safe-area-inset-top, 0));
        background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.1) 100%);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255,255,255,0.3);
        height: auto !important;
    }
    
    /* 隐藏PC端所有元素 */
    .header-left,
    .header-center,
    .header-right {
        display: none !important;
    }
    
    /* 显示移动端专用头部 */
    .mobile-header.mobile-only {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    
    .mobile-header .logo {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 1.3rem;
        font-weight: 600;
        color: var(--text-dark);
        text-decoration: none;
    }
    
    .mobile-header .logo-icon {
        width: 36px;
        height: 36px;
        background: var(--gradient-main);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
    }
    
    .mobile-header-btns {
        display: flex;
        gap: 12px;
    }
    
    .header-btn-mobile {
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.6);
        border: none;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        cursor: pointer;
        transition: all 0.3s ease;
        backdrop-filter: blur(10px);
        text-decoration: none;
    }
    
    .header-btn-mobile:active {
        transform: scale(0.95);
    }
    
    /* ==================== 内容区 ==================== */
    .main-content {
        padding: 50px 16px 20px !important;
        padding-top: calc(50px + env(safe-area-inset-top, 0)) !important;
        max-width: 100% !important;
        display: block !important;
    }
    
    .content-wrapper {
        display: block !important;
        width: 100% !important;
    }
    
    /* 移动端搜索区域 */
    .mobile-search {
        margin-top: 0 !important;
        margin-bottom: 10px !important;
        padding-top: 0 !important;
    }
    
    .search-bar-mobile {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* ==================== 搜索栏 ==================== */
    .search-bar-mobile {
        background: rgba(255, 255, 255, 0.6);
        backdrop-filter: blur(15px);
        border: 1px solid rgba(255,255,255,0.5);
        border-radius: 100px;
        padding: 12px 20px;
        display: flex !important;
        align-items: center;
        gap: 12px;
        margin-bottom: 20px;
        box-shadow: 0 4px 20px rgba(196, 78, 255, 0.1);
    }
    
    .search-bar-mobile input {
        flex: 1;
        border: none;
        background: transparent;
        font-size: 1rem;
        color: var(--text-dark);
        font-family: inherit;
        outline: none;
    }
    
    .search-bar-mobile input::placeholder {
        color: var(--text-muted);
    }
    
    .search-icon {
        font-size: 1.2rem;
        color: var(--text-muted);
    }
    
    /* ==================== 轮播横幅 ==================== */
    .banner-section {
        margin-bottom: 24px !important;
    }
    
    /* 隐藏PC端的banner侧边 */
    .banner-side {
        display: none !important;
    }
    
    .banner-main {
        position: relative;
        height: 160px !important;
        border-radius: 28px !important;
        overflow: hidden !important;
        box-shadow: 0 8px 32px rgba(196, 78, 255, 0.15);
    }
    
    .banner-bg {
        position: absolute;
        inset: 0;
        background: var(--gradient-main);
        border-radius: 28px;
    }
    
    .banner-content {
        position: relative;
        height: 100%;
        padding: 20px !important;
        display: flex !important;
        flex-direction: column;
        justify-content: flex-start !important;
        color: white;
        text-decoration: none;
    }
    
    .banner-tag {
        display: inline-flex !important;
        align-items: center;
        gap: 4px;
        background: rgba(255,255,255,0.25);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 6px 12px;
        border-radius: 100px;
        font-size: 0.75rem;
        width: fit-content;
        margin-bottom: 12px;
        color: white;
    }
    
    .banner-title {
        font-size: 1.4rem !important;
        font-weight: 600;
        margin-bottom: 6px;
        text-shadow: 0 2px 10px rgba(0,0,0,0.2);
        color: white;
        /* 限制为单行，超出截断 */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    .banner-desc {
        font-size: 0.9rem;
        opacity: 0.9;
        display: block !important;
        color: white;
        /* 简洁显示，单行 */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .banner-btn {
        display: none !important;
    }
    
    .banner-dots {
        position: absolute;
        bottom: 12px;
        left: 50%;
        transform: translateX(-50%);
        display: flex !important;
        gap: 8px;
        z-index: 10;
    }
    
    .banner-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: rgba(255,255,255,0.4);
        transition: all 0.3s;
    }
    
    .banner-dot.active {
        width: 20px;
        border-radius: 10px;
        background: white;
    }
    
    /* ==================== 分类标签 ==================== */
    .categories-wrapper {
        position: relative;
        margin-bottom: 16px;
    }
    
    .categories {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-bottom: 0;
    }
    
    .categories::-webkit-scrollbar {
        display: none;
    }
    
    /* 滑动提示 - 底部小横条指示器 */
    .swipe-hint {
        display: flex;
        justify-content: center;
        padding-top: 8px;
    }
    
    .swipe-indicator {
        display: inline-block;
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: linear-gradient(90deg, var(--candy-pink), var(--candy-purple));
        opacity: 0.5;
    }
    
    .category-chip {
        flex-shrink: 0;
        padding: 10px 18px;
        background: rgba(255, 255, 255, 0.6);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255,255,255,0.5);
        border-radius: 100px;
        font-size: 0.9rem;
        color: var(--text-light);
        cursor: pointer;
        transition: all 0.3s;
        white-space: nowrap;
        text-decoration: none;
    }
    
    .category-chip.active {
        background: var(--gradient-main);
        color: white;
        border-color: transparent;
        box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
    }
    
    .category-chip:active {
        transform: scale(0.95);
    }
    
    /* ==================== 区块标题 ==================== */
    .section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
    }
    
    .section-title {
        font-size: 1.2rem !important;
        font-weight: 600;
        color: var(--text-dark);
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .section-title::before {
        content: '';
        width: 4px;
        height: 20px;
        background: var(--gradient-main);
        border-radius: 2px;
    }
    
    .section-more {
        font-size: 0.85rem;
        color: var(--candy-pink);
        display: flex;
        align-items: center;
        gap: 4px;
        text-decoration: none;
    }
    
    /* ==================== 小说卡片 - 横向滚动 ==================== */
    .novel-scroll.mobile-only {
        display: flex !important;
        gap: 14px;
        overflow-x: auto;
        padding-bottom: 8px;
        margin-bottom: 28px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .novel-scroll.mobile-only::-webkit-scrollbar {
        display: none;
    }
    
    .novel-scroll.mobile-only .novel-card {
        flex-shrink: 0;
        width: 110px;
        cursor: pointer;
        transition: transform 0.3s;
    }
    
    .novel-scroll.mobile-only .novel-card:active {
        transform: scale(0.95);
    }
    
    .novel-scroll.mobile-only .novel-cover {
        position: relative;
        width: 110px;
        height: 150px;
        border-radius: 20px;
        overflow: hidden;
        margin-bottom: 10px;
        box-shadow: 0 4px 20px rgba(196, 78, 255, 0.1);
    }
    
    .novel-scroll.mobile-only .novel-cover img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .novel-scroll.mobile-only .novel-cover-placeholder {
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, #FFE5EC 0%, #E8D5FF 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 2.5rem;
    }
    
    .novel-badge {
        position: absolute;
        top: 8px;
        left: 8px;
        padding: 4px 8px;
        border-radius: 6px;
        font-size: 0.65rem;
        font-weight: 600;
        color: white;
    }
    
    .badge-hot {
        background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    }
    
    .badge-new {
        background: linear-gradient(135deg, #4ECAFF 0%, #44B4FF 100%);
    }
    
    .badge-vip {
        background: linear-gradient(135deg, #FFD93D 0%, #FF9500 100%);
    }
    
    .novel-scroll.mobile-only .novel-title {
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--text-dark);
        line-height: 1.3;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    /* 隐藏移动端卡片的多余信息 */
    .novel-scroll.mobile-only .novel-meta,
    .novel-scroll.mobile-only .novel-author,
    .novel-scroll.mobile-only .novel-stats {
        display: none !important;
    }
    
    /* ==================== 排行榜 ==================== */
    .ranking-section {
        background: rgba(255, 255, 255, 0.6);
        backdrop-filter: blur(15px);
        border: 1px solid rgba(255,255,255,0.5);
        border-radius: 28px;
        padding: 20px;
        margin-bottom: 28px;
        box-shadow: 0 4px 20px rgba(196, 78, 255, 0.1);
    }
    
    .ranking-section .section-header {
        margin-bottom: 12px !important;
    }
    
    .ranking-tabs {
        display: flex;
        gap: 8px;
        margin-bottom: 16px;
        overflow: visible !important;
    }
    
    .ranking-tab {
        flex: 1;
        padding: 10px;
        text-align: center;
        font-size: 0.85rem;
        color: var(--text-light);
        background: rgba(255,255,255,0.5);
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .ranking-tab.active {
        background: var(--gradient-main);
        color: white;
        box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
    }
    
    /* 移动端排行榜使用单列布局 */
    .ranking-grid {
        display: flex !important;
        flex-direction: column;
        gap: 14px;
        grid-template-columns: unset !important;
    }
    
    .ranking-list {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }
    
    .ranking-item {
        display: flex;
        align-items: center;
        gap: 14px;
        cursor: pointer;
        transition: transform 0.2s;
    }
    
    .ranking-item:active {
        transform: translateX(4px);
    }
    
    .ranking-num {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
        font-weight: 700;
        border-radius: 6px;
        flex-shrink: 0;
    }
    
    .ranking-num.top-1 {
        background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
        color: white;
    }
    
    .ranking-num.top-2 {
        background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
        color: white;
    }
    
    .ranking-num.top-3 {
        background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
        color: white;
    }
    
    .ranking-num.normal {
        background: rgba(196, 78, 255, 0.1);
        color: var(--text-light);
    }
    
    .ranking-cover {
        width: 50px;
        height: 66px;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        flex-shrink: 0;
    }
    
    .ranking-cover img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .ranking-info {
        flex: 1;
        min-width: 0;
    }
    
    .ranking-title {
        font-size: 0.95rem;
        font-weight: 500;
        color: var(--text-dark);
        margin-bottom: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .ranking-meta {
        font-size: 0.75rem;
        color: var(--text-muted);
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .ranking-heat {
        display: flex;
        align-items: center;
        gap: 4px;
        color: var(--candy-pink);
    }
    
    /* ==================== 网格布局小说 ==================== */
    .novel-grid.mobile-only {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
        margin-bottom: 28px;
    }
    
    .grid-card {
        cursor: pointer;
        transition: transform 0.3s;
    }
    
    .grid-card:active {
        transform: scale(0.95);
    }
    
    .grid-cover {
        position: relative;
        aspect-ratio: 3/4;
        border-radius: 20px;
        overflow: hidden;
        margin-bottom: 8px;
        box-shadow: 0 4px 20px rgba(196, 78, 255, 0.1);
    }
    
    .grid-cover img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .grid-title {
        font-size: 0.85rem;
        font-weight: 500;
        color: var(--text-dark);
        line-height: 1.3;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    /* ==================== 底部导航 ==================== */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        padding: 8px 20px calc(8px + env(safe-area-inset-bottom));
        background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.1) 100%);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255,255,255,0.3);
        display: block !important;
    }
    
    .nav-items {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
    
    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 6px 16px;
        cursor: pointer;
        transition: all 0.3s;
        border-radius: 20px;
        text-decoration: none;
    }
    
    .nav-item.active {
        background: linear-gradient(135deg, rgba(255,107,157,0.15) 0%, rgba(196,78,255,0.15) 100%);
    }
    
    .nav-icon {
        font-size: 1.4rem;
        transition: transform 0.3s;
    }
    
    .nav-item.active .nav-icon {
        transform: scale(1.1);
    }
    
    .nav-label {
        font-size: 0.7rem;
        color: var(--text-muted);
        transition: color 0.3s;
    }
    
    .nav-item.active .nav-label {
        color: var(--candy-pink);
        font-weight: 600;
    }
    
    /* 中间大按钮 */
    .nav-center {
        position: relative;
        top: -20px;
    }
    
    .nav-center-btn {
        width: 56px;
        height: 56px;
        background: var(--gradient-main);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.6rem;
        color: white;
        box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
        transition: transform 0.3s, box-shadow 0.3s;
    }
    
    .nav-center-btn:active {
        transform: scale(0.9);
    }
    
    /* ==================== 隐藏PC端footer ==================== */
    .footer {
        display: none !important;
    }
}

/* ==================== 大屏手机适配 (414px+, iPhone Plus/Max) ==================== */
@media (min-width: 414px) and (max-width: 768px) {
    .main-content {
        padding-top: calc(52px + env(safe-area-inset-top, 0)) !important;
    }
    
    .mobile-search {
        margin-bottom: 12px !important;
    }
}

/* ==================== 平板适配 (600px-768px) ==================== */
@media (min-width: 600px) and (max-width: 768px) {
    .main-content {
        padding-top: calc(55px + env(safe-area-inset-top, 0)) !important;
        padding-left: 24px !important;
        padding-right: 24px !important;
    }
    
    .mobile-search {
        margin-bottom: 14px !important;
    }
    
    .categories {
        gap: 12px;
    }
    
    .category-chip {
        padding: 12px 22px;
        font-size: 1rem;
    }
}

/* ==================== 小屏手机适配 (375px以下) ==================== */
@media (max-width: 374px) {
    .main-content {
        padding: 48px 12px 16px !important;
        padding-top: calc(48px + env(safe-area-inset-top, 0)) !important;
    }
    
    .mobile-search {
        margin-bottom: 8px !important;
    }
    
    .category-chip {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .mobile-header .logo span {
        font-size: 1.1rem;
    }
}
