:root {
    --primary: #FF6B6B;
    --primary-dark: #ee5253;
    --secondary: #4ECDC4;
    --quark-blue: #0066FF;
    --gradient: linear-gradient(135deg, #FF6B6B 0%, #4ECDC4 100%);
    --text-dark: #2c3e50;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --bg-page: #f4f7f9;
    --card-bg: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-page);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 18px;
}

/* ===== 顶部导航 ===== */
.site-header {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    flex-wrap: wrap;
    padding: 8px 18px;
}

.site-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.site-logo i {
    color: var(--primary);
}

.mobile-actions {
    display: none;
    align-items: center;
    gap: 8px;
}

.mobile-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mobile-icon-btn.is-active {
    background: #fff0f0;
    border-color: #ffd6d6;
    color: var(--primary);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.site-nav a {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.92rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active {
    background: #fff0f0;
    color: var(--primary);
}

.header-search {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 4px 6px 4px 14px;
    border: 1px solid transparent;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.header-search:focus-within {
    background: #fff;
    border-color: var(--primary);
}

.header-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.88rem;
    width: 150px;
    color: var(--text-dark);
}

.header-search button {
    border: none;
    background: var(--primary);
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.mobile-icon-btn:focus-visible,
.modal-close-btn:focus-visible,
.download-btn-single:focus-visible,
.modal-action-btn:focus-visible {
    outline: 3px solid rgba(255, 107, 107, 0.4);
    outline-offset: 2px;
}

/* ===== 首页 Hero 横幅 ===== */
.hero-banner {
    background: var(--gradient);
    color: #fff;
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 28px;
}

.hero-banner h1 {
    font-size: 1.9rem;
    margin-bottom: 8px;
}

.hero-banner p {
    font-size: 1rem;
    opacity: 0.92;
    margin-bottom: 20px;
}

.hero-search {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    background: #fff;
    border-radius: 999px;
    padding: 5px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

/* 设为 16px 彻底防止 iOS / 微信点击输入框自动放大页面 */
.hero-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    padding: 10px 16px;
    font-size: 16px;
    border-radius: 999px;
    color: var(--text-dark);
}

.hero-search input::placeholder {
    font-size: 0.92rem;
    color: #94a3b8;
}

.hero-search button {
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 10px 22px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.hero-search button:hover {
    background: var(--primary-dark);
}

/* ===== 分类标签条 & 面包屑 ===== */
.main-content {
    flex: 1;
    padding: 24px 0 40px;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-pill {
    padding: 7px 16px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border-color);
    font-size: 0.88rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.filter-pill:hover,
.filter-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.breadcrumb {
    font-size: 0.86rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.list-header {
    background: #fff;
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.list-header h1 {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.list-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===== 资源卡片网格 ===== */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.resource-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.resource-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.card-thumb {
    position: relative;
    height: 160px;
    background: #f8fafc;
    overflow: hidden;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #fff5f5 0%, #e6fffa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--primary);
    opacity: 0.7;
}

.card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 999px;
}

.card-inline-badge {
    display: inline-block;
    align-self: flex-start;
    background: #fff0f0;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
}

.card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-desc {
    font-size: 0.86rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.meta-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.meta-tag {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    color: #475569;
}

.card-go {
    color: var(--primary);
    font-weight: 600;
    white-space: nowrap;
}

/* ===== 详情页卡片 ===== */
.detail-wrapper {
    max-width: 720px;
    margin: 0 auto;
}

.detail-card {
    background: #fff;
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.07);
    border: 1px solid var(--border-color);
}

.detail-header {
    text-align: center;
    margin-bottom: 1.8rem;
}

.detail-header h1 {
    font-size: 1.7rem;
    margin-bottom: 8px;
}

.detail-subtitle {
    color: var(--text-muted);
    font-size: 0.98rem;
    margin-bottom: 14px;
}

.detail-badges {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.82rem;
}

.detail-badges span {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 12px;
    border-radius: 999px;
}

/* 统一下载按钮：去下载 + （夸克网盘） */
.download-box {
    margin: 1.5rem 0;
    text-align: center;
}

.download-btn-single {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 240px;
    padding: 14px 32px;
    border-radius: 16px;
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 10px 24px rgba(255, 107, 107, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    cursor: pointer;
}

.download-btn-single:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow: 0 14px 28px rgba(255, 107, 107, 0.38);
}

.download-btn-single .btn-main {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-btn-single .btn-sub {
    font-size: 0.8rem;
    opacity: 0.92;
    margin-top: 2px;
    font-weight: 400;
}

.download-btn-single[href=""] {
    display: none;
}

/* 提示与二维码区 */
.qr-section {
    background: #f8fafc;
    padding: 1.4rem;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 1.4rem;
    border: 1px solid var(--border-color);
}

.qr-code {
    width: 170px;
    height: 170px;
    margin: 0 auto 10px;
    display: block;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.qr-caption {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.instruction-card {
    background: #fffaf0;
    border-left: 5px solid #ed8936;
    border-radius: 12px;
    padding: 1rem 1.2rem;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    color: #4a5568;
}

.highlight-step {
    background: #fff3cd;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    color: #856404;
}

/* 富文本正文 */
.detail-content {
    border-top: 1px solid #edf2f7;
    padding-top: 1.5rem;
    font-size: 0.96rem;
    line-height: 1.8;
    color: #334155;
    word-break: break-word;
}

.detail-content h2,
.detail-content h3 {
    margin: 1.3rem 0 0.6rem;
    color: var(--text-dark);
}

.detail-content p {
    margin-bottom: 0.9rem;
}

.detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 10px 0;
}

.detail-content ul,
.detail-content ol {
    padding-left: 1.4rem;
    margin-bottom: 1rem;
}

.detail-nav {
    margin-top: 2rem;
    padding-top: 1.2rem;
    border-top: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.detail-nav a:hover {
    color: var(--primary);
}

/* ===== 分页条 ===== */
.pagination-wrap {
    margin-top: 30px;
    text-align: center;
}

.pagination-wrap .page-bar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-wrap a,
.pagination-wrap span {
    display: inline-block;
    padding: 7px 13px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border-color);
    font-size: 0.88rem;
    color: var(--text-muted);
}

.pagination-wrap a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-wrap .page-num-current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.empty-state {
    background: #fff;
    border-radius: 16px;
    padding: 48px 20px;
    text-align: center;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

/* ===== 页脚 ===== */
.site-footer {
    background: #fff;
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== 弹窗 ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: #fff;
    width: 100%;
    max-width: 380px;
    border-radius: 20px;
    padding: 2rem 1.5rem 1.6rem;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
    text-align: center;
    transform: scale(0.9) translateY(16px);
    transition: transform 0.25s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f3f5;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #666;
}

.modal-title {
    font-size: 1.2rem;
    margin-bottom: 6px;
    font-weight: 700;
}

.modal-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.modal-qrcode-wrapper {
    display: inline-block;
    padding: 10px;
    border-radius: 14px;
    border: 2px dashed var(--border-color);
    margin-bottom: 14px;
}

.modal-qrcode {
    width: 190px;
    height: 190px;
    display: block;
    border-radius: 8px;
    object-fit: cover;
}

.modal-steps {
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.85rem;
    color: #4a5568;
    text-align: left;
    line-height: 1.65;
}

.modal-steps .em {
    color: #e53e3e;
    font-weight: 700;
}

.modal-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--quark-blue);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
}

/* ===== 触控设备防输入框放大兜底 ===== */
@media (pointer: coarse) {
    input,
    textarea,
    select {
        font-size: 16px;
    }
}

/* ===== 响应式适配 ===== */
@media (max-width: 900px) {
    .resource-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-inner {
        min-height: 54px;
        padding: 6px 18px;
        gap: 10px;
    }

    .site-logo {
        font-size: 1.12rem;
    }

    .mobile-actions {
        display: inline-flex;
    }

    /* 手机端默认收起导航与搜索，保留单行清爽体验 */
    .site-nav,
    .header-search {
        display: none;
        width: 100%;
        flex-basis: 100%;
        padding-top: 8px;
        padding-bottom: 6px;
        border-top: 1px solid #f1f5f9;
    }

    .site-nav.is-open {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .site-nav.is-open a {
        padding: 7px 14px;
        background: #f8fafc;
        font-size: 0.88rem;
    }

    .site-nav.is-open a.active {
        background: #fff0f0;
    }

    .header-search.is-open {
        display: flex;
        padding: 5px 6px 5px 14px;
        margin-top: 4px;
        margin-bottom: 4px;
        border-top: none;
    }

    /* 手机端顶部搜索框同样设为 16px 防止点击放大 */
    .header-search.is-open input {
        flex: 1;
        width: auto;
        font-size: 16px;
    }

    .header-search.is-open input::placeholder {
        font-size: 0.88rem;
    }

    .hero-banner {
        padding: 26px 16px;
        margin-bottom: 18px;
    }

    .hero-banner h1 {
        font-size: 1.45rem;
    }

    .hero-banner p {
        font-size: 0.9rem;
        margin-bottom: 14px;
    }
}

@media (max-width: 600px) {
    .resource-grid {
        grid-template-columns: 1fr;
    }

    .detail-card {
        padding: 1.4rem 1.15rem;
    }

    .detail-header h1 {
        font-size: 1.45rem;
    }

    .download-btn-single {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
    }
}