/* =====================================================
   ソフトボール掲示板 - スタイルシート
   Soft-ball.com Board System
   ===================================================== */

/* ---- リセット & ベース ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* スマホで横スクロール防止（overflow-x:hiddenはposition:stickyを破壊するため使用不可） */
html { overflow-x: clip; }
body { overflow-x: clip; }

:root {
  --primary: #e84040;
  --primary-dark: #c0392b;
  --primary-light: #fff5f5;
  --secondary: #2c3e50;
  --accent: #f39c12;
  --green: #27ae60;
  --blue: #2980b9;
  --bg: #f5f6fa;
  --bg-white: #ffffff;
  --border: #e0e0e0;
  --text: #333333;
  --text-light: #666666;
  --text-muted: #999999;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.14);
  --font: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Hiragino Sans', sans-serif;
}

html { scroll-behavior: smooth; font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { padding-left: 1.5em; }

/* ---- ヘッダー ---- */
.site-header {
  background: var(--secondary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  position: sticky; top: 0; z-index: 1000;
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo-link { display: flex; align-items: center; gap: 12px; color: white; }
.logo-link:hover { color: #f0c040; }
.logo-icon { font-size: 2rem; }
.logo-main { font-size: 1.1rem; font-weight: 900; display: block; color: white; }
.logo-sub { font-size: 0.7rem; color: #aaa; display: block; font-weight: 400; }
.header-nav { display: flex; align-items: center; gap: 16px; }
.nav-link { color: #ccc; font-size: 0.9rem; font-weight: 500; padding: 6px 12px; border-radius: var(--radius-sm); transition: all .2s; }
.nav-link:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-post-btn { background: var(--primary); color: white !important; padding: 8px 18px; border-radius: 20px; font-weight: 700; }
.nav-post-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

/* ハンバーガー */
.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 24px; height: 2px; background: white; transition: all .3s; border-radius: 2px; }
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* モバイルメニュー */
.mobile-menu { display: none; flex-direction: column; background: var(--secondary); border-top: 1px solid rgba(255,255,255,0.1); }
.mobile-menu.open { display: flex; }
.mobile-link { color: #ccc; padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.9rem; transition: all .2s; }
.mobile-link:hover { background: rgba(255,255,255,0.08); color: white; }
.mobile-post { background: var(--primary); color: white !important; text-align: center; }

/* ---- メインレイアウト ---- */
.site-wrapper { min-height: calc(100vh - 64px); }
.main-content { padding: 24px 0 60px; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---- パンくず ---- */
.breadcrumb { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 20px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.bc-sep { color: var(--text-muted); }

/* ---- ヒーローバナー ---- */
.hero-section {
  background: linear-gradient(135deg, #c0392b 0%, #2c3e50 60%, #1a252f 100%);
  border-radius: 16px; padding: 40px 36px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 24px;
  margin-bottom: 28px; position: relative; overflow: hidden;
}
.hero-section::before {
  content: '&#x1F94E;'; font-size: 200px; position: absolute;
  right: -20px; top: -40px; opacity: 0.07; pointer-events: none; line-height: 1;
}
.hero-content { flex: 1; min-width: 280px; }
.hero-title { font-size: 1.8rem; font-weight: 900; color: white; margin-bottom: 10px; }
.hero-desc { color: rgba(255,255,255,0.8); font-size: 0.95rem; margin-bottom: 20px; line-height: 1.8; }
.hero-btn {
  display: inline-block; background: white; color: var(--primary);
  font-weight: 900; font-size: 1rem; padding: 12px 28px;
  border-radius: 50px; box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: all .25s;
}
.hero-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); color: var(--primary-dark); }
.hero-stats { display: flex; gap: 20px; flex-shrink: 0; }
.stat-item { text-align: center; background: rgba(255,255,255,0.12); padding: 14px 20px; border-radius: 12px; }
.stat-num { font-size: 2rem; font-weight: 900; color: white; display: block; line-height: 1; }
.stat-label { font-size: 0.72rem; color: rgba(255,255,255,0.75); display: block; margin-top: 4px; }

/* ---- カテゴリータブ ---- */
.tab-section { margin-bottom: 16px; }
.tab-list {
  display: flex; gap: 6px; background: white;
  border-radius: 50px; padding: 6px;
  box-shadow: var(--shadow); flex-wrap: wrap;
}
.tab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 40px;
  font-size: 0.88rem; font-weight: 600; color: var(--text-light);
  transition: all .25s; flex: 1; min-width: fit-content; justify-content: center;
  white-space: nowrap;
}
.tab-btn:hover { background: var(--bg); color: var(--text); }
.tab-btn.active { background: var(--tab-color, var(--secondary)); color: white; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.tab-icon { font-size: 1rem; }
.tab-count {
  background: rgba(0,0,0,0.12); color: inherit;
  font-size: 0.72rem; padding: 1px 7px; border-radius: 10px; font-weight: 700;
}
.tab-btn.active .tab-count { background: rgba(255,255,255,0.25); }

/* ---- カテゴリー説明 ---- */
.cat-description {
  display: flex; align-items: flex-start; gap: 12px;
  background: white; padding: 14px 18px; border-radius: var(--radius);
  margin-bottom: 16px; box-shadow: var(--shadow);
}
.cat-desc-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 2px; }
.cat-description strong { font-size: 0.95rem; color: var(--text); }
.cat-description p { font-size: 0.83rem; color: var(--text-light); margin-top: 2px; }

/* ---- コンテンツレイアウト ---- */
.content-layout { display: flex; gap: 28px; align-items: flex-start; }
.content-main { flex: 1; min-width: 0; }
.sidebar { width: 300px; flex-shrink: 0; position: sticky; top: 80px; align-self: flex-start; }

/* ---- 検索・フィルター ---- */
.search-filter-bar { background: white; border-radius: var(--radius); padding: 16px; margin-bottom: 20px; box-shadow: var(--shadow); }
.search-form { }
.search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-input-wrap { display: flex; flex: 1; min-width: 200px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; transition: border-color .2s; }
.search-input-wrap:focus-within { border-color: var(--primary); }
.search-input { flex: 1; padding: 10px 14px; border: none; outline: none; font-size: 0.9rem; font-family: var(--font); }
.search-btn { background: var(--primary); color: white; border: none; padding: 10px 16px; cursor: pointer; font-size: 1rem; transition: background .2s; }
.search-btn:hover { background: var(--primary-dark); }
.pref-select { padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.88rem; background: white; cursor: pointer; font-family: var(--font); min-width: 180px; }
.pref-select:focus { outline: none; border-color: var(--primary); }
.filter-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.filter-tag { background: #fff0f0; color: var(--primary); border: 1px solid #fcc; padding: 4px 10px; border-radius: 20px; font-size: 0.82rem; display: flex; align-items: center; gap: 6px; }
.filter-remove { color: #aaa; font-size: 0.9rem; }
.filter-remove:hover { color: var(--primary); }

/* ---- 投稿一覧ヘッダー ---- */
.posts-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.posts-count { font-size: 0.95rem; color: var(--text-light); font-weight: 500; }
.posts-count strong { color: var(--text); font-size: 1.1rem; margin: 0 4px; }
.post-btn-sm { background: var(--primary); color: white; padding: 8px 18px; border-radius: 20px; font-size: 0.85rem; font-weight: 700; transition: all .2s; }
.post-btn-sm:hover { background: var(--primary-dark); transform: translateY(-1px); color: white; }

/* ---- 投稿カード ---- */
.post-list { display: flex; flex-direction: column; gap: 14px; }
.post-card {
  background: white; border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow); transition: all .25s;
  border-left: 4px solid var(--border);
}
.post-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.post-card[data-category="battle"] { border-left-color: #e74c3c; }
.post-card[data-category="member"] { border-left-color: #27ae60; }
.post-card[data-category="other"]  { border-left-color: #2980b9; }

.post-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.post-title-link { flex: 1; }
.post-title { font-size: 1.02rem; font-weight: 700; color: var(--text); line-height: 1.5; transition: color .2s; }
.post-title-link:hover .post-title { color: var(--primary); }
.post-badges { display: flex; gap: 6px; flex-shrink: 0; }
.badge { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.badge-active { background: #e8f5e9; color: #27ae60; }
.badge-closed { background: #f5f5f5; color: #999; }

.post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.cat-badge { color: white; font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: 12px; }
.meta-item { font-size: 0.78rem; color: var(--text-light); background: #f8f8f8; padding: 3px 8px; border-radius: 10px; }

.post-excerpt { font-size: 0.88rem; color: var(--text-light); line-height: 1.6; margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.post-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding-top: 12px; border-top: 1px solid #f0f0f0; }
.post-info { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.post-author { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.team-name { color: var(--text-light); font-weight: 400; }
.post-date { font-size: 0.78rem; color: var(--text-muted); }
.post-stats { display: flex; align-items: center; gap: 12px; }
.stat-icon { font-size: 0.78rem; color: var(--text-muted); }
.stat-icon.stat-like { color: #e74c3c; font-weight: 600; }
.read-more { font-size: 0.82rem; font-weight: 700; color: var(--primary); padding: 5px 14px; border: 1.5px solid var(--primary); border-radius: 20px; transition: all .2s; }
.read-more:hover { background: var(--primary); color: white; }

/* ---- 投稿なし ---- */
.no-posts { text-align: center; padding: 60px 20px; background: white; border-radius: var(--radius); box-shadow: var(--shadow); }
.no-posts-icon { font-size: 4rem; margin-bottom: 16px; }
.no-posts-title { font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.no-posts-desc { color: var(--text-light); margin-bottom: 24px; }
.btn-primary { display: inline-block; background: var(--primary); color: white; padding: 12px 28px; border-radius: 50px; font-weight: 700; transition: all .2s; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); color: white; }
.btn-secondary { display: inline-block; background: var(--secondary); color: white; padding: 12px 28px; border-radius: 50px; font-weight: 700; transition: all .2s; }
.btn-secondary:hover { background: #1a252f; color: white; }
.btn-outline { display: inline-block; border: 2px solid var(--primary); color: var(--primary); padding: 10px 24px; border-radius: 50px; font-weight: 700; transition: all .2s; }
.btn-outline:hover { background: var(--primary); color: white; }

/* ---- ページネーション ---- */
.pagination { margin-top: 32px; }
.pagination-list { display: flex; gap: 6px; justify-content: center; list-style: none; padding: 0; flex-wrap: wrap; }
.page-btn { display: flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 14px; border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 600; color: var(--text); background: white; border: 1.5px solid var(--border); transition: all .2s; }
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-ellipsis { display: flex; align-items: center; color: var(--text-muted); padding: 0 6px; }

/* ---- サイドバー ---- */
.sidebar-card { background: white; border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.sidebar-title { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid #f0f0f0; }
.sidebar-post p { font-size: 0.83rem; color: var(--text-light); margin-bottom: 14px; }
.sidebar-cat-btns { display: flex; flex-direction: column; gap: 8px; }
.sidebar-cat-btn { display: block; padding: 10px 14px; border: 2px solid; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; text-align: center; transition: all .2s; }
.sidebar-cat-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

/* エリア検索 */
.pref-grid { display: flex; flex-direction: column; gap: 12px; }
.pref-region-title { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.pref-link { display: inline-block; font-size: 0.78rem; padding: 3px 8px; margin: 2px; border-radius: 4px; color: var(--text-light); background: #f8f8f8; transition: all .2s; }
.pref-link:hover, .pref-link.active { background: var(--primary); color: white; }

/* 最近の投稿 */
.recent-list { list-style: none; padding: 0; }
.recent-item { margin-bottom: 12px; }
.recent-link { display: flex; gap: 10px; align-items: flex-start; }
.recent-cat { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; flex-shrink: 0; }
.recent-info { flex: 1; min-width: 0; }
.recent-title { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text); line-height: 1.4; }
.recent-link:hover .recent-title { color: var(--primary); }
.recent-meta { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* サイドバープロモ */
.sidebar-promo { text-align: center; background: linear-gradient(135deg, #2c3e50, #1a252f); color: white; }
.sidebar-promo .sidebar-title, .sidebar-promo h3 { color: white; border-color: rgba(255,255,255,0.2); font-size: 1rem; }
.promo-icon { font-size: 2.5rem; margin-bottom: 8px; }
.sidebar-promo p { color: rgba(255,255,255,0.8); font-size: 0.83rem; margin-bottom: 14px; }
.promo-btn { display: inline-block; background: white; color: var(--secondary); padding: 8px 20px; border-radius: 20px; font-weight: 700; font-size: 0.85rem; transition: all .2s; }
.promo-btn:hover { background: #f0c040; color: var(--secondary); }

/* サイドバーカテゴリーリスト */
.sidebar-cat-list { display: flex; flex-direction: column; gap: 4px; }
.sidebar-cat-item { display: block; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.88rem; color: var(--text-light); transition: all .2s; }
.sidebar-cat-item:hover { background: #f8f8f8; color: var(--text); }
.sidebar-cat-item.active { background: #fff5f5; color: var(--primary); font-weight: 600; }

/* ---- 詳細ページ ---- */
.detail-card { background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 24px; }
.detail-cat-banner { padding: 12px 24px; color: white; font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; justify-content: space-between; }
.detail-status { font-size: 0.8rem; font-weight: 700; padding: 4px 12px; border-radius: 20px; }
.status-active { background: rgba(255,255,255,0.25); }
.status-closed { background: rgba(0,0,0,0.2); }

.detail-header { padding: 24px; border-bottom: 1px solid #f0f0f0; }
.detail-title { font-size: 1.4rem; font-weight: 900; color: var(--text); line-height: 1.5; margin-bottom: 16px; }
.detail-info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.info-item { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.info-value { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.info-team { color: var(--text-light); font-weight: 400; }
.highlight-date { color: var(--primary); font-size: 1rem; }

.detail-body { padding: 24px; }
.post-content {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text);
  text-align: left;        /* 左寄せ強制 */
  word-break: break-word;  /* 長い単語の折り返し */
}
/* nl2brで改行済みのためpre-wrapは不要。段落間の余白を抑制 */
.post-content br { display: block; margin-top: 0.1em; }

.detail-contact { padding: 16px 24px; background: #f8f9fa; border-top: 1px solid var(--border); }
.contact-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.contact-info { font-size: 0.88rem; color: var(--text); white-space: pre-wrap; }
.contact-email { font-size: 0.88rem; margin-top: 6px; }

.share-section { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.share-label { font-size: 0.83rem; color: var(--text-muted); }
.share-btn { font-size: 0.8rem; font-weight: 700; padding: 6px 14px; border-radius: 20px; transition: all .2s; }
.share-x { background: #000; color: white; }
.share-x:hover { background: #333; color: white; }
.share-line { background: #00b900; color: white; }
.share-line:hover { background: #009900; color: white; }

/* ---- 返信 ---- */
.replies-section { background: white; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.replies-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid #f0f0f0; }
.reply-count { color: var(--primary); font-size: 0.9rem; }
.replies-list { display: flex; flex-direction: column; gap: 14px; }
.reply-card { background: #f9f9f9; border-radius: var(--radius-sm); padding: 16px; border-left: 3px solid var(--primary); }
.reply-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.reply-num { font-size: 0.78rem; background: var(--primary); color: white; padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.reply-author { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.reply-date { font-size: 0.75rem; color: var(--text-muted); }
.reply-body { font-size: 0.9rem; line-height: 1.8; color: var(--text); white-space: pre-wrap; }
.no-replies { text-align: center; padding: 32px; color: var(--text-muted); background: #f9f9f9; border-radius: var(--radius-sm); }

/* ---- 返信フォーム ---- */
.reply-form-section { background: white; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.reply-form-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid #f0f0f0; }

/* ---- フォーム共通 ---- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.88rem; font-weight: 700; color: var(--text); margin-bottom: 7px; }
.required-mark { font-size: 0.72rem; background: var(--primary); color: white; padding: 2px 6px; border-radius: 4px; margin-left: 6px; font-weight: 700; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.92rem; font-family: var(--font); color: var(--text);
  background: white; transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232, 64, 64, 0.1);
}
.form-textarea { resize: vertical; min-height: 140px; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 5px; }
.form-row { margin-bottom: 0; }
.form-row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group-wide { }
.char-counter { font-size: 0.75rem; color: var(--text-muted); text-align: right; margin-top: 4px; }
.btn-submit {
  background: linear-gradient(135deg, var(--primary), #c0392b);
  color: white; border: none; padding: 14px 32px; border-radius: 50px;
  font-size: 1rem; font-weight: 900; cursor: pointer; font-family: var(--font);
  transition: all .25s; box-shadow: 0 4px 16px rgba(232,64,64,0.3);
}
.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(232,64,64,0.4); }
.btn-submit-large { width: 100%; font-size: 1.1rem; padding: 16px; }
.form-submit { text-align: center; }
.submit-note { font-size: 0.78rem; color: var(--text-muted); margin-top: 10px; }
.form-note { background: #fff9e6; border: 1px solid #ffe082; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.82rem; color: #7d6608; margin-bottom: 16px; }
.form-terms { margin-bottom: 20px; }
.checkbox-label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.checkbox-input { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; margin-top: 2px; accent-color: var(--primary); }
.checkbox-text { font-size: 0.88rem; color: var(--text); }

/* ---- アラート ---- */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 20px; }
.alert-success { background: #e8f5e9; border: 1px solid #a5d6a7; color: #2e7d32; }
.alert-error { background: #ffebee; border: 1px solid #ef9a9a; color: #c62828; }
.alert ul { padding-left: 1.2em; margin-top: 6px; }
.alert li { font-size: 0.88rem; margin-bottom: 4px; }

/* ---- 投稿フォームページ ---- */
.post-page-layout { display: flex; gap: 28px; align-items: flex-start; }
.post-form-wrap { flex: 1; min-width: 0; }
.post-help-sidebar { width: 280px; flex-shrink: 0; position: sticky; top: 80px; }
.post-form-header { margin-bottom: 24px; }
.post-form-title { font-size: 1.5rem; font-weight: 900; color: var(--text); margin-bottom: 8px; }
.post-form-desc { color: var(--text-light); font-size: 0.9rem; }

.form-step { background: white; border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.step-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.step-num { width: 32px; height: 32px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 0.9rem; flex-shrink: 0; }
.step-title { font-size: 1rem; font-weight: 700; color: var(--text); }

/* カテゴリー選択 */
.cat-options { display: flex; flex-direction: column; gap: 12px; }
.cat-option {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; border: 2px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all .2s; background: white;
}
.cat-option:hover { border-color: var(--cat-color, var(--primary)); background: #fafafa; }
.cat-option.selected { border-color: var(--cat-color, var(--primary)); background: rgba(var(--cat-color, var(--primary)), 0.05); box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }
.cat-option-icon { font-size: 2rem; flex-shrink: 0; }
.cat-option-info { flex: 1; }
.cat-option-label { font-size: 0.95rem; font-weight: 700; color: var(--text); display: block; margin-bottom: 3px; }
.cat-option-desc { font-size: 0.78rem; color: var(--text-muted); }
.cat-option-check { width: 24px; height: 24px; border: 2px solid var(--border); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; color: transparent; transition: all .2s; flex-shrink: 0; }
.cat-option.selected .cat-option-check { border-color: var(--cat-color, var(--primary)); background: var(--cat-color, var(--primary)); color: white; }

/* ヘルプサイドバー */
.help-card { background: white; border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.help-title { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid #f0f0f0; }
.help-section { margin-bottom: 14px; }
.help-section h4 { font-size: 0.85rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.help-section ul { list-style: none; padding: 0; }
.help-section li { font-size: 0.78rem; color: var(--text-light); padding: 2px 0; padding-left: 14px; position: relative; }
.help-section li::before { content: '✓'; position: absolute; left: 0; color: var(--green); font-size: 0.72rem; }
.help-rules ul li::before { content: '!'; color: var(--accent); font-weight: 900; }

/* ---- 成功ページ ---- */
.success-page { text-align: center; background: white; border-radius: var(--radius); padding: 60px 40px; box-shadow: var(--shadow); }
.success-icon { font-size: 5rem; margin-bottom: 16px; }
.success-title { font-size: 1.6rem; font-weight: 900; color: var(--green); margin-bottom: 12px; }
.success-desc { color: var(--text-light); margin-bottom: 32px; line-height: 1.8; }
.success-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---- 戻るリンク ---- */
.back-link { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.btn-back { display: inline-block; padding: 10px 22px; border: 2px solid var(--border); border-radius: 50px; font-size: 0.88rem; font-weight: 600; color: var(--text-light); transition: all .2s; }
.btn-back:hover { border-color: var(--primary); color: var(--primary); }
.btn-post-same { display: inline-block; padding: 10px 22px; background: var(--primary); color: white; border-radius: 50px; font-size: 0.88rem; font-weight: 700; transition: all .2s; }
.btn-post-same:hover { background: var(--primary-dark); color: white; }

/* ---- エラーボックス ---- */
.error-box { background: white; border-radius: var(--radius); padding: 40px; text-align: center; box-shadow: var(--shadow); }
.error-box h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 12px; }
.error-box p { color: var(--text-light); margin-bottom: 24px; }

/* ---- フッター ---- */
.site-footer { background: var(--secondary); color: rgba(255,255,255,0.8); padding-top: 48px; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.footer-top { display: flex; gap: 40px; padding-bottom: 36px; border-bottom: 1px solid rgba(255,255,255,0.1); flex-wrap: wrap; }
.footer-brand { flex: 1; min-width: 240px; }
.footer-logo { display: flex; align-items: center; gap: 10px; color: white; margin-bottom: 14px; }
.footer-logo-main { font-size: 1rem; font-weight: 900; display: block; color: white; }
.footer-logo-sub { font-size: 0.7rem; color: rgba(255,255,255,0.5); display: block; }
.footer-description { font-size: 0.83rem; color: rgba(255,255,255,0.6); line-height: 1.8; }
.footer-nav { display: flex; gap: 40px; flex-wrap: wrap; }
.footer-nav-group { }
.footer-nav-title { font-size: 0.82rem; font-weight: 700; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }
.footer-nav ul { list-style: none; padding: 0; }
.footer-nav li { margin-bottom: 8px; }
.footer-nav a { font-size: 0.85rem; color: rgba(255,255,255,0.7); transition: color .2s; }
.footer-nav a:hover { color: white; }
.footer-bottom { padding: 20px 0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.footer-copy { font-size: 0.8rem; color: rgba(255,255,255,0.5); }
.footer-copy a { color: rgba(255,255,255,0.6); }
.footer-disclaimer { font-size: 0.75rem; color: rgba(255,255,255,0.35); }

/* ---- ページトップ ---- */
#backToTop {
  display: none; position: fixed; bottom: 28px; right: 28px;
  width: 44px; height: 44px; background: var(--primary); color: white;
  border: none; border-radius: 50%; font-size: 1rem; cursor: pointer;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2); transition: all .2s; z-index: 100;
}
#backToTop:hover { background: var(--primary-dark); transform: translateY(-2px); }

/* ---- モーダル ---- */
.modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 2000;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-inner { background: white; border-radius: var(--radius); max-width: 560px; width: 100%; max-height: 80vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: white; }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-muted); transition: color .2s; }
.modal-close:hover { color: var(--primary); }
.modal-body { padding: 24px; }
.modal-body h4 { font-size: 0.9rem; font-weight: 700; color: var(--text); margin: 16px 0 6px; }
.modal-body p, .modal-body li { font-size: 0.85rem; color: var(--text-light); line-height: 1.7; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); text-align: right; }

/* ---- レスポンシブ ---- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .content-layout { flex-direction: column; }
  .post-page-layout { flex-direction: column; }
  .post-help-sidebar { width: 100%; position: static; }
  .hero-stats { display: none; }
}

/* ---- SP版サイドバー（モバイル用・記事下設置） ---- */
.sp-sidebar {
  display: none;
}
@media (max-width: 900px) {
  .sp-sidebar {
    display: block;
    margin-top: 24px;
    padding: 0 0 8px;
  }
  .sp-sidebar .sidebar-card {
    border-radius: var(--radius);
    margin-bottom: 16px;
  }
  /* SP版 投稿ボタン：大きく目立たせる */
  .sp-sidebar .sidebar-post .action-btn {
    display: block;
    width: 100%;
    padding: 16px;
    font-size: 1.05rem;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 4px 14px rgba(231,76,60,0.35);
  }
  .sp-sidebar .sidebar-post .action-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
  }
  /* SP版 エリアから探す：横スクロール対応 */
  .sp-sidebar .pref-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .sp-sidebar .pref-region {
    width: 100%;
  }
  .sp-sidebar .pref-region-title {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    margin: 8px 0 4px;
    padding: 0;
    border: none;
  }
  /* SP版 最近の投稿：コンパクト表示 */
  .sp-sidebar .recent-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .sp-sidebar .recent-item {
    border: none;
    padding: 0;
  }
  .sp-sidebar .recent-link {
    background: #f8f8f8;
    border-radius: var(--radius-sm);
    padding: 10px;
    gap: 8px;
    align-items: flex-start;
  }
  .sp-sidebar .recent-title {
    font-size: 0.8rem;
    line-height: 1.4;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
  }
  .sp-sidebar .recent-meta {
    font-size: 0.72rem;
  }
  /* SP版 プロモ：PC版と同じボール上・中央寄せ */
  .sp-promo-block {
    text-align: center !important;
    display: block !important;
    padding: 24px 20px !important;
  }
  .sp-promo-block .promo-icon {
    font-size: 2.8rem;
    margin: 0 auto 10px;
    display: block;
  }
  .sp-promo-block h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
  }
  .sp-promo-block p {
    font-size: 0.85rem;
    margin-bottom: 14px;
  }
  .sp-promo-block .promo-btn {
    display: inline-block;
    padding: 10px 28px;
    font-size: 0.9rem;
  }
}

@media (max-width: 600px) {
  /* ヘッダー */
  .header-nav { display: none; }
  .hamburger { display: flex; }
  .header-inner { padding: 0 12px; }

  /* ヒーロー */
  .hero-section { padding: 28px 16px; }
  .hero-title { font-size: 1.3rem; }
  .hero-desc { font-size: 0.82rem; }
  .hero-btn { font-size: 0.88rem; padding: 10px 20px; }

  /* タブ */
  .tab-list { flex-direction: column; border-radius: var(--radius); }
  .tab-btn { border-radius: var(--radius-sm); flex: none; }

  /* 検索バー */
  .search-row { flex-direction: column; gap: 8px; }
  .search-input-wrap { width: 100%; }
  .search-input { width: 100%; }
  .pref-select { width: 100%; }

  /* 投稿カード */
  .post-card { padding: 14px 12px; }
  .post-meta { flex-wrap: wrap; gap: 4px; }

  /* 詳細 */
  .detail-info-grid { grid-template-columns: 1fr 1fr; }
  .detail-title { font-size: 1.1rem; }
  .detail-header, .detail-body { padding: 16px; }

  /* フォーム */
  .form-row-2col { grid-template-columns: 1fr; }
  .cat-options { grid-template-columns: 1fr; }

  /* ポスト・アクション */
  .post-actions { flex-direction: row; }
  .posts-header { flex-wrap: wrap; gap: 8px; }

  /* フッター */
  .footer-top { flex-direction: column; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .footer-nav { gap: 16px; }
  .success-actions { flex-direction: column; align-items: center; }

  /* 管理者ページ */
  .admin-stats { gap: 10px; }
  .stat-card { min-width: 100px; padding: 14px 12px; }

  /* 画像アップロード */
  .image-preview-wrap { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 400px) {
  .container { padding: 0 10px; }
  .post-card { padding: 12px 10px; }
  .detail-info-grid { grid-template-columns: 1fr; }
  .detail-header, .detail-body { padding: 12px; }
}

/* =====================================================
   画像アップロード・プレビュー UI
   ===================================================== */

/* アップロードエリア */
.image-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 4px;
  transition: border-color .2s, background .2s;
}
.image-upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* 隠しinput */
.image-input-hidden {
  display: none;
}

/* ラベル（クリック領域） */
.image-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  cursor: pointer;
  gap: 6px;
}
.image-upload-label:hover .image-upload-icon { transform: scale(1.15); }

.image-upload-icon { font-size: 2.4rem; transition: transform .2s; }
.image-upload-text { font-size: 0.92rem; font-weight: 600; color: var(--text); }
.image-upload-sub  { font-size: 0.78rem; color: var(--text-muted); }
.form-hint-inline  { font-size: 0.78rem; color: var(--text-muted); font-weight: 400; margin-left: 8px; }

/* プレビューグリッド */
.image-preview-wrap {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 4px 8px;
}
.image-preview-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f0f0f0;
}
.image-preview-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 投稿詳細の画像表示 */
.post-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.post-image-link {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: box-shadow .2s;
}
.post-image-link:hover { box-shadow: var(--shadow-hover); }
.post-image-thumb {
  width: 160px;
  height: 120px;
  object-fit: cover;
  display: block;
}

@media (max-width: 600px) {
  .post-image-thumb { width: 120px; height: 90px; }
  .image-preview-wrap { grid-template-columns: repeat(2, 1fr); }
}

/* =====================================================
   編集・削除ボタン（detail.php / edit.php 用）
   ===================================================== */

/* 投稿アクション（編集・削除）ボタンエリア */
.post-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

/* 共通アクションボタンベース */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .2s, transform .1s, box-shadow .2s;
  line-height: 1.4;
}
.action-btn:active { transform: scale(.97); }

/* 編集ボタン（青系） */
.action-btn-edit {
  background: #2980b9;
  color: #fff !important;
}
.action-btn-edit:hover {
  background: #1a6fa8;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(41,128,185,.35);
}

/* 削除ボタン（赤系） */
.action-btn-delete {
  background: #e74c3c;
  color: #fff !important;
}
.action-btn-delete:hover {
  background: #c0392b;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(231,76,60,.35);
}

/* 返信削除ボタン（小さめ） */
.reply-delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  padding: 4px 10px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.reply-delete-btn:hover {
  background: #c0392b;
}

/* 返信ヘッダー：削除ボタンを右端に寄せる */
.reply-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* 削除済みメッセージ */
.deleted-notice {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #856404;
  font-size: 0.88rem;
  margin-bottom: 12px;
}

/* 編集完了フラッシュメッセージ */
.alert-edited {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-weight: 600;
}

/* =====================================================
   管理者サイドバーカード微調整
   ===================================================== */
.sidebar-card .action-btn {
  width: 100%;
  justify-content: center;
  box-sizing: border-box;
}

/* =====================================================
   いいねボタン（インスタ風）
   ===================================================== */

/* 返信カードのフッター（いいねボタンを置く行） */
.reply-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid #f0f0f0;
}

/* いいねボタン本体 */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 5px 10px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-muted);
  transition: background .15s, color .15s, transform .1s;
  font-family: var(--font);
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
}
.like-btn:hover {
  background: #fff0f0;
  color: var(--primary);
}
.like-btn:active {
  transform: scale(.92);
}
.like-btn:disabled {
  cursor: default;
  opacity: .7;
}

/* いいね済み状態 */
.like-btn.liked {
  color: #e84040;
}
.like-btn.liked .like-heart {
  animation: none;
}

/* ハートアイコン */
.like-heart {
  font-size: 1.1rem;
  line-height: 1;
  display: inline-block;
}

/* いいね数 */
.like-count {
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 16px;
}

/* ポンポンアニメーション */
@keyframes likePop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  70%  { transform: scale(.88); }
  100% { transform: scale(1); }
}
.like-btn.like-pop .like-heart {
  animation: likePop .3s ease;
}

/* =====================================================
   URL自動リンク
   ===================================================== */
.auto-link {
  color: var(--blue);
  text-decoration: underline;
  word-break: break-all;
}
.auto-link:hover {
  color: var(--primary);
}

/* チームURLリンク */
.team-url-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.82rem;
  color: var(--blue);
  background: #eef6ff;
  border: 1px solid #b8d9f8;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 4px;
  text-decoration: none;
  transition: background .2s;
  vertical-align: middle;
}
.team-url-link:hover {
  background: #d0eaff;
  color: var(--blue);
}

/* =====================================================
   投稿本体いいねボタン
   ===================================================== */
.post-like-section {
  display: flex;
  justify-content: flex-start;
  padding: 12px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.post-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 24px;
  padding: 8px 20px;
  cursor: pointer;
  font-size: 0.95rem;
  color: #666;
  transition: all .2s ease;
  font-family: inherit;
  font-weight: 600;
}
.post-like-btn:hover {
  border-color: #e74c3c;
  color: #e74c3c;
  background: #fff5f5;
}
.post-like-btn.liked {
  border-color: #e74c3c;
  color: #e74c3c;
  background: #fff5f5;
}
.post-like-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.post-like-heart {
  font-size: 1.15rem;
  line-height: 1;
  display: inline-block;
}
.post-like-label {
  font-size: 0.88rem;
}
.post-like-count {
  font-size: 0.88rem;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

/* ポンポンアニメーション（投稿いいね） */
.post-like-btn.like-pop .post-like-heart {
  animation: likePop .3s ease;
}

/* ---- SP版サイドバー補足スタイル ---- */
/* 「投稿する」カードのボタンをfull幅で大きく */
.sp-sidebar .sidebar-post .action-btn {
  display: block;
  width: 100%;
  padding: 15px;
  font-size: 1.05rem;
  text-align: center;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 14px rgba(231,76,60,.3);
}
.sp-sidebar .sidebar-post .action-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}
/* エリアから探す：prefリンクをコンパクトに */
.sp-sidebar .pref-link {
  padding: 3px 8px;
  font-size: 0.8rem;
}
/* 最近の投稿：2列グリッド */
.sp-sidebar .recent-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.sp-sidebar .recent-item {
  padding: 0;
  border: none;
}
.sp-sidebar .recent-link {
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  gap: 8px;
  align-items: flex-start;
}
.sp-sidebar .recent-title {
  font-size: 0.8rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sp-sidebar .recent-meta {
  font-size: 0.72rem;
}
/* .sp-promo-block スタイルは @media (max-width: 900px) 内で定義済み */
