/* =========================
   基本スタイル
   ========================= */

/* ボディの基本設定 */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f0f0;
}

/* ヘッダーのスタイル */
header {
    background-color: #333;
    color: #fff;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

/* ヘッダー内のタイトル */
header h1 {
    margin: 0;
    font-size: 24px;
}

/* ヘッダー内のトグルボタン */
header button {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: #ff6600;
    border: none;
    border-radius: 5px;
    color: #fff;
    transition: background-color 0.3s;
}

/* トグルボタンのホバー効果 */
header button:hover {
    background-color: #e65c00;
}

/* =========================
   グリッドレイアウト
   ========================= */

/* 広告コンテナのグリッド設定 */
.ad-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-gap: 15px;
    padding: 20px;
}

/* =========================
   広告ブロックのスタイル
   ========================= */

/* 広告ユニットの基本スタイル */
.ad-item {
    background-color: #ffffff;
    padding: 10px;
    border: 1px solid #ddd;
    border-bottom: 2px solid #ccc; /* 下部に強調された区切りライン */
    border-radius: 8px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    margin-bottom: 15px; /* 広告間のスペース */
}

/* 最後の広告ユニットには薄いボーダーを適用 */
.ad-item:last-child {
    border-bottom: 1px solid #ddd;
}

/* 広告ユニットのホバー効果 */
.ad-item:hover {
    transform: scale(1.02); /* 少し拡大 */
    box-shadow: 4px 4px 10px rgba(0,0,0,0.15); /* シャドウを強調 */
}

/* =========================
   レスポンシブデザイン
   ========================= */

/* タブレット向けのグリッド調整 */
@media (max-width: 768px) {
    .ad-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

/* モバイル向けのグリッド調整 */
@media (max-width: 480px) {
    .ad-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    /* ヘッダー内のタイトルとボタンの配置調整 */
    header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    header button {
        margin-top: 10px;
        width: 100%;
    }
}
