/* ============================================================
   style.css — Paralica Health Dashboard
   Premium dark UI · Glass morphism · 60fps animations
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;0,14..32,900&display=swap');

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
  /* Colors */
  --bg:           #06060c;
  --bg-deep:      #040408;
  --bg-card:      rgba(15, 15, 25, 0.70);
  --bg-card-hover: rgba(20, 20, 35, 0.85);
  --bg-glass:     rgba(255, 255, 255, 0.035);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);

  --border:       rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.12);
  --border-bright: rgba(255, 255, 255, 0.18);

  --text:         #f2f2f7;
  --text-secondary: #8e8ea0;
  --text-muted:   #4f4f65;

  /* Brand */
  --brand-gradient: linear-gradient(135deg, #667eea, #764ba2);
  --brand-from:   #667eea;
  --brand-to:     #764ba2;

  /* Score colors */
  --purple:       #a855f7;
  --green:        #22c55e;
  --blue:         #3b82f6;
  --orange:       #f97316;
  --red:          #ef4444;
  --pink:         #ec4899;
  --cyan:         #06b6d4;
  --yellow:       #eab308;

  /* UI */
  --radius:       20px;
  --radius-md:    14px;
  --radius-sm:    10px;
  --radius-xs:    8px;
  --radius-pill:  100px;

  /* Shadows */
  --shadow-card:  0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow-purple: 0 0 20px rgba(168, 85, 247, 0.3);
  --shadow-glow-green:  0 0 20px rgba(34, 197, 94, 0.3);
  --shadow-glow-blue:   0 0 20px rgba(59, 130, 246, 0.3);
  --shadow-glow-orange: 0 0 20px rgba(249, 115, 22, 0.3);

  /* Spacing */
  --page-gutter:  20px;

  /* Transitions */
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth:  cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

/* ============================================================
   Nebula Background Blobs
   ============================================================ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%,  rgba(102, 126, 234, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 70% 70% at 80% 85%,  rgba(118,  75, 162, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 60% 40%,  rgba( 59, 130, 246, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 40% 70%,  rgba( 34, 197,  94, 0.04) 0%, transparent 50%);
  animation: nebulaDrift 25s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes nebulaDrift {
  0%   { transform: translate(0,   0)   scale(1);    }
  33%  { transform: translate(1%,  -1%) scale(1.02); }
  66%  { transform: translate(-1%, 1%)  scale(0.98); }
  100% { transform: translate(2%,  -2%) scale(1.01); }
}

/* ============================================================
   Pull-Refresh Indicator
   ============================================================ */
.pull-refresh {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  z-index: 200;
  transition: transform 0.3s var(--ease-smooth);
}
.pull-refresh-inner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}
.pull-refresh-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--brand-from);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   App Container
   ============================================================ */
.app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 1;
}

/* ============================================================
   Header
   ============================================================ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 16px) var(--page-gutter) 14px;
  padding-top: max(env(safe-area-inset-top), 16px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 6, 12, 0.82);
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  border-bottom: 1px solid var(--border);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-bolt {
  -webkit-text-fill-color: initial;
  background: none;
  filter: drop-shadow(0 0 8px rgba(255, 210, 0, 0.6));
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease-smooth);
  position: relative;
}
.header-btn:hover {
  background: var(--bg-glass-hover);
  color: var(--text);
  border-color: var(--border-light);
}
.header-btn:active { transform: scale(0.92); }

.notif-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid var(--bg);
}

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c63ff, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(168,85,247,0.4);
}

/* ============================================================
   Profile Section
   ============================================================ */
.profile-section {
  padding: 20px var(--page-gutter) 16px;
}

.profile-top {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: white;
  position: relative;
  z-index: 1;
}

.avatar-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #a855f7, #22c55e);
  z-index: 0;
  padding: 2.5px;
}
.avatar-ring::after {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg);
}

.avatar-online {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg);
  z-index: 2;
  box-shadow: 0 0 8px rgba(34,197,94,0.5);
}

.profile-info h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 2px;
}

.profile-info .handle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.profile-info .bio {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.profile-info .location {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 0;
  margin-bottom: 14px;
  backdrop-filter: blur(24px);
}

.profile-stats .stat {
  text-align: center;
  border-right: 1px solid var(--border);
}
.profile-stats .stat:last-child { border-right: none; }
.profile-stats .stat .num {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.profile-stats .stat .label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.2s;
}
.badge:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-light);
  color: var(--text);
  transform: translateY(-1px);
}

.edit-profile-btn {
  width: 100%;
  padding: 10px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: -0.01em;
}
.edit-profile-btn:hover { background: var(--bg-glass-hover); border-color: var(--border-light); }
.edit-profile-btn:active { transform: scale(0.98); }

/* ============================================================
   Score Rings
   ============================================================ */
.scores-row {
  display: flex;
  gap: 10px;
  padding: 0 var(--page-gutter) 20px;
}

.score-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 6px;
  text-align: center;
  backdrop-filter: blur(24px);
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  position: relative;
  overflow: hidden;
}
.score-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 100%);
  pointer-events: none;
}
.score-card:hover, .score-card.expanded {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.score-card:active { transform: scale(0.97) translateY(0); }

.score-ring-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 10px;
}

.score-ring-wrap svg {
  width: 90px;
  height: 90px;
  transform: rotate(-90deg);
  overflow: visible;
}

.score-ring-wrap .score-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.score-card .score-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.score-card .score-change {
  font-size: 10px;
  font-weight: 700;
  margin-top: 3px;
}
.score-change.up { color: var(--green); }
.score-change.down { color: var(--red); }

/* Score factors */
.score-factors {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s var(--ease-smooth);
  padding: 0 var(--page-gutter);
}
.score-factors.open {
  max-height: 520px;
  padding: 0 var(--page-gutter) 20px;
}

.factor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(24px);
}

.factor-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.factor-row {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.factor-row:last-child { border-bottom: none; }

.factor-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.factor-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.factor-icon { font-size: 15px; }
.factor-name { font-size: 13px; color: var(--text-secondary); }
.factor-value { font-size: 14px; font-weight: 700; }
.factor-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  overflow: hidden;
}
.factor-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1.2s var(--ease-smooth);
}

/* ============================================================
   Stories Row
   ============================================================ */
.stories-section {
  padding: 0 0 16px;
}

.stories-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0 var(--page-gutter) 10px;
}

.stories-scroll {
  overflow-x: auto;
  padding: 4px var(--page-gutter) 4px;
}

.stories-row {
  display: flex;
  gap: 14px;
  min-width: max-content;
}

.story-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  min-width: 72px;
  transition: transform 0.2s var(--ease-spring);
}
.story-bubble:active { transform: scale(0.93); }

.story-ring-svg {
  width: 70px;
  height: 70px;
}

.story-ring-track {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 3;
}

.story-ring-fill {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s var(--ease-smooth);
}

.story-inner-circle {
  cursor: pointer;
}

.story-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.story-icon-text {
  font-size: 18px;
  line-height: 1;
}

.story-value-text {
  font-size: 11px;
  font-weight: 800;
  fill: white;
  letter-spacing: -0.03em;
}

.story-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

.story-change {
  font-size: 9px;
  font-weight: 700;
}

/* Active story pulse */
.story-bubble.active .story-ring-svg {
  animation: storyPulse 2s ease-in-out infinite;
}

@keyframes storyPulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(168,85,247,0.4)); }
  50%       { filter: drop-shadow(0 0 14px rgba(168,85,247,0.7)); }
}

/* ============================================================
   Integrations Bar
   ============================================================ */
.integrations-scroll {
  overflow-x: auto;
  padding: 0 0 16px;
}

.integrations-bar {
  display: flex;
  gap: 8px;
  padding: 0 var(--page-gutter);
  min-width: max-content;
}

.integration-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(24px);
  border-left: 3px solid var(--chip-color, var(--border-light));
  transition: all 0.2s;
}
.integration-chip:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.integration-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(34,197,94,0.6);
  animation: integrationPulse 2.5s ease-in-out infinite;
}

@keyframes integrationPulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 6px rgba(34,197,94,0.6); }
  50%       { opacity: 0.6; transform: scale(0.8); box-shadow: 0 0 2px rgba(34,197,94,0.3); }
}

.integration-name { color: var(--text); font-weight: 600; }
.integration-sync { color: var(--text-muted); font-size: 10px; margin-left: 2px; }

/* ============================================================
   Tab Bar
   ============================================================ */
.tab-bar {
  display: flex;
  position: sticky;
  top: 57px;
  z-index: 90;
  background: rgba(6, 6, 12, 0.88);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
}

.tab-indicator {
  position: absolute;
  bottom: -1px;
  height: 2px;
  background: var(--brand-gradient);
  border-radius: 2px 2px 0 0;
  transition: all 0.3s var(--ease-smooth);
  pointer-events: none;
}

.tab-btn {
  flex: 1;
  padding: 11px 4px 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn .tab-icon { font-size: 16px; }
.tab-btn .tab-label { font-size: 10px; letter-spacing: 0.2px; }
.tab-btn.active { color: var(--text); }

/* ============================================================
   Tab Content
   ============================================================ */
.tab-content {
  display: none;
  padding: 0 var(--page-gutter);
  animation: tabIn 0.28s var(--ease-smooth) both;
}
.tab-content.active { display: block; }

@keyframes tabIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Feed Cards
   ============================================================ */
.feed-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  backdrop-filter: blur(24px);
  transition: all 0.3s var(--ease-smooth);
  box-shadow: var(--shadow-card);
  position: relative;
}

.feed-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--card-accent, var(--brand-gradient));
  opacity: 0.9;
}

.feed-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  border-color: var(--border-light);
}

.feed-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 12px;
}

.feed-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
}

.feed-header-info { flex: 1; min-width: 0; }
.feed-header-info .name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.feed-header-info .meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.feed-header-info .timestamp {
  font-size: 11px;
  color: var(--text-muted);
}

.device-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.activity-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.feed-card-body {
  padding: 0 18px 16px;
}

.feed-card-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.feed-card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

/* Metrics grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.metric-box {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  transition: background 0.2s;
}
.metric-box:hover { background: rgba(255,255,255,0.05); }
.metric-box .metric-val {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.metric-box .metric-unit {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
.metric-box .metric-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* HR Zones */
.hr-zones-wrap { margin: 12px 0; }

.hr-zones-bar {
  display: flex;
  height: 10px;
  border-radius: var(--radius-pill);
  overflow: visible;
  gap: 2px;
  margin-bottom: 8px;
}

.hr-zone-segment {
  border-radius: var(--radius-pill);
  height: 100%;
  transition: width 1s var(--ease-smooth);
  position: relative;
}

.hr-zones-legend {
  display: flex;
  justify-content: space-between;
}
.hr-zone-label {
  font-size: 10px;
  font-weight: 600;
}

/* Sleep */
.sleep-breakdown {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.sleep-stage {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.04);
  border-left: 3px solid var(--stage-color, var(--border));
}
.sleep-stage .stage-val {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.sleep-stage .stage-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Race */
.race-splits {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.split-box {
  text-align: center;
  padding: 9px 4px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.04);
}
.split-box .split-val {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}
.split-box .split-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Glucose */
.glucose-highlights {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.glucose-stat {
  text-align: center;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.04);
}
.glucose-stat .g-val {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.glucose-stat .g-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.glucose-chart-wrap {
  height: 110px;
  margin: 8px 0 4px;
  position: relative;
}

/* Bloodwork */
.bloodwork-highlights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.bw-highlight {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bw-name {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 3px;
  font-weight: 500;
}
.bw-val {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.bw-change {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
}
.bw-change.up { color: var(--green); background: rgba(34,197,94,0.1); }
.bw-change.down-good { color: var(--green); background: rgba(34,197,94,0.1); }
.bw-change.down-bad { color: var(--red); background: rgba(239,68,68,0.1); }

/* Splits */
.splits-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}
.split-item {
  display: flex;
  flex-direction: column;
  padding: 5px 7px;
  font-size: 12px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.03);
}
.split-mile {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.split-pace { font-weight: 700; font-size: 12px; }

/* ============================================================
   Feed Card Footer (Social)
   ============================================================ */
.feed-card-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
}

.feed-actions {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 10px;
}

.feed-action {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px 6px 0;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.feed-action:hover { color: var(--text); }
.feed-action:active { transform: scale(0.9); }

.feed-action.like-btn .like-icon {
  font-size: 20px;
  transition: transform 0.3s var(--ease-spring);
  display: inline-block;
}
.feed-action.like-btn.liked .like-icon {
  color: var(--red);
  filter: drop-shadow(0 0 4px rgba(239,68,68,0.5));
  animation: heartBounce 0.4s var(--ease-spring);
}
@keyframes heartBounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.feed-action-icon { font-size: 18px; }

.feed-likes {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.feed-comments { }

.feed-comment {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  padding-left: 2px;
}

.comment-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  margin-top: 1px;
}

.comment-body { flex: 1; }
.comment-user {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.comment-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 5px;
}
.comment-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
  display: block;
}

.view-all-comments {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 0;
  font-weight: 600;
  transition: color 0.2s;
}
.view-all-comments:hover { color: var(--text-secondary); }

/* ============================================================
   Stats Tab
   ============================================================ */
.stats-section { margin-bottom: 24px; }

.stats-section-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1px;
}

.stats-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-card);
  transition: all 0.3s var(--ease-smooth);
}
.stats-chart-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.stats-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.stats-chart-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.stats-chart-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stats-chart-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stats-chart-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-align: right;
}
.stats-chart-delta {
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  margin-top: 2px;
}

.chart-area {
  height: 140px;
  position: relative;
}
.chart-area canvas { width: 100% !important; height: 100% !important; }

.time-toggle {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.time-toggle button {
  padding: 4px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.time-toggle button.active {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

/* Glucose weekly */
.glucose-week-grid {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}
.glucose-day-card {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius-xs);
}
.glucose-day-name { font-size: 9px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; margin-bottom: 4px; }
.glucose-day-avg { font-size: 14px; font-weight: 800; color: var(--orange); letter-spacing: -0.02em; }
.glucose-day-tir { font-size: 9px; font-weight: 700; margin-top: 2px; }

/* ============================================================
   Labs Tab
   ============================================================ */
.labs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-top: 4px;
}
.labs-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.labs-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.upload-btn {
  padding: 8px 16px;
  background: var(--brand-gradient);
  border: none;
  border-radius: var(--radius-pill);
  color: white;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(102,126,234,0.3);
}
.upload-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.upload-btn:active { transform: scale(0.97); }

.labs-category-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin: 20px 0 10px;
  padding: 0 2px;
}

.biomarker-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--bm-color, var(--green));
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  backdrop-filter: blur(24px);
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
  box-shadow: var(--shadow-card);
}
.biomarker-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  border-color: var(--border-light);
  border-left-color: var(--bm-color, var(--green));
}

.biomarker-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.biomarker-name {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}

.biomarker-right { text-align: right; }

.biomarker-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.biomarker-unit {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 2px;
}

.biomarker-change {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  display: inline-block;
  margin-top: 3px;
}
.biomarker-change.positive { color: var(--green); background: rgba(34,197,94,0.12); }
.biomarker-change.negative { color: var(--red); background: rgba(239,68,68,0.12); }

.biomarker-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.biomarker-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.biomarker-status.optimal { background: rgba(34,197,94,0.15); color: var(--green); }
.biomarker-status.normal  { background: rgba(234,179,8,0.15);  color: var(--yellow); }
.biomarker-status.attention { background: rgba(239,68,68,0.15); color: var(--red); }

.biomarker-range-label {
  font-size: 10px;
  color: var(--text-muted);
}

/* Range bar */
.biomarker-range-bar {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-pill);
  margin: 8px 0 12px;
  position: relative;
  overflow: visible;
}
.biomarker-range-optimal-zone {
  position: absolute;
  height: 100%;
  background: rgba(34,197,94,0.25);
  border-radius: var(--radius-pill);
  top: 0;
}
.biomarker-range-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid var(--bg);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2), var(--shadow-glow-green);
  z-index: 2;
}

.biomarker-sparkline {
  height: 56px;
  margin-top: 4px;
}
.biomarker-sparkline canvas { width: 100% !important; height: 100% !important; }

/* ============================================================
   Activities Tab
   ============================================================ */
.activities-header {
  padding-top: 4px;
  margin-bottom: 20px;
}
.activities-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}
.activities-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.activity-breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.activity-breakdown-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(24px);
  transition: all 0.25s var(--ease-smooth);
}
.activity-breakdown-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.act-card-num {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 4px;
}
.act-card-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.act-card-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.act-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.act-progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 1.2s var(--ease-smooth);
}

/* Calendar heatmap */
.heatmap-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}
.heatmap-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.heatmap-grid {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: transform 0.15s;
}
.heatmap-cell:hover { transform: scale(1.3); }
.heatmap-cell.l1 { background: rgba(59,130,246,0.2); }
.heatmap-cell.l2 { background: rgba(59,130,246,0.4); }
.heatmap-cell.l3 { background: rgba(59,130,246,0.65); }
.heatmap-cell.l4 { background: rgba(59,130,246,0.9); }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
}
.heatmap-legend-label {
  font-size: 10px;
  color: var(--text-muted);
}

/* ============================================================
   Profile Tab
   ============================================================ */
.profile-tab-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-card);
}

.profile-tab-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Goals */
.goal-item {
  margin-bottom: 14px;
}
.goal-item:last-child { margin-bottom: 0; }
.goal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.goal-name {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.goal-progress-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}
.goal-bar {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.goal-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 1.2s var(--ease-smooth);
}

/* Badges grid */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.badge-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s var(--ease-smooth);
}
.badge-card:hover {
  background: rgba(255,255,255,0.06);
  transform: translateY(-2px);
  border-color: var(--border-light);
}
.badge-card:active { transform: scale(0.95); }
.badge-emoji { font-size: 24px; display: block; margin-bottom: 6px; }
.badge-name { font-size: 10px; font-weight: 700; color: var(--text-secondary); letter-spacing: 0.2px; }

/* Connected devices */
.device-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.device-item:last-child { border-bottom: none; }
.device-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.device-info { flex: 1; }
.device-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.device-sync {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.device-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
}
.device-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(34,197,94,0.5);
}

/* ============================================================
   Bottom Nav
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  background: rgba(6, 6, 12, 0.85);
  backdrop-filter: blur(30px) saturate(1.5);
  -webkit-backdrop-filter: blur(30px) saturate(1.5);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  height: calc(64px + max(0px, env(safe-area-inset-bottom)));
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 4px 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-glow-dot {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand-from);
  opacity: 0;
  box-shadow: 0 0 8px var(--brand-from);
  transition: opacity 0.2s;
}

.nav-btn .nav-icon {
  transition: all 0.2s var(--ease-smooth);
}

.nav-btn span:not(.nav-glow-dot) {
  font-size: 10px;
  letter-spacing: 0.2px;
}

.nav-btn.active { color: var(--text); }
.nav-btn.active .nav-icon {
  filter: drop-shadow(0 0 8px rgba(102,126,234,0.6));
  stroke: url(#navGrad) var(--brand-from);
}
.nav-btn.active .nav-glow-dot { opacity: 1; }
.nav-btn:active .nav-icon { transform: scale(0.88); }

/* SVG gradient for nav icons */
.nav-svg-defs { position: absolute; width: 0; height: 0; }

/* ============================================================
   FAB
   ============================================================ */
.fab {
  position: fixed;
  bottom: calc(74px + max(0px, env(safe-area-inset-bottom)));
  right: max(calc(50% - 230px), 20px);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand-gradient);
  border: none;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(102,126,234,0.5), 0 0 0 1px rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  transition: all 0.3s var(--ease-spring);
}
.fab:hover {
  transform: scale(1.1) rotate(45deg);
  box-shadow: 0 8px 30px rgba(102,126,234,0.6);
}
.fab:active { transform: scale(0.95) rotate(45deg); }

/* ============================================================
   Animations — Fade In / Stagger
   ============================================================ */
.fade-in {
  opacity: 0;
  animation: fadeInCard 0.5s var(--ease-smooth) forwards;
}

@keyframes fadeInCard {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.12s; }
.stagger-3 { animation-delay: 0.19s; }
.stagger-4 { animation-delay: 0.26s; }
.stagger-5 { animation-delay: 0.33s; }
.stagger-6 { animation-delay: 0.40s; }

/* ============================================================
   Inner Glow Utility
   ============================================================ */
.glow-card {
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ============================================================
   Responsive — Min Desktop Centering
   ============================================================ */
@media (min-width: 481px) {
  .app {
    box-shadow: 0 0 80px rgba(0,0,0,0.6);
  }
}

/* ============================================================
   Touch Active States
   ============================================================ */
.feed-card:active,
.biomarker-card:active,
.stats-chart-card:active,
.score-card:active {
  transform: scale(0.99);
}

/* ============================================================
   Misc utilities
   ============================================================ */
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-blue   { color: var(--blue); }
.text-orange { color: var(--orange); }
.text-purple { color: var(--purple); }
.text-yellow { color: var(--yellow); }
.text-cyan   { color: var(--cyan); }
.text-muted  { color: var(--text-muted); }

.section-pt { padding-top: 20px; }
