/* 社群動態 — Instagram 風格動態牆 */
.community-app {
  max-width: 32rem;
  margin: 0 auto;
  min-height: 100dvh;
  background: #fafafa;
  color: #262626;
}

.community-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 2.5rem 1fr 2.5rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #efefef;
}

.community-home-btn {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  color: #3d4f23;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
}
.community-home-btn:hover {
  background: rgba(61, 79, 35, 0.08);
  color: #2d3b1a;
}
.community-home-btn:focus-visible {
  outline: 2px solid #3d4f23;
  outline-offset: 2px;
}
.community-home-btn .material-symbols-outlined {
  font-size: 1.45rem;
}

.community-logo {
  grid-column: 2;
  justify-self: center;
  font-family: "Noto Serif TC", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #3d4f23;
  text-decoration: none;
}

.community-member-slot {
  grid-column: 1;
  justify-self: start;
  min-width: 0;
  max-width: 9.5rem;
}

.community-member-login {
  font-size: 0.78rem;
  font-weight: 600;
  color: #3d4f23;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid #c5d4a8;
  background: #f7faf2;
}

.community-member-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.community-member-avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  object-fit: cover;
  flex-shrink: 0;
  background: #efefef;
}

.community-member-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: #3d4f23;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 3.5rem;
}

.community-member-online {
  flex-shrink: 0;
  font-size: 0.58rem;
  font-weight: 700;
  color: #2e7d32;
  background: #e8f5e9;
  border-radius: 9999px;
  padding: 0.1rem 0.35rem;
  line-height: 1.2;
}

.community-member-logout {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #8e8e8e;
  font-size: 0.62rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.15rem 0.2rem;
}

.community-member-logout:hover {
  color: #c62828;
}

.community-stories {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  padding: 0.85rem 1rem 0.5rem;
  scrollbar-width: none;
}
.community-stories::-webkit-scrollbar { display: none; }

.community-story {
  flex: 0 0 auto;
  width: 4.5rem;
  text-align: center;
}
.community-story-ring {
  width: 4rem;
  height: 4rem;
  margin: 0 auto;
  border-radius: 9999px;
  padding: 2px;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}
.community-story-ring > img {
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  object-fit: cover;
  border: 2px solid #fff;
}
.community-story span {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  color: #262626;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.community-post {
  background: #fff;
  border-top: 1px solid #efefef;
  border-bottom: 1px solid #efefef;
  margin-bottom: 0.65rem;
}
.community-post-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
}
.community-post-head img {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  object-fit: cover;
}
.community-post-meta strong {
  display: block;
  font-size: 0.82rem;
  line-height: 1.2;
}
.community-post-meta small {
  display: block;
  font-size: 0.68rem;
  color: #8e8e8e;
}
.community-post-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f3f3f3;
  overflow: hidden;
}
.community-post-media img,
.community-post-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.community-post-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
}
.community-post-media-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.community-video-badge {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.2rem 0.45rem;
  border-radius: 0.35rem;
}
.community-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.community-play span {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #262626;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.community-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem 0.35rem;
  gap: 0.5rem;
}
.community-actions-left {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}
.community-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #262626;
  cursor: pointer;
  line-height: 1;
}
.community-action-btn--solo {
  margin-left: auto;
}
.community-action-btn .material-symbols-outlined,
.community-action-btn .community-action-icon {
  font-size: 1.45rem;
  pointer-events: none;
}
.community-icon {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}
.community-action-btn .community-icon {
  width: 1.45rem;
  height: 1.45rem;
}
.community-post-more-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: #8e8e8e;
  flex-shrink: 0;
}
.community-post-head .community-icon {
  flex-shrink: 0;
}
.community-share-icon {
  width: 1.38rem;
  height: 1.38rem;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
  transform: translateY(-0.5px);
}
.community-action-btn[data-action="share"] {
  gap: 0.4rem;
}
.community-action-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: #262626;
  min-width: 0.5rem;
}
.community-action-btn.is-liked,
.community-action-btn.is-liked .community-action-count {
  color: #ed4956;
}
.community-action-btn.is-liked .material-symbols-outlined,
.community-action-btn.is-saved .material-symbols-outlined {
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}
.community-action-btn.is-saved {
  color: #262626;
}
.community-likes-line {
  padding: 0 0.85rem 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
}
.community-likes-line.is-hidden {
  display: none;
}
.community-view-comments {
  display: block;
  padding: 0 0.85rem 0.35rem;
  border: 0;
  background: transparent;
  font-size: 0.78rem;
  color: #8e8e8e;
  cursor: pointer;
  text-align: left;
}
.community-view-all-comments {
  display: block;
  width: 100%;
  padding: 0 0.85rem 0.4rem;
  border: 0;
  background: transparent;
  font-size: 0.78rem;
  color: #8e8e8e;
  cursor: pointer;
  text-align: left;
}
.community-view-all-comments:hover {
  color: #262626;
}
body.community-comment-open {
  overflow: hidden;
}
.community-comment-sheet {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}
.community-comment-sheet.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}
.community-comment-sheet[hidden] {
  display: none !important;
}
.community-comment-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.community-comment-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  max-height: min(78vh, 640px);
  background: #fff;
  border-radius: 1rem 1rem 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
}
.community-comment-sheet.is-open .community-comment-panel {
  transform: translateY(0);
}
.community-comment-handle {
  width: 2.25rem;
  height: 0.22rem;
  margin: 0.55rem auto 0.35rem;
  border-radius: 9999px;
  background: #dbdbdb;
  flex-shrink: 0;
}
.community-comment-heading {
  margin: 0;
  padding: 0.35rem 1rem 0.65rem;
  font-size: 1rem;
  font-weight: 700;
  color: #262626;
  text-align: center;
  flex-shrink: 0;
  border-bottom: 1px solid #efefef;
}
.community-comment-sheet-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.65rem 0.85rem 0.5rem;
  -webkit-overflow-scrolling: touch;
}
.community-comment-sheet-empty {
  margin: 2rem 0;
  text-align: center;
  font-size: 0.85rem;
  color: #8e8e8e;
}
.ig-comment-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.ig-comment-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  object-fit: cover;
  flex-shrink: 0;
  background: #efefef;
}
.ig-comment-main {
  flex: 1;
  min-width: 0;
}
.ig-comment-top {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.ig-comment-user {
  font-size: 0.82rem;
  font-weight: 700;
  color: #262626;
}
.ig-comment-time {
  font-size: 0.72rem;
  color: #8e8e8e;
}
.ig-comment-text {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #262626;
  word-break: break-word;
}
.ig-comment-reply {
  margin-top: 0.25rem;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #8e8e8e;
  cursor: pointer;
}
.ig-comment-like {
  border: 0;
  background: transparent;
  padding: 0.15rem 0 0;
  color: #8e8e8e;
  cursor: pointer;
  line-height: 1;
}
.ig-comment-like .material-symbols-outlined,
.ig-comment-like .community-icon {
  width: 0.95rem;
  height: 0.95rem;
}
.ig-comment-like.is-liked {
  color: #ed4956;
}
.ig-comment-like.is-liked .material-symbols-outlined {
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}
.ig-comment-manage {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.2rem;
}
.community-comment-action-btn {
  border: 0;
  background: transparent;
  color: #8e8e8e;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}
.community-comment-action-btn--danger {
  color: #ed4956;
}
.community-comment-edit-form {
  display: flex;
  gap: 0.35rem;
  width: 100%;
}
.community-comment-edit-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #dbdbdb;
  border-radius: 0.35rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
}
.community-comment-compose {
  flex-shrink: 0;
  border-top: 1px solid #efefef;
  background: #fff;
  padding: 0.45rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
}
.ig-comment-emojis {
  display: flex;
  gap: 0.15rem;
  overflow-x: auto;
  padding: 0.15rem 0 0.45rem;
  scrollbar-width: none;
}
.ig-comment-emojis::-webkit-scrollbar {
  display: none;
}
.ig-comment-emoji-btn {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.15rem 0.25rem;
  cursor: pointer;
}
.ig-comment-composer {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.ig-comment-compose-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  object-fit: cover;
  flex-shrink: 0;
  background: #efefef;
}
.ig-comment-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  border: 1px solid #dbdbdb;
  border-radius: 9999px;
  padding: 0.3rem 0.4rem 0.3rem 0.85rem;
  background: #f0f2f5;
}
.ig-comment-compose-actions {
  display: flex;
  align-items: center;
  gap: 0.05rem;
  flex-shrink: 0;
}
.ig-comment-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 0.88rem;
  outline: none;
  color: #262626;
  padding: 0.15rem 0;
}
.ig-comment-input::placeholder {
  color: #8e8e8e;
}
.ig-comment-compose-icon {
  border: 0;
  background: transparent;
  color: #262626;
  padding: 0.15rem;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ig-comment-compose-icon .material-symbols-outlined,
.ig-comment-compose-icon .community-icon {
  width: 1.35rem;
  height: 1.35rem;
}
.ig-comment-send-btn {
  border: 0;
  background: transparent;
  color: #1877f2;
  padding: 0.1rem 0.15rem;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.ig-comment-form.has-text .ig-comment-send-btn {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}
.ig-comment-send-btn:disabled {
  opacity: 0 !important;
  pointer-events: none !important;
}
.ig-comment-send-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}
.ig-comment-login-hint {
  margin: 0;
  padding: 0.65rem 0.25rem 0.15rem;
  font-size: 0.78rem;
  color: #8e8e8e;
  text-align: center;
  line-height: 1.4;
}
.ig-comment-login-hint a {
  color: #3d4f23;
  font-weight: 600;
  text-decoration: none;
}
@media (min-width: 768px) {
  .community-comment-sheet {
    align-items: center;
  }
  .community-comment-panel {
    border-radius: 1rem;
    max-height: min(70vh, 580px);
    transform: translateY(1.5rem);
    opacity: 0;
    transition: transform 0.28s ease, opacity 0.28s ease;
  }
  .community-comment-sheet.is-open .community-comment-panel {
    transform: translateY(0);
    opacity: 1;
  }
  .community-comment-handle {
    display: none;
  }
}
.community-interest-card {
  position: relative;
  margin: 0.5rem 0.85rem 0.65rem;
  padding: 0.85rem 0.85rem 0.75rem;
  border-radius: 0.65rem;
  background: #eef2f6;
}
.community-interest-close {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  border: 0;
  background: transparent;
  color: #8e8e8e;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem;
}
.community-interest-title {
  margin: 0 1.5rem 0.65rem 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #262626;
}
.community-interest-actions {
  display: flex;
  gap: 0.5rem;
}
.community-interest-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 9999px;
  background: #fff;
  color: #262626;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.community-interest-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 9999px;
  background: #f3f3f3;
  font-size: 0.72rem;
  font-weight: 700;
}
.community-interest-icon--yes {
  background: #e8f5e9;
  color: #2e7d32;
}
.community-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(120%);
  z-index: 100;
  background: rgba(38, 38, 38, 0.92);
  color: #fff;
  font-size: 0.82rem;
  padding: 0.55rem 1rem;
  border-radius: 9999px;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}
.community-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
body.community-share-open {
  overflow: hidden;
}
.community-share-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}
.community-share-sheet.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}
.community-share-sheet[hidden] {
  display: none !important;
}
.community-share-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.community-share-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-radius: 1rem 1rem 0 0;
  padding: 0.35rem 0 1.25rem;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
}
.community-share-sheet.is-open .community-share-panel {
  transform: translateY(0);
}
.community-share-handle {
  width: 2.25rem;
  height: 0.22rem;
  margin: 0.55rem auto 0.75rem;
  border-radius: 9999px;
  background: #dbdbdb;
}
.community-share-heading {
  margin: 0 1rem 0.85rem;
  font-size: 1rem;
  font-weight: 700;
  color: #262626;
  text-align: center;
}
.community-share-row {
  display: flex;
  gap: 0.65rem;
  padding: 0 0.85rem 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.community-share-row::-webkit-scrollbar {
  display: none;
}
.community-share-option {
  flex: 0 0 auto;
  width: 4.6rem;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: #262626;
}
.community-share-option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.35rem;
  height: 3.35rem;
  margin: 0 auto 0.45rem;
  border-radius: 9999px;
  background: #f2f2f2;
  transition: transform 0.12s ease;
}
.community-share-option-icon svg {
  width: 1.55rem;
  height: 1.55rem;
  display: block;
}
.community-share-option-icon--copy {
  color: #262626;
}
.community-share-option-icon--facebook {
  background: #e7f0ff;
  color: #1877f2;
}
.community-share-option-icon--facebook svg {
  width: 1.35rem;
  height: 1.35rem;
}
.community-share-option-icon--line {
  background: #e8f9ee;
}
.community-share-option-icon--line svg {
  width: 1.75rem;
  height: 1.75rem;
}
.community-share-option-icon--instagram {
  background: #f2f2f2;
  padding: 0;
}
.community-share-option-icon--instagram svg {
  width: 100%;
  height: 100%;
  border-radius: 9999px;
}
.community-share-option-label {
  display: block;
  font-size: 0.68rem;
  line-height: 1.25;
  text-align: center;
  color: #262626;
}
.community-share-option:active .community-share-option-icon {
  transform: scale(0.94);
}
@media (min-width: 768px) {
  .community-share-sheet {
    align-items: center;
  }
  .community-share-panel {
    border-radius: 1rem;
    max-width: 380px;
    transform: translateY(1.5rem);
    opacity: 0;
    transition: transform 0.28s ease, opacity 0.28s ease;
  }
  .community-share-sheet.is-open .community-share-panel {
    transform: translateY(0);
    opacity: 1;
  }
  .community-share-handle {
    display: none;
  }
}
.community-actions .material-symbols-outlined {
  font-size: 1.45rem;
  cursor: pointer;
}
.community-caption {
  padding: 0 0.85rem 0.35rem;
  font-size: 0.84rem;
  line-height: 1.45;
}
.community-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.85rem 0.35rem;
}
.community-tag {
  font-size: 0.68rem;
  color: #4a5d23;
  background: #f0efea;
  border-radius: 9999px;
  padding: 0.2rem 0.55rem;
}
.community-time {
  padding: 0 0.85rem 0.75rem;
  font-size: 0.62rem;
  color: #8e8e8e;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (min-width: 768px) {
  body.community-page {
    background: #e8e8e8;
  }
  .community-app {
    box-shadow: 0 0 0 1px #dbdbdb;
  }
}
