/* ============ SportK — Sistema de diseño ============ */

:root {
  /* Acento (default verde lima sport) */
  --accent: oklch(0.78 0.17 142);
  --accent-deep: oklch(0.62 0.16 145);
  --accent-soft: oklch(0.94 0.07 140);
  --accent-ink: oklch(0.28 0.08 150);

  /* Tokens de fase (motor de entrenamiento) */
  --phase-inhale: oklch(0.78 0.10 220);
  --phase-exhale: oklch(0.72 0.08 230);
  --phase-contract: var(--accent);
  --phase-hold: oklch(0.74 0.16 75);
  --phase-release: oklch(0.70 0.10 195);
  --phase-rest: oklch(0.62 0.006 150);
  --phase-reverse: oklch(0.68 0.16 320);
  --phase-peak: oklch(0.78 0.18 80);
  --phase-plateau: oklch(0.70 0.12 180);

  /* Neutros (light) */
  --bg: oklch(0.992 0.003 140);
  --surface: #ffffff;
  --surface-2: oklch(0.975 0.004 140);
  --line: oklch(0.92 0.005 140);
  --line-strong: oklch(0.86 0.006 140);
  --ink: oklch(0.18 0.01 150);
  --ink-2: oklch(0.42 0.008 150);
  --ink-3: oklch(0.62 0.006 150);

  /* Sombras suaves */
  --shadow-sm: 0 1px 2px rgba(20, 28, 22, 0.04), 0 0 0 1px rgba(20, 28, 22, 0.04);
  --shadow-md: 0 4px 16px rgba(20, 28, 22, 0.06), 0 0 0 1px rgba(20, 28, 22, 0.04);
  --shadow-lg: 0 16px 48px rgba(20, 28, 22, 0.10);

  /* Tipografía */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Espaciado */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;
}

[data-theme="dark"] {
  --bg: oklch(0.18 0.008 150);
  --surface: oklch(0.22 0.01 150);
  --surface-2: oklch(0.255 0.012 150);
  --line: oklch(0.30 0.012 150);
  --line-strong: oklch(0.36 0.014 150);
  --ink: oklch(0.97 0.005 140);
  --ink-2: oklch(0.78 0.008 150);
  --ink-3: oklch(0.58 0.008 150);
  --accent-soft: oklch(0.32 0.05 145);
  --accent-ink: oklch(0.92 0.10 140);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }

/* ============ App shell (responsive) ============ */
.app-shell {
  min-height: 100dvh;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 0;
}

@media (min-width: 720px) {
  .app-shell {
    padding: 32px;
    background: linear-gradient(180deg, var(--bg) 0%, var(--surface-2) 100%);
  }
}

.phone {
  width: 100%;
  max-width: 440px;
  height: 100dvh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (min-width: 720px) {
  .phone {
    min-height: 880px;
    height: 880px;
    border-radius: 36px;
    box-shadow: var(--shadow-lg), 0 0 0 8px var(--surface-2), 0 0 0 9px var(--line);
    overflow: hidden;
  }
}

.screen {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.screen::-webkit-scrollbar { width: 4px; }
.screen::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }

.screen-pad { padding: 0 22px; }
.screen-pad-top { padding-top: 18px; }

/* ============ Status bar (visual only) ============ */
.status-bar {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ============ Bottom nav ============ */
.bottom-nav {
  flex-shrink: 0;
  height: 78px;
  background: color-mix(in oklch, var(--surface) 88%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 12px calc(14px + env(safe-area-inset-bottom));
  z-index: 10;
}
.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  border-radius: 14px;
  padding: 6px 0;
  transition: color 0.15s, background 0.15s;
}
.bottom-nav button.active { color: var(--accent-deep); }
[data-theme="dark"] .bottom-nav button.active { color: var(--accent); }

/* ============ Header ============ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 22px 16px;
}
.app-header .title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.app-header .subtitle { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

/* ============ Cards ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
}
.card.flat { box-shadow: none; }
.card.elevated { box-shadow: var(--shadow-md); border-color: transparent; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 0.08s, background 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: oklch(0.18 0.04 150);
}
.btn-primary:hover { background: color-mix(in oklch, var(--accent) 92%, black); }
.btn-ghost {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--line); }
.btn-block { width: 100%; }
.btn-lg { padding: 18px 28px; font-size: 17px; }

/* ============ Pills / chips ============ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  letter-spacing: 0.01em;
}
.chip.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: transparent;
}
.chip.tiny { padding: 4px 9px; font-size: 11px; }

/* ============ Stat tiles ============ */
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.stat .label { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.stat .value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; color: var(--ink); margin-top: 4px; letter-spacing: -0.02em; }
.stat .delta { font-size: 11.5px; color: var(--accent-deep); margin-top: 2px; font-weight: 600; }

/* ============ Section heading ============ */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 28px 0 14px;
}
.section-head h2 { font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 0; letter-spacing: 0.02em; text-transform: uppercase; }
.section-head .link { font-size: 13px; color: var(--accent-deep); font-weight: 600; }
[data-theme="dark"] .section-head .link { color: var(--accent); }

/* ============ Hero card (today) ============ */
.hero {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  border-radius: var(--r-xl);
  padding: 22px;
  color: oklch(0.18 0.04 150);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%);
  pointer-events: none;
}
.hero .eyebrow {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  opacity: 0.7;
}
.hero h3 {
  margin: 6px 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.hero .meta {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.85;
}
.hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero .play-btn {
  margin-top: 16px;
  background: oklch(0.20 0.03 150);
  color: var(--accent);
  padding: 12px 22px;
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ============ Routine list item ============ */
.routine-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  width: 100%;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.routine-row:hover { background: var(--surface-2); border-color: var(--line-strong); }
.routine-row .icon-box {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.routine-row .meta {
  flex: 1;
  min-width: 0;
}
.routine-row .meta .name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.routine-row .meta .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.routine-row .arrow { color: var(--ink-3); flex-shrink: 0; }

/* ============ Exercise active screen ============ */
.exercise-active {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}
.exercise-active .top {
  padding: 16px 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.exercise-active .progress-track {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin: 14px 22px 0;
  overflow: hidden;
}
.exercise-active .progress-track .fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}
.exercise-active .body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}
.exercise-active .phase-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  font-weight: 700;
}
.exercise-active .exercise-name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 10px 0 4px;
  text-wrap: balance;
}
.exercise-active .exercise-sub {
  font-size: 14px;
  color: var(--ink-3);
  margin-bottom: 32px;
}

.timer-ring {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 16px auto;
}
.timer-ring svg { transform: rotate(-90deg); }
.timer-ring .timer-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.timer-ring .number {
  font-family: var(--font-mono);
  font-size: 72px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
}
.timer-ring .caption {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 8px;
}

.rep-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-2);
  margin-top: 20px;
  font-weight: 600;
}
.rep-counter .pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}
.rep-counter .pip.done { background: var(--accent); }

.exercise-controls {
  padding: 0 22px 32px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.icon-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink-2);
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.primary {
  width: 76px;
  height: 76px;
  background: var(--accent);
  color: oklch(0.18 0.04 150);
  border: none;
  box-shadow: 0 8px 24px color-mix(in oklch, var(--accent) 50%, transparent);
}

/* ============ Detail screen ============ */
.detail-hero {
  margin: 0 22px 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
}
.detail-hero .level-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.detail-hero h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
  text-wrap: balance;
}
.detail-hero .desc {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.5;
  margin: 0;
}
.detail-hero .stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.detail-hero .stats-row .col .l { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.detail-hero .stats-row .col .v { font-size: 18px; font-weight: 700; margin-top: 2px; font-family: var(--font-mono); letter-spacing: -0.02em; }

.exercise-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}
.exercise-list-item .num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.exercise-list-item .info { flex: 1; min-width: 0; }
.exercise-list-item .info .n { font-weight: 600; font-size: 14.5px; }
.exercise-list-item .info .s { font-size: 12px; color: var(--ink-3); margin-top: 2px; font-family: var(--font-mono); }

/* ============ Stats screen ============ */
.streak-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.streak-card .flame {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 26px;
  flex-shrink: 0;
}
.streak-card .num { font-family: var(--font-mono); font-size: 32px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.streak-card .lbl { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; font-weight: 600; }

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding: 8px 0;
}
.bar-chart .bar {
  flex: 1;
  background: var(--accent-soft);
  border-radius: 6px 6px 0 0;
  position: relative;
  min-height: 4px;
  transition: background 0.2s;
}
.bar-chart .bar.has-data { background: var(--accent); }
.bar-chart .bar .lbl {
  position: absolute;
  bottom: -22px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 600;
  text-transform: uppercase;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.history-row:last-child { border-bottom: none; }
.history-row .date-block {
  width: 48px;
  text-align: center;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.history-row .date-block .d { font-size: 22px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; }
.history-row .date-block .m { font-size: 10px; color: var(--ink-3); text-transform: uppercase; font-weight: 600; margin-top: 2px; }
.history-row .info { flex: 1; min-width: 0; }
.history-row .info .n { font-weight: 600; font-size: 14px; }
.history-row .info .s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ============ Profile / settings ============ */
.profile-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 22px 24px;
  text-align: center;
}
.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}
.profile-head .name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.profile-head .role { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

.settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  width: 100%;
  text-align: left;
}
.settings-row:first-child { border-top: none; }
.settings-row .ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink-2);
  flex-shrink: 0;
}
.settings-row .lbl { flex: 1; font-size: 14.5px; font-weight: 500; }
.settings-row .val { font-size: 13px; color: var(--ink-3); }

/* ============ Modal / sheet ============ */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 28, 22, 0.4);
  backdrop-filter: blur(4px);
  z-index: 20;
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: var(--bg);
  width: 100%;
  border-radius: 24px 24px 0 0;
  padding: 8px 22px 32px;
  max-height: 85%;
  overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes slideUp { from { transform: translateY(40px); } to { transform: translateY(0); } }
.sheet .grabber { width: 36px; height: 4px; background: var(--line-strong); border-radius: 2px; margin: 8px auto 16px; }
.sheet h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 16px; }

.field { margin-bottom: 14px; }
.field .l { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; display: block; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
}

.seg {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg button {
  flex: 1;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  transition: background 0.15s, color 0.15s;
}
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ============ Summary screen ============ */
.summary-head {
  text-align: center;
  padding: 32px 22px 16px;
}
.summary-head .badge {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.3, 1);
}
@keyframes pop { from { transform: scale(0.5); opacity: 0; } }
.summary-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.025em; margin: 0 0 4px; }
.summary-head .sub { color: var(--ink-3); font-size: 14px; }

.summary-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 22px;
  margin-bottom: 18px;
}

/* ============ Trainer pro (rediseño v2) ============ */

.exercise-active .ex-counter {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}

.phase-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1.5px solid currentColor;
  background: color-mix(in oklch, currentColor 8%, transparent);
}
.phase-pill .reverse-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  background: color-mix(in oklch, var(--phase-reverse) 28%, var(--surface));
  color: var(--phase-reverse);
  border: 1px solid color-mix(in oklch, var(--phase-reverse) 40%, transparent);
  letter-spacing: 0.05em;
  text-transform: none;
}

.timer-ring-pro {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 22px auto 12px;
}
.timer-ring-pro svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.timer-ring-pro .ring-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
  text-align: center;
}
.timer-ring-pro .breath-blob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.55;
  transform-origin: center;
  transition: transform 0.18s cubic-bezier(0.3, 0.9, 0.3, 1);
  pointer-events: none;
  z-index: 1;
}
.timer-ring-pro.is-flick .breath-blob {
  transition: transform 80ms ease-out;
}
.timer-ring-pro .cue-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
  max-width: 220px;
}
.timer-ring-pro .cue-number {
  font-family: var(--font-mono);
  font-size: 56px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
}
.timer-ring-pro .cue-sub {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink-3);
  margin-top: 6px;
}

/* Pulso visual para flicks */
.timer-ring-pro.is-flick .breath-blob {
  animation: flick-pulse 0.4s ease-out;
}
@keyframes flick-pulse {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(0.6); opacity: 0.45; }
}

/* Tinte sutil del fondo según fase */
.exercise-active.phase-inhale { background: color-mix(in oklch, var(--phase-inhale) 6%, var(--bg)); }
.exercise-active.phase-exhale { background: color-mix(in oklch, var(--phase-exhale) 6%, var(--bg)); }
.exercise-active.phase-contract { background: color-mix(in oklch, var(--phase-contract) 6%, var(--bg)); }
.exercise-active.phase-hold { background: color-mix(in oklch, var(--phase-hold) 6%, var(--bg)); }
.exercise-active.phase-release { background: color-mix(in oklch, var(--phase-release) 5%, var(--bg)); }
.exercise-active.phase-rest { background: var(--bg); }
.exercise-active.phase-reverse { background: color-mix(in oklch, var(--phase-reverse) 8%, var(--bg)); }
.exercise-active.phase-peak { background: color-mix(in oklch, var(--phase-peak) 8%, var(--bg)); }

/* Intensity bar */
.intensity-caption {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 14px auto 0;
}
.intensity-bar {
  position: relative;
  height: 10px;
  width: 220px;
  max-width: 80%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  margin: 22px auto 6px;
  overflow: visible;
}
.intensity-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: var(--accent);
  transition: width 0.18s ease;
  border-radius: 999px;
}
.intensity-fill.reverse {
  background: var(--phase-reverse);
  left: 0;
}
.intensity-label {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(100% + 4px);
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Rep counter pro */
.rep-counter-pro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}
.rep-counter-pro .pip {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: background 0.2s, transform 0.18s;
}
.rep-counter-pro .pip.done { background: var(--accent); }
.rep-counter-pro .pip.current {
  background: var(--accent-deep);
  transform: scale(1.4);
}
.rep-counter-pro .pip.reverse-mark {
  background: color-mix(in oklch, var(--phase-reverse) 50%, var(--line-strong));
  outline: 2px solid color-mix(in oklch, var(--phase-reverse) 35%, transparent);
}
.rep-counter-pro .pip.reverse-mark.done {
  background: var(--phase-reverse);
}

/* Tip activo */
.active-tip {
  margin: 18px auto 0;
  max-width: 340px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  text-align: center;
  line-height: 1.45;
}
.active-tip .tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 5px;
  margin-right: 6px;
}

/* Botón primario grande tap target ≥88px */
.icon-btn.primary.big {
  width: 88px;
  height: 88px;
  background: var(--accent);
  color: oklch(0.18 0.04 150);
  border: none;
  box-shadow: 0 10px 28px color-mix(in oklch, var(--accent) 50%, transparent);
}
.icon-btn:active { transform: scale(0.94); }

/* Pause overlay */
.pause-overlay {
  position: absolute;
  inset: 0;
  background: color-mix(in oklch, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 22px;
}
.pause-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.pause-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.pause-tips { margin: 14px 0 18px; font-size: 13px; color: var(--ink-2); line-height: 1.7; text-align: left; }
.pause-actions { display: flex; gap: 8px; }
.pause-actions .btn { flex: 1; }

/* Modo ojos cerrados */
.eyes-closed {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 40;
  cursor: pointer;
  user-select: none;
  transition: background 0.5s ease;
}
.ec-blob {
  position: absolute;
  top: 50%; left: 50%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  opacity: 0.7;
  filter: blur(28px);
  transition: transform 0.25s cubic-bezier(0.3, 0.9, 0.3, 1), background 0.6s ease;
}
.ec-cue {
  position: relative;
  z-index: 2;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-shadow: 0 1px 20px var(--bg);
  text-align: center;
  padding: 0 24px;
  text-wrap: balance;
}
.ec-intensity {
  position: relative;
  z-index: 2;
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-family: var(--font-sans);
  text-shadow: 0 1px 20px var(--bg);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ec-intensity-push {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--phase-reverse);
}
.ec-arousal-tap {
  position: relative;
  z-index: 3;
  min-width: 220px;
  padding: 18px 28px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 12px 32px color-mix(in oklch, var(--accent) 35%, transparent);
}
.ec-paused {
  position: absolute;
  bottom: 60px;
  left: 0; right: 0;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ec-reverse {
  position: absolute;
  top: 60px;
  left: 0; right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--phase-reverse);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}
.ec-exit {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--surface) 80%, transparent);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ============ Home ============ */
.tip-card {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 12px 14px;
}
.tip-card .tip-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-deep);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
[data-theme="dark"] .tip-card .tip-tag { color: var(--accent); }
.tip-card .tip-text { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }

.cta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  width: 100%;
  padding: 14px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.cta-row:hover { background: var(--surface-2); border-color: var(--accent); }
.cta-row .cta-ic {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.cta-row .cta-body { flex: 1; min-width: 0; }
.cta-row .cta-title { font-weight: 600; font-size: 14.5px; }
.cta-row .cta-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

.progression-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in oklch, var(--accent) 18%, var(--surface)));
  border: 1px solid color-mix(in oklch, var(--accent) 40%, transparent);
  border-radius: 14px;
  margin-bottom: 14px;
}
.progression-banner .pb-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: oklch(0.18 0.04 150);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.progression-banner .pb-body { flex: 1; min-width: 0; }
.progression-banner .pb-title { font-weight: 700; font-size: 14px; color: var(--accent-ink); }
.progression-banner .pb-sub { font-size: 12px; color: var(--accent-ink); opacity: 0.8; margin-top: 2px; }
.progression-banner .pb-actions { display: flex; gap: 6px; flex-shrink: 0; }

.rest-hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line);
}
.rest-hero::after { display: none; }
.rest-hero .hero-desc { font-size: 13.5px; line-height: 1.55; opacity: 0.8; margin-top: 6px; }

/* ============ Detalle: instrucción educativa ============ */
.exercise-list-item .instr {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  line-height: 1.5;
}

/* ============ Crear rutina: grid de tipos ============ */
.exercise-type-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

/* ============ Switch (toggle) ============ */
.switch {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background 0.18s;
  flex-shrink: 0;
}
.switch.on { background: var(--accent); }
.switch .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform 0.18s cubic-bezier(0.3, 0.9, 0.3, 1);
}
.switch.on .thumb { transform: translateX(18px); }

/* ============ Big number (test, sheets) ============ */
.big-number {
  font-family: var(--font-mono);
  font-size: 64px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  text-align: center;
  margin: 12px 0;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.big-number span {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink-3);
  margin-left: 4px;
  letter-spacing: 0;
}

.badge-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  display: grid;
  place-items: center;
  margin: 0 auto;
}

/* ============ Onboarding ============ */
.ob-eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-deep);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}
[data-theme="dark"] .ob-eyebrow { color: var(--accent); }
.ob-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 8px;
  line-height: 1.15;
  text-wrap: balance;
}
.ob-desc {
  font-size: 14.5px;
  color: var(--ink-2);
  margin: 0 0 22px;
  line-height: 1.5;
}

.ob-card {
  aspect-ratio: 1 / 1.05;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.15s;
}
.ob-card.active {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.ob-card-ic {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--ink-2);
  display: grid;
  place-items: center;
}
.ob-card.active .ob-card-ic { background: var(--accent); color: oklch(0.18 0.04 150); }
.ob-card-lbl { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }

.ob-goal {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  transition: all 0.15s;
}
.ob-goal.active {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
}
.ob-goal-radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  flex-shrink: 0;
  transition: all 0.15s;
}
.ob-goal.active .ob-goal-radio {
  border: 6px solid var(--accent);
}
.ob-goal-body { flex: 1; min-width: 0; }
.ob-goal-lbl { font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; }
.ob-goal.active .ob-goal-lbl { color: var(--accent-ink); }
.ob-goal-track { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ============ Track option (en EditProfileSheet) ============ */
.track-option {
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: all 0.15s;
}
.track-option.active {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
}
.track-option .t-name { font-weight: 600; font-size: 14px; }
.track-option .t-blurb { font-size: 12px; color: var(--ink-3); margin-top: 2px; line-height: 1.45; }

/* ============ Settings row column variant ============ */

/* ============ Reverse rep highlight ============ */
.exercise-active.is-reverse-rep .exercise-name { color: var(--phase-reverse); }
.exercise-active.is-reverse-rep .exercise-sub { color: color-mix(in oklch, var(--phase-reverse) 60%, var(--ink-3)); }

/* tweaks integration */
.tweak-color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.tweak-color-grid button {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform 0.1s;
  position: relative;
}
.tweak-color-grid button.active { border-color: var(--ink); transform: scale(1.05); }
[data-theme="dark"] .tweak-color-grid button.active { border-color: var(--ink); }

/* ============ Guía pre-test (onboarding) ============ */
.guide-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.guide-h {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.guide-p {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
.guide-list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.guide-list li {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.4;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.guide-list .bad {
  color: oklch(0.62 0.18 28);
  font-weight: 700;
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}
.guide-list .ok {
  color: var(--accent-deep);
  font-weight: 700;
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}

/* ============ Glosario por ejercicio ============ */
.ex-glossary {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.ex-glossary-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.ex-glossary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.glossary-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid color-mix(in oklch, var(--accent) 25%, transparent);
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  white-space: nowrap;
}
.glossary-chip:hover { transform: translateY(-1px); }
.glossary-chip:active { transform: translateY(0) scale(0.97); }
[data-theme="dark"] .glossary-chip {
  background: color-mix(in oklch, var(--accent) 18%, var(--surface));
  color: var(--accent);
  border-color: color-mix(in oklch, var(--accent) 40%, transparent);
}

/* Lista del glosario completo (sheet) */
.glossary-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
  margin: 4px -4px 0;
  padding: 0 4px;
}
.glossary-item {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.glossary-item:hover { border-color: var(--accent); }
.glossary-item:active { transform: scale(0.99); }
.gi-term {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}
.gi-short {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.4;
}

/* ===========================================================
   Fase 'arousal' (tap-controlada) — Stop-Start clínico
   =========================================================== */
.arousal-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 18px 0;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  text-align: center;
}
.arousal-hint {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  max-width: 320px;
}
.arousal-tap {
  background: var(--phase-c, var(--accent)) !important;
  border-color: var(--phase-c, var(--accent)) !important;
  color: #fff !important;
  font-size: 16px !important;
  padding: 18px 24px !important;
  box-shadow: 0 8px 24px -8px color-mix(in oklch, var(--phase-c, var(--accent)) 60%, transparent);
  animation: arousal-pulse 2s ease-in-out infinite;
}
.arousal-tap:active { transform: scale(0.985); animation: none; }
.arousal-sub {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.4;
  max-width: 300px;
}
@keyframes arousal-pulse {
  0%, 100% { box-shadow: 0 8px 24px -8px color-mix(in oklch, var(--phase-c, var(--accent)) 60%, transparent); }
  50%      { box-shadow: 0 8px 32px -4px color-mix(in oklch, var(--phase-c, var(--accent)) 80%, transparent); }
}

/* Toggle "con estimulación" en pantalla de detalle */
.arousal-toggle-card {
  margin: 8px 22px 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.arousal-toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.arousal-toggle-text { flex: 1; min-width: 0; }
.arousal-toggle-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.arousal-toggle-hint {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.4;
  margin-top: 4px;
}
.arousal-toggle-switch {
  flex-shrink: 0;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  position: relative;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
  padding: 0;
}
.arousal-toggle-switch.is-on {
  background: var(--accent);
  border-color: var(--accent);
}
.arousal-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 180ms ease;
}
.arousal-toggle-switch.is-on .arousal-toggle-knob { transform: translateX(20px); }
