:root {
  --mg-blue: #3b82f6;
  --mg-black: #111111;
  --mg-gray: #f5f7fa;
  --mg-border: #e5e7eb;
  --mg-text: #4b5563;
}

.mg-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 20px;
}

.mg-logo {
  line-height: 0.95;
  letter-spacing: 0.18em;
  font-weight: 600;
  font-size: 32px;
}

.mg-logo span {
  color: var(--mg-blue);
}

.mg-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
  align-items: center;
  margin: 48px 0;
}

.mg-kicker {
  color: var(--mg-blue);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}

.mg-title {
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.04em;
  margin: 0 0 24px;
}

.mg-lead {
  color: var(--mg-text);
  line-height: 1.9;
  font-size: 16px;
}

/* トップページの検索フォーム */
.mg-search-box {
    background: var(--mg-gray);
    border: 1px solid var(--mg-border);
    border-radius: 24px;
    padding: 16px;
    display: flex;
    flex-direction: column;  /* 縦に並べる */
    justify-content: space-between;
    width: 100%;  /* 横幅を100%に設定 */
    max-width: 600px;  /* 最大幅を設定（必要なら調整） */
    margin: 0 auto 32px;  /* 中央揃え */
}

/* トップページの検索フォームの入力欄 */
.mg-search-input {
    width: 100%;  /* 横幅を100%に設定 */
    border: none;
    padding: 12px;
    font-size: 16px;
    border-radius: 12px;
    margin-bottom: 16px;  /* ボタンと入力欄の間に隙間を作る */
}

/* トップページの検索フォームボタン */
.mg-search-box button {
    padding: 12px;
    background-color: var(--mg-blue);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
}

/* トップページの検索フォームボタンホバー時の効果 */
.mg-search-box button:hover {
    background-color: #3b82f6;
}

/* topicsページの検索フォーム */
.mg-search-box.topics-page {
    max-width: 100%;  /* 横幅を100%に設定 */
    margin: 0 auto 32px;  /* 中央揃え */
}

/* topicsページの検索入力部分 */
.mg-search-input.topics-page {
    width: 100%;  /* 横幅を100%に設定 */
    border: 1px solid #e5e7eb;  /* 境界線を追加 */
    padding: 14px;
    font-size: 16px;
    border-radius: 12px;
    margin-right: 10px;
}
.mg-section {
  margin-top: 56px;
}

.mg-section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 20px;
}

.mg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.mg-card {
  display: block;
  border: 1px solid var(--mg-border);
  border-radius: 20px;
  background: #fff;
  padding: 22px;
  text-decoration: none;
  color: var(--mg-black);
  transition: 0.2s;
}

.mg-card:hover {
  border-color: var(--mg-blue);
  transform: translateY(-2px);
}

.mg-card-title {
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 10px;
}

.mg-card-text {
  color: var(--mg-text);
  font-size: 14px;
  line-height: 1.8;
}

.mg-badge {
  display: inline-block;
  color: var(--mg-blue);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}

.mg-article {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 20px;
}

.mg-article h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.18;
  letter-spacing: -0.04em;
}

.mg-box {
  background: var(--mg-gray);
  border: 1px solid var(--mg-border);
  border-radius: 20px;
  padding: 24px;
  margin: 32px 0;
}

.mg-article-section {
  margin: 40px 0;
}

.mg-article-section h2 {
  font-size: 24px;
  margin-bottom: 14px;
}

.mg-article-section p {
  color: var(--mg-text);
  line-height: 2;
}

.mg-admin-form {
  max-width: 860px;
  margin: 0 auto;
}

.mg-admin-form input,
.mg-admin-form textarea,
.mg-admin-form select {
  width: 100%;
  border: 1px solid var(--mg-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 8px 0 18px;
}

.mg-admin-form textarea {
  min-height: 120px;
}

.mg-button {
  background: var(--mg-blue);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 22px;
  cursor: pointer;
}

/* トピック詳細のデザイン調整 */
.mg-article-section {
  margin: 40px 0;
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}

.mg-article-section h2 {
  font-size: 24px;
  color: #333;
  margin-bottom: 16px;
  font-weight: 600;
}

.mg-article-section p {
  color: #555;
  font-size: 16px;
  line-height: 1.8;
}

.mg-article-section ul {
  list-style-type: none;
  padding-left: 0;
}

.mg-article-section li {
  background-color: #fff;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.mg-article-section li a {
  color: #3b82f6;
  text-decoration: none;
  word-wrap: break-word;
}

.mg-article-section li a:hover {
  text-decoration: underline;
}

/* 記事のコンテンツ幅を広げる */
.mg-article {
  max-width: 1200px;  /* 最大幅を広げる */
  margin: 0 auto;     /* 中央揃え */
  padding: 40px 20px;
}

/* 各セクションの幅も調整 */
.mg-article-section {
  width: 100%;
  background-color: #f9f9f9;
  border-radius: 8px;
  margin-bottom: 20px;
  padding: 20px;
}

/* 見出しとテキストの間に十分なスペースを追加 */
.mg-article-section h2 {
  font-size: 26px;
  margin-bottom: 16px;
}

/* 各セクションに軽い影を追加して視覚的に分ける */
.mg-article-section {
  box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.1);
}

/* 各項目を枠で囲む */
.mg-article-section {
  border: 1px solid #ddd;  /* 薄いグレーで囲む */
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 30px;
}

/* セクションタイトルを目立たせる */
.mg-article-section h2 {
  font-size: 24px;
  color: #333;
  font-weight: bold;
  margin-bottom: 12px;
}

/* 本文のフォントサイズを調整 */
.mg-article-section p {
  font-size: 18px;  /* 読みやすいサイズに変更 */
  line-height: 1.8;  /* 行間を広げて読みやすさを向上 */
  color: #444;  /* 明るいグレーで視認性を向上 */
}

/* 出典リンクのデザイン */
.mg-article-section li {
  background-color: #f8fafc;  /* 薄いグレー背景 */
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;  /* 背景と同じ色の境界線 */
}

.mg-article-section li a {
  color: #3b82f6;  /* 青色のリンク */
  text-decoration: none;
  word-wrap: break-word;  /* 長いURLを折り返して表示 */
}

.mg-article-section li a:hover {
  text-decoration: underline;  /* ホバー時に下線を追加 */
}

/* 検索フォーム */
.mg-search-box {
    background: var(--mg-gray);
    border: 1px solid var(--mg-border);
    border-radius: 24px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    max-width: 400px;
    margin: 0 auto 32px;
}

.mg-search-input {
    width: 80%;
    border: none;
    padding: 12px;
    font-size: 16px;
    border-radius: 12px;
}

.mg-search-box button {
    padding: 12px;
    background-color: var(--mg-blue);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
}

/* 検索結果表示 */
.mg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.mg-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease;
}

.mg-card:hover {
    transform: translateY(-5px);
}

.mg-card-title {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
}

.mg-card-text {
    font-size: 14px;
    color: var(--mg-text);
}

/* SNSシェアボタンのデザイン */
.sns-share-buttons {
    margin-top: 40px;
    text-align: center;
}

.sns-share-buttons h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
}

.sns-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.sns-btn {
    padding: 10px 20px;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
    width: auto;
}

.sns-btn.facebook {
    background-color: #3b5998;
}

.sns-btn.twitter {
    background-color: #1da1f2;
}

.sns-btn.linkedin {
    background-color: #0077b5;
}

.sns-btn:hover {
    opacity: 0.8;
}

/* 投票セクションのスタイル */
.user-vote {
    margin-top: 40px;
    padding: 20px;
    background-color: #f9fafb;  /* 明るい背景色 */
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* 投票セクションのタイトル */
.user-vote h3 {
    font-size: 22px;
    color: #333;
    margin-bottom: 20px;
    font-weight: bold;
}

/* 投票ボタンのスタイル */
.vote-btn {
    padding: 14px 30px;
    background-color: #4caf50;  /* 役立ったボタン（緑色） */
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    margin: 10px;
}

.vote-btn:hover {
    background-color: #45a049;  /* ホバー時に色が少し変わる */
    transform: scale(1.05);  /* ボタンが少し拡大 */
}

.vote-btn:disabled {
    background-color: #ddd;  /* 無効時の色（グレー） */
    cursor: not-allowed;
}

/* 投票数の表示 */
.vote-counts p {
    font-size: 18px;
    color: #555;
    margin-top: 10px;
}

/* 投票ボタンと投票数を並べる */
.vote-counts {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

/* ビュー数表示のデザイン */
.view-count {
    background-color: #f0f4f8;  /* 明るい背景色 */
    border-left: 4px solid #4caf50;  /* 緑色のボーダー */
    padding: 10px 20px;
    margin: 20px 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.view-count span {
    color: #4caf50;  /* 緑色に文字を設定 */
}

@media (max-width: 768px) {
  .mg-hero,
  .mg-grid {
    grid-template-columns: 1fr;
  }
}