/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #ffffff;
    line-height: 1.6;
    color: #333;
}

h1, h2, h3, h4, h5, h6 {
    font-size: 100%;
    font-weight: 500;
    height: auto;
    padding-top: 0.12rem;
}

/* Main container */
.app-download-detail {
    min-height: 100vh;
    background-color: #ffffff;
    /* 在PC端居中显示，设置最大宽度 */
    max-width: 428px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Status bar section */
.status-bar-section {
    position: sticky;
    top: 0;
    z-index: 100;
    /* background-color: #f8f9fa; */
}

/* Header bar */
.header-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    /* padding: 0px 16px; */
    background: #fff;
    border-bottom: 1px solid #f8f8f8;
    min-height: 50px;
}

.back-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #007AFF;
    transition: background-color 0.2s ease;
}

.back-btn:hover {
    background-color: rgba(0, 122, 255, 0.1);
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    color: #1a1a1a;
}

/* Language switcher */
.language-switcher {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
}

.lang-btn {
    padding: 4px 8px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    background: #f0f0f0;
}

.lang-btn.active {
    background: #007AFF;
    color: white;
    border-color: #007AFF;
}

/* Main content */
.main-content {
    padding: 0 16px 20px;
}

/* App header section */
.app-header-section {
    /* background: white; */
    /* border-radius: 12px; */
    padding: 20px;
    margin-top: 16px;
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); */
}

.app-info-container {
    display: flex;
    gap: 16px;
}

.app-icon-wrapper {
    flex-shrink: 0;
}

.app-icon {
    width: 80px;
    height: 80px;
    border-radius: 22px;
    object-fit: cover;
}

.app-details {
    flex: 1;
}

.app-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.app-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0 0 16px 0;
    line-height: 1.4;
}

.download-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.download-btn {
    background: #007AFF;
    color: white;
    border: none;
    border-radius: 16px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background: #0056CC;
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Section divider */
.section-divider {
    height: 1px;
    /* background: #e8e8e8; */
    /* margin: 20px 0; */
}

/* App stats section */
.app-stats-section {
    /* background: white; */
    /* border-radius: 12px; */
    padding: 20px 0;
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); */
    margin-bottom: 20px;
}

.stats-container {
    display: flex;
    justify-content: space-between;
    align-items: start;
    text-align: center;
    position: relative;
}

.stats-container::after {
    content: '';
    position: absolute;
    right: 75%;
    top: 10%;
    bottom: 10%;
    width: 1px;
    background: #e8e8e8;
}

.stats-container::before {
    content: '';
    position: absolute;
    right: 50%;
    top: 10%;
    bottom: 10%;
    width: 1px;
    background: #e8e8e8;
}

.stat-item {
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.stat-sublabel {
    font-size: 12px;
    color: #666;
}

.star-rating {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin: 4px 0;
}

.star {
    width: 10px;
    height: 10px;
    background: #ddd;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.star.filled {
    background: #ff9500;
}

.ranking-info .rank-symbol {
    font-size: 12px;
    color: #666;
}

.ranking-info .rank-number {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

/* Screenshots section */
.screenshots-section {
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 16px 0;
}

.screenshots-carousel {
    position: relative;
    overflow: hidden;
}

.carousel-wrapper {
    overflow: hidden;
    /* border-radius: 12px; */
}

.carousel-track {
    display: flex;
    padding: 0 20px;
    gap: 12px;
    transition: transform 0.3s ease;
}

.screenshot-item {
    flex-shrink: 0;
    width: 250px;
}

.screenshot-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.screenshot-image:hover {
    transform: scale(1.02);
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: background 0.2s ease;
}

.indicator.active {
    background: #007AFF;
}

/* Description section */
.description-section {
    background: white;
    /* border-radius: 12px; */
    padding: 20px;
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); */
    margin-bottom: 20px;
}

.description-text {
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    margin: 0 0 16px 0;
}

.features-text {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
}

.features-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.features-list li {
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 4px;
}

.show-more-btn {
    background: none;
    border: none;
    color: #007AFF;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
}

/* Updates section */
.updates-section {
    background: white;
    /* border-radius: 12px; */
    padding: 20px;
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); */
    /* margin-bottom: 20px; */
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.version-history-btn {
    background: none;
    border: none;
    color: #007AFF;
    font-size: 12px;
    cursor: pointer;
}

.version-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.version-number {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.update-date {
    font-size: 14px;
    color: #666;
}

.update-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.update-list li {
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 4px;
}

/* Reviews section */
.reviews-section {
    /* background: white; */
    /* border-radius: 12px; */
    padding: 20px;
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); */
    margin-bottom: 20px;
}

.show-all-btn {
    background: none;
    border: none;
    color: #007AFF;
    font-size: 14px;
    cursor: pointer;
}

.rating-summary {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 20px;
}

.rating-score {
    font-size: 36px;
    font-weight: 600;
    color: #1a1a1a;
}

.rating-label {
    font-size: 14px;
    color: #666;
    margin-left: 8px;
}

.review-count {
    font-size: 14px;
    color: #666;
}

.rating-distribution {
    margin-bottom: 24px;
}

.rating-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.rating-stars {
    display: flex;
    gap: 2px;
}

.mini-star {
    width: 8px;
    height: 8px;
    background: #ff9500;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.mini-star:not(.filled) {
    background: #ddd;
}

.rating-progress {
    flex: 1;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #007AFF;
    transition: width 0.3s ease;
}

.helpful-reviews {
    margin-top: 20px;
}

.reviews-subtitle {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 16px 0;
}

.review-item {
    /* border: 1px solid #e8e8e8; */
    /* border-radius: 8px; */
    padding: 16px;
    /* margin-bottom: 12px; */
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* margin-bottom: 8px; */
}

.reviewer-rating {
    display: flex;
    gap: 2px;
}

.review-star {
    width: 12px;
    height: 12px;
    background: #ddd;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.review-star.filled {
    background: #ff9500;
}

.review-meta {
    font-size: 12px;
    color: #666;
}

.reviewer-name {
    margin-right: 8px;
}

.review-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px 0;
}

.review-content {
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    margin: 0 0 12px 0;
}

.developer-reply {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.reply-label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.reply-date {
    font-size: 12px;
    color: #666;
}

.reply-content {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin: 0;
}

/* App info section */
.app-info-section {
    /* background: white; */
    /* border-radius: 12px; */
    padding: 0 20px;
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); */
}

.info-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.info-label {
    font-size: 13px;
    color: #666;
}

.info-value {
    font-size: 13px;
    color: #333;
}

.info-value.age-rating-badge {
    display: inline-block;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.compatibility-info div {
    margin-bottom: 8px;
}

.compatibility-info strong {
    display: block;
    color: #333;
    margin-bottom: 2px;
}

.compatibility-info span {
    color: #666;
    font-size: 13px;
}

.app-links {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.app-link {
    color: #007AFF;
    font-size: 14px;
    text-decoration: none;
}

.app-link:hover {
    text-decoration: underline;
}

/* Image preview modal */
.image-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    cursor: pointer;
    justify-content: center;
    align-items: center;
}

.image-preview-modal.show {
    display: flex;
}

.image-preview-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 1001;
}

/* Loading state */
.download-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Responsive design */
@media (max-width: 428px) {
    .app-download-detail {
        max-width: 100%;
        margin: 0;
        box-shadow: none;
    }
    
    /* 移动端优化主要内容区域间距 */
    .main-content {
        padding: 0 16px 20px;
    }
    
    /* 移动端应用头部区域 */
    .app-header-section {
        padding: 16px;
        margin-top: 8px;
    }
    
    .app-info-container {
        gap: 12px;
    }
    
    .app-icon {
        width: 70px;
        height: 70px;
        border-radius: 18px;
    }
    
    .app-title {
        font-size: 18px;
        line-height: 1.3;
    }
    
    .app-subtitle {
        font-size: 13px;
        margin: 0 0 12px 0;
    }
    
    /* 移动端统计区域 */
    .app-stats-section {
        padding: 16px 0;
        margin-bottom: 16px;
    }
    
    .stat-item {
        height: 70px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    /* 移动端截图区域 */
    .screenshots-section {
        margin-bottom: 16px;
    }
    
    .section-title {
        font-size: 16px;
        margin: 0 0 12px 0;
    }
    
    /* 移动端截图轮播优化 */
    .screenshot-item {
        width: calc(100vw - 80px);
        max-width: 250px;
    }
    
    .screenshot-image {
        height: 350px;
        border-radius: 8px;
    }
    
    .carousel-track {
        gap: 8px;
        padding: 0 16px;
    }
    
    /* 移动端其他区域 */
    .description-section,
    .updates-section,
    .reviews-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .app-info-section {
        padding: 0 16px;
    }
}

@media (max-width: 768px) {
    .app-stats-section .stats-container::after,
    .app-stats-section .stats-container::before {
        display: none;
    }
    
    .screenshot-item {
        width: 250px;
    }
    
    .screenshot-image {
        height: 432px;
    }
    
    .main-content {
        padding: 0 12px 20px;
    }
    
    .app-header-section {
        padding: 20px;
    }
    
    .app-info-container {
        flex-direction: column;
        text-align: center;
    }
    
    .app-details {
        margin-top: 16px;
    }
    
    .stats-container {
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .stat-item {
        flex: 1;
    }
}

@media (max-width: 480px) {
    /* 极小屏幕优化 */
    .main-content {
        padding: 0 12px 20px;
    }
    
    .app-header-section {
        padding: 12px;
    }
    
    .app-info-container {
        gap: 10px;
    }
    
    .app-icon {
        width: 60px;
        height: 60px;
        border-radius: 15px;
    }
    
    .app-title {
        font-size: 16px;
    }
    
    .app-subtitle {
        font-size: 12px;
    }
    
    .download-btn {
        padding: 6px 16px;
        font-size: 13px;
    }
    
    /* 统计区域优化 */
    .app-stats-section {
        padding: 12px 0;
    }
    
    .stat-item {
        height: 60px;
    }
    
    .stat-value {
        font-size: 14px;
    }
    
    .stat-label,
    .stat-sublabel {
        font-size: 11px;
    }
    
    /* 截图轮播优化 */
    .screenshot-item {
        width: calc(100vw - 60px);
        max-width: 250px;
    }
    
    .screenshot-image {
        height: 320px;
        border-radius: 6px;
    }
    
    .carousel-track {
        gap: 6px;
        padding: 0 12px;
    }
    
    /* 其他区域优化 */
    .description-section,
    .updates-section,
    .reviews-section {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .app-info-section {
        padding: 0 12px;
    }
    
    .section-title {
        font-size: 15px;
    }
    
    .description-text,
    .features-text,
    .features-list li {
        font-size: 12px;
    }
    
    .language-switcher {
        position: static;
        transform: none;
        margin-top: 8px;
        justify-content: center;
    }
    
    .header-bar {
        /* flex-direction: column; */
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .carousel-track {
        gap: 8px;
    }
    
    .screenshot-item {
        width: 250px;
    }
    
    .screenshot-image {
        height: auto;
    }
}