/* グローバルスタイルとリセット */
:root {
    --primary-color: #007aff;
    --light-gray: #f0f0f0;
    --medium-gray: #ddd;
    --dark-gray: #555;
    --card-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    background-color: #f9f9f9;
    color: #333;
}
button {
    cursor: pointer;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: bold;
}
.hidden {
    display: none !important;
}

/* ヘッダー */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
    text-align: center;
}
header h1 {
    font-size: 20px;
}

/* --- タブナビゲーション (Sticky & 横スクロール対応) --- */
.tabs {
    display: flex;
    background-color: #f0f0f0;
    padding: 10px 15px 0;
    max-width: 1200px;
    margin: 0 auto;
    
    /* 固定表示の設定 */
    position: sticky;
    top: 0;
    z-index: 100; /* 最前面 */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-top: -1px;
    
    /* ★横スクロール設定 (スマホ対策) */
    overflow-x: auto;
    white-space: nowrap; /* 折り返し禁止 */
    -webkit-overflow-scrolling: touch; /* スクロールを滑らかに */
    scrollbar-width: none; /* スクロールバーを隠す(Firefox) */
}
.tabs::-webkit-scrollbar {
    display: none; /* スクロールバーを隠す(Chrome/Safari) */
}

.tab-button {
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    color: var(--dark-gray);
    border-radius: 8px 8px 0 0;
    background-color: #e0e0e0;
    margin-right: 5px;
    transition: transform 0.1s ease, background-color 0.2s ease;
    
    /* ボタンが潰れないようにする */
    flex-shrink: 0; 
}
/* アクティブなタブのスタイル */
.tab-button.active {
    background-color: #f9f9f9; /* #app-containerと同じ背景色 */
    color: var(--primary-color);
}
.tab-button:active {
    transform: scale(0.96);
}

/* メインコンテナ */
#app-container {
    padding: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- カテゴリ・ジャンプメニュー (Sticky Nav) --- */
#category-nav {
    /* 固定表示の設定 (タブの下に表示) */
    position: sticky;
    top: 50px; /* ★少し余裕を持たせて50pxに設定 */
    z-index: 99;
    
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    padding: 10px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    
    /* 横スクロール対応 */
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    
    scrollbar-width: none;
}
#category-nav::-webkit-scrollbar {
    display: none;
}

/* ジャンプメニューのボタン */
.nav-pill {
    display: inline-block;
    background-color: #f0f0f0;
    color: #555;
    padding: 6px 12px;
    margin: 0 5px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    flex-shrink: 0; /* 縮まないようにする */
}
.nav-pill:first-child { margin-left: 15px; }
.nav-pill:last-child { margin-right: 15px; }

/* アクティブ状態（選択中） */
.nav-pill.active {
    background-color: #007aff;
    color: white;
    box-shadow: 0 2px 6px rgba(0,122,255,0.4);
    transform: scale(1.05);
}
@media (hover: hover) {
    .nav-pill:hover { background-color: #e0e0e0; }
    .nav-pill.active:hover { background-color: #0060c8; }
}

/* セクション: フィルター */
#filters {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}
#filters h2 {
    font-size: 18px;
    margin-bottom: 15px;
}
.filter-group {
    margin-bottom: 15px;
}
.filter-group label {
    display: block;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 5px;
}
.filter-group input[type="text"],
.filter-group select {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid var(--medium-gray);
    border-radius: 5px;
}
.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    font-size: 16px;
    margin-bottom: 8px;
}
.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
}

/* グリッドレイアウト（カードコンテナ用） */
.card-container, 
.card-container-grid, 
#card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 15px;
}

/* --- カードスタイル --- */
.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
                box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: transform, box-shadow;
}
@media (hover: hover) {
    .card:hover {
        transform: translateY(-6px);
        box-shadow: 0 12px 24px rgba(0,0,0,0.12);
        z-index: 1;
    }
}

.card-image-container {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fdfdfd;
    border-bottom: 1px solid var(--light-gray);
    position: relative;
}
.card-image {
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
}
.card-image-na {
    color: var(--medium-gray);
    font-size: 14px;
}
.card-content {
    padding: 15px;
}
.card-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}
.card-manufacturer {
    font-size: 14px;
    color: var(--dark-gray);
    margin-bottom: 15px;
}
.card-features {
    list-style: none;
    font-size: 14px;
}
.card-features li {
    margin-bottom: 8px;
    display: flex;
}
.card-features li strong {
    min-width: 80px;
    color: var(--dark-gray);
}
.card-actions {
    margin-top: auto;
    padding: 15px;
    border-top: 1px solid var(--light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-actions .compare-label {
    display: flex;
    align-items: center;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.1s ease;
}
.card-actions .compare-label:active {
    transform: scale(0.96);
}
.card-actions input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}
.card-actions .detail-button {
    background-color: var(--dark-gray);
    color: white;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: normal;
}
.card-actions .detail-button:hover {
    background-color: #333;
}

/* --- カード内：特殊スタイル --- */
.card-features .feature-sensor {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--light-gray);
    line-height: 1.4;
}
.card-features .form-list {
    list-style: none;
    padding-left: 10px;
    margin-top: 8px;
    font-size: 13px;
    color: #333;
}
.card-features .form-list li { margin-bottom: 4px; }
.card-features .form-list strong {
    min-width: 80px;
    color: #555;
    background-color: #f4f4f4;
    padding: 2px 4px;
    border-radius: 3px;
    margin-right: 5px;
}
.injector-info {
    font-size: 11px;
    color: #666;
    margin-left: 10px;
    display: block;
    margin-top: 2px;
}
.injector-info-detail {
    font-size: 12px;
    color: #005a9c;
    font-weight: normal;
    margin-left: 1em;
}

/* --- 概要カードの特別スタイル --- */
.card.overview-card {
    background-color: #f5f5f5;
    border: 2px dashed var(--medium-gray);
    box-shadow: none;
}
.card.overview-card .form-list strong {
    background-color: #e0e0e0;
    color: #000;
}
.card.overview-card .compare-label { display: none; }
.card.overview-card .card-manufacturer {
    font-weight: bold;
    color: var(--primary-color);
}

/* --- バッジ --- */
.badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    letter-spacing: 0.5px;
}
.badge-originator { background-color: #005a9c; border: 1px solid #004080; }
.badge-originator-only { background-color: #777; opacity: 0.8; }
.badge-bs { background-color: #28a745; border: 1px solid #1e7e34; }

/* 薬剤タグ */
.drug-tags { margin-bottom: 8px; }
.drug-tag {
    display: inline-block;
    background-color: #eef4ff;
    color: #007aff;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid #d0e0ff;
}

/* --- カテゴリグループのデザイン --- */
.oral-group, .insulin-group, .glp1-group, .cgm-group {
    margin-bottom: 40px;
    background-color: transparent;
}
.category-header {
    background-color: #eef4ff;
    border-left: 6px solid #007aff;
    padding: 10px 15px;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    border-radius: 0 4px 4px 0;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.insulin-group h2 {
    font-size: 18px;
    border-bottom: none;
    padding-bottom: 10px;
}
.count-badge {
    background-color: #007aff;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 10px;
    font-weight: normal;
}

/* スマホ閲覧時、見出しをStickyに */
@media (max-width: 768px) {
    .category-header {
        position: sticky;
        /* ★重要: タブ(約48px) + メニュー(約50px)の下に来るように調整が必要だが、
           要素が多すぎると画面が狭くなるため、見出しはあえて固定しない、
           もしくはメニューの下に潜り込ませる設定にするのが一般的 */
        top: 0; 
        z-index: 10;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
}

/* --- 比較バー --- */
#comparison-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.2);
    transform: translateY(0);
    transition: transform 0.3s ease;
}
#comparison-bar.hidden { transform: translateY(100%); }
#comparison-count { font-size: 16px; font-weight: bold; }
#compareButton { background-color: white; color: var(--primary-color); }
#resetButton { background-color: var(--dark-gray); color: white; margin-left: 10px; }

#app-container.comparison-bar-active {
    padding-bottom: 100px;
}

/* --- 比較モーダル --- */
#comparison-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}
#comparison-modal.hidden { display: none; }
.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 100%;
    max-width: 1200px;
    height: 90%;
    display: flex;
    flex-direction: column;
}
#closeModalButton {
    align-self: flex-end;
    background: none;
    font-size: 28px;
    color: var(--dark-gray);
    padding: 10px;
}
.modal-content h2 {
    font-size: 20px;
    text-align: center;
    padding: 0 15px 15px;
}
#comparison-table-container {
    overflow-x: auto;
    flex-grow: 1;
    padding: 0 15px 15px;
}

/* --- 比較テーブル --- */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}
.comparison-table th, .comparison-table td {
    border: 1px solid var(--medium-gray);
    padding: 10px;
    text-align: left;
    vertical-align: middle;
    font-size: 14px;
}
.comparison-table th {
    background-color: var(--light-gray);
    font-weight: bold;
    position: sticky;
    left: 0;
    z-index: 1;
}
.comparison-table tr th:first-child {
    background-color: white;
    min-width: 120px;
    position: sticky;
    left: 0;
    z-index: 10;
    background: #eee !important;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}
.comparison-table td { text-align: center; }
.comparison-table img { max-width: 120px; height: auto; }
.comparison-table .link-button {
    display: inline-block;
    padding: 4px 8px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}
.comparison-table td.highlight-diff {
    background-color: #fffbe6;
    font-weight: 600;
    box-shadow: inset 0 0 0 2px #ffd966;
}
.comparison-table .cell-smartphone {
    line-height: 1.5;
    text-align: left;
    padding-left: 15px !important;
}

/* 詳細表示 */
.detail-view-list {
    list-style: none;
    padding: 0;
    border-top: 1px solid var(--medium-gray);
}
.detail-item {
    display: flex;
    padding: 12px 5px;
    border-bottom: 1px solid var(--light-gray);
    font-size: 14px;
    align-items: center;
}
.detail-label {
    flex: 0 0 100px;
    font-weight: bold;
    color: var(--dark-gray);
    font-size: 13px;
}
.detail-value {
    flex: 1;
    line-height: 1.4;
    text-align: left;
}
.detail-image-wrapper {
    text-align: center;
    padding: 20px;
}
.detail-image-wrapper img { max-width: 200px; height: auto; }

.bs-relation {
    background-color: #f0fff4;
    border: 1px solid #d4edda;
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 12px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.bs-relation .label {
    color: #155724;
    font-weight: bold;
    background: #d4edda;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
}
.bs-relation .value { color: #333; font-weight: 600; }

/* スマホ最適化 (Media Queries) */
@media (max-width: 768px) { /* スマホ向け設定 */
    #comparison-modal { padding: 5px; }
    .modal-content { height: 98%; }
    .modal-content h2 { font-size: 16px; padding: 5px; }
    #comparison-table-container { padding: 0 5px 10px; }

    /* ★スマホでのタブとメニューの調整 */
    .tabs {
        padding-top: 5px; 
    }
    .tab-button {
        padding: 8px 15px; /* ボタンを少し小さく */
        font-size: 14px;
    }

    /* ジャンプメニューの位置をスマホのタブ高さに合わせて調整 */
    #category-nav {
        top: 48px; /* スマホではタブが低いので少し詰める */
    }
}

/* 画面回転ガイド */
#landscape-hint {
    display: none;
    background: #fff3cd;
    color: #856404;
    padding: 10px;
    text-align: center;
    font-size: 13px;
    border-bottom: 1px solid #ffeeba;
}
@media (max-width: 600px) and (orientation: portrait) {
    .modal-active #landscape-hint { display: block; }
}

/* アニメーション */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.card.animate-in {
    animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
}

/* スケルトン */
.skeleton-card {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    height: 350px;
    border: 1px solid #eee;
}
.skeleton-pulse {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: pulse 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 10px;
}
@keyframes pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.sk-image { height: 160px; width: 100%; margin-bottom: 20px; }
.sk-title { height: 24px; width: 70%; margin-bottom: 10px; }
.sk-text { height: 14px; width: 100%; margin-bottom: 6px; }
.sk-btn { height: 40px; width: 100%; margin-top: 20px; }

/* --- 追加バッジスタイル --- */

/* 配合薬バッジ（オレンジ系で目立たせる） */
.badge-combination {
    background-color: #f39c12; /* オレンジ */
    border: 1px solid #e67e22;
}

/* 後発品（ジェネリック）バッジ */
.badge-generic {
    background-color: #28a745; /* 緑（BSと同じ） */
    border: 1px solid #1e7e34;
}

/* バッジを縦に積むためのコンテナ */
.badge-stack {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column; /* 縦並び */
    gap: 5px; /* バッジ間の隙間 */
    align-items: flex-end; /* 右寄せ */
    z-index: 2;
}

/* スタック内のバッジは絶対配置を解除して並べる */
.badge-stack .badge {
    position: relative;
    top: auto;
    right: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* --- SMBG用バッジ --- */

/* ISO適合バッジ（信頼性の緑） */
.badge-iso {
    background-color: #2da44e; 
    border: 1px solid #2c974b;
    color: #fff;
}

/* スマホ連携バッジ（テクノロジーの青） */
.badge-smart {
    background-color: #0366d6;
    border: 1px solid #0358c6;
    color: #fff;
}

/* --- 比較表のスマホ最適化（2件比較時の「シンデレラフィット」設定） --- */

/* 2件比較のときだけ、テーブルの列幅を固定して画面内に収める */
.comparison-table.cols-2 {
    table-layout: fixed; /* 列幅を固定計算にする（重要） */
    width: 100%;
}

/* 2件比較時のセル設定 */
.comparison-table.cols-2 th,
.comparison-table.cols-2 td {
    word-wrap: break-word;       /* 長い単語も強制的に改行 */
    overflow-wrap: break-word;
    white-space: normal;         /* 折り返しを許可 */
    font-size: 13px;             /* 文字を少し小さくして情報を詰め込む */
    padding: 8px 4px;            /* 余白を詰める */
    vertical-align: middle;      /* 上下中央揃え */
}

/* 【1列目：項目名】少し狭くする（約24%） */
.comparison-table.cols-2 th:first-child {
    width: 24%;
    background-color: #f9f9f9; /* 薄いグレーで項目だと分かりやすく */
    color: #555;
    font-weight: bold;
    font-size: 11px; /* 項目名はさらに小さくても読める */
    text-align: center;
}

/* 【2・3列目：製品データ】残りを等分（38%ずつ） */
.comparison-table.cols-2 th:not(:first-child),
.comparison-table.cols-2 td:not(:first-child) {
    width: 38%;
}

/* 画像を強制的に枠内に収める */
.comparison-table img {
    max-width: 100% !important;
    height: auto !important;
    width: auto !important; /* JSで指定された width=80px を無効化 */
    max-height: 100px;      /* 縦に長くなりすぎないように制限 */
    display: block;
    margin: 0 auto;
}

/* --- 比較表モーダル全体 --- */
#comparison-table-container {
    overflow-x: auto;       /* 横スクロールを許可 */
    overflow-y: auto;       /* 縦スクロールも許可 */
    max-height: 80vh;       /* 画面の8割まで表示（残りはスクロール） */
    position: relative;     /* Stickyの基準点 */
    border-top: 1px solid #ddd;
    /* スクロールバーを少し美しく（iOS向け） */
    -webkit-overflow-scrolling: touch;
}

/* テーブル基本設定 */
.comparison-table {
    width: 100%;
    border-collapse: separate; /* Stickyを使うために必須 */
    border-spacing: 0;
    margin: 0;
    table-layout: auto; /* 基本はコンテンツ幅に合わせて広がる */
}

/* --- ヘッダー（製品名）の固定 --- */
.comparison-table thead th {
    position: sticky;
    top: 0;
    z-index: 20; /* 列より手前に */
    background-color: #fff;
    color: #333;
    font-size: 12px;
    padding: 10px 5px;
    border-bottom: 2px solid #eee;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); /* 浮いている感を出す影 */
    vertical-align: middle;
    height: 50px;
}

/* --- 左端列（項目名）の固定 --- */
.comparison-table tbody th,
.comparison-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: #f9f9f9; /* 背景色をつけて透けないように */
    border-right: 1px solid #ddd;
    width: 70px !important;    /* ★ここ重要：幅を70pxに固定 */
    min-width: 70px;
    max-width: 70px;
    font-size: 10px;           /* 文字は極小 */
    font-weight: bold;
    padding: 8px 2px;
    text-align: center;
    vertical-align: middle;
    line-height: 1.3;
    word-break: break-all;     /* 長い単語は強制改行 */
}

/* 左上の角（項目×製品名の交点）は最前面に固定 */
.comparison-table thead th:first-child {
    z-index: 30;
    background-color: #f0f0f0;
}

/* --- データセル --- */
.comparison-table td {
    padding: 8px 6px;
    font-size: 12px;
    color: #444;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    text-align: center;
    min-width: 130px; /* 3件以上の時は最低この幅を確保してスクロールさせる */
    word-wrap: break-word;
}

/* --- 画像の最適化（小さく表示） --- */
.comparison-table img {
    width: auto !important;
    max-width: 100% !important;
    max-height: 60px !important; /* ★高さを60pxに制限してコンパクトに */
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

/* --- 差分ハイライト --- */
.highlight-diff {
    background-color: #fff0f0; /* 薄い赤 */
    font-weight: bold;
    color: #d00;
}

/* =========================================
   ★ここがキモ：2件比較時の「シンデレラフィット」
   ========================================= */
.comparison-table.cols-2 {
    table-layout: fixed; /* 幅を固定計算モードに */
    width: 100%;         /* 画面幅いっぱいに */
}

/* 2件時のデータ列幅設定 */
.comparison-table.cols-2 td,
.comparison-table.cols-2 thead th:not(:first-child) {
    width: 42% !important;  /* 残りの幅（100% - 左列）を等分 */
    min-width: auto;        /* 最小幅制限を解除 */
    white-space: normal;    /* 折り返しを許可 */
}

/* 2件時の左列（さらに狭く攻めるならここを調整） */
.comparison-table.cols-2 tbody th,
.comparison-table.cols-2 thead th:first-child {
    width: 16% !important;  /* 画面の16%だけ使う */
    min-width: auto;
}

/* --- 販売中止・中止予定バッジ --- */

/* 販売中止（赤色で強調） */
.badge-discontinued {
    background-color: #dc3545; /* Red */
    border: 1px solid #bd2130;
    color: #fff;
}

/* 販売中止予定（黄色/オレンジで注意喚起） */
.badge-discontinued-planned {
    background-color: #ffc107; /* Yellow/Orange */
    border: 1px solid #d39e00;
    color: #212529; /* 文字は黒で見やすく */
}

/* --- 販売中止カードのグレーアウト設定 --- */
.card.discontinued {
    background-color: #f2f2f2; /* 背景を薄いグレーに */
    color: #999;               /* 文字色を薄く */
    border: 1px solid #ddd;
    position: relative;        /* 必要に応じてオーバーレイなどを置けるように */
}

/* 画像を完全にモノクロ＋半透明にする */
.card.discontinued .card-image {
    filter: grayscale(100%);
    opacity: 0.5;
}

/* バッジは目立つように彩度を残す（またはあえてグレーにするか選べますが、今回は警告なので少し残します） */
.card.discontinued .badge-discontinued {
    background-color: #666;    /* バッジもダークグレーにして「過去のもの」感を出す */
    border-color: #444;
    color: #fff;
    opacity: 1;                /* バッジの文字ははっきり読めるように */
}

/* ホバー時の浮き上がり効果を打ち消す（クリックしたくさせない） */
.card.discontinued:hover {
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}