/* 极简下载站 — 详情页（移动优先 + 弹性布局） */
.detail-page {
    flex: 1;
    padding: 20px 0 calc(100px + var(--safe-bottom, 0px));
    min-height: 0;
}

.detail-shell {
    max-width: var(--max, 1100px);
}

.back-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    font-size: 0.875rem;
    color: var(--muted);
    text-decoration: none;
    margin-bottom: 16px;
    transition: color var(--transition);
}

.back-link:hover {
    color: var(--accent);
}

.detail-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.detail-main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.detail-hero-visual,
.detail-carousel {
    width: 100%;
    margin-bottom: 20px;
}

.detail-hero-visual,
.carousel-viewport {
    aspect-ratio: 16 / 9;
    max-height: 420px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--panel-bg, rgba(255, 255, 255, 0.72));
    border: 1px solid var(--line);
    box-shadow: var(--shadow-panel, 0 8px 32px rgba(15, 23, 42, 0.06));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.detail-hero-fallback {
    background: var(--carousel-fallback, #f4f4f5);
}

.detail-carousel {
    position: relative;
}

.carousel-viewport {
    width: 100%;
}

.carousel-track {
    position: absolute;
    inset: 0;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: scale(1.02);
    transition: opacity 0.45s ease, transform 0.45s ease;
    pointer-events: none;
}

.carousel-slide.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    z-index: 1;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background: var(--carousel-img-bg, linear-gradient(145deg, #f8fafc, #eef2f7));
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(17, 17, 17, 0.55);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.carousel-nav:hover {
    background: rgba(17, 17, 17, 0.78);
    transform: translateY(-50%) scale(1.05);
}

.carousel-nav.prev { left: 12px; }
.carousel-nav.next { right: 12px; }

.carousel-counter {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 3;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.55);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border: none;
    border-radius: 50%;
    background: var(--dot, #d4d4d8);
    cursor: pointer;
    padding: 0;
    transition: width 0.2s ease, background 0.2s ease;
}

.carousel-dot.active {
    width: 22px;
    border-radius: 999px;
    background: var(--accent, #1d4ed8);
}

.detail-hero-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-hero-initial {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 800;
    color: #a1a1aa;
    letter-spacing: -0.04em;
}

.detail-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 5vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.25;
    margin-bottom: 8px;
    word-break: break-word;
}

.detail-subtitle {
    font-size: 0.975rem;
    color: var(--ink-soft);
    margin-bottom: 12px;
}

.detail-description {
    font-size: 0.9375rem;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 28px;
    white-space: pre-wrap;
    word-break: break-word;
}

.detail-block {
    margin-bottom: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.detail-block h2 {
    font-family: var(--font-display);
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.feature-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.feature-mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feature-item h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 2px;
    word-break: break-word;
}

.feature-item p {
    font-size: 0.8125rem;
    color: var(--muted);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.media-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.media-grid img {
    width: calc(50% - 6px);
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    display: block;
    object-fit: cover;
}

.tutorial-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.tutorial-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.step-index {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink);
    flex-shrink: 0;
}

.tutorial-item h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.tutorial-item p {
    font-size: 0.8125rem;
    color: var(--muted);
    line-height: 1.6;
}

.tutorial-item img {
    margin-top: 12px;
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}

/* 桌面侧栏：手机隐藏侧栏按钮区，改用底部栏 */
.detail-aside {
    display: none;
}

.action-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.action-panel .meta-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 0.8125rem;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.action-panel .meta-row:last-of-type {
    margin-bottom: 16px;
}

.action-panel .meta-label {
    color: var(--muted);
    flex-shrink: 0;
}

.action-panel .meta-value {
    color: var(--ink);
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

.action-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-stack .btn {
    width: 100%;
    border-radius: var(--radius-sm);
}

/* 手机底部固定操作栏 */
.detail-mobile-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: flex;
    gap: 10px;
    padding: 12px max(16px, env(safe-area-inset-left)) calc(12px + var(--safe-bottom, 0px)) max(16px, env(safe-area-inset-right));
    background: var(--mobile-bar-bg, rgba(255, 255, 255, 0.94));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
}

.detail-mobile-bar .btn {
    flex: 1;
    border-radius: var(--radius-sm);
    min-height: 46px;
}

.detail-mobile-meta {
    display: none;
}

.detail-error {
    text-align: center;
    padding: 64px 20px;
    color: var(--muted);
}

/* 电脑端 */
@media (min-width: 900px) {
    .detail-page {
        padding: 32px 0 80px;
    }

    .detail-layout {
        flex-direction: row;
        align-items: flex-start;
        gap: 40px;
    }

    .detail-hero-visual,
    .carousel-viewport {
        max-height: 460px;
    }

    .detail-carousel {
        margin-bottom: 28px;
    }

    .detail-hero-initial {
        font-size: 4rem;
    }

    .detail-aside {
        display: block;
        position: sticky;
        top: calc(var(--nav-h, 64px) + 24px);
        width: 300px;
        flex-shrink: 0;
    }

    .detail-mobile-bar {
        display: none;
    }

    .media-grid img {
        width: calc(33.333% - 8px);
    }
}

@media (min-width: 600px) and (max-width: 899px) {
    .media-grid img {
        width: calc(33.333% - 8px);
    }

    .detail-page {
        padding-bottom: calc(110px + var(--safe-bottom, 0px));
    }
}
