:root {
  --cream:    #F3F0FF;
  --ink:      #111111;
  --blue:     #A8D8EA;
  --pink:     #FBCFE8;
  --coral:    #FECACA;
  --mint:     #A7F3D0;
  --yellow:   #FEF08A;
  --lavender: #DDD6FE;
  --orange:   #FED7AA;
  --green-card: #C8F7C5;
  --yellow-card: #FFF3BF;
  --blue-card: #BAE6FD;
  --coral-card: #FFD6CC;
  --purple-card: #E9D5FF;
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 28px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

html, body {
  min-height: 100%;
}

/* ─── PODIUM ──────────────────────────────────────────────── */
.podium-container {
  display: flex !important;
  align-items: flex-end !important;
  justify-content: center !important;
  gap: 12px !important;
  padding: 40px 10px 10px !important;
  margin: 10px 0 20px !important;
}
.podium-item {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  flex: 1 !important;
  max-width: 100px !important;
}
.podium-item.first { order: 2 !important; }
.podium-item.second { order: 1 !important; }
.podium-item.third { order: 3 !important; }

.podium-avatar {
  width: 54px !important;
  height: 54px !important;
  border-radius: 50% !important;
  border: 2.5px solid var(--ink) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 900 !important;
  font-size: 0.9rem !important;
  margin-bottom: -8px !important;
  position: relative !important;
  z-index: 2 !important;
  box-shadow: 3px 3px 0 var(--ink) !important;
  animation: float 3s ease-in-out infinite !important;
  background: white;
}
.podium-item.second .podium-avatar { animation-delay: 0.5s !important; }
.podium-item.third .podium-avatar { animation-delay: 1s !important; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.podium-base {
  width: 100% !important;
  border: 2.5px solid var(--ink) !important;
  border-bottom: 3px solid var(--ink) !important;
  border-radius: 12px 12px 6px 6px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: 'Paytone One', sans-serif !important;
  font-size: 1.6rem !important;
  color: var(--ink) !important;
  box-shadow: 4px 4px 0 var(--ink) !important;
}
.podium-item.first .podium-base  { height: 90px !important; background: var(--yellow) !important; }
.podium-item.second .podium-base { height: 65px !important; background: var(--blue) !important; }
.podium-item.third .podium-base  { height: 50px !important; background: var(--pink) !important; }

.podium-name {
  margin-top: 12px !important;
  font-weight: 900 !important;
  font-size: 0.75rem !important;
  text-align: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  width: 100% !important;
  color: var(--ink) !important;
}

/* ─── DUAL PODIUM ─────────────────────────────────────────── */
.dual-podium-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.dual-podium-section {
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 8px 6px 8px;
}
.dual-podium-title {
  font-family: 'Paytone One', sans-serif;
  font-size: 0.7rem;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}

/* Mini podium — new classes, no !important conflict */
.xpod {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding: 40px 4px 0;
}
.xpod-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.xpod-ava {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 900;
  margin-bottom: -14px;
  position: relative;
  z-index: 2;
  box-shadow: 3px 3px 0 var(--ink);
  background: white;
  flex-shrink: 0;
  animation: float 3s ease-in-out infinite;
  overflow: hidden;
}
.xpod-col:nth-child(1) .xpod-ava { animation-delay: 0.5s; }
.xpod-col:nth-child(3) .xpod-ava { animation-delay: 1s; }
.xpod-plat {
  width: 100%;
  border: 3px solid var(--ink);
  border-radius: 12px 12px 6px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Paytone One', sans-serif;
  font-size: 1.85rem;
  box-shadow: 3px 3px 0 var(--ink);
}
.xpod-plat.p1 { height: 104px; background: var(--yellow); }
.xpod-plat.p2 { height: 78px; background: var(--blue); }
.xpod-plat.p3 { height: 62px; background: var(--pink); }
.xpod-name {
  font-size: clamp(0.55rem, 2.2vw, 0.95rem);
  font-weight: 900;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  width: 100%;
  padding: 8px 2px 0;
  color: var(--ink);
}

.xpod-ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.xpod-ava-duo {
  width: 112px;
  height: 82px;
  border-radius: 16px;
}

/* ─── DUO NAME EDIT ────────────────────────────────────────── */
.duo-name-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 900;
  font-size: 0.82rem;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  transition: all 0.1s;
}
.duo-name-badge:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--ink); }

/* ─── LEADERBOARD FILTERS ─────────────────────────────────── */
.lb-filter-btn {
  border: 2px solid var(--ink) !important;
  background: #fff !important;
  border-radius: 10px !important;
  padding: 5px 14px !important;
  font-weight: 800 !important;
  font-size: 0.72rem !important;
  cursor: pointer !important;
  box-shadow: 2px 2px 0 var(--ink) !important;
  transition: all 0.1s !important;
  font-family: 'Nunito', sans-serif !important;
}
.lb-filter-btn.active {
  background: var(--yellow) !important;
  color: var(--ink) !important;
  box-shadow: 3px 3px 0 var(--ink) !important;
  transform: none !important;
  border-color: var(--ink) !important;
}

.pill-btn {
  border: 2px solid var(--ink) !important;
  background: #fff !important;
  border-radius: 999px !important;
  padding: 6px 16px !important;
  font-weight: 800 !important;
  font-size: 0.75rem !important;
  cursor: pointer !important;
  box-shadow: 3px 3px 0 var(--ink) !important;
  transition: all 0.1s !important;
  white-space: nowrap !important;
  font-family: 'Nunito', sans-serif !important;
}
.pill-btn.active {
  background: var(--ink) !important;
  color: #fff !important;
  box-shadow: 3px 3px 0 rgba(0,0,0,.3) !important;
  transform: none !important;
}

.podium-tab {
  padding: 6px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.78rem;
  background: #fff;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  box-shadow: 2px 2px 0 var(--ink);
  transition: all 0.1s;
}
.podium-tab.active {
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
  transform: none;
}

* { box-sizing: border-box; }
button, a, [onclick] { touch-action: manipulation; }

body {
  background-color: var(--cream);
  font-family: 'Nunito', sans-serif;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
}

.font-display { font-family: 'Paytone One', sans-serif; }

/* ─── NEO BRUTALISM ───────────────────────────────────────── */
.neo {
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: 4px 4px 0 var(--ink);
}
.neo-lg {
  border: 3px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: 6px 6px 0 var(--ink);
}

/* ─── STAT CARDS (inspired by image) ──────────────────────── */
.stat-card {
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s, box-shadow .12s;
}
.stat-card:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}
.stat-card .stat-number {
  font-family: 'Paytone One', sans-serif;
  font-size: 2.2rem;
  line-height: 1.1;
}
.stat-card .stat-label {
  font-size: .78rem;
  font-weight: 800;
  margin-top: 4px;
  opacity: .7;
}
.stat-card .stat-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: rgba(255,255,255,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
}

.stat-green  { background: var(--green-card); }
.stat-yellow { background: var(--yellow-card); }
.stat-blue   { background: var(--blue-card); }
.stat-coral  { background: var(--coral-card); }
.stat-purple { background: var(--purple-card); }
.stat-mint   { background: var(--mint); }

.dashboard-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-stat-grid .stat-card {
  padding: 14px 14px 13px;
  min-height: 122px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dashboard-stat-grid .stat-number {
  font-size: clamp(1.55rem, 6vw, 2.15rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0;
  word-break: break-word;
}

.dashboard-stat-grid .stat-label {
  font-size: 0.66rem;
  line-height: 1.2;
  margin-top: 7px;
  font-weight: 900;
  opacity: .72;
}

.stat-span-2 {
  grid-column: span 2;
}

@media (min-width: 768px) {
  .dashboard-stat-grid {
    gap: 12px;
  }

  .dashboard-stat-grid .stat-card {
    padding: 16px;
    min-height: 132px;
  }

  .dashboard-stat-grid .stat-number {
    font-size: clamp(1.7rem, 3.2vw, 2.2rem);
  }

  .dashboard-stat-grid .stat-label {
    font-size: 0.72rem;
  }
}

#g-progress-week {
  font-size: clamp(1.38rem, 5.2vw, 1.95rem);
}

/* ─── SECTION HEADERS ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-family: 'Paytone One', sans-serif;
  font-size: 1.1rem;
}
.section-badge {
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 3px 12px;
  font-weight: 800;
  font-size: .7rem;
  box-shadow: 2px 2px 0 var(--ink);
}

/* ─── CHART CONTAINERS ────────────────────────────────────── */
.chart-card {
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  margin-bottom: 20px;
}
.chart-card h4 {
  font-family: 'Paytone One', sans-serif;
  font-size: 1rem;
  margin: 0 0 16px 0;
}
.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 800;
}
.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}

/* ─── TABS (for dashboard sections) ───────────────────────── */
.dash-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tabs { scrollbar-width: none; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.dash-tab {
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 900;
  font-size: .8rem;
  cursor: pointer;
  white-space: nowrap;
  background: #fff;
  box-shadow: 3px 3px 0 var(--ink);
  transition: all .15s;
  font-family: 'Nunito', sans-serif;
  flex-shrink: 0;
}
.dash-tab.active {
  background: var(--ink);
  color: #fff;
  box-shadow: 2px 2px 0 rgba(0,0,0,.3);
}
.dash-tab:not(.active):hover {
  background: var(--yellow);
}

.dash-section { display: none; }
.dash-section.active { display: block; }

/* ─── COMMUNITY SCATTER ───────────────────────────────────── */
.scatter-hint {
  background: var(--lavender);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.impact-chart-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 2px 2px 0 var(--lavender);
}

.impact-chart-head h4 {
  margin: 0;
  font-family: 'Paytone One', sans-serif;
  font-size: 1.05rem;
  color: var(--ink);
}

.impact-chart-head p {
  margin: 8px 0 14px 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  opacity: .6;
}

.impact-chart-canvas-wrap {
  background: var(--cream);
  border-radius: 16px;
  padding: 8px;
}

.impact-bubble-legend {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--cream);
}

.impact-legend-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink);
  opacity: .72;
  margin-bottom: 8px;
}

.impact-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  opacity: .7;
}

.impact-dot {
  display: inline-block;
  border-radius: 999px;
  background: var(--blue);
}

.impact-dot.sm { width: 10px; height: 10px; }
.impact-dot.md { width: 15px; height: 15px; }
.impact-dot.lg { width: 20px; height: 20px; }

.impact-insights {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.impact-insight {
  background: var(--cream);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.73rem;
  font-weight: 800;
  color: var(--ink);
  opacity: .82;
}

.community-podium-card {
  padding: 18px 16px 14px !important;
}

/* ─── LEADERBOARD ─────────────────────────────────────────── */
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: 3px 3px 0 var(--ink);
  margin-bottom: 10px;
  transition: transform .12s, box-shadow .12s;
}
.lb-row-click {
  cursor: pointer;
}
.lb-row:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}
.lb-row.is-you {
  border-color: #7C3AED;
  box-shadow: 3px 3px 0 #7C3AED;
}
.lb-rank {
  font-size: 1.3rem;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}
.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 900;
  flex-shrink: 0;
}
.lb-avatar-click {
  cursor: pointer;
  padding: 0;
  background: transparent;
  font-family: inherit;
}

.xpod-ava.is-clickable {
  cursor: pointer;
}
.lb-info { flex: 1; min-width: 0; }
.lb-name {
  font-weight: 800;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-name-duo {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.2;
  word-break: break-word;
}
.lb-stats {
  font-size: .72rem;
  font-weight: 700;
  color: #6B7280;
}
.lb-score {
  font-family: 'Paytone One', sans-serif;
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ─── BUTTONS ─────────────────────────────────────────────── */
.btn-dark {
  background: var(--ink); color: #fff; border: 2.5px solid var(--ink);
  border-radius: 50px; padding: 15px 28px; font-weight: 900; font-size: .95rem;
  cursor: pointer; width: 100%; box-shadow: 4px 4px 0 rgba(0,0,0,.22);
  transition: transform .1s, box-shadow .1s; font-family: 'Nunito', sans-serif;
}
.btn-dark:active  { transform: translate(2px,2px); box-shadow: 2px 2px 0 rgba(0,0,0,.22); }
.btn-dark:disabled { opacity:.55; cursor:not-allowed; }

.btn-ghost {
  background: transparent; color: var(--ink); border: 2.5px solid var(--ink);
  border-radius: 50px; padding: 12px 22px; font-weight: 900; font-size: .9rem;
  cursor: pointer; transition: background .15s; font-family: 'Nunito', sans-serif;
}
.btn-ghost:hover { background: var(--ink); color: #fff; }
.btn-ghost.sm { padding: 8px 16px; font-size: .8rem; }

.btn-danger {
  background: #FEE2E2; color: #991B1B; border: 2.5px solid #991B1B;
  border-radius: 50px; padding: 10px 20px; font-weight: 900; font-size: .85rem;
  cursor: pointer; box-shadow: 3px 3px 0 #991B1B; font-family: 'Nunito', sans-serif;
  transition: transform .1s; width: 100%;
}
.btn-danger:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 #991B1B; }

.btn-accept {
  background: var(--mint); color: var(--ink); border: 2px solid var(--ink);
  border-radius: 50px; padding: 8px 14px; font-weight: 900; font-size: .78rem;
  cursor: pointer; font-family: 'Nunito', sans-serif; white-space: nowrap;
}
.btn-reject {
  background: var(--coral); color: var(--ink); border: 2px solid var(--ink);
  border-radius: 50px; padding: 8px 14px; font-weight: 900; font-size: .78rem;
  cursor: pointer; font-family: 'Nunito', sans-serif; white-space: nowrap;
}

/* ─── INPUTS ──────────────────────────────────────────────── */
.neo-input {
  border: 2.5px solid var(--ink); border-radius: var(--radius-sm); padding: 13px 16px;
  width: 100%; font-size: 1rem; font-family: 'Nunito', sans-serif; font-weight: 700;
  background: #fff; outline: none; box-shadow: 3px 3px 0 var(--ink); transition: box-shadow .12s;
}
.neo-input:focus { box-shadow: 5px 5px 0 var(--ink); }

/* ─── ACTION CARDS ────────────────────────────────────────── */
.action-card {
  border: 3px solid var(--ink); border-radius: 22px; padding: 18px 20px; cursor: pointer;
  transition: transform .12s, box-shadow .12s; box-shadow: 6px 6px 0 var(--ink);
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  font-family: 'Nunito', sans-serif;
}
.action-card:active   { transform: translate(3px,3px); box-shadow: 3px 3px 0 var(--ink); }
.action-card:disabled { opacity:.55; cursor:not-allowed; transform:none; }
.action-card.share-race {
  animation: shareRaceLap .28s cubic-bezier(.22,.84,.27,1);
  will-change: transform;
}

@keyframes shareRaceLap {
  0%   { transform: translateX(0); }
  44%  { transform: translateX(118%); }
  45%  { transform: translateX(-118%); }
  100% { transform: translateX(0); }
}
.action-icon {
  width: 54px; height: 54px; border-radius: 14px; border: 2.5px solid var(--ink);
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; flex-shrink: 0;
}

/* ─── PILLS ───────────────────────────────────────────────── */
.pill {
  border: 2px solid var(--ink); border-radius: 999px; padding: 5px 13px;
  font-weight: 800; font-size: .8rem; box-shadow: 3px 3px 0 var(--ink);
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}

/* ─── BOTTOM NAV ──────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--ink);
  z-index: 100; display: flex; justify-content: space-around;
  padding: 10px 0 calc(22px + var(--safe-bottom));
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: rgba(255,255,255,.38); cursor: pointer; padding: 6px 18px; border-radius: 12px;
  transition: color .2s; border: none; background: transparent;
  font-family: 'Nunito', sans-serif; position: relative;
}
.nav-btn.active { color: var(--yellow); }
.nav-btn i { font-size: 1.2rem; }
.nav-btn span { font-size: .66rem; font-weight: 800; letter-spacing: .04em; }
.nav-badge {
  position: absolute; top: 2px; right: 10px; background: #EF4444; color: #fff;
  border-radius: 999px; font-size: .6rem; font-weight: 900; padding: 1px 5px;
  min-width: 16px; text-align: center; border: 2px solid var(--ink);
}

/* ─── TOAST ───────────────────────────────────────────────── */
#toast {
  position: fixed; top: calc(20px + var(--safe-top)); left: 50%;
  transform: translateX(-50%) translateY(-140px);
  z-index: 999; transition: transform .4s cubic-bezier(.34,1.56,.64,1);
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ─── DUO ─────────────────────────────────────────────────── */
.duo-ring {
  width: 78px; height: 78px; border-radius: 50%; border: 3px solid var(--ink);
  display: flex; align-items: center; justify-content: center; font-size: 1.8rem; flex-shrink: 0;
}
.duo-page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.duo-title-photo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: 2.5px solid var(--ink);
  background: var(--lavender);
  box-shadow: 3px 3px 0 var(--ink);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.duo-meta-actions {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.versus-bar { height: 12px; border-radius: 999px; border: 2px solid var(--ink); overflow: hidden; display: flex; }
.versus-me      { background: var(--blue); transition: width .6s ease; }
.versus-partner { background: var(--pink); transition: width .6s ease; }

/* ─── AVATARS ─────────────────────────────────────────────── */
.avatar-xl {
  width: 96px; height: 96px; border-radius: 50%; border: 3px solid var(--ink);
  background: var(--yellow); overflow: hidden; box-shadow: 4px 4px 0 var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.avatar-sm {
  width: 38px; height: 38px; border-radius: 50%; border: 2.5px solid var(--ink);
  background: var(--yellow); overflow: hidden; display: flex; align-items: center;
  justify-content: center; font-size: .85rem; font-weight: 900; flex-shrink: 0;
  cursor: pointer; box-shadow: 3px 3px 0 var(--ink); transition: transform .1s;
}
.avatar-sm:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.avatar-edit-btn {
  position: absolute; bottom: 0; right: -4px; width: 30px; height: 30px;
  border-radius: 50%; background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid #fff; cursor: pointer;
}

/* ─── ANIMATIONS ──────────────────────────────────────────── */
@keyframes slideUp { from{transform:translateY(28px);opacity:0} to{transform:translateY(0);opacity:1} }
.slide-up { animation: slideUp .4s ease forwards; }
@keyframes pop { 0%{transform:scale(.6);opacity:0} 60%{transform:scale(1.1)} 100%{transform:scale(1);opacity:1} }
.pop { animation: pop .35s ease forwards; }
.spin { animation: spin 1s linear infinite; display:inline-block; }
@keyframes spin { to{transform:rotate(360deg)} }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.fade-in { animation: fadeIn .3s ease forwards; }

/* ─── PAGE SYSTEM ─────────────────────────────────────────── */
.page { display: none !important; }
.page.active { display: block !important; }
#page-auth.active { display: flex !important; }
.page.active {
  padding-top: 1.5rem;
}
.wrap { max-width: 480px; margin: 0 auto; }
.divider { height: 1px; background: rgba(17,17,17,.1); margin: 22px 0; }
.tab-on  { background: var(--ink) !important; color: #fff !important; }
.tab-off { background: #fff; color: var(--ink); }

/* ─── MEDALS ──────────────────────────────────────────────── */
.medal-1{background:var(--yellow)} .medal-2{background:#E5E7EB} .medal-3{background:var(--coral)}

/* ─── ENCOURAGEMENT BANNER ────────────────────────────────── */
.encourage-banner {
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  margin-bottom: 20px;
}
.encourage-banner .encourage-emoji {
  font-size: 2rem;
  flex-shrink: 0;
}
.encourage-banner .encourage-text {
  font-weight: 800;
  font-size: .88rem;
  line-height: 1.4;
}

/* ─── COMMUNITY POPUP ─────────────────────────────────────── */
.community-popup {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: 4px 4px 0 var(--ink);
  z-index: 1000;
  min-width: 260px;
  max-width: calc(100vw - 40px);
  transform: translateX(calc(-100% - 30px));
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.community-popup.show {
  transform: translateX(0);
}

/* ─── 5X NO POPUP ────────────────────────────────────────── */
.no-popup {
  position: fixed;
  inset: 0;
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.no-popup.hidden {
  display: none;
}
.no-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.42);
  backdrop-filter: blur(3px);
}
.no-popup-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 22px 20px 20px;
  text-align: center;
}
.no-popup-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
  margin-bottom: 14px;
}
.no-popup-icon {
  width: 74px;
  height: 74px;
  margin: 0 auto 12px;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--pink), var(--lavender));
  box-shadow: 4px 4px 0 var(--ink);
}
.no-popup-rotation {
  min-height: 22px;
}
.no-popup-btn {
  width: 100%;
}

.heart-particle {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1003;
  pointer-events: none;
  font-size: 1.2rem;
  will-change: transform, opacity;
  animation: heart-float 1200ms ease-out forwards;
}

@keyframes heart-float {
  0% {
    transform: translate(var(--heart-x, 0px), var(--heart-y, 0px)) scale(0.7);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(var(--heart-x, 0px) + var(--heart-dx, 0px)), calc(var(--heart-y, 0px) - 180px)) scale(1.35);
    opacity: 0;
  }
}

.entry-undo {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 990;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(460px, calc(100vw - 24px));
  justify-content: space-between;
}

.lb-user-modal {
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: rgba(17,17,17,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lb-user-card {
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 18px;
  position: relative;
}
.lb-user-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
}
.lb-user-avatar {
  width: 132px;
  height: 132px;
  margin: 2px auto 12px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Paytone One', sans-serif;
  font-size: 2rem;
  background: var(--yellow);
}
.lb-user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.lb-user-chip {
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  box-shadow: 2px 2px 0 var(--ink);
  padding: 4px 10px;
  font-size: .72rem;
  font-weight: 900;
}
.lb-user-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ─── DUO DROPDOWN ────────────────────────────────────────── */
#duo-search-dropdown {
  box-shadow: 4px 4px 0 var(--ink);
}
.duo-search-item {
  padding: 10px 14px;
  border-bottom: 2px solid rgba(0,0,0,0.05);
  cursor: pointer;
  transition: background 0.1s;
}
.duo-search-item:last-child {
  border-bottom: none;
}
.duo-search-item:hover {
  background: var(--cream);
}

.duo-name-badge {
  max-width: 100%;
  text-align: center;
  justify-content: center;
  white-space: normal;
  word-break: break-word;
}

.duo-meta-actions {
  width: 100%;
}

/* ─── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 380px) {
  .stat-card .stat-number { font-size: 1.8rem; }
  .dash-tab { padding: 6px 14px; font-size: .75rem; }
  .lb-user-avatar { width: 108px; height: 108px; }
  .lb-user-chip { font-size: .66rem; }
}

/* ═══════════════════════════════════════════════════════════
   LIQUID FLOW BACKGROUND
═══════════════════════════════════════════════════════════ */
body { position: relative; }

#flow-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: block;
  overflow: hidden;
  --liquid-pct: 0%;
  --stream-height: 0px;
  --flow-violet-deep: #5B21B6;
  --flow-violet-mid: #7C3AED;
  --flow-violet-light: #A78BFA;
}
.page.active { background: transparent !important; position: relative; z-index: 1; }

#flow-fill {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(
    180deg,
    rgba(167, 139, 250, 0.62) 0%,
    rgba(167, 139, 250, 0.74) 20%,
    rgba(124, 58, 237, 0.78) 55%,
    rgba(91, 33, 182, 0.78) 100%
  );
  transition: height 2s cubic-bezier(0.34, 1.56, 0.64, 1);
  height: 0%;
  z-index: 2;
}

#flow-fill::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -40px;
  height: 56px;
  background: linear-gradient(180deg, rgba(167, 139, 250, 0) 0%, rgba(167, 139, 250, 0.14) 68%, rgba(124, 58, 237, 0.24) 100%);
  pointer-events: none;
}

#flow-stream {
  position: absolute;
  top: 0;
  left: 34%;
  width: 32%;
  height: var(--stream-height);
  opacity: 0;
  transition: opacity .35s ease, height .65s ease;
  overflow: visible;
  z-index: 1;
}

#flow-stream.active {
  opacity: .62;
  animation: streamPulse 1.7s ease-in-out infinite;
}

.flow-line {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(224, 231, 255, 0.85) 0%, rgba(167, 139, 250, 0.65) 45%, rgba(129, 140, 248, 0.52) 100%);
  box-shadow: 0 0 7px rgba(167, 139, 250, 0.28);
}

.line-main {
  left: 51%;
  width: 4px;
  transform: translateX(-50%);
}

.line-thin {
  left: 43%;
  width: 2px;
  opacity: .75;
}

.line-micro {
  left: 58%;
  width: 1px;
  opacity: .62;
}

.line-side {
  left: 34%;
  width: 3px;
  opacity: .68;
}

.line-right {
  left: 67%;
  width: 2px;
  opacity: .66;
}

.line-left-far {
  left: 26%;
  width: 1px;
  opacity: .58;
}

.flow-drop {
  position: absolute;
  top: 0;
  width: 4px;
  height: 7px;
  border-radius: 999px;
  background: rgba(224, 231, 255, 0.9);
  box-shadow: 0 0 6px rgba(196, 181, 253, 0.42);
  opacity: 0;
}

#flow-stream.active .flow-drop {
  animation: dropFall 2.4s linear infinite;
}

.d1 { left: calc(51% - 1px); animation-delay: 0s !important; }
.d2 { left: 43%; animation-delay: .55s !important; height: 6px; width: 3px; }
.d3 { left: 58%; animation-delay: 1.1s !important; height: 5px; width: 3px; }
.d4 { left: 34%; animation-delay: .85s !important; height: 8px; width: 4px; }
.d5 { left: 48%; animation-delay: 1.45s !important; height: 6px; width: 2px; }
.d6 { left: 39%; animation-delay: 1.9s !important; height: 5px; width: 2px; }
.d7 { left: 67%; animation-delay: .35s !important; height: 7px; width: 3px; }
.d8 { left: 26%; animation-delay: 1.25s !important; height: 6px; width: 2px; }
.d9 { left: 61%; animation-delay: 2.05s !important; height: 5px; width: 2px; }
.d10 { left: 30%; animation-delay: .95s !important; height: 4px; width: 2px; }

@keyframes dropFall {
  0%   { transform: translateY(-8px); opacity: 0; }
  12%  { opacity: .75; }
  70%  { opacity: .65; }
  100% { transform: translateY(calc(var(--stream-height) + 34px)); opacity: 0; }
}

.flow-wave {
  position: absolute;
  top: -64px;
  left: -15%;
  width: 140%;
  height: 120px;
  transform-origin: center;
  will-change: transform;
  z-index: 3;
}

.wave-back {
  opacity: .15;
  animation: waveDriftLeft 6.6s ease-in-out infinite alternate;
}

.wave-mid {
  opacity: .22;
  animation: waveDriftRight 4.8s ease-in-out infinite alternate;
}

.wave-front {
  opacity: .38;
  animation: waveDriftLeftSoft 3.9s ease-in-out infinite alternate;
}

@keyframes waveDriftLeft {
  0% { transform: translate3d(-4%, 0, 0); }
  100% { transform: translate3d(-12%, 2px, 0); }
}

@keyframes waveDriftRight {
  0% { transform: translate3d(-11%, 0, 0); }
  100% { transform: translate3d(-3%, -2px, 0); }
}

@keyframes waveDriftLeftSoft {
  0% { transform: translate3d(-2%, 0, 0); }
  100% { transform: translate3d(-8%, 1px, 0); }
}

@keyframes streamPulse {
  0%, 100% { filter: saturate(100%); }
  50% { filter: saturate(140%); }
}

/* ═══════════════════════════════════════════════════════════
   CANDY-STRIPE GOAL PROGRESS BAR
═══════════════════════════════════════════════════════════ */
.goal-card {
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 14px 16px 16px;
}

.goal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.goal-card-title {
  font-family: 'Paytone One', sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
}
.goal-card-count {
  font-size: 0.75rem;
  font-weight: 800;
  color: #6b21a8;
}

.goal-track-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.goal-track {
  flex: 1;
  height: 28px;
  background: #1a1a1a;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
}

.goal-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f0abfc, #c026d3, #818cf8, #f0abfc);
  background-size: 300% 100%;
  animation: goalColorShift 3s linear infinite;
  position: relative;
  overflow: hidden;
  min-width: 0;
  transition: width 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes goalColorShift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

.goal-stripes {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    55deg,
    rgba(255,255,255,0.14) 0px,
    rgba(255,255,255,0.14) 12px,
    transparent 12px,
    transparent 28px
  );
  will-change: background-position;
  transform: translateZ(0);
  animation: stripeScroll 2.15s linear infinite;
}
@keyframes stripeScroll { from { background-position: 0 0; } to { background-position: 168px 0; } }

.goal-gloss {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 48%;
  background: linear-gradient(180deg, rgba(255,255,255,0.38) 0%, transparent 100%);
  border-radius: 999px 999px 0 0;
}

.goal-badge {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  background: linear-gradient(135deg, #f0abfc, #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Paytone One', sans-serif;
  font-size: 0.6rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  line-height: 1;
  text-align: center;
}
