/* ============================================================
   個別カードページの H1（SEO用、パンくず直下に小さく左寄せ表示）
   ============================================================ */
.cg-card-h1-wrap {
    margin: 0 0 12px !important;
    padding: 0 !important;
    text-align: left !important;
}

.cg-card-h1 {
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    line-height: 1.45 !important;
    color: #666 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    letter-spacing: 0;
    text-align: left !important;
}

.cg-card-h1::before,
.cg-card-h1::after {
    display: none !important;
    content: none !important;
    border: none !important;
    background: none !important;
}

@media (max-width: 600px) {
    .cg-card-h1 {
        font-size: 0.78rem !important;
    }
}

/* 個別カードページ: パンくず直下〜H1までの余白を最小限に */
.single-card #main_content,
.single-card .l-mainContent,
body.single-card .l-container {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.single-card .c-article__wrap,
body.single-card article.c-article__wrap {
    margin-top: 0 !important;
    padding-top: 4px !important;
}

/* ============================================================
   カード名リッチ表示（アイキャッチの上に配置）
   キャラクター名(大) + レアリティバッジ + 番号 + パック名
   ============================================================ */
.cg-card-name-hero {
    margin: 0 auto 18px;
    text-align: center;
    max-width: 720px;
}

.cg-card-name-character {
    font-size: 2rem;
    font-weight: 900;
    color: #1a1a1a;
    line-height: 1.2;
    letter-spacing: 0.01em;
    margin-bottom: 10px;
    word-break: break-word;
}

.cg-card-name-meta {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
}

.cg-card-name-rarity {
    display: inline-block;
    padding: 4px 12px;
    color: #fff;
    font-weight: 800;
    font-size: 12px;
    border-radius: 14px;
    letter-spacing: 0.05em;
}

.cg-card-name-number {
    color: #888;
    font-weight: 600;
    font-size: 13px;
}

.cg-card-name-pack {
    color: #3366cc;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    border-bottom: 1px dotted #3366cc;
    padding-bottom: 1px;
}

.cg-card-name-pack:hover {
    color: #1e4799;
    border-bottom-style: solid;
}

@media (max-width: 600px) {
    .cg-card-name-character {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }
    .cg-card-name-meta {
        gap: 6px;
        font-size: 12px;
    }
    .cg-card-name-rarity {
        padding: 3px 10px;
        font-size: 11px;
    }
}

/* ============================================================
   個別カードページのアイキャッチ画像 (固定サイズ枠)
   どんなサイズの画像でも枠いっぱいに表示し、はみ出し部分は切り取る
   ============================================================ */
.cg-card-thumb-wrap {
    margin: 0 auto 1.5rem;
    max-width: 220px;
}

.cg-card-thumb-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    display: block;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.cg-card-thumb-frame img,
.cg-card-thumb-frame .c-articleThumb__img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    /* 画像を枠いっぱいに拡大表示。はみ出し部分は切り取られる */
    object-fit: cover !important;
    object-position: center !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

@media (max-width: 600px) {
    .cg-card-thumb-wrap {
        max-width: 160px;
        margin: 0 auto 1rem;
    }
}

/* ============================================================
   個別カードページの価格ヒーローブロック (アイキャッチ直下)
   最高買取価格 / 平均買取価格 を大きく目立つように表示
   ============================================================ */
.cg-price-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 0 auto 2rem;
    max-width: 720px;
}

.cg-price-hero-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px 12px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-align: center;
    gap: 6px;
}

.cg-price-hero-cell--max {
    border-color: #d9534f;
    background: linear-gradient(180deg, #fff 0%, #fff5f4 100%);
}

.cg-price-hero-cell--avg {
    border-color: #3366cc;
    background: linear-gradient(180deg, #fff 0%, #f3f7fd 100%);
}

.cg-price-hero-label {
    font-size: 12px;
    font-weight: 700;
    color: #666;
    letter-spacing: 0.05em;
}

.cg-price-hero-cell--max .cg-price-hero-label {
    color: #d9534f;
}

.cg-price-hero-cell--avg .cg-price-hero-label {
    color: #3366cc;
}

.cg-price-hero-value {
    font-size: 2.2rem;
    font-weight: 900;
    color: #222;
    line-height: 1;
    letter-spacing: -0.01em;
}

.cg-price-hero-cell--max .cg-price-hero-value {
    color: #d9534f;
}

.cg-price-hero-cell--avg .cg-price-hero-value {
    color: #3366cc;
}

.cg-price-hero-meta {
    font-size: 11px;
    color: #888;
    font-weight: 500;
}

@media (max-width: 600px) {
    .cg-price-hero {
        gap: 8px;
        margin: 0 0 1.5rem;
    }
    .cg-price-hero-cell {
        padding: 14px 8px;
        gap: 4px;
        border-radius: 10px;
    }
    .cg-price-hero-label {
        font-size: 10px;
    }
    .cg-price-hero-value {
        font-size: 1.6rem;
    }
    .cg-price-hero-meta {
        font-size: 10px;
    }
}

/* ============================================================
   SWELL 標準レイアウトの余白調整
   パンくずリストとコンテンツの間の余白を詰める（全フロントページ）
   ============================================================ */
#breadcrumb + #content,
#breadcrumb + .l-content,
#breadcrumb + .l-container {
    padding-top: 8px !important;
    margin-top: 0 !important;
}

.l-mainContent {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* カードグリッドのスタイル — コンテナ幅に応じて自動で列数調整 */
.unified-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* タブレット〜スマホ: 3列以上を確保するため最小幅を縮小 */
@media (max-width: 767px) {
    .unified-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
        gap: 8px;
    }

    /* カード本体をコンパクト化(画像はそのままアスペクト比、テキストを縮小) */
    .unified-card-item .card-info {
        padding: 8px 6px;
    }

    .unified-card-item .card-item-h2 {
        font-size: 12px !important;
        margin: 0 0 4px !important;
    }

    .unified-card-item .card-item-h2 .card-name {
        font-size: 12px;
        line-height: 1.3;
    }

    /* 狭いセル幅では「最高買取 ¥xxx / 平均買取 ¥xxx」の赤いインライン表示は隠す
       （下の prices 行で見える）。
       ※!important は必須: 下方(544行)の非メディア規則
         `.unified-card-item .card-item-h2 .card-h2-inline{display:inline-block;white-space:nowrap}`
         が同詳細度・後勝ちでこの hide を無効化していたため、狭いカードで
         赤い価格がはみ出して見切れていた（2026-07-30 実機で確認・修正）。 */
    .unified-card-item .card-item-h2 .card-h2-inline {
        display: none !important;
    }

    /* メタ(レアリティ/番号)も外側のバッジで表示されるので狭い画面では隠す。
       ※ H3 の DOM テキストには残っているため SEO / a11y には影響しない
       ※同様に 554行の非メディア規則に後勝ちされるため !important。 */
    .unified-card-item .card-item-h2 .card-h2-meta {
        display: none !important;
    }

    .unified-card-item .card-number {
        font-size: 10px;
        margin-bottom: 3px;
    }

    .unified-card-item .card-rarity {
        font-size: 9px;
        padding: 2px 6px;
        margin-bottom: 4px;
    }

    .unified-card-item .card-prices {
        gap: 2px;
        font-size: 11px;
    }

    .unified-card-item .price-label {
        font-size: 9px;
    }

    .unified-card-item .price-value {
        font-size: 11px;
    }

    .unified-card-item .price-indicator {
        top: 4px;
        right: 4px;
    }

    .unified-card-item .price-indicator .trend {
        width: 22px;
        height: 22px;
        font-size: 11px;
        line-height: 18px;
    }

    .unified-card-item .price-indicator .trend.new {
        font-size: 7px;
    }
}

/* 極小スマホ(<=360px): 2列にして詰め込みすぎを回避 */
@media (max-width: 360px) {
    .unified-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.unified-card-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,.1);
    transition: transform .2s;
    background: #fff;
    position: relative;
}

.unified-card-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0,0,0,.15);
}

.unified-card-item a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-color-bar {
    height: 6px;
    width: 100%;
}

.card-image-wrapper {
    aspect-ratio: 3/4;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.no-image {
    color: #aaa;
    font-size: 14px;
}

.card-info {
    padding: 12px;
    text-align: center;
    margin-top: auto;
}

.card-name {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
    margin-bottom: 6px;
    color: #333;
}

.card-number {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

.card-rarity {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    text-align: center;
}

.card-prices {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price-label {
    font-size: 11px;
    color: #666;
}

.price-value {
    font-weight: 700;
    color: #d9534f;
    font-size: 14px;
}

/* 価格トレンドインジケーター */
.price-indicator {
    position: absolute;
    top: 5px;
    right: 10px;
    z-index: 10;
}

.price-indicator .trend {
    display: inline-block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    line-height: 26px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    background: #fff;
}

.price-indicator .trend.up {
    color: #d32f2f;
    border: 2px solid #d32f2f;
}

.price-indicator .trend.down {
    color: #1976d2;
    border: 2px solid #1976d2;
}

.price-indicator .trend.stable {
    color: #666;
    border: 2px solid #666;
}

.price-indicator .trend.new {
    color: #ffa500;
    border: 2px solid #ffa500;
    font-size: 9px;
    font-weight: bold;
    letter-spacing: -0.5px;
}

/* カード内 H2（SEO用の見出し + インライン価格）
   SWELL テーマの post_content h2 デフォルト装飾を明示リセット */
.unified-card-item .card-item-h2 {
    all: unset;
    display: block;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
    margin: 0 0 6px;
    color: #333;
    background: transparent !important;
    background-color: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

.unified-card-item .card-item-h2::before,
.unified-card-item .card-item-h2::after {
    display: none !important;
    content: none !important;
    border: none !important;
    background: none !important;
}

.unified-card-item .card-item-h2 .card-name {
    display: inline;
    font-weight: 700;
    color: #333;
    word-break: break-word;
}

.unified-card-item .card-item-h2 .card-h2-inline {
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #d9534f;
    white-space: nowrap;
}

/* レアリティ・番号メタ(H3重複回避用): 控えめに表示 */
.unified-card-item .card-item-h2 .card-h2-meta {
    display: inline-block;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #888;
    white-space: nowrap;
}

/* アーカイブヘッダー（動的H1 + メタ情報）
   H1 はパンくず直下の小さなサブタイトル、メタ情報バーは通常サイズ */
.cardgame-archive-header {
    margin: 0 0 16px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.cardgame-archive-header .cardgame-archive-h1 {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    margin: 0 0 10px !important;
    padding: 0 !important;
    color: #222 !important;
    border: none !important;
    background: none !important;
    letter-spacing: 0;
}

.cardgame-archive-header .cardgame-archive-game-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.35;
    color: #888;
    letter-spacing: 0.02em;
}

.cardgame-archive-header .cardgame-archive-title-text {
    display: block;
}

.cardgame-archive-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
}

.cardgame-archive-meta .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f6f7f8;
    border-radius: 6px;
    font-size: 13px;
}

.cardgame-archive-meta .meta-label {
    font-size: 11px;
    color: #888;
    font-weight: 500;
}

.cardgame-archive-meta .meta-value {
    font-size: 14px;
    font-weight: 700;
    color: #222;
}

@media (max-width: 600px) {
    .cardgame-archive-header .cardgame-archive-h1 {
        font-size: 1.1rem !important;
    }

    .cardgame-archive-header .cardgame-archive-game-label {
        font-size: 0.68rem;
    }
    .cardgame-archive-meta {
        gap: 8px;
    }
    .cardgame-archive-meta .meta-item {
        padding: 5px 10px;
    }
    .cardgame-archive-meta .meta-value {
        font-size: 13px;
    }
}

/* ============================================================
   記事内の「同名カード」「同パック高額カード」セクション（.cg-related-cards）:
   以前はスマホで横長リスト行に独自変形していたが、価格ラベルが
   「最/高/買/取」と1文字ずつ縦折れして崩れていた（2026-07-30 実機スクショで確認）。
   ユーザー要望により、アーカイブと全く同じカード型（.unified-card-grid の
   画像上・情報下グリッド）に統一する。＝ここでの独自オーバーライドは撤去。
   ============================================================ */
