:root {
  --green-dark: #2d5a3f;
  --green-darker: #062823;
  --green-lime: #a8e063;
  --green-lime-hover: #98d055;
  --green-mint: #e8f5e9;
  --green-mint-hero: #eef6ef;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;
  --surface: #ffffff;
  --border: #e5ebe8;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --max-w: 480px;
  --tabbar-h: 72px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

.home-body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  line-height: 1.45;
}

.home-app {
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + 16px);
}

/* Header */
.home-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 8px;
}

.home-brand {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.home-brand-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.home-brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--green-dark);
  letter-spacing: -0.02em;
}

.home-brand-tag {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  margin-top: 2px;
}

.home-btn-outline {
  flex-shrink: 0;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green-darker);
  background: var(--surface);
  border: 1.5px solid var(--green-darker);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.home-btn-outline:hover {
  background: #f8faf9;
}

.home-main {
  padding: 0 18px 24px;
}

/* Hero */
.home-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  background: linear-gradient(135deg, var(--green-mint) 0%, var(--green-mint-hero) 100%);
  border-radius: 16px;
  padding: 20px 16px 20px 18px;
  margin-bottom: 28px;
}

.home-hero-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--green-darker);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 8px;
}

.home-hero-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
  max-width: 220px;
}

.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.home-btn:active {
  transform: scale(0.98);
}

.home-btn--lime {
  background: var(--green-lime);
  color: var(--green-darker);
}

.home-btn--lime:hover {
  background: var(--green-lime-hover);
}

.home-btn--dark {
  background: var(--green-dark);
  color: #fff;
}

.home-btn--dark:hover {
  opacity: 0.92;
}

.home-hero-art {
  flex-shrink: 0;
  opacity: 0.95;
}

/* Sections */
.home-section {
  margin-bottom: 28px;
}

.home-section--last {
  margin-bottom: 8px;
}

.home-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--green-darker);
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

/* Featured scroll */
.featured-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.featured-scroll::-webkit-scrollbar {
  display: none;
}

.featured-card {
  flex: 0 0 72%;
  max-width: 280px;
  scroll-snap-align: start;
}

.featured-card.is-clickable {
  cursor: pointer;
  border-radius: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.featured-card.is-clickable:hover {
  transform: translateY(-2px);
}

.featured-card.is-clickable:focus-visible {
  outline: 2px solid var(--green-lime);
  outline-offset: 4px;
}

.featured-img {
  width: 100%;
  height: 168px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  background: var(--border);
}

.featured-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 10px 0 8px;
  line-height: 1.3;
}

.progress {
  height: 6px;
  background: #eceff1;
  border-radius: 999px;
  overflow: hidden;
}

.progress--thin {
  height: 5px;
  margin: 6px 0 4px;
}

.progress-fill {
  height: 100%;
  background: var(--green-lime);
  border-radius: 999px;
}

.featured-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}

.amount-raised {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green-dark);
}

.donate-btn {
  flex-shrink: 0;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--green-darker);
  background: var(--green-lime);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.donate-btn:hover {
  background: var(--green-lime-hover);
}

.donate-btn--sm {
  padding: 6px 14px;
  font-size: 0.78rem;
}

/* Family list */
.family-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.family-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.family-row.is-clickable {
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.family-row.is-clickable:hover {
  box-shadow: 0 4px 16px rgba(6, 40, 35, 0.08);
  border-color: #d8e4dc;
}

.family-row.is-clickable:focus-visible {
  outline: 2px solid var(--green-lime);
  outline-offset: 2px;
}

.family-row.is-hidden {
  display: none;
}

.family-row:not(.is-hidden) + .family-row.is-hidden {
  display: none;
}

.family-list.show-all .family-row.is-hidden {
  display: grid;
}

.family-thumb {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--border);
}

.family-body {
  min-width: 0;
}

.family-title {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 2px;
}

.family-stats {
  font-size: 0.78rem;
  margin-top: 2px;
}

.goal-text {
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 6px;
}

.family-meta {
  font-size: 0.72rem;
  color: var(--text-soft);
  margin-top: 4px;
}

.meta-dot {
  margin: 0 4px;
}

.family-row .donate-btn {
  align-self: end;
  margin-bottom: 2px;
}

.show-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--green-darker);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.show-more-btn:hover {
  background: #fafafa;
}

.show-more-btn.is-open svg {
  transform: rotate(180deg);
}

.show-more-btn svg {
  transition: transform 0.2s ease;
}

/* Community */
.community-head {
  margin-bottom: 12px;
}

.community-sub {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-top: -8px;
}

.activity-ticker {
  overflow: hidden;
  position: relative;
  --activity-row-h: 65px;
  height: calc(var(--activity-row-h) * 3);
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 8%,
    #000 92%,
    transparent 100%
  );
}

.activity-list {
  list-style: none;
}

.activity-track {
  will-change: transform;
  animation: activity-scroll-up var(--activity-duration, 36s) linear infinite;
}

.activity-ticker:hover .activity-track {
  animation-play-state: paused;
}

@keyframes activity-scroll-up {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(0, var(--activity-scroll, -50%), 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .activity-track {
    animation: none;
  }

  .activity-ticker {
    height: auto;
    max-height: calc(var(--activity-row-h) * 5);
    overflow-y: auto;
    mask-image: none;
  }
}

.activity-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: var(--activity-row-h);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.activity-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
}

.activity-text {
  font-size: 0.88rem;
  color: var(--text);
}

.activity-text strong {
  font-weight: 700;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-soft);
  white-space: nowrap;
}

/* Tab bar */
.home-tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--max-w);
  height: var(--tabbar-h);
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-soft);
  text-decoration: none;
}

.tab-item--active {
  color: var(--green-dark);
}

.tab-explore {
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: var(--green-dark);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab-explore:hover {
  opacity: 0.92;
}

@media (max-width: 380px) {
  .home-header {
    padding: 14px 14px 6px;
  }

  .home-main {
    padding: 0 14px 20px;
  }

  .home-btn-outline {
    font-size: 0.72rem;
    padding: 7px 10px;
  }

  .family-row {
    grid-template-columns: 72px 1fr;
  }

  .family-row .donate-btn {
    grid-column: 2;
    justify-self: end;
  }

  .family-thumb {
    width: 72px;
    height: 72px;
  }
}
