/* Terminatrix · estilo deportivo: blanco y negro, tipografía condensada, un solo acento. */

:root {
  --ink: #111111;
  --ink-2: #2e2e2e;
  --paper: #ffffff;
  --mist: #f5f5f5;
  --line: #e5e5e5;
  --mute: #6f6f6f;
  --soft: #bdbdbd;
  --accent: #dcff1e;
  --warn: #d43f00;
  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pad: 20px;
  --top: 56px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + var(--safe-t) + 48px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.has-rest { padding-bottom: calc(92px + var(--safe-b)); }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.wrap { max-width: 640px; margin: 0 auto; }
main:focus { outline: none; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* Tipografía */
.display {
  margin: 0;
  font-weight: 800;
  font-stretch: 62%;
  text-transform: uppercase;
  line-height: 0.86;
  letter-spacing: -0.005em;
}
.xl { font-size: clamp(64px, 21vw, 124px); }
.lg { font-size: clamp(40px, 12vw, 64px); }
.md { font-size: clamp(30px, 9vw, 42px); }
.kicker {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}
.mute { color: var(--mute); }

/* Barra superior */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: var(--safe-t);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  height: var(--top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 var(--pad);
}
.brand {
  font-weight: 900;
  font-stretch: 62%;
  font-size: 26px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-decoration: none;
}
.wake {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.wake-dot { width: 8px; height: 8px; border-radius: 50%; background: #c7c7c7; }
.wake.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.wake.is-on .wake-dot { background: var(--accent); }

/* Hero */
.hero { padding: 36px var(--pad) 40px; background: var(--ink); color: var(--paper); }
.hero .kicker { color: var(--soft); }
.lede { margin: 16px 0 0; max-width: 34ch; font-size: 17px; color: #e5e5e5; }
.back {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--soft);
  text-decoration: none;
}
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.hint { margin: 20px 0 0; font-size: 14px; color: var(--soft); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #2b2b2b;
  color: var(--paper);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill-accent { background: var(--accent); color: var(--ink); cursor: pointer; }
.pill-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.pill-q {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--accent);
  font-size: 11px;
}

/* Inicio: atletas */
.tiles { display: grid; }
.tile {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 16px;
  min-height: 340px;
  padding: 28px var(--pad) 32px;
  text-decoration: none;
}
.tile-light { background: var(--mist); color: var(--ink); }
.tile-dark { background: var(--ink); color: var(--paper); border-top: 1px solid #2b2b2b; }
.tile .kicker { margin: 0; color: var(--mute); }
.tile-dark .kicker { color: var(--soft); }
.tile-name { font-size: clamp(76px, 25vw, 150px); line-height: 0.8; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}
.tag-mist { background: var(--mist); border-color: var(--mist); }
.tag-accent { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.foot { margin: 0; padding: 24px var(--pad) 40px; font-size: 12px; color: var(--mute); }

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  align-self: flex-start;
  height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-light { background: var(--paper); color: var(--ink); }
.btn-accent { background: var(--accent); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-block { width: 100%; align-self: stretch; }

/* Progreso de la sesión */
.progress {
  position: sticky;
  top: calc(var(--top) + var(--safe-t));
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 var(--pad);
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.progress-lbl { color: var(--soft); }
.progress-track { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #2b2b2b; }
.progress-fill {
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s ease;
}

/* Bloques */
.block { padding: 44px var(--pad) 16px; border-top: 8px solid var(--mist); }
.block:first-of-type { border-top: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.block-note { margin: 10px 0 0; font-size: 15px; color: var(--mute); }

/* Calentamiento y estiramiento */
.checklist { margin: 20px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.cl {
  display: grid;
  grid-template-columns: 64px 1fr 44px;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.cl.no-img { grid-template-columns: 1fr 44px; }
.cl-txt { font-weight: 600; line-height: 1.3; }
.cl-txt small { display: block; margin-top: 3px; font-size: 14px; font-weight: 500; color: var(--mute); }
.cl.is-done .cl-txt { color: var(--mute); text-decoration: line-through; text-decoration-thickness: 1px; }

/* Tarjeta de ejercicio */
.card { padding: 28px var(--pad) 32px; border-top: 1px solid var(--line); }
.block + .card { border-top: 0; padding-top: 12px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.num {
  flex: none;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--mist);
  font-weight: 800;
  font-stretch: 62%;
  font-size: 22px;
  line-height: 1.1;
}
.card.is-done .num { background: var(--accent); }
.card.is-done .num::after { content: " ✓"; }
.card-top .tags { justify-content: flex-end; }
.card-title { margin-bottom: 14px; }
.machine { margin: 0 0 18px; font-size: 15px; line-height: 1.45; color: var(--ink-2); }

/* Animación: alterna la foto de inicio y la de final */
.anim {
  position: relative;
  margin: 0 calc(-1 * var(--pad));
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #fff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.anim img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.anim-b { animation: tx-in 2.8s ease-in-out infinite; }
.anim figcaption { position: absolute; left: 12px; bottom: 12px; height: 24px; }
.anim-lbl {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.anim-lbl-a { animation: tx-out 2.8s ease-in-out infinite; }
.anim-lbl-b { animation: tx-in 2.8s ease-in-out infinite; background: var(--accent); color: var(--ink); }
.anim-play {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(17, 17, 17, 0.8);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}
.anim.is-paused .anim-play { opacity: 1; }
.anim.is-paused img,
.anim.is-paused .anim-lbl { animation-play-state: paused; }
@keyframes tx-in { 0%, 38% { opacity: 0; } 50%, 88% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tx-out { 0%, 38% { opacity: 1; } 50%, 88% { opacity: 0; } 100% { opacity: 1; } }

.anim-sm {
  margin: 0;
  width: 64px;
  height: 64px;
  aspect-ratio: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: default;
}

/* Prescripción */
.rx {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  margin: 0;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.rx > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 4px; min-width: 0; padding-right: 8px; }
.rx > div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.rx dt { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; line-height: 1.2; text-transform: uppercase; color: var(--mute); }
.rx dd { margin: 0; font-weight: 800; font-stretch: 62%; font-size: 30px; line-height: 1; }
.rx-rir {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.prev { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--mist); font-size: 15px; font-weight: 600; }

/* Técnica */
.tec { margin-top: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tec summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  list-style: none;
  font-weight: 800;
  font-stretch: 62%;
  font-size: 26px;
  text-transform: uppercase;
  cursor: pointer;
}
.tec summary::-webkit-details-marker { display: none; }
.tec-ico { position: relative; width: 16px; height: 16px; }
.tec-ico::before,
.tec-ico::after { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 2px; background: currentColor; }
.tec-ico::after { transform: rotate(90deg); transition: transform 0.2s; }
.tec[open] .tec-ico::after { transform: rotate(0deg); }
.tec-body { display: grid; gap: 18px; padding: 0 0 20px; }
.tec-sec h4 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.tec-sec ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tec-sec li { position: relative; padding-left: 22px; line-height: 1.45; }
.tec-sec li::before { content: ""; position: absolute; left: 0; top: 0.68em; width: 12px; height: 2px; background: var(--ink); }
.tec-evita h4 { color: var(--warn); }
.tec-evita li::before { content: "✕"; top: 0; width: auto; height: auto; background: none; color: var(--warn); font-size: 13px; font-weight: 800; }
.nota { padding: 16px; border-radius: 14px; background: var(--ink); color: var(--paper); }
.nota .label { color: var(--accent); }
.nota p { margin: 0; }
.link-video { justify-self: start; font-size: 14px; font-weight: 700; text-underline-offset: 3px; }

/* Registro de series */
.sets { margin-top: 18px; }
.sets-head,
.set { display: grid; grid-template-columns: 36px 1fr 56px; gap: 10px; align-items: center; }
.sets-head {
  padding-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}
.sets-head span:first-child,
.sets-head span:last-child { text-align: center; }
.set { padding: 6px 0; }
.set-n { font-weight: 800; font-stretch: 62%; font-size: 28px; line-height: 1; text-align: center; }
.set-fields { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.field { position: relative; display: block; }
.field input {
  width: 100%;
  height: 56px;
  padding: 0 46px 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: 700 22px/1 var(--sans);
  appearance: none;
}
.field input::placeholder { color: #b8b8b8; font-weight: 600; }
.field input:focus { outline: none; border-color: var(--ink); }
.field span {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  pointer-events: none;
}
.set.is-done .field input { background: var(--mist); border-color: var(--mist); }

.check {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  color: #c4c4c4;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.check:active { transform: scale(0.94); }
.check[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.check-sm { width: 44px; height: 44px; font-size: 18px; }

/* Cierre de sesión */
.finish { margin-top: 24px; padding: 44px var(--pad) 48px; background: var(--mist); }
.finish p { margin: 12px 0 20px; color: var(--ink-2); }
.finish textarea {
  width: 100%;
  min-height: 112px;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  font: 16px/1.45 var(--sans);
  resize: vertical;
}
.finish textarea:focus { outline: none; border-color: var(--ink); }
.finish-btns { display: grid; gap: 10px; margin-top: 16px; }
.resumen {
  margin: 16px 0 0;
  padding: 14px;
  border-radius: 12px;
  background: var(--paper);
  font: 13px/1.5 ui-monospace, Menlo, monospace;
  white-space: pre-wrap;
  user-select: all;
  -webkit-user-select: all;
}

/* Temporizador de descanso */
.rest {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding-bottom: var(--safe-b);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
}
.rest-track { height: 4px; background: #2b2b2b; }
.rest-track i { display: block; height: 100%; background: var(--accent); transform-origin: left; transition: transform 0.25s linear; }
.rest-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--pad); }
.rest-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--soft); }
.rest-time {
  display: block;
  font-weight: 800;
  font-stretch: 62%;
  font-size: 48px;
  line-height: 0.95;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.rest-btns { display: flex; gap: 8px; }
.rest-btns button {
  height: 44px;
  min-width: 52px;
  padding: 0 14px;
  border: 1px solid #3a3a3a;
  border-radius: 999px;
  background: transparent;
  color: var(--paper);
  font-weight: 700;
  cursor: pointer;
}
.rest-btns .rest-skip { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.rest.is-over { background: var(--accent); color: var(--ink); }
.rest.is-over .rest-time,
.rest.is-over .rest-label { color: var(--ink); }
.rest.is-over .rest-btns button { border-color: rgba(0, 0, 0, 0.25); color: var(--ink); }
.rest.is-over .rest-btns .rest-skip { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* Hoja de RIR */
.sheet {
  width: 100%;
  max-width: min(640px, 100%);
  max-height: 90vh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  color: var(--ink);
  overflow: auto;
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.55); }
.sheet-in { padding: 28px var(--pad) calc(24px + var(--safe-b)); }
.sheet p { margin: 14px 0; }
.rir-scale { display: grid; gap: 8px; margin: 18px 0; padding: 0; list-style: none; }
.rir-scale li { padding: 12px 14px; border-radius: 12px; background: var(--mist); }
.rir-scale b { display: block; font-weight: 800; font-stretch: 62%; font-size: 20px; text-transform: uppercase; }
.rir-scale .is-ok { background: var(--accent); }

/* Aviso flotante */
.toast {
  position: fixed;
  top: calc(var(--top) + var(--safe-t) + 50px);
  left: 50%;
  z-index: 40;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Pantallas grandes: la app queda centrada como en el teléfono */
@media (min-width: 700px) {
  body { background: #ececec; }
  main { min-height: 100vh; background: var(--paper); }
}

/* Movimiento reducido: las dos fotos lado a lado, sin animación */
@media (prefers-reduced-motion: reduce) {
  .anim { display: grid; grid-template-columns: 1fr 1fr; aspect-ratio: auto; cursor: default; }
  .anim img { position: static; height: auto; aspect-ratio: 3 / 2; }
  .anim-b { animation: none; }
  .anim figcaption,
  .anim-play { display: none; }
  .anim-sm { display: block; }
  .anim-sm .anim-b { display: none; }
  *, *::before, *::after { transition: none !important; }
}
