/* 最新一覧用 compose ホスト（ドックは body へポータル） */
#community-olb-root.olb-compose-host {
  position: fixed;
  width: 0;
  height: 0;
  overflow: visible;
  clip: auto;
  border: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
  z-index: 0;
}

/* ドックは body へポータルするためホスト内の pointer-events 調整は不要 */

.community-olb-board-panel .olb-board-panel .olb-thread {
  margin-top: 0;
}

.community-board-panel-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}

.community-board-panel-head-row .community-board-panel-title {
  margin-bottom: 0;
}

.community-compose-open {
  flex-shrink: 0;
}

.community-app {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* 板切り替え = 書類の束から1枚をめくるイメージ（HTML遷移はしない） */
.community-boards {
  margin-top: 0.25rem;
  --board-accent: #6b7280;
  --board-bg: #fff;
  --board-border: #cbd5e1;
  --board-head-border: #e2e8f0;
}

.community-boards[data-active-tab='latest'] {
  --board-accent: #334155;
  --board-bg: #e5e7eb;
  --board-border: #94a3b8;
  --board-head-border: #cbd5e1;
}

.community-boards[data-active-tab='chat'] {
  --board-accent: #1f2937;
  --board-bg: #d1d5db;
  --board-tab-active-bg: #e5e7eb;
  --board-border: #6b7280;
  --board-head-border: #9ca3af;
}

.community-boards[data-active-tab='formation'] {
  --board-accent: #1e3a8a;
  --board-bg: #dbeafe;
  --board-tab-active-bg: #dbeafe;
  --board-border: #3b82f6;
  --board-head-border: #93c5fd;
}

.community-boards[data-active-tab='beginner'] {
  --board-accent: #047857;
  --board-bg: #bbf7d0;
  --board-tab-active-bg: #bbf7d0;
  --board-border: #10b981;
  --board-head-border: #6ee7b7;
}

.community-boards[data-active-tab='mine'] {
  --board-accent: #991b1b;
  --board-bg: #fecaca;
  --board-tab-active-bg: #fecaca;
  --board-border: #ef4444;
  --board-head-border: #fca5a5;
}

.community-boards-label {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7280;
}

.community-board-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 2px solid var(--board-border);
  background: #94a3b8;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.community-board-tab {
  flex: 1 1 auto;
  min-width: 5.5rem;
  margin: 0;
  padding: 0.85rem 1rem;
  border: none;
  border-right: 1px solid rgba(0, 0, 0, 0.12);
  border-bottom: 3px solid rgba(0, 0, 0, 0.15);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.community-board-tab:last-child {
  border-right: none;
}

/* 非選択タブも常に板色 */
.community-board-tab[data-tab='latest'] {
  background: #cbd5e1;
  color: #334155;
  border-bottom-color: #94a3b8;
}

.community-board-tab[data-tab='mine'] {
  background: #fca5a5;
  color: #7f1d1d;
  border-bottom-color: #ef4444;
}

.community-board-tab[data-tab='chat'] {
  background: #9ca3af;
  color: #111827;
  border-bottom-color: #4b5563;
}

.community-board-tab[data-tab='formation'] {
  background: #93c5fd;
  color: #1e3a8a;
  border-bottom-color: #2563eb;
}

.community-board-tab[data-tab='beginner'] {
  background: #6ee7b7;
  color: #064e3b;
  border-bottom-color: #059669;
}

.community-board-tab[data-tab='mine'] {
  background: #fca5a5;
  color: #7f1d1d;
  border-bottom-color: #dc2626;
}

.community-board-tab:hover {
  filter: brightness(1.06);
}

.community-board-tab.is-active {
  position: relative;
  z-index: 2;
  margin-bottom: -2px;
  padding-bottom: calc(0.85rem + 2px);
  border-bottom-width: 4px;
  filter: none;
  box-shadow: 0 -4px 0 0 currentColor inset;
}

.community-board-tab[data-tab='latest'].is-active {
  background: #e5e7eb;
  color: #0f172a;
  border-bottom-color: #64748b;
}

.community-board-tab[data-tab='mine'].is-active {
  background: #fecaca;
  color: #7f1d1d;
  border-bottom-color: #b91c1c;
}

.community-board-tab[data-tab='chat'].is-active {
  background: #e5e7eb;
  color: #030712;
  border-bottom-color: #374151;
}

.community-board-tab[data-tab='formation'].is-active {
  background: #dbeafe;
  color: #1e3a8a;
  border-bottom-color: #1d4ed8;
}

.community-board-tab[data-tab='beginner'].is-active {
  background: #bbf7d0;
  color: #064e3b;
  border-bottom-color: #047857;
}

.community-board-tab[data-tab='mine'].is-active {
  background: #fecaca;
  color: #7f1d1d;
  border-bottom-color: #b91c1c;
}

.community-board-panel {
  margin: 0;
  padding: 1rem 1.1rem 1.1rem;
  border: 2px solid var(--board-border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--board-bg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.community-board-panel-head {
  margin: 0 0 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--board-head-border);
}

.community-board-panel-title {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--board-accent);
  line-height: 1.3;
}

.community-board-panel-desc {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: color-mix(in srgb, var(--board-accent) 72%, #6b7280);
}

.community-board-scope {
  margin-top: 0.65rem;
}

.community-board-scope[hidden] {
  display: none !important;
}

.community-board-scope:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.community-board-scope-btn {
  font-size: 0.78rem;
  line-height: 1.3;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--board-accent) 35%, #9ca3af);
  background: color-mix(in srgb, var(--board-bg) 88%, #fff);
  color: var(--board-accent);
  cursor: pointer;
  font-weight: 600;
}

.community-board-scope-btn:hover {
  border-color: var(--board-accent);
}

.community-board-scope-btn.is-active {
  background: var(--board-accent);
  border-color: var(--board-accent);
  color: #fff;
}

/* 掲示板（OLB）と同じ1行リスト（外枠は板色） */
.community-feed.olb-feed-panel {
  border: 2px solid var(--board-border);
  border-radius: 10px;
  background: #1f1f1f;
  color: #fff;
  padding: 10px 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  --olb-inset-x-start: 12px;
  --olb-inset-x-end: 12px;
  overflow: hidden;
}

.community-feed .olb-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.community-feed .olb-list > .olb-item {
  margin: 0;
}

/* 最新一覧: ラジオ・本文を左端、ページラベルは行末へ */
.community-feed .olb-row--feed-latest {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  width: 100%;
}

.community-feed .olb-row--feed-latest .olb-select {
  flex-shrink: 0;
  margin-right: 0;
}

.community-feed .olb-row--feed-latest .olb-content {
  flex: 1 1 8rem;
  min-width: 0;
}

.community-feed .olb-row-feed-trail {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.community-feed .olb-row-feed-trail .olb-row-page-badge {
  margin-right: 0;
}

/* 最新一覧: 編成カードは右列 */
.community-feed .olb-item-split {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 10px 14px;
}

.community-feed .olb-item-split-main {
  order: 1;
  flex: 1 1 0;
  min-width: 0;
}

.community-feed .olb-item-split-formation {
  order: 2;
  flex: 0 0 min(100%, 280px);
  width: min(100%, 280px);
  min-width: 200px;
  max-width: 280px;
}

@media (max-width: 720px) {
  .community-feed .olb-item-split {
    flex-direction: column;
    flex-wrap: wrap;
  }

  .community-feed .olb-item-split-formation {
    width: 100%;
    max-width: none;
    align-self: flex-end;
  }
}

.community-feed-preview-item.olb-preview-item {
  margin: 6px 0 8px;
}

.community-feed-preview-item .olb-preview-compose-body {
  background: #236343;
  color: #fff;
  border-radius: 8px;
  padding: 0.5rem 0.55rem;
}

.community-feed-preview-item .olb-preview-compose-body .olb-row {
  background: transparent;
  padding: 0;
}

.community-feed-preview-item .olb-preview-compose-body .olb-content,
.community-feed-preview-item .olb-preview-compose-body .olb-author,
.community-feed-preview-item .olb-preview-compose-body .olb-meta,
.community-feed-preview-item .olb-preview-compose-body .olb-sep {
  color: #fff;
}

.community-feed-preview-item .olb-preview-compose-body .olb-item-split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 14px;
}

.community-feed-preview-item .olb-preview-compose-body .olb-item-split-formation {
  flex: 0 0 min(100%, 300px);
  width: min(100%, 300px);
  min-width: 220px;
  max-width: 300px;
}

.community-feed-preview-item .olb-preview-compose-body .olb-item-split-main {
  flex: 1 1 180px;
  min-width: 0;
}

.community-feed-preview-item .olb-preview-compose-body .olb-item-split-main .olb-content {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

/* 返信プレビューモード（背面すりガラス＋操作ブロック） */
.olb-reply-preview-mode .community-feed,
.olb-reply-preview-mode .home-feed-panel {
  position: relative;
}

/* 返信プレビュー：一覧フィードだけすりガラス（スレッド枠・タブ・サイドバーは対象外） */
.olb-reply-preview-mode .community-feed::after,
.olb-reply-preview-mode .home-feed-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: auto;
  background: var(--olb-overlay-bg, rgba(15, 23, 42, 0.12));
  -webkit-backdrop-filter: blur(3px) saturate(var(--olb-overlay-saturate, 1.02));
  backdrop-filter: blur(3px) saturate(var(--olb-overlay-saturate, 1.02));
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .olb-reply-preview-mode .community-feed::after,
  .olb-reply-preview-mode .home-feed-panel::after {
    background: rgba(15, 23, 42, 0.35);
  }
}

body.olb-dock-open .olb-reply-preview-mode .community-feed::after,
body.olb-dock-open .olb-reply-preview-mode .home-feed-panel::after {
  display: none;
}

.community-reply-preview {
  position: relative;
  z-index: 3;
  pointer-events: auto;
  margin: 0 0 1rem;
  border: 2px solid #8bc34a;
  border-radius: 12px;
  overflow: hidden;
  background: #0d1611;
  color: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.community-reply-preview-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: linear-gradient(180deg, #2d6a4f 0%, #236343 100%);
  border-bottom: 1px solid #184c38;
}

.community-reply-preview-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d9f99d;
}

.community-reply-preview-target {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
}

.community-reply-preview-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.community-reply-preview-close:hover {
  background: rgba(0, 0, 0, 0.4);
}

.olb-compose-dock-portal {
  z-index: 1320;
  pointer-events: none;
}

.olb-compose-dock-portal .olb-compose-dock-panel {
  pointer-events: auto;
}

.community-board-view {
  margin-top: 0.25rem;
}

.community-olb-board-panel {
  margin: 0;
}

/* 板タブ内 OLB：外側 .card と重ねた白枠をやめる */
.community-olb-board-panel.wiki-olb-wrap.card {
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin-bottom: 0;
}

.community-olb-board-panel[hidden] {
  display: none !important;
}

#community-olb-root[hidden] {
  display: none !important;
}

.community-board-view .olb-board-panel .olb-item[data-cid] {
  display: list-item;
}

.community-reply-preview-content {
  padding: 0.75rem 0.85rem 0.9rem;
}

.community-reply-preview-hint {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.community-reply-preview-list {
  list-style: none;
  margin: 0;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  background: #1a1a1a;
  border: 1px solid #333;
}

.community-reply-preview-list .community-thread-item {
  margin: 4px 0;
}

.community-reply-preview .olb-select,
.community-reply-preview .olb-feed-reply-radio {
  margin-right: 0.3rem;
  accent-color: #8bc34a;
  cursor: pointer;
}

.community-reply-preview-children {
  list-style: none;
  margin: 0.2rem 0 0.3rem 1rem;
  padding: 0 0 0 0.6rem;
  border-left: 2px solid #4a6b55;
}

.community-reply-preview-loading {
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.88rem;
  color: #cbd5e1;
  background: #1f2937;
  border-radius: 8px;
}

.community-reply-preview-loading.is-error {
  color: #fecaca;
  background: #450a0a;
}

.olb-reply-preview-mode .community-feed-item--muted {
  opacity: 0.35;
  filter: grayscale(0.2);
  pointer-events: none;
}

.olb-reply-preview-mode .community-feed-item--hidden-in-preview {
  display: none;
}

.home-community-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
}

.home-community-actions .community-compose-open {
  flex-shrink: 0;
}

#home-compose-open.community-compose-open {
  flex-shrink: 0;
}

.home-feed-panel {
  border: 2px solid #334155;
  border-radius: 10px;
  background: #1f1f1f;
  color: #fff;
  padding: 10px 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  --olb-inset-x-start: 12px;
  --olb-inset-x-end: 12px;
  overflow: hidden;
}

#home-olb-root.olb-compose-host {
  position: fixed;
  width: 0;
  height: 0;
  overflow: visible;
  clip: auto;
  border: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
  z-index: 0;
}

.wiki-olb-wrap .olb-board-panel .olb-thread {
  margin-top: 0;
}

.olb-feed-reply-tag,
.olb-feed-thread-btn {
  display: inline-block;
  margin-right: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}

.olb-feed-reply-tag {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: #374151;
  color: #e5e7eb;
}

.olb-feed-thread-btn {
  padding: 0.12rem 0.45rem;
  border: 1px solid #6b7280;
  border-radius: 4px;
  background: #111827;
  color: #93c5fd;
  cursor: pointer;
}

.olb-feed-thread-btn:hover {
  background: #1f2937;
  border-color: #93c5fd;
}

.community-feed .olb-item .olb-formation {
  margin-top: 6px;
}

.community-feed-loading,
.community-feed-empty,
.community-feed-error {
  margin: 0;
  font-size: 0.9rem;
  color: var(--gray-600);
}

.community-feed.olb-feed-panel .community-feed-loading,
.community-feed.olb-feed-panel .community-feed-empty,
.community-feed.olb-feed-panel .community-feed-error {
  color: #ccc;
}

.community-feed-more-wrap {
  margin: 0.85rem 0 0;
  text-align: center;
}

.wiki-comments-section {
  margin-top: 2rem;
  scroll-margin-top: 1rem;
}

@media (max-width: 640px) {
  .community-board-nav {
    flex-direction: column;
    border-radius: 8px 8px 0 0;
  }

  .community-board-tab {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #d1d5db;
    text-align: left;
    min-width: 0;
  }

  .community-board-tab.is-active {
    margin-bottom: 0;
    padding-bottom: 0.85rem;
    border-left: 4px solid var(--board-accent);
    box-shadow: none;
    border-bottom-color: var(--board-head-border);
  }

  .community-board-tab:last-child {
    border-bottom: none;
  }
}
