body {
    background-color: #FBFAF7;
    font-family: 'Roboto', sans-serif;
}

main {
    padding: 0.5rem;
}

h1 {
    font-size: 1.6rem;   /* PCなど広い画面向けのサイズ */
}

/* コンテナ周り */
.content-wrapper {
    max-width: 800px;
    margin: 50px auto;
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  }
  
  h2 {
    text-align: center;
    color: #333;
    margin-bottom: 1.5rem;
  }
  
  /* ====== 質問投稿ボタン ====== */
  .ask-question-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
  }
  
  .ask-question-button {
    background-color: var(--main-color);
    color: #fff;
    font-size: 1rem;
    padding: 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 40px auto;
  }
  
  .ask-question-button:hover {
    background-color: var(--accent-color);
  }
  .ask-icon {
    width: 24px;
    height: 24px;
  }
  
  /* ====== モーダル共通 ====== */
  .modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
  }
  .modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }
  .close-modal,
  .close-reply-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
  }
  .close-modal:hover,
  .close-reply-modal:hover {
    color: #333;
  }
  
  /* ====== フォーム ====== */
  .form-group {
    margin-bottom: 1rem;
  }
  .form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
  }
  #new-post-form input[type="text"],
  #new-post-form textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 1rem;
    margin-bottom: 1rem;
  }
  #new-post-form button[type="submit"] {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: var(--main-color);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
  }
  #new-post-form button[type="submit"]:hover {
    background-color: var(--accent-color);
  }
  
  /* ====== 投稿カード ====== */
  .popular-post-card {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s ease;
  }
  
  .popular-post-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  }
  
  /* ヘッダー */
  .popular-post-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  .rank-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }
  .post-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  /* 本文 */
  .popular-post-body {
    margin-bottom: 1rem;
  }
  .post-content {
    font-size: 1rem;
    color: #555;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
  }
  
  /* フッター */
  .popular-post-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #888;
    border-top: 1px solid #eee;
    padding-top: 0.5rem;
  }
  .post-author,
  .post-date,
  .post-view-count {
    margin-right: 0.5rem;
  }
  .post-author {
    display: inline-block;
    max-width: 120px;     /* 幅を制限 */
    white-space: nowrap;  
    overflow: hidden; 
    text-overflow: ellipsis; /* 省略(...) */
    vertical-align: middle;
  }
  
  /* コメント・リプライボタン */
  .comments-link {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
  }
  .comments-link .expand-button {
    color: var(--main-color);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
  }
  .comments-link .expand-button:hover {
    text-decoration: underline;
  }
  .reply-modal-open-btn {
    background-color: #f2eccf;
    color: #444;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
  }
  .reply-modal-open-btn:hover {
    background-color: #e0d7a7;
  }
  
  /* 詳細(リプライ一覧) */
  .post-details {
    margin-top: 1rem;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 1rem;
    display: none;
  }

  /* ▼ ボタン横並び用 */
.discussion-actions {
    display: flex;
    align-items: center;     /* 縦方向中央揃え */
    gap: 0.5rem;            /* ボタン間の余白 */
    margin-top: 0.5rem; 
  }
  
  /* secondaryボタン(例: グレー) */
  .secondary-button {
    background-color: #f2f2f2;
    color: #333;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
  }
  .secondary-button:hover {
    background-color: #e0e0e0;
  }
  
  /* primaryボタン(例: メインカラー) */
  .primary-button {
    background-color: var(--main-color);
    color: #fff;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
  }
  .primary-button:hover {
    background-color: var(--accent-color);
  }
  
  /* リプライ表示 */
  .reply-list {
    margin-top: 1rem;
  }
  .reply-item {
    padding: 0.8rem;
    border-bottom: 1px solid #ddd;
    margin-bottom: 0.8rem;
  }
  .reply-author-date {
    font-weight: bold;
    color: #444;
    margin-bottom: 4px;
  }
  .reply-content {
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
  }

  .reply-modal-content {
    /* ここでデザインを微調整 */
    max-width: 550px;        /* ちょっと広め */
    border-radius: 10px;     /* 角を少し丸める */
    padding: 2rem;           /* 十分な余白 */
    position: relative;      /* 既にあるが念のため */
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  }
  
  /* タイトル */
  .reply-modal-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center; /* 中央揃えにする例 */
    color: #333;
  }
  
  /* ラベル */
  .reply-label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #555;
  }
  
  /* テキストエリア */
  .reply-textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.8rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    margin-bottom: 1.2rem;
    resize: vertical; /* ユーザが高さ調整可能に */
  }
  
  /* ボタンエリア */
  .reply-modal-button-area {
    text-align: right; /* 右寄せ */
  }
  
  /* 送信ボタン */
  .reply-modal-submit-button {
    background-color: var(--main-color); /* サイトのメインカラー */
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
  }
  
  .reply-modal-submit-button:hover {
    background-color: var(--accent-color);
  }
  
  /* ====== レスポンシブ ====== */
  @media (max-width: 768px) {
    h1{
        font-size: 1.2rem;
        margin-top: -20px;
    }

    .content-wrapper {
      margin: 20px auto;
      padding: 1rem;
    }

    h2 {
      font-size: 0.95rem; /* 文字サイズをやや小さめ */
      margin-bottom: 1rem;
    }

    .popular-post-card {
      padding: 1rem;
    }

    .post-title {
      font-size: 0.85rem;
      white-space: normal; /* 改行を許可 */
    }

    .post-content {
      font-size: 0.8rem; /* 小さめフォント */
    }

    .ask-question-button {
      max-width: 100%;
      font-size: 0.9rem;
      padding: 0.8rem;
    }

    .modal-content {
      margin: 10% auto;
      width: 90%;
      max-width: 350px;
      padding: 1.5rem;
    }

    .discussion-actions {
        flex-direction: column; /* 縦に積む */
        align-items: stretch;
    }

    .secondary-button,
    .primary-button {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
        width: 100%; /* 全幅にすると分かりやすい */
    }

    .reply-modal-open-btn {
      font-size: 0.85rem;
      padding: 0.3rem 0.6rem;
    }

    .reply-modal-content {
        margin: 10% auto;
        width: 90%;
        max-width: 400px;
        padding: 1.5rem;
    }

    .reply-modal-title {
        font-size: 1rem;
    }

    .reply-textarea {
        font-size: 0.9rem;
        min-height: 80px;
    }

    .reply-modal-submit-button {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
  }