body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; margin: 16px; }
header { display:flex; gap:8px; align-items:center; margin-bottom:12px; flex-wrap: wrap; }
.hidden { display:none; }
.post { border:1px solid #ddd; border-radius:12px; padding:12px; margin:10px 0; background:#fff; }
.post-text { white-space:pre-wrap; word-break:break-word; }
.post-actions { display:flex; align-items:center; gap:8px; margin-top:8px; }
.post-actions .spacer { flex:1; }
.post-actions button.active { font-weight:700; }
#replyBanner { font-size:12px; color:#333; background:#f5f5f5; border:1px solid #ddd; border-radius:8px; padding:6px 8px; margin-bottom:6px; display:flex; gap:8px; align-items:center; }
#replyBanner a { text-decoration: underline; }
#replyBanner button { border:none; background:transparent; cursor:pointer; font-size:14px; }
#replyBanner.hidden { display: none; }

/* Repost 引用ブロックの余白を詰める */
.post blockquote { margin: 0; padding: 4px 8px; }  /* ブラウザ既定の上下余白をリセット */
.post blockquote .post-text { margin: 0; }         /* 内部のdivにも余白を付けない */
.post .post-text { line-height: 1.35; }            /* 必要なら行間を少し詰める（任意） */

/* Repost内の元投稿を中央寄せ＆左右余白を広く */
blockquote.post-text {
  margin-left: 2em;
  margin-right: 2em;
  padding-left: 1em;
  padding-right: 1em;
}

/* ===== Detail Modal ===== */
.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; z-index: 1000; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.modal-content {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(680px, 92vw); max-height: 90vh; overflow: auto;
  background: #fff; border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  padding: 16px 20px;
}
.modal-close {
  position: absolute; right: 8px; top: 8px; border: none; background: transparent; font-size: 20px; cursor: pointer;
}

#media-modal-content img,
#media-modal-content video {
  max-width: 100%;
  max-height: 78vh;
  display: block;
  margin: 0 auto;
}

.detail-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.detail-avatar {
  width: 56px; height: 56px; border-radius: 50%; background: #eee;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  overflow: hidden;
}
.detail-avatar img { width: 100%; height: 100%; object-fit: cover; }
.detail-name { font-weight: 600; }
.detail-sub { color: #666; font-size: 12px; }

.detail-body { margin: 8px 0 12px; }
/* 引用は少し内側に */
.detail-body blockquote { margin: 0 1.5em; padding: 4px 8px; border-left: 3px solid #ddd; }

.quote-label {
  margin-left: 8px;
  font-size: 0.9em;
  color: #888;
}

.quote-header {
  font-size: 0.8em;
  font-weight: bold;
  margin-bottom: 4px;
  color: #666;
}

/* === tighten spacing for embedded cards === */
.post .quote-card {
  padding: 5px 10px;            /* 枠自体の左右もさらに詰める（必要に応じて 2px 3px でもOK） */
}

.quote-card blockquote.post-text {
  margin: 0 !important;        /* 2em マージンを無効化 */
  padding: 0 !important;       /* 1em パディングを無効化 */
  border-left: none !important;/* モーダル用の左ボーダーも出ないように */
}

.quote-card .post-text {        /* 内側の div も余白ゼロで揃える */
  margin: 0;
}

/* 引用元を囲う枠の外側余白 */
.quote-card {
  margin: 12px 24px;   /* ← 上下6px, 左右12px の余白 */
  padding: 6px 8px;   /* ← 内側はお好みで */
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.post-meta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px !important;
  line-height: 20px;
  padding: 2px 8px;
  margin-left: 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fafafa;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, border-color 0.2s;
}

.post-meta-badge:hover {
  background: rgba(0,0,0,0.08);
  border-color: #999;
}

/* === Reply banner one-line ellipsis === */
#replyBanner { display: flex; align-items: center; gap: 8px; }
#replyBanner a { display: inline-block; max-width: calc(100% - 90px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === Quote banner (引用元プレビュー) === */
#quoteBanner {
  font-size:12px; color:#333; background:#f5f5f5; border:1px solid #ddd;
  border-radius:8px; padding:6px 8px; margin-bottom:6px;
  display:flex; gap:8px; align-items:center;
}
#quoteBanner a { text-decoration: underline; }
#quoteBanner button { border:none; background:transparent; cursor:pointer; font-size:14px; }
#quoteBanner.hidden { display:none; }

/* 1行省略（返信と同じ要領） */
#quoteBanner a {
  display:inline-block;
  max-width: calc(100% - 90px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

/* === Highlight replies to me === */
.post.reply-to-me .post-head { background: #fff6d6; border-radius: 8px; padding: 2px 6px; }

.post-actions button {
  width: 40px;
  height: 24px;
  line-height: 24px;
  font-size: 12px;     /* アイコンの見栄え */
  text-align: center;
  border: 1px solid #ccc;
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin: 0 3px;
  border-radius: 6px;  /* 丸み */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.post-actions button:hover {
  background: rgba(0,0,0,0.12);
  border-color: #999;
}

/* 投稿1行（🚪・textarea・右ボタン群）を並べる */
.composerRow {
  display: flex;
  align-items: stretch;  /* ← 子要素の高さを自動で揃える */
  gap: 8px;
}

/* NIP-07ログインボタン */
#loginNip07 {
  width: 70px;      /* ← 投稿欄の高さに合わせて固定 */
  height: 70px;     /* ← 正方形 */
  font-size: 40px;       /* ← 絵文字サイズ */
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 6px;    /* ← 角丸6px */
  background: #fff;
  transition: background 0.2s, border-color 0.2s;
  display: flex;         /* 中央寄せ */
  align-items: center;
  justify-content: center;
}
#loginNip07:hover {
  background: rgba(0,0,0,0.08);
  border-color: #999;
}

/* ログイン後はアイコン化 */
#loginNip07.logged-in {
  pointer-events: none;       /* クリック不能化（見た目はそのまま） */
  border-color: #ccc;
  background: #fff;
  padding: 0;                 /* 中のimgをピッタリに */
}

/* 中に img を入れてフルフィット */
#loginNip07.logged-in img {
  width: 100%;
  height: 100%;
  object-fit: cover;          /* 余白なしに切り抜き */
  border-radius: 6px;         /* ボタンの角丸と一致 */
  display: block;
}

/* 画像が無い場合のイニシャル表示用 */
#loginNip07.logged-in .avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  background: linear-gradient(135deg, #7aa0ff, #9cd2ff);
}

/* 入力欄は広く */
#note {
  flex: 1;
  resize: none; /* 必要なら縦方向リサイズ可能 */
  min-height: 0; /* flex 子の縮み制御の保険 */
  font-size: 16px;
  line-height: 1.2; /* 見やすさ向上用（任意） */
  height: var(--composer-h);     /* ← ここでボタンと同じ高さに固定 */
  padding: 2px 4px;   /* 文字が詰まるようなら 6～8px に微調整 */
  box-sizing: border-box;
  overflow-y: auto;     /* 入力が多い時は中でスクロール */
}

/* ボタンを縦に並べる */
#postButtons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: space-between; /* ← ボタン群を上下に均等配置 */

}
#postButtons button {
  width: 48px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 6px;   /* ← 角丸 */
  background: #fff;
  transition: background 0.2s, border-color 0.2s;
}

#postButtons button:hover {
  background: rgba(0,0,0,0.08);
  border-color: #999;
}

/* ログイン系の一部UIを非表示にする */
#nsec,
#load,
#setFav,
#whoami {
  display: none !important;
}

/* ==== post-head（統一版） ==== */
.post-head,
.post .post-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}
.post-head span:last-child {
  font-size: 0.8em;
  color: #666;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ==== quote-card（統合版） ==== */
.quote-card {
  margin: 12px 24px;
  padding: 6px 8px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 6px;
}
.post .quote-card { padding: 5px 10px; }
.quote-card blockquote.post-text {
  margin: 0 !important;
  padding: 0 !important;
  border-left: none !important;
}
.quote-card .post-text { margin: 0; }

/* iOSのフォーカス時拡大を防ぐ：入力系は最低16px */
input, textarea, select {
  font-size: 16px;
}
