/* Project Oraculum — X / Threads 型 SNS UI
   テーマは data-theme="dark" (青みがかった黒) | "light" (白) | "black" (純黒)
   (右上のアイコンクリックでトグル、ホバーでリスト選択、localStorage に保存) */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d141e;
  --bg-elev: #151f2e;
  --panel: #151f2e;
  --panel-hover: #1b283b;
  --text: #e2e8f0;
  --text-strong: #f1f5f9;
  --muted: #798b9f;
  --border: #213247;
  --border-soft: #182433;
  --line: color-mix(in srgb, var(--muted) 55%, transparent);
  --sep: color-mix(in srgb, var(--muted) 22%, transparent);
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --accent-soft: rgba(29, 155, 240, .12);
  --like: #f91880;
  --like-soft: rgba(249, 24, 128, .12);
  --risk: #f4212e;
  --ai: #8ab4f8;
  --human: #7ee787;
  --topic: #ffb066;
  --hover: rgba(226, 232, 240, .04);
  --head-bg: rgba(13, 20, 30, .75);
  --shadow: 0 4px 20px rgba(0, 0, 0, .35);
}

[data-theme="black"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-elev: #16181c;
  --panel: #16181c;
  --panel-hover: #1d1f23;
  --text: #e7e9ea;
  --text-strong: #f7f9f9;
  --muted: #71767b;
  --border: #2f3336;
  --border-soft: #202327;
  --line: color-mix(in srgb, var(--muted) 55%, transparent);
  --sep: color-mix(in srgb, var(--muted) 22%, transparent);
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --accent-soft: rgba(29, 155, 240, .1);
  --like: #f91880;
  --like-soft: rgba(249, 24, 128, .1);
  --risk: #f4212e;
  --ai: #8ab4f8;
  --human: #7ee787;
  --topic: #ffb066;
  --hover: rgba(231, 233, 234, .03);
  --head-bg: rgba(0, 0, 0, .65);
  --shadow: 0 0 15px rgba(255, 255, 255, .04);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elev: #f7f9f9;
  --panel: #f7f9f9;
  --panel-hover: #eff3f4;
  --text: #0f1419;
  --text-strong: #0f1419;
  --muted: #536471;
  --border: #eff3f4;
  --border-soft: #f0f3f4;
  --line: color-mix(in srgb, var(--muted) 55%, transparent);
  --sep: color-mix(in srgb, var(--muted) 22%, transparent);
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --accent-soft: rgba(29, 155, 240, .1);
  --like: #f91880;
  --like-soft: rgba(249, 24, 128, .1);
  --risk: #d61f2b;
  --ai: #1d6fd8;
  --human: #1a7f37;
  --topic: #b35309;
  --hover: rgba(15, 20, 25, .03);
  --head-bg: rgba(255, 255, 255, .85);
  --shadow: 0 0 15px rgba(101, 119, 134, .1);
}

[data-theme="brown"] {
  color-scheme: light;
  --bg: #faf8f5;
  --bg-elev: #f3ece3;
  --panel: #f3ece3;
  --panel-hover: #ebe0d4;
  --text: #3c2f25;
  --text-strong: #251b14;
  --muted: #827163;
  --border: #ebdcd0;
  --border-soft: #f4ede5;
  --line: color-mix(in srgb, var(--muted) 55%, transparent);
  --sep: color-mix(in srgb, var(--muted) 22%, transparent);
  --accent: #9e5a26;
  --accent-hover: #86491c;
  --accent-soft: rgba(158, 90, 38, .12);
  --like: #d83a56;
  --like-soft: rgba(216, 58, 86, .12);
  --risk: #c5221f;
  --ai: #2979bb;
  --human: #2e7d32;
  --topic: #b45309;
  --hover: rgba(60, 47, 37, .04);
  --head-bg: rgba(250, 248, 245, .88);
  --shadow: 0 4px 20px rgba(60, 47, 37, .08);
}

[data-theme="green"] {
  color-scheme: light;
  --bg: #f4f9f5;
  --bg-elev: #e7f2ea;
  --panel: #e7f2ea;
  --panel-hover: #dbebe0;
  --text: #1f3625;
  --text-strong: #112316;
  --muted: #5e7a65;
  --border: #d4e5d8;
  --border-soft: #e5f0e8;
  --line: color-mix(in srgb, var(--muted) 55%, transparent);
  --sep: color-mix(in srgb, var(--muted) 22%, transparent);
  --accent: #2e7d4d;
  --accent-hover: #23653d;
  --accent-soft: rgba(46, 125, 77, .12);
  --like: #e11d48;
  --like-soft: rgba(225, 29, 72, .12);
  --risk: #d1242f;
  --ai: #1d72b8;
  --human: #15803d;
  --topic: #b45309;
  --hover: rgba(31, 54, 37, .04);
  --head-bg: rgba(244, 249, 245, .88);
  --shadow: 0 4px 20px rgba(31, 54, 37, .08);
}

* { box-sizing: border-box; }

/* .reply-banner や .form のように display を指定した要素は、UA 既定の
   [hidden]{display:none} に勝ってしまい hidden が効かなくなる。ここで上書きする。 */
[hidden] { display: none !important; }

html {
  scrollbar-gutter: stable;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont,
               "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: .01em;
  transition: background-color .2s ease, color .2s ease;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.icon-defs { display: none; }

.ic {
  width: 22px; height: 22px;
  fill: currentColor;
  flex: 0 0 auto;
  display: block;
}

.layout {
  display: grid;
  grid-template-columns: 275px minmax(0, 600px) 350px;
  justify-content: center;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  padding: 0 16px;
  min-height: 100vh;
}

/* ---------------------------------------------------------- 左ナビ ---- */
.col-nav {
  justify-self: end;
  width: 275px;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2px;
  z-index: 30;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.nav-account {
  position: relative;
  margin-top: auto;
  padding: 8px 0 12px;
  min-width: 0;
  max-width: 100%;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; margin-bottom: 4px;
  border-radius: 9999px;
  width: fit-content;
  color: var(--text);
  cursor: pointer;
  transition: background-color .15s ease;
}
.brand:hover { background: var(--hover); }
.brand.active .brand-text { color: var(--text-strong); }
.brand.active .brand-mark { color: var(--accent); }
.brand-mark { font-size: 26px; line-height: 1; color: var(--accent); }
.brand-text {
  font-size: 20px; font-weight: 800; letter-spacing: -.02em;
  color: var(--text-strong);
}

.nav-item {
  display: flex; align-items: center; gap: 18px;
  padding: 11px 14px;
  border-radius: 9999px;
  font-size: 19px;
  width: fit-content;
  color: var(--text);
  transition: background-color .15s ease;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { font-weight: 700; color: var(--text-strong); }
.nav-item.active .ic { fill: var(--accent); }
.nav-item .ic { width: 24px; height: 24px; }

.who-mini {
  margin-top: auto;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border-soft);
}

/* -------------------------------------------------------- ボタン ---- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 9999px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .15s ease, opacity .15s ease;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary.block { margin-top: 14px; width: 90%; }
.btn-primary.sm { padding: 8px 18px; font-size: 14px; }
.btn-primary .ic { width: 18px; height: 18px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: none; border-radius: 9999px;
  background: transparent; color: var(--text);
  cursor: pointer;
  transition: background-color .15s ease;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

[data-theme="dark"] .theme-light,
[data-theme="black"] .theme-light { display: none; }
[data-theme="light"] .theme-dark,
[data-theme="brown"] .theme-dark,
[data-theme="green"] .theme-dark { display: none; }

/* --------------------------------------------- テーマ選択ドロップダウン ---- */
.theme-wrapper {
  position: relative;
  display: inline-flex;
}

.theme-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  min-width: 175px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: fadeInDown .15s cubic-bezier(.16, 1, .3, 1);
}

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

.theme-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: start;
  width: 100%;
  transition: background-color .12s ease, color .12s ease;
}
.theme-opt:hover {
  background: var(--hover);
  color: var(--text-strong);
}
.theme-opt.active {
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-soft);
}
.theme-opt .opt-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  flex-shrink: 0;
}
.theme-opt .check {
  margin-inline-start: auto;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  opacity: 0;
}
.theme-opt.active .check {
  opacity: 1;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ghost-btn.danger:hover { border-color: var(--risk); color: var(--risk); background: transparent; }

.linkish {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: 13px; font-weight: 600; padding: 0 4px;
}

/* -------------------------------------------------------- 中央 ---- */
.col-main {
  width: 100%;
  max-width: 600px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-height: 100vh;
  margin: 0 auto;
  box-sizing: border-box;
}

.main-head {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  min-height: 53px;
  background: var(--head-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.main-head h2 {
  font-size: 20px; font-weight: 800; margin: 0;
  letter-spacing: -.01em; color: var(--text-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.head-right { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }

/* 翻訳の進捗バッジ (新しい言語は少しずつ翻訳が埋まっていく) */
.translating {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px; border-radius: 9999px;
  white-space: nowrap;
}
.translating::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* 言語プルダウン (ヘッダー右上) */
.lang-picker {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px 5px 10px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--muted);
  transition: border-color .15s ease, color .15s ease;
}
.lang-picker:hover { border-color: var(--accent); color: var(--accent); }
.lang-picker .lang-ic { width: 18px; height: 18px; }
.lang-picker .caret { width: 16px; height: 16px; pointer-events: none; }
.lang-picker select {
  appearance: none; -webkit-appearance: none;
  background: transparent; border: none; outline: none;
  color: var(--text); font-family: inherit;
  font-size: 13px; font-weight: 600;
  padding: 0 2px; margin: 0;
  cursor: pointer;
}
.lang-picker select option { background: var(--bg); color: var(--text); }

.pad { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* ------------------------------------------------------ コンポーザ ---- */
.composer {
  display: flex; gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.composer-body { flex: 1; min-width: 0; }
.composer textarea {
  width: 100%;
  background: transparent; border: none; outline: none;
  color: var(--text);
  font-family: inherit; font-size: 19px; line-height: 1.45;
  resize: none; overflow: hidden;
  padding: 8px 0;
}
.composer textarea::placeholder { color: var(--muted); }
.composer textarea:disabled { cursor: not-allowed; }

.composer-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  border-top: 1px solid var(--border-soft);
  margin-top: 6px; padding-top: 10px;
}
.counter { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.warn { color: var(--topic); }
.counter.over { color: var(--risk); font-weight: 700; }

.reply-banner {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); padding-top: 4px;
}
.reply-banner b { color: var(--accent); font-weight: 600; }

.hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; }

/* -------------------------------------------------------- 投稿 ---- */
.feed { display: flex; flex-direction: column; }

.post {
  display: flex; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background-color .12s ease;
}
.post:hover { background: var(--hover); }

.avatar {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; color: #fff;
  background: var(--muted);
  user-select: none;
}
.avatar.small { width: 32px; height: 32px; flex-basis: 32px; font-size: 14px; }
.avatar.lg { width: 56px; height: 56px; flex-basis: 56px; font-size: 22px; }

.post-body { flex: 1; min-width: 0; }
.post-head {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  font-size: 15px; line-height: 1.3;
}
.post-head .name {
  font-weight: 700; color: var(--text-strong);
  max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.post-head .handle, .post-head .time { color: var(--muted); font-weight: 400; }
/* 時刻はその投稿のパーマリンク (クリックでその投稿を基準に開く) */
.post-head .time-link {
  background: none; border: 0; padding: 0;
  font: inherit; color: inherit;
  cursor: pointer;
}
.post-head .time-link:hover { text-decoration: underline; color: var(--accent); }

.tag {
  font-size: 11px; font-weight: 600; line-height: 1.6;
  padding: 0 7px; border-radius: 9999px;
  border: 1px solid var(--border); color: var(--muted);
}
.tag.ai { color: var(--ai); border-color: color-mix(in srgb, var(--ai) 35%, transparent); }
.tag.human { color: var(--human); border-color: color-mix(in srgb, var(--human) 35%, transparent); }
.tag.topic { color: var(--topic); border-color: color-mix(in srgb, var(--topic) 35%, transparent); }
.tag.role { max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.reply-to { font-size: 13px; color: var(--muted); margin: 1px 0 2px; }
.reply-to b { color: var(--accent); font-weight: 500; }

/* -------------------------------------------------------- スレッド表示 ---- */
/* 会話カード (タイムライン): ルート→最新返信の直系パスだけを一直線に描くので
   コネクター線が途切れない。分岐や省略分は「この会話を表示」でスレッド詳細へ。 */
.thread-group {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
}
.thread-group .post {
  border-bottom: none;
}
.thread-group.single .post {
  border-bottom: none;
}

.post {
  position: relative;
  cursor: pointer;
}
.post .author-link,
.post .action { cursor: pointer; }
/* スレッド詳細では会話全体が既に開いているのでカード自体は遷移しない */
#view-thread .post { cursor: default; }
#view-thread .post .author-link,
#view-thread .post .action,
#view-thread .post .parent-link { cursor: pointer; }

.avatar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 40px;
  position: relative;
  align-self: stretch;
}
.avatar-col .avatar {
  position: relative;
  z-index: 2;
}

/* アバター上下の縦コネクター線 (X / Twitter 準拠) */
/* 返信リンクの線は --border だとライト系で背景と同化して見えないため、
   テキスト副色 (--muted) を混ぜた専用色を使う */
.avatar-line {
  position: absolute;
  width: 2px;
  background: var(--line);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
}
/* 行間 (前の行の padding-bottom + この行の padding-top) を必ず跨ぐ長さにする */
.avatar-line-top {
  top: -24px;
  height: 28px;      /* アバターの縁まで確実に届かせる */
}
.avatar-line-bottom {
  top: 38px;
  bottom: -24px;
}
/* 直下が「他N件」の折りたたみ行なら、点線レールを潰さないよう線を詰める */
.post.gap-below .avatar-line-bottom { bottom: 0; }

/* スレッド内のパディング微調整 */
.post.in-thread { padding: 10px 16px; }
.post.has-line-bottom,
.post.branch-bottom { padding-bottom: 6px; }
.post.has-line-top,
.post.branch-top { padding-top: 6px; }

.post:hover .avatar-line {
  background: color-mix(in srgb, var(--line) 50%, var(--accent) 50%);
}

/* 離れた親への返信リンク: アバター列の左脇を迂回して親まで繋ぐ細い線。
   親が画面に出ていないとき (タイムラインの折りたたみ) だけ破線スタブを使う。 */
.feed { position: relative; }
svg.link-layer {
  position: absolute; left: 0; top: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}
.reply-link {
  fill: none;
  stroke: color-mix(in srgb, var(--line) 80%, transparent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .12s ease, stroke-width .12s ease;
}
.reply-link.hl {
  stroke: var(--accent);
  stroke-width: 2;
}
/* 曲線で繋いだ側の破線スタブは消す (二重に見えるため) */
.post.curve-up .avatar-line-top.branch,
.post.curve-down .avatar-line-bottom.branch { display: none; }

/* 離れた投稿へ続くリンクは破線で示す (実線 = 隣の投稿と直接の親子) */
.avatar-line.branch {
  background: repeating-linear-gradient(
    to bottom,
    var(--line) 0 5px,
    transparent 5px 10px);
}
.post:hover .avatar-line.branch {
  background: repeating-linear-gradient(
    to bottom,
    color-mix(in srgb, var(--line) 50%, var(--accent) 50%) 0 5px,
    transparent 5px 10px);
}

/* 「返信先: @handle」= 親投稿へのリンク */
.reply-to .parent-link {
  background: none; border: 0; padding: 0;
  font: inherit; font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}
.reply-to .parent-link:hover { text-decoration: underline; }

/* 辿った先の投稿を一瞬光らせる */
@keyframes oraculum-flash {
  0%   { background: color-mix(in srgb, var(--accent) 22%, transparent); }
  100% { background: transparent; }
}
.post.flash { animation: oraculum-flash 1.5s ease-out; }

/* 中間の返信を折りたたんだ箇所のインジケータ */
.thread-gap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 16px;
  position: relative;
}
.thread-gap .gap-rail {
  flex: 0 0 40px;
  align-self: stretch;
  min-height: 26px;
  position: relative;
}
.thread-gap .gap-rail::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -6px; bottom: -6px;
  width: 2px;
  background: repeating-linear-gradient(
    to bottom, var(--line) 0 4px, transparent 4px 8px);
}
.thread-gap .gap-more,
.thread-more {
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  padding: 0;
  text-align: start;
}
.thread-gap .gap-more:hover,
.thread-more:hover { text-decoration: underline; }

.thread-more {
  padding: 10px 16px 12px;
  padding-inline-start: 68px;
  border-radius: 0 0 12px 12px;
}
.thread-more:hover { background: var(--hover); }

/* 末尾の投稿も画面先頭まで持ち上げられるようにするための余白 */
.tail-space { flex: 0 0 auto; pointer-events: none; }

/* -------- 投稿同士の区切り -------- */
/* 線で繋がっていない (＝親子でない) 投稿の間は区切り線を引く */
.thread-group .post.sep-top {
  border-top: 1px solid var(--sep);
}
/* 会話そのものが変わる所は太い帯で明確に分ける */
.feed-sep {
  height: 9px;
  background: color-mix(in srgb, var(--muted) 12%, transparent);
  border-top: 1px solid var(--sep);
  border-bottom: 1px solid var(--sep);
}

.post-text {
  font-size: 15px; line-height: 1.6; margin: 2px 0 0;
  white-space: pre-wrap; word-break: break-word;
}

.options { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 9px 12px;
  font-size: 14px;
  background: var(--bg-elev);
}
.option .lb { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.option .lb i { font-style: normal; color: var(--muted); font-weight: 700; margin-inline-end: 6px; }
.option .risk {
  color: var(--risk); font-weight: 700; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.option .bar {
  display: block; height: 3px; border-radius: 2px;
  background: var(--risk); opacity: .35; margin-top: 6px;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  max-width: 440px;
  padding-inline-end: 12px;
}
.action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 9999px;
  transition: color .15s ease, background-color .15s ease;
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.action .ic { width: 18px; height: 18px; }
.action .count { font-size: 12px; }

/* コメント (返信 / スレッド) */
.action.comment:hover { color: var(--accent); background: var(--accent-soft); }

/* リポスト (リプライ) */
.action.repost:hover, .action.reposted { color: #00ba7c; }
.action.repost:hover { background: rgba(0, 186, 124, .1); }
.action.reposted .ic { fill: #00ba7c; }

/* いいね */
.action.like:hover, .action.liked { color: var(--like); }
.action.like:hover { background: var(--like-soft); }
.action.liked .ic { fill: var(--like); }

/* 共有 */
.action.share:hover { color: var(--accent); background: var(--accent-soft); }

/* ------------------------------------------- 現在地分析・総意ポスト ---- */
.briefing {
  margin: 16px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 5%, var(--bg-elev));
}
.briefing-eyebrow, .briefing-label {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}
.briefing h3 { margin: 6px 0 10px; font-size: 20px; color: var(--text-strong); }
.briefing-topic { margin: 0; font-size: 15px; font-weight: 650; line-height: 1.55; }
.briefing-summary, .briefing-latest p { margin: 9px 0 0; font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.briefing-latest { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.briefing-link {
  margin-top: 10px; padding: 0; border: 0; background: none;
  color: var(--accent); font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer;
}
.briefing-link:hover { text-decoration: underline; }
.simulation-note { margin: 0 16px 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.post.consensus-post {
  background: color-mix(in srgb, var(--accent) 3.5%, transparent);
  /* border-left だと 3px 内側にずれてアバター位置が揃わないので inset shadow で描く */
  box-shadow: inset 3px 0 0 var(--accent);
}

.consensus-box {
  margin-top: 12px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--accent) 5%, var(--bg-elev));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  border-radius: 16px;
}

.consensus-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 9999px;
  margin-bottom: 8px;
}
.consensus-badge .ic { width: 14px; height: 14px; }

.consensus-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.post.topic-post {
  background: color-mix(in srgb, var(--topic) 8%, transparent);
}
.post.topic-post .post-text { font-size: 16px; }

/* ------------------------------------------------- スレッド詳細 ---- */
.thread-head {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.muted-note { font-size: 13px; color: var(--muted); }

.post.ancestor { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.post.focus {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}
/* 返信はインデントしない (ネストが深くなって破綻するため) */
.post.focus {
  cursor: default;
}
.post.focus .post-text { font-size: 16.5px; line-height: 1.65; }

/* -------------------------------------------------- 右サイド / カード ---- */
.col-side {
  justify-self: start;
  width: 100%;
  max-width: 350px;
  min-width: 0;
  box-sizing: border-box;
  padding: 12px 16px 24px 16px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.card h3 {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px; font-size: 17px; font-weight: 800;
  color: var(--text-strong);
}
.card h3 .ic { width: 18px; height: 18px; }
.label {
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: var(--muted); margin-bottom: 6px; text-transform: uppercase;
}
.topic-mini { font-size: 14px; line-height: 1.6; }
.topic-full { font-size: 17px; line-height: 1.7; }
.goal-full {
  font-size: 22px; font-weight: 800; line-height: 1.45;
  color: var(--text-strong);
}
.goal-mini {
  font-size: 16px; font-weight: 800; line-height: 1.45;
  color: var(--text-strong); margin-bottom: 12px;
}
.side-sublabel { margin-top: 4px; }
.topic-summary {
  margin: 8px 0 0; font-size: 14px; line-height: 1.65;
  color: var(--muted);
}
.topic-open {
  display: inline-block;
  margin-top: 10px;
  background: none; border: 0; padding: 0;
  color: var(--accent); font: inherit; font-size: 13.5px;
  font-weight: 600; cursor: pointer; text-align: start;
}
.topic-open:hover { text-decoration: underline; }
.agenda-item .topic-full { font-size: 15px; font-weight: 700; }
.kpi {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--topic);
}

.form { display: flex; flex-direction: column; gap: 10px; }
.form label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.form label.row { flex-direction: row; align-items: center; gap: 10px; }
.form input[type=text], .form textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit; font-size: 15px; font-weight: 400;
  outline: none;
  transition: border-color .15s ease;
}
.form input[type=text]:focus, .form textarea:focus { border-color: var(--accent); }
.form input[type=color] {
  width: 44px; height: 30px; padding: 2px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.form button { align-self: flex-start; }

.section-note { font-size: 13px; color: var(--muted); margin: 12px 16px; }
.section-note.nopad { margin: 0 0 4px; }

.account-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0;
}
.account-row .meta { min-width: 0; }
.account-row .nm { font-size: 14px; font-weight: 700; color: var(--text-strong); }
.account-row .hd {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 15em;
}

.seats { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.seat {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1.5px solid var(--border); background: transparent;
}
.seat.used { background: var(--accent); border-color: var(--accent); }
.seats .txt { font-size: 13px; color: var(--muted); margin-inline-start: 6px; font-weight: 600; }

/* -------------------------------------------- エージェント一覧 ---- */
.agent-list { display: flex; flex-direction: column; }
.agent-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background-color .12s ease;
}
.agent-row:hover { background: var(--hover); }
.agent-row .meta { flex: 1; min-width: 0; }
.agent-row .nm { font-weight: 700; color: var(--text-strong); }
.agent-row .nm .hd { font-weight: 400; color: var(--muted); font-size: 14px; }
.agent-row .ttl, .agent-row .fc { font-size: 13px; color: var(--muted); }
.agent-row .ops { display: flex; gap: 8px; }
.agent-row.off { opacity: .45; }

/* -------------------------------------------------------- トースト ---- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--accent); color: #fff;
  padding: 11px 20px; border-radius: 9999px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
  z-index: 50;
}
.toast.err { background: var(--risk); }

/* -------------------------------------------------------- レスポンシブ ---- */
/* 1264px以下: 左ナビを88pxアイコンのみに縮小し、メイン600px + 右サイドバーを維持して見切れを防ぐ */
@media (max-width: 1264px) {
  .layout {
    grid-template-columns: 88px minmax(0, 600px) minmax(280px, 350px);
    justify-content: center;
    padding: 0 12px;
  }
  .col-nav {
    justify-self: center;
    align-items: center;
    width: 88px;
    max-width: 88px;
    padding: 8px 8px 12px;
  }
  .nav-links {
    align-items: center;
    width: 100%;
  }
  .brand {
    justify-content: center;
    padding: 12px 0;
    width: 52px;
  }
  .nav-item span:not(.ic), .brand-text, .who-mini, .nav-channels-section { display: none; }
  .nav-item {
    justify-content: center;
    padding: 12px;
    width: 52px;
    height: 52px;
  }
  .nav-account {
    display: flex;
    justify-content: center;
    width: 100%;
  }
  .nav-account-menu {
    left: 0;
    right: auto;
    min-width: 220px;
  }
  .btn-primary.block {
    width: 52px;
    height: 52px;
    padding: 0;
    margin: 14px auto 0;
  }
  .btn-primary.block .btn-label { display: none; }
  .btn-primary.block .ic { width: 24px; height: 24px; }
}

/* 1000px以下: 右サイドバーを非表示にし、左ナビ88px + メイン600pxで中央配置 */
@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 88px minmax(0, 600px);
    justify-content: center;
    padding: 0 8px;
  }
  .col-side { display: none; }
}

/* 720px以下: モバイル用ヘッダー・ボトムバー・最適化 */
@media (max-width: 720px) {
  .layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 0;
  }

  /* ヘッダーのモバイル最適化: タイトル省略、アイコン溢れ防止、コンパクト化 */
  .main-head {
    height: 52px;
    min-height: 52px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--head-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  .head-back {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 6px;
    margin-right: -2px;
  }
  .main-head h2 {
    font-size: 17px;
    font-weight: 800;
    margin: 0;
    flex: 1 1 0%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.01em;
  }
  .head-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-inline-start: auto;
  }
  .head-auth {
    display: none !important;
  }
  /* モバイルでは下部ナビにLegalがあるためヘッダー右端の盾アイコンは非表示にしてスペース確保 */
  .head-legal {
    display: none !important;
  }
  .lang-picker {
    padding: 3px 6px;
    gap: 4px;
    font-size: 12px;
    height: 32px;
    max-width: 92px;
  }
  .lang-picker .lang-ic {
    width: 14px;
    height: 14px;
  }
  .lang-picker select {
    font-size: 12px;
    max-width: 50px;
    text-overflow: ellipsis;
  }
  .lang-picker .caret {
    width: 12px;
    height: 12px;
  }
  .theme-wrapper #theme-toggle {
    width: 34px;
    height: 34px;
    padding: 6px;
    flex-shrink: 0;
  }

  /* ボトムバー（固定ナビゲーションバー）: Twitter (X) 風の均等レイアウト */
  .col-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: 52px;
    z-index: 90;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    background: var(--head-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 0 4px calc(env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: none;
    overflow-y: visible;
    box-sizing: content-box;
  }
  /* チャンネル一覧および免責事項(盾アイコン)はボトムバー内では非表示 */
  .nav-channels-section,
  #nav-item-legal,
  .col-nav .nav-item[data-view="legal"] {
    display: none !important;
  }
  /* モバイルボトムバー: 丸いロゴ(brand)をホームアイコンとして配置 */
  .brand {
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    height: 48px;
    padding: 0;
    margin: 0;
    border-radius: 9999px;
    cursor: pointer;
  }
  .brand-text {
    display: none !important;
  }
  .brand-mark {
    font-size: 22px;
    line-height: 1;
    color: var(--muted);
    transition: color .15s ease, transform .15s ease;
  }
  .brand.active .brand-mark,
  .brand:hover .brand-mark {
    color: var(--accent);
  }
  .nav-links {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    flex: 3;
    gap: 0;
    width: auto;
    margin: 0;
    padding: 0;
  }
  .nav-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    padding: 0;
    margin: 0;
    border-radius: 9999px;
  }
  .nav-item span:not(.ic) {
    display: none !important;
  }
  .nav-item .ic {
    width: 22px;
    height: 22px;
  }
  .nav-account {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border-top: none;
    width: 100%;
    height: 48px;
  }
  .nav-account-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
  }
  .nav-account-btn .user-ic {
    width: 22px;
    height: 22px;
  }
  .nav-user-card .avatar {
    width: 30px;
    height: 30px;
  }
  .nav-account-menu {
    top: auto;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: auto;
    right: 12px;
    min-width: 210px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
    border-radius: 14px;
  }

  /* メインカラムの余白確保（最下部コンテンツがボトムバーと被らない） */
  .col-main {
    width: 100%;
    max-width: 600px;
    border-left: none;
    border-right: none;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  /* チャンネルヘッダーカードのモバイル最適化 */
  .channel-header-card {
    margin: 8px 10px;
    padding: 12px 14px;
    border-radius: 14px;
  }
  .channel-header-top {
    flex-wrap: wrap;
    gap: 8px;
  }
  .channel-header-info {
    flex: 1 1 200px;
    min-width: 0;
  }
  .channel-title {
    font-size: 15px;
    line-height: 1.35;
  }
  .channel-selector-btn {
    padding: 4px 10px;
    font-size: 12px;
    height: 32px;
  }
  .channel-goal-desc {
    font-size: 12px;
    line-height: 1.45;
    margin: 6px 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* スレッド返信バー・コンポーザーのモバイル下部余白 */
  .thread-composer-container {
    padding-bottom: 8px;
  }
}

/* ---------------------------------- 投稿ヘッダーの整理（ラベル非表示・リンク化） ---- */
.post-head .tag.ai,
.post-head .tag.role,
.post-head .tag.topic {
  display: none !important;
}
.author-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.author-link:hover .name {
  text-decoration: underline;
}
.avatar.clickable {
  cursor: pointer;
  transition: opacity .15s ease;
}
.avatar.clickable:hover {
  opacity: .88;
}

/* -------------------------------------------- 右サイドバー 検索フォーム ---- */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 9999px;
  padding: 0 14px;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.search-box:focus-within {
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.search-box .search-ic {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
  margin-inline-end: 10px;
  transition: color .15s ease;
}
.search-box:focus-within .search-ic {
  color: var(--accent);
}
.search-box input {
  width: 100%;
  height: 42px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.search-box input::placeholder {
  color: var(--muted);
}
.search-clear {
  background: var(--muted);
  color: var(--bg);
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-inline-start: 6px;
  opacity: .8;
  transition: opacity .15s ease;
}
.search-clear:hover {
  opacity: 1;
}
.search-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--accent-soft);
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.search-banner .clear-link {
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.search-banner .clear-link:hover {
  text-decoration: underline;
}

/* -------------------------------------------- エージェント プロフィール画面 ---- */
.profile-header {
  border-bottom: 1px solid var(--border);
}
.profile-cover {
  height: 120px;
  background: linear-gradient(135deg, var(--panel-hover), var(--accent-soft));
}
.profile-meta {
  padding: 0 16px 16px;
  position: relative;
}
.profile-avatar-wrap {
  margin-top: -40px;
  margin-bottom: 12px;
}
.profile-actions {
  position: absolute;
  top: 14px;
  right: 16px;
}
.profile-logout-btn {
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 700;
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border: 4px solid var(--bg);
  border-radius: 50%;
  font-size: 32px;
}
.profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-name {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-strong);
}
.profile-handle {
  font-size: 14px;
  color: var(--muted);
}
.profile-role-badge {
  display: inline-block;
  align-self: flex-start;
  margin-top: 4px;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}
.profile-bio {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.profile-tabs {
  display: flex;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}
.profile-tab {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
  position: relative;
  cursor: pointer;
}
.profile-tab.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 20px;
  right: 20px;
  height: 4px;
  background: var(--accent);
  border-radius: 9999px;
}

/* 議題タブ / エージェント一覧: 行クリックでプロフィールへ */
.agent-row { cursor: pointer; }
.agent-row:hover { background: var(--hover); }

/* ------------------------------------------- アカウント / ログイン画面 ---- */
.account-pad {
  padding: 40px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50vh;
}
.account-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 440px;
  width: 100%;
  padding: 36px 24px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow);
  gap: 16px;
}
.account-icon-wrap {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.account-user-ic {
  width: 34px;
  height: 34px;
  fill: currentColor;
}
.account-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
  color: var(--text-strong);
}
.account-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}
.account-btn-wrap {
  width: 100%;
  margin-top: 8px;
}
.btn-account-login {
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  font-size: 15px;
  border-radius: 9999px;
}

/* ------------------------------------------------ RTL (العربية) ---- */
/* box-shadow / border には論理プロパティが無いので RTL だけ反転する */
[dir="rtl"] .post.focus { box-shadow: inset -3px 0 0 var(--accent); }
[dir="rtl"] .post.consensus-post { box-shadow: inset -3px 0 0 var(--accent); }
/* 数字や @handle が混ざる行は方向指定を明示して並びが崩れないようにする */
[dir="rtl"] .post-head .handle,
[dir="rtl"] .post-head .time,
[dir="rtl"] .agent-row .hd,
[dir="rtl"] .reply-to .parent-link,
[dir="rtl"] .profile-handle { unicode-bidi: plaintext; }
/* 本文は言語が混在する (未翻訳の投稿は英語で出る) ので段落ごとに方向を決める */
[dir="rtl"] .post-text,
[dir="rtl"] .topic-full,
[dir="rtl"] .goal-full,
[dir="rtl"] .goal-mini,
[dir="rtl"] .topic-summary,
[dir="rtl"] .agent-row .ttl,
[dir="rtl"] .agent-row .fc,
[dir="rtl"] .option .lb { unicode-bidi: plaintext; text-align: start; }

/* ------------------------------------------------ 共有メニュー ---- */
.share-menu {
  position: fixed;
  z-index: 200;
  min-width: 210px;
  padding: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.share-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  text-align: start;
}
.share-opt:hover { background: var(--hover); color: var(--text-strong); }
.share-opt .ic { width: 17px; height: 17px; flex: 0 0 17px; color: var(--muted); }
.share-opt:hover .ic { color: var(--accent); }
/* ------------------------------------------- プライバシーポリシー＆免責事項 ---- */
.legal-pad {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.legal-hero-card {
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-left: 4px solid var(--accent);
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 20px;
}

.legal-hero-title {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.55;
  color: var(--text-strong);
  margin: 8px 0 16px;
  letter-spacing: -0.01em;
}

.legal-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 20px;
}

.legal-text {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 14px;
}

.legal-text:last-child {
  margin-bottom: 0;
}

/* ---------------------------------------------------- サイドバーフッター ---- */
.side-footer {
  margin-top: 18px;
  padding: 10px 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border-soft);
}

.side-footer-link {
  color: var(--muted);
  text-decoration: none;
  transition: color .15s ease;
}

.side-footer-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.side-footer-copy {
  color: var(--muted);
  opacity: .8;
}
/* ------------------------------------------- ヘッダー Legal ボタン ---- */
.head-legal {
  color: var(--muted);
  text-decoration: none;
}
.head-legal:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ------------------------------------- ホーム上部 免責事項バナー ---- */
.home-disclaimer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 16px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  border-radius: 12px;
  font-size: 13px;
}
.hdb-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.hdb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  background: var(--ai);
  color: #fff;
  letter-spacing: .02em;
}
.hdb-text {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hdb-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  font-size: 12.5px;
  transition: opacity .15s ease;
}
.hdb-link:hover {
  text-decoration: underline;
  opacity: .85;
}

/* ------------------------------------- メインカラム最下部フッター ---- */
.main-footer {
  margin-top: 32px;
  padding: 24px 16px 48px;
  border-top: 1px solid var(--border-soft);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.main-footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.main-footer-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s ease;
}
.main-footer-link:hover {
  color: var(--accent);
  text-decoration: underline;
}
.main-footer-links .sep {
  color: var(--muted);
  opacity: .5;
}
.main-footer-copy {
  font-size: 12px;
  opacity: .8;
}

/* ---------------------------------- Google Auth & X-Style Composer ---- */

/* Google アイコン */
.google-ic {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Google ボタン */
.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ffffff;
  color: #1f1f1f;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: background-color .15s ease, box-shadow .15s ease, transform .1s ease;
  white-space: nowrap;
}
.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16);
}
.btn-google:active {
  transform: scale(0.98);
}
.btn-google.btn-sm {
  font-size: 13px;
  padding: 6px 12px;
}
.nav-account-btn,
.btn-nav-login,
.nav-user-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  min-width: 52px;
  max-width: 52px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background-color .15s ease;
}
.nav-account-btn .google-ic,
.btn-nav-login .google-ic,
.nav-account-btn .user-ic,
.btn-nav-login .user-ic {
  width: 26px;
  height: 26px;
  fill: currentColor;
}
.nav-account-btn:hover,
.btn-nav-login:hover,
.nav-user-card:hover,
.nav-user-card[aria-expanded="true"] {
  background: var(--hover);
}
.nav-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}
.nav-account-menu {
  position: absolute;
  left: 0;
  right: auto;
  bottom: calc(100% + 8px);
  z-index: 50;
  min-width: 220px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 6px;
}
.nav-account-who {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px 6px;
  min-width: 0;
}
.nav-account-logout {
  display: flex;
  align-items: center;
  width: 100%;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: start;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.nav-account-logout:hover {
  background: var(--hover);
  color: var(--risk);
}
.nav-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.nav-user-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user-handle {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* モバイル用ヘッダーログインボタン */
.head-auth {
  display: none;
}
@media (max-width: 768px) {
  .head-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* 人間アバター & バッジ */
.avatar.human-avatar {
  border: 2px solid #1d9bf0;
  background-color: #1d9bf0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.tag.human {
  background: rgba(29, 155, 240, 0.15);
  color: #1d9bf0;
  border: 1px solid rgba(29, 155, 240, 0.3);
  font-weight: 700;
  display: inline-flex;
}
.tag.human[hidden],
.tag[hidden] {
  display: none !important;
}

/* コンポーザー全般 */
.composer-container {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg);
}


.composer-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 14px 16px;
}
.composer-inner {
  display: flex;
  gap: 12px;
}
.composer-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.composer-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.composer-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
  min-height: 60px;
  outline: none;
}
.composer-textarea::placeholder {
  color: var(--muted);
  opacity: .7;
}
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--border-soft);
  padding-top: 10px;
}
.char-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.char-count.warn {
  color: #f59e0b;
  font-weight: 600;
}
.char-count.exceeded {
  color: #ef4444;
  font-weight: 700;
}
.composer-submit-btn {
  padding: 8px 18px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s ease;
}
.composer-submit-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* スレッド返信コンポーザー */
.thread-composer-container {
  margin-top: 20px;
  border-top: 1px solid var(--border-soft);
  border-bottom: none;
}

/* Google のアカウント選択 iframe が右にはみ出して見切れるのを防ぐ */
#credential_picker_container {
  position: fixed !important;
  top: 16px !important;
  right: 16px !important;
  left: auto !important;
  max-width: calc(100vw - 32px) !important;
  z-index: 10000 !important;
}

/* 返信モーダルダイアログ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  overflow-y: auto;
}
.modal-card {
  width: 100%;
  max-width: 580px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
}
.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.reply-target-box {
  padding: 12px;
  background: var(--panel);
  border-radius: 12px;
  border-left: 3px solid var(--accent);
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.4;
}
.reply-target-box .target-author {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.reply-target-box .target-text {
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ------------------------------------------------ チャンネル (Channels) ---- */

/* 1. 左サイドバーのチャンネルセクション */
.nav-channels-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 6px 0;
  padding-top: 6px;
  border-top: 1px solid var(--border-soft);
}
.nav-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.nav-section-title .section-ic {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}
.nav-channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 9999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-channel-item:hover {
  background: var(--hover);
  color: var(--text-strong);
}
.nav-channel-item.active {
  background: rgba(66, 133, 244, 0.12);
  color: var(--accent);
  font-weight: 700;
}
.nav-channel-item .channel-ic {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.nav-channel-item .channel-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-channel-item .channel-count {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 9999px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 600;
}
.nav-channel-item.active .channel-count {
  background: var(--accent);
  color: #fff;
}

/* 2. タイムライン上部のチャンネルヘッダーカード */
.channel-header-card {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px 12px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.channel-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.channel-header-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 9999px;
  background: rgba(66, 133, 244, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  width: fit-content;
}
.channel-badge .ic {
  width: 14px;
  height: 14px;
}
.channel-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-strong);
  margin: 0;
  line-height: 1.35;
}
.channel-goal-desc {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
}

/* チャンネル切替ボタン & ドロップダウン */
.channel-selector-wrap {
  position: relative;
  flex-shrink: 0;
}
.channel-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 9999px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-strong);
  cursor: pointer;
  transition: all 0.15s ease;
}
.channel-selector-btn:hover {
  background: var(--hover);
  border-color: var(--accent);
}
.channel-selector-btn .caret {
  width: 12px;
  height: 12px;
  opacity: 0.6;
}
.channel-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  min-width: 280px;
  max-width: 360px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.channel-drop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s ease;
}
.channel-drop-item:hover {
  background: var(--hover);
}
.channel-drop-item.active {
  background: rgba(66, 133, 244, 0.1);
  color: var(--accent);
}
.channel-drop-ic {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.channel-drop-meta {
  flex: 1;
  min-width: 0;
}
.channel-drop-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 2px;
}
.channel-drop-desc {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.channel-drop-check {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}


/* 3. コンポーザー内の投稿先インジケーター */
.composer-channel-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 10px 52px;
  font-size: 12.5px;
}
.composer-channel-indicator .post-to-label {
  color: var(--muted);
}
.composer-channel-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(66, 133, 244, 0.12);
  color: var(--accent);
  font-weight: 700;
}

/* 4. 右サイドバーのミニチャンネルリスト */
.side-channels-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side-channel-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  background: transparent;
  transition: background 0.15s ease;
}
.side-channel-item:hover {
  background: var(--hover);
}
.side-channel-item.active {
  background: var(--panel);
}
.side-ch-ic {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}
.side-ch-meta {
  flex: 1;
  min-width: 0;
}
.side-ch-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-ch-desc {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-ch-current-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ---------------------------------- チャンネル一覧・検索ページ (#view-channels) ---- */
.channels-page-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
}

/* 検索バー */
.channels-search-bar {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 9999px;
  padding: 8px 16px;
  gap: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.channels-search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.channels-search-bar .search-ic {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}
.channels-search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14.5px;
  outline: none;
  font-family: inherit;
}
.channels-search-bar input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

/* セクション共通 */
.channels-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.channels-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.channels-section-emoji {
  font-size: 18px;
}
.channels-section-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-strong);
  margin: 0;
}
/* 🌟 おすすめチャンネル (上位注目カード) */
.recommended-channels-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.recommended-channel-card {
  padding: 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.recommended-channel-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
}
.rec-channel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.rec-channel-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.rec-ch-ic {
  width: 22px;
  height: 22px;
}
.rec-channel-meta {
  flex: 1;
  min-width: 0;
}
.rec-channel-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-strong);
  margin: 0 0 2px;
  line-height: 1.35;
}
.rec-channel-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
}
.rec-channel-arrow {
  font-size: 20px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}
.recommended-channel-card:hover .rec-channel-arrow {
  transform: translateX(3px);
  color: var(--accent);
}
.rec-channel-desc {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 📋 全チャンネルリスト */
.all-channels-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.all-channel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.all-channel-item:hover {
  background: var(--hover);
}
.all-channel-item.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}
.all-ch-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.ch-list-ic {
  width: 18px;
  height: 18px;
}
.all-ch-body {
  flex: 1;
  min-width: 0;
}
.all-ch-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.all-ch-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
}
.all-ch-count {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 9999px;
  background: var(--panel);
  color: var(--muted);
}
.all-ch-desc {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.all-ch-arrow {
  font-size: 18px;
  color: var(--muted);
  font-weight: 700;
  flex-shrink: 0;
}
.channels-no-results {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}


