body {
  font-family: sans-serif;
  background: #f0f0f0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  background: #4CAF50;
  color: white;
  text-align: center;
  padding: 20px;
}

header p {
  margin: 5px 0 0 0;
  font-size: 14px;
}

/* 広告コンテナ（共通） */
.ad-box {
  margin: 20px auto;
  max-width: 728px;
  text-align: center;
  min-height: 50px;
}

/* カテゴリー間広告（PC時は非表示） */
.sp-ad-container {
  display: none;
}

main {
  flex: 1;
  padding: 0 20px;
  box-sizing: border-box;
}

/* ===== カテゴリーボックスの配置（画面サイズに合わせて横個数を自動調整） ===== */
.category-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* お知らせ欄（.news-section）と完全に同じボックス仕様 */
.category-box {
  background: #ffffff;
  border-radius: 14px;
  padding: 18px 22px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.08);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.category-box h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 20px;
  color: #333;
  border-left: 6px solid #4CAF50;
  padding-left: 10px;
}

/* ボックス内のアイテムグリッド */
.category-box .app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  width: 100%;
}

/* 元コード通りのアプリカード仕様 */
.app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: white;
  padding: 15px 10px;
  min-height: 48px;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  transition: transform 0.2s;
  box-sizing: border-box;
}

.app-card:hover {
  transform: translateY(-5px);
}

.app-card img {
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
}

.app-card span {
  font-weight: bold;
  color: #333;
  text-align: center;
  font-size: 14px;
}

footer {
  text-align: center;
  padding: 15px;
  background: #eee;
  font-size: 12px;
}

.feedback-link {
  text-align: center;
  margin: 30px 0;
}

.feedback-button {
  background-color: #4CAF50;
  color: white;
  padding: 12px 25px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.2s, transform 0.1s;
}

.feedback-button:hover {
  background-color: #45a049;
  transform: translateY(-2px);
}

.feedback-button:active {
  transform: translateY(0);
}

/* 元コード通りのヘッダー指定（PC時） */
.site-header {
  background: #4caf50;
  color: #fff;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left h1 {
  margin: 0;
}

.header-left p {
  margin: 5px 0 0;
  font-size: 0.9em;
}

.header-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* 姉妹サイトボタングループ */
.header-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sister-site-link {
  background: #fff;
  color: #4caf50;
  padding: 10px 16px;
  border-radius: 20px;
  font-weight: bold;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

.sister-site-link:hover {
  background: #e8f5e9;
  transform: translateY(-2px);
}

/* ===== お知らせ欄（上のカテゴリーボックスと最大幅を統一） ===== */
.news-section {
  max-width: 1200px;
  margin: 20px auto 0;
  background: #ffffff;
  border-radius: 14px;
  padding: 18px 22px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.08);
  box-sizing: border-box;
  width: 100%;
}

.news-section h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 20px;
  color: #333;
  border-left: 6px solid #4CAF50;
  padding-left: 10px;
}

.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* お知らせの自動改行 */
.news-item {
  padding: 10px 5px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.news-item:last-child {
  border-bottom: none;
}

.news-item .date {
  color: #888;
  margin-right: 10px;
  font-weight: bold;
  display: inline-block;
}

.badge {
  background: #ff5252;
  color: white;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  margin-right: 8px;
  display: inline-block;
}

.news-item.new {
  font-weight: bold;
}

/* ========================================================
   ダークモード（ブラウザ設定連動・元コードの色そのまま）
   ======================================================== */
@media (prefers-color-scheme: dark) {
  body {
    background: #121212;
    color: #ffffff;
  }

  .category-box {
    background: #1e1e1e;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
    border: 1px solid #2a2a2a;
  }

  .category-box h2 {
    color: #ffffff;
  }

  .app-card {
    background: #252525;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
    border: 1px solid #2a2a2a;
  }

  .app-card span {
    color: #ffffff;
  }

  .news-section {
    background: #1e1e1e;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
    border: 1px solid #2a2a2a;
  }

  .news-section h2 {
    color: #ffffff;
  }

  .news-item {
    border-bottom-color: #333333;
    color: #e0e0e0;
  }

  .news-item .date {
    color: #aaa;
  }

  footer {
    background: #121212;
    color: #aaa;
  }
}

/* ========================================================
   スマホ調整（画面幅768px以下）
   ======================================================== */
@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 15px;
    gap: 12px;
  }

  .header-left h1 {
    font-size: 1.45rem;
    line-height: 1.2;
  }

  .header-left p {
    font-size: 0.85em;
    margin-top: 4px;
  }

  .header-right {
    justify-content: center;
  }

  .sister-site-link {
    font-size: 0.85rem;
    padding: 8px 15px;
  }

  main {
    padding: 0 16px;
  }

  .category-container {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* SPのみカテゴリー間広告を表示 */
  .sp-ad-container {
    display: block;
    margin: 10px auto;
  }

  .category-box,
  .news-section {
    padding: 16px 14px;
  }

  .news-section {
    margin-top: 15px;
  }

  .category-box .app-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}