@charset "UTF-8";

/* =========================================
   ベース設定
   ========================================= */
body {
    margin: 0;
    font-family: "Noto Sans JP", "Helvetica Neue", Meiryo, sans-serif;
    background-color: #f0f2f5; /* 背景を少し濃くして、セクションの白/色を引き立たせる */
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* =========================================
   ヘッダー（ヒーローセクション）
   ========================================= */
   header {
    background: linear-gradient(135deg, #0d47a1 0%, #42a5f5 100%);
    color: #fff;
    padding: 25px 20px; /* 上下の余白を少し調整 */
    box-shadow: 0 4px 15px rgba(13, 71, 161, 0.3);
    margin-bottom: 40px;
    border-bottom: 5px solid #ffca28;
}

/* レイアウト用コンテナ */
.header-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative; /* PC配置の基準点 */
    display: flex;
    justify-content: center; /* コンテンツを中央寄せ */
    align-items: center;
    min-height: 70px; /* 高さを確保 */
}

/* --- 左側：ロゴエリア --- */
.header-left {
    position: absolute; /* 左端に固定 */
    left: 0;
    top: 50%;
    transform: translateY(-50%); /* 垂直方向の中央揃え */
}

.brand-logo {
    font-family: "Kanit", sans-serif;
    font-weight: 800;
    font-style: italic;
    font-size: 3.5rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    text-shadow: 4px 4px 0px rgba(0,0,0,0.2); /* 影を濃くして浮き上がらせる */
    line-height: 1;
    white-space: nowrap; /* 折り返し禁止 */
}

/* --- 中央：テキストエリア --- */
.header-center {
    text-align: center; /* 文字を中央揃え */
}

.header-center h1 {
    margin: 0;
    font-size: 1.5rem; /* 日本語タイトルのサイズ */
    font-weight: 700;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-center p {
    margin: 5px 0 0;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.9);
}

/* --- スマホ・タブレット対応（1024px以下で適用） --- */
@media (max-width: 1024px) {
    .header-content {
        flex-direction: column; /* 縦並びに変更 */
        padding: 15px 0;
        min-height: auto; /* 高さを自動調整 */
    }
    
    /* ロゴの固定を解除して中央に表示 */
    .header-left {
        position: static; 
        transform: none;
        margin-bottom: 15px;
        text-align: center;
    }
    
    /* ロゴサイズをタブレット・スマホ用に調整 */
    .brand-logo {
        font-size: 3rem; /* 3.5remから少し小さく */
    }
    
    /* 中央テキストの余白調整 */
    .header-center {
        text-align: center;
    }
    .header-center h1 {
        font-size: 1.2rem;
    }
    .header-center p {
        font-size: 0.85rem;
    }
}


/* =========================================
   メインコンテンツエリア
   ========================================= */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

h2 {
    font-size: 1.5rem;
    color: #2c3e50;
    border-bottom: 3px solid rgba(0,0,0,0.1); /* 線を少し控えめに */
    padding-bottom: 8px;
    margin-bottom: 25px;
    display: inline-block;
}

/* =========================================
   ★ジャンルセクション（背景色追加）
   ========================================= */
.genre-section {
    background: #fff; /* デフォルト */
    margin-bottom: 60px;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.02);
}

/* 各ジャンルのテーマカラー（目に優しいパステル調） */

/* 1. 文芸：知的なブルー系 */
#section-literature {
    background-color: #fdfdfd; /* ベースは白に近い */
    background-image: linear-gradient(to bottom, #e3f2fd 0%, #ffffff 150px);
}
#section-literature h2 { border-color: #2196f3; color: #1565c0; }

/* 2. ビジネス：信頼のグリーン/グレー系 */
#section-business {
    background-color: #fdfdfd;
    background-image: linear-gradient(to bottom, #e8f5e9 0%, #ffffff 150px);
}
#section-business h2 { border-color: #4caf50; color: #2e7d32; }

/* 3. 趣味：明るいオレンジ/イエロー系 */
#section-hobby {
    background-color: #fdfdfd;
    background-image: linear-gradient(to bottom, #fff3e0 0%, #ffffff 150px);
}
#section-hobby h2 { border-color: #ff9800; color: #ef6c00; }

/* 4. 専門書：落ち着いたパープル系 */
#section-specialized {
    background-color: #fdfdfd;
    background-image: linear-gradient(to bottom, #f3e5f5 0%, #ffffff 150px);
}
#section-specialized h2 { border-color: #9c27b0; color: #6a1b9a; }

/* 5. 児童書：優しいピンク系 */
#section-children {
    background-color: #fdfdfd;
    background-image: linear-gradient(to bottom, #fce4ec 0%, #ffffff 150px);
}
#section-children h2 { border-color: #e91e63; color: #ad1457; }

/* 6. 学習参考書：爽やかなシアン系 */
#section-study {
    background-color: #fdfdfd;
    background-image: linear-gradient(to bottom, #e0f7fa 0%, #ffffff 150px);
}
#section-study h2 { border-color: #00bcd4; color: #00838f; }

/* ■ 2026年 最新トレンド：落ち着いたルビーレッド */
#section-2026 {
    background-color: #fdfdfd; /* ベースは白に近い */
    /* 文芸(#e3f2fd)に対応する、ごく薄い桜色(#ffebee)を使用 */
    background-image: linear-gradient(to bottom, #ffebee 0%, #ffffff 150px);
}

#section-2026 h2 {
    /* 枠線：アクセントとなる少し明るめの赤 */
    border-color: #ef5350; 
    /* 文字：前回決定した、深みのある落ち着いた赤 */
    color: #bf2121; 
}

/* =========================================
   コントロールエリア（グラフ＆操作パネル）
   ========================================= */
.genre-top-area {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    margin-bottom: 30px;
}

/* ★変更点: グラフ用カードスタイルの追加 */
.chart-card {
    flex: 3;                 /* 以前のwrapperと同じ比率 */
    min-width: 300px;
    background: #fff;        /* 純白の背景 */
    border-radius: 12px;     /* 角丸 */
    padding: 20px;           /* 内側の余白 */
    box-shadow: 0 4px 15px rgba(0,0,0,0.08); /* ふんわりとした影 */
    border: 1px solid rgba(0,0,0,0.03); /* 極薄の枠線 */
    position: relative;
    /* フレックスアイテムとしての挙動 */
    display: flex;
    flex-direction: column;
}

/* ★変更点: 内部ラッパーはシンプルに */
.chart-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    /* 以前のスタイル（背景色や枠線）は .chart-card に移動しました */
}

.genre-controls {
    flex: 2;
    min-width: 280px;
    background: rgba(255,255,255,0.6); /* 背景色となじむように半透明 */
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 15px;
}

/* --- (以下、前回と同じですが念のため記載) --- */
.control-group {
    flex-grow: 1;
    flex-basis: 140px;
}
.control-group:last-child {
    flex-basis: auto;        /* 自動調整に変更 */    
    flex-grow: 2;            /* 検索欄は少し広めに確保すると綺麗です */
}

.genre-controls label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #555; /* 色を少し濃く */
    margin-bottom: 6px;
}

.genre-controls select,
.genre-controls input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
    height: 42px;
    box-sizing: border-box;
}

.genre-controls select:focus,
.genre-controls input:focus {
    border-color: #0073e6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-box-wrapper {
    display: flex;
    width: 100%;
}
.search-box-wrapper input {
    border-radius: 8px 0 0 8px;
    border-right: none;
}
.search-btn {
    background-color: #0073e6;
    color: white;
    border: 1px solid #0073e6;
    padding: 0 20px;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    white-space: nowrap;  /* 【追加】文字の折り返しを禁止 */    
    min-width: 80px;      /* 【追加】最低限の幅を確保 */
}
.search-btn:hover { 
    background-color: #005bb5; /* 少し濃いブルーに変更 */
    border-color: #005bb5;     /* ★枠線の色も合わせて変更するとより綺麗です */
}

/* =========================================
   本棚エリア（横スクロール）
   ========================================= */
.genre-books-area {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 10px 10px 25px 10px;
    
    /* スクロールバー装飾 */
    scrollbar-width: thin;
    scrollbar-color: #ccc rgba(0,0,0,0.05);
}
.genre-books-area::-webkit-scrollbar { height: 8px; }
.genre-books-area::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); border-radius: 4px; }
.genre-books-area::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }


/* =========================================
   書籍カードデザイン
   ========================================= */
.book-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
    min-width: 200px; 
    max-width: 200px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-color: #aed6f1;
    z-index: 10; /* ホバー時に手前に */
}

.book-item {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
}

.book-cover {
    width: 80px;
    height: auto;
    aspect-ratio: 80 / 110;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.15);
    flex-shrink: 0;
    align-self: flex-start;
}
.book-cover-placeholder {
    width: 80px;
    height: 110px;
    background: #ecf0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #bdc3c7;
    border-radius: 4px;
    flex-shrink: 0;
}

.book-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 5px;
    color: #2c3e50;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author-text {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.current-score {
    display: inline-block;
    font-size: 1.1rem;
    font-weight: 800;
    color: #e67e22;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.amazon-link-btn {
    display: block;
    width: 100%;
    background: #febd69;
    color: #111;
    text-align: center;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 6px 0;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: background 0.2s;
    margin-top: auto;
}
.amazon-link-btn:hover { background: #f3a847; }

.rating-area {
    margin-top: auto;
    border-top: 1px dashed #eee;
    padding-top: 12px;
}

.rating-buttons { display: flex; gap: 5px; }

.btn-vote {
    flex: 1;
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 0;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.btn-vote:hover { background: #2980b9; transform: translateY(-1px); }
.btn-vote:active { transform: translateY(1px); }

.voted-message {
    text-align: center;
    font-size: 0.85rem;
    font-weight: bold;
    color: #27ae60;
    background: #eafaf1;
    padding: 8px;
    border-radius: 6px;
}

/* ランキングバッジ */
.rank-badge {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    border: 2px solid #fff;
    background: #95a5a6; /* Default */
}

.rank-badge.rank-1 {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    width: 44px;
    height: 44px;
    font-size: 20px;
    top: -12px;
    left: -12px;
}
.rank-badge.rank-2 {
    background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%);
    width: 40px;
    height: 40px;
    font-size: 18px;
}
.rank-badge.rank-3 {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
}

/* モーダルなどは前回と同じため省略なしで記述 */
.info-btn {
    background: #fff; border: 1px solid #ddd; padding: 8px 16px; border-radius: 20px; font-size: 0.9rem; cursor: pointer; color: #555; transition: all 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.info-btn:hover { background: #f9f9f9; color: #333; }

.modal { 
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.6); 
    backdrop-filter: blur(3px); 
    overflow-y: auto; /* ★これを追加：中身が長い時にスクロールできるようにする */
}
.modal-content { background-color: #fff; margin: 5% auto; padding: 30px; border: none; width: 90%; max-width: 600px; border-radius: 12px; box-shadow: 0 15px 40px rgba(0,0,0,0.3); position: relative; animation: slideIn 0.3s ease-out; }
@keyframes slideIn { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.close-btn { position: absolute; top: 15px; right: 20px; font-size: 32px; color: #aaa; cursor: pointer; line-height: 1; }
.close-btn:hover { color: #333; }

/* おすすめ本エリアのデザイン */
#featured-section {
    background: #fff9c4; /* 薄い黄色 */
    border: 2px solid #f1c40f;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 30px;
    display: none; /* データ読み込みまでは隠しておく */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.featured-label {
    background: #f1c40f;
    color: #333;
    font-weight: bold;
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    margin-bottom: 10px;
}

/* レスポンシブ（タブレット・スマホ共通） */
@media (max-width: 1024px) {
    header { padding: 20px 15px; } /* 余白を少し詰める */
    
    .genre-section { padding: 20px; }
    .genre-top-area { flex-direction: column; }
    .genre-controls { flex-direction: column; }
    .control-group { flex-basis: 100%; }
    
    /* iPadではカードを少し見やすく（スマホ用の140px設定は768px以下のまま維持） */
    .book-card { min-width: 180px; max-width: 180px; }
}

/* 検索ボタンが無効化された時のスタイル */
.search-btn:disabled {
    background-color: #ccc !important; /* 灰色 */
    border-color: #ccc !important;
    color: #888 !important;           /* 文字色も少し薄く */
    cursor: not-allowed;              /* カーソルを禁止マークに */
    box-shadow: none !important;      /* 影などを消す */
}

/* --- ヘッダー下のナビゲーションボタン共通スタイル --- */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;           /* 高さを統一 */
    padding: 0 16px;        /* 横幅の余白 */
    background-color: #fff;
    border: 1px solid #ccc; /* 薄い枠線 */
    border-radius: 20px;    /* 丸み */
    text-decoration: none;  /* リンクの下線を消す */
    color: #555;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-family: inherit;   /* フォントを統一 */
}

/* ホバー時の動き */
.action-btn:hover {
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    color: #007bff;
}

/* =========================================
   スマホUIの操作性・レイアウト改善（横スクロール最適化版）
   ========================================= */
   @media (max-width: 768px) {

    /* カード本体の設定 */
    .book-card {
        /* ▼▼▼ 重要な変更点 ▼▼▼ */
        
        /* 1. カードの幅を固定（140px程度にすると2.5冊分くらい見えます） */
        width: 140px !important;
        min-width: 140px !important;
        max-width: 140px !important;

        /* 2. 「縮小禁止」の設定（これがないと潰れます） */
        flex: 0 0 auto !important;

        /* 3. 余白の調整（横スクロール用に右側に隙間を作る） */
        margin: 0 10px 0 0 !important;
        
        /* カード内の余白 */
        padding: 10px !important;
        
        /* ▲▲▲ 変更ここまで ▲▲▲ */
    }

    /* 以前の .book-img クラスがあればそれも調整 */
    .book-img {
        height: 100px !important;
        object-fit: contain;
    }

    /* タイトル文字サイズを少し小さくしてバランスを取る */
    .book-title {
        font-size: 0.85rem !important;
        white-space: normal !important;
        overflow-wrap: break-word !important;
        line-height: 1.4;
    }

    /* 本の情報エリア */
    .book-info {
        min-width: 0 !important;
        flex: 1;
        padding-right: 0 !important;
    }

    /* ★Amazonボタン（崩れないように調整） */
    .amazon-link-btn {
        display: block !important;
        width: 100% !important;
        margin: 8px 0 5px 0 !important;
        padding: 8px 0 !important; /* 少し高さを減らす */
        font-size: 0.7rem !important; /* 文字を少し小さく */
        background-color: #f0c14b;
        color: #111;
        border: 1px solid #a88734;
        border-radius: 4px;
        text-align: center;
        text-decoration: none;
        box-sizing: border-box;
        font-weight: bold;
    }

    /* 投票ボタンエリア */
    .rating-area {
        width: 100%;
        margin-top: 5px;
    }

    .vote-buttons, .rating-buttons {
        display: flex;
        justify-content: space-between;
        gap: 4px; /* 隙間を詰める */
        width: 100%;
    }

    .vote-btn, .btn-vote {
        flex: 1;
        padding: 8px 0 !important;
        font-size: 0.75rem !important; /* 文字サイズ調整 */
        border-radius: 4px;
        text-align: center;
    }

    /* ▼▼▼ 追加：点数表示の強制一行化 ▼▼▼ */
    .current-score {
        display: block !important;       /* 横幅いっぱいに広げる */
        width: 100% !important;          /* 確実に幅を確保 */
        white-space: nowrap !important;  /* 【重要】改行を絶対に禁止する */
        text-align: center !important;   /* 中央揃えで見やすく */
        
        /* フォントサイズ調整：カード幅140pxに収まるように少し小さく */
        font-size: 0.9rem !important;    
        
        margin: 5px 0 !important;        /* Amazonボタンとの隙間を調整 */
        padding: 2px 0 !important;       /* 上下の余白 */
    }
    
}

/* =========================================
   フッターデザイン
   ========================================= */
   .site-footer {
    background-color: #fff;
    border-top: 1px solid #ddd;
    padding: 40px 20px;
    margin-top: 60px;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

.footer-attribution {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 5px;
}

.copyright {
    font-size: 0.85rem;
    color: #aaa;
    margin: 0;
}

/* スマホ用調整 */
@media (max-width: 768px) {
    .footer-buttons {
        flex-direction: column;
        align-items: center;
    }
    .footer-buttons .action-btn {
        width: 80%; /* スマホではボタンを少し広めに */
    }
}

/* ===== セクション見出しに高級感（明朝体）を持たせる ===== */
.genre-section h2 {
    font-family: 'Noto Serif JP', "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", serif !important;
    font-weight: 700;
    letter-spacing: 0.0em; /* 文字と文字の隙間を少し開けると、より上品な抜け感が出ます */
}

/* ===== 【修正】スコアと点数ボタンのカラー変更（BookRee用：明るいクリアブルー） ===== */

/* スコア（★）のテキスト色（内側の文字も強制的に色を変える指定を追加） */
.movie-score,
.movie-score *,
.book-score,
.book-score * {
    color: #0073e6 !important; /* ★ パッと目を引く明るくクリアなブルー */
    font-weight: bold !important;
}

/* 点数ボタン（+1, +3, +5）のベースデザイン */
.btn-vote {
    background-color: #ffffff !important; 
    color: #0073e6 !important; /* 明るいブルー */
    border: 1.5px solid #0073e6 !important; /* 枠線も明るいブルー */
    border-radius: 4px !important; 
    font-weight: bold !important;
    transition: all 0.2s ease !important; 
}

/* ボタンを押した時（タップ・ホバー時）の反転アクション */
.btn-vote:active,
.btn-vote:hover {
    background-color: #0073e6 !important; /* 背景を明るいブルーに */
    color: #ffffff !important; 
}

/* ===== スマホ用レイアウト調整（画面幅が768px以下の場合） ===== */
@media screen and (max-width: 768px) {
    /* 1. 【修正】グラフエリアと、表示数・ランキング基準プルダウンを非表示 */
    .chart-wrapper {
        display: none !important;
    }
    /* 「>」をつけることで、直下の要素だけを狙い撃ちにし、入れ子になった「詳細」を保護します */
    .genre-controls > .control-group:first-child,
    .genre-controls > .control-group:nth-child(2) {
        display: none !important;
    }    
    /* 2. 操作パネル全体を幅100%にし、隙間を極限まで詰める */
    .genre-controls {
        width: 100%;
        margin-left: 0 !important;
        gap: 4px !important; /* フレックス時の隙間を最小化 */
    }
    .genre-top-area {
        flex-direction: column;
    }

    /* 3. 【修正】ラベル（ジャンル・検索）と入力欄を横並びにする */
    .control-group {
        display: flex !important;
        align-items: center !important; /* 縦の中央で揃える */
        margin-bottom: 6px !important; /* 項目同士の縦の隙間 */
        gap: 8px !important; /* ラベルと入力欄の横の隙間 */
    }

    .control-group label {
        font-size: 12px !important; 
        margin-bottom: 0 !important; /* 縦並びだった時の余白を消す */
        white-space: nowrap !important; /* 文字が縦に折り返されるのを防ぐ */
        width: 50px !important; /* ★幅を固定して、右側のプルダウンと検索枠の開始位置をピタッと揃える */
    }

    /* プルダウンと検索枠が残りの横幅をいっぱいに使うようにする */
    .form-select,
    .search-box-wrapper {
        flex: 1 !important;
        width: 100% !important;
    }

    /* 4. プルダウン・検索入力欄・検索ボタンの高さを完全に統一し極小化 */
    .form-select, 
    .form-input, 
    .search-btn {
        padding: 2px 8px !important; /* 内側の余白を限界まで削る */
        font-size: 13px !important;  /* 文字サイズを少し小さく */
        height: 32px !important;     /* 高さを32pxにピタッと強制統一 */
        line-height: 1.5 !important;
        box-sizing: border-box !important; /* 枠線を含めた高さ計算に統一 */
        margin: 0 !important;
    }

    /* 検索ボタンの文字がズレないための微調整 */
    .search-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* 5. 【修正：ちょうど良い余白】操作パネルとカード一覧の間にわずかな余白を作る */
    .genre-top-area, 
    .genre-controls {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    .genre-books-area {
        margin-top: 12px !important; /* ←ここにわずかに余白を追加 */
        padding-top: 0 !important;
    }

    /* 6. 【新規追加】順位マークをスマホ用に小さく、位置を微調整 */
    .rank-badge {
        width: 22px !important;   /* 幅を小さく */
        height: 22px !important;  /* 高さを小さく */
        font-size: 11px !important; /* 数字も小さく */
        top: 2px !important;      /* 位置を少し下に下げる */
        left: 2px !important;     /* 位置を少し右に寄せる */
        box-shadow: 0 1px 2px rgba(0,0,0,0.1); /* 影も薄く */
    }

    /* 7. 【新規追加】セクション見出しと操作パネルの間の余白を詰める */
    .genre-section h2 {
        margin-bottom: 6px !important; /* 見出しの下の余白を限界まで削る */
        padding-bottom: 0 !important;
    }
    
    .genre-top-area {
        margin-top: 0 !important; /* パネルの上の余白を無くす */
    }

    /* 8. 【新規追加】ヘッダーとメインコンテンツの間の余白を詰める */
    header, 
    .header-content {
        padding-bottom: 8px !important; /* ヘッダーの下の余白を削る */
        margin-bottom: 0 !important;
    }
    
    main {
        padding-top: 8px !important; /* メインエリアの上の余白を削る */
    }
    
    .genre-section {
        margin-top: 0 !important; /* セクションの上の余白を削る */
        padding-top: 0 !important;
    }

    /* 9. 【新規追加】各セクション同士（最新トレンドと文芸など）の間の余白を詰める */
    .genre-section {
        margin-bottom: 16px !important; /* セクションの下の余白をギュッと縮小 */
    }

    /* 10. 【新規追加】セクション内側（上下）の余白と、見出しの上の隙間を詰める */
    .genre-section {
        padding: 8px !important; /* 白枠内の余白（上下左右）を小さく統一 */
    }
    
    .genre-section h2 {
        margin-top: 0 !important; /* 見出し文字の上の不要な隙間を無くす */
    }

    /* 11. 【修正：右側のはみ出し防止】幅の計算ルールを統一し、枠内に収める */
    .genre-section,
    .genre-section *,
    .genre-top-area,
    .genre-controls,
    .form-select,
    .form-input {
        box-sizing: border-box !important;
        max-width: 100% !important;
    }

    /* プルダウンの横幅を親要素にぴったり合わせる */
    .form-select {
        width: 100% !important;
    }

    /* 12. 【新規追加】カードとカードの間の余白を詰める */
    .genre-books-area {
        gap: 0px !important; /* グリッド配置の場合の隙間を縮小 */
    }
    
    .book-item {
        margin-bottom: 8px !important; /* マージン配置の場合の隙間を縮小 */
    }

    /* 最後のカードの下には無駄な余白を作らない */
    .book-item:last-child {
        margin-bottom: 0 !important;
    }

    /* 13. 【新規追加】操作パネル（プルダウン・検索領域）の上部余白を詰める */
    .genre-controls {
        margin-top: 0 !important;
        padding-top: 1 !important;
    }

    /* 14. 【新規追加】スマホ版ではセクション見出しの下線を非表示にする */
    .genre-section h2 {
        border-bottom: none !important; /* 下線を消去 */
    }

    /* 15. 【新規追加】カード下部（点数ボタン・シェアボタン周辺）の上下余白を詰める */
    .rating-area {
        margin-top: 0px !important; /* 点数ボタンの上の余白を削る */
        margin-bottom: 0px !important; /* 点数ボタンの下の余白を削る */
    }

    .share-btn,
    .tweet-btn,
    .twitter-share-button {
        margin-top: 0px !important; /* シェアボタンの上の余白を削る */
        margin-bottom: 0 !important; /* シェアボタンの下の余白を削る */
    }

    /* カード自体（白い枠）の内側下部パディングを詰める */
    .book-item {
        padding-bottom: 0px !important; 
    }

    /* 16. 【横スクロール用レイアウト】画像・タイトル・スコアを中央揃えにする（BookRee版） */
    .book-item {
        display: grid !important;
        width: 100% !important; /* ★ 親のカード幅いっぱいに広げる */
        grid-template-columns: 1fr !important;
        grid-template-areas: 
            "cover"
            "title"
            "author"
            "score" !important;
        gap: 4px !important;
        align-items: start !important;
        justify-items: center !important; /* 要素を中央配置 */
        order: 1 !important; /* スマホでの表示順（1番目） */
        margin-bottom: 6px !important;
    }

    .book-info {
        display: contents !important;
    }

    .book-cover {
        grid-area: cover !important;
        width: 100% !important; 
        height: auto !important;
        aspect-ratio: 80 / 110 !important;
        margin: 0 auto !important; /* 画像を中央に寄せる */
    }

    .book-title {
        grid-area: title !important;
        width: 100% !important;
        text-align: center !important; /* 文字を中央揃えに */
        white-space: normal !important;
        line-height: 1.3 !important;
        margin-top: 4px !important;
        font-size: 13px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 3 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .book-author-text {
        grid-area: author !important;
        width: 100% !important;
        text-align: center !important; /* 文字を中央揃えに */
        margin-top: 0 !important;
        margin-bottom: 2px !important;
        font-size: 11px !important;
        color: #666 !important;
    }

    .movie-score {
        grid-area: score !important;
        width: 100% !important;
        text-align: center !important; /* 文字を中央揃えに */
        font-size: 16px !important; 
        margin: 0 !important;
    }

    /* 17. 【修正】スマホ版では「投票済み (+〇点)」のテキストのみ非表示にする */
    .voted-container,
    .voted-text-mobile {
        display: none !important;
    } /* ←★ここが抜けていました！ */

    /* 20. 【新規追加】スマホ版でカード内要素の順番を入れ替え、余白を最適化する（BookRee用） */
    .book-card {
        display: flex !important;
        flex-direction: column !important; 
        padding: 8px 8px 6px 8px !important; 
        width: 136px !important; /* カード全体の幅を固定して余白を消す */
        flex-shrink: 0 !important; 
    }

    /* ② 点数ボタン・投票済エリア（スコアのすぐ下へ移動） */
    .rating-area {
        order: 2 !important;
        margin-top: 0 !important;
        margin-bottom: 6px !important;
        padding-top: 0 !important;
        border: none !important; /* ★追加：上部の点線を非表示にする */
    }

    /* ③ Amazonボタン（点数ボタンの下へ移動） */
    .link-buttons-area,
    .amazon-btn-wrapper,
    .buy-links,
    .amazon-link-btn { /* ★実際のクラス名を追加しました！ */
        order: 3 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        width: 100% !important; /* 念のため横幅いっぱいに揃える指定を追加 */
        box-sizing: border-box !important;
    }

    /* 21. 【新規追加】スマホ版では点数ボタンを常時ブルーにする（BookRee用） */
    .btn-vote {
        background-color: #0073e6 !important; /* BookReeの明るいブルー */
        color: #ffffff !important;            /* 文字は白色 */
        border: 1px solid #0073e6 !important; /* 枠線もブルー */
    }

    /* ★おまけ：タップした瞬間に少し濃いブルーにして「押した感」を出す */
    .btn-vote:active {
        background-color: #005bb5 !important; /* 少し濃いブルー */
        border-color: #005bb5 !important;
    }
    
    /* 21. ランキングに戻るカードの幅を狭くする（BookRee用） */
    .back-to-ranking-card {
        width: 80px !important;      /* カードの幅を大幅にスリム化 */
        min-width: 80px !important;
        max-width: 80px !important;
        padding: 10px 4px !important; /* 内側の左右の余白を削る */
    }

    /* スリム化に合わせて、中のアイコンや文字も少し小さく調整 */
    .back-to-ranking-card > div:first-child {
        font-size: 2rem !important;       /* 🔙アイコンのサイズ */
        margin-bottom: 6px !important;    /* アイコンの下の隙間 */
    }

    .back-to-ranking-card > div:last-child {
        font-size: 0.8rem !important;     /* 「ランキングに戻る」の文字サイズ */
        line-height: 1.2 !important;      /* 行間を詰める */
    }
}