/*
Theme Name: DownFlow Pro UI (Clean Structure Fix)
Author: Top Engineer
Version: 900.0
*/

:root {
    --primary: #007AFF; 
    --bg-body: #F5F7FA;
    --bg-card: #FFFFFF;
    --text-main: #1D1D1F;
    --text-sub: #86868B;
    --divider: #E5E5EA;
    --radius-l: 18px;
    --radius-m: 14px;
    --shadow-card: 0 4px 12px rgba(0,0,0,0.03);
    --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body { 
    margin: 0; padding: 0; 
    font-family: var(--font-stack);
    background: var(--bg-body); color: var(--text-main); 
    padding-bottom: 40px;
}
a { text-decoration: none; color: inherit; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* Navbar */
.df-navbar { position: sticky; top: 0; z-index: 999; background: rgba(255,255,255,0.98); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(0,0,0,0.06); width: 100%; height: 70px; display: flex; align-items: center; }
.nav-flex { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 20px; }
.brand { font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.search-bar { display: flex; align-items: center; background: #F0F2F5; border-radius: 40px; width: 380px; height: 44px; overflow: hidden; }
.search-input { flex: 1; background: transparent; border: none; outline: none; padding: 0 20px; font-size: 14px; }
.search-btn { background: var(--primary); color: #fff; border: none; padding: 0 28px; height: 100%; font-size: 15px; font-weight: 700; cursor: pointer; }

/* Hero */
.hero-section { margin-top: 20px; margin-bottom: 30px; }
.hero-card { border-radius: var(--radius-l); padding: 30px; color: white; background: linear-gradient(135deg, #007AFF 0%, #00C6FF 100%); position: relative; overflow: hidden; height: 220px; display: flex; flex-direction: column; justify-content: center; }
.hero-title { font-size: 32px; font-weight: 800; margin: 0 0 12px 0; }
.hero-sub { font-size: 15px; opacity: 0.95; }
.hero-btn { position: absolute; bottom: 30px; right: 30px; background: rgba(255,255,255,0.2); color: #fff; padding: 8px 24px; border-radius: 30px; font-size: 13px; border: 1px solid rgba(255,255,255,0.4); }

/* =========================================
   🔥 首页核心布局修复
   ========================================= */

/* 1. 热门飙升 (Grid) */
.scroll-section { margin-bottom: 40px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 16px; padding: 0 4px; }
.section-title { font-size: 20px; font-weight: 700; margin: 0; color: #111; }
.see-all { font-size: 13px; color: var(--primary); font-weight: 600; cursor: pointer; }

.scroll-wrapper { 
    display: grid; 
    grid-template-columns: repeat(8, 1fr); /* 电脑端 8 列 */
    gap: 20px 15px; 
}
.scroll-item { 
    display: flex; flex-direction: column; align-items: center; 
    text-align: center; width: 100%; overflow: hidden;
}
/* 锁死网格图标 */
.icon-wrap { width: 100%; aspect-ratio: 1/1; margin-bottom: 8px; display: flex; justify-content: center; }
.scroll-icon-img { 
    width: 100%; height: 100%; 
    max-width: 80px; max-height: 80px; /* 双重保险 */
    border-radius: 20px; object-fit: cover; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); 
    transition: transform 0.2s;
}
.scroll-item:hover .scroll-icon-img { transform: translateY(-3px); }

.scroll-meta h4 { font-size: 13px; font-weight: 700; margin: 0; color: #333; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.scroll-meta span { font-size: 11px; color: #999; display: block; margin-top: 3px; }

/* 2. 最新上架 (List) */
.app-list-vertical { 
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; 
}
.list-item { 
    display: flex; align-items: center; gap: 15px; 
    padding: 15px; background: #fff; border-radius: 18px; 
    box-shadow: var(--shadow-card); 
    height: 94px; /* 固定高度防止撑爆 */
    overflow: hidden;
}
/* 锁死列表图标 */
.list-icon-wrap { width: 64px; height: 64px; flex-shrink: 0; }
.list-icon-img { 
    width: 64px; height: 64px; 
    border-radius: 14px; object-fit: cover; 
    border: 1px solid rgba(0,0,0,0.03); 
    display: block;
}

.list-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.list-title { font-size: 16px; font-weight: 600; margin: 0 0 4px 0; color: #000; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.list-sub { font-size: 13px; color: #888; margin-bottom: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: block; }
.rating-stars { font-size: 11px; color: #FF9F0A; font-weight: 700; }
.btn-get { background: #F0F2F5; color: var(--primary); font-weight: 700; font-size: 13px; padding: 6px 18px; border-radius: 20px; border: none; cursor: pointer; }

/* =========================================
   内页 (Single Page)
   ========================================= */
.single-page { padding-top: 30px; padding-bottom: 50px; background: #fff; }
.app-header-card { display: flex; gap: 20px; margin-bottom: 30px; align-items: flex-start; }
.app-icon-large { width: 110px; height: 110px; border-radius: 24px; object-fit: cover; box-shadow: 0 10px 20px rgba(0,0,0,0.1); flex-shrink: 0; }
.app-info-box { flex: 1; display: flex; flex-direction: column; justify-content: space-between; height: 110px; padding: 4px 0; }
.app-title { font-size: 24px; font-weight: 700; margin: 0; line-height: 1.2; }
.app-subtitle { font-size: 13px; color: var(--text-sub); margin: 6px 0 0 0; }
.app-actions { display: flex; align-items: center; gap: 15px; margin-top: auto; }
.btn-get-large { background: var(--primary); color: #fff; font-weight: 700; padding: 8px 28px; border-radius: 20px; font-size: 14px; }

.app-stats-row { display: flex; justify-content: space-between; padding: 20px 0; margin-bottom: 30px; border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider); }
.stat-item { flex: 1; text-align: center; }
.stat-item.border-left { border-left: 1px solid var(--divider); }
.stat-value { font-size: 20px; font-weight: 700; color: var(--text-sub); }
.stat-label { font-size: 12px; color: var(--text-sub); margin-top: 6px; }

.screenshots-scroll { display: flex; gap: 15px; overflow-x: auto; padding-bottom: 30px; margin: 0 -20px; padding-left: 20px; scrollbar-width: none; }
.screenshot-item { width: 200px; height: 356px; flex-shrink: 0; border-radius: 20px; overflow: hidden; position: relative; border: 1px solid #eee; background: #fff; }
.screenshot-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mock-screen-content { position: absolute; top: 0; left: 0; width: 100%; height: 100%; padding: 30px 20px; display: flex; flex-direction: column; align-items: center; }
.mock-screen-content span { color: rgba(255,255,255,0.9); font-weight: 800; font-size: 16px; margin-bottom: 15px; text-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.mock-line { width: 80%; height: 8px; background: rgba(255,255,255,0.4); border-radius: 4px; margin-bottom: 10px; }
.mock-line.short { width: 50%; }

.app-details-grid { margin-bottom: 30px; background: #fff; padding: 0 20px; border-radius: 18px; border: 1px solid #f0f0f0; }
.detail-row { display: flex; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid #f5f5f5; font-size: 14px; }
.detail-row:last-child { border-bottom: none; }

.tags-cloud { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 40px; }
.tag-chip { background: #F2F2F7; color: #666; padding: 6px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; }

.content-section { margin-bottom: 40px; }
.content-body { font-size: 16px; line-height: 1.8; color: #333; }
.content-body h3 { font-size: 18px; margin: 20px 0 10px 0; }

.comment-list { display: flex; gap: 16px; overflow-x: auto; margin: 0 -20px; padding: 0 20px 20px 20px; scrollbar-width: none; }
.comment-item { background: #F2F2F7; border-radius: 18px; padding: 20px; width: 300px; flex-shrink: 0; }
.comment-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; color: #888; }
.comment-body { font-size: 14px; color: #444; margin-bottom: 10px; line-height: 1.5; }
.comment-stars { color: #FF9500; }

/* 猜你喜欢 (10个网格) */
.related-section .grid-10 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px 15px; }
.small-item .icon-wrap { max-width: 60px; max-height: 60px; margin: 0 auto; } /* 小图标 */
.small-item h4 { font-size: 12px; margin-top: 5px; }

/* 手机端适配 */
@media (max-width: 768px) {
    .container { padding: 0 16px; } 
    .df-navbar { height: 70px; } 
    .nav-flex { gap: 12px; }
    .brand { font-size: 20px; max-width: 40%; }
    .search-bar { width: auto; flex: 1; height: 38px; border-radius: 19px; }
    .search-input { padding: 0 12px; font-size: 13px; }
    .search-btn { padding: 0 16px; font-size: 13px; border-radius: 0; }
    
    .hero-card { padding: 24px; height: 200px; }
    .hero-title { font-size: 24px; }
    
    /* 手机端 4 列 */
    .scroll-wrapper { grid-template-columns: repeat(4, 1fr); gap: 10px; }
    
    /* 手机端列表变单列 */
    .app-list-vertical { grid-template-columns: 1fr; gap: 0; background: #fff; padding: 0 20px; border-radius: 18px; }
    .list-item { padding: 16px 0; border-radius: 0; border-bottom: 1px solid #f0f0f0; box-shadow: none; height: auto; }
    .list-icon-wrap { width: 52px; height: 52px; }
    .list-icon-img { width: 52px; height: 52px; }
    
    .app-header-card { flex-direction: column; align-items: center; text-align: center; gap: 15px; }
    .app-icon-large { width: 100px; height: 100px; }
    .app-info-box { height: auto; width: 100%; }
    .app-actions { justify-content: center; }
    
    .screenshot-item { width: 160px; height: 284px; }
    
    .related-section .grid-10 { grid-template-columns: repeat(5, 1fr); gap: 8px; }
    .small-item .icon-wrap { max-width: 100%; }
    .small-item h4 { font-size: 11px; transform: scale(0.9); }
}

/* Footer & Colors */
.pc-footer { background: #fff; text-align: center; padding: 40px 0; font-size: 12px; color: #999; margin-top: 40px; border-top: 1px solid #eee; }
.footer-nav { display: flex; justify-content: center; gap: 10px; margin-bottom: 10px; }
.g-blue { background: #007AFF; } .g-purple { background: #5856D6; } .g-red { background: #FF3B30; } 
.g-orange { background: #FF9500; } .g-green { background: #34C759; } .g-pink { background: #FF2D55; }