/* 卡包库 / 卡包详情页样式
 *
 * 风格对齐 ankideck.html 参考：画布 #F8FAFC、正文 #0F172A、主色 #2563EB，
 * Inter + Noto Sans SC，白色圆角卡片 + slate 细边框，最大宽度 1040px 两栏。
 */
:root {
    --canvas: #F8FAFC;
    --ink: #0F172A;
    --ink-2: #475569;
    --ink-3: #94A3B8;
    --line: #E2E8F0;
    --line-soft: #F1F5F9;
    --academic: #2563EB;
    --academic-dark: #1D4ED8;
    --font: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.decks-page, .deck-page {
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- 顶栏 ---------- */
.dk-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(226, 232, 240, .8);
}
.dk-header-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
/* 顶栏左侧 Logo 与首页保持一致 */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--ink);
    font-size: 1.4rem;
    font-weight: 800;
}
.logo:hover { opacity: .8; }
.logo-icon { display: inline-flex; align-items: center; }
.logo-icon img {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: block;
}
.dk-header-links { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--ink-2); }
.dk-header-links a {
    color: var(--ink-2);
    text-decoration: none;
    transition: color .15s;
    white-space: nowrap;
}
.dk-header-links a:hover { color: var(--ink); }
.dk-lang { display: flex; gap: 4px; }
.dk-lang button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    border-radius: 8px;
    font-size: 12px;
    padding: 4px 10px;
    cursor: pointer;
    font-family: inherit;
}
.dk-lang button.is-active {
    background: var(--academic);
    border-color: var(--academic);
    color: #fff;
}

/* ---------- 主体 ---------- */
.deck-back-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--ink-2);
    text-decoration: none;
}
.deck-back-link:hover { color: var(--academic); }

.dk-main {
    flex: 1;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 32px 24px 64px;
    box-sizing: border-box;
}

/* ---------- 工具栏（卡包库） ---------- */
.dk-toolbar { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.dk-toolbar-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.dk-page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.dk-page-sub { color: var(--ink-2); font-size: 14px; margin: 4px 0 0; }
.dk-search {
    flex: 1;
    min-width: 220px;
    max-width: 420px;
    margin-left: auto;
    position: relative;
}
.dk-search input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    padding: 10px 14px 10px 38px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.dk-search input:focus {
    border-color: var(--academic);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.dk-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--ink-3);
    pointer-events: none;
}

.dk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dk-chip {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}
.dk-chip:hover { border-color: #CBD5E1; color: var(--ink); }
.dk-chip.is-active {
    background: var(--academic);
    border-color: var(--academic);
    color: #fff;
    font-weight: 500;
}

.dk-sort {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 3px;
    width: fit-content;
}
.dk-sort button {
    border: 0;
    background: transparent;
    color: var(--ink-2);
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
}
.dk-sort button.is-active { background: var(--academic); color: #fff; font-weight: 500; }

/* ---------- 卡包网格 ---------- */
.dk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.dk-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: var(--ink);
    transition: transform .15s, box-shadow .15s;
}
.dk-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
}
.dk-card-cover {
    aspect-ratio: 16 / 10;
    background: var(--line-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.dk-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.dk-card-cover-fallback { color: var(--ink-3); font-size: 13px; }
.dk-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.dk-card-cat {
    font-size: 11px;
    color: var(--academic);
    background: #EFF6FF;
    border-radius: 999px;
    padding: 2px 8px;
    width: fit-content;
}
.dk-card-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dk-card-summary {
    font-size: 12.5px;
    color: var(--ink-2);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}
.dk-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--ink-3);
    padding-top: 8px;
    border-top: 1px solid var(--line-soft);
}
.dk-card-meta .score { color: #D97706; font-weight: 600; }
.dk-card-meta .count { color: var(--ink-2); }
.dk-card-price { margin-left: auto; font-weight: 600; color: var(--academic); }
.dk-card-price.is-free { color: #16A34A; }

/* ---------- 加载/状态 ---------- */
.dk-more {
    margin: 28px auto 0;
    display: block;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    font-size: 14px;
    font-family: inherit;
    border-radius: 10px;
    padding: 10px 28px;
    cursor: pointer;
    transition: all .15s;
}
.dk-more:hover { border-color: var(--academic); color: var(--academic); }
.dk-more[disabled] { opacity: .5; cursor: default; }
.dk-state {
    text-align: center;
    color: var(--ink-3);
    font-size: 14px;
    padding: 48px 0;
}
.dk-state .dk-retry {
    display: inline-block;
    margin-top: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    border-radius: 8px;
    padding: 6px 18px;
    cursor: pointer;
    font-family: inherit;
}
.dk-skeleton {
    border-radius: 14px;
    background: linear-gradient(90deg, #fff, var(--line-soft), #fff);
    background-size: 200% 100%;
    animation: dk-skeleton 1.2s ease-in-out infinite;
    height: 240px;
    border: 1px solid var(--line);
}
@keyframes dk-skeleton {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* ---------- 详情页布局 ---------- */
.deck-layout {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
}
.deck-main { width: 100%; }
.deck-aside { width: 100%; display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 860px) {
    .deck-layout { flex-direction: row; }
    .deck-main { width: 68%; }
    .deck-aside { width: 32%; }
    .deck-aside-inner { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 20px; }
}

.dk-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
}
.deck-cover {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 10px;
    background: var(--line-soft);
    margin-bottom: 18px;
}
.deck-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.deck-head h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.35;
    margin: 0;
}
.deck-head .summary {
    margin-top: 10px;
    font-size: 14.5px;
    color: var(--ink-2);
    line-height: 1.65;
}
.deck-meta {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ink-3);
}
.deck-meta .cat { color: var(--ink-2); font-weight: 500; }
.deck-meta .score { color: #D97706; font-weight: 600; }
.deck-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.deck-tags span {
    font-size: 12px;
    color: var(--ink-2);
    background: var(--line-soft);
    border-radius: 999px;
    padding: 3px 10px;
}
.deck-price-line { margin-top: 14px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.deck-price-badge { font-weight: 700; color: var(--academic); font-size: 17px; }
.deck-price-badge.is-free { color: #16A34A; }
.deck-price-badge.is-vip { color: #B45309; background: #FEF3C7; border-radius: 6px; padding: 1px 8px; font-size: 13px; }
.deck-price-origin { color: var(--ink-3); text-decoration: line-through; font-size: 13px; }

.deck-actions {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--line-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.dk-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: var(--academic);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: background .15s;
}
.dk-btn-primary:hover { background: var(--academic-dark); }
.dk-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: background .15s;
}
.dk-btn-ghost:hover { background: var(--line-soft); }

.deck-desc { margin-top: 14px; font-size: 14.5px; color: var(--ink-2); line-height: 1.7; }
.deck-desc p { margin: 0 0 10px; }

/* ---------- 卡片预览 ---------- */
.preview-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}
.preview-head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.preview-head .sub { font-size: 12px; color: var(--ink-3); margin-left: 8px; }
.preview-toggle {
    border: 0;
    background: none;
    color: var(--academic);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}
.preview-list { display: flex; flex-direction: column; gap: 14px; }
.preview-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 20px;
}
.preview-card .q { font-size: 15px; line-height: 1.6; color: var(--ink); }
.preview-card .q .idx {
    display: inline-block;
    color: var(--ink-3);
    font-size: 12px;
    margin-right: 10px;
    font-variant-numeric: tabular-nums;
}
.preview-card .a-wrap { margin-top: 12px; }
.preview-card .a-head {
    border: 0;
    background: none;
    padding: 0;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--academic);
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.preview-card .a-box {
    display: none;
    margin-top: 10px;
    padding: 14px 16px;
    background: var(--line-soft);
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--ink);
    transition: all .2s ease;
}
.preview-card .a-box.is-open { display: block; }
.preview-card .a-box.is-open img { max-width: 100%; }
.preview-card iframe {
    width: 100%;
    border: 0;
    min-height: 36px;
    display: block;
    background: transparent;
}

/* ---------- 评价 ---------- */
.review-list { display: flex; flex-direction: column; gap: 14px; }
.review-item { padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.review-item:last-child { border-bottom: 0; padding-bottom: 0; }
.review-top { display: flex; align-items: center; gap: 10px; }
.review-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--line-soft);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    overflow: hidden;
}
.review-avatar img { width: 100%; height: 100%; object-fit: cover; }
.review-name { font-size: 13.5px; font-weight: 600; }
.review-stars { color: #D97706; font-size: 12px; letter-spacing: 1px; }
.review-date { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.review-content { margin-top: 8px; font-size: 13.5px; color: var(--ink-2); line-height: 1.65; white-space: pre-wrap; }

/* ---------- 右栏 ---------- */
.aside-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
}
.aside-card h3 { font-size: 13px; font-weight: 600; margin: 0 0 12px; color: var(--ink); }
.aside-card .hint { font-size: 11px; color: var(--ink-3); }
.qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: var(--canvas);
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    padding: 18px;
}
.qr-wrap .qr-box {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    line-height: 0;
}
.qr-box svg { width: 150px; height: 150px; }
.qr-caption { font-size: 12px; color: var(--ink-2); text-align: center; line-height: 1.6; }
.qr-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.qr-actions > * { width: 100%; box-sizing: border-box; white-space: nowrap; justify-content: center; }
.qr-actions img { width: 20px; height: 20px; object-fit: contain; }
.qr-actions svg { flex: none; }
.aside-steps { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); line-height: 1.9; }
.aside-note { margin-top: 10px; font-size: 12px; color: var(--ink-3); line-height: 1.6; }

/* ---------- 移动端打开横幅 ---------- */
.open-app-banner { display: none; }
@media (max-width: 859px) {
    .open-app-banner {
        display: flex;
        align-items: center;
        gap: 12px;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 12px 16px;
        margin-bottom: 20px;
    }
    .open-app-banner .txt { flex: 1; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
    .open-app-banner .txt strong { display: block; color: var(--ink); font-size: 14px; }
}

/* ---------- 页脚 ---------- */
.dk-footer {
    border-top: 1px solid var(--line);
    padding: 24px;
    text-align: center;
    font-size: 12.5px;
    color: var(--ink-3);
}
.dk-footer a { color: var(--ink-3); text-decoration: none; margin: 0 8px; }
.dk-footer a:hover { color: var(--ink); }

@media (max-width: 640px) {
    .dk-header-inner { padding: 0 16px; }
    .dk-main { padding: 20px 16px 48px; }
    .dk-page-title { font-size: 20px; }
    .dk-search { max-width: none; }
    .dk-panel { padding: 18px; }
    .deck-head h1 { font-size: 20px; }
    .dk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .dk-card-body { padding: 10px 12px 12px; gap: 6px; }
    .dk-card-name { font-size: 13.5px; }
    .dk-card-summary { font-size: 12px; }
    .dk-card-meta { gap: 6px; font-size: 11px; }
}

/* ---------- 下载弹窗（deck 内联） ---------- */
.dl-modal {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--ink);
    font-family: var(--font);
}
.dl-modal::backdrop {
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.dl-modal-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 28px 24px 22px;
    max-width: 420px;
    width: calc(100vw - 32px);
    box-sizing: border-box;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .2);
}
.dl-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: 0;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    color: var(--ink-3);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all .15s;
}
.dl-modal-close:hover { background: var(--line-soft); color: var(--ink); }
.dl-modal-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    text-align: center;
}
.dl-modal-sub {
    text-align: center;
    font-size: 13px;
    color: var(--ink-2);
    margin: 6px 0 22px;
}
.dl-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}
.dl-modal-platform {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--line-soft);
    text-decoration: none;
    color: var(--ink);
    transition: transform .12s, border-color .15s, box-shadow .15s;
}
.dl-modal-platform:hover {
    border-color: var(--academic);
    box-shadow: 0 4px 16px rgba(37, 99, 235, .12);
    transform: translateY(-1px);
}
.dl-modal-head {
    display: flex;
    align-items: center;
    gap: 10px;
}
.dl-modal-head svg {
    width: 28px;
    height: 28px;
    flex: none;
    color: var(--ink);
}
.dl-modal-head > div { display: flex; flex-direction: column; gap: 2px; }
.dl-modal-head strong { font-size: 13px; font-weight: 600; }
.dl-modal-head small { font-size: 11px; color: var(--ink-2); }
.dl-modal-btn {
    display: inline-block;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--academic);
    background: #fff;
    border: 1px solid var(--academic);
    border-radius: 8px;
    padding: 7px 10px;
    transition: all .15s;
}
.dl-modal-platform:hover .dl-modal-btn {
    background: var(--academic);
    color: #fff;
}
.dl-modal-back {
    display: block;
    width: 100%;
    border: 0;
    background: none;
    color: var(--ink-2);
    font-size: 13px;
    font-family: inherit;
    padding: 10px 0 2px;
    cursor: pointer;
    transition: color .15s;
}
.dl-modal-back:hover { color: var(--ink); }

@media (max-width: 420px) {
    .dl-modal-grid { grid-template-columns: 1fr; }
}
