    html, body, #main {
  box-sizing: border-box;
}
    
    body, html {
      font-family: sans-serif;
      margin: 0;
      padding: 0;
      background: #f5f5f5;
      height: 100%;
    }

    main {
      padding-bottom: 56px;
      overflow-y: auto;
      min-height: calc(100vh - 56px - 48px);
    }
.post-card, .card {
  width: 100%;
  max-width: 430px;
  padding: 12px;
  box-sizing: border-box; /* ← これ重要 */
  margin: 0 auto 16px auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
    .post-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .post-meta {
      font-size: 12px;
      color: #888;
    }
    .post-body {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
}
    .post-body img {
      width: 100%;
      max-height: 240px;
      object-fit: cover;
      border-radius: 4px;
      margin-top: 8px;
      display: block;
    }
    .actions {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 8px;
      font-size: 14px;
      color: #555;
    }

    .left-actions {
      display: flex;
      gap: 16px;
      align-items: center;
    }

    .right-actions {
      display: flex;
      align-items: center;
      margin-right: 8px; 
    }
    nav {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: #fff;
      border-top: 1px solid #ccc;
      display: flex;
      justify-content: space-around;
      padding: 6px 0;
      height: 56px;
    }
    nav button {
      background: none;
      border: none;
      font-size: 14px;
      color: #333;
    }
    header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 16px;
      border-bottom: 1px solid #ddd;
    }

    #userHeader img {
      width: 32px;
      height: 32px;
      border-radius: 50%;
    }
    .floating-add-button {
      position: fixed;
      bottom: 70px;
      right: 20px;
      width: 56px;
      height: 56px;
      border-radius: 50%;
      background-color: #3c91e6;
      color: white;
      font-size: 28px;
      text-align: center;
      line-height: 56px;
      box-shadow: 0 4px 8px rgba(0,0,0,0.2);
      z-index: 1000;
    }
    .like-button {
      background: none;
      border: none;
      color: #070707;
      font-size: 16px;
      display: flex;
      align-items: center;
      gap: 4px;
      cursor: pointer;
    }

    .like-icon {
      font-size: 16px;
      color: #070707;
      transition: color 0.2s ease, transform 0.2s ease;
    }
    .like-icon.liked {
      color: #df4242;
      content: '♥';
      transform: scale(1.3);
    }

    .comment-icon {
      font-size: 16px;
      color: #555;
    }

    .actions .like-icon {
      font-size: 16px; 
      vertical-align: middle;
      line-height: 1;
    }
    .actions span {
      display: inline-flex;
      align-items: center;
      gap: 2px;
    }
    @keyframes pop {
      0% { transform: scale(1); }
      50% { transform: scale(1.4); }
      100% { transform: scale(1); }
    }
    main {
      padding-bottom: 56px;
      padding-top: 8px;
      overflow-y: auto;
      min-height: calc(100vh - 56px - 48px);
    }

    .top-header {
      padding: 10px 16px;
      border-bottom: 1px solid #ddd;
      background: #fff;
    }
    .header-inner {
      display: flex;
      align-items: center;
      gap: 6px;
      flex: 1; 
      min-width: 0; 
      flex-wrap: nowrap;
      justify-content: space-between;
      overflow: hidden; 
      padding-right: env(safe-area-inset-right, 16px); /* iPhone右側の安全領域 */
    }

    .logo-area {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .logo-icon {
      width: 30px;
      height: 30px;
      object-fit: contain;
    }
    .logo-title {
      margin: 0;
      font-size: 20px;
      flex-shrink: 0;
      font-weight: bold;
    }


    .search-bar {
      background: #f1f1f1;
      padding: 6px 12px;
      border-radius: 20px;
      font-size: 14px;
      cursor: pointer;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      min-width: 60px;
      max-width: 130px;
      flex-grow: 1;
      transition: all 0.3s ease-in-out;
      text-align: center;
      flex-shrink: 1; 
      
    } 

    .search-bar.expanded {
      max-width: 300px;
      background: #fff;
      box-shadow: 0 0 8px rgba(0,0,0,0.1);
      text-align: left;
    }

    .user-icon-area {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      overflow: hidden;
      flex-shrink: 0;
      margin-left: auto; /* ←★ これで右端に寄せる */
    }

    .user-icon-area img {
      width: 32px;
      height: 32px;
      border-radius: 50%;
    }
    .modal {
      display: none;
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0, 0, 0, 0.5);
      z-index: 1000;
    }
    #searchModal.show {
      display: block;
    }
    .user-icon-loginarea {
      display: flex;
      align-items: center;
      justify-content: center;
      margin-left: auto;
      padding: 0 8px; /* ボタンに少し余白 */
      height: 32px;    /* 高さだけ固定 */
      min-width: auto; /* ← 幅はボタンに任せる */
      width: auto;
      border-radius: 16px;
      flex-shrink: 0;
    }
    .user-icon-loginarea button {
      white-space: nowrap; /* 🔑 改行防止 */
      background: none;
      border: none;
      font-size: 12px;
      color: #3c91e6;
      padding: 0;
      width: 100%;
      height: 100%;
      display: inline-block;
      align-items: center;
      justify-content: center;
      line-height: 32px;
    }
    .material-icons {
      font-size: 18px;
      vertical-align: middle;
      color: #666; /* 必要に応じて色変更 */
    }
.share-icon {
  background: none;
  border: none;
  padding: 0;
  color: #888;
  font-size: 16px;
  cursor: pointer;
  margin-left: 6px;
}
.dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background-color: red;
  border-radius: 50%;
}

.dot.hidden {
  display: none;
}

.notification-btn {
  position: relative; /* 相対位置基準にする */
}
.header-right-icons {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.notification-icon-area {
  position: relative;
  margin-right: 8px; /* ←追加 */
  font-size: 14px;
  cursor: pointer;
}
.notification-dot {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  background-color: red;
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 0 4px;
  border-radius: 9999px;
  text-align: center;
  line-height: 16px;
  display: inline-block;
  box-sizing: border-box;
}
.notification-dot.hidden {
  display: none;
}

img.timeline-vertical {
  aspect-ratio: 3 / 4; /* 縦長は3:4など */
  width: 100%;
  max-height: 480px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

img.timeline-horizontal {
  aspect-ratio: 16 / 9; /* 横長は16:9など */
  width: 100%;
  max-height: 320px;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
}

img.timeline-square {
  aspect-ratio: 1 / 1; /* 正方形 */
  width: 100%;
  max-width: 320px; /* or 100% for smaller screens */
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

@media (min-width: 600px) {
  img.timeline-square {
    max-width: 320px;
  }
  .search-bar {
    margin-left: 32px; /* 任意で調整（20〜40px） */
  }
}

.user-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
}
.user-link {
  text-decoration: none;
  color: inherit; /* 親と同じ色 */
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-modal-actions {
  display: flex;
  justify-content: center;
  gap: 20px; /* ボタン間の余白 */
  margin-top: 16px;
  margin-left: 5px; /* ← 全体を中央より少し左へ */ 
}
.search-btn,
.cancel-btn {
  width: 100px; /* ✅ 幅を完全に揃える */
  height: 36px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.search-btn {
  background-color: #0077cc;
  color: #fff;
}

.cancel-btn {
  background-color: #e0e0e0;
  color: #333;
}
.badge {
  margin-left: 4px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: bold;
  color: #fff;
  border-radius: 10px;
  vertical-align: middle;
  position: relative; /* ← これがないと top が効かない */
  top: -1px; /* ← 数ミリ上に調整 */
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
html { background: #fff; }

/* ローディング画面のスタイル */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-screen.active {
  opacity: 1;
  visibility: visible;
}

/* ロゴの回転アニメーション */
.loading-logo {
  width: 80px; /* サイズ調整 */
  height: auto;
  animation: rotateLogo 1.5s infinite linear;
}

/* ロゴの回転 */
@keyframes rotateLogo {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 「読み込み中...」テキストのフェードイン */
.loading-screen p {
  margin-top: 10px;
  font-size: 18px;
  color: #333;
  opacity: 0;
  animation: fadeInText 1.5s ease-out forwards;
}

@keyframes fadeInText {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}