/* ═══════════════════════════════════════════════════════════════
   Cardio final (js/24j-cardio.js): prescripción premium + anillo
   Ligero para Safari en iPhone: degradados planos, sin filtros ni
   desenfoques ni colores P3. El color sigue a la fase:
   trabajo = fuego, descanso = hielo, continuo = acento, hecho = verde.
═══════════════════════════════════════════════════════════════ */
.cx { --cx-hot: #ff6a3d; --cx-cool: #5b8dff; --cx-acc: var(--rn-acc, #d4a843); display: grid; gap: 12px; margin: 14px 0 16px; }

/* Prescripción */
.cx-card { position: relative; overflow: hidden; display: grid; gap: 12px; padding: 15px; border-radius: 22px;
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.02)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.cx-card::before { content: ''; position: absolute; top: 0; left: 18px; right: 18px; height: 2px; border-radius: 0 0 2px 2px; background: linear-gradient(90deg, transparent, var(--cx-c), transparent); opacity: .85; }
.cx-card.is-hiit { --cx-c: var(--cx-hot); background: radial-gradient(120% 120% at 100% 0%, rgba(255,106,61,.16), transparent 55%), linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.02)); }
.cx-card.is-steady { --cx-c: var(--cx-acc); background: radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--cx-acc) 16%, transparent), transparent 55%), linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.02)); }
.cx-card header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.cx-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: var(--cx-c); background: color-mix(in srgb, var(--cx-c) 16%, rgba(255,255,255,.03)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cx-c) 30%, transparent); }
.cx-ic svg { width: 22px; height: 22px; }
.cx-card header > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.cx-card header small { font: 900 9.5px/1 'Inter', sans-serif; letter-spacing: 1.5px; text-transform: uppercase; color: var(--cx-c); }
.cx-card header b { font: 900 21px/1 'Barlow Condensed', sans-serif; letter-spacing: .4px; text-transform: uppercase; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-card header em { display: inline-flex; align-items: center; gap: 5px; padding: 7px 11px 7px 9px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);  border-radius: 999px; background: rgba(0,0,0,.28); font: 800 13px/1 'Inter', sans-serif; font-style: normal; color: #fff; font-variant-numeric: tabular-nums; }
.cx-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cx-tiles div { display: grid; justify-items: center; gap: 4px; padding: 11px 6px; border-radius: 16px; background: rgba(0,0,0,.24); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.cx-tiles b { font: 900 26px/1 'Barlow Condensed', sans-serif; color: #fff; }
.cx-tiles b i { font-style: normal; font-size: 14px; margin-left: 1px; opacity: .7; }
.cx-tiles small { font: 800 10px/1 'Inter', sans-serif; letter-spacing: 1px; text-transform: uppercase; color: rgba(255,255,255,.55); }
.cx-tiles .is-work b { color: #ffb08a; } .cx-tiles .is-work { box-shadow: inset 0 0 0 1px rgba(255,106,61,.35); }
.cx-tiles .is-rest b { color: #a9c3ff; } .cx-tiles .is-rest { box-shadow: inset 0 0 0 1px rgba(91,141,255,.35); }
.cx-stations { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-stations span { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 11px 0 5px; border-radius: 999px; background: rgba(255,255,255,.06); font: 700 12.5px/1 'Inter', sans-serif; color: #fff; }
.cx-stations i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--cx-c); color: #1a0b05; font: 900 11px/1 'Inter', sans-serif; font-style: normal; }
.cx-card header em svg { width: 14px; height: 14px; color: var(--cx-c); }
.cx-card header em i { margin-left: 2px; font: 700 11px/1 'Inter', sans-serif; font-style: normal; color: rgba(255,255,255,.6); }
.cx-params { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
/* 3 por fila; si la última fila queda con 2 o 1, se reparten el ancho completo */
.cx-param:nth-child(3n+1):nth-last-child(2), .cx-param:nth-child(3n+1):nth-last-child(2) ~ .cx-param { grid-column: span 3; }
.cx-param:nth-child(3n+1):last-child { grid-column: 1 / -1; }
.cx-params:empty { display: none; }
.cx-param { grid-column: span 2; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  padding: 10px 10px 11px; border-radius: 16px; background: linear-gradient(180deg, rgba(0,0,0,.22), rgba(0,0,0,.32)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), inset 0 1px 0 rgba(255,255,255,.03); }
.cx-param-hd { display: inline-flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%; min-width: 0; }
.cx-param-ic { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px; color: var(--cx-c); background: color-mix(in srgb, var(--cx-c) 14%, transparent); }
.cx-param-ic svg { width: 13px; height: 13px; }
.cx-param small { min-width: 0; font: 800 8.5px/1 'Inter', sans-serif; letter-spacing: 1px; text-transform: uppercase; color: rgba(255,255,255,.48); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-param b { font: 900 24px/.95 'Barlow Condensed', sans-serif; letter-spacing: .2px; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-param b i { margin-left: 3px; font: 700 11px/1 'Inter', sans-serif; font-style: normal; color: rgba(255,255,255,.55); }
.cx-note { margin: 0; padding: 10px 12px; border-radius: 14px; background: rgba(0,0,0,.2); border-left: 2px solid var(--cx-c); font: 600 13px/1.5 'Inter', sans-serif; color: rgba(255,255,255,.82); }

/* Escenario */
.cx-stage { --ph: var(--cx-acc); display: grid; justify-items: center; gap: 12px; padding: 18px 14px 16px; border-radius: 26px;
  background: radial-gradient(90% 70% at 50% 30%, color-mix(in srgb, var(--ph) 18%, transparent), transparent 70%), linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); transition: background .5s; }
.cx-stage[data-phase=work] { --ph: var(--cx-hot); }
.cx-stage[data-phase=rest] { --ph: var(--cx-cool); }
.cx-stage[data-phase=done] { --ph: #2fbf74; }
.cx-ring { position: relative; width: min(62vw, 236px); aspect-ratio: 1; }
.cx-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.cx-track { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 14; }
.cx-arc { fill: none; stroke: url(#cx-g-steady); stroke-width: 14; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .25s linear; }
.cx-stage[data-phase=work] .cx-arc { stroke: url(#cx-g-work); }
.cx-stage[data-phase=rest] .cx-arc { stroke: url(#cx-g-rest); }
.cx-stage[data-phase=done] .cx-arc { stroke: url(#cx-g-done); }
.cx-total-track { fill: none; stroke: rgba(255,255,255,.05); stroke-width: 3; }
.cx-total { fill: none; stroke: rgba(255,255,255,.55); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .25s linear; }
.cx-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 0 9%; text-align: center; }
.cx-center small { max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 900 11px/1 'Inter', sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--ph); }
.cx-center b { font: 900 clamp(48px, 16.5vw, 64px)/.9 'Barlow Condensed', sans-serif; letter-spacing: .5px; color: #fff; font-variant-numeric: tabular-nums; }
.cx-center em { max-width: 100%; font: 700 12px/1.3 'Inter', sans-serif; font-style: normal; color: rgba(255,255,255,.62); text-align: center; }
.cx-stage[data-run] .cx-center b { animation: cxBeat 1s ease-in-out infinite; }
@keyframes cxBeat { 50% { transform: scale(1.025); } }
.cx-pips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 260px; }
.cx-pips i { width: 18px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.12); transition: background .3s, width .3s; }
.cx-pips i.is-on { width: 28px; background: var(--ph); }
.cx-pips i.is-done { background: rgba(255,255,255,.55); }
.cx-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; border-radius: 16px; background: rgba(255,255,255,.035); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.cx-stats > div { display: grid; justify-items: center; gap: 5px; padding: 11px 6px 10px; }
.cx-stats > div + div { box-shadow: inset 1px 0 0 rgba(255,255,255,.06); }
.cx-stats small { font: 800 10px/1 'Inter', sans-serif; letter-spacing: 1.4px; text-transform: uppercase; color: rgba(255,255,255,.45); }
.cx-stats b { font: 900 22px/1 'Barlow Condensed', sans-serif; letter-spacing: .3px; color: #fff; font-variant-numeric: tabular-nums; }
.cx-stats .is-grit b { color: var(--cx-acc); }
.cx-stage[data-paused] .cx-center small, .cx-stage[data-ended] .cx-center small { color: rgba(255,255,255,.6); }
.cx-stage[data-paused] .cx-center b { animation: cxBlink 1.6s ease-in-out infinite; }
.cx-stage[data-ended] .cx-arc { opacity: .55; }
@keyframes cxBlink { 50% { opacity: .45; } }
.cx-bar { width: 100%; height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.cx-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--cx-hot), var(--cx-acc)); transition: width .25s linear; }
.cx-ctrl { display: grid; grid-template-columns: 64px 76px 64px; align-items: start; justify-content: center; gap: 18px; margin-top: 4px; touch-action: pan-y; }
.cx-ctrl .cx-btn-ghost { position: relative; margin: 12px auto 0; }
.cx-btn-ghost small { position: absolute; top: calc(100% + 7px); left: 50%; transform: translateX(-50%); font: 700 10.5px/1 'Inter', sans-serif; color: rgba(255,255,255,.5); white-space: nowrap; }
.cx-ctrl button { display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .15s; }
.cx-ctrl button:active { transform: scale(.92); }
.cx-btn-ghost { width: 52px; height: 52px; background: rgba(255,255,255,.07); color: rgba(255,255,255,.8); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.cx-btn-ghost svg { width: 21px; height: 21px; }
.cx-btn-main { width: 76px; height: 76px; background: var(--ph); color: #0d0d10; box-shadow: 0 12px 28px color-mix(in srgb, var(--ph) 40%, transparent), inset 0 1px 0 rgba(255,255,255,.4); transition: background .4s, transform .15s; }
.cx-btn-main svg { width: 30px; height: 30px; }
.cx-stage:not([data-run]) .cx-btn-main svg { margin-left: 3px; }
.cx-stage[data-phase=done] .cx-btn-main svg { margin-left: 0; width: 34px; height: 34px; }
.cx-stage[data-phase=done] .cx-btn-main { animation: cxPop .5s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes cxPop { from { transform: scale(.7); } }
.cx { padding-bottom: 28px; }
/* Resumen */
.cx-sumrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; margin: 10px 0 0; padding: 12px 14px; border-radius: 16px; background: rgba(255,106,61,.08); box-shadow: inset 0 0 0 1px rgba(255,106,61,.22); }
.cx-sumrow span { display: inline-flex; align-items: center; gap: 8px; font: 800 13px/1 'Inter', sans-serif; color: #fff; }
.cx-sumrow span svg { width: 17px; height: 17px; color: #ff8a5c; }
.cx-sumrow b { font: 900 18px/1 'Barlow Condensed', sans-serif; color: #fff; } .cx-sumrow b i { font-style: normal; font-size: 13px; opacity: .6; }
.cx-sumrow em { font: 900 12px/1 'Inter', sans-serif; font-style: normal; color: var(--rn-acc, #d4a843); }
@media (prefers-reduced-motion: reduce) { .cx-stage[data-run] .cx-center b, .cx-stage[data-paused] .cx-center b, .cx-stage[data-phase=done] .cx-btn-main { animation: none; } .cx-arc, .cx-total, .cx-bar i { transition: none; } }


/* Completo: el botón de la bandera lleva al resumen */
.cx-ctrl .cx-btn-ghost.is-go { background: color-mix(in srgb, var(--ph) 18%, transparent); color: var(--ph); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ph) 45%, transparent); }
.cx-ctrl .cx-btn-ghost.is-go small { color: var(--ph); font-weight: 800; }

/* Elegir máquina cuando el coach dio alternativas */
.cx-pick { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.3); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); overflow-x: auto; scrollbar-width: none; }
.cx-pick::-webkit-scrollbar { display: none; }
.cx-pick button { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 12px; border: 0; border-radius: 11px; background: transparent; color: rgba(255,255,255,.6); font: 800 12.5px/1 'Inter', sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .2s, color .2s; }
.cx-pick button svg { width: 16px; height: 16px; }
.cx-pick button.on { background: color-mix(in srgb, var(--cx-c) 22%, rgba(255,255,255,.04)); color: #fff; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cx-c) 45%, transparent); }
.cx-pick button.on svg { color: var(--cx-c); }

.cx-head { display: grid; gap: 10px; }
/* Tipo de cardio: reglas cortas, nota y «cómo se calcula» detrás del ícono */
.cx-rules { display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: rgba(0,0,0,.22); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.cx-rules > small, .cx-note > small { display: block; font: 900 9.5px/1 'Inter', sans-serif; letter-spacing: 1.4px; text-transform: uppercase; color: var(--cx-c); }
.cx-note > small { margin-bottom: 6px; }
.cx-rules ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.cx-rules li { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 10px; font: 600 13px/1.35 'Inter', sans-serif; color: rgba(255,255,255,.86); }
.cx-rules li svg { width: 22px; height: 22px; padding: 4px; border-radius: 7px; color: var(--cx-c); background: color-mix(in srgb, var(--cx-c) 14%, transparent); }
.cx-why { border-radius: 14px; }
.cx-why summary { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; list-style: none; cursor: pointer; font: 700 12px/1 'Inter', sans-serif; color: rgba(255,255,255,.55); -webkit-tap-highlight-color: transparent; }
.cx-why summary::-webkit-details-marker { display: none; }
.cx-why summary svg { width: 17px; height: 17px; color: var(--cx-c); }
.cx-why[open] summary { color: #fff; }
.cx-why ul { margin: 4px 0 0; padding: 10px 12px 10px 28px; border-radius: 12px; background: rgba(0,0,0,.22); display: grid; gap: 6px; font: 500 12px/1.5 'Inter', sans-serif; color: rgba(255,255,255,.7); }
/* Rangos (3,5–4,5) caben en tres columnas en un iPhone */
.cx-params .cx-param { padding: 10px 6px 11px; gap: 7px; }
.cx-params .cx-param-hd { gap: 4px; }
.cx-params .cx-param-ic { width: 16px; height: 16px; border-radius: 5px; }
.cx-params .cx-param-ic svg { width: 11px; height: 11px; }
.cx-params .cx-param small { letter-spacing: .4px; }
.cx-params .cx-param b { font-size: 21px; }
.cx-params .cx-param b i { margin-left: 2px; font-size: 10px; }
