/* ============================================================
   ガチャ当たり度ランキング（[ef_gacha_ranking] / 一覧のTOP3 / 詳細ページの順位バッジ）

   SWELL の .post_content ol / li（詳細度 0,1,1 以上）に負けないよう、打ち消しは2クラス以上で書く。
   見出し（h2/h3）にはあえて何も当てない。SWELLの見出しデザインをそのまま効かせるため。
   幅の切り替えは記事本文の実幅（コンテナクエリ）で行う。
   ============================================================ */

.efpd-rank,
.efpd-rank-top3 {
    container-type: inline-size;
    container-name: efrank;
}

/* 当たり度の求め方（リスト直前の1行。枠や色帯で飾らず、文章として読ませる） */
.post_content .efpd-shortcode p.efpd-rank-formula,
p.efpd-rank-formula.efpd-rank-formula {
    margin: 0 0 0.6rem;
    font-size: 0.78rem;
    line-height: 1.7;
    color: var(--efpd-muted);
}

.efpd-rank-formula strong {
    color: var(--efpd-text);
    font-weight: 800;
}

/* ランキング本体 */
.post_content .efpd-shortcode ol.efpd-rank-list,
ol.efpd-rank-list.efpd-rank-list {
    display: grid;
    gap: 0.6rem;
    margin: 0.4rem 0 1.4rem;
    padding: 0;
    list-style: none;
}

.post_content .efpd-rank-list .efpd-rank-item,
.efpd-rank-list .efpd-rank-item {
    --efpd-mini-w: 3.1rem;
    display: grid;
    /* カード列は3枚＋「+N」の幅で固定し、枚数が違う行でもガチャ名の左端をそろえる */
    grid-template-columns: 3.4rem calc(var(--efpd-mini-w) * 2.4 + 1.6rem) minmax(0, 1fr) 5.6rem;
    grid-template-areas: "no cards body score";
    gap: 0.5rem 0.8rem;
    align-items: center;
    margin: 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--efpd-border);
    border-radius: 0.8rem;
    background: var(--efpd-surface);
    list-style: none;
}

.post_content .efpd-rank-list .efpd-rank-item::before,
.efpd-rank-list .efpd-rank-item::before {
    content: none;
}

/*
 * 順位はゲーム内カードの総合値と同じステンシル書体の数字で見せる（丸バッジにしない）。
 * 1〜3位だけ数字の色を金・銀・銅にする。
 */
.efpd-rank-item__no {
    grid-area: no;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.05rem;
    color: #8a93a3;
    line-height: 1;
}

.efpd-rank-item__num {
    font-family: "eFontStencil", "eFootballStencil", sans-serif;
    font-size: 2.1rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.efpd-rank-item__no small {
    font-size: 0.66rem;
    font-weight: 700;
}

.efpd-rank-item[data-rank="1"] .efpd-rank-item__no {
    color: #c48a00;
}

.efpd-rank-item[data-rank="2"] .efpd-rank-item__no {
    color: #6f7b8c;
}

.efpd-rank-item[data-rank="3"] .efpd-rank-item__no {
    color: #a3622b;
}

/* 目玉のカード（最大3枚を少し重ねる）。カード本体は player-detail.css の .efpd-player-card を縮めて使う */
.efpd-rank-item__cards {
    grid-area: cards;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.efpd-rank-item__cards .efpd-player-card {
    flex-shrink: 0;
    width: var(--efpd-mini-w);
    height: calc(var(--efpd-mini-w) * 1.41);
    border-radius: 0.35rem;
    box-shadow: 0 2px 8px rgba(23, 43, 77, 0.25);
}

.efpd-rank-item__cards .efpd-player-card + .efpd-player-card {
    margin-left: calc(var(--efpd-mini-w) * -0.3);
}

.efpd-rank-item__cards .efpd-player-card__meta,
.efpd-rank-item__cards .efpd-player-card__cond,
.efpd-rank-item__cards .efpd-player-card__ovr-pos,
.efpd-rank-item__cards .efpd-player-card__shimmer {
    display: none;
}

.efpd-rank-item__cards .efpd-player-card__ovr-value {
    font-size: calc(var(--efpd-mini-w) * 0.24);
}

.efpd-rank-item__cards .efpd-player-card__placeholder {
    font-size: 0.55rem;
}

@media (hover: hover) and (pointer: fine) {
    .efpd-rank-item__cards .efpd-player-card:hover {
        transform: none;
    }
}

.efpd-rank-item__rest {
    flex-shrink: 0;
    margin-left: 0.3rem;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--efpd-muted);
}

.efpd-rank-item__body {
    grid-area: body;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.efpd-rank-item__title {
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.post_content .efpd-shortcode .efpd-rank-item__players {
    margin: 0;
    font-size: 0.76rem;
    line-height: 1.55;
    color: var(--efpd-muted);
}

/* 内訳は「小さい見出し語＋太い数値」を並べるだけ。チップや色帯にしない */
.post_content .efpd-shortcode p.efpd-rank-item__facts,
p.efpd-rank-item__facts.efpd-rank-item__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.1rem 0.9rem;
    margin: 0;
    line-height: 1.5;
}

.efpd-rank-fact {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    white-space: nowrap;
}

.efpd-rank-fact small {
    font-size: 0.7rem;
    color: var(--efpd-muted);
}

.efpd-rank-fact strong {
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--efpd-text);
    font-variant-numeric: tabular-nums;
}

/* 右端の当たり度（このページで唯一の点数） */
.efpd-rank-item__score {
    grid-area: score;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    line-height: 1;
}

.efpd-rank-item__score-label {
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--efpd-muted);
}

.efpd-rank-item__score-value {
    font-size: 1.55rem;
    font-weight: 900;
    color: var(--efpd-text);
    font-variant-numeric: tabular-nums;
}

.efpd-rank-item__score-bar {
    display: block;
    width: 100%;
    height: 0.35rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e8ebef;
}

.efpd-rank-item__score-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: #31364b;
}

.efpd-rank-empty {
    margin: 0.4rem 0 1.4rem;
    color: var(--efpd-muted);
}

/*
 * 狭い幅: 1段目に順位とガチャ名・内訳、2段目に目玉カードと当たり度。
 * 本文の実幅で切り替える（サイドバーの有無で記事幅が変わるため viewport では判定しない）
 */
@container efrank (max-width: 34rem) {
    .post_content .efpd-rank-list .efpd-rank-item,
    .efpd-rank-list .efpd-rank-item {
        grid-template-columns: 3rem auto minmax(0, 1fr);
        grid-template-areas:
            "no body body"
            ". cards score";
        align-items: start;
        padding: 0.75rem 0.8rem;
    }

    .efpd-rank-item__score {
        align-self: end;
        max-width: 7rem;
        justify-self: end;
        width: 100%;
    }

}

/* 一覧ページ上部のTOP3 */
.efpd-rank-top3 {
    margin: 0 0 1.6rem;
    padding: 0.9rem 1rem 0.5rem;
    border: 1px solid var(--efpd-border);
    border-radius: 0.75rem;
    background: var(--efpd-surface-muted, #f2f4f7);
}

.efpd-rank-top3__title {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--efpd-text);
}

.efpd-rank-top3__more {
    margin: 0 0 0.4rem;
    font-size: 0.85rem;
    text-align: right;
}

/* 詳細ページ先頭の順位バッジ */
.efpd-gacha-rank {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.7rem;
    margin: 0 0 1rem;
    font-size: 0.85rem;
}

.efpd-gacha-rank__badge {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    padding: 0.2rem 0.8rem;
    border-radius: 999px;
    background: #31364b;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.6;
}

.efpd-gacha-rank__badge strong {
    font-size: 1.05rem;
    font-weight: 900;
}

.efpd-gacha-rank__badge small {
    font-size: 0.75rem;
    opacity: 0.8;
}

.efpd-gacha-rank__text {
    font-weight: 600;
}

.efpd-gacha-rank__link {
    font-weight: 700;
}

/* 一覧ページのTOP3は行を小さく */
.efpd-rank-list .efpd-rank-item--compact {
    --efpd-mini-w: 2.6rem;
}
