* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  color: #111111;
  overflow: hidden;
}

.app-layout {
  display: flex;
  width: 100%;
  height: 100dvh;
}

/* ────────── PC: 左サイドバー ────────── */
.sidebar {
  width: 240px;
  min-width: 240px;
  height: 100%;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 32px 20px;
  border-right: 1px solid #f2f2f2;
  z-index: 10;
}

.logo-container {
  margin-bottom: 28px;
  padding-left: 8px;
}

.app-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.nav-button {
  width: 100%;
  height: 54px;
  background-color: #f1f2f4;
  border: none;
  border-radius: 20px;
  font-size: 15px;
  font-weight: bold;
  color: #1a1a1a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background-color 0.15s, transform 0.05s;
}

.nav-button:hover { background-color: #e5e7eb; }
.nav-button:active { transform: scale(0.98); }
.nav-button.active { background-color: #e5e7eb; }

.sidebar-bottom {
  margin-top: auto;
}

.mobile-top-bar {
  display: none;
}

/* ────────── メインコンテンツエリア ────────── */
.main-area {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  background: linear-gradient(135deg, #ffffff 0%, #fff1f2 40%, #fecdd3 75%, #fca5a5 100%);
  padding: 40px 56px;
  -webkit-overflow-scrolling: touch;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  color: #000000;
  margin-bottom: 28px;
  letter-spacing: -0.01em;
}

/* ────────── 投稿フォーム（ピル型＋画像添付） ────────── */
.post-form-wrapper {
  max-width: 880px;
  margin-bottom: 30px;
}

.pill-input-card {
  background-color: #ffffff;
  min-height: 64px;
  border-radius: 36px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  padding: 8px 10px 8px 16px;
  width: 100%;
}

.user-avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #000000;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 12px;
  overflow: hidden;
}

.user-avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pill-text-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px; /* スマホ自動ズーム防止 */
  color: #222222;
  background: transparent;
  padding: 0 4px;
}

.pill-text-input::placeholder {
  color: #cccccc;
}

/* 投稿バーのツール群 */
.post-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.attach-btn {
  background: transparent;
  border: none;
  color: #888888;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s, background-color 0.2s;
}

.attach-btn:hover {
  color: #111111;
  background-color: #f3f4f6;
}

.circle-action-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background-color: #f87171;
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.1s;
}

.circle-action-btn:hover { opacity: 0.9; }
.circle-action-btn:active { transform: scale(0.95); }

/* 添付画像プレビュー */
.image-preview-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-left: 20px;
}

.preview-thumb-box {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
}

/* ────────── 投稿カード ────────── */
.posts-feed {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 880px;
  width: 100%;
}

.post-card {
  background-color: #ffffff;
  border-radius: 34px;
  padding: 26px 32px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.02);
}

.post-header {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.author-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.author-avatar-text {
  color: #ffffff;
  font-weight: 800;
  font-size: 10.5px;
  line-height: 1.1;
  text-align: center;
}

.verified-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}

.badge-official { background-color: #f59e0b; }
.badge-user { background-color: #38bdf8; }

.author-info {
  display: flex;
  flex-direction: column;
}

.author-name {
  font-size: 15px;
  font-weight: bold;
  color: #000000;
}

.post-date {
  font-size: 12px;
  color: #888888;
  margin-top: 2px;
}

.post-body {
  font-size: 15px;
  line-height: 1.75;
  color: #222222;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-attachment-img {
  margin-top: 14px;
  max-width: 100%;
  max-height: 420px;
  border-radius: 20px;
  object-fit: cover;
  display: block;
}

/* ────────── アカウント画面（画像2完全再現） ────────── */
.account-container {
  max-width: 880px;
}

/* プロフィール編集カード */
.profile-card {
  background-color: #ffffff;
  border-radius: 34px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
  margin-bottom: 30px;
}

.profile-card-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.avatar-upload-wrapper {
  position: relative;
  cursor: pointer;
}

.profile-large-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #ef4444;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.profile-large-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-badge-edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #111111;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}

.profile-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-input {
  height: 48px;
  background-color: #f1f2f4;
  border: none;
  border-radius: 16px;
  padding: 0 16px;
  font-size: 16px;
  outline: none;
  width: 100%;
}

.profile-input:focus {
  background-color: #e5e7eb;
}

.profile-save-btn {
  align-self: flex-start;
  background-color: #3f51f5;
  color: #ffffff;
  border: none;
  border-radius: 20px;
  height: 44px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s;
}

.profile-save-btn:hover { opacity: 0.9; }

/* 画像2の通りの白いピルボタン群 */
.account-actions-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.white-pill-btn {
  background-color: #ffffff;
  border: none;
  border-radius: 28px;
  padding: 16px 36px;
  font-size: 15px;
  font-weight: 500;
  color: #111111;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background-color 0.15s, transform 0.05s;
}

.white-pill-btn:hover {
  background-color: #f8f8f8;
}

.white-pill-btn:active {
  transform: scale(0.98);
}

.white-pill-btn.logout {
  color: #2563eb;
}

.white-pill-btn.danger {
  color: #dc2626;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #71717a;
  gap: 12px;
  font-size: 14px;
}

/* ═════════════════════════════════════════════════════════
   📱 モバイル（画面幅 768px 以下）完全対応
   ═════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
  }

  .app-layout {
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
  }

  /* 上部ヘッダー */
  .mobile-top-bar {
    display: flex;
    align-items: center;
    height: 56px;
    background-color: #ffffff;
    padding: 0 16px;
    border-bottom: 1px solid #f1f1f1;
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .mobile-top-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-right: 10px;
  }

  .mobile-top-title {
    font-size: 18px;
    font-weight: 800;
  }

  /* 下部固定ボトムナビ（iPhone セーフエリア完全対応） */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(64px + var(--safe-bottom));
    min-width: 100%;
    flex-direction: row;
    padding: 6px 12px calc(6px + var(--safe-bottom)) 12px;
    border-right: none;
    border-top: 1px solid #f0f0f0;
    align-items: center;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
    z-index: 40;
  }

  .logo-container,
  .sidebar-bottom {
    display: none;
  }

  .nav-group {
    flex-direction: row;
    width: 100%;
    justify-content: space-around;
    gap: 8px;
  }

  .nav-button {
    height: 48px;
    border-radius: 14px;
    font-size: 11px;
    flex-direction: column;
    gap: 4px;
    padding: 4px 10px;
    background-color: transparent;
    color: #666666;
  }

  .nav-button.active {
    background-color: #f1f2f4;
    color: #000000;
  }

  .nav-button.mobile-only-account {
    display: flex !important;
  }

  /* メインコンテンツ（下部バーが絶対に被らない） */
  .main-area {
    padding: 20px 16px calc(80px + var(--safe-bottom)) 16px;
    height: auto;
    overflow-y: visible;
  }

  .page-title {
    font-size: 22px;
    margin-bottom: 18px;
  }

  .pill-input-card {
    border-radius: 28px;
    padding: 6px 8px 6px 12px;
  }

  .user-avatar-circle {
    width: 38px;
    height: 38px;
    margin-right: 8px;
  }

  .circle-action-btn {
    width: 40px;
    height: 40px;
  }

  .post-card {
    border-radius: 24px;
    padding: 20px 18px;
  }

  .author-avatar {
    width: 40px;
    height: 40px;
    margin-right: 10px;
  }

  /* アカウント画面のボタン（スマホで押しやすい縦並び） */
  .profile-card {
    border-radius: 24px;
    padding: 20px 18px;
  }

  .profile-card-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
  }

  .profile-save-btn {
    width: 100%;
  }

  .account-actions-row {
    flex-direction: column;
    gap: 12px;
  }

  .white-pill-btn {
    width: 100%;
    height: 54px;
  }
}