@import url('https://fonts.googleapis.com/css2?family=Helvetica+Neue&display=swap');

:root {
  --main-color: #b2d8b2;
  --text-color: #003366;
  --alt-bg: #f0fff0;
}

/* 全体設定 */
body {
  margin: 0;
  font-family: 'Helvetica Neue', sans-serif;
  background-color: var(--alt-bg);
  color: var(--text-color);
  scroll-behavior: smooth;
  padding: 2rem 1rem;
  background-image: url('https://littlepenguin.me/bbs/kobanagara32_1.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.85);
  z-index: -1;
  backdrop-filter: blur(8px);
}

/* タイトル */
h1 {
  text-align: center;
  margin-bottom: 1rem;
  font-size: 2rem;
}

/* サイトに戻るリンク（固定） */
.back-link {
  position: fixed;
  top: 10px;
  left: 15px;
  background: var(--main-color);
  color: var(--text-color);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-weight: bold;
  text-decoration: none;
  z-index: 999;
}

.back-link:hover {
  opacity: 0.85;
}

/* 投稿フォームコンテナ */
.form-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 1rem;
}

/* 投稿フォーム */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background-color: #fff;
  border: 1px solid #ccc;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

form label {
  font-weight: bold;
  color: var(--text-color);
}

form label input,
form label textarea {
  margin-top: 0.3rem;
}

/* 入力欄 */
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  background-color: #f5faff;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* 投稿ボタン・削除ボタン */
input[type="submit"] {
  background-color: var(--main-color);
  color: var(--text-color);
  border: none;
  padding: 0.5rem 1.2rem;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  transition: opacity 0.3s;
  width: auto; /* 横長すぎ防止 */
  align-self: flex-start;
}

input[type="submit"]:hover {
  opacity: 0.8;
}

/* 投稿表示 */
.post {
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid #aaa;
  padding: 1rem;
  margin: 1rem auto;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  width: 90%;
  max-width: 800px;
}

.reply-post {
  background-color: #f4f8ff;
  margin-left: 2rem;
}

.post-header {
  font-weight: bold;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.post-date {
  font-size: 0.85rem;
  color: #666;
}

.post-message {
  margin-bottom: 1rem;
  white-space: pre-wrap;
}

.post-subject {
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: #444;
}

/* 返信フォームトグルボタン */
.reply-toggle {
  background-color: #b2d8b2;
  color: #003366;
  border: none;
  padding: 0.3rem 0.8rem;
  margin-bottom: 1rem;
  cursor: pointer;
  border-radius: 5px;
}

.reply-form {
  margin-top: 1rem;
  background-color: #eef7ef;
  padding: 0.8rem;
  border-radius: 6px;
}

.reply-form input,
.reply-form textarea {
  width: 100%;
  padding: 0.4rem;
  margin-bottom: 0.5rem;
}

/* 削除フォーム */
.delete-form {
  display: flex;
  align-items: center;
  justify-content: center;   /* 中央寄せ */
  gap: 0.4rem;               /* 要素の間隔 */
  margin-top: 0.4rem;
  margin-bottom: 0;
  width: fit-content;        /* 中身に合わせた幅 */
  max-width: 200px;          /* 最大幅を制限 */
}

/* パスワード入力欄 */
.delete-form input[type="password"] {
  width: 90px;               /* 横幅を短く */
  padding: 0.2rem 0.4rem;
  font-size: 0.85rem;
}

/* 削除ボタン */
.delete-form input[type="submit"] {
  background-color: #96c096;
  color: #fff;
  padding: 0.2rem 0.6rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.85rem;
}

/* ページネーション */
.pagination {
  text-align: center;
  margin: 1.5rem 0;
}

.pagination a {
  display: inline-block;
  margin: 0 0.3rem;
  padding: 0.4rem 0.8rem;
  background-color: var(--main-color);
  color: var(--text-color);
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
}

.pagination a.active {
  background-color: #96c096;
  color: white;
}

.pagination a:hover {
  opacity: 0.8;
}

/* スマホ対応 */
@media screen and (max-width: 768px) {
  body {
    padding: 1rem;
  }

  form {
    padding: 1rem;
  }

  .back-link {
    font-size: 0.8rem; /* スマホでは小さめ */
    padding: 0.3rem 0.6rem;
  }

  .delete-form input[type="password"] {
    width: 120px; /* スマホは少し広めに */
  }
}
