* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --background: #f9fafb;
  --surface: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

body.dark-mode {
  --primary: #818cf8;
  --primary-dark: #a78bfa;
  --secondary: #c084fc;
  --success: #34d399;
  --warning: #facc15;
  --danger: #f87171;
  --background: #111827;
  --surface: #1f2937;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --border-color: #374151;
  --shadow-sm: 0 1px 2px 0 rgb(255 255 255 / 0.05);
  --shadow: 0 1px 3px 0 rgb(255 255 255 / 0.1), 0 1px 2px -1px rgb(255 255 255 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(255 255 255 / 0.1), 0 2px 4px -2px rgb(255 255 255 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(255 255 255 / 0.1), 0 4px 6px -4px rgb(255 255 255 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(255 255 255 / 0.1), 0 8px 10px -6px rgb(255 255 255 / 0.1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Welcome Page */
.welcome-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  color: white;
}

.welcome-container {
  max-width: 800px;
  padding: 2rem;
  text-align: center;
  animation: fadeInUp 0.8s ease-out;
}

.welcome-header {
  margin-bottom: 3rem;
}

.welcome-brand {
  margin-bottom: 2rem;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2.5rem;
  box-shadow: var(--shadow-xl);
}

.welcome-brand h1 {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.welcome-brand p {
  font-size: 1.25rem;
  opacity: 0.9;
  font-weight: 300;
}

.welcome-content {
  margin-bottom: 3rem;
}

.welcome-text h2 {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.welcome-text p {
  font-size: 1.125rem;
  line-height: 1.7;
  opacity: 0.9;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.welcome-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}

.feature-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.3s ease, background 0.3s ease;
}

.feature-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.15);
}

.feature-item i {
  font-size: 1.5rem;
}

.feature-item span:first-child {
  font-size: 1.5rem;
}

.feature-item span {
  font-weight: 500;
}

.welcome-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.125rem;
  border-radius: 12px;
  min-width: 180px;
}

.welcome-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.welcome-footer p {
  opacity: 0.7;
  font-size: 0.875rem;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.header {
  background: color-mix(in srgb, var(--surface), transparent 5%);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform 0.3s ease-in-out, background 0.3s ease;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.5rem;
}

.brand-text h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: -4px;
}

.brand-text span {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-stats {
  display: flex;
  gap: 2rem;
}

.stat-item {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Main Content */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  gap: 2rem;
  transition: all 0.3s ease-in-out;
}

/* Sidebar */
.sidebar {
  background: color-mix(in srgb, var(--surface), transparent 5%);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 1.5rem;
  height: fit-content;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, background 0.3s ease;
}

.sidebar-header {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.sidebar-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.sidebar-controls {
  margin-top: 1rem;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.btn-small.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.btn-small:hover {
  transform: translateY(-1px);
}

.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.exercise-card {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  background: var(--background);
}

.exercise-card:hover {
  background: color-mix(in srgb, var(--surface), transparent 50%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.exercise-card.active {
  background: color-mix(in srgb, var(--primary), transparent 85%);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.exercise-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  margin-right: 1rem;
  font-size: 1.25rem;
}

.exercise-details h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.exercise-details p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.exercise-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.exercise-meta span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Workout Area */
.workout-area {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.camera-section {
  background: color-mix(in srgb, var(--surface), transparent 5%);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease;
}

.camera-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.camera-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--background);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: color-mix(in srgb, var(--surface), transparent 50%);
  color: var(--text-primary);
}

.camera-container {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 400px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--gray-900);
  box-shadow: var(--shadow-xl);
  transition: height 0.3s ease-in-out;
}

#video, #canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#canvas {
  z-index: 2;
  pointer-events: none;
}

.camera-overlay {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pose-indicator {
  width: 48px;
  height: 48px;
  background: rgba(16, 185, 129, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  backdrop-filter: blur(10px);
}

.form-feedback-overlay {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-score-badge {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 0.75rem;
  text-align: center;
  min-width: 60px;
  border: 2px solid var(--success);
  transition: all 0.3s ease;
}

.form-score-badge.good {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.form-score-badge.warning {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
}

.form-score-badge.poor {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.form-score-badge span {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.1rem;
}

.form-score-badge small {
  font-size: 0.65rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.form-tip {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  max-width: 200px;
  text-align: center;
  animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0; transform: translateY(-10px); }
  20%, 80% { opacity: 1; transform: translateY(0); }
}

.live-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.stat-box {
  background: var(--background);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  border: 1px solid var(--border-color);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.stat-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Feedback Panel */
.feedback-panel {
  background: color-mix(in srgb, var(--surface), transparent 5%);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  transition: background 0.3s ease;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.feedback-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--success), #059669);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.feedback-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.feedback-content p {
  font-size: 1rem;
  color: var(--text-secondary);
}

.progress-section {
  margin-bottom: 1.5rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.progress-header span:first-child {
  font-weight: 600;
  color: var(--text-primary);
}

.progress-header span:last-child {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 8px;
  transition: width 0.3s ease;
  width: 0%;
}

.control-section {
  display: flex;
  gap: 1rem;
}

.btn {
  flex: 1;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--surface), transparent 50%);
  transform: translateY(-1px);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-warning:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: modalSlideIn 0.3s ease-out;
}

.modal-large {
  max-width: 800px;
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--background);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: color-mix(in srgb, var(--surface), transparent 50%);
  color: var(--text-primary);
}

.modal-content {
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(80vh - 120px);
}

.video-wrapper {
  margin-bottom: 1.5rem;
  border-radius: 12px;
  overflow: hidden;
  background: var(--gray-900);
}

.video-wrapper iframe {
  width: 100%;
  height: 315px;
  border: none;
}

.modal-actions {
  display: flex;
  gap: 1rem;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-outline:hover {
  background: var(--background);
  border-color: var(--text-secondary);
}

/* History Modal Styles */
.history-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.history-stat {
  background: var(--background);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  border: 1px solid var(--border-color);
}

.history-stat .stat-number {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.history-stat .stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.history-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.history-list {
  max-height: 400px;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.history-empty {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-secondary);
}

.history-empty i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--border-color);
}

.history-empty p {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.history-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s ease;
}

.history-item:hover {
  background: var(--background);
}

.history-item:last-child {
  border-bottom: none;
}

.history-details h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.history-details p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.history-metrics {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.history-metric {
  text-align: center;
}

.history-metric .value {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
}

.history-metric .label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Programs Modal Styles */
.programs-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.tab-btn {
  padding: 1rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.program-card {
  background: var(--background);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.program-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.program-card.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary), transparent 90%);
}

.program-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.program-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
}

.program-info h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.program-info .duration {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.program-description {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.program-exercises {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.exercise-tag {
  background: color-mix(in srgb, var(--primary), transparent 85%);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Custom Workout Builder */
.custom-workout-builder h3 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.custom-workout-builder p {
  margin-bottom: 2rem;
  color: var(--text-secondary);
}

.custom-exercises {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.custom-exercise-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.custom-exercise-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.custom-exercise-info {
  flex: 1;
}

.custom-exercise-info h5 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.custom-exercise-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.custom-reps-input {
  width: 80px;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-align: center;
  background: var(--surface);
  color: var(--text-primary);
}

.custom-controls {
  display: flex;
  gap: 1rem;
}

/* Achievement System Styles */
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.progress-dashboard {
  margin-bottom: 2rem;
}

.progress-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.progress-card {
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
}

.progress-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.progress-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
}

.progress-stats {
  text-align: left;
}

.progress-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.progress-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.level-progress {
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
}

.level-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.level-info h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.level-info p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.level-bar {
  height: 12px;
  background: var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.level-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 6px;
  transition: width 0.5s ease;
}

.level-text {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.achievement-card {
  background: var(--background);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.achievement-card.unlocked {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success), transparent 90%);
}

.achievement-card.locked {
  opacity: 0.6;
  filter: grayscale(100%);
}

.achievement-card.new-unlock {
  animation: achievementUnlock 1s ease-out;
}

@keyframes achievementUnlock {
  0% {
    transform: scale(0.8) rotateY(180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.1) rotateY(90deg);
  }
  100% {
    transform: scale(1) rotateY(0deg);
    opacity: 1;
  }
}

.achievement-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.75rem;
}

.achievement-card.locked .achievement-icon {
  background: var(--border-color);
}

.achievement-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.achievement-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.achievement-progress {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
}

.achievement-date {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--success);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 600;
}

/* Animations */
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.rep-animation {
  animation: repPulse 0.4s ease-out;
}

@keyframes repPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Focus Mode Styles */
body.focus-mode .header {
  transform: translateY(-100%);
}
body.focus-mode .sidebar {
  transform: translateX(-110%);
  opacity: 0;
}

body.focus-mode .main {
  grid-template-columns: 1fr;
  max-width: 100vw;
  padding: 1rem;
}

body.focus-mode .workout-area {
  height: calc(100vh - 100px); /* Full height minus some padding */
}

body.focus-mode .camera-section {
  flex-grow: 1;
}

body.focus-mode .camera-container {
  min-height: 300px;
  flex-grow: 1;
}


/* Responsive Design */
@media (max-width: 1024px) {
  .main {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .camera-container {
    height: 400px;
  }

  .live-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .header {
    padding: 1rem;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .header-stats {
    gap: 1rem;
  }

  .main {
    padding: 1rem;
    gap: 1rem;
  }

  .camera-container {
    height: 300px;
  }

  .live-stats {
    grid-template-columns: 1fr;
  }

  .control-section {
    flex-direction: column;
  }

  .modal {
    margin: 1rem;
  }

  .modal-content {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .brand-text h1 {
    font-size: 1.5rem;
  }

  .exercise-card {
    padding: 0.75rem;
  }

  .exercise-icon {
    width: 40px;
    height: 40px;
    margin-right: 0.75rem;
  }

  .camera-container {
    height: 250px;
  }
}

/* Footer */
.footer {
  text-align: center;
  padding: 1rem;
  color: var(--gray-100);
  font-size: 0.875rem;
}

.footer a {
  color: var(--white);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--primary);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--background);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Firefox scrollbar styling */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--background);
}
