:root {
  --bg-primary: #0A0E17;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2744;
  --accent-blue: #00D9FF;
  --accent-green: #39FF14;
  --accent-purple: #8B5CF6;
  --text-primary: #F9FAFB;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --glass-bg: rgba(17, 24, 39, 0.8);
  --glass-border: rgba(0, 217, 255, 0.2);
}

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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(0, 217, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(57, 255, 20, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
}

.main-content {
  flex: 1;
  padding-bottom: 80px;
  overflow-y: auto;
}

.screen {
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

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

/* Glass morphism */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: var(--text-primary);
  border: none;
  padding: 16px 32px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 217, 255, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--accent-blue);
  color: var(--accent-blue);
  padding: 12px 24px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(0, 217, 255, 0.1);
}

.btn-large {
  width: 100%;
  padding: 20px;
  font-size: 18px;
}

.btn-danger {
  background: transparent;
  border: 1px solid #EF4444;
  color: #EF4444;
  padding: 12px 24px;
  border-radius: 12px;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}

.pulse-glow {
  animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 217, 255, 0.4); }
  50% { box-shadow: 0 0 40px rgba(0, 217, 255, 0.8); }
}

.glow-text {
  text-shadow: 0 0 10px var(--accent-green), 0 0 20px var(--accent-green);
  color: var(--accent-green);
}

/* Tab Navigation */
.tab-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-around;
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  padding: 8px 0;
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-item.active {
  color: var(--accent-blue);
}

.tab-item.active .tab-icon {
  transform: scale(1.2);
}

.tab-icon {
  font-size: 20px;
  transition: transform 0.3s ease;
}

.tab-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Onboarding */
.onboarding {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.onboarding-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
  max-width: 360px;
}

.fade-in {
  animation: fadeIn 0.5s ease;
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  width: 120px;
  height: 120px;
}

.logo-text {
  font-size: 48px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: 300;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
}

.science-brain {
  width: 150px;
  height: 150px;
}

.science-text {
  color: var(--text-secondary);
  line-height: 1.6;
}

.citation {
  font-size: 12px;
  color: var(--accent-blue);
}

.disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.goal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.goal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: var(--bg-secondary);
  border: 2px solid transparent;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.goal-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}

.goal-card.selected {
  border-color: var(--accent-green);
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
}

.goal-icon {
  font-size: 40px;
}

.goal-name {
  font-weight: 600;
  color: var(--text-primary);
}

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

.name-input {
  width: 100%;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.3s ease;
}

.name-input:focus {
  border-color: var(--accent-blue);
}

.intro-muscle {
  width: 200px;
  height: 200px;
}

.intro-text {
  color: var(--text-secondary);
}

/* Home Screen */
.home-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.greeting {
  font-size: 24px;
  font-weight: 600;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #FF6B35, #FF3366);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px;
  text-align: center;
}

.stat-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-blue);
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.featured-workout {
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gradient-border {
  position: relative;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
  border-radius: 22px;
  z-index: -1;
}

.workout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.workout-category {
  font-size: 12px;
  color: var(--accent-green);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.workout-duration {
  font-size: 14px;
  color: var(--text-secondary);
}

.workout-name {
  font-size: 24px;
  font-weight: 700;
}

.workout-tagline {
  color: var(--text-secondary);
  font-style: italic;
}

.difficulty {
  display: flex;
  gap: 4px;
}

.difficulty .brain {
  opacity: 0.3;
}

.difficulty .brain.active {
  opacity: 1;
}

.quick-actions {
  display: flex;
  justify-content: center;
}

/* Library Screen */
.library-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.screen-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.category-section {
  margin-bottom: 8px;
}

.category-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg-secondary);
  border: none;
  border-radius: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.category-header.active {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: var(--bg-tertiary);
}

.workout-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.chevron {
  color: var(--accent-blue);
}

.workout-list {
  background: var(--bg-tertiary);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slide-down {
  animation: slideDown 0.3s ease;
}

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

.workout-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.workout-card:hover {
  transform: translateX(4px);
  border-color: var(--accent-blue);
}

.workout-info h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

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

.workout-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.difficulty-small {
  font-size: 10px;
}

.play-icon {
  color: var(--accent-blue);
  font-size: 20px;
}

/* Workout Session */
.workout-session {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  position: fixed;
  inset: 0;
  z-index: 200;
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
}

.back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
}

.session-timer {
  text-align: center;
}

.timer-display {
  font-size: 48px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent-blue);
}

.set-indicator {
  font-size: 14px;
  color: var(--text-muted);
}

.session-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.exercise-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.session-muscle {
  width: 180px;
  height: 180px;
}

.muscle-glow {
  filter: drop-shadow(0 0 10px var(--accent-green));
  animation: muscleGlow 1s infinite alternate;
}

@keyframes muscleGlow {
  from { filter: drop-shadow(0 0 10px var(--accent-green)); }
  to { filter: drop-shadow(0 0 20px var(--accent-green)); }
}

.exercise-name {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 2px;
}

.coaching-text {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 280px;
  animation: fadeIn 0.5s ease;
}

.rep-counter {
  position: relative;
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rep-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 8;
}

.ring-progress {
  fill: none;
  stroke: var(--accent-green);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283;
  transition: stroke-dashoffset 0.3s ease;
}

.rep-text {
  display: flex;
  align-items: baseline;
}

.rep-current {
  font-size: 48px;
  font-weight: 800;
  color: var(--accent-green);
}

.rep-total {
  font-size: 24px;
  color: var(--text-muted);
}

.rest-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.rest-title {
  font-size: 64px;
  font-weight: 800;
  color: var(--accent-blue);
  letter-spacing: 4px;
}

.rest-text {
  color: var(--text-secondary);
  font-style: italic;
}

.skip-rest {
  background: none;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.session-footer {
  padding: 20px;
}

.progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  margin-bottom: 16px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
  border-radius: 2px;
  transition: width 0.3s ease;
}

.session-controls {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.control-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.control-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-blue);
}

/* Workout Complete */
.workout-complete {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  gap: 24px;
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 200;
}

.complete-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 3px;
}

.complete-brain {
  width: 120px;
  height: 120px;
}

.complete-stats {
  display: flex;
  gap: 32px;
}

.complete-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.complete-stat .stat-value {
  font-size: 32px;
}

/* Progress Screen */
.progress-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.weekly-chart {
  padding: 20px;
}

.weekly-chart h3 {
  margin-bottom: 16px;
  font-size: 16px;
  color: var(--text-secondary);
}

.chart-bars {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 120px;
}

.chart-bar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.chart-bar {
  width: 24px;
  min-height: 4px;
  background: var(--accent-blue);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}

.chart-bar.today {
  background: var(--accent-green);
}

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

.fun-stats {
  padding: 20px;
}

.fun-stats h3 {
  margin-bottom: 16px;
  font-size: 16px;
  color: var(--text-secondary);
}

.fun-stat {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--glass-border);
}

.fun-stat:last-child {
  border-bottom: none;
}

.fun-value {
  color: var(--accent-blue);
  font-weight: 600;
}

.achievements-section {
  padding: 20px;
}

.achievements-section h3 {
  margin-bottom: 16px;
  font-size: 16px;
  color: var(--text-secondary);
}

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

.achievement {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  text-align: center;
  transition: all 0.3s ease;
}

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

.achievement.unlocked {
  border: 1px solid var(--accent-green);
}

.ach-icon {
  font-size: 24px;
}

.ach-name {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
}

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

/* Photo Screen */
.photo-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.photo-upload {
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 2px dashed var(--glass-border);
}

.upload-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
}

.upload-icon {
  font-size: 48px;
}

.comparison-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.comparison-photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.photo-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

.photo-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
}

.photo-card.before img {
  filter: saturate(0.8) brightness(0.9);
}

.photo-card.after img {
  filter: saturate(1.1) brightness(1.1) contrast(1.05);
}

.photo-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
}

.photo-label h4 {
  font-size: 14px;
  margin-bottom: 4px;
}

.photo-label p {
  font-size: 10px;
  color: var(--text-secondary);
}

.photo-label .confidence {
  margin-top: 4px;
  font-weight: 600;
}

.comparison-stats {
  padding: 20px;
}

.comp-stat {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--glass-border);
  font-size: 14px;
}

.comp-stat:last-child {
  border-bottom: none;
}

.comp-stat.highlight {
  font-weight: 600;
}

.photo-actions {
  display: flex;
  justify-content: center;
}

/* Profile Screen */
.profile-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.avatar {
  width: 64px;
  height: 64px;
  background: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--accent-blue);
}

.avatar-icon {
  width: 40px;
  height: 40px;
}

.profile-info h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.profile-info p {
  font-size: 12px;
  color: var(--text-muted);
}

.settings-section {
  padding: 20px;
}

.settings-section h3 {
  margin-bottom: 16px;
  font-size: 16px;
  color: var(--text-secondary);
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--glass-border);
}

.setting-item:last-child {
  border-bottom: none;
}

.toggle {
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle.on {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: var(--bg-primary);
}

.setting-item input[type="range"] {
  width: 100px;
  accent-color: var(--accent-blue);
}

.danger-zone {
  padding: 20px;
}

.about-section {
  text-align: center;
  padding: 20px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  display: block;
  margin-top: 12px;
}

.footer-link:hover {
  color: var(--accent-blue);
}

/* Achievement Modal */
.achievement-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  animation: fadeIn 0.3s ease;
}

.achievement-content {
  padding: 40px;
  text-align: center;
  max-width: 300px;
  animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.achievement-content h2 {
  font-size: 18px;
  color: var(--accent-green);
  margin-bottom: 16px;
}

.ach-modal-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 16px;
}

.achievement-content h3 {
  font-size: 24px;
  margin-bottom: 8px;
}

.achievement-content p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Confetti */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 400;
}

.confetti-particle {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 10px;
  animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Neuron pulse animation */
.neuron-pulse {
  animation: neuronPulse 1.5s infinite;
}

.neuron-pulse.delay-1 {
  animation-delay: 0.5s;
}

.neuron-pulse.delay-2 {
  animation-delay: 1s;
}

@keyframes neuronPulse {
  0%, 100% { opacity: 0.3; r: 2; }
  50% { opacity: 1; r: 4; }
}

/* Responsive */
@media (min-width: 768px) {
  .app {
    max-width: 600px;
  }
  
  .stats-row {
    gap: 16px;
  }
  
  .stat-card {
    padding: 24px;
  }
  
  .stat-value {
    font-size: 32px;
  }
  
  .workout-name {
    font-size: 28px;
  }
}

@media (min-width: 1024px) {
  .app {
    max-width: 480px;
  }
}