/*
 * 应用市场的四屏样式（/site/market）。
 *
 * 为什么单独一张表而不是塞进 theme.css：这四屏只服务一个业务页，换主题时市场版式应当整份换掉。
 * 由控制器塞进 appStyles（head.html 在 theme.css 之后出 <link>），这里只做覆盖，不重设基元。
 *
 * 色彩自律：站点其余仍是 theme.css 那 7 个单色变量。市场页的彩色只留给「应用自己的图标」——
 * 按 appCode 落稳定色档（.mkt-acc-*，仅 .mkt 作用域）；Hero、筛选、徽章、Tab 这类装饰
 * 一律收敛成中性灰 + 一个交互主色 --mkt-accent，不再一处一个色相。
 * 不引外部资源、图标是后端离线内联 SVG（mkt.iconSvg）、模板里没有内联样式。
 */

/* ------------------------------------------------------------ 色档（只在 .mkt 内生效） */

.mkt .mkt-acc-0 { --acc: #2563eb; --acc-soft: #eef3ff; }
.mkt .mkt-acc-1 { --acc: #7c3aed; --acc-soft: #f3eeff; }
.mkt .mkt-acc-2 { --acc: #0f766e; --acc-soft: #e7f6f3; }
.mkt .mkt-acc-3 { --acc: #db2777; --acc-soft: #fdeef5; }
.mkt .mkt-acc-4 { --acc: #c2410c; --acc-soft: #fff0e7; }
.mkt .mkt-acc-5 { --acc: #15803d; --acc-soft: #eaf8ee; }
.mkt .mkt-acc-6 { --acc: #0e7490; --acc-soft: #e6f6fa; }
.mkt .mkt-acc-7 { --acc: #a16207; --acc-soft: #fbf4e4; }

/* 图标继承所在色档的前景色 */
.mkt .mkt-tint { color: var(--acc, #111); }

.mkt-ico {
    display: inline-block;
    flex: none;
    width: 1em;
    height: 1em;
    vertical-align: middle;
    fill: currentColor;
}

/* 后端 iconSvg 出来的 <svg class="mkt-ico"> 自带基线：不显式 block 的话，
   chip / badge 里的文字会被它顶偏半像素，看起来「图标和字没在同一条中线上」。 */
svg.mkt-ico {
    display: block;
    margin: 0 auto;
}

/* 四类标签（快捷入口 / 筛选 / 徽章 / Tab）统一居中口径：
   容器水平居中 + 行高压平，图标盒子自己再 flex 一次，图标与文字始终居中对齐。 */
.mkt-quick__chip,
.mkt-chip,
.mkt-badge,
.mkt-tab,
.mkt-tag,
.mkt-hero__eyebrow,
.mkt-search__btn,
.mkt-section__title,
.mkt-section__more {
    justify-content: center;
    line-height: 1.2;
}

.mkt-quick__chip .mkt-ico,
.mkt-chip__ico,
.mkt-badge__ico,
.mkt-tab .mkt-ico,
.mkt-tag .mkt-ico,
.mkt-section__title .mkt-tint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ------------------------------------------------------------ 通用块 */

.mkt {
    /* 唯一的交互色：hover / 选中 / 链接都用它，装饰不再各带一个色相 */
    --mkt-accent: #2563eb;
    --mkt-accent-soft: #eef3ff;
    min-height: 50vh;
}

.mkt-link {
    color: var(--mkt-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.mkt-empty {
    padding: 56px 0;
    color: var(--muted);
    text-align: center;
}

.mkt-empty p + p {
    margin-top: 10px;
}

/*
 * 取数期间的占位先占住接近三栏的高度。
 * 三栏是脚本填进来的，服务端这一发只有一句话；不留高度的话，数据回来会把下面的页脚整体往下顶一截，
 * 用户正好在滚动时就像页面"跳"了一下。空态（data-mkt-empty）不套这条，它按内容自适应就好。
 */
.mkt-empty[data-mkt-loading] {
    min-height: 380px;
}

/* ------------------------------------------------------------ 首页 Hero（居中 + 彩色网格背景 + 漂浮图标） */

.mkt-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 88px 0 72px;
    background: #fbfcff;
    border-bottom: 1px solid var(--line);
}

/* 背景只留一层极浅的晕，不再叠五种色相；点阵负责秩序感 */
.mkt-hero__bg {
    position: absolute;
    inset: -25%;
    z-index: -2;
    background:
        radial-gradient(46% 50% at 50% 0%, rgb(37 99 235 / 8%) 0%, transparent 72%),
        radial-gradient(40% 46% at 20% 100%, rgb(17 17 17 / 4%) 0%, transparent 72%);
    animation: mkt-drift 26s var(--motion) infinite alternate;
}

/* 点阵网格，边缘淡出，给背景一点「设计感」的秩序 */
.mkt-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(rgb(17 17 17 / 7%) 1px, transparent 1.4px);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(70% 70% at 50% 40%, #000 0%, transparent 78%);
    mask-image: radial-gradient(70% 70% at 50% 40%, #000 0%, transparent 78%);
}

@keyframes mkt-drift {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    50%  { transform: translate3d(2%, -2%, 0) scale(1.06); }
    100% { transform: translate3d(-2%, 2%, 0) scale(1.03); }
}

/* 漂浮的装饰图标：极低透明度，只做氛围，不抢内容 */
.mkt-hero__deco {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.mkt-hero__deco span {
    position: absolute;
    color: var(--muted);
    opacity: .12;
    line-height: 1;
}

.mkt-hero__deco .d1 { top: 14%; left: 8%;  font-size: 46px; transform: rotate(-12deg); }
.mkt-hero__deco .d2 { top: 24%; left: 88%; font-size: 40px; transform: rotate(10deg); }
.mkt-hero__deco .d3 { top: 68%; left: 14%; font-size: 38px; transform: rotate(8deg); }
.mkt-hero__deco .d4 { top: 74%; left: 82%; font-size: 50px; transform: rotate(-8deg); }
.mkt-hero__deco .d5 { top: 46%; left: 4%;  font-size: 30px; transform: rotate(6deg); }
.mkt-hero__deco .d6 { top: 12%; left: 52%; font-size: 28px; transform: rotate(-6deg); }
.mkt-hero__deco .d7 { top: 84%; left: 46%; font-size: 32px; transform: rotate(12deg); }
.mkt-hero__deco .d8 { top: 40%; left: 94%; font-size: 34px; transform: rotate(-10deg); }

.mkt-hero__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.mkt-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: var(--pill);
    background: rgb(255 255 255 / 70%);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.mkt-hero__title {
    margin: 18px 0 16px;
    font-size: clamp(40px, 5.4vw, 76px);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.04;
    color: var(--ink);
}

.mkt-hero__sub {
    max-width: 620px;
    margin: 0 auto;
    color: var(--body);
    font-size: 17px;
    line-height: 1.7;
}

.mkt-search {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 620px;
    margin: 30px auto 22px;
}

.mkt-search__input {
    flex: 1;
    min-width: 0;
    height: 52px;
    padding: 0 22px;
    border: 1px solid var(--line);
    border-radius: var(--pill);
    background: #fff;
    color: var(--ink);
    font: inherit;
    box-shadow: 0 6px 20px rgb(17 17 17 / 6%);
    transition: border-color var(--dur) var(--motion), box-shadow var(--dur) var(--motion);
}

.mkt-search__input:focus-visible {
    outline: none;
    border-color: var(--mkt-accent);
    box-shadow: 0 6px 22px rgb(37 99 235 / 12%);
}

.mkt-search__btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 52px;
    padding: 0 28px;
    border: 0;
    border-radius: var(--pill);
    background: var(--ink);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgb(17 17 17 / 12%);
    transition: transform var(--dur) var(--motion), box-shadow var(--dur) var(--motion);
}

.mkt-search__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgb(17 17 17 / 18%);
}

.mkt-search__btn .mkt-ico {
    font-size: 18px;
}

.mkt-quick {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.mkt-quick__chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: var(--pill);
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    transition: transform var(--dur) var(--motion), box-shadow var(--dur) var(--motion);
}

.mkt-quick__chip .mkt-ico {
    font-size: 17px;
}

.mkt-quick__chip:hover {
    transform: translateY(-2px);
    border-color: var(--mkt-accent);
    color: var(--mkt-accent);
    box-shadow: 0 8px 18px rgb(17 17 17 / 8%);
}

/* ------------------------------------------------------------ 首页分区 */

.mkt-section {
    padding: 52px 0 8px;
}

.mkt-section:last-of-type {
    padding-bottom: 56px;
}

.mkt-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.mkt-section__title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
}

.mkt-section__title .mkt-tint {
    display: inline-flex;
    font-size: 24px;
    color: var(--mkt-accent);
}

.mkt-section__more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 14px;
    transition: color var(--dur) var(--motion);
}

.mkt-section__more .mkt-ico {
    font-size: 18px;
    transition: transform var(--dur) var(--motion);
}

.mkt-section__more:hover {
    color: var(--mkt-accent);
}

.mkt-section__more:hover .mkt-ico {
    transform: translateX(3px);
}

.mkt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.mkt-grid__item {
    min-width: 0;
}

/* 屏幕外的应用卡不参与排版：目录一页十几张，原理与 theme.css 里文章卡那一条相同 */
@supports (content-visibility: auto) {
    .mkt-grid > .mkt-grid__item {
        content-visibility: auto;
        contain-intrinsic-size: auto 220px;
    }
}

/* ------------------------------------------------------------ 图标 tile */

.mkt-icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    overflow: hidden;
    border-radius: 12px;
    background: var(--acc-soft, #f6f6f7);
    color: var(--acc, #111);
    font-size: 24px;
    font-weight: 700;
}

.mkt-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ------------------------------------------------------------ 应用卡（对齐后台封面栅格） */

.mcard {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    transition: transform var(--dur) var(--motion), border-color var(--dur) var(--motion), box-shadow var(--dur) var(--motion);
}

.mcard:hover {
    transform: translateY(-3px);
    border-color: var(--mkt-accent);
    box-shadow: 0 12px 28px rgb(17 17 17 / 10%);
}

.mcard__link {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mcard__cover {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--soft);
}

.mcard__cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--dur) var(--motion);
}

.mcard:hover .mcard__cover-img {
    transform: scale(1.04);
}

/* 无封面兜底：应用色档的浅色渐变 + 白底彩色图标，让没封面的应用也有一张有设计的封面 */
.mcard__cover-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(120% 120% at 50% 0%, #fff 0%, transparent 60%),
        linear-gradient(135deg, var(--acc-soft, #f6f6f7) 0%, #fff 100%);
}

.mcard__cover-fallback .mkt-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: #fff;
    color: var(--acc, #111);
    font-size: 32px;
    box-shadow: 0 8px 20px rgb(17 17 17 / 12%);
    transition: transform var(--dur) var(--motion);
}

.mcard:hover .mcard__cover-fallback .mkt-icon {
    transform: scale(1.08) rotate(-3deg);
}

.mcard__badges {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.mcard__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 14px 16px 16px;
}

.mcard__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.mcard__name-line {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

.mcard__name {
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.mcard__version {
    flex: none;
    font-size: 12px;
    color: var(--muted);
}

.mcard__time {
    font-size: 12px;
    color: var(--muted);
}

.mcard__summary {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.mcard__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
}

.mcard__vendor {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.mcard__vendor-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--soft);
    color: var(--ink);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.mcard__vendor-name {
    overflow: hidden;
    font-size: 12px;
    color: var(--body);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.mcard__installs {
    flex: none;
    font-size: 12px;
    color: var(--muted);
}

/* ------------------------------------------------------------ 紧凑应用卡（首页下方两栏）
   一屏四列的横排小卡：左应用图标，右名称 + 纯文字类型标签 + 一行简介 + 作者 / 版本。
   不铺封面、不叠徽章组，整张卡的颜色只来自应用图标本身。 */
.mkt-grid--compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.mcard-mini {
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    transition: border-color var(--dur) var(--motion), box-shadow var(--dur) var(--motion);
}

.mcard-mini:hover {
    border-color: var(--mkt-accent);
    box-shadow: 0 6px 18px rgb(17 17 17 / 6%);
}

.mcard-mini__link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    height: 100%;
    padding: 14px;
}

.mcard-mini__link .mkt-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 21px;
}

.mcard-mini__body {
    flex: 1;
    min-width: 0;
}

.mcard-mini__line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.mcard-mini__name {
    overflow: hidden;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 纯文字类型标签：不带图标，也不给每个类型一个色相 */
.mkt-typetag {
    flex: none;
    padding: 2px 7px;
    border-radius: var(--pill);
    background: var(--soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}

.mcard-mini__summary {
    overflow: hidden;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.mcard-mini__foot {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
}

.mcard-mini__foot span + span::before {
    content: "\00b7";
    margin-right: 6px;
}

/* ------------------------------------------------------------ 徽章（纯文字 + 中性底） */

.mkt-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: var(--pill);
    background: rgb(255 255 255 / 92%);
    color: var(--ink);
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgb(17 17 17 / 8%);
}

.mkt-badge__ico {
    display: inline-flex;
    font-size: 13px;
}

.mkt-badge--official {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
}

/* ------------------------------------------------------------ 脚本切换显隐
   首页三栏由 market-home.js 克隆 <template> 后填值：封面与兜底块、官方徽章、版本、时间、
   安装量这几个格子要"有才显示"，靠 hidden 属性切换。
   它们自己带着 display（flex / inline-flex），会压过 [hidden] 自带的 display:none，
   所以这里显式补一条 —— 少了它，官方徽章与图标兜底会一直露在每一张卡上。
   与 theme.css 里 .btn[hidden] / .tag[hidden] 是同一个坑，已经是第三次踩。 */
.mcard__cover-img[hidden],
.mcard__cover-fallback[hidden],
.mkt-icon[hidden],
.mkt-badge[hidden],
.mcard__version[hidden],
.mcard__time[hidden],
.mcard__installs[hidden],
.mkt-empty[hidden],
.mkt-section[hidden] {
    display: none;
}

/* ------------------------------------------------------------ 内页页头（目录 / 排行共用，紧凑彩色带 + 居中） */

.mkt-page-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 44px 0 32px;
    text-align: center;
    background: #fbfcff;
    border-bottom: 1px solid var(--line);
}

.mkt-page-hero__bg {
    position: absolute;
    inset: -40% -10% 0;
    z-index: -2;
    background: radial-gradient(60% 70% at 50% 0%, rgb(37 99 235 / 7%) 0%, transparent 74%);
}

.mkt-page-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(rgb(17 17 17 / 6%) 1px, transparent 1.4px);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(80% 90% at 50% 0%, #000 0%, transparent 80%);
    mask-image: radial-gradient(80% 90% at 50% 0%, #000 0%, transparent 80%);
}

.mkt-page-hero .crumb {
    justify-content: center;
}

.mkt-list-title {
    margin: 14px 0 6px;
    font-size: clamp(30px, 3.6vw, 44px);
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--ink);
}

/* 结果数：跟着筛选条一起进「局部刷新的那一块」（见 market-catalog.html 的 data-live），
   因为它本来就随筛选变 —— 留在页头里，一次局部刷新之后就成上一档的旧数字了。
   位置从页头挪到列表区顶上：左对齐、小一号，读起来是"这一片有几张卡"，不是第二行标题。 */
.mkt-list-count {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 13px;
}

/* ------------------------------------------------------------ 目录筛选 */

.mkt-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 0;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.mkt-filter {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
}

.mkt-filter__label {
    min-width: 44px;
    color: var(--muted);
}

.mkt-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: var(--pill);
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    transition: border-color var(--dur) var(--motion), background var(--dur) var(--motion), color var(--dur) var(--motion);
}

.mkt-chip__ico {
    display: inline-flex;
    font-size: 15px;
}

.mkt-chip:hover {
    border-color: var(--mkt-accent);
}

.mkt-chip.is-on {
    border-color: var(--mkt-accent);
    background: var(--mkt-accent);
    color: #fff;
}

.mkt-chip.is-on .mkt-tint {
    color: #fff;
}

.mkt-list-body {
    padding-top: 28px;
    padding-bottom: 64px;
}

.mkt-filters + .mkt-grid,
.mkt-filters + .mkt-empty {
    margin-top: 28px;
}

/* ------------------------------------------------------------ Tab（排行 / 详情共用） */

.mkt-tabs {
    display: flex;
    gap: 24px;
    margin: 28px 0 24px;
    border-bottom: 1px solid var(--line);
}

.mkt-tabs--plain {
    justify-content: center;
    margin-bottom: 0;
    border-bottom: 0;
}

.mkt-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 12px 0;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-weight: 600;
    transition: color var(--dur) var(--motion), border-color var(--dur) var(--motion);
}

.mkt-tab .mkt-ico {
    font-size: 17px;
}

.mkt-tabs--plain .mkt-tab {
    padding: 9px 18px;
    border: 1px solid var(--line);
    border-radius: var(--pill);
    background: #fff;
}

.mkt-tab:hover {
    color: var(--mkt-accent);
}

.mkt-tab.is-on {
    border-color: var(--mkt-accent);
    color: var(--mkt-accent);
}

.mkt-tabs--plain .mkt-tab.is-on {
    background: var(--mkt-accent);
    border-color: var(--mkt-accent);
    color: #fff;
}

/* ------------------------------------------------------------ 排行 */

.mkt-rank-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mkt-rank {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-top: 12px;
}

.mkt-rank__no {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--soft);
    color: var(--muted);
    font-size: 15px;
    font-weight: 800;
}

.mkt-rank:nth-child(1) .mkt-rank__no {
    background: linear-gradient(135deg, #f6c445, #d99a1c);
    color: #fff;
    box-shadow: 0 4px 12px rgb(217 154 28 / 40%);
}

.mkt-rank:nth-child(2) .mkt-rank__no {
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    color: #fff;
    box-shadow: 0 4px 12px rgb(148 163 184 / 40%);
}

.mkt-rank:nth-child(3) .mkt-rank__no {
    background: linear-gradient(135deg, #e0a06a, #b06a34);
    color: #fff;
    box-shadow: 0 4px 12px rgb(176 106 52 / 40%);
}

.mkt-rank__link {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.mkt-rank__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mkt-rank__name {
    color: var(--ink);
    font-weight: 700;
}

.mkt-rank__summary {
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.mkt-rank__stat {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: var(--muted);
    font-size: 12px;
}

.mkt-rank__stat strong {
    color: #2563eb;
    font-size: 18px;
    font-weight: 700;
}

/* ------------------------------------------------------------ 详情页头 */

.mkt-detail-head {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 40px 0 28px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, var(--acc-soft, #f6f6f7) 0%, #fff 100%);
}

.mkt-detail__hero {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 24px;
}

.mkt-detail__hero .mkt-icon {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    background: #fff;
    color: var(--acc, #111);
    font-size: 52px;
    box-shadow: 0 10px 26px rgb(17 17 17 / 12%);
}

.mkt-detail__intro {
    flex: 1;
    min-width: 240px;
}

.mkt-detail__title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.mkt-detail__title {
    font-size: clamp(28px, 3.4vw, 40px);
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--ink);
}

.mkt-detail__summary {
    max-width: 720px;
    margin-top: 10px;
    color: var(--body);
    font-size: 16px;
}

.mkt-detail__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
}

.mkt-detail__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.mkt-detail__hint {
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
}

.mkt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 44px;
    padding: 0 22px;
    border: 1px solid var(--line);
    border-radius: var(--pill);
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    transition: transform var(--dur) var(--motion), border-color var(--dur) var(--motion), box-shadow var(--dur) var(--motion);
}

.mkt-btn .mkt-ico {
    font-size: 17px;
}

.mkt-btn--dark {
    border-color: transparent;
    background: linear-gradient(100deg, #2563eb, #7c3aed);
    color: #fff;
    box-shadow: 0 6px 18px rgb(37 99 235 / 26%);
}

.mkt-btn--dark:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgb(37 99 235 / 32%);
}

.mkt-btn--ghost:hover {
    border-color: var(--ink);
}

.mkt-detail__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 48px;
    padding-top: 28px;
    padding-bottom: 72px;
    align-items: start;
}

.mkt-detail__main {
    min-width: 0;
}

.mkt-shots {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: #7c3aed #eef;
}

.mkt-shots::-webkit-scrollbar {
    height: 8px;
}

.mkt-shots::-webkit-scrollbar-track {
    background: #eef1fb;
    border-radius: var(--pill);
}

.mkt-shots::-webkit-scrollbar-thumb {
    background: linear-gradient(100deg, #2563eb, #7c3aed);
    border-radius: var(--pill);
}

.mkt-shots img {
    flex: none;
    height: 260px;
    width: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.mkt-panel {
    display: block;
}

.mkt-detail__layout.is-ready .mkt-panel {
    display: none;
}

.mkt-detail__layout.is-ready .mkt-panel.is-on {
    display: block;
}

/* ------------------------------------------------------------ Markdown 正文 */

.mkt-md {
    color: var(--body);
    font-size: 15px;
    line-height: 1.75;
}

.mkt-md > :first-child {
    margin-top: 0;
}

.mkt-md h1,
.mkt-md h2,
.mkt-md h3,
.mkt-md h4,
.mkt-md h5,
.mkt-md h6 {
    margin: 1.6em 0 .6em;
    color: var(--ink);
    line-height: 1.3;
}

.mkt-md h1 { font-size: 28px; }
.mkt-md h2 { font-size: 23px; }
.mkt-md h3 { font-size: 19px; }
.mkt-md h4,
.mkt-md h5,
.mkt-md h6 { font-size: 16px; }

.mkt-md p {
    margin: 0 0 1em;
}

.mkt-md ul,
.mkt-md ol {
    margin: 0 0 1em;
    padding-left: 1.5em;
    list-style: revert;
}

.mkt-md li {
    margin: .3em 0;
}

.mkt-md code {
    padding: .15em .35em;
    border-radius: 4px;
    background: var(--soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: .9em;
}

.mkt-md pre {
    overflow: auto;
    margin: 0 0 1.2em;
    padding: 16px 20px;
    border-radius: 10px;
    background: var(--ink);
    color: #f2f2f2;
}

.mkt-md pre code {
    padding: 0;
    background: none;
    color: inherit;
}

.mkt-md blockquote {
    margin: 0 0 1.2em;
    padding: 4px 16px;
    border-left: 3px solid #c7d2fe;
    color: var(--muted);
}

.mkt-md img {
    margin: 10px 0;
    border-radius: 10px;
}

.mkt-md a {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.mkt-md hr {
    margin: 28px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------ 版本 */

.mkt-ver {
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
}

.mkt-ver:first-child {
    padding-top: 0;
}

.mkt-ver__head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 14px;
}

.mkt-ver__no {
    color: var(--ink);
    font-size: 17px;
    font-weight: 700;
}

.mkt-ver__meta {
    color: var(--muted);
    font-size: 13px;
}

.mkt-ver__log {
    margin-top: 12px;
    font-size: 14px;
}

.mkt-ver__empty {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

/* ------------------------------------------------------------ 右侧事实卡 */

.mkt-aside {
    position: sticky;
    top: 96px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 8px 24px rgb(17 17 17 / 6%);
}

.mkt-aside__title {
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
}

.mkt-fact {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.mkt-fact__k {
    flex: none;
    color: var(--muted);
}

.mkt-fact__v {
    min-width: 0;
    color: var(--ink);
    text-align: right;
    word-break: break-all;
}

.mkt-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 4px;
}

.mkt-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: var(--pill);
    background: var(--soft);
    color: var(--ink);
    font-size: 12px;
    transition: background var(--dur) var(--motion), color var(--dur) var(--motion);
}

.mkt-tag .mkt-ico {
    font-size: 13px;
    color: var(--mkt-accent);
}

.mkt-tag:hover {
    background: var(--mkt-accent-soft);
    color: var(--mkt-accent);
}

/* ------------------------------------------------------------ 动效偏好 */

@media (prefers-reduced-motion: reduce) {
    .mkt-hero__bg {
        animation: none;
    }

    .mcard,
    .mcard__cover-img,
    .mcard__cover-fallback .mkt-icon,
    .mkt-quick__chip,
    .mkt-search__btn,
    .mkt-btn,
    .mkt-section__more .mkt-ico {
        transition: none;
    }
}

/* ------------------------------------------------------------ 断点 */

@media (max-width: 960px) {
    .mkt-grid--compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mkt-detail__layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .mkt-aside {
        position: static;
    }

    .mkt-detail__actions {
        margin-left: 0;
    }

    .mkt-hero__deco {
        display: none;
    }
}

@media (max-width: 640px) {
    .mkt-hero {
        padding: 56px 0 44px;
    }

    .mkt-search {
        flex-direction: column;
    }

    .mkt-search__btn {
        width: 100%;
        justify-content: center;
    }

    .mkt-grid {
        grid-template-columns: 1fr;
    }

    .mkt-filter {
        align-items: flex-start;
    }

    .mkt-rank {
        gap: 12px;
    }

    .mkt-rank__summary {
        white-space: normal;
    }

    .mkt-rank__stat {
        display: none;
    }

    .mkt-shots img {
        height: 200px;
    }

    .mkt-detail__hero .mkt-icon {
        width: 72px;
        height: 72px;
        font-size: 40px;
    }
}
