/* ═══════════════════════════════════════════
   IRON · sistema visual
   Grafito con acento naranja. Sin colores por músculo,
   sin mayúsculas gritonas, menos bordes y más aire.
   ═══════════════════════════════════════════ */
:root {
  --bg: #1a1d23;
  --bg-alto: #212630;
  --surface: #252a33;
  --surface-2: #2d333d;
  --surface-3: #39404b;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --text: #f1f3f6;
  --muted: #a6aeba;
  --dim: #7e8794;
  --accent: #ff6a1f;
  --accent-2: #ffa033;
  --accent-soft: rgba(255, 106, 31, .13);
  --grad: linear-gradient(135deg, #ff6a1f, #ff9430);
  --ok: #43cc84;
  --warn: #ffb648;
  --danger: #ff5a68;
  --r: 16px;
  --r-lg: 22px;
  --sombra: 0 2px 8px rgba(0, 0, 0, .25), 0 12px 28px rgba(0, 0, 0, .22);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p, span, b, u, div, li, td, th, summary, .chip, .tag { overflow-wrap: anywhere; }

html, body {
  margin: 0;
  /* Ojo: nada de overflow aquí. Poner overflow en html/body convierte la página
     en un contenedor con scroll propio y deja de poder bajarse en el móvil. */
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body {
  min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  background-image: radial-gradient(1100px 600px at 50% -5%, #252b35, transparent 70%);
  background-attachment: fixed;
}
.hidden { display: none !important; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.02rem; }
.display { font-family: "Barlow Condensed", Inter, sans-serif; font-weight: 700; letter-spacing: .01em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.accent { color: var(--accent); }
.center { text-align: center; }

/* ── Arranque ─────────────────────────────── */
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); transition: opacity .4s; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-logo { width: 62px; height: 62px; border-radius: 18px; background: var(--grad);
  box-shadow: 0 0 40px rgba(255, 106, 31, .3); animation: pulso 1.2s ease-in-out infinite; }
@keyframes pulso { 50% { transform: scale(1.1); opacity: .75; } }

/* ── Barra superior ───────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; padding-top: calc(12px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--grad); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: 7px 5px; border-radius: 2px; background: rgba(0, 0, 0, .5);
  clip-path: polygon(0 35%, 12% 35%, 12% 0, 30% 0, 30% 100%, 12% 100%, 12% 65%, 0 65%, 0 35%, 100% 35%, 100% 65%, 88% 65%, 88% 100%, 70% 100%, 70% 0, 88% 0, 88% 35%); }
.brand-name { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 1.4rem; letter-spacing: .16em; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.pill-sync { font-size: .7rem; color: var(--dim); white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface-2);
  color: var(--text); font-weight: 600; font-size: .85rem; cursor: pointer; padding: 0; display: grid; place-items: center; flex: none; }

/* ── Estructura ───────────────────────────── */
main { max-width: 840px; margin: 0 auto; padding: 4px 18px 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-head:first-child { margin-top: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 8px; }
.stack > button { width: 100%; justify-content: flex-start; }

.stagger > * { animation: entra .45s cubic-bezier(.2, .7, .3, 1) backwards; }
.stagger > *:nth-child(1) { animation-delay: .01s } .stagger > *:nth-child(2) { animation-delay: .05s }
.stagger > *:nth-child(3) { animation-delay: .09s } .stagger > *:nth-child(4) { animation-delay: .13s }
.stagger > *:nth-child(n+5) { animation-delay: .17s }
@keyframes entra { from { opacity: 0; transform: translateY(10px); } }

/* ── Tarjetas ─────────────────────────────── */
.card {
  position: relative; background: var(--surface); border-radius: var(--r);
  padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--sombra);
}
.card.accent-edge { border-left: 3px solid var(--accent); }
.card.aviso { display: flex; gap: 12px; align-items: flex-start; background: linear-gradient(180deg, rgba(255, 182, 72, .1), var(--surface)); }
.card.aviso .ico { color: var(--warn); flex: none; }

/* ── Cabeceras con foto ───────────────────── */
.foto-hero {
  position: relative; border-radius: var(--r-lg); overflow: hidden; margin-bottom: 16px;
  min-height: 190px; display: flex; align-items: flex-end;
  background: linear-gradient(150deg, #2b313b, #1d2129);
  background-size: cover; background-position: center;
  box-shadow: var(--sombra);
}
.foto-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20, 22, 27, .35) 0%, rgba(20, 22, 27, .82) 70%, rgba(20, 22, 27, .95) 100%);
}
.foto-hero.con-foto { background-color: #14161b; }
.foto-hero > * { position: relative; z-index: 1; width: 100%; padding: 20px; }
.foto-hero .saludo { font-size: .8rem; color: var(--accent-2); font-weight: 600; letter-spacing: .04em; }
.foto-hero h1 { margin: 2px 0 0; font-size: 2rem; }

.foto-banda {
  position: relative; border-radius: var(--r); overflow: hidden; margin-bottom: 14px; min-height: 104px;
  display: flex; align-items: flex-end; background: linear-gradient(150deg, #2b313b, #1d2129);
  background-size: cover; background-position: center 35%;
}
.foto-banda::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20, 22, 27, .3), rgba(20, 22, 27, .9)); }
.foto-banda > * { position: relative; z-index: 1; padding: 14px 18px; width: 100%; }
.foto-banda h2 { font-size: 1.35rem; }
.foto-banda p { margin: 2px 0 0; color: var(--muted); font-size: .86rem; }

/* ── Datos ────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border-radius: 14px; padding: 13px 14px; box-shadow: var(--sombra); }
.tile .tiny { display: block; margin-bottom: 3px; }
.tile b { font-family: "Barlow Condensed", sans-serif; font-size: 1.85rem; font-weight: 700; display: block; line-height: 1; }
.tile u { text-decoration: none; color: var(--dim); font-size: .72rem; display: block; margin-top: 3px; }
.big-num { font-family: "Barlow Condensed", sans-serif; font-size: 1.6rem; }

.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring { width: 100px; height: 100px; flex: none; transform: rotate(-90deg); }
.ring .bg { fill: none; stroke: var(--surface-3); stroke-width: 9; }
.ring .fg { fill: none; stroke: url(#ringGrad); stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .9s cubic-bezier(.2,.8,.2,1); }
.ring-num { position: absolute; inset: 0; display: grid; place-items: center; font-family: "Barlow Condensed", sans-serif; }
.ring-num span { font-size: 1.7rem; font-weight: 700; }
.ring-num em { font-style: normal; color: var(--dim); font-size: 1rem; }

/* ── Botones ──────────────────────────────── */
button, .btn {
  font-family: inherit; font-size: .93rem; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 0; border-radius: 12px;
  padding: 12px 16px; min-height: 46px; cursor: pointer;
  transition: transform .1s, filter .18s, background .18s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:active { transform: scale(.975); }
button.primary { background: var(--grad); color: #221004; box-shadow: 0 6px 20px rgba(255, 106, 31, .26); }
button.primary:hover { filter: brightness(1.06); }
button.ghost { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
button.danger { color: var(--danger); background: rgba(255, 90, 104, .1); }
button.block { width: 100%; }
button.big { min-height: 54px; font-size: 1rem; }
button.sm { min-height: 38px; padding: 7px 13px; font-size: .84rem; border-radius: 10px; }
button.icon-btn { min-height: 40px; width: 40px; padding: 0; border-radius: 11px; }
button:disabled { opacity: .4; pointer-events: none; }
button.on { background: var(--accent-soft); color: var(--accent); }
.fab-row { position: sticky; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 12; display: flex; gap: 10px; margin-top: 18px; }
.fab-space { height: 78px; }
body.resting .fab-space { height: 132px; }

/* ── Formularios ──────────────────────────── */
input, select, textarea {
  font-family: inherit; font-size: 1rem; color: var(--text); background: var(--surface-2);
  border: 1px solid transparent; border-radius: 12px; padding: 12px 13px; min-height: 46px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--bg-alto); }
label { display: block; margin-bottom: 14px; }
label > span { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; }

/* ── Etiquetas ────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--surface-2); border-radius: 999px; padding: 8px 14px; font-size: .86rem;
  color: var(--muted); min-height: 0; font-weight: 500; }
.chip.on { background: var(--grad); color: #221004; font-weight: 600; }
.chip.sm { font-size: .76rem; padding: 5px 10px; }
.tag { font-size: .7rem; font-weight: 600; padding: 4px 9px; border-radius: 7px;
  background: var(--surface-3); color: var(--muted); display: inline-block; }
.scroll-x { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x .chip { flex: none; }

/* ── Listas y filas ───────────────────────── */
.fila { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.fila + .fila { box-shadow: inset 0 1px 0 var(--line); }
.fila-txt { flex: 1; min-width: 0; }
.fila-txt b { display: block; font-weight: 600; font-size: .95rem; }
.fila-txt span { color: var(--dim); font-size: .8rem; }
.fila .chev { color: var(--dim); flex: none; }
.ex-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: .88rem; }
.ex-line + .ex-line { box-shadow: inset 0 1px 0 var(--line); }
.pr-item { display: flex; align-items: center; gap: 13px; padding: 12px 0; cursor: pointer; }
.pr-item + .pr-item { box-shadow: inset 0 1px 0 var(--line); }
.pr-rank { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center;
  font-family: "Barlow Condensed", sans-serif; font-weight: 700; flex: none; }
.pr-item:first-child .pr-rank { background: var(--grad); color: #221004; }
.wk { padding-left: 2px; }

/* ── Rutinas ──────────────────────────────── */
.routine { background: var(--surface); border-radius: var(--r); padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--sombra); }
.routine.destacada { background: linear-gradient(140deg, #2f2419, var(--surface) 55%); }
.routine-top { display: flex; gap: 14px; align-items: flex-start; }
.dia-badge { font-size: .7rem; font-weight: 700; color: var(--accent); background: var(--accent-soft);
  padding: 4px 10px; border-radius: 999px; }
.mini-figs { display: flex; gap: 5px; flex: none; }
.mini-fig { width: 46px; height: 42px; border-radius: 10px; background: var(--bg-alto); overflow: hidden; display: grid; place-items: center; }
.mini-fig svg { width: 130%; height: 130%; }
.mini-fig.sm { width: 50px; height: 46px; cursor: pointer; }

/* ── Entreno en curso ─────────────────────── */
.live-head { position: sticky; top: calc(58px + env(safe-area-inset-top)); z-index: 15;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px);
  border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--sombra); }
.live-name { font-size: 1.15rem; font-weight: 700; min-height: 40px; padding: 5px 9px; background: transparent; }
.live-name:focus { background: var(--surface-2); }
.live-date { width: auto; font-size: .82rem; min-height: 40px; background: transparent; color: var(--muted); }
.live-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; text-align: center; }
.live-metrics b { font-family: "Barlow Condensed", sans-serif; font-size: 1.4rem; display: block; }
.progress-line { height: 4px; background: var(--surface-3); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.progress-line i { display: block; height: 100%; background: var(--grad); transition: width .35s; }
.rec-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); display: inline-block; animation: parpadeo 1.6s infinite; }
@keyframes parpadeo { 50% { opacity: .25; } }

.ex-card { background: var(--surface); border-radius: var(--r); margin-bottom: 12px; overflow: hidden; box-shadow: var(--sombra); }
.ex-card.en-superserie { box-shadow: var(--sombra), inset 3px 0 0 var(--accent); }
.ss-label { background: var(--accent-soft); color: var(--accent); font-size: .68rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; padding: 5px 18px; }
.ex-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; }
.ex-body { padding: 0 16px 16px; }
.last-time { font-size: .8rem; color: var(--dim); margin: 2px 0 12px; }
.sugerencia { display: flex; align-items: center; gap: 11px; background: var(--accent-soft);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; cursor: pointer; color: var(--accent); }
.sugerencia b { color: var(--text); }

.sets { width: 100%; border-collapse: separate; border-spacing: 0 7px; }
.sets th { font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); font-weight: 600;
  text-align: center; padding: 0 4px; }
.sets td { padding: 0 3px; }
.sets tr td:first-child { width: 36px; }
.sets .snum { width: 32px; height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--dim);
  display: grid; place-items: center; font-weight: 600; font-size: .86rem; }
.sets input { text-align: center; padding: 9px 4px; min-height: 44px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sets .ok-btn { width: 46px; min-height: 44px; padding: 0; border-radius: 11px; color: var(--dim); background: var(--surface-2); }
tr.done .snum { background: var(--accent-soft); color: var(--accent); }
tr.done input { background: rgba(255, 106, 31, .08); }
tr.done .ok-btn { background: var(--grad); color: #221004; }
tr.pr .snum { background: var(--grad); color: #221004; }

/* ── Buscador y biblioteca ────────────────── */
.buscador { display: flex; align-items: center; gap: 10px; background: var(--surface-2);
  border-radius: 13px; padding: 0 14px; color: var(--dim); }
.buscador input { background: none; border: 0; padding: 13px 0; }
.buscador input:focus { background: none; }

.ex-lista { background: var(--surface); border-radius: var(--r); overflow: hidden; box-shadow: var(--sombra); }
.ex-fila { display: flex; align-items: center; gap: 14px; padding: 13px 16px; width: 100%;
  background: none; border-radius: 0; min-height: 0; text-align: left; justify-content: flex-start; }
.ex-fila + .ex-fila { box-shadow: inset 0 1px 0 var(--line); }
.ex-fila:active { background: var(--surface-2); }
.ex-fila .mini-fig { width: 44px; height: 40px; flex: none; }
.ex-fila-txt { flex: 1; min-width: 0; }
.ex-fila-txt b { display: block; font-size: .93rem; font-weight: 600; }
.ex-fila-txt span { font-size: .78rem; color: var(--dim); }
.ex-fila .fav-on { color: var(--accent-2); flex: none; }

/* ── Ficha del ejercicio ──────────────────── */
.ficha-hero { border-radius: var(--r-lg); overflow: hidden; background: radial-gradient(75% 75% at 50% 25%, #2f3540, #1e222a); }
.ex-demo { background: none; }
.ex-demo.grande svg { max-height: 250px; margin: 0 auto; display: block; }
.pasos { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.pasos li::marker { color: var(--accent); font-weight: 700; }
.tip { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: .9rem; }
.tip .ico { color: var(--accent-2); flex: none; margin-top: 2px; }
.tip.malo .ico { color: var(--danger); }

/* ── Gráficas ─────────────────────────────── */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: rgba(255, 255, 255, .06); }
.chart .axis { fill: var(--dim); font-size: 17px; font-family: Inter, sans-serif; font-weight: 500; }
.chart .line { fill: none; stroke: url(#lineGrad); stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#areaGrad); }
.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 3; }
.chart .dot-last { fill: var(--accent); stroke: rgba(255, 106, 31, .25); stroke-width: 8; }
.bars rect { fill: var(--surface-3); rx: 4; }
.bars rect.on { fill: url(#lineGrad); }
.cal { width: 100%; height: auto; display: block; }

.bodymap { width: 100%; max-width: 320px; margin: 0 auto; display: block; }
.bodymap .part { fill: var(--surface-3); stroke: rgba(0, 0, 0, .3); stroke-width: .6; transition: fill .5s; }
.bodymap .skel { fill: #2b313b; }
.bodymap .lbl { fill: var(--dim); font-size: 7px; font-family: Inter, sans-serif; letter-spacing: .08em; font-weight: 600; }
.legend { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 10px; font-size: .74rem; color: var(--dim); }
.legend i { width: 48px; height: 7px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-3), var(--accent)); display: block; }
.center-chips { justify-content: center; margin-top: 12px; }

/* ── Volumen ──────────────────────────────── */
.vol-row { margin-bottom: 13px; }
.vol-bar { position: relative; height: 7px; background: var(--surface-3); border-radius: 5px; overflow: hidden; margin-top: 5px; }
.vol-bar i { display: block; height: 100%; background: var(--grad); }
.vol-bar i.bajo { background: #59616e; }
.vol-bar i.alto { background: linear-gradient(90deg, var(--warn), var(--danger)); }
.vol-bar u { position: absolute; top: -2px; width: 2px; height: 11px; background: rgba(255, 255, 255, .4); }
.num.bajo { color: var(--dim); } .num.ok { color: var(--ok); } .num.alto { color: var(--warn); }

/* ── Dieta ────────────────────────────────── */
.dieta-card { background: var(--surface); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 14px; box-shadow: var(--sombra); }
.dieta-top { padding: 18px; display: flex; gap: 14px; align-items: flex-start; }
.dieta-top.simple { background: linear-gradient(140deg, #223027, var(--surface) 60%); }
.dieta-top.completa { background: linear-gradient(140deg, #2d2519, var(--surface) 60%); }
.dieta-precio { font-family: "Barlow Condensed", sans-serif; font-size: 1.6rem; font-weight: 700; white-space: nowrap; }
.macros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 18px 16px; }
.macro { background: var(--bg-alto); border-radius: 12px; padding: 10px; text-align: center; }
.macro b { display: block; font-family: "Barlow Condensed", sans-serif; font-size: 1.3rem; }
.macro span { font-size: .68rem; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.comida { padding: 14px 18px; }
.comida + .comida { box-shadow: inset 0 1px 0 var(--line); }
.comida-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.comida-h b { font-size: .95rem; }
.comida-h span { font-size: .78rem; color: var(--dim); }
.comida ul { margin: 0; padding-left: 20px; color: var(--muted); font-size: .88rem; }
.comida li { margin: 3px 0; }
.compra { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.compra div { background: var(--bg-alto); border-radius: 10px; padding: 9px 12px; font-size: .85rem; display: flex; justify-content: space-between; gap: 8px; }
.compra span { color: var(--dim); }

/* ── Temporizador ─────────────────────────── */
.rest { position: fixed; z-index: 35; left: 50%; transform: translateX(-50%);
  bottom: calc(80px + env(safe-area-inset-bottom)); width: min(760px, calc(100vw - 20px)); overflow: hidden;
  background: var(--surface-2); border-radius: 14px; box-shadow: var(--sombra); }
.rest-fill { position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--accent-soft); transition: width .25s linear; }
.rest-content { position: relative; display: flex; align-items: center; gap: 8px; padding: 9px 11px; }
.rest-label { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.rest-time { font-family: "Barlow Condensed", sans-serif; font-size: 1.6rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; flex: 1; }
.rest-content button { min-height: 34px; padding: 4px 11px; font-size: .8rem; }
.rest-close { width: 38px; padding: 0; }
.rest.ended .rest-fill { background: rgba(67, 204, 132, .16); }
.rest.ended .rest-time { color: var(--ok); animation: destello .5s ease-in-out 5; }
@keyframes destello { 50% { transform: scale(1.08); } }
body.resting { padding-bottom: calc(148px + env(safe-area-inset-bottom)); }
body.resting .fab-row { bottom: calc(152px + env(safe-area-inset-bottom)); }
.confetti { position: fixed; inset: 0; z-index: 60; pointer-events: none; }

/* ── Navegación inferior ──────────────────── */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex;
  background: color-mix(in srgb, var(--bg-alto) 92%, transparent); backdrop-filter: blur(18px);
  box-shadow: 0 -1px 0 var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.tabbar button { flex: 1; flex-direction: column; gap: 4px; background: none; border-radius: 12px;
  color: var(--dim); font-size: .66rem; font-weight: 600; min-height: 52px; padding: 6px 2px; position: relative; }
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.active { color: var(--accent); }
.tabbar .live-dot { position: absolute; top: 7px; right: 50%; margin-right: -16px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--danger); animation: parpadeo 1.6s infinite; }

/* ── Diálogos ─────────────────────────────── */
dialog { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
dialog::backdrop { background: rgba(10, 11, 14, .72); backdrop-filter: blur(4px); }
#dlg-body { background: var(--bg-alto); border-radius: 22px 22px 0 0; width: 100vw; max-height: 88vh;
  overflow-y: auto; padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
  position: fixed; bottom: 0; left: 0; animation: sube .26s cubic-bezier(.2, .9, .3, 1); }
@keyframes sube { from { transform: translateY(40px); opacity: .5; } }
.sheet-grip { width: 42px; height: 4px; border-radius: 2px; background: var(--surface-3); margin: -6px auto 14px; }
.lista-sel { max-height: 44vh; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.lista-orden { margin: 6px 0 14px; padding-left: 20px; color: var(--muted); }

/* ── Creador de rutinas ───────────────────── */
.pasos-rutina { display: flex; gap: 6px; margin-bottom: 16px; }
.paso-punto { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.paso-punto.on { background: var(--accent); }
.grupo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.grupo-btn { flex-direction: column; gap: 8px; min-height: 88px; background: var(--surface-2); border-radius: 14px; padding: 14px 8px; }
.grupo-btn b { font-size: .88rem; }
.grupo-btn span { font-size: .7rem; color: var(--dim); }
.grupo-btn.on { background: var(--accent-soft); color: var(--accent); }
.sel-fila { display: flex; align-items: center; gap: 12px; padding: 11px 4px; width: 100%;
  background: none; border-radius: 10px; min-height: 0; justify-content: flex-start; text-align: left; }
.sel-fila + .sel-fila { box-shadow: inset 0 1px 0 var(--line); }
.sel-check { width: 24px; height: 24px; border-radius: 8px; background: var(--surface-3); flex: none;
  display: grid; place-items: center; color: transparent; }
.sel-fila.on .sel-check { background: var(--grad); color: #221004; }
.orden-lista { display: grid; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.orden-item { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.orden-item .num-orden { width: 24px; height: 24px; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center;
  font-size: .78rem; font-weight: 700; flex: none; }

/* ── Aviso flotante ───────────────────────── */
.toast { position: fixed; left: 50%; top: calc(66px + env(safe-area-inset-top));
  transform: translateX(-50%) translateY(-14px); z-index: 70; opacity: 0; transition: .26s; pointer-events: none;
  background: var(--surface-3); color: var(--text); padding: 12px 18px; border-radius: 13px;
  font-size: .88rem; font-weight: 500; box-shadow: var(--sombra); max-width: calc(100vw - 36px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.win { background: var(--grad); color: #221004; font-weight: 600; }

/* ── Acceso ───────────────────────────────── */
.gate { min-height: 82vh; display: grid; place-items: center; text-align: center; padding: 20px 0; }
.gate-card { max-width: 360px; width: 100%; }
.gate-card label { text-align: left; }
.brand-mark.big { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 20px; }
.brand-mark.big::after { inset: 20px 14px; }
.error-box { background: rgba(255, 90, 104, .12); color: #ffb0b7; border-radius: 11px; padding: 10px 13px;
  font-size: .86rem; margin: 0 0 14px; text-align: left; }
.sep { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--dim); font-size: .78rem; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-google { background: #fff; color: #1f1f1f; font-weight: 600; }

/* ── Figuras de ejercicio ─────────────────── */
.exfig { width: 100%; height: auto; display: block; color: var(--muted); }
.exfig .lm { fill: #58616e; }
.exfig .lm2 { fill: #4a525e; }
.exfig .lm3 { fill: #6d7786; }
.exfig .piel { fill: #6b7482; }
.exfig .sup { fill: #2b313b; }
.exfig .eq { fill: var(--accent); }
.exfig .hueco { fill: var(--surface); }
.exfig.en-ficha .hueco, .ficha-hero .exfig .hueco { fill: var(--bg-alto); }
.exfig .j { transform-box: view-box; transform: rotate(var(--a)); }
.exfig.anim .j { animation: giro var(--dur, 2.4s) cubic-bezier(.45, .05, .35, 1) infinite alternate; }
@keyframes giro { from { transform: rotate(var(--a)); } to { transform: rotate(var(--b)); } }
.exfig .fig { transform-box: view-box; transform: var(--t0); }
.exfig.anim .fig { animation: mueve var(--dur, 2.4s) cubic-bezier(.45, .05, .35, 1) infinite alternate; }
@keyframes mueve { from { transform: var(--t0); } to { transform: var(--t1); } }
.exfig .eqs { fill: var(--accent); }
.ex-demo.sm { max-width: 120px; }
@media (prefers-reduced-motion: reduce) { .exfig.anim .j, .exfig.anim .fig { animation: none; } }

/* ── Escritorio ───────────────────────────── */
@media (min-width: 900px) {
  body { padding-bottom: 24px; padding-left: 100px; }
  .tabbar { top: 0; bottom: 0; right: auto; width: 100px; flex-direction: column; justify-content: center; gap: 6px;
    box-shadow: 1px 0 0 var(--line); padding: 16px 10px; }
  .tabbar button { flex: 0; min-height: 66px; font-size: .68rem; }
  .tabbar .live-dot { top: 10px; right: 20px; margin: 0; }
  .topbar { padding-left: 26px; padding-right: 26px; }
  .rest { bottom: 22px; left: calc(50% + 50px); width: min(680px, calc(100vw - 150px)); }
  body.resting { padding-bottom: 92px; }
  body.resting .fab-row { bottom: 94px; }
  #dlg-body { position: static; width: min(580px, 94vw); border-radius: 22px; margin: auto; }
  dialog { display: grid; place-items: center; inset: 0; }
  dialog:not([open]) { display: none; }
  .fab-row { bottom: 22px; }
  .foto-hero { min-height: 230px; }
}
