/* start-blockコミュニティ スタイル
   Version: 2.0.0  Created: 2026/07/08 (JST)
   配色・フォントは本家 start-block.com を基礎に調整:
   クリーム背景 #f8f7f5 / オレンジ差し色 #fb761e / 文字色 #191919。
   いいね・フォロー・表示回数・カテゴリなど本家の機能面は取り入れない（MVP範囲外）。 */

:root {
  --color-primary: #fb761e;
  --color-primary-dark: #d8620f;
  --color-primary-tint: #fdece0;
  --color-bg: #f8f7f5;
  --color-card: #ffffff;
  --color-subtle-bg: #f1eee9; /* 本家の帯・自己紹介ボックス背景 */
  --color-text: #191919;
  --color-muted: #5f5f5f;
  --color-border: #e9e4dd;
  --color-danger: #c0392b;
  /* 元の明朝指定は復元用に保持する。現在の見出し書体は --font-accent だけで切り替える。 */
  --font-mincho: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Iowan Old Style", "Times New Roman", serif;
  /* 端末内蔵フォントのみ。本文の Yu Gothic UI / Hiragino Sans とは別系統を優先する。 */
  --font-accent-gothic: "Meiryo", "Hiragino Kaku Gothic ProN", "Hiragino Kaku Gothic Pro", sans-serif;
  --font-accent: var(--font-accent-gothic);
  --radius: 8px;
  --radius-cover: 14px;
  --content-max: 1264px;
  --reading-max: 900px;
  /* start-block.comのカードを基準に、通常部品の影を統一する。 */
  --shadow-standard: 0 2px 6px rgba(0, 0, 0, .15);
  --shadow-weak: var(--shadow-standard);
  --shadow-strong: var(--shadow-standard);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, .18);
  --shadow-modal: 0 12px 36px rgba(0, 0, 0, .22);
  --shadow-upward: 0 -2px 6px rgba(0, 0, 0, .15);
  --post-card-columns: 3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  padding-bottom: 56px;
  font-weight: 400;
}

.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ヘッダー（白地にアクセント書体のロゴ＋右にオレンジのボタン） */
.app-header {
  background: rgba(255, 255, 255, .94);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top);
}
.app-header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  min-height: 72px;
  padding: 11px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-brand { display: flex; align-items: center; gap: 14px; flex-shrink: 0; overflow: hidden; }
.app-title {
  font-family: var(--font-accent);
  font-size: 25px;
  margin: 0;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.app-title-button,
.header-user {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.app-title-button:hover,
.header-user:hover .header-user-name { color: var(--color-primary-dark); }
.header-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: #fff;
  color: var(--color-primary-dark);
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-standard);
}
.header-refresh:hover { border-color: var(--color-primary); background: var(--color-primary-tint); }
.header-refresh:disabled { cursor: wait; opacity: .72; }
.header-refresh.is-refreshing { animation: header-refresh-spin .8s linear infinite; }
@keyframes header-refresh-spin { to { transform: rotate(360deg); } }
.app-title-button:focus-visible,
.header-user:focus-visible,
.header-nav-select:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.header-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 48px;
  font-size: 11px;
  line-height: 1.2;
  color: var(--color-muted);
  white-space: nowrap;
}
.header-user .avatar-header {
  width: 48px;
  height: 48px;
  border: 2px solid var(--color-primary);
  font-size: 19px;
}
.header-user-name { max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) {
  .app-header-inner { min-height: 68px; padding: 8px 12px; gap: 8px; }
  .app-title { font-size: 18px; }
  .app-brand { gap: 8px; }
  .header-user { min-width: 36px; font-size: 9px; }
  .header-user .avatar-header { width: 38px; height: 38px; font-size: 15px; }
  .header-user-name { max-width: 52px; }
  .header-refresh { width: 30px; height: 30px; font-size: 20px; }
  .header-nav-select { width: 112px; }
}
/* ページ移動を1つのセレクトにまとめ、ヘッダー右端へ配置する。 */
.header-nav {
  display: flex;
  margin-left: auto;
  flex: 0 0 auto;
}
.header-nav-select {
  width: 170px;
  background: var(--color-primary);
  color: #fff;
  border: 1px solid var(--color-primary);
  border-radius: 8px;
  padding: 9px 32px 9px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.header-nav-select option { background: #fff; color: var(--color-text); }
.header-announcement {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  border-radius: 6px;
  padding: 8px 0;
}
.header-announcement-track {
  display: inline-flex;
  align-items: center;
  gap: 32px;
  min-width: max-content;
  white-space: nowrap;
  animation: announcement-scroll var(--announcement-duration, 22s) linear infinite;
  will-change: transform;
}
.header-announcement:hover .header-announcement-track { animation-play-state: paused; }
.header-announcement.is-fixed { text-align: center; }
.header-announcement.is-fixed .header-announcement-track { display: inline-flex; min-width: 0; white-space: normal; animation: none; }
.announcement-item { font-size: 14px; font-weight: 600; }
.announcement-separator { color: var(--color-primary); font-size: 9px; }
@keyframes announcement-scroll {
  from { transform: translateX(var(--announcement-start, 100vw)); }
  to { transform: translateX(var(--announcement-end, -100%)); }
}
@media (prefers-reduced-motion: reduce) {
  .header-announcement-track,
  .announcement-preview > div { animation: none !important; white-space: normal; min-width: 0; flex-wrap: wrap; justify-content: center; }
}
.badge {
  display: inline-block;
  background: var(--color-danger);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  margin-left: 4px;
}

/* メッセージ一覧 */
.conversation-row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 12px 16px;
}

.profile-thread-scroll {
  max-height: 60vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding: 2px 4px;
  margin-bottom: 20px;
}
.thread-infinite-status {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--color-muted);
  font-size: 12px;
  text-align: center;
}
.thread-infinite-status.is-loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid #f4d6c1;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: infinite-scroll-spin .75s linear infinite;
}
.thread-infinite-status .btn-small { margin: 0; }

/* プロフィール（自己紹介・その人の回覧一覧・DM欄をまとめた画面）
   カバー写真・自己紹介・回覧一覧などは全て同じ幅（#view-profileの幅いっぱい）に揃える */
#view-profile { max-width: 1020px; margin-left: auto; margin-right: auto; }
.profile-cover-wrap {
  margin: 0 0 14px;
  border-radius: var(--radius-cover);
  box-shadow: var(--shadow-strong);
  overflow: hidden;
}
.profile-cover { width: 100%; display: block; aspect-ratio: 3 / 1; object-fit: cover; }
/* アバター+名前+フォローボタン+統計を1行に横並び・中央寄せ（本家のユーザーページ風） */
.profile-meta-card {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}
/* .card と同じ詳細度の一般ルールがファイル後方にあるため、確実に勝つよう複合セレクタで上書きする */
.card.profile-meta-card {
  min-height: 44px;
  padding: 9px 28px;
  box-shadow: var(--shadow-strong);
}
.profile-meta-info { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.profile-name { font-family: var(--font-accent); font-size: 17px; font-weight: 600; margin: 0; }
.profile-meta-card .profile-name { font-size: 15px; line-height: 1; }
.profile-meta-card .post-meta { line-height: 1; }
.profile-meta-card .avatar-profile { width: 22px; height: 22px; font-size: 11px; }
.profile-meta-info .follow-btn {
  min-height: 24px;
  margin: 0;
  padding: 3px 10px;
  line-height: 1;
}
.avatar-profile { width: 44px; height: 44px; font-size: 17px; }
.card.profile-bio-card {
  background: var(--color-subtle-bg);
  box-shadow: none;
  padding: 16px 20px;
}
.profile-bio-card p { margin: 0; white-space: pre-wrap; }
@media (min-width: 641px) {
  .profile-bio-section {
    position: relative;
    width: 90%;
    margin: 32px auto;
    padding: 24px 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
  }
  .profile-bio-section .profile-bio-title {
    position: absolute;
    top: 0;
    left: 50%;
    width: auto;
    margin: 0;
    padding: 0 12px;
    transform: translate(-50%, -50%);
    border-radius: 0;
    background: var(--color-bg);
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
  }
  .profile-bio-section .card.profile-bio-card {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
}
.settings-cover-preview { max-width: 400px; margin: 0 0 8px; }

/* 会員一覧（本家のユーザー検索風カードグリッド） */
#view-members { max-width: 1020px; margin-left: auto; margin-right: auto; }
.member-controls, .post-controls, .category-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
}
.post-list-controls {
  max-width: var(--reading-max);
  margin-left: auto;
  margin-right: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 10px;
}
.post-list-controls > select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-list-controls .post-author-filter { grid-column: 1; width: 100%; min-width: 0; }
.post-list-controls input[type="search"] { grid-column: 2 / -1; width: 100%; min-width: 0; }
.timeline-collapse-toggle {
  display: block;
  width: 100%;
  max-width: var(--reading-max);
  margin: 0 auto 12px;
  padding: 11px 18px;
  text-align: left;
  position: relative;
}
.timeline-collapse-toggle::after {
  content: "+";
  position: absolute;
  right: 18px;
  font-weight: 700;
}
.timeline-collapse-toggle.is-expanded::after { content: "−"; }
button.timeline-mobile-toggle { display: none; }
.timeline-panel.is-collapsed { display: none; }
.member-controls select, .post-controls select, .category-controls select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--color-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23ffffff'/%3E%3C/svg%3E") no-repeat right 16px center;
  background-size: 10px 6px;
  border: none;
  border-radius: 999px;
  padding: 10px 36px 10px 18px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.member-controls select:focus, .post-controls select:focus, .category-controls select:focus {
  outline: 2px solid var(--color-primary-dark);
  outline-offset: 2px;
}
.member-controls input[type="search"], .post-controls input[type="search"], .category-controls input[type="search"] {
  flex: 1;
  min-width: 160px;
  margin: 0;
  padding: 10px 16px;
  font-size: 15px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  color: var(--color-text);
}
.member-controls input[type="search"]:focus, .post-controls input[type="search"]:focus, .category-controls input[type="search"]:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
}
/* 共通表示バーはヘッダーメニューと同じ、控えめな角丸に揃える。 */
.post-list-controls > select,
.post-list-controls input[type="search"] { border-radius: 8px; }
.member-filter-label { font-size: 13px; color: var(--color-muted); white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}
.member-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  min-height: 190px;
  text-align: center;
  cursor: pointer;
  padding: 14px 16px 12px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.member-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.member-card .member-card-avatar {
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
  border: 2px solid var(--color-primary);
  font-size: 22px;
}
.member-card-identity {
  display: flex;
  align-items: baseline;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 30px;
}
.member-card-author-label {
  flex: 0 0 auto;
  margin-right: 3px;
  color: var(--color-muted);
  font-size: 12px;
}
.member-card-name {
  overflow: hidden;
  color: var(--color-text);
  font-family: var(--font-accent);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-card-follow-row {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
}
.member-card-follow-row .follow-btn {
  padding: 6px 16px;
  font-size: 14px;
}
.member-card-stats {
  min-height: 22px;
  margin: 0;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .members-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
  .member-card { min-height: 184px; padding: 12px 8px 10px; }
  .member-card-name { font-size: 17px; }
  .member-card-author-label { font-size: 11px; }
  .member-card-stats { font-size: 12px; }
}
.follow-btn {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.follow-btn.following { background: var(--color-primary-dark); }
.follow-btn:disabled { opacity: .6; cursor: default; }

/* グループ */
#group-band, #view-groups { max-width: 640px; margin-left: auto; margin-right: auto; }
.group-row { cursor: pointer; padding: 12px 16px; }
.group-row-name { display: flex; align-items: center; gap: 8px; }
.group-row-desc {
  font-size: 13px;
  color: var(--color-muted);
  margin: 2px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.group-info-card { padding: 12px 16px; }
.group-info-card .hint { margin: 0 0 8px; white-space: pre-wrap; }
.group-info-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.group-info-actions .btn-small { margin-bottom: 0; }
.group-join-hint { text-align: center; margin: 0 0 12px; }
/* グループタグ・カテゴリータグ（本家のカテゴリタグ風: オレンジ塗り＋白文字） */
.group-pill, .category-pill {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* カテゴリー管理（設定ではなくタイムライン上に置くマスター専用の簡易UI） */
.category-manage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.category-manage-row input[type="text"] { flex: 1; margin: 0; }
.category-manage-row .btn-small, .category-manage-row .btn-delete { flex-shrink: 0; margin: 0; }
#form-create-category { display: flex; gap: 8px; align-items: center; }
#form-create-category input[type="text"] { flex: 1; margin: 0; }
#form-create-category button { flex-shrink: 0; width: auto; margin: 0; }
/* 回覧フォームのセレクトは、OS標準の開閉操作を残したまま掲載ボタンと同じ高さ・角丸へ揃える。 */
.post-category-select,
.publication-window-fields select {
  box-sizing: border-box;
  height: 44px;
  min-height: 44px;
  margin-top: 0;
  padding: 9px 14px;
  border: 1px solid var(--color-primary);
  border-radius: 8px;
  background-color: #fff;
  color: var(--color-text);
  font: inherit;
  font-size: 15px;
  line-height: 1.2;
}
.post-category-select { margin-bottom: 8px; }
.post-category-select:focus,
.publication-window-fields select:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.publication-window-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px;
  margin: 0 0 10px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-subtle-bg);
}
.publication-window-fields label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; }
.publication-window-fields input {
  box-sizing: border-box;
  width: auto;
  min-width: 0;
  height: 38px;
  margin: 0;
  padding: 7px 9px;
  font-size: 13px;
  line-height: 1.2;
}
.publication-window-fields select { min-width: 156px; }
.publication-datetime { display: inline-flex; align-items: center; gap: 6px; }
.publication-datetime input[type="date"] { width: 145px; }
.publication-datetime input[type="time"] { width: 105px; }
.publication-editor { margin-top: 10px; }
.publication-badge {
  display: inline-block;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}
.publication-scheduled { color: #714b00; background: #fff0b8; border: 1px solid #e6bc54; }
.publication-expired { color: #666; background: #eee; border: 1px solid #ccc; }
.conversation-info { min-width: 0; flex: 1; }
.conversation-name-row { display: flex; align-items: center; gap: 6px; }
.conversation-preview {
  font-size: 13px;
  color: var(--color-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* メッセージスレッド */
#view-message-thread { max-width: 640px; margin: 0 auto; }
.message-mine { background: var(--color-primary-tint); }

/* レイアウト
   タイムラインは本家風のカードグリッドにするため広め、他の画面は読みやすい1列幅 */
#main { max-width: var(--content-max); margin: 0 auto; padding: 28px 24px 80px; }
.view { display: block; }
#view-auth, #view-settings { max-width: 640px; margin: 0 auto; }
.post-form-card, .btn-banner, .empty-message,
.category-controls, #category-manage-card { max-width: var(--reading-max); margin-left: auto; margin-right: auto; }

.infinite-scroll-status {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 4px auto 24px;
  color: var(--color-muted);
  font-size: 13px;
  text-align: center;
}
.infinite-scroll-status.is-loading::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid #f4d6c1;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: infinite-scroll-spin .75s linear infinite;
}
.infinite-scroll-status .btn-small { margin: 0; }
@keyframes infinite-scroll-spin { to { transform: rotate(360deg); } }

.card {
  background: var(--color-card);
  border-radius: var(--radius);
  border: 1px solid rgba(233, 228, 221, .75);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-weak);
}

/* フォーム共通 */
label { display: block; font-size: 13px; color: var(--color-muted); margin-bottom: 10px; }
input[type="text"], input[type="email"], input[type="password"], textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 12px 14px;
  font-size: 16px; /* iOSのズーム防止のため16px以上 */
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fffefa;
  color: var(--color-text);
}
textarea { resize: vertical; font-family: inherit; }
input:focus, textarea:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; }

/* コメント入力欄は十分な初期高さを確保し、送信ボタンとの間隔を明確にする。 */
#form-comment {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#form-comment textarea,
#form-comment .btn-primary { margin-top: 0; }

/* 会員情報のメッセージ入力欄もコメント欄と同じ高さ・間隔に揃える。 */
#form-profile-message {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#form-profile-message textarea,
#form-profile-message .btn-primary { margin-top: 0; }

@media (min-width: 641px) {
  /* 見出し・履歴・入力欄を一体のメッセージ領域として中央へまとめる。 */
  #profile-dm-section {
    width: 66.666%;
    margin-right: auto;
    margin-left: auto;
  }
}

.btn-primary, .btn-secondary, .btn-danger {
  display: block;
  width: 100%;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 4px;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-primary:active { background: var(--color-primary-dark); }
.btn-primary:disabled { background: #f0c4a3; cursor: default; }
.btn-secondary { background: var(--color-primary-tint); color: var(--color-primary-dark); }
.btn-secondary:hover, .btn-small:hover { background: #fbdcc6; }
.btn-danger { background: #fdecea; color: var(--color-danger); }

.btn-small {
  display: inline-block;
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}
.btn-file { margin-bottom: 0; }

.btn-banner {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: none;
  border-radius: 8px;
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* 認証画面 */
.auth-form h2 { font-family: var(--font-accent); margin: 0 0 12px; font-size: 20px; font-weight: 600; }
.auth-links { font-size: 13px; margin: 12px 0 0; }
.auth-links a { color: var(--color-primary-dark); }
.hint { font-size: 13px; color: var(--color-muted); }
.notice {
  background: #eef4e8;
  color: #3f6727;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 12px;
}
.notice.error { background: #fdecea; color: var(--color-danger); }

/* 回覧フォーム */
.post-form-card textarea { margin-top: 0; }
.post-form-card { padding: 20px; }
.post-title-input { margin-top: 0; margin-bottom: 8px; }
.post-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}
.post-form-actions .btn-primary { width: auto; padding: 10px 24px; margin: 0; }

/* 回覧カードグリッド。列数は設定に応じてJavaScriptから更新する。 */
#timeline-list, #profile-posts-list, #category-search-list, #detail-related-list {
  display: grid;
  grid-template-columns: repeat(var(--post-card-columns), minmax(0, 1fr));
  min-width: 0;
  width: 100%;
  max-width: 100%;
  gap: 22px;
  margin-bottom: 22px;
}
.post-list-mode-active #timeline-list,
.post-list-mode-active #profile-posts-list,
.post-list-mode-active #category-search-list,
.post-list-mode-active #detail-related-list { grid-template-columns: minmax(0, 1fr); }

/* グリッドカード（写真が上端いっぱい → 日付+コメントタグ → 本文 → 回覧者名） */
.post-card {
  cursor: pointer;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  transition: transform .18s ease, box-shadow .18s ease;
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.post-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}
.post-thumb-wrap { position: relative; min-width: 0; max-width: 100%; overflow: hidden; }
.post-thumb-category-overlay {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  border: 2px solid rgba(255, 255, 255, .94);
  box-shadow: var(--shadow-standard);
}
.publication-period-overlay {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1;
  padding: 6px 10px;
  background: linear-gradient(90deg, rgba(24, 20, 16, .78), rgba(24, 20, 16, .42));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.publication-period-overlay-hero {
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  padding: 8px 12px;
}
.post-publication-period { display: block; margin: 0 0 3px; font-size: 12px; font-weight: 600; color: var(--color-muted); }
.post-card-content {
  min-width: 0;
  max-width: 100%;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.post-meta-row {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.comment-pill {
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.post-has-unread-comments {
  outline: 2px solid rgba(219, 78, 55, .72);
  outline-offset: 1px;
}
.comment-pill-unread {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff0ed;
  color: #b83224;
  border: 1px solid #e68072;
  animation: unread-comment-pulse 1.8s ease-in-out infinite;
}
.comment-pill-unread::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d63c2e;
  flex-shrink: 0;
}
@keyframes unread-comment-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(214, 60, 46, .08); }
  50% { box-shadow: 0 0 0 4px rgba(214, 60, 46, .22); }
}
@media (prefers-reduced-motion: reduce) {
  .comment-pill-unread { animation: none; }
}
.pill-group { display: flex; align-items: center; gap: 6px; }
.like-pill {
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  border: none;
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}
.like-pill.liked { background: var(--color-primary); color: #fff; }
.like-pill:disabled { opacity: .6; cursor: default; }
.post-body-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.post-card .post-author { color: var(--color-muted); font-size: 16px; font-weight: 400; }
.post-card .post-footer { margin-top: auto; padding-top: 5px; }
.post-card .post-title,
.post-card .post-body {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.post-card .post-footer { min-width: 0; max-width: 100%; }
.post-card .post-footer > .pill-group {
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* アバター（丸画像。未設定なら表示名の頭文字を丸背景に置く） */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  font-family: var(--font-accent);
  font-weight: 600;
  vertical-align: middle;
}
.avatar-sm { width: 22px; height: 22px; font-size: 11px; }
.avatar-md { width: 32px; height: 32px; font-size: 14px; }
.avatar-large { width: 72px; height: 72px; font-size: 28px; }
.author-group { display: inline-flex; align-items: center; gap: 6px; }
.author-group-link, #detail-title, #side-author { cursor: pointer; }
#detail-title.band-title-plain { cursor: default; }
.band-title .avatar { margin-right: 2px; }

/* 共通（詳細画面でも使う） */
.post-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.post-author { font-family: var(--font-accent); font-weight: 600; font-size: 15px; }
.post-meta { font-size: 13px; font-weight: 600; color: var(--color-muted); white-space: nowrap; }
.post-body {
  white-space: pre-wrap;
  /* URLや英数字など改行のない長文でも、親領域を横に押し広げず全文を折り返す。 */
  overflow-wrap: anywhere;
  font-size: 15px;
  margin: 0 0 8px;
}
.post-title {
  font-family: var(--font-accent);
  font-weight: 600;
  font-size: 19px;
  margin: 0 0 4px;
}
.post-image {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin-bottom: 8px;
}
.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--color-muted);
}
.post-card .post-footer .author-group { min-width: 0; }
.post-card .post-footer .post-author {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
}

/* 回覧カードのデザイン切り替え（今回のデザイン見直し前の見た目に戻す） */
.card-design-old .post-card {
  border-radius: 14px;
  box-shadow: var(--shadow-standard);
}
.card-design-old .post-card-content { padding: 12px 14px; gap: 6px; }
.card-design-old .post-card .post-title { font-size: 17px; }
.card-design-old .post-card .post-meta { font-size: 12px; font-weight: 400; }
.card-design-old .post-card .comment-pill,
.card-design-old .post-card .like-pill,
.card-design-old .post-card .group-pill,
.card-design-old .post-card .category-pill { font-size: 12px; padding: 1px 8px; }
.card-design-old .post-card .post-author { font-size: 14px; font-weight: 600; }

/* 実際の表示列数に合わせたカード密度。設定値ではなく安全調整後の列数で切り替える。 */
.post-card .post-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-density-medium #timeline-list,
.card-density-medium #profile-posts-list,
.card-density-medium #category-search-list,
.card-density-medium #detail-related-list { gap: 14px; }
.card-density-medium .post-thumb { aspect-ratio: 16 / 9; }
.card-density-medium .post-card-content,
.card-density-medium.card-design-old .post-card-content { padding: 12px; gap: 6px; }
.card-density-medium .post-card .post-title,
.card-density-medium.card-design-old .post-card .post-title {
  font-size: 16px;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  margin-bottom: 2px;
}
.card-density-medium .post-card .post-body { font-size: 14px; line-height: 1.55; }
.card-density-medium .post-card .post-body-clamp { -webkit-line-clamp: 2; }
.card-density-medium .post-card .post-meta { font-size: 12px; }
.card-density-medium .post-card .post-author { font-size: 14px; }
.card-density-medium .post-card .comment-pill,
.card-density-medium .post-card .like-pill,
.card-density-medium .post-card .group-pill,
.card-density-medium .post-card .category-pill { font-size: 11px; padding: 2px 7px; }

.card-density-small #timeline-list,
.card-density-small #profile-posts-list,
.card-density-small #category-search-list,
.card-density-small #detail-related-list { gap: 10px; }
.card-density-small .post-thumb { aspect-ratio: 16 / 9; }
.card-density-small .post-card-content,
.card-density-small.card-design-old .post-card-content { padding: 9px; gap: 5px; }
.card-density-small .post-meta-row { align-items: flex-start; flex-direction: column; gap: 4px; }
.card-density-small .post-meta-row .pill-group { flex-wrap: wrap; gap: 3px; }
.card-density-small .post-card .post-title,
.card-density-small.card-design-old .post-card .post-title {
  font-size: 14px;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  margin-bottom: 1px;
}
.card-density-small .post-card .post-body { font-size: 12px; line-height: 1.5; }
.card-density-small .post-card .post-body-clamp { -webkit-line-clamp: 1; }
.card-density-small .post-card .post-meta { font-size: 10px; font-weight: 400; }
.card-density-small .post-card .post-footer { align-items: flex-start; padding-top: 3px; gap: 4px; }
.card-density-small .post-card .post-footer > .pill-group { width: 100%; flex-wrap: wrap; gap: 3px; }
.card-density-small .post-card .post-author { font-size: 12px; max-width: 120px; }
.card-density-small .post-card .avatar-sm { width: 18px; height: 18px; font-size: 9px; }
.card-density-small .post-card .comment-pill,
.card-density-small .post-card .like-pill,
.card-density-small .post-card .group-pill,
.card-density-small .post-card .category-pill { font-size: 10px; padding: 1px 5px; }
.card-density-small .post-thumb-category-overlay { right: 6px; bottom: 6px; }
.card-density-small .post-card .btn-delete { font-size: 10px; padding: 2px; }

.card-density-mobile-two #timeline-list,
.card-density-mobile-two #profile-posts-list,
.card-density-mobile-two #category-search-list,
.card-density-mobile-two #detail-related-list { gap: 10px; }
.card-density-mobile-two .post-card { padding: 0; margin-bottom: 0; }
.card-density-mobile-two .post-thumb { aspect-ratio: 16 / 9; }
.card-density-mobile-two .post-card-content,
.card-density-mobile-two.card-design-old .post-card-content { padding: 10px; gap: 5px; }
.card-density-mobile-two .post-meta-row { align-items: flex-start; flex-direction: column; gap: 4px; }
.card-density-mobile-two .post-meta-row .pill-group { flex-wrap: wrap; gap: 3px; }
.card-density-mobile-two .post-card .post-title,
.card-density-mobile-two.card-design-old .post-card .post-title {
  font-size: 14px;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  margin-bottom: 1px;
}
.card-density-mobile-two .post-card .post-body { font-size: 12px; line-height: 1.5; }
.card-density-mobile-two .post-card .post-body-clamp { -webkit-line-clamp: 2; }
.card-density-mobile-two .post-card .post-meta { font-size: 10px; font-weight: 400; }
.card-density-mobile-two .post-card .post-footer { align-items: flex-start; padding-top: 3px; gap: 4px; }
.card-density-mobile-two .post-card .post-footer > .pill-group { width: 100%; flex-wrap: wrap; gap: 3px; }
.card-density-mobile-two .post-card .post-author { font-size: 12px; max-width: 110px; }
.card-density-mobile-two .post-card .avatar-sm { width: 18px; height: 18px; font-size: 9px; }
.card-density-mobile-two .post-card .comment-pill,
.card-density-mobile-two .post-card .like-pill,
.card-density-mobile-two .post-card .group-pill,
.card-density-mobile-two .post-card .category-pill { font-size: 10px; padding: 1px 5px; }
.card-density-mobile-two .post-thumb-category-overlay { right: 6px; bottom: 6px; }
.card-density-mobile-two .post-card .btn-delete { font-size: 10px; padding: 2px; }

.btn-delete {
  background: none;
  border: none;
  color: var(--color-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px;
}
.btn-delete:hover { color: var(--color-danger); }

/* 回覧詳細（本家の記事ページ風） */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  max-width: 100%;
  gap: 36px;
  align-items: start;
}
.detail-main,
.detail-post {
  min-width: 0;
  max-width: 100%;
}
.detail-side { display: none; }
@media (min-width: 900px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr) 306px; }
  .detail-side { display: block; }
}
/* 1カラム/2カラム切り替え（デスクトップ幅でもサイドバーを隠して1カラムにできる） */
#view-post.columns-1 .detail-layout { grid-template-columns: minmax(0, 1fr); }
#view-post.columns-1 .detail-side { display: none; }

/* タイトル帯・セクション帯（本家: ベージュの帯に明朝の見出し） */
.title-band, .section-band {
  background: var(--color-subtle-bg);
  border-radius: 8px;
  padding: 13px 18px;
  font-family: var(--font-accent);
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 18px;
}
.title-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
/* 回覧詳細は左右の移動ボタンを同じ固定幅にし、題名だけを中央の可変領域へ置く。
   長い題名でもタイトル帯の中心位置と矢印の位置が崩れない。 */
.detail-main > .title-band {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  gap: 8px;
}
.detail-main > .title-band .band-title {
  display: block;
  min-width: 0;
  width: 100%;
  text-align: center;
}
.detail-main > .title-band .band-arrow {
  width: 44px;
  padding: 0;
}
/* 記事タイトル本体は本家に合わせて大きく・軽めのウェイトで目立たせる */
.band-title {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 24px;
  font-weight: 400;
}
.band-arrow {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 0 8px;
}
.band-arrow:disabled { opacity: .2; cursor: default; }

/* 回覧詳細ページ上段の代表画像（一覧カードと同じサムネイル）。クリックでこの回覧の
   添付ギャラリーをそのサムネイルの位置から開く（他の回覧へは移動しない） */
.hero-stage {
  position: relative;
  width: 100%;
  margin-bottom: 18px;
  cursor: zoom-in;
}
/* 添付が無い回覧の既定画像（クリックしても何も開かない） */
.hero-stage-default { cursor: default; }
.hero-image {
  width: 100%;
  border-radius: 8px;
  display: block;
  box-shadow: var(--shadow-strong);
}
.hero-stage:hover .lightbox-zoom-icon { opacity: 1; }

/* 回覧添付のモーダル表示（ギャラリー形式。詳細ページの添付タップ用） */
.image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 5, .85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  z-index: 1000;
}
body.lightbox-open { overflow: hidden; }
@media (max-width: 640px) {
  .image-lightbox { padding: 24px 8px; }
}
.lightbox-stage {
  position: relative;
}
.image-lightbox .lightbox-stage {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lightbox-counter {
  color: #fff;
  font-size: 14px;
  margin-bottom: 8px;
}
.lightbox-media {
  display: flex;
  max-width: 100%;
  max-height: calc(100vh - 120px);
}
.lightbox-media.lightbox-media-image {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  cursor: zoom-in;
  touch-action: none;
  user-select: none;
}
.lightbox-media.lightbox-media-zoomed { cursor: grab; }
.lightbox-media.lightbox-media-dragging { cursor: grabbing; }
.lightbox-media img,
.lightbox-media video {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  display: block;
  border-radius: 8px;
}
.lightbox-media img {
  transform-origin: 0 0;
  will-change: transform;
}
.lightbox-pdf-wrap {
  background: #fff;
  border-radius: 8px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 240px;
}
.lightbox-pdf-icon { font-size: 48px; }
.lightbox-pdf-name { font-size: 14px; color: var(--color-text); word-break: break-all; text-align: center; }
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 1001;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .3); }
.lightbox-zoom-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(0, 0, 0, .35);
  border-radius: 50%;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}
.attachment-cell:hover .lightbox-zoom-icon { opacity: 1; }
.lightbox-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18%;
  min-width: 48px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, .5);
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color .15s ease, background-color .15s ease;
}
.lightbox-nav-left { left: 0; justify-content: flex-start; padding-left: 10px; }
.lightbox-nav-right { right: 0; justify-content: flex-end; padding-right: 10px; }
.lightbox-nav-left:hover:not(:disabled) { color: #fff; background: linear-gradient(to right, rgba(0, 0, 0, .28), transparent); }
.lightbox-nav-right:hover:not(:disabled) { color: #fff; background: linear-gradient(to left, rgba(0, 0, 0, .28), transparent); }
.lightbox-nav:disabled { opacity: .2; cursor: default; }

/* 回覧添付グリッド（本文とコメントの間）。列数はマスター設定の --attachment-cols で決まる */
.detail-post-has-attachments .detail-body-card { margin-bottom: 32px; }
.attachment-section { margin-bottom: 32px; }
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(var(--attachment-cols, 4), 1fr);
  gap: 12px;
}
.attachment-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--color-surface-alt, #eee);
  cursor: zoom-in;
}
.attachment-cell img,
.attachment-cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* 折りたたみ時：2列目は半分からグラデーションで消えていき、3行目以降は完全に隠す */
.attachment-peek {
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 50%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 50%, transparent 100%);
}
.attachment-hidden { display: none; }
.attachment-more-btn { width: 100%; margin-top: 8px; }

.attachment-icon-preview {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  text-align: center;
}
.attachment-icon-preview .attachment-icon { font-size: 32px; }
.attachment-icon-preview .attachment-filename {
  font-size: 11px;
  color: var(--color-muted);
  word-break: break-all;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* 編集での削除/追加の重ね表示。読了機能と同じ「全員に見える透明性」の考え方 */
.attachment-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 600;
}
.attachment-overlay-deleted { background: rgba(0, 0, 0, .55); }
.attachment-deleted { cursor: default; }
.attachment-deleted img,
.attachment-deleted .attachment-icon-preview { filter: blur(2px) brightness(.6); }
.attachment-overlay-added {
  background: rgba(0, 0, 0, .35);
  pointer-events: none;
}

/* 新規回覧・編集フォームの添付プレビュー一覧 */
.attachment-preview-wrap { margin: 8px 0; }
.attachment-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.attachment-picker-cell { cursor: default; }
.attachment-picker-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.attachment-thumb-btn {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  font-size: 11px;
  padding: 3px 4px;
  border-radius: 4px;
  border: none;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  cursor: pointer;
}
.attachment-thumb-btn.active { background: var(--color-primary); color: #fff; }

.edit-attachments-section { margin: 12px 0; }
.edit-attachments-section .attachment-preview-list { margin-bottom: 8px; }

/* 汎用の確認モーダル */
.confirm-dialog {
  position: relative;
  max-width: 360px;
  width: 100%;
  padding: 20px;
}
.confirm-dialog p { margin-bottom: 16px; }
.confirm-dialog .post-form-actions { justify-content: flex-end; }

.settings-field-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  margin-top: 12px;
}
.settings-number-input { width: 100px; }
.session-device-list { display: grid; gap: 10px; margin: 12px 0; }
.session-device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
}
.session-device-info { min-width: 0; display: grid; gap: 2px; }
.session-device-name { font-weight: 700; overflow-wrap: anywhere; }
.session-device-current { color: var(--color-primary-dark); font-size: 12px; font-weight: 700; }
.session-device-row .btn-small { flex: 0 0 auto; margin: 0; }
.session-logout-all { width: auto; margin: 0; padding: 8px 14px; }
@media (max-width: 640px) {
  .session-device-row { align-items: flex-start; flex-direction: column; }
  .session-device-row .btn-small { align-self: flex-end; }
}

/* メッセージの読了表示（自分が送った側は表示のみ、相手が送った側はボタン） */
.read-indicator {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
}
.read-indicator.is-read { color: var(--color-primary-dark); }

/* 読了状況モーダル（自分の回覧・コメントの読了ボタンから開く） */
.read-status-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.read-status-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 5, .5);
}
.read-status-box {
  position: relative;
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 380px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.read-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-accent);
  font-weight: 600;
  font-size: 16px;
}
#read-status-close,
#title-full-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--color-muted);
  cursor: pointer;
  padding: 4px;
}
.read-status-tabs { display: flex; border-bottom: 1px solid var(--color-border); }
.read-status-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.read-status-tab.active { color: var(--color-primary-dark); border-bottom-color: var(--color-primary); }
.read-status-list { overflow-y: auto; padding: 8px 16px; }
.title-full-box { max-width: min(520px, calc(100vw - 32px)); }
.title-full-content {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
  font-size: 17px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  user-select: text;
}
.detail-title-truncated-mobile {
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(251, 118, 30, .16);
}
.detail-title-truncated-mobile:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}
.read-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}
.read-status-row:last-child { border-bottom: none; }
.comment-recovery-box { max-width: 560px; }
.comment-recovery-content { padding: 18px; }
.comment-recovery-content p { margin: 0 0 14px; line-height: 1.7; }
.comment-recovery-content textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  margin-bottom: 12px;
}
.comment-recovery-content .post-form-actions { margin-top: 0; }
.recovery-field-label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
}
.recovery-field-label input,
.recovery-field-label textarea {
  width: 100%;
  font-weight: 400;
}
.recovery-note { color: var(--color-muted); font-size: 12px; }

/* 本家の「いいね/表示数/カテゴリ」ピル: 太めの影で目立たせた1つの帯にまとめる */
.meta-card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-strong);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 28px;
  width: 100%;
  margin: 0 auto 24px;
}
/* 詳細情報バーの主要指標は、span/buttonの既定行間の差をなくして同じ寸法に揃える。 */
.meta-card .comment-pill,
.meta-card .like-pill,
.meta-card .group-pill,
.meta-card .category-pill {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  min-height: 24px;
  padding: 3px 10px;
  font-size: 13px;
  line-height: 1;
}
.detail-body-card {
  width: 66.666%;
  min-width: 0;
  max-width: 100%;
  margin: 0 auto 24px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border: 0;
}
.detail-body-card .post-body {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 19px;
  font-weight: 300;
  line-height: 1.6;
  margin: 0;
}
@media (min-width: 641px) {
  .meta-card { margin-bottom: 32px; }
  .detail-body-card {
    width: 90%;
    position: relative;
    margin-bottom: 32px;
    padding: 24px 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
  }
  .detail-body-card::before {
    content: "本文";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0 12px;
    background: var(--color-bg);
    color: var(--color-muted);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
  }
  .attachment-section {
    width: 90%;
    margin-right: auto;
    margin-left: auto;
  }
  .attachment-cell { box-shadow: var(--shadow-weak); }
  .detail-comments {
    width: 66.666%;
    margin-right: auto;
    margin-left: auto;
  }
}
.edit-post-form input[type="text"] { margin-top: 0; margin-bottom: 8px; }
.edit-post-form textarea { margin-top: 0; }
.edit-post-form .post-form-actions { justify-content: flex-end; }
.edit-post-form .btn-small { margin-bottom: 0; }

.detail-top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.detail-top-row .btn-small { margin-bottom: 0; }
.detail-top-row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mobile-page-actions { display: none; }
.detail-related-posts { margin-top: 40px; }

/* 回覧詳細デザインB（写真つき記事風。参考画像に合わせた見た目のみの切り替え。
   SNSシェア・いいねのバリエーション・タイトル・複数枚写真は対象外） */
#view-post.design-b .hero-image {
  border-radius: 16px;
  box-shadow: var(--shadow-standard);
  margin-bottom: 18px;
}
#view-post.design-b .meta-card {
  background: transparent;
  box-shadow: none;
  width: auto;
  margin: 0 0 18px;
}
#view-post.design-b .detail-body-card {
  background: #fff;
  box-shadow: var(--shadow-standard);
  padding: 24px;
}
#view-post.design-b .detail-body-card .post-body {
  text-align: center;
  line-height: 2;
  font-size: 16px;
}
#view-post.design-b #comment-section-title { text-align: center; }
#view-post.design-b .comment-card {
  background: #fff;
  border: 1px solid var(--color-border);
  box-shadow: none;
  border-radius: 14px;
  padding: 16px 18px;
}

/* サイドバー: 作成者紹介（左に角丸画像、右に3行の作成者情報） */
.side-author {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: default;
}
.side-author-avatar-link {
  flex: 0 0 auto;
  cursor: pointer;
}
.side-author .side-author-avatar {
  width: 88px;
  height: 88px;
  border-radius: 10px;
  font-size: 28px;
}
.side-author-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.side-author-name-row {
  display: flex;
  align-items: baseline;
  min-width: 0;
  min-height: 26px;
  cursor: pointer;
}
.side-author-label {
  flex: 0 0 auto;
  margin-right: 2px;
  color: var(--color-muted);
  font-size: 12px;
}
.side-author .profile-name {
  overflow: hidden;
  font-size: 17px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-author-follow-row {
  display: flex;
  align-items: center;
  min-height: 30px;
}
.side-author-follow-row .follow-btn { padding: 5px 12px; }
.side-author-stats {
  min-height: 22px;
  font-size: 13px;
  line-height: 22px;
  white-space: nowrap;
}
.side-post {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  cursor: pointer;
  margin-bottom: 10px;
}
.side-post-main { display: flex; gap: 10px; min-width: 0; }
.side-post-main > img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.side-post-info { min-width: 0; font-size: 12px; color: var(--color-muted); flex: 1; }
.side-post-meta-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.side-post-excerpt {
  font-size: 13px;
  color: var(--color-text);
  margin: 2px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.side-post-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding-top: 2px;
}
.side-post-bottom-row .author-group { min-width: 0; overflow: hidden; }
.side-post-bottom-row .author-group span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-post-bottom-row .comment-pill { flex-shrink: 0; }
.side-post-attachments {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  padding-top: 2px;
}
.side-post-attachment {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 0;
  overflow: hidden;
  border-radius: 6px;
  background: var(--color-subtle-bg);
}
.side-post-attachment > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.side-post-attachment .attachment-icon-preview { height: 100%; padding: 4px; gap: 0; }
.side-post-attachment .attachment-icon { font-size: 18px; }
.side-post-attachment .attachment-filename { display: none; }
.side-post-attachment-more {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(25, 25, 25, .58);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

/* コメント */
.comment-card { padding: 12px 16px; }
.comment-card .post-body { font-size: 14px; margin-bottom: 0; }
.comment-pagination-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.comment-pagination-start { min-width: 0; justify-self: start; }
.comment-pagination-toolbar .btn-small { margin-bottom: 0; }
#btn-comments-older { justify-self: center; }
.comment-pagination-spacer { min-width: 0; }

/* 折りたたみ時のコメントの「消えていく」プレビュー演出（もっと見るを押すと全件展開） */
.comment-peek {
  max-height: 68px;
  overflow: hidden;
}
.comment-peek-half {
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 50%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 50%, transparent 100%);
}
.comment-peek-full {
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
}
#btn-comments-more {
  width: 50%;
  margin: 4px auto 20px;
}
@media (min-width: 641px) {
  .attachment-more-btn,
  #btn-comments-more {
    display: block;
    width: min(100%, 420px);
    margin: 12px auto 20px;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
  }
}
@media (max-width: 640px) {
  .comment-pagination-toolbar { grid-template-columns: 1fr; gap: 8px; }
  .comment-pagination-start { justify-self: start; }
  #btn-comments-older { grid-row: 2; justify-self: center; }
  .comment-pagination-spacer { display: none; }
}

/* 設定 */
.view-settings h2, #view-settings h2 { font-family: var(--font-accent); font-weight: 600; }
.settings-modal-open { overflow: hidden; }
#view-settings.settings-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  max-width: none;
  margin: 0;
  overflow-y: auto;
  padding: max(28px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  background: transparent;
}
.settings-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(62, 49, 36, .24);
  -webkit-backdrop-filter: blur(6px) saturate(.86);
  backdrop-filter: blur(6px) saturate(.86);
  cursor: pointer;
}
.settings-modal-card {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  margin: 0 auto;
  padding: 28px 34px;
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: var(--shadow-modal);
}
.settings-modal-close {
  position: sticky;
  top: 0;
  z-index: 4;
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 0 -42px auto;
  border: 0;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.settings-form { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--color-border); }
.settings-checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--color-text); }
.card-size-options {
  display: grid;
  gap: 8px;
  padding: 12px;
  margin: 0 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.card-size-options legend { padding: 0 6px; font-weight: 600; }
.card-size-options label { display: flex; align-items: center; gap: 8px; }
.card-size-options input { width: auto; margin: 0; }
.card-grid-settings select { max-width: 280px; }
.card-grid-settings select:disabled { opacity: .55; cursor: not-allowed; }
.settings-card-grid-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.settings-card-grid-actions button { width: auto; margin: 0; }
.admin-account-management {
  margin: 14px 0 24px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fffdfb;
}
.admin-invitation-management {
  margin: 14px 0 24px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fffdfb;
}
.admin-invitation-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, .8fr) minmax(120px, .5fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.admin-invitation-form label { display: grid; gap: 5px; }
.admin-invitation-form button { grid-column: 1 / -1; width: 100%; margin: 0; }
.admin-invitation-list { display: grid; gap: 8px; }
.admin-invitation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
}
.admin-invitation-info { display: grid; gap: 3px; min-width: 0; }
.admin-invitation-info span { overflow-wrap: anywhere; }
.admin-invitation-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.admin-invitation-actions button { width: auto; margin: 0; }
.admin-invitation-status {
  display: inline-flex;
  width: fit-content;
  padding: 3px 8px;
  border-radius: var(--radius-small);
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  font-size: 12px;
  font-weight: 700;
}
.admin-invitation-status.is-finished { background: #eee; color: var(--color-muted); }
.admin-account-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.admin-account-heading h3 { margin: 0 0 4px; }
.admin-account-heading p { margin: 0; }
.admin-account-heading button { flex: 0 0 auto; width: auto; margin: 0; }
.admin-account-list { display: grid; gap: 10px; }
.admin-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, .8fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
}
.admin-account-row.is-disabled { background: #f5f3f1; opacity: .86; }
.admin-account-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.admin-account-avatar { width: 44px; height: 44px; border: 2px solid var(--color-primary); font-size: 17px; }
.admin-account-info { display: grid; gap: 3px; min-width: 0; }
.admin-account-info strong,
.admin-account-info span { overflow-wrap: anywhere; }
.admin-account-status {
  display: inline-flex;
  width: fit-content;
  padding: 3px 8px;
  border-radius: var(--radius-small);
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  font-size: 12px;
  font-weight: 700;
}
.admin-account-status.is-disabled { background: #eee; color: var(--color-muted); }
.admin-account-actions { display: grid; gap: 8px; }
.admin-account-actions input { min-width: 0; }
.admin-account-actions button { width: 100%; margin: 0; }
.admin-account-audit-details { margin-top: 14px; }
.admin-account-audit-details summary { cursor: pointer; font-weight: 700; }
.admin-account-audit-list { display: grid; gap: 8px; margin-top: 10px; }
.admin-account-audit-row {
  padding: 10px 12px;
  border-left: 3px solid var(--color-primary);
  background: #fff;
  font-size: 13px;
}
.admin-account-audit-row p { margin: 3px 0 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .admin-invitation-form { grid-template-columns: 1fr; }
  .admin-invitation-form button { grid-column: auto; }
  .admin-invitation-row { grid-template-columns: 1fr; }
  .admin-invitation-actions { justify-content: stretch; }
  .admin-invitation-actions button { flex: 1 1 auto; }
  .admin-account-heading { align-items: stretch; flex-direction: column; }
  .admin-account-row { grid-template-columns: 1fr; }
}
.announcement-admin { margin-top: 24px; padding-top: 20px; border-top: 2px solid var(--color-border); }
.announcement-status-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px 16px;
  align-items: center;
  padding: 16px;
  margin-bottom: 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: #f5f5f5;
}
.announcement-status-card.is-on { border-color: var(--color-primary); background: #fff7f1; }
.announcement-status-card.is-emergency { border-color: var(--color-danger); background: #fff1ef; }
.announcement-toggle-label { display: flex; align-items: center; gap: 9px; font-weight: 700; cursor: pointer; }
.announcement-toggle-label input { position: absolute; opacity: 0; pointer-events: none; }
.announcement-toggle {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: 999px;
  background: #aaa;
  transition: background .18s ease;
}
.announcement-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .18s ease;
}
.announcement-toggle-label input:checked + .announcement-toggle { background: var(--color-primary); }
.announcement-toggle-label input:checked + .announcement-toggle::after { transform: translateX(22px); }
.announcement-toggle-label input:focus-visible + .announcement-toggle { outline: 2px solid var(--color-primary-dark); outline-offset: 2px; }
.announcement-save-state { color: var(--color-muted); font-size: 12px; }
.announcement-save-state.is-dirty { color: var(--color-danger); font-weight: 700; }
.announcement-current-summary { grid-column: 1 / -1; border-top: 1px solid var(--color-border); padding-top: 10px; }
.announcement-current-summary > span { font-size: 12px; font-weight: 700; color: var(--color-muted); }
.announcement-current-summary ol { margin: 6px 0 0; padding-left: 24px; }
.announcement-current-summary p { margin: 6px 0 0; color: var(--color-muted); }
#announcement-normal-settings { transition: opacity .18s ease, filter .18s ease; }
#announcement-normal-settings.is-suspended {
  opacity: .42;
  filter: grayscale(.8);
  pointer-events: none;
  user-select: none;
}
#announcement-normal-settings.is-suspended::before {
  content: "緊急連絡中は通常テロップを一時停止します";
  display: block;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  background: #fff1ef;
  color: var(--color-danger);
  font-weight: 700;
}
.announcement-basic-grid { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; }
.announcement-basic-grid > label { min-width: 150px; flex: 1; }
#announcement-normal-settings > .announcement-basic-grid {
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-standard);
}
.announcement-basic-grid input[type="color"],
.announcement-library-row input[type="color"],
.announcement-message-row input[type="color"] { width: 48px; min-height: 38px; padding: 2px; }
.announcement-editor-block {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e7ded3;
  border-radius: 12px;
  padding: 18px;
  margin: 16px 0;
  box-shadow: var(--shadow-standard);
}
.announcement-editor-block::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-primary);
}
.announcement-editor-block h3 {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
  font-size: 16px;
}
.announcement-editor-block > label:first-child { font-weight: 700; }
.announcement-message-list { display: grid; gap: 8px; margin: 10px 0; }
.announcement-message-row { display: grid; grid-template-columns: minmax(0, 1fr) 48px auto; gap: 8px; align-items: center; }
.announcement-message-row input { margin: 0; }
.announcement-message-row button { margin: 0; }
.announcement-library-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
}
.announcement-library-row select { width: 100%; min-width: 0; margin: 0; }
.announcement-library-row input { margin: 0; }
#btn-add-library-message {
  grid-column: 1 / -1;
  justify-self: start;
  width: auto;
  margin: 2px 0 0;
  padding: 9px 16px;
  white-space: nowrap;
  font-weight: 700;
}
.announcement-emergency-block { border-color: #e5a09a; background: #fff8f7; }
.announcement-emergency-block::before { background: var(--color-danger); }
.announcement-preview { overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 10px 0; margin: 14px 0; }
.announcement-preview > div { display: inline-flex; gap: 28px; min-width: max-content; white-space: nowrap; animation: announcement-scroll var(--announcement-duration, 22s) linear infinite; }
.announcement-preview.is-fixed { text-align: center; }
.announcement-preview.is-fixed > div { min-width: 0; white-space: normal; animation: none; }
.announcement-save-bar {
  position: sticky;
  bottom: -1px;
  z-index: 3;
  justify-content: flex-end;
  padding: 12px;
  border-top: 1px solid var(--color-border);
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow-upward);
}
.avatar-form { display: flex; align-items: center; gap: 16px; }
.avatar-form-actions { display: flex; flex-direction: column; gap: 8px; }
.avatar-form-actions .btn-small { margin-bottom: 0; }

.empty-message { text-align: center; color: var(--color-muted); font-size: 14px; padding: 24px 0; }

/* 削除済みコンテンツの表示（マスターが「削除済みを含めて表示」した時のみ見える） */
.deleted-content-note {
  color: var(--color-muted);
  font-style: italic;
  background: rgba(0, 0, 0, .04);
  border-radius: 8px;
  padding: 8px 10px;
}
.post-card-deleted { opacity: .6; }
.post-card-deleted .deleted-content-note { margin: 10px 12px 0; }
.revision-row { display: flex; flex-direction: column; gap: 4px; }
.revision-row .post-title { font-weight: 600; margin: 0; }
.revision-row .post-body { margin: 0; }

/* トースト */
.toast {
  position: fixed;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  background: rgba(40, 36, 30, .92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14px;
  max-width: 90%;
  z-index: 100;
}
.toast.error { background: rgba(180, 50, 40, .95); }

/* 最上部/最下部へ移動するボタン（右下固定） */
.scroll-nav {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
}
.scroll-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(40, 36, 30, .75);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-standard);
  transition: background-color .15s ease, opacity .15s ease;
}
.scroll-nav-btn:hover { background: rgba(40, 36, 30, .92); }
@media (max-width: 640px) {
  .scroll-nav { right: 12px; bottom: 12px; }
  .scroll-nav-btn { width: 40px; height: 40px; font-size: 14px; }
}

/* フッター */
.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  font-size: 11px;
  color: var(--color-muted);
  background: var(--color-bg);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border);
}

@media (max-width: 899px) {
  #main { padding: 20px 16px 72px; }
  .detail-layout { gap: 22px; }
}

@media (max-width: 640px) {
  #main { padding: 14px 10px 68px; }
  .mobile-page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
  }
  .mobile-page-actions .btn-small { margin-bottom: 0; }
  #btn-mobile-list-mode { margin-left: auto; }
  #btn-group-back,
  #btn-profile-back { display: none; }
  .app-header-inner { flex-wrap: wrap; }
  .header-announcement { order: 3; flex-basis: 100%; padding: 6px 0; }
  .announcement-item { font-size: 12px; }
  .announcement-library-row { grid-template-columns: 1fr; }
  .announcement-message-row { grid-template-columns: minmax(0, 1fr) 44px auto; }
  #view-settings.settings-modal-layer { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
  .settings-modal-card { width: 100%; min-height: 100vh; max-height: none; border-radius: 0; padding: 18px 14px 80px; }
  .announcement-status-card { grid-template-columns: 1fr auto; }
  .announcement-save-state { grid-column: 1 / -1; }
  .card { padding: 16px; margin-bottom: 14px; }
  #timeline-list, #profile-posts-list, #category-search-list, #detail-related-list { gap: 14px; }
  .detail-body-card { width: 100%; padding: 0; }
  .detail-body-card .post-body { font-size: 17px; }
  .detail-post-has-attachments .detail-body-card { margin-bottom: 24px; }
  .attachment-section { margin-bottom: 24px; }
  .attachment-grid { gap: 8px; }
  .band-title { font-size: 20px; }
  button.timeline-mobile-toggle { display: block; }
  #timeline-controls-panel.is-collapsed-mobile,
  #profile-post-controls-panel.is-collapsed-mobile,
  #category-search-controls-panel.is-collapsed-mobile,
  #detail-related-controls-panel.is-collapsed-mobile { display: none; }
  .timeline-collapse-toggle { margin-bottom: 10px; }
  .post-list-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-list-controls select { width: 100%; min-width: 0; }
  .post-list-controls .post-author-filter { min-width: 0; }
  .publication-window-fields { align-items: stretch; gap: 8px; }
  .publication-window-fields label { width: 100%; justify-content: space-between; }
  .post-category-select,
  .publication-window-fields select {
    min-height: 44px;
    font-size: 16px; /* iPhoneの自動拡大を避け、カテゴリーも読みやすくする */
  }
  .publication-window-fields label select { flex: 1; max-width: 230px; }
  .publication-datetime { width: 100%; }
  .publication-datetime input[type="date"] { flex: 1; width: auto; }
  .publication-datetime input[type="time"] { width: 105px; }
  .post-list-bar {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 10px;
    margin-bottom: 0;
    overflow: hidden;
    cursor: pointer;
  }
  .post-list-bar-main { display: flex; gap: 10px; min-width: 0; max-width: 100%; }
  .post-list-bar-thumb {
    width: 96px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
  }
  .post-list-bar-info { min-width: 0; max-width: 100%; flex: 1; overflow: hidden; }
  .post-list-bar-info .post-meta { display: block; font-size: 12px; font-weight: 400; }
  .post-list-bar-title {
    min-width: 0;
    max-width: 100%;
    margin: 3px 0 0;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .post-list-bar-footer {
    display: flex;
    min-width: 0;
    max-width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
  }
  .post-list-bar-footer > .pill-group {
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .post-list-bar-footer .post-author {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
  }
  .post-list-bar-footer .comment-pill,
  .post-list-bar-footer .like-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 24px;
    padding: 3px 8px;
    font-size: 13px;
    line-height: 1;
  }
}

@media (max-width: 480px) {
  .header-nav-select { width: 112px; }
}

/* -------------------------------------------------------------------------
 * 運用モード
 * ---------------------------------------------------------------------- */
.operation-mode-banner {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 18px;
  border-bottom: 1px solid #e3a36f;
  background: #fff0e4;
  color: #8b3d08;
  box-shadow: rgba(0, 0, 0, 0.15) 0 2px 6px 0;
  font-size: 14px;
}
.operation-mode-banner.is-closed {
  border-color: #b8352d;
  background: #fff0ef;
  color: #8c211b;
}
.operation-mode-banner strong { font-size: 15px; }
.operation-closed-card {
  max-width: 720px;
  margin: 64px auto;
  padding: 36px;
  text-align: center;
  border-top: 4px solid #c0392b;
}
.operation-closed-card h2 { margin-top: 0; color: #a12c24; }
.operation-mode-management {
  padding: 18px;
  margin-bottom: 22px;
  border: 1px solid #efc2a2;
  border-left: 4px solid #ff711d;
  border-radius: 10px;
  background: #fffdfb;
  box-shadow: rgba(0, 0, 0, 0.15) 0 2px 6px 0;
}
.operation-mode-current {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 8px;
  background: #fff0e4;
  color: #d34f08;
  font-weight: 700;
}
.operation-mode-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.operation-mode-form label:not(.settings-checkbox-label) {
  display: grid;
  gap: 6px;
}
.operation-mode-form textarea { min-height: 84px; }
.operation-mode-audit {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.operation-mode-audit-row {
  padding: 10px 12px;
  border: 1px solid #eadfd8;
  border-radius: 8px;
  background: #fff;
}
.operation-mode-audit-row span { display: block; }
body.operation-read-only .operation-write-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
body.operation-read-only .operation-write-control,
body.operation-closed .operation-write-control {
  pointer-events: none;
  opacity: 0.55;
  cursor: not-allowed;
}
/* 閲覧専用・全面停止中も、会員の無効化と招待の取り消し（権限を取り上げる操作）はできるよう一覧は残す */
body.operation-read-only #settings-master-section > :not(h2):not(.operation-mode-management):not(.admin-invitation-management):not(.admin-account-management),
body.operation-closed #settings-master-section > :not(h2):not(.operation-mode-management):not(.admin-invitation-management):not(.admin-account-management),
body.operation-read-only #form-admin-invitation,
body.operation-closed #form-admin-invitation {
  display: none !important;
}

@media (max-width: 640px) {
  .operation-mode-banner {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 9px 12px;
    font-size: 12px;
  }
  .operation-mode-banner strong { width: 100%; font-size: 14px; }
  .operation-closed-card { margin: 28px auto; padding: 24px 18px; }
  .operation-mode-management { padding: 14px; }
}
