:root {
  --bg: #000;
  --card: #1c1c1e;
  --card2: #2c2c2e;
  --card3: #3a3a3c;
  --text: #f2f2f7;
  --muted: #8e8e93;
  --accent: #ff9f0a;
  --green: #32d74b;
  --red: #ff453a;
  --fig: #f2f2f7;
  --fig-back: #6e6e73;
  --gear: #3a3a3c;
  --gear2: #545458;
  --weight: #ff9f0a;
  --cable: #8e8e93;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro", Inter, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

#app { padding: calc(var(--sat) + 8px) 16px calc(var(--sab) + 110px); max-width: 560px; margin: 0 auto; }

/* cabecera */
.top { display: flex; align-items: center; gap: 10px; padding: 8px 0 14px; }
.top h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.3px; }
.top .sub { color: var(--muted); font-size: 14px; }
.top .grow { flex: 1; min-width: 0; }
.back { width: 40px; height: 40px; border-radius: 12px; background: var(--card); display: grid; place-items: center; font-size: 22px; flex: none; }
.chip { font-size: 13px; padding: 6px 10px; border-radius: 999px; background: var(--card); color: var(--muted); font-weight: 600; }

/* inicio */
.hint { color: var(--muted); font-size: 15px; margin: 2px 0 12px; }
.hint b { color: var(--text); }
.day-card {
  display: block; position: relative; padding: 18px 18px 16px; border-radius: 20px; background: var(--card);
  margin: 0 0 12px; border-left: 6px solid var(--c); transition: transform .1s;
}
.day-card:active { transform: scale(.98); }
.day-card .num { font-size: 13px; font-weight: 700; color: var(--c); letter-spacing: 1px; }
.day-card .name { font-size: 26px; font-weight: 800; margin-top: 2px; }
.day-card .focus { color: var(--muted); font-size: 15px; }
.day-card .meta { color: var(--muted); font-size: 13px; margin-top: 10px; }
.day-card .badge { position: absolute; top: 16px; right: 16px; font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 999px; background: var(--c); color: #000; }
.day-card .badge.live { background: var(--green); animation: pulse 1.4s infinite; }
.note { color: var(--muted); font-size: 14px; font-style: italic; margin: 18px 4px; text-align: center; }

/* lista de ejercicios */
.ex-list { list-style: none; margin: 0; padding: 0; }
.ex-list a { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 16px; padding: 10px 14px 10px 10px; margin-bottom: 8px; }
.ex-list a:active { background: var(--card2); }
.thumb { width: 74px; height: 58px; border-radius: 10px; background: var(--card2); overflow: hidden; flex: none; }
.thumb svg { width: 100%; height: 100%; }
.ex-list .info { flex: 1; min-width: 0; }
.ex-list .name { font-weight: 600; font-size: 16px; }
.ex-list .scheme { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ex-list .prog { font-size: 14px; font-weight: 700; color: var(--muted); flex: none; }
.ex-list .prog.ok { color: var(--green); }
.ex-list .prog.part { color: var(--accent); }

/* barra inferior */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 16px calc(var(--sab) + 14px);
  background: linear-gradient(to top, #000 70%, transparent); display: flex; gap: 10px; max-width: 560px; margin: 0 auto;
}
.primary { flex: 1; height: 58px; border-radius: 16px; background: var(--accent); color: #000; font-size: 18px; font-weight: 800; }
.primary:active { filter: brightness(.9); }
.primary.green { background: var(--green); }
.secondary { height: 58px; padding: 0 20px; border-radius: 16px; background: var(--card2); font-weight: 700; }
.secondary:active { background: var(--card3); }

/* ejercicio */
.progress { height: 4px; border-radius: 2px; background: var(--card2); overflow: hidden; margin: 0 0 12px; }
.progress i { display: block; height: 100%; background: var(--c, var(--accent)); transition: width .3s; }
.fig { position: relative; aspect-ratio: 300 / 215; background: var(--card); border-radius: 22px; overflow: hidden; margin-bottom: 14px; }
.fig svg { width: 100%; height: 100%; display: block; }
.fig .timer { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); font-size: 84px; font-weight: 800; font-variant-numeric: tabular-nums; }
.scheme-line { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.scheme-line .set-label { font-size: 20px; font-weight: 800; }
.scheme-line .target { color: var(--muted); font-size: 15px; }
.sets { display: flex; gap: 6px; margin-bottom: 14px; }
.sets .s { flex: 1; height: 46px; border-radius: 12px; background: var(--card2); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.1; text-align: center; }
.sets .s.done { background: var(--green); color: #000; }
.sets .s.cur { outline: 2px solid var(--accent); color: var(--accent); }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stepper { background: var(--card); border-radius: 16px; padding: 8px 6px 6px; min-width: 0; }
.stepper label { display: block; text-align: center; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stepper .row { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; }
.stepper button { height: 48px; border-radius: 12px; font-size: 26px; font-weight: 600; background: var(--card2); }
.stepper button:active { background: var(--card3); }
.stepper input { width: 100%; min-width: 0; text-align: center; font: 800 30px/1 inherit; font-family: inherit; background: transparent; border: 0; color: var(--text); padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.undo { display: block; text-align: center; color: var(--muted); font-size: 14px; padding: 6px; margin-bottom: 8px; }

.tips { background: var(--card); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.tips h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 6px; }
.tips ol { margin: 0; padding-left: 18px; color: #d1d1d6; font-size: 15px; }
.tips li { margin: 4px 0; }
.nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.nav a, .nav span { flex: 1; text-align: center; padding: 12px; border-radius: 12px; background: var(--card); color: var(--muted); font-size: 14px; font-weight: 600; }
.nav a { color: var(--text); }

/* descanso */
#overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.94); z-index: 10; padding: calc(var(--sat) + 20px) 20px calc(var(--sab) + 20px); }
#overlay.show { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
#overlay .label { color: var(--muted); font-size: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.ring { position: relative; width: 240px; height: 240px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .t { position: absolute; inset: 0; display: grid; place-items: center; font-size: 68px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ring .t.go { color: var(--green); font-size: 54px; }
#overlay .next { text-align: center; font-size: 18px; }
#overlay .next b { display: block; font-size: 22px; margin-top: 2px; }
#overlay .btns { display: flex; gap: 10px; width: 100%; max-width: 360px; }
#overlay .btns button { flex: 1; height: 56px; border-radius: 16px; background: var(--card2); font-size: 17px; font-weight: 700; }
#overlay .btns button.skip { background: var(--accent); color: #000; }

/* resumen */
.done-hero { text-align: center; padding: 30px 0 10px; }
.done-hero .emoji { font-size: 64px; }
.done-hero h1 { font-size: 34px; font-weight: 900; margin-top: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.stat { background: var(--card); border-radius: 16px; padding: 14px 8px; text-align: center; }
.stat b { display: block; font-size: 24px; font-weight: 800; }
.stat span { color: var(--muted); font-size: 12px; }
.summary { list-style: none; margin: 0; padding: 0; }
.summary li { background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.summary .n { font-weight: 600; }
.summary .d { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* historial */
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { background: var(--card); border-radius: 16px; padding: 14px 16px; margin-bottom: 8px; border-left: 5px solid var(--c); }
.hist .h { display: flex; justify-content: space-between; align-items: baseline; }
.hist .h b { font-size: 17px; }
.hist .h span { color: var(--muted); font-size: 14px; }
.hist .m { color: var(--muted); font-size: 14px; margin-top: 4px; }
.hist details { margin-top: 8px; }
.hist summary { color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; }
.hist .del { color: var(--red); font-size: 13px; margin-top: 8px; display: inline-block; }
.empty { color: var(--muted); text-align: center; padding: 50px 20px; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
