/* リセット・基本設定 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0eff4;
  color: #333;
  min-height: 100vh;
}

/* ヘッダー */
.header {
  background: #4f46e5;
  color: white;
  padding: 24px 16px;
  text-align: center;
}
.header-inner { max-width: 640px; margin: 0 auto; }
.logo { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.tagline { font-size: 13px; opacity: 0.8; margin: 4px 0 16px; }
.btn-post {
  background: white;
  color: #4f46e5;
  border: none;
  padding: 10px 28px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-post:hover { opacity: 0.85; }

/* メイン */
.main { max-width: 640px; margin: 0 auto; padding: 16px; }

/* フィルターバー */
.filter-bar { margin-bottom: 16px; }
.sort-buttons { display: flex; gap: 8px; margin-bottom: 10px; }
.sort-btn {
  padding: 6px 16px;
  border: 2px solid #4f46e5;
  border-radius: 999px;
  background: white;
  color: #4f46e5;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.sort-btn.active { background: #4f46e5; color: white; }
.category-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-btn {
  padding: 4px 12px;
  border: 1px solid #c4c2d4;
  border-radius: 999px;
  background: white;
  color: #666;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.cat-btn.active { background: #ede9fe; border-color: #4f46e5; color: #4f46e5; font-weight: 600; }

/* 投稿カード */
.post-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.post-category {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
/* カテゴリ別カラー */
.cat-仕事    { background: #dbeafe; color: #1d4ed8; }
.cat-人間関係 { background: #fed7aa; color: #c2410c; }
.cat-家族    { background: #d1fae5; color: #065f46; }
.cat-恋愛    { background: #fce7f3; color: #9d174d; }
.cat-お金    { background: #fef3c7; color: #92400e; }
.cat-その他  { background: #e5e7eb; color: #374151; }

.post-text { font-size: 15px; line-height: 1.7; color: #222; margin-bottom: 12px; }
.post-actions { display: flex; gap: 12px; align-items: center; }
.action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f9f9f9;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  color: #555;
}
.action-btn:hover { background: #f0eff4; }
.action-btn.sympathized {
  background: #ede9fe;
  border-color: #4f46e5;
  color: #4f46e5;
  font-weight: 600;
}
.post-date { margin-left: auto; font-size: 11px; color: #aaa; }

/* 読み込み・空 */
.loading, .empty { text-align: center; color: #aaa; padding: 48px 0; font-size: 15px; }

/* モーダル */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; color: #333; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 6px; }
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #333;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-group select:focus,
.form-group textarea:focus { border-color: #4f46e5; }
.form-group textarea { height: 120px; resize: none; line-height: 1.6; }
.char-count { text-align: right; font-size: 12px; color: #aaa; margin-top: 4px; }
.error-msg { color: #dc2626; font-size: 13px; min-height: 20px; margin-bottom: 8px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-cancel {
  padding: 10px 20px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  background: white;
  color: #555;
  font-size: 14px;
  cursor: pointer;
}
.btn-submit {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  background: #4f46e5;
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-submit:hover { opacity: 0.85; }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* コメント */
.comments-section {
  border-top: 1px solid #eee;
  margin-top: 12px;
  padding-top: 12px;
}
.comment {
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
}
.comment-text { font-size: 0.9rem; color: #333; }
.comment-date { font-size: 0.75rem; color: #aaa; }
.empty-comment { font-size: 0.85rem; color: #aaa; padding: 8px 0; }
.comment-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.comment-input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  resize: none;
  height: 60px;
}
.btn-comment-submit {
  padding: 0 16px;
  background: #6c63ff;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}
.btn-comment-submit:hover { opacity: 0.85; }
