/* ===== 全体レイアウト ===== */
body {
  margin: 0;
  font-family: sans-serif;
  background-color: #fdfdfd;
  color: #333;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

a {
  color: inherit;
  text-decoration: none;
  display: inline-block;
}

/* ===== ヒーロー部分 ===== */
.hero {
  padding: 60px 20px;
  text-align: center;
  background-color: #fafafa;
}
.hero h1 {
  font-size: 28px;
  margin-bottom: 20px;
}

/* デスクトップでは改行なし */
.mobile-break {
  display: inline;
}

/* ===== ストーリー一覧 ===== */
.stories h2 {
  text-align: left;
  margin: 0 auto;
  padding: 20px 0;
  max-width: 800px;
}

#story-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2em;
  margin: 2em auto;
  padding: 0;
  max-width: 600px;
  width: 100%;
}

/* ===== ストーリーカード ===== */
.story-card {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  background-color: #ffffff;
  transition: box-shadow 0.2s;
  width: 100%;
  max-width: 600px;
  box-sizing: border-box;
  overflow-wrap: break-word;
}
.story-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.story-title {
  margin: 0 0 6px;
  font-size: 18px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.nickname {
  margin: 0 0 8px;
  color: #666;
  font-size: 12px;
  word-wrap: break-word;
}
.timestamp {
  font-size: 12px;
  color: #888;
}

/* ストーリーカード内のテキストコンテンツ */
.story-card p {
  margin: 8px 0;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}


/* ===== ヘッダー部分（公開/版数/編集削除） ===== */
.story-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  background: #f7f8fa;          /* ← グレー背景 */
  padding: 8px 12px;            /* 内側余白 */
  border-radius: 8px;           /* 角丸 */
}
.story-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.story-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 公開/下書きバッジ */
.status-badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-published {
  background: #e8fff2;
  color: #137a3a;
  border: 1px solid #bff1d4;
}
.status-draft {
  background: #fff5e8;
  color: #a05a00;
  border: 1px solid #ffe0b8;
}

/* 版数プルダウン */
.version-select {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #d0d7de;
  background: #f9fafb;
}

/* 編集・削除ボタン */
.edit-btn,
.delete-btn {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #d0d7de;
  cursor: pointer;
}
.edit-btn {
  background: #f0f7ff;
  color: #105eef;
  border-color: #cfe0ff;
}
.edit-btn:hover {
  background: #dbe8ff;
}
.delete-btn {
  background: #fff5f5;
  color: #b42318;
  border-color: #ffd3d3;
}
.delete-btn:hover {
  background: #ffecec;
}

/* ===== 版数管理 ===== */
.version-preview {
  margin-top: 15px;
  display: none;
}

.version-card {
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  background: #f8f9fa;
  overflow: hidden;
}

.version-header {
  background: #e9ecef;
  padding: 15px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.version-header h3 {
  margin: 0;
  color: #495057;
  font-size: 16px;
}

.version-date {
  margin: 0;
  color: #6c757d;
  font-size: 14px;
}

.close-preview {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #6c757d;
  background: #fff;
  color: #6c757d;
  cursor: pointer;
}

.close-preview:hover {
  background: #f8f9fa;
}

.version-content {
  padding: 20px;
}

.version-content h4 {
  margin: 0 0 15px 0;
  color: #212529;
  font-size: 18px;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 8px;
}

.version-sections .section {
  margin-bottom: 20px;
}

.version-sections .section h5 {
  margin: 0 0 8px 0;
  color: #6c757d;
  font-size: 14px;
  font-weight: 600;
}

.version-sections .section p {
  margin: 0;
  line-height: 1.6;
  color: #495057;
  background: #fff;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #e9ecef;
  white-space: pre-wrap;
}

/* モバイル対応 */
@media (max-width: 768px) {
  .version-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .version-content {
    padding: 15px;
  }
}

/* ===== フッター部分（花束表示） ===== */
.story-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.bouquet-icon {
  font-size: 18px;
}
.bouquet-count {
  font-size: 14px;
  color: #333;
}

/* ===== 花束ボタン（トップページ用） ===== */
.bouquet-btn {
  background: transparent;
  border: 0;
  padding: 0 2px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: transform 0.2s;
}
.bouquet-btn:hover {
  transform: scale(1.2);
}

/* ===== マイページ用：ラッパーと管理パネル ===== */
.my-story-group {
  margin-bottom: 24px;
  width: 100%;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.my-story-group .story-card {
  margin-top: 8px;
  width: 100%;
  max-width: 600px;
  box-sizing: border-box;
} /* 管理パネルの下に余白 */

/* お気に入りストーリー用 */
#fav-stories {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5em;
  margin: 2em auto;
  max-width: 600px;
  width: 100%;
}

#fav-stories .story-card {
  width: 100%;
  max-width: 600px;
}

.subtle {
  color: #666;
  font-size: 0.9rem;
  margin: 0.5rem 0 1rem 0;
}

/* 管理者専用要素 */
.admin-only {
  position: relative;
}

.story-admin-panel {
  border: 1px solid #e7e7e7;
  border-radius: 12px;
  padding: 12px 14px;
  background: #f7f8fa;
}

.admin-card {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* 状態バッジ */
.status-badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-badge.published {
  color: #0a6;
  background: #e9f8f1;
  border: 1px solid #bcebd8;
}
.status-badge.draft {
  color: #a66;
  background: #fbefef;
  border: 1px solid #f3d0d0;
}
.status-badge.pending {
  color: #b8860b;
  background: #fff8dc;
  border: 1px solid #f0e68c;
}

/* 版プルダウンとボタン */
.ver-label {
  font-size: 14px;
  color: #333;
}
.ver-select {
  margin-left: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fff;
}

.admin-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}
.btn:hover {
  background: #f2f2f2;
}
.btn.danger {
  color: #a33;
  border-color: #e3c4c4;
  background: #fff6f6;
}
.btn.danger:hover {
  background: #ffecec;
}
/* うっすら青の編集ボタン */
.admin-actions .btn.edit-btn {
  background: #eaf1ff;
  border-color: #cfe0ff;
  color: #105eef;
  font-weight: 400;
}
.admin-actions .btn.edit-btn:hover {
  background: #dbe8ff;
}


/* ...existing code... */

/* ===== ハンバーガーメニュー ===== */
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  color: #333;
}

.hamburger:hover {
  color: #666;
}

/* ===== 成功モーダル ===== */
.success-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.success-modal.show {
  display: flex !important;
}

.success-modal-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  text-align: center;
  max-width: 400px;
  width: 90%;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.success-modal h3 {
  margin: 0 0 1rem 0;
  color: #333;
  font-size: 1.5rem;
}

.success-modal p {
  margin: 0 0 1.5rem 0;
  color: #666;
  line-height: 1.6;
}

.success-modal-button {
  padding: 12px 24px;
  background-color: #4a4a4a;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-top: 1rem;
  display: inline-block;
  min-width: 200px;
}

.success-modal-button:hover {
  background-color: #3a3a3a;
}

/* 成功アイコン */
.success-icon {
  font-size: 3rem;
  color: #4CAF50;
  margin-bottom: 1rem;
}

/* モバイルメニューのオーバーレイ */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.mobile-menu-overlay.active {
  display: block;
}

/* モバイルメニュー本体 */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: 100%;
  background-color: #fff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  transition: right 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
}

.mobile-menu.active {
  right: 0;
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #eee;
}

.mobile-menu-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}

.mobile-menu-content {
  padding: 1rem 0;
}

.mobile-menu-item {
  display: block;
  padding: 1rem 1.5rem;
  color: #333;
  text-decoration: none;
  border-bottom: 1px solid #f0f0f0;
  font-size: 1rem;
}

.mobile-menu-item:hover {
  background-color: #f8f8f8;
}

.mobile-menu-item.has-submenu {
  position: relative;
}

.mobile-submenu {
  background-color: #f8f8f8;
  padding-left: 0;
}

.mobile-submenu-item {
  display: block;
  padding: 0.8rem 2rem;
  color: #666;
  text-decoration: none;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

.mobile-submenu-item:hover {
  background-color: #f0f0f0;
}

/* ===== スマホ対応 (768px以下) ===== */
@media screen and (max-width: 768px) {
  /* ハンバーガーメニューを表示 */
  .hamburger {
    display: block;
  }
  
  /* デスクトップのメニューを非表示 */
  .main-buttons,
  .desktop-menu {
    display: none !important;
  }
  
  /* ヘッダートップの調整 */
  .header-top {
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }
  
  /* ロゴのサイズ調整 */
  .logo {
    font-size: 1.5rem;
  }
  
  /* ナビボタンエリアの調整 */
  .nav-buttons {
    gap: 0.3rem;
    align-items: center;
    flex-wrap: wrap;
  }
  
  /* スマホでログアウトボタンを非表示 */
  .logout-btn {
    display: none !important;
  }
  
  /* スマホでユーザー情報（ニックネーム）は表示を維持 */
  .user-info {
    font-size: 0.8rem;
    white-space: nowrap;
  }
  
  /* ログインボタンのサイズ調整 */
  .auth-dropdown > .menu-link.btn-like {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    white-space: nowrap;
  }
  
  /* スマホでユーザー情報（ニックネーム）の調整 */
  .user-info {
    font-size: 0.8rem;
    white-space: nowrap;
    margin-right: 0.5rem;
  }
  
  /* ヘッダー */
  .header {
    padding: 0;
  }
  
  .header .logo {
    font-size: 1.5rem;
  }
  
  .header .nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .header .nav a {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  /* ヒーローセクション */
  .hero {
    padding: 2rem 1rem;
    text-align: center;
  }
  
  .hero h1 {
    font-size: 1.8rem;
    line-height: 1.4;
    margin-bottom: 1rem;
  }
  
  .hero p {
    font-size: 1rem;
    line-height: 1.6;
  }
  
  /* スマホでの改行制御 */
  .mobile-break {
    display: block;
  }
  
  /* ストーリーセクション */
  .stories {
    padding: 2rem 1rem;
  }
  
  .stories h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
  }
  
  /* ストーリーリスト */
  #story-list {
    max-width: 100%;
    padding: 0;
  }
  
  .story-card {
    margin: 0 0 1.5rem 0;
    padding: 1rem;
    max-width: 100% !important;
  }
  
  .story-card h3 {
    font-size: 1.2rem;
    line-height: 1.4;
  }
  
  .story-card .story-meta {
    font-size: 0.8rem;
    margin-bottom: 0.8rem;
  }
  
  .story-card .story-content {
    font-size: 0.9rem;
    line-height: 1.6;
  }
  
  /* フッター */
  .footer {
    padding: 2rem 1rem;
  }
  
  .footer-content {
    flex-direction: column;
    gap: 2rem;
    text-align: center;
  }
  
  .footer-section h4 {
    font-size: 1rem;
  }
  
  .footer-section ul {
    gap: 0.5rem;
  }
  
  .footer-section a {
    font-size: 0.9rem;
  }
  .footer-column .social-icons {
      text-align: center;
      display: flex;
      justify-content: center;
      gap: 1rem;
  }
}



/* 極小画面対応 (480px以下) */
@media screen and (max-width: 480px) {
  .hero h1 {
    font-size: 1.5rem;
  }
  
  .hero p {
    font-size: 0.9rem;
  }
  
  .story-card {
    padding: 0.8rem;
  }
  
  .story-card h3 {
    font-size: 1.1rem;
  }
  
  .header .nav a {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* ===== モデレーション詳細表示 ===== */
.flagged-sections {
  background-color: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 8px;
  padding: 15px;
  margin: 15px 0;
  max-height: 300px;
  overflow-y: auto;
}

.flagged-chunk {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e2e8f0;
}

.flagged-chunk:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.section-title {
  color: #d53f8c;
  font-size: 14px;
  font-weight: bold;
  margin: 0 0 8px 0;
}

.flagged-text {
  background-color: #ffeaa7;
  border-left: 4px solid #fdcb6e;
  padding: 10px 12px;
  margin: 8px 0;
  font-style: italic;
  font-size: 14px;
  line-height: 1.4;
}

.violation-categories {
  color: #e53e3e;
  font-size: 12px;
  font-weight: bold;
  margin-top: 8px;
}

.moderation-advice {
  color: #2d3748;
  font-weight: 500;
  margin-top: 20px;
}