/* =============================================
   FitForge — Elite Training App
   Design System & Premium UI CSS
   ============================================= */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

/* =============================================
   DESIGN TOKENS
   ============================================= */
:root {
  /* Core palette */
  --bg-void:     #050508;
  --bg-surface:  #0c0c14;
  --bg-raised:   #12121e;
  --bg-elevated: #191928;
  --border:      rgba(255,255,255,0.06);
  --border-glow: rgba(99,102,241,0.3);

  /* Neon accents */
  --neon-blue:   #6366f1;
  --neon-cyan:   #22d3ee;
  --neon-green:  #4ade80;
  --neon-orange: #fb923c;
  --neon-pink:   #f472b6;
  --neon-purple: #a78bfa;
  --gold:        #fbbf24;
  --danger:      #f87171;

  /* Gradients */
  --grad-blue:   linear-gradient(135deg, #6366f1, #8b5cf6);
  --grad-cyan:   linear-gradient(135deg, #06b6d4, #6366f1);
  --grad-green:  linear-gradient(135deg, #10b981, #059669);
  --grad-fire:   linear-gradient(135deg, #f97316, #ef4444);
  --grad-gold:   linear-gradient(135deg, #f59e0b, #d97706);

  /* Typography */
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  /* Text */
  --text-primary:   #f0f0ff;
  --text-secondary: rgba(240,240,255,0.55);
  --text-muted:     rgba(240,240,255,0.3);

  /* Spacing */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h:       72px;
  --radius-sm:   10px;
  --radius-md:   18px;
  --radius-lg:   24px;
  --radius-xl:   32px;

  /* Transitions */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-snappy: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html {
  height: 100%;
  overflow: hidden;
  font-size: 16px;
}

body {
  height: 100%;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow: hidden;
  position: fixed;
  width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* =============================================
   LOADER SCREEN
   ============================================= */
#loader {
  position: fixed;
  inset: 0;
  background: var(--bg-void);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s var(--ease-snappy), transform 0.6s var(--ease-snappy);
}

#loader.hide {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

.loader-logo {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1px;
  background: var(--grad-blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.loader-tagline {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 48px;
}

.loader-bolt {
  font-size: 56px;
  animation: bolt-pulse 1.4s ease-in-out infinite;
  margin-bottom: 32px;
  filter: drop-shadow(0 0 20px var(--neon-blue));
}

@keyframes bolt-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 12px var(--neon-blue)); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 32px var(--neon-cyan)); }
}

.loader-bar-wrap {
  width: 180px;
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  background: var(--grad-blue);
  border-radius: 99px;
  width: 0%;
  animation: load-progress 2.4s var(--ease-snappy) forwards;
  box-shadow: 0 0 12px var(--neon-blue);
}

@keyframes load-progress {
  0%   { width: 0%; }
  40%  { width: 60%; }
  70%  { width: 80%; }
  100% { width: 100%; }
}

/* =============================================
   APP SHELL
   ============================================= */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* =============================================
   SCREENS
   ============================================= */
.screen {
  position: absolute;
  inset: 0;
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  transform: translateX(30px);
  pointer-events: none;
  transition: opacity 0.35s var(--ease-snappy), transform 0.35s var(--ease-snappy);
  padding-bottom: 24px;
}

.screen.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: all;
}

.screen.slide-out {
  opacity: 0;
  transform: translateX(-30px);
}

/* Scrollbar */
.screen::-webkit-scrollbar { display: none; }

/* =============================================
   BOTTOM NAVIGATION
   ============================================= */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(12,12,20,0.92);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 8px;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s var(--ease-bounce);
  position: relative;
  min-width: 56px;
  background: none;
  border: none;
  color: var(--text-muted);
}

.nav-item.active {
  color: var(--neon-blue);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  background: rgba(99,102,241,0.12);
}

.nav-item:active {
  transform: scale(0.88);
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.25s var(--ease-bounce);
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
  filter: drop-shadow(0 0 8px var(--neon-blue));
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  font-family: var(--font-display);
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 10px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  box-shadow: 0 0 8px var(--danger);
}

/* =============================================
   HEADER
   ============================================= */
.screen-header {
  padding: calc(var(--safe-top) + 16px) 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.screen-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.screen-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: transform 0.2s var(--ease-snappy), box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.card:active {
  transform: scale(0.975);
}

.card-glow {
  box-shadow: 0 0 30px rgba(99,102,241,0.12), 0 8px 32px rgba(0,0,0,0.4);
}

.card-elevated {
  background: var(--bg-raised);
}

/* =============================================
   DASHBOARD SCREEN
   ============================================= */
#screen-home {
  padding-top: 0;
}

.home-hero {
  padding: calc(var(--safe-top) + 20px) 20px 24px;
  background: linear-gradient(180deg, rgba(99,102,241,0.08) 0%, transparent 100%);
}

.home-greeting {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.home-name {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 20px;
}

.home-name span {
  background: var(--grad-blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* XP Bar */
.xp-card {
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.rank-badge {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  background: var(--grad-gold);
  box-shadow: 0 0 20px rgba(251,191,36,0.4);
  animation: rank-glow 3s ease-in-out infinite;
}

@keyframes rank-glow {
  0%, 100% { box-shadow: 0 0 16px rgba(251,191,36,0.35); }
  50% { box-shadow: 0 0 28px rgba(251,191,36,0.6); }
}

.xp-info { flex: 1; }

.xp-rank {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 2px;
}

.xp-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.xp-bar-wrap {
  height: 5px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}

.xp-bar {
  height: 100%;
  background: var(--grad-gold);
  border-radius: 99px;
  transition: width 1.2s var(--ease-snappy);
  box-shadow: 0 0 8px var(--gold);
}

.xp-number {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--gold);
  flex-shrink: 0;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--ease-snappy);
}

.stat-card:active { transform: scale(0.94); }

.stat-icon {
  font-size: 22px;
  margin-bottom: 10px;
  display: block;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.stat-card .stat-bg {
  position: absolute;
  right: -12px;
  bottom: -12px;
  font-size: 60px;
  opacity: 0.06;
  pointer-events: none;
}

.stat-streak .stat-value { color: var(--neon-orange); }
.stat-calories .stat-value { color: var(--danger); }
.stat-volume .stat-value { color: var(--neon-cyan); }
.stat-pr .stat-value { color: var(--neon-green); }

/* Workout CTA */
.workout-cta {
  margin: 0 20px 24px;
}

.btn-start {
  width: 100%;
  padding: 20px 24px;
  background: var(--grad-blue);
  border: none;
  border-radius: var(--radius-lg);
  color: white;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s var(--ease-bounce);
  box-shadow: 0 8px 32px rgba(99,102,241,0.45), 0 0 0 1px rgba(255,255,255,0.1) inset;
  position: relative;
  overflow: hidden;
}

.btn-start::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  border-radius: inherit;
}

.btn-start:active {
  transform: scale(0.96);
  box-shadow: 0 4px 16px rgba(99,102,241,0.35);
}

.btn-icon { font-size: 22px; }

/* Chart Section */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  margin-bottom: 14px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.section-action {
  font-size: 13px;
  color: var(--neon-blue);
  font-weight: 600;
  cursor: pointer;
}

.chart-card {
  margin: 0 20px;
  padding: 20px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.chart-title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
}

/* SVG Chart */
.svg-chart {
  width: 100%;
  height: 100px;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke: url(#lineGrad);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(99,102,241,0.6));
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw-line 1.8s var(--ease-snappy) 0.3s forwards;
}

@keyframes draw-line {
  to { stroke-dashoffset: 0; }
}

.chart-area {
  fill: url(#areaGrad);
  opacity: 0;
  animation: fade-in-area 0.5s ease 1.8s forwards;
}

@keyframes fade-in-area {
  to { opacity: 1; }
}

.chart-dot {
  fill: var(--neon-blue);
  r: 3.5;
  filter: drop-shadow(0 0 4px var(--neon-blue));
  opacity: 0;
  animation: pop-dot 0.3s var(--ease-bounce) forwards;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

.chart-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Recent Workout */
.recent-card {
  margin: 0 20px 24px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-snappy), border-color 0.2s;
}

.recent-card:active {
  transform: scale(0.97);
  border-color: rgba(99,102,241,0.3);
}

.recent-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--grad-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(99,102,241,0.35);
}

.recent-info { flex: 1; }
.recent-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.recent-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
}
.recent-meta span::before { content: '· '; }
.recent-meta span:first-child::before { content: ''; }

/* Motivation Widget */
.motivation-card {
  margin: 0 20px 32px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.1));
  border: 1px solid rgba(99,102,241,0.25);
  position: relative;
  overflow: hidden;
}

.motivation-card::before {
  content: '"';
  position: absolute;
  top: -8px;
  left: 12px;
  font-size: 80px;
  color: var(--neon-blue);
  opacity: 0.15;
  font-family: Georgia, serif;
  line-height: 1;
}

.motivation-quote {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-secondary);
  font-style: italic;
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
}

.motivation-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--neon-purple);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* =============================================
   WORKOUT SCREEN
   ============================================= */
.prog-filters {
  display: flex;
  gap: 10px;
  padding: 0 20px 20px;
  overflow-x: auto;
}
.prog-filters::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 8px 16px;
  border-radius: 99px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s var(--ease-snappy);
  flex-shrink: 0;
}

.filter-chip.active {
  background: var(--grad-blue);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 16px rgba(99,102,241,0.35);
}

.program-list {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.program-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s var(--ease-snappy);
  position: relative;
  overflow: hidden;
}

.program-card:active { transform: scale(0.97); }

.program-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.program-emoji {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.program-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.program-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.program-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.prog-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  padding: 5px 10px;
  border-radius: 99px;
}

.program-bar-wrap {
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}

.program-bar {
  height: 100%;
  border-radius: 99px;
}

.bar-blue  { background: var(--grad-blue); box-shadow: 0 0 8px var(--neon-blue); }
.bar-green { background: var(--grad-green); box-shadow: 0 0 8px var(--neon-green); }
.bar-fire  { background: var(--grad-fire); box-shadow: 0 0 8px var(--neon-orange); }
.bar-cyan  { background: var(--grad-cyan); box-shadow: 0 0 8px var(--neon-cyan); }

/* Active Session Banner */
.active-session-banner {
  margin: 0 20px 16px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(74,222,128,0.15), rgba(16,185,129,0.08));
  border: 1px solid rgba(74,222,128,0.3);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  animation: pulse-border 2s ease infinite;
  transition: transform 0.2s;
}

.active-session-banner:active { transform: scale(0.97); }

@keyframes pulse-border {
  0%, 100% { border-color: rgba(74,222,128,0.3); }
  50% { border-color: rgba(74,222,128,0.6); }
}

.session-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 10px var(--neon-green);
  flex-shrink: 0;
  animation: live-pulse 1.5s ease infinite;
}

@keyframes live-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.session-info { flex: 1; }
.session-name { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.session-time { font-size: 12px; color: var(--neon-green); font-weight: 600; }

/* =============================================
   ACTIVE WORKOUT MODAL
   ============================================= */
#workout-modal {
  position: fixed;
  inset: 0;
  background: var(--bg-void);
  z-index: 500;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}

#workout-modal.open {
  transform: translateY(0);
}

.workout-top-bar {
  padding: calc(var(--safe-top) + 14px) 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.workout-timer-display {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--neon-green);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.workout-title-bar {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}

.btn-finish {
  background: var(--grad-green);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  color: white;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(74,222,128,0.4);
  transition: transform 0.2s var(--ease-bounce);
}

.btn-finish:active { transform: scale(0.93); }

.exercise-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.exercise-block {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
}

.exercise-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sets-table {
  width: 100%;
  border-collapse: collapse;
}

.sets-table th {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  text-align: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.sets-table th:first-child { text-align: left; }

.set-row td {
  text-align: center;
  padding: 12px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.set-row td:first-child { text-align: left; color: var(--text-muted); font-size: 13px; }

.set-row.done { opacity: 0.5; }
.set-row.done td { text-decoration: line-through; }

.set-check {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s var(--ease-bounce);
}

.set-check.checked {
  background: var(--neon-green);
  border-color: var(--neon-green);
  box-shadow: 0 0 10px rgba(74,222,128,0.4);
  transform: scale(1.1);
}

/* Rest Timer */
#rest-timer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,5,8,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#rest-timer-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.rest-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 32px;
}

.rest-circle {
  position: relative;
  width: 200px;
  height: 200px;
  margin-bottom: 32px;
}

.rest-circle-svg {
  width: 200px;
  height: 200px;
  transform: rotate(-90deg);
}

.rest-circle-bg {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 8;
}

.rest-circle-prog {
  fill: none;
  stroke: url(#timerGrad);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 8px var(--neon-cyan));
}

.rest-time-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.rest-time-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.btn-skip-rest {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 36px;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s var(--ease-snappy);
}

.btn-skip-rest:active { transform: scale(0.93); }

/* =============================================
   RANKS / SOCIAL SCREEN
   ============================================= */
.rank-hero {
  padding: 0 20px 24px;
  text-align: center;
}

.rank-display {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-xl);
  background: var(--grad-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  margin: 0 auto 14px;
  box-shadow: 0 0 40px rgba(251,191,36,0.5), 0 0 80px rgba(251,191,36,0.2);
  animation: rank-shine 3s ease-in-out infinite;
}

@keyframes rank-shine {
  0%, 100% { box-shadow: 0 0 32px rgba(251,191,36,0.45), 0 0 60px rgba(251,191,36,0.15); }
  50% { box-shadow: 0 0 48px rgba(251,191,36,0.65), 0 0 90px rgba(251,191,36,0.25); }
}

.rank-name {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.rank-points {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Leaderboard */
.leaderboard-card {
  margin: 0 20px 24px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.lb-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lb-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

.lb-tabs {
  display: flex;
  gap: 6px;
}

.lb-tab {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.2s;
  background: none;
  border: none;
  color: var(--text-muted);
}

.lb-tab.active {
  background: var(--bg-elevated);
  color: var(--neon-blue);
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  cursor: pointer;
}

.lb-row:last-child { border-bottom: none; }
.lb-row:active { background: rgba(255,255,255,0.03); }

.lb-rank-num {
  width: 26px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.lb-rank-num.gold { color: var(--gold); }
.lb-rank-num.silver { color: #aaa; }
.lb-rank-num.bronze { color: #cd7f32; }

.lb-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  overflow: hidden;
}

.lb-avatar.me { border-color: var(--neon-blue); }

.lb-info { flex: 1; }
.lb-username { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.lb-stats { font-size: 11px; color: var(--text-muted); }

.lb-score {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--neon-blue);
}

/* Achievements */
.achievements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 20px 24px;
}

.achievement {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  transition: all 0.2s var(--ease-snappy);
  cursor: pointer;
}

.achievement:active { transform: scale(0.93); }

.achievement.locked {
  opacity: 0.4;
  filter: grayscale(1);
}

.achievement-icon {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
}

.achievement-name {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 3px;
}

.achievement-desc {
  font-size: 10px;
  color: var(--text-muted);
}

/* =============================================
   SOCIAL SCREEN
   ============================================= */
.feed-list {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feed-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.feed-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.feed-user { flex: 1; }
.feed-username { font-weight: 700; font-size: 14px; }
.feed-time { font-size: 11px; color: var(--text-muted); }

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

.feed-workout-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 8px;
}

.feed-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.feed-stat {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.feed-stat strong { color: var(--text-primary); }

.feed-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 20px;
}

.feed-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.feed-action-btn.liked { color: var(--danger); }
.feed-action-btn:active { transform: scale(0.9); }

/* =============================================
   PROFILE SCREEN
   ============================================= */
.profile-hero {
  padding: calc(var(--safe-top) + 20px) 20px 24px;
  text-align: center;
  background: linear-gradient(180deg, rgba(99,102,241,0.06) 0%, transparent 100%);
}

.profile-avatar-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--grad-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  border: 3px solid var(--neon-blue);
  box-shadow: 0 0 24px rgba(99,102,241,0.45);
}

.profile-rank-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--grad-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 2px solid var(--bg-void);
}

.profile-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

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

.profile-stats-row {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 20px;
}

.prof-stat { text-align: center; }
.prof-stat-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}

.prof-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Calendar Heatmap */
.heatmap-card {
  margin: 0 20px 24px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.heatmap-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 3px;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--bg-elevated);
  transition: all 0.2s;
}

.heat-cell.l1 { background: rgba(99,102,241,0.25); }
.heat-cell.l2 { background: rgba(99,102,241,0.5); }
.heat-cell.l3 { background: rgba(99,102,241,0.75); }
.heat-cell.l4 { background: rgba(99,102,241,1); box-shadow: 0 0 6px rgba(99,102,241,0.5); }

/* PRs list */
.pr-list {
  padding: 0 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pr-row {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pr-exercise { font-size: 14px; font-weight: 700; }
.pr-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--neon-green);
}

.pr-date { font-size: 11px; color: var(--text-muted); text-align: right; }

/* =============================================
   AI COACH SCREEN
   ============================================= */
.ai-hero {
  padding: 0 20px 24px;
  text-align: center;
}

.ai-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #6366f1, #22d3ee);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  margin: 0 auto 14px;
  box-shadow: 0 0 40px rgba(34,211,238,0.4);
  animation: ai-pulse 3s ease-in-out infinite;
}

@keyframes ai-pulse {
  0%, 100% { box-shadow: 0 0 32px rgba(34,211,238,0.35); }
  50% { box-shadow: 0 0 48px rgba(34,211,238,0.6); }
}

.ai-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #6366f1, #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ai-desc { font-size: 13px; color: var(--text-muted); }

/* Chat */
.ai-chat {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.msg {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  animation: msg-in 0.3s var(--ease-bounce);
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-ai {
  background: var(--bg-raised);
  border: 1px solid rgba(99,102,241,0.2);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  color: var(--text-secondary);
}

.msg-user {
  background: var(--grad-blue);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  color: white;
  box-shadow: 0 4px 16px rgba(99,102,241,0.35);
}

/* AI Input */
.ai-input-row {
  display: flex;
  gap: 10px;
  padding: 0 20px 24px;
}

.ai-input {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
}

.ai-input:focus { border-color: var(--neon-blue); }
.ai-input::placeholder { color: var(--text-muted); }

.btn-send {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: var(--grad-blue);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: transform 0.2s var(--ease-bounce);
  box-shadow: 0 4px 14px rgba(99,102,241,0.4);
  flex-shrink: 0;
}

.btn-send:active { transform: scale(0.88); }

/* Suggestions */
.ai-suggestions {
  padding: 0 20px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-suggestion {
  padding: 9px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease-snappy);
}

.ai-suggestion:active {
  background: rgba(99,102,241,0.2);
  border-color: rgba(99,102,241,0.4);
  transform: scale(0.94);
}

/* =============================================
   MISC UTILITIES
   ============================================= */
.px-20 { padding-left: 20px; padding-right: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-16 { margin-bottom: 16px; }

.label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

/* Glow text */
.glow-blue  { text-shadow: 0 0 16px rgba(99,102,241,0.6); }
.glow-green { text-shadow: 0 0 16px rgba(74,222,128,0.6); }
.glow-gold  { text-shadow: 0 0 16px rgba(251,191,36,0.6); }

/* Pill tag */
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

.pill-blue { background: rgba(99,102,241,0.18); color: var(--neon-blue); }
.pill-green { background: rgba(74,222,128,0.15); color: var(--neon-green); }
.pill-orange { background: rgba(251,146,60,0.15); color: var(--neon-orange); }
.pill-pink { background: rgba(244,114,182,0.15); color: var(--neon-pink); }

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 0 20px 24px;
}

/* Scroll-anchor for bottom nav */
.nav-spacer {
  height: 20px;
}

/* Touch ripple */
.ripple {
  position: relative;
  overflow: hidden;
}

/* Haptic feedback visual */
@keyframes haptic-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.haptic { animation: haptic-flash 0.15s ease; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, rgba(255,255,255,0.05) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: skeleton-load 1.5s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-load {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Toast notification */
#toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition: all 0.3s var(--ease-bounce);
  z-index: 9000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Particle burst */
.particle {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9500;
  animation: particle-burst 0.6s ease-out forwards;
}

@keyframes particle-burst {
  0% { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* Number counter animation */
.count-up { transition: all 0.8s var(--ease-snappy); }

/* Scrolling gradient top fade on screens */
.screen::after {
  content: '';
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--bg-void));
  pointer-events: none;
  display: block;
}
