/* Astral 详情页 —— 8:4 两栏、跟随主题浅色/深色 */

.ad-detail {
    --ad-ink: #20242c;
    --ad-muted: #727884;
    --ad-faint: #98a0ac;
    --ad-line: #e7e9ed;
    --ad-soft: #f2f4f8;
    --ad-surface: #ffffff;
    --ad-surface-2: #f8f9fb;
    --ad-accent: var(--focus-color, #315ddc);
    --ad-green: #2f8f63;
    --ad-green-bg: #e9f7f0;
    --ad-gold: #d69519;
    padding-top: 8px;
    padding-bottom: 48px;
}

.dark-theme .ad-detail {
    --ad-ink: #f1f1f3;
    --ad-muted: #b6b6bf;
    --ad-faint: #8c8c96;
    --ad-line: #2d2d35;
    --ad-soft: #24242a;
    --ad-surface: #1b1b20;
    --ad-surface-2: #202026;
    --ad-green: #6ee7a8;
    --ad-green-bg: rgba(47, 143, 99, 0.18);
}

.ad-detail,
.ad-detail * {
    box-sizing: border-box;
}

.ad-detail a {
    color: inherit;
    text-decoration: none;
}

.ad-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 18px;
    color: var(--ad-muted);
    font-size: 12px;
}

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

/* Hero ------------------------------------------------------------------ */

.ad-hero {
    padding: 28px 32px;
    background: var(--ad-surface);
    border: 1px solid var(--ad-line);
    border-radius: 16px;
    margin-bottom: 18px;
}

.ad-hero-head {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.ad-logo {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 72px;
    height: 72px;
    overflow: hidden;
    border: 1px solid var(--ad-line);
    border-radius: 16px;
    background: var(--ad-soft);
    color: var(--ad-muted);
    font-size: 26px;
}

.ad-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ad-heading {
    min-width: 0;
    flex: 1;
}

.ad-kicker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--ad-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ad-title {
    margin: 0 0 10px;
    color: var(--ad-ink);
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.ad-tagline {
    max-width: 780px;
    margin: 0 0 14px;
    color: var(--ad-muted);
    font-size: 16px;
    line-height: 1.7;
}

.ad-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    color: var(--ad-muted);
    font-size: 13px;
}

.ad-meta strong {
    color: var(--ad-ink);
    font-weight: 600;
}

.ad-stars {
    color: var(--ad-gold);
    font-weight: 600;
}

.ad-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.ad-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--ad-line);
    border-radius: 9px;
    background: var(--ad-surface);
    color: var(--ad-ink);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.ad-btn:hover {
    border-color: var(--ad-accent);
    color: var(--ad-accent);
}

.ad-btn-primary {
    background: var(--ad-accent);
    border-color: var(--ad-accent);
    color: #fff;
}

.ad-btn-primary:hover {
    background: var(--ad-accent);
    border-color: var(--ad-accent);
    color: #fff;
    opacity: 0.9;
}

.ad-btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
}

.ad-hero-command {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px solid var(--ad-line);
    border-radius: 10px;
    background: var(--ad-surface-2);
    font-size: 12px;
}

.ad-hero-command > span {
    flex: 0 0 auto;
    color: var(--ad-muted);
}

.ad-hero-command code {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    color: var(--ad-ink);
    font-size: 12px;
    white-space: nowrap;
}

/* 锚点导航 -------------------------------------------------------------- */

.ad-nav {
    position: sticky;
    top: 64px;
    z-index: 6;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    margin-bottom: 20px;
    padding: 8px;
    border: 1px solid var(--ad-line);
    border-radius: 12px;
    background: var(--ad-surface);
    scrollbar-width: none;
}

.ad-nav::-webkit-scrollbar {
    display: none;
}

.ad-nav a {
    flex: 0 0 auto;
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--ad-muted);
    font-size: 13px;
    white-space: nowrap;
}

.ad-nav a:hover,
.ad-nav a.is-active {
    background: color-mix(in srgb, var(--ad-accent) 10%, transparent);
    color: var(--ad-accent);
}

/* 两栏 ------------------------------------------------------------------ */

.ad-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 32px;
    align-items: start;
}

.ad-main {
    min-width: 0;
}

.ad-aside {
    position: sticky;
    top: 76px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* 分区 ------------------------------------------------------------------ */

.ad-section {
    padding: 26px 28px;
    margin-bottom: 16px;
    background: var(--ad-surface);
    border: 1px solid var(--ad-line);
    border-radius: 14px;
    scroll-margin-top: 96px;
}

.ad-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.ad-section-head h2 {
    margin: 0;
    color: var(--ad-ink);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.ad-section h3 {
    margin: 22px 0 8px;
    color: var(--ad-ink);
    font-size: 15px;
    font-weight: 600;
}

.ad-section h3:first-child {
    margin-top: 0;
}

.ad-count {
    color: var(--ad-faint);
    font-size: 12px;
}

.ad-prose {
    color: var(--ad-ink);
    font-size: 15px;
    line-height: 1.85;
    overflow-wrap: anywhere;
}

.ad-prose p {
    margin: 0 0 14px;
}

.ad-prose p:last-child {
    margin-bottom: 0;
}

.ad-prose ul,
.ad-prose ol {
    margin: 0 0 14px;
    padding-left: 22px;
}

.ad-prose li {
    margin-bottom: 6px;
}

.ad-prose img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.ad-prose pre {
    overflow-x: auto;
    padding: 12px;
    border-radius: 10px;
    background: var(--ad-surface-2);
}

.ad-document h1,
.ad-document h2,
.ad-document h3 {
    margin: 20px 0 8px;
}

.ad-note {
    margin: 8px 0;
    color: var(--ad-muted);
    font-size: 12px;
}

.ad-preserve {
    white-space: pre-wrap;
}

/* 列表 / 事实表 --------------------------------------------------------- */

.ad-list {
    margin: 0;
    padding-left: 20px;
    color: var(--ad-ink);
    font-size: 14px;
    line-height: 1.8;
}

.ad-list li {
    margin-bottom: 6px;
}

.ad-facts {
    display: grid;
    grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
    margin: 0 0 14px;
    border-top: 1px solid var(--ad-line);
    font-size: 13px;
}

.ad-facts dt {
    padding: 10px 0;
    border-bottom: 1px solid var(--ad-line);
    color: var(--ad-muted);
}

.ad-facts dd {
    margin: 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--ad-line);
    color: var(--ad-ink);
    overflow-wrap: anywhere;
}

.ad-facts code {
    font-size: 12px;
    word-break: break-all;
}

/* 代码 ------------------------------------------------------------------ */

.ad-code {
    position: relative;
    margin: 8px 0 0;
}

.ad-code pre {
    overflow-x: auto;
    margin: 0;
    padding: 14px 76px 14px 14px;
    border: 1px solid var(--ad-line);
    border-radius: 10px;
    background: var(--ad-surface-2);
    color: var(--ad-ink);
    font-size: 12px;
    line-height: 1.7;
    white-space: pre;
}

.ad-code .ad-btn {
    position: absolute;
    top: 8px;
    right: 8px;
}

.ad-snippets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.ad-snippet {
    padding: 14px;
    border: 1px solid var(--ad-line);
    border-radius: 12px;
    background: var(--ad-surface-2);
}

.ad-snippet-head {
    margin-bottom: 6px;
    color: var(--ad-ink);
    font-size: 12px;
    font-weight: 600;
}

.ad-snippet .ad-code pre {
    background: var(--ad-surface);
}

/* 状态 / 徽章 ----------------------------------------------------------- */

.ad-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.ad-status.is-ok {
    background: var(--ad-green-bg);
    color: var(--ad-green);
}

.ad-status.is-partial {
    background: rgba(214, 149, 25, 0.14);
    color: #a97710;
}

.dark-theme .ad-status.is-partial {
    color: #e0b45f;
}

.ad-status.is-warn {
    background: rgba(214, 85, 25, 0.14);
    color: #b3521f;
}

.dark-theme .ad-status.is-warn {
    color: #e08a5f;
}

.ad-status.is-off {
    background: rgba(120, 120, 120, 0.14);
    color: var(--ad-muted);
}

.ad-status.is-muted {
    background: var(--ad-soft);
    color: var(--ad-muted);
}

.ad-chip {
    display: inline-flex;
    align-items: center;
    margin: 0 4px 4px 0;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--ad-soft);
    color: var(--ad-muted);
    font-size: 12px;
}

.ad-notice {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--ad-line);
    border-left: 3px solid var(--ad-accent);
    border-radius: 8px;
    background: var(--ad-surface-2);
    color: var(--ad-muted);
    font-size: 12px;
    line-height: 1.7;
}

.ad-notice strong {
    display: block;
    margin-bottom: 2px;
    color: var(--ad-ink);
}

/* 能力 ------------------------------------------------------------------ */

.ad-capabilities {
    display: grid;
    gap: 10px;
}

.ad-capability {
    padding: 14px;
    border: 1px solid var(--ad-line);
    border-radius: 12px;
    background: var(--ad-surface-2);
}

.ad-capability-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.ad-capability h3 {
    margin: 0;
    font-size: 14px;
}

.ad-capability p {
    margin: 0;
    color: var(--ad-muted);
    font-size: 13px;
}

.ad-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

/* 价格 ------------------------------------------------------------------ */

.ad-plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

.ad-plan {
    padding: 16px;
    border: 1px solid var(--ad-line);
    border-radius: 12px;
    background: var(--ad-surface-2);
}

.ad-plan h3 {
    margin: 0 0 6px;
    font-size: 14px;
}

.ad-plan-price {
    color: var(--ad-ink);
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.ad-plan-price span {
    color: var(--ad-muted);
    font-size: 12px;
    font-weight: 400;
}

.ad-plan-best {
    margin: 4px 0;
    color: var(--ad-muted);
    font-size: 12px;
}

.ad-plan .ad-list {
    margin-top: 8px;
    font-size: 13px;
}

.ad-plan .ad-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--ad-accent);
    font-size: 12px;
}

.ad-link {
    color: var(--ad-accent);
    font-size: 13px;
}

.ad-link:hover {
    text-decoration: underline;
}

/* 表格 ------------------------------------------------------------------ */

.ad-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--ad-line);
    border-radius: 10px;
}

.ad-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ad-table th,
.ad-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--ad-line);
    text-align: left;
    vertical-align: top;
}

.ad-table th {
    background: var(--ad-surface-2);
    color: var(--ad-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ad-table tbody tr:last-child td {
    border-bottom: 0;
}

.ad-table code {
    font-size: 12px;
}

.ad-tools-table td:nth-child(2) {
    min-width: 220px;
    color: var(--ad-muted);
}

.ad-params summary {
    color: var(--ad-accent);
    cursor: pointer;
    font-size: 12px;
}

.ad-params .ad-code {
    min-width: 240px;
    margin-top: 6px;
}

/* 截图 / 工作流 / FAQ --------------------------------------------------- */

.ad-shots {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ad-shots img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--ad-line);
    border-radius: 10px;
}

.ad-workflows {
    display: grid;
    gap: 12px;
}

.ad-workflows article {
    padding: 14px;
    border: 1px solid var(--ad-line);
    border-radius: 12px;
    background: var(--ad-surface-2);
}

.ad-workflows h3 {
    margin: 0 0 8px;
}

.ad-faq {
    padding: 12px 0;
    border-bottom: 1px solid var(--ad-line);
}

.ad-faq:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.ad-faq summary {
    color: var(--ad-ink);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.ad-faq p {
    margin: 8px 0 0;
    color: var(--ad-muted);
    font-size: 13px;
    line-height: 1.75;
}

/* 相关 ------------------------------------------------------------------ */

.ad-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.ad-related-card {
    padding: 14px;
    border: 1px solid var(--ad-line);
    border-radius: 12px;
    background: var(--ad-surface-2);
}

.ad-related-card h3 {
    margin: 0 0 6px;
    font-size: 14px;
}

.ad-related-card h3 a:hover {
    color: var(--ad-accent);
}

.ad-related-card p {
    margin: 0;
    color: var(--ad-muted);
    font-size: 13px;
}

.ad-sources {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ad-sources li {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--ad-line);
    font-size: 13px;
}

.ad-sources a {
    color: var(--ad-accent);
}

.ad-sources span {
    color: var(--ad-muted);
    font-size: 12px;
}

.ad-raw summary,
.ad-readme summary {
    color: var(--ad-accent);
    cursor: pointer;
    font-size: 13px;
}

.ad-readme .ad-prose {
    margin-top: 12px;
    font-size: 14px;
}

/* 侧栏 ------------------------------------------------------------------ */

.ad-card {
    padding: 18px;
    background: var(--ad-surface);
    border: 1px solid var(--ad-line);
    border-radius: 12px;
}

.ad-card h2 {
    margin: 0 0 10px;
    color: var(--ad-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ad-stats {
    display: flex;
    gap: 22px;
}

.ad-stats div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ad-stats strong {
    color: var(--ad-ink);
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ad-stats span {
    color: var(--ad-faint);
    font-size: 11px;
}

.ad-links {
    display: flex;
    flex-direction: column;
}

.ad-links a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--ad-line);
    color: var(--ad-ink);
    font-size: 13px;
}

.ad-links a:last-child {
    border-bottom: 0;
}

.ad-links a:hover {
    color: var(--ad-accent);
}

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

/* 响应式 ---------------------------------------------------------------- */

@media (max-width: 1000px) {
    .ad-layout {
        grid-template-columns: 1fr;
    }

    .ad-aside {
        position: static;
    }

    .ad-nav {
        top: 56px;
    }
}

@media (max-width: 640px) {
    .ad-hero {
        padding: 20px;
    }

    .ad-hero-head {
        gap: 14px;
    }

    .ad-logo {
        width: 56px;
        height: 56px;
        border-radius: 12px;
        font-size: 20px;
    }

    .ad-title {
        font-size: 24px;
    }

    .ad-tagline {
        font-size: 14px;
    }

    .ad-section {
        padding: 18px;
    }

    .ad-facts {
        grid-template-columns: 1fr;
    }

    .ad-facts dt {
        padding-bottom: 0;
        border-bottom: 0;
    }

    .ad-facts dd {
        padding-top: 2px;
    }

    .ad-split,
    .ad-shots {
        grid-template-columns: 1fr;
    }

    .ad-hero-command {
        flex-wrap: wrap;
    }

    .ad-hero-command code {
        flex: 1 0 100%;
        order: 3;
    }
}

/* 订阅卡沿用详情页卡片外观 */
.ad-aside .astral-updates {
    margin: 0;
    padding: 18px;
    background: var(--ad-surface);
    border: 1px solid var(--ad-line);
    border-radius: 12px;
}

.ad-aside .astral-updates h2 {
    margin: 0 0 8px;
    color: var(--ad-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ad-aside .astral-updates p {
    margin: 0 0 10px;
    color: var(--ad-muted);
    font-size: 13px;
}

.ad-aside .astral-updates label {
    display: block;
    margin: 6px 0;
    color: var(--ad-ink);
    font-size: 13px;
}

.ad-aside .astral-updates .but {
    display: block;
    width: 100%;
    margin-top: 10px;
    text-align: center;
}

/* 避免主题代码高亮器接管我们的复制块 */
.ad-code .enlighter-default,
.ad-code .enlighter-toolbar {
    display: none !important;
}

.ad-code pre.enlighter-default {
    display: block !important;
}

/* Hero：图标左置，评分与热度右置 */
.ad-hero-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 20px;
    align-items: start;
}

.ad-logo {
    grid-column: 1;
}

.ad-heading {
    grid-column: 2;
    min-width: 0;
}

.ad-hero-score {
    grid-column: 3;
    text-align: right;
    min-width: 120px;
}

.ad-score-line {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 4px;
    color: var(--ad-ink);
}

.ad-score-line .ad-stars {
    font-size: 14px;
}

.ad-score-line strong {
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.ad-score-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 6px;
    color: var(--ad-muted);
    font-size: 12px;
}

.ad-score-meta strong {
    color: var(--ad-ink);
    font-weight: 600;
}

@media (max-width: 640px) {
    .ad-hero-head {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas: "logo heading" "score score";
    }

    .ad-logo {
        grid-area: logo;
    }

    .ad-heading {
        grid-area: heading;
    }

    .ad-hero-score {
        grid-area: score;
        text-align: left;
        display: flex;
        align-items: baseline;
        gap: 14px;
        margin-top: 8px;
    }

    .ad-score-meta {
        flex-direction: row;
        gap: 12px;
        margin-top: 0;
    }
}

/* 详情页视觉打磨 */
.ad-hero {
    background: linear-gradient(135deg, color-mix(in srgb, var(--ad-accent) 5%, var(--ad-surface)) 0%, var(--ad-surface) 45%);
}

.ad-hero-head .ad-logo {
    width: 88px;
    height: 88px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--ad-accent) 8%, var(--ad-surface));
    border-color: color-mix(in srgb, var(--ad-accent) 18%, var(--ad-line));
    font-size: 30px;
}

.ad-section-head h2 {
    position: relative;
    padding-left: 12px;
}

.ad-section-head h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.28em;
    bottom: 0.28em;
    width: 3px;
    border-radius: 3px;
    background: var(--ad-accent);
    opacity: 0.9;
}

.ad-section {
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.dark-theme .ad-section {
    box-shadow: none;
}

.ad-card {
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.dark-theme .ad-card {
    box-shadow: none;
}

@media (max-width: 640px) {
    .ad-hero-head .ad-logo {
        width: 64px;
        height: 64px;
        border-radius: 14px;
        font-size: 22px;
    }
}

.ad-meta-sep {
    color: var(--ad-faint);
}

/* 评分与操作右置 */
.ad-hero-score {
    min-width: 240px;
}

.ad-hero-score .ad-actions {
    justify-content: flex-end;
    margin-top: 14px;
}

.ad-hero-score .ad-actions .ad-btn {
    padding: 8px 14px;
    font-size: 13px;
}

/* 能力清单：方格布局 */
.ad-capabilities {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ad-capability {
    height: 100%;
}

@media (max-width: 900px) {
    .ad-hero-head {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas: "logo heading" "score score";
    }

    .ad-hero-score {
        grid-area: score;
        min-width: 0;
        text-align: left;
        display: block;
        margin-top: 10px;
    }

    .ad-hero-score .ad-actions {
        justify-content: flex-start;
    }

    .ad-capabilities {
        grid-template-columns: 1fr;
    }
}

/* 资源与维护：紧凑两列 */
.ad-sources-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.ad-source {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--ad-line);
    border-radius: 9px;
    background: var(--ad-surface-2);
}

.ad-source:hover {
    border-color: color-mix(in srgb, var(--ad-accent) 40%, var(--ad-line));
}

.ad-source-label {
    color: var(--ad-accent);
    font-size: 13px;
}

.ad-source-host {
    color: var(--ad-faint);
    font-size: 11px;
}

.ad-source-note {
    color: var(--ad-muted);
    font-size: 11px;
}

.ad-sources-note {
    margin: 12px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--ad-line);
    color: var(--ad-faint);
    font-size: 11px;
}

@media (max-width: 700px) {
    .ad-sources-grid {
        grid-template-columns: 1fr;
    }
}

/* 分区网格列数 */
.ad-cols .ad-capabilities {
    grid-template-columns: repeat(var(--ad-cols, 2), minmax(0, 1fr));
}

.ad-cols .ad-related-grid {
    grid-template-columns: repeat(var(--ad-cols, 2), minmax(0, 1fr));
}

/* 主题评论区 */
.ad-comments {
    margin-top: 28px;
    padding-bottom: 20px;
}

@media (max-width: 700px) {
    .ad-cols .ad-capabilities,
    .ad-cols .ad-related-grid {
        grid-template-columns: 1fr;
    }
}

/* 侧栏：主题小工具统一成详情卡片外观 */
.ad-aside .zib-widget {
    margin: 0 0 14px;
    padding: 18px;
    background: var(--ad-surface);
    border: 1px solid var(--ad-line);
    border-radius: 12px;
    box-shadow: none;
}

.ad-aside .zib-widget h3,
.ad-aside .zib-widget .title-theme {
    margin: 0 0 12px;
    color: var(--ad-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* 网址排行 */
.ad-rank h3 {
    margin: 0 0 10px;
    color: var(--ad-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ad-rank ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ad-rank li a {
    display: grid;
    grid-template-columns: 18px 28px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--ad-line);
    color: var(--ad-ink);
    font-size: 12.5px;
}

.ad-rank li:last-child a {
    border-bottom: 0;
}

.ad-rank li a:hover .ad-rank-name {
    color: var(--ad-accent);
}

.ad-rank-no {
    color: var(--ad-faint);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.ad-rank-logo {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    overflow: hidden;
    border: 1px solid var(--ad-line);
    border-radius: 7px;
    background: var(--ad-soft);
    color: var(--ad-muted);
    font-size: 11px;
}

.ad-rank-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ad-rank-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ad-rank-value {
    color: var(--ad-faint);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.ad-rank-unit {
    margin: 8px 0 0;
    color: var(--ad-faint);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* 排行模块背板 */
.ad-rank {
    padding: 18px;
    background: var(--ad-surface);
    border: 1px solid var(--ad-line);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.dark-theme .ad-rank {
    box-shadow: none;
}

.ad-rank-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.ad-rank-head h3 {
    margin: 0;
}

.ad-rank-head span {
    color: var(--ad-faint);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* 侧栏里的主题小工具不再重复套背板 */
.ad-aside .zib-widget {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

/* 排行：TOP1 大卡 + 彩色名次 */
.ad-rank .ad-rank-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ad-rank-item {
    position: relative;
}

.ad-rank .ad-rank-list li a {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 0;
    border: 0;
}

.ad-rank-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    padding: 2px 8px;
    border-radius: 6px;
    background: #7c828d;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.rank-1 .ad-rank-badge {
    background: var(--ad-accent);
}

.rank-2 .ad-rank-badge {
    background: #f08a3c;
}

.rank-3 .ad-rank-badge {
    background: #d9a441;
}

.ad-rank-image {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border: 1px solid var(--ad-line);
    border-radius: 10px;
    background: var(--ad-soft);
    color: var(--ad-muted);
    font-size: 16px;
}

.ad-rank-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ad-rank-body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.ad-rank-name {
    display: -webkit-box;
    overflow: hidden;
    color: var(--ad-ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    white-space: normal;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ad-rank-item a:hover .ad-rank-name {
    color: var(--ad-accent);
}

.ad-rank-meta {
    display: flex;
    gap: 10px;
    color: var(--ad-faint);
    font-size: 11px;
}

/* TOP1 */
.ad-rank .ad-rank-list .ad-rank-item.is-top a {
    display: block;
    padding: 52px 16px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2b3157 0%, #12141f 100%);
    color: #fff;
}

.ad-rank .ad-rank-list .ad-rank-item.is-top .ad-rank-badge {
    top: 12px;
    left: 12px;
}

.ad-rank .ad-rank-list .ad-rank-item.is-top .ad-rank-image {
    width: 56px;
    height: 56px;
    margin-bottom: 10px;
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 12px;
}

.ad-rank .ad-rank-list .ad-rank-item.is-top .ad-rank-name {
    display: block;
    color: #fff;
    font-size: 16px;
    -webkit-line-clamp: 2;
}

.ad-rank .ad-rank-list .ad-rank-item.is-top a:hover .ad-rank-name {
    color: #fff;
}

.ad-rank .ad-rank-list .ad-rank-item.is-top .ad-rank-meta {
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.65);
}

.ad-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 14px 16px;
    border: 1px dashed var(--ad-line);
    border-radius: 10px;
    background: var(--ad-soft);
    color: var(--ad-muted);
    font-size: 13px;
}

.ad-empty strong {
    color: var(--ad-ink);
}

.ad-empty .ad-btn {
    margin-top: 4px;
}

/* 主题 code 样式隔离：安装命令保持深色底、浅色字 */
.ad-detail .ad-hero-command code {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ad-ink);
}

.ad-detail .ad-hero-command {
    background: var(--ad-soft);
}

/* 主题代码块兜底：Enlighter 未初始化时也有正常外观 */
.ad-code-block .enlighter-pre {
    margin: 8px 0 0;
    padding: 12px 14px;
    overflow-x: auto;
    border: 1px solid var(--ad-line);
    border-radius: 10px;
    background: var(--ad-soft);
    color: var(--ad-ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre;
}

.ad-code-block .enlighter-pre code {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
}

/* 详情分区 Tab：无 JS 时保持全部展开 */
.ad-detail.ad-tabs-enabled .ad-section {
    display: none;
}

.ad-detail.ad-tabs-enabled .ad-section.is-active {
    display: block;
}

.ad-nav a.is-active {
    color: var(--ad-ink);
    background: var(--ad-soft);
    border-color: var(--ad-line);
}

.ad-btn-primary {
    color: #fff;
}

.ad-btn-icon {
    padding: 8px 11px;
    font-size: 16px;
    line-height: 1;
}

.ad-btn-icon .fa {
    vertical-align: 0;
}

/* Connect 代码块上下排列 */
.ad-snippets {
    grid-template-columns: 1fr;
}

/* SKILL.md code fences: style when Enlighter is not initialized */
.ad-document pre.enlighter-pre,
.ad-prose pre.enlighter-pre {
    margin: 14px 0;
    padding: 14px 16px;
    overflow-x: auto;
    border: 1px solid var(--ad-line);
    border-radius: 10px;
    background: var(--ad-soft);
    color: var(--ad-ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre;
    tab-size: 2;
}
.ad-document pre.enlighter-pre code,
.ad-prose pre.enlighter-pre code {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    white-space: pre;
}
.dark-theme .ad-document pre.enlighter-pre,
.dark-theme .ad-prose pre.enlighter-pre {
    background: #111216;
    border-color: #2d2d35;
    color: #e8e8ec;
}
