/* ============================================
   Hirano Home 家族SNS - Instagram風 / スマホ最優先
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  background: #fafafa;
  color: #262626;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---- ヘッダー ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 16px;
  background: #fff; border-bottom: 1px solid #dbdbdb;
}
.logo {
  font-family: "Segoe Script", "Brush Script MT", "Hiragino Mincho ProN", cursive, serif;
  font-size: 24px; font-weight: 700; letter-spacing: .5px;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: #dc2743;
}
.topbar-icon { display: inline-flex; padding: 6px; color: #262626; }
.topbar-icon svg { width: 24px; height: 24px; }

/* ---- コンテナ ---- */
.container { max-width: 600px; margin: 0 auto; }

/* ---- ボトムナビ ---- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around; align-items: center;
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid #dbdbdb;
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  flex: 1; padding: 6px 0; color: #8e8e8e; font-size: 10px;
}
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a.active { color: #262626; font-weight: 700; }
.bottomnav a.postbtn svg { width: 28px; height: 28px; }

/* ---- フィードカード ---- */
.card {
  background: #fff; border-bottom: 1px solid #efefef;
  margin-bottom: 8px;
}
@media (min-width: 620px) {
  .card { border: 1px solid #dbdbdb; border-radius: 8px; margin: 12px 0; }
}
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
}
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(45deg, #f09433, #dc2743, #bc1888);
  color: #fff; font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.card-head .who { flex: 1; min-width: 0; }
.card-head .name { font-weight: 700; font-size: 14px; }
.card-head .place { font-size: 12px; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head .place svg { width: 11px; height: 11px; vertical-align: -1px; }

/* 写真カルーセル（スクロールスナップ） */
.carousel {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; background: #000;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel .slide {
  flex: 0 0 100%; scroll-snap-align: center;
  display: flex; align-items: center; justify-content: center;
}
.carousel .slide img { width: 100%; height: auto; max-height: 75vh; object-fit: contain; }
.carousel-wrap { position: relative; }
.carousel-count {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,.65); color: #fff;
  font-size: 12px; padding: 3px 10px; border-radius: 12px;
}
/* PC用の左右矢印（マウス環境のみ表示・スマホはスワイプ） */
.car-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.9); color: #262626; font-size: 14px;
  cursor: pointer; z-index: 5; display: none;
  align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.car-arrow:hover { background: #fff; }
.car-prev { left: 10px; }
.car-next { right: 10px; }
@media (hover: hover) and (pointer: fine) {
  .car-arrow { display: flex; }
}

.dots { display: flex; justify-content: center; gap: 4px; padding: 8px 0 0; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: #cfcfcf; }
.dots span.on { background: #0095f6; }

.card-body { padding: 10px 12px 14px; }
.card-date { font-size: 12px; color: #8e8e8e; margin-bottom: 6px; }
.card-date svg { width: 12px; height: 12px; vertical-align: -2px; }
.card-text { font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-wrap: break-word; }
.card-more { color: #8e8e8e; font-size: 13px; }

/* カテゴリバッジ */
.badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 12px; color: #fff;
}
.badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex-shrink: 0; }
.badge-travel { background: #4a90d9; }
.badge-meal { background: #e8843c; }
.badge-daily { background: #5aa46a; }
.badge-other { background: #9b9b9b; }

/* ---- ログインページ ---- */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px; background: #fafafa;
}
.login-box {
  width: 100%; max-width: 350px; background: #fff;
  border: 1px solid #dbdbdb; border-radius: 8px;
  padding: 40px 36px; text-align: center;
}
.login-box .logo { font-size: 34px; display: inline-block; margin-bottom: 8px; }
.login-sub { color: #8e8e8e; font-size: 13px; margin-bottom: 24px; }
.login-box input[type=text], .login-box input[type=password] {
  width: 100%; padding: 11px 10px; margin-bottom: 10px;
  border: 1px solid #dbdbdb; border-radius: 6px;
  background: #fafafa; font-size: 16px;
}
.btn {
  display: inline-block; width: 100%; padding: 11px;
  background: #0095f6; color: #fff; font-size: 15px; font-weight: 700;
  border: none; border-radius: 8px; cursor: pointer; text-align: center;
}
.btn:active { opacity: .8; }
.btn-danger { background: #ed4956; }
.btn-gray { background: #efefef; color: #262626; }
.btn-sm { width: auto; padding: 7px 16px; font-size: 13px; }
.pw-toggle {
  display: block; text-align: left; font-size: 12px; color: #555;
  margin: 2px 0 12px; cursor: pointer;
}
.pw-toggle input { vertical-align: -1px; margin-right: 4px; }
.pw-note { color: #8e8e8e; font-size: 11px; }
.err {
  background: #fdecea; color: #c0392b; border: 1px solid #f5c6c2;
  border-radius: 6px; padding: 10px; font-size: 13px; margin-bottom: 12px;
}
.ok {
  background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9;
  border-radius: 6px; padding: 10px; font-size: 13px; margin-bottom: 12px;
}

/* ---- 投稿フォーム ---- */
.form-card {
  background: #fff; border-bottom: 1px solid #efefef; padding: 16px;
}
@media (min-width: 620px) {
  .form-card { border: 1px solid #dbdbdb; border-radius: 8px; margin: 12px 0; }
}
.form-card h1 { font-size: 17px; margin-bottom: 14px; }
.edit-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.edit-head h1 { margin-bottom: 0; }
.del-link {
  background: none; border: 1px solid #ed4956; color: #ed4956;
  font-size: 12px; font-weight: 700; padding: 5px 12px;
  border-radius: 6px; cursor: pointer;
}
.del-link .fa-trash-can { font-size: 13px; margin-right: 2px; }
.del-link:active { background: #fdecea; }
.form-label { display: block; font-size: 13px; font-weight: 700; margin: 14px 0 6px; }
.form-note { font-size: 11px; color: #8e8e8e; font-weight: 400; }
input[type=text], input[type=password], input[type=date], input[type=datetime-local], textarea, select {
  width: 100%; padding: 11px 10px;
  border: 1px solid #dbdbdb; border-radius: 6px;
  background: #fafafa; font-size: 16px;
  font-family: inherit;
}
textarea { min-height: 110px; resize: vertical; }

/* 旅行期間ブロック */
.trip-block {
  margin-top: 10px; padding: 12px; border: 1px solid #cfe3f7;
  border-radius: 10px; background: #f5faff;
}
.trip-block .form-label { margin-top: 0; }
.trip-date-row { display: flex; gap: 10px; margin-top: 6px; }
.trip-date-row > div { flex: 1; }
.trip-date-row .form-label { margin: 0 0 4px; }
a.badge { text-decoration: none; }

/* 住所欄 */
.addr-row { display: flex; gap: 8px; align-items: stretch; }
.addr-row input { flex: 1; min-width: 0; }
.addr-row .btn-sm { flex-shrink: 0; white-space: nowrap; }
.card-addr { margin-bottom: 6px; }
.card-addr a { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: #0095f6; }
.card-addr svg { width: 14px; height: 14px; flex-shrink: 0; }

/* カテゴリ選択（セグメント） */
.seg { display: flex; gap: 8px; }
.seg label {
  flex: 1; text-align: center; padding: 10px 0;
  border: 1px solid #dbdbdb; border-radius: 8px;
  font-size: 14px; cursor: pointer; background: #fff;
}
.seg input { display: none; }
.seg input:checked + span { font-weight: 700; }
.seg label.sel-travel { border-color: #4a90d9; background: #eaf3fc; color: #2b6cb0; }
.seg label.sel-meal { border-color: #e8843c; background: #fdf1e7; color: #c05621; }
.seg label.sel-daily { border-color: #5aa46a; background: #ecf6ee; color: #35754a; }
.seg label.sel-other { border-color: #9b9b9b; background: #f1f1f1; color: #555; }

/* 写真選択 */
.photo-pick {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed #c7c7c7; border-radius: 10px;
  padding: 26px 10px; color: #0095f6; font-weight: 700; font-size: 14px;
  cursor: pointer; background: #fbfdff;
}
.photo-pick svg { width: 26px; height: 26px; }
.previews { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.previews img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 6px; }

/* 非同期アップロードの進行状況 */
.up-item { position: relative; }
.up-status {
  position: absolute; bottom: 4px; right: 4px;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 10px; padding: 1px 7px; border-radius: 8px;
}
.up-wait img { opacity: .45; }
.up-done .up-status { background: #2e7d32; }
.up-fail img { opacity: .35; }
.up-fail .up-status { background: #c0392b; }

/* ---- 検索・グリッド ---- */
.searchbar { padding: 10px 12px; background: #fff; border-bottom: 1px solid #efefef; }
.searchbar form { display: flex; gap: 8px; }
.searchbar input[type=text] { flex: 1; }
.chips { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; }
.chip {
  padding: 6px 16px; border-radius: 16px; font-size: 13px;
  background: #efefef; color: #262626; white-space: nowrap;
}
.chip.on { background: #262626; color: #fff; }
/* ハッシュタグ */
.tag-link { color: #0057a3; font-weight: 600; }
.tag-chips { padding-top: 0; }
.chip-tag { background: #eaf3fc; color: #0057a3; }
.chip-tag.on { background: #0057a3; color: #fff; }
.chip-cnt { font-size: 10px; margin-left: 4px; opacity: .7; }
.chips-wrap { flex-wrap: wrap; overflow-x: visible; padding: 0; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.grid a { position: relative; display: block; aspect-ratio: 1/1; background: #eee; overflow: hidden; }
.grid img { width: 100%; height: 100%; object-fit: cover; }
.grid .nophoto {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  font-size: 11px; color: #666; padding: 6px; text-align: center; background: #f3f3f3;
}
.grid .multi {
  position: absolute; top: 6px; right: 6px; color: #fff;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.5));
}
.grid .multi svg { width: 16px; height: 16px; }
.result-note { padding: 12px; font-size: 13px; color: #8e8e8e; }

/* ---- 記録（統計） ---- */
.stat-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px; }
.stat-card {
  background: #fff; border: 1px solid #dbdbdb; border-radius: 10px;
  padding: 16px 12px; text-align: center;
}
.stat-card .num { font-size: 28px; font-weight: 800; }
.stat-card .lbl { font-size: 12px; color: #8e8e8e; margin-top: 2px; }
.stat-card.c-travel .num { color: #4a90d9; }
.stat-card.c-meal .num { color: #e8843c; }
.section {
  background: #fff; border-bottom: 1px solid #efefef; padding: 14px 12px; margin-bottom: 8px;
}
@media (min-width: 620px) {
  .section { border: 1px solid #dbdbdb; border-radius: 8px; }
}
.section h2 { font-size: 14px; margin-bottom: 10px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 13px; }
.bar-row .bl { width: 72px; flex-shrink: 0; color: #555; }
.bar-track { flex: 1; display: flex; height: 18px; border-radius: 4px; overflow: hidden; background: #f1f1f1; }
.bar-travel { background: #4a90d9; height: 100%; }
.bar-meal { background: #e8843c; height: 100%; }
.bar-daily { background: #5aa46a; height: 100%; }
.bar-other { background: #c4c4c4; height: 100%; }
.bar-row .bn { width: 58px; flex-shrink: 0; text-align: right; color: #8e8e8e; font-size: 12px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: #555; margin-bottom: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
/* 旅行の一覧 */
.trip-list { list-style: none; }
.trip-list li { border-bottom: 1px solid #f3f3f3; }
.trip-list li:last-child { border-bottom: none; }
.trip-list a { display: flex; align-items: center; gap: 10px; padding: 11px 0; }
.trip-period { font-size: 14px; font-weight: 700; color: #2b6cb0; white-space: nowrap; }
.trip-meta { flex: 1; font-size: 12px; color: #8e8e8e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-cnt { font-size: 12px; color: #8e8e8e; flex-shrink: 0; }

.rank-list { list-style: none; }
.rank-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid #f3f3f3; font-size: 14px;
}
.rank-list li:last-child { border-bottom: none; }
.rank-no {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #efefef; font-size: 12px; font-weight: 700;
}
.rank-list li:nth-child(1) .rank-no { background: #f6d465; }
.rank-list li:nth-child(2) .rank-no { background: #d9dbdd; }
.rank-list li:nth-child(3) .rank-no { background: #e6b98c; }
.rank-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-cnt { color: #8e8e8e; font-size: 13px; }

/* ---- メンバー・メニュー ---- */
.member-list { list-style: none; }
.member-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid #f3f3f3;
}
.member-list li:last-child { border-bottom: none; }
.member-list .mname { flex: 1; font-size: 14px; font-weight: 700; }
.member-list .mmeta { font-size: 12px; color: #8e8e8e; }
.admin-star { color: #f6a623; font-size: 12px; }

/* ---- 詳細ページ ---- */
.detail-actions { display: flex; gap: 10px; padding: 12px; }
.detail-actions form { flex: 1; }
.detail-actions .btn { width: 100%; }
.back-link { display: inline-block; padding: 12px; font-size: 14px; color: #0095f6; font-weight: 700; }

/* 既存写真の削除チェック + 回転ボタン */
.photo-del-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-del-grid label { position: relative; display: block; cursor: pointer; }
.photo-del-grid img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 6px; }
.photo-del-grid input { position: absolute; top: 6px; left: 6px; transform: scale(1.3); }
.photo-del-grid input:checked + img { opacity: .35; outline: 3px solid #ed4956; }
.slide { position: relative; }
.photo-by {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
}
.photo-owner { font-size: 11px; color: #8e8e8e; text-align: center; margin-top: 2px; }
.rotate-btn {
  display: block; width: 100%; margin-top: 4px; padding: 7px 0;
  font-size: 12px; font-weight: 700; color: #0095f6;
  background: #fff; border: 1px solid #dbdbdb; border-radius: 6px; cursor: pointer;
}
.rotate-btn:active { background: #eaf3fc; }

/* ---- コメント ---- */
.comments { border-top: 1px solid #efefef; padding: 12px; }
.comments-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: #555; }
.comment { display: flex; gap: 10px; margin-bottom: 12px; }
.comment .avatar { width: 28px; height: 28px; font-size: 12px; }
.comment-main { flex: 1; min-width: 0; }
.comment-body { font-size: 14px; line-height: 1.6; word-wrap: break-word; }
.comment-name { font-weight: 700; margin-right: 8px; }
.comment-meta { display: flex; align-items: center; gap: 12px; font-size: 11px; color: #8e8e8e; margin-top: 2px; }
.comment-del button {
  background: none; border: none; color: #8e8e8e; font-size: 11px;
  cursor: pointer; padding: 0; text-decoration: underline;
}
.comment-none { font-size: 13px; color: #8e8e8e; margin-bottom: 12px; }
.comment-form { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.comment-form .avatar { width: 28px; height: 28px; font-size: 12px; }
.comment-form input[type=text] {
  flex: 1; min-width: 0; border: 1px solid #dbdbdb; border-radius: 20px;
  padding: 9px 14px; background: #fafafa; font-size: 16px;
}
.comment-send {
  background: none; border: none; color: #0095f6; font-weight: 700;
  font-size: 14px; cursor: pointer; padding: 6px; flex-shrink: 0;
}
.comment-send:active { opacity: .6; }
.card-comments-link { display: inline-block; margin-top: 6px; font-size: 13px; color: #8e8e8e; }

/* ページネーション */
.pager { display: flex; justify-content: center; gap: 16px; padding: 16px; }
.pager a { color: #0095f6; font-weight: 700; font-size: 14px; padding: 8px 14px; }
.empty { text-align: center; color: #8e8e8e; padding: 50px 20px; font-size: 14px; line-height: 1.8; }
.empty .big { font-size: 40px; }
