/* ==========================================================================
   Swing Flow — stylesheet
   Replaces the inline <style> block in builder.html.

   Design language borrowed from shadcn/ui (MIT), hand-written as plain CSS.
   shadcn components are React + Radix and cannot be dropped into a static
   page, but its *look* is just a token system plus a set of conventions, and
   that ports directly. No Tailwind, no build step, no runtime compiler —
   Tailwind's Play CDN is explicitly development-only.

   Every class name here already exists in builder.html. The markup does not
   change, so this file can be swapped in and reverted freely.
   ========================================================================== */

/* ------------------------------------------------------------------ tokens */

:root {
  /* shadcn neutral scale, expressed as HSL triples so they compose */
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;

  /* Swing Flow keeps its teal as the primary */
  --primary: 186 81% 29%;
  --primary-foreground: 0 0% 100%;
  --primary-hover: 186 83% 24%;
  --primary-subtle: 186 40% 96%;

  --destructive: 0 72% 51%;
  --ring: 186 81% 29%;

  --radius: 0.5rem;
  --radius-sm: 0.375rem;
  --radius-lg: 0.75rem;

  /* shadcn's shadow ladder — restrained, never more than two layers */
  --shadow-sm: 0 1px 2px 0 hsl(240 6% 10% / 0.05);
  --shadow: 0 1px 3px 0 hsl(240 6% 10% / 0.1), 0 1px 2px -1px hsl(240 6% 10% / 0.1);
  --shadow-md: 0 4px 6px -1px hsl(240 6% 10% / 0.1), 0 2px 4px -2px hsl(240 6% 10% / 0.1);
  --shadow-lg: 0 10px 15px -3px hsl(240 6% 10% / 0.1), 0 4px 6px -4px hsl(240 6% 10% / 0.1);

  /* Names the old stylesheet used. Kept so nothing referencing them breaks. */
  --bg: hsl(var(--background));
  --text: hsl(var(--foreground));
  --accent: hsl(var(--primary));
  --accent-hover: hsl(var(--primary-hover));
  --accent-light: hsl(var(--primary-subtle));
  --brand: hsl(var(--primary));
  --danger: hsl(var(--destructive));
  --hover: hsl(var(--muted));
}

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* One focus treatment everywhere. The old sheet had none on most controls. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------------ layout */

.container {
  max-width: 72rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.header {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: hsl(var(--foreground));
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s ease;
}

.logo-link:hover { opacity: 0.7; }

.logo-icon {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.logo-icon svg { width: 100%; height: 100%; }

.logo-text {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.tagline {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  margin-top: 0.375rem;
  max-width: 46ch;
}

.toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ----------------------------------------------------------------- buttons */
/* shadcn's button: fixed height, medium weight, small radius, no uppercase.
   The old sheet used uppercase + letter-spacing on every control, which is
   what made the page read as a template. */

.toolbar button,
.download-modal-btn,
.history-btn,
.cookie-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 0.875rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.toolbar button:hover,
.download-modal-btn:hover,
.history-btn:hover,
.cookie-btn:hover {
  background: hsl(var(--muted));
}

.toolbar button:active,
.download-modal-btn:active,
.history-btn:active { transform: translateY(0.5px); }

.download-modal-btn.primary,
.cookie-btn.primary {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.download-modal-btn.primary:hover,
.cookie-btn.primary:hover {
  background: hsl(var(--primary-hover));
  border-color: hsl(var(--primary-hover));
}

button:disabled { opacity: 0.5; pointer-events: none; }

/* Loading spinner, sized to the new button height */
.toolbar button.loading,
.unlock-btn.loading { position: relative; color: transparent; cursor: wait; }

.toolbar button.loading::after,
.unlock-btn.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.875rem;
  height: 0.875rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.toolbar button.loading::after { border-color: hsl(var(--foreground)); border-top-color: transparent; }
.unlock-btn.loading::after { border-color: hsl(var(--primary-foreground)); border-top-color: transparent; }

@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------------- grid */

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 60rem) {
  .grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}

/* -------------------------------------------------------------------- card */

.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.form { padding: 1.5rem; }

.form-section { padding-bottom: 1.5rem; margin-bottom: 1.5rem; border-bottom: 1px solid hsl(var(--border)); }
.form-section:last-of-type { padding-bottom: 0; margin-bottom: 0; border-bottom: none; }

.section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.section-helper {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 1rem;
  line-height: 1.5;
}

.preset-description {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
  padding: 0.75rem;
  margin-top: 0.75rem;
  background: hsl(var(--muted));
  border-radius: var(--radius);
  border: none;
  min-height: 3.5rem;
}

/* --------------------------------------------------- segmented button group */
/* shadcn's Tabs list: a muted track with the active item raised on white. */

.body-type-selector {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: hsl(var(--muted));
  border-radius: var(--radius);
  margin-top: 0.75rem;
}

.body-type-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.4375rem 0.5rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  color: hsl(var(--muted-foreground));
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.body-type-btn:hover { color: hsl(var(--foreground)); }

.body-type-btn.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Preset row wraps to two columns rather than squeezing four */
#preset-beginner, #preset-intermediate, #preset-advanced, #preset-custom { flex: 1 1 40%; }

/* ----------------------------------------------------------------- sliders */

.focus-group { display: flex; flex-direction: column; gap: 0.25rem; }

.focus-item {
  display: grid;
  grid-template-columns: 5.5rem 1fr 2.5rem;
  gap: 0.75rem;
  align-items: center;
  padding: 0.625rem 0;
}

.focus-label {
  position: relative;
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  cursor: help;
  border-radius: var(--radius-sm);
}

.focus-label:hover { color: hsl(var(--primary)); }

.slider-container { display: flex; align-items: center; gap: 0.5rem; }

.focus-slider {
  flex: 1;
  height: 0.375rem;
  -webkit-appearance: none;
  appearance: none;
  background: hsl(var(--muted));
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.focus-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: hsl(var(--background));
  border: 2px solid hsl(var(--primary));
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: box-shadow 0.15s ease;
}

.focus-slider::-webkit-slider-thumb:active { cursor: grabbing; }

.focus-slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px hsl(var(--primary-subtle));
}

.focus-slider::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: hsl(var(--background));
  border: 2px solid hsl(var(--primary));
  box-shadow: var(--shadow-sm);
  cursor: grab;
}

.lock-toggle {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  padding: 0;
  color: hsl(var(--muted-foreground));
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.lock-toggle:hover { background: hsl(var(--muted)); color: hsl(var(--foreground)); }

.lock-toggle.locked {
  color: hsl(var(--primary));
  background: hsl(var(--primary-subtle));
  border-color: hsl(var(--primary) / 0.3);
}

.lock-toggle svg { width: 0.875rem; height: 0.875rem; display: block; }

.focus-value {
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: right;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ inputs */

.circuit-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.setting-item { display: flex; flex-direction: column; gap: 0.375rem; }

.setting-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.setting-input,
.unlock-input,
.gratitude-input {
  width: 100%;
  height: 2.25rem;
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.setting-input::placeholder,
.unlock-input::placeholder,
.gratitude-input::placeholder { color: hsl(var(--muted-foreground)); }

.setting-input:focus,
.unlock-input:focus,
.gratitude-input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--primary-subtle));
}

/* ------------------------------------------------------------ generate bar */

.generate-bar { margin-top: 1.5rem; }

.generate-btn {
  width: 100%;
  height: 2.75rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  border: 1px solid hsl(var(--primary));
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease;
}

.generate-btn:hover { background: hsl(var(--primary-hover)); border-color: hsl(var(--primary-hover)); }

/* -------------------------------------------------------------- circuit list */

.list { padding: 0; }

.list .row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 0.8fr 0.9fr 0.7fr;
  gap: 1rem;
  align-items: center;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid hsl(var(--border));
  font-size: 0.875rem;
}

.list .head {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  padding-top: 0.625rem;
  padding-bottom: 0.625rem;
}

.list .row.data { cursor: default; transition: background-color 0.15s ease; }
.list .row.data:hover { background: hsl(var(--muted) / 0.5); }
.list .row:last-child { border-bottom: none; }

.list .row strong { font-weight: 600; font-size: 0.875rem; }

.section-row {
  padding: 0.625rem 1.25rem;
  background: hsl(var(--muted));
  border-bottom: 1px solid hsl(var(--border));
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.subrow { padding-left: 2.25rem; }

.rest-row {
  padding: 0.5rem 1.25rem;
  background: hsl(var(--muted) / 0.4);
  border-bottom: 1px solid hsl(var(--border));
  text-align: center;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.exercise-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.play-btn {
  flex-shrink: 0;
  height: 1.875rem;
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.play-btn:hover {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

/* shadcn Badge: secondary variant by default, outline for accents */
.badge-pill {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.0625rem 0.4375rem;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.4;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  border: 1px solid transparent;
  border-radius: 999px;
  vertical-align: middle;
}

.badge-pill.accent {
  color: hsl(var(--primary));
  background: hsl(var(--primary-subtle));
  border-color: hsl(var(--primary) / 0.2);
}

/* Focus dot — a quiet colour cue, replacing the old sliding animation */
.anim {
  display: inline-block;
  width: 0.375rem;
  height: 0.375rem;
  margin-left: 0.4375rem;
  border-radius: 50%;
  vertical-align: middle;
  background: hsl(var(--muted-foreground));
}

.anim--strength { background: hsl(240 5% 34%); }
.anim--power, .anim--explosive { background: hsl(var(--primary)); }
.anim--mobility { background: hsl(190 40% 60%); }
.anim--stability { background: hsl(240 4% 60%); }
.anim--warmup { background: hsl(var(--primary) / 0.5); }
.anim--cooldown { background: hsl(240 4% 75%); }

.total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1rem 1.25rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.4);
}

.total .muted {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-transform: none;
  letter-spacing: normal;
}

.total strong {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.muted { color: hsl(var(--muted-foreground)); }

.empty-state { padding: 3.5rem 1.5rem; text-align: center; color: hsl(var(--muted-foreground)); }
.empty-state-icon { font-size: 1.75rem; margin-bottom: 0.75rem; opacity: 0.5; }
.empty-state-text { font-size: 0.875rem; max-width: 32ch; margin: 0 auto; }

/* ------------------------------------------------------------- unlock state */

.preview-overlay { position: relative; }

.preview-blurred { filter: blur(3px); opacity: 0.55; pointer-events: none; user-select: none; }

.preview-gradient {
  position: absolute;
  inset: auto 0 0 0;
  height: 13rem;
  background: linear-gradient(to bottom,
    hsl(var(--background) / 0), hsl(var(--background) / 0.92) 45%, hsl(var(--background)));
  pointer-events: none;
  z-index: 5;
}

.unlock-cta {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 6;
  width: min(20rem, calc(100% - 2rem));
  padding: 1.25rem;
  text-align: center;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.unlock-input { margin-top: 0.75rem; text-align: center; }

.unlock-error {
  min-height: 1rem;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: hsl(var(--destructive));
}

.unlock-btn {
  position: relative;
  width: 100%;
  height: 2.25rem;
  margin-top: 0.375rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  border: 1px solid hsl(var(--primary));
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.unlock-btn:hover { background: hsl(var(--primary-hover)); }

.unlock-text { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }

/* ------------------------------------------------------------------ dialogs */
/* shadcn Dialog: dimmed overlay, centred panel, large radius, lg shadow. */

.video-modal, .download-modal, .cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: hsl(240 10% 4% / 0.7);
}

.video-modal.show, .download-modal.show { display: flex; }

.video-modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 46rem;
  max-height: 90vh;
  overflow-y: auto;
  background: hsl(240 10% 6%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.video-modal-close {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  font-size: 1rem;
  line-height: 1;
  color: hsl(0 0% 100%);
  background: hsl(240 10% 4% / 0.6);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.video-modal-close:hover { background: hsl(240 10% 4% / 0.9); }

.video-frame { flex: 0 0 auto; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.video-frame iframe { display: block; width: 100%; height: 100%; border: 0; }

.video-substitute-note {
  display: none;
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  text-align: center;
  color: hsl(186 40% 82%);
  background: hsl(190 30% 12%);
}

/* The link-out panel is what most exercises show, so it is designed as a
   primary action rather than an error state. */
.video-fallback {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 16rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: hsl(0 0% 100%);
}

.vf-title { margin: 0; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.vf-sub { margin: 0; max-width: 38ch; font-size: 0.875rem; color: hsl(240 5% 70%); }

.vf-cta {
  height: 2.5rem;
  padding: 0 1.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  border: 1px solid hsl(var(--primary));
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.vf-cta:hover { background: hsl(var(--primary-hover)); }

.video-open-external {
  display: block;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  text-align: center;
  color: hsl(186 40% 78%);
  background: hsl(240 8% 9%);
  border-top: 1px solid hsl(0 0% 100% / 0.06);
}

.video-open-external:hover { color: hsl(0 0% 100%); }

.video-tips {
  padding: 1rem 1.25rem 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: hsl(240 5% 85%);
  background: hsl(240 8% 9%);
  border-top: 1px solid hsl(0 0% 100% / 0.06);
}

.video-tips h4 {
  margin-bottom: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: hsl(186 35% 70%);
}

.video-tips ul { padding-left: 1.125rem; }
.video-tips li { margin: 0.1875rem 0; }

.download-modal-content {
  width: 100%;
  max-width: 26rem;
  padding: 1.5rem;
  text-align: center;
  background: hsl(var(--card));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.download-modal-title { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.02em; }

.download-modal-text {
  margin: 0.5rem 0 1.25rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: hsl(var(--muted-foreground));
}

.download-modal-buttons { display: flex; flex-direction: column; gap: 0.5rem; }
.download-modal-btn { width: 100%; height: 2.5rem; }

.download-modal-close {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}

.download-modal-close:hover { color: hsl(var(--foreground)); text-decoration: underline; }

/* -------------------------------------------------------------- gratitude */

.gratitude-banner {
  display: none;
  margin: 1.25rem;
  padding: 1.25rem;
  text-align: center;
  background: hsl(var(--primary-subtle));
  border: 1px solid hsl(var(--primary) / 0.2);
  border-radius: var(--radius-lg);
}

.gratitude-banner.show { display: block; }
.gratitude-title { font-size: 0.9375rem; font-weight: 600; }

.gratitude-text {
  margin: 0.375rem 0 1rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.gratitude-form { display: flex; gap: 0.5rem; max-width: 24rem; margin: 0 auto; }

.gratitude-btn {
  flex-shrink: 0;
  height: 2.25rem;
  padding: 0 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  border: 1px solid hsl(var(--primary));
  border-radius: var(--radius);
  cursor: pointer;
}

.gratitude-btn:hover { background: hsl(var(--primary-hover)); }

.gratitude-skip {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}

.gratitude-skip:hover { color: hsl(var(--foreground)); text-decoration: underline; }

/* ---------------------------------------------------------- saved programs */

.history-btn { height: 2rem; padding: 0 0.75rem; font-size: 0.8125rem; }

/* ---------------------------------------------------------------- tooltips */

.tooltip {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 40;
  width: max-content;
  max-width: 17rem;
  padding: 0.5rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.5;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  color: hsl(0 0% 100%);
  background: hsl(240 10% 8%);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}

.focus-label:hover .tooltip,
.focus-label.active .tooltip,
.category-badge:hover .tooltip,
.body-type-btn:hover .tooltip {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.15s ease, visibility 0s linear 0s;
}

.category-badge {
  position: relative;
  display: inline-block;
  padding: 0.125rem 0.4375rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  cursor: help;
}

/* ------------------------------------------------------------------ cookies */

.cookie-banner {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 60;
  display: none;
  padding: 1rem 1.5rem;
  color: hsl(0 0% 100%);
  background: hsl(240 10% 8%);
  box-shadow: 0 -4px 20px hsl(240 10% 4% / 0.25);
}

.cookie-content {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  max-width: 72rem;
  margin: 0 auto;
}

.cookie-text { font-size: 0.8125rem; line-height: 1.6; max-width: 60ch; }
.cookie-actions { display: flex; gap: 0.5rem; }

.cookie-banner .cookie-btn {
  color: hsl(0 0% 100%);
  background: transparent;
  border-color: hsl(0 0% 100% / 0.2);
}

.cookie-banner .cookie-btn:hover { background: hsl(0 0% 100% / 0.1); }

.cookie-banner .cookie-btn.primary {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
}

.cookie-link { color: hsl(186 50% 75%); text-decoration: underline; }

.cookie-modal-content {
  width: 100%;
  max-width: 32rem;
  padding: 1.5rem;
  background: hsl(var(--card));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.cookie-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 0;
  border-top: 1px solid hsl(var(--border));
}

.cookie-row:first-of-type { border-top: none; }

.cookie-switch {
  position: relative;
  flex-shrink: 0;
  width: 2.75rem;
  height: 1.5rem;
  background: hsl(var(--muted));
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.cookie-switch input { display: none; }

.cookie-switch span {
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1.125rem;
  height: 1.125rem;
  background: hsl(var(--background));
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.cookie-switch:has(input:checked) { background: hsl(var(--primary)); }
.cookie-switch input:checked + span { transform: translateX(1.25rem); }

.cookie-modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.25rem; }

/* -------------------------------------------------------------------- toast */

.export-confirmation {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 70;
  max-width: 22rem;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-0.5rem);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.export-confirmation.show { opacity: 1; transform: translateY(0); }

/* ------------------------------------------------------------------- footer */

.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid hsl(var(--border));
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
}

.footer a { color: hsl(var(--muted-foreground)); }

/* --------------------------------------------------------------- responsive */

@media (max-width: 48rem) {
  .container { padding: 1.5rem 1rem 3rem; }
  .header { margin-bottom: 1.5rem; align-items: flex-start; }
  h1 { font-size: 1.375rem; }
  .toolbar { width: 100%; }
  .toolbar button { flex: 1 1 0; }
  .form { padding: 1.25rem; }

  .focus-item { grid-template-columns: 4.5rem 1fr 2.25rem; gap: 0.5rem; }

  /* Card layout for circuit rows — the 4-column grid cannot survive 375px */
  .list .row.data {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
  }

  .list .head { display: none; }
  .subrow { padding-left: 1.5rem; border-left: 2px solid hsl(var(--border)); }

  .list .row.data > div:not(.exercise-main) {
    display: inline-block;
    width: fit-content;
    padding: 0.125rem 0.4375rem;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    background: hsl(var(--muted));
    border-radius: var(--radius-sm);
  }

  .exercise-main { flex-wrap: wrap; }
  .play-btn { min-height: 2.25rem; }

  .generate-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin: 1.5rem -1.25rem -1.25rem;
    padding: 0.75rem 1.25rem calc(0.75rem + env(safe-area-inset-bottom));
    background: hsl(var(--background));
    border-top: 1px solid hsl(var(--border));
  }

  .tooltip { left: 0; right: auto; max-width: calc(100vw - 3rem); }
  .unlock-cta { width: calc(100% - 1.5rem); }
  .cookie-content { flex-direction: column; align-items: stretch; }
  .cookie-actions { flex-wrap: wrap; }
  .cookie-actions .cookie-btn { flex: 1 1 auto; }
  .export-confirmation { left: 1rem; right: 1rem; max-width: none; }
  .gratitude-form { flex-direction: column; }
  .gratitude-btn { width: 100%; }
}

/* ------------------------------------------------------------------- print */

.print-header { display: none; }

@media print {
  .no-print, .toolbar, .form, .header, .footer, .export-confirmation,
  .preview-gradient, .unlock-cta, .gratitude-banner, .download-modal,
  .cookie-banner, .cookie-modal, .play-btn, #my-programs-section { display: none !important; }

  @page { margin: 1.5cm; }

  body { background: #fff; font-size: 11pt; }
  .container { max-width: none; padding: 0; }
  .grid { grid-template-columns: 1fr; gap: 0; }
  .card { border: none; box-shadow: none; border-radius: 0; }

  .print-header {
    display: block;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    text-align: center;
    border-bottom: 2px solid #000;
  }

  .print-title { font-size: 16pt; font-weight: 700; }
  .print-date { font-size: 10pt; color: #555; }

  .list .row { padding: 0.5rem 0; page-break-inside: avoid; }
  .section-row { background: #f0f0f0; page-break-after: avoid; }
  .preview-blurred { filter: none; opacity: 1; }
  .total { padding: 0.75rem 0; border-top: 2px solid #000; }
}
