/* Modern Design System */
:root {
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-light: #f7f8fc;
  --panel: #ffffff;
  --ink: #1a202c;
  --muted: #718096;
  --accent: #667eea;
  --accent-dark: #5a67d8;
  --success: #48bb78;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.2);
  --radius: 16px;
  --radius-sm: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

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

body {
  min-height: 100vh;
  background: var(--bg-light);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.site-header {
  padding: 24px 20px;
  text-align: center;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.02em;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.brand-word {
  background: var(--bg-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 11px;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.24);
}

/* Hero Container */
main {
  min-height: calc(100vh - 180px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.hero-container {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

/* Streak Badge */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  padding: 8px 16px;
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
  font-size: 14px;
  font-weight: 600;
}

.streak-flame {
  font-size: 20px;
}

.streak-number {
  color: var(--accent);
}

/* Hero Title */
.hero-title {
  font-size: 48px;
  font-weight: 800;
  margin-bottom: 32px;
  background: var(--bg-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

/* Workout Preview */
.workout-preview {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.workout-preview:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.workout-meta {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.workout-duration,
.workout-type {
  background: var(--bg-light);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.workout-name {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink);
}

.workout-exercises {
  color: var(--muted);
  font-size: 16px;
}

/* Start Button */
.start-button {
  width: 100%;
  background: var(--bg-gradient);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 20px 32px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
  margin-bottom: 16px;
}

.start-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.start-button:active {
  transform: translateY(0);
}

.start-button svg {
  transition: transform 0.2s ease;
}

.start-button:hover svg {
  transform: translateX(4px);
}

/* Settings Link */
.settings-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 8px;
}

.settings-link:hover {
  color: var(--ink);
}

/* Settings Panel */
.settings-panel {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.settings-panel.active {
  display: flex;
}

.settings-content {
  background: var(--panel);
  width: 100%;
  max-width: 500px;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 32px;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease;
  max-height: 80vh;
  overflow-y: auto;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.settings-header h3 {
  font-size: 24px;
  font-weight: 700;
}

.settings-close {
  background: none;
  border: none;
  font-size: 32px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.settings-close:hover {
  color: var(--ink);
}

.setting-group {
  margin-bottom: 24px;
}

.setting-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.setting-option {
  flex: 1;
  min-width: 80px;
  background: var(--bg-light);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--ink);
}

.setting-option:hover {
  background: #edf2f7;
}

.setting-option.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.apply-button {
  width: 100%;
  background: var(--ink);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
}

.apply-button:hover {
  background: #2d3748;
}

/* Workout Flow Overlay */
.workout-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: none;
  z-index: 2000;
}

.workout-overlay.active {
  display: block;
}

.workout-flow,
.feedback-screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 24px;
  color: white;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.workout-flow.active,
.feedback-screen.active {
  display: flex;
}

.flow-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.flow-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Progress */
.flow-progress {
  margin-bottom: 40px;
}

.flow-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: white;
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 8%;
}

.progress-text {
  font-size: 14px;
  opacity: 0.9;
  font-weight: 600;
}

.workout-timer {
  min-width: 68px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: white;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

/* Flow Step */
.flow-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px 0;
}

.step-round {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
  margin-bottom: 16px;
}

.step-exercise {
  font-size: 48px;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.1;
}

.step-reps {
  font-size: 24px;
  font-weight: 600;
  opacity: 0.9;
  margin-bottom: 24px;
}

.step-cue {
  font-size: 16px;
  opacity: 0.8;
  max-width: 400px;
  line-height: 1.6;
}

/* Next Button */
.next-button {
  background: white;
  color: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 20px 32px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.next-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.next-button:active {
  transform: translateY(0);
}

/* Feedback Screen */
.feedback-content {
  flex: 1;
  display: grid;
  grid-template-rows: auto auto auto auto auto auto;
  align-content: center;
  justify-items: center;
  align-items: center;
  text-align: center;
  gap: 18px;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 20px 0;
}

.completion-icon {
  width: 80px;
  height: 80px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: 4px;
  color: var(--success);
}

.completion-title {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 0;
}

.completion-text {
  font-size: 18px;
  opacity: 0.9;
  margin-bottom: 0;
}

.feedback-buttons {
  display: flex;
  gap: 16px;
  width: 100%;
  margin-bottom: 0;
}

.feedback-option {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  padding: 20px 24px;
  color: white;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s ease;
  min-width: 90px;
}

.feedback-option:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.feedback-option.selected {
  background: white;
  color: var(--accent);
  border-color: white;
}

.feedback-emoji {
  font-size: 32px;
}

.feedback-streak {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 0;
  opacity: 0.9;
}

.done-button {
  background: white;
  color: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 16px 48px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-width: 220px;
}

.completion-actions {
  display: grid;
  gap: 12px;
  width: min(100%, 320px);
}

.share-end-button {
  background: rgba(255, 255, 255, 0.18);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: var(--radius);
  padding: 16px 28px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.share-end-button:hover,
.share-end-button:focus-visible {
  background: rgba(255, 255, 255, 0.28);
}

.done-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .workout-flow,
  .feedback-screen {
    min-height: 100dvh;
    padding: max(18px, env(safe-area-inset-top)) 20px max(18px, env(safe-area-inset-bottom));
  }

  .feedback-screen.active {
    display: grid;
  }

  .feedback-content {
    min-height: calc(100dvh - 36px);
    align-content: start;
    gap: 14px;
    padding: 8px 0 0;
  }

  .completion-icon {
    width: 64px;
    height: 64px;
    margin-top: 6px;
  }

  .completion-icon svg {
    width: 38px;
    height: 38px;
  }

  .completion-title {
    font-size: 32px;
    line-height: 1.05;
  }

  .flow-progress {
    margin-bottom: 20px;
  }

  .flow-status {
    gap: 10px;
  }

  .workout-timer {
    min-width: 62px;
    font-size: 14px;
  }

  .completion-text {
    font-size: 17px;
  }

  .hero-title {
    font-size: 36px;
  }

  .step-exercise {
    font-size: 36px;
  }

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

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

  .feedback-option {
    width: 100%;
    min-height: 86px;
    padding: 14px 18px;
    gap: 6px;
  }

  .feedback-icon {
    width: 28px;
    height: 28px;
  }

  .feedback-streak {
    font-size: 18px;
    margin-top: 4px;
  }

  .done-button {
    position: sticky;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 100%;
    min-height: 56px;
    margin-top: 2px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  }

  .completion-actions {
    position: sticky;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 100%;
  }

  .completion-actions .done-button {
    position: static;
  }

  .share-end-button {
    min-height: 52px;
    width: 100%;
  }

  .button-group {
    flex-direction: column;
  }

  .setting-option {
    min-width: 100%;
  }
}

/* Hidden old elements */
.inline-controls,
.workout-card,
.utility-row,
.timer-overlay,
#exercise-list,
#plan-notes,
#copy-button,
#share-button,
#complete-button,
#new-workout-button,
.landing-page {
  display: none !important;
}
