/*
 * public/css/talk.css — ふだんのメッセージ
 * ★ 既読は人数だけ。誰が読んだかは出さない (docs/PRINCIPLES.md 原則2)。
 */
.talk { max-width: 42rem; margin: 0 auto; padding: var(--sp-3) var(--sp-3) 7rem; }
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }

.msg { display: flex; gap: var(--sp-2); align-items: flex-end; }
.msg__avatar {
  flex: 0 0 auto;
  width: 2.4rem; height: 2.4rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--c-surface);
  box-shadow: var(--shadow-1); font-size: 1.2rem;
}
.msg__col { min-width: 0; max-width: 78%; }
.msg__name { font-size: var(--fs-caption); color: var(--c-ink-weak); margin-bottom: 2px; }
.msg__bubble {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 6px;
  background: var(--c-surface);
  box-shadow: var(--shadow-1);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.msg__foot { display: flex; gap: var(--sp-2); font-size: var(--fs-caption); color: var(--c-ink-weak); margin-top: 2px; }

/* 自分の書き込みは右に寄せて色を変える。 */
.msg--mine { flex-direction: row-reverse; }
.msg--mine .msg__col { margin-left: auto; }
.msg--mine .msg__bubble {
  background: var(--grad-accent);
  color: #fff;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: 6px;
}
.msg--mine .msg__name { text-align: right; }
.msg--mine .msg__foot { flex-direction: row-reverse; }

/* 日付の区切り。★ 24時間表記に曜日を必ず付ける。
   午前/午後の表記は親世代の読み違いの元になる。 */
.daysep { align-self: center; padding: 2px 12px; border-radius: 999px;
  background: var(--c-accent-soft); color: #06526b;
  font-size: var(--fs-caption); font-weight: 700; }

/* ここから未読 */
.unreadsep { display: flex; align-items: center; gap: var(--sp-2); color: var(--c-urgent);
  font-size: var(--fs-caption); font-weight: 700; }
.unreadsep::before, .unreadsep::after { content: ''; flex: 1; height: 2px; background: currentColor; opacity: 0.4; }

.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; gap: var(--sp-2); align-items: flex-end;
  padding: var(--sp-2) var(--sp-3) calc(var(--sp-2) + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  box-shadow: 0 -2px 16px rgba(15, 36, 48, 0.10);
}
.composer textarea {
  flex: 1; min-height: var(--tap-min); max-height: 8rem;
  padding: var(--sp-2) var(--sp-3);
  border: 2px solid var(--c-line); border-radius: var(--radius-lg);
  font: inherit; font-size: var(--fs-body); resize: none;
}
.composer textarea:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 1px; }
.composer__send {
  flex: 0 0 auto; width: var(--tap-min); height: var(--tap-min);
  border: 0; border-radius: 999px; background: var(--grad-accent);
  color: #fff; font-size: 1.4rem; cursor: pointer;
  box-shadow: var(--shadow-1); transition: transform 60ms ease-out;
  touch-action: manipulation;
}
.composer__send:active:not(:disabled) { transform: scale(0.92); }
.composer__send:disabled { opacity: 0.45; }

/* --- 部屋の一覧 ----------------------------------------------------------- */
.rooms { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.roomcard {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-lg);
  background: var(--c-surface);
  box-shadow: var(--shadow-1);
  color: var(--c-ink);
  text-decoration: none;
  min-height: var(--tap-min);
  transition: transform 60ms ease-out;
  touch-action: manipulation;
}
.roomcard:active { transform: scale(0.985); }
.roomcard__body { flex: 1; min-width: 0; }
.roomcard__name { font-weight: 800; color: var(--c-accent); }
.roomcard__last {
  font-size: var(--fs-caption); color: var(--c-ink-weak);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 未読の数。★ 誰が読んでいないかは出さない。数だけ。 */
.roomcard__unread {
  flex: 0 0 auto;
  min-width: 1.9rem; height: 1.9rem;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--c-urgent); color: #fff;
  font-size: var(--fs-caption); font-weight: 800;
}

.roomhead {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  margin-bottom: var(--sp-3); padding: var(--sp-3);
  border-radius: var(--radius-lg);
  background: var(--c-accent-soft);
}
.roomhead__name { font-weight: 800; color: #06526b; flex: 1; }

/* --- スレッド ------------------------------------------------------------- */
.msg__replies {
  margin-top: 4px;
  padding: 4px 10px;
  border: 0; border-radius: 999px;
  background: var(--c-accent-soft); color: #06526b;
  font: inherit; font-size: var(--fs-caption); font-weight: 700;
  cursor: pointer; min-height: 36px;
  touch-action: manipulation;
}
.msg--mine .msg__replies { margin-left: auto; display: block; }
.threadhead {
  align-self: stretch; margin-bottom: var(--sp-2); padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius); background: var(--c-accent-soft);
  color: #06526b; font-size: var(--fs-caption); font-weight: 700;
}

/* --- 添付 ---------------------------------------------------------------- */
.msg__files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.msg__img {
  max-width: 220px; max-height: 220px;
  border-radius: var(--radius); display: block;
  background: var(--c-accent-soft);
}
.msg__file {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 44px; padding: 0 var(--sp-3);
  border-radius: var(--radius);
  background: var(--c-surface); color: var(--c-accent);
  box-shadow: var(--shadow-1);
  text-decoration: none; font-size: var(--fs-caption); font-weight: 700;
}
.msg--mine .msg__file { background: rgba(255,255,255,0.92); }

.composer { flex-direction: column; align-items: stretch; }
.composer__row { display: flex; gap: var(--sp-2); align-items: flex-end; }
.composer__clip {
  flex: 0 0 auto;
  width: var(--tap-min); height: var(--tap-min);
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--c-accent-soft);
  font-size: 1.4rem; cursor: pointer;
  touch-action: manipulation;
}
.composer__clip:active { transform: scale(0.92); }
.composer__files { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: var(--sp-2); }
.pendfile {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: var(--radius);
  background: var(--c-accent-soft); font-size: var(--fs-caption); font-weight: 700;
}
.pendfile img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }
.pendfile button {
  border: 0; background: transparent; font: inherit; font-size: 1.1rem;
  cursor: pointer; min-width: 32px; min-height: 32px;
}
.composer__replying {
  margin: var(--sp-2) 0 0; font-size: var(--fs-caption);
  color: var(--c-accent); font-weight: 700;
}

.picklist { list-style: none; margin: 0; padding: 0; max-height: 40vh; overflow-y: auto; }
.picklist li { border-bottom: 1px solid var(--c-line); }
.picklist label {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--tap-min); padding: var(--sp-2);
  cursor: pointer;
}
.radio { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--tap-min); }

/* --- その人のページ -------------------------------------------------------- */
.pcard__head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.pcard__id { min-width: 0; }
.pcard__name { font-size: var(--fs-head); font-weight: 800; color: var(--c-accent); }
.pcard__note { margin: 2px 0 0; }
.pcompose__row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.pcompose__row .btn { flex: 1 1 8rem; margin-top: 0; min-width: 0; white-space: nowrap; }

/* ひとりごと1件 */
.post { display: flex; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--c-line); }
.post:last-child { border-bottom: 0; }
.post__col { flex: 1; min-width: 0; }
.post__head { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.post__name { font-weight: 800; color: var(--c-accent); }
.post__when { font-size: var(--fs-caption); color: var(--c-ink-weak); }
.post__body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post__del {
  margin-left: auto; min-height: 36px; padding: 0 var(--sp-3);
  border: 0; border-radius: 999px; background: var(--c-bg);
  color: var(--c-ink-weak); font: inherit; font-size: var(--fs-caption); cursor: pointer;
}

/* 家族の一覧（トップから飛ぶ） */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: var(--sp-3); list-style: none; padding: 0; margin: 0; }
.people-grid a {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3); border-radius: var(--radius-lg);
  background: var(--c-surface); box-shadow: var(--shadow-1);
  color: var(--c-ink); text-decoration: none; text-align: center;
  min-height: var(--tap-min);
}
.people-grid a:active { transform: scale(0.97); }
.people-grid .name { font-weight: 700; font-size: var(--fs-caption); overflow-wrap: anywhere; }

/* --- ひとりごとへの リアクション -------------------------------------------
   ★ 6つだけ。並びも変えない。位置で覚えて押せるようにするため。
   ★ 数だけ出す。誰が押したかは出さない（原則2）。 */
.reacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-2); }
.react {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 36px; padding: 0 10px;
  border: 1px solid var(--c-line); border-radius: 999px;
  background: var(--c-surface);
  font: inherit; font-size: var(--fs-caption); line-height: 1;
  cursor: pointer;
  transition: transform 60ms ease-out;
  touch-action: manipulation;
}
.react:active:not(:disabled) { transform: scale(0.9); }
.react:disabled { opacity: 0.5; }
.react__e { font-size: 1.05rem; }
.react__n { font-weight: 800; color: var(--c-ink-weak); font-variant-numeric: tabular-nums; }
/* ★ 自分が押したものは、色だけでなく枠の太さでも分かるようにする。 */
.react--mine {
  border: 2px solid var(--c-accent);
  background: var(--c-accent-soft);
}
.react--mine .react__n { color: var(--c-accent); }
